typescript 4.8.0-dev.20220730 → 4.8.0-dev.20220802
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/de/diagnosticMessages.generated.json +1 -0
- package/lib/es/diagnosticMessages.generated.json +1 -0
- package/lib/fr/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +1 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +1 -0
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/pt-br/diagnosticMessages.generated.json +1 -0
- package/lib/ru/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +250 -131
- package/lib/tsserver.js +311 -179
- package/lib/tsserverlibrary.d.ts +16 -10
- package/lib/tsserverlibrary.js +311 -179
- package/lib/typescript.d.ts +16 -10
- package/lib/typescript.js +306 -174
- package/lib/typescriptServices.d.ts +16 -10
- package/lib/typescriptServices.js +306 -174
- package/lib/typingsInstaller.js +265 -141
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -0
- 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.20220802";
|
|
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;
|
|
@@ -82097,9 +82110,11 @@ var ts;
|
|
|
82097
82110
|
// We only need `Awaited<T>` if `T` contains possibly non-primitive types.
|
|
82098
82111
|
if (isGenericObjectType(type)) {
|
|
82099
82112
|
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`,
|
|
82113
|
+
// 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
82114
|
// or is promise-like.
|
|
82102
|
-
if (
|
|
82115
|
+
if (baseConstraint ?
|
|
82116
|
+
baseConstraint.flags & 3 /* AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) :
|
|
82117
|
+
maybeTypeOfKind(type, 8650752 /* TypeVariable */)) {
|
|
82103
82118
|
return true;
|
|
82104
82119
|
}
|
|
82105
82120
|
}
|
|
@@ -94871,10 +94886,11 @@ var ts;
|
|
|
94871
94886
|
}
|
|
94872
94887
|
function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) {
|
|
94873
94888
|
if (node.operator === 45 /* PlusPlusToken */ || node.operator === 46 /* MinusMinusToken */) {
|
|
94874
|
-
|
|
94889
|
+
var operand = ts.skipParentheses(node.operand);
|
|
94890
|
+
if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) {
|
|
94875
94891
|
var info = void 0;
|
|
94876
|
-
if (info = accessPrivateIdentifier(
|
|
94877
|
-
var receiver = ts.visitNode(
|
|
94892
|
+
if (info = accessPrivateIdentifier(operand.name)) {
|
|
94893
|
+
var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression);
|
|
94878
94894
|
var _a = createCopiableReceiverExpr(receiver), readExpression = _a.readExpression, initializeExpression = _a.initializeExpression;
|
|
94879
94895
|
var expression = createPrivateIdentifierAccess(info, readExpression);
|
|
94880
94896
|
var temp = ts.isPrefixUnaryExpression(node) || valueIsDiscarded ? undefined : factory.createTempVariable(hoistVariableDeclaration);
|
|
@@ -94890,7 +94906,7 @@ var ts;
|
|
|
94890
94906
|
}
|
|
94891
94907
|
}
|
|
94892
94908
|
else if (shouldTransformSuperInStaticInitializers &&
|
|
94893
|
-
ts.isSuperProperty(
|
|
94909
|
+
ts.isSuperProperty(operand) &&
|
|
94894
94910
|
currentStaticPropertyDeclarationOrStaticBlock &&
|
|
94895
94911
|
currentClassLexicalEnvironment) {
|
|
94896
94912
|
// converts `++super.a` into `(Reflect.set(_baseTemp, "a", (_a = Reflect.get(_baseTemp, "a", _classTemp), _b = ++_a), _classTemp), _b)`
|
|
@@ -94903,31 +94919,31 @@ var ts;
|
|
|
94903
94919
|
// converts `super[f()]--` into `(Reflect.set(_baseTemp, _a = f(), (_b = Reflect.get(_baseTemp, _a, _classTemp), _c = _b--), _classTemp), _c)`
|
|
94904
94920
|
var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts;
|
|
94905
94921
|
if (facts & 1 /* ClassWasDecorated */) {
|
|
94906
|
-
var
|
|
94922
|
+
var expression = visitInvalidSuperProperty(operand);
|
|
94907
94923
|
return ts.isPrefixUnaryExpression(node) ?
|
|
94908
|
-
factory.updatePrefixUnaryExpression(node,
|
|
94909
|
-
factory.updatePostfixUnaryExpression(node,
|
|
94924
|
+
factory.updatePrefixUnaryExpression(node, expression) :
|
|
94925
|
+
factory.updatePostfixUnaryExpression(node, expression);
|
|
94910
94926
|
}
|
|
94911
94927
|
if (classConstructor && superClassReference) {
|
|
94912
94928
|
var setterName = void 0;
|
|
94913
94929
|
var getterName = void 0;
|
|
94914
|
-
if (ts.isPropertyAccessExpression(
|
|
94915
|
-
if (ts.isIdentifier(
|
|
94916
|
-
getterName = setterName = factory.createStringLiteralFromNode(
|
|
94930
|
+
if (ts.isPropertyAccessExpression(operand)) {
|
|
94931
|
+
if (ts.isIdentifier(operand.name)) {
|
|
94932
|
+
getterName = setterName = factory.createStringLiteralFromNode(operand.name);
|
|
94917
94933
|
}
|
|
94918
94934
|
}
|
|
94919
94935
|
else {
|
|
94920
|
-
if (ts.isSimpleInlineableExpression(
|
|
94921
|
-
getterName = setterName =
|
|
94936
|
+
if (ts.isSimpleInlineableExpression(operand.argumentExpression)) {
|
|
94937
|
+
getterName = setterName = operand.argumentExpression;
|
|
94922
94938
|
}
|
|
94923
94939
|
else {
|
|
94924
94940
|
getterName = factory.createTempVariable(hoistVariableDeclaration);
|
|
94925
|
-
setterName = factory.createAssignment(getterName, ts.visitNode(
|
|
94941
|
+
setterName = factory.createAssignment(getterName, ts.visitNode(operand.argumentExpression, visitor, ts.isExpression));
|
|
94926
94942
|
}
|
|
94927
94943
|
}
|
|
94928
94944
|
if (setterName && getterName) {
|
|
94929
94945
|
var expression = factory.createReflectGetCall(superClassReference, getterName, classConstructor);
|
|
94930
|
-
ts.setTextRange(expression,
|
|
94946
|
+
ts.setTextRange(expression, operand);
|
|
94931
94947
|
var temp = valueIsDiscarded ? undefined : factory.createTempVariable(hoistVariableDeclaration);
|
|
94932
94948
|
expression = ts.expandPreOrPostfixIncrementOrDecrementExpression(factory, node, expression, hoistVariableDeclaration, temp);
|
|
94933
94949
|
expression = factory.createReflectSetCall(superClassReference, setterName, expression, classConstructor);
|
|
@@ -117682,6 +117698,12 @@ var ts;
|
|
|
117682
117698
|
* @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format
|
|
117683
117699
|
*/
|
|
117684
117700
|
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
117701
|
+
var result = getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options);
|
|
117702
|
+
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
117703
|
+
}
|
|
117704
|
+
ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
|
|
117705
|
+
/*@internal*/
|
|
117706
|
+
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
117685
117707
|
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
117686
117708
|
case ts.ModuleResolutionKind.Node16:
|
|
117687
117709
|
case ts.ModuleResolutionKind.NodeNext:
|
|
@@ -117693,11 +117715,16 @@ var ts;
|
|
|
117693
117715
|
return undefined;
|
|
117694
117716
|
}
|
|
117695
117717
|
function lookupFromPackageJson() {
|
|
117696
|
-
var
|
|
117697
|
-
|
|
117718
|
+
var state = ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
|
|
117719
|
+
var packageJsonLocations = [];
|
|
117720
|
+
state.failedLookupLocations = packageJsonLocations;
|
|
117721
|
+
state.affectingLocations = packageJsonLocations;
|
|
117722
|
+
var packageJsonScope = ts.getPackageScopeForPath(fileName, state);
|
|
117723
|
+
var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
117724
|
+
return { impliedNodeFormat: impliedNodeFormat, packageJsonLocations: packageJsonLocations, packageJsonScope: packageJsonScope };
|
|
117698
117725
|
}
|
|
117699
117726
|
}
|
|
117700
|
-
ts.
|
|
117727
|
+
ts.getImpliedNodeFormatForFileWorker = getImpliedNodeFormatForFileWorker;
|
|
117701
117728
|
/** @internal */
|
|
117702
117729
|
ts.plainJSErrors = new ts.Set([
|
|
117703
117730
|
// binder errors
|
|
@@ -118022,7 +118049,7 @@ var ts;
|
|
|
118022
118049
|
for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) {
|
|
118023
118050
|
var oldSourceFile = oldSourceFiles_1[_i];
|
|
118024
118051
|
var newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
|
118025
|
-
if (shouldCreateNewSourceFile || !newFile ||
|
|
118052
|
+
if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat ||
|
|
118026
118053
|
// old file wasn't redirect but new file is
|
|
118027
118054
|
(oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path)) {
|
|
118028
118055
|
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
|
|
@@ -118415,7 +118442,7 @@ var ts;
|
|
|
118415
118442
|
});
|
|
118416
118443
|
}
|
|
118417
118444
|
function tryReuseStructureFromOldProgram() {
|
|
118418
|
-
var _a;
|
|
118445
|
+
var _a, _b;
|
|
118419
118446
|
if (!oldProgram) {
|
|
118420
118447
|
return 0 /* Not */;
|
|
118421
118448
|
}
|
|
@@ -118456,12 +118483,15 @@ var ts;
|
|
|
118456
118483
|
var seenPackageNames = new ts.Map();
|
|
118457
118484
|
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
|
|
118458
118485
|
var oldSourceFile = oldSourceFiles_2[_i];
|
|
118486
|
+
var sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options);
|
|
118459
118487
|
var newSourceFile = host.getSourceFileByPath
|
|
118460
|
-
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath,
|
|
118461
|
-
: host.getSourceFile(oldSourceFile.fileName,
|
|
118488
|
+
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, sourceFileOptions, /*onError*/ undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat)
|
|
118489
|
+
: host.getSourceFile(oldSourceFile.fileName, sourceFileOptions, /*onError*/ undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat); // TODO: GH#18217
|
|
118462
118490
|
if (!newSourceFile) {
|
|
118463
118491
|
return 0 /* Not */;
|
|
118464
118492
|
}
|
|
118493
|
+
newSourceFile.packageJsonLocations = ((_a = sourceFileOptions.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
118494
|
+
newSourceFile.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
118465
118495
|
ts.Debug.assert(!newSourceFile.redirectInfo, "Host should not return a redirect source file from `getSourceFile`");
|
|
118466
118496
|
var fileChanged = void 0;
|
|
118467
118497
|
if (oldSourceFile.redirectInfo) {
|
|
@@ -118501,38 +118531,43 @@ var ts;
|
|
|
118501
118531
|
seenPackageNames.set(packageName, newKind);
|
|
118502
118532
|
}
|
|
118503
118533
|
if (fileChanged) {
|
|
118534
|
+
if (oldSourceFile.impliedNodeFormat !== newSourceFile.impliedNodeFormat) {
|
|
118535
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118536
|
+
}
|
|
118504
118537
|
// The `newSourceFile` object was created for the new program.
|
|
118505
|
-
if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
118538
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
118506
118539
|
// 'lib' references has changed. Matches behavior in changesAffectModuleResolution
|
|
118507
118540
|
structureIsReused = 1 /* SafeModules */;
|
|
118508
118541
|
}
|
|
118509
|
-
if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
|
118542
|
+
else if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
|
118510
118543
|
// value of no-default-lib has changed
|
|
118511
118544
|
// this will affect if default library is injected into the list of files
|
|
118512
118545
|
structureIsReused = 1 /* SafeModules */;
|
|
118513
118546
|
}
|
|
118514
118547
|
// check tripleslash references
|
|
118515
|
-
if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
|
118548
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
|
118516
118549
|
// tripleslash references has changed
|
|
118517
118550
|
structureIsReused = 1 /* SafeModules */;
|
|
118518
118551
|
}
|
|
118519
|
-
|
|
118520
|
-
|
|
118521
|
-
|
|
118522
|
-
|
|
118523
|
-
|
|
118524
|
-
|
|
118525
|
-
|
|
118526
|
-
|
|
118527
|
-
|
|
118528
|
-
|
|
118529
|
-
|
|
118530
|
-
|
|
118531
|
-
|
|
118532
|
-
|
|
118533
|
-
|
|
118534
|
-
|
|
118535
|
-
|
|
118552
|
+
else {
|
|
118553
|
+
// check imports and module augmentations
|
|
118554
|
+
collectExternalModuleReferences(newSourceFile);
|
|
118555
|
+
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
|
|
118556
|
+
// imports has changed
|
|
118557
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118558
|
+
}
|
|
118559
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
|
|
118560
|
+
// moduleAugmentations has changed
|
|
118561
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118562
|
+
}
|
|
118563
|
+
else if ((oldSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */) !== (newSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */)) {
|
|
118564
|
+
// dynamicImport has changed
|
|
118565
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118566
|
+
}
|
|
118567
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
118568
|
+
// 'types' references has changed
|
|
118569
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118570
|
+
}
|
|
118536
118571
|
}
|
|
118537
118572
|
// tentatively approve the file
|
|
118538
118573
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
@@ -118550,18 +118585,18 @@ var ts;
|
|
|
118550
118585
|
return structureIsReused;
|
|
118551
118586
|
}
|
|
118552
118587
|
var modifiedFiles = modifiedSourceFiles.map(function (f) { return f.oldFile; });
|
|
118553
|
-
for (var
|
|
118554
|
-
var oldFile = oldSourceFiles_3[
|
|
118588
|
+
for (var _c = 0, oldSourceFiles_3 = oldSourceFiles; _c < oldSourceFiles_3.length; _c++) {
|
|
118589
|
+
var oldFile = oldSourceFiles_3[_c];
|
|
118555
118590
|
if (!ts.contains(modifiedFiles, oldFile)) {
|
|
118556
|
-
for (var
|
|
118557
|
-
var moduleName = _d
|
|
118591
|
+
for (var _d = 0, _e = oldFile.ambientModuleNames; _d < _e.length; _d++) {
|
|
118592
|
+
var moduleName = _e[_d];
|
|
118558
118593
|
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
|
|
118559
118594
|
}
|
|
118560
118595
|
}
|
|
118561
118596
|
}
|
|
118562
118597
|
// try to verify results of module resolution
|
|
118563
|
-
for (var
|
|
118564
|
-
var
|
|
118598
|
+
for (var _f = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _f < modifiedSourceFiles_1.length; _f++) {
|
|
118599
|
+
var _g = modifiedSourceFiles_1[_f], oldSourceFile = _g.oldFile, newSourceFile = _g.newFile;
|
|
118565
118600
|
var moduleNames = getModuleNames(newSourceFile);
|
|
118566
118601
|
var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
118567
118602
|
// ensure that module resolution results are still correct
|
|
@@ -118588,14 +118623,14 @@ var ts;
|
|
|
118588
118623
|
if (structureIsReused !== 2 /* Completely */) {
|
|
118589
118624
|
return structureIsReused;
|
|
118590
118625
|
}
|
|
118591
|
-
if (ts.changesAffectingProgramStructure(oldOptions, options) || ((
|
|
118626
|
+
if (ts.changesAffectingProgramStructure(oldOptions, options) || ((_b = host.hasChangedAutomaticTypeDirectiveNames) === null || _b === void 0 ? void 0 : _b.call(host))) {
|
|
118592
118627
|
return 1 /* SafeModules */;
|
|
118593
118628
|
}
|
|
118594
118629
|
missingFilePaths = oldProgram.getMissingFilePaths();
|
|
118595
118630
|
// update fileName -> file mapping
|
|
118596
118631
|
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
118597
|
-
for (var
|
|
118598
|
-
var newSourceFile = newSourceFiles_1[
|
|
118632
|
+
for (var _h = 0, newSourceFiles_1 = newSourceFiles; _h < newSourceFiles_1.length; _h++) {
|
|
118633
|
+
var newSourceFile = newSourceFiles_1[_h];
|
|
118599
118634
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
118600
118635
|
}
|
|
118601
118636
|
var oldFilesByNameMap = oldProgram.getFilesByNameMap();
|
|
@@ -119378,13 +119413,16 @@ var ts;
|
|
|
119378
119413
|
addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, [fileName, existingFile.fileName]);
|
|
119379
119414
|
}
|
|
119380
119415
|
}
|
|
119381
|
-
function createRedirectSourceFile(redirectTarget, unredirected, fileName, path, resolvedPath, originalFileName) {
|
|
119416
|
+
function createRedirectSourceFile(redirectTarget, unredirected, fileName, path, resolvedPath, originalFileName, sourceFileOptions) {
|
|
119417
|
+
var _a;
|
|
119382
119418
|
var redirect = Object.create(redirectTarget);
|
|
119383
119419
|
redirect.fileName = fileName;
|
|
119384
119420
|
redirect.path = path;
|
|
119385
119421
|
redirect.resolvedPath = resolvedPath;
|
|
119386
119422
|
redirect.originalFileName = originalFileName;
|
|
119387
119423
|
redirect.redirectInfo = { redirectTarget: redirectTarget, unredirected: unredirected };
|
|
119424
|
+
redirect.packageJsonLocations = ((_a = sourceFileOptions.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
119425
|
+
redirect.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
119388
119426
|
sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
|
|
119389
119427
|
Object.defineProperties(redirect, {
|
|
119390
119428
|
id: {
|
|
@@ -119413,14 +119451,14 @@ var ts;
|
|
|
119413
119451
|
// 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
119452
|
// 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
119453
|
// 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
|
-
};
|
|
119454
|
+
var result = getImpliedNodeFormatForFileWorker(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
119455
|
+
var languageVersion = ts.getEmitScriptTarget(options);
|
|
119456
|
+
var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options);
|
|
119457
|
+
return typeof result === "object" ? __assign(__assign({}, result), { languageVersion: languageVersion, setExternalModuleIndicator: setExternalModuleIndicator }) :
|
|
119458
|
+
{ languageVersion: languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator };
|
|
119422
119459
|
}
|
|
119423
119460
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
119461
|
+
var _a, _b;
|
|
119424
119462
|
var path = toPath(fileName);
|
|
119425
119463
|
if (useSourceOfProjectReferenceRedirect) {
|
|
119426
119464
|
var source = getSourceOfProjectReferenceRedirect(path);
|
|
@@ -119507,14 +119545,15 @@ var ts;
|
|
|
119507
119545
|
}
|
|
119508
119546
|
}
|
|
119509
119547
|
// We haven't looked for this file, do so now and cache result
|
|
119510
|
-
var
|
|
119548
|
+
var sourceFileOptions = getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options);
|
|
119549
|
+
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
119550
|
if (packageId) {
|
|
119512
119551
|
var packageIdKey = ts.packageIdToString(packageId);
|
|
119513
119552
|
var fileFromPackageId = packageIdToSourceFile.get(packageIdKey);
|
|
119514
119553
|
if (fileFromPackageId) {
|
|
119515
119554
|
// Some other SourceFile already exists with this package name and version.
|
|
119516
119555
|
// Instead of creating a duplicate, just redirect to the existing one.
|
|
119517
|
-
var dupFile = createRedirectSourceFile(fileFromPackageId, file, fileName, path, toPath(fileName), originalFileName);
|
|
119556
|
+
var dupFile = createRedirectSourceFile(fileFromPackageId, file, fileName, path, toPath(fileName), originalFileName, sourceFileOptions);
|
|
119518
119557
|
redirectTargetsMap.add(fileFromPackageId.path, fileName);
|
|
119519
119558
|
addFileToFilesByName(dupFile, path, redirectedPath);
|
|
119520
119559
|
addFileIncludeReason(dupFile, reason);
|
|
@@ -119535,6 +119574,8 @@ var ts;
|
|
|
119535
119574
|
file.path = path;
|
|
119536
119575
|
file.resolvedPath = toPath(fileName);
|
|
119537
119576
|
file.originalFileName = originalFileName;
|
|
119577
|
+
file.packageJsonLocations = ((_b = sourceFileOptions.packageJsonLocations) === null || _b === void 0 ? void 0 : _b.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
119578
|
+
file.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
119538
119579
|
addFileIncludeReason(file, reason);
|
|
119539
119580
|
if (host.useCaseSensitiveFileNames()) {
|
|
119540
119581
|
var pathLowerCase = ts.toFileNameLowerCase(path);
|
|
@@ -120165,7 +120206,7 @@ var ts;
|
|
|
120165
120206
|
fileIncludeReasons = undefined;
|
|
120166
120207
|
var location = locationReason && getReferencedFileLocation(getSourceFileByPath, locationReason);
|
|
120167
120208
|
var fileIncludeReasonDetails = fileIncludeReasons && ts.chainDiagnosticMessages(fileIncludeReasons, ts.Diagnostics.The_file_is_in_the_program_because_Colon);
|
|
120168
|
-
var redirectInfo = file && ts.
|
|
120209
|
+
var redirectInfo = file && ts.explainIfFileIsRedirectAndImpliedFormat(file);
|
|
120169
120210
|
var chain = ts.chainDiagnosticMessages.apply(void 0, __spreadArray([redirectInfo ? fileIncludeReasonDetails ? __spreadArray([fileIncludeReasonDetails], redirectInfo, true) : redirectInfo : fileIncludeReasonDetails, diagnostic], args || ts.emptyArray, false));
|
|
120170
120211
|
return location && isReferenceFileLocation(location) ?
|
|
120171
120212
|
ts.createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) :
|
|
@@ -122470,7 +122511,7 @@ var ts;
|
|
|
122470
122511
|
* "c:/", "c:/users", "c:/users/username", "c:/users/username/folderAtRoot", "c:/folderAtRoot"
|
|
122471
122512
|
* @param dirPath
|
|
122472
122513
|
*/
|
|
122473
|
-
function
|
|
122514
|
+
function canWatchDirectoryOrFile(dirPath) {
|
|
122474
122515
|
var rootLength = ts.getRootLength(dirPath);
|
|
122475
122516
|
if (dirPath.length === rootLength) {
|
|
122476
122517
|
// Ignore "/", "c:/"
|
|
@@ -122507,7 +122548,7 @@ var ts;
|
|
|
122507
122548
|
}
|
|
122508
122549
|
return true;
|
|
122509
122550
|
}
|
|
122510
|
-
ts.
|
|
122551
|
+
ts.canWatchDirectoryOrFile = canWatchDirectoryOrFile;
|
|
122511
122552
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
122512
122553
|
var filesWithChangedSetOfUnresolvedImports;
|
|
122513
122554
|
var filesWithInvalidatedResolutions;
|
|
@@ -122516,7 +122557,9 @@ var ts;
|
|
|
122516
122557
|
var resolutionsWithFailedLookups = [];
|
|
122517
122558
|
var resolutionsWithOnlyAffectingLocations = [];
|
|
122518
122559
|
var resolvedFileToResolution = ts.createMultiMap();
|
|
122560
|
+
var impliedFormatPackageJsons = new ts.Map();
|
|
122519
122561
|
var hasChangedAutomaticTypeDirectiveNames = false;
|
|
122562
|
+
var affectingPathChecksForFile;
|
|
122520
122563
|
var affectingPathChecks;
|
|
122521
122564
|
var failedLookupChecks;
|
|
122522
122565
|
var startsWithPathChecks;
|
|
@@ -122556,7 +122599,7 @@ var ts;
|
|
|
122556
122599
|
finishRecordingFilesWithChangedResolutions: finishRecordingFilesWithChangedResolutions,
|
|
122557
122600
|
// perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update
|
|
122558
122601
|
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
|
|
122559
|
-
startCachingPerDirectoryResolution:
|
|
122602
|
+
startCachingPerDirectoryResolution: startCachingPerDirectoryResolution,
|
|
122560
122603
|
finishCachingPerDirectoryResolution: finishCachingPerDirectoryResolution,
|
|
122561
122604
|
resolveModuleNames: resolveModuleNames,
|
|
122562
122605
|
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
@@ -122600,9 +122643,10 @@ var ts;
|
|
|
122600
122643
|
startsWithPathChecks = undefined;
|
|
122601
122644
|
isInDirectoryChecks = undefined;
|
|
122602
122645
|
affectingPathChecks = undefined;
|
|
122603
|
-
|
|
122604
|
-
|
|
122605
|
-
|
|
122646
|
+
affectingPathChecksForFile = undefined;
|
|
122647
|
+
moduleResolutionCache.clear();
|
|
122648
|
+
typeReferenceDirectiveResolutionCache.clear();
|
|
122649
|
+
impliedFormatPackageJsons.clear();
|
|
122606
122650
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
122607
122651
|
}
|
|
122608
122652
|
function startRecordingFilesWithChangedResolutions() {
|
|
@@ -122634,15 +122678,44 @@ var ts;
|
|
|
122634
122678
|
return function (path) { return (!!collected && collected.has(path)) ||
|
|
122635
122679
|
isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
|
|
122636
122680
|
}
|
|
122637
|
-
function
|
|
122638
|
-
moduleResolutionCache.
|
|
122639
|
-
typeReferenceDirectiveResolutionCache.
|
|
122681
|
+
function startCachingPerDirectoryResolution() {
|
|
122682
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
122683
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
122684
|
+
// perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update
|
|
122685
|
+
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
|
|
122640
122686
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
122641
122687
|
nonRelativeExternalModuleResolutions.clear();
|
|
122642
122688
|
}
|
|
122643
|
-
function finishCachingPerDirectoryResolution() {
|
|
122689
|
+
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
122644
122690
|
filesWithInvalidatedNonRelativeUnresolvedImports = undefined;
|
|
122645
|
-
|
|
122691
|
+
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
122692
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
122693
|
+
// Update file watches
|
|
122694
|
+
if (newProgram !== oldProgram) {
|
|
122695
|
+
newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFiles().forEach(function (newFile) {
|
|
122696
|
+
var _a, _b, _c;
|
|
122697
|
+
var expected = ts.isExternalOrCommonJsModule(newFile) ? (_b = (_a = newFile.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 : 0;
|
|
122698
|
+
var existing = (_c = impliedFormatPackageJsons.get(newFile.path)) !== null && _c !== void 0 ? _c : ts.emptyArray;
|
|
122699
|
+
for (var i = existing.length; i < expected; i++) {
|
|
122700
|
+
createFileWatcherOfAffectingLocation(newFile.packageJsonLocations[i], /*forResolution*/ false);
|
|
122701
|
+
}
|
|
122702
|
+
if (existing.length > expected) {
|
|
122703
|
+
for (var i = expected; i < existing.length; i++) {
|
|
122704
|
+
fileWatchesOfAffectingLocations.get(existing[i]).files--;
|
|
122705
|
+
}
|
|
122706
|
+
}
|
|
122707
|
+
if (expected)
|
|
122708
|
+
impliedFormatPackageJsons.set(newFile.path, newFile.packageJsonLocations);
|
|
122709
|
+
else
|
|
122710
|
+
impliedFormatPackageJsons.delete(newFile.path);
|
|
122711
|
+
});
|
|
122712
|
+
impliedFormatPackageJsons.forEach(function (existing, path) {
|
|
122713
|
+
if (!(newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFileByPath(path))) {
|
|
122714
|
+
existing.forEach(function (location) { return fileWatchesOfAffectingLocations.get(location).files--; });
|
|
122715
|
+
impliedFormatPackageJsons.delete(path);
|
|
122716
|
+
}
|
|
122717
|
+
});
|
|
122718
|
+
}
|
|
122646
122719
|
directoryWatchesOfFailedLookups.forEach(function (watcher, path) {
|
|
122647
122720
|
if (watcher.refCount === 0) {
|
|
122648
122721
|
directoryWatchesOfFailedLookups.delete(path);
|
|
@@ -122650,7 +122723,7 @@ var ts;
|
|
|
122650
122723
|
}
|
|
122651
122724
|
});
|
|
122652
122725
|
fileWatchesOfAffectingLocations.forEach(function (watcher, path) {
|
|
122653
|
-
if (watcher.
|
|
122726
|
+
if (watcher.files === 0 && watcher.resolutions === 0) {
|
|
122654
122727
|
fileWatchesOfAffectingLocations.delete(path);
|
|
122655
122728
|
watcher.watcher.close();
|
|
122656
122729
|
// Ensure when watching symlinked package.json, we can close the actual file watcher only once
|
|
@@ -122881,7 +122954,7 @@ var ts;
|
|
|
122881
122954
|
}
|
|
122882
122955
|
// If the directory is node_modules use it to watch, always watch it recursively
|
|
122883
122956
|
if (ts.isNodeModulesDirectory(dirPath)) {
|
|
122884
|
-
return
|
|
122957
|
+
return canWatchDirectoryOrFile(ts.getDirectoryPath(dirPath)) ? { dir: dir, dirPath: dirPath } : undefined;
|
|
122885
122958
|
}
|
|
122886
122959
|
var nonRecursive = true;
|
|
122887
122960
|
// Use some ancestor of the root directory
|
|
@@ -122899,7 +122972,7 @@ var ts;
|
|
|
122899
122972
|
dir = ts.getDirectoryPath(dir);
|
|
122900
122973
|
}
|
|
122901
122974
|
}
|
|
122902
|
-
return
|
|
122975
|
+
return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive: nonRecursive } : undefined;
|
|
122903
122976
|
}
|
|
122904
122977
|
function isPathWithDefaultFailedLookupExtension(path) {
|
|
122905
122978
|
return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
@@ -122970,46 +123043,58 @@ var ts;
|
|
|
122970
123043
|
// Watch package json
|
|
122971
123044
|
for (var _i = 0, affectingLocations_1 = affectingLocations; _i < affectingLocations_1.length; _i++) {
|
|
122972
123045
|
var affectingLocation = affectingLocations_1[_i];
|
|
122973
|
-
createFileWatcherOfAffectingLocation(affectingLocation);
|
|
123046
|
+
createFileWatcherOfAffectingLocation(affectingLocation, /*forResolution*/ true);
|
|
122974
123047
|
}
|
|
122975
123048
|
}
|
|
122976
|
-
function createFileWatcherOfAffectingLocation(affectingLocation) {
|
|
122977
|
-
var
|
|
122978
|
-
var fileWatcher = fileWatchesOfAffectingLocations.get(path);
|
|
123049
|
+
function createFileWatcherOfAffectingLocation(affectingLocation, forResolution) {
|
|
123050
|
+
var fileWatcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
122979
123051
|
if (fileWatcher) {
|
|
122980
|
-
|
|
123052
|
+
if (forResolution)
|
|
123053
|
+
fileWatcher.resolutions++;
|
|
123054
|
+
else
|
|
123055
|
+
fileWatcher.files++;
|
|
122981
123056
|
return;
|
|
122982
123057
|
}
|
|
122983
123058
|
var locationToWatch = affectingLocation;
|
|
122984
|
-
var locationToWatchPath = path;
|
|
122985
123059
|
if (resolutionHost.realpath) {
|
|
122986
123060
|
locationToWatch = resolutionHost.realpath(affectingLocation);
|
|
122987
|
-
|
|
122988
|
-
|
|
122989
|
-
var fileWatcher_1 = fileWatchesOfAffectingLocations.get(locationToWatchPath);
|
|
123061
|
+
if (affectingLocation !== locationToWatch) {
|
|
123062
|
+
var fileWatcher_1 = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
122990
123063
|
if (fileWatcher_1) {
|
|
122991
|
-
|
|
122992
|
-
|
|
122993
|
-
|
|
123064
|
+
if (forResolution)
|
|
123065
|
+
fileWatcher_1.resolutions++;
|
|
123066
|
+
else
|
|
123067
|
+
fileWatcher_1.files++;
|
|
123068
|
+
fileWatcher_1.paths.add(affectingLocation);
|
|
123069
|
+
fileWatchesOfAffectingLocations.set(affectingLocation, fileWatcher_1);
|
|
122994
123070
|
return;
|
|
122995
123071
|
}
|
|
122996
123072
|
}
|
|
122997
123073
|
}
|
|
122998
123074
|
var paths = new ts.Set();
|
|
122999
|
-
paths.add(
|
|
123075
|
+
paths.add(locationToWatch);
|
|
123000
123076
|
var watcher = {
|
|
123001
|
-
watcher: resolutionHost.
|
|
123002
|
-
|
|
123003
|
-
|
|
123004
|
-
|
|
123005
|
-
|
|
123006
|
-
|
|
123077
|
+
watcher: canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ?
|
|
123078
|
+
resolutionHost.watchAffectingFileLocation(locationToWatch, function (fileName, eventKind) {
|
|
123079
|
+
cachedDirectoryStructureHost === null || cachedDirectoryStructureHost === void 0 ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
|
|
123080
|
+
paths.forEach(function (path) {
|
|
123081
|
+
var _a;
|
|
123082
|
+
if (watcher.resolutions)
|
|
123083
|
+
(affectingPathChecks !== null && affectingPathChecks !== void 0 ? affectingPathChecks : (affectingPathChecks = new ts.Set())).add(path);
|
|
123084
|
+
if (watcher.files)
|
|
123085
|
+
(affectingPathChecksForFile !== null && affectingPathChecksForFile !== void 0 ? affectingPathChecksForFile : (affectingPathChecksForFile = new ts.Set())).add(path);
|
|
123086
|
+
(_a = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap()) === null || _a === void 0 ? void 0 : _a.delete(resolutionHost.toPath(path));
|
|
123087
|
+
});
|
|
123088
|
+
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
123089
|
+
}) : ts.noopFileWatcher,
|
|
123090
|
+
resolutions: forResolution ? 1 : 0,
|
|
123091
|
+
files: forResolution ? 0 : 1,
|
|
123007
123092
|
paths: paths,
|
|
123008
123093
|
};
|
|
123009
|
-
fileWatchesOfAffectingLocations.set(
|
|
123010
|
-
if (
|
|
123011
|
-
fileWatchesOfAffectingLocations.set(
|
|
123012
|
-
paths.add(
|
|
123094
|
+
fileWatchesOfAffectingLocations.set(locationToWatch, watcher);
|
|
123095
|
+
if (affectingLocation !== locationToWatch) {
|
|
123096
|
+
fileWatchesOfAffectingLocations.set(affectingLocation, watcher);
|
|
123097
|
+
paths.add(affectingLocation);
|
|
123013
123098
|
}
|
|
123014
123099
|
}
|
|
123015
123100
|
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
@@ -123077,8 +123162,8 @@ var ts;
|
|
|
123077
123162
|
}
|
|
123078
123163
|
for (var _a = 0, affectingLocations_2 = affectingLocations; _a < affectingLocations_2.length; _a++) {
|
|
123079
123164
|
var affectingLocation = affectingLocations_2[_a];
|
|
123080
|
-
var watcher = fileWatchesOfAffectingLocations.get(
|
|
123081
|
-
watcher.
|
|
123165
|
+
var watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
123166
|
+
watcher.resolutions--;
|
|
123082
123167
|
}
|
|
123083
123168
|
}
|
|
123084
123169
|
function removeDirectoryWatcher(dirPath) {
|
|
@@ -123132,7 +123217,7 @@ var ts;
|
|
|
123132
123217
|
resolution.isInvalidated = invalidated = true;
|
|
123133
123218
|
for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
|
|
123134
123219
|
var containingFilePath = _b[_a];
|
|
123135
|
-
(filesWithInvalidatedResolutions
|
|
123220
|
+
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
|
|
123136
123221
|
// When its a file with inferred types resolution, invalidate type reference directive resolution
|
|
123137
123222
|
hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts.endsWith(containingFilePath, ts.inferredTypesContainingFile);
|
|
123138
123223
|
}
|
|
@@ -123199,10 +123284,25 @@ var ts;
|
|
|
123199
123284
|
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
123200
123285
|
}
|
|
123201
123286
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
123287
|
+
var _a;
|
|
123288
|
+
var invalidated = false;
|
|
123289
|
+
if (affectingPathChecksForFile) {
|
|
123290
|
+
(_a = resolutionHost.getCurrentProgram()) === null || _a === void 0 ? void 0 : _a.getSourceFiles().forEach(function (f) {
|
|
123291
|
+
if (ts.some(f.packageJsonLocations, function (location) { return affectingPathChecksForFile.has(location); })) {
|
|
123292
|
+
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(f.path);
|
|
123293
|
+
invalidated = true;
|
|
123294
|
+
}
|
|
123295
|
+
});
|
|
123296
|
+
affectingPathChecksForFile = undefined;
|
|
123297
|
+
}
|
|
123202
123298
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks && !affectingPathChecks) {
|
|
123203
|
-
return
|
|
123299
|
+
return invalidated;
|
|
123300
|
+
}
|
|
123301
|
+
invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
|
|
123302
|
+
var packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
123303
|
+
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
123304
|
+
packageJsonMap.forEach(function (_value, path) { return isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : undefined; });
|
|
123204
123305
|
}
|
|
123205
|
-
var invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution);
|
|
123206
123306
|
failedLookupChecks = undefined;
|
|
123207
123307
|
startsWithPathChecks = undefined;
|
|
123208
123308
|
isInDirectoryChecks = undefined;
|
|
@@ -123215,17 +123315,15 @@ var ts;
|
|
|
123215
123315
|
return true;
|
|
123216
123316
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
|
|
123217
123317
|
return false;
|
|
123218
|
-
return resolution.failedLookupLocations.some(function (location) {
|
|
123219
|
-
|
|
123220
|
-
|
|
123221
|
-
|
|
123222
|
-
|
|
123223
|
-
|
|
123318
|
+
return resolution.failedLookupLocations.some(function (location) { return isInvalidatedFailedLookup(resolutionHost.toPath(location)); });
|
|
123319
|
+
}
|
|
123320
|
+
function isInvalidatedFailedLookup(locationPath) {
|
|
123321
|
+
return (failedLookupChecks === null || failedLookupChecks === void 0 ? void 0 : failedLookupChecks.has(locationPath)) ||
|
|
123322
|
+
ts.firstDefinedIterator((startsWithPathChecks === null || startsWithPathChecks === void 0 ? void 0 : startsWithPathChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return ts.startsWith(locationPath, fileOrDirectoryPath) ? true : undefined; }) ||
|
|
123323
|
+
ts.firstDefinedIterator((isInDirectoryChecks === null || isInDirectoryChecks === void 0 ? void 0 : isInDirectoryChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : undefined; });
|
|
123224
123324
|
}
|
|
123225
123325
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
123226
|
-
return !!affectingPathChecks && resolution.affectingLocations.some(function (location) {
|
|
123227
|
-
return affectingPathChecks.has(resolutionHost.toPath(location));
|
|
123228
|
-
});
|
|
123326
|
+
return !!affectingPathChecks && resolution.affectingLocations.some(function (location) { return affectingPathChecks.has(location); });
|
|
123229
123327
|
}
|
|
123230
123328
|
function closeTypeRootsWatch() {
|
|
123231
123329
|
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
|
|
@@ -123291,7 +123389,7 @@ var ts;
|
|
|
123291
123389
|
function directoryExistsForTypeRootWatch(nodeTypesDirectory) {
|
|
123292
123390
|
var dir = ts.getDirectoryPath(ts.getDirectoryPath(nodeTypesDirectory));
|
|
123293
123391
|
var dirPath = resolutionHost.toPath(dir);
|
|
123294
|
-
return dirPath === rootPath ||
|
|
123392
|
+
return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
|
|
123295
123393
|
}
|
|
123296
123394
|
}
|
|
123297
123395
|
ts.createResolutionCache = createResolutionCache;
|
|
@@ -124264,23 +124362,46 @@ var ts;
|
|
|
124264
124362
|
var file = _c[_i];
|
|
124265
124363
|
write("" + toFileName(file, relativeFileName));
|
|
124266
124364
|
(_a = reasons.get(file.path)) === null || _a === void 0 ? void 0 : _a.forEach(function (reason) { return write(" " + fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText); });
|
|
124267
|
-
(_b =
|
|
124365
|
+
(_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) === null || _b === void 0 ? void 0 : _b.forEach(function (d) { return write(" " + d.messageText); });
|
|
124268
124366
|
}
|
|
124269
124367
|
}
|
|
124270
124368
|
ts.explainFiles = explainFiles;
|
|
124271
|
-
function
|
|
124369
|
+
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
124370
|
+
var _a;
|
|
124272
124371
|
var result;
|
|
124273
124372
|
if (file.path !== file.resolvedPath) {
|
|
124274
|
-
(result
|
|
124373
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124275
124374
|
/*details*/ undefined, ts.Diagnostics.File_is_output_of_project_reference_source_0, toFileName(file.originalFileName, fileNameConvertor)));
|
|
124276
124375
|
}
|
|
124277
124376
|
if (file.redirectInfo) {
|
|
124278
|
-
(result
|
|
124377
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124279
124378
|
/*details*/ undefined, ts.Diagnostics.File_redirects_to_file_0, toFileName(file.redirectInfo.redirectTarget, fileNameConvertor)));
|
|
124280
124379
|
}
|
|
124380
|
+
if (ts.isExternalOrCommonJsModule(file)) {
|
|
124381
|
+
switch (file.impliedNodeFormat) {
|
|
124382
|
+
case ts.ModuleKind.ESNext:
|
|
124383
|
+
if (file.packageJsonScope) {
|
|
124384
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124385
|
+
/*details*/ undefined, ts.Diagnostics.File_is_ECMAScript_module_because_0_has_field_type_with_value_module, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor)));
|
|
124386
|
+
}
|
|
124387
|
+
break;
|
|
124388
|
+
case ts.ModuleKind.CommonJS:
|
|
124389
|
+
if (file.packageJsonScope) {
|
|
124390
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124391
|
+
/*details*/ undefined, file.packageJsonScope.packageJsonContent.type ?
|
|
124392
|
+
ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module :
|
|
124393
|
+
ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor)));
|
|
124394
|
+
}
|
|
124395
|
+
else if ((_a = file.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) {
|
|
124396
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124397
|
+
/*details*/ undefined, ts.Diagnostics.File_is_CommonJS_module_because_package_json_was_not_found));
|
|
124398
|
+
}
|
|
124399
|
+
break;
|
|
124400
|
+
}
|
|
124401
|
+
}
|
|
124281
124402
|
return result;
|
|
124282
124403
|
}
|
|
124283
|
-
ts.
|
|
124404
|
+
ts.explainIfFileIsRedirectAndImpliedFormat = explainIfFileIsRedirectAndImpliedFormat;
|
|
124284
124405
|
function getMatchedFileSpec(program, fileName) {
|
|
124285
124406
|
var _a;
|
|
124286
124407
|
var configFile = program.getCompilerOptions().configFile;
|
|
@@ -124490,6 +124611,7 @@ var ts;
|
|
|
124490
124611
|
MissingFile: "Missing file",
|
|
124491
124612
|
WildcardDirectory: "Wild card directory",
|
|
124492
124613
|
FailedLookupLocations: "Failed Lookup Locations",
|
|
124614
|
+
AffectingFileLocation: "File location affecting resolution",
|
|
124493
124615
|
TypeRoots: "Type roots",
|
|
124494
124616
|
ConfigFileOfReferencedProject: "Config file of referened project",
|
|
124495
124617
|
ExtendedConfigOfReferencedProject: "Extended config file of referenced project",
|
|
@@ -124813,7 +124935,7 @@ var ts;
|
|
|
124813
124935
|
compilerHost.getCompilationSettings = function () { return compilerOptions; };
|
|
124814
124936
|
compilerHost.useSourceOfProjectReferenceRedirect = ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect);
|
|
124815
124937
|
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.
|
|
124938
|
+
compilerHost.watchAffectingFileLocation = function (file, cb) { return watchFile(file, cb, ts.PollingInterval.High, watchOptions, ts.WatchType.AffectingFileLocation); };
|
|
124817
124939
|
compilerHost.watchTypeRootsDirectory = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.TypeRoots); };
|
|
124818
124940
|
compilerHost.getCachedDirectoryStructureHost = function () { return cachedDirectoryStructureHost; };
|
|
124819
124941
|
compilerHost.scheduleInvalidateResolutionsOfFailedLookupLocations = scheduleInvalidateResolutionsOfFailedLookupLocations;
|
|
@@ -124847,6 +124969,9 @@ var ts;
|
|
|
124847
124969
|
return host.resolveTypeReferenceDirectives.apply(host, args);
|
|
124848
124970
|
}) :
|
|
124849
124971
|
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode); });
|
|
124972
|
+
compilerHost.getModuleResolutionCache = host.resolveModuleNames ?
|
|
124973
|
+
ts.maybeBind(host, host.getModuleResolutionCache) :
|
|
124974
|
+
(function () { return resolutionCache.getModuleResolutionCache(); });
|
|
124850
124975
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
124851
124976
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
124852
124977
|
synchronizeProgram();
|
|
@@ -124949,8 +125074,9 @@ var ts;
|
|
|
124949
125074
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
124950
125075
|
compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
|
|
124951
125076
|
compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
125077
|
+
var oldProgram = getCurrentProgram();
|
|
124952
125078
|
builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
124953
|
-
resolutionCache.finishCachingPerDirectoryResolution();
|
|
125079
|
+
resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
|
|
124954
125080
|
// Update watches
|
|
124955
125081
|
ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
|
|
124956
125082
|
if (needsUpdateInTypeRootWatch) {
|
|
@@ -125032,9 +125158,6 @@ var ts;
|
|
|
125032
125158
|
sourceFilesCache.set(path, false);
|
|
125033
125159
|
}
|
|
125034
125160
|
}
|
|
125035
|
-
if (sourceFile) {
|
|
125036
|
-
sourceFile.impliedNodeFormat = ts.getImpliedNodeFormatForFile(path, resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache(), compilerHost, compilerHost.getCompilationSettings());
|
|
125037
|
-
}
|
|
125038
125161
|
return sourceFile;
|
|
125039
125162
|
}
|
|
125040
125163
|
return hostSourceFile.sourceFile;
|
|
@@ -125550,6 +125673,7 @@ var ts;
|
|
|
125550
125673
|
compilerHost.getParsedCommandLine = function (fileName) { return parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName)); };
|
|
125551
125674
|
compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
|
|
125552
125675
|
compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
125676
|
+
compilerHost.getModuleResolutionCache = ts.maybeBind(host, host.getModuleResolutionCache);
|
|
125553
125677
|
var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
|
|
125554
125678
|
var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, /*options*/ undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
|
|
125555
125679
|
if (!compilerHost.resolveModuleNames) {
|