diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-02 14:05:23 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-02 14:05:23 +0000 |
commit | 856e4ba126ae776753f38c00593c02c4f43be510 (patch) | |
tree | 94671175f90d50e215b6ead77de44fd8a39d3f8e /editors/code | |
parent | 9006cec4928a28e4b70f536fc740fad5e82319d1 (diff) | |
parent | f08297983faac35e0b0fd475bc935ba0bc0726cb (diff) |
Merge #2979
2979: vscode: now we are actually using tslib r=matklad a=Veetaha
We had an incorrect setup where `tslib` was in `devDependencies`.
FYI:
tslib is a runtime dependency, it contains functions that are used by transpiled JavaScript in order not to inline them in each file.
For example:
```ts
// foo.ts (source code)
import * as foo from "foo";
// ---------------------------
// foo.js (compiled output)
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const foo = __importStar(require("foo"));
```
As you see, `tsc` generated that `__importStar` helper function in compiled output. And it generates it per each file if you don't enable `"importHelpers": true`. Now with `importHelpers` enabled we get the following picture:
```ts
// foo.ts (source code)
import * as foo from "foo";
// ---------------------------
// foo.js (compiled output)
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const foo = tslib_1.__importStar(require("foo"));
```
It saves some bundle size, but I am not entirely sure wheter we want that. Discussions are welcome!
Co-authored-by: Veetaha <[email protected]>
Diffstat (limited to 'editors/code')
-rw-r--r-- | editors/code/package-lock.json | 3 | ||||
-rw-r--r-- | editors/code/package.json | 4 | ||||
-rw-r--r-- | editors/code/tsconfig.json | 1 |
3 files changed, 4 insertions, 4 deletions
diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json index f92ce1fe2..02e17d184 100644 --- a/editors/code/package-lock.json +++ b/editors/code/package-lock.json | |||
@@ -749,8 +749,7 @@ | |||
749 | "tslib": { | 749 | "tslib": { |
750 | "version": "1.10.0", | 750 | "version": "1.10.0", |
751 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", | 751 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", |
752 | "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", | 752 | "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" |
753 | "dev": true | ||
754 | }, | 753 | }, |
755 | "tslint": { | 754 | "tslint": { |
756 | "version": "5.20.1", | 755 | "version": "5.20.1", |
diff --git a/editors/code/package.json b/editors/code/package.json index 4aefd4488..beb721210 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -26,7 +26,8 @@ | |||
26 | "dependencies": { | 26 | "dependencies": { |
27 | "jsonc-parser": "^2.1.0", | 27 | "jsonc-parser": "^2.1.0", |
28 | "seedrandom": "^3.0.5", | 28 | "seedrandom": "^3.0.5", |
29 | "vscode-languageclient": "^6.1.0" | 29 | "vscode-languageclient": "^6.1.0", |
30 | "tslib": "^1.10.0" | ||
30 | }, | 31 | }, |
31 | "devDependencies": { | 32 | "devDependencies": { |
32 | "@rollup/plugin-commonjs": "^11.0.1", | 33 | "@rollup/plugin-commonjs": "^11.0.1", |
@@ -36,7 +37,6 @@ | |||
36 | "@types/seedrandom": "^2.4.28", | 37 | "@types/seedrandom": "^2.4.28", |
37 | "@types/vscode": "^1.41.0", | 38 | "@types/vscode": "^1.41.0", |
38 | "rollup": "^1.30.1", | 39 | "rollup": "^1.30.1", |
39 | "tslib": "^1.10.0", | ||
40 | "tslint": "^5.20.1", | 40 | "tslint": "^5.20.1", |
41 | "typescript": "^3.7.5", | 41 | "typescript": "^3.7.5", |
42 | "typescript-formatter": "^7.2.2", | 42 | "typescript-formatter": "^7.2.2", |
diff --git a/editors/code/tsconfig.json b/editors/code/tsconfig.json index 1ea433961..1e17e4510 100644 --- a/editors/code/tsconfig.json +++ b/editors/code/tsconfig.json | |||
@@ -15,6 +15,7 @@ | |||
15 | "noFallthroughCasesInSwitch": true, | 15 | "noFallthroughCasesInSwitch": true, |
16 | "newLine": "LF", | 16 | "newLine": "LF", |
17 | "esModuleInterop": true, | 17 | "esModuleInterop": true, |
18 | "importHelpers": true | ||
18 | }, | 19 | }, |
19 | "exclude": [ | 20 | "exclude": [ |
20 | "node_modules" | 21 | "node_modules" |