@vue/typescript-plugin 3.0.4 → 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.
Files changed (37) hide show
  1. package/index.js +2 -2
  2. package/lib/requests/collectExtractProps.d.ts +4 -2
  3. package/lib/requests/collectExtractProps.js +5 -8
  4. package/lib/requests/getComponentDirectives.d.ts +1 -1
  5. package/lib/requests/getComponentDirectives.js +5 -5
  6. package/lib/requests/getComponentEvents.d.ts +1 -1
  7. package/lib/requests/getComponentEvents.js +6 -6
  8. package/lib/requests/getComponentNames.d.ts +1 -4
  9. package/lib/requests/getComponentNames.js +6 -10
  10. package/lib/requests/getComponentProps.d.ts +1 -1
  11. package/lib/requests/getComponentProps.js +6 -6
  12. package/lib/requests/getComponentSlots.d.ts +1 -1
  13. package/lib/requests/getComponentSlots.js +7 -7
  14. package/lib/requests/getElementAttrs.d.ts +1 -1
  15. package/lib/requests/getElementAttrs.js +5 -5
  16. package/lib/requests/getElementNames.d.ts +1 -4
  17. package/lib/requests/getElementNames.js +5 -9
  18. package/lib/requests/getImportPathForFile.d.ts +3 -1
  19. package/lib/requests/getImportPathForFile.js +5 -5
  20. package/lib/requests/getPropertiesAtLocation.d.ts +1 -1
  21. package/lib/requests/getPropertiesAtLocation.js +23 -21
  22. package/lib/requests/index.d.ts +17 -16
  23. package/package.json +4 -4
  24. package/lib/requests/getComponentHighlights.d.ts +0 -1
  25. package/lib/requests/getComponentHighlights.js +0 -3
  26. package/lib/requests/getCurrentComponentSlots.d.ts +0 -1
  27. package/lib/requests/getCurrentComponentSlots.js +0 -3
  28. package/lib/requests/getDefineSlotNames.d.ts +0 -1
  29. package/lib/requests/getDefineSlotNames.js +0 -3
  30. package/lib/requests/getDefineSlots.d.ts +0 -2
  31. package/lib/requests/getDefineSlots.js +0 -16
  32. package/lib/requests/getMissingPropsDiagnostics.d.ts +0 -10
  33. package/lib/requests/getMissingPropsDiagnostics.js +0 -40
  34. package/lib/requests/getSemanticClassfications.d.ts +0 -3
  35. package/lib/requests/getSemanticClassfications.js +0 -8
  36. package/lib/requests/getVariableProperties.d.ts +0 -10
  37. package/lib/requests/getVariableProperties.js +0 -16
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 == undefined) {
51
+ if (!session) {
52
52
  projectService.logger.info('Vue: there is no session in info.');
53
53
  return;
54
54
  }
55
- if (session.addProtocolHandler == undefined) {
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;
@@ -1,6 +1,8 @@
1
1
  import type { RequestContext } from './types';
2
- export declare function collectExtractProps(this: RequestContext, fileName: string, templateCodeRange: [number, number]): {
2
+ interface ExtractPropsInfo {
3
3
  name: string;
4
4
  type: string;
5
5
  model: boolean;
6
- }[] | undefined;
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
- if (!sourceScript?.generated) {
9
- return;
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?.languagePlugin.typescript?.getServiceScript(root);
20
- const maps = script ? [...language.maps.forEach(script.code)].map(([_sourceScript, map]) => 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[] | undefined;
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 volarFile = language.scripts.get(fileName);
17
- if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
18
- return;
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 vueCode = volarFile.generated.root;
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[] | undefined;
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 volarFile = language.scripts.get(fileName);
9
- if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
10
- return;
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, vueCode, '__VLS_components');
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, vueCode, components, fileName, tag);
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[] | undefined;
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 volarFile = language.scripts.get(fileName);
10
- if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
11
- return;
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 vueCode = volarFile.generated.root;
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)(vueCode.fileName));
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[] | undefined;
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 volarFile = language.scripts.get(fileName);
9
- if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
10
- return;
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
- 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, vueCode, components, fileName, tag);
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[] | undefined;
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 volarFile = language.scripts.get(fileName);
9
- if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
10
- return;
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
- 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, vueCode, assignName);
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[] | undefined;
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 volarFile = language.scripts.get(fileName);
9
- if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
10
- return;
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, vueCode, '__VLS_elements');
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[] | undefined;
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 volarFile = language.scripts.get(fileName);
10
- if (!(volarFile?.generated?.root instanceof language_core_1.VueVirtualCode)) {
11
- return;
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 vueCode = volarFile.generated.root;
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): string | undefined;
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
- for (const moduleSpecifier of moduleSpecifiers.moduleSpecifiers) {
16
- return moduleSpecifier;
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[] | undefined;
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 file = language.scripts.get(fileName);
10
- if (file?.generated) {
11
- const virtualScript = file.generated.languagePlugin.typescript?.getServiceScript(file.generated.root);
12
- if (!virtualScript) {
13
- return;
14
- }
15
- let mapped = false;
16
- for (const [_sourceScript, map] of language.maps.forEach(virtualScript.code)) {
17
- for (const [position2, mapping] of map.toGeneratedLocation(position)) {
18
- if ((0, language_core_1.isCompletionEnabled)(mapping.data)) {
19
- position = position2;
20
- mapped = true;
21
- break;
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 (!mapped) {
29
- return;
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);
@@ -1,18 +1,19 @@
1
1
  import type * as ts from 'typescript';
2
- type ToRequest<T extends (...args: any) => any> = (...args: Parameters<T>) => Promise<ReturnType<T> | null | undefined>;
3
- export type Requests = {
4
- collectExtractProps: ToRequest<typeof import('./collectExtractProps.js')['collectExtractProps']>;
5
- getImportPathForFile: ToRequest<typeof import('./getImportPathForFile.js')['getImportPathForFile']>;
6
- getPropertiesAtLocation: ToRequest<typeof import('./getPropertiesAtLocation.js')['getPropertiesAtLocation']>;
7
- getComponentDirectives: ToRequest<typeof import('./getComponentDirectives.js')['getComponentDirectives']>;
8
- getComponentEvents: ToRequest<typeof import('./getComponentEvents.js')['getComponentEvents']>;
9
- getComponentNames: ToRequest<typeof import('./getComponentNames.js')['getComponentNames']>;
10
- getComponentProps: ToRequest<typeof import('./getComponentProps.js')['getComponentProps']>;
11
- getComponentSlots: ToRequest<typeof import('./getComponentSlots.js')['getComponentSlots']>;
12
- getElementAttrs: ToRequest<typeof import('./getElementAttrs.js')['getElementAttrs']>;
13
- getElementNames: ToRequest<typeof import('./getElementNames.js')['getElementNames']>;
14
- getDocumentHighlights: ToRequest<(fileName: string, position: number) => ts.DocumentHighlights[]>;
15
- getEncodedSemanticClassifications: ToRequest<(fileName: string, span: ts.TextSpan) => ts.Classifications>;
16
- getQuickInfoAtPosition: ToRequest<(fileName: string, position: ts.LineAndCharacter) => string>;
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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/typescript-plugin",
3
- "version": "3.0.4",
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.20",
17
- "@vue/language-core": "3.0.4",
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": "148d386f9779c2de64cdcbd35310e03b36943b05"
25
+ "gitHead": "59f8cde8a5148e54294868104312b2b0f4c30d1e"
26
26
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=getComponentHighlights.js.map
@@ -1 +0,0 @@
1
- export { };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=getCurrentComponentSlots.js.map
@@ -1 +0,0 @@
1
- export { };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=getDefineSlotNames.js.map
@@ -1,2 +0,0 @@
1
- import type { RequestContext } from './types';
2
- export declare function getDefineSlots(this: RequestContext, fileName: string): string[] | undefined;
@@ -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,3 +0,0 @@
1
- import type * as ts from 'typescript';
2
- import type { RequestContext } from './types';
3
- export declare function getSemanticClassifications(this: RequestContext, fileName: string, span: ts.TextSpan): ts.ClassifiedSpan[] | ts.ClassifiedSpan2020[];
@@ -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