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