File tree Expand file tree Collapse file tree 4 files changed +14
-8
lines changed
playground-nuxt/app/graphql Expand file tree Collapse file tree 4 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 33/* tslint:disable */
44/* eslint-disable */
55/* prettier-ignore */
6- import * as Types from '#graphql/client' ;
6+ import type * as Types from '#graphql/client' ;
77
88export type CreateUserMutationVariables = Types . Exact < {
99 input : Types . CreateUserInput ;
Original file line number Diff line number Diff line change @@ -162,10 +162,11 @@ export async function generateClientTypes(
162162 NonEmptyString : 'string' ,
163163 Currency : 'string' ,
164164 } ,
165+ useTypeImports : true ,
166+
165167 } ,
166168 presetConfig : {
167169 typesPath : '#graphql/client' ,
168-
169170 } ,
170171 plugins : [
171172 { pluginContent : { } } ,
Original file line number Diff line number Diff line change 11import type { VueTSConfig } from '@nuxt/schema'
2- import { addImportsDir , defineNuxtModule } from '@nuxt/kit'
3- import { join } from 'pathe'
2+ import { defineNuxtModule } from '@nuxt/kit'
3+ import { join , resolve } from 'pathe'
44
55export interface ModuleOptions {
66
@@ -14,8 +14,7 @@ export default defineNuxtModule<ModuleOptions>({
1414 nuxt : '>=3.16.0' ,
1515 } ,
1616 } ,
17- defaults : { } ,
18- setup : ( options , nuxt ) => {
17+ setup : async ( _options , nuxt ) => {
1918 nuxt . hooks . hook ( 'prepare:types' , ( options ) => {
2019 options . references . push ( { path : 'types/nitro-graphql-client.d.ts' } )
2120
@@ -33,6 +32,8 @@ export default defineNuxtModule<ModuleOptions>({
3332 nuxt . options . alias = nuxt . options . alias || { }
3433 nuxt . options . alias [ '#graphql/client' ] = join ( nuxt . options . buildDir , 'types/nitro-graphql-client.d.ts' )
3534
36- addImportsDir ( join ( nuxt . options . srcDir , 'graphql' ) )
35+ nuxt . hook ( 'imports:dirs' , ( dirs ) => {
36+ dirs . push ( resolve ( nuxt . options . srcDir , 'graphql' ) )
37+ } )
3738 } ,
3839} )
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export default defineNitroModule({
3131 default :
3232 }
3333
34- watch ( watchDirs , {
34+ const watcher = watch ( watchDirs , {
3535 persistent : true ,
3636 ignoreInitial : true ,
3737 ignored : nitro . options . ignore ,
@@ -41,6 +41,10 @@ export default defineNitroModule({
4141 }
4242 } )
4343
44+ nitro . hooks . hook ( 'close' , ( ) => {
45+ watcher . close ( )
46+ } )
47+
4448 const tsConfigPath = resolve (
4549 nitro . options . buildDir ,
4650 nitro . options . typescript . tsconfigPath ,
You can’t perform that action at this time.
0 commit comments