@typescript-deploys/pr-build 4.9.0-pr-50293-5 → 4.9.0-pr-50294-5
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/tsc.js +1767 -756
- package/lib/tsserver.js +1962 -893
- package/lib/tsserverlibrary.d.ts +39 -33
- package/lib/tsserverlibrary.js +1962 -893
- package/lib/typescript.d.ts +37 -30
- package/lib/typescript.js +1902 -842
- package/lib/typescriptServices.d.ts +37 -30
- package/lib/typescriptServices.js +1902 -842
- package/lib/typingsInstaller.js +1857 -801
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -6678,6 +6678,8 @@ var ts;
|
|
|
6678
6678
|
Found_1_error_in_1: diag(6259, ts.DiagnosticCategory.Message, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
|
|
6679
6679
|
Found_0_errors_in_the_same_file_starting_at_Colon_1: diag(6260, ts.DiagnosticCategory.Message, "Found_0_errors_in_the_same_file_starting_at_Colon_1_6260", "Found {0} errors in the same file, starting at: {1}"),
|
|
6680
6680
|
Found_0_errors_in_1_files: diag(6261, ts.DiagnosticCategory.Message, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
6681
|
+
Directory_0_resolves_to_1_scope_according_to_cache: diag(6263, ts.DiagnosticCategory.Message, "Directory_0_resolves_to_1_scope_according_to_cache_6263", "Directory '{0}' resolves to '{1}' scope according to cache."),
|
|
6682
|
+
Directory_0_has_no_containing_package_json_scope_according_to_cache: diag(6264, ts.DiagnosticCategory.Message, "Directory_0_has_no_containing_package_json_scope_according_to_cache_6264", "Directory '{0}' has no containing package.json scope according to cache."),
|
|
6681
6683
|
Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, ts.DiagnosticCategory.Message, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
|
|
6682
6684
|
Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, ts.DiagnosticCategory.Message, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
6683
6685
|
Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, ts.DiagnosticCategory.Message, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
|
|
@@ -6862,6 +6864,7 @@ var ts;
|
|
|
6862
6864
|
Specify_how_the_TypeScript_watch_mode_works: diag(6715, ts.DiagnosticCategory.Message, "Specify_how_the_TypeScript_watch_mode_works_6715", "Specify how the TypeScript watch mode works."),
|
|
6863
6865
|
Require_undeclared_properties_from_index_signatures_to_use_element_accesses: diag(6717, ts.DiagnosticCategory.Message, "Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717", "Require undeclared properties from index signatures to use element accesses."),
|
|
6864
6866
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, ts.DiagnosticCategory.Message, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
|
6867
|
+
Save_resolutions_into_tsbuildinfo_file_and_use_them_for_incremental_compilation: diag(6719, ts.DiagnosticCategory.Message, "Save_resolutions_into_tsbuildinfo_file_and_use_them_for_incremental_compilation_6719", "Save resolutions into .tsbuildinfo file and use them for incremental compilation."),
|
|
6865
6868
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, ts.DiagnosticCategory.Message, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
|
6866
6869
|
one_of_Colon: diag(6900, ts.DiagnosticCategory.Message, "one_of_Colon_6900", "one of:"),
|
|
6867
6870
|
one_or_more_Colon: diag(6901, ts.DiagnosticCategory.Message, "one_or_more_Colon_6901", "one or more:"),
|
|
@@ -10999,7 +11002,8 @@ var ts;
|
|
|
10999
11002
|
}
|
|
11000
11003
|
ts.changesAffectModuleResolution = changesAffectModuleResolution;
|
|
11001
11004
|
function optionsHaveModuleResolutionChanges(oldOptions, newOptions) {
|
|
11002
|
-
return
|
|
11005
|
+
return oldOptions.pathsBasePath !== newOptions.pathsBasePath ||
|
|
11006
|
+
optionsHaveChanges(oldOptions, newOptions, ts.moduleResolutionOptionDeclarations);
|
|
11003
11007
|
}
|
|
11004
11008
|
ts.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges;
|
|
11005
11009
|
function changesAffectingProgramStructure(oldOptions, newOptions) {
|
|
@@ -11071,21 +11075,20 @@ var ts;
|
|
|
11071
11075
|
}
|
|
11072
11076
|
ts.getFullWidth = getFullWidth;
|
|
11073
11077
|
function getResolvedModule(sourceFile, moduleNameText, mode) {
|
|
11074
|
-
|
|
11078
|
+
var _a, _b;
|
|
11079
|
+
return (_b = (_a = sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.get(moduleNameText, mode)) === null || _b === void 0 ? void 0 : _b.resolvedModule;
|
|
11075
11080
|
}
|
|
11076
11081
|
ts.getResolvedModule = getResolvedModule;
|
|
11077
11082
|
function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
|
|
11078
|
-
|
|
11079
|
-
|
|
11080
|
-
}
|
|
11083
|
+
var _a;
|
|
11084
|
+
(_a = sourceFile.resolvedModules) !== null && _a !== void 0 ? _a : (sourceFile.resolvedModules = ts.createModeAwareCache());
|
|
11081
11085
|
sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
|
|
11082
11086
|
}
|
|
11083
11087
|
ts.setResolvedModule = setResolvedModule;
|
|
11084
|
-
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {
|
|
11085
|
-
|
|
11086
|
-
|
|
11087
|
-
|
|
11088
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, undefined, resolvedTypeReferenceDirective);
|
|
11088
|
+
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective, mode) {
|
|
11089
|
+
var _a;
|
|
11090
|
+
(_a = sourceFile.resolvedTypeReferenceDirectiveNames) !== null && _a !== void 0 ? _a : (sourceFile.resolvedTypeReferenceDirectiveNames = ts.createModeAwareCache());
|
|
11091
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, mode, resolvedTypeReferenceDirective);
|
|
11089
11092
|
}
|
|
11090
11093
|
ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;
|
|
11091
11094
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
@@ -11095,11 +11098,15 @@ var ts;
|
|
|
11095
11098
|
}
|
|
11096
11099
|
ts.projectReferenceIsEqualTo = projectReferenceIsEqualTo;
|
|
11097
11100
|
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
11098
|
-
return oldResolution
|
|
11099
|
-
oldResolution.
|
|
11100
|
-
oldResolution.
|
|
11101
|
-
|
|
11102
|
-
|
|
11101
|
+
return oldResolution === newResolution ||
|
|
11102
|
+
oldResolution.resolvedModule === newResolution.resolvedModule ||
|
|
11103
|
+
!!oldResolution.resolvedModule &&
|
|
11104
|
+
!!newResolution.resolvedModule &&
|
|
11105
|
+
oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport &&
|
|
11106
|
+
oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension &&
|
|
11107
|
+
oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName &&
|
|
11108
|
+
oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath &&
|
|
11109
|
+
packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId);
|
|
11103
11110
|
}
|
|
11104
11111
|
ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo;
|
|
11105
11112
|
function packageIdIsEqual(a, b) {
|
|
@@ -11115,9 +11122,13 @@ var ts;
|
|
|
11115
11122
|
}
|
|
11116
11123
|
ts.packageIdToString = packageIdToString;
|
|
11117
11124
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
11118
|
-
return oldResolution
|
|
11119
|
-
|
|
11120
|
-
|
|
11125
|
+
return oldResolution === newResolution ||
|
|
11126
|
+
oldResolution.resolvedTypeReferenceDirective === newResolution.resolvedTypeReferenceDirective ||
|
|
11127
|
+
!!oldResolution.resolvedTypeReferenceDirective &&
|
|
11128
|
+
!!newResolution.resolvedTypeReferenceDirective &&
|
|
11129
|
+
oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName &&
|
|
11130
|
+
!!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary &&
|
|
11131
|
+
oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
|
|
11121
11132
|
}
|
|
11122
11133
|
ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;
|
|
11123
11134
|
function hasChangesInResolutions(names, newResolutions, oldResolutions, oldSourceFile, comparer) {
|
|
@@ -15317,15 +15328,15 @@ var ts;
|
|
|
15317
15328
|
}
|
|
15318
15329
|
ts.base64decode = base64decode;
|
|
15319
15330
|
function readJsonOrUndefined(path, hostOrText) {
|
|
15320
|
-
var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path);
|
|
15331
|
+
var jsonText = ts.isString(hostOrText) || hostOrText === undefined ? hostOrText : hostOrText.readFile(path);
|
|
15321
15332
|
if (!jsonText)
|
|
15322
15333
|
return undefined;
|
|
15323
15334
|
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
15324
15335
|
return !result.error ? result.config : undefined;
|
|
15325
15336
|
}
|
|
15326
15337
|
ts.readJsonOrUndefined = readJsonOrUndefined;
|
|
15327
|
-
function readJson(path,
|
|
15328
|
-
return readJsonOrUndefined(path,
|
|
15338
|
+
function readJson(path, hostOrText) {
|
|
15339
|
+
return readJsonOrUndefined(path, hostOrText) || {};
|
|
15329
15340
|
}
|
|
15330
15341
|
ts.readJson = readJson;
|
|
15331
15342
|
function directoryProbablyExists(directoryName, host) {
|
|
@@ -16305,14 +16316,15 @@ var ts;
|
|
|
16305
16316
|
},
|
|
16306
16317
|
setSymlinksFromResolutions: function (files, typeReferenceDirectives) {
|
|
16307
16318
|
var _this = this;
|
|
16308
|
-
var _a;
|
|
16319
|
+
var _a, _b;
|
|
16309
16320
|
ts.Debug.assert(!hasProcessedResolutions);
|
|
16310
16321
|
hasProcessedResolutions = true;
|
|
16311
16322
|
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
16312
16323
|
var file = files_1[_i];
|
|
16313
|
-
(_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function (resolution) { return processResolution(_this, resolution); });
|
|
16324
|
+
(_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function (resolution) { return processResolution(_this, resolution === null || resolution === void 0 ? void 0 : resolution.resolvedModule); });
|
|
16325
|
+
(_b = file.resolvedTypeReferenceDirectiveNames) === null || _b === void 0 ? void 0 : _b.forEach(function (resolution) { return processResolution(_this, resolution === null || resolution === void 0 ? void 0 : resolution.resolvedTypeReferenceDirective); });
|
|
16314
16326
|
}
|
|
16315
|
-
typeReferenceDirectives
|
|
16327
|
+
typeReferenceDirectives.forEach(function (resolution) { return processResolution(_this, resolution.resolvedTypeReferenceDirective); });
|
|
16316
16328
|
},
|
|
16317
16329
|
hasProcessedResolutions: function () { return hasProcessedResolutions; },
|
|
16318
16330
|
};
|
|
@@ -32391,6 +32403,17 @@ var ts;
|
|
|
32391
32403
|
transpileOptionValue: undefined,
|
|
32392
32404
|
defaultValueDescription: ts.Diagnostics.false_unless_composite_is_set
|
|
32393
32405
|
},
|
|
32406
|
+
{
|
|
32407
|
+
name: "cacheResolutions",
|
|
32408
|
+
type: "boolean",
|
|
32409
|
+
category: ts.Diagnostics.Projects,
|
|
32410
|
+
description: ts.Diagnostics.Save_resolutions_into_tsbuildinfo_file_and_use_them_for_incremental_compilation,
|
|
32411
|
+
affectsModuleResolution: true,
|
|
32412
|
+
affectsMultiFileEmitBuildInfo: true,
|
|
32413
|
+
affectsBundleEmitBuildInfo: true,
|
|
32414
|
+
transpileOptionValue: undefined,
|
|
32415
|
+
defaultValueDescription: false,
|
|
32416
|
+
},
|
|
32394
32417
|
{
|
|
32395
32418
|
name: "assumeChangesOnlyAffectDirectDependencies",
|
|
32396
32419
|
type: "boolean",
|
|
@@ -34347,6 +34370,9 @@ var ts;
|
|
|
34347
34370
|
if (result.configFilePath) {
|
|
34348
34371
|
result.configFilePath = toAbsolutePath(result.configFilePath);
|
|
34349
34372
|
}
|
|
34373
|
+
if (result.pathsBasePath) {
|
|
34374
|
+
result.pathsBasePath = toAbsolutePath(result.pathsBasePath);
|
|
34375
|
+
}
|
|
34350
34376
|
return result;
|
|
34351
34377
|
}
|
|
34352
34378
|
ts.convertToOptionsWithAbsolutePaths = convertToOptionsWithAbsolutePaths;
|
|
@@ -35172,20 +35198,35 @@ var ts;
|
|
|
35172
35198
|
ts.Debug.assert(ts.extensionIsTS(resolved.extension));
|
|
35173
35199
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
35174
35200
|
}
|
|
35175
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
|
|
35176
|
-
var _a
|
|
35201
|
+
function createResolvedModuleWithFailedLookupLocations(compilerOptions, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
|
|
35202
|
+
var _a;
|
|
35203
|
+
var _b;
|
|
35177
35204
|
if (resultFromCache) {
|
|
35178
|
-
(
|
|
35179
|
-
|
|
35205
|
+
if ((!compilerOptions.cacheResolutions || !((_b = resultFromCache.resolvedModule) === null || _b === void 0 ? void 0 : _b.resolvedFileName)) && failedLookupLocations.length)
|
|
35206
|
+
(_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
35207
|
+
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
35208
|
+
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
35180
35209
|
return resultFromCache;
|
|
35181
35210
|
}
|
|
35182
35211
|
return {
|
|
35183
35212
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
|
|
35184
|
-
failedLookupLocations: failedLookupLocations,
|
|
35185
|
-
affectingLocations: affectingLocations,
|
|
35186
|
-
resolutionDiagnostics: diagnostics,
|
|
35213
|
+
failedLookupLocations: !compilerOptions.cacheResolutions || !(resolved === null || resolved === void 0 ? void 0 : resolved.path) ? failedLookupLocations : ts.emptyArray,
|
|
35214
|
+
affectingLocations: initializeResolutionField(affectingLocations),
|
|
35215
|
+
resolutionDiagnostics: initializeResolutionField(diagnostics),
|
|
35187
35216
|
};
|
|
35188
35217
|
}
|
|
35218
|
+
function initializeResolutionField(value) {
|
|
35219
|
+
return value.length ? value : undefined;
|
|
35220
|
+
}
|
|
35221
|
+
function updateResolutionField(to, value) {
|
|
35222
|
+
if (!(value === null || value === void 0 ? void 0 : value.length))
|
|
35223
|
+
return to;
|
|
35224
|
+
if (!(to === null || to === void 0 ? void 0 : to.length))
|
|
35225
|
+
return value;
|
|
35226
|
+
to.push.apply(to, value);
|
|
35227
|
+
return to;
|
|
35228
|
+
}
|
|
35229
|
+
ts.updateResolutionField = updateResolutionField;
|
|
35189
35230
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
35190
35231
|
if (!ts.hasProperty(jsonContent, fieldName)) {
|
|
35191
35232
|
if (state.traceEnabled) {
|
|
@@ -35324,8 +35365,7 @@ var ts;
|
|
|
35324
35365
|
options = redirectedReference.commandLine.options;
|
|
35325
35366
|
}
|
|
35326
35367
|
var containingDirectory = containingFile ? ts.getDirectoryPath(containingFile) : undefined;
|
|
35327
|
-
var
|
|
35328
|
-
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName, resolutionMode);
|
|
35368
|
+
var result = containingDirectory ? cache === null || cache === void 0 ? void 0 : cache.getFromCache(containingDirectory, typeReferenceDirectiveName, resolutionMode, redirectedReference) : undefined;
|
|
35329
35369
|
if (result) {
|
|
35330
35370
|
if (traceEnabled) {
|
|
35331
35371
|
trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
|
|
@@ -35376,7 +35416,7 @@ var ts;
|
|
|
35376
35416
|
features: features,
|
|
35377
35417
|
conditions: conditions,
|
|
35378
35418
|
requestContainingDirectory: containingDirectory,
|
|
35379
|
-
|
|
35419
|
+
reportResolutionDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
35380
35420
|
};
|
|
35381
35421
|
var resolved = primaryLookup();
|
|
35382
35422
|
var primary = true;
|
|
@@ -35397,8 +35437,15 @@ var ts;
|
|
|
35397
35437
|
isExternalLibraryImport: pathContainsNodeModules(fileName),
|
|
35398
35438
|
};
|
|
35399
35439
|
}
|
|
35400
|
-
result = {
|
|
35401
|
-
|
|
35440
|
+
result = {
|
|
35441
|
+
resolvedTypeReferenceDirective: resolvedTypeReferenceDirective,
|
|
35442
|
+
failedLookupLocations: !options.cacheResolutions || !(resolvedTypeReferenceDirective === null || resolvedTypeReferenceDirective === void 0 ? void 0 : resolvedTypeReferenceDirective.resolvedFileName) ? failedLookupLocations : ts.emptyArray,
|
|
35443
|
+
affectingLocations: initializeResolutionField(affectingLocations),
|
|
35444
|
+
resolutionDiagnostics: initializeResolutionField(diagnostics),
|
|
35445
|
+
};
|
|
35446
|
+
if (containingDirectory && cache) {
|
|
35447
|
+
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(typeReferenceDirectiveName, resolutionMode, result);
|
|
35448
|
+
}
|
|
35402
35449
|
if (traceEnabled)
|
|
35403
35450
|
traceResult(result);
|
|
35404
35451
|
return result;
|
|
@@ -35408,10 +35455,10 @@ var ts;
|
|
|
35408
35455
|
trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName);
|
|
35409
35456
|
}
|
|
35410
35457
|
else if (result.resolvedTypeReferenceDirective.packageId) {
|
|
35411
|
-
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, ts.packageIdToString(result.resolvedTypeReferenceDirective.packageId), result.resolvedTypeReferenceDirective.primary);
|
|
35458
|
+
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, ts.packageIdToString(result.resolvedTypeReferenceDirective.packageId), !!result.resolvedTypeReferenceDirective.primary);
|
|
35412
35459
|
}
|
|
35413
35460
|
else {
|
|
35414
|
-
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, result.resolvedTypeReferenceDirective.primary);
|
|
35461
|
+
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, !!result.resolvedTypeReferenceDirective.primary);
|
|
35415
35462
|
}
|
|
35416
35463
|
}
|
|
35417
35464
|
function primaryLookup() {
|
|
@@ -35506,62 +35553,181 @@ var ts;
|
|
|
35506
35553
|
return result;
|
|
35507
35554
|
}
|
|
35508
35555
|
ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
|
|
35509
|
-
function
|
|
35510
|
-
|
|
35556
|
+
function getPackageJsconLocationFromScope(scope) {
|
|
35557
|
+
return ts.lastOrUndefined(scope.affectingLocations);
|
|
35558
|
+
}
|
|
35559
|
+
ts.getPackageJsconLocationFromScope = getPackageJsconLocationFromScope;
|
|
35560
|
+
function compilerOptionValueToString(value) {
|
|
35561
|
+
var _a;
|
|
35562
|
+
if (value === null || typeof value !== "object") {
|
|
35563
|
+
return "" + value;
|
|
35564
|
+
}
|
|
35565
|
+
if (ts.isArray(value)) {
|
|
35566
|
+
return "[" + ((_a = ts.map(value, function (e) { return compilerOptionValueToString(e); })) === null || _a === void 0 ? void 0 : _a.join(",")) + "]";
|
|
35567
|
+
}
|
|
35568
|
+
var str = "{";
|
|
35569
|
+
for (var key in value) {
|
|
35570
|
+
if (ts.hasProperty(value, key)) {
|
|
35571
|
+
str += key + ": " + compilerOptionValueToString(value[key]);
|
|
35572
|
+
}
|
|
35573
|
+
}
|
|
35574
|
+
return str + "}";
|
|
35575
|
+
}
|
|
35576
|
+
function getKeyForCompilationSettings(settings, options) {
|
|
35577
|
+
return options.map(function (option) { return compilerOptionValueToString(ts.getCompilerOptionValue(settings, option)); }).join("|") + ("|" + settings.pathsBasePath);
|
|
35578
|
+
}
|
|
35579
|
+
ts.getKeyForCompilationSettings = getKeyForCompilationSettings;
|
|
35580
|
+
function getRedirectsCacheKey(options) {
|
|
35581
|
+
return getKeyForCompilationSettings(options, ts.moduleResolutionOptionDeclarations);
|
|
35582
|
+
}
|
|
35583
|
+
ts.getRedirectsCacheKey = getRedirectsCacheKey;
|
|
35584
|
+
function createCacheWithRedirects(ownOptions) {
|
|
35585
|
+
var ownMap;
|
|
35586
|
+
var ownKey;
|
|
35587
|
+
var redirectsKeyToCache = new ts.Map();
|
|
35511
35588
|
var redirectsMap = new ts.Map();
|
|
35512
35589
|
return {
|
|
35513
35590
|
getOwnMap: getOwnMap,
|
|
35514
|
-
|
|
35591
|
+
redirectsKeyToCache: redirectsKeyToCache,
|
|
35592
|
+
createMapForCompilerOptions: createMapForCompilerOptions,
|
|
35593
|
+
getMapOfCacheRedirects: getMapOfCacheRedirects,
|
|
35515
35594
|
getOrCreateMapOfCacheRedirects: getOrCreateMapOfCacheRedirects,
|
|
35516
35595
|
clear: clear,
|
|
35517
|
-
|
|
35518
|
-
|
|
35596
|
+
update: update,
|
|
35597
|
+
clearRedirectsMap: function () { return redirectsMap.clear(); },
|
|
35519
35598
|
};
|
|
35520
|
-
function
|
|
35521
|
-
|
|
35599
|
+
function ensureOwnKeyCached() {
|
|
35600
|
+
ownKey !== null && ownKey !== void 0 ? ownKey : (ownKey = ownOptions && getRedirectsCacheKey(ownOptions));
|
|
35601
|
+
if (ownKey && !redirectsKeyToCache.has(ownKey))
|
|
35602
|
+
redirectsKeyToCache.set(ownKey, { map: ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map()), options: ownOptions });
|
|
35522
35603
|
}
|
|
35523
|
-
function
|
|
35524
|
-
options
|
|
35604
|
+
function createMapForCompilerOptions(options, optionsKey) {
|
|
35605
|
+
if (options === ownOptions)
|
|
35606
|
+
return ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map());
|
|
35607
|
+
return getOrCreateRedirectMapAndKey(options, undefined, optionsKey);
|
|
35525
35608
|
}
|
|
35526
|
-
function
|
|
35527
|
-
|
|
35609
|
+
function getOrCreateRedirectMapAndKey(options, path, optionsKey) {
|
|
35610
|
+
var _a;
|
|
35611
|
+
if (path || options.configFile) {
|
|
35612
|
+
var redirects = redirectsMap.get(path || options.configFile.path);
|
|
35613
|
+
if (redirects)
|
|
35614
|
+
return redirects;
|
|
35615
|
+
}
|
|
35616
|
+
var key = optionsKey || getRedirectsCacheKey(options);
|
|
35617
|
+
var map = (_a = redirectsKeyToCache.get(key)) === null || _a === void 0 ? void 0 : _a.map;
|
|
35618
|
+
if (!map) {
|
|
35619
|
+
ensureOwnKeyCached();
|
|
35620
|
+
if (ownKey === key) {
|
|
35621
|
+
map = ownMap;
|
|
35622
|
+
}
|
|
35623
|
+
else {
|
|
35624
|
+
redirectsKeyToCache.set(key, { map: map = new ts.Map(), options: options });
|
|
35625
|
+
}
|
|
35626
|
+
}
|
|
35627
|
+
if (path || options.configFile)
|
|
35628
|
+
redirectsMap.set(path || options.configFile.path, map);
|
|
35629
|
+
return map;
|
|
35528
35630
|
}
|
|
35529
|
-
function
|
|
35530
|
-
|
|
35531
|
-
|
|
35631
|
+
function getOwnMap() {
|
|
35632
|
+
return ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map());
|
|
35633
|
+
}
|
|
35634
|
+
function update(newOwnOptions) {
|
|
35635
|
+
if (ownMap && (ownOptions === null || ownOptions === void 0 ? void 0 : ownOptions.configFile)) {
|
|
35636
|
+
ensureOwnKeyCached();
|
|
35637
|
+
if (!redirectsMap.has(ownOptions.configFile.path)) {
|
|
35638
|
+
redirectsMap.set(ownOptions.configFile.path, ownMap);
|
|
35639
|
+
}
|
|
35640
|
+
}
|
|
35641
|
+
if (newOwnOptions.configFile) {
|
|
35642
|
+
var existing_1 = redirectsMap.get(newOwnOptions.configFile.path);
|
|
35643
|
+
if (existing_1) {
|
|
35644
|
+
ownMap = existing_1;
|
|
35645
|
+
ownOptions = newOwnOptions;
|
|
35646
|
+
return;
|
|
35647
|
+
}
|
|
35532
35648
|
}
|
|
35533
|
-
var
|
|
35534
|
-
var
|
|
35535
|
-
|
|
35536
|
-
|
|
35537
|
-
|
|
35649
|
+
var key = getRedirectsCacheKey(newOwnOptions);
|
|
35650
|
+
var existing = redirectsKeyToCache.get(key);
|
|
35651
|
+
ownMap = (existing === null || existing === void 0 ? void 0 : existing.map) || new ts.Map();
|
|
35652
|
+
ownKey = key;
|
|
35653
|
+
ownOptions = newOwnOptions;
|
|
35654
|
+
if (newOwnOptions.configFile)
|
|
35655
|
+
redirectsMap.set(newOwnOptions.configFile.path, ownMap);
|
|
35656
|
+
}
|
|
35657
|
+
function getMapOfCacheRedirects(redirectedReference) {
|
|
35658
|
+
if (!redirectedReference)
|
|
35659
|
+
return ownMap;
|
|
35660
|
+
var directResult = redirectsMap.get(redirectedReference.sourceFile.path);
|
|
35661
|
+
if (directResult)
|
|
35662
|
+
return directResult;
|
|
35663
|
+
var key = getRedirectsCacheKey(redirectedReference.commandLine.options);
|
|
35664
|
+
var fromKey = redirectsKeyToCache.get(key);
|
|
35665
|
+
if (fromKey) {
|
|
35666
|
+
redirectsMap.set(redirectedReference.sourceFile.path, fromKey.map);
|
|
35667
|
+
return fromKey.map;
|
|
35668
|
+
}
|
|
35669
|
+
if (ownMap)
|
|
35670
|
+
ensureOwnKeyCached();
|
|
35671
|
+
if (ownKey === key) {
|
|
35672
|
+
redirectsMap.set(redirectedReference.sourceFile.path, ownMap);
|
|
35673
|
+
return ownMap;
|
|
35538
35674
|
}
|
|
35539
|
-
return
|
|
35675
|
+
return undefined;
|
|
35676
|
+
}
|
|
35677
|
+
function getOrCreateMapOfCacheRedirects(redirectedReference) {
|
|
35678
|
+
return !redirectedReference || redirectedReference.commandLine.options === ownOptions ?
|
|
35679
|
+
getOwnMap() :
|
|
35680
|
+
getOrCreateRedirectMapAndKey(redirectedReference.commandLine.options, redirectedReference.sourceFile.path, undefined);
|
|
35540
35681
|
}
|
|
35541
35682
|
function clear() {
|
|
35542
|
-
|
|
35683
|
+
ownKey = undefined;
|
|
35684
|
+
ownMap = undefined;
|
|
35543
35685
|
redirectsMap.clear();
|
|
35686
|
+
redirectsKeyToCache.clear();
|
|
35544
35687
|
}
|
|
35545
35688
|
}
|
|
35546
35689
|
ts.createCacheWithRedirects = createCacheWithRedirects;
|
|
35547
|
-
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
35548
|
-
var
|
|
35549
|
-
|
|
35690
|
+
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName, cache) {
|
|
35691
|
+
var dirToPackageJsonScope = new ts.Map();
|
|
35692
|
+
var oldPackageJsonInfoCache;
|
|
35693
|
+
return {
|
|
35694
|
+
getPackageJsonInfo: getPackageJsonInfo,
|
|
35695
|
+
setPackageJsonInfo: setPackageJsonInfo,
|
|
35696
|
+
clear: clear,
|
|
35697
|
+
entries: entries,
|
|
35698
|
+
getInternalMap: function () { return cache; },
|
|
35699
|
+
setInternalMap: function (value) { return cache = value; },
|
|
35700
|
+
clone: clone,
|
|
35701
|
+
getPackageJsonScope: getPackageJsonScope,
|
|
35702
|
+
setPackageJsonScope: setPackageJsonScope,
|
|
35703
|
+
setOldPackageJsonScopeCache: function (cache) { return oldPackageJsonInfoCache = cache; },
|
|
35704
|
+
};
|
|
35550
35705
|
function getPackageJsonInfo(packageJsonPath) {
|
|
35551
|
-
return cache === null || cache === void 0 ? void 0 : cache.get(
|
|
35706
|
+
return cache === null || cache === void 0 ? void 0 : cache.get(toPath(packageJsonPath));
|
|
35552
35707
|
}
|
|
35553
35708
|
function setPackageJsonInfo(packageJsonPath, info) {
|
|
35554
|
-
(cache || (cache = new ts.Map())).set(
|
|
35709
|
+
(cache || (cache = new ts.Map())).set(toPath(packageJsonPath), info);
|
|
35555
35710
|
}
|
|
35556
35711
|
function clear() {
|
|
35712
|
+
oldPackageJsonInfoCache = undefined;
|
|
35557
35713
|
cache = undefined;
|
|
35714
|
+
dirToPackageJsonScope.clear();
|
|
35558
35715
|
}
|
|
35559
35716
|
function entries() {
|
|
35560
35717
|
var iter = cache === null || cache === void 0 ? void 0 : cache.entries();
|
|
35561
35718
|
return iter ? ts.arrayFrom(iter) : [];
|
|
35562
35719
|
}
|
|
35563
|
-
function
|
|
35564
|
-
return cache;
|
|
35720
|
+
function clone() {
|
|
35721
|
+
return createPackageJsonInfoCache(currentDirectory, getCanonicalFileName, cache && new ts.Map(cache));
|
|
35722
|
+
}
|
|
35723
|
+
function getPackageJsonScope(dir) {
|
|
35724
|
+
return dirToPackageJsonScope.get(dir) || (oldPackageJsonInfoCache === null || oldPackageJsonInfoCache === void 0 ? void 0 : oldPackageJsonInfoCache.getPackageJsonScope(dir));
|
|
35725
|
+
}
|
|
35726
|
+
function setPackageJsonScope(dir, scope) {
|
|
35727
|
+
moduleNameToDirectorySet(dirToPackageJsonScope, dir, scope, getPackageJsconLocationFromScope, toPath, ts.noop);
|
|
35728
|
+
}
|
|
35729
|
+
function toPath(file) {
|
|
35730
|
+
return ts.toPath(file, currentDirectory, getCanonicalFileName);
|
|
35565
35731
|
}
|
|
35566
35732
|
}
|
|
35567
35733
|
function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
|
|
@@ -35573,45 +35739,43 @@ var ts;
|
|
|
35573
35739
|
}
|
|
35574
35740
|
return result;
|
|
35575
35741
|
}
|
|
35576
|
-
function
|
|
35577
|
-
|
|
35578
|
-
|
|
35579
|
-
if (directoryToModuleNameMap.redirectsMap.size === 0) {
|
|
35580
|
-
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size === 0);
|
|
35581
|
-
ts.Debug.assert(directoryToModuleNameMap.getOwnMap().size === 0);
|
|
35582
|
-
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.getOwnMap().size === 0);
|
|
35583
|
-
directoryToModuleNameMap.redirectsMap.set(options.configFile.path, directoryToModuleNameMap.getOwnMap());
|
|
35584
|
-
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.redirectsMap.set(options.configFile.path, moduleNameToDirectoryMap.getOwnMap());
|
|
35585
|
-
}
|
|
35586
|
-
else {
|
|
35587
|
-
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size > 0);
|
|
35588
|
-
var ref = {
|
|
35589
|
-
sourceFile: options.configFile,
|
|
35590
|
-
commandLine: { options: options }
|
|
35591
|
-
};
|
|
35592
|
-
directoryToModuleNameMap.setOwnMap(directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
|
|
35593
|
-
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnMap(moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
|
|
35594
|
-
}
|
|
35595
|
-
directoryToModuleNameMap.setOwnOptions(options);
|
|
35596
|
-
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnOptions(options);
|
|
35597
|
-
}
|
|
35598
|
-
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap) {
|
|
35742
|
+
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
35743
|
+
var directoryToModuleNameMap = createCacheWithRedirects(options);
|
|
35744
|
+
var oldResolutionCache;
|
|
35599
35745
|
return {
|
|
35746
|
+
getFromCache: getFromCache,
|
|
35600
35747
|
getOrCreateCacheForDirectory: getOrCreateCacheForDirectory,
|
|
35601
35748
|
clear: clear,
|
|
35602
35749
|
update: update,
|
|
35750
|
+
setOldResolutionCache: function (cache) { return oldResolutionCache = cache; }
|
|
35603
35751
|
};
|
|
35604
35752
|
function clear() {
|
|
35753
|
+
oldResolutionCache = undefined;
|
|
35605
35754
|
directoryToModuleNameMap.clear();
|
|
35606
35755
|
}
|
|
35607
35756
|
function update(options) {
|
|
35608
|
-
|
|
35757
|
+
directoryToModuleNameMap.update(options);
|
|
35609
35758
|
}
|
|
35610
35759
|
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
|
|
35611
35760
|
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
35612
|
-
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path,
|
|
35761
|
+
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, createModeAwareCache);
|
|
35762
|
+
}
|
|
35763
|
+
function getFromCache(directoryName, name, mode, redirectedReference) {
|
|
35764
|
+
var _a, _b;
|
|
35765
|
+
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
35766
|
+
var result = (_b = (_a = directoryToModuleNameMap.getMapOfCacheRedirects(redirectedReference)) === null || _a === void 0 ? void 0 : _a.get(path)) === null || _b === void 0 ? void 0 : _b.get(name, mode);
|
|
35767
|
+
if (result)
|
|
35768
|
+
return result;
|
|
35769
|
+
var resultFromOld = oldResolutionCache === null || oldResolutionCache === void 0 ? void 0 : oldResolutionCache.getResolved(path, name, mode, redirectedReference);
|
|
35770
|
+
if (resultFromOld)
|
|
35771
|
+
getOrCreateCacheForDirectory(directoryName, redirectedReference).set(name, mode, resultFromOld);
|
|
35772
|
+
return resultFromOld;
|
|
35613
35773
|
}
|
|
35614
35774
|
}
|
|
35775
|
+
function getModeAwareCacheKey(specifier, mode) {
|
|
35776
|
+
return (mode === undefined ? specifier : mode + "|" + specifier);
|
|
35777
|
+
}
|
|
35778
|
+
ts.getModeAwareCacheKey = getModeAwareCacheKey;
|
|
35615
35779
|
function createModeAwareCache() {
|
|
35616
35780
|
var underlying = new ts.Map();
|
|
35617
35781
|
var memoizedReverseKeys = new ts.Map();
|
|
@@ -35636,13 +35800,22 @@ var ts;
|
|
|
35636
35800
|
return cb(elem, specifier, mode);
|
|
35637
35801
|
});
|
|
35638
35802
|
},
|
|
35803
|
+
entries: function () {
|
|
35804
|
+
var keys = underlying.entries();
|
|
35805
|
+
return {
|
|
35806
|
+
next: function () {
|
|
35807
|
+
var next = keys.next();
|
|
35808
|
+
return !next.done ? { value: __spreadArray(__spreadArray([], memoizedReverseKeys.get(next.value[0]), true), [next.value[1]], false) } : next;
|
|
35809
|
+
},
|
|
35810
|
+
};
|
|
35811
|
+
},
|
|
35639
35812
|
size: function () {
|
|
35640
35813
|
return underlying.size;
|
|
35641
|
-
}
|
|
35814
|
+
},
|
|
35642
35815
|
};
|
|
35643
35816
|
return cache;
|
|
35644
35817
|
function getUnderlyingCacheKey(specifier, mode) {
|
|
35645
|
-
var result =
|
|
35818
|
+
var result = getModeAwareCacheKey(specifier, mode);
|
|
35646
35819
|
memoizedReverseKeys.set(result, [specifier, mode]);
|
|
35647
35820
|
return result;
|
|
35648
35821
|
}
|
|
@@ -35653,100 +35826,122 @@ var ts;
|
|
|
35653
35826
|
var map = createModeAwareCache();
|
|
35654
35827
|
for (var i = 0; i < keys.length; ++i) {
|
|
35655
35828
|
var entry = keys[i];
|
|
35656
|
-
var name = !ts.isString(entry) ? entry.fileName
|
|
35829
|
+
var name = !ts.isString(entry) ? ts.toFileNameLowerCase(entry.fileName) : entry;
|
|
35657
35830
|
var mode = !ts.isString(entry) ? entry.resolutionMode || file.impliedNodeFormat : ts.getModeForResolutionAtIndex(file, i);
|
|
35658
35831
|
map.set(name, mode, values[i]);
|
|
35659
35832
|
}
|
|
35660
35833
|
return map;
|
|
35661
35834
|
}
|
|
35662
35835
|
ts.zipToModeAwareCache = zipToModeAwareCache;
|
|
35663
|
-
function
|
|
35664
|
-
var
|
|
35665
|
-
|
|
35836
|
+
function getCommonPrefix(directory, resolution, toPath) {
|
|
35837
|
+
var resolutionDirectory = toPath(ts.getDirectoryPath(resolution));
|
|
35838
|
+
var i = 0;
|
|
35839
|
+
var limit = Math.min(directory.length, resolutionDirectory.length);
|
|
35840
|
+
while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
|
35841
|
+
i++;
|
|
35842
|
+
}
|
|
35843
|
+
if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts.directorySeparator)) {
|
|
35844
|
+
return directory;
|
|
35845
|
+
}
|
|
35846
|
+
var rootLength = ts.getRootLength(directory);
|
|
35847
|
+
if (i < rootLength) {
|
|
35848
|
+
return undefined;
|
|
35849
|
+
}
|
|
35850
|
+
var sep = directory.lastIndexOf(ts.directorySeparator, i - 1);
|
|
35851
|
+
if (sep === -1) {
|
|
35852
|
+
return undefined;
|
|
35853
|
+
}
|
|
35854
|
+
return directory.substr(0, Math.max(sep, rootLength));
|
|
35855
|
+
}
|
|
35856
|
+
function getResolvedFileNameForModuleNameToDirectorySet(result) {
|
|
35857
|
+
return result.resolvedModule &&
|
|
35858
|
+
(result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
35859
|
+
}
|
|
35860
|
+
ts.getResolvedFileNameForModuleNameToDirectorySet = getResolvedFileNameForModuleNameToDirectorySet;
|
|
35861
|
+
function moduleNameToDirectorySet(directoryPathMap, directory, result, getResolvedFileName, toPath, ancestoryWorker) {
|
|
35862
|
+
if (directoryPathMap.has(directory))
|
|
35863
|
+
return;
|
|
35864
|
+
directoryPathMap.set(directory, result);
|
|
35865
|
+
var resolvedFileName = getResolvedFileName(result);
|
|
35866
|
+
var commonPrefix = resolvedFileName && getCommonPrefix(directory, resolvedFileName, toPath);
|
|
35867
|
+
var current = directory;
|
|
35868
|
+
while (current !== commonPrefix) {
|
|
35869
|
+
var parent = ts.getDirectoryPath(current);
|
|
35870
|
+
if (parent === current)
|
|
35871
|
+
break;
|
|
35872
|
+
if (directoryPathMap.has(parent)) {
|
|
35873
|
+
ancestoryWorker(parent);
|
|
35874
|
+
break;
|
|
35875
|
+
}
|
|
35876
|
+
directoryPathMap.set(parent, result);
|
|
35877
|
+
ancestoryWorker(parent);
|
|
35878
|
+
current = parent;
|
|
35879
|
+
}
|
|
35880
|
+
}
|
|
35881
|
+
ts.moduleNameToDirectorySet = moduleNameToDirectorySet;
|
|
35882
|
+
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
35883
|
+
var moduleNameToDirectoryMap = createCacheWithRedirects(options);
|
|
35884
|
+
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
35666
35885
|
var packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
|
35667
|
-
|
|
35886
|
+
var oldResolutionCache;
|
|
35887
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, getFromModuleNameCache: getFromModuleNameCache, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; }, setOldResolutionCache: setOldResolutionCache });
|
|
35668
35888
|
function clear() {
|
|
35669
|
-
|
|
35670
|
-
packageJsonInfoCache.clear();
|
|
35671
|
-
}
|
|
35672
|
-
function clearAllExceptPackageJsonInfoCache() {
|
|
35889
|
+
oldResolutionCache = undefined;
|
|
35673
35890
|
perDirectoryResolutionCache.clear();
|
|
35674
35891
|
moduleNameToDirectoryMap.clear();
|
|
35892
|
+
packageJsonInfoCache.clear();
|
|
35675
35893
|
}
|
|
35676
35894
|
function update(options) {
|
|
35677
|
-
|
|
35895
|
+
perDirectoryResolutionCache.update(options);
|
|
35896
|
+
moduleNameToDirectoryMap.update(options);
|
|
35897
|
+
}
|
|
35898
|
+
function setOldResolutionCache(cache) {
|
|
35899
|
+
oldResolutionCache = cache;
|
|
35900
|
+
perDirectoryResolutionCache.setOldResolutionCache(cache);
|
|
35901
|
+
}
|
|
35902
|
+
function getFromModuleNameCache(directoryName, nonRelativeModuleName, mode, redirectedReference) {
|
|
35903
|
+
var _a, _b;
|
|
35904
|
+
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
35905
|
+
var result = (_b = (_a = moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) === null || _a === void 0 ? void 0 : _a.get(getModeAwareCacheKey(nonRelativeModuleName, mode))) === null || _b === void 0 ? void 0 : _b.get(directoryName);
|
|
35906
|
+
if (result)
|
|
35907
|
+
return result;
|
|
35908
|
+
var fromOld = oldResolutionCache === null || oldResolutionCache === void 0 ? void 0 : oldResolutionCache.getResolved(toPath(directoryName), nonRelativeModuleName, mode, redirectedReference);
|
|
35909
|
+
if (fromOld)
|
|
35910
|
+
getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference).set(directoryName, fromOld);
|
|
35911
|
+
return fromOld;
|
|
35678
35912
|
}
|
|
35679
35913
|
function getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference) {
|
|
35680
35914
|
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
35681
|
-
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference,
|
|
35915
|
+
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, getModeAwareCacheKey(nonRelativeModuleName, mode), createPerModuleNameCache);
|
|
35682
35916
|
}
|
|
35683
35917
|
function createPerModuleNameCache() {
|
|
35684
35918
|
var directoryPathMap = new ts.Map();
|
|
35685
35919
|
return { get: get, set: set };
|
|
35686
35920
|
function get(directory) {
|
|
35687
|
-
return directoryPathMap.get(
|
|
35921
|
+
return directoryPathMap.get(toPath(directory));
|
|
35688
35922
|
}
|
|
35689
35923
|
function set(directory, result) {
|
|
35690
|
-
|
|
35691
|
-
if (directoryPathMap.has(path)) {
|
|
35692
|
-
return;
|
|
35693
|
-
}
|
|
35694
|
-
directoryPathMap.set(path, result);
|
|
35695
|
-
var resolvedFileName = result.resolvedModule &&
|
|
35696
|
-
(result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
35697
|
-
var commonPrefix = resolvedFileName && getCommonPrefix(path, resolvedFileName);
|
|
35698
|
-
var current = path;
|
|
35699
|
-
while (current !== commonPrefix) {
|
|
35700
|
-
var parent = ts.getDirectoryPath(current);
|
|
35701
|
-
if (parent === current || directoryPathMap.has(parent)) {
|
|
35702
|
-
break;
|
|
35703
|
-
}
|
|
35704
|
-
directoryPathMap.set(parent, result);
|
|
35705
|
-
current = parent;
|
|
35706
|
-
}
|
|
35707
|
-
}
|
|
35708
|
-
function getCommonPrefix(directory, resolution) {
|
|
35709
|
-
var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName);
|
|
35710
|
-
var i = 0;
|
|
35711
|
-
var limit = Math.min(directory.length, resolutionDirectory.length);
|
|
35712
|
-
while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
|
35713
|
-
i++;
|
|
35714
|
-
}
|
|
35715
|
-
if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts.directorySeparator)) {
|
|
35716
|
-
return directory;
|
|
35717
|
-
}
|
|
35718
|
-
var rootLength = ts.getRootLength(directory);
|
|
35719
|
-
if (i < rootLength) {
|
|
35720
|
-
return undefined;
|
|
35721
|
-
}
|
|
35722
|
-
var sep = directory.lastIndexOf(ts.directorySeparator, i - 1);
|
|
35723
|
-
if (sep === -1) {
|
|
35724
|
-
return undefined;
|
|
35725
|
-
}
|
|
35726
|
-
return directory.substr(0, Math.max(sep, rootLength));
|
|
35924
|
+
return moduleNameToDirectorySet(directoryPathMap, toPath(directory), result, getResolvedFileNameForModuleNameToDirectorySet, toPath, ts.noop);
|
|
35727
35925
|
}
|
|
35728
35926
|
}
|
|
35927
|
+
function toPath(fileName) {
|
|
35928
|
+
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
35929
|
+
}
|
|
35729
35930
|
}
|
|
35730
35931
|
ts.createModuleResolutionCache = createModuleResolutionCache;
|
|
35731
|
-
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache
|
|
35732
|
-
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName,
|
|
35932
|
+
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
|
|
35933
|
+
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
35733
35934
|
packageJsonInfoCache || (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
|
|
35734
|
-
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { clear: clear
|
|
35935
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { clear: clear });
|
|
35735
35936
|
function clear() {
|
|
35736
|
-
clearAllExceptPackageJsonInfoCache();
|
|
35737
|
-
packageJsonInfoCache.clear();
|
|
35738
|
-
}
|
|
35739
|
-
function clearAllExceptPackageJsonInfoCache() {
|
|
35740
35937
|
perDirectoryResolutionCache.clear();
|
|
35938
|
+
packageJsonInfoCache.clear();
|
|
35741
35939
|
}
|
|
35742
35940
|
}
|
|
35743
35941
|
ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
|
|
35744
35942
|
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
35745
35943
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
35746
|
-
|
|
35747
|
-
if (!perFolderCache)
|
|
35748
|
-
return undefined;
|
|
35749
|
-
return perFolderCache.get(moduleName, mode);
|
|
35944
|
+
return cache === null || cache === void 0 ? void 0 : cache.getFromCache(containingDirectory, moduleName, mode);
|
|
35750
35945
|
}
|
|
35751
35946
|
ts.resolveModuleNameFromCache = resolveModuleNameFromCache;
|
|
35752
35947
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
@@ -35761,8 +35956,7 @@ var ts;
|
|
|
35761
35956
|
}
|
|
35762
35957
|
}
|
|
35763
35958
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
35764
|
-
var
|
|
35765
|
-
var result = perFolderCache && perFolderCache.get(moduleName, resolutionMode);
|
|
35959
|
+
var result = cache === null || cache === void 0 ? void 0 : cache.getFromCache(containingDirectory, moduleName, resolutionMode, redirectedReference);
|
|
35766
35960
|
if (result) {
|
|
35767
35961
|
if (traceEnabled) {
|
|
35768
35962
|
trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -35814,8 +36008,8 @@ var ts;
|
|
|
35814
36008
|
if (result && result.resolvedModule)
|
|
35815
36009
|
ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
|
|
35816
36010
|
ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
35817
|
-
if (
|
|
35818
|
-
|
|
36011
|
+
if (cache) {
|
|
36012
|
+
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
|
|
35819
36013
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
35820
36014
|
cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
35821
36015
|
}
|
|
@@ -36019,10 +36213,10 @@ var ts;
|
|
|
36019
36213
|
features: features,
|
|
36020
36214
|
conditions: conditions,
|
|
36021
36215
|
requestContainingDirectory: containingDirectory,
|
|
36022
|
-
|
|
36216
|
+
reportResolutionDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
36023
36217
|
};
|
|
36024
36218
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
36025
|
-
return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
36219
|
+
return createResolvedModuleWithFailedLookupLocations(compilerOptions, (_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
36026
36220
|
function tryResolve(extensions) {
|
|
36027
36221
|
var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, true); };
|
|
36028
36222
|
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
|
|
@@ -36359,21 +36553,42 @@ var ts;
|
|
|
36359
36553
|
features: NodeResolutionFeatures.None,
|
|
36360
36554
|
conditions: ts.emptyArray,
|
|
36361
36555
|
requestContainingDirectory: undefined,
|
|
36362
|
-
|
|
36556
|
+
reportResolutionDiagnostic: ts.noop
|
|
36363
36557
|
};
|
|
36364
36558
|
}
|
|
36365
36559
|
ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
|
|
36366
|
-
function
|
|
36367
|
-
var
|
|
36368
|
-
|
|
36369
|
-
|
|
36370
|
-
|
|
36371
|
-
|
|
36372
|
-
|
|
36373
|
-
|
|
36374
|
-
|
|
36375
|
-
|
|
36376
|
-
|
|
36560
|
+
function getPackageScope(dir, packageJsonInfoCache, host, options) {
|
|
36561
|
+
var state = getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
|
|
36562
|
+
var failedLookupLocations = [];
|
|
36563
|
+
var affectingLocations = [];
|
|
36564
|
+
state.failedLookupLocations = failedLookupLocations;
|
|
36565
|
+
state.affectingLocations = affectingLocations;
|
|
36566
|
+
var result = ts.forEachAncestorDirectory(dir, function (directory) {
|
|
36567
|
+
var _a;
|
|
36568
|
+
var fromCache = (_a = state.packageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.getPackageJsonScope(directory);
|
|
36569
|
+
if (fromCache) {
|
|
36570
|
+
var host_2 = state.host, traceEnabled = state.traceEnabled;
|
|
36571
|
+
if (traceEnabled) {
|
|
36572
|
+
trace(host_2, fromCache.info ?
|
|
36573
|
+
ts.Diagnostics.Directory_0_resolves_to_1_scope_according_to_cache :
|
|
36574
|
+
ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_according_to_cache, directory, getPackageJsconLocationFromScope(fromCache));
|
|
36575
|
+
}
|
|
36576
|
+
return fromCache;
|
|
36577
|
+
}
|
|
36578
|
+
var info = getPackageJsonInfo(directory, false, state);
|
|
36579
|
+
if (info)
|
|
36580
|
+
return { info: info };
|
|
36581
|
+
}) || { info: undefined };
|
|
36582
|
+
result.failedLookupLocations = updateResolutionField(result.failedLookupLocations, !options.cacheResolutions || !result.info ? failedLookupLocations : undefined);
|
|
36583
|
+
result.affectingLocations = updateResolutionField(result.affectingLocations, affectingLocations);
|
|
36584
|
+
packageJsonInfoCache === null || packageJsonInfoCache === void 0 ? void 0 : packageJsonInfoCache.setPackageJsonScope(dir, result);
|
|
36585
|
+
return result;
|
|
36586
|
+
}
|
|
36587
|
+
ts.getPackageScope = getPackageScope;
|
|
36588
|
+
function getPackageScopeForPath(dir, state) {
|
|
36589
|
+
return ts.forEachAncestorDirectory(dir, function (directory) {
|
|
36590
|
+
return getPackageJsonInfo(directory, false, state);
|
|
36591
|
+
});
|
|
36377
36592
|
}
|
|
36378
36593
|
ts.getPackageScopeForPath = getPackageScopeForPath;
|
|
36379
36594
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
@@ -36401,12 +36616,13 @@ var ts;
|
|
|
36401
36616
|
}
|
|
36402
36617
|
var directoryExists = ts.directoryProbablyExists(packageDirectory, host);
|
|
36403
36618
|
if (directoryExists && host.fileExists(packageJsonPath)) {
|
|
36404
|
-
var
|
|
36619
|
+
var packageJsonText = host.readFile(packageJsonPath);
|
|
36620
|
+
var packageJsonContent = ts.readJson(packageJsonPath, packageJsonText);
|
|
36405
36621
|
if (traceEnabled) {
|
|
36406
36622
|
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
36407
36623
|
}
|
|
36408
36624
|
var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
|
|
36409
|
-
var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
|
|
36625
|
+
var result = { packageDirectory: packageDirectory, packageJsonText: packageJsonText, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
|
|
36410
36626
|
(_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
|
|
36411
36627
|
state.affectingLocations.push(packageJsonPath);
|
|
36412
36628
|
return result;
|
|
@@ -36519,7 +36735,7 @@ var ts;
|
|
|
36519
36735
|
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
36520
36736
|
var _a, _b;
|
|
36521
36737
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
36522
|
-
var directoryPath = ts.toPath(
|
|
36738
|
+
var directoryPath = ts.toPath(directory, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
36523
36739
|
var scope = getPackageScopeForPath(directoryPath, state);
|
|
36524
36740
|
if (!scope || !scope.packageJsonContent.exports) {
|
|
36525
36741
|
return undefined;
|
|
@@ -36578,7 +36794,7 @@ var ts;
|
|
|
36578
36794
|
return toSearchResult(undefined);
|
|
36579
36795
|
}
|
|
36580
36796
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
36581
|
-
var directoryPath = ts.toPath(
|
|
36797
|
+
var directoryPath = ts.toPath(directory, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
36582
36798
|
var scope = getPackageScopeForPath(directoryPath, state);
|
|
36583
36799
|
if (!scope) {
|
|
36584
36800
|
if (state.traceEnabled) {
|
|
@@ -36778,11 +36994,8 @@ var ts;
|
|
|
36778
36994
|
fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
|
|
36779
36995
|
}
|
|
36780
36996
|
}
|
|
36781
|
-
if (commonSourceDirGuesses.length > 1)
|
|
36782
|
-
state.
|
|
36783
|
-
? ts.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate
|
|
36784
|
-
: ts.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate, entry === "" ? "." : entry, packagePath));
|
|
36785
|
-
}
|
|
36997
|
+
if (commonSourceDirGuesses.length > 1)
|
|
36998
|
+
state.reportResolutionDiagnostic({ isImports: isImports, entry: entry, packagePath: packagePath });
|
|
36786
36999
|
for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
|
|
36787
37000
|
var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
|
|
36788
37001
|
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
@@ -36847,10 +37060,10 @@ var ts;
|
|
|
36847
37060
|
return loadModuleFromNearestNodeModulesDirectoryWorker(Extensions.DtsOnly, moduleName, directory, state, true, undefined, undefined);
|
|
36848
37061
|
}
|
|
36849
37062
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
36850
|
-
var
|
|
37063
|
+
var mode = state.features === 0 ? undefined : state.features & NodeResolutionFeatures.EsmMode ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
36851
37064
|
return ts.forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {
|
|
36852
37065
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
36853
|
-
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
37066
|
+
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, ancestorDirectory, redirectedReference, state);
|
|
36854
37067
|
if (resolutionFromCache) {
|
|
36855
37068
|
return resolutionFromCache;
|
|
36856
37069
|
}
|
|
@@ -36987,8 +37200,8 @@ var ts;
|
|
|
36987
37200
|
typesPackageName;
|
|
36988
37201
|
}
|
|
36989
37202
|
ts.unmangleScopedPackageName = unmangleScopedPackageName;
|
|
36990
|
-
function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, state) {
|
|
36991
|
-
var result = cache
|
|
37203
|
+
function tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, containingDirectory, redirectedReference, state) {
|
|
37204
|
+
var result = cache === null || cache === void 0 ? void 0 : cache.getFromModuleNameCache(containingDirectory, moduleName, mode, redirectedReference);
|
|
36992
37205
|
if (result) {
|
|
36993
37206
|
if (state.traceEnabled) {
|
|
36994
37207
|
trace(state.host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -37013,19 +37226,18 @@ var ts;
|
|
|
37013
37226
|
features: NodeResolutionFeatures.None,
|
|
37014
37227
|
conditions: [],
|
|
37015
37228
|
requestContainingDirectory: containingDirectory,
|
|
37016
|
-
|
|
37229
|
+
reportResolutionDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
37017
37230
|
};
|
|
37018
37231
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
37019
|
-
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
37232
|
+
return createResolvedModuleWithFailedLookupLocations(compilerOptions, resolved && resolved.value, false, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
37020
37233
|
function tryResolve(extensions) {
|
|
37021
37234
|
var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
37022
37235
|
if (resolvedUsingSettings) {
|
|
37023
37236
|
return { value: resolvedUsingSettings };
|
|
37024
37237
|
}
|
|
37025
37238
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
37026
|
-
var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName, undefined, redirectedReference);
|
|
37027
37239
|
var resolved_3 = ts.forEachAncestorDirectory(containingDirectory, function (directory) {
|
|
37028
|
-
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
37240
|
+
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, undefined, directory, redirectedReference, state);
|
|
37029
37241
|
if (resolutionFromCache) {
|
|
37030
37242
|
return resolutionFromCache;
|
|
37031
37243
|
}
|
|
@@ -37064,10 +37276,10 @@ var ts;
|
|
|
37064
37276
|
features: NodeResolutionFeatures.None,
|
|
37065
37277
|
conditions: [],
|
|
37066
37278
|
requestContainingDirectory: undefined,
|
|
37067
|
-
|
|
37279
|
+
reportResolutionDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
37068
37280
|
};
|
|
37069
37281
|
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, false, undefined, undefined);
|
|
37070
|
-
return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
37282
|
+
return createResolvedModuleWithFailedLookupLocations(compilerOptions, resolved, true, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
37071
37283
|
}
|
|
37072
37284
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
37073
37285
|
function toSearchResult(value) {
|
|
@@ -40080,9 +40292,10 @@ var ts;
|
|
|
40080
40292
|
host.getSourceFiles().forEach(function (sf) {
|
|
40081
40293
|
if (!sf.resolvedModules)
|
|
40082
40294
|
return;
|
|
40083
|
-
sf.resolvedModules.forEach(function (
|
|
40084
|
-
|
|
40085
|
-
|
|
40295
|
+
sf.resolvedModules.forEach(function (_a) {
|
|
40296
|
+
var resolvedModule = _a.resolvedModule;
|
|
40297
|
+
if (resolvedModule === null || resolvedModule === void 0 ? void 0 : resolvedModule.packageId)
|
|
40298
|
+
map.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" || !!map.get(resolvedModule.packageId.name));
|
|
40086
40299
|
});
|
|
40087
40300
|
});
|
|
40088
40301
|
return map;
|
|
@@ -42715,7 +42928,7 @@ var ts;
|
|
|
42715
42928
|
: undefined;
|
|
42716
42929
|
}
|
|
42717
42930
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {
|
|
42718
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
42931
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
42719
42932
|
if (isForAugmentation === void 0) { isForAugmentation = false; }
|
|
42720
42933
|
if (ts.startsWith(moduleReference, "@types/")) {
|
|
42721
42934
|
var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
@@ -42761,7 +42974,7 @@ var ts;
|
|
|
42761
42974
|
var diagnosticDetails = void 0;
|
|
42762
42975
|
var ext = ts.tryGetExtensionFromPath(currentSourceFile.fileName);
|
|
42763
42976
|
if (ext === ".ts" || ext === ".js" || ext === ".tsx" || ext === ".jsx") {
|
|
42764
|
-
var scope = currentSourceFile.packageJsonScope;
|
|
42977
|
+
var scope = (_h = currentSourceFile.packageJsonScope) === null || _h === void 0 ? void 0 : _h.info;
|
|
42765
42978
|
var targetExt = ext === ".ts" ? ".mts" : ext === ".js" ? ".mjs" : undefined;
|
|
42766
42979
|
if (scope && !scope.packageJsonContent.type) {
|
|
42767
42980
|
if (targetExt) {
|
|
@@ -42845,10 +43058,10 @@ var ts;
|
|
|
42845
43058
|
}
|
|
42846
43059
|
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
42847
43060
|
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
42848
|
-
var suggestedExt = (
|
|
43061
|
+
var suggestedExt = (_j = suggestedExtensions.find(function (_a) {
|
|
42849
43062
|
var actualExt = _a[0], _importExt = _a[1];
|
|
42850
43063
|
return host.fileExists(absoluteRef_1 + actualExt);
|
|
42851
|
-
})) === null ||
|
|
43064
|
+
})) === null || _j === void 0 ? void 0 : _j[1];
|
|
42852
43065
|
if (suggestedExt) {
|
|
42853
43066
|
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
42854
43067
|
}
|
|
@@ -73198,12 +73411,12 @@ var ts;
|
|
|
73198
73411
|
var parent = node.parent;
|
|
73199
73412
|
var paramTag = node.parent.parent;
|
|
73200
73413
|
if (ts.isJSDocTypeExpression(node.parent) && ts.isJSDocParameterTag(paramTag)) {
|
|
73201
|
-
var
|
|
73414
|
+
var host_3 = ts.getHostSignatureFromJSDoc(paramTag);
|
|
73202
73415
|
var isCallbackTag = ts.isJSDocCallbackTag(paramTag.parent.parent);
|
|
73203
|
-
if (
|
|
73416
|
+
if (host_3 || isCallbackTag) {
|
|
73204
73417
|
var lastParamDeclaration = isCallbackTag
|
|
73205
73418
|
? ts.lastOrUndefined(paramTag.parent.parent.typeExpression.parameters)
|
|
73206
|
-
: ts.lastOrUndefined(
|
|
73419
|
+
: ts.lastOrUndefined(host_3.parameters);
|
|
73207
73420
|
var symbol = ts.getParameterSymbolFromJSDoc(paramTag);
|
|
73208
73421
|
if (!lastParamDeclaration ||
|
|
73209
73422
|
symbol && lastParamDeclaration.symbol === symbol && ts.isRestParameter(lastParamDeclaration)) {
|
|
@@ -74438,11 +74651,12 @@ var ts;
|
|
|
74438
74651
|
var fileToDirective;
|
|
74439
74652
|
if (resolvedTypeReferenceDirectives) {
|
|
74440
74653
|
fileToDirective = new ts.Map();
|
|
74441
|
-
resolvedTypeReferenceDirectives.forEach(function (
|
|
74442
|
-
|
|
74654
|
+
resolvedTypeReferenceDirectives.forEach(function (_a, key, mode) {
|
|
74655
|
+
var resolvedTypeReferenceDirective = _a.resolvedTypeReferenceDirective;
|
|
74656
|
+
if (!resolvedTypeReferenceDirective || !resolvedTypeReferenceDirective.resolvedFileName) {
|
|
74443
74657
|
return;
|
|
74444
74658
|
}
|
|
74445
|
-
var file = host.getSourceFile(
|
|
74659
|
+
var file = host.getSourceFile(resolvedTypeReferenceDirective.resolvedFileName);
|
|
74446
74660
|
if (file) {
|
|
74447
74661
|
addReferencedFilesToTypeDirective(file, key, mode);
|
|
74448
74662
|
}
|
|
@@ -75719,9 +75933,9 @@ var ts;
|
|
|
75719
75933
|
}
|
|
75720
75934
|
var parent = ts.walkUpParenthesizedTypes(node.parent);
|
|
75721
75935
|
if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) {
|
|
75722
|
-
var
|
|
75723
|
-
if (
|
|
75724
|
-
parent = ts.getSingleVariableOfVariableStatement(
|
|
75936
|
+
var host_4 = ts.getJSDocHost(parent);
|
|
75937
|
+
if (host_4) {
|
|
75938
|
+
parent = ts.getSingleVariableOfVariableStatement(host_4) || host_4;
|
|
75725
75939
|
}
|
|
75726
75940
|
}
|
|
75727
75941
|
switch (parent.kind) {
|
|
@@ -92234,7 +92448,7 @@ var ts;
|
|
|
92234
92448
|
var sourceMap = sourceMapGenerator.toString();
|
|
92235
92449
|
ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
|
|
92236
92450
|
if (printer.bundleFileInfo)
|
|
92237
|
-
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap,
|
|
92451
|
+
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, host);
|
|
92238
92452
|
}
|
|
92239
92453
|
}
|
|
92240
92454
|
else {
|
|
@@ -92243,7 +92457,7 @@ var ts;
|
|
|
92243
92457
|
var text = writer.getText();
|
|
92244
92458
|
ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos, diagnostics: transform.diagnostics });
|
|
92245
92459
|
if (printer.bundleFileInfo)
|
|
92246
|
-
printer.bundleFileInfo.hash = ts.computeSignature(text,
|
|
92460
|
+
printer.bundleFileInfo.hash = ts.computeSignature(text, host);
|
|
92247
92461
|
writer.clear();
|
|
92248
92462
|
}
|
|
92249
92463
|
function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
|
|
@@ -92378,7 +92592,6 @@ var ts;
|
|
|
92378
92592
|
}
|
|
92379
92593
|
ts.emitUsingBuildInfo = emitUsingBuildInfo;
|
|
92380
92594
|
function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers) {
|
|
92381
|
-
var createHash = ts.maybeBind(host, host.createHash);
|
|
92382
92595
|
var _a = getOutputPathsForBundle(config.options, false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
|
|
92383
92596
|
var buildInfo = host.getBuildInfo(buildInfoPath, config.options);
|
|
92384
92597
|
if (!buildInfo)
|
|
@@ -92388,22 +92601,22 @@ var ts;
|
|
|
92388
92601
|
var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
|
|
92389
92602
|
if (!jsFileText)
|
|
92390
92603
|
return jsFilePath;
|
|
92391
|
-
if (ts.computeSignature(jsFileText,
|
|
92604
|
+
if (ts.computeSignature(jsFileText, host) !== buildInfo.bundle.js.hash)
|
|
92392
92605
|
return jsFilePath;
|
|
92393
92606
|
var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
|
|
92394
92607
|
if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
|
|
92395
92608
|
return sourceMapFilePath || "inline sourcemap decoding";
|
|
92396
|
-
if (sourceMapFilePath && ts.computeSignature(sourceMapText,
|
|
92609
|
+
if (sourceMapFilePath && ts.computeSignature(sourceMapText, host) !== buildInfo.bundle.js.mapHash)
|
|
92397
92610
|
return sourceMapFilePath;
|
|
92398
92611
|
var declarationText = declarationFilePath && host.readFile(declarationFilePath);
|
|
92399
92612
|
if (declarationFilePath && !declarationText)
|
|
92400
92613
|
return declarationFilePath;
|
|
92401
|
-
if (declarationFilePath && ts.computeSignature(declarationText,
|
|
92614
|
+
if (declarationFilePath && ts.computeSignature(declarationText, host) !== buildInfo.bundle.dts.hash)
|
|
92402
92615
|
return declarationFilePath;
|
|
92403
92616
|
var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
|
|
92404
92617
|
if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
|
|
92405
92618
|
return declarationMapPath || "inline sourcemap decoding";
|
|
92406
|
-
if (declarationMapPath && ts.computeSignature(declarationMapText,
|
|
92619
|
+
if (declarationMapPath && ts.computeSignature(declarationMapText, host) !== buildInfo.bundle.dts.mapHash)
|
|
92407
92620
|
return declarationMapPath;
|
|
92408
92621
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
92409
92622
|
var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo, true);
|
|
@@ -92441,7 +92654,7 @@ var ts;
|
|
|
92441
92654
|
var newBuildInfo = data.buildInfo;
|
|
92442
92655
|
newBuildInfo.program = buildInfo.program;
|
|
92443
92656
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
92444
|
-
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText,
|
|
92657
|
+
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, host, changedDtsData);
|
|
92445
92658
|
}
|
|
92446
92659
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
92447
92660
|
newBuildInfo.bundle.js.sources = js.sources;
|
|
@@ -92475,7 +92688,7 @@ var ts;
|
|
|
92475
92688
|
getSourceFileFromReference: ts.returnUndefined,
|
|
92476
92689
|
redirectTargetsMap: ts.createMultiMap(),
|
|
92477
92690
|
getFileIncludeReasons: ts.notImplemented,
|
|
92478
|
-
createHash: createHash,
|
|
92691
|
+
createHash: ts.maybeBind(host, host.createHash),
|
|
92479
92692
|
buildInfoCallbacks: host.buildInfoCallbacks,
|
|
92480
92693
|
};
|
|
92481
92694
|
emitFiles(ts.notImplementedResolver, emitHost, undefined, ts.getTransformers(config.options, customTransformers));
|
|
@@ -97479,7 +97692,7 @@ var ts;
|
|
|
97479
97692
|
var name = names_2[_i];
|
|
97480
97693
|
var result = void 0;
|
|
97481
97694
|
var mode = getModeForFileReference(name, containingFileMode);
|
|
97482
|
-
var strName = ts.isString(name) ? name : name.fileName
|
|
97695
|
+
var strName = ts.isString(name) ? name : ts.toFileNameLowerCase(name.fileName);
|
|
97483
97696
|
var cacheKey = mode !== undefined ? mode + "|" + strName : strName;
|
|
97484
97697
|
if (cache.has(cacheKey)) {
|
|
97485
97698
|
result = cache.get(cacheKey);
|
|
@@ -97563,7 +97776,21 @@ var ts;
|
|
|
97563
97776
|
return elem.value.text === "import" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
97564
97777
|
}
|
|
97565
97778
|
ts.getResolutionModeOverrideForClause = getResolutionModeOverrideForClause;
|
|
97566
|
-
|
|
97779
|
+
var emptyResolution = {
|
|
97780
|
+
resolvedModule: undefined,
|
|
97781
|
+
resolvedTypeReferenceDirective: undefined,
|
|
97782
|
+
failedLookupLocations: [],
|
|
97783
|
+
affectingLocations: [],
|
|
97784
|
+
resolutionDiagnostics: [],
|
|
97785
|
+
};
|
|
97786
|
+
function isResolvedModuleWithFailedLookupLocation(resolved) {
|
|
97787
|
+
return !!resolved && !!resolved.failedLookupLocations;
|
|
97788
|
+
}
|
|
97789
|
+
function isResolvedTypeReferenceDirectiveWithFailedLookupLocations(resolved) {
|
|
97790
|
+
return !!resolved && !!resolved.failedLookupLocations;
|
|
97791
|
+
}
|
|
97792
|
+
function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference, partialResolutionInfo, loader) {
|
|
97793
|
+
var _a;
|
|
97567
97794
|
if (names.length === 0) {
|
|
97568
97795
|
return [];
|
|
97569
97796
|
}
|
|
@@ -97573,7 +97800,7 @@ var ts;
|
|
|
97573
97800
|
for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
|
|
97574
97801
|
var name = names_3[_i];
|
|
97575
97802
|
var result = void 0;
|
|
97576
|
-
var mode = getModeForResolutionAtIndex(containingFile, i);
|
|
97803
|
+
var mode = getModeForResolutionAtIndex(containingFile, (_a = partialResolutionInfo === null || partialResolutionInfo === void 0 ? void 0 : partialResolutionInfo.namesIndex[i]) !== null && _a !== void 0 ? _a : i);
|
|
97577
97804
|
i++;
|
|
97578
97805
|
var cacheKey = mode !== undefined ? mode + "|" + name : name;
|
|
97579
97806
|
if (cache.has(cacheKey)) {
|
|
@@ -97631,14 +97858,14 @@ var ts;
|
|
|
97631
97858
|
ts.isReferenceFileLocation = isReferenceFileLocation;
|
|
97632
97859
|
function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
97633
97860
|
var _a, _b, _c;
|
|
97634
|
-
var _d, _e, _f, _g;
|
|
97861
|
+
var _d, _e, _f, _g, _h, _j;
|
|
97635
97862
|
var file = ts.Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
97636
97863
|
var kind = ref.kind, index = ref.index;
|
|
97637
97864
|
var pos, end, packageId, resolutionMode;
|
|
97638
97865
|
switch (kind) {
|
|
97639
97866
|
case ts.FileIncludeKind.Import:
|
|
97640
97867
|
var importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
97641
|
-
packageId = (_e = (_d = file.resolvedModules) === null || _d === void 0 ? void 0 : _d.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) === null || _e === void 0 ? void 0 : _e.packageId;
|
|
97868
|
+
packageId = (_f = (_e = (_d = file.resolvedModules) === null || _d === void 0 ? void 0 : _d.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) === null || _e === void 0 ? void 0 : _e.resolvedModule) === null || _f === void 0 ? void 0 : _f.packageId;
|
|
97642
97869
|
if (importLiteral.pos === -1)
|
|
97643
97870
|
return { file: file, packageId: packageId, text: importLiteral.text };
|
|
97644
97871
|
pos = ts.skipTrivia(file.text, importLiteral.pos);
|
|
@@ -97649,7 +97876,7 @@ var ts;
|
|
|
97649
97876
|
break;
|
|
97650
97877
|
case ts.FileIncludeKind.TypeReferenceDirective:
|
|
97651
97878
|
(_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end, resolutionMode = _b.resolutionMode);
|
|
97652
|
-
packageId = (
|
|
97879
|
+
packageId = (_j = (_h = (_g = file.resolvedTypeReferenceDirectiveNames) === null || _g === void 0 ? void 0 : _g.get(ts.toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) === null || _h === void 0 ? void 0 : _h.resolvedTypeReferenceDirective) === null || _j === void 0 ? void 0 : _j.packageId;
|
|
97653
97880
|
break;
|
|
97654
97881
|
case ts.FileIncludeKind.LibReferenceDirective:
|
|
97655
97882
|
(_c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end);
|
|
@@ -97733,13 +97960,13 @@ var ts;
|
|
|
97733
97960
|
return undefined;
|
|
97734
97961
|
}
|
|
97735
97962
|
function lookupFromPackageJson() {
|
|
97736
|
-
var
|
|
97737
|
-
var
|
|
97738
|
-
|
|
97739
|
-
|
|
97740
|
-
|
|
97741
|
-
|
|
97742
|
-
|
|
97963
|
+
var _a;
|
|
97964
|
+
var packageJsonScope = ts.getPackageScope(ts.getDirectoryPath(fileName), packageJsonInfoCache, host, options);
|
|
97965
|
+
var impliedNodeFormat = ((_a = packageJsonScope.info) === null || _a === void 0 ? void 0 : _a.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
97966
|
+
return {
|
|
97967
|
+
impliedNodeFormat: impliedNodeFormat,
|
|
97968
|
+
packageJsonScope: packageJsonScope,
|
|
97969
|
+
};
|
|
97743
97970
|
}
|
|
97744
97971
|
}
|
|
97745
97972
|
ts.getImpliedNodeFormatForFileWorker = getImpliedNodeFormatForFileWorker;
|
|
@@ -97851,10 +98078,10 @@ var ts;
|
|
|
97851
98078
|
};
|
|
97852
98079
|
}
|
|
97853
98080
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
97854
|
-
var _a, _b, _c, _d;
|
|
98081
|
+
var _a, _b, _c, _d, _e;
|
|
97855
98082
|
var createProgramOptions = ts.isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
97856
98083
|
var rootNames = createProgramOptions.rootNames, options = createProgramOptions.options, configFileParsingDiagnostics = createProgramOptions.configFileParsingDiagnostics, projectReferences = createProgramOptions.projectReferences;
|
|
97857
|
-
var
|
|
98084
|
+
var oldProgramOrOldBuildInfoProgramConstructor = createProgramOptions.oldProgram;
|
|
97858
98085
|
var processingDefaultLibFiles;
|
|
97859
98086
|
var processingOtherFiles;
|
|
97860
98087
|
var files;
|
|
@@ -97868,6 +98095,8 @@ var ts;
|
|
|
97868
98095
|
var cachedDeclarationDiagnosticsForFile = {};
|
|
97869
98096
|
var resolvedTypeReferenceDirectives = ts.createModeAwareCache();
|
|
97870
98097
|
var fileProcessingDiagnostics;
|
|
98098
|
+
var automaticTypeDirectiveNames;
|
|
98099
|
+
var automaticTypeDirectiveResolutions;
|
|
97871
98100
|
var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
97872
98101
|
var currentNodeModulesDepth = 0;
|
|
97873
98102
|
var modulesWithElidedImports = new ts.Map();
|
|
@@ -97890,29 +98119,72 @@ var ts;
|
|
|
97890
98119
|
var actualResolveModuleNamesWorker;
|
|
97891
98120
|
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
|
|
97892
98121
|
if (host.resolveModuleNames) {
|
|
97893
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName,
|
|
97894
|
-
|
|
97895
|
-
|
|
97896
|
-
|
|
97897
|
-
|
|
97898
|
-
|
|
97899
|
-
return
|
|
97900
|
-
|
|
98122
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, redirectedReference, partialResolutionInfo) {
|
|
98123
|
+
var _a;
|
|
98124
|
+
var result = host.resolveModuleNames(moduleNames, containingFileName, (_a = partialResolutionInfo === null || partialResolutionInfo === void 0 ? void 0 : partialResolutionInfo.reusedNames) === null || _a === void 0 ? void 0 : _a.map(function (_a) {
|
|
98125
|
+
var name = _a.name;
|
|
98126
|
+
return name;
|
|
98127
|
+
}), redirectedReference, options, containingFile, partialResolutionInfo);
|
|
98128
|
+
return result.some(isResolvedModuleWithFailedLookupLocation) ?
|
|
98129
|
+
result :
|
|
98130
|
+
result.map(function (resolved) { return resolved ?
|
|
98131
|
+
resolved.extension !== undefined ?
|
|
98132
|
+
{ resolvedModule: resolved, failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
98133
|
+
{ resolvedModule: __assign(__assign({}, resolved), { extension: ts.extensionFromPath(resolved.resolvedFileName) }), failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
98134
|
+
emptyResolution; });
|
|
98135
|
+
};
|
|
97901
98136
|
moduleResolutionCache = (_a = host.getModuleResolutionCache) === null || _a === void 0 ? void 0 : _a.call(host);
|
|
97902
98137
|
}
|
|
97903
98138
|
else {
|
|
97904
98139
|
moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
97905
|
-
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode)
|
|
97906
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName,
|
|
98140
|
+
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode); };
|
|
98141
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, redirectedReference, partialResolutionInfo) {
|
|
98142
|
+
return loadWithModeAwareCache(moduleNames, containingFile, containingFileName, redirectedReference, partialResolutionInfo, loader_1);
|
|
98143
|
+
};
|
|
97907
98144
|
}
|
|
97908
98145
|
var actualResolveTypeReferenceDirectiveNamesWorker;
|
|
97909
98146
|
if (host.resolveTypeReferenceDirectives) {
|
|
97910
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode
|
|
98147
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode, partialResolutionInfo) {
|
|
98148
|
+
var result = host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, options, containingFileMode, partialResolutionInfo);
|
|
98149
|
+
return result.some(isResolvedTypeReferenceDirectiveWithFailedLookupLocations) ?
|
|
98150
|
+
result :
|
|
98151
|
+
result.map(function (resolved) { return resolved ?
|
|
98152
|
+
{ resolvedTypeReferenceDirective: resolved, failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
98153
|
+
emptyResolution; });
|
|
98154
|
+
};
|
|
98155
|
+
typeReferenceDirectiveResolutionCache = (_b = host.getTypeReferenceDirectiveResolutionCache) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
97911
98156
|
}
|
|
97912
98157
|
else {
|
|
97913
98158
|
typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
97914
|
-
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode)
|
|
97915
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
98159
|
+
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode); };
|
|
98160
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
98161
|
+
return loadWithTypeDirectiveCache(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode, loader_2);
|
|
98162
|
+
};
|
|
98163
|
+
}
|
|
98164
|
+
var oldProgram = typeof oldProgramOrOldBuildInfoProgramConstructor === "object" ? oldProgramOrOldBuildInfoProgramConstructor : undefined;
|
|
98165
|
+
var oldBuildInfoProgram;
|
|
98166
|
+
if (!oldProgram && typeof oldProgramOrOldBuildInfoProgramConstructor === "function") {
|
|
98167
|
+
var state_11 = ts.getTemporaryModuleResolutionState(moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
98168
|
+
oldBuildInfoProgram = oldProgramOrOldBuildInfoProgramConstructor({
|
|
98169
|
+
fileExists: function (fileName) { return host.fileExists(fileName); },
|
|
98170
|
+
createHash: ts.maybeBind(host, host.createHash),
|
|
98171
|
+
getPackageJsonInfo: function (fileName) { return ts.getPackageJsonInfo(ts.getDirectoryPath(fileName), false, state_11); },
|
|
98172
|
+
});
|
|
98173
|
+
if (oldBuildInfoProgram) {
|
|
98174
|
+
moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.setOldResolutionCache({
|
|
98175
|
+
getResolved: function (dirPath, name, mode, redirectedReference) {
|
|
98176
|
+
return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getResolvedModule(dirPath, name, mode, redirectedReference);
|
|
98177
|
+
}
|
|
98178
|
+
});
|
|
98179
|
+
typeReferenceDirectiveResolutionCache === null || typeReferenceDirectiveResolutionCache === void 0 ? void 0 : typeReferenceDirectiveResolutionCache.setOldResolutionCache({
|
|
98180
|
+
getResolved: function (dirPath, name, mode, redirectedReference) {
|
|
98181
|
+
return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getResolvedTypeReferenceDirective(dirPath, name, mode, redirectedReference);
|
|
98182
|
+
}
|
|
98183
|
+
});
|
|
98184
|
+
moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache().setOldPackageJsonScopeCache({
|
|
98185
|
+
getPackageJsonScope: function (dirPath) { return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getPackageJsonScope(dirPath); }
|
|
98186
|
+
});
|
|
98187
|
+
}
|
|
97916
98188
|
}
|
|
97917
98189
|
var packageIdToSourceFile = new ts.Map();
|
|
97918
98190
|
var sourceFileToPackageName = new ts.Map();
|
|
@@ -97925,9 +98197,9 @@ var ts;
|
|
|
97925
98197
|
var projectReferenceRedirects;
|
|
97926
98198
|
var mapFromFileToProjectReferenceRedirects;
|
|
97927
98199
|
var mapFromToProjectReferenceRedirectSource;
|
|
97928
|
-
var useSourceOfProjectReferenceRedirect = !!((
|
|
98200
|
+
var useSourceOfProjectReferenceRedirect = !!((_c = host.useSourceOfProjectReferenceRedirect) === null || _c === void 0 ? void 0 : _c.call(host)) &&
|
|
97929
98201
|
!options.disableSourceOfProjectReferenceRedirect;
|
|
97930
|
-
var
|
|
98202
|
+
var _f = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
97931
98203
|
compilerHost: host,
|
|
97932
98204
|
getSymlinkCache: getSymlinkCache,
|
|
97933
98205
|
useSourceOfProjectReferenceRedirect: useSourceOfProjectReferenceRedirect,
|
|
@@ -97935,7 +98207,7 @@ var ts;
|
|
|
97935
98207
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
97936
98208
|
getSourceOfProjectReferenceRedirect: getSourceOfProjectReferenceRedirect,
|
|
97937
98209
|
forEachResolvedProjectReference: forEachResolvedProjectReference
|
|
97938
|
-
}), onProgramCreateComplete =
|
|
98210
|
+
}), onProgramCreateComplete = _f.onProgramCreateComplete, fileExists = _f.fileExists, directoryExists = _f.directoryExists;
|
|
97939
98211
|
var readFile = host.readFile.bind(host);
|
|
97940
98212
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
97941
98213
|
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
@@ -97944,7 +98216,7 @@ var ts;
|
|
|
97944
98216
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "tryReuseStructureFromOldProgram", {});
|
|
97945
98217
|
structureIsReused = tryReuseStructureFromOldProgram();
|
|
97946
98218
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
97947
|
-
if (structureIsReused !==
|
|
98219
|
+
if (structureIsReused !== 3) {
|
|
97948
98220
|
processingDefaultLibFiles = [];
|
|
97949
98221
|
processingOtherFiles = [];
|
|
97950
98222
|
if (projectReferences) {
|
|
@@ -97984,14 +98256,14 @@ var ts;
|
|
|
97984
98256
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processRootFiles", { count: rootNames.length });
|
|
97985
98257
|
ts.forEach(rootNames, function (name, index) { return processRootFile(name, false, false, { kind: ts.FileIncludeKind.RootFile, index: index }); });
|
|
97986
98258
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
97987
|
-
|
|
97988
|
-
|
|
97989
|
-
|
|
97990
|
-
|
|
97991
|
-
var
|
|
97992
|
-
var
|
|
97993
|
-
|
|
97994
|
-
processTypeReferenceDirective(
|
|
98259
|
+
automaticTypeDirectiveNames !== null && automaticTypeDirectiveNames !== void 0 ? automaticTypeDirectiveNames : (automaticTypeDirectiveNames = rootNames.length ? ts.getAutomaticTypeDirectiveNames(options, host) : ts.emptyArray);
|
|
98260
|
+
automaticTypeDirectiveResolutions = ts.createModeAwareCache();
|
|
98261
|
+
if (automaticTypeDirectiveNames.length) {
|
|
98262
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
98263
|
+
var resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, getAutomaticTypeDirectiveContainingFile());
|
|
98264
|
+
for (var i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
98265
|
+
automaticTypeDirectiveResolutions.set(automaticTypeDirectiveNames[i], undefined, resolutions[i]);
|
|
98266
|
+
processTypeReferenceDirective(automaticTypeDirectiveNames[i], undefined, resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: automaticTypeDirectiveNames[i], packageId: (_d = resolutions[i].resolvedTypeReferenceDirective) === null || _d === void 0 ? void 0 : _d.packageId });
|
|
97995
98267
|
}
|
|
97996
98268
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
97997
98269
|
}
|
|
@@ -98022,13 +98294,13 @@ var ts;
|
|
|
98022
98294
|
var newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
|
98023
98295
|
if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat ||
|
|
98024
98296
|
(oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path)) {
|
|
98025
|
-
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions()
|
|
98297
|
+
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions());
|
|
98026
98298
|
}
|
|
98027
98299
|
}
|
|
98028
98300
|
if (!host.getParsedCommandLine) {
|
|
98029
98301
|
oldProgram.forEachResolvedProjectReference(function (resolvedProjectReference) {
|
|
98030
98302
|
if (!getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) {
|
|
98031
|
-
host.onReleaseOldSourceFile(resolvedProjectReference.sourceFile, oldProgram.getCompilerOptions()
|
|
98303
|
+
host.onReleaseOldSourceFile(resolvedProjectReference.sourceFile, oldProgram.getCompilerOptions());
|
|
98032
98304
|
}
|
|
98033
98305
|
});
|
|
98034
98306
|
}
|
|
@@ -98044,6 +98316,8 @@ var ts;
|
|
|
98044
98316
|
}
|
|
98045
98317
|
typeReferenceDirectiveResolutionCache = undefined;
|
|
98046
98318
|
oldProgram = undefined;
|
|
98319
|
+
oldBuildInfoProgram = undefined;
|
|
98320
|
+
oldProgramOrOldBuildInfoProgramConstructor = undefined;
|
|
98047
98321
|
var program = {
|
|
98048
98322
|
getRootFileNames: function () { return rootNames; },
|
|
98049
98323
|
getSourceFile: getSourceFile,
|
|
@@ -98051,6 +98325,7 @@ var ts;
|
|
|
98051
98325
|
getSourceFiles: function () { return files; },
|
|
98052
98326
|
getMissingFilePaths: function () { return missingFilePaths; },
|
|
98053
98327
|
getModuleResolutionCache: function () { return moduleResolutionCache; },
|
|
98328
|
+
getTypeReferenceDirectiveResolutionCache: function () { return typeReferenceDirectiveResolutionCache; },
|
|
98054
98329
|
getFilesByNameMap: function () { return filesByName; },
|
|
98055
98330
|
getCompilerOptions: function () { return options; },
|
|
98056
98331
|
getSyntacticDiagnostics: getSyntacticDiagnostics,
|
|
@@ -98075,6 +98350,9 @@ var ts;
|
|
|
98075
98350
|
getRelationCacheSizes: function () { return getTypeChecker().getRelationCacheSizes(); },
|
|
98076
98351
|
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
|
|
98077
98352
|
getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
|
|
98353
|
+
getAutomaticTypeDirectiveNames: function () { return automaticTypeDirectiveNames; },
|
|
98354
|
+
getAutomaticTypeDirectiveResolutions: function () { return automaticTypeDirectiveResolutions; },
|
|
98355
|
+
getAutomaticTypeDirectiveContainingFile: getAutomaticTypeDirectiveContainingFile,
|
|
98078
98356
|
isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
|
|
98079
98357
|
isSourceFileDefaultLibrary: isSourceFileDefaultLibrary,
|
|
98080
98358
|
getSourceFileFromReference: getSourceFileFromReference,
|
|
@@ -98084,12 +98362,12 @@ var ts;
|
|
|
98084
98362
|
usesUriStyleNodeCoreModules: usesUriStyleNodeCoreModules,
|
|
98085
98363
|
isEmittedFile: isEmittedFile,
|
|
98086
98364
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics,
|
|
98087
|
-
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
98088
98365
|
getProjectReferences: getProjectReferences,
|
|
98089
98366
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
98090
98367
|
getProjectReferenceRedirect: getProjectReferenceRedirect,
|
|
98091
98368
|
getResolvedProjectReferenceToRedirect: getResolvedProjectReferenceToRedirect,
|
|
98092
98369
|
getResolvedProjectReferenceByPath: getResolvedProjectReferenceByPath,
|
|
98370
|
+
getRedirectReferenceForResolution: getRedirectReferenceForResolution,
|
|
98093
98371
|
forEachResolvedProjectReference: forEachResolvedProjectReference,
|
|
98094
98372
|
isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
|
|
98095
98373
|
emitBuildInfo: emitBuildInfo,
|
|
@@ -98097,7 +98375,7 @@ var ts;
|
|
|
98097
98375
|
readFile: readFile,
|
|
98098
98376
|
directoryExists: directoryExists,
|
|
98099
98377
|
getSymlinkCache: getSymlinkCache,
|
|
98100
|
-
realpath: (
|
|
98378
|
+
realpath: (_e = host.realpath) === null || _e === void 0 ? void 0 : _e.bind(host),
|
|
98101
98379
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
98102
98380
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
98103
98381
|
structureIsReused: structureIsReused,
|
|
@@ -98111,6 +98389,8 @@ var ts;
|
|
|
98111
98389
|
case 0:
|
|
98112
98390
|
var _a = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason), file = _a.file, pos = _a.pos, end = _a.end;
|
|
98113
98391
|
return programDiagnostics.add(ts.createFileDiagnostic.apply(void 0, __spreadArray([file, ts.Debug.checkDefined(pos), ts.Debug.checkDefined(end) - pos, diagnostic.diagnostic], diagnostic.args || ts.emptyArray, false)));
|
|
98392
|
+
case 2:
|
|
98393
|
+
return diagnostic.diagnostics.forEach(function (d) { return programDiagnostics.add(d); });
|
|
98114
98394
|
default:
|
|
98115
98395
|
ts.Debug.assertNever(diagnostic);
|
|
98116
98396
|
}
|
|
@@ -98120,57 +98400,44 @@ var ts;
|
|
|
98120
98400
|
ts.performance.measure("Program", "beforeProgram", "afterProgram");
|
|
98121
98401
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
98122
98402
|
return program;
|
|
98123
|
-
function
|
|
98124
|
-
|
|
98125
|
-
|
|
98126
|
-
for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
|
|
98127
|
-
var elem = list_3[_i];
|
|
98128
|
-
programDiagnostics.add(elem);
|
|
98129
|
-
}
|
|
98403
|
+
function getAutomaticTypeDirectiveContainingFile() {
|
|
98404
|
+
var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
|
|
98405
|
+
return ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
98130
98406
|
}
|
|
98131
|
-
function
|
|
98132
|
-
|
|
98133
|
-
if (!moduleResolutionCache)
|
|
98407
|
+
function addResolutionDiagnostics(resolution) {
|
|
98408
|
+
if (!resolution.resolutionDiagnostics)
|
|
98134
98409
|
return;
|
|
98135
|
-
|
|
98136
|
-
|
|
98137
|
-
|
|
98138
|
-
|
|
98139
|
-
|
|
98140
|
-
|
|
98141
|
-
var n = names_4[_i];
|
|
98142
|
-
var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
|
|
98143
|
-
var name = typeof n === "string" ? n : n.fileName;
|
|
98144
|
-
i++;
|
|
98145
|
-
if (ts.isExternalModuleNameRelative(name))
|
|
98146
|
-
continue;
|
|
98147
|
-
var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
|
|
98148
|
-
addResolutionDiagnostics(diags);
|
|
98149
|
-
}
|
|
98410
|
+
(fileProcessingDiagnostics !== null && fileProcessingDiagnostics !== void 0 ? fileProcessingDiagnostics : (fileProcessingDiagnostics = [])).push({
|
|
98411
|
+
kind: 2,
|
|
98412
|
+
diagnostics: resolution.resolutionDiagnostics.map(function (d) { return ts.createCompilerDiagnostic(d.isImports
|
|
98413
|
+
? ts.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate
|
|
98414
|
+
: ts.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate, d.entry === "" ? "." : d.entry, d.packagePath); })
|
|
98415
|
+
});
|
|
98150
98416
|
}
|
|
98151
|
-
function resolveModuleNamesWorker(moduleNames, containingFile,
|
|
98417
|
+
function resolveModuleNamesWorker(moduleNames, containingFile, partialResolutionInfo, redirectedReference) {
|
|
98152
98418
|
if (!moduleNames.length)
|
|
98153
98419
|
return ts.emptyArray;
|
|
98154
98420
|
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
98155
|
-
|
|
98421
|
+
if (redirectedReference === undefined)
|
|
98422
|
+
redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
98156
98423
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "resolveModuleNamesWorker", { containingFileName: containingFileName });
|
|
98157
98424
|
ts.performance.mark("beforeResolveModule");
|
|
98158
|
-
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName,
|
|
98425
|
+
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName, redirectedReference || undefined, partialResolutionInfo);
|
|
98159
98426
|
ts.performance.mark("afterResolveModule");
|
|
98160
98427
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
98161
98428
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
98162
|
-
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
98163
98429
|
return result;
|
|
98164
98430
|
}
|
|
98165
|
-
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
|
|
98431
|
+
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, partialResolutionInfo, redirectedReference) {
|
|
98166
98432
|
if (!typeDirectiveNames.length)
|
|
98167
98433
|
return [];
|
|
98168
98434
|
var containingFileName = !ts.isString(containingFile) ? ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
98169
|
-
|
|
98435
|
+
if (redirectedReference === undefined && !ts.isString(containingFile))
|
|
98436
|
+
redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
98170
98437
|
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
98171
98438
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "resolveTypeReferenceDirectiveNamesWorker", { containingFileName: containingFileName });
|
|
98172
98439
|
ts.performance.mark("beforeResolveTypeReference");
|
|
98173
|
-
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, containingFileMode);
|
|
98440
|
+
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference || undefined, containingFileMode, partialResolutionInfo);
|
|
98174
98441
|
ts.performance.mark("afterResolveTypeReference");
|
|
98175
98442
|
ts.performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
98176
98443
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -98216,9 +98483,6 @@ var ts;
|
|
|
98216
98483
|
}
|
|
98217
98484
|
return ts.libs.length + 2;
|
|
98218
98485
|
}
|
|
98219
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, mode) {
|
|
98220
|
-
return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, mode);
|
|
98221
|
-
}
|
|
98222
98486
|
function toPath(fileName) {
|
|
98223
98487
|
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
98224
98488
|
}
|
|
@@ -98242,8 +98506,9 @@ var ts;
|
|
|
98242
98506
|
return classifiableNames;
|
|
98243
98507
|
}
|
|
98244
98508
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
98509
|
+
var _a;
|
|
98245
98510
|
if (structureIsReused === 0 && !file.ambientModuleNames.length) {
|
|
98246
|
-
return resolveModuleNamesWorker(moduleNames, file, undefined);
|
|
98511
|
+
return resolveModuleNamesWorker(moduleNames, file, undefined, undefined);
|
|
98247
98512
|
}
|
|
98248
98513
|
var oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
98249
98514
|
if (oldSourceFile !== file && file.resolvedModules) {
|
|
@@ -98258,21 +98523,34 @@ var ts;
|
|
|
98258
98523
|
return result_14;
|
|
98259
98524
|
}
|
|
98260
98525
|
var unknownModuleNames;
|
|
98261
|
-
var
|
|
98526
|
+
var unknownModuleNamesIndex;
|
|
98262
98527
|
var reusedNames;
|
|
98263
|
-
var
|
|
98528
|
+
var result;
|
|
98529
|
+
var predictedToResolveToAmbientModuleMarker = true;
|
|
98530
|
+
var redirectedReference;
|
|
98264
98531
|
for (var i = 0; i < moduleNames.length; i++) {
|
|
98265
98532
|
var moduleName = moduleNames[i];
|
|
98266
|
-
if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
|
|
98267
|
-
var
|
|
98268
|
-
|
|
98533
|
+
if (oldBuildInfoProgram || file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
|
|
98534
|
+
var mode = getModeForResolutionAtIndex(file, i);
|
|
98535
|
+
var oldResolution = !oldBuildInfoProgram ?
|
|
98536
|
+
(_a = oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.get(moduleName, mode) :
|
|
98537
|
+
oldBuildInfoProgram.getResolvedModule(ts.getDirectoryPath(file.path), moduleName, mode, (redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(file) || false) : redirectedReference) || undefined);
|
|
98538
|
+
if (oldResolution === null || oldResolution === void 0 ? void 0 : oldResolution.resolvedModule) {
|
|
98269
98539
|
if (ts.isTraceEnabled(options, host)) {
|
|
98270
|
-
ts.
|
|
98271
|
-
|
|
98272
|
-
ts.
|
|
98540
|
+
var fileLocation = ts.getNormalizedAbsolutePath(file.originalFileName, currentDirectory);
|
|
98541
|
+
if (!oldBuildInfoProgram) {
|
|
98542
|
+
ts.trace(host, oldResolution.resolvedModule.packageId ?
|
|
98543
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
98544
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2, moduleName, fileLocation, oldResolution.resolvedModule.resolvedFileName, oldResolution.resolvedModule.packageId && ts.packageIdToString(oldResolution.resolvedModule.packageId));
|
|
98545
|
+
}
|
|
98546
|
+
else {
|
|
98547
|
+
ts.trace(host, oldResolution.resolvedModule.packageId ?
|
|
98548
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 :
|
|
98549
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3, moduleName, fileLocation, ts.getDirectoryPath(fileLocation), oldResolution.resolvedModule.resolvedFileName, oldResolution.resolvedModule.packageId && ts.packageIdToString(oldResolution.resolvedModule.packageId));
|
|
98550
|
+
}
|
|
98273
98551
|
}
|
|
98274
|
-
(result
|
|
98275
|
-
(reusedNames
|
|
98552
|
+
(result !== null && result !== void 0 ? result : (result = new Array(moduleNames.length)))[i] = oldResolution;
|
|
98553
|
+
(reusedNames !== null && reusedNames !== void 0 ? reusedNames : (reusedNames = [])).push({ name: moduleName, mode: mode });
|
|
98276
98554
|
continue;
|
|
98277
98555
|
}
|
|
98278
98556
|
}
|
|
@@ -98287,14 +98565,15 @@ var ts;
|
|
|
98287
98565
|
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, i);
|
|
98288
98566
|
}
|
|
98289
98567
|
if (resolvesToAmbientModuleInNonModifiedFile) {
|
|
98290
|
-
(result
|
|
98568
|
+
(result !== null && result !== void 0 ? result : (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
|
|
98291
98569
|
}
|
|
98292
98570
|
else {
|
|
98293
|
-
(unknownModuleNames
|
|
98571
|
+
(unknownModuleNames !== null && unknownModuleNames !== void 0 ? unknownModuleNames : (unknownModuleNames = [])).push(moduleName);
|
|
98572
|
+
(unknownModuleNamesIndex !== null && unknownModuleNamesIndex !== void 0 ? unknownModuleNamesIndex : (unknownModuleNamesIndex = [])).push(i);
|
|
98294
98573
|
}
|
|
98295
98574
|
}
|
|
98296
98575
|
var resolutions = unknownModuleNames && unknownModuleNames.length
|
|
98297
|
-
? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames)
|
|
98576
|
+
? resolveModuleNamesWorker(unknownModuleNames, file, { reusedNames: reusedNames, namesIndex: unknownModuleNamesIndex }, redirectedReference)
|
|
98298
98577
|
: ts.emptyArray;
|
|
98299
98578
|
if (!result) {
|
|
98300
98579
|
ts.Debug.assert(resolutions.length === moduleNames.length);
|
|
@@ -98304,7 +98583,7 @@ var ts;
|
|
|
98304
98583
|
for (var i = 0; i < result.length; i++) {
|
|
98305
98584
|
if (result[i]) {
|
|
98306
98585
|
if (result[i] === predictedToResolveToAmbientModuleMarker) {
|
|
98307
|
-
result[i] =
|
|
98586
|
+
result[i] = emptyResolution;
|
|
98308
98587
|
}
|
|
98309
98588
|
}
|
|
98310
98589
|
else {
|
|
@@ -98332,6 +98611,78 @@ var ts;
|
|
|
98332
98611
|
return true;
|
|
98333
98612
|
}
|
|
98334
98613
|
}
|
|
98614
|
+
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
98615
|
+
var _a;
|
|
98616
|
+
if (structureIsReused === 0) {
|
|
98617
|
+
return resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, undefined, undefined);
|
|
98618
|
+
}
|
|
98619
|
+
var containingSourceFile = !ts.isString(containingFile) ? containingFile : undefined;
|
|
98620
|
+
var inferredTypeFile = !ts.isString(containingFile) ? undefined : containingFile;
|
|
98621
|
+
var oldSourceFile = containingSourceFile && (oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getSourceFile(containingSourceFile.fileName));
|
|
98622
|
+
if (containingSourceFile && oldSourceFile !== containingSourceFile && containingSourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
98623
|
+
var result_15 = [];
|
|
98624
|
+
for (var _i = 0, _b = typeDirectiveNames; _i < _b.length; _i++) {
|
|
98625
|
+
var typeDirectiveName = _b[_i];
|
|
98626
|
+
var resolvedTypeReferenceDirective = containingSourceFile.resolvedTypeReferenceDirectiveNames.get(ts.toFileNameLowerCase(typeDirectiveName.fileName), typeDirectiveName.resolutionMode || containingSourceFile.impliedNodeFormat);
|
|
98627
|
+
result_15.push(resolvedTypeReferenceDirective);
|
|
98628
|
+
}
|
|
98629
|
+
return result_15;
|
|
98630
|
+
}
|
|
98631
|
+
var unknownTypeReferenceDirectiveNames;
|
|
98632
|
+
var unknownTypeReferenceDirectiveNamesIndex;
|
|
98633
|
+
var result;
|
|
98634
|
+
var reusedNames;
|
|
98635
|
+
var canReuseResolutions = oldBuildInfoProgram || (containingSourceFile ?
|
|
98636
|
+
containingSourceFile === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path) :
|
|
98637
|
+
!hasInvalidatedResolution(toPath(inferredTypeFile)));
|
|
98638
|
+
var redirectedReference;
|
|
98639
|
+
for (var i = 0; i < typeDirectiveNames.length; i++) {
|
|
98640
|
+
var entry = typeDirectiveNames[i];
|
|
98641
|
+
if (canReuseResolutions) {
|
|
98642
|
+
var typeDirectiveName = !ts.isString(entry) ? entry.fileName.toLowerCase() : entry;
|
|
98643
|
+
var mode = getModeForFileReference(entry, containingSourceFile === null || containingSourceFile === void 0 ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
98644
|
+
var oldResolution = !oldBuildInfoProgram ?
|
|
98645
|
+
(_a = (containingSourceFile ? oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.resolvedTypeReferenceDirectiveNames : oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions())) === null || _a === void 0 ? void 0 : _a.get(typeDirectiveName, mode) :
|
|
98646
|
+
oldBuildInfoProgram.getResolvedTypeReferenceDirective(ts.getDirectoryPath(containingSourceFile ? containingSourceFile.path : toPath(inferredTypeFile)), typeDirectiveName, mode, containingSourceFile && (redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(containingSourceFile) || false) : redirectedReference) || undefined);
|
|
98647
|
+
if (oldResolution === null || oldResolution === void 0 ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
98648
|
+
if (ts.isTraceEnabled(options, host)) {
|
|
98649
|
+
var fileLocation = containingSourceFile ? ts.getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory) : inferredTypeFile;
|
|
98650
|
+
if (!oldBuildInfoProgram) {
|
|
98651
|
+
ts.trace(host, oldResolution.resolvedTypeReferenceDirective.packageId ?
|
|
98652
|
+
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
98653
|
+
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2, typeDirectiveName, fileLocation, oldResolution.resolvedTypeReferenceDirective.resolvedFileName, oldResolution.resolvedTypeReferenceDirective.packageId && ts.packageIdToString(oldResolution.resolvedTypeReferenceDirective.packageId));
|
|
98654
|
+
}
|
|
98655
|
+
else {
|
|
98656
|
+
ts.trace(host, oldResolution.resolvedTypeReferenceDirective.packageId ?
|
|
98657
|
+
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 :
|
|
98658
|
+
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3, typeDirectiveName, fileLocation, ts.getDirectoryPath(fileLocation), oldResolution.resolvedTypeReferenceDirective.resolvedFileName, oldResolution.resolvedTypeReferenceDirective.packageId && ts.packageIdToString(oldResolution.resolvedTypeReferenceDirective.packageId));
|
|
98659
|
+
}
|
|
98660
|
+
}
|
|
98661
|
+
(result || (result = new Array(typeDirectiveNames.length)))[i] = oldResolution;
|
|
98662
|
+
(reusedNames !== null && reusedNames !== void 0 ? reusedNames : (reusedNames = [])).push({ name: typeDirectiveName, mode: mode });
|
|
98663
|
+
continue;
|
|
98664
|
+
}
|
|
98665
|
+
}
|
|
98666
|
+
(unknownTypeReferenceDirectiveNames !== null && unknownTypeReferenceDirectiveNames !== void 0 ? unknownTypeReferenceDirectiveNames : (unknownTypeReferenceDirectiveNames = [])).push(entry);
|
|
98667
|
+
(unknownTypeReferenceDirectiveNamesIndex !== null && unknownTypeReferenceDirectiveNamesIndex !== void 0 ? unknownTypeReferenceDirectiveNamesIndex : (unknownTypeReferenceDirectiveNamesIndex = [])).push(i);
|
|
98668
|
+
}
|
|
98669
|
+
if (!unknownTypeReferenceDirectiveNames)
|
|
98670
|
+
return result || ts.emptyArray;
|
|
98671
|
+
var resolutions = resolveTypeReferenceDirectiveNamesWorker(unknownTypeReferenceDirectiveNames, containingFile, { reusedNames: reusedNames, namesIndex: unknownTypeReferenceDirectiveNamesIndex }, redirectedReference);
|
|
98672
|
+
if (!result) {
|
|
98673
|
+
ts.Debug.assert(resolutions.length === typeDirectiveNames.length);
|
|
98674
|
+
return resolutions;
|
|
98675
|
+
}
|
|
98676
|
+
var j = 0;
|
|
98677
|
+
for (var i = 0; i < result.length; i++) {
|
|
98678
|
+
if (!result[i]) {
|
|
98679
|
+
result[i] = resolutions[j];
|
|
98680
|
+
j++;
|
|
98681
|
+
}
|
|
98682
|
+
}
|
|
98683
|
+
ts.Debug.assert(j === resolutions.length);
|
|
98684
|
+
return result;
|
|
98685
|
+
}
|
|
98335
98686
|
function canReuseProjectReferences() {
|
|
98336
98687
|
return !forEachProjectReference(oldProgram.getProjectReferences(), oldProgram.getResolvedProjectReferences(), function (oldResolvedRef, parent, index) {
|
|
98337
98688
|
var newRef = (parent ? parent.commandLine.projectReferences : projectReferences)[index];
|
|
@@ -98350,12 +98701,17 @@ var ts;
|
|
|
98350
98701
|
});
|
|
98351
98702
|
}
|
|
98352
98703
|
function tryReuseStructureFromOldProgram() {
|
|
98353
|
-
var
|
|
98354
|
-
if (!
|
|
98704
|
+
var oldOptions = (oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getCompilerOptions()) || (oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getCompilerOptions());
|
|
98705
|
+
if (!oldOptions || ts.changesAffectModuleResolution(oldOptions, options)) {
|
|
98355
98706
|
return 0;
|
|
98356
98707
|
}
|
|
98357
|
-
var
|
|
98358
|
-
|
|
98708
|
+
var result = tryReuseStructureFromOldProgramWorker();
|
|
98709
|
+
return options.cacheResolutions && (oldProgram || oldBuildInfoProgram) && result === 0 ?
|
|
98710
|
+
1 :
|
|
98711
|
+
result;
|
|
98712
|
+
}
|
|
98713
|
+
function tryReuseStructureFromOldProgramWorker() {
|
|
98714
|
+
if (!oldProgram) {
|
|
98359
98715
|
return 0;
|
|
98360
98716
|
}
|
|
98361
98717
|
var oldRootNames = oldProgram.getRootFileNames();
|
|
@@ -98370,7 +98726,7 @@ var ts;
|
|
|
98370
98726
|
}
|
|
98371
98727
|
var newSourceFiles = [];
|
|
98372
98728
|
var modifiedSourceFiles = [];
|
|
98373
|
-
structureIsReused =
|
|
98729
|
+
structureIsReused = 3;
|
|
98374
98730
|
if (oldProgram.getMissingFilePaths().some(function (missingFilePath) { return host.fileExists(missingFilePath); })) {
|
|
98375
98731
|
return 0;
|
|
98376
98732
|
}
|
|
@@ -98378,14 +98734,13 @@ var ts;
|
|
|
98378
98734
|
var seenPackageNames = new ts.Map();
|
|
98379
98735
|
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
|
|
98380
98736
|
var oldSourceFile = oldSourceFiles_2[_i];
|
|
98381
|
-
var sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName
|
|
98737
|
+
var sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName);
|
|
98382
98738
|
var newSourceFile = host.getSourceFileByPath
|
|
98383
98739
|
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, sourceFileOptions, undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat)
|
|
98384
98740
|
: host.getSourceFile(oldSourceFile.fileName, sourceFileOptions, undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat);
|
|
98385
98741
|
if (!newSourceFile) {
|
|
98386
98742
|
return 0;
|
|
98387
98743
|
}
|
|
98388
|
-
newSourceFile.packageJsonLocations = ((_a = sourceFileOptions.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
98389
98744
|
newSourceFile.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
98390
98745
|
ts.Debug.assert(!newSourceFile.redirectInfo, "Host should not return a redirect source file from `getSourceFile`");
|
|
98391
98746
|
var fileChanged = void 0;
|
|
@@ -98420,86 +98775,95 @@ var ts;
|
|
|
98420
98775
|
}
|
|
98421
98776
|
if (fileChanged) {
|
|
98422
98777
|
if (oldSourceFile.impliedNodeFormat !== newSourceFile.impliedNodeFormat) {
|
|
98423
|
-
structureIsReused =
|
|
98778
|
+
structureIsReused = 2;
|
|
98424
98779
|
}
|
|
98425
98780
|
else if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
98426
|
-
structureIsReused =
|
|
98781
|
+
structureIsReused = 2;
|
|
98427
98782
|
}
|
|
98428
98783
|
else if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
|
98429
|
-
structureIsReused =
|
|
98784
|
+
structureIsReused = 2;
|
|
98430
98785
|
}
|
|
98431
98786
|
else if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
|
98432
|
-
structureIsReused =
|
|
98787
|
+
structureIsReused = 2;
|
|
98433
98788
|
}
|
|
98434
98789
|
else {
|
|
98435
98790
|
collectExternalModuleReferences(newSourceFile);
|
|
98436
98791
|
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
|
|
98437
|
-
structureIsReused =
|
|
98792
|
+
structureIsReused = 2;
|
|
98438
98793
|
}
|
|
98439
98794
|
else if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
|
|
98440
|
-
structureIsReused =
|
|
98795
|
+
structureIsReused = 2;
|
|
98441
98796
|
}
|
|
98442
98797
|
else if ((oldSourceFile.flags & 6291456) !== (newSourceFile.flags & 6291456)) {
|
|
98443
|
-
structureIsReused =
|
|
98798
|
+
structureIsReused = 2;
|
|
98444
98799
|
}
|
|
98445
98800
|
else if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
98446
|
-
structureIsReused =
|
|
98801
|
+
structureIsReused = 2;
|
|
98447
98802
|
}
|
|
98448
98803
|
}
|
|
98449
98804
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
98450
98805
|
}
|
|
98451
98806
|
else if (hasInvalidatedResolution(oldSourceFile.path)) {
|
|
98452
|
-
structureIsReused =
|
|
98807
|
+
structureIsReused = 2;
|
|
98453
98808
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
98454
98809
|
}
|
|
98455
98810
|
newSourceFiles.push(newSourceFile);
|
|
98456
98811
|
}
|
|
98457
|
-
if (structureIsReused !==
|
|
98812
|
+
if (structureIsReused !== 3) {
|
|
98458
98813
|
return structureIsReused;
|
|
98459
98814
|
}
|
|
98460
98815
|
var modifiedFiles = modifiedSourceFiles.map(function (f) { return f.oldFile; });
|
|
98461
|
-
for (var
|
|
98462
|
-
var oldFile = oldSourceFiles_3[
|
|
98816
|
+
for (var _a = 0, oldSourceFiles_3 = oldSourceFiles; _a < oldSourceFiles_3.length; _a++) {
|
|
98817
|
+
var oldFile = oldSourceFiles_3[_a];
|
|
98463
98818
|
if (!ts.contains(modifiedFiles, oldFile)) {
|
|
98464
|
-
for (var
|
|
98465
|
-
var moduleName =
|
|
98819
|
+
for (var _b = 0, _c = oldFile.ambientModuleNames; _b < _c.length; _b++) {
|
|
98820
|
+
var moduleName = _c[_b];
|
|
98466
98821
|
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
|
|
98467
98822
|
}
|
|
98468
98823
|
}
|
|
98469
98824
|
}
|
|
98470
|
-
for (var
|
|
98471
|
-
var
|
|
98825
|
+
for (var _d = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _d < modifiedSourceFiles_1.length; _d++) {
|
|
98826
|
+
var _e = modifiedSourceFiles_1[_d], oldSourceFile = _e.oldFile, newSourceFile = _e.newFile;
|
|
98472
98827
|
var moduleNames = getModuleNames(newSourceFile);
|
|
98473
98828
|
var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
98474
98829
|
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, oldSourceFile, ts.moduleResolutionIsEqualTo);
|
|
98475
98830
|
if (resolutionsChanged) {
|
|
98476
|
-
structureIsReused =
|
|
98831
|
+
structureIsReused = 2;
|
|
98477
98832
|
newSourceFile.resolvedModules = ts.zipToModeAwareCache(newSourceFile, moduleNames, resolutions);
|
|
98478
98833
|
}
|
|
98479
98834
|
else {
|
|
98480
98835
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
98481
98836
|
}
|
|
98482
98837
|
var typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
98483
|
-
var typeReferenceResolutions =
|
|
98838
|
+
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
|
|
98484
98839
|
var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
98485
98840
|
if (typeReferenceResolutionsChanged) {
|
|
98486
|
-
structureIsReused =
|
|
98841
|
+
structureIsReused = 2;
|
|
98487
98842
|
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
98488
98843
|
}
|
|
98489
98844
|
else {
|
|
98490
98845
|
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
98491
98846
|
}
|
|
98492
98847
|
}
|
|
98493
|
-
if (structureIsReused !==
|
|
98848
|
+
if (structureIsReused !== 3) {
|
|
98494
98849
|
return structureIsReused;
|
|
98495
98850
|
}
|
|
98496
|
-
if (ts.changesAffectingProgramStructure(
|
|
98497
|
-
return
|
|
98851
|
+
if (ts.changesAffectingProgramStructure(oldProgram.getCompilerOptions(), options)) {
|
|
98852
|
+
return 2;
|
|
98853
|
+
}
|
|
98854
|
+
if (host.hasChangedAutomaticTypeDirectiveNames) {
|
|
98855
|
+
if (host.hasChangedAutomaticTypeDirectiveNames())
|
|
98856
|
+
return 2;
|
|
98857
|
+
}
|
|
98858
|
+
else {
|
|
98859
|
+
automaticTypeDirectiveNames = ts.getAutomaticTypeDirectiveNames(options, host);
|
|
98860
|
+
if (!ts.arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
|
|
98861
|
+
return 2;
|
|
98498
98862
|
}
|
|
98499
98863
|
missingFilePaths = oldProgram.getMissingFilePaths();
|
|
98500
98864
|
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
98501
|
-
for (var
|
|
98502
|
-
var newSourceFile = newSourceFiles_1[
|
|
98865
|
+
for (var _f = 0, newSourceFiles_1 = newSourceFiles; _f < newSourceFiles_1.length; _f++) {
|
|
98866
|
+
var newSourceFile = newSourceFiles_1[_f];
|
|
98503
98867
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
98504
98868
|
}
|
|
98505
98869
|
var oldFilesByNameMap = oldProgram.getFilesByNameMap();
|
|
@@ -98520,10 +98884,12 @@ var ts;
|
|
|
98520
98884
|
fileReasons = oldProgram.getFileIncludeReasons();
|
|
98521
98885
|
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
|
98522
98886
|
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
|
|
98887
|
+
automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames();
|
|
98888
|
+
automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions();
|
|
98523
98889
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
98524
98890
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
98525
98891
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
98526
|
-
return
|
|
98892
|
+
return 3;
|
|
98527
98893
|
}
|
|
98528
98894
|
function getEmitHost(writeFileCallback) {
|
|
98529
98895
|
return {
|
|
@@ -99201,14 +99567,12 @@ var ts;
|
|
|
99201
99567
|
}
|
|
99202
99568
|
}
|
|
99203
99569
|
function createRedirectSourceFile(redirectTarget, unredirected, fileName, path, resolvedPath, originalFileName, sourceFileOptions) {
|
|
99204
|
-
var _a;
|
|
99205
99570
|
var redirect = Object.create(redirectTarget);
|
|
99206
99571
|
redirect.fileName = fileName;
|
|
99207
99572
|
redirect.path = path;
|
|
99208
99573
|
redirect.resolvedPath = resolvedPath;
|
|
99209
99574
|
redirect.originalFileName = originalFileName;
|
|
99210
99575
|
redirect.redirectInfo = { redirectTarget: redirectTarget, unredirected: unredirected };
|
|
99211
|
-
redirect.packageJsonLocations = ((_a = sourceFileOptions.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
99212
99576
|
redirect.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
99213
99577
|
sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
|
|
99214
99578
|
Object.defineProperties(redirect, {
|
|
@@ -99233,7 +99597,7 @@ var ts;
|
|
|
99233
99597
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
99234
99598
|
return result;
|
|
99235
99599
|
}
|
|
99236
|
-
function getCreateSourceFileOptions(fileName
|
|
99600
|
+
function getCreateSourceFileOptions(fileName) {
|
|
99237
99601
|
var result = getImpliedNodeFormatForFileWorker(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
99238
99602
|
var languageVersion = ts.getEmitScriptTarget(options);
|
|
99239
99603
|
var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options);
|
|
@@ -99241,7 +99605,7 @@ var ts;
|
|
|
99241
99605
|
{ languageVersion: languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator };
|
|
99242
99606
|
}
|
|
99243
99607
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
99244
|
-
var _a
|
|
99608
|
+
var _a;
|
|
99245
99609
|
var path = toPath(fileName);
|
|
99246
99610
|
if (useSourceOfProjectReferenceRedirect) {
|
|
99247
99611
|
var source = getSourceOfProjectReferenceRedirect(path);
|
|
@@ -99311,7 +99675,7 @@ var ts;
|
|
|
99311
99675
|
redirectedPath = toPath(redirect);
|
|
99312
99676
|
}
|
|
99313
99677
|
}
|
|
99314
|
-
var sourceFileOptions = getCreateSourceFileOptions(fileName
|
|
99678
|
+
var sourceFileOptions = getCreateSourceFileOptions(fileName);
|
|
99315
99679
|
var file = host.getSourceFile(fileName, sourceFileOptions, function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(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));
|
|
99316
99680
|
if (packageId) {
|
|
99317
99681
|
var packageIdKey = ts.packageIdToString(packageId);
|
|
@@ -99337,7 +99701,6 @@ var ts;
|
|
|
99337
99701
|
file.path = path;
|
|
99338
99702
|
file.resolvedPath = toPath(fileName);
|
|
99339
99703
|
file.originalFileName = originalFileName;
|
|
99340
|
-
file.packageJsonLocations = ((_b = sourceFileOptions.packageJsonLocations) === null || _b === void 0 ? void 0 : _b.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
99341
99704
|
file.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
99342
99705
|
addFileIncludeReason(file, reason);
|
|
99343
99706
|
if (host.useCaseSensitiveFileNames()) {
|
|
@@ -99454,33 +99817,40 @@ var ts;
|
|
|
99454
99817
|
}
|
|
99455
99818
|
function processTypeReferenceDirectives(file) {
|
|
99456
99819
|
var typeDirectives = file.typeReferenceDirectives;
|
|
99457
|
-
if (!typeDirectives) {
|
|
99820
|
+
if (!typeDirectives.length) {
|
|
99821
|
+
file.resolvedTypeReferenceDirectiveNames = undefined;
|
|
99458
99822
|
return;
|
|
99459
99823
|
}
|
|
99460
|
-
var resolutions =
|
|
99824
|
+
var resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
|
|
99461
99825
|
for (var index = 0; index < typeDirectives.length; index++) {
|
|
99462
99826
|
var ref = file.typeReferenceDirectives[index];
|
|
99463
99827
|
var resolvedTypeReferenceDirective = resolutions[index];
|
|
99464
99828
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
99465
|
-
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
99829
|
+
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective, getModeForFileReference(ref, file.impliedNodeFormat));
|
|
99466
99830
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
99467
99831
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
99468
|
-
|
|
99832
|
+
(fileProcessingDiagnostics !== null && fileProcessingDiagnostics !== void 0 ? fileProcessingDiagnostics : (fileProcessingDiagnostics = [])).push({
|
|
99833
|
+
kind: 2,
|
|
99834
|
+
diagnostics: [ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)]
|
|
99835
|
+
});
|
|
99469
99836
|
}
|
|
99470
99837
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
99471
99838
|
}
|
|
99472
99839
|
}
|
|
99473
|
-
function processTypeReferenceDirective(typeReferenceDirective, mode,
|
|
99474
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined });
|
|
99475
|
-
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
99840
|
+
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
|
|
99841
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolution.resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined });
|
|
99842
|
+
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason);
|
|
99476
99843
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
99477
99844
|
}
|
|
99478
|
-
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
99479
|
-
var
|
|
99845
|
+
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason) {
|
|
99846
|
+
var _a;
|
|
99847
|
+
addResolutionDiagnostics(resolution);
|
|
99848
|
+
var previousResolution = (_a = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode)) === null || _a === void 0 ? void 0 : _a.resolvedTypeReferenceDirective;
|
|
99480
99849
|
if (previousResolution && previousResolution.primary) {
|
|
99481
99850
|
return;
|
|
99482
99851
|
}
|
|
99483
99852
|
var saveResolution = true;
|
|
99853
|
+
var resolvedTypeReferenceDirective = resolution.resolvedTypeReferenceDirective;
|
|
99484
99854
|
if (resolvedTypeReferenceDirective) {
|
|
99485
99855
|
if (resolvedTypeReferenceDirective.isExternalLibraryImport)
|
|
99486
99856
|
currentNodeModulesDepth++;
|
|
@@ -99509,7 +99879,7 @@ var ts;
|
|
|
99509
99879
|
addFilePreprocessingFileExplainingDiagnostic(undefined, reason, ts.Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]);
|
|
99510
99880
|
}
|
|
99511
99881
|
if (saveResolution) {
|
|
99512
|
-
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode,
|
|
99882
|
+
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolution);
|
|
99513
99883
|
}
|
|
99514
99884
|
}
|
|
99515
99885
|
function pathForLibFile(libFileName) {
|
|
@@ -99538,7 +99908,7 @@ var ts;
|
|
|
99538
99908
|
var unqualifiedLibName = ts.removeSuffix(ts.removePrefix(libName, "lib."), ".d.ts");
|
|
99539
99909
|
var suggestion = ts.getSpellingSuggestion(unqualifiedLibName, ts.libs, ts.identity);
|
|
99540
99910
|
var diagnostic = suggestion ? ts.Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : ts.Diagnostics.Cannot_find_lib_definition_for_0;
|
|
99541
|
-
(fileProcessingDiagnostics
|
|
99911
|
+
(fileProcessingDiagnostics !== null && fileProcessingDiagnostics !== void 0 ? fileProcessingDiagnostics : (fileProcessingDiagnostics = [])).push({
|
|
99542
99912
|
kind: 0,
|
|
99543
99913
|
reason: { kind: ts.FileIncludeKind.LibReferenceDirective, file: file.path, index: index, },
|
|
99544
99914
|
diagnostic: diagnostic,
|
|
@@ -99561,19 +99931,20 @@ var ts;
|
|
|
99561
99931
|
for (var index = 0; index < moduleNames.length; index++) {
|
|
99562
99932
|
var resolution = resolutions[index];
|
|
99563
99933
|
ts.setResolvedModule(file, moduleNames[index], resolution, getModeForResolutionAtIndex(file, index));
|
|
99564
|
-
|
|
99934
|
+
addResolutionDiagnostics(resolution);
|
|
99935
|
+
if (!resolution.resolvedModule) {
|
|
99565
99936
|
continue;
|
|
99566
99937
|
}
|
|
99567
|
-
var isFromNodeModulesSearch = resolution.isExternalLibraryImport;
|
|
99568
|
-
var isJsFile = !ts.resolutionExtensionIsTSOrJson(resolution.extension);
|
|
99938
|
+
var isFromNodeModulesSearch = resolution.resolvedModule.isExternalLibraryImport;
|
|
99939
|
+
var isJsFile = !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension);
|
|
99569
99940
|
var isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile;
|
|
99570
|
-
var resolvedFileName = resolution.resolvedFileName;
|
|
99941
|
+
var resolvedFileName = resolution.resolvedModule.resolvedFileName;
|
|
99571
99942
|
if (isFromNodeModulesSearch) {
|
|
99572
99943
|
currentNodeModulesDepth++;
|
|
99573
99944
|
}
|
|
99574
99945
|
var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth;
|
|
99575
99946
|
var shouldAddFile = resolvedFileName
|
|
99576
|
-
&& !getResolutionDiagnostic(optionsForFile, resolution)
|
|
99947
|
+
&& !getResolutionDiagnostic(optionsForFile, resolution.resolvedModule)
|
|
99577
99948
|
&& !optionsForFile.noResolve
|
|
99578
99949
|
&& index < file.imports.length
|
|
99579
99950
|
&& !elideImport
|
|
@@ -99583,7 +99954,7 @@ var ts;
|
|
|
99583
99954
|
modulesWithElidedImports.set(file.path, true);
|
|
99584
99955
|
}
|
|
99585
99956
|
else if (shouldAddFile) {
|
|
99586
|
-
findSourceFile(resolvedFileName, false, false, { kind: ts.FileIncludeKind.Import, file: file.path, index: index, }, resolution.packageId);
|
|
99957
|
+
findSourceFile(resolvedFileName, false, false, { kind: ts.FileIncludeKind.Import, file: file.path, index: index, }, resolution.resolvedModule.packageId);
|
|
99587
99958
|
}
|
|
99588
99959
|
if (isFromNodeModulesSearch) {
|
|
99589
99960
|
currentNodeModulesDepth--;
|
|
@@ -99684,6 +100055,9 @@ var ts;
|
|
|
99684
100055
|
createDiagnosticForOptionName(ts.Diagnostics.Composite_projects_may_not_disable_incremental_compilation, "declaration");
|
|
99685
100056
|
}
|
|
99686
100057
|
}
|
|
100058
|
+
if (options.cacheResolutions && !ts.isIncrementalCompilation(options)) {
|
|
100059
|
+
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "cacheResolutions", "incremental", "composite");
|
|
100060
|
+
}
|
|
99687
100061
|
var outputFile = ts.outFile(options);
|
|
99688
100062
|
if (options.tsBuildInfoFile) {
|
|
99689
100063
|
if (!ts.isIncrementalCompilation(options)) {
|
|
@@ -99933,7 +100307,7 @@ var ts;
|
|
|
99933
100307
|
}
|
|
99934
100308
|
}
|
|
99935
100309
|
function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
|
|
99936
|
-
(fileProcessingDiagnostics
|
|
100310
|
+
(fileProcessingDiagnostics !== null && fileProcessingDiagnostics !== void 0 ? fileProcessingDiagnostics : (fileProcessingDiagnostics = [])).push({
|
|
99937
100311
|
kind: 1,
|
|
99938
100312
|
file: file && file.path,
|
|
99939
100313
|
fileProcessingReason: fileProcessingReason,
|
|
@@ -100194,8 +100568,8 @@ var ts;
|
|
|
100194
100568
|
if (!symlinks) {
|
|
100195
100569
|
symlinks = ts.createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
100196
100570
|
}
|
|
100197
|
-
if (files &&
|
|
100198
|
-
symlinks.setSymlinksFromResolutions(files,
|
|
100571
|
+
if (files && automaticTypeDirectiveResolutions && !symlinks.hasProcessedResolutions()) {
|
|
100572
|
+
symlinks.setSymlinksFromResolutions(files, automaticTypeDirectiveResolutions);
|
|
100199
100573
|
}
|
|
100200
100574
|
return symlinks;
|
|
100201
100575
|
}
|
|
@@ -100554,7 +100928,8 @@ var ts;
|
|
|
100554
100928
|
}
|
|
100555
100929
|
}
|
|
100556
100930
|
if (sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
100557
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (
|
|
100931
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (_a) {
|
|
100932
|
+
var resolvedTypeReferenceDirective = _a.resolvedTypeReferenceDirective;
|
|
100558
100933
|
if (!resolvedTypeReferenceDirective) {
|
|
100559
100934
|
return;
|
|
100560
100935
|
}
|
|
@@ -100603,12 +100978,13 @@ var ts;
|
|
|
100603
100978
|
return oldState && !oldState.referencedMap === !newReferencedMap;
|
|
100604
100979
|
}
|
|
100605
100980
|
BuilderState.canReuseOldState = canReuseOldState;
|
|
100606
|
-
function create(newProgram,
|
|
100981
|
+
function create(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
100607
100982
|
var _a, _b, _c;
|
|
100608
100983
|
var fileInfos = new ts.Map();
|
|
100609
100984
|
var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
|
|
100610
100985
|
var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
|
|
100611
100986
|
var useOldState = canReuseOldState(referencedMap, oldState);
|
|
100987
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames());
|
|
100612
100988
|
newProgram.getTypeChecker();
|
|
100613
100989
|
for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
|
|
100614
100990
|
var sourceFile = _d[_i];
|
|
@@ -100652,23 +101028,23 @@ var ts;
|
|
|
100652
101028
|
state.allFileNames = undefined;
|
|
100653
101029
|
}
|
|
100654
101030
|
BuilderState.releaseCache = releaseCache;
|
|
100655
|
-
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken,
|
|
101031
|
+
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, host) {
|
|
100656
101032
|
var _a, _b;
|
|
100657
|
-
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken,
|
|
101033
|
+
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, host);
|
|
100658
101034
|
(_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
|
|
100659
101035
|
(_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
|
|
100660
101036
|
return result;
|
|
100661
101037
|
}
|
|
100662
101038
|
BuilderState.getFilesAffectedBy = getFilesAffectedBy;
|
|
100663
|
-
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken,
|
|
101039
|
+
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, host) {
|
|
100664
101040
|
var sourceFile = programOfThisState.getSourceFileByPath(path);
|
|
100665
101041
|
if (!sourceFile) {
|
|
100666
101042
|
return ts.emptyArray;
|
|
100667
101043
|
}
|
|
100668
|
-
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
101044
|
+
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host)) {
|
|
100669
101045
|
return [sourceFile];
|
|
100670
101046
|
}
|
|
100671
|
-
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken,
|
|
101047
|
+
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, host);
|
|
100672
101048
|
}
|
|
100673
101049
|
BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
|
|
100674
101050
|
function updateSignatureOfFile(state, signature, path) {
|
|
@@ -100676,7 +101052,7 @@ var ts;
|
|
|
100676
101052
|
(state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
|
|
100677
101053
|
}
|
|
100678
101054
|
BuilderState.updateSignatureOfFile = updateSignatureOfFile;
|
|
100679
|
-
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
101055
|
+
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host, useFileVersionAsSignature) {
|
|
100680
101056
|
var _a;
|
|
100681
101057
|
if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
|
|
100682
101058
|
if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
|
|
@@ -100687,7 +101063,7 @@ var ts;
|
|
|
100687
101063
|
if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
|
|
100688
101064
|
programOfThisState.emit(sourceFile, function (fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) {
|
|
100689
101065
|
ts.Debug.assert(ts.isDeclarationFileName(fileName), "File extension for signature expected to be dts: Got:: " + fileName);
|
|
100690
|
-
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text,
|
|
101066
|
+
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text, host, ts.createGetCanonicalFileName(programOfThisState.useCaseSensitiveFileNames()), data);
|
|
100691
101067
|
if (latestSignature !== prevSignature) {
|
|
100692
101068
|
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
100693
101069
|
}
|
|
@@ -100821,7 +101197,7 @@ var ts;
|
|
|
100821
101197
|
}
|
|
100822
101198
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
100823
101199
|
}
|
|
100824
|
-
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken,
|
|
101200
|
+
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, host) {
|
|
100825
101201
|
if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
|
|
100826
101202
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
100827
101203
|
}
|
|
@@ -100837,7 +101213,7 @@ var ts;
|
|
|
100837
101213
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
100838
101214
|
var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
|
|
100839
101215
|
seenFileNamesMap.set(currentPath, currentSourceFile);
|
|
100840
|
-
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken,
|
|
101216
|
+
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, host)) {
|
|
100841
101217
|
queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
100842
101218
|
}
|
|
100843
101219
|
}
|
|
@@ -100851,9 +101227,9 @@ var ts;
|
|
|
100851
101227
|
function hasSameKeys(map1, map2) {
|
|
100852
101228
|
return map1 === map2 || map1 !== undefined && map2 !== undefined && map1.size === map2.size && !ts.forEachKey(map1, function (key) { return !map2.has(key); });
|
|
100853
101229
|
}
|
|
100854
|
-
function createBuilderProgramState(newProgram,
|
|
101230
|
+
function createBuilderProgramState(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
100855
101231
|
var _a, _b;
|
|
100856
|
-
var state = ts.BuilderState.create(newProgram,
|
|
101232
|
+
var state = ts.BuilderState.create(newProgram, oldState, disableUseFileVersionAsSignature);
|
|
100857
101233
|
state.program = newProgram;
|
|
100858
101234
|
var compilerOptions = newProgram.getCompilerOptions();
|
|
100859
101235
|
state.compilerOptions = compilerOptions;
|
|
@@ -100906,7 +101282,7 @@ var ts;
|
|
|
100906
101282
|
return;
|
|
100907
101283
|
var diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
|
|
100908
101284
|
if (diagnostics) {
|
|
100909
|
-
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram
|
|
101285
|
+
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : diagnostics);
|
|
100910
101286
|
if (!state.semanticDiagnosticsFromOldState) {
|
|
100911
101287
|
state.semanticDiagnosticsFromOldState = new ts.Set();
|
|
100912
101288
|
}
|
|
@@ -100928,13 +101304,16 @@ var ts;
|
|
|
100928
101304
|
ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
|
|
100929
101305
|
state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
|
|
100930
101306
|
}
|
|
100931
|
-
state.buildInfoEmitPending = !useOldState ||
|
|
101307
|
+
state.buildInfoEmitPending = !useOldState ||
|
|
101308
|
+
state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0) ||
|
|
101309
|
+
state.fileInfos.size !== oldState.fileInfos.size;
|
|
100932
101310
|
return state;
|
|
100933
101311
|
}
|
|
100934
|
-
function convertToDiagnostics(diagnostics, newProgram
|
|
101312
|
+
function convertToDiagnostics(diagnostics, newProgram) {
|
|
100935
101313
|
if (!diagnostics.length)
|
|
100936
101314
|
return ts.emptyArray;
|
|
100937
|
-
var buildInfoDirectory
|
|
101315
|
+
var buildInfoDirectory;
|
|
101316
|
+
var getCanonicalFileName;
|
|
100938
101317
|
return diagnostics.map(function (diagnostic) {
|
|
100939
101318
|
var result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath);
|
|
100940
101319
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
@@ -100950,7 +101329,8 @@ var ts;
|
|
|
100950
101329
|
return result;
|
|
100951
101330
|
});
|
|
100952
101331
|
function toPath(path) {
|
|
100953
|
-
|
|
101332
|
+
buildInfoDirectory !== null && buildInfoDirectory !== void 0 ? buildInfoDirectory : (buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory())));
|
|
101333
|
+
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName !== null && getCanonicalFileName !== void 0 ? getCanonicalFileName : (getCanonicalFileName = ts.createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames())));
|
|
100954
101334
|
}
|
|
100955
101335
|
}
|
|
100956
101336
|
function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath) {
|
|
@@ -100959,6 +101339,8 @@ var ts;
|
|
|
100959
101339
|
}
|
|
100960
101340
|
function releaseCache(state) {
|
|
100961
101341
|
ts.BuilderState.releaseCache(state);
|
|
101342
|
+
if (!state.resuableCacheResolutions)
|
|
101343
|
+
getCacheResolutions(state);
|
|
100962
101344
|
state.program = undefined;
|
|
100963
101345
|
}
|
|
100964
101346
|
function backupBuilderProgramEmitState(state) {
|
|
@@ -100993,7 +101375,7 @@ var ts;
|
|
|
100993
101375
|
function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
|
|
100994
101376
|
ts.Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
|
|
100995
101377
|
}
|
|
100996
|
-
function getNextAffectedFile(state, cancellationToken,
|
|
101378
|
+
function getNextAffectedFile(state, cancellationToken, host) {
|
|
100997
101379
|
var _a, _b;
|
|
100998
101380
|
while (true) {
|
|
100999
101381
|
var affectedFiles = state.affectedFiles;
|
|
@@ -101004,7 +101386,7 @@ var ts;
|
|
|
101004
101386
|
var affectedFile = affectedFiles[affectedFilesIndex];
|
|
101005
101387
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
101006
101388
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
101007
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken,
|
|
101389
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host);
|
|
101008
101390
|
return affectedFile;
|
|
101009
101391
|
}
|
|
101010
101392
|
affectedFilesIndex++;
|
|
@@ -101025,7 +101407,7 @@ var ts;
|
|
|
101025
101407
|
ts.Debug.assert(!state.semanticDiagnosticsPerFile);
|
|
101026
101408
|
return program;
|
|
101027
101409
|
}
|
|
101028
|
-
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken,
|
|
101410
|
+
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, host);
|
|
101029
101411
|
state.currentChangedFilePath = nextKey.value;
|
|
101030
101412
|
state.affectedFilesIndex = 0;
|
|
101031
101413
|
if (!state.seenAffectedFiles)
|
|
@@ -101068,24 +101450,24 @@ var ts;
|
|
|
101068
101450
|
});
|
|
101069
101451
|
}
|
|
101070
101452
|
}
|
|
101071
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken,
|
|
101453
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
101072
101454
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
101073
101455
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
101074
101456
|
removeDiagnosticsOfLibraryFiles(state);
|
|
101075
|
-
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken,
|
|
101457
|
+
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, host);
|
|
101076
101458
|
return;
|
|
101077
101459
|
}
|
|
101078
101460
|
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
101079
101461
|
return;
|
|
101080
|
-
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken,
|
|
101462
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host);
|
|
101081
101463
|
}
|
|
101082
|
-
function handleDtsMayChangeOf(state, path, cancellationToken,
|
|
101464
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, host) {
|
|
101083
101465
|
removeSemanticDiagnosticsOf(state, path);
|
|
101084
101466
|
if (!state.changedFilesSet.has(path)) {
|
|
101085
101467
|
var program = ts.Debug.checkDefined(state.program);
|
|
101086
101468
|
var sourceFile = program.getSourceFileByPath(path);
|
|
101087
101469
|
if (sourceFile) {
|
|
101088
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken,
|
|
101470
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, host, !host.disableUseFileVersionAsSignature);
|
|
101089
101471
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
101090
101472
|
addToAffectedFilesPendingEmit(state, path, 0);
|
|
101091
101473
|
}
|
|
@@ -101105,16 +101487,16 @@ var ts;
|
|
|
101105
101487
|
var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
101106
101488
|
return newSignature !== oldSignature;
|
|
101107
101489
|
}
|
|
101108
|
-
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken,
|
|
101490
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host) {
|
|
101109
101491
|
var _a;
|
|
101110
101492
|
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
101111
101493
|
return false;
|
|
101112
101494
|
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, undefined)
|
|
101113
|
-
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken,
|
|
101495
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, host); });
|
|
101114
101496
|
removeDiagnosticsOfLibraryFiles(state);
|
|
101115
101497
|
return true;
|
|
101116
101498
|
}
|
|
101117
|
-
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken,
|
|
101499
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
101118
101500
|
var _a;
|
|
101119
101501
|
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
101120
101502
|
return;
|
|
@@ -101128,9 +101510,9 @@ var ts;
|
|
|
101128
101510
|
var currentPath = queue.pop();
|
|
101129
101511
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
101130
101512
|
seenFileNamesMap.set(currentPath, true);
|
|
101131
|
-
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken,
|
|
101513
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, host))
|
|
101132
101514
|
return;
|
|
101133
|
-
handleDtsMayChangeOf(state, currentPath, cancellationToken,
|
|
101515
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, host);
|
|
101134
101516
|
if (isChangedSignature(state, currentPath)) {
|
|
101135
101517
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
101136
101518
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -101140,27 +101522,27 @@ var ts;
|
|
|
101140
101522
|
}
|
|
101141
101523
|
var seenFileAndExportsOfFile = new ts.Set();
|
|
101142
101524
|
(_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
101143
|
-
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken,
|
|
101525
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host))
|
|
101144
101526
|
return true;
|
|
101145
101527
|
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
101146
101528
|
return references && ts.forEachKey(references, function (filePath) {
|
|
101147
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken,
|
|
101529
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host);
|
|
101148
101530
|
});
|
|
101149
101531
|
});
|
|
101150
101532
|
}
|
|
101151
|
-
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken,
|
|
101533
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
|
|
101152
101534
|
var _a, _b;
|
|
101153
101535
|
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
101154
101536
|
return undefined;
|
|
101155
|
-
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken,
|
|
101537
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host))
|
|
101156
101538
|
return true;
|
|
101157
|
-
handleDtsMayChangeOf(state, filePath, cancellationToken,
|
|
101539
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, host);
|
|
101158
101540
|
(_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
101159
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken,
|
|
101541
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, host);
|
|
101160
101542
|
});
|
|
101161
101543
|
(_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
|
|
101162
101544
|
return !seenFileAndExportsOfFile.has(referencingFilePath) &&
|
|
101163
|
-
handleDtsMayChangeOf(state, referencingFilePath, cancellationToken,
|
|
101545
|
+
handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, host);
|
|
101164
101546
|
});
|
|
101165
101547
|
return undefined;
|
|
101166
101548
|
}
|
|
@@ -101215,40 +101597,51 @@ var ts;
|
|
|
101215
101597
|
return !!ts.outFile(info.options || {});
|
|
101216
101598
|
}
|
|
101217
101599
|
ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
|
|
101218
|
-
function getProgramBuildInfo(state,
|
|
101219
|
-
if (ts.outFile(state.compilerOptions) && !state.compilerOptions.composite)
|
|
101600
|
+
function getProgramBuildInfo(state, host) {
|
|
101601
|
+
if (ts.outFile(state.compilerOptions) && !state.compilerOptions.composite && !state.compilerOptions.cacheResolutions)
|
|
101220
101602
|
return;
|
|
101221
101603
|
ts.performance.mark("beforeGetProgramBuildInfo");
|
|
101222
|
-
var result = getProgramBuildInfoWorker(state,
|
|
101604
|
+
var result = getProgramBuildInfoWorker(state, host);
|
|
101223
101605
|
ts.performance.mark("afterGetProgramBuildInfo");
|
|
101224
101606
|
ts.performance.measure("BuildInfo generation", "beforeGetProgramBuildInfo", "afterGetProgramBuildInfo");
|
|
101225
101607
|
return result;
|
|
101226
101608
|
}
|
|
101227
|
-
function getProgramBuildInfoWorker(state,
|
|
101609
|
+
function getProgramBuildInfoWorker(state, host) {
|
|
101228
101610
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
101229
|
-
var
|
|
101611
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(state.program.useCaseSensitiveFileNames());
|
|
101612
|
+
var buildInfoPath = ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory);
|
|
101613
|
+
var buildInfoDirectory = ts.getDirectoryPath(buildInfoPath);
|
|
101230
101614
|
var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
|
|
101615
|
+
var fileNames = [];
|
|
101616
|
+
var fileNameToFileId = new ts.Map();
|
|
101617
|
+
var resolutions;
|
|
101618
|
+
var names;
|
|
101619
|
+
var resolutionNameToResolutionNameId;
|
|
101620
|
+
var resolutionEntries;
|
|
101621
|
+
var resolutionEntryToResolutionEntryId;
|
|
101622
|
+
var affectedFilesHash;
|
|
101231
101623
|
if (ts.outFile(state.compilerOptions)) {
|
|
101232
|
-
var
|
|
101233
|
-
|
|
101234
|
-
|
|
101235
|
-
|
|
101236
|
-
|
|
101237
|
-
|
|
101238
|
-
|
|
101239
|
-
|
|
101240
|
-
|
|
101241
|
-
|
|
101242
|
-
|
|
101624
|
+
var fileInfos_1;
|
|
101625
|
+
if (state.compilerOptions.composite) {
|
|
101626
|
+
state.program.getRootFileNames().forEach(function (f) {
|
|
101627
|
+
var sourceFile = state.program.getSourceFile(f);
|
|
101628
|
+
if (!sourceFile)
|
|
101629
|
+
return;
|
|
101630
|
+
var fileId = toFileId(sourceFile.resolvedPath);
|
|
101631
|
+
(fileInfos_1 !== null && fileInfos_1 !== void 0 ? fileInfos_1 : (fileInfos_1 = []))[fileId - 1] = sourceFile.version;
|
|
101632
|
+
});
|
|
101633
|
+
}
|
|
101634
|
+
var cacheResolutions_1 = toProgramBuildInfoCacheResolutions();
|
|
101635
|
+
var result_16 = {
|
|
101636
|
+
fileNames: fileNames,
|
|
101243
101637
|
fileInfos: fileInfos_1,
|
|
101244
|
-
options:
|
|
101638
|
+
options: toProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo", !!state.compilerOptions.cacheResolutions),
|
|
101245
101639
|
outSignature: state.outSignature,
|
|
101246
101640
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
101641
|
+
cacheResolutions: cacheResolutions_1,
|
|
101247
101642
|
};
|
|
101248
|
-
return
|
|
101643
|
+
return result_16;
|
|
101249
101644
|
}
|
|
101250
|
-
var fileNames = [];
|
|
101251
|
-
var fileNameToFileId = new ts.Map();
|
|
101252
101645
|
var fileIdsList;
|
|
101253
101646
|
var fileNamesToFileIdListId;
|
|
101254
101647
|
var emitSignatures;
|
|
@@ -101305,7 +101698,7 @@ var ts;
|
|
|
101305
101698
|
(semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
|
|
101306
101699
|
[
|
|
101307
101700
|
toFileId(key),
|
|
101308
|
-
|
|
101701
|
+
value.map(toReusableDiagnostic)
|
|
101309
101702
|
] :
|
|
101310
101703
|
toFileId(key));
|
|
101311
101704
|
}
|
|
@@ -101327,10 +101720,11 @@ var ts;
|
|
|
101327
101720
|
(changeFileSet || (changeFileSet = [])).push(toFileId(path));
|
|
101328
101721
|
}
|
|
101329
101722
|
}
|
|
101723
|
+
var cacheResolutions = toProgramBuildInfoCacheResolutions();
|
|
101330
101724
|
var result = {
|
|
101331
101725
|
fileNames: fileNames,
|
|
101332
101726
|
fileInfos: fileInfos,
|
|
101333
|
-
options:
|
|
101727
|
+
options: toProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo", !!state.compilerOptions.cacheResolutions),
|
|
101334
101728
|
fileIdsList: fileIdsList,
|
|
101335
101729
|
referencedMap: referencedMap,
|
|
101336
101730
|
exportedModulesMap: exportedModulesMap,
|
|
@@ -101339,6 +101733,7 @@ var ts;
|
|
|
101339
101733
|
changeFileSet: changeFileSet,
|
|
101340
101734
|
emitSignatures: emitSignatures,
|
|
101341
101735
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
101736
|
+
cacheResolutions: cacheResolutions,
|
|
101342
101737
|
};
|
|
101343
101738
|
return result;
|
|
101344
101739
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -101347,7 +101742,7 @@ var ts;
|
|
|
101347
101742
|
function relativeToBuildInfo(path) {
|
|
101348
101743
|
return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(buildInfoDirectory, path, getCanonicalFileName));
|
|
101349
101744
|
}
|
|
101350
|
-
function
|
|
101745
|
+
function toFileAndAbsoluteFileId(path) {
|
|
101351
101746
|
var fileId = fileNameToFileId.get(path);
|
|
101352
101747
|
if (fileId === undefined) {
|
|
101353
101748
|
fileNames.push(relativeToBuildInfo(path));
|
|
@@ -101355,6 +101750,12 @@ var ts;
|
|
|
101355
101750
|
}
|
|
101356
101751
|
return fileId;
|
|
101357
101752
|
}
|
|
101753
|
+
function toFileId(path) {
|
|
101754
|
+
return toFileAndAbsoluteFileId(path);
|
|
101755
|
+
}
|
|
101756
|
+
function toAbsoluteFileId(path) {
|
|
101757
|
+
return toFileAndAbsoluteFileId(ts.getNormalizedAbsolutePath(path, currentDirectory));
|
|
101758
|
+
}
|
|
101358
101759
|
function toFileIdListId(set) {
|
|
101359
101760
|
var fileIds = ts.arrayFrom(set.keys(), toFileId).sort(ts.compareValues);
|
|
101360
101761
|
var key = fileIds.join();
|
|
@@ -101365,53 +101766,232 @@ var ts;
|
|
|
101365
101766
|
}
|
|
101366
101767
|
return fileIdListId;
|
|
101367
101768
|
}
|
|
101368
|
-
function
|
|
101769
|
+
function toProgramBuildInfoCompilerOptions(options, optionKey, affectsModuleResolution) {
|
|
101369
101770
|
var result;
|
|
101370
101771
|
var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
|
|
101371
101772
|
for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
|
|
101372
101773
|
var name = _a[_i];
|
|
101373
101774
|
var optionInfo = optionsNameMap.get(name.toLowerCase());
|
|
101374
|
-
if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
|
|
101375
|
-
(result
|
|
101775
|
+
if ((optionKey && (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey])) || (affectsModuleResolution && (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsModuleResolution))) {
|
|
101776
|
+
(result !== null && result !== void 0 ? result : (result = {}))[name] = toReusableCompilerOptionValue(optionInfo, options[name]);
|
|
101777
|
+
}
|
|
101778
|
+
else if (affectsModuleResolution && name === "pathsBasePath") {
|
|
101779
|
+
(result !== null && result !== void 0 ? result : (result = {})).pathsBasePath = relativeToBuildInfoEnsuringAbsolutePath(options.pathsBasePath);
|
|
101780
|
+
continue;
|
|
101376
101781
|
}
|
|
101377
101782
|
}
|
|
101378
101783
|
return result;
|
|
101379
101784
|
}
|
|
101380
|
-
|
|
101381
|
-
|
|
101382
|
-
|
|
101383
|
-
|
|
101384
|
-
|
|
101385
|
-
|
|
101386
|
-
|
|
101785
|
+
function toReusableCompilerOptionValue(option, value) {
|
|
101786
|
+
if (option) {
|
|
101787
|
+
if (option.type === "list") {
|
|
101788
|
+
var values = value;
|
|
101789
|
+
if (option.element.isFilePath && values.length) {
|
|
101790
|
+
return values.map(relativeToBuildInfoEnsuringAbsolutePath);
|
|
101791
|
+
}
|
|
101792
|
+
}
|
|
101793
|
+
else if (option.isFilePath) {
|
|
101794
|
+
return relativeToBuildInfoEnsuringAbsolutePath(value);
|
|
101387
101795
|
}
|
|
101388
101796
|
}
|
|
101389
|
-
|
|
101390
|
-
return relativeToBuildInfo(value);
|
|
101391
|
-
}
|
|
101797
|
+
return value;
|
|
101392
101798
|
}
|
|
101393
|
-
|
|
101394
|
-
|
|
101395
|
-
|
|
101396
|
-
|
|
101397
|
-
|
|
101398
|
-
var result = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo);
|
|
101799
|
+
function toReadonlyArrayOrUndefined(array, map) {
|
|
101800
|
+
return (array === null || array === void 0 ? void 0 : array.length) ? array.map(map) : undefined;
|
|
101801
|
+
}
|
|
101802
|
+
function toReusableDiagnostic(diagnostic) {
|
|
101803
|
+
var result = toReusableDiagnosticRelatedInformation(diagnostic);
|
|
101399
101804
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
101400
101805
|
result.reportDeprecated = diagnostic.reportsDeprecated;
|
|
101401
101806
|
result.source = diagnostic.source;
|
|
101402
101807
|
result.skippedOn = diagnostic.skippedOn;
|
|
101403
101808
|
var relatedInformation = diagnostic.relatedInformation;
|
|
101404
|
-
result.relatedInformation = relatedInformation ?
|
|
101405
|
-
|
|
101406
|
-
|
|
101407
|
-
|
|
101408
|
-
|
|
101809
|
+
result.relatedInformation = relatedInformation === null || relatedInformation === void 0 ? void 0 : relatedInformation.map(toReusableDiagnosticRelatedInformation);
|
|
101810
|
+
return result;
|
|
101811
|
+
}
|
|
101812
|
+
function toReusableDiagnosticRelatedInformation(diagnostic) {
|
|
101813
|
+
var file = diagnostic.file;
|
|
101814
|
+
return __assign(__assign({}, diagnostic), { file: file ? relativeToBuildInfo(file.resolvedPath) : undefined });
|
|
101815
|
+
}
|
|
101816
|
+
function toProgramBuildInfoCacheResolutions() {
|
|
101817
|
+
var cacheResolutions = getCacheResolutions(state);
|
|
101818
|
+
var modules = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.modules);
|
|
101819
|
+
var typeRefs = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.typeRefs);
|
|
101820
|
+
var packageJsons = toProgramBuildInfoPackageJsons(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.perDirPackageJsonMap);
|
|
101821
|
+
if (!resolutions)
|
|
101822
|
+
return;
|
|
101823
|
+
ts.Debug.assertIsDefined(names);
|
|
101824
|
+
ts.Debug.assertIsDefined(resolutionEntries);
|
|
101825
|
+
state.resuableCacheResolutions = {
|
|
101826
|
+
cache: {
|
|
101827
|
+
resolutions: resolutions.map(toProgramBuildInfoResolution),
|
|
101828
|
+
names: names,
|
|
101829
|
+
hash: toProgramBuildInfoHashes(),
|
|
101830
|
+
resolutionEntries: resolutionEntries,
|
|
101831
|
+
modules: modules,
|
|
101832
|
+
typeRefs: typeRefs,
|
|
101833
|
+
packageJsons: packageJsons,
|
|
101834
|
+
},
|
|
101835
|
+
getProgramBuildInfoFilePathDecoder: ts.memoize(function () { return getProgramBuildInfoFilePathDecoder(fileNames, buildInfoPath, currentDirectory, getCanonicalFileName); })
|
|
101836
|
+
};
|
|
101837
|
+
return state.resuableCacheResolutions.cache;
|
|
101838
|
+
}
|
|
101839
|
+
function toProgramBuildInfoPackageJsons(cache) {
|
|
101840
|
+
var result;
|
|
101841
|
+
cache === null || cache === void 0 ? void 0 : cache.forEach(function (packageJson, dirPath) {
|
|
101842
|
+
var packageJsonDirPath = ts.getDirectoryPath(ts.toPath(packageJson, currentDirectory, getCanonicalFileName));
|
|
101843
|
+
if (packageJsonDirPath !== dirPath) {
|
|
101844
|
+
(result !== null && result !== void 0 ? result : (result = [])).push([
|
|
101845
|
+
toFileId(dirPath),
|
|
101846
|
+
toAbsoluteFileId(packageJson),
|
|
101847
|
+
]);
|
|
101848
|
+
}
|
|
101849
|
+
});
|
|
101850
|
+
return result;
|
|
101851
|
+
}
|
|
101852
|
+
function toProgramBuildInfoResolutionCacheWithRedirects(cache) {
|
|
101853
|
+
if (!cache)
|
|
101854
|
+
return undefined;
|
|
101855
|
+
var ownMap = cache.getOwnMap();
|
|
101856
|
+
var own = toProgramBuildInfoResolutionCache(ownMap);
|
|
101857
|
+
var redirects;
|
|
101858
|
+
cache.redirectsKeyToCache.forEach(function (_a) {
|
|
101859
|
+
var map = _a.map, options = _a.options;
|
|
101860
|
+
if (map === ownMap)
|
|
101861
|
+
return;
|
|
101862
|
+
var redirectCache = toProgramBuildInfoResolutionCache(map);
|
|
101863
|
+
if (redirectCache) {
|
|
101864
|
+
(redirects !== null && redirects !== void 0 ? redirects : (redirects = [])).push({
|
|
101865
|
+
options: toProgramBuildInfoCompilerOptions(options, undefined, true),
|
|
101866
|
+
cache: redirectCache
|
|
101867
|
+
});
|
|
101868
|
+
}
|
|
101869
|
+
});
|
|
101870
|
+
return !redirects ? own : { own: own, redirects: redirects };
|
|
101871
|
+
}
|
|
101872
|
+
function toProgramBuildInfoResolutionCache(cache) {
|
|
101873
|
+
var result;
|
|
101874
|
+
cache === null || cache === void 0 ? void 0 : cache.forEach(function (dirCache, dirPath) { return dirCache.size() ?
|
|
101875
|
+
(result !== null && result !== void 0 ? result : (result = [])).push([
|
|
101876
|
+
toFileId(dirPath),
|
|
101877
|
+
ts.arrayFrom(dirCache.entries()).map(toProgramBuildInfoResolutionEntryId)
|
|
101878
|
+
]) :
|
|
101879
|
+
undefined; });
|
|
101409
101880
|
return result;
|
|
101881
|
+
}
|
|
101882
|
+
function toProgramBuildInfoResolutionEntryId(_a) {
|
|
101883
|
+
var name = _a[0], mode = _a[1], resolution = _a[2];
|
|
101884
|
+
var resolutionNameId = toProgramBuildInfoResolutionNameId(name);
|
|
101885
|
+
var resolutionId = toProgramBuildInfoResolutionId(resolution);
|
|
101886
|
+
var key = resolutionNameId + "," + mode + "," + resolutionId;
|
|
101887
|
+
var resolutionEntryId = resolutionEntryToResolutionEntryId === null || resolutionEntryToResolutionEntryId === void 0 ? void 0 : resolutionEntryToResolutionEntryId.get(key);
|
|
101888
|
+
if (resolutionEntryId === undefined) {
|
|
101889
|
+
(resolutionEntries || (resolutionEntries = [])).push(mode ? [resolutionNameId, resolutionId, mode] : [resolutionNameId, resolutionId]);
|
|
101890
|
+
(resolutionEntryToResolutionEntryId || (resolutionEntryToResolutionEntryId = new ts.Map())).set(key, resolutionEntryId = resolutionEntries.length);
|
|
101891
|
+
}
|
|
101892
|
+
return resolutionEntryId;
|
|
101893
|
+
}
|
|
101894
|
+
function toProgramBuildInfoResolutionNameId(name) {
|
|
101895
|
+
var resolutionNameId = resolutionNameToResolutionNameId === null || resolutionNameToResolutionNameId === void 0 ? void 0 : resolutionNameToResolutionNameId.get(name);
|
|
101896
|
+
if (resolutionNameId === undefined) {
|
|
101897
|
+
(names !== null && names !== void 0 ? names : (names = [])).push(name);
|
|
101898
|
+
(resolutionNameToResolutionNameId !== null && resolutionNameToResolutionNameId !== void 0 ? resolutionNameToResolutionNameId : (resolutionNameToResolutionNameId = new ts.Map())).set(name, resolutionNameId = names.length);
|
|
101899
|
+
}
|
|
101900
|
+
return resolutionNameId;
|
|
101901
|
+
}
|
|
101902
|
+
function toProgramBuildInfoResolutionId(resolution) {
|
|
101903
|
+
if (resolution.serializationIndex === undefined) {
|
|
101904
|
+
(resolutions !== null && resolutions !== void 0 ? resolutions : (resolutions = [])).push(resolution);
|
|
101905
|
+
resolution.serializationIndex = resolutions.length;
|
|
101906
|
+
}
|
|
101907
|
+
return resolution.serializationIndex;
|
|
101908
|
+
}
|
|
101909
|
+
function toProgramBuildInfoResolution(resolution) {
|
|
101910
|
+
resolution.serializationIndex = undefined;
|
|
101911
|
+
return {
|
|
101912
|
+
resolvedModule: toProgramBuildInfoResolved(resolution.resolvedModule),
|
|
101913
|
+
resolvedTypeReferenceDirective: toProgramBuildInfoResolved(resolution.resolvedTypeReferenceDirective),
|
|
101914
|
+
affectingLocations: toReadonlyArrayOrUndefined(resolution.affectingLocations, toAffectedFileId),
|
|
101915
|
+
resolutionDiagnostics: toReadonlyArrayOrUndefined(resolution.resolutionDiagnostics, toProgramBuildInfoResolutionDiagnostic),
|
|
101916
|
+
};
|
|
101917
|
+
}
|
|
101918
|
+
function toProgramBuildInfoHashes() {
|
|
101919
|
+
if (!affectedFilesHash)
|
|
101920
|
+
return undefined;
|
|
101921
|
+
var hashes = [];
|
|
101922
|
+
for (var _i = 0, _a = ts.arrayFrom(affectedFilesHash.keys()).sort(ts.compareValues); _i < _a.length; _i++) {
|
|
101923
|
+
var key = _a[_i];
|
|
101924
|
+
var value = affectedFilesHash.get(key);
|
|
101925
|
+
hashes.push(value ? [key, value] : key);
|
|
101926
|
+
}
|
|
101927
|
+
return hashes;
|
|
101928
|
+
}
|
|
101929
|
+
function toAffectedFileId(file) {
|
|
101930
|
+
var _a;
|
|
101931
|
+
var fileId = toAbsoluteFileId(file);
|
|
101932
|
+
if (!(affectedFilesHash === null || affectedFilesHash === void 0 ? void 0 : affectedFilesHash.has(fileId))) {
|
|
101933
|
+
var packageJsonInfo = (_a = state.program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfo(file);
|
|
101934
|
+
var text = typeof packageJsonInfo === "object" ? packageJsonInfo.packageJsonText : undefined;
|
|
101935
|
+
(affectedFilesHash !== null && affectedFilesHash !== void 0 ? affectedFilesHash : (affectedFilesHash = new ts.Map())).set(fileId, text ? computeSignature(text, host) : undefined);
|
|
101936
|
+
}
|
|
101937
|
+
return fileId;
|
|
101938
|
+
}
|
|
101939
|
+
function toProgramBuildInfoResolved(resolved) {
|
|
101940
|
+
return resolved ? __assign(__assign({}, resolved), { resolvedFileName: toAbsoluteFileId(resolved.resolvedFileName), isExternalLibraryImport: resolved.isExternalLibraryImport ? true : undefined, originalPath: resolved.originalPath ? toAbsoluteFileId(resolved.originalPath) : undefined, primary: resolved.primary || undefined, extension: undefined }) : undefined;
|
|
101941
|
+
}
|
|
101942
|
+
function toProgramBuildInfoResolutionDiagnostic(d) {
|
|
101943
|
+
return {
|
|
101944
|
+
isImports: d.isImports || undefined,
|
|
101945
|
+
entry: d.entry || undefined,
|
|
101946
|
+
packagePath: toAbsoluteFileId(d.packagePath),
|
|
101947
|
+
};
|
|
101948
|
+
}
|
|
101949
|
+
}
|
|
101950
|
+
function getCacheResolutions(state) {
|
|
101951
|
+
var _a;
|
|
101952
|
+
if (state.cacheResolutions || !state.compilerOptions.cacheResolutions)
|
|
101953
|
+
return state.cacheResolutions;
|
|
101954
|
+
var modules;
|
|
101955
|
+
var typeRefs;
|
|
101956
|
+
var moduleNameToDirectoryMap = ts.createCacheWithRedirects(state.compilerOptions);
|
|
101957
|
+
var dirToPackageJsonScope = new ts.Map();
|
|
101958
|
+
var perDirPackageJsonMap;
|
|
101959
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(state.program.useCaseSensitiveFileNames());
|
|
101960
|
+
state.program.getSourceFiles().forEach(function (f) {
|
|
101961
|
+
var _a;
|
|
101962
|
+
modules = toPerDirectoryCache(state, getCanonicalFileName, modules, ts.getResolvedModuleOfResolution, f, f.resolvedModules, moduleNameToDirectoryMap);
|
|
101963
|
+
typeRefs = toPerDirectoryCache(state, getCanonicalFileName, typeRefs, ts.getResolvedTypeReferenceDirectiveOfResolution, f, f.resolvedTypeReferenceDirectiveNames);
|
|
101964
|
+
if ((_a = f.packageJsonScope) === null || _a === void 0 ? void 0 : _a.info) {
|
|
101965
|
+
var dirPath = ts.getDirectoryPath(f.resolvedPath);
|
|
101966
|
+
if (!(dirToPackageJsonScope === null || dirToPackageJsonScope === void 0 ? void 0 : dirToPackageJsonScope.has(dirPath))) {
|
|
101967
|
+
(perDirPackageJsonMap !== null && perDirPackageJsonMap !== void 0 ? perDirPackageJsonMap : (perDirPackageJsonMap = new ts.Map())).set(dirPath, ts.getPackageJsconLocationFromScope(f.packageJsonScope));
|
|
101968
|
+
ts.moduleNameToDirectorySet(dirToPackageJsonScope, dirPath, f.packageJsonScope, ts.getPackageJsconLocationFromScope, function (dir) { return ts.toPath(dir, state.program.getCurrentDirectory(), getCanonicalFileName); }, function (ancestorPath) { return perDirPackageJsonMap === null || perDirPackageJsonMap === void 0 ? void 0 : perDirPackageJsonMap.delete(ancestorPath); });
|
|
101969
|
+
}
|
|
101970
|
+
}
|
|
101410
101971
|
});
|
|
101972
|
+
var automaticTypeDirectiveNames = state.program.getAutomaticTypeDirectiveNames();
|
|
101973
|
+
if (automaticTypeDirectiveNames.length) {
|
|
101974
|
+
var currentDirectory = state.program.getCurrentDirectory();
|
|
101975
|
+
var containingPath = ts.toPath(state.program.getAutomaticTypeDirectiveContainingFile(), currentDirectory, getCanonicalFileName);
|
|
101976
|
+
typeRefs = toPerDirectoryCache(state, getCanonicalFileName, typeRefs, ts.getResolvedTypeReferenceDirectiveOfResolution, containingPath, state.program.getAutomaticTypeDirectiveResolutions());
|
|
101977
|
+
}
|
|
101978
|
+
return state.cacheResolutions = {
|
|
101979
|
+
modules: modules,
|
|
101980
|
+
typeRefs: typeRefs,
|
|
101981
|
+
moduleNameToDirectoryMap: moduleNameToDirectoryMap,
|
|
101982
|
+
dirToPackageJsonScope: dirToPackageJsonScope,
|
|
101983
|
+
perDirPackageJsonMap: perDirPackageJsonMap,
|
|
101984
|
+
packageJsonCache: (_a = state.program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache().clone(),
|
|
101985
|
+
};
|
|
101411
101986
|
}
|
|
101412
|
-
function
|
|
101413
|
-
|
|
101414
|
-
|
|
101987
|
+
function toPerDirectoryCache(state, getCanonicalFileName, perDirCache, getResolutionWithResolvedFileName, sourceFileOrPath, fileCacheFromProgram, moduleNameToDirectoryMap) {
|
|
101988
|
+
return ts.toPerDirectoryResolution(state.program, fileCacheFromProgram, sourceFileOrPath, perDirCache, moduleNameToDirectoryMap, ts.noop, function (r, name, mode, _key, redirectedReference, dirPath) {
|
|
101989
|
+
var _a, _b, _c;
|
|
101990
|
+
return !((_a = getResolutionWithResolvedFileName(r)) === null || _a === void 0 ? void 0 : _a.resolvedFileName) ||
|
|
101991
|
+
(moduleNameToDirectoryMap &&
|
|
101992
|
+
!ts.isExternalModuleNameRelative(name) &&
|
|
101993
|
+
((_c = (_b = moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) === null || _b === void 0 ? void 0 : _b.get(ts.getModeAwareCacheKey(name, mode))) === null || _c === void 0 ? void 0 : _c.get(dirPath)));
|
|
101994
|
+
}, function (dir) { return ts.toPath(dir, state.program.getCurrentDirectory(), getCanonicalFileName); }, function (ancestorPath, name, mode, perDirResolutionCache) { var _a; return (_a = perDirResolutionCache === null || perDirResolutionCache === void 0 ? void 0 : perDirResolutionCache.get(ancestorPath)) === null || _a === void 0 ? void 0 : _a.delete(name, mode); });
|
|
101415
101995
|
}
|
|
101416
101996
|
var BuilderProgramKind;
|
|
101417
101997
|
(function (BuilderProgramKind) {
|
|
@@ -101435,7 +102015,7 @@ var ts;
|
|
|
101435
102015
|
rootNames: newProgramOrRootNames,
|
|
101436
102016
|
options: hostOrOptions,
|
|
101437
102017
|
host: oldProgramOrHost,
|
|
101438
|
-
oldProgram: oldProgram
|
|
102018
|
+
oldProgram: oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getProgramOrOldBuildInfoProgramUndefined(),
|
|
101439
102019
|
configFileParsingDiagnostics: configFileParsingDiagnostics,
|
|
101440
102020
|
projectReferences: projectReferences
|
|
101441
102021
|
});
|
|
@@ -101453,8 +102033,8 @@ var ts;
|
|
|
101453
102033
|
function getTextHandlingSourceMapForSignature(text, data) {
|
|
101454
102034
|
return (data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text;
|
|
101455
102035
|
}
|
|
101456
|
-
function computeSignatureWithDiagnostics(sourceFile, text,
|
|
101457
|
-
var _a;
|
|
102036
|
+
function computeSignatureWithDiagnostics(sourceFile, text, host, getCanonicalFileName, data) {
|
|
102037
|
+
var _a, _b;
|
|
101458
102038
|
text = getTextHandlingSourceMapForSignature(text, data);
|
|
101459
102039
|
var sourceFileDirectory;
|
|
101460
102040
|
if ((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -101462,7 +102042,7 @@ var ts;
|
|
|
101462
102042
|
return "" + locationInfo(diagnostic) + ts.DiagnosticCategory[diagnostic.category] + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText);
|
|
101463
102043
|
}).join("\n");
|
|
101464
102044
|
}
|
|
101465
|
-
return (
|
|
102045
|
+
return ((_b = host.createHash) !== null && _b !== void 0 ? _b : ts.generateDjb2Hash)(text);
|
|
101466
102046
|
function flattenDiagnosticMessageText(diagnostic) {
|
|
101467
102047
|
return ts.isString(diagnostic) ?
|
|
101468
102048
|
diagnostic :
|
|
@@ -101481,8 +102061,9 @@ var ts;
|
|
|
101481
102061
|
}
|
|
101482
102062
|
}
|
|
101483
102063
|
ts.computeSignatureWithDiagnostics = computeSignatureWithDiagnostics;
|
|
101484
|
-
function computeSignature(text,
|
|
101485
|
-
|
|
102064
|
+
function computeSignature(text, host, data) {
|
|
102065
|
+
var _a;
|
|
102066
|
+
return ((_a = host.createHash) !== null && _a !== void 0 ? _a : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
|
|
101486
102067
|
}
|
|
101487
102068
|
ts.computeSignature = computeSignature;
|
|
101488
102069
|
function createBuilderProgram(kind, _a) {
|
|
@@ -101493,10 +102074,8 @@ var ts;
|
|
|
101493
102074
|
oldState = undefined;
|
|
101494
102075
|
return oldProgram;
|
|
101495
102076
|
}
|
|
101496
|
-
var
|
|
101497
|
-
|
|
101498
|
-
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
101499
|
-
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
102077
|
+
var state = createBuilderProgramState(newProgram, oldState, host.disableUseFileVersionAsSignature);
|
|
102078
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, host); };
|
|
101500
102079
|
newProgram = undefined;
|
|
101501
102080
|
oldProgram = undefined;
|
|
101502
102081
|
oldState = undefined;
|
|
@@ -101510,6 +102089,7 @@ var ts;
|
|
|
101510
102089
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
101511
102090
|
builderProgram.emit = emit;
|
|
101512
102091
|
builderProgram.releaseProgram = function () { return releaseCache(state); };
|
|
102092
|
+
builderProgram.getProgramOrOldBuildInfoProgramUndefined = createGetProgramOrOldBuildInfoProgramUndefined(state);
|
|
101513
102093
|
if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
|
|
101514
102094
|
builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
|
|
101515
102095
|
}
|
|
@@ -101531,7 +102111,7 @@ var ts;
|
|
|
101531
102111
|
return ts.emitSkippedWithNoDiagnostics;
|
|
101532
102112
|
}
|
|
101533
102113
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
101534
|
-
var affected = getNextAffectedFile(state, cancellationToken,
|
|
102114
|
+
var affected = getNextAffectedFile(state, cancellationToken, host);
|
|
101535
102115
|
var emitKind = 1;
|
|
101536
102116
|
var isPendingEmitFile = false;
|
|
101537
102117
|
if (!affected) {
|
|
@@ -101569,7 +102149,7 @@ var ts;
|
|
|
101569
102149
|
var file = sourceFiles[0];
|
|
101570
102150
|
var info = state.fileInfos.get(file.resolvedPath);
|
|
101571
102151
|
if (info.signature === file.version) {
|
|
101572
|
-
var signature = computeSignatureWithDiagnostics(file, text,
|
|
102152
|
+
var signature = computeSignatureWithDiagnostics(file, text, host, ts.createGetCanonicalFileName(state.program.useCaseSensitiveFileNames()), data);
|
|
101573
102153
|
if (!((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length))
|
|
101574
102154
|
emitSignature = signature;
|
|
101575
102155
|
if (signature !== file.version) {
|
|
@@ -101593,7 +102173,7 @@ var ts;
|
|
|
101593
102173
|
if (state.compilerOptions.composite) {
|
|
101594
102174
|
var filePath = sourceFiles[0].resolvedPath;
|
|
101595
102175
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
101596
|
-
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text,
|
|
102176
|
+
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, host, data));
|
|
101597
102177
|
if (emitSignature === oldSignature)
|
|
101598
102178
|
return;
|
|
101599
102179
|
((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
|
|
@@ -101602,7 +102182,7 @@ var ts;
|
|
|
101602
102182
|
}
|
|
101603
102183
|
}
|
|
101604
102184
|
else if (state.compilerOptions.composite) {
|
|
101605
|
-
var newSignature = computeSignature(text,
|
|
102185
|
+
var newSignature = computeSignature(text, host, data);
|
|
101606
102186
|
if (newSignature === state.outSignature)
|
|
101607
102187
|
return;
|
|
101608
102188
|
state.outSignature = newSignature;
|
|
@@ -101663,7 +102243,7 @@ var ts;
|
|
|
101663
102243
|
}
|
|
101664
102244
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
101665
102245
|
while (true) {
|
|
101666
|
-
var affected = getNextAffectedFile(state, cancellationToken,
|
|
102246
|
+
var affected = getNextAffectedFile(state, cancellationToken, host);
|
|
101667
102247
|
if (!affected) {
|
|
101668
102248
|
return undefined;
|
|
101669
102249
|
}
|
|
@@ -101721,12 +102301,32 @@ var ts;
|
|
|
101721
102301
|
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
|
|
101722
102302
|
}
|
|
101723
102303
|
ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
|
|
101724
|
-
function
|
|
101725
|
-
var
|
|
101726
|
-
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
101727
|
-
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
101728
|
-
var state;
|
|
102304
|
+
function getProgramBuildInfoFilePathDecoder(fileNames, buildInfoPath, currentDirectory, getCanonicalFileName) {
|
|
102305
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, currentDirectory));
|
|
101729
102306
|
var filePaths;
|
|
102307
|
+
var fileAbsolutePaths;
|
|
102308
|
+
return { toAbsolutePath: toAbsolutePath, toFilePath: toFilePath, toFileAbsolutePath: toFileAbsolutePath, currentDirectory: currentDirectory, getCanonicalFileName: getCanonicalFileName };
|
|
102309
|
+
function toPath(path) {
|
|
102310
|
+
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
102311
|
+
}
|
|
102312
|
+
function toAbsolutePath(path) {
|
|
102313
|
+
return ts.getNormalizedAbsolutePath(path, buildInfoDirectory);
|
|
102314
|
+
}
|
|
102315
|
+
function toFilePath(fileId) {
|
|
102316
|
+
var _a;
|
|
102317
|
+
return (_a = filePaths === null || filePaths === void 0 ? void 0 : filePaths[fileId - 1]) !== null && _a !== void 0 ? _a : ((filePaths !== null && filePaths !== void 0 ? filePaths : (filePaths = new Array(fileNames.length)))[fileId - 1] = toPath(fileNames[fileId - 1]));
|
|
102318
|
+
}
|
|
102319
|
+
function toFileAbsolutePath(fileId) {
|
|
102320
|
+
var _a;
|
|
102321
|
+
return (_a = fileAbsolutePaths === null || fileAbsolutePaths === void 0 ? void 0 : fileAbsolutePaths[fileId - 1]) !== null && _a !== void 0 ? _a : ((fileAbsolutePaths !== null && fileAbsolutePaths !== void 0 ? fileAbsolutePaths : (fileAbsolutePaths = new Array(fileNames.length)))[fileId - 1] = toAbsolutePath(fileNames[fileId - 1]));
|
|
102322
|
+
}
|
|
102323
|
+
}
|
|
102324
|
+
ts.getProgramBuildInfoFilePathDecoder = getProgramBuildInfoFilePathDecoder;
|
|
102325
|
+
function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host, configFilePath) {
|
|
102326
|
+
var _a, _b, _c;
|
|
102327
|
+
var buildInfoFilePathDecoder = getProgramBuildInfoFilePathDecoder(program.fileNames, buildInfoPath, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames()));
|
|
102328
|
+
var toFilePath = buildInfoFilePathDecoder.toFilePath, toAbsolutePath = buildInfoFilePathDecoder.toAbsolutePath;
|
|
102329
|
+
var state;
|
|
101730
102330
|
var filePathsSetList;
|
|
101731
102331
|
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
101732
102332
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
@@ -101735,13 +102335,13 @@ var ts;
|
|
|
101735
102335
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
101736
102336
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
101737
102337
|
outSignature: program.outSignature,
|
|
102338
|
+
resuableCacheResolutions: toResuableCacheResolutions(),
|
|
101738
102339
|
};
|
|
101739
102340
|
}
|
|
101740
102341
|
else {
|
|
101741
|
-
|
|
101742
|
-
filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
|
|
102342
|
+
filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
|
|
101743
102343
|
var fileInfos_2 = new ts.Map();
|
|
101744
|
-
var emitSignatures_1 = ((
|
|
102344
|
+
var emitSignatures_1 = ((_b = program.options) === null || _b === void 0 ? void 0 : _b.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
|
|
101745
102345
|
program.fileInfos.forEach(function (fileInfo, index) {
|
|
101746
102346
|
var path = toFilePath(index + 1);
|
|
101747
102347
|
var stateFileInfo = toBuilderStateFileInfo(fileInfo);
|
|
@@ -101749,7 +102349,7 @@ var ts;
|
|
|
101749
102349
|
if (emitSignatures_1 && stateFileInfo.signature)
|
|
101750
102350
|
emitSignatures_1.set(path, stateFileInfo.signature);
|
|
101751
102351
|
});
|
|
101752
|
-
(
|
|
102352
|
+
(_c = program.emitSignatures) === null || _c === void 0 ? void 0 : _c.forEach(function (value) {
|
|
101753
102353
|
if (ts.isNumber(value))
|
|
101754
102354
|
emitSignatures_1.delete(toFilePath(value));
|
|
101755
102355
|
else
|
|
@@ -101768,14 +102368,17 @@ var ts;
|
|
|
101768
102368
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
101769
102369
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
101770
102370
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
102371
|
+
resuableCacheResolutions: toResuableCacheResolutions(),
|
|
101771
102372
|
};
|
|
101772
102373
|
}
|
|
102374
|
+
state.compilerOptions.configFilePath = configFilePath;
|
|
101773
102375
|
return {
|
|
101774
102376
|
getState: function () { return state; },
|
|
101775
102377
|
saveEmitState: ts.noop,
|
|
101776
102378
|
restoreEmitState: ts.noop,
|
|
101777
102379
|
getProgram: ts.notImplemented,
|
|
101778
102380
|
getProgramOrUndefined: ts.returnUndefined,
|
|
102381
|
+
getProgramOrOldBuildInfoProgramUndefined: createGetProgramOrOldBuildInfoProgramUndefined(state),
|
|
101779
102382
|
releaseProgram: ts.noop,
|
|
101780
102383
|
getCompilerOptions: function () { return state.compilerOptions; },
|
|
101781
102384
|
getSourceFile: ts.notImplemented,
|
|
@@ -101795,15 +102398,6 @@ var ts;
|
|
|
101795
102398
|
close: ts.noop,
|
|
101796
102399
|
hasChangedEmitSignature: ts.returnFalse,
|
|
101797
102400
|
};
|
|
101798
|
-
function toPath(path) {
|
|
101799
|
-
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
101800
|
-
}
|
|
101801
|
-
function toAbsolutePath(path) {
|
|
101802
|
-
return ts.getNormalizedAbsolutePath(path, buildInfoDirectory);
|
|
101803
|
-
}
|
|
101804
|
-
function toFilePath(fileId) {
|
|
101805
|
-
return filePaths[fileId - 1];
|
|
101806
|
-
}
|
|
101807
102401
|
function toFilePathsSet(fileIdsListId) {
|
|
101808
102402
|
return filePathsSetList[fileIdsListId - 1];
|
|
101809
102403
|
}
|
|
@@ -101818,8 +102412,241 @@ var ts;
|
|
|
101818
102412
|
});
|
|
101819
102413
|
return map;
|
|
101820
102414
|
}
|
|
102415
|
+
function toResuableCacheResolutions() {
|
|
102416
|
+
return program.cacheResolutions && {
|
|
102417
|
+
cache: program.cacheResolutions,
|
|
102418
|
+
getProgramBuildInfoFilePathDecoder: function () { return buildInfoFilePathDecoder; },
|
|
102419
|
+
};
|
|
102420
|
+
}
|
|
101821
102421
|
}
|
|
101822
102422
|
ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
|
|
102423
|
+
function createGetProgramOrOldBuildInfoProgramUndefined(state) {
|
|
102424
|
+
return function () {
|
|
102425
|
+
var _a;
|
|
102426
|
+
return (_a = state.program) !== null && _a !== void 0 ? _a : (state.cacheResolutions || state.resuableCacheResolutions ?
|
|
102427
|
+
(function (host) { return createOldBuildInfoProgram(host, state.compilerOptions, state.cacheResolutions, !state.cacheResolutions ? state.resuableCacheResolutions : undefined); }) :
|
|
102428
|
+
undefined);
|
|
102429
|
+
};
|
|
102430
|
+
}
|
|
102431
|
+
function createOldBuildInfoProgram(host, compilerOptions, cacheResolutions, resuableCacheResolutions) {
|
|
102432
|
+
if (!cacheResolutions && !resuableCacheResolutions)
|
|
102433
|
+
return undefined;
|
|
102434
|
+
var fileExistsMap = new ts.Map();
|
|
102435
|
+
var packageJsonInfoMap = new ts.Map();
|
|
102436
|
+
var affectingLoationsSameMap = new ts.Map();
|
|
102437
|
+
var decodedResolvedModules = ts.createCacheWithRedirects(compilerOptions);
|
|
102438
|
+
var decodedResolvedTypeRefs = ts.createCacheWithRedirects(compilerOptions);
|
|
102439
|
+
var decodedModuleNameToDirectoryMap = ts.createCacheWithRedirects(compilerOptions);
|
|
102440
|
+
var decodedPackageJsonMap;
|
|
102441
|
+
var packageJsonScopes;
|
|
102442
|
+
var decodedHashes;
|
|
102443
|
+
var resolutions;
|
|
102444
|
+
var originalPathOrResolvedFileNames;
|
|
102445
|
+
var resolutionEntries;
|
|
102446
|
+
return {
|
|
102447
|
+
getCompilerOptions: function () { return compilerOptions; },
|
|
102448
|
+
getResolvedModule: function (dirPath, name, mode, redirectedReference) { return getResolvedFromCache(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.modules, resuableCacheResolutions === null || resuableCacheResolutions === void 0 ? void 0 : resuableCacheResolutions.cache.modules, decodedResolvedModules, dirPath, name, mode, redirectedReference, cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.moduleNameToDirectoryMap, decodedModuleNameToDirectoryMap); },
|
|
102449
|
+
getResolvedTypeReferenceDirective: function (dirPath, name, mode, redirectedReference) { return getResolvedFromCache(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.typeRefs, resuableCacheResolutions === null || resuableCacheResolutions === void 0 ? void 0 : resuableCacheResolutions.cache.typeRefs, decodedResolvedTypeRefs, dirPath, name, mode, redirectedReference, undefined, undefined); },
|
|
102450
|
+
getPackageJsonScope: getPackageJsonScope,
|
|
102451
|
+
};
|
|
102452
|
+
function fileExists(fileName) {
|
|
102453
|
+
var result = fileExistsMap.get(fileName);
|
|
102454
|
+
if (result === undefined)
|
|
102455
|
+
fileExistsMap.set(fileName, result = host.fileExists(fileName));
|
|
102456
|
+
return result;
|
|
102457
|
+
}
|
|
102458
|
+
function getPackageJsonInfo(fileName) {
|
|
102459
|
+
var result = packageJsonInfoMap.get(fileName);
|
|
102460
|
+
if (result === undefined)
|
|
102461
|
+
packageJsonInfoMap.set(fileName, result = host.getPackageJsonInfo(fileName) || false);
|
|
102462
|
+
return result || undefined;
|
|
102463
|
+
}
|
|
102464
|
+
function affectingLocationsSame(fileName, expected) {
|
|
102465
|
+
var _a;
|
|
102466
|
+
var result = affectingLoationsSameMap.get(fileName);
|
|
102467
|
+
if (result !== undefined)
|
|
102468
|
+
return result;
|
|
102469
|
+
var packageJsonInfo = getPackageJsonInfo(fileName);
|
|
102470
|
+
var currentText = typeof packageJsonInfo === "object" ? packageJsonInfo.packageJsonText : undefined;
|
|
102471
|
+
if (ts.isString(expected)) {
|
|
102472
|
+
result = !!currentText && ((_a = host.createHash) !== null && _a !== void 0 ? _a : ts.generateDjb2Hash)(currentText) === expected;
|
|
102473
|
+
}
|
|
102474
|
+
else {
|
|
102475
|
+
var expectedText = typeof expected === "object" ? expected.packageJsonText : undefined;
|
|
102476
|
+
result = currentText === expectedText;
|
|
102477
|
+
}
|
|
102478
|
+
affectingLoationsSameMap.set(fileName, result);
|
|
102479
|
+
return result;
|
|
102480
|
+
}
|
|
102481
|
+
function getPackageJsonScope(dirPath) {
|
|
102482
|
+
var _a;
|
|
102483
|
+
var fromCache = (_a = cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.dirToPackageJsonScope) === null || _a === void 0 ? void 0 : _a.get(dirPath);
|
|
102484
|
+
if (fromCache) {
|
|
102485
|
+
var packageJson = ts.getPackageJsconLocationFromScope(fromCache);
|
|
102486
|
+
var result = packageJsonScopes === null || packageJsonScopes === void 0 ? void 0 : packageJsonScopes.get(packageJson);
|
|
102487
|
+
if (result === undefined) {
|
|
102488
|
+
(packageJsonScopes !== null && packageJsonScopes !== void 0 ? packageJsonScopes : (packageJsonScopes = new ts.Map())).set(packageJson, result = affectingLocationsSame(packageJson, fromCache.info) ?
|
|
102489
|
+
fromCache :
|
|
102490
|
+
fileExists(packageJson) ?
|
|
102491
|
+
{ info: getPackageJsonInfo(packageJson), affectingLocations: [packageJson] } :
|
|
102492
|
+
false);
|
|
102493
|
+
}
|
|
102494
|
+
return result || undefined;
|
|
102495
|
+
}
|
|
102496
|
+
if (!(resuableCacheResolutions === null || resuableCacheResolutions === void 0 ? void 0 : resuableCacheResolutions.cache.packageJsons))
|
|
102497
|
+
return;
|
|
102498
|
+
if (!decodedPackageJsonMap) {
|
|
102499
|
+
decodedPackageJsonMap = new ts.Map();
|
|
102500
|
+
var filePathDecoder_1 = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder();
|
|
102501
|
+
for (var _i = 0, _b = resuableCacheResolutions.cache.packageJsons; _i < _b.length; _i++) {
|
|
102502
|
+
var dirIdOrDirAndPackageJson = _b[_i];
|
|
102503
|
+
var dirPath_1 = filePathDecoder_1.toFilePath(dirIdOrDirAndPackageJson[0]);
|
|
102504
|
+
var packageJson = filePathDecoder_1.toFileAbsolutePath(dirIdOrDirAndPackageJson[1]);
|
|
102505
|
+
ts.moduleNameToDirectorySet(decodedPackageJsonMap, dirPath_1, packageJson, ts.identity, function (fileName) { return ts.toPath(fileName, filePathDecoder_1.currentDirectory, filePathDecoder_1.getCanonicalFileName); }, ts.noop);
|
|
102506
|
+
}
|
|
102507
|
+
}
|
|
102508
|
+
return toPackageJsonScope(decodedPackageJsonMap.get(dirPath));
|
|
102509
|
+
}
|
|
102510
|
+
function toPackageJsonScope(file) {
|
|
102511
|
+
if (!file)
|
|
102512
|
+
return undefined;
|
|
102513
|
+
var result = packageJsonScopes === null || packageJsonScopes === void 0 ? void 0 : packageJsonScopes.get(file);
|
|
102514
|
+
if (result !== undefined)
|
|
102515
|
+
return result || undefined;
|
|
102516
|
+
(packageJsonScopes !== null && packageJsonScopes !== void 0 ? packageJsonScopes : (packageJsonScopes = new ts.Map()));
|
|
102517
|
+
if (fileExists(file)) {
|
|
102518
|
+
result = {
|
|
102519
|
+
info: getPackageJsonInfo(file),
|
|
102520
|
+
affectingLocations: [file]
|
|
102521
|
+
};
|
|
102522
|
+
}
|
|
102523
|
+
packageJsonScopes.set(file, result || false);
|
|
102524
|
+
return result;
|
|
102525
|
+
}
|
|
102526
|
+
function getResolvedFromCache(cache, reusableCache, decodedReusableCache, dirPath, name, mode, redirectedReference, moduleNameToDirectoryMap, decodedModuleNameToDirectoryMap) {
|
|
102527
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
102528
|
+
var fromCache = ((_b = (_a = cache === null || cache === void 0 ? void 0 : cache.getMapOfCacheRedirects(redirectedReference)) === null || _a === void 0 ? void 0 : _a.get(dirPath)) === null || _b === void 0 ? void 0 : _b.get(name, mode)) ||
|
|
102529
|
+
((_d = (_c = moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) === null || _c === void 0 ? void 0 : _c.get(ts.getModeAwareCacheKey(name, mode))) === null || _d === void 0 ? void 0 : _d.get(dirPath));
|
|
102530
|
+
if (fromCache) {
|
|
102531
|
+
return fileExists(((_e = fromCache.resolvedModule) === null || _e === void 0 ? void 0 : _e.resolvedFileName) ||
|
|
102532
|
+
fromCache.resolvedTypeReferenceDirective.resolvedFileName) && ts.every(fromCache.affectingLocations, function (fileName) { var _a; return affectingLocationsSame(fileName, (_a = cacheResolutions.packageJsonCache) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfo(fileName)); }) ? fromCache : undefined;
|
|
102533
|
+
}
|
|
102534
|
+
if (!reusableCache)
|
|
102535
|
+
return undefined;
|
|
102536
|
+
if (!decodedReusableCache.getOwnMap().size && !decodedReusableCache.redirectsKeyToCache.size) {
|
|
102537
|
+
if (ts.isArray(reusableCache)) {
|
|
102538
|
+
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, undefined, reusableCache, decodedModuleNameToDirectoryMap);
|
|
102539
|
+
}
|
|
102540
|
+
else {
|
|
102541
|
+
if (reusableCache.own)
|
|
102542
|
+
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, undefined, reusableCache.own, decodedModuleNameToDirectoryMap);
|
|
102543
|
+
reusableCache.redirects.forEach(function (_a) {
|
|
102544
|
+
var options = _a.options, cache = _a.cache;
|
|
102545
|
+
var compilerOptions = options ? ts.convertToOptionsWithAbsolutePaths(options, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toAbsolutePath) : {};
|
|
102546
|
+
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, ts.getRedirectsCacheKey(compilerOptions), cache, decodedModuleNameToDirectoryMap);
|
|
102547
|
+
});
|
|
102548
|
+
}
|
|
102549
|
+
decodedReusableCache.clearRedirectsMap();
|
|
102550
|
+
decodedModuleNameToDirectoryMap === null || decodedModuleNameToDirectoryMap === void 0 ? void 0 : decodedModuleNameToDirectoryMap.clearRedirectsMap();
|
|
102551
|
+
}
|
|
102552
|
+
var resolutionId = ((_g = (_f = decodedReusableCache.getMapOfCacheRedirects(redirectedReference)) === null || _f === void 0 ? void 0 : _f.get(dirPath)) === null || _g === void 0 ? void 0 : _g.get(name, mode)) ||
|
|
102553
|
+
((_j = (_h = decodedModuleNameToDirectoryMap === null || decodedModuleNameToDirectoryMap === void 0 ? void 0 : decodedModuleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) === null || _h === void 0 ? void 0 : _h.get(ts.getModeAwareCacheKey(name, mode))) === null || _j === void 0 ? void 0 : _j.get(dirPath));
|
|
102554
|
+
return resolutionId ? toResolution(resolutionId) : undefined;
|
|
102555
|
+
}
|
|
102556
|
+
function setBuildInfoResolutionEntries(decodedReusableCache, options, optionsKey, reusableCache, decodedModuleNameToDirectoryMap) {
|
|
102557
|
+
var map = decodedReusableCache.createMapForCompilerOptions(options, optionsKey);
|
|
102558
|
+
reusableCache.forEach(function (_a) {
|
|
102559
|
+
var dirId = _a[0], entryId = _a[1];
|
|
102560
|
+
var dirPath = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFilePath(dirId);
|
|
102561
|
+
map.set(dirPath, toModeAwareCache(entryId, dirPath, options, optionsKey, decodedModuleNameToDirectoryMap));
|
|
102562
|
+
});
|
|
102563
|
+
}
|
|
102564
|
+
function toModeAwareCache(entries, dirPath, options, optionsKey, decodedModuleNameToDirectoryMap) {
|
|
102565
|
+
var modeAwareCache = ts.createModeAwareCache();
|
|
102566
|
+
entries.forEach(function (entryId) {
|
|
102567
|
+
var _a = toResolutionEntry(entryId), name = _a[0], resolutionId = _a[1], mode = _a[2];
|
|
102568
|
+
modeAwareCache.set(name, mode, resolutionId);
|
|
102569
|
+
if (!decodedModuleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
102570
|
+
return;
|
|
102571
|
+
var mapForOptions = decodedModuleNameToDirectoryMap.createMapForCompilerOptions(options, optionsKey);
|
|
102572
|
+
var key = ts.getModeAwareCacheKey(name, mode);
|
|
102573
|
+
var moduleNameMap = mapForOptions.get(key);
|
|
102574
|
+
;
|
|
102575
|
+
if (!moduleNameMap)
|
|
102576
|
+
mapForOptions.set(key, moduleNameMap = new ts.Map());
|
|
102577
|
+
ts.moduleNameToDirectorySet(moduleNameMap, dirPath, resolutionId, toOriginalPathOrResolvedFileName, function (fileName) { return ts.toPath(fileName, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().currentDirectory, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().getCanonicalFileName); }, ts.noop);
|
|
102578
|
+
});
|
|
102579
|
+
return modeAwareCache;
|
|
102580
|
+
}
|
|
102581
|
+
function toResolutionEntry(entryId) {
|
|
102582
|
+
var existing = resolutionEntries === null || resolutionEntries === void 0 ? void 0 : resolutionEntries[entryId - 1];
|
|
102583
|
+
if (existing)
|
|
102584
|
+
return existing;
|
|
102585
|
+
resolutionEntries !== null && resolutionEntries !== void 0 ? resolutionEntries : (resolutionEntries = new Array(resuableCacheResolutions.cache.resolutionEntries.length));
|
|
102586
|
+
var _a = resuableCacheResolutions.cache.resolutionEntries[entryId - 1], nameId = _a[0], resolutionId = _a[1], mode = _a[2];
|
|
102587
|
+
return resolutionEntries[entryId - 1] = [
|
|
102588
|
+
toName(nameId),
|
|
102589
|
+
resolutionId,
|
|
102590
|
+
mode
|
|
102591
|
+
];
|
|
102592
|
+
}
|
|
102593
|
+
function toName(nameId) {
|
|
102594
|
+
return resuableCacheResolutions.cache.names[nameId - 1];
|
|
102595
|
+
}
|
|
102596
|
+
function toOriginalPathOrResolvedFileName(resolutionId) {
|
|
102597
|
+
var _a;
|
|
102598
|
+
return (_a = originalPathOrResolvedFileNames === null || originalPathOrResolvedFileNames === void 0 ? void 0 : originalPathOrResolvedFileNames[resolutionId - 1]) !== null && _a !== void 0 ? _a : ((originalPathOrResolvedFileNames !== null && originalPathOrResolvedFileNames !== void 0 ? originalPathOrResolvedFileNames : (originalPathOrResolvedFileNames = new Array(resuableCacheResolutions.cache.resolutions.length)))[resolutionId - 1] = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(resuableCacheResolutions.cache.resolutions[resolutionId - 1].resolvedModule.originalPath ||
|
|
102599
|
+
resuableCacheResolutions.cache.resolutions[resolutionId - 1].resolvedModule.resolvedFileName));
|
|
102600
|
+
}
|
|
102601
|
+
function toAffectingFileLocation(fileId) {
|
|
102602
|
+
if (!decodedHashes && resuableCacheResolutions.cache.hash) {
|
|
102603
|
+
decodedHashes = ts.arrayToMap(resuableCacheResolutions.cache.hash, function (hash) { return ts.isArray(hash) ? hash[0] : hash; }, function (hash) { return ts.isArray(hash) ? hash[1] : undefined; });
|
|
102604
|
+
}
|
|
102605
|
+
var hash = decodedHashes === null || decodedHashes === void 0 ? void 0 : decodedHashes.get(fileId);
|
|
102606
|
+
var file = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(fileId);
|
|
102607
|
+
return affectingLocationsSame(file, hash) ? file : undefined;
|
|
102608
|
+
}
|
|
102609
|
+
function toResolution(resolutionId) {
|
|
102610
|
+
var _a, _b;
|
|
102611
|
+
var existing = resolutions === null || resolutions === void 0 ? void 0 : resolutions[resolutionId - 1];
|
|
102612
|
+
if (existing !== undefined)
|
|
102613
|
+
return existing || undefined;
|
|
102614
|
+
resolutions !== null && resolutions !== void 0 ? resolutions : (resolutions = new Array(resuableCacheResolutions.cache.resolutions.length));
|
|
102615
|
+
var resolution = resuableCacheResolutions.cache.resolutions[resolutionId - 1];
|
|
102616
|
+
var resolvedFileName = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName) || resolution.resolvedTypeReferenceDirective.resolvedFileName);
|
|
102617
|
+
var affectingLocations;
|
|
102618
|
+
if (fileExists(resolvedFileName) && ts.every(resolution.affectingLocations, function (fileId) {
|
|
102619
|
+
var file = toAffectingFileLocation(fileId);
|
|
102620
|
+
if (file)
|
|
102621
|
+
(affectingLocations !== null && affectingLocations !== void 0 ? affectingLocations : (affectingLocations = [])).push(file);
|
|
102622
|
+
return !!file;
|
|
102623
|
+
})) {
|
|
102624
|
+
var extenstion = resolution.resolvedModule ? ts.extensionFromPath(resolvedFileName) : undefined;
|
|
102625
|
+
return resolutions[resolutionId - 1] = {
|
|
102626
|
+
resolvedModule: toResolved(resolution.resolvedModule, resolvedFileName, extenstion),
|
|
102627
|
+
resolvedTypeReferenceDirective: toResolved(resolution.resolvedTypeReferenceDirective, resolvedFileName, extenstion),
|
|
102628
|
+
failedLookupLocations: ts.emptyArray,
|
|
102629
|
+
affectingLocations: affectingLocations,
|
|
102630
|
+
resolutionDiagnostics: (_b = resolution.resolutionDiagnostics) === null || _b === void 0 ? void 0 : _b.map(toResolutionDiagnostic)
|
|
102631
|
+
};
|
|
102632
|
+
}
|
|
102633
|
+
resolutions[resolutionId - 1] = false;
|
|
102634
|
+
return undefined;
|
|
102635
|
+
}
|
|
102636
|
+
function toResolved(resolved, resolvedFileName, extension) {
|
|
102637
|
+
if (!resolved)
|
|
102638
|
+
return undefined;
|
|
102639
|
+
return __assign(__assign({}, resolved), { resolvedFileName: resolvedFileName, originalPath: resolved.originalPath ? resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(resolved.originalPath) : undefined, extension: extension });
|
|
102640
|
+
}
|
|
102641
|
+
function toResolutionDiagnostic(d) {
|
|
102642
|
+
return {
|
|
102643
|
+
isImports: !!d.isImports,
|
|
102644
|
+
entry: d.entry || "",
|
|
102645
|
+
packagePath: resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(d.packagePath)
|
|
102646
|
+
};
|
|
102647
|
+
}
|
|
102648
|
+
}
|
|
102649
|
+
ts.createOldBuildInfoProgram = createOldBuildInfoProgram;
|
|
101823
102650
|
function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
|
|
101824
102651
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
101825
102652
|
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
@@ -101839,6 +102666,7 @@ var ts;
|
|
|
101839
102666
|
restoreEmitState: ts.noop,
|
|
101840
102667
|
getProgram: getProgram,
|
|
101841
102668
|
getProgramOrUndefined: function () { return getState().program; },
|
|
102669
|
+
getProgramOrOldBuildInfoProgramUndefined: function () { return getState().program; },
|
|
101842
102670
|
releaseProgram: function () { return getState().program = undefined; },
|
|
101843
102671
|
getCompilerOptions: function () { return getState().compilerOptions; },
|
|
101844
102672
|
getSourceFile: function (fileName) { return getProgram().getSourceFile(fileName); },
|
|
@@ -101921,15 +102749,57 @@ var ts;
|
|
|
101921
102749
|
return true;
|
|
101922
102750
|
}
|
|
101923
102751
|
ts.canWatchDirectoryOrFile = canWatchDirectoryOrFile;
|
|
102752
|
+
function getResolvedModuleOfResolution(resolution) {
|
|
102753
|
+
return resolution.resolvedModule;
|
|
102754
|
+
}
|
|
102755
|
+
ts.getResolvedModuleOfResolution = getResolvedModuleOfResolution;
|
|
102756
|
+
function getResolvedTypeReferenceDirectiveOfResolution(resolution) {
|
|
102757
|
+
return resolution.resolvedTypeReferenceDirective;
|
|
102758
|
+
}
|
|
102759
|
+
ts.getResolvedTypeReferenceDirectiveOfResolution = getResolvedTypeReferenceDirectiveOfResolution;
|
|
102760
|
+
function toPerDirectoryResolution(newProgram, fileCacheFromProgram, sourceFileOrPath, perDirCache, moduleNameToDirectoryMap, onRedirectedReferenceKey, forEachResolution, toPath, ancestoryWorker) {
|
|
102761
|
+
if (!(fileCacheFromProgram === null || fileCacheFromProgram === void 0 ? void 0 : fileCacheFromProgram.size()))
|
|
102762
|
+
return perDirCache;
|
|
102763
|
+
var path = !ts.isString(sourceFileOrPath) ? sourceFileOrPath.path : sourceFileOrPath;
|
|
102764
|
+
var redirectedReference = !ts.isString(sourceFileOrPath) ? newProgram.getRedirectReferenceForResolution(sourceFileOrPath) : undefined;
|
|
102765
|
+
var options = (redirectedReference === null || redirectedReference === void 0 ? void 0 : redirectedReference.commandLine.options) || newProgram.getCompilerOptions();
|
|
102766
|
+
var key = ts.getRedirectsCacheKey(options);
|
|
102767
|
+
onRedirectedReferenceKey(key);
|
|
102768
|
+
var dirPath = ts.getDirectoryPath(path);
|
|
102769
|
+
var perDirResolutionCache = perDirCache === null || perDirCache === void 0 ? void 0 : perDirCache.getMapOfCacheRedirects(redirectedReference);
|
|
102770
|
+
var cacheForDir = perDirResolutionCache === null || perDirResolutionCache === void 0 ? void 0 : perDirResolutionCache.get(dirPath);
|
|
102771
|
+
fileCacheFromProgram.forEach(function (r, name, mode) {
|
|
102772
|
+
if (forEachResolution(r, name, mode, key, redirectedReference, dirPath))
|
|
102773
|
+
return;
|
|
102774
|
+
if (cacheForDir === null || cacheForDir === void 0 ? void 0 : cacheForDir.has(name, mode))
|
|
102775
|
+
return;
|
|
102776
|
+
if (!cacheForDir) {
|
|
102777
|
+
perDirResolutionCache !== null && perDirResolutionCache !== void 0 ? perDirResolutionCache : (perDirResolutionCache = (perDirCache !== null && perDirCache !== void 0 ? perDirCache : (perDirCache = ts.createCacheWithRedirects(newProgram.getCompilerOptions()))).createMapForCompilerOptions(options, key));
|
|
102778
|
+
perDirResolutionCache.set(dirPath, cacheForDir = ts.createModeAwareCache());
|
|
102779
|
+
}
|
|
102780
|
+
cacheForDir.set(name, mode, r);
|
|
102781
|
+
if (!moduleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
102782
|
+
return;
|
|
102783
|
+
var actualModuleNameToDirectoryMap = moduleNameToDirectoryMap.createMapForCompilerOptions(options, key);
|
|
102784
|
+
var modeAwareCacheKey = ts.getModeAwareCacheKey(name, mode);
|
|
102785
|
+
var directoryPathMap = actualModuleNameToDirectoryMap.get(modeAwareCacheKey);
|
|
102786
|
+
if (!directoryPathMap)
|
|
102787
|
+
actualModuleNameToDirectoryMap.set(modeAwareCacheKey, directoryPathMap = new ts.Map());
|
|
102788
|
+
ts.moduleNameToDirectorySet(directoryPathMap, dirPath, r, ts.getResolvedFileNameForModuleNameToDirectorySet, toPath, function (ancestorPath) { return ancestoryWorker(ancestorPath, name, mode, perDirResolutionCache); });
|
|
102789
|
+
});
|
|
102790
|
+
return perDirCache;
|
|
102791
|
+
}
|
|
102792
|
+
ts.toPerDirectoryResolution = toPerDirectoryResolution;
|
|
101924
102793
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
101925
102794
|
var filesWithChangedSetOfUnresolvedImports;
|
|
101926
102795
|
var filesWithInvalidatedResolutions;
|
|
101927
|
-
var filesWithInvalidatedNonRelativeUnresolvedImports;
|
|
101928
|
-
var nonRelativeExternalModuleResolutions = ts.createMultiMap();
|
|
101929
102796
|
var resolutionsWithFailedLookups = [];
|
|
101930
102797
|
var resolutionsWithOnlyAffectingLocations = [];
|
|
101931
102798
|
var resolvedFileToResolution = ts.createMultiMap();
|
|
101932
|
-
var
|
|
102799
|
+
var perFilePackageJsonScope = new ts.Map();
|
|
102800
|
+
var watchedPackageJsonScopes = [];
|
|
102801
|
+
var packageJsonsToCloseWatcherOn;
|
|
102802
|
+
var resolutionsToCloseWatcherOn;
|
|
101933
102803
|
var hasChangedAutomaticTypeDirectiveNames = false;
|
|
101934
102804
|
var affectingPathChecksForFile;
|
|
101935
102805
|
var affectingPathChecks;
|
|
@@ -101938,13 +102808,12 @@ var ts;
|
|
|
101938
102808
|
var isInDirectoryChecks;
|
|
101939
102809
|
var getCurrentDirectory = ts.memoize(function () { return resolutionHost.getCurrentDirectory(); });
|
|
101940
102810
|
var cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
102811
|
+
var oldModuleAndTypeRefCache;
|
|
102812
|
+
var oldPackageJsonInfoCache;
|
|
101941
102813
|
var resolvedModuleNames = new ts.Map();
|
|
101942
|
-
var
|
|
101943
|
-
var nonRelativeModuleNameCache = ts.createCacheWithRedirects();
|
|
101944
|
-
var moduleResolutionCache = ts.createModuleResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName, undefined, perDirectoryResolvedModuleNames, nonRelativeModuleNameCache);
|
|
102814
|
+
var moduleResolutionCache = ts.createModuleResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName);
|
|
101945
102815
|
var resolvedTypeReferenceDirectives = new ts.Map();
|
|
101946
|
-
var
|
|
101947
|
-
var typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName, undefined, moduleResolutionCache.getPackageJsonInfoCache(), perDirectoryResolvedTypeReferenceDirectives);
|
|
102816
|
+
var typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName, undefined, moduleResolutionCache.getPackageJsonInfoCache());
|
|
101948
102817
|
var failedLookupDefaultExtensions = [".ts", ".tsx", ".js", ".jsx", ".json"];
|
|
101949
102818
|
var customFailedLookupPaths = new ts.Map();
|
|
101950
102819
|
var directoryWatchesOfFailedLookups = new ts.Map();
|
|
@@ -101954,32 +102823,23 @@ var ts;
|
|
|
101954
102823
|
var rootSplitLength = rootPath !== undefined ? rootPath.split(ts.directorySeparator).length : 0;
|
|
101955
102824
|
var typeRootsWatches = new ts.Map();
|
|
101956
102825
|
return {
|
|
102826
|
+
resolvedModuleNames: resolvedModuleNames,
|
|
102827
|
+
resolvedTypeReferenceDirectives: resolvedTypeReferenceDirectives,
|
|
101957
102828
|
getModuleResolutionCache: function () { return moduleResolutionCache; },
|
|
102829
|
+
getTypeReferenceDirectiveResolutionCache: function () { return typeReferenceDirectiveResolutionCache; },
|
|
101958
102830
|
startRecordingFilesWithChangedResolutions: startRecordingFilesWithChangedResolutions,
|
|
101959
102831
|
finishRecordingFilesWithChangedResolutions: finishRecordingFilesWithChangedResolutions,
|
|
101960
102832
|
startCachingPerDirectoryResolution: startCachingPerDirectoryResolution,
|
|
101961
102833
|
finishCachingPerDirectoryResolution: finishCachingPerDirectoryResolution,
|
|
101962
102834
|
resolveModuleNames: resolveModuleNames,
|
|
101963
|
-
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
101964
102835
|
resolveTypeReferenceDirectives: resolveTypeReferenceDirectives,
|
|
101965
|
-
removeResolutionsFromProjectReferenceRedirects: removeResolutionsFromProjectReferenceRedirects,
|
|
101966
|
-
removeResolutionsOfFile: removeResolutionsOfFile,
|
|
101967
102836
|
hasChangedAutomaticTypeDirectiveNames: function () { return hasChangedAutomaticTypeDirectiveNames; },
|
|
101968
102837
|
invalidateResolutionOfFile: invalidateResolutionOfFile,
|
|
101969
102838
|
invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
|
|
101970
102839
|
setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
|
|
101971
102840
|
createHasInvalidatedResolution: createHasInvalidatedResolution,
|
|
101972
|
-
isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
101973
|
-
updateTypeRootsWatch: updateTypeRootsWatch,
|
|
101974
|
-
closeTypeRootsWatch: closeTypeRootsWatch,
|
|
101975
102841
|
clear: clear
|
|
101976
102842
|
};
|
|
101977
|
-
function getResolvedModule(resolution) {
|
|
101978
|
-
return resolution.resolvedModule;
|
|
101979
|
-
}
|
|
101980
|
-
function getResolvedTypeReferenceDirective(resolution) {
|
|
101981
|
-
return resolution.resolvedTypeReferenceDirective;
|
|
101982
|
-
}
|
|
101983
102843
|
function isInDirectoryPath(dir, file) {
|
|
101984
102844
|
if (dir === undefined || file.length <= dir.length) {
|
|
101985
102845
|
return false;
|
|
@@ -101990,21 +102850,25 @@ var ts;
|
|
|
101990
102850
|
ts.clearMap(directoryWatchesOfFailedLookups, ts.closeFileWatcherOf);
|
|
101991
102851
|
ts.clearMap(fileWatchesOfAffectingLocations, ts.closeFileWatcherOf);
|
|
101992
102852
|
customFailedLookupPaths.clear();
|
|
101993
|
-
nonRelativeExternalModuleResolutions.clear();
|
|
101994
102853
|
closeTypeRootsWatch();
|
|
101995
102854
|
resolvedModuleNames.clear();
|
|
101996
102855
|
resolvedTypeReferenceDirectives.clear();
|
|
101997
102856
|
resolvedFileToResolution.clear();
|
|
101998
102857
|
resolutionsWithFailedLookups.length = 0;
|
|
101999
102858
|
resolutionsWithOnlyAffectingLocations.length = 0;
|
|
102859
|
+
watchedPackageJsonScopes.length = 0;
|
|
102000
102860
|
failedLookupChecks = undefined;
|
|
102001
102861
|
startsWithPathChecks = undefined;
|
|
102002
102862
|
isInDirectoryChecks = undefined;
|
|
102003
102863
|
affectingPathChecks = undefined;
|
|
102004
102864
|
affectingPathChecksForFile = undefined;
|
|
102865
|
+
resolutionsToCloseWatcherOn = undefined;
|
|
102866
|
+
packageJsonsToCloseWatcherOn = undefined;
|
|
102867
|
+
oldModuleAndTypeRefCache = undefined;
|
|
102868
|
+
oldPackageJsonInfoCache = undefined;
|
|
102005
102869
|
moduleResolutionCache.clear();
|
|
102006
102870
|
typeReferenceDirectiveResolutionCache.clear();
|
|
102007
|
-
|
|
102871
|
+
perFilePackageJsonScope.clear();
|
|
102008
102872
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
102009
102873
|
}
|
|
102010
102874
|
function startRecordingFilesWithChangedResolutions() {
|
|
@@ -102015,13 +102879,6 @@ var ts;
|
|
|
102015
102879
|
filesWithChangedSetOfUnresolvedImports = undefined;
|
|
102016
102880
|
return collected;
|
|
102017
102881
|
}
|
|
102018
|
-
function isFileWithInvalidatedNonRelativeUnresolvedImports(path) {
|
|
102019
|
-
if (!filesWithInvalidatedNonRelativeUnresolvedImports) {
|
|
102020
|
-
return false;
|
|
102021
|
-
}
|
|
102022
|
-
var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
|
|
102023
|
-
return !!value && !!value.length;
|
|
102024
|
-
}
|
|
102025
102882
|
function createHasInvalidatedResolution(forceAllFilesAsInvalidated) {
|
|
102026
102883
|
invalidateResolutionsOfFailedLookupLocations();
|
|
102027
102884
|
if (forceAllFilesAsInvalidated) {
|
|
@@ -102030,71 +102887,239 @@ var ts;
|
|
|
102030
102887
|
}
|
|
102031
102888
|
var collected = filesWithInvalidatedResolutions;
|
|
102032
102889
|
filesWithInvalidatedResolutions = undefined;
|
|
102033
|
-
return function (path) { return (
|
|
102034
|
-
isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
|
|
102890
|
+
return function (path) { return !!(collected === null || collected === void 0 ? void 0 : collected.has(path)); };
|
|
102035
102891
|
}
|
|
102036
102892
|
function startCachingPerDirectoryResolution() {
|
|
102037
|
-
moduleResolutionCache.
|
|
102038
|
-
|
|
102039
|
-
|
|
102040
|
-
|
|
102893
|
+
var packageJsonInfoCache = moduleResolutionCache.getPackageJsonInfoCache();
|
|
102894
|
+
var internalCache = packageJsonInfoCache.getInternalMap();
|
|
102895
|
+
moduleResolutionCache.clear();
|
|
102896
|
+
typeReferenceDirectiveResolutionCache.clear();
|
|
102897
|
+
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
102898
|
+
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
102899
|
+
if (oldModuleAndTypeRefCache) {
|
|
102900
|
+
oldModuleAndTypeRefCache.clearRedirectsMap();
|
|
102901
|
+
moduleResolutionCache.setOldResolutionCache(oldModuleAndTypeRefCache.modules);
|
|
102902
|
+
typeReferenceDirectiveResolutionCache.setOldResolutionCache(oldModuleAndTypeRefCache.typeRefs);
|
|
102903
|
+
}
|
|
102904
|
+
packageJsonInfoCache.setInternalMap(internalCache);
|
|
102905
|
+
packageJsonInfoCache.setOldPackageJsonScopeCache(oldPackageJsonInfoCache);
|
|
102041
102906
|
}
|
|
102042
102907
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
102043
|
-
|
|
102044
|
-
|
|
102045
|
-
|
|
102046
|
-
|
|
102047
|
-
|
|
102048
|
-
|
|
102049
|
-
|
|
102050
|
-
|
|
102051
|
-
|
|
102052
|
-
|
|
102053
|
-
|
|
102054
|
-
|
|
102055
|
-
|
|
102056
|
-
|
|
102057
|
-
|
|
102908
|
+
hasChangedAutomaticTypeDirectiveNames = false;
|
|
102909
|
+
if (!newProgram) {
|
|
102910
|
+
clear();
|
|
102911
|
+
return;
|
|
102912
|
+
}
|
|
102913
|
+
if (newProgram === oldProgram)
|
|
102914
|
+
return;
|
|
102915
|
+
var needsResolutionUpdate = newProgram.structureIsReused !== 3;
|
|
102916
|
+
var modules;
|
|
102917
|
+
var typeRefs;
|
|
102918
|
+
var moduleNameToDirectoryMap = ts.createCacheWithRedirects(newProgram.getCompilerOptions());
|
|
102919
|
+
var dirToPackageJsonScope = new ts.Map();
|
|
102920
|
+
for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
|
|
102921
|
+
var newFile = _a[_i];
|
|
102922
|
+
if (needsResolutionUpdate) {
|
|
102923
|
+
modules = ensureResolutionsOfFile(newProgram, resolvedModuleNames, newFile.resolvedModules, newFile, getResolvedModuleOfResolution, modules, moduleNameToDirectoryMap);
|
|
102924
|
+
typeRefs = ensureResolutionsOfFile(newProgram, resolvedTypeReferenceDirectives, newFile.resolvedTypeReferenceDirectiveNames, newFile, getResolvedTypeReferenceDirectiveOfResolution, typeRefs, undefined);
|
|
102925
|
+
}
|
|
102926
|
+
ensurePackageJsonWatchesForFile(newFile, dirToPackageJsonScope);
|
|
102927
|
+
}
|
|
102928
|
+
if (needsResolutionUpdate) {
|
|
102929
|
+
var newProgramAutoTypeRefContainingFile = resolutionHost.toPath(newProgram.getAutomaticTypeDirectiveContainingFile());
|
|
102930
|
+
typeRefs = ensureResolutionsOfFile(newProgram, resolvedTypeReferenceDirectives, newProgram.getAutomaticTypeDirectiveResolutions(), newProgramAutoTypeRefContainingFile, getResolvedTypeReferenceDirectiveOfResolution, typeRefs, undefined);
|
|
102931
|
+
if (!modules && !typeRefs) {
|
|
102932
|
+
oldModuleAndTypeRefCache = undefined;
|
|
102933
|
+
}
|
|
102934
|
+
else {
|
|
102935
|
+
oldModuleAndTypeRefCache = getOldResolutionCache(modules, typeRefs, moduleNameToDirectoryMap);
|
|
102936
|
+
}
|
|
102937
|
+
if (oldProgram) {
|
|
102938
|
+
for (var _b = 0, _c = oldProgram.getSourceFiles(); _b < _c.length; _b++) {
|
|
102939
|
+
var f = _c[_b];
|
|
102940
|
+
if (!newProgram.getSourceFileByPath(f.path))
|
|
102941
|
+
removeResolutionsOfFile(f.path);
|
|
102058
102942
|
}
|
|
102059
|
-
|
|
102060
|
-
|
|
102061
|
-
|
|
102062
|
-
impliedFormatPackageJsons.delete(newFile.path);
|
|
102063
|
-
});
|
|
102064
|
-
impliedFormatPackageJsons.forEach(function (existing, path) {
|
|
102065
|
-
if (!(newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFileByPath(path))) {
|
|
102066
|
-
existing.forEach(function (location) { return fileWatchesOfAffectingLocations.get(location).files--; });
|
|
102067
|
-
impliedFormatPackageJsons.delete(path);
|
|
102943
|
+
var oldProgramAutoTypeRefContainingFile = resolutionHost.toPath(oldProgram.getAutomaticTypeDirectiveContainingFile());
|
|
102944
|
+
if (oldProgramAutoTypeRefContainingFile !== newProgramAutoTypeRefContainingFile) {
|
|
102945
|
+
removeResolutionsOfFile(oldProgramAutoTypeRefContainingFile);
|
|
102068
102946
|
}
|
|
102069
|
-
}
|
|
102947
|
+
}
|
|
102070
102948
|
}
|
|
102071
|
-
|
|
102072
|
-
if (
|
|
102073
|
-
|
|
102074
|
-
|
|
102949
|
+
perFilePackageJsonScope.forEach(function (existing, path) {
|
|
102950
|
+
if (!(newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFileByPath(path))) {
|
|
102951
|
+
stopWatchingPackageJsonScope(existing, path);
|
|
102952
|
+
perFilePackageJsonScope.delete(path);
|
|
102075
102953
|
}
|
|
102076
102954
|
});
|
|
102955
|
+
if (dirToPackageJsonScope.size) {
|
|
102956
|
+
oldPackageJsonInfoCache = getOldPackageJsonInfoCache(dirToPackageJsonScope);
|
|
102957
|
+
}
|
|
102958
|
+
else {
|
|
102959
|
+
oldPackageJsonInfoCache = undefined;
|
|
102960
|
+
}
|
|
102961
|
+
if (needsResolutionUpdate && (!oldProgram || newProgram.getCompilerOptions() !== oldProgram.getCompilerOptions()))
|
|
102962
|
+
updateTypeRootsWatch();
|
|
102963
|
+
resolutionsToCloseWatcherOn === null || resolutionsToCloseWatcherOn === void 0 ? void 0 : resolutionsToCloseWatcherOn.forEach(closeWatchersOfResolution);
|
|
102964
|
+
resolutionsToCloseWatcherOn = undefined;
|
|
102965
|
+
packageJsonsToCloseWatcherOn === null || packageJsonsToCloseWatcherOn === void 0 ? void 0 : packageJsonsToCloseWatcherOn.forEach(closeWatchersOfPackageJsonScope);
|
|
102966
|
+
packageJsonsToCloseWatcherOn = undefined;
|
|
102077
102967
|
fileWatchesOfAffectingLocations.forEach(function (watcher, path) {
|
|
102078
102968
|
if (watcher.files === 0 && watcher.resolutions === 0) {
|
|
102079
102969
|
fileWatchesOfAffectingLocations.delete(path);
|
|
102080
102970
|
watcher.watcher.close();
|
|
102081
102971
|
}
|
|
102082
102972
|
});
|
|
102083
|
-
hasChangedAutomaticTypeDirectiveNames = false;
|
|
102084
102973
|
}
|
|
102085
|
-
function
|
|
102974
|
+
function ensurePackageJsonWatchesForFile(newFile, dirToPackageJsonScope) {
|
|
102975
|
+
var _a;
|
|
102976
|
+
var existing = perFilePackageJsonScope.get(newFile.path);
|
|
102977
|
+
var scope = ts.isExternalOrCommonJsModule(newFile) ? newFile.packageJsonScope : undefined;
|
|
102978
|
+
if (scope) {
|
|
102979
|
+
((_a = scope.files) !== null && _a !== void 0 ? _a : (scope.files = new ts.Set())).add(newFile.path);
|
|
102980
|
+
watchPackageJsonScopeLocations(scope, scope.failedLookupLocations, "watchedFailed");
|
|
102981
|
+
watchPackageJsonScopeLocations(scope, scope.affectingLocations, "watchedAffected");
|
|
102982
|
+
perFilePackageJsonScope.set(newFile.path, scope);
|
|
102983
|
+
ts.moduleNameToDirectorySet(dirToPackageJsonScope, ts.getDirectoryPath(newFile.resolvedPath), scope, ts.getPackageJsconLocationFromScope, function (dir) { return resolutionHost.toPath(dir); }, ts.noop);
|
|
102984
|
+
}
|
|
102985
|
+
if (existing && scope !== existing)
|
|
102986
|
+
stopWatchingPackageJsonScope(existing, newFile.path);
|
|
102987
|
+
}
|
|
102988
|
+
function stopWatchingPackageJsonScope(scope, path) {
|
|
102989
|
+
var _a, _b;
|
|
102990
|
+
(_a = scope.files) === null || _a === void 0 ? void 0 : _a.delete(path);
|
|
102991
|
+
if (!((_b = scope.files) === null || _b === void 0 ? void 0 : _b.size))
|
|
102992
|
+
(packageJsonsToCloseWatcherOn !== null && packageJsonsToCloseWatcherOn !== void 0 ? packageJsonsToCloseWatcherOn : (packageJsonsToCloseWatcherOn = [])).push(scope);
|
|
102993
|
+
}
|
|
102994
|
+
function watchPackageJsonScopeLocations(scope, locations, field) {
|
|
102086
102995
|
var _a, _b;
|
|
102996
|
+
var locationsLength = (_a = locations === null || locations === void 0 ? void 0 : locations.length) !== null && _a !== void 0 ? _a : 0;
|
|
102997
|
+
if (!locationsLength || scope[field] === locationsLength)
|
|
102998
|
+
return;
|
|
102999
|
+
if (!scope.watchedFailed && !scope.watchedAffected)
|
|
103000
|
+
watchedPackageJsonScopes.push(scope);
|
|
103001
|
+
for (var i = (_b = scope[field]) !== null && _b !== void 0 ? _b : 0; i < locationsLength; i++) {
|
|
103002
|
+
createFileWatcherOfAffectingLocation(locations[i], false);
|
|
103003
|
+
}
|
|
103004
|
+
scope[field] = locationsLength;
|
|
103005
|
+
}
|
|
103006
|
+
function closeWatchersOfPackageJsonScope(scope) {
|
|
103007
|
+
var _a;
|
|
103008
|
+
if (((_a = scope.files) === null || _a === void 0 ? void 0 : _a.size) || !scope.files)
|
|
103009
|
+
return;
|
|
103010
|
+
scope.files = undefined;
|
|
103011
|
+
ts.unorderedRemoveItem(watchedPackageJsonScopes, scope);
|
|
103012
|
+
stopWatchingPackageJsonScopeLocations(scope, scope.failedLookupLocations, "watchedFailed");
|
|
103013
|
+
stopWatchingPackageJsonScopeLocations(scope, scope.affectingLocations, "watchedAffected");
|
|
103014
|
+
}
|
|
103015
|
+
function stopWatchingPackageJsonScopeLocations(scope, locations, field) {
|
|
103016
|
+
if (!scope[field])
|
|
103017
|
+
return;
|
|
103018
|
+
for (var i = 0; i < scope[field]; i++) {
|
|
103019
|
+
fileWatchesOfAffectingLocations.get(locations[i]).files--;
|
|
103020
|
+
}
|
|
103021
|
+
scope[field] = undefined;
|
|
103022
|
+
}
|
|
103023
|
+
function getOldPackageJsonInfoCache(dirToPackageJsonScope) {
|
|
103024
|
+
var packageJsons;
|
|
103025
|
+
return {
|
|
103026
|
+
getPackageJsonScope: function (dir) {
|
|
103027
|
+
var _a;
|
|
103028
|
+
var scope = dirToPackageJsonScope.get(dir);
|
|
103029
|
+
if (!scope)
|
|
103030
|
+
return undefined;
|
|
103031
|
+
if (!scope.isInvalidated)
|
|
103032
|
+
return scope;
|
|
103033
|
+
if (!resolutionHost.getCompilationSettings().cacheResolutions || !scope.info)
|
|
103034
|
+
return undefined;
|
|
103035
|
+
var packageJson = ts.getPackageJsconLocationFromScope(scope);
|
|
103036
|
+
var result = packageJsons === null || packageJsons === void 0 ? void 0 : packageJsons.get(packageJson);
|
|
103037
|
+
if (result !== undefined)
|
|
103038
|
+
return result || undefined;
|
|
103039
|
+
if (resolutionHost.fileExists(packageJson)) {
|
|
103040
|
+
result = {
|
|
103041
|
+
info: ts.getPackageJsonInfo(ts.getDirectoryPath(packageJson), false, ts.getTemporaryModuleResolutionState(moduleResolutionCache.getPackageJsonInfoCache(), ((_a = resolutionHost.getCompilerHost) === null || _a === void 0 ? void 0 : _a.call(resolutionHost)) || resolutionHost, resolutionHost.getCompilationSettings())),
|
|
103042
|
+
affectingLocations: [packageJson],
|
|
103043
|
+
};
|
|
103044
|
+
}
|
|
103045
|
+
(packageJsons !== null && packageJsons !== void 0 ? packageJsons : (packageJsons = new ts.Map())).set(packageJson, result || false);
|
|
103046
|
+
return result;
|
|
103047
|
+
}
|
|
103048
|
+
};
|
|
103049
|
+
}
|
|
103050
|
+
function ensureResolutionsOfFile(newProgram, perFileCache, fileCacheFromProgram, sourceFileOrPath, getResolutionWithResolvedFileName, perDirCache, moduleNameToDirectoryMap) {
|
|
103051
|
+
var path = !ts.isString(sourceFileOrPath) ? sourceFileOrPath.path : sourceFileOrPath;
|
|
103052
|
+
var resolutionsInFile = perFileCache.get(path);
|
|
103053
|
+
var seenNamesInFile = ts.createModeAwareCache();
|
|
103054
|
+
perDirCache = toPerDirectoryResolution(newProgram, fileCacheFromProgram, sourceFileOrPath, perDirCache, moduleNameToDirectoryMap, function (key) {
|
|
103055
|
+
if (resolutionsInFile && resolutionsInFile.key !== key) {
|
|
103056
|
+
resolutionsInFile.cache.forEach(function (r) { return stopWatchingResolution(r, path, getResolutionWithResolvedFileName); });
|
|
103057
|
+
resolutionsInFile = undefined;
|
|
103058
|
+
}
|
|
103059
|
+
}, function (r, name, mode, key) {
|
|
103060
|
+
seenNamesInFile.set(name, mode, true);
|
|
103061
|
+
var existing = resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.get(name, mode);
|
|
103062
|
+
if (existing && r !== existing)
|
|
103063
|
+
stopWatchingResolution(existing, path, getResolutionWithResolvedFileName);
|
|
103064
|
+
watchResolution(newProgram, name, r, path, getResolutionWithResolvedFileName);
|
|
103065
|
+
if (!resolutionsInFile)
|
|
103066
|
+
perFileCache.set(path, resolutionsInFile = { key: key, cache: ts.createModeAwareCache() });
|
|
103067
|
+
resolutionsInFile.cache.set(name, mode, r);
|
|
103068
|
+
}, function (dir) { return resolutionHost.toPath(dir); }, ts.noop);
|
|
103069
|
+
if (((resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.size()) || 0) !== seenNamesInFile.size()) {
|
|
103070
|
+
resolutionsInFile.cache.forEach(function (resolution, name, mode) {
|
|
103071
|
+
if (!seenNamesInFile.has(name, mode)) {
|
|
103072
|
+
stopWatchingResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
103073
|
+
resolutionsInFile.cache.delete(name, mode);
|
|
103074
|
+
}
|
|
103075
|
+
});
|
|
103076
|
+
if (!(resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.size))
|
|
103077
|
+
perFileCache.delete(path);
|
|
103078
|
+
}
|
|
103079
|
+
return perDirCache;
|
|
103080
|
+
}
|
|
103081
|
+
function getOldResolutionCache(modules, typeRefs, moduleNameToDirectoryMap) {
|
|
103082
|
+
if (!modules && !typeRefs)
|
|
103083
|
+
return undefined;
|
|
103084
|
+
return {
|
|
103085
|
+
modules: {
|
|
103086
|
+
getResolved: function (dirPath, name, mode, redirectedReference) { return getResolvedWithOldCache(dirPath, name, mode, redirectedReference, modules, moduleNameToDirectoryMap); }
|
|
103087
|
+
},
|
|
103088
|
+
typeRefs: {
|
|
103089
|
+
getResolved: function (dirPath, name, mode, redirectedReference) { return getResolvedWithOldCache(dirPath, name, mode, redirectedReference, typeRefs, undefined); }
|
|
103090
|
+
},
|
|
103091
|
+
clearRedirectsMap: function () {
|
|
103092
|
+
modules === null || modules === void 0 ? void 0 : modules.clearRedirectsMap();
|
|
103093
|
+
typeRefs === null || typeRefs === void 0 ? void 0 : typeRefs.clearRedirectsMap();
|
|
103094
|
+
moduleNameToDirectoryMap.clearRedirectsMap();
|
|
103095
|
+
},
|
|
103096
|
+
};
|
|
103097
|
+
}
|
|
103098
|
+
function getResolvedWithOldCache(dirPath, name, mode, redirectedReference, perDirCache, moduleNameToDirectoryMap) {
|
|
103099
|
+
var _a, _b, _c, _d;
|
|
103100
|
+
if (!perDirCache)
|
|
103101
|
+
return undefined;
|
|
103102
|
+
var result = ((_b = (_a = perDirCache.getMapOfCacheRedirects(redirectedReference)) === null || _a === void 0 ? void 0 : _a.get(dirPath)) === null || _b === void 0 ? void 0 : _b.get(name, mode)) ||
|
|
103103
|
+
((_d = (_c = moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) === null || _c === void 0 ? void 0 : _c.get(ts.getModeAwareCacheKey(name, mode))) === null || _d === void 0 ? void 0 : _d.get(dirPath));
|
|
103104
|
+
return result && !result.isInvalidated ? result : undefined;
|
|
103105
|
+
}
|
|
103106
|
+
function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference, _containingSourceFile, mode) {
|
|
103107
|
+
var _a;
|
|
102087
103108
|
var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
102088
103109
|
if (!resolutionHost.getGlobalCache) {
|
|
102089
103110
|
return primaryResult;
|
|
102090
103111
|
}
|
|
102091
103112
|
var globalCache = resolutionHost.getGlobalCache();
|
|
102092
103113
|
if (globalCache !== undefined && !ts.isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && ts.extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
102093
|
-
var
|
|
103114
|
+
var _b = ts.loadModuleFromGlobalCache(ts.Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName), resolutionHost.projectName, compilerOptions, host, globalCache, moduleResolutionCache), resolvedModule = _b.resolvedModule, failedLookupLocations = _b.failedLookupLocations, affectingLocations = _b.affectingLocations, resolutionDiagnostics = _b.resolutionDiagnostics;
|
|
102094
103115
|
if (resolvedModule) {
|
|
102095
103116
|
primaryResult.resolvedModule = resolvedModule;
|
|
102096
|
-
(
|
|
102097
|
-
|
|
103117
|
+
if (!compilerOptions.cacheResolutions)
|
|
103118
|
+
(_a = primaryResult.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
103119
|
+
else
|
|
103120
|
+
primaryResult.failedLookupLocations.length = 0;
|
|
103121
|
+
primaryResult.affectingLocations = ts.updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
103122
|
+
primaryResult.resolutionDiagnostics = ts.updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
102098
103123
|
return primaryResult;
|
|
102099
103124
|
}
|
|
102100
103125
|
}
|
|
@@ -102104,68 +103129,35 @@ var ts;
|
|
|
102104
103129
|
return ts.resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode);
|
|
102105
103130
|
}
|
|
102106
103131
|
function resolveNamesWithLocalCache(_a) {
|
|
102107
|
-
var _b, _c, _d;
|
|
102108
|
-
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference,
|
|
103132
|
+
var _b, _c, _d, _e;
|
|
103133
|
+
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, perFileCache = _a.perFileCache, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, partialResolutionInfo = _a.partialResolutionInfo, logChanges = _a.logChanges, containingSourceFile = _a.containingSourceFile, containingSourceFileMode = _a.containingSourceFileMode;
|
|
102109
103134
|
var path = resolutionHost.toPath(containingFile);
|
|
102110
|
-
var resolutionsInFile =
|
|
102111
|
-
var
|
|
102112
|
-
var
|
|
102113
|
-
|
|
102114
|
-
|
|
102115
|
-
|
|
102116
|
-
perDirectoryCache.set(dirPath, perDirectoryResolution);
|
|
103135
|
+
var resolutionsInFile = perFileCache.get(path);
|
|
103136
|
+
var compilerOptions = resolutionHost.getCompilationSettings();
|
|
103137
|
+
var key = ts.getRedirectsCacheKey((redirectedReference === null || redirectedReference === void 0 ? void 0 : redirectedReference.commandLine.options) || compilerOptions);
|
|
103138
|
+
if (!resolutionsInFile || resolutionsInFile.key !== key) {
|
|
103139
|
+
resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.forEach(function (r) { return stopWatchingResolution(r, path, getResolutionWithResolvedFileName); });
|
|
103140
|
+
perFileCache.set(path, resolutionsInFile = { key: key, cache: ts.createModeAwareCache() });
|
|
102117
103141
|
}
|
|
102118
103142
|
var resolvedModules = [];
|
|
102119
|
-
var compilerOptions = resolutionHost.getCompilationSettings();
|
|
102120
|
-
var hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
102121
|
-
var program = resolutionHost.getCurrentProgram();
|
|
102122
|
-
var oldRedirect = program && program.getResolvedProjectReferenceToRedirect(containingFile);
|
|
102123
|
-
var unmatchedRedirects = oldRedirect ?
|
|
102124
|
-
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
|
|
102125
|
-
!!redirectedReference;
|
|
102126
103143
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
102127
103144
|
var i = 0;
|
|
102128
|
-
for (var _i = 0,
|
|
102129
|
-
var entry =
|
|
102130
|
-
var name = ts.isString(entry) ? entry : entry.fileName
|
|
103145
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
103146
|
+
var entry = names_4[_i];
|
|
103147
|
+
var name = ts.isString(entry) ? entry : ts.toFileNameLowerCase(entry.fileName);
|
|
102131
103148
|
var mode = !ts.isString(entry) ? ts.getModeForFileReference(entry, containingSourceFileMode) :
|
|
102132
|
-
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
|
|
103149
|
+
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, (_b = partialResolutionInfo === null || partialResolutionInfo === void 0 ? void 0 : partialResolutionInfo.namesIndex[i]) !== null && _b !== void 0 ? _b : i) : undefined;
|
|
102133
103150
|
i++;
|
|
102134
|
-
var resolution = resolutionsInFile.get(name, mode);
|
|
102135
|
-
if (!seenNamesInFile.has(name, mode) &&
|
|
102136
|
-
unmatchedRedirects || !resolution || resolution.isInvalidated ||
|
|
102137
|
-
(hasInvalidatedNonRelativeUnresolvedImport && !ts.isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
103151
|
+
var resolution = resolutionsInFile.cache.get(name, mode);
|
|
103152
|
+
if (!seenNamesInFile.has(name, mode) && (!resolution || resolution.isInvalidated)) {
|
|
102138
103153
|
var existingResolution = resolution;
|
|
102139
|
-
|
|
102140
|
-
if (
|
|
102141
|
-
|
|
102142
|
-
var host = ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost;
|
|
102143
|
-
if (ts.isTraceEnabled(compilerOptions, host)) {
|
|
102144
|
-
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
102145
|
-
ts.trace(host, loader === resolveModuleName ?
|
|
102146
|
-
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
102147
|
-
resolved.packagetId ?
|
|
102148
|
-
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 :
|
|
102149
|
-
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
|
|
102150
|
-
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved :
|
|
102151
|
-
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
102152
|
-
resolved.packagetId ?
|
|
102153
|
-
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 :
|
|
102154
|
-
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
|
|
102155
|
-
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved, name, containingFile, ts.getDirectoryPath(containingFile), resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName, (resolved === null || resolved === void 0 ? void 0 : resolved.packagetId) && ts.packageIdToString(resolved.packagetId));
|
|
102156
|
-
}
|
|
102157
|
-
}
|
|
102158
|
-
else {
|
|
102159
|
-
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode);
|
|
102160
|
-
perDirectoryResolution.set(name, mode, resolution);
|
|
102161
|
-
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
102162
|
-
resolutionHost.onDiscoveredSymlink();
|
|
102163
|
-
}
|
|
103154
|
+
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode);
|
|
103155
|
+
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
103156
|
+
resolutionHost.onDiscoveredSymlink();
|
|
102164
103157
|
}
|
|
102165
|
-
resolutionsInFile.set(name, mode, resolution);
|
|
102166
|
-
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
103158
|
+
resolutionsInFile.cache.set(name, mode, resolution);
|
|
102167
103159
|
if (existingResolution) {
|
|
102168
|
-
|
|
103160
|
+
stopWatchingResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
102169
103161
|
}
|
|
102170
103162
|
if (logChanges && filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {
|
|
102171
103163
|
filesWithChangedSetOfUnresolvedImports.push(path);
|
|
@@ -102178,27 +103170,33 @@ var ts;
|
|
|
102178
103170
|
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
102179
103171
|
ts.trace(host, loader === resolveModuleName ?
|
|
102180
103172
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
102181
|
-
resolved.
|
|
103173
|
+
resolved.packageId ?
|
|
102182
103174
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
102183
103175
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
|
|
102184
103176
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved :
|
|
102185
103177
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
102186
|
-
resolved.
|
|
103178
|
+
resolved.packageId ?
|
|
102187
103179
|
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
102188
103180
|
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
|
|
102189
|
-
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved, name, containingFile, resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName, (resolved === null || resolved === void 0 ? void 0 : resolved.
|
|
103181
|
+
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved, name, containingFile, resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName, (resolved === null || resolved === void 0 ? void 0 : resolved.packageId) && ts.packageIdToString(resolved.packageId));
|
|
102190
103182
|
}
|
|
102191
103183
|
}
|
|
102192
103184
|
ts.Debug.assert(resolution !== undefined && !resolution.isInvalidated);
|
|
102193
103185
|
seenNamesInFile.set(name, mode, true);
|
|
102194
|
-
resolvedModules.push(
|
|
103186
|
+
resolvedModules.push(resolution);
|
|
102195
103187
|
}
|
|
102196
|
-
|
|
102197
|
-
|
|
102198
|
-
|
|
102199
|
-
resolutionsInFile.delete(name, mode);
|
|
102200
|
-
}
|
|
103188
|
+
(_e = partialResolutionInfo === null || partialResolutionInfo === void 0 ? void 0 : partialResolutionInfo.reusedNames) === null || _e === void 0 ? void 0 : _e.forEach(function (_a) {
|
|
103189
|
+
var name = _a.name, mode = _a.mode;
|
|
103190
|
+
return seenNamesInFile.set(name, mode, true);
|
|
102201
103191
|
});
|
|
103192
|
+
if (resolutionsInFile.cache.size() !== seenNamesInFile.size()) {
|
|
103193
|
+
resolutionsInFile.cache.forEach(function (resolution, name, mode) {
|
|
103194
|
+
if (!seenNamesInFile.has(name, mode)) {
|
|
103195
|
+
stopWatchingResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
103196
|
+
resolutionsInFile.cache.delete(name, mode);
|
|
103197
|
+
}
|
|
103198
|
+
});
|
|
103199
|
+
}
|
|
102202
103200
|
return resolvedModules;
|
|
102203
103201
|
function resolutionIsEqualTo(oldResolution, newResolution) {
|
|
102204
103202
|
if (oldResolution === newResolution) {
|
|
@@ -102218,40 +103216,31 @@ var ts;
|
|
|
102218
103216
|
return oldResult.resolvedFileName === newResult.resolvedFileName;
|
|
102219
103217
|
}
|
|
102220
103218
|
}
|
|
102221
|
-
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
103219
|
+
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode, partialResolutionInfo) {
|
|
102222
103220
|
return resolveNamesWithLocalCache({
|
|
102223
103221
|
names: typeDirectiveNames,
|
|
102224
103222
|
containingFile: containingFile,
|
|
102225
103223
|
redirectedReference: redirectedReference,
|
|
102226
|
-
|
|
102227
|
-
perDirectoryCacheWithRedirects: perDirectoryResolvedTypeReferenceDirectives,
|
|
103224
|
+
perFileCache: resolvedTypeReferenceDirectives,
|
|
102228
103225
|
loader: resolveTypeReferenceDirective,
|
|
102229
|
-
getResolutionWithResolvedFileName:
|
|
102230
|
-
|
|
102231
|
-
|
|
103226
|
+
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirectiveOfResolution,
|
|
103227
|
+
containingSourceFileMode: containingFileMode,
|
|
103228
|
+
partialResolutionInfo: partialResolutionInfo,
|
|
102232
103229
|
});
|
|
102233
103230
|
}
|
|
102234
|
-
function resolveModuleNames(moduleNames, containingFile,
|
|
103231
|
+
function resolveModuleNames(moduleNames, containingFile, redirectedReference, containingSourceFile, partialResolutionInfo) {
|
|
102235
103232
|
return resolveNamesWithLocalCache({
|
|
102236
103233
|
names: moduleNames,
|
|
102237
103234
|
containingFile: containingFile,
|
|
102238
103235
|
redirectedReference: redirectedReference,
|
|
102239
|
-
|
|
102240
|
-
perDirectoryCacheWithRedirects: perDirectoryResolvedModuleNames,
|
|
103236
|
+
perFileCache: resolvedModuleNames,
|
|
102241
103237
|
loader: resolveModuleName,
|
|
102242
|
-
getResolutionWithResolvedFileName:
|
|
102243
|
-
|
|
102244
|
-
reusedNames: reusedNames,
|
|
103238
|
+
getResolutionWithResolvedFileName: getResolvedModuleOfResolution,
|
|
103239
|
+
partialResolutionInfo: partialResolutionInfo,
|
|
102245
103240
|
logChanges: logChangesWhenResolvingModule,
|
|
102246
103241
|
containingSourceFile: containingSourceFile,
|
|
102247
103242
|
});
|
|
102248
103243
|
}
|
|
102249
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode) {
|
|
102250
|
-
var cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile));
|
|
102251
|
-
if (!cache)
|
|
102252
|
-
return undefined;
|
|
102253
|
-
return cache.get(moduleName, resolutionMode);
|
|
102254
|
-
}
|
|
102255
103244
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
102256
103245
|
return ts.endsWith(dirPath, "/node_modules/@types");
|
|
102257
103246
|
}
|
|
@@ -102305,37 +103294,41 @@ var ts;
|
|
|
102305
103294
|
function isPathWithDefaultFailedLookupExtension(path) {
|
|
102306
103295
|
return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
102307
103296
|
}
|
|
102308
|
-
function
|
|
102309
|
-
if (resolution.
|
|
102310
|
-
resolution.
|
|
102311
|
-
|
|
103297
|
+
function watchResolution(newProgram, name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
103298
|
+
if (resolution.files) {
|
|
103299
|
+
resolution.files.add(filePath);
|
|
103300
|
+
if (resolution.watchedFailed !== false)
|
|
103301
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
103302
|
+
watchAffectingLocationsOfResolution(resolution);
|
|
103303
|
+
return;
|
|
103304
|
+
}
|
|
103305
|
+
resolution.files = new ts.Set();
|
|
103306
|
+
resolution.files.add(filePath);
|
|
103307
|
+
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
103308
|
+
if (resolved && resolved.resolvedFileName) {
|
|
103309
|
+
resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
103310
|
+
}
|
|
103311
|
+
if (ts.isExternalModuleNameRelative(name) || !newProgram.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
103312
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
103313
|
+
watchAffectingLocationsOfResolution(resolution);
|
|
102312
103314
|
}
|
|
102313
103315
|
else {
|
|
102314
|
-
resolution.
|
|
102315
|
-
|
|
102316
|
-
if (ts.isExternalModuleNameRelative(name)) {
|
|
102317
|
-
watchFailedLookupLocationOfResolution(resolution);
|
|
102318
|
-
}
|
|
102319
|
-
else {
|
|
102320
|
-
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
102321
|
-
}
|
|
102322
|
-
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
102323
|
-
if (resolved && resolved.resolvedFileName) {
|
|
102324
|
-
resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
102325
|
-
}
|
|
103316
|
+
resolution.watchedFailed = false;
|
|
103317
|
+
watchAffectingLocationsOfResolution(resolution);
|
|
102326
103318
|
}
|
|
102327
|
-
(resolution.files || (resolution.files = [])).push(filePath);
|
|
102328
103319
|
}
|
|
102329
103320
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
102330
|
-
|
|
102331
|
-
|
|
102332
|
-
if (!failedLookupLocations.length && !affectingLocations.length)
|
|
103321
|
+
var failedLookupLocations = resolution.failedLookupLocations;
|
|
103322
|
+
if (!failedLookupLocations.length || resolution.watchedFailed === failedLookupLocations.length)
|
|
102333
103323
|
return;
|
|
102334
|
-
if (
|
|
103324
|
+
if (!resolution.watchedFailed) {
|
|
102335
103325
|
resolutionsWithFailedLookups.push(resolution);
|
|
102336
|
-
|
|
102337
|
-
|
|
102338
|
-
|
|
103326
|
+
if (resolution.watchedAffected)
|
|
103327
|
+
ts.unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
|
|
103328
|
+
}
|
|
103329
|
+
var setAtRoot = !!resolution.setAtRoot;
|
|
103330
|
+
for (var i = resolution.watchedFailed || 0; i < failedLookupLocations.length; i++) {
|
|
103331
|
+
var failedLookupLocation = failedLookupLocations[i];
|
|
102339
103332
|
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
102340
103333
|
var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
102341
103334
|
if (toWatch) {
|
|
@@ -102353,22 +103346,22 @@ var ts;
|
|
|
102353
103346
|
}
|
|
102354
103347
|
}
|
|
102355
103348
|
}
|
|
102356
|
-
if (setAtRoot) {
|
|
103349
|
+
if (setAtRoot && !resolution.setAtRoot) {
|
|
102357
103350
|
setDirectoryWatcher(rootDir, rootPath, true);
|
|
102358
103351
|
}
|
|
102359
|
-
|
|
103352
|
+
resolution.setAtRoot = setAtRoot;
|
|
103353
|
+
resolution.watchedFailed = failedLookupLocations.length;
|
|
102360
103354
|
}
|
|
102361
|
-
function watchAffectingLocationsOfResolution(resolution
|
|
102362
|
-
ts.Debug.assert(!!resolution.refCount);
|
|
103355
|
+
function watchAffectingLocationsOfResolution(resolution) {
|
|
102363
103356
|
var affectingLocations = resolution.affectingLocations;
|
|
102364
|
-
if (!affectingLocations.length)
|
|
103357
|
+
if (!(affectingLocations === null || affectingLocations === void 0 ? void 0 : affectingLocations.length) || resolution.watchedAffected === affectingLocations.length)
|
|
102365
103358
|
return;
|
|
102366
|
-
if (
|
|
103359
|
+
if (!resolution.watchedFailed && !resolution.watchedAffected)
|
|
102367
103360
|
resolutionsWithOnlyAffectingLocations.push(resolution);
|
|
102368
|
-
for (var
|
|
102369
|
-
|
|
102370
|
-
createFileWatcherOfAffectingLocation(affectingLocation, true);
|
|
103361
|
+
for (var i = resolution.watchedAffected || 0; i < affectingLocations.length; i++) {
|
|
103362
|
+
createFileWatcherOfAffectingLocation(affectingLocations[i], true);
|
|
102371
103363
|
}
|
|
103364
|
+
resolution.watchedAffected = affectingLocations.length;
|
|
102372
103365
|
}
|
|
102373
103366
|
function createFileWatcherOfAffectingLocation(affectingLocation, forResolution) {
|
|
102374
103367
|
var fileWatcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
@@ -102427,15 +103420,6 @@ var ts;
|
|
|
102427
103420
|
paths.add(affectingLocation);
|
|
102428
103421
|
}
|
|
102429
103422
|
}
|
|
102430
|
-
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
102431
|
-
var program = resolutionHost.getCurrentProgram();
|
|
102432
|
-
if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
102433
|
-
resolutions.forEach(watchFailedLookupLocationOfResolution);
|
|
102434
|
-
}
|
|
102435
|
-
else {
|
|
102436
|
-
resolutions.forEach(function (resolution) { return watchAffectingLocationsOfResolution(resolution, true); });
|
|
102437
|
-
}
|
|
102438
|
-
}
|
|
102439
103423
|
function setDirectoryWatcher(dir, dirPath, nonRecursive) {
|
|
102440
103424
|
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
102441
103425
|
if (dirWatcher) {
|
|
@@ -102446,21 +103430,27 @@ var ts;
|
|
|
102446
103430
|
directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive: nonRecursive });
|
|
102447
103431
|
}
|
|
102448
103432
|
}
|
|
102449
|
-
function
|
|
102450
|
-
|
|
102451
|
-
resolution.
|
|
102452
|
-
if (resolution.
|
|
103433
|
+
function stopWatchingResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
103434
|
+
var _a, _b;
|
|
103435
|
+
(_a = resolution.files) === null || _a === void 0 ? void 0 : _a.delete(filePath);
|
|
103436
|
+
if (!((_b = resolution.files) === null || _b === void 0 ? void 0 : _b.size))
|
|
103437
|
+
(resolutionsToCloseWatcherOn !== null && resolutionsToCloseWatcherOn !== void 0 ? resolutionsToCloseWatcherOn : (resolutionsToCloseWatcherOn = [])).push({ resolution: resolution, getResolved: getResolutionWithResolvedFileName });
|
|
103438
|
+
}
|
|
103439
|
+
function closeWatchersOfResolution(_a) {
|
|
103440
|
+
var _b;
|
|
103441
|
+
var resolution = _a.resolution, getResolved = _a.getResolved;
|
|
103442
|
+
if (((_b = resolution.files) === null || _b === void 0 ? void 0 : _b.size) || !resolution.files)
|
|
102453
103443
|
return;
|
|
102454
|
-
|
|
102455
|
-
var resolved =
|
|
103444
|
+
resolution.files = undefined;
|
|
103445
|
+
var resolved = getResolved(resolution);
|
|
102456
103446
|
if (resolved && resolved.resolvedFileName) {
|
|
102457
103447
|
resolvedFileToResolution.remove(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
102458
103448
|
}
|
|
102459
|
-
|
|
102460
|
-
|
|
103449
|
+
if (resolution.watchedFailed) {
|
|
103450
|
+
ts.unorderedRemoveItem(resolutionsWithFailedLookups, resolution);
|
|
102461
103451
|
var removeAtRoot = false;
|
|
102462
|
-
for (var
|
|
102463
|
-
var failedLookupLocation =
|
|
103452
|
+
for (var i = 0; i < resolution.watchedFailed; i++) {
|
|
103453
|
+
var failedLookupLocation = resolution.failedLookupLocations[i];
|
|
102464
103454
|
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
102465
103455
|
var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
102466
103456
|
if (toWatch) {
|
|
@@ -102483,22 +103473,28 @@ var ts;
|
|
|
102483
103473
|
}
|
|
102484
103474
|
}
|
|
102485
103475
|
}
|
|
103476
|
+
ts.Debug.assert(resolution.setAtRoot === removeAtRoot);
|
|
102486
103477
|
if (removeAtRoot) {
|
|
102487
103478
|
removeDirectoryWatcher(rootPath);
|
|
102488
103479
|
}
|
|
102489
103480
|
}
|
|
102490
|
-
else if (
|
|
103481
|
+
else if (resolution.watchedAffected) {
|
|
102491
103482
|
ts.unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
|
|
102492
103483
|
}
|
|
102493
|
-
|
|
102494
|
-
var
|
|
102495
|
-
|
|
102496
|
-
|
|
103484
|
+
if (resolution.watchedAffected) {
|
|
103485
|
+
for (var i = 0; i < resolution.watchedAffected; i++) {
|
|
103486
|
+
var watcher = fileWatchesOfAffectingLocations.get(resolution.affectingLocations[i]);
|
|
103487
|
+
watcher.resolutions--;
|
|
103488
|
+
}
|
|
102497
103489
|
}
|
|
102498
103490
|
}
|
|
102499
103491
|
function removeDirectoryWatcher(dirPath) {
|
|
102500
103492
|
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
102501
103493
|
dirWatcher.refCount--;
|
|
103494
|
+
if (dirWatcher.refCount === 0) {
|
|
103495
|
+
directoryWatchesOfFailedLookups.delete(dirPath);
|
|
103496
|
+
dirWatcher.watcher.close();
|
|
103497
|
+
}
|
|
102502
103498
|
}
|
|
102503
103499
|
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
|
|
102504
103500
|
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, function (fileOrDirectory) {
|
|
@@ -102512,26 +103508,16 @@ var ts;
|
|
|
102512
103508
|
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName) {
|
|
102513
103509
|
var resolutions = cache.get(filePath);
|
|
102514
103510
|
if (resolutions) {
|
|
102515
|
-
resolutions.forEach(function (resolution) { return
|
|
103511
|
+
resolutions.cache.forEach(function (resolution) { return stopWatchingResolution(resolution, filePath, getResolutionWithResolvedFileName); });
|
|
102516
103512
|
cache.delete(filePath);
|
|
102517
103513
|
}
|
|
102518
103514
|
}
|
|
102519
|
-
function removeResolutionsFromProjectReferenceRedirects(filePath) {
|
|
102520
|
-
if (!ts.fileExtensionIs(filePath, ".json"))
|
|
102521
|
-
return;
|
|
102522
|
-
var program = resolutionHost.getCurrentProgram();
|
|
102523
|
-
if (!program)
|
|
102524
|
-
return;
|
|
102525
|
-
var resolvedProjectReference = program.getResolvedProjectReferenceByPath(filePath);
|
|
102526
|
-
if (!resolvedProjectReference)
|
|
102527
|
-
return;
|
|
102528
|
-
resolvedProjectReference.commandLine.fileNames.forEach(function (f) { return removeResolutionsOfFile(resolutionHost.toPath(f)); });
|
|
102529
|
-
}
|
|
102530
103515
|
function removeResolutionsOfFile(filePath) {
|
|
102531
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath,
|
|
102532
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath,
|
|
103516
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModuleOfResolution);
|
|
103517
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirectiveOfResolution);
|
|
102533
103518
|
}
|
|
102534
103519
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
103520
|
+
var _a;
|
|
102535
103521
|
if (!resolutions)
|
|
102536
103522
|
return false;
|
|
102537
103523
|
var invalidated = false;
|
|
@@ -102540,16 +103526,14 @@ var ts;
|
|
|
102540
103526
|
if (resolution.isInvalidated || !canInvalidate(resolution))
|
|
102541
103527
|
continue;
|
|
102542
103528
|
resolution.isInvalidated = invalidated = true;
|
|
102543
|
-
|
|
102544
|
-
var containingFilePath = _b[_a];
|
|
103529
|
+
(_a = resolution.files) === null || _a === void 0 ? void 0 : _a.forEach(function (containingFilePath) {
|
|
102545
103530
|
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
|
|
102546
103531
|
hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts.endsWith(containingFilePath, ts.inferredTypesContainingFile);
|
|
102547
|
-
}
|
|
103532
|
+
});
|
|
102548
103533
|
}
|
|
102549
103534
|
return invalidated;
|
|
102550
103535
|
}
|
|
102551
103536
|
function invalidateResolutionOfFile(filePath) {
|
|
102552
|
-
removeResolutionsOfFile(filePath);
|
|
102553
103537
|
var prevHasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
102554
103538
|
if (invalidateResolutions(resolvedFileToResolution.get(filePath), ts.returnTrue) &&
|
|
102555
103539
|
hasChangedAutomaticTypeDirectiveNames &&
|
|
@@ -102558,8 +103542,28 @@ var ts;
|
|
|
102558
103542
|
}
|
|
102559
103543
|
}
|
|
102560
103544
|
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) {
|
|
102561
|
-
|
|
102562
|
-
|
|
103545
|
+
filesMap.forEach(function (_a, filePath) {
|
|
103546
|
+
var imports = _a.imports;
|
|
103547
|
+
if (!imports.length)
|
|
103548
|
+
return;
|
|
103549
|
+
var resolvedModules = resolvedModuleNames.get(filePath);
|
|
103550
|
+
var resolvedTypeRefs = resolvedTypeReferenceDirectives.get(filePath);
|
|
103551
|
+
if (!(resolvedModules === null || resolvedModules === void 0 ? void 0 : resolvedModules.cache.size()) && !(resolvedTypeRefs === null || resolvedTypeRefs === void 0 ? void 0 : resolvedTypeRefs.cache.size()))
|
|
103552
|
+
return;
|
|
103553
|
+
imports.forEach(function (_a) {
|
|
103554
|
+
var name = _a.name, mode = _a.mode;
|
|
103555
|
+
var resolvedModule = resolvedModules === null || resolvedModules === void 0 ? void 0 : resolvedModules.cache.get(name, mode);
|
|
103556
|
+
if (resolvedModule && !resolvedModule.isInvalidated && (!resolvedModule.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolvedModule.resolvedModule.extension))) {
|
|
103557
|
+
resolvedModule.isInvalidated = true;
|
|
103558
|
+
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(filePath);
|
|
103559
|
+
}
|
|
103560
|
+
var resolvedTypeRef = resolvedTypeRefs === null || resolvedTypeRefs === void 0 ? void 0 : resolvedTypeRefs.cache.get(name, mode);
|
|
103561
|
+
if (resolvedTypeRef && !resolvedTypeRef.isInvalidated && !resolvedTypeRef.resolvedTypeReferenceDirective) {
|
|
103562
|
+
resolvedTypeRef.isInvalidated = true;
|
|
103563
|
+
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(filePath);
|
|
103564
|
+
}
|
|
103565
|
+
});
|
|
103566
|
+
});
|
|
102563
103567
|
}
|
|
102564
103568
|
function scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, isCreatingWatchedDirectory) {
|
|
102565
103569
|
if (isCreatingWatchedDirectory) {
|
|
@@ -102598,12 +103602,17 @@ var ts;
|
|
|
102598
103602
|
var _a;
|
|
102599
103603
|
var invalidated = false;
|
|
102600
103604
|
if (affectingPathChecksForFile) {
|
|
102601
|
-
|
|
102602
|
-
|
|
102603
|
-
|
|
103605
|
+
for (var _i = 0, watchedPackageJsonScopes_1 = watchedPackageJsonScopes; _i < watchedPackageJsonScopes_1.length; _i++) {
|
|
103606
|
+
var scope = watchedPackageJsonScopes_1[_i];
|
|
103607
|
+
if (scope.isInvalidated)
|
|
103608
|
+
continue;
|
|
103609
|
+
if (ts.some(scope.failedLookupLocations, function (location) { return affectingPathChecksForFile.has(location); }) ||
|
|
103610
|
+
ts.some(scope.affectingLocations, function (location) { return affectingPathChecksForFile.has(location); })) {
|
|
103611
|
+
scope.isInvalidated = true;
|
|
102604
103612
|
invalidated = true;
|
|
103613
|
+
(_a = scope.files) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return (filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(path); });
|
|
102605
103614
|
}
|
|
102606
|
-
}
|
|
103615
|
+
}
|
|
102607
103616
|
affectingPathChecksForFile = undefined;
|
|
102608
103617
|
}
|
|
102609
103618
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks && !affectingPathChecks) {
|
|
@@ -102634,7 +103643,8 @@ var ts;
|
|
|
102634
103643
|
ts.firstDefinedIterator((isInDirectoryChecks === null || isInDirectoryChecks === void 0 ? void 0 : isInDirectoryChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : undefined; });
|
|
102635
103644
|
}
|
|
102636
103645
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
102637
|
-
|
|
103646
|
+
var _a;
|
|
103647
|
+
return !!affectingPathChecks && !!((_a = resolution.affectingLocations) === null || _a === void 0 ? void 0 : _a.some(function (location) { return affectingPathChecks.has(location); }));
|
|
102638
103648
|
}
|
|
102639
103649
|
function closeTypeRootsWatch() {
|
|
102640
103650
|
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
|
|
@@ -102935,9 +103945,9 @@ var ts;
|
|
|
102935
103945
|
var targets = importedFileNames.map(function (f) { return ts.getNormalizedAbsolutePath(f, cwd); });
|
|
102936
103946
|
var shouldFilterIgnoredPaths = !ts.every(targets, ts.containsIgnoredPath);
|
|
102937
103947
|
if (!preferSymlinks) {
|
|
102938
|
-
var
|
|
102939
|
-
if (
|
|
102940
|
-
return
|
|
103948
|
+
var result_17 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
103949
|
+
if (result_17)
|
|
103950
|
+
return result_17;
|
|
102941
103951
|
}
|
|
102942
103952
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
102943
103953
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -102956,10 +103966,10 @@ var ts;
|
|
|
102956
103966
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
102957
103967
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
102958
103968
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
102959
|
-
var
|
|
103969
|
+
var result_18 = cb(option, target === referenceRedirect);
|
|
102960
103970
|
shouldFilterIgnoredPaths = true;
|
|
102961
|
-
if (
|
|
102962
|
-
return
|
|
103971
|
+
if (result_18)
|
|
103972
|
+
return result_18;
|
|
102963
103973
|
}
|
|
102964
103974
|
});
|
|
102965
103975
|
});
|
|
@@ -103018,9 +104028,9 @@ var ts;
|
|
|
103018
104028
|
};
|
|
103019
104029
|
var out_directory_1;
|
|
103020
104030
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
103021
|
-
var
|
|
104031
|
+
var state_12 = _loop_35(directory);
|
|
103022
104032
|
directory = out_directory_1;
|
|
103023
|
-
if (
|
|
104033
|
+
if (state_12 === "break")
|
|
103024
104034
|
break;
|
|
103025
104035
|
}
|
|
103026
104036
|
if (allFileNames.size) {
|
|
@@ -103110,9 +104120,9 @@ var ts;
|
|
|
103110
104120
|
};
|
|
103111
104121
|
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
|
|
103112
104122
|
var patternText_1 = _a[_i];
|
|
103113
|
-
var
|
|
103114
|
-
if (typeof
|
|
103115
|
-
return
|
|
104123
|
+
var state_13 = _loop_36(patternText_1);
|
|
104124
|
+
if (typeof state_13 === "object")
|
|
104125
|
+
return state_13.value;
|
|
103116
104126
|
}
|
|
103117
104127
|
}
|
|
103118
104128
|
function validateEnding(_a) {
|
|
@@ -103565,7 +104575,7 @@ var ts;
|
|
|
103565
104575
|
}
|
|
103566
104576
|
ts.explainFiles = explainFiles;
|
|
103567
104577
|
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
103568
|
-
var _a;
|
|
104578
|
+
var _a, _b;
|
|
103569
104579
|
var result;
|
|
103570
104580
|
if (file.path !== file.resolvedPath) {
|
|
103571
104581
|
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_output_of_project_reference_source_0, toFileName(file.originalFileName, fileNameConvertor)));
|
|
@@ -103576,17 +104586,17 @@ var ts;
|
|
|
103576
104586
|
if (ts.isExternalOrCommonJsModule(file)) {
|
|
103577
104587
|
switch (file.impliedNodeFormat) {
|
|
103578
104588
|
case ts.ModuleKind.ESNext:
|
|
103579
|
-
if (file.packageJsonScope) {
|
|
103580
|
-
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_ECMAScript_module_because_0_has_field_type_with_value_module, toFileName(ts.
|
|
104589
|
+
if ((_a = file.packageJsonScope) === null || _a === void 0 ? void 0 : _a.info) {
|
|
104590
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_ECMAScript_module_because_0_has_field_type_with_value_module, toFileName(ts.getPackageJsconLocationFromScope(file.packageJsonScope), fileNameConvertor)));
|
|
103581
104591
|
}
|
|
103582
104592
|
break;
|
|
103583
104593
|
case ts.ModuleKind.CommonJS:
|
|
103584
|
-
if (file.packageJsonScope) {
|
|
103585
|
-
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, file.packageJsonScope.packageJsonContent.type ?
|
|
104594
|
+
if ((_b = file.packageJsonScope) === null || _b === void 0 ? void 0 : _b.info) {
|
|
104595
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, file.packageJsonScope.info.packageJsonContent.type ?
|
|
103586
104596
|
ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module :
|
|
103587
|
-
ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.
|
|
104597
|
+
ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.getPackageJsconLocationFromScope(file.packageJsonScope), fileNameConvertor)));
|
|
103588
104598
|
}
|
|
103589
|
-
else if (
|
|
104599
|
+
else if (file.packageJsonScope) {
|
|
103590
104600
|
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_CommonJS_module_because_package_json_was_not_found));
|
|
103591
104601
|
}
|
|
103592
104602
|
break;
|
|
@@ -103930,7 +104940,7 @@ var ts;
|
|
|
103930
104940
|
})(ts || (ts = {}));
|
|
103931
104941
|
var ts;
|
|
103932
104942
|
(function (ts) {
|
|
103933
|
-
function
|
|
104943
|
+
function readBuildInfoForProgram(compilerOptions, host) {
|
|
103934
104944
|
var _a, _b, _c;
|
|
103935
104945
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
|
|
103936
104946
|
if (!buildInfoPath)
|
|
@@ -103948,7 +104958,12 @@ var ts;
|
|
|
103948
104958
|
}
|
|
103949
104959
|
if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program)
|
|
103950
104960
|
return undefined;
|
|
103951
|
-
return
|
|
104961
|
+
return { buildInfo: buildInfo, buildInfoPath: buildInfoPath };
|
|
104962
|
+
}
|
|
104963
|
+
ts.readBuildInfoForProgram = readBuildInfoForProgram;
|
|
104964
|
+
function readBuilderProgram(compilerOptions, host) {
|
|
104965
|
+
var result = readBuildInfoForProgram(compilerOptions, host);
|
|
104966
|
+
return result && ts.createBuilderProgramUsingProgramBuildInfo(result.buildInfo.program, result.buildInfoPath, host, compilerOptions.configFilePath);
|
|
103952
104967
|
}
|
|
103953
104968
|
ts.readBuilderProgram = readBuilderProgram;
|
|
103954
104969
|
function createIncrementalCompilerHost(options, system) {
|
|
@@ -104081,7 +105096,7 @@ var ts;
|
|
|
104081
105096
|
}
|
|
104082
105097
|
return host.resolveModuleNames.apply(host, args);
|
|
104083
105098
|
}) :
|
|
104084
|
-
(function (moduleNames, containingFile,
|
|
105099
|
+
(function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, sourceFile, partialResolutionInfo) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, redirectedReference, sourceFile, partialResolutionInfo); });
|
|
104085
105100
|
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
|
|
104086
105101
|
(function () {
|
|
104087
105102
|
var args = [];
|
|
@@ -104090,10 +105105,13 @@ var ts;
|
|
|
104090
105105
|
}
|
|
104091
105106
|
return host.resolveTypeReferenceDirectives.apply(host, args);
|
|
104092
105107
|
}) :
|
|
104093
|
-
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode); });
|
|
105108
|
+
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode, partialResolutionInfo) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode, partialResolutionInfo); });
|
|
104094
105109
|
compilerHost.getModuleResolutionCache = host.resolveModuleNames ?
|
|
104095
105110
|
ts.maybeBind(host, host.getModuleResolutionCache) :
|
|
104096
105111
|
(function () { return resolutionCache.getModuleResolutionCache(); });
|
|
105112
|
+
compilerHost.getTypeReferenceDirectiveResolutionCache = host.resolveTypeReferenceDirectives ?
|
|
105113
|
+
ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache) :
|
|
105114
|
+
(function () { return resolutionCache.getTypeReferenceDirectiveResolutionCache(); });
|
|
104097
105115
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
104098
105116
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
104099
105117
|
synchronizeProgram();
|
|
@@ -104192,7 +105210,6 @@ var ts;
|
|
|
104192
105210
|
writeLog(" options: " + JSON.stringify(compilerOptions));
|
|
104193
105211
|
if (projectReferences)
|
|
104194
105212
|
writeLog(" projectReferences: " + JSON.stringify(projectReferences));
|
|
104195
|
-
var needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !getCurrentProgram();
|
|
104196
105213
|
hasChangedCompilerOptions = false;
|
|
104197
105214
|
hasChangedConfigFileParsingErrors = false;
|
|
104198
105215
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
@@ -104202,9 +105219,6 @@ var ts;
|
|
|
104202
105219
|
builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
104203
105220
|
resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
|
|
104204
105221
|
ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
|
|
104205
|
-
if (needsUpdateInTypeRootWatch) {
|
|
104206
|
-
resolutionCache.updateTypeRootsWatch();
|
|
104207
|
-
}
|
|
104208
105222
|
if (missingFilePathsRequestedForRelease) {
|
|
104209
105223
|
for (var _i = 0, missingFilePathsRequestedForRelease_1 = missingFilePathsRequestedForRelease; _i < missingFilePathsRequestedForRelease_1.length; _i++) {
|
|
104210
105224
|
var missingFilePath = missingFilePathsRequestedForRelease_1[_i];
|
|
@@ -104289,7 +105303,7 @@ var ts;
|
|
|
104289
105303
|
var hostSourceFile = sourceFilesCache.get(path);
|
|
104290
105304
|
return !hostSourceFile || !hostSourceFile.version ? undefined : hostSourceFile.version;
|
|
104291
105305
|
}
|
|
104292
|
-
function onReleaseOldSourceFile(oldSourceFile
|
|
105306
|
+
function onReleaseOldSourceFile(oldSourceFile) {
|
|
104293
105307
|
var hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
|
|
104294
105308
|
if (hostSourceFileInfo !== undefined) {
|
|
104295
105309
|
if (isFileMissingOnHost(hostSourceFileInfo)) {
|
|
@@ -104300,9 +105314,6 @@ var ts;
|
|
|
104300
105314
|
hostSourceFileInfo.fileWatcher.close();
|
|
104301
105315
|
}
|
|
104302
105316
|
sourceFilesCache.delete(oldSourceFile.resolvedPath);
|
|
104303
|
-
if (!hasSourceFileByPath) {
|
|
104304
|
-
resolutionCache.removeResolutionsOfFile(oldSourceFile.path);
|
|
104305
|
-
}
|
|
104306
105317
|
}
|
|
104307
105318
|
}
|
|
104308
105319
|
}
|
|
@@ -104537,7 +105548,6 @@ var ts;
|
|
|
104537
105548
|
var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(projectPath);
|
|
104538
105549
|
if (config)
|
|
104539
105550
|
config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
|
|
104540
|
-
resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath);
|
|
104541
105551
|
}
|
|
104542
105552
|
scheduleProgramUpdate();
|
|
104543
105553
|
});
|
|
@@ -104550,7 +105560,6 @@ var ts;
|
|
|
104550
105560
|
var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(configPath);
|
|
104551
105561
|
if (config)
|
|
104552
105562
|
config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
|
|
104553
|
-
resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
|
|
104554
105563
|
scheduleProgramUpdate();
|
|
104555
105564
|
}, ts.PollingInterval.High, ((_a = commandLine.parsedCommandLine) === null || _a === void 0 ? void 0 : _a.watchOptions) || watchOptions, ts.WatchType.ConfigFileOfReferencedProject));
|
|
104556
105565
|
if ((_b = commandLine.parsedCommandLine) === null || _b === void 0 ? void 0 : _b.wildcardDirectories) {
|
|
@@ -104724,20 +105733,22 @@ var ts;
|
|
|
104724
105733
|
compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
|
|
104725
105734
|
compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
104726
105735
|
compilerHost.getModuleResolutionCache = ts.maybeBind(host, host.getModuleResolutionCache);
|
|
105736
|
+
compilerHost.getTypeReferenceDirectiveResolutionCache = ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache);
|
|
104727
105737
|
var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
|
|
104728
105738
|
var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
|
|
104729
105739
|
if (!compilerHost.resolveModuleNames) {
|
|
104730
|
-
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode)
|
|
104731
|
-
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile) {
|
|
104732
|
-
return ts.loadWithModeAwareCache(
|
|
105740
|
+
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode); };
|
|
105741
|
+
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile, partialResolutionInfo) {
|
|
105742
|
+
return ts.loadWithModeAwareCache(moduleNames, ts.Debug.checkDefined(containingSourceFile), containingFile, redirectedReference, partialResolutionInfo, loader_3);
|
|
104733
105743
|
};
|
|
104734
105744
|
compilerHost.getModuleResolutionCache = function () { return moduleResolutionCache; };
|
|
104735
105745
|
}
|
|
104736
105746
|
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
104737
|
-
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode)
|
|
105747
|
+
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode); };
|
|
104738
105748
|
compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) {
|
|
104739
|
-
return ts.loadWithTypeDirectiveCache(
|
|
105749
|
+
return ts.loadWithTypeDirectiveCache(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode, loader_4);
|
|
104740
105750
|
};
|
|
105751
|
+
compilerHost.getTypeReferenceDirectiveResolutionCache = function () { return typeReferenceDirectiveResolutionCache; };
|
|
104741
105752
|
}
|
|
104742
105753
|
compilerHost.getBuildInfo = function (fileName, options) { return getBuildInfo(state, fileName, options, toResolvedConfigFilePath(state, options.configFilePath), undefined); };
|
|
104743
105754
|
var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
|
|
@@ -105702,7 +106713,7 @@ var ts;
|
|
|
105702
106713
|
if (buildInfoTime && buildInfoTime < inputTime) {
|
|
105703
106714
|
var version_3 = void 0;
|
|
105704
106715
|
var currentVersion = void 0;
|
|
105705
|
-
if (buildInfoProgram) {
|
|
106716
|
+
if (buildInfoProgram === null || buildInfoProgram === void 0 ? void 0 : buildInfoProgram.fileInfos) {
|
|
105706
106717
|
if (!buildInfoVersionMap)
|
|
105707
106718
|
buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
|
|
105708
106719
|
version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
|