Skip to content

Commit 5f5d967

Browse files
SimonSchickjohnnyreilly
authored andcommitted
chore: cleanup package and dependencies (#182)
chore: cleanup package and dependencies - change compile target to es6
1 parent 97c86d6 commit 5f5d967

31 files changed

+1298
-1544
lines changed

Diff for: .npmignore

-12
This file was deleted.

Diff for: .travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
language: node_js
22
node_js:
3+
- '6'
34
- '8'
45
install:
56
- yarn install
67
- yarn build
78
- yarn add $WEBPACK $TSLOADER $VUELOADER -D
89
- yarn lint
910
env:
10-
- WEBPACK=webpack@^4.0.0 TSLOADER=ts-loader@^4.3.0 VUELOADER=vue-loader@^15.2.4
11+
- WEBPACK=webpack@^4.0.0 TSLOADER=ts-loader@^5.0.0 VUELOADER=vue-loader@^15.2.4
1112
- WEBPACK=webpack@^3.10.0 TSLOADER=ts-loader@^3.4.0 VUELOADER=vue-loader@^13.5.0
1213
- WEBPACK=webpack@^2.7.0 TSLOADER=ts-loader@^3.4.0 VUELOADER=vue-loader@^13.5.0
1314
deploy:

Diff for: CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## 0.5.0
2+
* Removed unused dependency `resolve`.
3+
* Replace `lodash` usage with native calls.
4+
* ** Breaking Changes**:
5+
* Removed all getters from `NormalizedMessage`, use direct property access instead.
6+
* **Internal**:
7+
* Test against ts-loader v5
8+
* Enable all strict type checks
9+
* Update dev dependencies
10+
11+
112
## v0.4.15
213

314
* [Add `tslintAutoFix` option to be passed on to tslint to auto format typescript files](https://github.com/Realytics/fork-ts-checker-webpack-plugin/pull/174) (#174)

Diff for: fork-ts-checker-webpack-plugin-v0.4.11.tgz

-23.6 KB
Binary file not shown.

Diff for: package.json

+12-16
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "fork-ts-checker-webpack-plugin",
3-
"version": "0.4.15",
3+
"version": "0.5.0",
44
"description": "Runs typescript type checker and linter on separate process.",
55
"main": "lib/index.js",
6-
"types": "lib/types/index.d.ts",
6+
"types": "lib/index.d.ts",
77
"files": [
88
"lib"
99
],
@@ -51,27 +51,25 @@
5151
"devDependencies": {
5252
"@types/babel-code-frame": "^6.20.1",
5353
"@types/chokidar": "^1.7.5",
54-
"@types/lodash": "^4.14.117",
5554
"@types/micromatch": "^3.1.0",
5655
"@types/minimatch": "^3.0.1",
57-
"@types/node": "^8.0.26",
58-
"@types/resolve": "0.0.4",
59-
"@types/webpack": "^4.4.9",
60-
"chai": "^3.5.0",
61-
"css-loader": "^0.28.7",
56+
"@types/node": "^8.10.38",
57+
"@types/webpack": "^4.4.19",
58+
"chai": "^4.2.0",
59+
"css-loader": "0.28.11",
6260
"eslint": "^5.7.0",
63-
"husky": "^1.1.2",
61+
"husky": "^1.1.4",
6462
"istanbul": "^0.4.5",
65-
"lint-staged": "^7.3.0",
63+
"lint-staged": "^8.0.5",
6664
"mocha": "^5.2.0",
6765
"mock-fs": "^4.3.0",
68-
"mock-require": "^2.0.2",
66+
"mock-require": "^3.0.2",
6967
"prettier": "^1.14.3",
7068
"rimraf": "^2.5.4",
71-
"sinon": "^2.3.1",
72-
"ts-loader": "4.3.0",
69+
"sinon": "^7.1.1",
70+
"ts-loader": "^5.3.0",
7371
"tslint": "^5.11.0",
74-
"tslint-config-prettier": "^1.15.0",
72+
"tslint-config-prettier": "^1.16.0",
7573
"typescript": "^3.0.1",
7674
"vue": "^2.5.16",
7775
"vue-class-component": "^6.1.1",
@@ -88,10 +86,8 @@
8886
"babel-code-frame": "^6.22.0",
8987
"chalk": "^2.4.1",
9088
"chokidar": "^2.0.4",
91-
"lodash": "^4.17.11",
9289
"micromatch": "^3.1.10",
9390
"minimatch": "^3.0.4",
94-
"resolve": "^1.5.0",
9591
"tapable": "^1.0.0"
9692
},
9793
"husky": {

Diff for: src/CancellationToken.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,32 @@ interface CancellationTokenData {
1010
}
1111

1212
export class CancellationToken {
13-
isCancelled: boolean;
14-
cancellationFileName: string;
15-
lastCancellationCheckTime: number;
16-
constructor(cancellationFileName: string, isCancelled: boolean) {
13+
private isCancelled: boolean;
14+
private cancellationFileName: string;
15+
private lastCancellationCheckTime: number;
16+
constructor(cancellationFileName?: string, isCancelled?: boolean) {
1717
this.isCancelled = !!isCancelled;
1818
this.cancellationFileName =
1919
cancellationFileName || crypto.randomBytes(64).toString('hex');
2020
this.lastCancellationCheckTime = 0;
2121
}
2222

23-
static createFromJSON(json: CancellationTokenData) {
23+
public static createFromJSON(json: CancellationTokenData) {
2424
return new CancellationToken(json.cancellationFileName, json.isCancelled);
2525
}
2626

27-
toJSON() {
27+
public toJSON() {
2828
return {
2929
cancellationFileName: this.cancellationFileName,
3030
isCancelled: this.isCancelled
3131
};
3232
}
3333

34-
getCancellationFilePath() {
34+
public getCancellationFilePath() {
3535
return path.join(os.tmpdir(), this.cancellationFileName);
3636
}
3737

38-
isCancellationRequested() {
38+
public isCancellationRequested() {
3939
if (this.isCancelled) {
4040
return true;
4141
}
@@ -52,18 +52,18 @@ export class CancellationToken {
5252
return this.isCancelled;
5353
}
5454

55-
throwIfCancellationRequested() {
55+
public throwIfCancellationRequested() {
5656
if (this.isCancellationRequested()) {
5757
throw new ts.OperationCanceledException();
5858
}
5959
}
6060

61-
requestCancellation() {
61+
public requestCancellation() {
6262
fs.writeFileSync(this.getCancellationFilePath(), '');
6363
this.isCancelled = true;
6464
}
6565

66-
cleanupCancellation() {
66+
public cleanupCancellation() {
6767
if (this.isCancelled && fs.existsSync(this.getCancellationFilePath())) {
6868
fs.unlinkSync(this.getCancellationFilePath());
6969
this.isCancelled = false;

Diff for: src/FilesRegister.ts

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,70 @@
11
import * as ts from 'typescript';
2+
import { RuleFailure } from 'tslint';
23

3-
interface DataShape {
4-
source: ts.SourceFile;
4+
export interface DataShape {
5+
source?: ts.SourceFile;
56
linted: boolean;
6-
lints: any[];
7+
lints: RuleFailure[];
78
}
89

910
export class FilesRegister {
10-
files: { [filePath: string]: { mtime: number; data: DataShape } };
11-
dataFactory: (_data?: any) => DataShape; // It doesn't seem that the _data parameter is ever used?
11+
private files: { [filePath: string]: { mtime?: number; data: DataShape } };
1212

13-
constructor(dataFactory: (_data?: any) => DataShape) {
13+
constructor(private dataFactory: (_data?: DataShape) => DataShape) {
1414
this.files = {};
1515
this.dataFactory = dataFactory;
1616
}
1717

18-
keys() {
18+
public keys() {
1919
return Object.keys(this.files);
2020
}
2121

22-
add(filePath: string) {
22+
public add(filePath: string) {
2323
this.files[filePath] = {
2424
mtime: undefined,
2525
data: this.dataFactory(undefined)
2626
};
2727
}
2828

29-
remove(filePath: string) {
29+
public remove(filePath: string) {
3030
if (this.has(filePath)) {
3131
delete this.files[filePath];
3232
}
3333
}
3434

35-
has(filePath: string) {
35+
public has(filePath: string) {
3636
return this.files.hasOwnProperty(filePath);
3737
}
3838

39-
get(filePath: string) {
39+
public get(filePath: string) {
4040
if (!this.has(filePath)) {
4141
throw new Error('File "' + filePath + '" not found in register.');
4242
}
4343

4444
return this.files[filePath];
4545
}
4646

47-
ensure(filePath: string) {
47+
public ensure(filePath: string) {
4848
if (!this.has(filePath)) {
4949
this.add(filePath);
5050
}
5151
}
5252

53-
getData(filePath: string) {
53+
public getData(filePath: string) {
5454
return this.get(filePath).data;
5555
}
5656

57-
mutateData(filePath: string, mutator: (data: DataShape) => void) {
57+
public mutateData(filePath: string, mutator: (data: DataShape) => void) {
5858
this.ensure(filePath);
5959

6060
mutator(this.files[filePath].data);
6161
}
6262

63-
getMtime(filePath: string) {
63+
public getMtime(filePath: string) {
6464
return this.get(filePath).mtime;
6565
}
6666

67-
setMtime(filePath: string, mtime: number) {
67+
public setMtime(filePath: string, mtime: number) {
6868
this.ensure(filePath);
6969

7070
if (this.files[filePath].mtime !== mtime) {

Diff for: src/FilesWatcher.ts

+10-14
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
import * as chokidar from 'chokidar';
22
import * as path from 'path';
3-
import startsWith = require('lodash/startsWith');
43

54
export class FilesWatcher {
6-
watchPaths: string[];
7-
watchExtensions: string[];
8-
watchers: chokidar.FSWatcher[];
9-
listeners: { [eventName: string]: Function[] };
10-
constructor(watchPaths: string[], watchExtensions: string[]) {
11-
this.watchPaths = watchPaths;
5+
private watchers: chokidar.FSWatcher[];
6+
private listeners: { [eventName: string]: Function[] };
7+
constructor(private watchPaths: string[], private watchExtensions: string[]) {
128
this.watchExtensions = watchExtensions;
139
this.watchers = [];
1410
this.listeners = {};
1511
}
1612

17-
isFileSupported(filePath: string) {
13+
public isFileSupported(filePath: string) {
1814
return this.watchExtensions.indexOf(path.extname(filePath)) !== -1;
1915
}
2016

21-
watch() {
17+
public watch() {
2218
if (this.isWatching()) {
2319
throw new Error('Cannot watch again - already watching.');
2420
}
@@ -43,27 +39,27 @@ export class FilesWatcher {
4339
});
4440
}
4541

46-
isWatchingFile(filePath: string) {
42+
public isWatchingFile(filePath: string) {
4743
return (
4844
this.isWatching() &&
4945
this.isFileSupported(filePath) &&
50-
this.watchPaths.some(watchPath => startsWith(filePath, watchPath))
46+
this.watchPaths.some(watchPath => filePath.startsWith(watchPath))
5147
);
5248
}
5349

54-
isWatching() {
50+
public isWatching() {
5551
return this.watchers.length > 0;
5652
}
5753

58-
on(event: string, listener: Function) {
54+
public on(event: string, listener: Function) {
5955
if (!this.listeners[event]) {
6056
this.listeners[event] = [];
6157
}
6258

6359
this.listeners[event].push(listener);
6460
}
6561

66-
off(event: string, listener: Function) {
62+
public off(event: string, listener: Function) {
6763
if (this.listeners[event]) {
6864
this.listeners[event] = this.listeners[event].filter(
6965
oldListener => oldListener !== listener

0 commit comments

Comments
 (0)