@@ -93,21 +93,21 @@ function baseCreate(
9393 rootPath : string ,
9494 globalComponentName : string ,
9595) {
96- let [ commandLine , _fileNames ] = getConfigAndFiles ( ) ;
96+ let [ { vueOptions , options , projectReferences } , fileNames ] = getConfigAndFiles ( ) ;
9797 /**
9898 * Used to lookup if a file is referenced.
9999 */
100- let fileNames = new Set ( _fileNames . map ( path => path . replace ( windowsPathReg , '/' ) ) ) ;
100+ let fileNamesSet = new Set ( fileNames . map ( path => path . replace ( windowsPathReg , '/' ) ) ) ;
101101 let projectVersion = 0 ;
102102
103- vue . writeGlobalTypes ( commandLine . vueOptions , ts . sys . writeFile ) ;
103+ vueOptions . globalTypesPath = vue . createGlobalTypesWriter ( vueOptions , ts . sys . writeFile ) ;
104104
105105 const projectHost : TypeScriptProjectHost = {
106106 getCurrentDirectory : ( ) => rootPath ,
107107 getProjectVersion : ( ) => projectVersion . toString ( ) ,
108- getCompilationSettings : ( ) => commandLine . options ,
109- getScriptFileNames : ( ) => [ ...fileNames ] ,
110- getProjectReferences : ( ) => commandLine . projectReferences ,
108+ getCompilationSettings : ( ) => options ,
109+ getScriptFileNames : ( ) => [ ...fileNamesSet ] ,
110+ getProjectReferences : ( ) => projectReferences ,
111111 } ;
112112 const globalComponentSnapshot = ts . ScriptSnapshot . fromString ( '<script setup lang="ts"></script>' ) ;
113113 const scriptSnapshots = new Map < string , ts . IScriptSnapshot | undefined > ( ) ;
@@ -126,7 +126,7 @@ function baseCreate(
126126 const vueLanguagePlugin = vue . createVueLanguagePlugin < string > (
127127 ts ,
128128 projectHost . getCompilationSettings ( ) ,
129- commandLine . vueOptions ,
129+ vueOptions ,
130130 id => id ,
131131 ) ;
132132 const language = vue . createLanguage (
@@ -179,7 +179,7 @@ function baseCreate(
179179 const getScriptKind = languageServiceHost . getScriptKind ?. bind ( languageServiceHost ) ;
180180 languageServiceHost . getScriptKind = fileName => {
181181 const scriptKind = getScriptKind ! ( fileName ) ;
182- if ( commandLine . vueOptions . extensions . some ( ext => fileName . endsWith ( ext ) ) ) {
182+ if ( vueOptions . extensions . some ( ext => fileName . endsWith ( ext ) ) ) {
183183 if ( scriptKind === ts . ScriptKind . JS ) {
184184 return ts . ScriptKind . TS ;
185185 }
@@ -200,17 +200,18 @@ function baseCreate(
200200 fileName = fileName . replace ( windowsPathReg , '/' ) ;
201201 scriptSnapshots . set ( fileName , ts . ScriptSnapshot . fromString ( text ) ) ;
202202 // Ensure the file is referenced
203- fileNames . add ( fileName ) ;
203+ fileNamesSet . add ( fileName ) ;
204204 projectVersion ++ ;
205205 } ,
206206 deleteFile ( fileName : string ) {
207207 fileName = fileName . replace ( windowsPathReg , '/' ) ;
208- fileNames . delete ( fileName ) ;
208+ fileNamesSet . delete ( fileName ) ;
209209 projectVersion ++ ;
210210 } ,
211211 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 , '/' ) ) ) ;
214215 this . clearCache ( ) ;
215216 } ,
216217 clearCache ( ) {
@@ -228,7 +229,7 @@ function baseCreate(
228229
229230 function getMetaFileName ( fileName : string ) {
230231 return (
231- commandLine . vueOptions . extensions . some ( ext => fileName . endsWith ( ext ) )
232+ vueOptions . extensions . some ( ext => fileName . endsWith ( ext ) )
232233 ? fileName
233234 : fileName . slice ( 0 , fileName . lastIndexOf ( '.' ) )
234235 ) + '.meta.ts' ;
0 commit comments