typescript 4.8.0-dev.20220731 → 4.8.0-dev.20220803
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/cs/diagnosticMessages.generated.json +1 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/lib.es2015.promise.d.ts +9 -4
- package/lib/lib.es5.d.ts +2 -2
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/pt-br/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +256 -139
- package/lib/tsserver.js +331 -201
- package/lib/tsserverlibrary.d.ts +16 -10
- package/lib/tsserverlibrary.js +331 -201
- package/lib/typescript.d.ts +16 -10
- package/lib/typescript.js +326 -196
- package/lib/typescriptServices.d.ts +16 -10
- package/lib/typescriptServices.js +326 -196
- package/lib/typingsInstaller.js +285 -163
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220803";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -8551,6 +8551,10 @@ var ts;
|
|
|
8551
8551
|
resolution_mode_is_the_only_valid_key_for_type_import_assertions: diag(1455, ts.DiagnosticCategory.Error, "resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455", "`resolution-mode` is the only valid key for type import assertions."),
|
|
8552
8552
|
Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require: diag(1456, ts.DiagnosticCategory.Error, "Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require_1456", "Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`."),
|
|
8553
8553
|
Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk: diag(1457, ts.DiagnosticCategory.Message, "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457", "Matched by default include pattern '**/*'"),
|
|
8554
|
+
File_is_ECMAScript_module_because_0_has_field_type_with_value_module: diag(1458, ts.DiagnosticCategory.Message, "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458", "File is ECMAScript module because '{0}' has field \"type\" with value \"module\""),
|
|
8555
|
+
File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module: diag(1459, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459", "File is CommonJS module because '{0}' has field \"type\" whose value is not \"module\""),
|
|
8556
|
+
File_is_CommonJS_module_because_0_does_not_have_field_type: diag(1460, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_does_not_have_field_type_1460", "File is CommonJS module because '{0}' does not have field \"type\""),
|
|
8557
|
+
File_is_CommonJS_module_because_package_json_was_not_found: diag(1461, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_package_json_was_not_found_1461", "File is CommonJS module because 'package.json' was not found"),
|
|
8554
8558
|
The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
|
|
8555
8559
|
Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
|
|
8556
8560
|
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
@@ -43228,7 +43232,7 @@ var ts;
|
|
|
43228
43232
|
ts.createCacheWithRedirects = createCacheWithRedirects;
|
|
43229
43233
|
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
43230
43234
|
var cache;
|
|
43231
|
-
return { getPackageJsonInfo: getPackageJsonInfo, setPackageJsonInfo: setPackageJsonInfo, clear: clear, entries: entries };
|
|
43235
|
+
return { getPackageJsonInfo: getPackageJsonInfo, setPackageJsonInfo: setPackageJsonInfo, clear: clear, entries: entries, getInternalMap: getInternalMap };
|
|
43232
43236
|
function getPackageJsonInfo(packageJsonPath) {
|
|
43233
43237
|
return cache === null || cache === void 0 ? void 0 : cache.get(ts.toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
|
|
43234
43238
|
}
|
|
@@ -43242,6 +43246,9 @@ var ts;
|
|
|
43242
43246
|
var iter = cache === null || cache === void 0 ? void 0 : cache.entries();
|
|
43243
43247
|
return iter ? ts.arrayFrom(iter) : [];
|
|
43244
43248
|
}
|
|
43249
|
+
function getInternalMap() {
|
|
43250
|
+
return cache;
|
|
43251
|
+
}
|
|
43245
43252
|
}
|
|
43246
43253
|
function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
|
|
43247
43254
|
var cache = cacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
@@ -43345,15 +43352,18 @@ var ts;
|
|
|
43345
43352
|
}
|
|
43346
43353
|
ts.zipToModeAwareCache = zipToModeAwareCache;
|
|
43347
43354
|
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
43348
|
-
var
|
|
43355
|
+
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
43349
43356
|
moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options));
|
|
43350
43357
|
var packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
|
43351
|
-
return __assign(__assign(__assign({}, packageJsonInfoCache),
|
|
43358
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; }, clearAllExceptPackageJsonInfoCache: clearAllExceptPackageJsonInfoCache });
|
|
43352
43359
|
function clear() {
|
|
43353
|
-
|
|
43354
|
-
moduleNameToDirectoryMap.clear();
|
|
43360
|
+
clearAllExceptPackageJsonInfoCache();
|
|
43355
43361
|
packageJsonInfoCache.clear();
|
|
43356
43362
|
}
|
|
43363
|
+
function clearAllExceptPackageJsonInfoCache() {
|
|
43364
|
+
perDirectoryResolutionCache.clear();
|
|
43365
|
+
moduleNameToDirectoryMap.clear();
|
|
43366
|
+
}
|
|
43357
43367
|
function update(options) {
|
|
43358
43368
|
updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap);
|
|
43359
43369
|
}
|
|
@@ -43429,13 +43439,16 @@ var ts;
|
|
|
43429
43439
|
}
|
|
43430
43440
|
ts.createModuleResolutionCache = createModuleResolutionCache;
|
|
43431
43441
|
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, directoryToModuleNameMap) {
|
|
43432
|
-
var
|
|
43442
|
+
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
43433
43443
|
packageJsonInfoCache || (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
|
|
43434
|
-
return __assign(__assign(__assign({}, packageJsonInfoCache),
|
|
43444
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { clear: clear, clearAllExceptPackageJsonInfoCache: clearAllExceptPackageJsonInfoCache });
|
|
43435
43445
|
function clear() {
|
|
43436
|
-
|
|
43446
|
+
clearAllExceptPackageJsonInfoCache();
|
|
43437
43447
|
packageJsonInfoCache.clear();
|
|
43438
43448
|
}
|
|
43449
|
+
function clearAllExceptPackageJsonInfoCache() {
|
|
43450
|
+
perDirectoryResolutionCache.clear();
|
|
43451
|
+
}
|
|
43439
43452
|
}
|
|
43440
43453
|
ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
|
|
43441
43454
|
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
@@ -51223,10 +51236,6 @@ var ts;
|
|
|
51223
51236
|
checkExpressionCached(expression);
|
|
51224
51237
|
return getNodeLinks(expression).resolvedSymbol;
|
|
51225
51238
|
}
|
|
51226
|
-
function getTargetOfPropertyAssignment(node, dontRecursivelyResolve) {
|
|
51227
|
-
var expression = node.initializer;
|
|
51228
|
-
return getTargetOfAliasLikeExpression(expression, dontRecursivelyResolve);
|
|
51229
|
-
}
|
|
51230
51239
|
function getTargetOfAccessExpression(node, dontRecursivelyResolve) {
|
|
51231
51240
|
if (!(ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* EqualsToken */)) {
|
|
51232
51241
|
return undefined;
|
|
@@ -51258,7 +51267,7 @@ var ts;
|
|
|
51258
51267
|
case 297 /* ShorthandPropertyAssignment */:
|
|
51259
51268
|
return resolveEntityName(node.name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ true, dontRecursivelyResolve);
|
|
51260
51269
|
case 296 /* PropertyAssignment */:
|
|
51261
|
-
return
|
|
51270
|
+
return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve);
|
|
51262
51271
|
case 207 /* ElementAccessExpression */:
|
|
51263
51272
|
case 206 /* PropertyAccessExpression */:
|
|
51264
51273
|
return getTargetOfAccessExpression(node, dontRecursivelyResolve);
|
|
@@ -56783,7 +56792,7 @@ var ts;
|
|
|
56783
56792
|
(resolvedSymbol || symbol).exports.forEach(function (s, name) {
|
|
56784
56793
|
var _a;
|
|
56785
56794
|
var exportedMember = members_4.get(name);
|
|
56786
|
-
if (exportedMember && exportedMember !== s) {
|
|
56795
|
+
if (exportedMember && exportedMember !== s && !(s.flags & 2097152 /* Alias */)) {
|
|
56787
56796
|
if (s.flags & 111551 /* Value */ && exportedMember.flags & 111551 /* Value */) {
|
|
56788
56797
|
// If the member has an additional value-like declaration, union the types from the two declarations,
|
|
56789
56798
|
// but issue an error if they occurred in two different files. The purpose is to support a JS file with
|
|
@@ -63275,6 +63284,7 @@ var ts;
|
|
|
63275
63284
|
}
|
|
63276
63285
|
}
|
|
63277
63286
|
function getTypeFromImportTypeNode(node) {
|
|
63287
|
+
var _a;
|
|
63278
63288
|
var links = getNodeLinks(node);
|
|
63279
63289
|
if (!links.resolvedType) {
|
|
63280
63290
|
if (node.isTypeOf && node.typeArguments) { // Only the non-typeof form can make use of type arguments
|
|
@@ -63294,6 +63304,7 @@ var ts;
|
|
|
63294
63304
|
links.resolvedSymbol = unknownSymbol;
|
|
63295
63305
|
return links.resolvedType = errorType;
|
|
63296
63306
|
}
|
|
63307
|
+
var isExportEquals = !!((_a = innerModuleSymbol.exports) === null || _a === void 0 ? void 0 : _a.get("export=" /* ExportEquals */));
|
|
63297
63308
|
var moduleSymbol = resolveExternalModuleSymbol(innerModuleSymbol, /*dontResolveAlias*/ false);
|
|
63298
63309
|
if (!ts.nodeIsMissing(node.qualifier)) {
|
|
63299
63310
|
var nameStack = getIdentifierChain(node.qualifier);
|
|
@@ -63305,9 +63316,11 @@ var ts;
|
|
|
63305
63316
|
// That, in turn, ultimately uses `getPropertyOfType` on the type of the symbol, which differs slightly from
|
|
63306
63317
|
// the `exports` lookup process that only looks up namespace members which is used for most type references
|
|
63307
63318
|
var mergedResolvedSymbol = getMergedSymbol(resolveSymbol(currentNamespace));
|
|
63308
|
-
var
|
|
63319
|
+
var symbolFromVariable = node.isTypeOf || ts.isInJSFile(node) && isExportEquals
|
|
63309
63320
|
? getPropertyOfType(getTypeOfSymbol(mergedResolvedSymbol), current.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ true)
|
|
63310
|
-
:
|
|
63321
|
+
: undefined;
|
|
63322
|
+
var symbolFromModule = node.isTypeOf ? undefined : getSymbol(getExportsOfSymbol(mergedResolvedSymbol), current.escapedText, meaning);
|
|
63323
|
+
var next = symbolFromModule !== null && symbolFromModule !== void 0 ? symbolFromModule : symbolFromVariable;
|
|
63311
63324
|
if (!next) {
|
|
63312
63325
|
error(current, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), ts.declarationNameToString(current));
|
|
63313
63326
|
return links.resolvedType = errorType;
|
|
@@ -66165,6 +66178,26 @@ var ts;
|
|
|
66165
66178
|
function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
|
|
66166
66179
|
var saveErrorInfo = captureErrorCalculationState();
|
|
66167
66180
|
var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
|
|
66181
|
+
if (!result && (source.flags & 2097152 /* Intersection */ || source.flags & 262144 /* TypeParameter */ && target.flags & 1048576 /* Union */)) {
|
|
66182
|
+
// The combined constraint of an intersection type is the intersection of the constraints of
|
|
66183
|
+
// the constituents. When an intersection type contains instantiable types with union type
|
|
66184
|
+
// constraints, there are situations where we need to examine the combined constraint. One is
|
|
66185
|
+
// when the target is a union type. Another is when the intersection contains types belonging
|
|
66186
|
+
// to one of the disjoint domains. For example, given type variables T and U, each with the
|
|
66187
|
+
// constraint 'string | number', the combined constraint of 'T & U' is 'string | number' and
|
|
66188
|
+
// we need to check this constraint against a union on the target side. Also, given a type
|
|
66189
|
+
// variable V constrained to 'string | number', 'V & number' has a combined constraint of
|
|
66190
|
+
// 'string & number | number & number' which reduces to just 'number'.
|
|
66191
|
+
// This also handles type parameters, as a type parameter with a union constraint compared against a union
|
|
66192
|
+
// needs to have its constraint hoisted into an intersection with said type parameter, this way
|
|
66193
|
+
// the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
|
|
66194
|
+
// For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
|
|
66195
|
+
var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* Union */));
|
|
66196
|
+
if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
|
|
66197
|
+
// TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
|
|
66198
|
+
result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
|
|
66199
|
+
}
|
|
66200
|
+
}
|
|
66168
66201
|
if (result) {
|
|
66169
66202
|
resetErrorInfo(saveErrorInfo);
|
|
66170
66203
|
}
|
|
@@ -66222,28 +66255,6 @@ var ts;
|
|
|
66222
66255
|
if (result = unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState)) {
|
|
66223
66256
|
return result;
|
|
66224
66257
|
}
|
|
66225
|
-
if (source.flags & 2097152 /* Intersection */ || source.flags & 262144 /* TypeParameter */ && target.flags & 1048576 /* Union */) {
|
|
66226
|
-
// The combined constraint of an intersection type is the intersection of the constraints of
|
|
66227
|
-
// the constituents. When an intersection type contains instantiable types with union type
|
|
66228
|
-
// constraints, there are situations where we need to examine the combined constraint. One is
|
|
66229
|
-
// when the target is a union type. Another is when the intersection contains types belonging
|
|
66230
|
-
// to one of the disjoint domains. For example, given type variables T and U, each with the
|
|
66231
|
-
// constraint 'string | number', the combined constraint of 'T & U' is 'string | number' and
|
|
66232
|
-
// we need to check this constraint against a union on the target side. Also, given a type
|
|
66233
|
-
// variable V constrained to 'string | number', 'V & number' has a combined constraint of
|
|
66234
|
-
// 'string & number | number & number' which reduces to just 'number'.
|
|
66235
|
-
// This also handles type parameters, as a type parameter with a union constraint compared against a union
|
|
66236
|
-
// needs to have its constraint hoisted into an intersection with said type parameter, this way
|
|
66237
|
-
// the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
|
|
66238
|
-
// For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
|
|
66239
|
-
var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* Union */));
|
|
66240
|
-
if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
|
|
66241
|
-
// TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
|
|
66242
|
-
if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
66243
|
-
return result;
|
|
66244
|
-
}
|
|
66245
|
-
}
|
|
66246
|
-
}
|
|
66247
66258
|
// The ordered decomposition above doesn't handle all cases. Specifically, we also need to handle:
|
|
66248
66259
|
// Source is instantiable (e.g. source has union or intersection constraint).
|
|
66249
66260
|
// Source is an object, target is a union (e.g. { a, b: boolean } <=> { a, b: true } | { a, b: false }).
|
|
@@ -82097,9 +82108,11 @@ var ts;
|
|
|
82097
82108
|
// We only need `Awaited<T>` if `T` contains possibly non-primitive types.
|
|
82098
82109
|
if (isGenericObjectType(type)) {
|
|
82099
82110
|
var baseConstraint = getBaseConstraintOfType(type);
|
|
82100
|
-
// We only need `Awaited<T>` if `T` has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
82111
|
+
// We only need `Awaited<T>` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
82101
82112
|
// or is promise-like.
|
|
82102
|
-
if (
|
|
82113
|
+
if (baseConstraint ?
|
|
82114
|
+
baseConstraint.flags & 3 /* AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) :
|
|
82115
|
+
maybeTypeOfKind(type, 8650752 /* TypeVariable */)) {
|
|
82103
82116
|
return true;
|
|
82104
82117
|
}
|
|
82105
82118
|
}
|
|
@@ -94871,10 +94884,11 @@ var ts;
|
|
|
94871
94884
|
}
|
|
94872
94885
|
function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) {
|
|
94873
94886
|
if (node.operator === 45 /* PlusPlusToken */ || node.operator === 46 /* MinusMinusToken */) {
|
|
94874
|
-
|
|
94887
|
+
var operand = ts.skipParentheses(node.operand);
|
|
94888
|
+
if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) {
|
|
94875
94889
|
var info = void 0;
|
|
94876
|
-
if (info = accessPrivateIdentifier(
|
|
94877
|
-
var receiver = ts.visitNode(
|
|
94890
|
+
if (info = accessPrivateIdentifier(operand.name)) {
|
|
94891
|
+
var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression);
|
|
94878
94892
|
var _a = createCopiableReceiverExpr(receiver), readExpression = _a.readExpression, initializeExpression = _a.initializeExpression;
|
|
94879
94893
|
var expression = createPrivateIdentifierAccess(info, readExpression);
|
|
94880
94894
|
var temp = ts.isPrefixUnaryExpression(node) || valueIsDiscarded ? undefined : factory.createTempVariable(hoistVariableDeclaration);
|
|
@@ -94890,7 +94904,7 @@ var ts;
|
|
|
94890
94904
|
}
|
|
94891
94905
|
}
|
|
94892
94906
|
else if (shouldTransformSuperInStaticInitializers &&
|
|
94893
|
-
ts.isSuperProperty(
|
|
94907
|
+
ts.isSuperProperty(operand) &&
|
|
94894
94908
|
currentStaticPropertyDeclarationOrStaticBlock &&
|
|
94895
94909
|
currentClassLexicalEnvironment) {
|
|
94896
94910
|
// converts `++super.a` into `(Reflect.set(_baseTemp, "a", (_a = Reflect.get(_baseTemp, "a", _classTemp), _b = ++_a), _classTemp), _b)`
|
|
@@ -94903,31 +94917,31 @@ var ts;
|
|
|
94903
94917
|
// converts `super[f()]--` into `(Reflect.set(_baseTemp, _a = f(), (_b = Reflect.get(_baseTemp, _a, _classTemp), _c = _b--), _classTemp), _c)`
|
|
94904
94918
|
var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts;
|
|
94905
94919
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
94906
|
-
var
|
|
94920
|
+
var expression = visitInvalidSuperProperty(operand);
|
|
94907
94921
|
return ts.isPrefixUnaryExpression(node) ?
|
|
94908
|
-
factory.updatePrefixUnaryExpression(node,
|
|
94909
|
-
factory.updatePostfixUnaryExpression(node,
|
|
94922
|
+
factory.updatePrefixUnaryExpression(node, expression) :
|
|
94923
|
+
factory.updatePostfixUnaryExpression(node, expression);
|
|
94910
94924
|
}
|
|
94911
94925
|
if (classConstructor && superClassReference) {
|
|
94912
94926
|
var setterName = void 0;
|
|
94913
94927
|
var getterName = void 0;
|
|
94914
|
-
if (ts.isPropertyAccessExpression(
|
|
94915
|
-
if (ts.isIdentifier(
|
|
94916
|
-
getterName = setterName = factory.createStringLiteralFromNode(
|
|
94928
|
+
if (ts.isPropertyAccessExpression(operand)) {
|
|
94929
|
+
if (ts.isIdentifier(operand.name)) {
|
|
94930
|
+
getterName = setterName = factory.createStringLiteralFromNode(operand.name);
|
|
94917
94931
|
}
|
|
94918
94932
|
}
|
|
94919
94933
|
else {
|
|
94920
|
-
if (ts.isSimpleInlineableExpression(
|
|
94921
|
-
getterName = setterName =
|
|
94934
|
+
if (ts.isSimpleInlineableExpression(operand.argumentExpression)) {
|
|
94935
|
+
getterName = setterName = operand.argumentExpression;
|
|
94922
94936
|
}
|
|
94923
94937
|
else {
|
|
94924
94938
|
getterName = factory.createTempVariable(hoistVariableDeclaration);
|
|
94925
|
-
setterName = factory.createAssignment(getterName, ts.visitNode(
|
|
94939
|
+
setterName = factory.createAssignment(getterName, ts.visitNode(operand.argumentExpression, visitor, ts.isExpression));
|
|
94926
94940
|
}
|
|
94927
94941
|
}
|
|
94928
94942
|
if (setterName && getterName) {
|
|
94929
94943
|
var expression = factory.createReflectGetCall(superClassReference, getterName, classConstructor);
|
|
94930
|
-
ts.setTextRange(expression,
|
|
94944
|
+
ts.setTextRange(expression, operand);
|
|
94931
94945
|
var temp = valueIsDiscarded ? undefined : factory.createTempVariable(hoistVariableDeclaration);
|
|
94932
94946
|
expression = ts.expandPreOrPostfixIncrementOrDecrementExpression(factory, node, expression, hoistVariableDeclaration, temp);
|
|
94933
94947
|
expression = factory.createReflectSetCall(superClassReference, setterName, expression, classConstructor);
|
|
@@ -117682,6 +117696,12 @@ var ts;
|
|
|
117682
117696
|
* @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format
|
|
117683
117697
|
*/
|
|
117684
117698
|
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
117699
|
+
var result = getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options);
|
|
117700
|
+
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
117701
|
+
}
|
|
117702
|
+
ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
|
|
117703
|
+
/*@internal*/
|
|
117704
|
+
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
117685
117705
|
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
117686
117706
|
case ts.ModuleResolutionKind.Node16:
|
|
117687
117707
|
case ts.ModuleResolutionKind.NodeNext:
|
|
@@ -117693,11 +117713,16 @@ var ts;
|
|
|
117693
117713
|
return undefined;
|
|
117694
117714
|
}
|
|
117695
117715
|
function lookupFromPackageJson() {
|
|
117696
|
-
var
|
|
117697
|
-
|
|
117716
|
+
var state = ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
|
|
117717
|
+
var packageJsonLocations = [];
|
|
117718
|
+
state.failedLookupLocations = packageJsonLocations;
|
|
117719
|
+
state.affectingLocations = packageJsonLocations;
|
|
117720
|
+
var packageJsonScope = ts.getPackageScopeForPath(fileName, state);
|
|
117721
|
+
var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
117722
|
+
return { impliedNodeFormat: impliedNodeFormat, packageJsonLocations: packageJsonLocations, packageJsonScope: packageJsonScope };
|
|
117698
117723
|
}
|
|
117699
117724
|
}
|
|
117700
|
-
ts.
|
|
117725
|
+
ts.getImpliedNodeFormatForFileWorker = getImpliedNodeFormatForFileWorker;
|
|
117701
117726
|
/** @internal */
|
|
117702
117727
|
ts.plainJSErrors = new ts.Set([
|
|
117703
117728
|
// binder errors
|
|
@@ -118022,7 +118047,7 @@ var ts;
|
|
|
118022
118047
|
for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) {
|
|
118023
118048
|
var oldSourceFile = oldSourceFiles_1[_i];
|
|
118024
118049
|
var newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
|
118025
|
-
if (shouldCreateNewSourceFile || !newFile ||
|
|
118050
|
+
if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat ||
|
|
118026
118051
|
// old file wasn't redirect but new file is
|
|
118027
118052
|
(oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path)) {
|
|
118028
118053
|
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
|
|
@@ -118415,7 +118440,7 @@ var ts;
|
|
|
118415
118440
|
});
|
|
118416
118441
|
}
|
|
118417
118442
|
function tryReuseStructureFromOldProgram() {
|
|
118418
|
-
var _a;
|
|
118443
|
+
var _a, _b;
|
|
118419
118444
|
if (!oldProgram) {
|
|
118420
118445
|
return 0 /* Not */;
|
|
118421
118446
|
}
|
|
@@ -118456,12 +118481,15 @@ var ts;
|
|
|
118456
118481
|
var seenPackageNames = new ts.Map();
|
|
118457
118482
|
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
|
|
118458
118483
|
var oldSourceFile = oldSourceFiles_2[_i];
|
|
118484
|
+
var sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options);
|
|
118459
118485
|
var newSourceFile = host.getSourceFileByPath
|
|
118460
|
-
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath,
|
|
118461
|
-
: host.getSourceFile(oldSourceFile.fileName,
|
|
118486
|
+
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, sourceFileOptions, /*onError*/ undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat)
|
|
118487
|
+
: host.getSourceFile(oldSourceFile.fileName, sourceFileOptions, /*onError*/ undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat); // TODO: GH#18217
|
|
118462
118488
|
if (!newSourceFile) {
|
|
118463
118489
|
return 0 /* Not */;
|
|
118464
118490
|
}
|
|
118491
|
+
newSourceFile.packageJsonLocations = ((_a = sourceFileOptions.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
118492
|
+
newSourceFile.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
118465
118493
|
ts.Debug.assert(!newSourceFile.redirectInfo, "Host should not return a redirect source file from `getSourceFile`");
|
|
118466
118494
|
var fileChanged = void 0;
|
|
118467
118495
|
if (oldSourceFile.redirectInfo) {
|
|
@@ -118501,38 +118529,43 @@ var ts;
|
|
|
118501
118529
|
seenPackageNames.set(packageName, newKind);
|
|
118502
118530
|
}
|
|
118503
118531
|
if (fileChanged) {
|
|
118532
|
+
if (oldSourceFile.impliedNodeFormat !== newSourceFile.impliedNodeFormat) {
|
|
118533
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118534
|
+
}
|
|
118504
118535
|
// The `newSourceFile` object was created for the new program.
|
|
118505
|
-
if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
118536
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
118506
118537
|
// 'lib' references has changed. Matches behavior in changesAffectModuleResolution
|
|
118507
118538
|
structureIsReused = 1 /* SafeModules */;
|
|
118508
118539
|
}
|
|
118509
|
-
if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
|
118540
|
+
else if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
|
118510
118541
|
// value of no-default-lib has changed
|
|
118511
118542
|
// this will affect if default library is injected into the list of files
|
|
118512
118543
|
structureIsReused = 1 /* SafeModules */;
|
|
118513
118544
|
}
|
|
118514
118545
|
// check tripleslash references
|
|
118515
|
-
if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
|
118546
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
|
118516
118547
|
// tripleslash references has changed
|
|
118517
118548
|
structureIsReused = 1 /* SafeModules */;
|
|
118518
118549
|
}
|
|
118519
|
-
|
|
118520
|
-
|
|
118521
|
-
|
|
118522
|
-
|
|
118523
|
-
|
|
118524
|
-
|
|
118525
|
-
|
|
118526
|
-
|
|
118527
|
-
|
|
118528
|
-
|
|
118529
|
-
|
|
118530
|
-
|
|
118531
|
-
|
|
118532
|
-
|
|
118533
|
-
|
|
118534
|
-
|
|
118535
|
-
|
|
118550
|
+
else {
|
|
118551
|
+
// check imports and module augmentations
|
|
118552
|
+
collectExternalModuleReferences(newSourceFile);
|
|
118553
|
+
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
|
|
118554
|
+
// imports has changed
|
|
118555
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118556
|
+
}
|
|
118557
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
|
|
118558
|
+
// moduleAugmentations has changed
|
|
118559
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118560
|
+
}
|
|
118561
|
+
else if ((oldSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */) !== (newSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */)) {
|
|
118562
|
+
// dynamicImport has changed
|
|
118563
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118564
|
+
}
|
|
118565
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
118566
|
+
// 'types' references has changed
|
|
118567
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118568
|
+
}
|
|
118536
118569
|
}
|
|
118537
118570
|
// tentatively approve the file
|
|
118538
118571
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
@@ -118550,18 +118583,18 @@ var ts;
|
|
|
118550
118583
|
return structureIsReused;
|
|
118551
118584
|
}
|
|
118552
118585
|
var modifiedFiles = modifiedSourceFiles.map(function (f) { return f.oldFile; });
|
|
118553
|
-
for (var
|
|
118554
|
-
var oldFile = oldSourceFiles_3[
|
|
118586
|
+
for (var _c = 0, oldSourceFiles_3 = oldSourceFiles; _c < oldSourceFiles_3.length; _c++) {
|
|
118587
|
+
var oldFile = oldSourceFiles_3[_c];
|
|
118555
118588
|
if (!ts.contains(modifiedFiles, oldFile)) {
|
|
118556
|
-
for (var
|
|
118557
|
-
var moduleName = _d
|
|
118589
|
+
for (var _d = 0, _e = oldFile.ambientModuleNames; _d < _e.length; _d++) {
|
|
118590
|
+
var moduleName = _e[_d];
|
|
118558
118591
|
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
|
|
118559
118592
|
}
|
|
118560
118593
|
}
|
|
118561
118594
|
}
|
|
118562
118595
|
// try to verify results of module resolution
|
|
118563
|
-
for (var
|
|
118564
|
-
var
|
|
118596
|
+
for (var _f = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _f < modifiedSourceFiles_1.length; _f++) {
|
|
118597
|
+
var _g = modifiedSourceFiles_1[_f], oldSourceFile = _g.oldFile, newSourceFile = _g.newFile;
|
|
118565
118598
|
var moduleNames = getModuleNames(newSourceFile);
|
|
118566
118599
|
var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
118567
118600
|
// ensure that module resolution results are still correct
|
|
@@ -118588,14 +118621,14 @@ var ts;
|
|
|
118588
118621
|
if (structureIsReused !== 2 /* Completely */) {
|
|
118589
118622
|
return structureIsReused;
|
|
118590
118623
|
}
|
|
118591
|
-
if (ts.changesAffectingProgramStructure(oldOptions, options) || ((
|
|
118624
|
+
if (ts.changesAffectingProgramStructure(oldOptions, options) || ((_b = host.hasChangedAutomaticTypeDirectiveNames) === null || _b === void 0 ? void 0 : _b.call(host))) {
|
|
118592
118625
|
return 1 /* SafeModules */;
|
|
118593
118626
|
}
|
|
118594
118627
|
missingFilePaths = oldProgram.getMissingFilePaths();
|
|
118595
118628
|
// update fileName -> file mapping
|
|
118596
118629
|
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
118597
|
-
for (var
|
|
118598
|
-
var newSourceFile = newSourceFiles_1[
|
|
118630
|
+
for (var _h = 0, newSourceFiles_1 = newSourceFiles; _h < newSourceFiles_1.length; _h++) {
|
|
118631
|
+
var newSourceFile = newSourceFiles_1[_h];
|
|
118599
118632
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
118600
118633
|
}
|
|
118601
118634
|
var oldFilesByNameMap = oldProgram.getFilesByNameMap();
|
|
@@ -119378,13 +119411,16 @@ var ts;
|
|
|
119378
119411
|
addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, [fileName, existingFile.fileName]);
|
|
119379
119412
|
}
|
|
119380
119413
|
}
|
|
119381
|
-
function createRedirectSourceFile(redirectTarget, unredirected, fileName, path, resolvedPath, originalFileName) {
|
|
119414
|
+
function createRedirectSourceFile(redirectTarget, unredirected, fileName, path, resolvedPath, originalFileName, sourceFileOptions) {
|
|
119415
|
+
var _a;
|
|
119382
119416
|
var redirect = Object.create(redirectTarget);
|
|
119383
119417
|
redirect.fileName = fileName;
|
|
119384
119418
|
redirect.path = path;
|
|
119385
119419
|
redirect.resolvedPath = resolvedPath;
|
|
119386
119420
|
redirect.originalFileName = originalFileName;
|
|
119387
119421
|
redirect.redirectInfo = { redirectTarget: redirectTarget, unredirected: unredirected };
|
|
119422
|
+
redirect.packageJsonLocations = ((_a = sourceFileOptions.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
119423
|
+
redirect.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
119388
119424
|
sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
|
|
119389
119425
|
Object.defineProperties(redirect, {
|
|
119390
119426
|
id: {
|
|
@@ -119413,14 +119449,14 @@ var ts;
|
|
|
119413
119449
|
// It's a _little odd_ that we can't set `impliedNodeFormat` until the program step - but it's the first and only time we have a resolution cache
|
|
119414
119450
|
// and a freshly made source file node on hand at the same time, and we need both to set the field. Persisting the resolution cache all the way
|
|
119415
119451
|
// to the check and emit steps would be bad - so we much prefer detecting and storing the format information on the source file node upfront.
|
|
119416
|
-
var
|
|
119417
|
-
|
|
119418
|
-
|
|
119419
|
-
|
|
119420
|
-
setExternalModuleIndicator:
|
|
119421
|
-
};
|
|
119452
|
+
var result = getImpliedNodeFormatForFileWorker(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
119453
|
+
var languageVersion = ts.getEmitScriptTarget(options);
|
|
119454
|
+
var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options);
|
|
119455
|
+
return typeof result === "object" ? __assign(__assign({}, result), { languageVersion: languageVersion, setExternalModuleIndicator: setExternalModuleIndicator }) :
|
|
119456
|
+
{ languageVersion: languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator };
|
|
119422
119457
|
}
|
|
119423
119458
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
119459
|
+
var _a, _b;
|
|
119424
119460
|
var path = toPath(fileName);
|
|
119425
119461
|
if (useSourceOfProjectReferenceRedirect) {
|
|
119426
119462
|
var source = getSourceOfProjectReferenceRedirect(path);
|
|
@@ -119507,14 +119543,15 @@ var ts;
|
|
|
119507
119543
|
}
|
|
119508
119544
|
}
|
|
119509
119545
|
// We haven't looked for this file, do so now and cache result
|
|
119510
|
-
var
|
|
119546
|
+
var sourceFileOptions = getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options);
|
|
119547
|
+
var file = host.getSourceFile(fileName, sourceFileOptions, function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, ts.Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]); }, shouldCreateNewSourceFile || (((_a = oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getSourceFileByPath(toPath(fileName))) === null || _a === void 0 ? void 0 : _a.impliedNodeFormat) !== sourceFileOptions.impliedNodeFormat));
|
|
119511
119548
|
if (packageId) {
|
|
119512
119549
|
var packageIdKey = ts.packageIdToString(packageId);
|
|
119513
119550
|
var fileFromPackageId = packageIdToSourceFile.get(packageIdKey);
|
|
119514
119551
|
if (fileFromPackageId) {
|
|
119515
119552
|
// Some other SourceFile already exists with this package name and version.
|
|
119516
119553
|
// Instead of creating a duplicate, just redirect to the existing one.
|
|
119517
|
-
var dupFile = createRedirectSourceFile(fileFromPackageId, file, fileName, path, toPath(fileName), originalFileName);
|
|
119554
|
+
var dupFile = createRedirectSourceFile(fileFromPackageId, file, fileName, path, toPath(fileName), originalFileName, sourceFileOptions);
|
|
119518
119555
|
redirectTargetsMap.add(fileFromPackageId.path, fileName);
|
|
119519
119556
|
addFileToFilesByName(dupFile, path, redirectedPath);
|
|
119520
119557
|
addFileIncludeReason(dupFile, reason);
|
|
@@ -119535,6 +119572,8 @@ var ts;
|
|
|
119535
119572
|
file.path = path;
|
|
119536
119573
|
file.resolvedPath = toPath(fileName);
|
|
119537
119574
|
file.originalFileName = originalFileName;
|
|
119575
|
+
file.packageJsonLocations = ((_b = sourceFileOptions.packageJsonLocations) === null || _b === void 0 ? void 0 : _b.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
119576
|
+
file.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
119538
119577
|
addFileIncludeReason(file, reason);
|
|
119539
119578
|
if (host.useCaseSensitiveFileNames()) {
|
|
119540
119579
|
var pathLowerCase = ts.toFileNameLowerCase(path);
|
|
@@ -120165,7 +120204,7 @@ var ts;
|
|
|
120165
120204
|
fileIncludeReasons = undefined;
|
|
120166
120205
|
var location = locationReason && getReferencedFileLocation(getSourceFileByPath, locationReason);
|
|
120167
120206
|
var fileIncludeReasonDetails = fileIncludeReasons && ts.chainDiagnosticMessages(fileIncludeReasons, ts.Diagnostics.The_file_is_in_the_program_because_Colon);
|
|
120168
|
-
var redirectInfo = file && ts.
|
|
120207
|
+
var redirectInfo = file && ts.explainIfFileIsRedirectAndImpliedFormat(file);
|
|
120169
120208
|
var chain = ts.chainDiagnosticMessages.apply(void 0, __spreadArray([redirectInfo ? fileIncludeReasonDetails ? __spreadArray([fileIncludeReasonDetails], redirectInfo, true) : redirectInfo : fileIncludeReasonDetails, diagnostic], args || ts.emptyArray, false));
|
|
120170
120209
|
return location && isReferenceFileLocation(location) ?
|
|
120171
120210
|
ts.createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) :
|
|
@@ -122470,7 +122509,7 @@ var ts;
|
|
|
122470
122509
|
* "c:/", "c:/users", "c:/users/username", "c:/users/username/folderAtRoot", "c:/folderAtRoot"
|
|
122471
122510
|
* @param dirPath
|
|
122472
122511
|
*/
|
|
122473
|
-
function
|
|
122512
|
+
function canWatchDirectoryOrFile(dirPath) {
|
|
122474
122513
|
var rootLength = ts.getRootLength(dirPath);
|
|
122475
122514
|
if (dirPath.length === rootLength) {
|
|
122476
122515
|
// Ignore "/", "c:/"
|
|
@@ -122507,7 +122546,7 @@ var ts;
|
|
|
122507
122546
|
}
|
|
122508
122547
|
return true;
|
|
122509
122548
|
}
|
|
122510
|
-
ts.
|
|
122549
|
+
ts.canWatchDirectoryOrFile = canWatchDirectoryOrFile;
|
|
122511
122550
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
122512
122551
|
var filesWithChangedSetOfUnresolvedImports;
|
|
122513
122552
|
var filesWithInvalidatedResolutions;
|
|
@@ -122516,7 +122555,9 @@ var ts;
|
|
|
122516
122555
|
var resolutionsWithFailedLookups = [];
|
|
122517
122556
|
var resolutionsWithOnlyAffectingLocations = [];
|
|
122518
122557
|
var resolvedFileToResolution = ts.createMultiMap();
|
|
122558
|
+
var impliedFormatPackageJsons = new ts.Map();
|
|
122519
122559
|
var hasChangedAutomaticTypeDirectiveNames = false;
|
|
122560
|
+
var affectingPathChecksForFile;
|
|
122520
122561
|
var affectingPathChecks;
|
|
122521
122562
|
var failedLookupChecks;
|
|
122522
122563
|
var startsWithPathChecks;
|
|
@@ -122556,7 +122597,7 @@ var ts;
|
|
|
122556
122597
|
finishRecordingFilesWithChangedResolutions: finishRecordingFilesWithChangedResolutions,
|
|
122557
122598
|
// perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update
|
|
122558
122599
|
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
|
|
122559
|
-
startCachingPerDirectoryResolution:
|
|
122600
|
+
startCachingPerDirectoryResolution: startCachingPerDirectoryResolution,
|
|
122560
122601
|
finishCachingPerDirectoryResolution: finishCachingPerDirectoryResolution,
|
|
122561
122602
|
resolveModuleNames: resolveModuleNames,
|
|
122562
122603
|
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
@@ -122600,9 +122641,10 @@ var ts;
|
|
|
122600
122641
|
startsWithPathChecks = undefined;
|
|
122601
122642
|
isInDirectoryChecks = undefined;
|
|
122602
122643
|
affectingPathChecks = undefined;
|
|
122603
|
-
|
|
122604
|
-
|
|
122605
|
-
|
|
122644
|
+
affectingPathChecksForFile = undefined;
|
|
122645
|
+
moduleResolutionCache.clear();
|
|
122646
|
+
typeReferenceDirectiveResolutionCache.clear();
|
|
122647
|
+
impliedFormatPackageJsons.clear();
|
|
122606
122648
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
122607
122649
|
}
|
|
122608
122650
|
function startRecordingFilesWithChangedResolutions() {
|
|
@@ -122634,15 +122676,44 @@ var ts;
|
|
|
122634
122676
|
return function (path) { return (!!collected && collected.has(path)) ||
|
|
122635
122677
|
isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
|
|
122636
122678
|
}
|
|
122637
|
-
function
|
|
122638
|
-
moduleResolutionCache.
|
|
122639
|
-
typeReferenceDirectiveResolutionCache.
|
|
122679
|
+
function startCachingPerDirectoryResolution() {
|
|
122680
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
122681
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
122682
|
+
// perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update
|
|
122683
|
+
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
|
|
122640
122684
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
122641
122685
|
nonRelativeExternalModuleResolutions.clear();
|
|
122642
122686
|
}
|
|
122643
|
-
function finishCachingPerDirectoryResolution() {
|
|
122687
|
+
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
122644
122688
|
filesWithInvalidatedNonRelativeUnresolvedImports = undefined;
|
|
122645
|
-
|
|
122689
|
+
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
122690
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
122691
|
+
// Update file watches
|
|
122692
|
+
if (newProgram !== oldProgram) {
|
|
122693
|
+
newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFiles().forEach(function (newFile) {
|
|
122694
|
+
var _a, _b, _c;
|
|
122695
|
+
var expected = ts.isExternalOrCommonJsModule(newFile) ? (_b = (_a = newFile.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 : 0;
|
|
122696
|
+
var existing = (_c = impliedFormatPackageJsons.get(newFile.path)) !== null && _c !== void 0 ? _c : ts.emptyArray;
|
|
122697
|
+
for (var i = existing.length; i < expected; i++) {
|
|
122698
|
+
createFileWatcherOfAffectingLocation(newFile.packageJsonLocations[i], /*forResolution*/ false);
|
|
122699
|
+
}
|
|
122700
|
+
if (existing.length > expected) {
|
|
122701
|
+
for (var i = expected; i < existing.length; i++) {
|
|
122702
|
+
fileWatchesOfAffectingLocations.get(existing[i]).files--;
|
|
122703
|
+
}
|
|
122704
|
+
}
|
|
122705
|
+
if (expected)
|
|
122706
|
+
impliedFormatPackageJsons.set(newFile.path, newFile.packageJsonLocations);
|
|
122707
|
+
else
|
|
122708
|
+
impliedFormatPackageJsons.delete(newFile.path);
|
|
122709
|
+
});
|
|
122710
|
+
impliedFormatPackageJsons.forEach(function (existing, path) {
|
|
122711
|
+
if (!(newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFileByPath(path))) {
|
|
122712
|
+
existing.forEach(function (location) { return fileWatchesOfAffectingLocations.get(location).files--; });
|
|
122713
|
+
impliedFormatPackageJsons.delete(path);
|
|
122714
|
+
}
|
|
122715
|
+
});
|
|
122716
|
+
}
|
|
122646
122717
|
directoryWatchesOfFailedLookups.forEach(function (watcher, path) {
|
|
122647
122718
|
if (watcher.refCount === 0) {
|
|
122648
122719
|
directoryWatchesOfFailedLookups.delete(path);
|
|
@@ -122650,7 +122721,7 @@ var ts;
|
|
|
122650
122721
|
}
|
|
122651
122722
|
});
|
|
122652
122723
|
fileWatchesOfAffectingLocations.forEach(function (watcher, path) {
|
|
122653
|
-
if (watcher.
|
|
122724
|
+
if (watcher.files === 0 && watcher.resolutions === 0) {
|
|
122654
122725
|
fileWatchesOfAffectingLocations.delete(path);
|
|
122655
122726
|
watcher.watcher.close();
|
|
122656
122727
|
// Ensure when watching symlinked package.json, we can close the actual file watcher only once
|
|
@@ -122881,7 +122952,7 @@ var ts;
|
|
|
122881
122952
|
}
|
|
122882
122953
|
// If the directory is node_modules use it to watch, always watch it recursively
|
|
122883
122954
|
if (ts.isNodeModulesDirectory(dirPath)) {
|
|
122884
|
-
return
|
|
122955
|
+
return canWatchDirectoryOrFile(ts.getDirectoryPath(dirPath)) ? { dir: dir, dirPath: dirPath } : undefined;
|
|
122885
122956
|
}
|
|
122886
122957
|
var nonRecursive = true;
|
|
122887
122958
|
// Use some ancestor of the root directory
|
|
@@ -122899,7 +122970,7 @@ var ts;
|
|
|
122899
122970
|
dir = ts.getDirectoryPath(dir);
|
|
122900
122971
|
}
|
|
122901
122972
|
}
|
|
122902
|
-
return
|
|
122973
|
+
return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive: nonRecursive } : undefined;
|
|
122903
122974
|
}
|
|
122904
122975
|
function isPathWithDefaultFailedLookupExtension(path) {
|
|
122905
122976
|
return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
@@ -122970,46 +123041,58 @@ var ts;
|
|
|
122970
123041
|
// Watch package json
|
|
122971
123042
|
for (var _i = 0, affectingLocations_1 = affectingLocations; _i < affectingLocations_1.length; _i++) {
|
|
122972
123043
|
var affectingLocation = affectingLocations_1[_i];
|
|
122973
|
-
createFileWatcherOfAffectingLocation(affectingLocation);
|
|
123044
|
+
createFileWatcherOfAffectingLocation(affectingLocation, /*forResolution*/ true);
|
|
122974
123045
|
}
|
|
122975
123046
|
}
|
|
122976
|
-
function createFileWatcherOfAffectingLocation(affectingLocation) {
|
|
122977
|
-
var
|
|
122978
|
-
var fileWatcher = fileWatchesOfAffectingLocations.get(path);
|
|
123047
|
+
function createFileWatcherOfAffectingLocation(affectingLocation, forResolution) {
|
|
123048
|
+
var fileWatcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
122979
123049
|
if (fileWatcher) {
|
|
122980
|
-
|
|
123050
|
+
if (forResolution)
|
|
123051
|
+
fileWatcher.resolutions++;
|
|
123052
|
+
else
|
|
123053
|
+
fileWatcher.files++;
|
|
122981
123054
|
return;
|
|
122982
123055
|
}
|
|
122983
123056
|
var locationToWatch = affectingLocation;
|
|
122984
|
-
var locationToWatchPath = path;
|
|
122985
123057
|
if (resolutionHost.realpath) {
|
|
122986
123058
|
locationToWatch = resolutionHost.realpath(affectingLocation);
|
|
122987
|
-
|
|
122988
|
-
|
|
122989
|
-
var fileWatcher_1 = fileWatchesOfAffectingLocations.get(locationToWatchPath);
|
|
123059
|
+
if (affectingLocation !== locationToWatch) {
|
|
123060
|
+
var fileWatcher_1 = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
122990
123061
|
if (fileWatcher_1) {
|
|
122991
|
-
|
|
122992
|
-
|
|
122993
|
-
|
|
123062
|
+
if (forResolution)
|
|
123063
|
+
fileWatcher_1.resolutions++;
|
|
123064
|
+
else
|
|
123065
|
+
fileWatcher_1.files++;
|
|
123066
|
+
fileWatcher_1.paths.add(affectingLocation);
|
|
123067
|
+
fileWatchesOfAffectingLocations.set(affectingLocation, fileWatcher_1);
|
|
122994
123068
|
return;
|
|
122995
123069
|
}
|
|
122996
123070
|
}
|
|
122997
123071
|
}
|
|
122998
123072
|
var paths = new ts.Set();
|
|
122999
|
-
paths.add(
|
|
123073
|
+
paths.add(locationToWatch);
|
|
123000
123074
|
var watcher = {
|
|
123001
|
-
watcher: resolutionHost.
|
|
123002
|
-
|
|
123003
|
-
|
|
123004
|
-
|
|
123005
|
-
|
|
123006
|
-
|
|
123075
|
+
watcher: canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ?
|
|
123076
|
+
resolutionHost.watchAffectingFileLocation(locationToWatch, function (fileName, eventKind) {
|
|
123077
|
+
cachedDirectoryStructureHost === null || cachedDirectoryStructureHost === void 0 ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
|
|
123078
|
+
paths.forEach(function (path) {
|
|
123079
|
+
var _a;
|
|
123080
|
+
if (watcher.resolutions)
|
|
123081
|
+
(affectingPathChecks !== null && affectingPathChecks !== void 0 ? affectingPathChecks : (affectingPathChecks = new ts.Set())).add(path);
|
|
123082
|
+
if (watcher.files)
|
|
123083
|
+
(affectingPathChecksForFile !== null && affectingPathChecksForFile !== void 0 ? affectingPathChecksForFile : (affectingPathChecksForFile = new ts.Set())).add(path);
|
|
123084
|
+
(_a = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap()) === null || _a === void 0 ? void 0 : _a.delete(resolutionHost.toPath(path));
|
|
123085
|
+
});
|
|
123086
|
+
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
123087
|
+
}) : ts.noopFileWatcher,
|
|
123088
|
+
resolutions: forResolution ? 1 : 0,
|
|
123089
|
+
files: forResolution ? 0 : 1,
|
|
123007
123090
|
paths: paths,
|
|
123008
123091
|
};
|
|
123009
|
-
fileWatchesOfAffectingLocations.set(
|
|
123010
|
-
if (
|
|
123011
|
-
fileWatchesOfAffectingLocations.set(
|
|
123012
|
-
paths.add(
|
|
123092
|
+
fileWatchesOfAffectingLocations.set(locationToWatch, watcher);
|
|
123093
|
+
if (affectingLocation !== locationToWatch) {
|
|
123094
|
+
fileWatchesOfAffectingLocations.set(affectingLocation, watcher);
|
|
123095
|
+
paths.add(affectingLocation);
|
|
123013
123096
|
}
|
|
123014
123097
|
}
|
|
123015
123098
|
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
@@ -123077,8 +123160,8 @@ var ts;
|
|
|
123077
123160
|
}
|
|
123078
123161
|
for (var _a = 0, affectingLocations_2 = affectingLocations; _a < affectingLocations_2.length; _a++) {
|
|
123079
123162
|
var affectingLocation = affectingLocations_2[_a];
|
|
123080
|
-
var watcher = fileWatchesOfAffectingLocations.get(
|
|
123081
|
-
watcher.
|
|
123163
|
+
var watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
123164
|
+
watcher.resolutions--;
|
|
123082
123165
|
}
|
|
123083
123166
|
}
|
|
123084
123167
|
function removeDirectoryWatcher(dirPath) {
|
|
@@ -123132,7 +123215,7 @@ var ts;
|
|
|
123132
123215
|
resolution.isInvalidated = invalidated = true;
|
|
123133
123216
|
for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
|
|
123134
123217
|
var containingFilePath = _b[_a];
|
|
123135
|
-
(filesWithInvalidatedResolutions
|
|
123218
|
+
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
|
|
123136
123219
|
// When its a file with inferred types resolution, invalidate type reference directive resolution
|
|
123137
123220
|
hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts.endsWith(containingFilePath, ts.inferredTypesContainingFile);
|
|
123138
123221
|
}
|
|
@@ -123199,10 +123282,25 @@ var ts;
|
|
|
123199
123282
|
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
123200
123283
|
}
|
|
123201
123284
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
123285
|
+
var _a;
|
|
123286
|
+
var invalidated = false;
|
|
123287
|
+
if (affectingPathChecksForFile) {
|
|
123288
|
+
(_a = resolutionHost.getCurrentProgram()) === null || _a === void 0 ? void 0 : _a.getSourceFiles().forEach(function (f) {
|
|
123289
|
+
if (ts.some(f.packageJsonLocations, function (location) { return affectingPathChecksForFile.has(location); })) {
|
|
123290
|
+
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(f.path);
|
|
123291
|
+
invalidated = true;
|
|
123292
|
+
}
|
|
123293
|
+
});
|
|
123294
|
+
affectingPathChecksForFile = undefined;
|
|
123295
|
+
}
|
|
123202
123296
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks && !affectingPathChecks) {
|
|
123203
|
-
return
|
|
123297
|
+
return invalidated;
|
|
123298
|
+
}
|
|
123299
|
+
invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
|
|
123300
|
+
var packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
123301
|
+
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
123302
|
+
packageJsonMap.forEach(function (_value, path) { return isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : undefined; });
|
|
123204
123303
|
}
|
|
123205
|
-
var invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution);
|
|
123206
123304
|
failedLookupChecks = undefined;
|
|
123207
123305
|
startsWithPathChecks = undefined;
|
|
123208
123306
|
isInDirectoryChecks = undefined;
|
|
@@ -123215,17 +123313,15 @@ var ts;
|
|
|
123215
123313
|
return true;
|
|
123216
123314
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
|
|
123217
123315
|
return false;
|
|
123218
|
-
return resolution.failedLookupLocations.some(function (location) {
|
|
123219
|
-
|
|
123220
|
-
|
|
123221
|
-
|
|
123222
|
-
|
|
123223
|
-
|
|
123316
|
+
return resolution.failedLookupLocations.some(function (location) { return isInvalidatedFailedLookup(resolutionHost.toPath(location)); });
|
|
123317
|
+
}
|
|
123318
|
+
function isInvalidatedFailedLookup(locationPath) {
|
|
123319
|
+
return (failedLookupChecks === null || failedLookupChecks === void 0 ? void 0 : failedLookupChecks.has(locationPath)) ||
|
|
123320
|
+
ts.firstDefinedIterator((startsWithPathChecks === null || startsWithPathChecks === void 0 ? void 0 : startsWithPathChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return ts.startsWith(locationPath, fileOrDirectoryPath) ? true : undefined; }) ||
|
|
123321
|
+
ts.firstDefinedIterator((isInDirectoryChecks === null || isInDirectoryChecks === void 0 ? void 0 : isInDirectoryChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : undefined; });
|
|
123224
123322
|
}
|
|
123225
123323
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
123226
|
-
return !!affectingPathChecks && resolution.affectingLocations.some(function (location) {
|
|
123227
|
-
return affectingPathChecks.has(resolutionHost.toPath(location));
|
|
123228
|
-
});
|
|
123324
|
+
return !!affectingPathChecks && resolution.affectingLocations.some(function (location) { return affectingPathChecks.has(location); });
|
|
123229
123325
|
}
|
|
123230
123326
|
function closeTypeRootsWatch() {
|
|
123231
123327
|
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
|
|
@@ -123291,7 +123387,7 @@ var ts;
|
|
|
123291
123387
|
function directoryExistsForTypeRootWatch(nodeTypesDirectory) {
|
|
123292
123388
|
var dir = ts.getDirectoryPath(ts.getDirectoryPath(nodeTypesDirectory));
|
|
123293
123389
|
var dirPath = resolutionHost.toPath(dir);
|
|
123294
|
-
return dirPath === rootPath ||
|
|
123390
|
+
return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
|
|
123295
123391
|
}
|
|
123296
123392
|
}
|
|
123297
123393
|
ts.createResolutionCache = createResolutionCache;
|
|
@@ -124264,23 +124360,46 @@ var ts;
|
|
|
124264
124360
|
var file = _c[_i];
|
|
124265
124361
|
write("" + toFileName(file, relativeFileName));
|
|
124266
124362
|
(_a = reasons.get(file.path)) === null || _a === void 0 ? void 0 : _a.forEach(function (reason) { return write(" " + fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText); });
|
|
124267
|
-
(_b =
|
|
124363
|
+
(_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) === null || _b === void 0 ? void 0 : _b.forEach(function (d) { return write(" " + d.messageText); });
|
|
124268
124364
|
}
|
|
124269
124365
|
}
|
|
124270
124366
|
ts.explainFiles = explainFiles;
|
|
124271
|
-
function
|
|
124367
|
+
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
124368
|
+
var _a;
|
|
124272
124369
|
var result;
|
|
124273
124370
|
if (file.path !== file.resolvedPath) {
|
|
124274
|
-
(result
|
|
124371
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124275
124372
|
/*details*/ undefined, ts.Diagnostics.File_is_output_of_project_reference_source_0, toFileName(file.originalFileName, fileNameConvertor)));
|
|
124276
124373
|
}
|
|
124277
124374
|
if (file.redirectInfo) {
|
|
124278
|
-
(result
|
|
124375
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124279
124376
|
/*details*/ undefined, ts.Diagnostics.File_redirects_to_file_0, toFileName(file.redirectInfo.redirectTarget, fileNameConvertor)));
|
|
124280
124377
|
}
|
|
124378
|
+
if (ts.isExternalOrCommonJsModule(file)) {
|
|
124379
|
+
switch (file.impliedNodeFormat) {
|
|
124380
|
+
case ts.ModuleKind.ESNext:
|
|
124381
|
+
if (file.packageJsonScope) {
|
|
124382
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124383
|
+
/*details*/ undefined, ts.Diagnostics.File_is_ECMAScript_module_because_0_has_field_type_with_value_module, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor)));
|
|
124384
|
+
}
|
|
124385
|
+
break;
|
|
124386
|
+
case ts.ModuleKind.CommonJS:
|
|
124387
|
+
if (file.packageJsonScope) {
|
|
124388
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124389
|
+
/*details*/ undefined, file.packageJsonScope.packageJsonContent.type ?
|
|
124390
|
+
ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module :
|
|
124391
|
+
ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor)));
|
|
124392
|
+
}
|
|
124393
|
+
else if ((_a = file.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) {
|
|
124394
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124395
|
+
/*details*/ undefined, ts.Diagnostics.File_is_CommonJS_module_because_package_json_was_not_found));
|
|
124396
|
+
}
|
|
124397
|
+
break;
|
|
124398
|
+
}
|
|
124399
|
+
}
|
|
124281
124400
|
return result;
|
|
124282
124401
|
}
|
|
124283
|
-
ts.
|
|
124402
|
+
ts.explainIfFileIsRedirectAndImpliedFormat = explainIfFileIsRedirectAndImpliedFormat;
|
|
124284
124403
|
function getMatchedFileSpec(program, fileName) {
|
|
124285
124404
|
var _a;
|
|
124286
124405
|
var configFile = program.getCompilerOptions().configFile;
|
|
@@ -124490,6 +124609,7 @@ var ts;
|
|
|
124490
124609
|
MissingFile: "Missing file",
|
|
124491
124610
|
WildcardDirectory: "Wild card directory",
|
|
124492
124611
|
FailedLookupLocations: "Failed Lookup Locations",
|
|
124612
|
+
AffectingFileLocation: "File location affecting resolution",
|
|
124493
124613
|
TypeRoots: "Type roots",
|
|
124494
124614
|
ConfigFileOfReferencedProject: "Config file of referened project",
|
|
124495
124615
|
ExtendedConfigOfReferencedProject: "Extended config file of referenced project",
|
|
@@ -124813,7 +124933,7 @@ var ts;
|
|
|
124813
124933
|
compilerHost.getCompilationSettings = function () { return compilerOptions; };
|
|
124814
124934
|
compilerHost.useSourceOfProjectReferenceRedirect = ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect);
|
|
124815
124935
|
compilerHost.watchDirectoryOfFailedLookupLocation = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.FailedLookupLocations); };
|
|
124816
|
-
compilerHost.watchAffectingFileLocation = function (file, cb) { return watchFile(file, cb, ts.PollingInterval.High, watchOptions, ts.WatchType.
|
|
124936
|
+
compilerHost.watchAffectingFileLocation = function (file, cb) { return watchFile(file, cb, ts.PollingInterval.High, watchOptions, ts.WatchType.AffectingFileLocation); };
|
|
124817
124937
|
compilerHost.watchTypeRootsDirectory = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.TypeRoots); };
|
|
124818
124938
|
compilerHost.getCachedDirectoryStructureHost = function () { return cachedDirectoryStructureHost; };
|
|
124819
124939
|
compilerHost.scheduleInvalidateResolutionsOfFailedLookupLocations = scheduleInvalidateResolutionsOfFailedLookupLocations;
|
|
@@ -124847,6 +124967,9 @@ var ts;
|
|
|
124847
124967
|
return host.resolveTypeReferenceDirectives.apply(host, args);
|
|
124848
124968
|
}) :
|
|
124849
124969
|
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode); });
|
|
124970
|
+
compilerHost.getModuleResolutionCache = host.resolveModuleNames ?
|
|
124971
|
+
ts.maybeBind(host, host.getModuleResolutionCache) :
|
|
124972
|
+
(function () { return resolutionCache.getModuleResolutionCache(); });
|
|
124850
124973
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
124851
124974
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
124852
124975
|
synchronizeProgram();
|
|
@@ -124949,8 +125072,9 @@ var ts;
|
|
|
124949
125072
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
124950
125073
|
compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
|
|
124951
125074
|
compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
125075
|
+
var oldProgram = getCurrentProgram();
|
|
124952
125076
|
builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
124953
|
-
resolutionCache.finishCachingPerDirectoryResolution();
|
|
125077
|
+
resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
|
|
124954
125078
|
// Update watches
|
|
124955
125079
|
ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
|
|
124956
125080
|
if (needsUpdateInTypeRootWatch) {
|
|
@@ -125032,9 +125156,6 @@ var ts;
|
|
|
125032
125156
|
sourceFilesCache.set(path, false);
|
|
125033
125157
|
}
|
|
125034
125158
|
}
|
|
125035
|
-
if (sourceFile) {
|
|
125036
|
-
sourceFile.impliedNodeFormat = ts.getImpliedNodeFormatForFile(path, resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache(), compilerHost, compilerHost.getCompilationSettings());
|
|
125037
|
-
}
|
|
125038
125159
|
return sourceFile;
|
|
125039
125160
|
}
|
|
125040
125161
|
return hostSourceFile.sourceFile;
|
|
@@ -125550,6 +125671,7 @@ var ts;
|
|
|
125550
125671
|
compilerHost.getParsedCommandLine = function (fileName) { return parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName)); };
|
|
125551
125672
|
compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
|
|
125552
125673
|
compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
125674
|
+
compilerHost.getModuleResolutionCache = ts.maybeBind(host, host.getModuleResolutionCache);
|
|
125553
125675
|
var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
|
|
125554
125676
|
var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, /*options*/ undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
|
|
125555
125677
|
if (!compilerHost.resolveModuleNames) {
|