vue-tsc 1.7.8 → 1.7.9
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/bin/vue-tsc.js +15 -4
- package/out/index.d.ts +1 -1
- package/out/index.js +50 -24
- package/package.json +6 -5
package/bin/vue-tsc.js
CHANGED
|
@@ -21,10 +21,21 @@ fs.readFileSync = (...args) => {
|
|
|
21
21
|
|
|
22
22
|
// patches logic for checking root file extension in build program for incremental builds
|
|
23
23
|
if (semver.gt(tsPkg.version, '5.0.0')) {
|
|
24
|
-
tryReplace(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
tryReplace(
|
|
25
|
+
`for (const existingRoot of buildInfoVersionMap.roots) {`,
|
|
26
|
+
`for (const existingRoot of buildInfoVersionMap.roots
|
|
27
|
+
.filter(file => !file.toLowerCase().includes('__vls_'))
|
|
28
|
+
.map(file => file.replace(/\.vue\.(j|t)sx?$/i, '.vue'))
|
|
29
|
+
) {`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
if (semver.gte(tsPkg.version, '5.0.4')) {
|
|
33
|
+
tryReplace(
|
|
34
|
+
`return createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, host);`,
|
|
35
|
+
s => `buildInfo.program.fileNames = buildInfo.program.fileNames
|
|
36
|
+
.filter(file => !file.toLowerCase().includes('__vls_'))
|
|
37
|
+
.map(file => file.replace(/\.vue\.(j|t)sx?$/i, '.vue'));\n` + s
|
|
38
|
+
);
|
|
28
39
|
}
|
|
29
40
|
|
|
30
41
|
return tsc;
|
package/out/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type _Program = ts.Program & {
|
|
|
8
8
|
interface ProgramContext {
|
|
9
9
|
projectVersion: number;
|
|
10
10
|
options: ts.CreateProgramOptions;
|
|
11
|
-
|
|
11
|
+
languageHost: vue.TypeScriptLanguageHost;
|
|
12
12
|
vueCompilerOptions: Partial<vue.VueCompilerOptions>;
|
|
13
13
|
languageService: ReturnType<typeof vueTs.createLanguageService>;
|
|
14
14
|
}
|
package/out/index.js
CHANGED
|
@@ -5,6 +5,8 @@ const ts = require("typescript");
|
|
|
5
5
|
const vue = require("@vue/language-core");
|
|
6
6
|
const vueTs = require("@vue/typescript");
|
|
7
7
|
const shared_1 = require("./shared");
|
|
8
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
9
|
+
const fs = require("fs");
|
|
8
10
|
function createProgram(options) {
|
|
9
11
|
if (!options.options.noEmit && !options.options.emitDeclarationOnly)
|
|
10
12
|
throw toThrow('js emit is not supported');
|
|
@@ -23,8 +25,8 @@ function createProgram(options) {
|
|
|
23
25
|
const ctx = {
|
|
24
26
|
projectVersion: 0,
|
|
25
27
|
options,
|
|
26
|
-
get
|
|
27
|
-
return
|
|
28
|
+
get languageHost() {
|
|
29
|
+
return languageHost;
|
|
28
30
|
},
|
|
29
31
|
get vueCompilerOptions() {
|
|
30
32
|
return vueCompilerOptions;
|
|
@@ -35,35 +37,62 @@ function createProgram(options) {
|
|
|
35
37
|
};
|
|
36
38
|
const vueCompilerOptions = getVueCompilerOptions();
|
|
37
39
|
const scripts = new Map();
|
|
38
|
-
const
|
|
39
|
-
// avoid failed with tsc built-in fileExists
|
|
40
|
-
resolveModuleNames: undefined,
|
|
41
|
-
resolveModuleNameLiterals: undefined,
|
|
42
|
-
writeFile: (fileName, content) => {
|
|
43
|
-
if (fileName.indexOf('__VLS_') === -1) {
|
|
44
|
-
ctx.options.host.writeFile(fileName, content, false);
|
|
45
|
-
}
|
|
46
|
-
},
|
|
40
|
+
const languageHost = {
|
|
47
41
|
getCompilationSettings: () => ctx.options.options,
|
|
48
42
|
getScriptFileNames: () => {
|
|
49
43
|
return ctx.options.rootNames;
|
|
50
44
|
},
|
|
51
|
-
getScriptVersion,
|
|
52
45
|
getScriptSnapshot,
|
|
53
46
|
getProjectVersion: () => {
|
|
54
|
-
return ctx.projectVersion
|
|
47
|
+
return ctx.projectVersion;
|
|
55
48
|
},
|
|
56
49
|
getProjectReferences: () => ctx.options.projectReferences,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
getCurrentDirectory: () => ctx.options.host.getCurrentDirectory().replace(/\\/g, '/'),
|
|
51
|
+
getCancellationToken: ctx.options.host.getCancellationToken ? () => ctx.options.host.getCancellationToken() : undefined,
|
|
52
|
+
};
|
|
53
|
+
const uriToFileName = (uri) => vscode_uri_1.URI.parse(uri).fsPath.replace(/\\/g, '/');
|
|
54
|
+
const fileNameToUri = (fileName) => vscode_uri_1.URI.file(fileName).toString();
|
|
55
|
+
const vueTsLs = vueTs.createLanguageService(languageHost, vueCompilerOptions, ts, {
|
|
56
|
+
uriToFileName,
|
|
57
|
+
fileNameToUri,
|
|
58
|
+
rootUri: vscode_uri_1.URI.parse(fileNameToUri(languageHost.getCurrentDirectory())),
|
|
59
|
+
fs: {
|
|
60
|
+
stat(uri) {
|
|
61
|
+
if (uri.startsWith('file://')) {
|
|
62
|
+
const stats = fs.statSync(uriToFileName(uri), { throwIfNoEntry: false });
|
|
63
|
+
if (stats) {
|
|
64
|
+
return {
|
|
65
|
+
type: stats.isFile() ? 1
|
|
66
|
+
: stats.isDirectory() ? 2
|
|
67
|
+
: stats.isSymbolicLink() ? 64
|
|
68
|
+
: 0,
|
|
69
|
+
ctime: stats.ctimeMs,
|
|
70
|
+
mtime: stats.mtimeMs,
|
|
71
|
+
size: stats.size,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
readFile(uri, encoding) {
|
|
77
|
+
if (uri.startsWith('file://')) {
|
|
78
|
+
return fs.readFileSync(uriToFileName(uri), { encoding: encoding ?? 'utf-8' });
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
readDirectory(uri) {
|
|
82
|
+
if (uri.startsWith('file://')) {
|
|
83
|
+
const dirName = uriToFileName(uri);
|
|
84
|
+
const files = fs.existsSync(dirName) ? fs.readdirSync(dirName, { withFileTypes: true }) : [];
|
|
85
|
+
return files.map(file => {
|
|
86
|
+
return [file.name, file.isFile() ? 1
|
|
87
|
+
: file.isDirectory() ? 2
|
|
88
|
+
: file.isSymbolicLink() ? 64
|
|
89
|
+
: 0];
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return [];
|
|
93
|
+
},
|
|
64
94
|
},
|
|
65
95
|
});
|
|
66
|
-
const vueTsLs = vueTs.createLanguageService(vueLsHost, vueCompilerOptions, ts);
|
|
67
96
|
program = vueTsLs.getProgram();
|
|
68
97
|
program.__vue = ctx;
|
|
69
98
|
function getVueCompilerOptions() {
|
|
@@ -73,9 +102,6 @@ function createProgram(options) {
|
|
|
73
102
|
}
|
|
74
103
|
return {};
|
|
75
104
|
}
|
|
76
|
-
function getScriptVersion(fileName) {
|
|
77
|
-
return getScript(fileName)?.version ?? '';
|
|
78
|
-
}
|
|
79
105
|
function getScriptSnapshot(fileName) {
|
|
80
106
|
return getScript(fileName)?.scriptSnapshot;
|
|
81
107
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-tsc",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.9",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -17,12 +17,13 @@
|
|
|
17
17
|
"vue-tsc": "./bin/vue-tsc.js"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@vue/language-core": "1.7.
|
|
21
|
-
"@vue/typescript": "1.7.
|
|
22
|
-
"semver": "^7.3.8"
|
|
20
|
+
"@vue/language-core": "1.7.9",
|
|
21
|
+
"@vue/typescript": "1.7.9",
|
|
22
|
+
"semver": "^7.3.8",
|
|
23
|
+
"vscode-uri": "^3.0.7"
|
|
23
24
|
},
|
|
24
25
|
"peerDependencies": {
|
|
25
26
|
"typescript": "*"
|
|
26
27
|
},
|
|
27
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "70f9ebedbc55a8d342ec425cc483dfe39c4b7489"
|
|
28
29
|
}
|