vue-tsc 0.37.3 → 0.37.8
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/bin/vue-tsc.js +3 -3
- package/out/apis.d.ts +5 -5
- package/out/apis.js +16 -16
- package/out/proxy.js +7 -14
- package/package.json +3 -3
package/bin/vue-tsc.js
CHANGED
|
@@ -12,15 +12,15 @@ fs.readFileSync = (...args) => {
|
|
|
12
12
|
// add *.vue files to allow extensions
|
|
13
13
|
tsc = tsc.replace(
|
|
14
14
|
`ts.supportedTSExtensions = [[".ts", ".tsx", ".d.ts"], [".cts", ".d.cts"], [".mts", ".d.mts"]];`,
|
|
15
|
-
`ts.supportedTSExtensions = [[".ts", ".tsx", ".d.ts"], [".cts", ".d.cts"], [".mts", ".d.mts"], [".vue", ".md"]];`,
|
|
15
|
+
`ts.supportedTSExtensions = [[".ts", ".tsx", ".d.ts"], [".cts", ".d.cts"], [".mts", ".d.mts"], [".vue", ".md", ".html"]];`,
|
|
16
16
|
);
|
|
17
17
|
tsc = tsc.replace(
|
|
18
18
|
`ts.supportedJSExtensions = [[".js", ".jsx"], [".mjs"], [".cjs"]];`,
|
|
19
|
-
`ts.supportedJSExtensions = [[".js", ".jsx"], [".mjs"], [".cjs"], [".vue", ".md"]];`,
|
|
19
|
+
`ts.supportedJSExtensions = [[".js", ".jsx"], [".mjs"], [".cjs"], [".vue", ".md", ".html"]];`,
|
|
20
20
|
);
|
|
21
21
|
tsc = tsc.replace(
|
|
22
22
|
`var allSupportedExtensions = [[".ts", ".tsx", ".d.ts", ".js", ".jsx"], [".cts", ".d.cts", ".cjs"], [".mts", ".d.mts", ".mjs"]];`,
|
|
23
|
-
`var allSupportedExtensions = [[".ts", ".tsx", ".d.ts", ".js", ".jsx"], [".cts", ".d.cts", ".cjs"], [".mts", ".d.mts", ".mjs"], [".vue", ".md"]];`,
|
|
23
|
+
`var allSupportedExtensions = [[".ts", ".tsx", ".d.ts", ".js", ".jsx"], [".cts", ".d.cts", ".cjs"], [".mts", ".d.mts", ".mjs"], [".vue", ".md", ".html"]];`,
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
// proxy createProgram apis
|
package/out/apis.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
2
|
-
import type
|
|
3
|
-
export declare function register(ts: typeof import('typescript/lib/tsserverlibrary'),
|
|
2
|
+
import type * as vueTs from '@volar/vue-typescript';
|
|
3
|
+
export declare function register(ts: typeof import('typescript/lib/tsserverlibrary'), vueLsCtx: vueTs.LanguageServiceContext): {
|
|
4
4
|
getRootFileNames: () => string[];
|
|
5
5
|
emit: (targetSourceFile?: ts.SourceFile, _writeFile?: ts.WriteFileCallback, cancellationToken?: ts.CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: ts.CustomTransformers) => ts.EmitResult;
|
|
6
|
-
getSyntacticDiagnostics: (sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken) => readonly ts.
|
|
7
|
-
getSemanticDiagnostics: (sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken) => readonly ts.
|
|
6
|
+
getSyntacticDiagnostics: (sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken) => readonly ts.DiagnosticWithLocation[] | readonly ts.Diagnostic[];
|
|
7
|
+
getSemanticDiagnostics: (sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken) => readonly ts.DiagnosticWithLocation[] | readonly ts.Diagnostic[];
|
|
8
8
|
getGlobalDiagnostics: (cancellationToken?: ts.CancellationToken) => readonly ts.Diagnostic[];
|
|
9
|
-
getBindAndCheckDiagnostics: (sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken) => readonly ts.
|
|
9
|
+
getBindAndCheckDiagnostics: (sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken) => readonly ts.DiagnosticWithLocation[] | readonly ts.Diagnostic[];
|
|
10
10
|
};
|
package/out/apis.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
function register(ts,
|
|
4
|
+
function register(ts, vueLsCtx) {
|
|
5
5
|
return {
|
|
6
6
|
getRootFileNames,
|
|
7
7
|
emit,
|
|
@@ -11,7 +11,7 @@ function register(ts, context, vueLsHost) {
|
|
|
11
11
|
getBindAndCheckDiagnostics,
|
|
12
12
|
};
|
|
13
13
|
function getRootFileNames() {
|
|
14
|
-
return getProgram().getRootFileNames().filter(fileName => { var _a, _b; return (_b = (_a =
|
|
14
|
+
return getProgram().getRootFileNames().filter(fileName => { var _a, _b; return (_b = (_a = vueLsCtx.typescriptLanguageServiceHost).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) {
|
|
@@ -27,7 +27,7 @@ function register(ts, context, vueLsHost) {
|
|
|
27
27
|
function getSourceFileDiagnosticsWorker(sourceFile, cancellationToken, api) {
|
|
28
28
|
var _a, _b;
|
|
29
29
|
if (sourceFile) {
|
|
30
|
-
const mapped =
|
|
30
|
+
const mapped = vueLsCtx.sourceFiles.fromEmbeddedFileName(sourceFile.fileName);
|
|
31
31
|
if (mapped) {
|
|
32
32
|
if (!mapped.embedded.file.capabilities.diagnostics)
|
|
33
33
|
return [];
|
|
@@ -44,7 +44,7 @@ function register(ts, context, vueLsHost) {
|
|
|
44
44
|
}
|
|
45
45
|
function emit(targetSourceFile, _writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
46
46
|
var _a;
|
|
47
|
-
const scriptResult = getProgram().emit(targetSourceFile, ((_a =
|
|
47
|
+
const scriptResult = getProgram().emit(targetSourceFile, ((_a = vueLsCtx.typescriptLanguageServiceHost.writeFile) !== null && _a !== void 0 ? _a : ts.sys.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
48
48
|
return {
|
|
49
49
|
emitSkipped: scriptResult.emitSkipped,
|
|
50
50
|
emittedFiles: scriptResult.emittedFiles,
|
|
@@ -52,35 +52,35 @@ function register(ts, context, vueLsHost) {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
function getProgram() {
|
|
55
|
-
return
|
|
55
|
+
return vueLsCtx.typescriptLanguageService.getProgram();
|
|
56
56
|
}
|
|
57
57
|
// transform
|
|
58
58
|
function transformDiagnostics(diagnostics) {
|
|
59
|
-
var _a, _b, _c, _d, _e;
|
|
59
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
60
60
|
const result = [];
|
|
61
61
|
for (const diagnostic of diagnostics) {
|
|
62
62
|
if (diagnostic.file !== undefined
|
|
63
63
|
&& diagnostic.start !== undefined
|
|
64
64
|
&& diagnostic.length !== undefined) {
|
|
65
65
|
let founded = false;
|
|
66
|
-
for (const tsOrVueLoc of
|
|
67
|
-
if (!((_a =
|
|
66
|
+
for (const tsOrVueLoc of vueLsCtx.sourceFiles.fromEmbeddedLocation(diagnostic.file.fileName, diagnostic.start, diagnostic.start + diagnostic.length, data => !!data.capabilities.diagnostic)) {
|
|
67
|
+
if (!((_b = (_a = vueLsCtx.typescriptLanguageServiceHost).fileExists) === null || _b === void 0 ? void 0 : _b.call(_a, tsOrVueLoc.fileName)))
|
|
68
68
|
continue;
|
|
69
|
-
onMapping(diagnostic, tsOrVueLoc.fileName, tsOrVueLoc.range.start, tsOrVueLoc.range.end, (
|
|
69
|
+
onMapping(diagnostic, tsOrVueLoc.fileName, tsOrVueLoc.range.start, tsOrVueLoc.range.end, (_c = tsOrVueLoc.mapped) === null || _c === void 0 ? void 0 : _c.vueFile.text);
|
|
70
70
|
founded = true;
|
|
71
71
|
break;
|
|
72
72
|
}
|
|
73
73
|
// fix https://github.com/johnsoncodehk/volar/issues/1372
|
|
74
74
|
if (!founded) {
|
|
75
|
-
for (const start of
|
|
76
|
-
if (!((
|
|
75
|
+
for (const start of vueLsCtx.sourceFiles.fromEmbeddedLocation(diagnostic.file.fileName, diagnostic.start, diagnostic.start, data => !!data.capabilities.diagnostic)) {
|
|
76
|
+
if (!((_e = (_d = vueLsCtx.typescriptLanguageServiceHost).fileExists) === null || _e === void 0 ? void 0 : _e.call(_d, start.fileName)))
|
|
77
77
|
continue;
|
|
78
|
-
for (const end of
|
|
79
|
-
if (!((
|
|
78
|
+
for (const end of vueLsCtx.sourceFiles.fromEmbeddedLocation(diagnostic.file.fileName, diagnostic.start + diagnostic.length, diagnostic.start + diagnostic.length, data => !!data.capabilities.diagnostic)) {
|
|
79
|
+
if (!((_g = (_f = vueLsCtx.typescriptLanguageServiceHost).fileExists) === null || _g === void 0 ? void 0 : _g.call(_f, end.fileName)))
|
|
80
80
|
continue;
|
|
81
81
|
if (start.fileName !== end.fileName)
|
|
82
82
|
continue;
|
|
83
|
-
onMapping(diagnostic, start.fileName, start.range.start, end.range.end, (
|
|
83
|
+
onMapping(diagnostic, start.fileName, start.range.start, end.range.end, (_h = start.mapped) === null || _h === void 0 ? void 0 : _h.vueFile.text);
|
|
84
84
|
founded = true;
|
|
85
85
|
break;
|
|
86
86
|
}
|
|
@@ -102,13 +102,13 @@ function register(ts, context, vueLsHost) {
|
|
|
102
102
|
: undefined;
|
|
103
103
|
if (!file) {
|
|
104
104
|
if (docText === undefined) {
|
|
105
|
-
const snapshot =
|
|
105
|
+
const snapshot = vueLsCtx.typescriptLanguageServiceHost.getScriptSnapshot(fileName);
|
|
106
106
|
if (snapshot) {
|
|
107
107
|
docText = snapshot.getText(0, snapshot.getLength());
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
else {
|
|
111
|
-
file = ts.createSourceFile(fileName, docText, fileName.endsWith('.vue') || fileName.endsWith('.md') ? ts.ScriptTarget.JSON : ts.ScriptTarget.Latest);
|
|
111
|
+
file = ts.createSourceFile(fileName, docText, fileName.endsWith('.vue') || fileName.endsWith('.md') || fileName.endsWith('.html') ? ts.ScriptTarget.JSON : ts.ScriptTarget.Latest);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
const newDiagnostic = Object.assign(Object.assign({}, diagnostic), { file, start: start, length: end - start });
|
package/out/proxy.js
CHANGED
|
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.loadTsLib = exports.createProgramProxy = void 0;
|
|
4
4
|
const ts = require("typescript/lib/tsserverlibrary");
|
|
5
5
|
const apis = require("./apis");
|
|
6
|
-
const
|
|
7
|
-
const vue_typescript_2 = require("@volar/vue-typescript");
|
|
6
|
+
const vueTs = require("@volar/vue-typescript");
|
|
8
7
|
let projectVersion = 0;
|
|
9
8
|
function createProgramProxy(options, // rootNamesOrOptions: readonly string[] | CreateProgramOptions,
|
|
10
9
|
_options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
@@ -26,24 +25,18 @@ _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
|
26
25
|
}, getScriptVersion,
|
|
27
26
|
getScriptSnapshot, getProjectVersion: () => {
|
|
28
27
|
return projectVersion.toString();
|
|
29
|
-
}, getProjectReferences: () => options.projectReferences });
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
vueLsHost: vueLsHost,
|
|
33
|
-
isVueTsc: true,
|
|
34
|
-
});
|
|
35
|
-
tsRuntime.update(); // must update before getProgram() to update virtual scripts
|
|
36
|
-
const proxyApis = apis.register(ts, tsRuntime, vueLsHost);
|
|
28
|
+
}, getProjectReferences: () => options.projectReferences, isTsc: true });
|
|
29
|
+
const vueLsCtx = (_b = (_a = options.oldProgram) === null || _a === void 0 ? void 0 : _a.__VLS_vueCtx) !== null && _b !== void 0 ? _b : vueTs.createLanguageServiceContext(ts, vueLsHost);
|
|
30
|
+
const proxyApis = apis.register(ts, vueLsCtx);
|
|
37
31
|
const program = new Proxy({}, {
|
|
38
32
|
get: (_, property) => {
|
|
39
|
-
tsRuntime.update();
|
|
40
33
|
if (property in proxyApis) {
|
|
41
34
|
return proxyApis[property];
|
|
42
35
|
}
|
|
43
|
-
return
|
|
36
|
+
return vueLsCtx.typescriptLanguageService.getProgram()[property];
|
|
44
37
|
},
|
|
45
38
|
});
|
|
46
|
-
program.
|
|
39
|
+
program.__VLS_vueCtx = vueLsCtx;
|
|
47
40
|
for (const rootName of options.rootNames) {
|
|
48
41
|
// register file watchers
|
|
49
42
|
host.getSourceFile(rootName, ts.ScriptTarget.ESNext);
|
|
@@ -52,7 +45,7 @@ _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
|
52
45
|
function getVueCompilerOptions() {
|
|
53
46
|
const tsConfig = options.options.configFilePath;
|
|
54
47
|
if (typeof tsConfig === 'string') {
|
|
55
|
-
return
|
|
48
|
+
return vueTs.tsShared.createParsedCommandLine(ts, ts.sys, tsConfig).vueOptions;
|
|
56
49
|
}
|
|
57
50
|
return {};
|
|
58
51
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-tsc",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.8",
|
|
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.37.
|
|
19
|
+
"@volar/vue-typescript": "0.37.8"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"typescript": "*"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "22fce979edb8cb2473ee46c2059b95611cf97e64"
|
|
25
25
|
}
|