@@ -93,21 +93,21 @@ function baseCreate(
93
93
rootPath : string ,
94
94
globalComponentName : string ,
95
95
) {
96
- let [ commandLine , _fileNames ] = getConfigAndFiles ( ) ;
96
+ let [ { vueOptions , options , projectReferences } , fileNames ] = getConfigAndFiles ( ) ;
97
97
/**
98
98
* Used to lookup if a file is referenced.
99
99
*/
100
- let fileNames = new Set ( _fileNames . map ( path => path . replace ( windowsPathReg , '/' ) ) ) ;
100
+ let fileNamesSet = new Set ( fileNames . map ( path => path . replace ( windowsPathReg , '/' ) ) ) ;
101
101
let projectVersion = 0 ;
102
102
103
- vue . writeGlobalTypes ( commandLine . vueOptions , ts . sys . writeFile ) ;
103
+ vueOptions . globalTypesPath = vue . createGlobalTypesWriter ( vueOptions , ts . sys . writeFile ) ;
104
104
105
105
const projectHost : TypeScriptProjectHost = {
106
106
getCurrentDirectory : ( ) => rootPath ,
107
107
getProjectVersion : ( ) => projectVersion . toString ( ) ,
108
- getCompilationSettings : ( ) => commandLine . options ,
109
- getScriptFileNames : ( ) => [ ...fileNames ] ,
110
- getProjectReferences : ( ) => commandLine . projectReferences ,
108
+ getCompilationSettings : ( ) => options ,
109
+ getScriptFileNames : ( ) => [ ...fileNamesSet ] ,
110
+ getProjectReferences : ( ) => projectReferences ,
111
111
} ;
112
112
const globalComponentSnapshot = ts . ScriptSnapshot . fromString ( '<script setup lang="ts"></script>' ) ;
113
113
const scriptSnapshots = new Map < string , ts . IScriptSnapshot | undefined > ( ) ;
@@ -126,7 +126,7 @@ function baseCreate(
126
126
const vueLanguagePlugin = vue . createVueLanguagePlugin < string > (
127
127
ts ,
128
128
projectHost . getCompilationSettings ( ) ,
129
- commandLine . vueOptions ,
129
+ vueOptions ,
130
130
id => id ,
131
131
) ;
132
132
const language = vue . createLanguage (
@@ -179,7 +179,7 @@ function baseCreate(
179
179
const getScriptKind = languageServiceHost . getScriptKind ?. bind ( languageServiceHost ) ;
180
180
languageServiceHost . getScriptKind = fileName => {
181
181
const scriptKind = getScriptKind ! ( fileName ) ;
182
- if ( commandLine . vueOptions . extensions . some ( ext => fileName . endsWith ( ext ) ) ) {
182
+ if ( vueOptions . extensions . some ( ext => fileName . endsWith ( ext ) ) ) {
183
183
if ( scriptKind === ts . ScriptKind . JS ) {
184
184
return ts . ScriptKind . TS ;
185
185
}
@@ -200,17 +200,18 @@ function baseCreate(
200
200
fileName = fileName . replace ( windowsPathReg , '/' ) ;
201
201
scriptSnapshots . set ( fileName , ts . ScriptSnapshot . fromString ( text ) ) ;
202
202
// Ensure the file is referenced
203
- fileNames . add ( fileName ) ;
203
+ fileNamesSet . add ( fileName ) ;
204
204
projectVersion ++ ;
205
205
} ,
206
206
deleteFile ( fileName : string ) {
207
207
fileName = fileName . replace ( windowsPathReg , '/' ) ;
208
- fileNames . delete ( fileName ) ;
208
+ fileNamesSet . delete ( fileName ) ;
209
209
projectVersion ++ ;
210
210
} ,
211
211
reload ( ) {
212
- [ commandLine , _fileNames ] = getConfigAndFiles ( ) ;
213
- fileNames = new Set ( _fileNames . map ( path => path . replace ( windowsPathReg , '/' ) ) ) ;
212
+ [ { vueOptions, options, projectReferences } , fileNames ] = getConfigAndFiles ( ) ;
213
+ vueOptions . globalTypesPath = vue . createGlobalTypesWriter ( vueOptions , ts . sys . writeFile ) ;
214
+ fileNamesSet = new Set ( fileNames . map ( path => path . replace ( windowsPathReg , '/' ) ) ) ;
214
215
this . clearCache ( ) ;
215
216
} ,
216
217
clearCache ( ) {
@@ -228,7 +229,7 @@ function baseCreate(
228
229
229
230
function getMetaFileName ( fileName : string ) {
230
231
return (
231
- commandLine . vueOptions . extensions . some ( ext => fileName . endsWith ( ext ) )
232
+ vueOptions . extensions . some ( ext => fileName . endsWith ( ext ) )
232
233
? fileName
233
234
: fileName . slice ( 0 , fileName . lastIndexOf ( '.' ) )
234
235
) + '.meta.ts' ;
0 commit comments