vue-tsc 2.0.7 → 2.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/index.d.ts +1 -2
- package/index.js +20 -32
- package/package.json +4 -4
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.removeEmitGlobalTypes = exports.run = void 0;
|
|
4
4
|
const runTsc_1 = require("@volar/typescript/lib/quickstart/runTsc");
|
|
5
5
|
const vue = require("@vue/language-core");
|
|
6
6
|
const windowsPathReg = /\\/g;
|
|
@@ -12,16 +12,30 @@ function run() {
|
|
|
12
12
|
const vueOptions = typeof configFilePath === 'string'
|
|
13
13
|
? vue.createParsedCommandLine(ts, ts.sys, configFilePath.replace(windowsPathReg, '/')).vueOptions
|
|
14
14
|
: vue.resolveVueCompilerOptions({});
|
|
15
|
-
const fakeGlobalTypesHolder = createFakeGlobalTypesHolder(options);
|
|
16
15
|
if (runExtensions.length === vueOptions.extensions.length
|
|
17
16
|
&& runExtensions.every(ext => vueOptions.extensions.includes(ext))) {
|
|
18
|
-
const
|
|
17
|
+
const writeFile = options.host.writeFile.bind(options.host);
|
|
18
|
+
options.host.writeFile = (fileName, contents, ...args) => {
|
|
19
|
+
if (fileName.endsWith('.d.ts')
|
|
20
|
+
&& vueLanguagePlugin
|
|
21
|
+
.getCanonicalFileName(fileName.replace(windowsPathReg, '/'))
|
|
22
|
+
.slice(0, -5) === vueLanguagePlugin.pluginContext.globalTypesHolder) {
|
|
23
|
+
contents = removeEmitGlobalTypes(contents);
|
|
24
|
+
}
|
|
25
|
+
return writeFile(fileName, contents, ...args);
|
|
26
|
+
};
|
|
27
|
+
const vueLanguagePlugin = vue.createVueLanguagePlugin(ts, id => id, options.host?.useCaseSensitiveFileNames?.() ?? false, () => '', () => options.rootNames.map(rootName => rootName.replace(windowsPathReg, '/')), options.options, vueOptions, false);
|
|
19
28
|
return [vueLanguagePlugin];
|
|
20
29
|
}
|
|
21
30
|
else {
|
|
22
31
|
runExtensions = vueOptions.extensions;
|
|
23
32
|
throw extensionsChangedException;
|
|
24
33
|
}
|
|
34
|
+
}, fileName => {
|
|
35
|
+
if (runExtensions.some(ext => fileName.endsWith(ext))) {
|
|
36
|
+
return 'vue';
|
|
37
|
+
}
|
|
38
|
+
return vue.resolveCommonLanguageId(fileName);
|
|
25
39
|
});
|
|
26
40
|
try {
|
|
27
41
|
main();
|
|
@@ -33,34 +47,8 @@ function run() {
|
|
|
33
47
|
}
|
|
34
48
|
}
|
|
35
49
|
exports.run = run;
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
if (firstVueFile) {
|
|
39
|
-
const fakeFileName = firstVueFile + '__VLS_globalTypes.vue';
|
|
40
|
-
options.rootNames.push(fakeFileName);
|
|
41
|
-
const fileExists = options.host.fileExists.bind(options.host);
|
|
42
|
-
const readFile = options.host.readFile.bind(options.host);
|
|
43
|
-
const writeFile = options.host.writeFile.bind(options.host);
|
|
44
|
-
options.host.fileExists = fileName => {
|
|
45
|
-
if (fileName.endsWith('__VLS_globalTypes.vue')) {
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
return fileExists(fileName);
|
|
49
|
-
};
|
|
50
|
-
options.host.readFile = fileName => {
|
|
51
|
-
if (fileName.endsWith('__VLS_globalTypes.vue')) {
|
|
52
|
-
return '<script setup lang="ts"></script>';
|
|
53
|
-
}
|
|
54
|
-
return readFile(fileName);
|
|
55
|
-
};
|
|
56
|
-
options.host.writeFile = (fileName, ...args) => {
|
|
57
|
-
if (fileName.endsWith('__VLS_globalTypes.vue.d.ts')) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
return writeFile(fileName, ...args);
|
|
61
|
-
};
|
|
62
|
-
return fakeFileName.replace(windowsPathReg, '/');
|
|
63
|
-
}
|
|
50
|
+
function removeEmitGlobalTypes(dts) {
|
|
51
|
+
return dts.replace(/[^\n]*__VLS_globalTypesStart[\w\W]*__VLS_globalTypesEnd[^\n]*\n/, '');
|
|
64
52
|
}
|
|
65
|
-
exports.
|
|
53
|
+
exports.removeEmitGlobalTypes = removeEmitGlobalTypes;
|
|
66
54
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-tsc",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"bin",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"vue-tsc": "./bin/vue-tsc.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@volar/typescript": "~2.
|
|
20
|
-
"@vue/language-core": "2.0.
|
|
19
|
+
"@volar/typescript": "~2.2.0-alpha.5",
|
|
20
|
+
"@vue/language-core": "2.0.10",
|
|
21
21
|
"semver": "^7.5.4"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "latest"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "a20a2ee950b63a949660b7e8faf0faed0e5bad33"
|
|
30
30
|
}
|