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/typescript.js
CHANGED
|
@@ -91,210 +91,15 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
91
91
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
92
92
|
};
|
|
93
93
|
})();
|
|
94
|
-
/* @internal */
|
|
95
|
-
var ts;
|
|
96
|
-
(function (ts) {
|
|
97
|
-
function createMapData() {
|
|
98
|
-
var sentinel = {};
|
|
99
|
-
sentinel.prev = sentinel;
|
|
100
|
-
return { head: sentinel, tail: sentinel, size: 0 };
|
|
101
|
-
}
|
|
102
|
-
function createMapEntry(key, value) {
|
|
103
|
-
return { key: key, value: value, next: undefined, prev: undefined };
|
|
104
|
-
}
|
|
105
|
-
function sameValueZero(x, y) {
|
|
106
|
-
// Treats -0 === 0 and NaN === NaN
|
|
107
|
-
return x === y || x !== x && y !== y;
|
|
108
|
-
}
|
|
109
|
-
function getPrev(entry) {
|
|
110
|
-
var prev = entry.prev;
|
|
111
|
-
// Entries without a 'prev' have been removed from the map.
|
|
112
|
-
// An entry whose 'prev' points to itself is the head of the list and is invalid here.
|
|
113
|
-
if (!prev || prev === entry)
|
|
114
|
-
throw new Error("Illegal state");
|
|
115
|
-
return prev;
|
|
116
|
-
}
|
|
117
|
-
function getNext(entry) {
|
|
118
|
-
while (entry) {
|
|
119
|
-
// Entries without a 'prev' have been removed from the map. Their 'next'
|
|
120
|
-
// pointer should point to the previous entry prior to deletion and
|
|
121
|
-
// that entry should be skipped to resume iteration.
|
|
122
|
-
var skipNext = !entry.prev;
|
|
123
|
-
entry = entry.next;
|
|
124
|
-
if (skipNext) {
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
return entry;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function getEntry(data, key) {
|
|
131
|
-
// We walk backwards from 'tail' to prioritize recently added entries.
|
|
132
|
-
// We skip 'head' because it is an empty entry used to track iteration start.
|
|
133
|
-
for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) {
|
|
134
|
-
if (sameValueZero(entry.key, key)) {
|
|
135
|
-
return entry;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function addOrUpdateEntry(data, key, value) {
|
|
140
|
-
var existing = getEntry(data, key);
|
|
141
|
-
if (existing) {
|
|
142
|
-
existing.value = value;
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
var entry = createMapEntry(key, value);
|
|
146
|
-
entry.prev = data.tail;
|
|
147
|
-
data.tail.next = entry;
|
|
148
|
-
data.tail = entry;
|
|
149
|
-
data.size++;
|
|
150
|
-
return entry;
|
|
151
|
-
}
|
|
152
|
-
function deleteEntry(data, key) {
|
|
153
|
-
// We walk backwards from 'tail' to prioritize recently added entries.
|
|
154
|
-
// We skip 'head' because it is an empty entry used to track iteration start.
|
|
155
|
-
for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) {
|
|
156
|
-
// all entries in the map should have a 'prev' pointer.
|
|
157
|
-
if (entry.prev === undefined)
|
|
158
|
-
throw new Error("Illegal state");
|
|
159
|
-
if (sameValueZero(entry.key, key)) {
|
|
160
|
-
if (entry.next) {
|
|
161
|
-
entry.next.prev = entry.prev;
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
// an entry in the map without a 'next' pointer must be the 'tail'.
|
|
165
|
-
if (data.tail !== entry)
|
|
166
|
-
throw new Error("Illegal state");
|
|
167
|
-
data.tail = entry.prev;
|
|
168
|
-
}
|
|
169
|
-
entry.prev.next = entry.next;
|
|
170
|
-
entry.next = entry.prev;
|
|
171
|
-
entry.prev = undefined;
|
|
172
|
-
data.size--;
|
|
173
|
-
return entry;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
function clearEntries(data) {
|
|
178
|
-
var node = data.tail;
|
|
179
|
-
while (node !== data.head) {
|
|
180
|
-
var prev = getPrev(node);
|
|
181
|
-
node.next = data.head;
|
|
182
|
-
node.prev = undefined;
|
|
183
|
-
node = prev;
|
|
184
|
-
}
|
|
185
|
-
data.head.next = undefined;
|
|
186
|
-
data.tail = data.head;
|
|
187
|
-
data.size = 0;
|
|
188
|
-
}
|
|
189
|
-
function forEachEntry(data, action) {
|
|
190
|
-
var entry = data.head;
|
|
191
|
-
while (entry) {
|
|
192
|
-
entry = getNext(entry);
|
|
193
|
-
if (entry) {
|
|
194
|
-
action(entry.value, entry.key);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
function forEachIteration(iterator, action) {
|
|
199
|
-
if (iterator) {
|
|
200
|
-
for (var step = iterator.next(); !step.done; step = iterator.next()) {
|
|
201
|
-
action(step.value);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
function createIteratorData(data, selector) {
|
|
206
|
-
return { current: data.head, selector: selector };
|
|
207
|
-
}
|
|
208
|
-
function iteratorNext(data) {
|
|
209
|
-
// Navigate to the next entry.
|
|
210
|
-
data.current = getNext(data.current);
|
|
211
|
-
if (data.current) {
|
|
212
|
-
return { value: data.selector(data.current.key, data.current.value), done: false };
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
return { value: undefined, done: true };
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
/* @internal */
|
|
219
|
-
var ShimCollections;
|
|
220
|
-
(function (ShimCollections) {
|
|
221
|
-
function createMapShim(getIterator) {
|
|
222
|
-
var MapIterator = /** @class */ (function () {
|
|
223
|
-
function MapIterator(data, selector) {
|
|
224
|
-
this._data = createIteratorData(data, selector);
|
|
225
|
-
}
|
|
226
|
-
MapIterator.prototype.next = function () { return iteratorNext(this._data); };
|
|
227
|
-
return MapIterator;
|
|
228
|
-
}());
|
|
229
|
-
return /** @class */ (function () {
|
|
230
|
-
function Map(iterable) {
|
|
231
|
-
var _this = this;
|
|
232
|
-
this._mapData = createMapData();
|
|
233
|
-
forEachIteration(getIterator(iterable), function (_a) {
|
|
234
|
-
var key = _a[0], value = _a[1];
|
|
235
|
-
return _this.set(key, value);
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
Object.defineProperty(Map.prototype, "size", {
|
|
239
|
-
get: function () { return this._mapData.size; },
|
|
240
|
-
enumerable: false,
|
|
241
|
-
configurable: true
|
|
242
|
-
});
|
|
243
|
-
Map.prototype.get = function (key) { var _a; return (_a = getEntry(this._mapData, key)) === null || _a === void 0 ? void 0 : _a.value; };
|
|
244
|
-
Map.prototype.set = function (key, value) { return addOrUpdateEntry(this._mapData, key, value), this; };
|
|
245
|
-
Map.prototype.has = function (key) { return !!getEntry(this._mapData, key); };
|
|
246
|
-
Map.prototype.delete = function (key) { return !!deleteEntry(this._mapData, key); };
|
|
247
|
-
Map.prototype.clear = function () { clearEntries(this._mapData); };
|
|
248
|
-
Map.prototype.keys = function () { return new MapIterator(this._mapData, function (key, _value) { return key; }); };
|
|
249
|
-
Map.prototype.values = function () { return new MapIterator(this._mapData, function (_key, value) { return value; }); };
|
|
250
|
-
Map.prototype.entries = function () { return new MapIterator(this._mapData, function (key, value) { return [key, value]; }); };
|
|
251
|
-
Map.prototype.forEach = function (action) { forEachEntry(this._mapData, action); };
|
|
252
|
-
return Map;
|
|
253
|
-
}());
|
|
254
|
-
}
|
|
255
|
-
ShimCollections.createMapShim = createMapShim;
|
|
256
|
-
function createSetShim(getIterator) {
|
|
257
|
-
var SetIterator = /** @class */ (function () {
|
|
258
|
-
function SetIterator(data, selector) {
|
|
259
|
-
this._data = createIteratorData(data, selector);
|
|
260
|
-
}
|
|
261
|
-
SetIterator.prototype.next = function () { return iteratorNext(this._data); };
|
|
262
|
-
return SetIterator;
|
|
263
|
-
}());
|
|
264
|
-
return /** @class */ (function () {
|
|
265
|
-
function Set(iterable) {
|
|
266
|
-
var _this = this;
|
|
267
|
-
this._mapData = createMapData();
|
|
268
|
-
forEachIteration(getIterator(iterable), function (value) { return _this.add(value); });
|
|
269
|
-
}
|
|
270
|
-
Object.defineProperty(Set.prototype, "size", {
|
|
271
|
-
get: function () { return this._mapData.size; },
|
|
272
|
-
enumerable: false,
|
|
273
|
-
configurable: true
|
|
274
|
-
});
|
|
275
|
-
Set.prototype.add = function (value) { return addOrUpdateEntry(this._mapData, value, value), this; };
|
|
276
|
-
Set.prototype.has = function (value) { return !!getEntry(this._mapData, value); };
|
|
277
|
-
Set.prototype.delete = function (value) { return !!deleteEntry(this._mapData, value); };
|
|
278
|
-
Set.prototype.clear = function () { clearEntries(this._mapData); };
|
|
279
|
-
Set.prototype.keys = function () { return new SetIterator(this._mapData, function (key, _value) { return key; }); };
|
|
280
|
-
Set.prototype.values = function () { return new SetIterator(this._mapData, function (_key, value) { return value; }); };
|
|
281
|
-
Set.prototype.entries = function () { return new SetIterator(this._mapData, function (key, value) { return [key, value]; }); };
|
|
282
|
-
Set.prototype.forEach = function (action) { forEachEntry(this._mapData, action); };
|
|
283
|
-
return Set;
|
|
284
|
-
}());
|
|
285
|
-
}
|
|
286
|
-
ShimCollections.createSetShim = createSetShim;
|
|
287
|
-
})(ShimCollections = ts.ShimCollections || (ts.ShimCollections = {}));
|
|
288
|
-
})(ts || (ts = {}));
|
|
289
94
|
var ts;
|
|
290
95
|
(function (ts) {
|
|
291
96
|
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
|
|
292
97
|
// If changing the text in this section, be sure to test `configurePrerelease` too.
|
|
293
|
-
ts.versionMajorMinor = "4.
|
|
98
|
+
ts.versionMajorMinor = "4.9";
|
|
294
99
|
// The following is baselined as a literal template type without intervention
|
|
295
100
|
/** The version of the TypeScript compiler release */
|
|
296
101
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
102
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220812";
|
|
298
103
|
/* @internal */
|
|
299
104
|
var Comparison;
|
|
300
105
|
(function (Comparison) {
|
|
@@ -316,7 +121,11 @@ var ts;
|
|
|
316
121
|
// Internet Explorer's Map doesn't support iteration, so don't use it.
|
|
317
122
|
var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
|
|
318
123
|
// eslint-disable-next-line no-in-operator
|
|
319
|
-
|
|
124
|
+
var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
|
|
125
|
+
if (!constructor) {
|
|
126
|
+
throw new Error("No compatible Map implementation found.");
|
|
127
|
+
}
|
|
128
|
+
return constructor;
|
|
320
129
|
}
|
|
321
130
|
NativeCollections.tryGetNativeMap = tryGetNativeMap;
|
|
322
131
|
/**
|
|
@@ -326,23 +135,18 @@ var ts;
|
|
|
326
135
|
// Internet Explorer's Set doesn't support iteration, so don't use it.
|
|
327
136
|
var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
|
|
328
137
|
// eslint-disable-next-line no-in-operator
|
|
329
|
-
|
|
138
|
+
var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
|
|
139
|
+
if (!constructor) {
|
|
140
|
+
throw new Error("No compatible Set implementation found.");
|
|
141
|
+
}
|
|
142
|
+
return constructor;
|
|
330
143
|
}
|
|
331
144
|
NativeCollections.tryGetNativeSet = tryGetNativeSet;
|
|
332
145
|
})(NativeCollections || (NativeCollections = {}));
|
|
333
146
|
/* @internal */
|
|
334
|
-
ts.Map =
|
|
147
|
+
ts.Map = NativeCollections.tryGetNativeMap();
|
|
335
148
|
/* @internal */
|
|
336
|
-
ts.Set =
|
|
337
|
-
/* @internal */
|
|
338
|
-
function getCollectionImplementation(name, nativeFactory, shimFactory) {
|
|
339
|
-
var _a;
|
|
340
|
-
// NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it.
|
|
341
|
-
var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator);
|
|
342
|
-
if (constructor)
|
|
343
|
-
return constructor;
|
|
344
|
-
throw new Error("TypeScript requires an environment that provides a compatible native " + name + " implementation.");
|
|
345
|
-
}
|
|
149
|
+
ts.Set = NativeCollections.tryGetNativeSet();
|
|
346
150
|
})(ts || (ts = {}));
|
|
347
151
|
/* @internal */
|
|
348
152
|
var ts;
|
|
@@ -1058,15 +862,18 @@ var ts;
|
|
|
1058
862
|
function insertSorted(array, insert, compare, allowDuplicates) {
|
|
1059
863
|
if (array.length === 0) {
|
|
1060
864
|
array.push(insert);
|
|
1061
|
-
return;
|
|
865
|
+
return true;
|
|
1062
866
|
}
|
|
1063
867
|
var insertIndex = binarySearch(array, insert, identity, compare);
|
|
1064
868
|
if (insertIndex < 0) {
|
|
1065
869
|
array.splice(~insertIndex, 0, insert);
|
|
870
|
+
return true;
|
|
1066
871
|
}
|
|
1067
|
-
|
|
872
|
+
if (allowDuplicates) {
|
|
1068
873
|
array.splice(insertIndex, 0, insert);
|
|
874
|
+
return true;
|
|
1069
875
|
}
|
|
876
|
+
return false;
|
|
1070
877
|
}
|
|
1071
878
|
ts.insertSorted = insertSorted;
|
|
1072
879
|
function sortAndDeduplicate(array, comparer, equalityComparer) {
|
|
@@ -3746,6 +3553,8 @@ var ts;
|
|
|
3746
3553
|
typeof performance.mark === "function" &&
|
|
3747
3554
|
typeof performance.measure === "function" &&
|
|
3748
3555
|
typeof performance.now === "function" &&
|
|
3556
|
+
typeof performance.clearMarks === "function" &&
|
|
3557
|
+
typeof performance.clearMeasures === "function" &&
|
|
3749
3558
|
typeof PerformanceObserver === "function";
|
|
3750
3559
|
}
|
|
3751
3560
|
function tryGetWebPerformanceHooks() {
|
|
@@ -3790,7 +3599,9 @@ var ts;
|
|
|
3790
3599
|
if (end === "__performance.measure-fix__") {
|
|
3791
3600
|
nodePerformance_1.clearMarks("__performance.measure-fix__");
|
|
3792
3601
|
}
|
|
3793
|
-
}
|
|
3602
|
+
},
|
|
3603
|
+
clearMarks: function (name) { return nodePerformance_1.clearMarks(name); },
|
|
3604
|
+
clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); },
|
|
3794
3605
|
};
|
|
3795
3606
|
}
|
|
3796
3607
|
return {
|
|
@@ -3923,6 +3734,30 @@ var ts;
|
|
|
3923
3734
|
durations.forEach(function (duration, measureName) { return cb(measureName, duration); });
|
|
3924
3735
|
}
|
|
3925
3736
|
performance.forEachMeasure = forEachMeasure;
|
|
3737
|
+
function forEachMark(cb) {
|
|
3738
|
+
marks.forEach(function (_time, markName) { return cb(markName); });
|
|
3739
|
+
}
|
|
3740
|
+
performance.forEachMark = forEachMark;
|
|
3741
|
+
function clearMeasures(name) {
|
|
3742
|
+
if (name !== undefined)
|
|
3743
|
+
durations.delete(name);
|
|
3744
|
+
else
|
|
3745
|
+
durations.clear();
|
|
3746
|
+
performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name);
|
|
3747
|
+
}
|
|
3748
|
+
performance.clearMeasures = clearMeasures;
|
|
3749
|
+
function clearMarks(name) {
|
|
3750
|
+
if (name !== undefined) {
|
|
3751
|
+
counts.delete(name);
|
|
3752
|
+
marks.delete(name);
|
|
3753
|
+
}
|
|
3754
|
+
else {
|
|
3755
|
+
counts.clear();
|
|
3756
|
+
marks.clear();
|
|
3757
|
+
}
|
|
3758
|
+
performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name);
|
|
3759
|
+
}
|
|
3760
|
+
performance.clearMarks = clearMarks;
|
|
3926
3761
|
/**
|
|
3927
3762
|
* Indicates whether the performance API is enabled.
|
|
3928
3763
|
*/
|
|
@@ -8027,12 +7862,9 @@ var ts;
|
|
|
8027
7862
|
* Normalize path separators, converting `\` into `/`.
|
|
8028
7863
|
*/
|
|
8029
7864
|
function normalizeSlashes(path) {
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
}
|
|
8034
|
-
backslashRegExp.lastIndex = index; // prime regex with known position
|
|
8035
|
-
return path.replace(backslashRegExp, ts.directorySeparator);
|
|
7865
|
+
return path.indexOf("\\") !== -1
|
|
7866
|
+
? path.replace(backslashRegExp, ts.directorySeparator)
|
|
7867
|
+
: path;
|
|
8036
7868
|
}
|
|
8037
7869
|
ts.normalizeSlashes = normalizeSlashes;
|
|
8038
7870
|
/**
|
|
@@ -9733,6 +9565,7 @@ var ts;
|
|
|
9733
9565
|
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."),
|
|
9734
9566
|
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"),
|
|
9735
9567
|
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"),
|
|
9568
|
+
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}'"),
|
|
9736
9569
|
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}'"),
|
|
9737
9570
|
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."),
|
|
9738
9571
|
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."),
|
|
@@ -19576,21 +19409,17 @@ var ts;
|
|
|
19576
19409
|
return getStringFromExpandedCharCodes(expandedCharCodes);
|
|
19577
19410
|
}
|
|
19578
19411
|
ts.base64decode = base64decode;
|
|
19412
|
+
function readJsonOrUndefined(path, hostOrText) {
|
|
19413
|
+
var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path);
|
|
19414
|
+
if (!jsonText)
|
|
19415
|
+
return undefined;
|
|
19416
|
+
// gracefully handle if readFile fails or returns not JSON
|
|
19417
|
+
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
19418
|
+
return !result.error ? result.config : undefined;
|
|
19419
|
+
}
|
|
19420
|
+
ts.readJsonOrUndefined = readJsonOrUndefined;
|
|
19579
19421
|
function readJson(path, host) {
|
|
19580
|
-
|
|
19581
|
-
var jsonText = host.readFile(path);
|
|
19582
|
-
if (!jsonText)
|
|
19583
|
-
return {};
|
|
19584
|
-
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
19585
|
-
if (result.error) {
|
|
19586
|
-
return {};
|
|
19587
|
-
}
|
|
19588
|
-
return result.config;
|
|
19589
|
-
}
|
|
19590
|
-
catch (e) {
|
|
19591
|
-
// gracefully handle if readFile fails or returns not JSON
|
|
19592
|
-
return {};
|
|
19593
|
-
}
|
|
19422
|
+
return readJsonOrUndefined(path, host) || {};
|
|
19594
19423
|
}
|
|
19595
19424
|
ts.readJson = readJson;
|
|
19596
19425
|
function directoryProbablyExists(directoryName, host) {
|
|
@@ -27941,9 +27770,10 @@ var ts;
|
|
|
27941
27770
|
};
|
|
27942
27771
|
var buildInfo_1;
|
|
27943
27772
|
var getAndCacheBuildInfo_1 = function (getText) {
|
|
27773
|
+
var _a;
|
|
27944
27774
|
if (buildInfo_1 === undefined) {
|
|
27945
27775
|
var result = getText();
|
|
27946
|
-
buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false;
|
|
27776
|
+
buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false;
|
|
27947
27777
|
}
|
|
27948
27778
|
return buildInfo_1 || undefined;
|
|
27949
27779
|
};
|
|
@@ -46003,6 +45833,9 @@ var ts;
|
|
|
46003
45833
|
case 203 /* BindingElement */:
|
|
46004
45834
|
bindBindingElementFlow(node);
|
|
46005
45835
|
break;
|
|
45836
|
+
case 164 /* Parameter */:
|
|
45837
|
+
bindParameterFlow(node);
|
|
45838
|
+
break;
|
|
46006
45839
|
case 205 /* ObjectLiteralExpression */:
|
|
46007
45840
|
case 204 /* ArrayLiteralExpression */:
|
|
46008
45841
|
case 296 /* PropertyAssignment */:
|
|
@@ -46743,20 +46576,38 @@ var ts;
|
|
|
46743
46576
|
}
|
|
46744
46577
|
}
|
|
46745
46578
|
function bindBindingElementFlow(node) {
|
|
46746
|
-
|
|
46747
|
-
|
|
46748
|
-
|
|
46749
|
-
|
|
46750
|
-
|
|
46751
|
-
|
|
46752
|
-
|
|
46753
|
-
|
|
46754
|
-
|
|
46755
|
-
|
|
46579
|
+
// When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per:
|
|
46580
|
+
// - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization
|
|
46581
|
+
// - `BindingElement: BindingPattern Initializer?`
|
|
46582
|
+
// - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization
|
|
46583
|
+
// - `BindingElement: BindingPattern Initializer?`
|
|
46584
|
+
bind(node.dotDotDotToken);
|
|
46585
|
+
bind(node.propertyName);
|
|
46586
|
+
bindInitializer(node.initializer);
|
|
46587
|
+
bind(node.name);
|
|
46588
|
+
}
|
|
46589
|
+
function bindParameterFlow(node) {
|
|
46590
|
+
bindEach(node.modifiers);
|
|
46591
|
+
bind(node.dotDotDotToken);
|
|
46592
|
+
bind(node.questionToken);
|
|
46593
|
+
bind(node.type);
|
|
46594
|
+
bindInitializer(node.initializer);
|
|
46595
|
+
bind(node.name);
|
|
46596
|
+
}
|
|
46597
|
+
// a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759)
|
|
46598
|
+
function bindInitializer(node) {
|
|
46599
|
+
if (!node) {
|
|
46600
|
+
return;
|
|
46756
46601
|
}
|
|
46757
|
-
|
|
46758
|
-
|
|
46602
|
+
var entryFlow = currentFlow;
|
|
46603
|
+
bind(node);
|
|
46604
|
+
if (entryFlow === unreachableFlow || entryFlow === currentFlow) {
|
|
46605
|
+
return;
|
|
46759
46606
|
}
|
|
46607
|
+
var exitFlow = createBranchLabel();
|
|
46608
|
+
addAntecedent(exitFlow, entryFlow);
|
|
46609
|
+
addAntecedent(exitFlow, currentFlow);
|
|
46610
|
+
currentFlow = finishFlowLabel(exitFlow);
|
|
46760
46611
|
}
|
|
46761
46612
|
function bindJSDocTypeAlias(node) {
|
|
46762
46613
|
bind(node.tagName);
|
|
@@ -49927,7 +49778,7 @@ var ts;
|
|
|
49927
49778
|
if (unidirectional === void 0) { unidirectional = false; }
|
|
49928
49779
|
source.forEach(function (sourceSymbol, id) {
|
|
49929
49780
|
var targetSymbol = target.get(id);
|
|
49930
|
-
target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol);
|
|
49781
|
+
target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol));
|
|
49931
49782
|
});
|
|
49932
49783
|
}
|
|
49933
49784
|
function mergeModuleAugmentation(moduleName) {
|
|
@@ -56718,11 +56569,9 @@ var ts;
|
|
|
56718
56569
|
return getReturnTypeOfSignature(getterSignature);
|
|
56719
56570
|
}
|
|
56720
56571
|
}
|
|
56721
|
-
|
|
56722
|
-
|
|
56723
|
-
|
|
56724
|
-
return type_1;
|
|
56725
|
-
}
|
|
56572
|
+
var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration);
|
|
56573
|
+
if (parameterTypeOfTypeTag)
|
|
56574
|
+
return parameterTypeOfTypeTag;
|
|
56726
56575
|
// Use contextual parameter type if one is available
|
|
56727
56576
|
var type = declaration.symbol.escapedName === "this" /* This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
|
|
56728
56577
|
if (type) {
|
|
@@ -57298,9 +57147,9 @@ var ts;
|
|
|
57298
57147
|
if (typeNode === undefined) {
|
|
57299
57148
|
return useUnknownInCatchVariables ? unknownType : anyType;
|
|
57300
57149
|
}
|
|
57301
|
-
var
|
|
57150
|
+
var type_1 = getTypeOfNode(typeNode);
|
|
57302
57151
|
// an errorType will make `checkTryStatement` issue an error
|
|
57303
|
-
return isTypeAny(
|
|
57152
|
+
return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType;
|
|
57304
57153
|
}
|
|
57305
57154
|
// Handle export default expressions
|
|
57306
57155
|
if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
|
|
@@ -57510,11 +57359,11 @@ var ts;
|
|
|
57510
57359
|
return errorType;
|
|
57511
57360
|
}
|
|
57512
57361
|
var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* ExportEquals */));
|
|
57513
|
-
var
|
|
57362
|
+
var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
|
|
57514
57363
|
if (!popTypeResolution()) {
|
|
57515
57364
|
return reportCircularityError(symbol);
|
|
57516
57365
|
}
|
|
57517
|
-
return
|
|
57366
|
+
return type_2;
|
|
57518
57367
|
}
|
|
57519
57368
|
}
|
|
57520
57369
|
var type = createObjectType(16 /* Anonymous */, symbol);
|
|
@@ -59737,10 +59586,10 @@ var ts;
|
|
|
59737
59586
|
var baseTypes = [];
|
|
59738
59587
|
var different = false;
|
|
59739
59588
|
for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {
|
|
59740
|
-
var
|
|
59741
|
-
var baseType = getBaseConstraint(
|
|
59589
|
+
var type_3 = types_7[_i];
|
|
59590
|
+
var baseType = getBaseConstraint(type_3);
|
|
59742
59591
|
if (baseType) {
|
|
59743
|
-
if (baseType !==
|
|
59592
|
+
if (baseType !== type_3) {
|
|
59744
59593
|
different = true;
|
|
59745
59594
|
}
|
|
59746
59595
|
baseTypes.push(baseType);
|
|
@@ -60531,7 +60380,12 @@ var ts;
|
|
|
60531
60380
|
continue;
|
|
60532
60381
|
}
|
|
60533
60382
|
}
|
|
60534
|
-
|
|
60383
|
+
// If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters.
|
|
60384
|
+
// 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.
|
|
60385
|
+
result.push((!ts.isFunctionExpressionOrArrowFunction(decl) &&
|
|
60386
|
+
!ts.isObjectLiteralMethod(decl) &&
|
|
60387
|
+
getSignatureOfTypeTag(decl)) ||
|
|
60388
|
+
getSignatureFromDeclaration(decl));
|
|
60535
60389
|
}
|
|
60536
60390
|
return result;
|
|
60537
60391
|
}
|
|
@@ -60562,7 +60416,7 @@ var ts;
|
|
|
60562
60416
|
else {
|
|
60563
60417
|
var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
|
|
60564
60418
|
var jsdocPredicate = void 0;
|
|
60565
|
-
if (!type
|
|
60419
|
+
if (!type) {
|
|
60566
60420
|
var jsdocSignature = getSignatureOfTypeTag(signature.declaration);
|
|
60567
60421
|
if (jsdocSignature && signature !== jsdocSignature) {
|
|
60568
60422
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
@@ -64588,15 +64442,14 @@ var ts;
|
|
|
64588
64442
|
return false;
|
|
64589
64443
|
}
|
|
64590
64444
|
function isContextSensitiveFunctionLikeDeclaration(node) {
|
|
64591
|
-
return
|
|
64592
|
-
(ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node));
|
|
64445
|
+
return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
|
|
64593
64446
|
}
|
|
64594
64447
|
function hasContextSensitiveReturnExpression(node) {
|
|
64595
64448
|
// TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value.
|
|
64596
64449
|
return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* Block */ && isContextSensitive(node.body);
|
|
64597
64450
|
}
|
|
64598
64451
|
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
|
|
64599
|
-
return (ts.
|
|
64452
|
+
return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
|
|
64600
64453
|
isContextSensitiveFunctionLikeDeclaration(func);
|
|
64601
64454
|
}
|
|
64602
64455
|
function getTypeWithoutSignatures(type) {
|
|
@@ -73654,9 +73507,11 @@ var ts;
|
|
|
73654
73507
|
case 1 /* ExportsProperty */:
|
|
73655
73508
|
case 6 /* Prototype */:
|
|
73656
73509
|
case 3 /* PrototypeProperty */:
|
|
73657
|
-
var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
|
|
73658
|
-
// falls through
|
|
73659
73510
|
case 2 /* ModuleExports */:
|
|
73511
|
+
var valueDeclaration = void 0;
|
|
73512
|
+
if (kind !== 2 /* ModuleExports */) {
|
|
73513
|
+
valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
|
|
73514
|
+
}
|
|
73660
73515
|
valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration);
|
|
73661
73516
|
var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration);
|
|
73662
73517
|
return annotated ? getTypeFromTypeNode(annotated) : undefined;
|
|
@@ -74134,9 +73989,16 @@ var ts;
|
|
|
74134
73989
|
if (!isErrorType(intrinsicClassAttribs)) {
|
|
74135
73990
|
var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);
|
|
74136
73991
|
var hostClassType = getReturnTypeOfSignature(sig);
|
|
74137
|
-
|
|
74138
|
-
|
|
74139
|
-
|
|
73992
|
+
var libraryManagedAttributeType = void 0;
|
|
73993
|
+
if (typeParams) {
|
|
73994
|
+
// apply JSX.IntrinsicClassElements<hostClassType, ...>
|
|
73995
|
+
var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context));
|
|
73996
|
+
libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs));
|
|
73997
|
+
}
|
|
73998
|
+
// or JSX.IntrinsicClassElements has no generics.
|
|
73999
|
+
else
|
|
74000
|
+
libraryManagedAttributeType = intrinsicClassAttribs;
|
|
74001
|
+
apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType);
|
|
74140
74002
|
}
|
|
74141
74003
|
var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
|
|
74142
74004
|
if (!isErrorType(intrinsicAttribs)) {
|
|
@@ -77963,12 +77825,15 @@ var ts;
|
|
|
77963
77825
|
return false;
|
|
77964
77826
|
}
|
|
77965
77827
|
var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
|
|
77966
|
-
ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
|
|
77828
|
+
(ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
|
|
77967
77829
|
undefined;
|
|
77968
77830
|
if (func) {
|
|
77969
|
-
// If the node has a @class tag, treat it like a constructor.
|
|
77831
|
+
// If the node has a @class or @constructor tag, treat it like a constructor.
|
|
77970
77832
|
if (ts.getJSDocClassTag(node))
|
|
77971
77833
|
return true;
|
|
77834
|
+
// If the node is a property of an object literal.
|
|
77835
|
+
if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent)))
|
|
77836
|
+
return false;
|
|
77972
77837
|
// If the symbol of the node has members, treat it like a constructor.
|
|
77973
77838
|
var symbol = getSymbolOfNode(func);
|
|
77974
77839
|
return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size);
|
|
@@ -78216,8 +78081,8 @@ var ts;
|
|
|
78216
78081
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
78217
78082
|
var synthType = type;
|
|
78218
78083
|
if (!synthType.defaultOnlyType) {
|
|
78219
|
-
var
|
|
78220
|
-
synthType.defaultOnlyType =
|
|
78084
|
+
var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
|
|
78085
|
+
synthType.defaultOnlyType = type_4;
|
|
78221
78086
|
}
|
|
78222
78087
|
return synthType.defaultOnlyType;
|
|
78223
78088
|
}
|
|
@@ -87554,6 +87419,12 @@ var ts;
|
|
|
87554
87419
|
return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container));
|
|
87555
87420
|
}
|
|
87556
87421
|
}
|
|
87422
|
+
if (result && isJSDoc_1) {
|
|
87423
|
+
var container = ts.getJSDocHost(name);
|
|
87424
|
+
if (container && ts.isEnumMember(container) && container === result.valueDeclaration) {
|
|
87425
|
+
return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result;
|
|
87426
|
+
}
|
|
87427
|
+
}
|
|
87557
87428
|
return result;
|
|
87558
87429
|
}
|
|
87559
87430
|
else if (ts.isPrivateIdentifier(name)) {
|
|
@@ -107715,6 +107586,13 @@ var ts;
|
|
|
107715
107586
|
ts.Debug.assert(importVariableName !== undefined);
|
|
107716
107587
|
// save import into the local
|
|
107717
107588
|
statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName)));
|
|
107589
|
+
if (ts.hasSyntacticModifier(entry, 1 /* Export */)) {
|
|
107590
|
+
statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction,
|
|
107591
|
+
/*typeArguments*/ undefined, [
|
|
107592
|
+
factory.createStringLiteral(ts.idText(importVariableName)),
|
|
107593
|
+
parameterName,
|
|
107594
|
+
])));
|
|
107595
|
+
}
|
|
107718
107596
|
break;
|
|
107719
107597
|
case 272 /* ExportDeclaration */:
|
|
107720
107598
|
ts.Debug.assert(importVariableName !== undefined);
|
|
@@ -110557,8 +110435,12 @@ var ts;
|
|
|
110557
110435
|
}
|
|
110558
110436
|
var previousNeedsDeclare = needsDeclare;
|
|
110559
110437
|
switch (input.kind) {
|
|
110560
|
-
case 259 /* TypeAliasDeclaration */:
|
|
110561
|
-
|
|
110438
|
+
case 259 /* TypeAliasDeclaration */: {
|
|
110439
|
+
needsDeclare = false;
|
|
110440
|
+
var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
|
|
110441
|
+
needsDeclare = previousNeedsDeclare;
|
|
110442
|
+
return clean;
|
|
110443
|
+
}
|
|
110562
110444
|
case 258 /* InterfaceDeclaration */: {
|
|
110563
110445
|
return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree)));
|
|
110564
110446
|
}
|
|
@@ -112062,8 +111944,8 @@ var ts;
|
|
|
112062
111944
|
}
|
|
112063
111945
|
ts.getBuildInfoText = getBuildInfoText;
|
|
112064
111946
|
/*@internal*/
|
|
112065
|
-
function getBuildInfo(buildInfoText) {
|
|
112066
|
-
return
|
|
111947
|
+
function getBuildInfo(buildInfoFile, buildInfoText) {
|
|
111948
|
+
return ts.readJsonOrUndefined(buildInfoFile, buildInfoText);
|
|
112067
111949
|
}
|
|
112068
111950
|
ts.getBuildInfo = getBuildInfo;
|
|
112069
111951
|
/*@internal*/
|
|
@@ -112141,17 +112023,16 @@ var ts;
|
|
|
112141
112023
|
var buildInfo;
|
|
112142
112024
|
if (host.getBuildInfo) {
|
|
112143
112025
|
// If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo
|
|
112144
|
-
|
|
112145
|
-
if (!hostBuildInfo)
|
|
112146
|
-
return buildInfoPath;
|
|
112147
|
-
buildInfo = hostBuildInfo;
|
|
112026
|
+
buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
|
|
112148
112027
|
}
|
|
112149
112028
|
else {
|
|
112150
112029
|
var buildInfoText = host.readFile(buildInfoPath);
|
|
112151
112030
|
if (!buildInfoText)
|
|
112152
112031
|
return buildInfoPath;
|
|
112153
|
-
buildInfo = getBuildInfo(buildInfoText);
|
|
112032
|
+
buildInfo = getBuildInfo(buildInfoPath, buildInfoText);
|
|
112154
112033
|
}
|
|
112034
|
+
if (!buildInfo)
|
|
112035
|
+
return buildInfoPath;
|
|
112155
112036
|
if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
|
|
112156
112037
|
return buildInfoPath;
|
|
112157
112038
|
var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
|
|
@@ -116809,7 +116690,16 @@ var ts;
|
|
|
116809
116690
|
return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath));
|
|
116810
116691
|
}
|
|
116811
116692
|
function getCachedFileSystemEntriesForBaseDir(path) {
|
|
116812
|
-
|
|
116693
|
+
var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path));
|
|
116694
|
+
if (!entries) {
|
|
116695
|
+
return entries;
|
|
116696
|
+
}
|
|
116697
|
+
// If we're looking for the base directory, we're definitely going to search the entries
|
|
116698
|
+
if (!entries.sortedAndCanonicalizedFiles) {
|
|
116699
|
+
entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort();
|
|
116700
|
+
entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort();
|
|
116701
|
+
}
|
|
116702
|
+
return entries;
|
|
116813
116703
|
}
|
|
116814
116704
|
function getBaseNameOfFileName(fileName) {
|
|
116815
116705
|
return ts.getBaseFileName(ts.normalizePath(fileName));
|
|
@@ -116852,21 +116742,10 @@ var ts;
|
|
|
116852
116742
|
return undefined;
|
|
116853
116743
|
}
|
|
116854
116744
|
}
|
|
116855
|
-
function fileNameEqual(name1, name2) {
|
|
116856
|
-
return getCanonicalFileName(name1) === getCanonicalFileName(name2);
|
|
116857
|
-
}
|
|
116858
116745
|
function hasEntry(entries, name) {
|
|
116859
|
-
|
|
116860
|
-
|
|
116861
|
-
|
|
116862
|
-
if (hasEntry(entries, baseName)) {
|
|
116863
|
-
if (!isValid) {
|
|
116864
|
-
return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); });
|
|
116865
|
-
}
|
|
116866
|
-
}
|
|
116867
|
-
else if (isValid) {
|
|
116868
|
-
return entries.push(baseName);
|
|
116869
|
-
}
|
|
116746
|
+
// Case-sensitive comparison since already canonicalized
|
|
116747
|
+
var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive);
|
|
116748
|
+
return index >= 0;
|
|
116870
116749
|
}
|
|
116871
116750
|
function writeFile(fileName, data, writeByteOrderMark) {
|
|
116872
116751
|
var path = toPath(fileName);
|
|
@@ -116879,7 +116758,7 @@ var ts;
|
|
|
116879
116758
|
function fileExists(fileName) {
|
|
116880
116759
|
var path = toPath(fileName);
|
|
116881
116760
|
var result = getCachedFileSystemEntriesForBaseDir(path);
|
|
116882
|
-
return result && hasEntry(result.
|
|
116761
|
+
return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) ||
|
|
116883
116762
|
host.fileExists(fileName);
|
|
116884
116763
|
}
|
|
116885
116764
|
function directoryExists(dirPath) {
|
|
@@ -116889,9 +116768,14 @@ var ts;
|
|
|
116889
116768
|
function createDirectory(dirPath) {
|
|
116890
116769
|
var path = toPath(dirPath);
|
|
116891
116770
|
var result = getCachedFileSystemEntriesForBaseDir(path);
|
|
116892
|
-
var baseFileName = getBaseNameOfFileName(dirPath);
|
|
116893
116771
|
if (result) {
|
|
116894
|
-
|
|
116772
|
+
var baseName = getBaseNameOfFileName(dirPath);
|
|
116773
|
+
var canonicalizedBaseName = getCanonicalFileName(baseName);
|
|
116774
|
+
var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories;
|
|
116775
|
+
// Case-sensitive comparison since already canonicalized
|
|
116776
|
+
if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) {
|
|
116777
|
+
result.directories.push(baseName);
|
|
116778
|
+
}
|
|
116895
116779
|
}
|
|
116896
116780
|
host.createDirectory(dirPath);
|
|
116897
116781
|
}
|
|
@@ -116960,7 +116844,7 @@ var ts;
|
|
|
116960
116844
|
fileExists: host.fileExists(fileOrDirectoryPath),
|
|
116961
116845
|
directoryExists: host.directoryExists(fileOrDirectoryPath)
|
|
116962
116846
|
};
|
|
116963
|
-
if (fsQueryResult.directoryExists || hasEntry(parentResult.
|
|
116847
|
+
if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
|
|
116964
116848
|
// Folder added or removed, clear the cache instead of updating the folder and its structure
|
|
116965
116849
|
clearCache();
|
|
116966
116850
|
}
|
|
@@ -116980,7 +116864,23 @@ var ts;
|
|
|
116980
116864
|
}
|
|
116981
116865
|
}
|
|
116982
116866
|
function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) {
|
|
116983
|
-
|
|
116867
|
+
var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles;
|
|
116868
|
+
var canonicalizedBaseName = getCanonicalFileName(baseName);
|
|
116869
|
+
if (fileExists) {
|
|
116870
|
+
// Case-sensitive comparison since already canonicalized
|
|
116871
|
+
if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) {
|
|
116872
|
+
parentResult.files.push(baseName);
|
|
116873
|
+
}
|
|
116874
|
+
}
|
|
116875
|
+
else {
|
|
116876
|
+
// Case-sensitive comparison since already canonicalized
|
|
116877
|
+
var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive);
|
|
116878
|
+
if (sortedIndex >= 0) {
|
|
116879
|
+
canonicalizedFiles.splice(sortedIndex, 1);
|
|
116880
|
+
var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; });
|
|
116881
|
+
parentResult.files.splice(unsortedIndex, 1);
|
|
116882
|
+
}
|
|
116883
|
+
}
|
|
116984
116884
|
}
|
|
116985
116885
|
function clearCache() {
|
|
116986
116886
|
cachedReadDirectoryResult.clear();
|
|
@@ -125218,18 +125118,14 @@ var ts;
|
|
|
125218
125118
|
if (host.getBuildInfo) {
|
|
125219
125119
|
// host provides buildinfo, get it from there. This allows host to cache it
|
|
125220
125120
|
buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
|
|
125221
|
-
if (!buildInfo)
|
|
125222
|
-
return undefined;
|
|
125223
125121
|
}
|
|
125224
125122
|
else {
|
|
125225
125123
|
var content = host.readFile(buildInfoPath);
|
|
125226
125124
|
if (!content)
|
|
125227
125125
|
return undefined;
|
|
125228
|
-
buildInfo = ts.getBuildInfo(content);
|
|
125126
|
+
buildInfo = ts.getBuildInfo(buildInfoPath, content);
|
|
125229
125127
|
}
|
|
125230
|
-
if (buildInfo.version !== ts.version)
|
|
125231
|
-
return undefined;
|
|
125232
|
-
if (!buildInfo.program)
|
|
125128
|
+
if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program)
|
|
125233
125129
|
return undefined;
|
|
125234
125130
|
return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
|
|
125235
125131
|
}
|
|
@@ -125451,7 +125347,8 @@ var ts;
|
|
|
125451
125347
|
}
|
|
125452
125348
|
// All resolutions are invalid if user provided resolutions
|
|
125453
125349
|
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
|
|
125454
|
-
|
|
125350
|
+
var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
|
|
125351
|
+
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
125455
125352
|
if (hasChangedConfigFileParsingErrors) {
|
|
125456
125353
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
125457
125354
|
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -125470,6 +125367,11 @@ var ts;
|
|
|
125470
125367
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
125471
125368
|
host.afterProgramCreate(builderProgram);
|
|
125472
125369
|
}
|
|
125370
|
+
compilerHost.readFile = originalReadFile;
|
|
125371
|
+
compilerHost.fileExists = originalFileExists;
|
|
125372
|
+
compilerHost.directoryExists = originalDirectoryExists;
|
|
125373
|
+
compilerHost.createDirectory = originalCreateDirectory;
|
|
125374
|
+
compilerHost.writeFile = originalWriteFile;
|
|
125473
125375
|
return builderProgram;
|
|
125474
125376
|
}
|
|
125475
125377
|
function createNewProgram(hasInvalidatedResolution) {
|
|
@@ -125947,19 +125849,20 @@ var ts;
|
|
|
125947
125849
|
*/
|
|
125948
125850
|
UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend";
|
|
125949
125851
|
UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
|
|
125950
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125951
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125952
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125953
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125954
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125955
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125956
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125957
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125852
|
+
UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile";
|
|
125853
|
+
UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf";
|
|
125854
|
+
UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream";
|
|
125855
|
+
UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo";
|
|
125856
|
+
UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate";
|
|
125857
|
+
UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked";
|
|
125858
|
+
UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream";
|
|
125859
|
+
UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate";
|
|
125860
|
+
UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText";
|
|
125958
125861
|
/**
|
|
125959
125862
|
* Projects with no outputs (i.e. "solution" files)
|
|
125960
125863
|
*/
|
|
125961
|
-
UpToDateStatusType[UpToDateStatusType["ContainerOnly"] =
|
|
125962
|
-
UpToDateStatusType[UpToDateStatusType["ForceBuild"] =
|
|
125864
|
+
UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly";
|
|
125865
|
+
UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild";
|
|
125963
125866
|
})(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
|
|
125964
125867
|
function resolveConfigFileProjectName(project) {
|
|
125965
125868
|
if (ts.fileExtensionIs(project, ".json" /* Json */)) {
|
|
@@ -126177,6 +126080,7 @@ var ts;
|
|
|
126177
126080
|
if (value) {
|
|
126178
126081
|
return isParsedCommandLine(value) ? value : undefined;
|
|
126179
126082
|
}
|
|
126083
|
+
ts.performance.mark("SolutionBuilder::beforeConfigFileParsing");
|
|
126180
126084
|
var diagnostic;
|
|
126181
126085
|
var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host;
|
|
126182
126086
|
var parsed;
|
|
@@ -126191,6 +126095,8 @@ var ts;
|
|
|
126191
126095
|
parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
|
|
126192
126096
|
}
|
|
126193
126097
|
configFileCache.set(configFilePath, parsed || diagnostic);
|
|
126098
|
+
ts.performance.mark("SolutionBuilder::afterConfigFileParsing");
|
|
126099
|
+
ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing");
|
|
126194
126100
|
return parsed;
|
|
126195
126101
|
}
|
|
126196
126102
|
function resolveProjectName(state, name) {
|
|
@@ -126390,6 +126296,7 @@ var ts;
|
|
|
126390
126296
|
if (updateOutputFileStampsPending) {
|
|
126391
126297
|
updateOutputTimestamps(state, config, projectPath);
|
|
126392
126298
|
}
|
|
126299
|
+
ts.performance.mark("SolutionBuilder::Timestamps only updates");
|
|
126393
126300
|
return doneInvalidatedProject(state, projectPath);
|
|
126394
126301
|
}
|
|
126395
126302
|
};
|
|
@@ -126483,6 +126390,10 @@ var ts;
|
|
|
126483
126390
|
};
|
|
126484
126391
|
function done(cancellationToken, writeFile, customTransformers) {
|
|
126485
126392
|
executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers);
|
|
126393
|
+
if (kind === InvalidatedProjectKind.Build)
|
|
126394
|
+
ts.performance.mark("SolutionBuilder::Projects built");
|
|
126395
|
+
else
|
|
126396
|
+
ts.performance.mark("SolutionBuilder::Bundles updated");
|
|
126486
126397
|
return doneInvalidatedProject(state, projectPath);
|
|
126487
126398
|
}
|
|
126488
126399
|
function withProgramOrUndefined(action) {
|
|
@@ -126661,13 +126572,13 @@ var ts;
|
|
|
126661
126572
|
var emitterDiagnostics = ts.createDiagnosticCollection();
|
|
126662
126573
|
var emittedOutputs = new ts.Map();
|
|
126663
126574
|
var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
|
|
126664
|
-
var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
|
|
126575
|
+
var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined;
|
|
126665
126576
|
outputFiles.forEach(function (_a) {
|
|
126666
126577
|
var _b, _c;
|
|
126667
126578
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
126668
126579
|
emittedOutputs.set(toPath(state, name), name);
|
|
126669
126580
|
if (buildInfo) {
|
|
126670
|
-
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
126581
|
+
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)) {
|
|
126671
126582
|
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
126672
126583
|
}
|
|
126673
126584
|
setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
|
|
@@ -126960,8 +126871,7 @@ var ts;
|
|
|
126960
126871
|
return existing.buildInfo || undefined;
|
|
126961
126872
|
}
|
|
126962
126873
|
var value = state.readFileWithCache(buildInfoPath);
|
|
126963
|
-
var buildInfo = value ? ts.getBuildInfo(value) : undefined;
|
|
126964
|
-
ts.Debug.assert(modifiedTime || !buildInfo);
|
|
126874
|
+
var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined;
|
|
126965
126875
|
state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
|
|
126966
126876
|
return buildInfo;
|
|
126967
126877
|
}
|
|
@@ -127046,7 +126956,14 @@ var ts;
|
|
|
127046
126956
|
missingOutputFileName: buildInfoPath
|
|
127047
126957
|
};
|
|
127048
126958
|
}
|
|
127049
|
-
var buildInfo =
|
|
126959
|
+
var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime);
|
|
126960
|
+
if (!buildInfo) {
|
|
126961
|
+
// Error reading buildInfo
|
|
126962
|
+
return {
|
|
126963
|
+
type: ts.UpToDateStatusType.ErrorReadingFile,
|
|
126964
|
+
fileName: buildInfoPath
|
|
126965
|
+
};
|
|
126966
|
+
}
|
|
127050
126967
|
if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
|
|
127051
126968
|
return {
|
|
127052
126969
|
type: ts.UpToDateStatusType.TsVersionOutputOfDate,
|
|
@@ -127249,7 +127166,10 @@ var ts;
|
|
|
127249
127166
|
if (prior !== undefined) {
|
|
127250
127167
|
return prior;
|
|
127251
127168
|
}
|
|
127169
|
+
ts.performance.mark("SolutionBuilder::beforeUpToDateCheck");
|
|
127252
127170
|
var actual = getUpToDateStatusWorker(state, project, resolvedPath);
|
|
127171
|
+
ts.performance.mark("SolutionBuilder::afterUpToDateCheck");
|
|
127172
|
+
ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck");
|
|
127253
127173
|
state.projectStatus.set(resolvedPath, actual);
|
|
127254
127174
|
return actual;
|
|
127255
127175
|
}
|
|
@@ -127387,6 +127307,13 @@ var ts;
|
|
|
127387
127307
|
}
|
|
127388
127308
|
}
|
|
127389
127309
|
function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
|
|
127310
|
+
ts.performance.mark("SolutionBuilder::beforeBuild");
|
|
127311
|
+
var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences);
|
|
127312
|
+
ts.performance.mark("SolutionBuilder::afterBuild");
|
|
127313
|
+
ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild");
|
|
127314
|
+
return result;
|
|
127315
|
+
}
|
|
127316
|
+
function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
|
|
127390
127317
|
var buildOrder = getBuildOrderFor(state, project, onlyReferences);
|
|
127391
127318
|
if (!buildOrder)
|
|
127392
127319
|
return ts.ExitStatus.InvalidProject_OutputsSkipped;
|
|
@@ -127414,6 +127341,13 @@ var ts;
|
|
|
127414
127341
|
: ts.ExitStatus.DiagnosticsPresent_OutputsSkipped;
|
|
127415
127342
|
}
|
|
127416
127343
|
function clean(state, project, onlyReferences) {
|
|
127344
|
+
ts.performance.mark("SolutionBuilder::beforeClean");
|
|
127345
|
+
var result = cleanWorker(state, project, onlyReferences);
|
|
127346
|
+
ts.performance.mark("SolutionBuilder::afterClean");
|
|
127347
|
+
ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean");
|
|
127348
|
+
return result;
|
|
127349
|
+
}
|
|
127350
|
+
function cleanWorker(state, project, onlyReferences) {
|
|
127417
127351
|
var buildOrder = getBuildOrderFor(state, project, onlyReferences);
|
|
127418
127352
|
if (!buildOrder)
|
|
127419
127353
|
return ts.ExitStatus.InvalidProject_OutputsSkipped;
|
|
@@ -127487,6 +127421,14 @@ var ts;
|
|
|
127487
127421
|
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
|
|
127488
127422
|
}
|
|
127489
127423
|
function buildNextInvalidatedProject(state, changeDetected) {
|
|
127424
|
+
ts.performance.mark("SolutionBuilder::beforeBuild");
|
|
127425
|
+
var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
|
|
127426
|
+
ts.performance.mark("SolutionBuilder::afterBuild");
|
|
127427
|
+
ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild");
|
|
127428
|
+
if (buildOrder)
|
|
127429
|
+
reportErrorSummary(state, buildOrder);
|
|
127430
|
+
}
|
|
127431
|
+
function buildNextInvalidatedProjectWorker(state, changeDetected) {
|
|
127490
127432
|
state.timerToBuildInvalidatedProject = undefined;
|
|
127491
127433
|
if (state.reportFileChangeDetected) {
|
|
127492
127434
|
state.reportFileChangeDetected = false;
|
|
@@ -127519,7 +127461,7 @@ var ts;
|
|
|
127519
127461
|
}
|
|
127520
127462
|
}
|
|
127521
127463
|
disableCache(state);
|
|
127522
|
-
|
|
127464
|
+
return buildOrder;
|
|
127523
127465
|
}
|
|
127524
127466
|
function watchConfigFile(state, resolved, resolvedPath, parsed) {
|
|
127525
127467
|
if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
|
|
@@ -127574,6 +127516,7 @@ var ts;
|
|
|
127574
127516
|
function startWatching(state, buildOrder) {
|
|
127575
127517
|
if (!state.watchAllProjectsPending)
|
|
127576
127518
|
return;
|
|
127519
|
+
ts.performance.mark("SolutionBuilder::beforeWatcherCreation");
|
|
127577
127520
|
state.watchAllProjectsPending = false;
|
|
127578
127521
|
for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) {
|
|
127579
127522
|
var resolved = _a[_i];
|
|
@@ -127591,6 +127534,8 @@ var ts;
|
|
|
127591
127534
|
watchPackageJsonFiles(state, resolved, resolvedPath, cfg);
|
|
127592
127535
|
}
|
|
127593
127536
|
}
|
|
127537
|
+
ts.performance.mark("SolutionBuilder::afterWatcherCreation");
|
|
127538
|
+
ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation");
|
|
127594
127539
|
}
|
|
127595
127540
|
function stopWatching(state) {
|
|
127596
127541
|
ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher);
|
|
@@ -127704,6 +127649,8 @@ var ts;
|
|
|
127704
127649
|
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));
|
|
127705
127650
|
case ts.UpToDateStatusType.OutputMissing:
|
|
127706
127651
|
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));
|
|
127652
|
+
case ts.UpToDateStatusType.ErrorReadingFile:
|
|
127653
|
+
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));
|
|
127707
127654
|
case ts.UpToDateStatusType.OutOfDateBuildInfo:
|
|
127708
127655
|
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));
|
|
127709
127656
|
case ts.UpToDateStatusType.UpToDate:
|
|
@@ -157157,6 +157104,15 @@ var ts;
|
|
|
157157
157104
|
ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code,
|
|
157158
157105
|
ts.Diagnostics.Cannot_find_name_0.code
|
|
157159
157106
|
];
|
|
157107
|
+
var InfoKind;
|
|
157108
|
+
(function (InfoKind) {
|
|
157109
|
+
InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration";
|
|
157110
|
+
InfoKind[InfoKind["Enum"] = 1] = "Enum";
|
|
157111
|
+
InfoKind[InfoKind["Function"] = 2] = "Function";
|
|
157112
|
+
InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral";
|
|
157113
|
+
InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes";
|
|
157114
|
+
InfoKind[InfoKind["Signature"] = 5] = "Signature";
|
|
157115
|
+
})(InfoKind || (InfoKind = {}));
|
|
157160
157116
|
codefix.registerCodeFix({
|
|
157161
157117
|
errorCodes: errorCodes,
|
|
157162
157118
|
getCodeActions: function (context) {
|
|
@@ -157165,19 +157121,19 @@ var ts;
|
|
|
157165
157121
|
if (!info) {
|
|
157166
157122
|
return undefined;
|
|
157167
157123
|
}
|
|
157168
|
-
if (info.kind ===
|
|
157124
|
+
if (info.kind === InfoKind.ObjectLiteral) {
|
|
157169
157125
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addObjectLiteralProperties(t, context, info); });
|
|
157170
157126
|
return [codefix.createCodeFixAction(fixMissingProperties, changes, ts.Diagnostics.Add_missing_properties, fixMissingProperties, ts.Diagnostics.Add_all_missing_properties)];
|
|
157171
157127
|
}
|
|
157172
|
-
if (info.kind ===
|
|
157128
|
+
if (info.kind === InfoKind.JsxAttributes) {
|
|
157173
157129
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addJsxAttributes(t, context, info); });
|
|
157174
157130
|
return [codefix.createCodeFixAction(fixMissingAttributes, changes, ts.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts.Diagnostics.Add_all_missing_attributes)];
|
|
157175
157131
|
}
|
|
157176
|
-
if (info.kind ===
|
|
157132
|
+
if (info.kind === InfoKind.Function || info.kind === InfoKind.Signature) {
|
|
157177
157133
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); });
|
|
157178
157134
|
return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)];
|
|
157179
157135
|
}
|
|
157180
|
-
if (info.kind ===
|
|
157136
|
+
if (info.kind === InfoKind.Enum) {
|
|
157181
157137
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); });
|
|
157182
157138
|
return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)];
|
|
157183
157139
|
}
|
|
@@ -157195,20 +157151,20 @@ var ts;
|
|
|
157195
157151
|
if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) {
|
|
157196
157152
|
return;
|
|
157197
157153
|
}
|
|
157198
|
-
if (fixId === fixMissingFunctionDeclaration && info.kind ===
|
|
157154
|
+
if (fixId === fixMissingFunctionDeclaration && (info.kind === InfoKind.Function || info.kind === InfoKind.Signature)) {
|
|
157199
157155
|
addFunctionDeclaration(changes, context, info);
|
|
157200
157156
|
}
|
|
157201
|
-
else if (fixId === fixMissingProperties && info.kind ===
|
|
157157
|
+
else if (fixId === fixMissingProperties && info.kind === InfoKind.ObjectLiteral) {
|
|
157202
157158
|
addObjectLiteralProperties(changes, context, info);
|
|
157203
157159
|
}
|
|
157204
|
-
else if (fixId === fixMissingAttributes && info.kind ===
|
|
157160
|
+
else if (fixId === fixMissingAttributes && info.kind === InfoKind.JsxAttributes) {
|
|
157205
157161
|
addJsxAttributes(changes, context, info);
|
|
157206
157162
|
}
|
|
157207
157163
|
else {
|
|
157208
|
-
if (info.kind ===
|
|
157164
|
+
if (info.kind === InfoKind.Enum) {
|
|
157209
157165
|
addEnumMemberDeclaration(changes, checker, info);
|
|
157210
157166
|
}
|
|
157211
|
-
if (info.kind ===
|
|
157167
|
+
if (info.kind === InfoKind.TypeLikeDeclaration) {
|
|
157212
157168
|
var parentDeclaration = info.parentDeclaration, token_1 = info.token;
|
|
157213
157169
|
var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; });
|
|
157214
157170
|
if (!infos.some(function (i) { return i.token.text === token_1.text; })) {
|
|
@@ -157252,14 +157208,6 @@ var ts;
|
|
|
157252
157208
|
}));
|
|
157253
157209
|
},
|
|
157254
157210
|
});
|
|
157255
|
-
var InfoKind;
|
|
157256
|
-
(function (InfoKind) {
|
|
157257
|
-
InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration";
|
|
157258
|
-
InfoKind[InfoKind["Enum"] = 1] = "Enum";
|
|
157259
|
-
InfoKind[InfoKind["Function"] = 2] = "Function";
|
|
157260
|
-
InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral";
|
|
157261
|
-
InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes";
|
|
157262
|
-
})(InfoKind || (InfoKind = {}));
|
|
157263
157211
|
function getInfo(sourceFile, tokenPos, errorCode, checker, program) {
|
|
157264
157212
|
// The identifier of the missing property. eg:
|
|
157265
157213
|
// this.missing = 1;
|
|
@@ -157281,7 +157229,7 @@ var ts;
|
|
|
157281
157229
|
var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false));
|
|
157282
157230
|
if (!ts.length(properties))
|
|
157283
157231
|
return undefined;
|
|
157284
|
-
return { kind:
|
|
157232
|
+
return { kind: InfoKind.ObjectLiteral, token: param.name, properties: properties, parentDeclaration: parent };
|
|
157285
157233
|
}
|
|
157286
157234
|
if (!ts.isMemberName(token))
|
|
157287
157235
|
return undefined;
|
|
@@ -157289,17 +157237,26 @@ var ts;
|
|
|
157289
157237
|
var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent.initializer), checker.getTypeAtLocation(token), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false));
|
|
157290
157238
|
if (!ts.length(properties))
|
|
157291
157239
|
return undefined;
|
|
157292
|
-
return { kind:
|
|
157240
|
+
return { kind: InfoKind.ObjectLiteral, token: token, properties: properties, parentDeclaration: parent.initializer };
|
|
157293
157241
|
}
|
|
157294
157242
|
if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) {
|
|
157295
157243
|
var target = ts.getEmitScriptTarget(program.getCompilerOptions());
|
|
157296
157244
|
var attributes = getUnmatchedAttributes(checker, target, token.parent);
|
|
157297
157245
|
if (!ts.length(attributes))
|
|
157298
157246
|
return undefined;
|
|
157299
|
-
return { kind:
|
|
157247
|
+
return { kind: InfoKind.JsxAttributes, token: token, attributes: attributes, parentDeclaration: token.parent };
|
|
157300
157248
|
}
|
|
157301
|
-
if (ts.isIdentifier(token)
|
|
157302
|
-
|
|
157249
|
+
if (ts.isIdentifier(token)) {
|
|
157250
|
+
var type = checker.getContextualType(token);
|
|
157251
|
+
if (type && ts.getObjectFlags(type) & 16 /* Anonymous */) {
|
|
157252
|
+
var signature = ts.firstOrUndefined(checker.getSignaturesOfType(type, 0 /* Call */));
|
|
157253
|
+
if (signature === undefined)
|
|
157254
|
+
return undefined;
|
|
157255
|
+
return { kind: InfoKind.Signature, token: token, signature: signature, sourceFile: sourceFile, parentDeclaration: findScope(token) };
|
|
157256
|
+
}
|
|
157257
|
+
if (ts.isCallExpression(parent) && parent.expression === token) {
|
|
157258
|
+
return { kind: InfoKind.Function, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* None */, parentDeclaration: findScope(token) };
|
|
157259
|
+
}
|
|
157303
157260
|
}
|
|
157304
157261
|
if (!ts.isPropertyAccessExpression(parent))
|
|
157305
157262
|
return undefined;
|
|
@@ -157311,13 +157268,13 @@ var ts;
|
|
|
157311
157268
|
var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration);
|
|
157312
157269
|
var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile();
|
|
157313
157270
|
if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) {
|
|
157314
|
-
return { kind:
|
|
157271
|
+
return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* Export */, parentDeclaration: moduleDeclaration };
|
|
157315
157272
|
}
|
|
157316
157273
|
var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile);
|
|
157317
157274
|
if (sourceFile.commonJsModuleIndicator)
|
|
157318
157275
|
return undefined;
|
|
157319
157276
|
if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) {
|
|
157320
|
-
return { kind:
|
|
157277
|
+
return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* Export */, parentDeclaration: moduleSourceFile };
|
|
157321
157278
|
}
|
|
157322
157279
|
}
|
|
157323
157280
|
var classDeclaration = ts.find(symbol.declarations, ts.isClassLike);
|
|
@@ -157335,11 +157292,11 @@ var ts;
|
|
|
157335
157292
|
(makeStatic ? 32 /* Static */ : 0 /* None */) | (ts.startsWithUnderscore(token.text) ? 8 /* Private */ : 0 /* None */);
|
|
157336
157293
|
var isJSFile = ts.isSourceFileJS(declSourceFile);
|
|
157337
157294
|
var call = ts.tryCast(parent.parent, ts.isCallExpression);
|
|
157338
|
-
return { kind:
|
|
157295
|
+
return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile };
|
|
157339
157296
|
}
|
|
157340
157297
|
var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
|
|
157341
157298
|
if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
|
|
157342
|
-
return { kind:
|
|
157299
|
+
return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration };
|
|
157343
157300
|
}
|
|
157344
157301
|
return undefined;
|
|
157345
157302
|
}
|
|
@@ -157515,9 +157472,17 @@ var ts;
|
|
|
157515
157472
|
});
|
|
157516
157473
|
}
|
|
157517
157474
|
function addFunctionDeclaration(changes, context, info) {
|
|
157475
|
+
var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences);
|
|
157518
157476
|
var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
|
|
157519
|
-
var functionDeclaration =
|
|
157520
|
-
|
|
157477
|
+
var functionDeclaration = info.kind === InfoKind.Function
|
|
157478
|
+
? codefix.createSignatureDeclarationFromCallExpression(256 /* FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration)
|
|
157479
|
+
: 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);
|
|
157480
|
+
if (functionDeclaration === undefined) {
|
|
157481
|
+
ts.Debug.fail("fixMissingFunctionDeclaration codefix got unexpected error.");
|
|
157482
|
+
}
|
|
157483
|
+
ts.isReturnStatement(info.parentDeclaration)
|
|
157484
|
+
? changes.insertNodeBefore(info.sourceFile, info.parentDeclaration, functionDeclaration, /*blankLineBetween*/ true)
|
|
157485
|
+
: changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration);
|
|
157521
157486
|
importAdder.writeFixes(changes);
|
|
157522
157487
|
}
|
|
157523
157488
|
function addJsxAttributes(changes, context, info) {
|
|
@@ -157675,6 +157640,14 @@ var ts;
|
|
|
157675
157640
|
}
|
|
157676
157641
|
return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* Single */);
|
|
157677
157642
|
}
|
|
157643
|
+
function findScope(node) {
|
|
157644
|
+
if (ts.findAncestor(node, ts.isJsxExpression)) {
|
|
157645
|
+
var returnStatement = ts.findAncestor(node.parent, ts.isReturnStatement);
|
|
157646
|
+
if (returnStatement)
|
|
157647
|
+
return returnStatement;
|
|
157648
|
+
}
|
|
157649
|
+
return ts.getSourceFileOfNode(node);
|
|
157650
|
+
}
|
|
157678
157651
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
157679
157652
|
})(ts || (ts = {}));
|
|
157680
157653
|
/* @internal */
|
|
@@ -160364,6 +160337,9 @@ var ts;
|
|
|
160364
160337
|
if (ts.isMethodDeclaration(signatureDeclaration)) {
|
|
160365
160338
|
return ts.factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name !== null && name !== void 0 ? name : ts.factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body);
|
|
160366
160339
|
}
|
|
160340
|
+
if (ts.isFunctionDeclaration(signatureDeclaration)) {
|
|
160341
|
+
return ts.factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts.tryCast(name, ts.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body);
|
|
160342
|
+
}
|
|
160367
160343
|
return undefined;
|
|
160368
160344
|
}
|
|
160369
160345
|
codefix.createSignatureDeclarationFromSignature = createSignatureDeclarationFromSignature;
|
|
@@ -167666,6 +167642,10 @@ var ts;
|
|
|
167666
167642
|
getCurrentDirectory: compilerHost.getCurrentDirectory,
|
|
167667
167643
|
onUnRecoverableConfigFileDiagnostic: ts.noop,
|
|
167668
167644
|
};
|
|
167645
|
+
// The call to isProgramUptoDate below may refer back to documentRegistryBucketKey;
|
|
167646
|
+
// calculate this early so it's not undefined if downleveled to a var (or, if emitted
|
|
167647
|
+
// as a const variable without downleveling, doesn't crash).
|
|
167648
|
+
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
167669
167649
|
// If the program is already up-to-date, we can reuse it
|
|
167670
167650
|
if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
167671
167651
|
return;
|
|
@@ -167675,7 +167655,6 @@ var ts;
|
|
|
167675
167655
|
// instance. If we cancel midway through, we may end up in an inconsistent state where
|
|
167676
167656
|
// the program points to old source files that have been invalidated because of
|
|
167677
167657
|
// incremental parsing.
|
|
167678
|
-
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
167679
167658
|
var options = {
|
|
167680
167659
|
rootNames: rootFileNames,
|
|
167681
167660
|
options: newSettings,
|