@vue/typescript-plugin 3.1.0-alpha.0 → 3.1.1

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 (32) hide show
  1. package/index.js +35 -56
  2. package/lib/requests/index.d.ts +0 -1
  3. package/lib/requests/isRefAtPosition.js +4 -1
  4. package/package.json +3 -3
  5. package/lib/proxy.d.ts +0 -3
  6. package/lib/proxy.js +0 -227
  7. package/lib/requests/getComponentHighlights.d.ts +0 -1
  8. package/lib/requests/getComponentHighlights.js +0 -3
  9. package/lib/requests/getCurrentComponentSlots.d.ts +0 -1
  10. package/lib/requests/getCurrentComponentSlots.js +0 -3
  11. package/lib/requests/getDefineSlotNames.d.ts +0 -1
  12. package/lib/requests/getDefineSlotNames.js +0 -3
  13. package/lib/requests/getDefineSlots.d.ts +0 -2
  14. package/lib/requests/getDefineSlots.js +0 -16
  15. package/lib/requests/getMissingPropsDiagnostics.d.ts +0 -10
  16. package/lib/requests/getMissingPropsDiagnostics.js +0 -40
  17. package/lib/requests/getPropertiesAtLocation.d.ts +0 -2
  18. package/lib/requests/getPropertiesAtLocation.js +0 -63
  19. package/lib/requests/getReactiveReferences.d.ts +0 -12
  20. package/lib/requests/getReactiveReferences.js +0 -605
  21. package/lib/requests/getReactiveVariableSpans.d.ts +0 -3
  22. package/lib/requests/getReactiveVariableSpans.js +0 -30
  23. package/lib/requests/getSemanticClassfications.d.ts +0 -3
  24. package/lib/requests/getSemanticClassfications.js +0 -8
  25. package/lib/requests/getVariableProperties.d.ts +0 -10
  26. package/lib/requests/getVariableProperties.js +0 -16
  27. package/lib/requests/isRefAtLocation.d.ts +0 -3
  28. package/lib/requests/isRefAtLocation.js +0 -55
  29. package/lib/requests/resolveModuleName.d.ts +0 -4
  30. package/lib/requests/resolveModuleName.js +0 -28
  31. package/lib/requests/types.d.ts +0 -8
  32. package/lib/requests/types.js +0 -3
@@ -1,3 +0,0 @@
1
- import { type Language, type SourceScript, type VueVirtualCode } from '@vue/language-core';
2
- import type * as ts from 'typescript';
3
- export declare function isRefAtLocation(ts: typeof import('typescript'), language: Language, program: ts.Program, sourceScript: SourceScript, virtualCode: VueVirtualCode, position: number, isTsPlugin: boolean): boolean;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- /// <reference types="@volar/typescript" />
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.isRefAtLocation = isRefAtLocation;
5
- const language_core_1 = require("@vue/language-core");
6
- function isRefAtLocation(ts, language, program, sourceScript, virtualCode, position, isTsPlugin) {
7
- const serviceScript = sourceScript.generated.languagePlugin.typescript?.getServiceScript(virtualCode);
8
- if (!serviceScript) {
9
- return false;
10
- }
11
- let mapped = false;
12
- for (const [_sourceScript, map] of language.maps.forEach(serviceScript.code)) {
13
- for (const [position2, mapping] of map.toGeneratedLocation(position)) {
14
- if ((0, language_core_1.isCompletionEnabled)(mapping.data)) {
15
- position = position2;
16
- mapped = true;
17
- break;
18
- }
19
- }
20
- if (mapped) {
21
- break;
22
- }
23
- }
24
- if (!mapped) {
25
- return false;
26
- }
27
- position += isTsPlugin ? sourceScript.snapshot.getLength() : 0;
28
- const sourceFile = program.getSourceFile(virtualCode.fileName);
29
- if (!sourceFile) {
30
- return false;
31
- }
32
- const node = findPositionIdentifier(sourceFile, sourceFile, position);
33
- if (!node) {
34
- return false;
35
- }
36
- const checker = program.getTypeChecker();
37
- const type = checker.getTypeAtLocation(node);
38
- const props = type.getProperties();
39
- return props.some(prop => prop.escapedName === 'value' && prop.flags & ts.SymbolFlags.Accessor);
40
- function findPositionIdentifier(sourceFile, node, offset) {
41
- let result;
42
- node.forEachChild(child => {
43
- if (!result) {
44
- if (child.end === offset && ts.isIdentifier(child)) {
45
- result = child;
46
- }
47
- else if (child.end >= offset && child.getStart(sourceFile) < offset) {
48
- result = findPositionIdentifier(sourceFile, child, offset);
49
- }
50
- }
51
- });
52
- return result;
53
- }
54
- }
55
- //# sourceMappingURL=isRefAtLocation.js.map
@@ -1,4 +0,0 @@
1
- import type { RequestContext } from './types';
2
- export declare function resolveModuleName(this: RequestContext, fileName: string, moduleName: string): {
3
- name?: string;
4
- };
@@ -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
@@ -1,8 +0,0 @@
1
- import type { Language } from '@vue/language-core';
2
- import type * as ts from 'typescript';
3
- export interface RequestContext {
4
- typescript: typeof ts;
5
- languageService: ts.LanguageService;
6
- languageServiceHost: ts.LanguageServiceHost;
7
- language: Language<string>;
8
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map