vue-tsc 0.28.4 → 0.28.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/README.md +11 -0
- package/out/proxy.js +22 -5
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -10,8 +10,19 @@ Roadmap:
|
|
|
10
10
|
- [x] Use released LSP module
|
|
11
11
|
- [x] Make `typescript` as peerDependencies
|
|
12
12
|
- [x] Cleaner dependencies (remove `prettyhtml`, `prettier` etc.) (with `vscode-vue-languageservice` version >= 0.26.4)
|
|
13
|
+
- [x] dts emit support
|
|
13
14
|
- [ ] Watch mode support
|
|
14
15
|
|
|
16
|
+
## Using
|
|
17
|
+
|
|
18
|
+
Type check:
|
|
19
|
+
|
|
20
|
+
`vue-tsc --noEmit`
|
|
21
|
+
|
|
22
|
+
Build dts:
|
|
23
|
+
|
|
24
|
+
`vue-tsc --declaration --emitDeclarationOnly`
|
|
25
|
+
|
|
15
26
|
## Sponsors
|
|
16
27
|
|
|
17
28
|
This company is [sponsoring this project](https://github.com/sponsors/johnsoncodehk) to improve your DX. 💪
|
package/out/proxy.js
CHANGED
|
@@ -4,15 +4,16 @@ exports.createProgramProxy = void 0;
|
|
|
4
4
|
const ts = require("typescript/lib/tsserverlibrary");
|
|
5
5
|
const vue = require("vscode-vue-languageservice");
|
|
6
6
|
const path = require("path");
|
|
7
|
+
const shared = require("@volar/shared");
|
|
7
8
|
function createProgramProxy(options) {
|
|
8
|
-
if (!options.options.noEmit)
|
|
9
|
-
|
|
9
|
+
if (!options.options.noEmit && !options.options.emitDeclarationOnly)
|
|
10
|
+
return doThrow('js emit is not support');
|
|
10
11
|
if (!options.host)
|
|
11
|
-
|
|
12
|
+
return doThrow('!options.host');
|
|
12
13
|
if (!options.host.realpath)
|
|
13
|
-
|
|
14
|
+
return doThrow('!options.host.realpath');
|
|
14
15
|
if (!options.host.readDirectory)
|
|
15
|
-
|
|
16
|
+
return doThrow('!options.host.readDirectory');
|
|
16
17
|
const host = options.host;
|
|
17
18
|
const realpath = options.host.realpath;
|
|
18
19
|
const readDirectory = options.host.readDirectory;
|
|
@@ -28,15 +29,19 @@ function createProgramProxy(options) {
|
|
|
28
29
|
...options.rootNames.map(rootName => realpath(rootName)),
|
|
29
30
|
...getVueFileNames(),
|
|
30
31
|
];
|
|
32
|
+
const vueCompilerOptions = getVueCompilerOptions();
|
|
31
33
|
const scriptSnapshots = new Map();
|
|
32
34
|
const vueLsHost = {
|
|
33
35
|
...host,
|
|
34
36
|
writeFile: undefined,
|
|
35
37
|
getCompilationSettings: () => options.options,
|
|
38
|
+
getVueCompilationSettings: () => vueCompilerOptions,
|
|
36
39
|
getScriptFileNames: () => fileNames,
|
|
37
40
|
getScriptVersion: () => '',
|
|
38
41
|
getScriptSnapshot,
|
|
39
42
|
getProjectVersion: () => '',
|
|
43
|
+
getVueProjectVersion: () => '',
|
|
44
|
+
getProjectReferences: () => options.projectReferences,
|
|
40
45
|
};
|
|
41
46
|
const vueLs = vue.createLanguageService({ typescript: ts }, vueLsHost);
|
|
42
47
|
const program = vueLs.__internal__.tsProgramProxy;
|
|
@@ -50,6 +55,14 @@ function createProgramProxy(options) {
|
|
|
50
55
|
}
|
|
51
56
|
return [];
|
|
52
57
|
}
|
|
58
|
+
function getVueCompilerOptions() {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
const tsConfig = options.options.configFilePath;
|
|
61
|
+
if (typeof tsConfig === 'string') {
|
|
62
|
+
return (_b = (_a = shared.createParsedCommandLine(ts, ts.sys, tsConfig).raw) === null || _a === void 0 ? void 0 : _a.vueCompilerOptions) !== null && _b !== void 0 ? _b : {};
|
|
63
|
+
}
|
|
64
|
+
return {};
|
|
65
|
+
}
|
|
53
66
|
function getScriptSnapshot(fileName) {
|
|
54
67
|
const scriptSnapshot = scriptSnapshots.get(fileName);
|
|
55
68
|
if (scriptSnapshot) {
|
|
@@ -66,4 +79,8 @@ function createProgramProxy(options) {
|
|
|
66
79
|
}
|
|
67
80
|
}
|
|
68
81
|
exports.createProgramProxy = createProgramProxy;
|
|
82
|
+
function doThrow(msg) {
|
|
83
|
+
console.error(msg);
|
|
84
|
+
throw msg;
|
|
85
|
+
}
|
|
69
86
|
//# sourceMappingURL=proxy.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-tsc",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"bin",
|
|
@@ -15,10 +15,11 @@
|
|
|
15
15
|
"vue-tsc": "./bin/vue-tsc.js"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"
|
|
18
|
+
"@volar/shared": "0.28.8",
|
|
19
|
+
"vscode-vue-languageservice": "0.28.8"
|
|
19
20
|
},
|
|
20
21
|
"peerDependencies": {
|
|
21
22
|
"typescript": "*"
|
|
22
23
|
},
|
|
23
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "a2c73bf4ad69fc0038f00f1bd849c26eed28e1f3"
|
|
24
25
|
}
|