fork-ts-checker-webpack-plugin 4.0.0-beta.3 → 4.0.2
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/LICENSE +1 -1
- package/README.md +21 -73
- package/lib/ApiIncrementalChecker.d.ts +2 -15
- package/lib/ApiIncrementalChecker.js +79 -109
- package/lib/ApiIncrementalChecker.js.map +1 -1
- package/lib/CancellationToken.js +32 -24
- package/lib/CancellationToken.js.map +1 -1
- package/lib/CompilerHost.d.ts +7 -7
- package/lib/CompilerHost.js +225 -155
- package/lib/CompilerHost.js.map +1 -1
- package/lib/FilesRegister.d.ts +2 -4
- package/lib/FilesRegister.js +24 -23
- package/lib/FilesRegister.js.map +1 -1
- package/lib/FsHelper.js +9 -1
- package/lib/FsHelper.js.map +1 -1
- package/lib/IncrementalChecker.d.ts +2 -15
- package/lib/IncrementalChecker.js +146 -172
- package/lib/IncrementalChecker.js.map +1 -1
- package/lib/IncrementalCheckerInterface.d.ts +0 -4
- package/lib/IncrementalCheckerInterface.js.map +1 -1
- package/lib/LinkedList.js +38 -36
- package/lib/LinkedList.js.map +1 -1
- package/lib/Message.js.map +1 -1
- package/lib/RpcTypes.js.map +1 -1
- package/lib/VueProgram.d.ts +1 -1
- package/lib/VueProgram.js +92 -71
- package/lib/VueProgram.js.map +1 -1
- package/lib/createEslinter.d.ts +2 -2
- package/lib/createEslinter.js +13 -6
- package/lib/createEslinter.js.map +1 -1
- package/lib/formatter/CodeframeFormatter.js +41 -17
- package/lib/formatter/CodeframeFormatter.js.map +1 -1
- package/lib/formatter/DefaultFormatter.js +18 -8
- package/lib/formatter/DefaultFormatter.js.map +1 -1
- package/lib/formatter/Formatter.js.map +1 -1
- package/lib/formatter/FormatterFactory.js +2 -2
- package/lib/formatter/FormatterFactory.js.map +1 -1
- package/lib/formatter/InternalFormatter.js +17 -7
- package/lib/formatter/InternalFormatter.js.map +1 -1
- package/lib/formatter/RawFormatter.js +3 -3
- package/lib/formatter/RawFormatter.js.map +1 -1
- package/lib/formatter/index.js.map +1 -1
- package/lib/hooks.d.ts +0 -3
- package/lib/hooks.js +5 -16
- package/lib/hooks.js.map +1 -1
- package/lib/index.d.ts +2 -10
- package/lib/index.js +247 -377
- package/lib/index.js.map +1 -1
- package/lib/issue/Issue.js +6 -4
- package/lib/issue/Issue.js.map +1 -1
- package/lib/issue/IssueOrigin.d.ts +0 -1
- package/lib/issue/IssueOrigin.js +8 -9
- package/lib/issue/IssueOrigin.js.map +1 -1
- package/lib/issue/IssueSeverity.js +4 -2
- package/lib/issue/IssueSeverity.js.map +1 -1
- package/lib/issue/eslint/EsLintIssueFactory.d.ts +2 -2
- package/lib/issue/eslint/EsLintIssueFactory.js +17 -12
- package/lib/issue/eslint/EsLintIssueFactory.js.map +1 -1
- package/lib/issue/eslint/FileAwareEsLintMessage.d.ts +2 -2
- package/lib/issue/eslint/FileAwareEsLintMessage.js.map +1 -1
- package/lib/issue/eslint/index.js.map +1 -1
- package/lib/issue/index.d.ts +0 -1
- package/lib/issue/index.js +0 -1
- package/lib/issue/index.js.map +1 -1
- package/lib/issue/internal/InternalIssueFactory.d.ts +6 -1
- package/lib/issue/internal/InternalIssueFactory.js +5 -3
- package/lib/issue/internal/InternalIssueFactory.js.map +1 -1
- package/lib/issue/internal/index.js.map +1 -1
- package/lib/issue/typescript/TypeScriptIssueFactory.js +14 -14
- package/lib/issue/typescript/TypeScriptIssueFactory.js.map +1 -1
- package/lib/issue/typescript/index.js.map +1 -1
- package/lib/patchTypescript.js +27 -20
- package/lib/patchTypescript.js.map +1 -1
- package/lib/resolution.js +3 -11
- package/lib/resolution.js.map +1 -1
- package/lib/service.js +107 -63
- package/lib/service.js.map +1 -1
- package/lib/types/eslint.d.ts +33 -0
- package/lib/types/eslint.js +3 -0
- package/lib/types/eslint.js.map +1 -0
- package/lib/types/vue-options.js.map +1 -1
- package/package.json +11 -33
- package/lib/issue/tslint/TsLintIssueFactory.d.ts +0 -5
- package/lib/issue/tslint/TsLintIssueFactory.js +0 -25
- package/lib/issue/tslint/TsLintIssueFactory.js.map +0 -1
- package/lib/issue/tslint/index.d.ts +0 -1
- package/lib/issue/tslint/index.js +0 -7
- package/lib/issue/tslint/index.js.map +0 -1
- package/lib/linterConfigHelpers.d.ts +0 -10
- package/lib/linterConfigHelpers.js +0 -35
- package/lib/linterConfigHelpers.js.map +0 -1
package/lib/CompilerHost.js
CHANGED
|
@@ -7,11 +7,39 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
10
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
38
|
+
var LinkedList_1 = require("./LinkedList");
|
|
39
|
+
var VueProgram_1 = require("./VueProgram");
|
|
40
|
+
var CompilerHost = /** @class */ (function () {
|
|
41
|
+
function CompilerHost(typescript, vueOptions, programConfigFile, compilerOptions, checkSyntacticErrors, userResolveModuleName, userResolveTypeReferenceDirective) {
|
|
42
|
+
var _this = this;
|
|
15
43
|
this.typescript = typescript;
|
|
16
44
|
this.vueOptions = vueOptions;
|
|
17
45
|
// intercept all watch events and collect them until we get notification to start compilation
|
|
@@ -19,13 +47,13 @@ class CompilerHost {
|
|
|
19
47
|
this.fileWatchers = new LinkedList_1.LinkedList();
|
|
20
48
|
this.knownFiles = new Set();
|
|
21
49
|
this.gatheredDiagnostic = [];
|
|
22
|
-
this.afterCompile = ()
|
|
50
|
+
this.afterCompile = function () {
|
|
23
51
|
/* do nothing */
|
|
24
52
|
};
|
|
25
53
|
this.compilationStarted = false;
|
|
26
54
|
this.createProgram = this.typescript
|
|
27
55
|
.createEmitAndSemanticDiagnosticsBuilderProgram;
|
|
28
|
-
this.tsHost = typescript.createWatchCompilerHost(programConfigFile, compilerOptions, typescript.sys, typescript.createEmitAndSemanticDiagnosticsBuilderProgram, (diag)
|
|
56
|
+
this.tsHost = typescript.createWatchCompilerHost(programConfigFile, compilerOptions, typescript.sys, typescript.createEmitAndSemanticDiagnosticsBuilderProgram, function (diag) {
|
|
29
57
|
if (!checkSyntacticErrors &&
|
|
30
58
|
diag.code >= 1000 &&
|
|
31
59
|
diag.code < 2000 &&
|
|
@@ -33,109 +61,143 @@ class CompilerHost {
|
|
|
33
61
|
) {
|
|
34
62
|
return;
|
|
35
63
|
}
|
|
36
|
-
|
|
37
|
-
}, ()
|
|
64
|
+
_this.gatheredDiagnostic.push(diag);
|
|
65
|
+
}, function () {
|
|
38
66
|
// do nothing
|
|
39
67
|
});
|
|
40
68
|
this.configFileName = this.tsHost.configFileName;
|
|
41
69
|
this.optionsToExtend = this.tsHost.optionsToExtend || {};
|
|
42
70
|
if (userResolveModuleName) {
|
|
43
|
-
this.resolveModuleNames = (moduleNames, containingFile)
|
|
44
|
-
return moduleNames.map(moduleName
|
|
45
|
-
return userResolveModuleName(
|
|
71
|
+
this.resolveModuleNames = function (moduleNames, containingFile) {
|
|
72
|
+
return moduleNames.map(function (moduleName) {
|
|
73
|
+
return userResolveModuleName(_this.typescript, moduleName, containingFile, _this.optionsToExtend, _this).resolvedModule;
|
|
46
74
|
});
|
|
47
75
|
};
|
|
48
76
|
}
|
|
49
77
|
if (userResolveTypeReferenceDirective) {
|
|
50
|
-
this.resolveTypeReferenceDirectives = (typeDirectiveNames, containingFile)
|
|
51
|
-
return typeDirectiveNames.map(typeDirectiveName
|
|
52
|
-
return userResolveTypeReferenceDirective(
|
|
78
|
+
this.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) {
|
|
79
|
+
return typeDirectiveNames.map(function (typeDirectiveName) {
|
|
80
|
+
return userResolveTypeReferenceDirective(_this.typescript, typeDirectiveName, containingFile, _this.optionsToExtend, _this).resolvedTypeReferenceDirective;
|
|
53
81
|
});
|
|
54
82
|
};
|
|
55
83
|
}
|
|
56
84
|
}
|
|
57
|
-
getProgram() {
|
|
85
|
+
CompilerHost.prototype.getProgram = function () {
|
|
86
|
+
if (!this.program) {
|
|
87
|
+
throw new Error('Program is not created yet.');
|
|
88
|
+
}
|
|
58
89
|
return this.program.getProgram().getProgram();
|
|
59
|
-
}
|
|
60
|
-
getAllKnownFiles() {
|
|
90
|
+
};
|
|
91
|
+
CompilerHost.prototype.getAllKnownFiles = function () {
|
|
61
92
|
return this.knownFiles;
|
|
62
|
-
}
|
|
63
|
-
processChanges() {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
93
|
+
};
|
|
94
|
+
CompilerHost.prototype.processChanges = function () {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
+
var initialCompile, errors, previousDiagnostic, resultPromise, files, updatedFiles, removedFiles, results;
|
|
97
|
+
var _this = this;
|
|
98
|
+
return __generator(this, function (_a) {
|
|
99
|
+
switch (_a.label) {
|
|
100
|
+
case 0:
|
|
101
|
+
if (!!this.lastProcessing) return [3 /*break*/, 2];
|
|
102
|
+
initialCompile = new Promise(function (resolve) {
|
|
103
|
+
_this.afterCompile = function () {
|
|
104
|
+
resolve(_this.gatheredDiagnostic);
|
|
105
|
+
_this.afterCompile = function () {
|
|
106
|
+
/* do nothing */
|
|
107
|
+
};
|
|
108
|
+
_this.compilationStarted = false;
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
this.lastProcessing = initialCompile;
|
|
112
|
+
this.program = this.typescript.createWatchProgram(this);
|
|
113
|
+
return [4 /*yield*/, initialCompile];
|
|
114
|
+
case 1:
|
|
115
|
+
errors = _a.sent();
|
|
116
|
+
return [2 /*return*/, {
|
|
117
|
+
results: errors,
|
|
118
|
+
updatedFiles: Array.from(this.knownFiles),
|
|
119
|
+
removedFiles: []
|
|
120
|
+
}];
|
|
121
|
+
case 2:
|
|
122
|
+
// since we do not have a way to pass cancellation token to typescript,
|
|
123
|
+
// we just wait until previous compilation finishes.
|
|
124
|
+
return [4 /*yield*/, this.lastProcessing];
|
|
125
|
+
case 3:
|
|
126
|
+
// since we do not have a way to pass cancellation token to typescript,
|
|
127
|
+
// we just wait until previous compilation finishes.
|
|
128
|
+
_a.sent();
|
|
129
|
+
previousDiagnostic = this.gatheredDiagnostic;
|
|
130
|
+
this.gatheredDiagnostic = [];
|
|
131
|
+
resultPromise = new Promise(function (resolve) {
|
|
132
|
+
_this.afterCompile = function () {
|
|
133
|
+
resolve(_this.gatheredDiagnostic);
|
|
134
|
+
_this.afterCompile = function () {
|
|
135
|
+
/* do nothing */
|
|
136
|
+
};
|
|
137
|
+
_this.compilationStarted = false;
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
this.lastProcessing = resultPromise;
|
|
141
|
+
files = [];
|
|
142
|
+
this.directoryWatchers.forEach(function (item) {
|
|
143
|
+
for (var _i = 0, _a = item.events; _i < _a.length; _i++) {
|
|
144
|
+
var e = _a[_i];
|
|
145
|
+
item.callback(e.fileName);
|
|
146
|
+
}
|
|
147
|
+
item.events.length = 0;
|
|
148
|
+
});
|
|
149
|
+
updatedFiles = [];
|
|
150
|
+
removedFiles = [];
|
|
151
|
+
this.fileWatchers.forEach(function (item) {
|
|
152
|
+
for (var _i = 0, _a = item.events; _i < _a.length; _i++) {
|
|
153
|
+
var e = _a[_i];
|
|
154
|
+
item.callback(e.fileName, e.eventKind);
|
|
155
|
+
files.push(e.fileName);
|
|
156
|
+
if (e.eventKind === _this.typescript.FileWatcherEventKind.Created ||
|
|
157
|
+
e.eventKind === _this.typescript.FileWatcherEventKind.Changed) {
|
|
158
|
+
updatedFiles.push(e.fileName);
|
|
159
|
+
}
|
|
160
|
+
else if (e.eventKind === _this.typescript.FileWatcherEventKind.Deleted) {
|
|
161
|
+
removedFiles.push(e.fileName);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
item.events.length = 0;
|
|
165
|
+
});
|
|
166
|
+
// if the files are not relevant to typescript it may choose not to compile
|
|
167
|
+
// in this case we need to trigger promise resolution from here
|
|
168
|
+
if (!this.compilationStarted) {
|
|
169
|
+
// keep diagnostic from previous run
|
|
170
|
+
this.gatheredDiagnostic = previousDiagnostic;
|
|
171
|
+
this.afterCompile();
|
|
172
|
+
return [2 /*return*/, {
|
|
173
|
+
results: this.gatheredDiagnostic,
|
|
174
|
+
updatedFiles: [],
|
|
175
|
+
removedFiles: []
|
|
176
|
+
}];
|
|
177
|
+
}
|
|
178
|
+
return [4 /*yield*/, resultPromise];
|
|
179
|
+
case 4:
|
|
180
|
+
results = _a.sent();
|
|
181
|
+
return [2 /*return*/, { results: results, updatedFiles: updatedFiles, removedFiles: removedFiles }];
|
|
103
182
|
}
|
|
104
|
-
item.events.length = 0;
|
|
105
183
|
});
|
|
106
|
-
const updatedFiles = [];
|
|
107
|
-
const removedFiles = [];
|
|
108
|
-
this.fileWatchers.forEach(item => {
|
|
109
|
-
for (const e of item.events) {
|
|
110
|
-
item.callback(e.fileName, e.eventKind);
|
|
111
|
-
files.push(e.fileName);
|
|
112
|
-
if (e.eventKind === this.typescript.FileWatcherEventKind.Created ||
|
|
113
|
-
e.eventKind === this.typescript.FileWatcherEventKind.Changed) {
|
|
114
|
-
updatedFiles.push(e.fileName);
|
|
115
|
-
}
|
|
116
|
-
else if (e.eventKind === this.typescript.FileWatcherEventKind.Deleted) {
|
|
117
|
-
removedFiles.push(e.fileName);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
item.events.length = 0;
|
|
121
|
-
});
|
|
122
|
-
// if the files are not relevant to typescript it may choose not to compile
|
|
123
|
-
// in this case we need to trigger promise resolution from here
|
|
124
|
-
if (!this.compilationStarted) {
|
|
125
|
-
// keep diagnostic from previous run
|
|
126
|
-
this.gatheredDiagnostic = previousDiagnostic;
|
|
127
|
-
this.afterCompile();
|
|
128
|
-
return {
|
|
129
|
-
results: this.gatheredDiagnostic,
|
|
130
|
-
updatedFiles: [],
|
|
131
|
-
removedFiles: []
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
const results = yield resultPromise;
|
|
135
|
-
return { results, updatedFiles, removedFiles };
|
|
136
184
|
});
|
|
137
|
-
}
|
|
138
|
-
setTimeout
|
|
185
|
+
};
|
|
186
|
+
CompilerHost.prototype.setTimeout = function (
|
|
187
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
188
|
+
callback, ms) {
|
|
189
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
190
|
+
var args = [];
|
|
191
|
+
for (
|
|
192
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
193
|
+
var _i = 2;
|
|
194
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
195
|
+
_i < arguments.length;
|
|
196
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
197
|
+
_i++) {
|
|
198
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
199
|
+
args[_i - 2] = arguments[_i];
|
|
200
|
+
}
|
|
139
201
|
// There are 2 things we are hacking here:
|
|
140
202
|
// 1. This method only called from watch program to wait until all files
|
|
141
203
|
// are written to filesystem (for example, when doing 'save all')
|
|
@@ -156,113 +218,121 @@ class CompilerHost {
|
|
|
156
218
|
// dramatic compilation time increase), so we have to stick with these
|
|
157
219
|
// hacks for now.
|
|
158
220
|
this.compilationStarted = true;
|
|
159
|
-
return this.typescript.sys.setTimeout(callback, 1, args);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
221
|
+
return (this.typescript.sys.setTimeout || setTimeout)(callback, 1, args);
|
|
222
|
+
};
|
|
223
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
224
|
+
CompilerHost.prototype.clearTimeout = function (timeoutId) {
|
|
225
|
+
(this.typescript.sys.clearTimeout || clearTimeout)(timeoutId);
|
|
226
|
+
};
|
|
227
|
+
CompilerHost.prototype.onWatchStatusChange = function () {
|
|
165
228
|
// do nothing
|
|
166
|
-
}
|
|
167
|
-
watchDirectory(path, callback, recursive) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
this.tsHost.watchDirectory(path, fileName
|
|
171
|
-
slot.events.push({ fileName });
|
|
229
|
+
};
|
|
230
|
+
CompilerHost.prototype.watchDirectory = function (path, callback, recursive) {
|
|
231
|
+
var slot = { callback: callback, events: [] };
|
|
232
|
+
var node = this.directoryWatchers.add(slot);
|
|
233
|
+
this.tsHost.watchDirectory(path, function (fileName) {
|
|
234
|
+
slot.events.push({ fileName: fileName });
|
|
172
235
|
}, recursive);
|
|
173
236
|
return {
|
|
174
|
-
close: ()
|
|
237
|
+
close: function () {
|
|
175
238
|
node.detachSelf();
|
|
176
239
|
}
|
|
177
240
|
};
|
|
178
|
-
}
|
|
179
|
-
watchFile(path, callback,
|
|
180
|
-
|
|
181
|
-
|
|
241
|
+
};
|
|
242
|
+
CompilerHost.prototype.watchFile = function (path, callback, pollingInterval) {
|
|
243
|
+
var _this = this;
|
|
244
|
+
var slot = { callback: callback, events: [] };
|
|
245
|
+
var node = this.fileWatchers.add(slot);
|
|
182
246
|
this.knownFiles.add(path);
|
|
183
|
-
this.tsHost.watchFile(path, (fileName, eventKind)
|
|
184
|
-
if (eventKind ===
|
|
185
|
-
|
|
247
|
+
this.tsHost.watchFile(path, function (fileName, eventKind) {
|
|
248
|
+
if (eventKind === _this.typescript.FileWatcherEventKind.Created) {
|
|
249
|
+
_this.knownFiles.add(fileName);
|
|
186
250
|
}
|
|
187
|
-
else if (eventKind ===
|
|
188
|
-
|
|
251
|
+
else if (eventKind === _this.typescript.FileWatcherEventKind.Deleted) {
|
|
252
|
+
_this.knownFiles.delete(fileName);
|
|
189
253
|
}
|
|
190
|
-
slot.events.push({ fileName, eventKind });
|
|
191
|
-
},
|
|
254
|
+
slot.events.push({ fileName: fileName, eventKind: eventKind });
|
|
255
|
+
}, pollingInterval);
|
|
192
256
|
return {
|
|
193
|
-
close: ()
|
|
257
|
+
close: function () {
|
|
194
258
|
node.detachSelf();
|
|
195
259
|
}
|
|
196
260
|
};
|
|
197
|
-
}
|
|
198
|
-
fileExists(path) {
|
|
261
|
+
};
|
|
262
|
+
CompilerHost.prototype.fileExists = function (path) {
|
|
199
263
|
return this.tsHost.fileExists(path);
|
|
200
|
-
}
|
|
201
|
-
readFile(path, encoding) {
|
|
202
|
-
|
|
264
|
+
};
|
|
265
|
+
CompilerHost.prototype.readFile = function (path, encoding) {
|
|
266
|
+
var content = this.tsHost.readFile(path, encoding);
|
|
203
267
|
// get typescript contents from Vue file
|
|
204
268
|
if (content && VueProgram_1.VueProgram.isVue(path)) {
|
|
205
|
-
|
|
269
|
+
var resolved = VueProgram_1.VueProgram.resolveScriptBlock(this.typescript, content, this.vueOptions.compiler);
|
|
206
270
|
return resolved.content;
|
|
207
271
|
}
|
|
208
272
|
return content;
|
|
209
|
-
}
|
|
210
|
-
directoryExists(path) {
|
|
273
|
+
};
|
|
274
|
+
CompilerHost.prototype.directoryExists = function (path) {
|
|
211
275
|
return ((this.tsHost.directoryExists && this.tsHost.directoryExists(path)) ||
|
|
212
276
|
false);
|
|
213
|
-
}
|
|
214
|
-
getDirectories(path) {
|
|
277
|
+
};
|
|
278
|
+
CompilerHost.prototype.getDirectories = function (path) {
|
|
215
279
|
return ((this.tsHost.getDirectories && this.tsHost.getDirectories(path)) || []);
|
|
216
|
-
}
|
|
217
|
-
readDirectory(path, extensions, exclude, include, depth) {
|
|
280
|
+
};
|
|
281
|
+
CompilerHost.prototype.readDirectory = function (path, extensions, exclude, include, depth) {
|
|
218
282
|
return this.typescript.sys.readDirectory(path, extensions, exclude, include, depth);
|
|
219
|
-
}
|
|
220
|
-
getCurrentDirectory() {
|
|
283
|
+
};
|
|
284
|
+
CompilerHost.prototype.getCurrentDirectory = function () {
|
|
221
285
|
return this.tsHost.getCurrentDirectory();
|
|
222
|
-
}
|
|
223
|
-
getDefaultLibFileName(options) {
|
|
286
|
+
};
|
|
287
|
+
CompilerHost.prototype.getDefaultLibFileName = function (options) {
|
|
224
288
|
return this.tsHost.getDefaultLibFileName(options);
|
|
225
|
-
}
|
|
226
|
-
getEnvironmentVariable(name) {
|
|
289
|
+
};
|
|
290
|
+
CompilerHost.prototype.getEnvironmentVariable = function (name) {
|
|
227
291
|
return (this.tsHost.getEnvironmentVariable &&
|
|
228
292
|
this.tsHost.getEnvironmentVariable(name));
|
|
229
|
-
}
|
|
230
|
-
getNewLine() {
|
|
293
|
+
};
|
|
294
|
+
CompilerHost.prototype.getNewLine = function () {
|
|
231
295
|
return this.tsHost.getNewLine();
|
|
232
|
-
}
|
|
233
|
-
realpath(path) {
|
|
296
|
+
};
|
|
297
|
+
CompilerHost.prototype.realpath = function (path) {
|
|
298
|
+
if (!this.tsHost.realpath) {
|
|
299
|
+
throw new Error('The realpath function is not supported by the CompilerHost.');
|
|
300
|
+
}
|
|
234
301
|
return this.tsHost.realpath(path);
|
|
235
|
-
}
|
|
236
|
-
trace(s) {
|
|
302
|
+
};
|
|
303
|
+
CompilerHost.prototype.trace = function (s) {
|
|
237
304
|
if (this.tsHost.trace) {
|
|
238
305
|
this.tsHost.trace(s);
|
|
239
306
|
}
|
|
240
|
-
}
|
|
241
|
-
useCaseSensitiveFileNames() {
|
|
307
|
+
};
|
|
308
|
+
CompilerHost.prototype.useCaseSensitiveFileNames = function () {
|
|
242
309
|
return this.tsHost.useCaseSensitiveFileNames();
|
|
243
|
-
}
|
|
244
|
-
onUnRecoverableConfigFileDiagnostic(
|
|
310
|
+
};
|
|
311
|
+
CompilerHost.prototype.onUnRecoverableConfigFileDiagnostic = function () {
|
|
245
312
|
// do nothing
|
|
246
|
-
}
|
|
247
|
-
afterProgramCreate(program) {
|
|
313
|
+
};
|
|
314
|
+
CompilerHost.prototype.afterProgramCreate = function (program) {
|
|
248
315
|
// all actual diagnostics happens here
|
|
249
|
-
this.tsHost.afterProgramCreate
|
|
316
|
+
if (this.tsHost.afterProgramCreate) {
|
|
317
|
+
this.tsHost.afterProgramCreate(program);
|
|
318
|
+
}
|
|
250
319
|
this.afterCompile();
|
|
251
|
-
}
|
|
320
|
+
};
|
|
252
321
|
// the functions below are use internally by typescript. we cannot use non-emitting version of incremental watching API
|
|
253
322
|
// because it is
|
|
254
323
|
// - much slower for some reason,
|
|
255
324
|
// - writes files anyway (o_O)
|
|
256
325
|
// - has different way of providing diagnostics. (with this version we can at least reliably get it from afterProgramCreate)
|
|
257
|
-
createDirectory(
|
|
326
|
+
CompilerHost.prototype.createDirectory = function () {
|
|
258
327
|
// pretend everything was ok
|
|
259
|
-
}
|
|
260
|
-
writeFile
|
|
328
|
+
};
|
|
329
|
+
CompilerHost.prototype.writeFile = function () {
|
|
261
330
|
// pretend everything was ok
|
|
262
|
-
}
|
|
263
|
-
onCachedDirectoryStructureHostCreate(
|
|
331
|
+
};
|
|
332
|
+
CompilerHost.prototype.onCachedDirectoryStructureHostCreate = function () {
|
|
264
333
|
// pretend everything was ok
|
|
265
|
-
}
|
|
266
|
-
|
|
334
|
+
};
|
|
335
|
+
return CompilerHost;
|
|
336
|
+
}());
|
|
267
337
|
exports.CompilerHost = CompilerHost;
|
|
268
338
|
//# sourceMappingURL=CompilerHost.js.map
|
package/lib/CompilerHost.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompilerHost.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"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,oCAAY"}
|
package/lib/FilesRegister.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
|
-
import
|
|
3
|
-
import * as eslint from 'eslint';
|
|
2
|
+
import { LintReport } from './types/eslint';
|
|
4
3
|
export interface DataShape {
|
|
5
4
|
source?: ts.SourceFile;
|
|
6
5
|
linted: boolean;
|
|
7
|
-
|
|
8
|
-
eslints: eslint.CLIEngine.LintReport[];
|
|
6
|
+
eslints: LintReport[];
|
|
9
7
|
}
|
|
10
8
|
export declare class FilesRegister {
|
|
11
9
|
private dataFactory;
|
package/lib/FilesRegister.js
CHANGED
|
@@ -1,57 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var FilesRegister = /** @class */ (function () {
|
|
4
|
+
function FilesRegister(dataFactory) {
|
|
5
5
|
this.dataFactory = dataFactory;
|
|
6
6
|
this.files = {};
|
|
7
7
|
this.dataFactory = dataFactory;
|
|
8
8
|
}
|
|
9
|
-
keys() {
|
|
9
|
+
FilesRegister.prototype.keys = function () {
|
|
10
10
|
return Object.keys(this.files);
|
|
11
|
-
}
|
|
12
|
-
add(filePath) {
|
|
11
|
+
};
|
|
12
|
+
FilesRegister.prototype.add = function (filePath) {
|
|
13
13
|
this.files[filePath] = {
|
|
14
14
|
mtime: undefined,
|
|
15
15
|
data: this.dataFactory(undefined)
|
|
16
16
|
};
|
|
17
|
-
}
|
|
18
|
-
remove(filePath) {
|
|
17
|
+
};
|
|
18
|
+
FilesRegister.prototype.remove = function (filePath) {
|
|
19
19
|
if (this.has(filePath)) {
|
|
20
20
|
delete this.files[filePath];
|
|
21
21
|
}
|
|
22
|
-
}
|
|
23
|
-
has(filePath) {
|
|
22
|
+
};
|
|
23
|
+
FilesRegister.prototype.has = function (filePath) {
|
|
24
24
|
return this.files.hasOwnProperty(filePath);
|
|
25
|
-
}
|
|
26
|
-
get(filePath) {
|
|
25
|
+
};
|
|
26
|
+
FilesRegister.prototype.get = function (filePath) {
|
|
27
27
|
if (!this.has(filePath)) {
|
|
28
28
|
throw new Error('File "' + filePath + '" not found in register.');
|
|
29
29
|
}
|
|
30
30
|
return this.files[filePath];
|
|
31
|
-
}
|
|
32
|
-
ensure(filePath) {
|
|
31
|
+
};
|
|
32
|
+
FilesRegister.prototype.ensure = function (filePath) {
|
|
33
33
|
if (!this.has(filePath)) {
|
|
34
34
|
this.add(filePath);
|
|
35
35
|
}
|
|
36
|
-
}
|
|
37
|
-
getData(filePath) {
|
|
36
|
+
};
|
|
37
|
+
FilesRegister.prototype.getData = function (filePath) {
|
|
38
38
|
return this.get(filePath).data;
|
|
39
|
-
}
|
|
40
|
-
mutateData(filePath, mutator) {
|
|
39
|
+
};
|
|
40
|
+
FilesRegister.prototype.mutateData = function (filePath, mutator) {
|
|
41
41
|
this.ensure(filePath);
|
|
42
42
|
mutator(this.files[filePath].data);
|
|
43
|
-
}
|
|
44
|
-
getMtime(filePath) {
|
|
43
|
+
};
|
|
44
|
+
FilesRegister.prototype.getMtime = function (filePath) {
|
|
45
45
|
return this.get(filePath).mtime;
|
|
46
|
-
}
|
|
47
|
-
setMtime(filePath, mtime) {
|
|
46
|
+
};
|
|
47
|
+
FilesRegister.prototype.setMtime = function (filePath, mtime) {
|
|
48
48
|
this.ensure(filePath);
|
|
49
49
|
if (this.files[filePath].mtime !== mtime) {
|
|
50
50
|
this.files[filePath].mtime = mtime;
|
|
51
51
|
// file has been changed - we have to reset data
|
|
52
52
|
this.files[filePath].data = this.dataFactory(this.files[filePath].data);
|
|
53
53
|
}
|
|
54
|
-
}
|
|
55
|
-
|
|
54
|
+
};
|
|
55
|
+
return FilesRegister;
|
|
56
|
+
}());
|
|
56
57
|
exports.FilesRegister = FilesRegister;
|
|
57
58
|
//# sourceMappingURL=FilesRegister.js.map
|
package/lib/FilesRegister.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
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