typescript 4.8.0-dev.20220809 → 4.9.0-dev.20220812
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/lib/lib.es2015.reflect.d.ts +25 -2
- package/lib/lib.es5.d.ts +13 -3
- package/lib/tsc.js +410 -177
- package/lib/tsserver.js +333 -159
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +333 -354
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +333 -354
- package/lib/typescriptServices.d.ts +1 -1
- package/lib/typescriptServices.js +333 -354
- package/lib/typingsInstaller.js +272 -130
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -100,210 +100,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
100
100
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
101
101
|
});
|
|
102
102
|
};
|
|
103
|
-
/* @internal */
|
|
104
|
-
var ts;
|
|
105
|
-
(function (ts) {
|
|
106
|
-
function createMapData() {
|
|
107
|
-
var sentinel = {};
|
|
108
|
-
sentinel.prev = sentinel;
|
|
109
|
-
return { head: sentinel, tail: sentinel, size: 0 };
|
|
110
|
-
}
|
|
111
|
-
function createMapEntry(key, value) {
|
|
112
|
-
return { key: key, value: value, next: undefined, prev: undefined };
|
|
113
|
-
}
|
|
114
|
-
function sameValueZero(x, y) {
|
|
115
|
-
// Treats -0 === 0 and NaN === NaN
|
|
116
|
-
return x === y || x !== x && y !== y;
|
|
117
|
-
}
|
|
118
|
-
function getPrev(entry) {
|
|
119
|
-
var prev = entry.prev;
|
|
120
|
-
// Entries without a 'prev' have been removed from the map.
|
|
121
|
-
// An entry whose 'prev' points to itself is the head of the list and is invalid here.
|
|
122
|
-
if (!prev || prev === entry)
|
|
123
|
-
throw new Error("Illegal state");
|
|
124
|
-
return prev;
|
|
125
|
-
}
|
|
126
|
-
function getNext(entry) {
|
|
127
|
-
while (entry) {
|
|
128
|
-
// Entries without a 'prev' have been removed from the map. Their 'next'
|
|
129
|
-
// pointer should point to the previous entry prior to deletion and
|
|
130
|
-
// that entry should be skipped to resume iteration.
|
|
131
|
-
var skipNext = !entry.prev;
|
|
132
|
-
entry = entry.next;
|
|
133
|
-
if (skipNext) {
|
|
134
|
-
continue;
|
|
135
|
-
}
|
|
136
|
-
return entry;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function getEntry(data, key) {
|
|
140
|
-
// We walk backwards from 'tail' to prioritize recently added entries.
|
|
141
|
-
// We skip 'head' because it is an empty entry used to track iteration start.
|
|
142
|
-
for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) {
|
|
143
|
-
if (sameValueZero(entry.key, key)) {
|
|
144
|
-
return entry;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function addOrUpdateEntry(data, key, value) {
|
|
149
|
-
var existing = getEntry(data, key);
|
|
150
|
-
if (existing) {
|
|
151
|
-
existing.value = value;
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
var entry = createMapEntry(key, value);
|
|
155
|
-
entry.prev = data.tail;
|
|
156
|
-
data.tail.next = entry;
|
|
157
|
-
data.tail = entry;
|
|
158
|
-
data.size++;
|
|
159
|
-
return entry;
|
|
160
|
-
}
|
|
161
|
-
function deleteEntry(data, key) {
|
|
162
|
-
// We walk backwards from 'tail' to prioritize recently added entries.
|
|
163
|
-
// We skip 'head' because it is an empty entry used to track iteration start.
|
|
164
|
-
for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) {
|
|
165
|
-
// all entries in the map should have a 'prev' pointer.
|
|
166
|
-
if (entry.prev === undefined)
|
|
167
|
-
throw new Error("Illegal state");
|
|
168
|
-
if (sameValueZero(entry.key, key)) {
|
|
169
|
-
if (entry.next) {
|
|
170
|
-
entry.next.prev = entry.prev;
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
// an entry in the map without a 'next' pointer must be the 'tail'.
|
|
174
|
-
if (data.tail !== entry)
|
|
175
|
-
throw new Error("Illegal state");
|
|
176
|
-
data.tail = entry.prev;
|
|
177
|
-
}
|
|
178
|
-
entry.prev.next = entry.next;
|
|
179
|
-
entry.next = entry.prev;
|
|
180
|
-
entry.prev = undefined;
|
|
181
|
-
data.size--;
|
|
182
|
-
return entry;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
function clearEntries(data) {
|
|
187
|
-
var node = data.tail;
|
|
188
|
-
while (node !== data.head) {
|
|
189
|
-
var prev = getPrev(node);
|
|
190
|
-
node.next = data.head;
|
|
191
|
-
node.prev = undefined;
|
|
192
|
-
node = prev;
|
|
193
|
-
}
|
|
194
|
-
data.head.next = undefined;
|
|
195
|
-
data.tail = data.head;
|
|
196
|
-
data.size = 0;
|
|
197
|
-
}
|
|
198
|
-
function forEachEntry(data, action) {
|
|
199
|
-
var entry = data.head;
|
|
200
|
-
while (entry) {
|
|
201
|
-
entry = getNext(entry);
|
|
202
|
-
if (entry) {
|
|
203
|
-
action(entry.value, entry.key);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
function forEachIteration(iterator, action) {
|
|
208
|
-
if (iterator) {
|
|
209
|
-
for (var step = iterator.next(); !step.done; step = iterator.next()) {
|
|
210
|
-
action(step.value);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
function createIteratorData(data, selector) {
|
|
215
|
-
return { current: data.head, selector: selector };
|
|
216
|
-
}
|
|
217
|
-
function iteratorNext(data) {
|
|
218
|
-
// Navigate to the next entry.
|
|
219
|
-
data.current = getNext(data.current);
|
|
220
|
-
if (data.current) {
|
|
221
|
-
return { value: data.selector(data.current.key, data.current.value), done: false };
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
return { value: undefined, done: true };
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
/* @internal */
|
|
228
|
-
var ShimCollections;
|
|
229
|
-
(function (ShimCollections) {
|
|
230
|
-
function createMapShim(getIterator) {
|
|
231
|
-
var MapIterator = /** @class */ (function () {
|
|
232
|
-
function MapIterator(data, selector) {
|
|
233
|
-
this._data = createIteratorData(data, selector);
|
|
234
|
-
}
|
|
235
|
-
MapIterator.prototype.next = function () { return iteratorNext(this._data); };
|
|
236
|
-
return MapIterator;
|
|
237
|
-
}());
|
|
238
|
-
return /** @class */ (function () {
|
|
239
|
-
function Map(iterable) {
|
|
240
|
-
var _this = this;
|
|
241
|
-
this._mapData = createMapData();
|
|
242
|
-
forEachIteration(getIterator(iterable), function (_a) {
|
|
243
|
-
var key = _a[0], value = _a[1];
|
|
244
|
-
return _this.set(key, value);
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
Object.defineProperty(Map.prototype, "size", {
|
|
248
|
-
get: function () { return this._mapData.size; },
|
|
249
|
-
enumerable: false,
|
|
250
|
-
configurable: true
|
|
251
|
-
});
|
|
252
|
-
Map.prototype.get = function (key) { var _a; return (_a = getEntry(this._mapData, key)) === null || _a === void 0 ? void 0 : _a.value; };
|
|
253
|
-
Map.prototype.set = function (key, value) { return addOrUpdateEntry(this._mapData, key, value), this; };
|
|
254
|
-
Map.prototype.has = function (key) { return !!getEntry(this._mapData, key); };
|
|
255
|
-
Map.prototype.delete = function (key) { return !!deleteEntry(this._mapData, key); };
|
|
256
|
-
Map.prototype.clear = function () { clearEntries(this._mapData); };
|
|
257
|
-
Map.prototype.keys = function () { return new MapIterator(this._mapData, function (key, _value) { return key; }); };
|
|
258
|
-
Map.prototype.values = function () { return new MapIterator(this._mapData, function (_key, value) { return value; }); };
|
|
259
|
-
Map.prototype.entries = function () { return new MapIterator(this._mapData, function (key, value) { return [key, value]; }); };
|
|
260
|
-
Map.prototype.forEach = function (action) { forEachEntry(this._mapData, action); };
|
|
261
|
-
return Map;
|
|
262
|
-
}());
|
|
263
|
-
}
|
|
264
|
-
ShimCollections.createMapShim = createMapShim;
|
|
265
|
-
function createSetShim(getIterator) {
|
|
266
|
-
var SetIterator = /** @class */ (function () {
|
|
267
|
-
function SetIterator(data, selector) {
|
|
268
|
-
this._data = createIteratorData(data, selector);
|
|
269
|
-
}
|
|
270
|
-
SetIterator.prototype.next = function () { return iteratorNext(this._data); };
|
|
271
|
-
return SetIterator;
|
|
272
|
-
}());
|
|
273
|
-
return /** @class */ (function () {
|
|
274
|
-
function Set(iterable) {
|
|
275
|
-
var _this = this;
|
|
276
|
-
this._mapData = createMapData();
|
|
277
|
-
forEachIteration(getIterator(iterable), function (value) { return _this.add(value); });
|
|
278
|
-
}
|
|
279
|
-
Object.defineProperty(Set.prototype, "size", {
|
|
280
|
-
get: function () { return this._mapData.size; },
|
|
281
|
-
enumerable: false,
|
|
282
|
-
configurable: true
|
|
283
|
-
});
|
|
284
|
-
Set.prototype.add = function (value) { return addOrUpdateEntry(this._mapData, value, value), this; };
|
|
285
|
-
Set.prototype.has = function (value) { return !!getEntry(this._mapData, value); };
|
|
286
|
-
Set.prototype.delete = function (value) { return !!deleteEntry(this._mapData, value); };
|
|
287
|
-
Set.prototype.clear = function () { clearEntries(this._mapData); };
|
|
288
|
-
Set.prototype.keys = function () { return new SetIterator(this._mapData, function (key, _value) { return key; }); };
|
|
289
|
-
Set.prototype.values = function () { return new SetIterator(this._mapData, function (_key, value) { return value; }); };
|
|
290
|
-
Set.prototype.entries = function () { return new SetIterator(this._mapData, function (key, value) { return [key, value]; }); };
|
|
291
|
-
Set.prototype.forEach = function (action) { forEachEntry(this._mapData, action); };
|
|
292
|
-
return Set;
|
|
293
|
-
}());
|
|
294
|
-
}
|
|
295
|
-
ShimCollections.createSetShim = createSetShim;
|
|
296
|
-
})(ShimCollections = ts.ShimCollections || (ts.ShimCollections = {}));
|
|
297
|
-
})(ts || (ts = {}));
|
|
298
103
|
var ts;
|
|
299
104
|
(function (ts) {
|
|
300
105
|
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
|
|
301
106
|
// If changing the text in this section, be sure to test `configurePrerelease` too.
|
|
302
|
-
ts.versionMajorMinor = "4.
|
|
107
|
+
ts.versionMajorMinor = "4.9";
|
|
303
108
|
// The following is baselined as a literal template type without intervention
|
|
304
109
|
/** The version of the TypeScript compiler release */
|
|
305
110
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
306
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
111
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220812";
|
|
307
112
|
/* @internal */
|
|
308
113
|
var Comparison;
|
|
309
114
|
(function (Comparison) {
|
|
@@ -325,7 +130,11 @@ var ts;
|
|
|
325
130
|
// Internet Explorer's Map doesn't support iteration, so don't use it.
|
|
326
131
|
var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
|
|
327
132
|
// eslint-disable-next-line no-in-operator
|
|
328
|
-
|
|
133
|
+
var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
|
|
134
|
+
if (!constructor) {
|
|
135
|
+
throw new Error("No compatible Map implementation found.");
|
|
136
|
+
}
|
|
137
|
+
return constructor;
|
|
329
138
|
}
|
|
330
139
|
NativeCollections.tryGetNativeMap = tryGetNativeMap;
|
|
331
140
|
/**
|
|
@@ -335,23 +144,18 @@ var ts;
|
|
|
335
144
|
// Internet Explorer's Set doesn't support iteration, so don't use it.
|
|
336
145
|
var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
|
|
337
146
|
// eslint-disable-next-line no-in-operator
|
|
338
|
-
|
|
147
|
+
var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
|
|
148
|
+
if (!constructor) {
|
|
149
|
+
throw new Error("No compatible Set implementation found.");
|
|
150
|
+
}
|
|
151
|
+
return constructor;
|
|
339
152
|
}
|
|
340
153
|
NativeCollections.tryGetNativeSet = tryGetNativeSet;
|
|
341
154
|
})(NativeCollections || (NativeCollections = {}));
|
|
342
155
|
/* @internal */
|
|
343
|
-
ts.Map =
|
|
344
|
-
/* @internal */
|
|
345
|
-
ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim");
|
|
156
|
+
ts.Map = NativeCollections.tryGetNativeMap();
|
|
346
157
|
/* @internal */
|
|
347
|
-
|
|
348
|
-
var _a;
|
|
349
|
-
// NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it.
|
|
350
|
-
var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator);
|
|
351
|
-
if (constructor)
|
|
352
|
-
return constructor;
|
|
353
|
-
throw new Error("TypeScript requires an environment that provides a compatible native " + name + " implementation.");
|
|
354
|
-
}
|
|
158
|
+
ts.Set = NativeCollections.tryGetNativeSet();
|
|
355
159
|
})(ts || (ts = {}));
|
|
356
160
|
/* @internal */
|
|
357
161
|
var ts;
|
|
@@ -1067,15 +871,18 @@ var ts;
|
|
|
1067
871
|
function insertSorted(array, insert, compare, allowDuplicates) {
|
|
1068
872
|
if (array.length === 0) {
|
|
1069
873
|
array.push(insert);
|
|
1070
|
-
return;
|
|
874
|
+
return true;
|
|
1071
875
|
}
|
|
1072
876
|
var insertIndex = binarySearch(array, insert, identity, compare);
|
|
1073
877
|
if (insertIndex < 0) {
|
|
1074
878
|
array.splice(~insertIndex, 0, insert);
|
|
879
|
+
return true;
|
|
1075
880
|
}
|
|
1076
|
-
|
|
881
|
+
if (allowDuplicates) {
|
|
1077
882
|
array.splice(insertIndex, 0, insert);
|
|
883
|
+
return true;
|
|
1078
884
|
}
|
|
885
|
+
return false;
|
|
1079
886
|
}
|
|
1080
887
|
ts.insertSorted = insertSorted;
|
|
1081
888
|
function sortAndDeduplicate(array, comparer, equalityComparer) {
|
|
@@ -3755,6 +3562,8 @@ var ts;
|
|
|
3755
3562
|
typeof performance.mark === "function" &&
|
|
3756
3563
|
typeof performance.measure === "function" &&
|
|
3757
3564
|
typeof performance.now === "function" &&
|
|
3565
|
+
typeof performance.clearMarks === "function" &&
|
|
3566
|
+
typeof performance.clearMeasures === "function" &&
|
|
3758
3567
|
typeof PerformanceObserver === "function";
|
|
3759
3568
|
}
|
|
3760
3569
|
function tryGetWebPerformanceHooks() {
|
|
@@ -3799,7 +3608,9 @@ var ts;
|
|
|
3799
3608
|
if (end === "__performance.measure-fix__") {
|
|
3800
3609
|
nodePerformance_1.clearMarks("__performance.measure-fix__");
|
|
3801
3610
|
}
|
|
3802
|
-
}
|
|
3611
|
+
},
|
|
3612
|
+
clearMarks: function (name) { return nodePerformance_1.clearMarks(name); },
|
|
3613
|
+
clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); },
|
|
3803
3614
|
};
|
|
3804
3615
|
}
|
|
3805
3616
|
return {
|
|
@@ -3932,6 +3743,30 @@ var ts;
|
|
|
3932
3743
|
durations.forEach(function (duration, measureName) { return cb(measureName, duration); });
|
|
3933
3744
|
}
|
|
3934
3745
|
performance.forEachMeasure = forEachMeasure;
|
|
3746
|
+
function forEachMark(cb) {
|
|
3747
|
+
marks.forEach(function (_time, markName) { return cb(markName); });
|
|
3748
|
+
}
|
|
3749
|
+
performance.forEachMark = forEachMark;
|
|
3750
|
+
function clearMeasures(name) {
|
|
3751
|
+
if (name !== undefined)
|
|
3752
|
+
durations.delete(name);
|
|
3753
|
+
else
|
|
3754
|
+
durations.clear();
|
|
3755
|
+
performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name);
|
|
3756
|
+
}
|
|
3757
|
+
performance.clearMeasures = clearMeasures;
|
|
3758
|
+
function clearMarks(name) {
|
|
3759
|
+
if (name !== undefined) {
|
|
3760
|
+
counts.delete(name);
|
|
3761
|
+
marks.delete(name);
|
|
3762
|
+
}
|
|
3763
|
+
else {
|
|
3764
|
+
counts.clear();
|
|
3765
|
+
marks.clear();
|
|
3766
|
+
}
|
|
3767
|
+
performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name);
|
|
3768
|
+
}
|
|
3769
|
+
performance.clearMarks = clearMarks;
|
|
3935
3770
|
/**
|
|
3936
3771
|
* Indicates whether the performance API is enabled.
|
|
3937
3772
|
*/
|
|
@@ -8036,12 +7871,9 @@ var ts;
|
|
|
8036
7871
|
* Normalize path separators, converting `\` into `/`.
|
|
8037
7872
|
*/
|
|
8038
7873
|
function normalizeSlashes(path) {
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
}
|
|
8043
|
-
backslashRegExp.lastIndex = index; // prime regex with known position
|
|
8044
|
-
return path.replace(backslashRegExp, ts.directorySeparator);
|
|
7874
|
+
return path.indexOf("\\") !== -1
|
|
7875
|
+
? path.replace(backslashRegExp, ts.directorySeparator)
|
|
7876
|
+
: path;
|
|
8045
7877
|
}
|
|
8046
7878
|
ts.normalizeSlashes = normalizeSlashes;
|
|
8047
7879
|
/**
|
|
@@ -9742,6 +9574,7 @@ var ts;
|
|
|
9742
9574
|
Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."),
|
|
9743
9575
|
Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"),
|
|
9744
9576
|
Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"),
|
|
9577
|
+
Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"),
|
|
9745
9578
|
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
|
|
9746
9579
|
The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
|
|
9747
9580
|
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
|
|
@@ -19585,21 +19418,17 @@ var ts;
|
|
|
19585
19418
|
return getStringFromExpandedCharCodes(expandedCharCodes);
|
|
19586
19419
|
}
|
|
19587
19420
|
ts.base64decode = base64decode;
|
|
19421
|
+
function readJsonOrUndefined(path, hostOrText) {
|
|
19422
|
+
var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path);
|
|
19423
|
+
if (!jsonText)
|
|
19424
|
+
return undefined;
|
|
19425
|
+
// gracefully handle if readFile fails or returns not JSON
|
|
19426
|
+
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
19427
|
+
return !result.error ? result.config : undefined;
|
|
19428
|
+
}
|
|
19429
|
+
ts.readJsonOrUndefined = readJsonOrUndefined;
|
|
19588
19430
|
function readJson(path, host) {
|
|
19589
|
-
|
|
19590
|
-
var jsonText = host.readFile(path);
|
|
19591
|
-
if (!jsonText)
|
|
19592
|
-
return {};
|
|
19593
|
-
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
19594
|
-
if (result.error) {
|
|
19595
|
-
return {};
|
|
19596
|
-
}
|
|
19597
|
-
return result.config;
|
|
19598
|
-
}
|
|
19599
|
-
catch (e) {
|
|
19600
|
-
// gracefully handle if readFile fails or returns not JSON
|
|
19601
|
-
return {};
|
|
19602
|
-
}
|
|
19431
|
+
return readJsonOrUndefined(path, host) || {};
|
|
19603
19432
|
}
|
|
19604
19433
|
ts.readJson = readJson;
|
|
19605
19434
|
function directoryProbablyExists(directoryName, host) {
|
|
@@ -27950,9 +27779,10 @@ var ts;
|
|
|
27950
27779
|
};
|
|
27951
27780
|
var buildInfo_1;
|
|
27952
27781
|
var getAndCacheBuildInfo_1 = function (getText) {
|
|
27782
|
+
var _a;
|
|
27953
27783
|
if (buildInfo_1 === undefined) {
|
|
27954
27784
|
var result = getText();
|
|
27955
|
-
buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false;
|
|
27785
|
+
buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false;
|
|
27956
27786
|
}
|
|
27957
27787
|
return buildInfo_1 || undefined;
|
|
27958
27788
|
};
|
|
@@ -46012,6 +45842,9 @@ var ts;
|
|
|
46012
45842
|
case 203 /* BindingElement */:
|
|
46013
45843
|
bindBindingElementFlow(node);
|
|
46014
45844
|
break;
|
|
45845
|
+
case 164 /* Parameter */:
|
|
45846
|
+
bindParameterFlow(node);
|
|
45847
|
+
break;
|
|
46015
45848
|
case 205 /* ObjectLiteralExpression */:
|
|
46016
45849
|
case 204 /* ArrayLiteralExpression */:
|
|
46017
45850
|
case 296 /* PropertyAssignment */:
|
|
@@ -46752,20 +46585,38 @@ var ts;
|
|
|
46752
46585
|
}
|
|
46753
46586
|
}
|
|
46754
46587
|
function bindBindingElementFlow(node) {
|
|
46755
|
-
|
|
46756
|
-
|
|
46757
|
-
|
|
46758
|
-
|
|
46759
|
-
|
|
46760
|
-
|
|
46761
|
-
|
|
46762
|
-
|
|
46763
|
-
|
|
46764
|
-
|
|
46588
|
+
// When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per:
|
|
46589
|
+
// - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization
|
|
46590
|
+
// - `BindingElement: BindingPattern Initializer?`
|
|
46591
|
+
// - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization
|
|
46592
|
+
// - `BindingElement: BindingPattern Initializer?`
|
|
46593
|
+
bind(node.dotDotDotToken);
|
|
46594
|
+
bind(node.propertyName);
|
|
46595
|
+
bindInitializer(node.initializer);
|
|
46596
|
+
bind(node.name);
|
|
46597
|
+
}
|
|
46598
|
+
function bindParameterFlow(node) {
|
|
46599
|
+
bindEach(node.modifiers);
|
|
46600
|
+
bind(node.dotDotDotToken);
|
|
46601
|
+
bind(node.questionToken);
|
|
46602
|
+
bind(node.type);
|
|
46603
|
+
bindInitializer(node.initializer);
|
|
46604
|
+
bind(node.name);
|
|
46605
|
+
}
|
|
46606
|
+
// a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759)
|
|
46607
|
+
function bindInitializer(node) {
|
|
46608
|
+
if (!node) {
|
|
46609
|
+
return;
|
|
46765
46610
|
}
|
|
46766
|
-
|
|
46767
|
-
|
|
46611
|
+
var entryFlow = currentFlow;
|
|
46612
|
+
bind(node);
|
|
46613
|
+
if (entryFlow === unreachableFlow || entryFlow === currentFlow) {
|
|
46614
|
+
return;
|
|
46768
46615
|
}
|
|
46616
|
+
var exitFlow = createBranchLabel();
|
|
46617
|
+
addAntecedent(exitFlow, entryFlow);
|
|
46618
|
+
addAntecedent(exitFlow, currentFlow);
|
|
46619
|
+
currentFlow = finishFlowLabel(exitFlow);
|
|
46769
46620
|
}
|
|
46770
46621
|
function bindJSDocTypeAlias(node) {
|
|
46771
46622
|
bind(node.tagName);
|
|
@@ -49936,7 +49787,7 @@ var ts;
|
|
|
49936
49787
|
if (unidirectional === void 0) { unidirectional = false; }
|
|
49937
49788
|
source.forEach(function (sourceSymbol, id) {
|
|
49938
49789
|
var targetSymbol = target.get(id);
|
|
49939
|
-
target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol);
|
|
49790
|
+
target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol));
|
|
49940
49791
|
});
|
|
49941
49792
|
}
|
|
49942
49793
|
function mergeModuleAugmentation(moduleName) {
|
|
@@ -56727,11 +56578,9 @@ var ts;
|
|
|
56727
56578
|
return getReturnTypeOfSignature(getterSignature);
|
|
56728
56579
|
}
|
|
56729
56580
|
}
|
|
56730
|
-
|
|
56731
|
-
|
|
56732
|
-
|
|
56733
|
-
return type_1;
|
|
56734
|
-
}
|
|
56581
|
+
var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration);
|
|
56582
|
+
if (parameterTypeOfTypeTag)
|
|
56583
|
+
return parameterTypeOfTypeTag;
|
|
56735
56584
|
// Use contextual parameter type if one is available
|
|
56736
56585
|
var type = declaration.symbol.escapedName === "this" /* This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
|
|
56737
56586
|
if (type) {
|
|
@@ -57307,9 +57156,9 @@ var ts;
|
|
|
57307
57156
|
if (typeNode === undefined) {
|
|
57308
57157
|
return useUnknownInCatchVariables ? unknownType : anyType;
|
|
57309
57158
|
}
|
|
57310
|
-
var
|
|
57159
|
+
var type_1 = getTypeOfNode(typeNode);
|
|
57311
57160
|
// an errorType will make `checkTryStatement` issue an error
|
|
57312
|
-
return isTypeAny(
|
|
57161
|
+
return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType;
|
|
57313
57162
|
}
|
|
57314
57163
|
// Handle export default expressions
|
|
57315
57164
|
if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
|
|
@@ -57519,11 +57368,11 @@ var ts;
|
|
|
57519
57368
|
return errorType;
|
|
57520
57369
|
}
|
|
57521
57370
|
var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* ExportEquals */));
|
|
57522
|
-
var
|
|
57371
|
+
var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
|
|
57523
57372
|
if (!popTypeResolution()) {
|
|
57524
57373
|
return reportCircularityError(symbol);
|
|
57525
57374
|
}
|
|
57526
|
-
return
|
|
57375
|
+
return type_2;
|
|
57527
57376
|
}
|
|
57528
57377
|
}
|
|
57529
57378
|
var type = createObjectType(16 /* Anonymous */, symbol);
|
|
@@ -59746,10 +59595,10 @@ var ts;
|
|
|
59746
59595
|
var baseTypes = [];
|
|
59747
59596
|
var different = false;
|
|
59748
59597
|
for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {
|
|
59749
|
-
var
|
|
59750
|
-
var baseType = getBaseConstraint(
|
|
59598
|
+
var type_3 = types_7[_i];
|
|
59599
|
+
var baseType = getBaseConstraint(type_3);
|
|
59751
59600
|
if (baseType) {
|
|
59752
|
-
if (baseType !==
|
|
59601
|
+
if (baseType !== type_3) {
|
|
59753
59602
|
different = true;
|
|
59754
59603
|
}
|
|
59755
59604
|
baseTypes.push(baseType);
|
|
@@ -60540,7 +60389,12 @@ var ts;
|
|
|
60540
60389
|
continue;
|
|
60541
60390
|
}
|
|
60542
60391
|
}
|
|
60543
|
-
|
|
60392
|
+
// If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters.
|
|
60393
|
+
// Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would supress checks that the two are compatible.
|
|
60394
|
+
result.push((!ts.isFunctionExpressionOrArrowFunction(decl) &&
|
|
60395
|
+
!ts.isObjectLiteralMethod(decl) &&
|
|
60396
|
+
getSignatureOfTypeTag(decl)) ||
|
|
60397
|
+
getSignatureFromDeclaration(decl));
|
|
60544
60398
|
}
|
|
60545
60399
|
return result;
|
|
60546
60400
|
}
|
|
@@ -60571,7 +60425,7 @@ var ts;
|
|
|
60571
60425
|
else {
|
|
60572
60426
|
var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
|
|
60573
60427
|
var jsdocPredicate = void 0;
|
|
60574
|
-
if (!type
|
|
60428
|
+
if (!type) {
|
|
60575
60429
|
var jsdocSignature = getSignatureOfTypeTag(signature.declaration);
|
|
60576
60430
|
if (jsdocSignature && signature !== jsdocSignature) {
|
|
60577
60431
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
@@ -64597,15 +64451,14 @@ var ts;
|
|
|
64597
64451
|
return false;
|
|
64598
64452
|
}
|
|
64599
64453
|
function isContextSensitiveFunctionLikeDeclaration(node) {
|
|
64600
|
-
return
|
|
64601
|
-
(ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node));
|
|
64454
|
+
return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
|
|
64602
64455
|
}
|
|
64603
64456
|
function hasContextSensitiveReturnExpression(node) {
|
|
64604
64457
|
// TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value.
|
|
64605
64458
|
return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* Block */ && isContextSensitive(node.body);
|
|
64606
64459
|
}
|
|
64607
64460
|
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
|
|
64608
|
-
return (ts.
|
|
64461
|
+
return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
|
|
64609
64462
|
isContextSensitiveFunctionLikeDeclaration(func);
|
|
64610
64463
|
}
|
|
64611
64464
|
function getTypeWithoutSignatures(type) {
|
|
@@ -73663,9 +73516,11 @@ var ts;
|
|
|
73663
73516
|
case 1 /* ExportsProperty */:
|
|
73664
73517
|
case 6 /* Prototype */:
|
|
73665
73518
|
case 3 /* PrototypeProperty */:
|
|
73666
|
-
var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
|
|
73667
|
-
// falls through
|
|
73668
73519
|
case 2 /* ModuleExports */:
|
|
73520
|
+
var valueDeclaration = void 0;
|
|
73521
|
+
if (kind !== 2 /* ModuleExports */) {
|
|
73522
|
+
valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
|
|
73523
|
+
}
|
|
73669
73524
|
valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration);
|
|
73670
73525
|
var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration);
|
|
73671
73526
|
return annotated ? getTypeFromTypeNode(annotated) : undefined;
|
|
@@ -74143,9 +73998,16 @@ var ts;
|
|
|
74143
73998
|
if (!isErrorType(intrinsicClassAttribs)) {
|
|
74144
73999
|
var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);
|
|
74145
74000
|
var hostClassType = getReturnTypeOfSignature(sig);
|
|
74146
|
-
|
|
74147
|
-
|
|
74148
|
-
|
|
74001
|
+
var libraryManagedAttributeType = void 0;
|
|
74002
|
+
if (typeParams) {
|
|
74003
|
+
// apply JSX.IntrinsicClassElements<hostClassType, ...>
|
|
74004
|
+
var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context));
|
|
74005
|
+
libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs));
|
|
74006
|
+
}
|
|
74007
|
+
// or JSX.IntrinsicClassElements has no generics.
|
|
74008
|
+
else
|
|
74009
|
+
libraryManagedAttributeType = intrinsicClassAttribs;
|
|
74010
|
+
apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType);
|
|
74149
74011
|
}
|
|
74150
74012
|
var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
|
|
74151
74013
|
if (!isErrorType(intrinsicAttribs)) {
|
|
@@ -77972,12 +77834,15 @@ var ts;
|
|
|
77972
77834
|
return false;
|
|
77973
77835
|
}
|
|
77974
77836
|
var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
|
|
77975
|
-
ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
|
|
77837
|
+
(ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
|
|
77976
77838
|
undefined;
|
|
77977
77839
|
if (func) {
|
|
77978
|
-
// If the node has a @class tag, treat it like a constructor.
|
|
77840
|
+
// If the node has a @class or @constructor tag, treat it like a constructor.
|
|
77979
77841
|
if (ts.getJSDocClassTag(node))
|
|
77980
77842
|
return true;
|
|
77843
|
+
// If the node is a property of an object literal.
|
|
77844
|
+
if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent)))
|
|
77845
|
+
return false;
|
|
77981
77846
|
// If the symbol of the node has members, treat it like a constructor.
|
|
77982
77847
|
var symbol = getSymbolOfNode(func);
|
|
77983
77848
|
return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size);
|
|
@@ -78225,8 +78090,8 @@ var ts;
|
|
|
78225
78090
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
78226
78091
|
var synthType = type;
|
|
78227
78092
|
if (!synthType.defaultOnlyType) {
|
|
78228
|
-
var
|
|
78229
|
-
synthType.defaultOnlyType =
|
|
78093
|
+
var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
|
|
78094
|
+
synthType.defaultOnlyType = type_4;
|
|
78230
78095
|
}
|
|
78231
78096
|
return synthType.defaultOnlyType;
|
|
78232
78097
|
}
|
|
@@ -87563,6 +87428,12 @@ var ts;
|
|
|
87563
87428
|
return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container));
|
|
87564
87429
|
}
|
|
87565
87430
|
}
|
|
87431
|
+
if (result && isJSDoc_1) {
|
|
87432
|
+
var container = ts.getJSDocHost(name);
|
|
87433
|
+
if (container && ts.isEnumMember(container) && container === result.valueDeclaration) {
|
|
87434
|
+
return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result;
|
|
87435
|
+
}
|
|
87436
|
+
}
|
|
87566
87437
|
return result;
|
|
87567
87438
|
}
|
|
87568
87439
|
else if (ts.isPrivateIdentifier(name)) {
|
|
@@ -107724,6 +107595,13 @@ var ts;
|
|
|
107724
107595
|
ts.Debug.assert(importVariableName !== undefined);
|
|
107725
107596
|
// save import into the local
|
|
107726
107597
|
statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName)));
|
|
107598
|
+
if (ts.hasSyntacticModifier(entry, 1 /* Export */)) {
|
|
107599
|
+
statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction,
|
|
107600
|
+
/*typeArguments*/ undefined, [
|
|
107601
|
+
factory.createStringLiteral(ts.idText(importVariableName)),
|
|
107602
|
+
parameterName,
|
|
107603
|
+
])));
|
|
107604
|
+
}
|
|
107727
107605
|
break;
|
|
107728
107606
|
case 272 /* ExportDeclaration */:
|
|
107729
107607
|
ts.Debug.assert(importVariableName !== undefined);
|
|
@@ -110566,8 +110444,12 @@ var ts;
|
|
|
110566
110444
|
}
|
|
110567
110445
|
var previousNeedsDeclare = needsDeclare;
|
|
110568
110446
|
switch (input.kind) {
|
|
110569
|
-
case 259 /* TypeAliasDeclaration */:
|
|
110570
|
-
|
|
110447
|
+
case 259 /* TypeAliasDeclaration */: {
|
|
110448
|
+
needsDeclare = false;
|
|
110449
|
+
var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
|
|
110450
|
+
needsDeclare = previousNeedsDeclare;
|
|
110451
|
+
return clean;
|
|
110452
|
+
}
|
|
110571
110453
|
case 258 /* InterfaceDeclaration */: {
|
|
110572
110454
|
return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree)));
|
|
110573
110455
|
}
|
|
@@ -112071,8 +111953,8 @@ var ts;
|
|
|
112071
111953
|
}
|
|
112072
111954
|
ts.getBuildInfoText = getBuildInfoText;
|
|
112073
111955
|
/*@internal*/
|
|
112074
|
-
function getBuildInfo(buildInfoText) {
|
|
112075
|
-
return
|
|
111956
|
+
function getBuildInfo(buildInfoFile, buildInfoText) {
|
|
111957
|
+
return ts.readJsonOrUndefined(buildInfoFile, buildInfoText);
|
|
112076
111958
|
}
|
|
112077
111959
|
ts.getBuildInfo = getBuildInfo;
|
|
112078
111960
|
/*@internal*/
|
|
@@ -112150,17 +112032,16 @@ var ts;
|
|
|
112150
112032
|
var buildInfo;
|
|
112151
112033
|
if (host.getBuildInfo) {
|
|
112152
112034
|
// If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo
|
|
112153
|
-
|
|
112154
|
-
if (!hostBuildInfo)
|
|
112155
|
-
return buildInfoPath;
|
|
112156
|
-
buildInfo = hostBuildInfo;
|
|
112035
|
+
buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
|
|
112157
112036
|
}
|
|
112158
112037
|
else {
|
|
112159
112038
|
var buildInfoText = host.readFile(buildInfoPath);
|
|
112160
112039
|
if (!buildInfoText)
|
|
112161
112040
|
return buildInfoPath;
|
|
112162
|
-
buildInfo = getBuildInfo(buildInfoText);
|
|
112041
|
+
buildInfo = getBuildInfo(buildInfoPath, buildInfoText);
|
|
112163
112042
|
}
|
|
112043
|
+
if (!buildInfo)
|
|
112044
|
+
return buildInfoPath;
|
|
112164
112045
|
if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
|
|
112165
112046
|
return buildInfoPath;
|
|
112166
112047
|
var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
|
|
@@ -116818,7 +116699,16 @@ var ts;
|
|
|
116818
116699
|
return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath));
|
|
116819
116700
|
}
|
|
116820
116701
|
function getCachedFileSystemEntriesForBaseDir(path) {
|
|
116821
|
-
|
|
116702
|
+
var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path));
|
|
116703
|
+
if (!entries) {
|
|
116704
|
+
return entries;
|
|
116705
|
+
}
|
|
116706
|
+
// If we're looking for the base directory, we're definitely going to search the entries
|
|
116707
|
+
if (!entries.sortedAndCanonicalizedFiles) {
|
|
116708
|
+
entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort();
|
|
116709
|
+
entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort();
|
|
116710
|
+
}
|
|
116711
|
+
return entries;
|
|
116822
116712
|
}
|
|
116823
116713
|
function getBaseNameOfFileName(fileName) {
|
|
116824
116714
|
return ts.getBaseFileName(ts.normalizePath(fileName));
|
|
@@ -116861,21 +116751,10 @@ var ts;
|
|
|
116861
116751
|
return undefined;
|
|
116862
116752
|
}
|
|
116863
116753
|
}
|
|
116864
|
-
function fileNameEqual(name1, name2) {
|
|
116865
|
-
return getCanonicalFileName(name1) === getCanonicalFileName(name2);
|
|
116866
|
-
}
|
|
116867
116754
|
function hasEntry(entries, name) {
|
|
116868
|
-
|
|
116869
|
-
|
|
116870
|
-
|
|
116871
|
-
if (hasEntry(entries, baseName)) {
|
|
116872
|
-
if (!isValid) {
|
|
116873
|
-
return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); });
|
|
116874
|
-
}
|
|
116875
|
-
}
|
|
116876
|
-
else if (isValid) {
|
|
116877
|
-
return entries.push(baseName);
|
|
116878
|
-
}
|
|
116755
|
+
// Case-sensitive comparison since already canonicalized
|
|
116756
|
+
var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive);
|
|
116757
|
+
return index >= 0;
|
|
116879
116758
|
}
|
|
116880
116759
|
function writeFile(fileName, data, writeByteOrderMark) {
|
|
116881
116760
|
var path = toPath(fileName);
|
|
@@ -116888,7 +116767,7 @@ var ts;
|
|
|
116888
116767
|
function fileExists(fileName) {
|
|
116889
116768
|
var path = toPath(fileName);
|
|
116890
116769
|
var result = getCachedFileSystemEntriesForBaseDir(path);
|
|
116891
|
-
return result && hasEntry(result.
|
|
116770
|
+
return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) ||
|
|
116892
116771
|
host.fileExists(fileName);
|
|
116893
116772
|
}
|
|
116894
116773
|
function directoryExists(dirPath) {
|
|
@@ -116898,9 +116777,14 @@ var ts;
|
|
|
116898
116777
|
function createDirectory(dirPath) {
|
|
116899
116778
|
var path = toPath(dirPath);
|
|
116900
116779
|
var result = getCachedFileSystemEntriesForBaseDir(path);
|
|
116901
|
-
var baseFileName = getBaseNameOfFileName(dirPath);
|
|
116902
116780
|
if (result) {
|
|
116903
|
-
|
|
116781
|
+
var baseName = getBaseNameOfFileName(dirPath);
|
|
116782
|
+
var canonicalizedBaseName = getCanonicalFileName(baseName);
|
|
116783
|
+
var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories;
|
|
116784
|
+
// Case-sensitive comparison since already canonicalized
|
|
116785
|
+
if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) {
|
|
116786
|
+
result.directories.push(baseName);
|
|
116787
|
+
}
|
|
116904
116788
|
}
|
|
116905
116789
|
host.createDirectory(dirPath);
|
|
116906
116790
|
}
|
|
@@ -116969,7 +116853,7 @@ var ts;
|
|
|
116969
116853
|
fileExists: host.fileExists(fileOrDirectoryPath),
|
|
116970
116854
|
directoryExists: host.directoryExists(fileOrDirectoryPath)
|
|
116971
116855
|
};
|
|
116972
|
-
if (fsQueryResult.directoryExists || hasEntry(parentResult.
|
|
116856
|
+
if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
|
|
116973
116857
|
// Folder added or removed, clear the cache instead of updating the folder and its structure
|
|
116974
116858
|
clearCache();
|
|
116975
116859
|
}
|
|
@@ -116989,7 +116873,23 @@ var ts;
|
|
|
116989
116873
|
}
|
|
116990
116874
|
}
|
|
116991
116875
|
function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) {
|
|
116992
|
-
|
|
116876
|
+
var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles;
|
|
116877
|
+
var canonicalizedBaseName = getCanonicalFileName(baseName);
|
|
116878
|
+
if (fileExists) {
|
|
116879
|
+
// Case-sensitive comparison since already canonicalized
|
|
116880
|
+
if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) {
|
|
116881
|
+
parentResult.files.push(baseName);
|
|
116882
|
+
}
|
|
116883
|
+
}
|
|
116884
|
+
else {
|
|
116885
|
+
// Case-sensitive comparison since already canonicalized
|
|
116886
|
+
var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive);
|
|
116887
|
+
if (sortedIndex >= 0) {
|
|
116888
|
+
canonicalizedFiles.splice(sortedIndex, 1);
|
|
116889
|
+
var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; });
|
|
116890
|
+
parentResult.files.splice(unsortedIndex, 1);
|
|
116891
|
+
}
|
|
116892
|
+
}
|
|
116993
116893
|
}
|
|
116994
116894
|
function clearCache() {
|
|
116995
116895
|
cachedReadDirectoryResult.clear();
|
|
@@ -125227,18 +125127,14 @@ var ts;
|
|
|
125227
125127
|
if (host.getBuildInfo) {
|
|
125228
125128
|
// host provides buildinfo, get it from there. This allows host to cache it
|
|
125229
125129
|
buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
|
|
125230
|
-
if (!buildInfo)
|
|
125231
|
-
return undefined;
|
|
125232
125130
|
}
|
|
125233
125131
|
else {
|
|
125234
125132
|
var content = host.readFile(buildInfoPath);
|
|
125235
125133
|
if (!content)
|
|
125236
125134
|
return undefined;
|
|
125237
|
-
buildInfo = ts.getBuildInfo(content);
|
|
125135
|
+
buildInfo = ts.getBuildInfo(buildInfoPath, content);
|
|
125238
125136
|
}
|
|
125239
|
-
if (buildInfo.version !== ts.version)
|
|
125240
|
-
return undefined;
|
|
125241
|
-
if (!buildInfo.program)
|
|
125137
|
+
if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program)
|
|
125242
125138
|
return undefined;
|
|
125243
125139
|
return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
|
|
125244
125140
|
}
|
|
@@ -125460,7 +125356,8 @@ var ts;
|
|
|
125460
125356
|
}
|
|
125461
125357
|
// All resolutions are invalid if user provided resolutions
|
|
125462
125358
|
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
|
|
125463
|
-
|
|
125359
|
+
var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
|
|
125360
|
+
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
125464
125361
|
if (hasChangedConfigFileParsingErrors) {
|
|
125465
125362
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
125466
125363
|
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -125479,6 +125376,11 @@ var ts;
|
|
|
125479
125376
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
125480
125377
|
host.afterProgramCreate(builderProgram);
|
|
125481
125378
|
}
|
|
125379
|
+
compilerHost.readFile = originalReadFile;
|
|
125380
|
+
compilerHost.fileExists = originalFileExists;
|
|
125381
|
+
compilerHost.directoryExists = originalDirectoryExists;
|
|
125382
|
+
compilerHost.createDirectory = originalCreateDirectory;
|
|
125383
|
+
compilerHost.writeFile = originalWriteFile;
|
|
125482
125384
|
return builderProgram;
|
|
125483
125385
|
}
|
|
125484
125386
|
function createNewProgram(hasInvalidatedResolution) {
|
|
@@ -125956,19 +125858,20 @@ var ts;
|
|
|
125956
125858
|
*/
|
|
125957
125859
|
UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend";
|
|
125958
125860
|
UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
|
|
125959
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125960
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125961
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125962
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125963
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125964
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125965
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125966
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125861
|
+
UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile";
|
|
125862
|
+
UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf";
|
|
125863
|
+
UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream";
|
|
125864
|
+
UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo";
|
|
125865
|
+
UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate";
|
|
125866
|
+
UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked";
|
|
125867
|
+
UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream";
|
|
125868
|
+
UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate";
|
|
125869
|
+
UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText";
|
|
125967
125870
|
/**
|
|
125968
125871
|
* Projects with no outputs (i.e. "solution" files)
|
|
125969
125872
|
*/
|
|
125970
|
-
UpToDateStatusType[UpToDateStatusType["ContainerOnly"] =
|
|
125971
|
-
UpToDateStatusType[UpToDateStatusType["ForceBuild"] =
|
|
125873
|
+
UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly";
|
|
125874
|
+
UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild";
|
|
125972
125875
|
})(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
|
|
125973
125876
|
function resolveConfigFileProjectName(project) {
|
|
125974
125877
|
if (ts.fileExtensionIs(project, ".json" /* Json */)) {
|
|
@@ -126186,6 +126089,7 @@ var ts;
|
|
|
126186
126089
|
if (value) {
|
|
126187
126090
|
return isParsedCommandLine(value) ? value : undefined;
|
|
126188
126091
|
}
|
|
126092
|
+
ts.performance.mark("SolutionBuilder::beforeConfigFileParsing");
|
|
126189
126093
|
var diagnostic;
|
|
126190
126094
|
var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host;
|
|
126191
126095
|
var parsed;
|
|
@@ -126200,6 +126104,8 @@ var ts;
|
|
|
126200
126104
|
parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
|
|
126201
126105
|
}
|
|
126202
126106
|
configFileCache.set(configFilePath, parsed || diagnostic);
|
|
126107
|
+
ts.performance.mark("SolutionBuilder::afterConfigFileParsing");
|
|
126108
|
+
ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing");
|
|
126203
126109
|
return parsed;
|
|
126204
126110
|
}
|
|
126205
126111
|
function resolveProjectName(state, name) {
|
|
@@ -126399,6 +126305,7 @@ var ts;
|
|
|
126399
126305
|
if (updateOutputFileStampsPending) {
|
|
126400
126306
|
updateOutputTimestamps(state, config, projectPath);
|
|
126401
126307
|
}
|
|
126308
|
+
ts.performance.mark("SolutionBuilder::Timestamps only updates");
|
|
126402
126309
|
return doneInvalidatedProject(state, projectPath);
|
|
126403
126310
|
}
|
|
126404
126311
|
};
|
|
@@ -126492,6 +126399,10 @@ var ts;
|
|
|
126492
126399
|
};
|
|
126493
126400
|
function done(cancellationToken, writeFile, customTransformers) {
|
|
126494
126401
|
executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers);
|
|
126402
|
+
if (kind === InvalidatedProjectKind.Build)
|
|
126403
|
+
ts.performance.mark("SolutionBuilder::Projects built");
|
|
126404
|
+
else
|
|
126405
|
+
ts.performance.mark("SolutionBuilder::Bundles updated");
|
|
126495
126406
|
return doneInvalidatedProject(state, projectPath);
|
|
126496
126407
|
}
|
|
126497
126408
|
function withProgramOrUndefined(action) {
|
|
@@ -126670,13 +126581,13 @@ var ts;
|
|
|
126670
126581
|
var emitterDiagnostics = ts.createDiagnosticCollection();
|
|
126671
126582
|
var emittedOutputs = new ts.Map();
|
|
126672
126583
|
var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
|
|
126673
|
-
var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
|
|
126584
|
+
var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined;
|
|
126674
126585
|
outputFiles.forEach(function (_a) {
|
|
126675
126586
|
var _b, _c;
|
|
126676
126587
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
126677
126588
|
emittedOutputs.set(toPath(state, name), name);
|
|
126678
126589
|
if (buildInfo) {
|
|
126679
|
-
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
126590
|
+
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
126680
126591
|
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
126681
126592
|
}
|
|
126682
126593
|
setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
|
|
@@ -126969,8 +126880,7 @@ var ts;
|
|
|
126969
126880
|
return existing.buildInfo || undefined;
|
|
126970
126881
|
}
|
|
126971
126882
|
var value = state.readFileWithCache(buildInfoPath);
|
|
126972
|
-
var buildInfo = value ? ts.getBuildInfo(value) : undefined;
|
|
126973
|
-
ts.Debug.assert(modifiedTime || !buildInfo);
|
|
126883
|
+
var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined;
|
|
126974
126884
|
state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
|
|
126975
126885
|
return buildInfo;
|
|
126976
126886
|
}
|
|
@@ -127055,7 +126965,14 @@ var ts;
|
|
|
127055
126965
|
missingOutputFileName: buildInfoPath
|
|
127056
126966
|
};
|
|
127057
126967
|
}
|
|
127058
|
-
var buildInfo =
|
|
126968
|
+
var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime);
|
|
126969
|
+
if (!buildInfo) {
|
|
126970
|
+
// Error reading buildInfo
|
|
126971
|
+
return {
|
|
126972
|
+
type: ts.UpToDateStatusType.ErrorReadingFile,
|
|
126973
|
+
fileName: buildInfoPath
|
|
126974
|
+
};
|
|
126975
|
+
}
|
|
127059
126976
|
if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
|
|
127060
126977
|
return {
|
|
127061
126978
|
type: ts.UpToDateStatusType.TsVersionOutputOfDate,
|
|
@@ -127258,7 +127175,10 @@ var ts;
|
|
|
127258
127175
|
if (prior !== undefined) {
|
|
127259
127176
|
return prior;
|
|
127260
127177
|
}
|
|
127178
|
+
ts.performance.mark("SolutionBuilder::beforeUpToDateCheck");
|
|
127261
127179
|
var actual = getUpToDateStatusWorker(state, project, resolvedPath);
|
|
127180
|
+
ts.performance.mark("SolutionBuilder::afterUpToDateCheck");
|
|
127181
|
+
ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck");
|
|
127262
127182
|
state.projectStatus.set(resolvedPath, actual);
|
|
127263
127183
|
return actual;
|
|
127264
127184
|
}
|
|
@@ -127396,6 +127316,13 @@ var ts;
|
|
|
127396
127316
|
}
|
|
127397
127317
|
}
|
|
127398
127318
|
function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
|
|
127319
|
+
ts.performance.mark("SolutionBuilder::beforeBuild");
|
|
127320
|
+
var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences);
|
|
127321
|
+
ts.performance.mark("SolutionBuilder::afterBuild");
|
|
127322
|
+
ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild");
|
|
127323
|
+
return result;
|
|
127324
|
+
}
|
|
127325
|
+
function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
|
|
127399
127326
|
var buildOrder = getBuildOrderFor(state, project, onlyReferences);
|
|
127400
127327
|
if (!buildOrder)
|
|
127401
127328
|
return ts.ExitStatus.InvalidProject_OutputsSkipped;
|
|
@@ -127423,6 +127350,13 @@ var ts;
|
|
|
127423
127350
|
: ts.ExitStatus.DiagnosticsPresent_OutputsSkipped;
|
|
127424
127351
|
}
|
|
127425
127352
|
function clean(state, project, onlyReferences) {
|
|
127353
|
+
ts.performance.mark("SolutionBuilder::beforeClean");
|
|
127354
|
+
var result = cleanWorker(state, project, onlyReferences);
|
|
127355
|
+
ts.performance.mark("SolutionBuilder::afterClean");
|
|
127356
|
+
ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean");
|
|
127357
|
+
return result;
|
|
127358
|
+
}
|
|
127359
|
+
function cleanWorker(state, project, onlyReferences) {
|
|
127426
127360
|
var buildOrder = getBuildOrderFor(state, project, onlyReferences);
|
|
127427
127361
|
if (!buildOrder)
|
|
127428
127362
|
return ts.ExitStatus.InvalidProject_OutputsSkipped;
|
|
@@ -127496,6 +127430,14 @@ var ts;
|
|
|
127496
127430
|
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
|
|
127497
127431
|
}
|
|
127498
127432
|
function buildNextInvalidatedProject(state, changeDetected) {
|
|
127433
|
+
ts.performance.mark("SolutionBuilder::beforeBuild");
|
|
127434
|
+
var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
|
|
127435
|
+
ts.performance.mark("SolutionBuilder::afterBuild");
|
|
127436
|
+
ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild");
|
|
127437
|
+
if (buildOrder)
|
|
127438
|
+
reportErrorSummary(state, buildOrder);
|
|
127439
|
+
}
|
|
127440
|
+
function buildNextInvalidatedProjectWorker(state, changeDetected) {
|
|
127499
127441
|
state.timerToBuildInvalidatedProject = undefined;
|
|
127500
127442
|
if (state.reportFileChangeDetected) {
|
|
127501
127443
|
state.reportFileChangeDetected = false;
|
|
@@ -127528,7 +127470,7 @@ var ts;
|
|
|
127528
127470
|
}
|
|
127529
127471
|
}
|
|
127530
127472
|
disableCache(state);
|
|
127531
|
-
|
|
127473
|
+
return buildOrder;
|
|
127532
127474
|
}
|
|
127533
127475
|
function watchConfigFile(state, resolved, resolvedPath, parsed) {
|
|
127534
127476
|
if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
|
|
@@ -127583,6 +127525,7 @@ var ts;
|
|
|
127583
127525
|
function startWatching(state, buildOrder) {
|
|
127584
127526
|
if (!state.watchAllProjectsPending)
|
|
127585
127527
|
return;
|
|
127528
|
+
ts.performance.mark("SolutionBuilder::beforeWatcherCreation");
|
|
127586
127529
|
state.watchAllProjectsPending = false;
|
|
127587
127530
|
for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) {
|
|
127588
127531
|
var resolved = _a[_i];
|
|
@@ -127600,6 +127543,8 @@ var ts;
|
|
|
127600
127543
|
watchPackageJsonFiles(state, resolved, resolvedPath, cfg);
|
|
127601
127544
|
}
|
|
127602
127545
|
}
|
|
127546
|
+
ts.performance.mark("SolutionBuilder::afterWatcherCreation");
|
|
127547
|
+
ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation");
|
|
127603
127548
|
}
|
|
127604
127549
|
function stopWatching(state) {
|
|
127605
127550
|
ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher);
|
|
@@ -127713,6 +127658,8 @@ var ts;
|
|
|
127713
127658
|
return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName));
|
|
127714
127659
|
case ts.UpToDateStatusType.OutputMissing:
|
|
127715
127660
|
return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName));
|
|
127661
|
+
case ts.UpToDateStatusType.ErrorReadingFile:
|
|
127662
|
+
return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName));
|
|
127716
127663
|
case ts.UpToDateStatusType.OutOfDateBuildInfo:
|
|
127717
127664
|
return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile));
|
|
127718
127665
|
case ts.UpToDateStatusType.UpToDate:
|
|
@@ -157166,6 +157113,15 @@ var ts;
|
|
|
157166
157113
|
ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code,
|
|
157167
157114
|
ts.Diagnostics.Cannot_find_name_0.code
|
|
157168
157115
|
];
|
|
157116
|
+
var InfoKind;
|
|
157117
|
+
(function (InfoKind) {
|
|
157118
|
+
InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration";
|
|
157119
|
+
InfoKind[InfoKind["Enum"] = 1] = "Enum";
|
|
157120
|
+
InfoKind[InfoKind["Function"] = 2] = "Function";
|
|
157121
|
+
InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral";
|
|
157122
|
+
InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes";
|
|
157123
|
+
InfoKind[InfoKind["Signature"] = 5] = "Signature";
|
|
157124
|
+
})(InfoKind || (InfoKind = {}));
|
|
157169
157125
|
codefix.registerCodeFix({
|
|
157170
157126
|
errorCodes: errorCodes,
|
|
157171
157127
|
getCodeActions: function (context) {
|
|
@@ -157174,19 +157130,19 @@ var ts;
|
|
|
157174
157130
|
if (!info) {
|
|
157175
157131
|
return undefined;
|
|
157176
157132
|
}
|
|
157177
|
-
if (info.kind ===
|
|
157133
|
+
if (info.kind === InfoKind.ObjectLiteral) {
|
|
157178
157134
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addObjectLiteralProperties(t, context, info); });
|
|
157179
157135
|
return [codefix.createCodeFixAction(fixMissingProperties, changes, ts.Diagnostics.Add_missing_properties, fixMissingProperties, ts.Diagnostics.Add_all_missing_properties)];
|
|
157180
157136
|
}
|
|
157181
|
-
if (info.kind ===
|
|
157137
|
+
if (info.kind === InfoKind.JsxAttributes) {
|
|
157182
157138
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addJsxAttributes(t, context, info); });
|
|
157183
157139
|
return [codefix.createCodeFixAction(fixMissingAttributes, changes, ts.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts.Diagnostics.Add_all_missing_attributes)];
|
|
157184
157140
|
}
|
|
157185
|
-
if (info.kind ===
|
|
157141
|
+
if (info.kind === InfoKind.Function || info.kind === InfoKind.Signature) {
|
|
157186
157142
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); });
|
|
157187
157143
|
return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)];
|
|
157188
157144
|
}
|
|
157189
|
-
if (info.kind ===
|
|
157145
|
+
if (info.kind === InfoKind.Enum) {
|
|
157190
157146
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); });
|
|
157191
157147
|
return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)];
|
|
157192
157148
|
}
|
|
@@ -157204,20 +157160,20 @@ var ts;
|
|
|
157204
157160
|
if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) {
|
|
157205
157161
|
return;
|
|
157206
157162
|
}
|
|
157207
|
-
if (fixId === fixMissingFunctionDeclaration && info.kind ===
|
|
157163
|
+
if (fixId === fixMissingFunctionDeclaration && (info.kind === InfoKind.Function || info.kind === InfoKind.Signature)) {
|
|
157208
157164
|
addFunctionDeclaration(changes, context, info);
|
|
157209
157165
|
}
|
|
157210
|
-
else if (fixId === fixMissingProperties && info.kind ===
|
|
157166
|
+
else if (fixId === fixMissingProperties && info.kind === InfoKind.ObjectLiteral) {
|
|
157211
157167
|
addObjectLiteralProperties(changes, context, info);
|
|
157212
157168
|
}
|
|
157213
|
-
else if (fixId === fixMissingAttributes && info.kind ===
|
|
157169
|
+
else if (fixId === fixMissingAttributes && info.kind === InfoKind.JsxAttributes) {
|
|
157214
157170
|
addJsxAttributes(changes, context, info);
|
|
157215
157171
|
}
|
|
157216
157172
|
else {
|
|
157217
|
-
if (info.kind ===
|
|
157173
|
+
if (info.kind === InfoKind.Enum) {
|
|
157218
157174
|
addEnumMemberDeclaration(changes, checker, info);
|
|
157219
157175
|
}
|
|
157220
|
-
if (info.kind ===
|
|
157176
|
+
if (info.kind === InfoKind.TypeLikeDeclaration) {
|
|
157221
157177
|
var parentDeclaration = info.parentDeclaration, token_1 = info.token;
|
|
157222
157178
|
var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; });
|
|
157223
157179
|
if (!infos.some(function (i) { return i.token.text === token_1.text; })) {
|
|
@@ -157261,14 +157217,6 @@ var ts;
|
|
|
157261
157217
|
}));
|
|
157262
157218
|
},
|
|
157263
157219
|
});
|
|
157264
|
-
var InfoKind;
|
|
157265
|
-
(function (InfoKind) {
|
|
157266
|
-
InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration";
|
|
157267
|
-
InfoKind[InfoKind["Enum"] = 1] = "Enum";
|
|
157268
|
-
InfoKind[InfoKind["Function"] = 2] = "Function";
|
|
157269
|
-
InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral";
|
|
157270
|
-
InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes";
|
|
157271
|
-
})(InfoKind || (InfoKind = {}));
|
|
157272
157220
|
function getInfo(sourceFile, tokenPos, errorCode, checker, program) {
|
|
157273
157221
|
// The identifier of the missing property. eg:
|
|
157274
157222
|
// this.missing = 1;
|
|
@@ -157290,7 +157238,7 @@ var ts;
|
|
|
157290
157238
|
var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false));
|
|
157291
157239
|
if (!ts.length(properties))
|
|
157292
157240
|
return undefined;
|
|
157293
|
-
return { kind:
|
|
157241
|
+
return { kind: InfoKind.ObjectLiteral, token: param.name, properties: properties, parentDeclaration: parent };
|
|
157294
157242
|
}
|
|
157295
157243
|
if (!ts.isMemberName(token))
|
|
157296
157244
|
return undefined;
|
|
@@ -157298,17 +157246,26 @@ var ts;
|
|
|
157298
157246
|
var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent.initializer), checker.getTypeAtLocation(token), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false));
|
|
157299
157247
|
if (!ts.length(properties))
|
|
157300
157248
|
return undefined;
|
|
157301
|
-
return { kind:
|
|
157249
|
+
return { kind: InfoKind.ObjectLiteral, token: token, properties: properties, parentDeclaration: parent.initializer };
|
|
157302
157250
|
}
|
|
157303
157251
|
if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) {
|
|
157304
157252
|
var target = ts.getEmitScriptTarget(program.getCompilerOptions());
|
|
157305
157253
|
var attributes = getUnmatchedAttributes(checker, target, token.parent);
|
|
157306
157254
|
if (!ts.length(attributes))
|
|
157307
157255
|
return undefined;
|
|
157308
|
-
return { kind:
|
|
157256
|
+
return { kind: InfoKind.JsxAttributes, token: token, attributes: attributes, parentDeclaration: token.parent };
|
|
157309
157257
|
}
|
|
157310
|
-
if (ts.isIdentifier(token)
|
|
157311
|
-
|
|
157258
|
+
if (ts.isIdentifier(token)) {
|
|
157259
|
+
var type = checker.getContextualType(token);
|
|
157260
|
+
if (type && ts.getObjectFlags(type) & 16 /* Anonymous */) {
|
|
157261
|
+
var signature = ts.firstOrUndefined(checker.getSignaturesOfType(type, 0 /* Call */));
|
|
157262
|
+
if (signature === undefined)
|
|
157263
|
+
return undefined;
|
|
157264
|
+
return { kind: InfoKind.Signature, token: token, signature: signature, sourceFile: sourceFile, parentDeclaration: findScope(token) };
|
|
157265
|
+
}
|
|
157266
|
+
if (ts.isCallExpression(parent) && parent.expression === token) {
|
|
157267
|
+
return { kind: InfoKind.Function, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* None */, parentDeclaration: findScope(token) };
|
|
157268
|
+
}
|
|
157312
157269
|
}
|
|
157313
157270
|
if (!ts.isPropertyAccessExpression(parent))
|
|
157314
157271
|
return undefined;
|
|
@@ -157320,13 +157277,13 @@ var ts;
|
|
|
157320
157277
|
var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration);
|
|
157321
157278
|
var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile();
|
|
157322
157279
|
if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) {
|
|
157323
|
-
return { kind:
|
|
157280
|
+
return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* Export */, parentDeclaration: moduleDeclaration };
|
|
157324
157281
|
}
|
|
157325
157282
|
var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile);
|
|
157326
157283
|
if (sourceFile.commonJsModuleIndicator)
|
|
157327
157284
|
return undefined;
|
|
157328
157285
|
if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) {
|
|
157329
|
-
return { kind:
|
|
157286
|
+
return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* Export */, parentDeclaration: moduleSourceFile };
|
|
157330
157287
|
}
|
|
157331
157288
|
}
|
|
157332
157289
|
var classDeclaration = ts.find(symbol.declarations, ts.isClassLike);
|
|
@@ -157344,11 +157301,11 @@ var ts;
|
|
|
157344
157301
|
(makeStatic ? 32 /* Static */ : 0 /* None */) | (ts.startsWithUnderscore(token.text) ? 8 /* Private */ : 0 /* None */);
|
|
157345
157302
|
var isJSFile = ts.isSourceFileJS(declSourceFile);
|
|
157346
157303
|
var call = ts.tryCast(parent.parent, ts.isCallExpression);
|
|
157347
|
-
return { kind:
|
|
157304
|
+
return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile };
|
|
157348
157305
|
}
|
|
157349
157306
|
var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
|
|
157350
157307
|
if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
|
|
157351
|
-
return { kind:
|
|
157308
|
+
return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration };
|
|
157352
157309
|
}
|
|
157353
157310
|
return undefined;
|
|
157354
157311
|
}
|
|
@@ -157524,9 +157481,17 @@ var ts;
|
|
|
157524
157481
|
});
|
|
157525
157482
|
}
|
|
157526
157483
|
function addFunctionDeclaration(changes, context, info) {
|
|
157484
|
+
var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences);
|
|
157527
157485
|
var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
|
|
157528
|
-
var functionDeclaration =
|
|
157529
|
-
|
|
157486
|
+
var functionDeclaration = info.kind === InfoKind.Function
|
|
157487
|
+
? codefix.createSignatureDeclarationFromCallExpression(256 /* FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration)
|
|
157488
|
+
: codefix.createSignatureDeclarationFromSignature(256 /* FunctionDeclaration */, context, quotePreference, info.signature, codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), info.token, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ undefined, importAdder);
|
|
157489
|
+
if (functionDeclaration === undefined) {
|
|
157490
|
+
ts.Debug.fail("fixMissingFunctionDeclaration codefix got unexpected error.");
|
|
157491
|
+
}
|
|
157492
|
+
ts.isReturnStatement(info.parentDeclaration)
|
|
157493
|
+
? changes.insertNodeBefore(info.sourceFile, info.parentDeclaration, functionDeclaration, /*blankLineBetween*/ true)
|
|
157494
|
+
: changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration);
|
|
157530
157495
|
importAdder.writeFixes(changes);
|
|
157531
157496
|
}
|
|
157532
157497
|
function addJsxAttributes(changes, context, info) {
|
|
@@ -157684,6 +157649,14 @@ var ts;
|
|
|
157684
157649
|
}
|
|
157685
157650
|
return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* Single */);
|
|
157686
157651
|
}
|
|
157652
|
+
function findScope(node) {
|
|
157653
|
+
if (ts.findAncestor(node, ts.isJsxExpression)) {
|
|
157654
|
+
var returnStatement = ts.findAncestor(node.parent, ts.isReturnStatement);
|
|
157655
|
+
if (returnStatement)
|
|
157656
|
+
return returnStatement;
|
|
157657
|
+
}
|
|
157658
|
+
return ts.getSourceFileOfNode(node);
|
|
157659
|
+
}
|
|
157687
157660
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
157688
157661
|
})(ts || (ts = {}));
|
|
157689
157662
|
/* @internal */
|
|
@@ -160373,6 +160346,9 @@ var ts;
|
|
|
160373
160346
|
if (ts.isMethodDeclaration(signatureDeclaration)) {
|
|
160374
160347
|
return ts.factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name !== null && name !== void 0 ? name : ts.factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body);
|
|
160375
160348
|
}
|
|
160349
|
+
if (ts.isFunctionDeclaration(signatureDeclaration)) {
|
|
160350
|
+
return ts.factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts.tryCast(name, ts.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body);
|
|
160351
|
+
}
|
|
160376
160352
|
return undefined;
|
|
160377
160353
|
}
|
|
160378
160354
|
codefix.createSignatureDeclarationFromSignature = createSignatureDeclarationFromSignature;
|
|
@@ -167675,6 +167651,10 @@ var ts;
|
|
|
167675
167651
|
getCurrentDirectory: compilerHost.getCurrentDirectory,
|
|
167676
167652
|
onUnRecoverableConfigFileDiagnostic: ts.noop,
|
|
167677
167653
|
};
|
|
167654
|
+
// The call to isProgramUptoDate below may refer back to documentRegistryBucketKey;
|
|
167655
|
+
// calculate this early so it's not undefined if downleveled to a var (or, if emitted
|
|
167656
|
+
// as a const variable without downleveling, doesn't crash).
|
|
167657
|
+
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
167678
167658
|
// If the program is already up-to-date, we can reuse it
|
|
167679
167659
|
if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
167680
167660
|
return;
|
|
@@ -167684,7 +167664,6 @@ var ts;
|
|
|
167684
167664
|
// instance. If we cancel midway through, we may end up in an inconsistent state where
|
|
167685
167665
|
// the program points to old source files that have been invalidated because of
|
|
167686
167666
|
// incremental parsing.
|
|
167687
|
-
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
167688
167667
|
var options = {
|
|
167689
167668
|
rootNames: rootFileNames,
|
|
167690
167669
|
options: newSettings,
|