@typescript-deploys/pr-build 4.8.0-pr-50085-2 → 4.8.0-pr-50098-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cs/diagnosticMessages.generated.json +1 -0
- package/lib/de/diagnosticMessages.generated.json +1 -0
- package/lib/es/diagnosticMessages.generated.json +1 -0
- package/lib/fr/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +1 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +1 -0
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/pt-br/diagnosticMessages.generated.json +1 -0
- package/lib/ru/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +299 -138
- package/lib/tsserver.js +381 -206
- package/lib/tsserverlibrary.d.ts +16 -10
- package/lib/tsserverlibrary.js +381 -206
- package/lib/typescript.d.ts +16 -10
- package/lib/typescript.js +376 -201
- package/lib/typescriptServices.d.ts +16 -10
- package/lib/typescriptServices.js +376 -201
- package/lib/typingsInstaller.js +335 -168
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -0
- package/package.json +1 -1
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220730";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -5907,10 +5907,8 @@ var ts;
|
|
|
5907
5907
|
TransformFlags[TransformFlags["ContainsPossibleTopLevelAwait"] = 67108864] = "ContainsPossibleTopLevelAwait";
|
|
5908
5908
|
TransformFlags[TransformFlags["ContainsLexicalSuper"] = 134217728] = "ContainsLexicalSuper";
|
|
5909
5909
|
TransformFlags[TransformFlags["ContainsUpdateExpressionForIdentifier"] = 268435456] = "ContainsUpdateExpressionForIdentifier";
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
// It is a good reminder of how much room we have left
|
|
5913
|
-
TransformFlags[TransformFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags";
|
|
5910
|
+
TransformFlags[TransformFlags["ContainsPrivateIdentifierInExpression"] = 536870912] = "ContainsPrivateIdentifierInExpression";
|
|
5911
|
+
TransformFlags[TransformFlags["HasComputedFlags"] = -2147483648] = "HasComputedFlags";
|
|
5914
5912
|
// Assertions
|
|
5915
5913
|
// - Bitmasks that are used to assert facts about the syntax of a node and its subtree.
|
|
5916
5914
|
TransformFlags[TransformFlags["AssertTypeScript"] = 1] = "AssertTypeScript";
|
|
@@ -5929,23 +5927,23 @@ var ts;
|
|
|
5929
5927
|
// Scope Exclusions
|
|
5930
5928
|
// - Bitmasks that exclude flags from propagating out of a specific context
|
|
5931
5929
|
// into the subtree flags of their container.
|
|
5932
|
-
TransformFlags[TransformFlags["OuterExpressionExcludes"] =
|
|
5933
|
-
TransformFlags[TransformFlags["PropertyAccessExcludes"] =
|
|
5934
|
-
TransformFlags[TransformFlags["NodeExcludes"] =
|
|
5935
|
-
TransformFlags[TransformFlags["ArrowFunctionExcludes"] =
|
|
5936
|
-
TransformFlags[TransformFlags["FunctionExcludes"] =
|
|
5937
|
-
TransformFlags[TransformFlags["ConstructorExcludes"] =
|
|
5938
|
-
TransformFlags[TransformFlags["MethodOrAccessorExcludes"] =
|
|
5939
|
-
TransformFlags[TransformFlags["PropertyExcludes"] =
|
|
5940
|
-
TransformFlags[TransformFlags["ClassExcludes"] =
|
|
5941
|
-
TransformFlags[TransformFlags["ModuleExcludes"] =
|
|
5930
|
+
TransformFlags[TransformFlags["OuterExpressionExcludes"] = -2147483648] = "OuterExpressionExcludes";
|
|
5931
|
+
TransformFlags[TransformFlags["PropertyAccessExcludes"] = -2147483648] = "PropertyAccessExcludes";
|
|
5932
|
+
TransformFlags[TransformFlags["NodeExcludes"] = -2147483648] = "NodeExcludes";
|
|
5933
|
+
TransformFlags[TransformFlags["ArrowFunctionExcludes"] = -2072174592] = "ArrowFunctionExcludes";
|
|
5934
|
+
TransformFlags[TransformFlags["FunctionExcludes"] = -1937940480] = "FunctionExcludes";
|
|
5935
|
+
TransformFlags[TransformFlags["ConstructorExcludes"] = -1937948672] = "ConstructorExcludes";
|
|
5936
|
+
TransformFlags[TransformFlags["MethodOrAccessorExcludes"] = -2005057536] = "MethodOrAccessorExcludes";
|
|
5937
|
+
TransformFlags[TransformFlags["PropertyExcludes"] = -2013249536] = "PropertyExcludes";
|
|
5938
|
+
TransformFlags[TransformFlags["ClassExcludes"] = -2147344384] = "ClassExcludes";
|
|
5939
|
+
TransformFlags[TransformFlags["ModuleExcludes"] = -1941676032] = "ModuleExcludes";
|
|
5942
5940
|
TransformFlags[TransformFlags["TypeExcludes"] = -2] = "TypeExcludes";
|
|
5943
|
-
TransformFlags[TransformFlags["ObjectLiteralExcludes"] =
|
|
5944
|
-
TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] =
|
|
5945
|
-
TransformFlags[TransformFlags["VariableDeclarationListExcludes"] =
|
|
5946
|
-
TransformFlags[TransformFlags["ParameterExcludes"] =
|
|
5947
|
-
TransformFlags[TransformFlags["CatchClauseExcludes"] =
|
|
5948
|
-
TransformFlags[TransformFlags["BindingPatternExcludes"] =
|
|
5941
|
+
TransformFlags[TransformFlags["ObjectLiteralExcludes"] = -2147278848] = "ObjectLiteralExcludes";
|
|
5942
|
+
TransformFlags[TransformFlags["ArrayLiteralOrCallOrNewExcludes"] = -2147450880] = "ArrayLiteralOrCallOrNewExcludes";
|
|
5943
|
+
TransformFlags[TransformFlags["VariableDeclarationListExcludes"] = -2146893824] = "VariableDeclarationListExcludes";
|
|
5944
|
+
TransformFlags[TransformFlags["ParameterExcludes"] = -2147483648] = "ParameterExcludes";
|
|
5945
|
+
TransformFlags[TransformFlags["CatchClauseExcludes"] = -2147418112] = "CatchClauseExcludes";
|
|
5946
|
+
TransformFlags[TransformFlags["BindingPatternExcludes"] = -2147450880] = "BindingPatternExcludes";
|
|
5949
5947
|
TransformFlags[TransformFlags["ContainsLexicalThisOrSuper"] = 134234112] = "ContainsLexicalThisOrSuper";
|
|
5950
5948
|
// Propagating flags
|
|
5951
5949
|
// - Bitmasks for flags that should propagate from a child
|
|
@@ -8758,6 +8756,10 @@ var ts;
|
|
|
8758
8756
|
resolution_mode_is_the_only_valid_key_for_type_import_assertions: diag(1455, ts.DiagnosticCategory.Error, "resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455", "`resolution-mode` is the only valid key for type import assertions."),
|
|
8759
8757
|
Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require: diag(1456, ts.DiagnosticCategory.Error, "Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require_1456", "Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`."),
|
|
8760
8758
|
Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk: diag(1457, ts.DiagnosticCategory.Message, "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457", "Matched by default include pattern '**/*'"),
|
|
8759
|
+
File_is_ECMAScript_module_because_0_has_field_type_with_value_module: diag(1458, ts.DiagnosticCategory.Message, "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458", "File is ECMAScript module because '{0}' has field \"type\" with value \"module\""),
|
|
8760
|
+
File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module: diag(1459, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459", "File is CommonJS module because '{0}' has field \"type\" whose value is not \"module\""),
|
|
8761
|
+
File_is_CommonJS_module_because_0_does_not_have_field_type: diag(1460, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_does_not_have_field_type_1460", "File is CommonJS module because '{0}' does not have field \"type\""),
|
|
8762
|
+
File_is_CommonJS_module_because_package_json_was_not_found: diag(1461, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_package_json_was_not_found_1461", "File is CommonJS module because 'package.json' was not found"),
|
|
8761
8763
|
The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
|
|
8762
8764
|
Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
|
|
8763
8765
|
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
@@ -24284,7 +24286,7 @@ var ts;
|
|
|
24284
24286
|
propagateChildFlags(node.expression) |
|
|
24285
24287
|
(ts.isIdentifier(node.name) ?
|
|
24286
24288
|
propagateIdentifierNameFlags(node.name) :
|
|
24287
|
-
propagateChildFlags(node.name));
|
|
24289
|
+
propagateChildFlags(node.name) | 536870912 /* ContainsPrivateIdentifierInExpression */);
|
|
24288
24290
|
if (ts.isSuperKeyword(expression)) {
|
|
24289
24291
|
// super method calls require a lexical 'this'
|
|
24290
24292
|
// super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators
|
|
@@ -24317,7 +24319,7 @@ var ts;
|
|
|
24317
24319
|
propagateChildFlags(node.questionDotToken) |
|
|
24318
24320
|
(ts.isIdentifier(node.name) ?
|
|
24319
24321
|
propagateIdentifierNameFlags(node.name) :
|
|
24320
|
-
propagateChildFlags(node.name));
|
|
24322
|
+
propagateChildFlags(node.name) | 536870912 /* ContainsPrivateIdentifierInExpression */);
|
|
24321
24323
|
return node;
|
|
24322
24324
|
}
|
|
24323
24325
|
// @api
|
|
@@ -24721,6 +24723,9 @@ var ts;
|
|
|
24721
24723
|
else if (ts.isLogicalOrCoalescingAssignmentOperator(operatorKind)) {
|
|
24722
24724
|
node.transformFlags |= 16 /* ContainsES2021 */;
|
|
24723
24725
|
}
|
|
24726
|
+
if (operatorKind === 101 /* InKeyword */ && ts.isPrivateIdentifier(node.left)) {
|
|
24727
|
+
node.transformFlags |= 536870912 /* ContainsPrivateIdentifierInExpression */;
|
|
24728
|
+
}
|
|
24724
24729
|
return node;
|
|
24725
24730
|
}
|
|
24726
24731
|
function propagateAssignmentPatternFlags(node) {
|
|
@@ -27675,29 +27680,29 @@ var ts;
|
|
|
27675
27680
|
case 208 /* CallExpression */:
|
|
27676
27681
|
case 209 /* NewExpression */:
|
|
27677
27682
|
case 204 /* ArrayLiteralExpression */:
|
|
27678
|
-
return
|
|
27683
|
+
return -2147450880 /* ArrayLiteralOrCallOrNewExcludes */;
|
|
27679
27684
|
case 261 /* ModuleDeclaration */:
|
|
27680
|
-
return
|
|
27685
|
+
return -1941676032 /* ModuleExcludes */;
|
|
27681
27686
|
case 164 /* Parameter */:
|
|
27682
|
-
return
|
|
27687
|
+
return -2147483648 /* ParameterExcludes */;
|
|
27683
27688
|
case 214 /* ArrowFunction */:
|
|
27684
|
-
return
|
|
27689
|
+
return -2072174592 /* ArrowFunctionExcludes */;
|
|
27685
27690
|
case 213 /* FunctionExpression */:
|
|
27686
27691
|
case 256 /* FunctionDeclaration */:
|
|
27687
|
-
return
|
|
27692
|
+
return -1937940480 /* FunctionExcludes */;
|
|
27688
27693
|
case 255 /* VariableDeclarationList */:
|
|
27689
|
-
return
|
|
27694
|
+
return -2146893824 /* VariableDeclarationListExcludes */;
|
|
27690
27695
|
case 257 /* ClassDeclaration */:
|
|
27691
27696
|
case 226 /* ClassExpression */:
|
|
27692
|
-
return
|
|
27697
|
+
return -2147344384 /* ClassExcludes */;
|
|
27693
27698
|
case 171 /* Constructor */:
|
|
27694
|
-
return
|
|
27699
|
+
return -1937948672 /* ConstructorExcludes */;
|
|
27695
27700
|
case 167 /* PropertyDeclaration */:
|
|
27696
|
-
return
|
|
27701
|
+
return -2013249536 /* PropertyExcludes */;
|
|
27697
27702
|
case 169 /* MethodDeclaration */:
|
|
27698
27703
|
case 172 /* GetAccessor */:
|
|
27699
27704
|
case 173 /* SetAccessor */:
|
|
27700
|
-
return
|
|
27705
|
+
return -2005057536 /* MethodOrAccessorExcludes */;
|
|
27701
27706
|
case 130 /* AnyKeyword */:
|
|
27702
27707
|
case 147 /* NumberKeyword */:
|
|
27703
27708
|
case 158 /* BigIntKeyword */:
|
|
@@ -27717,23 +27722,23 @@ var ts;
|
|
|
27717
27722
|
case 259 /* TypeAliasDeclaration */:
|
|
27718
27723
|
return -2 /* TypeExcludes */;
|
|
27719
27724
|
case 205 /* ObjectLiteralExpression */:
|
|
27720
|
-
return
|
|
27725
|
+
return -2147278848 /* ObjectLiteralExcludes */;
|
|
27721
27726
|
case 292 /* CatchClause */:
|
|
27722
|
-
return
|
|
27727
|
+
return -2147418112 /* CatchClauseExcludes */;
|
|
27723
27728
|
case 201 /* ObjectBindingPattern */:
|
|
27724
27729
|
case 202 /* ArrayBindingPattern */:
|
|
27725
|
-
return
|
|
27730
|
+
return -2147450880 /* BindingPatternExcludes */;
|
|
27726
27731
|
case 211 /* TypeAssertionExpression */:
|
|
27727
27732
|
case 229 /* AsExpression */:
|
|
27728
27733
|
case 350 /* PartiallyEmittedExpression */:
|
|
27729
27734
|
case 212 /* ParenthesizedExpression */:
|
|
27730
27735
|
case 106 /* SuperKeyword */:
|
|
27731
|
-
return
|
|
27736
|
+
return -2147483648 /* OuterExpressionExcludes */;
|
|
27732
27737
|
case 206 /* PropertyAccessExpression */:
|
|
27733
27738
|
case 207 /* ElementAccessExpression */:
|
|
27734
|
-
return
|
|
27739
|
+
return -2147483648 /* PropertyAccessExcludes */;
|
|
27735
27740
|
default:
|
|
27736
|
-
return
|
|
27741
|
+
return -2147483648 /* NodeExcludes */;
|
|
27737
27742
|
}
|
|
27738
27743
|
}
|
|
27739
27744
|
ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions;
|
|
@@ -43432,7 +43437,7 @@ var ts;
|
|
|
43432
43437
|
ts.createCacheWithRedirects = createCacheWithRedirects;
|
|
43433
43438
|
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
43434
43439
|
var cache;
|
|
43435
|
-
return { getPackageJsonInfo: getPackageJsonInfo, setPackageJsonInfo: setPackageJsonInfo, clear: clear, entries: entries };
|
|
43440
|
+
return { getPackageJsonInfo: getPackageJsonInfo, setPackageJsonInfo: setPackageJsonInfo, clear: clear, entries: entries, getInternalMap: getInternalMap };
|
|
43436
43441
|
function getPackageJsonInfo(packageJsonPath) {
|
|
43437
43442
|
return cache === null || cache === void 0 ? void 0 : cache.get(ts.toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
|
|
43438
43443
|
}
|
|
@@ -43446,6 +43451,9 @@ var ts;
|
|
|
43446
43451
|
var iter = cache === null || cache === void 0 ? void 0 : cache.entries();
|
|
43447
43452
|
return iter ? ts.arrayFrom(iter) : [];
|
|
43448
43453
|
}
|
|
43454
|
+
function getInternalMap() {
|
|
43455
|
+
return cache;
|
|
43456
|
+
}
|
|
43449
43457
|
}
|
|
43450
43458
|
function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
|
|
43451
43459
|
var cache = cacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
@@ -43549,15 +43557,18 @@ var ts;
|
|
|
43549
43557
|
}
|
|
43550
43558
|
ts.zipToModeAwareCache = zipToModeAwareCache;
|
|
43551
43559
|
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
43552
|
-
var
|
|
43560
|
+
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
43553
43561
|
moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options));
|
|
43554
43562
|
var packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
|
43555
|
-
return __assign(__assign(__assign({}, packageJsonInfoCache),
|
|
43563
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; }, clearAllExceptPackageJsonInfoCache: clearAllExceptPackageJsonInfoCache });
|
|
43556
43564
|
function clear() {
|
|
43557
|
-
|
|
43558
|
-
moduleNameToDirectoryMap.clear();
|
|
43565
|
+
clearAllExceptPackageJsonInfoCache();
|
|
43559
43566
|
packageJsonInfoCache.clear();
|
|
43560
43567
|
}
|
|
43568
|
+
function clearAllExceptPackageJsonInfoCache() {
|
|
43569
|
+
perDirectoryResolutionCache.clear();
|
|
43570
|
+
moduleNameToDirectoryMap.clear();
|
|
43571
|
+
}
|
|
43561
43572
|
function update(options) {
|
|
43562
43573
|
updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap);
|
|
43563
43574
|
}
|
|
@@ -43635,11 +43646,14 @@ var ts;
|
|
|
43635
43646
|
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, directoryToModuleNameMap) {
|
|
43636
43647
|
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
43637
43648
|
packageJsonInfoCache || (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
|
|
43638
|
-
return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { clear: clear });
|
|
43649
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { clear: clear, clearAllExceptPackageJsonInfoCache: clearAllExceptPackageJsonInfoCache });
|
|
43639
43650
|
function clear() {
|
|
43640
|
-
|
|
43651
|
+
clearAllExceptPackageJsonInfoCache();
|
|
43641
43652
|
packageJsonInfoCache.clear();
|
|
43642
43653
|
}
|
|
43654
|
+
function clearAllExceptPackageJsonInfoCache() {
|
|
43655
|
+
preDirectoryResolutionCache.clear();
|
|
43656
|
+
}
|
|
43643
43657
|
}
|
|
43644
43658
|
ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
|
|
43645
43659
|
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
@@ -53080,6 +53094,12 @@ var ts;
|
|
|
53080
53094
|
return context.truncating = context.approximateLength > ((context.flags & 1 /* NoTruncation */) ? ts.noTruncationMaximumTruncationLength : ts.defaultMaximumTruncationLength);
|
|
53081
53095
|
}
|
|
53082
53096
|
function typeToTypeNodeHelper(type, context) {
|
|
53097
|
+
var savedFlags = context.flags;
|
|
53098
|
+
var typeNode = typeToTypeNodeWorker(type, context);
|
|
53099
|
+
context.flags = savedFlags;
|
|
53100
|
+
return typeNode;
|
|
53101
|
+
}
|
|
53102
|
+
function typeToTypeNodeWorker(type, context) {
|
|
53083
53103
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
53084
53104
|
cancellationToken.throwIfCancellationRequested();
|
|
53085
53105
|
}
|
|
@@ -80973,7 +80993,7 @@ var ts;
|
|
|
80973
80993
|
error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
|
|
80974
80994
|
}
|
|
80975
80995
|
}
|
|
80976
|
-
if (node.questionToken && ts.isBindingPattern(node.name) && func.body) {
|
|
80996
|
+
if ((node.questionToken || isJSDocOptionalParameter(node)) && ts.isBindingPattern(node.name) && func.body) {
|
|
80977
80997
|
error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
|
|
80978
80998
|
}
|
|
80979
80999
|
if (node.name && ts.isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
|
|
@@ -96778,39 +96798,72 @@ var ts;
|
|
|
96778
96798
|
function visitClassDeclaration(node) {
|
|
96779
96799
|
if (!(ts.classOrConstructorParameterIsDecorated(node) || ts.childIsDecorated(node)))
|
|
96780
96800
|
return ts.visitEachChild(node, visitor, context);
|
|
96781
|
-
var
|
|
96782
|
-
|
|
96783
|
-
|
|
96784
|
-
var statements = [classStatement];
|
|
96785
|
-
// Write any decorators of the node.
|
|
96786
|
-
addClassElementDecorationStatements(statements, node, /*isStatic*/ false);
|
|
96787
|
-
addClassElementDecorationStatements(statements, node, /*isStatic*/ true);
|
|
96788
|
-
addConstructorDecorationStatement(statements, node);
|
|
96801
|
+
var statements = ts.hasDecorators(node) ?
|
|
96802
|
+
transformClassDeclarationWithClassDecorators(node, node.name) :
|
|
96803
|
+
transformClassDeclarationWithoutClassDecorators(node, node.name);
|
|
96789
96804
|
if (statements.length > 1) {
|
|
96790
96805
|
// Add a DeclarationMarker as a marker for the end of the declaration
|
|
96791
96806
|
statements.push(factory.createEndOfDeclarationMarker(node));
|
|
96792
|
-
ts.setEmitFlags(
|
|
96807
|
+
ts.setEmitFlags(statements[0], ts.getEmitFlags(statements[0]) | 4194304 /* HasEndOfDeclarationMarker */);
|
|
96793
96808
|
}
|
|
96794
96809
|
return ts.singleOrMany(statements);
|
|
96795
96810
|
}
|
|
96811
|
+
function decoratorContainsPrivateIdentifierInExpression(decorator) {
|
|
96812
|
+
return !!(decorator.transformFlags & 536870912 /* ContainsPrivateIdentifierInExpression */);
|
|
96813
|
+
}
|
|
96814
|
+
function parameterDecoratorsContainPrivateIdentifierInExpression(parameterDecorators) {
|
|
96815
|
+
return ts.some(parameterDecorators, decoratorContainsPrivateIdentifierInExpression);
|
|
96816
|
+
}
|
|
96817
|
+
function hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node) {
|
|
96818
|
+
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
96819
|
+
var member = _a[_i];
|
|
96820
|
+
if (!ts.canHaveDecorators(member))
|
|
96821
|
+
continue;
|
|
96822
|
+
var allDecorators = ts.getAllDecoratorsOfClassElement(member, node);
|
|
96823
|
+
if (ts.some(allDecorators === null || allDecorators === void 0 ? void 0 : allDecorators.decorators, decoratorContainsPrivateIdentifierInExpression))
|
|
96824
|
+
return true;
|
|
96825
|
+
if (ts.some(allDecorators === null || allDecorators === void 0 ? void 0 : allDecorators.parameters, parameterDecoratorsContainPrivateIdentifierInExpression))
|
|
96826
|
+
return true;
|
|
96827
|
+
}
|
|
96828
|
+
return false;
|
|
96829
|
+
}
|
|
96830
|
+
function transformDecoratorsOfClassElements(node, members) {
|
|
96831
|
+
var decorationStatements = [];
|
|
96832
|
+
addClassElementDecorationStatements(decorationStatements, node, /*isStatic*/ false);
|
|
96833
|
+
addClassElementDecorationStatements(decorationStatements, node, /*isStatic*/ true);
|
|
96834
|
+
if (hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node)) {
|
|
96835
|
+
members = ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray([], members, true), [
|
|
96836
|
+
factory.createClassStaticBlockDeclaration(factory.createBlock(decorationStatements, /*multiLine*/ true))
|
|
96837
|
+
], false)), members);
|
|
96838
|
+
decorationStatements = undefined;
|
|
96839
|
+
}
|
|
96840
|
+
return { decorationStatements: decorationStatements, members: members };
|
|
96841
|
+
}
|
|
96796
96842
|
/**
|
|
96797
96843
|
* Transforms a non-decorated class declaration.
|
|
96798
96844
|
*
|
|
96799
96845
|
* @param node A ClassDeclaration node.
|
|
96800
96846
|
* @param name The name of the class.
|
|
96801
96847
|
*/
|
|
96802
|
-
function
|
|
96848
|
+
function transformClassDeclarationWithoutClassDecorators(node, name) {
|
|
96803
96849
|
// ${modifiers} class ${name} ${heritageClauses} {
|
|
96804
96850
|
// ${members}
|
|
96805
96851
|
// }
|
|
96806
|
-
|
|
96807
|
-
|
|
96852
|
+
var _a;
|
|
96853
|
+
var modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier);
|
|
96854
|
+
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
|
|
96855
|
+
var members = ts.visitNodes(node.members, visitor, ts.isClassElement);
|
|
96856
|
+
var decorationStatements = [];
|
|
96857
|
+
(_a = transformDecoratorsOfClassElements(node, members), members = _a.members, decorationStatements = _a.decorationStatements);
|
|
96858
|
+
var updated = factory.updateClassDeclaration(node, modifiers, name,
|
|
96859
|
+
/*typeParameters*/ undefined, heritageClauses, members);
|
|
96860
|
+
return ts.addRange([updated], decorationStatements);
|
|
96808
96861
|
}
|
|
96809
96862
|
/**
|
|
96810
96863
|
* Transforms a decorated class declaration and appends the resulting statements. If
|
|
96811
96864
|
* the class requires an alias to avoid issues with double-binding, the alias is returned.
|
|
96812
96865
|
*/
|
|
96813
|
-
function
|
|
96866
|
+
function transformClassDeclarationWithClassDecorators(node, name) {
|
|
96814
96867
|
// When we emit an ES6 class that has a class decorator, we must tailor the
|
|
96815
96868
|
// emit to certain specific cases.
|
|
96816
96869
|
//
|
|
@@ -96896,6 +96949,7 @@ var ts;
|
|
|
96896
96949
|
// | var C_1;
|
|
96897
96950
|
// ---------------------------------------------------------------------
|
|
96898
96951
|
//
|
|
96952
|
+
var _a;
|
|
96899
96953
|
var location = ts.moveRangePastModifiers(node);
|
|
96900
96954
|
var classAlias = getClassAliasIfNeeded(node);
|
|
96901
96955
|
// When we transform to ES5/3 this will be moved inside an IIFE and should reference the name
|
|
@@ -96908,7 +96962,11 @@ var ts;
|
|
|
96908
96962
|
// }
|
|
96909
96963
|
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
|
|
96910
96964
|
var members = ts.visitNodes(node.members, visitor, ts.isClassElement);
|
|
96911
|
-
var
|
|
96965
|
+
var decorationStatements = [];
|
|
96966
|
+
(_a = transformDecoratorsOfClassElements(node, members), members = _a.members, decorationStatements = _a.decorationStatements);
|
|
96967
|
+
var classExpression = factory.createClassExpression(
|
|
96968
|
+
/*modifiers*/ undefined, name,
|
|
96969
|
+
/*typeParameters*/ undefined, heritageClauses, members);
|
|
96912
96970
|
ts.setOriginalNode(classExpression, node);
|
|
96913
96971
|
ts.setTextRange(classExpression, location);
|
|
96914
96972
|
// let ${name} = ${classExpression} where name is either declaredName if the class doesn't contain self-reference
|
|
@@ -96922,7 +96980,10 @@ var ts;
|
|
|
96922
96980
|
ts.setOriginalNode(statement, node);
|
|
96923
96981
|
ts.setTextRange(statement, location);
|
|
96924
96982
|
ts.setCommentRange(statement, node);
|
|
96925
|
-
|
|
96983
|
+
var statements = [statement];
|
|
96984
|
+
ts.addRange(statements, decorationStatements);
|
|
96985
|
+
addConstructorDecorationStatement(statements, node);
|
|
96986
|
+
return statements;
|
|
96926
96987
|
}
|
|
96927
96988
|
function visitClassExpression(node) {
|
|
96928
96989
|
// Legacy decorators were not supported on class expressions
|
|
@@ -117839,6 +117900,12 @@ var ts;
|
|
|
117839
117900
|
* @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format
|
|
117840
117901
|
*/
|
|
117841
117902
|
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
117903
|
+
var result = getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options);
|
|
117904
|
+
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
117905
|
+
}
|
|
117906
|
+
ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
|
|
117907
|
+
/*@internal*/
|
|
117908
|
+
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
117842
117909
|
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
117843
117910
|
case ts.ModuleResolutionKind.Node16:
|
|
117844
117911
|
case ts.ModuleResolutionKind.NodeNext:
|
|
@@ -117850,11 +117917,16 @@ var ts;
|
|
|
117850
117917
|
return undefined;
|
|
117851
117918
|
}
|
|
117852
117919
|
function lookupFromPackageJson() {
|
|
117853
|
-
var
|
|
117854
|
-
|
|
117920
|
+
var state = ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
|
|
117921
|
+
var packageJsonLocations = [];
|
|
117922
|
+
state.failedLookupLocations = packageJsonLocations;
|
|
117923
|
+
state.affectingLocations = packageJsonLocations;
|
|
117924
|
+
var packageJsonScope = ts.getPackageScopeForPath(fileName, state);
|
|
117925
|
+
var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
117926
|
+
return { impliedNodeFormat: impliedNodeFormat, packageJsonLocations: packageJsonLocations, packageJsonScope: packageJsonScope };
|
|
117855
117927
|
}
|
|
117856
117928
|
}
|
|
117857
|
-
ts.
|
|
117929
|
+
ts.getImpliedNodeFormatForFileWorker = getImpliedNodeFormatForFileWorker;
|
|
117858
117930
|
/** @internal */
|
|
117859
117931
|
ts.plainJSErrors = new ts.Set([
|
|
117860
117932
|
// binder errors
|
|
@@ -118179,7 +118251,7 @@ var ts;
|
|
|
118179
118251
|
for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) {
|
|
118180
118252
|
var oldSourceFile = oldSourceFiles_1[_i];
|
|
118181
118253
|
var newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
|
118182
|
-
if (shouldCreateNewSourceFile || !newFile ||
|
|
118254
|
+
if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat ||
|
|
118183
118255
|
// old file wasn't redirect but new file is
|
|
118184
118256
|
(oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path)) {
|
|
118185
118257
|
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
|
|
@@ -118572,7 +118644,7 @@ var ts;
|
|
|
118572
118644
|
});
|
|
118573
118645
|
}
|
|
118574
118646
|
function tryReuseStructureFromOldProgram() {
|
|
118575
|
-
var _a;
|
|
118647
|
+
var _a, _b;
|
|
118576
118648
|
if (!oldProgram) {
|
|
118577
118649
|
return 0 /* Not */;
|
|
118578
118650
|
}
|
|
@@ -118613,12 +118685,15 @@ var ts;
|
|
|
118613
118685
|
var seenPackageNames = new ts.Map();
|
|
118614
118686
|
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
|
|
118615
118687
|
var oldSourceFile = oldSourceFiles_2[_i];
|
|
118688
|
+
var sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options);
|
|
118616
118689
|
var newSourceFile = host.getSourceFileByPath
|
|
118617
|
-
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath,
|
|
118618
|
-
: host.getSourceFile(oldSourceFile.fileName,
|
|
118690
|
+
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, sourceFileOptions, /*onError*/ undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat)
|
|
118691
|
+
: host.getSourceFile(oldSourceFile.fileName, sourceFileOptions, /*onError*/ undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat); // TODO: GH#18217
|
|
118619
118692
|
if (!newSourceFile) {
|
|
118620
118693
|
return 0 /* Not */;
|
|
118621
118694
|
}
|
|
118695
|
+
newSourceFile.packageJsonLocations = ((_a = sourceFileOptions.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
118696
|
+
newSourceFile.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
118622
118697
|
ts.Debug.assert(!newSourceFile.redirectInfo, "Host should not return a redirect source file from `getSourceFile`");
|
|
118623
118698
|
var fileChanged = void 0;
|
|
118624
118699
|
if (oldSourceFile.redirectInfo) {
|
|
@@ -118658,38 +118733,43 @@ var ts;
|
|
|
118658
118733
|
seenPackageNames.set(packageName, newKind);
|
|
118659
118734
|
}
|
|
118660
118735
|
if (fileChanged) {
|
|
118736
|
+
if (oldSourceFile.impliedNodeFormat !== newSourceFile.impliedNodeFormat) {
|
|
118737
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118738
|
+
}
|
|
118661
118739
|
// The `newSourceFile` object was created for the new program.
|
|
118662
|
-
if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
118740
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
118663
118741
|
// 'lib' references has changed. Matches behavior in changesAffectModuleResolution
|
|
118664
118742
|
structureIsReused = 1 /* SafeModules */;
|
|
118665
118743
|
}
|
|
118666
|
-
if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
|
118744
|
+
else if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
|
118667
118745
|
// value of no-default-lib has changed
|
|
118668
118746
|
// this will affect if default library is injected into the list of files
|
|
118669
118747
|
structureIsReused = 1 /* SafeModules */;
|
|
118670
118748
|
}
|
|
118671
118749
|
// check tripleslash references
|
|
118672
|
-
if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
|
118750
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
|
118673
118751
|
// tripleslash references has changed
|
|
118674
118752
|
structureIsReused = 1 /* SafeModules */;
|
|
118675
118753
|
}
|
|
118676
|
-
|
|
118677
|
-
|
|
118678
|
-
|
|
118679
|
-
|
|
118680
|
-
|
|
118681
|
-
|
|
118682
|
-
|
|
118683
|
-
|
|
118684
|
-
|
|
118685
|
-
|
|
118686
|
-
|
|
118687
|
-
|
|
118688
|
-
|
|
118689
|
-
|
|
118690
|
-
|
|
118691
|
-
|
|
118692
|
-
|
|
118754
|
+
else {
|
|
118755
|
+
// check imports and module augmentations
|
|
118756
|
+
collectExternalModuleReferences(newSourceFile);
|
|
118757
|
+
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
|
|
118758
|
+
// imports has changed
|
|
118759
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118760
|
+
}
|
|
118761
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
|
|
118762
|
+
// moduleAugmentations has changed
|
|
118763
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118764
|
+
}
|
|
118765
|
+
else if ((oldSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */) !== (newSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */)) {
|
|
118766
|
+
// dynamicImport has changed
|
|
118767
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118768
|
+
}
|
|
118769
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
118770
|
+
// 'types' references has changed
|
|
118771
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118772
|
+
}
|
|
118693
118773
|
}
|
|
118694
118774
|
// tentatively approve the file
|
|
118695
118775
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
@@ -118707,18 +118787,18 @@ var ts;
|
|
|
118707
118787
|
return structureIsReused;
|
|
118708
118788
|
}
|
|
118709
118789
|
var modifiedFiles = modifiedSourceFiles.map(function (f) { return f.oldFile; });
|
|
118710
|
-
for (var
|
|
118711
|
-
var oldFile = oldSourceFiles_3[
|
|
118790
|
+
for (var _c = 0, oldSourceFiles_3 = oldSourceFiles; _c < oldSourceFiles_3.length; _c++) {
|
|
118791
|
+
var oldFile = oldSourceFiles_3[_c];
|
|
118712
118792
|
if (!ts.contains(modifiedFiles, oldFile)) {
|
|
118713
|
-
for (var
|
|
118714
|
-
var moduleName = _d
|
|
118793
|
+
for (var _d = 0, _e = oldFile.ambientModuleNames; _d < _e.length; _d++) {
|
|
118794
|
+
var moduleName = _e[_d];
|
|
118715
118795
|
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
|
|
118716
118796
|
}
|
|
118717
118797
|
}
|
|
118718
118798
|
}
|
|
118719
118799
|
// try to verify results of module resolution
|
|
118720
|
-
for (var
|
|
118721
|
-
var
|
|
118800
|
+
for (var _f = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _f < modifiedSourceFiles_1.length; _f++) {
|
|
118801
|
+
var _g = modifiedSourceFiles_1[_f], oldSourceFile = _g.oldFile, newSourceFile = _g.newFile;
|
|
118722
118802
|
var moduleNames = getModuleNames(newSourceFile);
|
|
118723
118803
|
var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
118724
118804
|
// ensure that module resolution results are still correct
|
|
@@ -118745,14 +118825,14 @@ var ts;
|
|
|
118745
118825
|
if (structureIsReused !== 2 /* Completely */) {
|
|
118746
118826
|
return structureIsReused;
|
|
118747
118827
|
}
|
|
118748
|
-
if (ts.changesAffectingProgramStructure(oldOptions, options) || ((
|
|
118828
|
+
if (ts.changesAffectingProgramStructure(oldOptions, options) || ((_b = host.hasChangedAutomaticTypeDirectiveNames) === null || _b === void 0 ? void 0 : _b.call(host))) {
|
|
118749
118829
|
return 1 /* SafeModules */;
|
|
118750
118830
|
}
|
|
118751
118831
|
missingFilePaths = oldProgram.getMissingFilePaths();
|
|
118752
118832
|
// update fileName -> file mapping
|
|
118753
118833
|
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
118754
|
-
for (var
|
|
118755
|
-
var newSourceFile = newSourceFiles_1[
|
|
118834
|
+
for (var _h = 0, newSourceFiles_1 = newSourceFiles; _h < newSourceFiles_1.length; _h++) {
|
|
118835
|
+
var newSourceFile = newSourceFiles_1[_h];
|
|
118756
118836
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
118757
118837
|
}
|
|
118758
118838
|
var oldFilesByNameMap = oldProgram.getFilesByNameMap();
|
|
@@ -119542,6 +119622,7 @@ var ts;
|
|
|
119542
119622
|
redirect.resolvedPath = resolvedPath;
|
|
119543
119623
|
redirect.originalFileName = originalFileName;
|
|
119544
119624
|
redirect.redirectInfo = { redirectTarget: redirectTarget, unredirected: unredirected };
|
|
119625
|
+
// TODO:" shkamat"
|
|
119545
119626
|
sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
|
|
119546
119627
|
Object.defineProperties(redirect, {
|
|
119547
119628
|
id: {
|
|
@@ -119570,14 +119651,14 @@ var ts;
|
|
|
119570
119651
|
// It's a _little odd_ that we can't set `impliedNodeFormat` until the program step - but it's the first and only time we have a resolution cache
|
|
119571
119652
|
// and a freshly made source file node on hand at the same time, and we need both to set the field. Persisting the resolution cache all the way
|
|
119572
119653
|
// to the check and emit steps would be bad - so we much prefer detecting and storing the format information on the source file node upfront.
|
|
119573
|
-
var
|
|
119574
|
-
|
|
119575
|
-
|
|
119576
|
-
|
|
119577
|
-
setExternalModuleIndicator:
|
|
119578
|
-
};
|
|
119654
|
+
var result = getImpliedNodeFormatForFileWorker(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
119655
|
+
var languageVersion = ts.getEmitScriptTarget(options);
|
|
119656
|
+
var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options);
|
|
119657
|
+
return typeof result === "object" ? __assign(__assign({}, result), { languageVersion: languageVersion, setExternalModuleIndicator: setExternalModuleIndicator }) :
|
|
119658
|
+
{ languageVersion: languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator };
|
|
119579
119659
|
}
|
|
119580
119660
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
119661
|
+
var _a, _b;
|
|
119581
119662
|
var path = toPath(fileName);
|
|
119582
119663
|
if (useSourceOfProjectReferenceRedirect) {
|
|
119583
119664
|
var source = getSourceOfProjectReferenceRedirect(path);
|
|
@@ -119664,7 +119745,8 @@ var ts;
|
|
|
119664
119745
|
}
|
|
119665
119746
|
}
|
|
119666
119747
|
// We haven't looked for this file, do so now and cache result
|
|
119667
|
-
var
|
|
119748
|
+
var sourceFileOptions = getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options);
|
|
119749
|
+
var file = host.getSourceFile(fileName, sourceFileOptions, function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, ts.Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]); }, shouldCreateNewSourceFile || (((_a = oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getSourceFileByPath(toPath(fileName))) === null || _a === void 0 ? void 0 : _a.impliedNodeFormat) !== sourceFileOptions.impliedNodeFormat));
|
|
119668
119750
|
if (packageId) {
|
|
119669
119751
|
var packageIdKey = ts.packageIdToString(packageId);
|
|
119670
119752
|
var fileFromPackageId = packageIdToSourceFile.get(packageIdKey);
|
|
@@ -119692,6 +119774,9 @@ var ts;
|
|
|
119692
119774
|
file.path = path;
|
|
119693
119775
|
file.resolvedPath = toPath(fileName);
|
|
119694
119776
|
file.originalFileName = originalFileName;
|
|
119777
|
+
file.packageJsonLocations = ((_b = sourceFileOptions.packageJsonLocations) === null || _b === void 0 ? void 0 : _b.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
119778
|
+
file.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
119779
|
+
// TODO: handle watch when same file has changes in failed and affecting locations
|
|
119695
119780
|
addFileIncludeReason(file, reason);
|
|
119696
119781
|
if (host.useCaseSensitiveFileNames()) {
|
|
119697
119782
|
var pathLowerCase = ts.toFileNameLowerCase(path);
|
|
@@ -120322,7 +120407,7 @@ var ts;
|
|
|
120322
120407
|
fileIncludeReasons = undefined;
|
|
120323
120408
|
var location = locationReason && getReferencedFileLocation(getSourceFileByPath, locationReason);
|
|
120324
120409
|
var fileIncludeReasonDetails = fileIncludeReasons && ts.chainDiagnosticMessages(fileIncludeReasons, ts.Diagnostics.The_file_is_in_the_program_because_Colon);
|
|
120325
|
-
var redirectInfo = file && ts.
|
|
120410
|
+
var redirectInfo = file && ts.explainIfFileIsRedirectAndImpliedFormat(file);
|
|
120326
120411
|
var chain = ts.chainDiagnosticMessages.apply(void 0, __spreadArray([redirectInfo ? fileIncludeReasonDetails ? __spreadArray([fileIncludeReasonDetails], redirectInfo, true) : redirectInfo : fileIncludeReasonDetails, diagnostic], args || ts.emptyArray, false));
|
|
120327
120412
|
return location && isReferenceFileLocation(location) ?
|
|
120328
120413
|
ts.createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) :
|
|
@@ -122627,7 +122712,7 @@ var ts;
|
|
|
122627
122712
|
* "c:/", "c:/users", "c:/users/username", "c:/users/username/folderAtRoot", "c:/folderAtRoot"
|
|
122628
122713
|
* @param dirPath
|
|
122629
122714
|
*/
|
|
122630
|
-
function
|
|
122715
|
+
function canWatchDirectoryOrFile(dirPath) {
|
|
122631
122716
|
var rootLength = ts.getRootLength(dirPath);
|
|
122632
122717
|
if (dirPath.length === rootLength) {
|
|
122633
122718
|
// Ignore "/", "c:/"
|
|
@@ -122664,7 +122749,7 @@ var ts;
|
|
|
122664
122749
|
}
|
|
122665
122750
|
return true;
|
|
122666
122751
|
}
|
|
122667
|
-
ts.
|
|
122752
|
+
ts.canWatchDirectoryOrFile = canWatchDirectoryOrFile;
|
|
122668
122753
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
122669
122754
|
var filesWithChangedSetOfUnresolvedImports;
|
|
122670
122755
|
var filesWithInvalidatedResolutions;
|
|
@@ -122673,7 +122758,9 @@ var ts;
|
|
|
122673
122758
|
var resolutionsWithFailedLookups = [];
|
|
122674
122759
|
var resolutionsWithOnlyAffectingLocations = [];
|
|
122675
122760
|
var resolvedFileToResolution = ts.createMultiMap();
|
|
122761
|
+
var impliedFormatPackageJsons = new ts.Map();
|
|
122676
122762
|
var hasChangedAutomaticTypeDirectiveNames = false;
|
|
122763
|
+
var affectingPathChecksForFile;
|
|
122677
122764
|
var affectingPathChecks;
|
|
122678
122765
|
var failedLookupChecks;
|
|
122679
122766
|
var startsWithPathChecks;
|
|
@@ -122713,7 +122800,7 @@ var ts;
|
|
|
122713
122800
|
finishRecordingFilesWithChangedResolutions: finishRecordingFilesWithChangedResolutions,
|
|
122714
122801
|
// perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update
|
|
122715
122802
|
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
|
|
122716
|
-
startCachingPerDirectoryResolution:
|
|
122803
|
+
startCachingPerDirectoryResolution: startCachingPerDirectoryResolution,
|
|
122717
122804
|
finishCachingPerDirectoryResolution: finishCachingPerDirectoryResolution,
|
|
122718
122805
|
resolveModuleNames: resolveModuleNames,
|
|
122719
122806
|
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
@@ -122751,15 +122838,19 @@ var ts;
|
|
|
122751
122838
|
resolvedModuleNames.clear();
|
|
122752
122839
|
resolvedTypeReferenceDirectives.clear();
|
|
122753
122840
|
resolvedFileToResolution.clear();
|
|
122841
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
122754
122842
|
resolutionsWithFailedLookups.length = 0;
|
|
122755
122843
|
resolutionsWithOnlyAffectingLocations.length = 0;
|
|
122756
122844
|
failedLookupChecks = undefined;
|
|
122757
122845
|
startsWithPathChecks = undefined;
|
|
122758
122846
|
isInDirectoryChecks = undefined;
|
|
122759
122847
|
affectingPathChecks = undefined;
|
|
122848
|
+
affectingPathChecksForFile = undefined;
|
|
122760
122849
|
// perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update
|
|
122761
122850
|
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
|
|
122762
|
-
|
|
122851
|
+
moduleResolutionCache.clear();
|
|
122852
|
+
typeReferenceDirectiveResolutionCache.clear();
|
|
122853
|
+
impliedFormatPackageJsons.clear();
|
|
122763
122854
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
122764
122855
|
}
|
|
122765
122856
|
function startRecordingFilesWithChangedResolutions() {
|
|
@@ -122791,15 +122882,40 @@ var ts;
|
|
|
122791
122882
|
return function (path) { return (!!collected && collected.has(path)) ||
|
|
122792
122883
|
isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
|
|
122793
122884
|
}
|
|
122794
|
-
function
|
|
122795
|
-
moduleResolutionCache.
|
|
122796
|
-
typeReferenceDirectiveResolutionCache.
|
|
122797
|
-
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
122798
|
-
nonRelativeExternalModuleResolutions.clear();
|
|
122885
|
+
function startCachingPerDirectoryResolution() {
|
|
122886
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
122887
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
122799
122888
|
}
|
|
122800
|
-
function finishCachingPerDirectoryResolution() {
|
|
122889
|
+
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
122801
122890
|
filesWithInvalidatedNonRelativeUnresolvedImports = undefined;
|
|
122802
|
-
|
|
122891
|
+
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
122892
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
122893
|
+
// Update file watches
|
|
122894
|
+
if (newProgram !== oldProgram) {
|
|
122895
|
+
newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFiles().forEach(function (newFile) {
|
|
122896
|
+
var _a, _b, _c;
|
|
122897
|
+
var expected = ts.isExternalOrCommonJsModule(newFile) ? (_b = (_a = newFile.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 : 0;
|
|
122898
|
+
var existing = (_c = impliedFormatPackageJsons.get(newFile.path)) !== null && _c !== void 0 ? _c : ts.emptyArray;
|
|
122899
|
+
for (var i = existing.length; i < expected; i++) {
|
|
122900
|
+
createFileWatcherOfAffectingLocation(newFile.packageJsonLocations[i], /*forResolution*/ false);
|
|
122901
|
+
}
|
|
122902
|
+
if (existing.length > expected) {
|
|
122903
|
+
for (var i = expected; i < existing.length; i++) {
|
|
122904
|
+
fileWatchesOfAffectingLocations.get(existing[i]).files--;
|
|
122905
|
+
}
|
|
122906
|
+
}
|
|
122907
|
+
if (expected)
|
|
122908
|
+
impliedFormatPackageJsons.set(newFile.path, newFile.packageJsonLocations);
|
|
122909
|
+
else
|
|
122910
|
+
impliedFormatPackageJsons.delete(newFile.path);
|
|
122911
|
+
});
|
|
122912
|
+
impliedFormatPackageJsons.forEach(function (existing, path) {
|
|
122913
|
+
if (!(newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFileByPath(path))) {
|
|
122914
|
+
existing.forEach(function (location) { return fileWatchesOfAffectingLocations.get(location).files--; });
|
|
122915
|
+
impliedFormatPackageJsons.delete(path);
|
|
122916
|
+
}
|
|
122917
|
+
});
|
|
122918
|
+
}
|
|
122803
122919
|
directoryWatchesOfFailedLookups.forEach(function (watcher, path) {
|
|
122804
122920
|
if (watcher.refCount === 0) {
|
|
122805
122921
|
directoryWatchesOfFailedLookups.delete(path);
|
|
@@ -122807,7 +122923,7 @@ var ts;
|
|
|
122807
122923
|
}
|
|
122808
122924
|
});
|
|
122809
122925
|
fileWatchesOfAffectingLocations.forEach(function (watcher, path) {
|
|
122810
|
-
if (watcher.
|
|
122926
|
+
if (watcher.files === 0 && watcher.resolutions === 0) {
|
|
122811
122927
|
fileWatchesOfAffectingLocations.delete(path);
|
|
122812
122928
|
watcher.watcher.close();
|
|
122813
122929
|
// Ensure when watching symlinked package.json, we can close the actual file watcher only once
|
|
@@ -123038,7 +123154,7 @@ var ts;
|
|
|
123038
123154
|
}
|
|
123039
123155
|
// If the directory is node_modules use it to watch, always watch it recursively
|
|
123040
123156
|
if (ts.isNodeModulesDirectory(dirPath)) {
|
|
123041
|
-
return
|
|
123157
|
+
return canWatchDirectoryOrFile(ts.getDirectoryPath(dirPath)) ? { dir: dir, dirPath: dirPath } : undefined;
|
|
123042
123158
|
}
|
|
123043
123159
|
var nonRecursive = true;
|
|
123044
123160
|
// Use some ancestor of the root directory
|
|
@@ -123056,7 +123172,7 @@ var ts;
|
|
|
123056
123172
|
dir = ts.getDirectoryPath(dir);
|
|
123057
123173
|
}
|
|
123058
123174
|
}
|
|
123059
|
-
return
|
|
123175
|
+
return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive: nonRecursive } : undefined;
|
|
123060
123176
|
}
|
|
123061
123177
|
function isPathWithDefaultFailedLookupExtension(path) {
|
|
123062
123178
|
return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
@@ -123127,46 +123243,58 @@ var ts;
|
|
|
123127
123243
|
// Watch package json
|
|
123128
123244
|
for (var _i = 0, affectingLocations_1 = affectingLocations; _i < affectingLocations_1.length; _i++) {
|
|
123129
123245
|
var affectingLocation = affectingLocations_1[_i];
|
|
123130
|
-
createFileWatcherOfAffectingLocation(affectingLocation);
|
|
123246
|
+
createFileWatcherOfAffectingLocation(affectingLocation, /*forResolution*/ true);
|
|
123131
123247
|
}
|
|
123132
123248
|
}
|
|
123133
|
-
function createFileWatcherOfAffectingLocation(affectingLocation) {
|
|
123134
|
-
var
|
|
123135
|
-
var fileWatcher = fileWatchesOfAffectingLocations.get(path);
|
|
123249
|
+
function createFileWatcherOfAffectingLocation(affectingLocation, forResolution) {
|
|
123250
|
+
var fileWatcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
123136
123251
|
if (fileWatcher) {
|
|
123137
|
-
|
|
123252
|
+
if (forResolution)
|
|
123253
|
+
fileWatcher.resolutions++;
|
|
123254
|
+
else
|
|
123255
|
+
fileWatcher.files++;
|
|
123138
123256
|
return;
|
|
123139
123257
|
}
|
|
123140
123258
|
var locationToWatch = affectingLocation;
|
|
123141
|
-
var locationToWatchPath = path;
|
|
123142
123259
|
if (resolutionHost.realpath) {
|
|
123143
123260
|
locationToWatch = resolutionHost.realpath(affectingLocation);
|
|
123144
|
-
|
|
123145
|
-
|
|
123146
|
-
var fileWatcher_1 = fileWatchesOfAffectingLocations.get(locationToWatchPath);
|
|
123261
|
+
if (affectingLocation !== locationToWatch) {
|
|
123262
|
+
var fileWatcher_1 = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
123147
123263
|
if (fileWatcher_1) {
|
|
123148
|
-
|
|
123149
|
-
|
|
123150
|
-
|
|
123264
|
+
if (forResolution)
|
|
123265
|
+
fileWatcher_1.resolutions++;
|
|
123266
|
+
else
|
|
123267
|
+
fileWatcher_1.files++;
|
|
123268
|
+
fileWatcher_1.paths.add(affectingLocation);
|
|
123269
|
+
fileWatchesOfAffectingLocations.set(affectingLocation, fileWatcher_1);
|
|
123151
123270
|
return;
|
|
123152
123271
|
}
|
|
123153
123272
|
}
|
|
123154
123273
|
}
|
|
123155
123274
|
var paths = new ts.Set();
|
|
123156
|
-
paths.add(
|
|
123275
|
+
paths.add(locationToWatch);
|
|
123157
123276
|
var watcher = {
|
|
123158
|
-
watcher: resolutionHost.
|
|
123159
|
-
|
|
123160
|
-
|
|
123161
|
-
|
|
123162
|
-
|
|
123163
|
-
|
|
123277
|
+
watcher: canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ?
|
|
123278
|
+
resolutionHost.watchAffectingFileLocation(locationToWatch, function (fileName, eventKind) {
|
|
123279
|
+
cachedDirectoryStructureHost === null || cachedDirectoryStructureHost === void 0 ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
|
|
123280
|
+
paths.forEach(function (path) {
|
|
123281
|
+
var _a;
|
|
123282
|
+
if (watcher.resolutions)
|
|
123283
|
+
(affectingPathChecks !== null && affectingPathChecks !== void 0 ? affectingPathChecks : (affectingPathChecks = new ts.Set())).add(path);
|
|
123284
|
+
if (watcher.files)
|
|
123285
|
+
(affectingPathChecksForFile !== null && affectingPathChecksForFile !== void 0 ? affectingPathChecksForFile : (affectingPathChecksForFile = new ts.Set())).add(path);
|
|
123286
|
+
(_a = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap()) === null || _a === void 0 ? void 0 : _a.delete(resolutionHost.toPath(path));
|
|
123287
|
+
});
|
|
123288
|
+
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
123289
|
+
}) : ts.noopFileWatcher,
|
|
123290
|
+
resolutions: forResolution ? 1 : 0,
|
|
123291
|
+
files: forResolution ? 0 : 1,
|
|
123164
123292
|
paths: paths,
|
|
123165
123293
|
};
|
|
123166
|
-
fileWatchesOfAffectingLocations.set(
|
|
123167
|
-
if (
|
|
123168
|
-
fileWatchesOfAffectingLocations.set(
|
|
123169
|
-
paths.add(
|
|
123294
|
+
fileWatchesOfAffectingLocations.set(locationToWatch, watcher);
|
|
123295
|
+
if (affectingLocation !== locationToWatch) {
|
|
123296
|
+
fileWatchesOfAffectingLocations.set(affectingLocation, watcher);
|
|
123297
|
+
paths.add(affectingLocation);
|
|
123170
123298
|
}
|
|
123171
123299
|
}
|
|
123172
123300
|
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
@@ -123234,8 +123362,8 @@ var ts;
|
|
|
123234
123362
|
}
|
|
123235
123363
|
for (var _a = 0, affectingLocations_2 = affectingLocations; _a < affectingLocations_2.length; _a++) {
|
|
123236
123364
|
var affectingLocation = affectingLocations_2[_a];
|
|
123237
|
-
var watcher = fileWatchesOfAffectingLocations.get(
|
|
123238
|
-
watcher.
|
|
123365
|
+
var watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
123366
|
+
watcher.resolutions--;
|
|
123239
123367
|
}
|
|
123240
123368
|
}
|
|
123241
123369
|
function removeDirectoryWatcher(dirPath) {
|
|
@@ -123289,7 +123417,7 @@ var ts;
|
|
|
123289
123417
|
resolution.isInvalidated = invalidated = true;
|
|
123290
123418
|
for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
|
|
123291
123419
|
var containingFilePath = _b[_a];
|
|
123292
|
-
(filesWithInvalidatedResolutions
|
|
123420
|
+
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
|
|
123293
123421
|
// When its a file with inferred types resolution, invalidate type reference directive resolution
|
|
123294
123422
|
hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts.endsWith(containingFilePath, ts.inferredTypesContainingFile);
|
|
123295
123423
|
}
|
|
@@ -123356,10 +123484,25 @@ var ts;
|
|
|
123356
123484
|
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
123357
123485
|
}
|
|
123358
123486
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
123487
|
+
var _a;
|
|
123488
|
+
var invalidated = false;
|
|
123489
|
+
if (affectingPathChecksForFile) {
|
|
123490
|
+
(_a = resolutionHost.getCurrentProgram()) === null || _a === void 0 ? void 0 : _a.getSourceFiles().forEach(function (f) {
|
|
123491
|
+
if (ts.some(f.packageJsonLocations, function (location) { return affectingPathChecksForFile.has(location); })) {
|
|
123492
|
+
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(f.path);
|
|
123493
|
+
invalidated = true;
|
|
123494
|
+
}
|
|
123495
|
+
});
|
|
123496
|
+
affectingPathChecksForFile = undefined;
|
|
123497
|
+
}
|
|
123359
123498
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks && !affectingPathChecks) {
|
|
123360
|
-
return
|
|
123499
|
+
return invalidated;
|
|
123500
|
+
}
|
|
123501
|
+
invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
|
|
123502
|
+
var packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
123503
|
+
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
123504
|
+
packageJsonMap.forEach(function (_value, path) { return isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : undefined; });
|
|
123361
123505
|
}
|
|
123362
|
-
var invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution);
|
|
123363
123506
|
failedLookupChecks = undefined;
|
|
123364
123507
|
startsWithPathChecks = undefined;
|
|
123365
123508
|
isInDirectoryChecks = undefined;
|
|
@@ -123372,17 +123515,15 @@ var ts;
|
|
|
123372
123515
|
return true;
|
|
123373
123516
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
|
|
123374
123517
|
return false;
|
|
123375
|
-
return resolution.failedLookupLocations.some(function (location) {
|
|
123376
|
-
|
|
123377
|
-
|
|
123378
|
-
|
|
123379
|
-
|
|
123380
|
-
|
|
123518
|
+
return resolution.failedLookupLocations.some(function (location) { return isInvalidatedFailedLookup(resolutionHost.toPath(location)); });
|
|
123519
|
+
}
|
|
123520
|
+
function isInvalidatedFailedLookup(locationPath) {
|
|
123521
|
+
return (failedLookupChecks === null || failedLookupChecks === void 0 ? void 0 : failedLookupChecks.has(locationPath)) ||
|
|
123522
|
+
ts.firstDefinedIterator((startsWithPathChecks === null || startsWithPathChecks === void 0 ? void 0 : startsWithPathChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return ts.startsWith(locationPath, fileOrDirectoryPath) ? true : undefined; }) ||
|
|
123523
|
+
ts.firstDefinedIterator((isInDirectoryChecks === null || isInDirectoryChecks === void 0 ? void 0 : isInDirectoryChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : undefined; });
|
|
123381
123524
|
}
|
|
123382
123525
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
123383
|
-
return !!affectingPathChecks && resolution.affectingLocations.some(function (location) {
|
|
123384
|
-
return affectingPathChecks.has(resolutionHost.toPath(location));
|
|
123385
|
-
});
|
|
123526
|
+
return !!affectingPathChecks && resolution.affectingLocations.some(function (location) { return affectingPathChecks.has(location); });
|
|
123386
123527
|
}
|
|
123387
123528
|
function closeTypeRootsWatch() {
|
|
123388
123529
|
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
|
|
@@ -123448,7 +123589,7 @@ var ts;
|
|
|
123448
123589
|
function directoryExistsForTypeRootWatch(nodeTypesDirectory) {
|
|
123449
123590
|
var dir = ts.getDirectoryPath(ts.getDirectoryPath(nodeTypesDirectory));
|
|
123450
123591
|
var dirPath = resolutionHost.toPath(dir);
|
|
123451
|
-
return dirPath === rootPath ||
|
|
123592
|
+
return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
|
|
123452
123593
|
}
|
|
123453
123594
|
}
|
|
123454
123595
|
ts.createResolutionCache = createResolutionCache;
|
|
@@ -124421,23 +124562,46 @@ var ts;
|
|
|
124421
124562
|
var file = _c[_i];
|
|
124422
124563
|
write("" + toFileName(file, relativeFileName));
|
|
124423
124564
|
(_a = reasons.get(file.path)) === null || _a === void 0 ? void 0 : _a.forEach(function (reason) { return write(" " + fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText); });
|
|
124424
|
-
(_b =
|
|
124565
|
+
(_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) === null || _b === void 0 ? void 0 : _b.forEach(function (d) { return write(" " + d.messageText); });
|
|
124425
124566
|
}
|
|
124426
124567
|
}
|
|
124427
124568
|
ts.explainFiles = explainFiles;
|
|
124428
|
-
function
|
|
124569
|
+
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
124570
|
+
var _a;
|
|
124429
124571
|
var result;
|
|
124430
124572
|
if (file.path !== file.resolvedPath) {
|
|
124431
|
-
(result
|
|
124573
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124432
124574
|
/*details*/ undefined, ts.Diagnostics.File_is_output_of_project_reference_source_0, toFileName(file.originalFileName, fileNameConvertor)));
|
|
124433
124575
|
}
|
|
124434
124576
|
if (file.redirectInfo) {
|
|
124435
|
-
(result
|
|
124577
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124436
124578
|
/*details*/ undefined, ts.Diagnostics.File_redirects_to_file_0, toFileName(file.redirectInfo.redirectTarget, fileNameConvertor)));
|
|
124437
124579
|
}
|
|
124580
|
+
if (ts.isExternalOrCommonJsModule(file)) {
|
|
124581
|
+
switch (file.impliedNodeFormat) {
|
|
124582
|
+
case ts.ModuleKind.ESNext:
|
|
124583
|
+
if (file.packageJsonScope) {
|
|
124584
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124585
|
+
/*details*/ undefined, ts.Diagnostics.File_is_ECMAScript_module_because_0_has_field_type_with_value_module, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor)));
|
|
124586
|
+
}
|
|
124587
|
+
break;
|
|
124588
|
+
case ts.ModuleKind.CommonJS:
|
|
124589
|
+
if (file.packageJsonScope) {
|
|
124590
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124591
|
+
/*details*/ undefined, file.packageJsonScope.packageJsonContent.type ?
|
|
124592
|
+
ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module :
|
|
124593
|
+
ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor)));
|
|
124594
|
+
}
|
|
124595
|
+
else if ((_a = file.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) {
|
|
124596
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
124597
|
+
/*details*/ undefined, ts.Diagnostics.File_is_CommonJS_module_because_package_json_was_not_found));
|
|
124598
|
+
}
|
|
124599
|
+
break;
|
|
124600
|
+
}
|
|
124601
|
+
}
|
|
124438
124602
|
return result;
|
|
124439
124603
|
}
|
|
124440
|
-
ts.
|
|
124604
|
+
ts.explainIfFileIsRedirectAndImpliedFormat = explainIfFileIsRedirectAndImpliedFormat;
|
|
124441
124605
|
function getMatchedFileSpec(program, fileName) {
|
|
124442
124606
|
var _a;
|
|
124443
124607
|
var configFile = program.getCompilerOptions().configFile;
|
|
@@ -124647,6 +124811,7 @@ var ts;
|
|
|
124647
124811
|
MissingFile: "Missing file",
|
|
124648
124812
|
WildcardDirectory: "Wild card directory",
|
|
124649
124813
|
FailedLookupLocations: "Failed Lookup Locations",
|
|
124814
|
+
AffectingFileLocation: "File location affecting resolution",
|
|
124650
124815
|
TypeRoots: "Type roots",
|
|
124651
124816
|
ConfigFileOfReferencedProject: "Config file of referened project",
|
|
124652
124817
|
ExtendedConfigOfReferencedProject: "Extended config file of referenced project",
|
|
@@ -124970,7 +125135,7 @@ var ts;
|
|
|
124970
125135
|
compilerHost.getCompilationSettings = function () { return compilerOptions; };
|
|
124971
125136
|
compilerHost.useSourceOfProjectReferenceRedirect = ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect);
|
|
124972
125137
|
compilerHost.watchDirectoryOfFailedLookupLocation = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.FailedLookupLocations); };
|
|
124973
|
-
compilerHost.watchAffectingFileLocation = function (file, cb) { return watchFile(file, cb, ts.PollingInterval.High, watchOptions, ts.WatchType.
|
|
125138
|
+
compilerHost.watchAffectingFileLocation = function (file, cb) { return watchFile(file, cb, ts.PollingInterval.High, watchOptions, ts.WatchType.AffectingFileLocation); };
|
|
124974
125139
|
compilerHost.watchTypeRootsDirectory = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.TypeRoots); };
|
|
124975
125140
|
compilerHost.getCachedDirectoryStructureHost = function () { return cachedDirectoryStructureHost; };
|
|
124976
125141
|
compilerHost.scheduleInvalidateResolutionsOfFailedLookupLocations = scheduleInvalidateResolutionsOfFailedLookupLocations;
|
|
@@ -125004,6 +125169,9 @@ var ts;
|
|
|
125004
125169
|
return host.resolveTypeReferenceDirectives.apply(host, args);
|
|
125005
125170
|
}) :
|
|
125006
125171
|
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode); });
|
|
125172
|
+
compilerHost.getModuleResolutionCache = host.resolveModuleNames ?
|
|
125173
|
+
ts.maybeBind(host, host.getModuleResolutionCache) :
|
|
125174
|
+
(function () { return resolutionCache.getModuleResolutionCache(); });
|
|
125007
125175
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
125008
125176
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
125009
125177
|
synchronizeProgram();
|
|
@@ -125106,8 +125274,9 @@ var ts;
|
|
|
125106
125274
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
125107
125275
|
compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
|
|
125108
125276
|
compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
125277
|
+
var oldProgram = getCurrentProgram();
|
|
125109
125278
|
builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
125110
|
-
resolutionCache.finishCachingPerDirectoryResolution();
|
|
125279
|
+
resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
|
|
125111
125280
|
// Update watches
|
|
125112
125281
|
ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
|
|
125113
125282
|
if (needsUpdateInTypeRootWatch) {
|
|
@@ -125189,9 +125358,6 @@ var ts;
|
|
|
125189
125358
|
sourceFilesCache.set(path, false);
|
|
125190
125359
|
}
|
|
125191
125360
|
}
|
|
125192
|
-
if (sourceFile) {
|
|
125193
|
-
sourceFile.impliedNodeFormat = ts.getImpliedNodeFormatForFile(path, resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache(), compilerHost, compilerHost.getCompilationSettings());
|
|
125194
|
-
}
|
|
125195
125361
|
return sourceFile;
|
|
125196
125362
|
}
|
|
125197
125363
|
return hostSourceFile.sourceFile;
|
|
@@ -125707,6 +125873,7 @@ var ts;
|
|
|
125707
125873
|
compilerHost.getParsedCommandLine = function (fileName) { return parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName)); };
|
|
125708
125874
|
compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
|
|
125709
125875
|
compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
125876
|
+
compilerHost.getModuleResolutionCache = ts.maybeBind(host, host.getModuleResolutionCache);
|
|
125710
125877
|
var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
|
|
125711
125878
|
var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, /*options*/ undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
|
|
125712
125879
|
if (!compilerHost.resolveModuleNames) {
|
|
@@ -137925,60 +138092,64 @@ var ts;
|
|
|
137925
138092
|
}
|
|
137926
138093
|
return settingsOrHost;
|
|
137927
138094
|
}
|
|
137928
|
-
function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) {
|
|
138095
|
+
function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind, languageVersionOrOptions) {
|
|
137929
138096
|
var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
137930
138097
|
var key = getKeyForCompilationSettings(getCompilationSettings(compilationSettings));
|
|
137931
|
-
return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind);
|
|
138098
|
+
return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind, languageVersionOrOptions);
|
|
137932
138099
|
}
|
|
137933
|
-
function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) {
|
|
137934
|
-
return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ true, scriptKind);
|
|
138100
|
+
function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind, languageVersionOrOptions) {
|
|
138101
|
+
return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ true, scriptKind, languageVersionOrOptions);
|
|
137935
138102
|
}
|
|
137936
|
-
function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) {
|
|
138103
|
+
function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind, languageVersionOrOptions) {
|
|
137937
138104
|
var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
137938
138105
|
var key = getKeyForCompilationSettings(getCompilationSettings(compilationSettings));
|
|
137939
|
-
return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind);
|
|
138106
|
+
return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind, languageVersionOrOptions);
|
|
137940
138107
|
}
|
|
137941
|
-
function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) {
|
|
137942
|
-
return acquireOrUpdateDocument(fileName, path, getCompilationSettings(compilationSettings), key, scriptSnapshot, version, /*acquiring*/ false, scriptKind);
|
|
138108
|
+
function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind, languageVersionOrOptions) {
|
|
138109
|
+
return acquireOrUpdateDocument(fileName, path, getCompilationSettings(compilationSettings), key, scriptSnapshot, version, /*acquiring*/ false, scriptKind, languageVersionOrOptions);
|
|
137943
138110
|
}
|
|
137944
138111
|
function getDocumentRegistryEntry(bucketEntry, scriptKind) {
|
|
137945
138112
|
var entry = isDocumentRegistryEntry(bucketEntry) ? bucketEntry : bucketEntry.get(ts.Debug.checkDefined(scriptKind, "If there are more than one scriptKind's for same document the scriptKind should be provided"));
|
|
137946
138113
|
ts.Debug.assert(scriptKind === undefined || !entry || entry.sourceFile.scriptKind === scriptKind, "Script kind should match provided ScriptKind:" + scriptKind + " and sourceFile.scriptKind: " + (entry === null || entry === void 0 ? void 0 : entry.sourceFile.scriptKind) + ", !entry: " + !entry);
|
|
137947
138114
|
return entry;
|
|
137948
138115
|
}
|
|
137949
|
-
function acquireOrUpdateDocument(fileName, path, compilationSettingsOrHost, key, scriptSnapshot, version, acquiring, scriptKind) {
|
|
138116
|
+
function acquireOrUpdateDocument(fileName, path, compilationSettingsOrHost, key, scriptSnapshot, version, acquiring, scriptKind, languageVersionOrOptions) {
|
|
137950
138117
|
var _a, _b, _c, _d;
|
|
137951
138118
|
scriptKind = ts.ensureScriptKind(fileName, scriptKind);
|
|
137952
138119
|
var compilationSettings = getCompilationSettings(compilationSettingsOrHost);
|
|
137953
138120
|
var host = compilationSettingsOrHost === compilationSettings ? undefined : compilationSettingsOrHost;
|
|
137954
138121
|
var scriptTarget = scriptKind === 6 /* JSON */ ? 100 /* JSON */ : ts.getEmitScriptTarget(compilationSettings);
|
|
137955
|
-
var sourceFileOptions =
|
|
137956
|
-
|
|
137957
|
-
|
|
137958
|
-
|
|
137959
|
-
|
|
138122
|
+
var sourceFileOptions = typeof languageVersionOrOptions === "object" ?
|
|
138123
|
+
languageVersionOrOptions :
|
|
138124
|
+
{
|
|
138125
|
+
languageVersion: scriptTarget,
|
|
138126
|
+
impliedNodeFormat: host && ts.getImpliedNodeFormatForFile(path, (_d = (_c = (_b = (_a = host.getCompilerHost) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getModuleResolutionCache) === null || _c === void 0 ? void 0 : _c.call(_b)) === null || _d === void 0 ? void 0 : _d.getPackageJsonInfoCache(), host, compilationSettings),
|
|
138127
|
+
setExternalModuleIndicator: ts.getSetExternalModuleIndicator(compilationSettings)
|
|
138128
|
+
};
|
|
138129
|
+
sourceFileOptions.languageVersion = scriptTarget;
|
|
137960
138130
|
var oldBucketCount = buckets.size;
|
|
137961
|
-
var
|
|
138131
|
+
var keyWithMode = getDocumentRegistryBucketKeyWithMode(key, sourceFileOptions.impliedNodeFormat);
|
|
138132
|
+
var bucket = ts.getOrUpdate(buckets, keyWithMode, function () { return new ts.Map(); });
|
|
137962
138133
|
if (ts.tracing) {
|
|
137963
138134
|
if (buckets.size > oldBucketCount) {
|
|
137964
138135
|
// It is interesting, but not definitively problematic if a build requires multiple document registry buckets -
|
|
137965
138136
|
// perhaps they are for two projects that don't have any overlap.
|
|
137966
138137
|
// Bonus: these events can help us interpret the more interesting event below.
|
|
137967
|
-
ts.tracing.instant("session" /* Session */, "createdDocumentRegistryBucket", { configFilePath: compilationSettings.configFilePath, key:
|
|
138138
|
+
ts.tracing.instant("session" /* Session */, "createdDocumentRegistryBucket", { configFilePath: compilationSettings.configFilePath, key: keyWithMode });
|
|
137968
138139
|
}
|
|
137969
138140
|
// It is fairly suspicious to have one path in two buckets - you'd expect dependencies to have similar configurations.
|
|
137970
138141
|
// If this occurs unexpectedly, the fix is likely to synchronize the project settings.
|
|
137971
138142
|
// Skip .d.ts files to reduce noise (should also cover most of node_modules).
|
|
137972
138143
|
var otherBucketKey = !ts.isDeclarationFileName(path) &&
|
|
137973
|
-
ts.forEachEntry(buckets, function (bucket, bucketKey) { return bucketKey !==
|
|
138144
|
+
ts.forEachEntry(buckets, function (bucket, bucketKey) { return bucketKey !== keyWithMode && bucket.has(path) && bucketKey; });
|
|
137974
138145
|
if (otherBucketKey) {
|
|
137975
|
-
ts.tracing.instant("session" /* Session */, "documentRegistryBucketOverlap", { path: path, key1: otherBucketKey, key2:
|
|
138146
|
+
ts.tracing.instant("session" /* Session */, "documentRegistryBucketOverlap", { path: path, key1: otherBucketKey, key2: keyWithMode });
|
|
137976
138147
|
}
|
|
137977
138148
|
}
|
|
137978
138149
|
var bucketEntry = bucket.get(path);
|
|
137979
138150
|
var entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind);
|
|
137980
138151
|
if (!entry && externalCache) {
|
|
137981
|
-
var sourceFile = externalCache.getDocument(
|
|
138152
|
+
var sourceFile = externalCache.getDocument(keyWithMode, path);
|
|
137982
138153
|
if (sourceFile) {
|
|
137983
138154
|
ts.Debug.assert(acquiring);
|
|
137984
138155
|
entry = {
|
|
@@ -137992,7 +138163,7 @@ var ts;
|
|
|
137992
138163
|
// Have never seen this file with these settings. Create a new source file for it.
|
|
137993
138164
|
var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, sourceFileOptions, version, /*setNodeParents*/ false, scriptKind);
|
|
137994
138165
|
if (externalCache) {
|
|
137995
|
-
externalCache.setDocument(
|
|
138166
|
+
externalCache.setDocument(keyWithMode, path, sourceFile);
|
|
137996
138167
|
}
|
|
137997
138168
|
entry = {
|
|
137998
138169
|
sourceFile: sourceFile,
|
|
@@ -138007,7 +138178,7 @@ var ts;
|
|
|
138007
138178
|
if (entry.sourceFile.version !== version) {
|
|
138008
138179
|
entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot)); // TODO: GH#18217
|
|
138009
138180
|
if (externalCache) {
|
|
138010
|
-
externalCache.setDocument(
|
|
138181
|
+
externalCache.setDocument(keyWithMode, path, entry.sourceFile);
|
|
138011
138182
|
}
|
|
138012
138183
|
}
|
|
138013
138184
|
// If we're acquiring, then this is the first time this LS is asking for this document.
|
|
@@ -138036,13 +138207,13 @@ var ts;
|
|
|
138036
138207
|
}
|
|
138037
138208
|
}
|
|
138038
138209
|
}
|
|
138039
|
-
function releaseDocument(fileName, compilationSettings, scriptKind) {
|
|
138210
|
+
function releaseDocument(fileName, compilationSettings, scriptKind, impliedNodeFormat) {
|
|
138040
138211
|
var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
138041
138212
|
var key = getKeyForCompilationSettings(compilationSettings);
|
|
138042
|
-
return releaseDocumentWithKey(path, key, scriptKind);
|
|
138213
|
+
return releaseDocumentWithKey(path, key, scriptKind, impliedNodeFormat);
|
|
138043
138214
|
}
|
|
138044
|
-
function releaseDocumentWithKey(path, key, scriptKind) {
|
|
138045
|
-
var bucket = ts.Debug.checkDefined(buckets.get(key));
|
|
138215
|
+
function releaseDocumentWithKey(path, key, scriptKind, impliedNodeFormat) {
|
|
138216
|
+
var bucket = ts.Debug.checkDefined(buckets.get(getDocumentRegistryBucketKeyWithMode(key, impliedNodeFormat)));
|
|
138046
138217
|
var bucketEntry = bucket.get(path);
|
|
138047
138218
|
var entry = getDocumentRegistryEntry(bucketEntry, scriptKind);
|
|
138048
138219
|
entry.languageServiceRefCount--;
|
|
@@ -138099,6 +138270,9 @@ var ts;
|
|
|
138099
138270
|
function getKeyForCompilationSettings(settings) {
|
|
138100
138271
|
return ts.sourceFileAffectingCompilerOptions.map(function (option) { return compilerOptionValueToString(ts.getCompilerOptionValue(settings, option)); }).join("|") + (settings.pathsBasePath ? "|" + settings.pathsBasePath : undefined);
|
|
138101
138272
|
}
|
|
138273
|
+
function getDocumentRegistryBucketKeyWithMode(key, mode) {
|
|
138274
|
+
return (mode ? key + "|" + mode : key);
|
|
138275
|
+
}
|
|
138102
138276
|
})(ts || (ts = {}));
|
|
138103
138277
|
/* Code for finding imports of an exported symbol. Used only by FindAllReferences. */
|
|
138104
138278
|
/* @internal */
|
|
@@ -167342,12 +167516,12 @@ var ts;
|
|
|
167342
167516
|
// not part of the new program.
|
|
167343
167517
|
function onReleaseOldSourceFile(oldSourceFile, oldOptions) {
|
|
167344
167518
|
var oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldOptions);
|
|
167345
|
-
documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, oldSettingsKey, oldSourceFile.scriptKind);
|
|
167519
|
+
documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, oldSettingsKey, oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat);
|
|
167346
167520
|
}
|
|
167347
|
-
function getOrCreateSourceFile(fileName,
|
|
167348
|
-
return getOrCreateSourceFileByPath(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName),
|
|
167521
|
+
function getOrCreateSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) {
|
|
167522
|
+
return getOrCreateSourceFileByPath(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), languageVersionOrOptions, onError, shouldCreateNewSourceFile);
|
|
167349
167523
|
}
|
|
167350
|
-
function getOrCreateSourceFileByPath(fileName, path,
|
|
167524
|
+
function getOrCreateSourceFileByPath(fileName, path, languageVersionOrOptions, _onError, shouldCreateNewSourceFile) {
|
|
167351
167525
|
ts.Debug.assert(compilerHost, "getOrCreateSourceFileByPath called after typical CompilerHost lifetime, check the callstack something with a reference to an old host.");
|
|
167352
167526
|
// The program is asking for this file, check first if the host can locate it.
|
|
167353
167527
|
// If the host can not locate the file, then it does not exist. return undefined
|
|
@@ -167390,17 +167564,17 @@ var ts;
|
|
|
167390
167564
|
// file's script kind, i.e. in one project some file is treated as ".ts"
|
|
167391
167565
|
// and in another as ".js"
|
|
167392
167566
|
if (scriptKind === oldSourceFile.scriptKind) {
|
|
167393
|
-
return documentRegistry.updateDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind);
|
|
167567
|
+
return documentRegistry.updateDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind, languageVersionOrOptions);
|
|
167394
167568
|
}
|
|
167395
167569
|
else {
|
|
167396
167570
|
// Release old source file and fall through to aquire new file with new script kind
|
|
167397
|
-
documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions()), oldSourceFile.scriptKind);
|
|
167571
|
+
documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions()), oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat);
|
|
167398
167572
|
}
|
|
167399
167573
|
}
|
|
167400
167574
|
// We didn't already have the file. Fall through and acquire it from the registry.
|
|
167401
167575
|
}
|
|
167402
167576
|
// Could not find this file in the old program, create a new SourceFile for it.
|
|
167403
|
-
return documentRegistry.acquireDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind);
|
|
167577
|
+
return documentRegistry.acquireDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind, languageVersionOrOptions);
|
|
167404
167578
|
}
|
|
167405
167579
|
}
|
|
167406
167580
|
// TODO: GH#18217 frequently asserted as defined
|
|
@@ -167479,7 +167653,7 @@ var ts;
|
|
|
167479
167653
|
// Use paths to ensure we are using correct key and paths as document registry could be created with different current directory than host
|
|
167480
167654
|
var key_1 = documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions());
|
|
167481
167655
|
ts.forEach(program.getSourceFiles(), function (f) {
|
|
167482
|
-
return documentRegistry.releaseDocumentWithKey(f.resolvedPath, key_1, f.scriptKind);
|
|
167656
|
+
return documentRegistry.releaseDocumentWithKey(f.resolvedPath, key_1, f.scriptKind, f.impliedNodeFormat);
|
|
167483
167657
|
});
|
|
167484
167658
|
program = undefined; // TODO: GH#18217
|
|
167485
167659
|
}
|
|
@@ -168396,6 +168570,7 @@ var ts;
|
|
|
168396
168570
|
getEmitOutput: getEmitOutput,
|
|
168397
168571
|
getNonBoundSourceFile: getNonBoundSourceFile,
|
|
168398
168572
|
getProgram: getProgram,
|
|
168573
|
+
getCurrentProgram: function () { return program; },
|
|
168399
168574
|
getAutoImportProvider: getAutoImportProvider,
|
|
168400
168575
|
updateIsDefinitionOfReferencedSymbols: updateIsDefinitionOfReferencedSymbols,
|
|
168401
168576
|
getApplicableRefactors: getApplicableRefactors,
|