Skip to content

Commit 2dad936

Browse files
yanivefraimjohnnyreilly
authored andcommitted
fix useTypescriptIncrementalApi flag to work according to docs (#223)
* fix useTypescriptIncrementalApi * do not default to using incremental watch API in Vue mode * update changelog and bump version
1 parent 547d087 commit 2dad936

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v1.0.0-alpha.10
2+
3+
* [Fix incremental api to work with TS 3+ by default](https://github.com/Realytics/fork-ts-checker-webpack-plugin/pull/223)
4+
15
## v1.0.0-alpha.9
26

37
* [Default to incremental api usage to true if TS 3+](https://github.com/Realytics/fork-ts-checker-webpack-plugin/pull/217)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fork-ts-checker-webpack-plugin",
3-
"version": "1.0.0-alpha.9",
3+
"version": "1.0.0-alpha.10",
44
"description": "Runs typescript type checker and linter on separate process.",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,13 @@ class ForkTsCheckerWebpackPlugin {
205205

206206
this.validateVersions();
207207

208+
this.vue = options.vue === true; // default false
209+
208210
this.useTypescriptIncrementalApi =
209211
options.useTypescriptIncrementalApi === undefined
210-
? semver.gte(this.typescriptVersion, '3.0.0')
212+
? semver.gte(this.typescriptVersion, '3.0.0') && !this.vue
211213
: options.useTypescriptIncrementalApi;
212214

213-
this.vue = options.vue === true; // default false
214215
this.measureTime = options.measureCompilationTime === true;
215216
if (this.measureTime) {
216217
// Node 8+ only
@@ -571,8 +572,7 @@ class ForkTsCheckerWebpackPlugin {
571572
WORK_DIVISION: Math.max(1, this.workersNumber),
572573
MEMORY_LIMIT: this.memoryLimit,
573574
CHECK_SYNTACTIC_ERRORS: this.checkSyntacticErrors,
574-
USE_INCREMENTAL_API:
575-
this.options.useTypescriptIncrementalApi === true,
575+
USE_INCREMENTAL_API: this.useTypescriptIncrementalApi === true,
576576
VUE: this.vue
577577
},
578578
stdio: ['inherit', 'inherit', 'inherit', 'ipc']

test/unit/index.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,25 @@ describe('[UNIT] ForkTsCheckerWebpackPlugin', function() {
118118
expect(new ForkTsCheckerWebpackPlugin().useTypescriptIncrementalApi).to.be
119119
.true;
120120
});
121+
122+
it('should be false if useTypescriptIncrementalApi not supplied and typescript version < 3.0.0 and vue is true', function() {
123+
mockRequire('typescript', { version: '2.1.0' });
124+
var ForkTsCheckerWebpackPlugin = mockRequire.reRequire('../../lib/index');
125+
126+
expect(
127+
new ForkTsCheckerWebpackPlugin({ vue: true })
128+
.useTypescriptIncrementalApi
129+
).to.be.false;
130+
});
131+
132+
it('should be false if useTypescriptIncrementalApi not supplied and typescript version >= 3.0.0 and vue is true', function() {
133+
mockRequire('typescript', { version: '3.0.0' });
134+
var ForkTsCheckerWebpackPlugin = mockRequire.reRequire('../../lib/index');
135+
136+
expect(
137+
new ForkTsCheckerWebpackPlugin({ vue: true })
138+
.useTypescriptIncrementalApi
139+
).to.be.false;
140+
});
121141
});
122142
});

yarn.lock

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3691,8 +3691,9 @@ typedarray@^0.0.6:
36913691
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
36923692

36933693
typescript@^3.0.1:
3694-
version "3.2.2"
3695-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5"
3694+
version "3.3.3333"
3695+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.3333.tgz#171b2c5af66c59e9431199117a3bcadc66fdcfd6"
3696+
integrity sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw==
36963697

36973698
uglify-js@^3.1.4:
36983699
version "3.4.9"

0 commit comments

Comments
 (0)