vue-tsc 0.33.9 → 0.34.2
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.js +16 -38
- package/out/proxy.js +1 -1
- package/package.json +3 -3
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,41 @@ 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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const program = getProgram(embedded.file.lsType);
|
|
42
|
-
const embeddedSourceFile = program?.getSourceFile(embedded.file.fileName);
|
|
43
|
-
if (embeddedSourceFile) {
|
|
44
|
-
const errors = transformDiagnostics(embedded.file.lsType, program?.[api](embeddedSourceFile, cancellationToken) ?? []);
|
|
45
|
-
results = results.concat(errors);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return results;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
return getProgram('script')?.[api](sourceFile, cancellationToken) ?? [];
|
|
31
|
+
if (!mapped.embedded.file.capabilities.diagnostics)
|
|
32
|
+
return [];
|
|
33
|
+
const program = getProgram();
|
|
34
|
+
const errors = transformDiagnostics(program?.[api](sourceFile, cancellationToken) ?? []);
|
|
35
|
+
return errors;
|
|
52
36
|
}
|
|
53
37
|
}
|
|
54
|
-
return
|
|
38
|
+
return transformDiagnostics(getProgram()[api](sourceFile, cancellationToken) ?? []);
|
|
55
39
|
}
|
|
56
40
|
function getGlobalDiagnostics(cancellationToken) {
|
|
57
|
-
return
|
|
41
|
+
return transformDiagnostics(getProgram().getGlobalDiagnostics(cancellationToken) ?? []);
|
|
58
42
|
}
|
|
59
43
|
function emit(targetSourceFile, _writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
60
|
-
const scriptResult = getProgram(
|
|
61
|
-
const templateResult = getProgram('template')?.emit(targetSourceFile, undefined, cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
44
|
+
const scriptResult = getProgram().emit(targetSourceFile, (context.vueLsHost.writeFile ?? ts.sys.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
62
45
|
return {
|
|
63
46
|
emitSkipped: scriptResult.emitSkipped,
|
|
64
47
|
emittedFiles: scriptResult.emittedFiles,
|
|
65
|
-
diagnostics:
|
|
66
|
-
...transformDiagnostics('script', scriptResult.diagnostics),
|
|
67
|
-
...transformDiagnostics('template', templateResult?.diagnostics ?? []),
|
|
68
|
-
],
|
|
48
|
+
diagnostics: transformDiagnostics(scriptResult.diagnostics),
|
|
69
49
|
};
|
|
70
50
|
}
|
|
71
|
-
function getProgram(
|
|
72
|
-
return context.getTsLs(
|
|
51
|
+
function getProgram() {
|
|
52
|
+
return context.getTsLs().getProgram();
|
|
73
53
|
}
|
|
74
54
|
// transform
|
|
75
|
-
function transformDiagnostics(
|
|
55
|
+
function transformDiagnostics(diagnostics) {
|
|
76
56
|
const result = [];
|
|
77
57
|
for (const diagnostic of diagnostics) {
|
|
78
58
|
if (diagnostic.file !== undefined
|
|
79
59
|
&& diagnostic.start !== undefined
|
|
80
60
|
&& diagnostic.length !== undefined) {
|
|
81
|
-
for (const tsOrVueLoc of context.vueFiles.fromEmbeddedLocation(
|
|
61
|
+
for (const tsOrVueLoc of context.vueFiles.fromEmbeddedLocation(diagnostic.file.fileName, diagnostic.start, diagnostic.start + diagnostic.length, data => !!data.capabilities.diagnostic)) {
|
|
82
62
|
if (!context.vueLsHost.fileExists?.(tsOrVueLoc.fileName))
|
|
83
63
|
continue;
|
|
84
|
-
if (!tsOrVueLoc.mapped && lsType !== 'script')
|
|
85
|
-
continue;
|
|
86
64
|
let file = tsOrVueLoc.fileName === diagnostic.file.fileName
|
|
87
65
|
? diagnostic.file
|
|
88
66
|
: undefined;
|
|
@@ -106,7 +84,7 @@ function register(ts, context) {
|
|
|
106
84
|
};
|
|
107
85
|
const relatedInformation = diagnostic.relatedInformation;
|
|
108
86
|
if (relatedInformation) {
|
|
109
|
-
newDiagnostic.relatedInformation = transformDiagnostics(
|
|
87
|
+
newDiagnostic.relatedInformation = transformDiagnostics(relatedInformation);
|
|
110
88
|
}
|
|
111
89
|
result.push(newDiagnostic);
|
|
112
90
|
}
|
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.2",
|
|
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.2"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"typescript": "*"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "468f95dad9421f9c55f0674751ffd7afd45b8777"
|
|
25
25
|
}
|