vue-tsc 0.34.0 → 0.34.3
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 +9 -23
- package/out/proxy.js +7 -3
- 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[];
|
|
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
|
@@ -11,7 +11,7 @@ function register(ts, context) {
|
|
|
11
11
|
getBindAndCheckDiagnostics,
|
|
12
12
|
};
|
|
13
13
|
function getRootFileNames() {
|
|
14
|
-
return getProgram()
|
|
14
|
+
return getProgram().getRootFileNames().filter(fileName => context.getTsLsHost().fileExists?.(fileName));
|
|
15
15
|
}
|
|
16
16
|
// for vue-tsc --noEmit --watch
|
|
17
17
|
function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
|
|
@@ -28,32 +28,17 @@ function register(ts, context) {
|
|
|
28
28
|
if (sourceFile) {
|
|
29
29
|
const mapped = context.vueFiles.fromEmbeddedFileName(sourceFile.fileName);
|
|
30
30
|
if (mapped) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
embedded.file.fileName.endsWith('.jsx') ||
|
|
37
|
-
embedded.file.fileName.endsWith('.tsx');
|
|
38
|
-
if (!isTsFile || !embedded.file.capabilities.diagnostics)
|
|
39
|
-
continue;
|
|
40
|
-
const program = getProgram();
|
|
41
|
-
const embeddedSourceFile = program?.getSourceFile(embedded.file.fileName);
|
|
42
|
-
if (embeddedSourceFile) {
|
|
43
|
-
const errors = transformDiagnostics(program?.[api](embeddedSourceFile, cancellationToken) ?? []);
|
|
44
|
-
results = results.concat(errors);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return results;
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
return getProgram()?.[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;
|
|
51
36
|
}
|
|
52
37
|
}
|
|
53
|
-
return transformDiagnostics(getProgram()
|
|
38
|
+
return transformDiagnostics(getProgram()[api](sourceFile, cancellationToken) ?? []);
|
|
54
39
|
}
|
|
55
40
|
function getGlobalDiagnostics(cancellationToken) {
|
|
56
|
-
return transformDiagnostics(getProgram()
|
|
41
|
+
return transformDiagnostics(getProgram().getGlobalDiagnostics(cancellationToken) ?? []);
|
|
57
42
|
}
|
|
58
43
|
function emit(targetSourceFile, _writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
59
44
|
const scriptResult = getProgram().emit(targetSourceFile, (context.vueLsHost.writeFile ?? ts.sys.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
@@ -102,6 +87,7 @@ function register(ts, context) {
|
|
|
102
87
|
newDiagnostic.relatedInformation = transformDiagnostics(relatedInformation);
|
|
103
88
|
}
|
|
104
89
|
result.push(newDiagnostic);
|
|
90
|
+
break;
|
|
105
91
|
}
|
|
106
92
|
}
|
|
107
93
|
else if (diagnostic.file === undefined) {
|
package/out/proxy.js
CHANGED
|
@@ -19,7 +19,11 @@ _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
|
19
19
|
const vueLsHost = {
|
|
20
20
|
...host,
|
|
21
21
|
resolveModuleNames: undefined,
|
|
22
|
-
writeFile:
|
|
22
|
+
writeFile: (fileName, content) => {
|
|
23
|
+
if (fileName.indexOf('__VLS_') === -1) {
|
|
24
|
+
host.writeFile(fileName, content, false);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
23
27
|
getCompilationSettings: () => options.options,
|
|
24
28
|
getVueCompilationSettings: () => vueCompilerOptions,
|
|
25
29
|
getScriptFileNames: () => {
|
|
@@ -43,14 +47,14 @@ _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
|
43
47
|
vueLsHost: vueLsHost,
|
|
44
48
|
isVueTsc: true,
|
|
45
49
|
});
|
|
46
|
-
tsRuntime.update(
|
|
50
|
+
tsRuntime.update(); // must update before getProgram() to update virtual scripts
|
|
47
51
|
const tsProgram = tsRuntime.getTsLs().getProgram();
|
|
48
52
|
if (!tsProgram)
|
|
49
53
|
throw '!tsProgram';
|
|
50
54
|
const proxyApis = apis.register(ts, tsRuntime);
|
|
51
55
|
const program = new Proxy(tsProgram, {
|
|
52
56
|
get: (target, property) => {
|
|
53
|
-
tsRuntime.update(
|
|
57
|
+
tsRuntime.update();
|
|
54
58
|
return proxyApis[property] || target[property];
|
|
55
59
|
},
|
|
56
60
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-tsc",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.3",
|
|
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.34.
|
|
19
|
+
"@volar/vue-typescript": "0.34.3"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"typescript": "*"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "be2759ff46b63bbda69de29184bd6ab7df3be667"
|
|
25
25
|
}
|