vue-tsc 1.0.9 → 1.0.10
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 +26 -40
- package/out/proxy.js +5 -5
- package/package.json +4 -4
package/bin/vue-tsc.js
CHANGED
|
@@ -6,46 +6,32 @@ const tscPath = require.resolve('typescript/lib/tsc');
|
|
|
6
6
|
const proxyPath = require.resolve('../out/proxy');
|
|
7
7
|
|
|
8
8
|
fs.readFileSync = (...args) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// proxy tracing
|
|
36
|
-
tsc = tsc.replace(
|
|
37
|
-
`ts.startTracing = tracingEnabled.startTracing;`,
|
|
38
|
-
`ts.startTracing = require(${JSON.stringify(proxyPath)}).loadTsLib().startTracing;`,
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
tsc = tsc.replace(
|
|
42
|
-
`ts.dumpTracingLegend = tracingEnabled.dumpLegend;`,
|
|
43
|
-
`ts.dumpTracingLegend = require(${JSON.stringify(proxyPath)}).loadTsLib().dumpTracingLegend;`,
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
return tsc;
|
|
47
|
-
}
|
|
48
|
-
return readFileSync(...args);
|
|
9
|
+
if (args[0] === tscPath) {
|
|
10
|
+
let tsc = readFileSync(...args);
|
|
11
|
+
|
|
12
|
+
// add *.vue files to allow extensions
|
|
13
|
+
tryReplace(/supportedTSExtensions = .*(?=;)/, s => s + '.concat([[".vue"]])');
|
|
14
|
+
tryReplace(/supportedJSExtensions = .*(?=;)/, s => s + '.concat([[".vue"]])');
|
|
15
|
+
tryReplace(/allSupportedExtensions = .*(?=;)/, s => s + '.concat([[".vue"]])');
|
|
16
|
+
|
|
17
|
+
// proxy startTracing, dumpTracingLegend
|
|
18
|
+
tryReplace(/ = tracingEnabled\./g, ` = require(${JSON.stringify(proxyPath)}).loadTsLib().`);
|
|
19
|
+
|
|
20
|
+
// proxy createProgram apis
|
|
21
|
+
tryReplace(/function createProgram\(.+\) {/, s => s + ` return require(${JSON.stringify(proxyPath)}).createProgramProxy(...arguments);`);
|
|
22
|
+
|
|
23
|
+
return tsc;
|
|
24
|
+
|
|
25
|
+
function tryReplace(search, replace) {
|
|
26
|
+
const before = tsc;
|
|
27
|
+
tsc = tsc.replace(search, replace);
|
|
28
|
+
const after = tsc;
|
|
29
|
+
if (after === before) {
|
|
30
|
+
throw 'Search string not found: ' + JSON.stringify(search.toString());
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return readFileSync(...args);
|
|
49
35
|
};
|
|
50
36
|
|
|
51
37
|
require(tscPath);
|
package/out/proxy.js
CHANGED
|
@@ -6,9 +6,9 @@ const vueTs = require("@volar/vue-typescript");
|
|
|
6
6
|
function createProgramProxy(options, // rootNamesOrOptions: readonly string[] | CreateProgramOptions,
|
|
7
7
|
_options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
8
8
|
if (!options.options.noEmit && !options.options.emitDeclarationOnly)
|
|
9
|
-
return doThrow('js emit is not
|
|
9
|
+
return doThrow('js emit is not supported');
|
|
10
10
|
if (!options.options.noEmit && options.options.noEmitOnError)
|
|
11
|
-
return doThrow('noEmitOnError is not
|
|
11
|
+
return doThrow('noEmitOnError is not supported');
|
|
12
12
|
if (!options.host)
|
|
13
13
|
return doThrow('!options.host');
|
|
14
14
|
let program = options.oldProgram;
|
|
@@ -49,7 +49,7 @@ _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
|
49
49
|
});
|
|
50
50
|
const vueTsLs = vueTs.createLanguageService(vueLsHost);
|
|
51
51
|
program = vueTsLs.getProgram();
|
|
52
|
-
program.
|
|
52
|
+
program.__vue = ctx;
|
|
53
53
|
function getVueCompilerOptions() {
|
|
54
54
|
const tsConfig = ctx.options.options.configFilePath;
|
|
55
55
|
if (typeof tsConfig === 'string') {
|
|
@@ -91,8 +91,8 @@ _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
94
|
-
program.
|
|
95
|
-
program.
|
|
94
|
+
program.__vue.options = options;
|
|
95
|
+
program.__vue.projectVersion++;
|
|
96
96
|
}
|
|
97
97
|
for (const rootName of options.rootNames) {
|
|
98
98
|
// register file watchers
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-tsc",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"bin",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"vue-tsc": "./bin/vue-tsc.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@volar/vue-language-core": "1.0.
|
|
20
|
-
"@volar/vue-typescript": "1.0.
|
|
19
|
+
"@volar/vue-language-core": "1.0.10",
|
|
20
|
+
"@volar/vue-typescript": "1.0.10"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"typescript": "*"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "89b82f92fdc30674b03941c5f17c60df8c46211c"
|
|
26
26
|
}
|