@@ -36,13 +36,10 @@ export function createParsedCommandLineByJson(
36
36
37
37
const resolvedVueOptions = resolveVueCompilerOptions ( vueOptions ) ;
38
38
if ( skipGlobalTypesSetup ) {
39
- resolvedVueOptions . __setupedGlobalTypes = { } ;
39
+ resolvedVueOptions . __setupedGlobalTypes = true ;
40
40
}
41
41
else {
42
- const absolutePath = setupGlobalTypes ( rootDir , resolvedVueOptions , parseConfigHost ) ;
43
- if ( absolutePath ) {
44
- resolvedVueOptions . __setupedGlobalTypes = { absolutePath } ;
45
- }
42
+ resolvedVueOptions . __setupedGlobalTypes = setupGlobalTypes ( rootDir , resolvedVueOptions , parseConfigHost ) ;
46
43
}
47
44
const parsed = ts . parseJsonConfigFileContent (
48
45
json ,
@@ -94,13 +91,10 @@ export function createParsedCommandLine(
94
91
95
92
const resolvedVueOptions = resolveVueCompilerOptions ( vueOptions ) ;
96
93
if ( skipGlobalTypesSetup ) {
97
- resolvedVueOptions . __setupedGlobalTypes = { } ;
94
+ resolvedVueOptions . __setupedGlobalTypes = true ;
98
95
}
99
96
else {
100
- const absolutePath = setupGlobalTypes ( path . dirname ( tsConfigPath ) , resolvedVueOptions , parseConfigHost ) ;
101
- if ( absolutePath ) {
102
- resolvedVueOptions . __setupedGlobalTypes = { absolutePath } ;
103
- }
97
+ resolvedVueOptions . __setupedGlobalTypes = setupGlobalTypes ( path . dirname ( tsConfigPath ) , resolvedVueOptions , parseConfigHost ) ;
104
98
}
105
99
const parsed = ts . parseJsonSourceFileConfigFileContent (
106
100
config ,
@@ -287,7 +281,7 @@ export function resolveVueCompilerOptions(vueOptions: Partial<VueCompilerOptions
287
281
export function setupGlobalTypes ( rootDir : string , vueOptions : VueCompilerOptions , host : {
288
282
fileExists ( path : string ) : boolean ;
289
283
writeFile ?( path : string , data : string ) : void ;
290
- } ) {
284
+ } ) : { absolutePath : string ; } | undefined {
291
285
if ( ! host . writeFile ) {
292
286
return ;
293
287
}
@@ -303,6 +297,6 @@ export function setupGlobalTypes(rootDir: string, vueOptions: VueCompilerOptions
303
297
const globalTypesPath = path . join ( dir , 'node_modules' , '.vue-global-types' , `${ vueOptions . lib } _${ vueOptions . target } _${ vueOptions . strictTemplates } .d.ts` ) ;
304
298
const globalTypesContents = `// @ts-nocheck\nexport {};\n` + generateGlobalTypes ( vueOptions . lib , vueOptions . target , vueOptions . strictTemplates ) ;
305
299
host . writeFile ( globalTypesPath , globalTypesContents ) ;
306
- return globalTypesPath ;
300
+ return { absolutePath : globalTypesPath } ;
307
301
} catch { }
308
302
}
0 commit comments