@@ -37,7 +37,7 @@ export const generate = async ({ moduleConfig, nuxt }: GenerateArgs) => {
37
37
const collectionKebab = kebabCase ( collectionName ) ;
38
38
const openApiTsFilePath = `${ moduleFolderName } /${ collectionKebab } /${ openApiTsFileName } .ts` ;
39
39
40
- const { dst : openAPITSTypesDST } = addTemplate ( {
40
+ addTemplate ( {
41
41
filename : openApiTsFilePath ,
42
42
getContents : async ( ) => {
43
43
const openApiTs = await getOpenApiTs ( {
@@ -150,8 +150,6 @@ export const ${useLazyClientName}: UseLazyFetch<${pathsTypeName}> = (path, opts?
150
150
if ( clientConfig . nitro !== false ) {
151
151
const nitroClientPath = `${ moduleFolderName } /${ collectionKebab } /nitro` ;
152
152
153
- addNitroTsFile ( nuxt , openAPITSTypesDST , false ) ;
154
-
155
153
const { dst } = addTemplate ( {
156
154
filename : `${ nitroClientPath } .ts` ,
157
155
getContents :
@@ -179,8 +177,6 @@ export const ${clientName}: NitroFetch<${pathsTypeName}> = (path, opts) => {
179
177
write : true ,
180
178
} ) ;
181
179
182
- addNitroTsFile ( nuxt , dst , true ) ;
183
-
184
180
addedNitroClientsDirNames . add ( collectionKebab ) ;
185
181
186
182
if ( clientConfig . nitro . autoImport ) {
@@ -225,7 +221,7 @@ export const ${clientName}: NitroFetch<${pathsTypeName}> = (path, opts) => {
225
221
}
226
222
227
223
if ( addedNitroClientsDirNames . size > 0 ) {
228
- const { dst } = addTemplate ( {
224
+ addTemplate ( {
229
225
filename : `${ moduleFolderName } /nitro.ts` ,
230
226
getContents : ( ) => {
231
227
const result = addedNitroClientsDirNames
@@ -242,8 +238,6 @@ export const ${clientName}: NitroFetch<${pathsTypeName}> = (path, opts) => {
242
238
write : true ,
243
239
} ) ;
244
240
245
- addNitroTsFile ( nuxt , dst , true ) ;
246
-
247
241
nuxt . hook ( 'nitro:config' , ( nitro ) => {
248
242
nitro . alias ??= { } ;
249
243
nitro . alias [ `#${ moduleFolderName } ` ] = path . join (
@@ -305,8 +299,7 @@ const getOpenApiTs = async ({
305
299
nuxt,
306
300
collectionName,
307
301
} ) ;
308
-
309
- return await openapiTS ( new URL ( openAPIFilePath ) , openApiTsConfig ) ;
302
+ return await openapiTS ( new URL ( `file://${ openAPIFilePath } ` ) , openApiTsConfig ) ;
310
303
} ;
311
304
312
305
type DiscoverOpenApiObjectFilePathArgs = {
@@ -347,22 +340,6 @@ const discoverOpenApiObjectFilePath = ({
347
340
) ;
348
341
} ;
349
342
350
- const addNitroTsFile = (
351
- nuxt : Nuxt ,
352
- file : string ,
353
- nuxtIgnore : boolean = false ,
354
- ) => {
355
- nuxt . options . nitro . typescript ??= { } ;
356
- nuxt . options . nitro . typescript . tsConfig ??= { } ;
357
- nuxt . options . nitro . typescript . tsConfig . include ??= [ ] ;
358
- nuxt . options . nitro . typescript . tsConfig . include . push ( file ) ;
359
-
360
- if ( nuxtIgnore ) {
361
- nuxt . options . typescript . tsConfig . exclude ??= [ ] ;
362
- nuxt . options . typescript . tsConfig . exclude . push ( file ) ;
363
- }
364
- } ;
365
-
366
343
const resolveClientConfig = (
367
344
moduleConfig : ResolvedConfig [ 'clients' ] ,
368
345
apiConfig : ApiConfig [ 'clients' ] ,
0 commit comments