vue-tsc 0.33.9 → 0.34.0
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/out/apis.d.ts +1 -1
- package/out/apis.js +19 -26
- package/out/proxy.js +1 -1
- package/package.json +3 -3
package/out/apis.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
2
2
|
import type { TypeScriptRuntime } from '@volar/vue-typescript';
|
|
3
3
|
export declare function register(ts: typeof import('typescript/lib/tsserverlibrary'), context: TypeScriptRuntime): {
|
|
4
|
-
getRootFileNames: () => string[];
|
|
4
|
+
getRootFileNames: () => string[] | undefined;
|
|
5
5
|
emit: (targetSourceFile?: ts.SourceFile | undefined, _writeFile?: ts.WriteFileCallback | undefined, cancellationToken?: ts.CancellationToken | undefined, emitOnlyDtsFiles?: boolean | undefined, customTransformers?: ts.CustomTransformers | undefined) => ts.EmitResult;
|
|
6
6
|
getSyntacticDiagnostics: (sourceFile?: ts.SourceFile | undefined, cancellationToken?: ts.CancellationToken | undefined) => readonly ts.DiagnosticWithLocation[] | readonly ts.Diagnostic[];
|
|
7
7
|
getSemanticDiagnostics: (sourceFile?: ts.SourceFile | undefined, cancellationToken?: ts.CancellationToken | undefined) => readonly ts.DiagnosticWithLocation[] | readonly ts.Diagnostic[];
|
package/out/apis.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const lsTypes = ['script', 'template'];
|
|
5
4
|
function register(ts, context) {
|
|
6
5
|
return {
|
|
7
6
|
getRootFileNames,
|
|
@@ -12,11 +11,7 @@ function register(ts, context) {
|
|
|
12
11
|
getBindAndCheckDiagnostics,
|
|
13
12
|
};
|
|
14
13
|
function getRootFileNames() {
|
|
15
|
-
|
|
16
|
-
...getProgram('script')?.getRootFileNames().filter(fileName => context.getTsLsHost('script').fileExists?.(fileName)) ?? [],
|
|
17
|
-
...getProgram('template')?.getRootFileNames().filter(fileName => context.getTsLsHost('template')?.fileExists?.(fileName)) ?? [],
|
|
18
|
-
]);
|
|
19
|
-
return [...set.values()];
|
|
14
|
+
return getProgram()?.getRootFileNames().filter(fileName => context.getTsLsHost().fileExists?.(fileName));
|
|
20
15
|
}
|
|
21
16
|
// for vue-tsc --noEmit --watch
|
|
22
17
|
function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
|
|
@@ -31,58 +26,56 @@ function register(ts, context) {
|
|
|
31
26
|
}
|
|
32
27
|
function getSourceFileDiagnosticsWorker(sourceFile, cancellationToken, api) {
|
|
33
28
|
if (sourceFile) {
|
|
34
|
-
const mapped = context.vueFiles.fromEmbeddedFileName(
|
|
29
|
+
const mapped = context.vueFiles.fromEmbeddedFileName(sourceFile.fileName);
|
|
35
30
|
if (mapped) {
|
|
36
31
|
let results = [];
|
|
37
32
|
const embeddeds = mapped.vueFile.getAllEmbeddeds();
|
|
38
33
|
for (const embedded of embeddeds) {
|
|
39
|
-
|
|
34
|
+
const isTsFile = embedded.file.fileName.endsWith('.js') ||
|
|
35
|
+
embedded.file.fileName.endsWith('.ts') ||
|
|
36
|
+
embedded.file.fileName.endsWith('.jsx') ||
|
|
37
|
+
embedded.file.fileName.endsWith('.tsx');
|
|
38
|
+
if (!isTsFile || !embedded.file.capabilities.diagnostics)
|
|
40
39
|
continue;
|
|
41
|
-
const program = getProgram(
|
|
40
|
+
const program = getProgram();
|
|
42
41
|
const embeddedSourceFile = program?.getSourceFile(embedded.file.fileName);
|
|
43
42
|
if (embeddedSourceFile) {
|
|
44
|
-
const errors = transformDiagnostics(
|
|
43
|
+
const errors = transformDiagnostics(program?.[api](embeddedSourceFile, cancellationToken) ?? []);
|
|
45
44
|
results = results.concat(errors);
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
return results;
|
|
49
48
|
}
|
|
50
49
|
else {
|
|
51
|
-
return getProgram(
|
|
50
|
+
return getProgram()?.[api](sourceFile, cancellationToken) ?? [];
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
|
-
return
|
|
53
|
+
return transformDiagnostics(getProgram()?.[api](sourceFile, cancellationToken) ?? []);
|
|
55
54
|
}
|
|
56
55
|
function getGlobalDiagnostics(cancellationToken) {
|
|
57
|
-
return
|
|
56
|
+
return transformDiagnostics(getProgram()?.getGlobalDiagnostics(cancellationToken) ?? []);
|
|
58
57
|
}
|
|
59
58
|
function emit(targetSourceFile, _writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
60
|
-
const scriptResult = getProgram(
|
|
61
|
-
const templateResult = getProgram('template')?.emit(targetSourceFile, undefined, cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
59
|
+
const scriptResult = getProgram().emit(targetSourceFile, (context.vueLsHost.writeFile ?? ts.sys.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
62
60
|
return {
|
|
63
61
|
emitSkipped: scriptResult.emitSkipped,
|
|
64
62
|
emittedFiles: scriptResult.emittedFiles,
|
|
65
|
-
diagnostics:
|
|
66
|
-
...transformDiagnostics('script', scriptResult.diagnostics),
|
|
67
|
-
...transformDiagnostics('template', templateResult?.diagnostics ?? []),
|
|
68
|
-
],
|
|
63
|
+
diagnostics: transformDiagnostics(scriptResult.diagnostics),
|
|
69
64
|
};
|
|
70
65
|
}
|
|
71
|
-
function getProgram(
|
|
72
|
-
return context.getTsLs(
|
|
66
|
+
function getProgram() {
|
|
67
|
+
return context.getTsLs().getProgram();
|
|
73
68
|
}
|
|
74
69
|
// transform
|
|
75
|
-
function transformDiagnostics(
|
|
70
|
+
function transformDiagnostics(diagnostics) {
|
|
76
71
|
const result = [];
|
|
77
72
|
for (const diagnostic of diagnostics) {
|
|
78
73
|
if (diagnostic.file !== undefined
|
|
79
74
|
&& diagnostic.start !== undefined
|
|
80
75
|
&& diagnostic.length !== undefined) {
|
|
81
|
-
for (const tsOrVueLoc of context.vueFiles.fromEmbeddedLocation(
|
|
76
|
+
for (const tsOrVueLoc of context.vueFiles.fromEmbeddedLocation(diagnostic.file.fileName, diagnostic.start, diagnostic.start + diagnostic.length, data => !!data.capabilities.diagnostic)) {
|
|
82
77
|
if (!context.vueLsHost.fileExists?.(tsOrVueLoc.fileName))
|
|
83
78
|
continue;
|
|
84
|
-
if (!tsOrVueLoc.mapped && lsType !== 'script')
|
|
85
|
-
continue;
|
|
86
79
|
let file = tsOrVueLoc.fileName === diagnostic.file.fileName
|
|
87
80
|
? diagnostic.file
|
|
88
81
|
: undefined;
|
|
@@ -106,7 +99,7 @@ function register(ts, context) {
|
|
|
106
99
|
};
|
|
107
100
|
const relatedInformation = diagnostic.relatedInformation;
|
|
108
101
|
if (relatedInformation) {
|
|
109
|
-
newDiagnostic.relatedInformation = transformDiagnostics(
|
|
102
|
+
newDiagnostic.relatedInformation = transformDiagnostics(relatedInformation);
|
|
110
103
|
}
|
|
111
104
|
result.push(newDiagnostic);
|
|
112
105
|
}
|
package/out/proxy.js
CHANGED
|
@@ -44,7 +44,7 @@ _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
|
44
44
|
isVueTsc: true,
|
|
45
45
|
});
|
|
46
46
|
tsRuntime.update(true); // must update before getProgram() to update virtual scripts
|
|
47
|
-
const tsProgram = tsRuntime.getTsLs(
|
|
47
|
+
const tsProgram = tsRuntime.getTsLs().getProgram();
|
|
48
48
|
if (!tsProgram)
|
|
49
49
|
throw '!tsProgram';
|
|
50
50
|
const proxyApis = apis.register(ts, tsRuntime);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-tsc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"bin",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"vue-tsc": "./bin/vue-tsc.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@volar/vue-typescript": "0.
|
|
19
|
+
"@volar/vue-typescript": "0.34.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"typescript": "*"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "1a70119c77eca70c56d5a99da0322c087a6cb33b"
|
|
25
25
|
}
|