1
1
import { createLanguageServiceHost , resolveFileLanguageId , type TypeScriptProjectHost } from '@volar/typescript' ;
2
- import * as vue from '@vue/language-core' ;
2
+ import * as core from '@vue/language-core' ;
3
3
import { posix as path } from 'path-browserify' ;
4
4
import type * as ts from 'typescript' ;
5
5
@@ -28,15 +28,15 @@ export function createCheckerByJsonConfigBase(
28
28
return baseCreate (
29
29
ts ,
30
30
( ) => {
31
- const commandLine = vue . createParsedCommandLineByJson ( ts , ts . sys , rootDir , json ) ;
31
+ const commandLine = core . createParsedCommandLineByJson ( ts , ts . sys , rootDir , json ) ;
32
32
const { fileNames } = ts . parseJsonConfigFileContent (
33
33
json ,
34
34
ts . sys ,
35
35
rootDir ,
36
36
{ } ,
37
37
undefined ,
38
38
undefined ,
39
- vue . getAllExtensions ( commandLine . vueOptions )
39
+ core . getAllExtensions ( commandLine . vueOptions )
40
40
. map ( extension => ( {
41
41
extension : extension . slice ( 1 ) ,
42
42
isMixedContent : true ,
@@ -60,15 +60,15 @@ export function createCheckerBase(
60
60
return baseCreate (
61
61
ts ,
62
62
( ) => {
63
- const commandLine = vue . createParsedCommandLine ( ts , ts . sys , tsconfig ) ;
63
+ const commandLine = core . createParsedCommandLine ( ts , ts . sys , tsconfig ) ;
64
64
const { fileNames } = ts . parseJsonSourceFileConfigFileContent (
65
65
ts . readJsonConfigFile ( tsconfig , ts . sys . readFile ) ,
66
66
ts . sys ,
67
67
path . dirname ( tsconfig ) ,
68
68
{ } ,
69
69
tsconfig ,
70
70
undefined ,
71
- vue . getAllExtensions ( commandLine . vueOptions )
71
+ core . getAllExtensions ( commandLine . vueOptions )
72
72
. map ( extension => ( {
73
73
extension : extension . slice ( 1 ) ,
74
74
isMixedContent : true ,
@@ -86,7 +86,7 @@ export function createCheckerBase(
86
86
function baseCreate (
87
87
ts : typeof import ( 'typescript' ) ,
88
88
getConfigAndFiles : ( ) => [
89
- commandLine : vue . ParsedCommandLine ,
89
+ commandLine : core . ParsedCommandLine ,
90
90
fileNames : string [ ] ,
91
91
] ,
92
92
checkerOptions : MetaCheckerOptions ,
@@ -100,7 +100,7 @@ function baseCreate(
100
100
let fileNamesSet = new Set ( fileNames . map ( path => path . replace ( windowsPathReg , '/' ) ) ) ;
101
101
let projectVersion = 0 ;
102
102
103
- vueOptions . globalTypesPath = vue . createGlobalTypesWriter ( vueOptions , ts . sys . writeFile ) ;
103
+ vueOptions . globalTypesPath = core . createGlobalTypesWriter ( vueOptions , ts . sys . writeFile ) ;
104
104
105
105
const projectHost : TypeScriptProjectHost = {
106
106
getCurrentDirectory : ( ) => rootPath ,
@@ -123,13 +123,13 @@ function baseCreate(
123
123
] ;
124
124
} ;
125
125
126
- const vueLanguagePlugin = vue . createVueLanguagePlugin < string > (
126
+ const vueLanguagePlugin = core . createVueLanguagePlugin < string > (
127
127
ts ,
128
128
projectHost . getCompilationSettings ( ) ,
129
129
vueOptions ,
130
130
id => id ,
131
131
) ;
132
- const language = vue . createLanguage (
132
+ const language = core . createLanguage (
133
133
[
134
134
vueLanguagePlugin ,
135
135
{
@@ -138,7 +138,7 @@ function baseCreate(
138
138
} ,
139
139
} ,
140
140
] ,
141
- new vue . FileMap ( ts . sys . useCaseSensitiveFileNames ) ,
141
+ new core . FileMap ( ts . sys . useCaseSensitiveFileNames ) ,
142
142
fileName => {
143
143
let snapshot = scriptSnapshots . get ( fileName ) ;
144
144
@@ -210,7 +210,7 @@ function baseCreate(
210
210
} ,
211
211
reload ( ) {
212
212
[ { vueOptions, options, projectReferences } , fileNames ] = getConfigAndFiles ( ) ;
213
- vueOptions . globalTypesPath = vue . createGlobalTypesWriter ( vueOptions , ts . sys . writeFile ) ;
213
+ vueOptions . globalTypesPath = core . createGlobalTypesWriter ( vueOptions , ts . sys . writeFile ) ;
214
214
fileNamesSet = new Set ( fileNames . map ( path => path . replace ( windowsPathReg , '/' ) ) ) ;
215
215
this . clearCache ( ) ;
216
216
} ,
@@ -348,7 +348,7 @@ interface ComponentMeta<T> {
348
348
349
349
const vueFile = sourceScript . generated ?. root ;
350
350
const vueDefaults = vueFile && exportName === 'default'
351
- ? ( vueFile instanceof vue . VueVirtualCode ? readVueComponentDefaultProps ( vueFile , printer , ts ) : { } )
351
+ ? ( vueFile instanceof core . VueVirtualCode ? readVueComponentDefaultProps ( vueFile , printer , ts ) : { } )
352
352
: { } ;
353
353
const tsDefaults = ! vueFile
354
354
? readTsComponentDefaultProps (
@@ -493,7 +493,7 @@ function createSchemaResolvers(
493
493
symbolNode : ts . Expression ,
494
494
{ rawType, schema : options , noDeclarations } : MetaCheckerOptions ,
495
495
ts : typeof import ( 'typescript' ) ,
496
- language : vue . Language < string > ,
496
+ language : core . Language < string > ,
497
497
) {
498
498
const visited = new Set < ts . Type > ( ) ;
499
499
@@ -758,7 +758,7 @@ function createSchemaResolvers(
758
758
}
759
759
760
760
function readVueComponentDefaultProps (
761
- root : vue . VueVirtualCode ,
761
+ root : core . VueVirtualCode ,
762
762
printer : ts . Printer | undefined ,
763
763
ts : typeof import ( 'typescript' ) ,
764
764
) {
@@ -779,7 +779,7 @@ function readVueComponentDefaultProps(
779
779
}
780
780
const { ast } = sfc . scriptSetup ;
781
781
782
- const codegen = vue . tsCodegen . get ( sfc ) ;
782
+ const codegen = core . tsCodegen . get ( sfc ) ;
783
783
const scriptSetupRanges = codegen ?. getScriptSetupRanges ( ) ;
784
784
785
785
if ( scriptSetupRanges ?. withDefaults ?. argNode ) {
0 commit comments