@vue/typescript-plugin 2.0.13 → 2.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/common.d.ts
CHANGED
|
@@ -4,5 +4,4 @@ export declare function decorateLanguageServiceForVue(language: vue.Language, la
|
|
|
4
4
|
export declare function getComponentSpans(this: {
|
|
5
5
|
typescript: typeof import('typescript');
|
|
6
6
|
languageService: ts.LanguageService;
|
|
7
|
-
|
|
8
|
-
}, vueCode: vue.VueGeneratedCode, template: NonNullable<vue.VueGeneratedCode['sfc']['template']>, spanTemplateRange: ts.TextSpan): ts.TextSpan[];
|
|
7
|
+
}, vueCode: vue.VueVirtualCode, template: NonNullable<vue.VueVirtualCode['sfc']['template']>, spanTemplateRange: ts.TextSpan): ts.TextSpan[];
|
package/lib/common.js
CHANGED
|
@@ -68,7 +68,7 @@ function decorateLanguageServiceForVue(language, languageService, vueOptions, ts
|
|
|
68
68
|
languageService.getEncodedSemanticClassifications = (fileName, span, format) => {
|
|
69
69
|
const result = getEncodedSemanticClassifications(fileName, span, format);
|
|
70
70
|
const file = language.scripts.get(fileName);
|
|
71
|
-
if (file?.generated?.root instanceof vue.
|
|
71
|
+
if (file?.generated?.root instanceof vue.VueVirtualCode) {
|
|
72
72
|
const { template } = file.generated.root.sfc;
|
|
73
73
|
if (template) {
|
|
74
74
|
for (const componentSpan of getComponentSpans.call({ typescript: ts, languageService, vueOptions }, file.generated.root, template, {
|
|
@@ -85,9 +85,9 @@ function decorateLanguageServiceForVue(language, languageService, vueOptions, ts
|
|
|
85
85
|
}
|
|
86
86
|
exports.decorateLanguageServiceForVue = decorateLanguageServiceForVue;
|
|
87
87
|
function getComponentSpans(vueCode, template, spanTemplateRange) {
|
|
88
|
-
const { typescript: ts, languageService
|
|
88
|
+
const { typescript: ts, languageService } = this;
|
|
89
89
|
const result = [];
|
|
90
|
-
const validComponentNames = (0, componentInfos_1._getComponentNames)(ts, languageService, vueCode
|
|
90
|
+
const validComponentNames = (0, componentInfos_1._getComponentNames)(ts, languageService, vueCode);
|
|
91
91
|
const components = new Set([
|
|
92
92
|
...validComponentNames,
|
|
93
93
|
...validComponentNames.map(vue.hyphenateTag),
|
|
@@ -5,7 +5,7 @@ const language_core_1 = require("@vue/language-core");
|
|
|
5
5
|
function collectExtractProps(fileName, templateCodeRange) {
|
|
6
6
|
const { typescript: ts, languageService, language, isTsPlugin, getFileId } = this;
|
|
7
7
|
const volarFile = language.scripts.get(getFileId(fileName));
|
|
8
|
-
if (!(volarFile?.generated?.root instanceof language_core_1.
|
|
8
|
+
if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
const result = new Map();
|
|
@@ -4,14 +4,12 @@ export declare function getComponentProps(this: {
|
|
|
4
4
|
typescript: typeof import('typescript');
|
|
5
5
|
languageService: ts.LanguageService;
|
|
6
6
|
language: vue.Language;
|
|
7
|
-
vueOptions: vue.VueCompilerOptions;
|
|
8
7
|
getFileId: (fileName: string) => string;
|
|
9
8
|
}, fileName: string, tag: string, requiredOnly?: boolean): string[] | undefined;
|
|
10
9
|
export declare function getComponentEvents(this: {
|
|
11
10
|
typescript: typeof import('typescript');
|
|
12
11
|
languageService: ts.LanguageService;
|
|
13
12
|
language: vue.Language;
|
|
14
|
-
vueOptions: vue.VueCompilerOptions;
|
|
15
13
|
getFileId: (fileName: string) => string;
|
|
16
14
|
}, fileName: string, tag: string): string[] | undefined;
|
|
17
15
|
export declare function getTemplateContextProps(this: {
|
|
@@ -24,10 +22,9 @@ export declare function getComponentNames(this: {
|
|
|
24
22
|
typescript: typeof import('typescript');
|
|
25
23
|
languageService: ts.LanguageService;
|
|
26
24
|
language: vue.Language;
|
|
27
|
-
vueOptions: vue.VueCompilerOptions;
|
|
28
25
|
getFileId: (fileName: string) => string;
|
|
29
26
|
}, fileName: string): string[] | undefined;
|
|
30
|
-
export declare function _getComponentNames(ts: typeof import('typescript'), tsLs: ts.LanguageService, vueCode: vue.
|
|
27
|
+
export declare function _getComponentNames(ts: typeof import('typescript'), tsLs: ts.LanguageService, vueCode: vue.VueVirtualCode): string[];
|
|
31
28
|
export declare function getElementAttrs(this: {
|
|
32
29
|
typescript: typeof import('typescript');
|
|
33
30
|
languageService: ts.LanguageService;
|
|
@@ -4,9 +4,9 @@ exports.getElementAttrs = exports._getComponentNames = exports.getComponentNames
|
|
|
4
4
|
const vue = require("@vue/language-core");
|
|
5
5
|
const shared_1 = require("@vue/shared");
|
|
6
6
|
function getComponentProps(fileName, tag, requiredOnly = false) {
|
|
7
|
-
const { typescript: ts, language,
|
|
7
|
+
const { typescript: ts, language, languageService, getFileId } = this;
|
|
8
8
|
const volarFile = language.scripts.get(getFileId(fileName));
|
|
9
|
-
if (!(volarFile?.generated?.root instanceof vue.
|
|
9
|
+
if (!(volarFile?.generated?.root instanceof vue.VueVirtualCode)) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
const vueCode = volarFile.generated.root;
|
|
@@ -21,7 +21,7 @@ function getComponentProps(fileName, tag, requiredOnly = false) {
|
|
|
21
21
|
}
|
|
22
22
|
const name = tag.split('.');
|
|
23
23
|
let componentSymbol = components.type.getProperty(name[0]);
|
|
24
|
-
if (!componentSymbol
|
|
24
|
+
if (!componentSymbol) {
|
|
25
25
|
componentSymbol = components.type.getProperty((0, shared_1.camelize)(name[0]))
|
|
26
26
|
?? components.type.getProperty((0, shared_1.capitalize)((0, shared_1.camelize)(name[0])));
|
|
27
27
|
}
|
|
@@ -71,9 +71,9 @@ function getComponentProps(fileName, tag, requiredOnly = false) {
|
|
|
71
71
|
}
|
|
72
72
|
exports.getComponentProps = getComponentProps;
|
|
73
73
|
function getComponentEvents(fileName, tag) {
|
|
74
|
-
const { typescript: ts, language,
|
|
74
|
+
const { typescript: ts, language, languageService, getFileId } = this;
|
|
75
75
|
const volarFile = language.scripts.get(getFileId(fileName));
|
|
76
|
-
if (!(volarFile?.generated?.root instanceof vue.
|
|
76
|
+
if (!(volarFile?.generated?.root instanceof vue.VueVirtualCode)) {
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
const vueCode = volarFile.generated.root;
|
|
@@ -88,7 +88,7 @@ function getComponentEvents(fileName, tag) {
|
|
|
88
88
|
}
|
|
89
89
|
const name = tag.split('.');
|
|
90
90
|
let componentSymbol = components.type.getProperty(name[0]);
|
|
91
|
-
if (!componentSymbol
|
|
91
|
+
if (!componentSymbol) {
|
|
92
92
|
componentSymbol = components.type.getProperty((0, shared_1.camelize)(name[0]))
|
|
93
93
|
?? components.type.getProperty((0, shared_1.capitalize)((0, shared_1.camelize)(name[0])));
|
|
94
94
|
}
|
|
@@ -134,7 +134,7 @@ exports.getComponentEvents = getComponentEvents;
|
|
|
134
134
|
function getTemplateContextProps(fileName) {
|
|
135
135
|
const { typescript: ts, language, languageService, getFileId } = this;
|
|
136
136
|
const volarFile = language.scripts.get(getFileId(fileName));
|
|
137
|
-
if (!(volarFile?.generated?.root instanceof vue.
|
|
137
|
+
if (!(volarFile?.generated?.root instanceof vue.VueVirtualCode)) {
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
140
|
const vueCode = volarFile.generated.root;
|
|
@@ -145,9 +145,9 @@ function getTemplateContextProps(fileName) {
|
|
|
145
145
|
}
|
|
146
146
|
exports.getTemplateContextProps = getTemplateContextProps;
|
|
147
147
|
function getComponentNames(fileName) {
|
|
148
|
-
const { typescript: ts, language,
|
|
148
|
+
const { typescript: ts, language, languageService, getFileId } = this;
|
|
149
149
|
const volarFile = language.scripts.get(getFileId(fileName));
|
|
150
|
-
if (!(volarFile?.generated?.root instanceof vue.
|
|
150
|
+
if (!(volarFile?.generated?.root instanceof vue.VueVirtualCode)) {
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
153
153
|
const vueCode = volarFile.generated.root;
|
|
@@ -156,24 +156,22 @@ function getComponentNames(fileName) {
|
|
|
156
156
|
?.getProperties()
|
|
157
157
|
.map(c => c.name)
|
|
158
158
|
.filter(entry => entry.indexOf('$') === -1 && !entry.startsWith('_'))
|
|
159
|
-
.filter(entry => !vueOptions.nativeTags.includes(entry))
|
|
160
159
|
?? [];
|
|
161
160
|
}
|
|
162
161
|
exports.getComponentNames = getComponentNames;
|
|
163
|
-
function _getComponentNames(ts, tsLs, vueCode
|
|
162
|
+
function _getComponentNames(ts, tsLs, vueCode) {
|
|
164
163
|
return getVariableType(ts, tsLs, vueCode, '__VLS_components')
|
|
165
164
|
?.type
|
|
166
165
|
?.getProperties()
|
|
167
166
|
.map(c => c.name)
|
|
168
167
|
.filter(entry => entry.indexOf('$') === -1 && !entry.startsWith('_'))
|
|
169
|
-
.filter(entry => !vueOptions.nativeTags.includes(entry))
|
|
170
168
|
?? [];
|
|
171
169
|
}
|
|
172
170
|
exports._getComponentNames = _getComponentNames;
|
|
173
171
|
function getElementAttrs(fileName, tagName) {
|
|
174
172
|
const { typescript: ts, language, languageService, getFileId } = this;
|
|
175
173
|
const volarFile = language.scripts.get(getFileId(fileName));
|
|
176
|
-
if (!(volarFile?.generated?.root instanceof vue.
|
|
174
|
+
if (!(volarFile?.generated?.root instanceof vue.VueVirtualCode)) {
|
|
177
175
|
return;
|
|
178
176
|
}
|
|
179
177
|
const program = languageService.getCurrentProgram();
|
package/lib/server.js
CHANGED
|
@@ -23,7 +23,7 @@ function startNamedPipeServer(ts, serverKind, currentDirectory) {
|
|
|
23
23
|
const text = data.toString();
|
|
24
24
|
const request = JSON.parse(text);
|
|
25
25
|
const fileName = request.args[0];
|
|
26
|
-
const project = getProject(fileName);
|
|
26
|
+
const project = getProject(ts.server.toNormalizedPath(fileName));
|
|
27
27
|
if (request.type === 'projectInfoForFile') {
|
|
28
28
|
connection.write(JSON.stringify(project
|
|
29
29
|
? {
|
|
@@ -120,9 +120,9 @@ function cleanupPipeTable() {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
exports.projects = new Map();
|
|
123
|
-
function getProject(
|
|
123
|
+
function getProject(filename) {
|
|
124
124
|
for (const [project, data] of exports.projects) {
|
|
125
|
-
if (project.containsFile(
|
|
125
|
+
if (project.containsFile(filename)) {
|
|
126
126
|
return data;
|
|
127
127
|
}
|
|
128
128
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/typescript-plugin",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
"directory": "packages/typescript-plugin"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@volar/typescript": "2.2.0-alpha.
|
|
16
|
-
"@vue/language-core": "2.0.
|
|
15
|
+
"@volar/typescript": "2.2.0-alpha.10",
|
|
16
|
+
"@vue/language-core": "2.0.14",
|
|
17
17
|
"@vue/shared": "^3.4.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/node": "latest"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "ce1412067f88b7f9af03a2d3e04c220b4921c363"
|
|
23
23
|
}
|