vue-tsc 2.0.11 → 2.0.13

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.
Files changed (2) hide show
  1. package/index.js +8 -7
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
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
+ const path = require("path");
6
7
  const windowsPathReg = /\\/g;
7
8
  function run() {
8
9
  let runExtensions = ['.vue'];
@@ -16,13 +17,12 @@ function run() {
16
17
  && runExtensions.every(ext => vueOptions.extensions.includes(ext))) {
17
18
  const writeFile = options.host.writeFile.bind(options.host);
18
19
  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);
20
+ if (!vueLanguagePlugin.pluginContext.globalTypesHolder) {
21
+ return writeFile(fileName, contents, ...args);
24
22
  }
25
- return writeFile(fileName, contents, ...args);
23
+ const writeFileName = path.basename(vueLanguagePlugin.getCanonicalFileName(fileName));
24
+ const globalTypesFileName = path.basename(vueLanguagePlugin.getCanonicalFileName(vueLanguagePlugin.pluginContext.globalTypesHolder));
25
+ return writeFile(fileName, writeFileName.startsWith(globalTypesFileName) ? removeEmitGlobalTypes(contents) : contents, ...args);
26
26
  };
27
27
  const vueLanguagePlugin = vue.createVueLanguagePlugin(ts, id => id, options.host?.useCaseSensitiveFileNames?.() ?? false, () => '', () => options.rootNames.map(rootName => rootName.replace(windowsPathReg, '/')), options.options, vueOptions, false);
28
28
  return [vueLanguagePlugin];
@@ -47,8 +47,9 @@ function run() {
47
47
  }
48
48
  }
49
49
  exports.run = run;
50
+ const removeEmitGlobalTypesRegexp = /[^\n]*__VLS_globalTypesStart[\w\W]*__VLS_globalTypesEnd[^\n]*\n/g;
50
51
  function removeEmitGlobalTypes(dts) {
51
- return dts.replace(/[^\n]*__VLS_globalTypesStart[\w\W]*__VLS_globalTypesEnd[^\n]*\n/, '');
52
+ return dts.replace(removeEmitGlobalTypesRegexp, '');
52
53
  }
53
54
  exports.removeEmitGlobalTypes = removeEmitGlobalTypes;
54
55
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-tsc",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
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.2.0-alpha.6",
20
- "@vue/language-core": "2.0.11",
19
+ "@volar/typescript": "2.2.0-alpha.8",
20
+ "@vue/language-core": "2.0.13",
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": "c89f25ffc32c760130adeeac796b9a5d20585bf7"
29
+ "gitHead": "591d019acd0d34e390880d69b31fbc7b794b806b"
30
30
  }