File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33" @hey-api/shared " : patch
44---
55
6- ** output** : pass context as second argument in ` resolveModuleName ()` function
6+ ** output** : pass context as second argument in ` module.resolve ()` function
Original file line number Diff line number Diff line change 22" @hey-api/openapi-ts " : patch
33---
44
5- ** plugin(@hey-api/transformers )** : expose plugin in context
5+ ** plugin(@hey-api/transformers )** : expose plugin in transformer function context
Original file line number Diff line number Diff line change @@ -169,8 +169,7 @@ export type { UserConfig } from './config/types';
169169export { clientDefaultConfig , clientDefaultMeta } from './plugins/@hey-api/client-core/config' ;
170170export { clientPluginHandler } from './plugins/@hey-api/client-core/plugin' ;
171171export type { Client } from './plugins/@hey-api/client-core/types' ;
172- export type { ExpressionTransformer } from './plugins/@hey-api/transformers/expressions' ;
173- export type { TypeTransformer } from './plugins/@hey-api/transformers/types' ;
172+ export type { ExpressionTransformer , TypeTransformer } from './plugins/@hey-api/transformers/types' ;
174173export * from './ts-dsl' ;
175174export { Logger } from '@hey-api/codegen-core' ;
176175export type {
Original file line number Diff line number Diff line change 1- import type { IR } from '@hey-api/shared' ;
2- import type ts from 'typescript' ;
3-
41import { $ } from '../../../ts-dsl' ;
5- import type { HeyApiTransformersPlugin , UserConfig } from './types' ;
6-
7- export type ExpressionTransformer = ( ctx : {
8- /** @deprecated Use `plugin` instead and access the config via `plugin.config` */
9- config : Omit < UserConfig , 'name' > ;
10- dataExpression ?: ts . Expression | ReturnType < typeof $ . attr | typeof $ . expr > | string ;
11- plugin : HeyApiTransformersPlugin [ 'Instance' ] ;
12- schema : IR . SchemaObject ;
13- } ) => Array < ReturnType < typeof $ . fromValue > > | undefined ;
2+ import type { ExpressionTransformer } from './types' ;
143
154export const bigIntExpressions : ExpressionTransformer = ( { dataExpression, schema } ) => {
165 if ( schema . type !== 'integer' || schema . format !== 'int64' ) {
Original file line number Diff line number Diff line change @@ -2,13 +2,26 @@ import type { IR } from '@hey-api/shared';
22import type { DefinePlugin , Plugin } from '@hey-api/shared' ;
33import type ts from 'typescript' ;
44
5- import type { ExpressionTransformer } from './expressions' ;
5+ import type { $ , MaybeTsDsl , TsDsl } from '../../../ts-dsl' ;
6+
7+ interface BaseTransformer {
8+ plugin : HeyApiTransformersPlugin [ 'Instance' ] ;
9+ schema : IR . SchemaObject ;
10+ }
11+
12+ export type ExpressionTransformer = (
13+ ctx : BaseTransformer & {
14+ /** @deprecated Use `plugin` instead and access the config via `plugin.config` */
15+ config : Omit < UserConfig , 'name' > ;
16+ dataExpression ?: ts . Expression | ReturnType < typeof $ . attr | typeof $ . expr > | string ;
17+ } ,
18+ ) => Array < TsDsl < ts . Expression > > | undefined ;
619
720/**
821 * Returns the TypeScript type node for a schema with a specific format.
922 * If undefined is returned, the default type will be used.
1023 */
11- export type TypeTransformer = ( { schema } : { schema : IR . SchemaObject } ) => ts . TypeNode | undefined ;
24+ export type TypeTransformer = ( ctx : BaseTransformer ) => MaybeTsDsl < ts . TypeNode > | undefined ;
1225
1326export type UserConfig = Plugin . Name < '@hey-api/transformers' > &
1427 Plugin . Hooks &
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ export function createVisitor(
9494 const transformersPlugin = ctx . plugin . getPlugin ( '@hey-api/transformers' ) ;
9595 if ( transformersPlugin ?. config . typeTransformers ) {
9696 for ( const typeTransformer of transformersPlugin . config . typeTransformers ) {
97- const typeNode = typeTransformer ( { schema } ) ;
97+ const typeNode = typeTransformer ( { plugin : transformersPlugin , schema } ) ;
9898 if ( typeNode ) {
9999 return { meta : defaultMeta ( schema ) , type : typeNode } ;
100100 }
You can’t perform that action at this time.
0 commit comments