@@ -525,15 +525,6 @@ export function generateMethods(
525
525
526
526
METHOD_TYPES . forEach ( ( method ) => {
527
527
// Hoist file path and key declaration for this hook
528
- const normalized = normalizePath ( path ) ;
529
- const fileName = `${ options . hooks ?. path ?? 'hooks' } /${ normalized } _${ method } .ts` ;
530
- const keyName = `${ normalized . toUpperCase ( ) } _KEY` ;
531
- const keyDecl = t . variableDeclaration ( 'const' , [
532
- t . variableDeclarator (
533
- t . identifier ( keyName ) ,
534
- t . arrayExpression ( [ t . stringLiteral ( normalized ) ] )
535
- ) ,
536
- ] ) ;
537
528
const operation = ( pathItem as any ) [ method ] as Operation ;
538
529
if ( ! operation || ! shouldIncludeOperation ( options , pathItem , path , method as any ) ) {
539
530
return ;
@@ -660,7 +651,6 @@ export interface HookComponent {
660
651
importDecls : t . ImportDeclaration [ ] ;
661
652
funcDecl : t . ExportNamedDeclaration ;
662
653
constDecls : t . VariableDeclaration [ ] ;
663
- fileName : string ;
664
654
}
665
655
666
656
/**
@@ -805,7 +795,7 @@ export function collectReactQueryHookComponents(
805
795
[ ]
806
796
) ;
807
797
808
- components . push ( { importDecls, funcDecl, constDecls : [ keyDecl ] , fileName : ` ${ options . hooks . path } / ${ hookName } .ts` } ) ;
798
+ components . push ( { importDecls, funcDecl, constDecls : [ keyDecl ] } ) ;
809
799
} else {
810
800
importDecls . push (
811
801
t . importDeclaration ( [
@@ -891,7 +881,7 @@ export function collectReactQueryHookComponents(
891
881
[ ]
892
882
) ;
893
883
894
- components . push ( { importDecls, funcDecl, constDecls : [ keyDecl ] , fileName : ` ${ options . hooks . path } / ${ hookName } .ts` } ) ;
884
+ components . push ( { importDecls, funcDecl, constDecls : [ keyDecl ] } ) ;
895
885
}
896
886
} ) ;
897
887
} ) ;
@@ -905,10 +895,9 @@ export function collectReactQueryHookComponents(
905
895
export function generateReactQueryHooks (
906
896
options : OpenAPIOptions ,
907
897
schema : OpenAPISpec
908
- ) : HookFile [ ] {
898
+ ) : string {
909
899
const components = collectReactQueryHookComponents ( options , schema ) ;
910
- if ( ! components . length ) return [ ] ;
911
- const basePath = options . hooks ?. path ?? 'hooks' ;
900
+ if ( ! components . length ) return ''
912
901
// Group imports
913
902
const importMap = new Map < string , Set < string > > ( ) ;
914
903
// Collect unique imports and consts
@@ -946,7 +935,7 @@ export function generateReactQueryHooks(
946
935
// Build AST and generate code
947
936
const ast = t . file ( t . program ( [ ...uniqueImportDecls , ...uniqueConstDecls , ...funcDecls ] ) ) ;
948
937
const code = generate ( ast ) . code ;
949
- return [ { fileName : ` ${ basePath } /index.ts` , code } ] ;
938
+ return code ;
950
939
}
951
940
952
941
/**
0 commit comments