@vue/typescript-plugin 3.0.5 → 3.0.6
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/index.js +2 -2
- package/package.json +4 -4
- package/lib/requests/getComponentHighlights.d.ts +0 -1
- package/lib/requests/getComponentHighlights.js +0 -3
- package/lib/requests/getCurrentComponentSlots.d.ts +0 -1
- package/lib/requests/getCurrentComponentSlots.js +0 -3
- package/lib/requests/getDefineSlotNames.d.ts +0 -1
- package/lib/requests/getDefineSlotNames.js +0 -3
- package/lib/requests/getDefineSlots.d.ts +0 -2
- package/lib/requests/getDefineSlots.js +0 -16
- package/lib/requests/getMissingPropsDiagnostics.d.ts +0 -10
- package/lib/requests/getMissingPropsDiagnostics.js +0 -40
- package/lib/requests/getSemanticClassfications.d.ts +0 -3
- package/lib/requests/getSemanticClassfications.js +0 -8
- package/lib/requests/getVariableProperties.d.ts +0 -10
- package/lib/requests/getVariableProperties.js +0 -16
- package/lib/requests/resolveModuleName.d.ts +0 -4
- package/lib/requests/resolveModuleName.js +0 -28
package/index.js
CHANGED
|
@@ -48,11 +48,11 @@ module.exports = (0, createLanguageServicePlugin_1.createLanguageServicePlugin)(
|
|
|
48
48
|
const projectService = info.project.projectService;
|
|
49
49
|
projectService.logger.info('Vue: called handler processing ' + info.project.projectKind);
|
|
50
50
|
const session = info.session;
|
|
51
|
-
if (session
|
|
51
|
+
if (!session) {
|
|
52
52
|
projectService.logger.info('Vue: there is no session in info.');
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
if (session.addProtocolHandler
|
|
55
|
+
if (!session.addProtocolHandler) {
|
|
56
56
|
// addProtocolHandler was introduced in TS 4.4 or 4.5 in 2021, see https://github.com/microsoft/TypeScript/issues/43893
|
|
57
57
|
projectService.logger.info('Vue: there is no addProtocolHandler method.');
|
|
58
58
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/typescript-plugin",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"directory": "packages/typescript-plugin"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/typescript": "2.4.
|
|
17
|
-
"@vue/language-core": "3.0.
|
|
16
|
+
"@volar/typescript": "2.4.23",
|
|
17
|
+
"@vue/language-core": "3.0.6",
|
|
18
18
|
"@vue/shared": "^3.5.0",
|
|
19
19
|
"path-browserify": "^1.0.1"
|
|
20
20
|
},
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"@types/node": "^22.10.4",
|
|
23
23
|
"@types/path-browserify": "^1.0.1"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "59f8cde8a5148e54294868104312b2b0f4c30d1e"
|
|
26
26
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDefineSlots = getDefineSlots;
|
|
4
|
-
const language_core_1 = require("@vue/language-core");
|
|
5
|
-
const utils_1 = require("./utils");
|
|
6
|
-
function getDefineSlots(fileName) {
|
|
7
|
-
const { typescript: ts, language, languageService, getFileId } = this;
|
|
8
|
-
const volarFile = language.scripts.get(getFileId(fileName));
|
|
9
|
-
if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
const vueCode = volarFile.generated.root;
|
|
13
|
-
const slots = (0, utils_1.getTypeAliasType)(ts, languageService, vueCode, '__VLS_Slots');
|
|
14
|
-
return slots?.type.getProperties().map(prop => prop.getName());
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=getDefineSlots.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { RequestContext } from './types';
|
|
2
|
-
export interface ComponentPropInfo {
|
|
3
|
-
name: string;
|
|
4
|
-
required?: boolean;
|
|
5
|
-
deprecated?: boolean;
|
|
6
|
-
isAttribute?: boolean;
|
|
7
|
-
commentMarkdown?: string;
|
|
8
|
-
values?: string[];
|
|
9
|
-
}
|
|
10
|
-
export declare function getMissingPropsDiagnostics(this: RequestContext, fileName: string): undefined;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getMissingPropsDiagnostics = getMissingPropsDiagnostics;
|
|
4
|
-
const language_core_1 = require("@vue/language-core");
|
|
5
|
-
function getMissingPropsDiagnostics(fileName) {
|
|
6
|
-
const { typescript: ts, language, languageService, asScriptId } = this;
|
|
7
|
-
const volarFile = language.scripts.get(asScriptId(fileName));
|
|
8
|
-
if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
const vueCode = volarFile.generated.root;
|
|
12
|
-
const program = languageService.getProgram();
|
|
13
|
-
const sourceFile = program.getSourceFile(vueCode.fileName);
|
|
14
|
-
if (!sourceFile) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const checker = program.getTypeChecker();
|
|
18
|
-
ts.forEachChild(sourceFile, function visit(node) {
|
|
19
|
-
if (ts.isVariableDeclaration(node)
|
|
20
|
-
&& node.initializer
|
|
21
|
-
&& ts.isCallExpression(node.initializer)
|
|
22
|
-
&& ts.isIdentifier(node.initializer.expression)
|
|
23
|
-
&& /^__VLS_\d+$/.test(node.initializer.expression.text)) {
|
|
24
|
-
const firstArg = node.initializer.arguments[0];
|
|
25
|
-
const type = checker.getTypeAtLocation(firstArg);
|
|
26
|
-
const contextualType = checker.getContextualType(firstArg);
|
|
27
|
-
if (contextualType) {
|
|
28
|
-
const subtype = contextualType.isUnion()
|
|
29
|
-
? contextualType.types.find(subtype => checker.isTypeAssignableTo(subtype, type))
|
|
30
|
-
: contextualType;
|
|
31
|
-
void subtype;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
ts.forEachChild(node, visit);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=getMissingPropsDiagnostics.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSemanticClassifications = getSemanticClassifications;
|
|
4
|
-
function getSemanticClassifications(fileName, span) {
|
|
5
|
-
const { languageService, typescript: ts } = this;
|
|
6
|
-
return languageService.getSemanticClassifications(fileName, span, ts.SemanticClassificationFormat.TwentyTwenty);
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=getSemanticClassfications.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { RequestContext } from './types';
|
|
2
|
-
export interface ComponentPropInfo {
|
|
3
|
-
name: string;
|
|
4
|
-
required?: boolean;
|
|
5
|
-
deprecated?: boolean;
|
|
6
|
-
isAttribute?: boolean;
|
|
7
|
-
commentMarkdown?: string;
|
|
8
|
-
values?: string[];
|
|
9
|
-
}
|
|
10
|
-
export declare function getVariableProperties(this: RequestContext, fileName: string, variableName: string): string[] | undefined;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getVariableProperties = getVariableProperties;
|
|
4
|
-
const language_core_1 = require("@vue/language-core");
|
|
5
|
-
const utils_1 = require("./utils");
|
|
6
|
-
function getVariableProperties(fileName, variableName) {
|
|
7
|
-
const { typescript: ts, language, languageService, asScriptId } = this;
|
|
8
|
-
const volarFile = language.scripts.get(asScriptId(fileName));
|
|
9
|
-
if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
const vueCode = volarFile.generated.root;
|
|
13
|
-
const variable = (0, utils_1.getVariableType)(ts, languageService, vueCode, variableName);
|
|
14
|
-
return variable?.type.getProperties().map(prop => prop.name);
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=getVariableProperties.js.map
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveModuleName = resolveModuleName;
|
|
4
|
-
function resolveModuleName(fileName, moduleName) {
|
|
5
|
-
const { typescript: ts, languageServiceHost } = this;
|
|
6
|
-
const compilerOptions = languageServiceHost.getCompilationSettings();
|
|
7
|
-
const ext = moduleName.split('.').pop();
|
|
8
|
-
const result = ts.resolveModuleName(moduleName, fileName, {
|
|
9
|
-
...compilerOptions,
|
|
10
|
-
allowArbitraryExtensions: true,
|
|
11
|
-
}, {
|
|
12
|
-
fileExists(fileName) {
|
|
13
|
-
fileName = transformFileName(fileName, ext);
|
|
14
|
-
return languageServiceHost.fileExists(fileName);
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
const resolveFileName = result.resolvedModule?.resolvedFileName;
|
|
18
|
-
return {
|
|
19
|
-
name: resolveFileName ? transformFileName(resolveFileName, ext) : undefined,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function transformFileName(fileName, ext) {
|
|
23
|
-
if (ext && fileName.endsWith(`.d.${ext}.ts`)) {
|
|
24
|
-
return fileName.slice(0, -`.d.${ext}.ts`.length) + `.${ext}`;
|
|
25
|
-
}
|
|
26
|
-
return fileName;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=resolveModuleName.js.map
|