@@ -525,15 +525,6 @@ export function generateMethods(
525525
526526 METHOD_TYPES . forEach ( ( method ) => {
527527 // 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- ] ) ;
537528 const operation = ( pathItem as any ) [ method ] as Operation ;
538529 if ( ! operation || ! shouldIncludeOperation ( options , pathItem , path , method as any ) ) {
539530 return ;
@@ -660,7 +651,6 @@ export interface HookComponent {
660651 importDecls : t . ImportDeclaration [ ] ;
661652 funcDecl : t . ExportNamedDeclaration ;
662653 constDecls : t . VariableDeclaration [ ] ;
663- fileName : string ;
664654}
665655
666656/**
@@ -805,7 +795,7 @@ export function collectReactQueryHookComponents(
805795 [ ]
806796 ) ;
807797
808- components . push ( { importDecls, funcDecl, constDecls : [ keyDecl ] , fileName : ` ${ options . hooks . path } / ${ hookName } .ts` } ) ;
798+ components . push ( { importDecls, funcDecl, constDecls : [ keyDecl ] } ) ;
809799 } else {
810800 importDecls . push (
811801 t . importDeclaration ( [
@@ -891,7 +881,7 @@ export function collectReactQueryHookComponents(
891881 [ ]
892882 ) ;
893883
894- components . push ( { importDecls, funcDecl, constDecls : [ keyDecl ] , fileName : ` ${ options . hooks . path } / ${ hookName } .ts` } ) ;
884+ components . push ( { importDecls, funcDecl, constDecls : [ keyDecl ] } ) ;
895885 }
896886 } ) ;
897887 } ) ;
@@ -905,10 +895,9 @@ export function collectReactQueryHookComponents(
905895export function generateReactQueryHooks (
906896 options : OpenAPIOptions ,
907897 schema : OpenAPISpec
908- ) : HookFile [ ] {
898+ ) : string {
909899 const components = collectReactQueryHookComponents ( options , schema ) ;
910- if ( ! components . length ) return [ ] ;
911- const basePath = options . hooks ?. path ?? 'hooks' ;
900+ if ( ! components . length ) return ''
912901 // Group imports
913902 const importMap = new Map < string , Set < string > > ( ) ;
914903 // Collect unique imports and consts
@@ -946,7 +935,7 @@ export function generateReactQueryHooks(
946935 // Build AST and generate code
947936 const ast = t . file ( t . program ( [ ...uniqueImportDecls , ...uniqueConstDecls , ...funcDecls ] ) ) ;
948937 const code = generate ( ast ) . code ;
949- return [ { fileName : ` ${ basePath } /index.ts` , code } ] ;
938+ return code ;
950939}
951940
952941/**
0 commit comments