vue-tsc 1.2.2-alpha.0 → 1.2.2-alpha.2
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/out/index.js +8 -21
- 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
|
-
|
|
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
|
-
|
|
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 (
|
|
80
|
+
if (script?.projectVersion === ctx.projectVersion) {
|
|
94
81
|
return script;
|
|
95
82
|
}
|
|
96
|
-
const modifiedTime =
|
|
97
|
-
if (
|
|
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:
|
|
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 = (
|
|
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: (() =>
|
|
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.2-alpha.
|
|
3
|
+
"version": "1.2.2-alpha.2",
|
|
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.2-alpha.
|
|
21
|
-
"@volar/vue-typescript": "1.2.2-alpha.
|
|
20
|
+
"@volar/vue-language-core": "1.2.2-alpha.2",
|
|
21
|
+
"@volar/vue-typescript": "1.2.2-alpha.2"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"typescript": "*"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "2b2f0c453e04f9ada4a39154a3ef8edde664029c"
|
|
27
27
|
}
|