vue-tsc 1.2.1 → 1.2.2-alpha.1

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/out/index.js +8 -21
  2. package/package.json +4 -4
package/out/index.js CHANGED
@@ -1,12 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  Object.defineProperty(exports, "__esModule", { value: true });
11
2
  exports.createProgram = void 0;
12
3
  const ts = require("typescript");
@@ -14,7 +5,6 @@ const vue = require("@volar/vue-language-core");
14
5
  const vueTs = require("@volar/vue-typescript");
15
6
  const shared_1 = require("./shared");
16
7
  function createProgram(options) {
17
- var _a, _b;
18
8
  if (!options.options.noEmit && !options.options.emitDeclarationOnly)
19
9
  throw toThrow('js emit is not supported');
20
10
  if (!options.options.noEmit && options.options.noEmitOnError)
@@ -80,21 +70,18 @@ function createProgram(options) {
80
70
  return {};
81
71
  }
82
72
  function getScriptVersion(fileName) {
83
- var _a, _b;
84
- return (_b = (_a = getScript(fileName)) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : '';
73
+ return getScript(fileName)?.version ?? '';
85
74
  }
86
75
  function getScriptSnapshot(fileName) {
87
- var _a;
88
- return (_a = getScript(fileName)) === null || _a === void 0 ? void 0 : _a.scriptSnapshot;
76
+ return getScript(fileName)?.scriptSnapshot;
89
77
  }
90
78
  function getScript(fileName) {
91
- var _a, _b, _c, _d, _e, _f, _g;
92
79
  const script = scripts.get(fileName);
93
- if ((script === null || script === void 0 ? void 0 : script.projectVersion) === ctx.projectVersion) {
80
+ if (script?.projectVersion === ctx.projectVersion) {
94
81
  return script;
95
82
  }
96
- const modifiedTime = (_d = (_c = (_b = (_a = ts.sys).getModifiedTime) === null || _b === void 0 ? void 0 : _b.call(_a, fileName)) === null || _c === void 0 ? void 0 : _c.valueOf()) !== null && _d !== void 0 ? _d : 0;
97
- if ((script === null || script === void 0 ? void 0 : script.modifiedTime) === modifiedTime) {
83
+ const modifiedTime = ts.sys.getModifiedTime?.(fileName)?.valueOf() ?? 0;
84
+ if (script?.modifiedTime === modifiedTime) {
98
85
  return script;
99
86
  }
100
87
  if (ctx.options.host.fileExists(fileName)) {
@@ -104,7 +91,7 @@ function createProgram(options) {
104
91
  projectVersion: ctx.projectVersion,
105
92
  modifiedTime,
106
93
  scriptSnapshot: ts.ScriptSnapshot.fromString(fileContent),
107
- version: (_g = (_f = (_e = ctx.options.host).createHash) === null || _f === void 0 ? void 0 : _f.call(_e, fileContent)) !== null && _g !== void 0 ? _g : fileContent,
94
+ version: ctx.options.host.createHash?.(fileContent) ?? fileContent,
108
95
  };
109
96
  scripts.set(fileName, script);
110
97
  return script;
@@ -119,14 +106,14 @@ function createProgram(options) {
119
106
  }
120
107
  const vueCompilerOptions = program.__vue.languageServiceHost.getVueCompilationSettings();
121
108
  if (vueCompilerOptions.hooks) {
122
- const index = ((_b = (_a = shared_1.state.hook) === null || _a === void 0 ? void 0 : _a.index) !== null && _b !== void 0 ? _b : -1) + 1;
109
+ const index = (shared_1.state.hook?.index ?? -1) + 1;
123
110
  if (index < vueCompilerOptions.hooks.length) {
124
111
  const hookPath = vueCompilerOptions.hooks[index];
125
112
  const hook = require(hookPath);
126
113
  shared_1.state.hook = {
127
114
  program,
128
115
  index,
129
- worker: (() => __awaiter(this, void 0, void 0, function* () { return yield hook(program); }))(),
116
+ worker: (async () => await hook(program))(),
130
117
  };
131
118
  throw 'hook';
132
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-tsc",
3
- "version": "1.2.1",
3
+ "version": "1.2.2-alpha.1",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -17,11 +17,11 @@
17
17
  "vue-tsc": "./bin/vue-tsc.js"
18
18
  },
19
19
  "dependencies": {
20
- "@volar/vue-language-core": "1.2.1",
21
- "@volar/vue-typescript": "1.2.1"
20
+ "@volar/vue-language-core": "1.2.2-alpha.1",
21
+ "@volar/vue-typescript": "1.2.2-alpha.1"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "typescript": "*"
25
25
  },
26
- "gitHead": "b984fa45fbdb96606abf0d211c76b78f0948139e"
26
+ "gitHead": "ec74b353fe44dc521a0e4048a8f4e18bd99a546f"
27
27
  }