File tree Expand file tree Collapse file tree 5 files changed +13
-16
lines changed
plugins/@hey-api/transformers Expand file tree Collapse file tree 5 files changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ export {
124124} from './plugins/@hey-api/client-core/config' ;
125125export { clientPluginHandler } from './plugins/@hey-api/client-core/plugin' ;
126126export type { Client } from './plugins/@hey-api/client-core/types' ;
127- export type { expressionTransformer } from './plugins/@hey-api/transformers' ;
127+ export type { ExpressionTransformer } from './plugins/@hey-api/transformers/expressions ' ;
128128export { definePluginConfig } from './plugins/shared/utils/config' ;
129129export type { DefinePlugin , Plugin } from './plugins/types' ;
130130export type { UserConfig } from './types/config' ;
Original file line number Diff line number Diff line change @@ -5,24 +5,24 @@ import type { TypeScriptFile } from '../../../generate/files';
55import type { IR } from '../../../ir/types' ;
66import type { Config } from './types' ;
77
8- export type expressionTransformer = ( {
8+ export type ExpressionTransformer = ( {
99 config,
1010 dataExpression,
1111 file,
1212 schema,
1313} : {
14- config : Config ;
14+ config : Omit < Config , 'name' > ;
1515 dataExpression ?: ts . Expression | string ;
1616 file : TypeScriptFile ;
1717 schema : IR . SchemaObject ;
1818} ) => Array < ts . Expression > | undefined ;
1919
20- export const bigIntExpressions : expressionTransformer = ( {
20+ export const bigIntExpressions : ExpressionTransformer = ( {
2121 dataExpression,
2222 schema,
2323} ) => {
2424 if ( schema . type !== 'integer' || schema . format !== 'int64' ) {
25- return undefined ;
25+ return ;
2626 }
2727
2828 const bigIntCallExpression =
@@ -55,18 +55,18 @@ export const bigIntExpressions: expressionTransformer = ({
5555 }
5656 }
5757
58- return [ ] ;
58+ return ;
5959} ;
6060
61- export const dateExpressions : expressionTransformer = ( {
61+ export const dateExpressions : ExpressionTransformer = ( {
6262 dataExpression,
6363 schema,
6464} ) => {
6565 if (
6666 schema . type !== 'string' ||
6767 ! ( schema . format === 'date' || schema . format === 'date-time' )
6868 ) {
69- return undefined ;
69+ return ;
7070 }
7171
7272 const identifierDate = compiler . identifier ( { text : 'Date' } ) ;
@@ -92,5 +92,5 @@ export const dateExpressions: expressionTransformer = ({
9292 ] ;
9393 }
9494
95- return [ ] ;
95+ return ;
9696} ;
Original file line number Diff line number Diff line change 11export { compiler } from '../../../compiler' ;
22export { defaultConfig , defineConfig } from './config' ;
3- export { type expressionTransformer } from './expressions-transformers' ;
43export type { HeyApiTransformersPlugin } from './types' ;
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import { irRef } from '../../../utils/ref';
1010import { stringCase } from '../../../utils/stringCase' ;
1111import { operationIrRef } from '../../shared/utils/ref' ;
1212import { typesId } from '../typescript/ref' ;
13- import { bigIntExpressions , dateExpressions } from './expressions-transformers ' ;
13+ import { bigIntExpressions , dateExpressions } from './expressions' ;
1414import type { HeyApiTransformersPlugin } from './types' ;
1515
1616interface OperationIRRef {
Original file line number Diff line number Diff line change 11import type { DefinePlugin , Plugin } from '../../types' ;
2+ import type { ExpressionTransformer } from './expressions' ;
23
34export type Config = Plugin . Name < '@hey-api/transformers' > & {
45 /**
@@ -26,13 +27,10 @@ export type Config = Plugin.Name<'@hey-api/transformers'> & {
2627 * @default 'transformers'
2728 */
2829 output ?: string ;
29-
3030 /**
31- * transformers to apply to the generated code
32- * @default []
31+ * Custom transforms to apply to the generated code.
3332 */
34-
35- transformers ?: expressionTransformer [ ] ;
33+ transformers ?: ReadonlyArray < ExpressionTransformer > ;
3634} ;
3735
3836export type HeyApiTransformersPlugin = DefinePlugin < Config > ;
You can’t perform that action at this time.
0 commit comments