@vue/typescript-plugin 3.0.4 → 3.0.5
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/requests/collectExtractProps.d.ts +4 -2
- package/lib/requests/collectExtractProps.js +5 -8
- package/lib/requests/getComponentDirectives.d.ts +1 -1
- package/lib/requests/getComponentDirectives.js +5 -5
- package/lib/requests/getComponentEvents.d.ts +1 -1
- package/lib/requests/getComponentEvents.js +6 -6
- package/lib/requests/getComponentNames.d.ts +1 -4
- package/lib/requests/getComponentNames.js +6 -10
- package/lib/requests/getComponentProps.d.ts +1 -1
- package/lib/requests/getComponentProps.js +6 -6
- package/lib/requests/getComponentSlots.d.ts +1 -1
- package/lib/requests/getComponentSlots.js +7 -7
- package/lib/requests/getElementAttrs.d.ts +1 -1
- package/lib/requests/getElementAttrs.js +5 -5
- package/lib/requests/getElementNames.d.ts +1 -4
- package/lib/requests/getElementNames.js +5 -9
- package/lib/requests/getImportPathForFile.d.ts +3 -1
- package/lib/requests/getImportPathForFile.js +5 -5
- package/lib/requests/getPropertiesAtLocation.d.ts +1 -1
- package/lib/requests/getPropertiesAtLocation.js +23 -21
- package/lib/requests/index.d.ts +17 -16
- package/lib/requests/resolveModuleName.d.ts +4 -0
- package/lib/requests/resolveModuleName.js +28 -0
- package/package.json +4 -4
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { RequestContext } from './types';
|
|
2
|
-
|
|
2
|
+
interface ExtractPropsInfo {
|
|
3
3
|
name: string;
|
|
4
4
|
type: string;
|
|
5
5
|
model: boolean;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
|
+
export declare function collectExtractProps(this: RequestContext, fileName: string, templateCodeRange: [number, number]): ExtractPropsInfo[];
|
|
8
|
+
export {};
|
|
@@ -5,19 +5,16 @@ const language_core_1 = require("@vue/language-core");
|
|
|
5
5
|
function collectExtractProps(fileName, templateCodeRange) {
|
|
6
6
|
const { typescript: ts, languageService, language } = this;
|
|
7
7
|
const sourceScript = language.scripts.get(fileName);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const root = sourceScript.generated.root;
|
|
12
|
-
if (!(root instanceof language_core_1.VueVirtualCode)) {
|
|
13
|
-
return;
|
|
8
|
+
const root = sourceScript?.generated?.root;
|
|
9
|
+
if (!sourceScript?.generated || !(root instanceof language_core_1.VueVirtualCode)) {
|
|
10
|
+
return [];
|
|
14
11
|
}
|
|
15
12
|
const result = new Map();
|
|
16
13
|
const program = languageService.getProgram();
|
|
17
14
|
const sourceFile = program.getSourceFile(fileName);
|
|
18
15
|
const checker = program.getTypeChecker();
|
|
19
|
-
const script = sourceScript.generated
|
|
20
|
-
const maps = script ? [...language.maps.forEach(script.code)].map(([
|
|
16
|
+
const script = sourceScript.generated.languagePlugin.typescript?.getServiceScript(root);
|
|
17
|
+
const maps = script ? [...language.maps.forEach(script.code)].map(([, map]) => map) : [];
|
|
21
18
|
const { sfc } = root;
|
|
22
19
|
sourceFile.forEachChild(function visit(node) {
|
|
23
20
|
if (ts.isPropertyAccessExpression(node)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { RequestContext } from './types';
|
|
2
|
-
export declare function getComponentDirectives(this: RequestContext, fileName: string): string[]
|
|
2
|
+
export declare function getComponentDirectives(this: RequestContext, fileName: string): string[];
|
|
@@ -13,12 +13,12 @@ const builtInDirectives = new Set([
|
|
|
13
13
|
]);
|
|
14
14
|
function getComponentDirectives(fileName) {
|
|
15
15
|
const { typescript: ts, language, languageService } = this;
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const sourceScript = language.scripts.get(fileName);
|
|
17
|
+
const root = sourceScript?.generated?.root;
|
|
18
|
+
if (!sourceScript?.generated || !(root instanceof language_core_1.VueVirtualCode)) {
|
|
19
|
+
return [];
|
|
19
20
|
}
|
|
20
|
-
const
|
|
21
|
-
const directives = (0, utils_1.getVariableType)(ts, languageService, vueCode, '__VLS_directives');
|
|
21
|
+
const directives = (0, utils_1.getVariableType)(ts, languageService, root, '__VLS_directives');
|
|
22
22
|
if (!directives) {
|
|
23
23
|
return [];
|
|
24
24
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { RequestContext } from './types';
|
|
2
|
-
export declare function getComponentEvents(this: RequestContext, fileName: string, tag: string): string[]
|
|
2
|
+
export declare function getComponentEvents(this: RequestContext, fileName: string, tag: string): string[];
|
|
@@ -5,18 +5,18 @@ const language_core_1 = require("@vue/language-core");
|
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
6
|
function getComponentEvents(fileName, tag) {
|
|
7
7
|
const { typescript: ts, language, languageService } = this;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const sourceScript = language.scripts.get(fileName);
|
|
9
|
+
const root = sourceScript?.generated?.root;
|
|
10
|
+
if (!sourceScript?.generated || !(root instanceof language_core_1.VueVirtualCode)) {
|
|
11
|
+
return [];
|
|
11
12
|
}
|
|
12
|
-
const vueCode = volarFile.generated.root;
|
|
13
13
|
const program = languageService.getProgram();
|
|
14
14
|
const checker = program.getTypeChecker();
|
|
15
|
-
const components = (0, utils_1.getVariableType)(ts, languageService,
|
|
15
|
+
const components = (0, utils_1.getVariableType)(ts, languageService, root, '__VLS_components');
|
|
16
16
|
if (!components) {
|
|
17
17
|
return [];
|
|
18
18
|
}
|
|
19
|
-
const componentType = (0, utils_1.getComponentType)(ts, languageService,
|
|
19
|
+
const componentType = (0, utils_1.getComponentType)(ts, languageService, root, components, fileName, tag);
|
|
20
20
|
if (!componentType) {
|
|
21
21
|
return [];
|
|
22
22
|
}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import { VueVirtualCode } from '@vue/language-core';
|
|
2
|
-
import type * as ts from 'typescript';
|
|
3
1
|
import type { RequestContext } from './types';
|
|
4
|
-
export declare function getComponentNames(this: RequestContext, fileName: string): string[]
|
|
5
|
-
export declare function _getComponentNames(ts: typeof import('typescript'), tsLs: ts.LanguageService, vueCode: VueVirtualCode): string[];
|
|
2
|
+
export declare function getComponentNames(this: RequestContext, fileName: string): string[];
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getComponentNames = getComponentNames;
|
|
4
|
-
exports._getComponentNames = _getComponentNames;
|
|
5
4
|
const language_core_1 = require("@vue/language-core");
|
|
6
5
|
const utils_1 = require("./utils");
|
|
7
6
|
function getComponentNames(fileName) {
|
|
8
7
|
const { typescript: ts, language, languageService } = this;
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const sourceScript = language.scripts.get(fileName);
|
|
9
|
+
const root = sourceScript?.generated?.root;
|
|
10
|
+
if (!sourceScript?.generated || !(root instanceof language_core_1.VueVirtualCode)) {
|
|
11
|
+
return [];
|
|
12
12
|
}
|
|
13
|
-
const
|
|
14
|
-
return _getComponentNames(ts, languageService, vueCode);
|
|
15
|
-
}
|
|
16
|
-
function _getComponentNames(ts, tsLs, vueCode) {
|
|
17
|
-
const names = (0, utils_1.getVariableType)(ts, tsLs, vueCode, '__VLS_components')
|
|
13
|
+
const names = (0, utils_1.getVariableType)(ts, languageService, root, '__VLS_components')
|
|
18
14
|
?.type
|
|
19
15
|
?.getProperties()
|
|
20
16
|
.map(c => c.name)
|
|
21
17
|
.filter(entry => !entry.includes('$') && !entry.startsWith('_'))
|
|
22
18
|
?? [];
|
|
23
|
-
names.push((0, utils_1.getSelfComponentName)(
|
|
19
|
+
names.push((0, utils_1.getSelfComponentName)(fileName));
|
|
24
20
|
return names;
|
|
25
21
|
}
|
|
26
22
|
//# sourceMappingURL=getComponentNames.js.map
|
|
@@ -7,4 +7,4 @@ export interface ComponentPropInfo {
|
|
|
7
7
|
documentation?: string;
|
|
8
8
|
values?: string[];
|
|
9
9
|
}
|
|
10
|
-
export declare function getComponentProps(this: RequestContext, fileName: string, tag: string): ComponentPropInfo[]
|
|
10
|
+
export declare function getComponentProps(this: RequestContext, fileName: string, tag: string): ComponentPropInfo[];
|
|
@@ -5,16 +5,16 @@ const language_core_1 = require("@vue/language-core");
|
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
6
|
function getComponentProps(fileName, tag) {
|
|
7
7
|
const { typescript: ts, language, languageService } = this;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const sourceScript = language.scripts.get(fileName);
|
|
9
|
+
const root = sourceScript?.generated?.root;
|
|
10
|
+
if (!sourceScript?.generated || !(root instanceof language_core_1.VueVirtualCode)) {
|
|
11
|
+
return [];
|
|
11
12
|
}
|
|
12
|
-
const
|
|
13
|
-
const components = (0, utils_1.getVariableType)(ts, languageService, vueCode, '__VLS_components');
|
|
13
|
+
const components = (0, utils_1.getVariableType)(ts, languageService, root, '__VLS_components');
|
|
14
14
|
if (!components) {
|
|
15
15
|
return [];
|
|
16
16
|
}
|
|
17
|
-
const componentType = (0, utils_1.getComponentType)(ts, languageService,
|
|
17
|
+
const componentType = (0, utils_1.getComponentType)(ts, languageService, root, components, fileName, tag);
|
|
18
18
|
if (!componentType) {
|
|
19
19
|
return [];
|
|
20
20
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { RequestContext } from './types';
|
|
2
|
-
export declare function getComponentSlots(this: RequestContext, fileName: string): string[]
|
|
2
|
+
export declare function getComponentSlots(this: RequestContext, fileName: string): string[];
|
|
@@ -5,17 +5,17 @@ const language_core_1 = require("@vue/language-core");
|
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
6
|
function getComponentSlots(fileName) {
|
|
7
7
|
const { typescript: ts, language, languageService } = this;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const sourceScript = language.scripts.get(fileName);
|
|
9
|
+
const root = sourceScript?.generated?.root;
|
|
10
|
+
if (!sourceScript?.generated || !(root instanceof language_core_1.VueVirtualCode)) {
|
|
11
|
+
return [];
|
|
11
12
|
}
|
|
12
|
-
const
|
|
13
|
-
const codegen = language_core_1.tsCodegen.get(vueCode.sfc);
|
|
13
|
+
const codegen = language_core_1.tsCodegen.get(root.sfc);
|
|
14
14
|
if (!codegen) {
|
|
15
|
-
return;
|
|
15
|
+
return [];
|
|
16
16
|
}
|
|
17
17
|
const assignName = codegen.getSetupSlotsAssignName() ?? `__VLS_slots`;
|
|
18
|
-
const slots = (0, utils_1.getVariableType)(ts, languageService,
|
|
18
|
+
const slots = (0, utils_1.getVariableType)(ts, languageService, root, assignName);
|
|
19
19
|
if (!slots) {
|
|
20
20
|
return [];
|
|
21
21
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { RequestContext } from './types';
|
|
2
|
-
export declare function getElementAttrs(this: RequestContext, fileName: string, tagName: string): string[]
|
|
2
|
+
export declare function getElementAttrs(this: RequestContext, fileName: string, tagName: string): string[];
|
|
@@ -5,14 +5,14 @@ const language_core_1 = require("@vue/language-core");
|
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
6
|
function getElementAttrs(fileName, tagName) {
|
|
7
7
|
const { typescript: ts, language, languageService } = this;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const sourceScript = language.scripts.get(fileName);
|
|
9
|
+
const root = sourceScript?.generated?.root;
|
|
10
|
+
if (!sourceScript?.generated || !(root instanceof language_core_1.VueVirtualCode)) {
|
|
11
|
+
return [];
|
|
11
12
|
}
|
|
12
|
-
const vueCode = volarFile.generated.root;
|
|
13
13
|
const program = languageService.getProgram();
|
|
14
14
|
const checker = program.getTypeChecker();
|
|
15
|
-
const elements = (0, utils_1.getVariableType)(ts, languageService,
|
|
15
|
+
const elements = (0, utils_1.getVariableType)(ts, languageService, root, '__VLS_elements');
|
|
16
16
|
if (!elements) {
|
|
17
17
|
return [];
|
|
18
18
|
}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import { VueVirtualCode } from '@vue/language-core';
|
|
2
|
-
import type * as ts from 'typescript';
|
|
3
1
|
import type { RequestContext } from './types';
|
|
4
|
-
export declare function getElementNames(this: RequestContext, fileName: string): string[]
|
|
5
|
-
export declare function _getElementNames(ts: typeof import('typescript'), tsLs: ts.LanguageService, vueCode: VueVirtualCode): string[];
|
|
2
|
+
export declare function getElementNames(this: RequestContext, fileName: string): string[];
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getElementNames = getElementNames;
|
|
4
|
-
exports._getElementNames = _getElementNames;
|
|
5
4
|
const language_core_1 = require("@vue/language-core");
|
|
6
5
|
const utils_1 = require("./utils");
|
|
7
6
|
function getElementNames(fileName) {
|
|
8
7
|
const { typescript: ts, language, languageService } = this;
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const sourceScript = language.scripts.get(fileName);
|
|
9
|
+
const root = sourceScript?.generated?.root;
|
|
10
|
+
if (!sourceScript?.generated || !(root instanceof language_core_1.VueVirtualCode)) {
|
|
11
|
+
return [];
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
return _getElementNames(ts, languageService, vueCode);
|
|
15
|
-
}
|
|
16
|
-
function _getElementNames(ts, tsLs, vueCode) {
|
|
17
|
-
return (0, utils_1.getVariableType)(ts, tsLs, vueCode, '__VLS_elements')
|
|
13
|
+
return (0, utils_1.getVariableType)(ts, languageService, root, '__VLS_elements')
|
|
18
14
|
?.type
|
|
19
15
|
?.getProperties()
|
|
20
16
|
.map(c => c.name)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type * as ts from 'typescript';
|
|
2
2
|
import type { RequestContext } from './types';
|
|
3
|
-
export declare function getImportPathForFile(this: RequestContext, fileName: string, incomingFileName: string, preferences: ts.UserPreferences):
|
|
3
|
+
export declare function getImportPathForFile(this: RequestContext, fileName: string, incomingFileName: string, preferences: ts.UserPreferences): {
|
|
4
|
+
path?: string;
|
|
5
|
+
};
|
|
@@ -7,13 +7,13 @@ function getImportPathForFile(fileName, incomingFileName, preferences) {
|
|
|
7
7
|
const incomingFile = program?.getSourceFile(incomingFileName);
|
|
8
8
|
const sourceFile = program?.getSourceFile(fileName);
|
|
9
9
|
if (!program || !sourceFile || !incomingFile) {
|
|
10
|
-
return;
|
|
10
|
+
return {};
|
|
11
11
|
}
|
|
12
12
|
const getModuleSpecifiersWithCacheInfo = ts.moduleSpecifiers.getModuleSpecifiersWithCacheInfo;
|
|
13
13
|
const resolutionHost = ts.createModuleSpecifierResolutionHost(program, languageServiceHost);
|
|
14
|
-
const moduleSpecifiers = getModuleSpecifiersWithCacheInfo(incomingFile.symbol, program.getTypeChecker(), languageServiceHost.getCompilationSettings(), sourceFile, resolutionHost, preferences);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
14
|
+
const { moduleSpecifiers } = getModuleSpecifiersWithCacheInfo(incomingFile.symbol, program.getTypeChecker(), languageServiceHost.getCompilationSettings(), sourceFile, resolutionHost, preferences);
|
|
15
|
+
return {
|
|
16
|
+
path: moduleSpecifiers[0],
|
|
17
|
+
};
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=getImportPathForFile.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { RequestContext } from './types';
|
|
2
|
-
export declare function getPropertiesAtLocation(this: RequestContext, fileName: string, position: number): string[]
|
|
2
|
+
export declare function getPropertiesAtLocation(this: RequestContext, fileName: string, position: number): string[];
|
|
@@ -6,38 +6,40 @@ const language_core_1 = require("@vue/language-core");
|
|
|
6
6
|
function getPropertiesAtLocation(fileName, position) {
|
|
7
7
|
const { languageService, language, typescript: ts } = this;
|
|
8
8
|
// mapping
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (mapped) {
|
|
9
|
+
const sourceScript = language.scripts.get(fileName);
|
|
10
|
+
const root = sourceScript?.generated?.root;
|
|
11
|
+
if (!sourceScript?.generated || !(root instanceof language_core_1.VueVirtualCode)) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
const virtualScript = sourceScript.generated.languagePlugin.typescript?.getServiceScript(root);
|
|
15
|
+
if (!virtualScript) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
let mapped = false;
|
|
19
|
+
for (const [_sourceScript, map] of language.maps.forEach(virtualScript.code)) {
|
|
20
|
+
for (const [position2, mapping] of map.toGeneratedLocation(position)) {
|
|
21
|
+
if ((0, language_core_1.isCompletionEnabled)(mapping.data)) {
|
|
22
|
+
position = position2;
|
|
23
|
+
mapped = true;
|
|
25
24
|
break;
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
|
-
if (
|
|
29
|
-
|
|
27
|
+
if (mapped) {
|
|
28
|
+
break;
|
|
30
29
|
}
|
|
31
|
-
position += file.snapshot.getLength();
|
|
32
30
|
}
|
|
31
|
+
if (!mapped) {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
position += sourceScript.snapshot.getLength();
|
|
33
35
|
const program = languageService.getProgram();
|
|
34
36
|
const sourceFile = program.getSourceFile(fileName);
|
|
35
37
|
if (!sourceFile) {
|
|
36
|
-
return;
|
|
38
|
+
return [];
|
|
37
39
|
}
|
|
38
40
|
const node = findPositionIdentifier(sourceFile, sourceFile, position);
|
|
39
41
|
if (!node) {
|
|
40
|
-
return;
|
|
42
|
+
return [];
|
|
41
43
|
}
|
|
42
44
|
const checker = program.getTypeChecker();
|
|
43
45
|
const type = checker.getTypeAtLocation(node);
|
package/lib/requests/index.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import type * as ts from 'typescript';
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
type Request<T extends (...args: any) => any> = (...args: Parameters<T>) => MaybePromise<ReturnType<T> | null | undefined>;
|
|
3
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
4
|
+
export interface Requests {
|
|
5
|
+
collectExtractProps: Request<typeof import('./collectExtractProps.js')['collectExtractProps']>;
|
|
6
|
+
getImportPathForFile: Request<typeof import('./getImportPathForFile.js')['getImportPathForFile']>;
|
|
7
|
+
getPropertiesAtLocation: Request<typeof import('./getPropertiesAtLocation.js')['getPropertiesAtLocation']>;
|
|
8
|
+
getComponentDirectives: Request<typeof import('./getComponentDirectives.js')['getComponentDirectives']>;
|
|
9
|
+
getComponentEvents: Request<typeof import('./getComponentEvents.js')['getComponentEvents']>;
|
|
10
|
+
getComponentNames: Request<typeof import('./getComponentNames.js')['getComponentNames']>;
|
|
11
|
+
getComponentProps: Request<typeof import('./getComponentProps.js')['getComponentProps']>;
|
|
12
|
+
getComponentSlots: Request<typeof import('./getComponentSlots.js')['getComponentSlots']>;
|
|
13
|
+
getElementAttrs: Request<typeof import('./getElementAttrs.js')['getElementAttrs']>;
|
|
14
|
+
getElementNames: Request<typeof import('./getElementNames.js')['getElementNames']>;
|
|
15
|
+
getDocumentHighlights: Request<(fileName: string, position: number) => ts.DocumentHighlights[]>;
|
|
16
|
+
getEncodedSemanticClassifications: Request<(fileName: string, span: ts.TextSpan) => ts.Classifications>;
|
|
17
|
+
getQuickInfoAtPosition: Request<(fileName: string, position: ts.LineAndCharacter) => string>;
|
|
18
|
+
}
|
|
18
19
|
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/typescript-plugin",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
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.22",
|
|
17
|
+
"@vue/language-core": "3.0.5",
|
|
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": "036b6b1882179d35586e16f2a5cba5150e5d18e6"
|
|
26
26
|
}
|