vue-tsc 0.34.6 → 0.34.9
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/README.md +9 -1
- package/out/apis.js +12 -13
- package/out/proxy.js +16 -26
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -29,8 +29,16 @@ Check out https://github.com/johnsoncodehk/volar/discussions/640#discussioncomme
|
|
|
29
29
|
|
|
30
30
|
## Sponsors
|
|
31
31
|
|
|
32
|
+
<p align="center">
|
|
33
|
+
<a href="https://cdn.jsdelivr.net/gh/johnsoncodehk/sponsors/company/sponsors.svg">
|
|
34
|
+
<img src="https://cdn.jsdelivr.net/gh/johnsoncodehk/sponsors/company/sponsors.svg"/>
|
|
35
|
+
</a>
|
|
36
|
+
</p>
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
32
40
|
<p align="center">
|
|
33
41
|
<a href="https://cdn.jsdelivr.net/gh/johnsoncodehk/sponsors/sponsors.svg">
|
|
34
|
-
<img src=
|
|
42
|
+
<img src="https://cdn.jsdelivr.net/gh/johnsoncodehk/sponsors/sponsors.svg"/>
|
|
35
43
|
</a>
|
|
36
44
|
</p>
|
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().getRootFileNames().filter(fileName => context.getTsLsHost().fileExists
|
|
14
|
+
return getProgram().getRootFileNames().filter(fileName => { var _a, _b; return (_b = (_a = context.getTsLsHost()).fileExists) === null || _b === void 0 ? void 0 : _b.call(_a, fileName); });
|
|
15
15
|
}
|
|
16
16
|
// for vue-tsc --noEmit --watch
|
|
17
17
|
function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
|
|
@@ -25,23 +25,26 @@ function register(ts, context) {
|
|
|
25
25
|
return getSourceFileDiagnosticsWorker(sourceFile, cancellationToken, 'getSemanticDiagnostics');
|
|
26
26
|
}
|
|
27
27
|
function getSourceFileDiagnosticsWorker(sourceFile, cancellationToken, api) {
|
|
28
|
+
var _a, _b;
|
|
28
29
|
if (sourceFile) {
|
|
29
30
|
const mapped = context.vueFiles.fromEmbeddedFileName(sourceFile.fileName);
|
|
30
31
|
if (mapped) {
|
|
31
32
|
if (!mapped.embedded.file.capabilities.diagnostics)
|
|
32
33
|
return [];
|
|
33
34
|
const program = getProgram();
|
|
34
|
-
const errors = transformDiagnostics(program
|
|
35
|
+
const errors = transformDiagnostics((_a = program === null || program === void 0 ? void 0 : program[api](sourceFile, cancellationToken)) !== null && _a !== void 0 ? _a : []);
|
|
35
36
|
return errors;
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
|
-
return transformDiagnostics(getProgram()[api](sourceFile, cancellationToken)
|
|
39
|
+
return transformDiagnostics((_b = getProgram()[api](sourceFile, cancellationToken)) !== null && _b !== void 0 ? _b : []);
|
|
39
40
|
}
|
|
40
41
|
function getGlobalDiagnostics(cancellationToken) {
|
|
41
|
-
|
|
42
|
+
var _a;
|
|
43
|
+
return transformDiagnostics((_a = getProgram().getGlobalDiagnostics(cancellationToken)) !== null && _a !== void 0 ? _a : []);
|
|
42
44
|
}
|
|
43
45
|
function emit(targetSourceFile, _writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
44
|
-
|
|
46
|
+
var _a;
|
|
47
|
+
const scriptResult = getProgram().emit(targetSourceFile, ((_a = context.vueLsHost.writeFile) !== null && _a !== void 0 ? _a : ts.sys.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
45
48
|
return {
|
|
46
49
|
emitSkipped: scriptResult.emitSkipped,
|
|
47
50
|
emittedFiles: scriptResult.emittedFiles,
|
|
@@ -53,19 +56,20 @@ function register(ts, context) {
|
|
|
53
56
|
}
|
|
54
57
|
// transform
|
|
55
58
|
function transformDiagnostics(diagnostics) {
|
|
59
|
+
var _a, _b, _c;
|
|
56
60
|
const result = [];
|
|
57
61
|
for (const diagnostic of diagnostics) {
|
|
58
62
|
if (diagnostic.file !== undefined
|
|
59
63
|
&& diagnostic.start !== undefined
|
|
60
64
|
&& diagnostic.length !== undefined) {
|
|
61
65
|
for (const tsOrVueLoc of context.vueFiles.fromEmbeddedLocation(diagnostic.file.fileName, diagnostic.start, diagnostic.start + diagnostic.length, data => !!data.capabilities.diagnostic)) {
|
|
62
|
-
if (!context.vueLsHost.fileExists
|
|
66
|
+
if (!((_b = (_a = context.vueLsHost).fileExists) === null || _b === void 0 ? void 0 : _b.call(_a, tsOrVueLoc.fileName)))
|
|
63
67
|
continue;
|
|
64
68
|
let file = tsOrVueLoc.fileName === diagnostic.file.fileName
|
|
65
69
|
? diagnostic.file
|
|
66
70
|
: undefined;
|
|
67
71
|
if (!file) {
|
|
68
|
-
let docText = tsOrVueLoc.mapped
|
|
72
|
+
let docText = (_c = tsOrVueLoc.mapped) === null || _c === void 0 ? void 0 : _c.vueFile.getContent();
|
|
69
73
|
if (docText === undefined) {
|
|
70
74
|
const snapshot = context.vueLsHost.getScriptSnapshot(tsOrVueLoc.fileName);
|
|
71
75
|
if (snapshot) {
|
|
@@ -76,12 +80,7 @@ function register(ts, context) {
|
|
|
76
80
|
file = ts.createSourceFile(tsOrVueLoc.fileName, docText, tsOrVueLoc.fileName.endsWith('.vue') ? ts.ScriptTarget.JSON : ts.ScriptTarget.Latest);
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
|
-
const newDiagnostic = {
|
|
80
|
-
...diagnostic,
|
|
81
|
-
file,
|
|
82
|
-
start: tsOrVueLoc.range.start,
|
|
83
|
-
length: tsOrVueLoc.range.end - tsOrVueLoc.range.start,
|
|
84
|
-
};
|
|
83
|
+
const newDiagnostic = Object.assign(Object.assign({}, diagnostic), { file, start: tsOrVueLoc.range.start, length: tsOrVueLoc.range.end - tsOrVueLoc.range.start });
|
|
85
84
|
const relatedInformation = diagnostic.relatedInformation;
|
|
86
85
|
if (relatedInformation) {
|
|
87
86
|
newDiagnostic.relatedInformation = transformDiagnostics(relatedInformation);
|
package/out/proxy.js
CHANGED
|
@@ -8,6 +8,7 @@ const vue_typescript_2 = require("@volar/vue-typescript");
|
|
|
8
8
|
let projectVersion = 0;
|
|
9
9
|
function createProgramProxy(options, // rootNamesOrOptions: readonly string[] | CreateProgramOptions,
|
|
10
10
|
_options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
11
|
+
var _a, _b;
|
|
11
12
|
if (!options.options.noEmit && !options.options.emitDeclarationOnly)
|
|
12
13
|
return doThrow('js emit is not support');
|
|
13
14
|
if (!options.host)
|
|
@@ -16,34 +17,20 @@ _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
|
16
17
|
const host = options.host;
|
|
17
18
|
const vueCompilerOptions = getVueCompilerOptions();
|
|
18
19
|
const scripts = new Map();
|
|
19
|
-
const vueLsHost = {
|
|
20
|
-
...host,
|
|
21
|
-
resolveModuleNames: undefined,
|
|
22
|
-
writeFile: (fileName, content) => {
|
|
20
|
+
const vueLsHost = Object.assign(Object.assign({}, host), { resolveModuleNames: undefined, writeFile: (fileName, content) => {
|
|
23
21
|
if (fileName.indexOf('__VLS_') === -1) {
|
|
24
22
|
host.writeFile(fileName, content, false);
|
|
25
23
|
}
|
|
26
|
-
},
|
|
27
|
-
getCompilationSettings: () => options.options,
|
|
28
|
-
getVueCompilationSettings: () => vueCompilerOptions,
|
|
29
|
-
getScriptFileNames: () => {
|
|
24
|
+
}, getCompilationSettings: () => options.options, getVueCompilationSettings: () => vueCompilerOptions, getScriptFileNames: () => {
|
|
30
25
|
return options.rootNames;
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
getScriptSnapshot,
|
|
34
|
-
getProjectVersion: () => {
|
|
26
|
+
}, getScriptVersion,
|
|
27
|
+
getScriptSnapshot, getProjectVersion: () => {
|
|
35
28
|
return projectVersion.toString();
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
return projectVersion.toString();
|
|
39
|
-
},
|
|
40
|
-
getProjectReferences: () => options.projectReferences,
|
|
41
|
-
};
|
|
42
|
-
const tsRuntime = options.oldProgram?.__VLS_tsRuntime ?? (0, vue_typescript_1.createTypeScriptRuntime)({
|
|
29
|
+
}, getProjectReferences: () => options.projectReferences });
|
|
30
|
+
const tsRuntime = (_b = (_a = options.oldProgram) === null || _a === void 0 ? void 0 : _a.__VLS_tsRuntime) !== null && _b !== void 0 ? _b : (0, vue_typescript_1.createTypeScriptRuntime)({
|
|
43
31
|
typescript: ts,
|
|
44
32
|
baseCssModuleType: 'any',
|
|
45
33
|
getCssClasses: () => ({}),
|
|
46
|
-
vueCompilerOptions,
|
|
47
34
|
vueLsHost: vueLsHost,
|
|
48
35
|
isVueTsc: true,
|
|
49
36
|
});
|
|
@@ -72,18 +59,21 @@ _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
|
72
59
|
return {};
|
|
73
60
|
}
|
|
74
61
|
function getScriptVersion(fileName) {
|
|
75
|
-
|
|
62
|
+
var _a, _b;
|
|
63
|
+
return (_b = (_a = getScript(fileName)) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : '';
|
|
76
64
|
}
|
|
77
65
|
function getScriptSnapshot(fileName) {
|
|
78
|
-
|
|
66
|
+
var _a;
|
|
67
|
+
return (_a = getScript(fileName)) === null || _a === void 0 ? void 0 : _a.scriptSnapshot;
|
|
79
68
|
}
|
|
80
69
|
function getScript(fileName) {
|
|
70
|
+
var _a, _b, _c, _d, _e, _f;
|
|
81
71
|
const script = scripts.get(fileName);
|
|
82
|
-
if (script
|
|
72
|
+
if ((script === null || script === void 0 ? void 0 : script.projectVersion) === projectVersion) {
|
|
83
73
|
return script;
|
|
84
74
|
}
|
|
85
|
-
const modifiedTime = ts.sys.getModifiedTime
|
|
86
|
-
if (script
|
|
75
|
+
const modifiedTime = (_d = (_c = (_b = (_a = ts.sys).getModifiedTime) === null || _b === void 0 ? void 0 : _b.call(_a, fileName)) === null || _c === void 0 ? void 0 : _c.valueOf()) !== null && _d !== void 0 ? _d : 0;
|
|
76
|
+
if ((script === null || script === void 0 ? void 0 : script.modifiedTime) === modifiedTime) {
|
|
87
77
|
return script;
|
|
88
78
|
}
|
|
89
79
|
if (host.fileExists(fileName)) {
|
|
@@ -93,7 +83,7 @@ _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
|
93
83
|
projectVersion,
|
|
94
84
|
modifiedTime,
|
|
95
85
|
scriptSnapshot: ts.ScriptSnapshot.fromString(fileContent),
|
|
96
|
-
version: host.createHash
|
|
86
|
+
version: (_f = (_e = host.createHash) === null || _e === void 0 ? void 0 : _e.call(host, fileContent)) !== null && _f !== void 0 ? _f : fileContent,
|
|
97
87
|
};
|
|
98
88
|
scripts.set(fileName, script);
|
|
99
89
|
return script;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-tsc",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.9",
|
|
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.9"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"typescript": "*"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "80523163eb73755da2b136be15c871e7a4c5ce6e"
|
|
25
25
|
}
|