@volar/typescript 2.4.0-alpha.11 → 2.4.0-alpha.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.
|
@@ -4,4 +4,7 @@ export declare let getLanguagePlugins: (ts: typeof import('typescript'), options
|
|
|
4
4
|
languagePlugins: LanguagePlugin<string>[];
|
|
5
5
|
setup?(language: Language<string>): void;
|
|
6
6
|
};
|
|
7
|
-
export declare function runTsc(tscPath: string,
|
|
7
|
+
export declare function runTsc(tscPath: string, extensionsOrOptions: string[] | {
|
|
8
|
+
supportedExtensions: string[];
|
|
9
|
+
extensionsToRemove: string[];
|
|
10
|
+
}, _getLanguagePlugins: typeof getLanguagePlugins): void;
|
package/lib/quickstart/runTsc.js
CHANGED
|
@@ -5,18 +5,26 @@ exports.runTsc = runTsc;
|
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
let getLanguagePlugins = () => [];
|
|
7
7
|
exports.getLanguagePlugins = getLanguagePlugins;
|
|
8
|
-
function runTsc(tscPath,
|
|
8
|
+
function runTsc(tscPath, extensionsOrOptions, _getLanguagePlugins) {
|
|
9
9
|
exports.getLanguagePlugins = _getLanguagePlugins;
|
|
10
10
|
const proxyApiPath = require.resolve('../node/proxyCreateProgram');
|
|
11
11
|
const readFileSync = fs.readFileSync;
|
|
12
12
|
fs.readFileSync = (...args) => {
|
|
13
13
|
if (args[0] === tscPath) {
|
|
14
14
|
let tsc = readFileSync(...args);
|
|
15
|
+
const supportedExtensions = Array.isArray(extensionsOrOptions) ? extensionsOrOptions : extensionsOrOptions.supportedExtensions;
|
|
16
|
+
const extensionsToRemove = Array.isArray(extensionsOrOptions) ? [] : extensionsOrOptions.extensionsToRemove;
|
|
15
17
|
// add allow extensions
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
if (supportedExtensions.length) {
|
|
19
|
+
const extsText = supportedExtensions.map(ext => `"${ext}"`).join(', ');
|
|
20
|
+
tsc = replace(tsc, /supportedTSExtensions = .*(?=;)/, s => s + `.concat([[${extsText}]])`);
|
|
21
|
+
tsc = replace(tsc, /supportedJSExtensions = .*(?=;)/, s => s + `.concat([[${extsText}]])`);
|
|
22
|
+
tsc = replace(tsc, /allSupportedExtensions = .*(?=;)/, s => s + `.concat([[${extsText}]])`);
|
|
23
|
+
}
|
|
24
|
+
if (extensionsToRemove.length) {
|
|
25
|
+
const extsText = extensionsToRemove.map(ext => `"${ext}"`).join(', ');
|
|
26
|
+
tsc = replace(tsc, /extensionsToRemove = .*(?=;)/, s => s + `.concat([${extsText}])`);
|
|
27
|
+
}
|
|
20
28
|
// proxy createProgram
|
|
21
29
|
tsc = replace(tsc, /function createProgram\(.+\) {/, s => `var createProgram = require(${JSON.stringify(proxyApiPath)}).proxyCreateProgram(`
|
|
22
30
|
+ [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/typescript",
|
|
3
|
-
"version": "2.4.0-alpha.
|
|
3
|
+
"version": "2.4.0-alpha.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
"directory": "packages/typescript"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@volar/language-core": "2.4.0-alpha.
|
|
15
|
+
"@volar/language-core": "2.4.0-alpha.13",
|
|
16
16
|
"path-browserify": "^1.0.1",
|
|
17
17
|
"vscode-uri": "^3.0.8"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/node": "latest",
|
|
21
21
|
"@types/path-browserify": "latest",
|
|
22
|
-
"@volar/language-service": "2.4.0-alpha.
|
|
22
|
+
"@volar/language-service": "2.4.0-alpha.13"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "5f6d5d8ec51a5dda702d071c283e9133254cae97"
|
|
25
25
|
}
|