@typescript-deploys/pr-build 5.5.0-pr-55267-135 → 5.5.0-pr-58157-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 +949 -683
- package/lib/typescript.d.ts +99 -30
- package/lib/typescript.js +1368 -908
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240413`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -4307,7 +4307,7 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
4307
4307
|
const filePathComparer = getStringComparer(!useCaseSensitiveFileNames2);
|
|
4308
4308
|
const toCanonicalFilePath = createGetCanonicalFileName(useCaseSensitiveFileNames2);
|
|
4309
4309
|
return (dirName, callback, recursive, options) => recursive ? createDirectoryWatcher(dirName, options, callback) : watchDirectory(dirName, callback, recursive, options);
|
|
4310
|
-
function createDirectoryWatcher(dirName, options, callback) {
|
|
4310
|
+
function createDirectoryWatcher(dirName, options, callback, link) {
|
|
4311
4311
|
const dirPath = toCanonicalFilePath(dirName);
|
|
4312
4312
|
let directoryWatcher = cache.get(dirPath);
|
|
4313
4313
|
if (directoryWatcher) {
|
|
@@ -4317,10 +4317,12 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
4317
4317
|
watcher: watchDirectory(
|
|
4318
4318
|
dirName,
|
|
4319
4319
|
(fileName) => {
|
|
4320
|
+
var _a;
|
|
4320
4321
|
if (isIgnoredPath(fileName, options))
|
|
4321
4322
|
return;
|
|
4322
4323
|
if (options == null ? void 0 : options.synchronousWatchDirectory) {
|
|
4323
|
-
|
|
4324
|
+
if (!((_a = cache.get(dirPath)) == null ? void 0 : _a.targetWatcher))
|
|
4325
|
+
invokeCallbacks(dirName, dirPath, fileName);
|
|
4324
4326
|
updateChildWatches(dirName, dirPath, options);
|
|
4325
4327
|
} else {
|
|
4326
4328
|
nonSyncUpdateChildWatches(dirName, dirPath, fileName, options);
|
|
@@ -4331,11 +4333,15 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
4331
4333
|
options
|
|
4332
4334
|
),
|
|
4333
4335
|
refCount: 1,
|
|
4334
|
-
childWatches: emptyArray
|
|
4336
|
+
childWatches: emptyArray,
|
|
4337
|
+
targetWatcher: void 0,
|
|
4338
|
+
links: void 0
|
|
4335
4339
|
};
|
|
4336
4340
|
cache.set(dirPath, directoryWatcher);
|
|
4337
4341
|
updateChildWatches(dirName, dirPath, options);
|
|
4338
4342
|
}
|
|
4343
|
+
if (link)
|
|
4344
|
+
(directoryWatcher.links ?? (directoryWatcher.links = /* @__PURE__ */ new Set())).add(link);
|
|
4339
4345
|
const callbackToAdd = callback && { dirName, callback };
|
|
4340
4346
|
if (callbackToAdd) {
|
|
4341
4347
|
callbackCache.add(dirPath, callbackToAdd);
|
|
@@ -4343,19 +4349,25 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
4343
4349
|
return {
|
|
4344
4350
|
dirName,
|
|
4345
4351
|
close: () => {
|
|
4352
|
+
var _a;
|
|
4346
4353
|
const directoryWatcher2 = Debug.checkDefined(cache.get(dirPath));
|
|
4347
4354
|
if (callbackToAdd)
|
|
4348
4355
|
callbackCache.remove(dirPath, callbackToAdd);
|
|
4356
|
+
if (link)
|
|
4357
|
+
(_a = directoryWatcher2.links) == null ? void 0 : _a.delete(link);
|
|
4349
4358
|
directoryWatcher2.refCount--;
|
|
4350
4359
|
if (directoryWatcher2.refCount)
|
|
4351
4360
|
return;
|
|
4352
4361
|
cache.delete(dirPath);
|
|
4362
|
+
directoryWatcher2.links = void 0;
|
|
4353
4363
|
closeFileWatcherOf(directoryWatcher2);
|
|
4364
|
+
closeTargetWatcher(directoryWatcher2);
|
|
4354
4365
|
directoryWatcher2.childWatches.forEach(closeFileWatcher);
|
|
4355
4366
|
}
|
|
4356
4367
|
};
|
|
4357
4368
|
}
|
|
4358
|
-
function invokeCallbacks(dirPath, fileNameOrInvokeMap, fileNames) {
|
|
4369
|
+
function invokeCallbacks(dirName, dirPath, fileNameOrInvokeMap, fileNames) {
|
|
4370
|
+
var _a, _b;
|
|
4359
4371
|
let fileName;
|
|
4360
4372
|
let invokeMap;
|
|
4361
4373
|
if (isString(fileNameOrInvokeMap)) {
|
|
@@ -4383,6 +4395,14 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
4383
4395
|
}
|
|
4384
4396
|
}
|
|
4385
4397
|
});
|
|
4398
|
+
(_b = (_a = cache.get(dirPath)) == null ? void 0 : _a.links) == null ? void 0 : _b.forEach((link) => {
|
|
4399
|
+
const toPathInLink = (fileName2) => combinePaths(link, getRelativePathFromDirectory(dirName, fileName2, toCanonicalFilePath));
|
|
4400
|
+
if (invokeMap) {
|
|
4401
|
+
invokeCallbacks(link, toCanonicalFilePath(link), invokeMap, fileNames == null ? void 0 : fileNames.map(toPathInLink));
|
|
4402
|
+
} else {
|
|
4403
|
+
invokeCallbacks(link, toCanonicalFilePath(link), toPathInLink(fileName));
|
|
4404
|
+
}
|
|
4405
|
+
});
|
|
4386
4406
|
}
|
|
4387
4407
|
function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
|
|
4388
4408
|
const parentWatcher = cache.get(dirPath);
|
|
@@ -4390,7 +4410,8 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
4390
4410
|
scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
|
|
4391
4411
|
return;
|
|
4392
4412
|
}
|
|
4393
|
-
invokeCallbacks(dirPath, fileName);
|
|
4413
|
+
invokeCallbacks(dirName, dirPath, fileName);
|
|
4414
|
+
closeTargetWatcher(parentWatcher);
|
|
4394
4415
|
removeChildWatches(parentWatcher);
|
|
4395
4416
|
}
|
|
4396
4417
|
function scheduleUpdateChildWatches(dirName, dirPath, fileName, options) {
|
|
@@ -4407,6 +4428,7 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
4407
4428
|
timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3, "timerToUpdateChildWatches");
|
|
4408
4429
|
}
|
|
4409
4430
|
function onTimerToUpdateChildWatches() {
|
|
4431
|
+
var _a;
|
|
4410
4432
|
timerToUpdateChildWatches = void 0;
|
|
4411
4433
|
sysLog(`sysLog:: onTimerToUpdateChildWatches:: ${cacheToUpdateChildWatches.size}`);
|
|
4412
4434
|
const start = timestamp();
|
|
@@ -4417,7 +4439,8 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
4417
4439
|
const { value: [dirPath, { dirName, options, fileNames }] } = result;
|
|
4418
4440
|
cacheToUpdateChildWatches.delete(dirPath);
|
|
4419
4441
|
const hasChanges = updateChildWatches(dirName, dirPath, options);
|
|
4420
|
-
|
|
4442
|
+
if (!((_a = cache.get(dirPath)) == null ? void 0 : _a.targetWatcher))
|
|
4443
|
+
invokeCallbacks(dirName, dirPath, invokeMap, hasChanges ? void 0 : fileNames);
|
|
4421
4444
|
}
|
|
4422
4445
|
sysLog(`sysLog:: invokingWatchers:: Elapsed:: ${timestamp() - start}ms:: ${cacheToUpdateChildWatches.size}`);
|
|
4423
4446
|
callbackCache.forEach((callbacks, rootDirName) => {
|
|
@@ -4445,22 +4468,46 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
4445
4468
|
removeChildWatches(cache.get(toCanonicalFilePath(childWatcher.dirName)));
|
|
4446
4469
|
}
|
|
4447
4470
|
}
|
|
4471
|
+
function closeTargetWatcher(watcher) {
|
|
4472
|
+
if (watcher == null ? void 0 : watcher.targetWatcher) {
|
|
4473
|
+
watcher.targetWatcher.close();
|
|
4474
|
+
watcher.targetWatcher = void 0;
|
|
4475
|
+
}
|
|
4476
|
+
}
|
|
4448
4477
|
function updateChildWatches(parentDir, parentDirPath, options) {
|
|
4449
4478
|
const parentWatcher = cache.get(parentDirPath);
|
|
4450
4479
|
if (!parentWatcher)
|
|
4451
4480
|
return false;
|
|
4481
|
+
const target = normalizePath(realpath(parentDir));
|
|
4482
|
+
let hasChanges;
|
|
4452
4483
|
let newChildWatches;
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4484
|
+
if (filePathComparer(target, parentDir) === 0 /* EqualTo */) {
|
|
4485
|
+
hasChanges = enumerateInsertsAndDeletes(
|
|
4486
|
+
fileSystemEntryExists(parentDir, 1 /* Directory */) ? mapDefined(getAccessibleSortedChildDirectories(parentDir), (child) => {
|
|
4487
|
+
const childFullName = getNormalizedAbsolutePath(child, parentDir);
|
|
4488
|
+
return !isIgnoredPath(childFullName, options) && filePathComparer(childFullName, normalizePath(realpath(childFullName))) === 0 /* EqualTo */ ? childFullName : void 0;
|
|
4489
|
+
}) : emptyArray,
|
|
4490
|
+
parentWatcher.childWatches,
|
|
4491
|
+
(child, childWatcher) => filePathComparer(child, childWatcher.dirName),
|
|
4492
|
+
createAndAddChildDirectoryWatcher,
|
|
4493
|
+
closeFileWatcher,
|
|
4494
|
+
addChildDirectoryWatcher
|
|
4495
|
+
);
|
|
4496
|
+
} else if (parentWatcher.targetWatcher && filePathComparer(target, parentWatcher.targetWatcher.dirName) === 0 /* EqualTo */) {
|
|
4497
|
+
hasChanges = false;
|
|
4498
|
+
Debug.assert(parentWatcher.childWatches === emptyArray);
|
|
4499
|
+
} else {
|
|
4500
|
+
closeTargetWatcher(parentWatcher);
|
|
4501
|
+
parentWatcher.targetWatcher = createDirectoryWatcher(
|
|
4502
|
+
target,
|
|
4503
|
+
options,
|
|
4504
|
+
/*callback*/
|
|
4505
|
+
void 0,
|
|
4506
|
+
parentDir
|
|
4507
|
+
);
|
|
4508
|
+
parentWatcher.childWatches.forEach(closeFileWatcher);
|
|
4509
|
+
hasChanges = true;
|
|
4510
|
+
}
|
|
4464
4511
|
parentWatcher.childWatches = newChildWatches || emptyArray;
|
|
4465
4512
|
return hasChanges;
|
|
4466
4513
|
function createAndAddChildDirectoryWatcher(childName) {
|
|
@@ -5955,6 +6002,7 @@ var Diagnostics = {
|
|
|
5955
6002
|
_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1290, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1290", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
|
5956
6003
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
|
|
5957
6004
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
|
6005
|
+
ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
|
|
5958
6006
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
5959
6007
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
|
5960
6008
|
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
|
|
@@ -10060,6 +10108,8 @@ function getDefaultLibFileName(options) {
|
|
|
10060
10108
|
switch (getEmitScriptTarget(options)) {
|
|
10061
10109
|
case 99 /* ESNext */:
|
|
10062
10110
|
return "lib.esnext.full.d.ts";
|
|
10111
|
+
case 10 /* ES2023 */:
|
|
10112
|
+
return "lib.es2023.full.d.ts";
|
|
10063
10113
|
case 9 /* ES2022 */:
|
|
10064
10114
|
return "lib.es2022.full.d.ts";
|
|
10065
10115
|
case 8 /* ES2021 */:
|
|
@@ -12644,6 +12694,9 @@ function getErrorSpanForNode(sourceFile, node) {
|
|
|
12644
12694
|
}
|
|
12645
12695
|
return createTextSpanFromBounds(pos, errorNode.end);
|
|
12646
12696
|
}
|
|
12697
|
+
function isGlobalSourceFile(node) {
|
|
12698
|
+
return node.kind === 307 /* SourceFile */ && !isExternalOrCommonJsModule(node);
|
|
12699
|
+
}
|
|
12647
12700
|
function isExternalOrCommonJsModule(file) {
|
|
12648
12701
|
return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== void 0;
|
|
12649
12702
|
}
|
|
@@ -13704,6 +13757,23 @@ function isFunctionSymbol(symbol) {
|
|
|
13704
13757
|
const decl = symbol.valueDeclaration;
|
|
13705
13758
|
return decl.kind === 262 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer);
|
|
13706
13759
|
}
|
|
13760
|
+
function canHaveModuleSpecifier(node) {
|
|
13761
|
+
switch (node == null ? void 0 : node.kind) {
|
|
13762
|
+
case 260 /* VariableDeclaration */:
|
|
13763
|
+
case 208 /* BindingElement */:
|
|
13764
|
+
case 272 /* ImportDeclaration */:
|
|
13765
|
+
case 278 /* ExportDeclaration */:
|
|
13766
|
+
case 271 /* ImportEqualsDeclaration */:
|
|
13767
|
+
case 273 /* ImportClause */:
|
|
13768
|
+
case 280 /* NamespaceExport */:
|
|
13769
|
+
case 274 /* NamespaceImport */:
|
|
13770
|
+
case 281 /* ExportSpecifier */:
|
|
13771
|
+
case 276 /* ImportSpecifier */:
|
|
13772
|
+
case 205 /* ImportType */:
|
|
13773
|
+
return true;
|
|
13774
|
+
}
|
|
13775
|
+
return false;
|
|
13776
|
+
}
|
|
13707
13777
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
13708
13778
|
var _a, _b;
|
|
13709
13779
|
switch (node.kind) {
|
|
@@ -16378,8 +16448,8 @@ function walkTreeForJSXTags(node) {
|
|
|
16378
16448
|
function isFileModuleFromUsingJSXTag(file) {
|
|
16379
16449
|
return !file.isDeclarationFile ? walkTreeForJSXTags(file) : void 0;
|
|
16380
16450
|
}
|
|
16381
|
-
function isFileForcedToBeModuleByFormat(file) {
|
|
16382
|
-
return (file
|
|
16451
|
+
function isFileForcedToBeModuleByFormat(file, options) {
|
|
16452
|
+
return (getImpliedNodeFormatForEmitWorker(file, options) === 99 /* ESNext */ || fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */])) && !file.isDeclarationFile ? true : void 0;
|
|
16383
16453
|
}
|
|
16384
16454
|
function getSetExternalModuleIndicator(options) {
|
|
16385
16455
|
switch (getEmitModuleDetectionKind(options)) {
|
|
@@ -16398,10 +16468,14 @@ function getSetExternalModuleIndicator(options) {
|
|
|
16398
16468
|
}
|
|
16399
16469
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
16400
16470
|
const combined = or(...checks);
|
|
16401
|
-
const callback = (file) => void (file.externalModuleIndicator = combined(file));
|
|
16471
|
+
const callback = (file) => void (file.externalModuleIndicator = combined(file, options));
|
|
16402
16472
|
return callback;
|
|
16403
16473
|
}
|
|
16404
16474
|
}
|
|
16475
|
+
function importSyntaxAffectsModuleResolution(options) {
|
|
16476
|
+
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
16477
|
+
return 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || getResolvePackageJsonExports(options) || getResolvePackageJsonImports(options);
|
|
16478
|
+
}
|
|
16405
16479
|
function createComputedCompilerOptions(options) {
|
|
16406
16480
|
return options;
|
|
16407
16481
|
}
|
|
@@ -17820,6 +17894,380 @@ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameEx
|
|
|
17820
17894
|
}
|
|
17821
17895
|
return evaluate;
|
|
17822
17896
|
}
|
|
17897
|
+
function isConstAssertion(location) {
|
|
17898
|
+
return isAssertionExpression(location) && isConstTypeReference(location.type) || isJSDocTypeTag(location) && isConstTypeReference(location.typeExpression);
|
|
17899
|
+
}
|
|
17900
|
+
function findConstructorDeclaration(node) {
|
|
17901
|
+
const members = node.members;
|
|
17902
|
+
for (const member of members) {
|
|
17903
|
+
if (member.kind === 176 /* Constructor */ && nodeIsPresent(member.body)) {
|
|
17904
|
+
return member;
|
|
17905
|
+
}
|
|
17906
|
+
}
|
|
17907
|
+
}
|
|
17908
|
+
function createNameResolver({
|
|
17909
|
+
compilerOptions,
|
|
17910
|
+
requireSymbol,
|
|
17911
|
+
argumentsSymbol,
|
|
17912
|
+
error,
|
|
17913
|
+
getSymbolOfDeclaration,
|
|
17914
|
+
globals,
|
|
17915
|
+
lookup,
|
|
17916
|
+
setRequiresScopeChangeCache = returnUndefined,
|
|
17917
|
+
getRequiresScopeChangeCache = returnUndefined,
|
|
17918
|
+
onPropertyWithInvalidInitializer = returnFalse,
|
|
17919
|
+
onFailedToResolveSymbol = returnUndefined,
|
|
17920
|
+
onSuccessfullyResolvedSymbol = returnUndefined
|
|
17921
|
+
}) {
|
|
17922
|
+
var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
|
|
17923
|
+
var emitStandardClassFields = getEmitStandardClassFields(compilerOptions);
|
|
17924
|
+
var emptySymbols = createSymbolTable();
|
|
17925
|
+
return resolveNameHelper;
|
|
17926
|
+
function resolveNameHelper(location, nameArg, meaning, nameNotFoundMessage, isUse, excludeGlobals) {
|
|
17927
|
+
var _a, _b, _c;
|
|
17928
|
+
const originalLocation = location;
|
|
17929
|
+
let result;
|
|
17930
|
+
let lastLocation;
|
|
17931
|
+
let lastSelfReferenceLocation;
|
|
17932
|
+
let propertyWithInvalidInitializer;
|
|
17933
|
+
let associatedDeclarationForContainingInitializerOrBindingName;
|
|
17934
|
+
let withinDeferredContext = false;
|
|
17935
|
+
let grandparent;
|
|
17936
|
+
const name = isString(nameArg) ? nameArg : nameArg.escapedText;
|
|
17937
|
+
loop:
|
|
17938
|
+
while (location) {
|
|
17939
|
+
if (name === "const" && isConstAssertion(location)) {
|
|
17940
|
+
return void 0;
|
|
17941
|
+
}
|
|
17942
|
+
if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
|
|
17943
|
+
lastLocation = location;
|
|
17944
|
+
location = location.parent;
|
|
17945
|
+
}
|
|
17946
|
+
if (canHaveLocals(location) && location.locals && !isGlobalSourceFile(location)) {
|
|
17947
|
+
if (result = lookup(location.locals, name, meaning)) {
|
|
17948
|
+
let useResult = true;
|
|
17949
|
+
if (isFunctionLike(location) && lastLocation && lastLocation !== location.body) {
|
|
17950
|
+
if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 320 /* JSDoc */) {
|
|
17951
|
+
useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || lastLocation.kind === 169 /* Parameter */ || lastLocation.kind === 341 /* JSDocParameterTag */ || lastLocation.kind === 342 /* JSDocReturnTag */ || lastLocation.kind === 168 /* TypeParameter */ : false;
|
|
17952
|
+
}
|
|
17953
|
+
if (meaning & result.flags & 3 /* Variable */) {
|
|
17954
|
+
if (useOuterVariableScopeInParameter(result, location, lastLocation)) {
|
|
17955
|
+
useResult = false;
|
|
17956
|
+
} else if (result.flags & 1 /* FunctionScopedVariable */) {
|
|
17957
|
+
useResult = lastLocation.kind === 169 /* Parameter */ || lastLocation === location.type && !!findAncestor(result.valueDeclaration, isParameter);
|
|
17958
|
+
}
|
|
17959
|
+
}
|
|
17960
|
+
} else if (location.kind === 194 /* ConditionalType */) {
|
|
17961
|
+
useResult = lastLocation === location.trueType;
|
|
17962
|
+
}
|
|
17963
|
+
if (useResult) {
|
|
17964
|
+
break loop;
|
|
17965
|
+
} else {
|
|
17966
|
+
result = void 0;
|
|
17967
|
+
}
|
|
17968
|
+
}
|
|
17969
|
+
}
|
|
17970
|
+
withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation);
|
|
17971
|
+
switch (location.kind) {
|
|
17972
|
+
case 307 /* SourceFile */:
|
|
17973
|
+
if (!isExternalOrCommonJsModule(location))
|
|
17974
|
+
break;
|
|
17975
|
+
case 267 /* ModuleDeclaration */:
|
|
17976
|
+
const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
|
|
17977
|
+
if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
|
|
17978
|
+
if (result = moduleExports.get("default" /* Default */)) {
|
|
17979
|
+
const localSymbol = getLocalSymbolForExportDefault(result);
|
|
17980
|
+
if (localSymbol && result.flags & meaning && localSymbol.escapedName === name) {
|
|
17981
|
+
break loop;
|
|
17982
|
+
}
|
|
17983
|
+
result = void 0;
|
|
17984
|
+
}
|
|
17985
|
+
const moduleExport = moduleExports.get(name);
|
|
17986
|
+
if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && (getDeclarationOfKind(moduleExport, 281 /* ExportSpecifier */) || getDeclarationOfKind(moduleExport, 280 /* NamespaceExport */))) {
|
|
17987
|
+
break;
|
|
17988
|
+
}
|
|
17989
|
+
}
|
|
17990
|
+
if (name !== "default" /* Default */ && (result = lookup(moduleExports, name, meaning & 2623475 /* ModuleMember */))) {
|
|
17991
|
+
if (isSourceFile(location) && location.commonJsModuleIndicator && !((_b = result.declarations) == null ? void 0 : _b.some(isJSDocTypeAlias))) {
|
|
17992
|
+
result = void 0;
|
|
17993
|
+
} else {
|
|
17994
|
+
break loop;
|
|
17995
|
+
}
|
|
17996
|
+
}
|
|
17997
|
+
break;
|
|
17998
|
+
case 266 /* EnumDeclaration */:
|
|
17999
|
+
if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) {
|
|
18000
|
+
if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 33554432 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) {
|
|
18001
|
+
error(
|
|
18002
|
+
originalLocation,
|
|
18003
|
+
Diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead,
|
|
18004
|
+
unescapeLeadingUnderscores(name),
|
|
18005
|
+
isolatedModulesLikeFlagName,
|
|
18006
|
+
`${unescapeLeadingUnderscores(getSymbolOfDeclaration(location).escapedName)}.${unescapeLeadingUnderscores(name)}`
|
|
18007
|
+
);
|
|
18008
|
+
}
|
|
18009
|
+
break loop;
|
|
18010
|
+
}
|
|
18011
|
+
break;
|
|
18012
|
+
case 172 /* PropertyDeclaration */:
|
|
18013
|
+
if (!isStatic(location)) {
|
|
18014
|
+
const ctor = findConstructorDeclaration(location.parent);
|
|
18015
|
+
if (ctor && ctor.locals) {
|
|
18016
|
+
if (lookup(ctor.locals, name, meaning & 111551 /* Value */)) {
|
|
18017
|
+
Debug.assertNode(location, isPropertyDeclaration);
|
|
18018
|
+
propertyWithInvalidInitializer = location;
|
|
18019
|
+
}
|
|
18020
|
+
}
|
|
18021
|
+
}
|
|
18022
|
+
break;
|
|
18023
|
+
case 263 /* ClassDeclaration */:
|
|
18024
|
+
case 231 /* ClassExpression */:
|
|
18025
|
+
case 264 /* InterfaceDeclaration */:
|
|
18026
|
+
if (result = lookup(getSymbolOfDeclaration(location).members || emptySymbols, name, meaning & 788968 /* Type */)) {
|
|
18027
|
+
if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
|
|
18028
|
+
result = void 0;
|
|
18029
|
+
break;
|
|
18030
|
+
}
|
|
18031
|
+
if (lastLocation && isStatic(lastLocation)) {
|
|
18032
|
+
if (nameNotFoundMessage) {
|
|
18033
|
+
error(originalLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters);
|
|
18034
|
+
}
|
|
18035
|
+
return void 0;
|
|
18036
|
+
}
|
|
18037
|
+
break loop;
|
|
18038
|
+
}
|
|
18039
|
+
if (isClassExpression(location) && meaning & 32 /* Class */) {
|
|
18040
|
+
const className = location.name;
|
|
18041
|
+
if (className && name === className.escapedText) {
|
|
18042
|
+
result = location.symbol;
|
|
18043
|
+
break loop;
|
|
18044
|
+
}
|
|
18045
|
+
}
|
|
18046
|
+
break;
|
|
18047
|
+
case 233 /* ExpressionWithTypeArguments */:
|
|
18048
|
+
if (lastLocation === location.expression && location.parent.token === 96 /* ExtendsKeyword */) {
|
|
18049
|
+
const container = location.parent.parent;
|
|
18050
|
+
if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) {
|
|
18051
|
+
if (nameNotFoundMessage) {
|
|
18052
|
+
error(originalLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
|
|
18053
|
+
}
|
|
18054
|
+
return void 0;
|
|
18055
|
+
}
|
|
18056
|
+
}
|
|
18057
|
+
break;
|
|
18058
|
+
case 167 /* ComputedPropertyName */:
|
|
18059
|
+
grandparent = location.parent.parent;
|
|
18060
|
+
if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
|
|
18061
|
+
if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) {
|
|
18062
|
+
if (nameNotFoundMessage) {
|
|
18063
|
+
error(originalLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
|
|
18064
|
+
}
|
|
18065
|
+
return void 0;
|
|
18066
|
+
}
|
|
18067
|
+
}
|
|
18068
|
+
break;
|
|
18069
|
+
case 219 /* ArrowFunction */:
|
|
18070
|
+
if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
|
|
18071
|
+
break;
|
|
18072
|
+
}
|
|
18073
|
+
case 174 /* MethodDeclaration */:
|
|
18074
|
+
case 176 /* Constructor */:
|
|
18075
|
+
case 177 /* GetAccessor */:
|
|
18076
|
+
case 178 /* SetAccessor */:
|
|
18077
|
+
case 262 /* FunctionDeclaration */:
|
|
18078
|
+
if (meaning & 3 /* Variable */ && name === "arguments") {
|
|
18079
|
+
result = argumentsSymbol;
|
|
18080
|
+
break loop;
|
|
18081
|
+
}
|
|
18082
|
+
break;
|
|
18083
|
+
case 218 /* FunctionExpression */:
|
|
18084
|
+
if (meaning & 3 /* Variable */ && name === "arguments") {
|
|
18085
|
+
result = argumentsSymbol;
|
|
18086
|
+
break loop;
|
|
18087
|
+
}
|
|
18088
|
+
if (meaning & 16 /* Function */) {
|
|
18089
|
+
const functionName = location.name;
|
|
18090
|
+
if (functionName && name === functionName.escapedText) {
|
|
18091
|
+
result = location.symbol;
|
|
18092
|
+
break loop;
|
|
18093
|
+
}
|
|
18094
|
+
}
|
|
18095
|
+
break;
|
|
18096
|
+
case 170 /* Decorator */:
|
|
18097
|
+
if (location.parent && location.parent.kind === 169 /* Parameter */) {
|
|
18098
|
+
location = location.parent;
|
|
18099
|
+
}
|
|
18100
|
+
if (location.parent && (isClassElement(location.parent) || location.parent.kind === 263 /* ClassDeclaration */)) {
|
|
18101
|
+
location = location.parent;
|
|
18102
|
+
}
|
|
18103
|
+
break;
|
|
18104
|
+
case 346 /* JSDocTypedefTag */:
|
|
18105
|
+
case 338 /* JSDocCallbackTag */:
|
|
18106
|
+
case 340 /* JSDocEnumTag */:
|
|
18107
|
+
case 351 /* JSDocImportTag */:
|
|
18108
|
+
const root = getJSDocRoot(location);
|
|
18109
|
+
if (root) {
|
|
18110
|
+
location = root.parent;
|
|
18111
|
+
}
|
|
18112
|
+
break;
|
|
18113
|
+
case 169 /* Parameter */:
|
|
18114
|
+
if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
|
|
18115
|
+
if (!associatedDeclarationForContainingInitializerOrBindingName) {
|
|
18116
|
+
associatedDeclarationForContainingInitializerOrBindingName = location;
|
|
18117
|
+
}
|
|
18118
|
+
}
|
|
18119
|
+
break;
|
|
18120
|
+
case 208 /* BindingElement */:
|
|
18121
|
+
if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
|
|
18122
|
+
if (isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
|
|
18123
|
+
associatedDeclarationForContainingInitializerOrBindingName = location;
|
|
18124
|
+
}
|
|
18125
|
+
}
|
|
18126
|
+
break;
|
|
18127
|
+
case 195 /* InferType */:
|
|
18128
|
+
if (meaning & 262144 /* TypeParameter */) {
|
|
18129
|
+
const parameterName = location.typeParameter.name;
|
|
18130
|
+
if (parameterName && name === parameterName.escapedText) {
|
|
18131
|
+
result = location.typeParameter.symbol;
|
|
18132
|
+
break loop;
|
|
18133
|
+
}
|
|
18134
|
+
}
|
|
18135
|
+
break;
|
|
18136
|
+
case 281 /* ExportSpecifier */:
|
|
18137
|
+
if (lastLocation && lastLocation === location.propertyName && location.parent.parent.moduleSpecifier) {
|
|
18138
|
+
location = location.parent.parent.parent;
|
|
18139
|
+
}
|
|
18140
|
+
break;
|
|
18141
|
+
}
|
|
18142
|
+
if (isSelfReferenceLocation(location)) {
|
|
18143
|
+
lastSelfReferenceLocation = location;
|
|
18144
|
+
}
|
|
18145
|
+
lastLocation = location;
|
|
18146
|
+
location = isJSDocTemplateTag(location) ? getEffectiveContainerForJSDocTemplateTag(location) || location.parent : isJSDocParameterTag(location) || isJSDocReturnTag(location) ? getHostSignatureFromJSDoc(location) || location.parent : location.parent;
|
|
18147
|
+
}
|
|
18148
|
+
if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
|
|
18149
|
+
result.isReferenced |= meaning;
|
|
18150
|
+
}
|
|
18151
|
+
if (!result) {
|
|
18152
|
+
if (lastLocation) {
|
|
18153
|
+
Debug.assertNode(lastLocation, isSourceFile);
|
|
18154
|
+
if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
|
|
18155
|
+
return lastLocation.symbol;
|
|
18156
|
+
}
|
|
18157
|
+
}
|
|
18158
|
+
if (!excludeGlobals) {
|
|
18159
|
+
result = lookup(globals, name, meaning);
|
|
18160
|
+
}
|
|
18161
|
+
}
|
|
18162
|
+
if (!result) {
|
|
18163
|
+
if (originalLocation && isInJSFile(originalLocation) && originalLocation.parent) {
|
|
18164
|
+
if (isRequireCall(
|
|
18165
|
+
originalLocation.parent,
|
|
18166
|
+
/*requireStringLiteralLikeArgument*/
|
|
18167
|
+
false
|
|
18168
|
+
)) {
|
|
18169
|
+
return requireSymbol;
|
|
18170
|
+
}
|
|
18171
|
+
}
|
|
18172
|
+
}
|
|
18173
|
+
if (nameNotFoundMessage) {
|
|
18174
|
+
if (propertyWithInvalidInitializer && onPropertyWithInvalidInitializer(originalLocation, name, propertyWithInvalidInitializer, result)) {
|
|
18175
|
+
return void 0;
|
|
18176
|
+
}
|
|
18177
|
+
if (!result) {
|
|
18178
|
+
onFailedToResolveSymbol(originalLocation, nameArg, meaning, nameNotFoundMessage);
|
|
18179
|
+
} else {
|
|
18180
|
+
onSuccessfullyResolvedSymbol(originalLocation, result, meaning, lastLocation, associatedDeclarationForContainingInitializerOrBindingName, withinDeferredContext);
|
|
18181
|
+
}
|
|
18182
|
+
}
|
|
18183
|
+
return result;
|
|
18184
|
+
}
|
|
18185
|
+
function useOuterVariableScopeInParameter(result, location, lastLocation) {
|
|
18186
|
+
const target = getEmitScriptTarget(compilerOptions);
|
|
18187
|
+
const functionLocation = location;
|
|
18188
|
+
if (isParameter(lastLocation) && functionLocation.body && result.valueDeclaration && result.valueDeclaration.pos >= functionLocation.body.pos && result.valueDeclaration.end <= functionLocation.body.end) {
|
|
18189
|
+
if (target >= 2 /* ES2015 */) {
|
|
18190
|
+
let declarationRequiresScopeChange = getRequiresScopeChangeCache(functionLocation);
|
|
18191
|
+
if (declarationRequiresScopeChange === void 0) {
|
|
18192
|
+
declarationRequiresScopeChange = forEach(functionLocation.parameters, requiresScopeChange) || false;
|
|
18193
|
+
setRequiresScopeChangeCache(functionLocation, declarationRequiresScopeChange);
|
|
18194
|
+
}
|
|
18195
|
+
return !declarationRequiresScopeChange;
|
|
18196
|
+
}
|
|
18197
|
+
}
|
|
18198
|
+
return false;
|
|
18199
|
+
function requiresScopeChange(node) {
|
|
18200
|
+
return requiresScopeChangeWorker(node.name) || !!node.initializer && requiresScopeChangeWorker(node.initializer);
|
|
18201
|
+
}
|
|
18202
|
+
function requiresScopeChangeWorker(node) {
|
|
18203
|
+
switch (node.kind) {
|
|
18204
|
+
case 219 /* ArrowFunction */:
|
|
18205
|
+
case 218 /* FunctionExpression */:
|
|
18206
|
+
case 262 /* FunctionDeclaration */:
|
|
18207
|
+
case 176 /* Constructor */:
|
|
18208
|
+
return false;
|
|
18209
|
+
case 174 /* MethodDeclaration */:
|
|
18210
|
+
case 177 /* GetAccessor */:
|
|
18211
|
+
case 178 /* SetAccessor */:
|
|
18212
|
+
case 303 /* PropertyAssignment */:
|
|
18213
|
+
return requiresScopeChangeWorker(node.name);
|
|
18214
|
+
case 172 /* PropertyDeclaration */:
|
|
18215
|
+
if (hasStaticModifier(node)) {
|
|
18216
|
+
return !emitStandardClassFields;
|
|
18217
|
+
}
|
|
18218
|
+
return requiresScopeChangeWorker(node.name);
|
|
18219
|
+
default:
|
|
18220
|
+
if (isNullishCoalesce(node) || isOptionalChain(node)) {
|
|
18221
|
+
return target < 7 /* ES2020 */;
|
|
18222
|
+
}
|
|
18223
|
+
if (isBindingElement(node) && node.dotDotDotToken && isObjectBindingPattern(node.parent)) {
|
|
18224
|
+
return target < 4 /* ES2017 */;
|
|
18225
|
+
}
|
|
18226
|
+
if (isTypeNode(node))
|
|
18227
|
+
return false;
|
|
18228
|
+
return forEachChild(node, requiresScopeChangeWorker) || false;
|
|
18229
|
+
}
|
|
18230
|
+
}
|
|
18231
|
+
}
|
|
18232
|
+
function getIsDeferredContext(location, lastLocation) {
|
|
18233
|
+
if (location.kind !== 219 /* ArrowFunction */ && location.kind !== 218 /* FunctionExpression */) {
|
|
18234
|
+
return isTypeQueryNode(location) || (isFunctionLikeDeclaration(location) || location.kind === 172 /* PropertyDeclaration */ && !isStatic(location)) && (!lastLocation || lastLocation !== location.name);
|
|
18235
|
+
}
|
|
18236
|
+
if (lastLocation && lastLocation === location.name) {
|
|
18237
|
+
return false;
|
|
18238
|
+
}
|
|
18239
|
+
if (location.asteriskToken || hasSyntacticModifier(location, 1024 /* Async */)) {
|
|
18240
|
+
return true;
|
|
18241
|
+
}
|
|
18242
|
+
return !getImmediatelyInvokedFunctionExpression(location);
|
|
18243
|
+
}
|
|
18244
|
+
function isSelfReferenceLocation(node) {
|
|
18245
|
+
switch (node.kind) {
|
|
18246
|
+
case 262 /* FunctionDeclaration */:
|
|
18247
|
+
case 263 /* ClassDeclaration */:
|
|
18248
|
+
case 264 /* InterfaceDeclaration */:
|
|
18249
|
+
case 266 /* EnumDeclaration */:
|
|
18250
|
+
case 265 /* TypeAliasDeclaration */:
|
|
18251
|
+
case 267 /* ModuleDeclaration */:
|
|
18252
|
+
return true;
|
|
18253
|
+
default:
|
|
18254
|
+
return false;
|
|
18255
|
+
}
|
|
18256
|
+
}
|
|
18257
|
+
function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
|
|
18258
|
+
if (symbol.declarations) {
|
|
18259
|
+
for (const decl of symbol.declarations) {
|
|
18260
|
+
if (decl.kind === 168 /* TypeParameter */) {
|
|
18261
|
+
const parent = isJSDocTemplateTag(decl.parent) ? getJSDocHost(decl.parent) : decl.parent;
|
|
18262
|
+
if (parent === container) {
|
|
18263
|
+
return !(isJSDocTemplateTag(decl.parent) && find(decl.parent.parent.tags, isJSDocTypeAlias));
|
|
18264
|
+
}
|
|
18265
|
+
}
|
|
18266
|
+
}
|
|
18267
|
+
}
|
|
18268
|
+
return false;
|
|
18269
|
+
}
|
|
18270
|
+
}
|
|
17823
18271
|
|
|
17824
18272
|
// src/compiler/factory/baseNodeFactory.ts
|
|
17825
18273
|
function createBaseNodeFactory() {
|
|
@@ -25171,7 +25619,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
|
|
|
25171
25619
|
if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
25172
25620
|
let namedBindings;
|
|
25173
25621
|
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
25174
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || sourceFile
|
|
25622
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || getImpliedNodeFormatForEmitWorker(sourceFile, compilerOptions) === 99 /* ESNext */) {
|
|
25175
25623
|
const helpers = getEmitHelpers(sourceFile);
|
|
25176
25624
|
if (helpers) {
|
|
25177
25625
|
const helperNames = [];
|
|
@@ -25236,8 +25684,7 @@ function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOp
|
|
|
25236
25684
|
if (externalHelpersModuleName) {
|
|
25237
25685
|
return externalHelpersModuleName;
|
|
25238
25686
|
}
|
|
25239
|
-
|
|
25240
|
-
let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || node.impliedNodeFormat === 1 /* CommonJS */);
|
|
25687
|
+
let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && getEmitModuleFormatOfFileWorker(node, compilerOptions) < 4 /* System */;
|
|
25241
25688
|
if (!create) {
|
|
25242
25689
|
const helpers = getEmitHelpers(node);
|
|
25243
25690
|
if (helpers) {
|
|
@@ -34253,6 +34700,7 @@ var targetOptionDeclaration = {
|
|
|
34253
34700
|
es2020: 7 /* ES2020 */,
|
|
34254
34701
|
es2021: 8 /* ES2021 */,
|
|
34255
34702
|
es2022: 9 /* ES2022 */,
|
|
34703
|
+
es2023: 10 /* ES2023 */,
|
|
34256
34704
|
esnext: 99 /* ESNext */
|
|
34257
34705
|
})),
|
|
34258
34706
|
affectsSourceFile: true,
|
|
@@ -42631,13 +43079,15 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu
|
|
|
42631
43079
|
}
|
|
42632
43080
|
|
|
42633
43081
|
// src/compiler/moduleSpecifiers.ts
|
|
42634
|
-
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
43082
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
42635
43083
|
const filePreferredEnding = getPreferredEnding();
|
|
42636
43084
|
return {
|
|
42637
43085
|
relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */,
|
|
42638
43086
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
42639
|
-
const
|
|
42640
|
-
|
|
43087
|
+
const impliedNodeFormat = getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions);
|
|
43088
|
+
const preferredEnding = syntaxImpliedNodeFormat !== impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
|
|
43089
|
+
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
43090
|
+
if ((syntaxImpliedNodeFormat ?? impliedNodeFormat) === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
|
|
42641
43091
|
if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
|
|
42642
43092
|
return [3 /* TsExtension */, 2 /* JsExtension */];
|
|
42643
43093
|
}
|
|
@@ -42670,7 +43120,7 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
|
|
|
42670
43120
|
}
|
|
42671
43121
|
return getModuleSpecifierEndingPreference(
|
|
42672
43122
|
importModuleSpecifierEnding,
|
|
42673
|
-
resolutionMode ?? importingSourceFile
|
|
43123
|
+
resolutionMode ?? getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions),
|
|
42674
43124
|
compilerOptions,
|
|
42675
43125
|
isFullSourceFile(importingSourceFile) ? importingSourceFile : void 0
|
|
42676
43126
|
);
|
|
@@ -42731,14 +43181,17 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
42731
43181
|
}
|
|
42732
43182
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
42733
43183
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
42734
|
-
const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
43184
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, host, compilerOptions, importingSourceFile);
|
|
42735
43185
|
const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, (modulePath) => forEach(
|
|
42736
43186
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
42737
43187
|
(reason) => {
|
|
42738
43188
|
if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path)
|
|
42739
43189
|
return void 0;
|
|
42740
|
-
|
|
43190
|
+
const existingMode = host.getModeForResolutionAtIndex(importingSourceFile, reason.index);
|
|
43191
|
+
const targetMode = options.overrideImportMode ?? host.getDefaultResolutionModeForFile(importingSourceFile);
|
|
43192
|
+
if (existingMode !== targetMode && existingMode !== void 0 && targetMode !== void 0) {
|
|
42741
43193
|
return void 0;
|
|
43194
|
+
}
|
|
42742
43195
|
const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
|
|
42743
43196
|
return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
|
|
42744
43197
|
}
|
|
@@ -43233,7 +43686,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
43233
43686
|
if (!parts) {
|
|
43234
43687
|
return void 0;
|
|
43235
43688
|
}
|
|
43236
|
-
const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
|
|
43689
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, host, options, importingSourceFile);
|
|
43237
43690
|
const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
|
|
43238
43691
|
let moduleSpecifier = path;
|
|
43239
43692
|
let isPackageRootPath = false;
|
|
@@ -43284,7 +43737,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
43284
43737
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
43285
43738
|
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
43286
43739
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
|
|
43287
|
-
const importMode = overrideMode || importingSourceFile
|
|
43740
|
+
const importMode = overrideMode || getDefaultResolutionModeForFile(importingSourceFile, host, options);
|
|
43288
43741
|
if (getResolvePackageJsonExports(options)) {
|
|
43289
43742
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
43290
43743
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
@@ -43436,6 +43889,9 @@ function getRelativePathIfInSameVolume(path, directoryPath, getCanonicalFileName
|
|
|
43436
43889
|
function isPathRelativeToParent(path) {
|
|
43437
43890
|
return startsWith(path, "..");
|
|
43438
43891
|
}
|
|
43892
|
+
function getDefaultResolutionModeForFile(file, host, compilerOptions) {
|
|
43893
|
+
return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
|
|
43894
|
+
}
|
|
43439
43895
|
|
|
43440
43896
|
// src/compiler/checker.ts
|
|
43441
43897
|
var ambientModuleSymbolRegex = /^".+"$/;
|
|
@@ -43646,6 +44102,31 @@ function createTypeChecker(host) {
|
|
|
43646
44102
|
var lastGetCombinedNodeFlagsResult = 0 /* None */;
|
|
43647
44103
|
var lastGetCombinedModifierFlagsNode;
|
|
43648
44104
|
var lastGetCombinedModifierFlagsResult = 0 /* None */;
|
|
44105
|
+
var resolveName = createNameResolver({
|
|
44106
|
+
compilerOptions,
|
|
44107
|
+
requireSymbol,
|
|
44108
|
+
argumentsSymbol,
|
|
44109
|
+
globals,
|
|
44110
|
+
getSymbolOfDeclaration,
|
|
44111
|
+
error,
|
|
44112
|
+
getRequiresScopeChangeCache,
|
|
44113
|
+
setRequiresScopeChangeCache,
|
|
44114
|
+
lookup: getSymbol,
|
|
44115
|
+
onPropertyWithInvalidInitializer: checkAndReportErrorForInvalidInitializer,
|
|
44116
|
+
onFailedToResolveSymbol,
|
|
44117
|
+
onSuccessfullyResolvedSymbol
|
|
44118
|
+
});
|
|
44119
|
+
var resolveNameForSymbolSuggestion = createNameResolver({
|
|
44120
|
+
compilerOptions,
|
|
44121
|
+
requireSymbol,
|
|
44122
|
+
argumentsSymbol,
|
|
44123
|
+
globals,
|
|
44124
|
+
getSymbolOfDeclaration,
|
|
44125
|
+
error,
|
|
44126
|
+
getRequiresScopeChangeCache,
|
|
44127
|
+
setRequiresScopeChangeCache,
|
|
44128
|
+
lookup: getSuggestionForSymbolNameLookup
|
|
44129
|
+
});
|
|
43649
44130
|
const checker = {
|
|
43650
44131
|
getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
|
|
43651
44132
|
getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0),
|
|
@@ -43951,8 +44432,6 @@ function createTypeChecker(host) {
|
|
|
43951
44432
|
meaning,
|
|
43952
44433
|
/*nameNotFoundMessage*/
|
|
43953
44434
|
void 0,
|
|
43954
|
-
/*nameArg*/
|
|
43955
|
-
void 0,
|
|
43956
44435
|
/*isUse*/
|
|
43957
44436
|
false,
|
|
43958
44437
|
excludeGlobals
|
|
@@ -44982,9 +45461,6 @@ function createTypeChecker(host) {
|
|
|
44982
45461
|
const nodeId = getNodeId(node);
|
|
44983
45462
|
return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks());
|
|
44984
45463
|
}
|
|
44985
|
-
function isGlobalSourceFile(node) {
|
|
44986
|
-
return node.kind === 307 /* SourceFile */ && !isExternalOrCommonJsModule(node);
|
|
44987
|
-
}
|
|
44988
45464
|
function getSymbol(symbols, name, meaning) {
|
|
44989
45465
|
if (meaning) {
|
|
44990
45466
|
const symbol = getMergedSymbol(symbols.get(name));
|
|
@@ -45160,417 +45636,120 @@ function createTypeChecker(host) {
|
|
|
45160
45636
|
return ancestorChangingReferenceScope === void 0;
|
|
45161
45637
|
}
|
|
45162
45638
|
}
|
|
45163
|
-
function
|
|
45164
|
-
|
|
45165
|
-
|
|
45166
|
-
|
|
45167
|
-
|
|
45168
|
-
|
|
45169
|
-
|
|
45170
|
-
|
|
45171
|
-
|
|
45172
|
-
return
|
|
45639
|
+
function getRequiresScopeChangeCache(node) {
|
|
45640
|
+
return getNodeLinks(node).declarationRequiresScopeChange;
|
|
45641
|
+
}
|
|
45642
|
+
function setRequiresScopeChangeCache(node, value) {
|
|
45643
|
+
getNodeLinks(node).declarationRequiresScopeChange = value;
|
|
45644
|
+
}
|
|
45645
|
+
function checkAndReportErrorForInvalidInitializer(errorLocation, name, propertyWithInvalidInitializer, result) {
|
|
45646
|
+
if (!emitStandardClassFields) {
|
|
45647
|
+
if (errorLocation && !result && checkAndReportErrorForMissingPrefix(errorLocation, name, name)) {
|
|
45648
|
+
return true;
|
|
45173
45649
|
}
|
|
45650
|
+
error(
|
|
45651
|
+
errorLocation,
|
|
45652
|
+
errorLocation && propertyWithInvalidInitializer.type && textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos) ? Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor : Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor,
|
|
45653
|
+
declarationNameToString(propertyWithInvalidInitializer.name),
|
|
45654
|
+
diagnosticName(name)
|
|
45655
|
+
);
|
|
45656
|
+
return true;
|
|
45174
45657
|
}
|
|
45175
45658
|
return false;
|
|
45176
|
-
function requiresScopeChange(node) {
|
|
45177
|
-
return requiresScopeChangeWorker(node.name) || !!node.initializer && requiresScopeChangeWorker(node.initializer);
|
|
45178
|
-
}
|
|
45179
|
-
function requiresScopeChangeWorker(node) {
|
|
45180
|
-
switch (node.kind) {
|
|
45181
|
-
case 219 /* ArrowFunction */:
|
|
45182
|
-
case 218 /* FunctionExpression */:
|
|
45183
|
-
case 262 /* FunctionDeclaration */:
|
|
45184
|
-
case 176 /* Constructor */:
|
|
45185
|
-
return false;
|
|
45186
|
-
case 174 /* MethodDeclaration */:
|
|
45187
|
-
case 177 /* GetAccessor */:
|
|
45188
|
-
case 178 /* SetAccessor */:
|
|
45189
|
-
case 303 /* PropertyAssignment */:
|
|
45190
|
-
return requiresScopeChangeWorker(node.name);
|
|
45191
|
-
case 172 /* PropertyDeclaration */:
|
|
45192
|
-
if (hasStaticModifier(node)) {
|
|
45193
|
-
return !emitStandardClassFields;
|
|
45194
|
-
}
|
|
45195
|
-
return requiresScopeChangeWorker(node.name);
|
|
45196
|
-
default:
|
|
45197
|
-
if (isNullishCoalesce(node) || isOptionalChain(node)) {
|
|
45198
|
-
return target < 7 /* ES2020 */;
|
|
45199
|
-
}
|
|
45200
|
-
if (isBindingElement(node) && node.dotDotDotToken && isObjectBindingPattern(node.parent)) {
|
|
45201
|
-
return target < 4 /* ES2017 */;
|
|
45202
|
-
}
|
|
45203
|
-
if (isTypeNode(node))
|
|
45204
|
-
return false;
|
|
45205
|
-
return forEachChild(node, requiresScopeChangeWorker) || false;
|
|
45206
|
-
}
|
|
45207
|
-
}
|
|
45208
|
-
}
|
|
45209
|
-
function isConstAssertion(location) {
|
|
45210
|
-
return isAssertionExpression(location) && isConstTypeReference(location.type) || isJSDocTypeTag(location) && isConstTypeReference(location.typeExpression);
|
|
45211
|
-
}
|
|
45212
|
-
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals = false, getSpellingSuggestions = true) {
|
|
45213
|
-
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol);
|
|
45214
45659
|
}
|
|
45215
|
-
function
|
|
45216
|
-
|
|
45217
|
-
|
|
45218
|
-
|
|
45219
|
-
|
|
45220
|
-
|
|
45221
|
-
|
|
45222
|
-
|
|
45223
|
-
|
|
45224
|
-
|
|
45225
|
-
|
|
45226
|
-
|
|
45227
|
-
|
|
45228
|
-
|
|
45229
|
-
|
|
45230
|
-
|
|
45231
|
-
|
|
45232
|
-
|
|
45233
|
-
|
|
45234
|
-
|
|
45235
|
-
|
|
45236
|
-
|
|
45237
|
-
|
|
45238
|
-
|
|
45239
|
-
|
|
45240
|
-
|
|
45241
|
-
|
|
45242
|
-
|
|
45243
|
-
|
|
45244
|
-
|
|
45245
|
-
|
|
45246
|
-
|
|
45247
|
-
|
|
45248
|
-
|
|
45249
|
-
}
|
|
45250
|
-
} else if (location.kind === 194 /* ConditionalType */) {
|
|
45251
|
-
useResult = lastLocation === location.trueType;
|
|
45252
|
-
}
|
|
45253
|
-
if (useResult) {
|
|
45254
|
-
break loop;
|
|
45255
|
-
} else {
|
|
45256
|
-
result = void 0;
|
|
45660
|
+
function onFailedToResolveSymbol(errorLocation, nameArg, meaning, nameNotFoundMessage) {
|
|
45661
|
+
const name = isString(nameArg) ? nameArg : nameArg.escapedText;
|
|
45662
|
+
addLazyDiagnostic(() => {
|
|
45663
|
+
if (!errorLocation || errorLocation.parent.kind !== 324 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
|
|
45664
|
+
let suggestion;
|
|
45665
|
+
let suggestedLib;
|
|
45666
|
+
if (nameArg) {
|
|
45667
|
+
suggestedLib = getSuggestedLibForNonExistentName(nameArg);
|
|
45668
|
+
if (suggestedLib) {
|
|
45669
|
+
error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
|
|
45670
|
+
}
|
|
45671
|
+
}
|
|
45672
|
+
if (!suggestedLib && suggestionCount < maximumSuggestionCount) {
|
|
45673
|
+
suggestion = getSuggestedSymbolForNonexistentSymbol(errorLocation, name, meaning);
|
|
45674
|
+
const isGlobalScopeAugmentationDeclaration = (suggestion == null ? void 0 : suggestion.valueDeclaration) && isAmbientModule(suggestion.valueDeclaration) && isGlobalScopeAugmentation(suggestion.valueDeclaration);
|
|
45675
|
+
if (isGlobalScopeAugmentationDeclaration) {
|
|
45676
|
+
suggestion = void 0;
|
|
45677
|
+
}
|
|
45678
|
+
if (suggestion) {
|
|
45679
|
+
const suggestionName = symbolToString(suggestion);
|
|
45680
|
+
const isUncheckedJS = isUncheckedJSSuggestion(
|
|
45681
|
+
errorLocation,
|
|
45682
|
+
suggestion,
|
|
45683
|
+
/*excludeClasses*/
|
|
45684
|
+
false
|
|
45685
|
+
);
|
|
45686
|
+
const message = meaning === 1920 /* Namespace */ || nameArg && typeof nameArg !== "string" && nodeIsSynthesized(nameArg) ? Diagnostics.Cannot_find_namespace_0_Did_you_mean_1 : isUncheckedJS ? Diagnostics.Could_not_find_name_0_Did_you_mean_1 : Diagnostics.Cannot_find_name_0_Did_you_mean_1;
|
|
45687
|
+
const diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
|
|
45688
|
+
addErrorOrSuggestion(!isUncheckedJS, diagnostic);
|
|
45689
|
+
if (suggestion.valueDeclaration) {
|
|
45690
|
+
addRelatedInfo(
|
|
45691
|
+
diagnostic,
|
|
45692
|
+
createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName)
|
|
45693
|
+
);
|
|
45257
45694
|
}
|
|
45258
45695
|
}
|
|
45259
45696
|
}
|
|
45260
|
-
|
|
45261
|
-
|
|
45262
|
-
case 307 /* SourceFile */:
|
|
45263
|
-
if (!isExternalOrCommonJsModule(location))
|
|
45264
|
-
break;
|
|
45265
|
-
isInExternalModule = true;
|
|
45266
|
-
case 267 /* ModuleDeclaration */:
|
|
45267
|
-
const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
|
|
45268
|
-
if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
|
|
45269
|
-
if (result = moduleExports.get("default" /* Default */)) {
|
|
45270
|
-
const localSymbol = getLocalSymbolForExportDefault(result);
|
|
45271
|
-
if (localSymbol && result.flags & meaning && localSymbol.escapedName === name) {
|
|
45272
|
-
break loop;
|
|
45273
|
-
}
|
|
45274
|
-
result = void 0;
|
|
45275
|
-
}
|
|
45276
|
-
const moduleExport = moduleExports.get(name);
|
|
45277
|
-
if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && (getDeclarationOfKind(moduleExport, 281 /* ExportSpecifier */) || getDeclarationOfKind(moduleExport, 280 /* NamespaceExport */))) {
|
|
45278
|
-
break;
|
|
45279
|
-
}
|
|
45280
|
-
}
|
|
45281
|
-
if (name !== "default" /* Default */ && (result = lookup(moduleExports, name, meaning & 2623475 /* ModuleMember */))) {
|
|
45282
|
-
if (isSourceFile(location) && location.commonJsModuleIndicator && !((_b = result.declarations) == null ? void 0 : _b.some(isJSDocTypeAlias))) {
|
|
45283
|
-
result = void 0;
|
|
45284
|
-
} else {
|
|
45285
|
-
break loop;
|
|
45286
|
-
}
|
|
45287
|
-
}
|
|
45288
|
-
break;
|
|
45289
|
-
case 266 /* EnumDeclaration */:
|
|
45290
|
-
if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) {
|
|
45291
|
-
if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 33554432 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) {
|
|
45292
|
-
error(
|
|
45293
|
-
errorLocation,
|
|
45294
|
-
Diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead,
|
|
45295
|
-
unescapeLeadingUnderscores(name),
|
|
45296
|
-
isolatedModulesLikeFlagName,
|
|
45297
|
-
`${unescapeLeadingUnderscores(getSymbolOfNode(location).escapedName)}.${unescapeLeadingUnderscores(name)}`
|
|
45298
|
-
);
|
|
45299
|
-
}
|
|
45300
|
-
break loop;
|
|
45301
|
-
}
|
|
45302
|
-
break;
|
|
45303
|
-
case 172 /* PropertyDeclaration */:
|
|
45304
|
-
if (!isStatic(location)) {
|
|
45305
|
-
const ctor = findConstructorDeclaration(location.parent);
|
|
45306
|
-
if (ctor && ctor.locals) {
|
|
45307
|
-
if (lookup(ctor.locals, name, meaning & 111551 /* Value */)) {
|
|
45308
|
-
Debug.assertNode(location, isPropertyDeclaration);
|
|
45309
|
-
propertyWithInvalidInitializer = location;
|
|
45310
|
-
}
|
|
45311
|
-
}
|
|
45312
|
-
}
|
|
45313
|
-
break;
|
|
45314
|
-
case 263 /* ClassDeclaration */:
|
|
45315
|
-
case 231 /* ClassExpression */:
|
|
45316
|
-
case 264 /* InterfaceDeclaration */:
|
|
45317
|
-
if (result = lookup(getSymbolOfDeclaration(location).members || emptySymbols, name, meaning & 788968 /* Type */)) {
|
|
45318
|
-
if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
|
|
45319
|
-
result = void 0;
|
|
45320
|
-
break;
|
|
45321
|
-
}
|
|
45322
|
-
if (lastLocation && isStatic(lastLocation)) {
|
|
45323
|
-
if (nameNotFoundMessage) {
|
|
45324
|
-
error(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters);
|
|
45325
|
-
}
|
|
45326
|
-
return void 0;
|
|
45327
|
-
}
|
|
45328
|
-
break loop;
|
|
45329
|
-
}
|
|
45330
|
-
if (isClassExpression(location) && meaning & 32 /* Class */) {
|
|
45331
|
-
const className = location.name;
|
|
45332
|
-
if (className && name === className.escapedText) {
|
|
45333
|
-
result = location.symbol;
|
|
45334
|
-
break loop;
|
|
45335
|
-
}
|
|
45336
|
-
}
|
|
45337
|
-
break;
|
|
45338
|
-
case 233 /* ExpressionWithTypeArguments */:
|
|
45339
|
-
if (lastLocation === location.expression && location.parent.token === 96 /* ExtendsKeyword */) {
|
|
45340
|
-
const container = location.parent.parent;
|
|
45341
|
-
if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) {
|
|
45342
|
-
if (nameNotFoundMessage) {
|
|
45343
|
-
error(errorLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
|
|
45344
|
-
}
|
|
45345
|
-
return void 0;
|
|
45346
|
-
}
|
|
45347
|
-
}
|
|
45348
|
-
break;
|
|
45349
|
-
case 167 /* ComputedPropertyName */:
|
|
45350
|
-
grandparent = location.parent.parent;
|
|
45351
|
-
if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
|
|
45352
|
-
if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) {
|
|
45353
|
-
if (nameNotFoundMessage) {
|
|
45354
|
-
error(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
|
|
45355
|
-
}
|
|
45356
|
-
return void 0;
|
|
45357
|
-
}
|
|
45358
|
-
}
|
|
45359
|
-
break;
|
|
45360
|
-
case 219 /* ArrowFunction */:
|
|
45361
|
-
if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
|
|
45362
|
-
break;
|
|
45363
|
-
}
|
|
45364
|
-
case 174 /* MethodDeclaration */:
|
|
45365
|
-
case 176 /* Constructor */:
|
|
45366
|
-
case 177 /* GetAccessor */:
|
|
45367
|
-
case 178 /* SetAccessor */:
|
|
45368
|
-
case 262 /* FunctionDeclaration */:
|
|
45369
|
-
if (meaning & 3 /* Variable */ && name === "arguments") {
|
|
45370
|
-
result = argumentsSymbol;
|
|
45371
|
-
break loop;
|
|
45372
|
-
}
|
|
45373
|
-
break;
|
|
45374
|
-
case 218 /* FunctionExpression */:
|
|
45375
|
-
if (meaning & 3 /* Variable */ && name === "arguments") {
|
|
45376
|
-
result = argumentsSymbol;
|
|
45377
|
-
break loop;
|
|
45378
|
-
}
|
|
45379
|
-
if (meaning & 16 /* Function */) {
|
|
45380
|
-
const functionName = location.name;
|
|
45381
|
-
if (functionName && name === functionName.escapedText) {
|
|
45382
|
-
result = location.symbol;
|
|
45383
|
-
break loop;
|
|
45384
|
-
}
|
|
45385
|
-
}
|
|
45386
|
-
break;
|
|
45387
|
-
case 170 /* Decorator */:
|
|
45388
|
-
if (location.parent && location.parent.kind === 169 /* Parameter */) {
|
|
45389
|
-
location = location.parent;
|
|
45390
|
-
}
|
|
45391
|
-
if (location.parent && (isClassElement(location.parent) || location.parent.kind === 263 /* ClassDeclaration */)) {
|
|
45392
|
-
location = location.parent;
|
|
45393
|
-
}
|
|
45394
|
-
break;
|
|
45395
|
-
case 346 /* JSDocTypedefTag */:
|
|
45396
|
-
case 338 /* JSDocCallbackTag */:
|
|
45397
|
-
case 340 /* JSDocEnumTag */:
|
|
45398
|
-
case 351 /* JSDocImportTag */:
|
|
45399
|
-
const root = getJSDocRoot(location);
|
|
45400
|
-
if (root) {
|
|
45401
|
-
location = root.parent;
|
|
45402
|
-
}
|
|
45403
|
-
break;
|
|
45404
|
-
case 169 /* Parameter */:
|
|
45405
|
-
if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
|
|
45406
|
-
if (!associatedDeclarationForContainingInitializerOrBindingName) {
|
|
45407
|
-
associatedDeclarationForContainingInitializerOrBindingName = location;
|
|
45408
|
-
}
|
|
45409
|
-
}
|
|
45410
|
-
break;
|
|
45411
|
-
case 208 /* BindingElement */:
|
|
45412
|
-
if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
|
|
45413
|
-
if (isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
|
|
45414
|
-
associatedDeclarationForContainingInitializerOrBindingName = location;
|
|
45415
|
-
}
|
|
45416
|
-
}
|
|
45417
|
-
break;
|
|
45418
|
-
case 195 /* InferType */:
|
|
45419
|
-
if (meaning & 262144 /* TypeParameter */) {
|
|
45420
|
-
const parameterName = location.typeParameter.name;
|
|
45421
|
-
if (parameterName && name === parameterName.escapedText) {
|
|
45422
|
-
result = location.typeParameter.symbol;
|
|
45423
|
-
break loop;
|
|
45424
|
-
}
|
|
45425
|
-
}
|
|
45426
|
-
break;
|
|
45427
|
-
case 281 /* ExportSpecifier */:
|
|
45428
|
-
if (lastLocation && lastLocation === location.propertyName && location.parent.parent.moduleSpecifier) {
|
|
45429
|
-
location = location.parent.parent.parent;
|
|
45430
|
-
}
|
|
45431
|
-
break;
|
|
45432
|
-
}
|
|
45433
|
-
if (isSelfReferenceLocation(location)) {
|
|
45434
|
-
lastSelfReferenceLocation = location;
|
|
45435
|
-
}
|
|
45436
|
-
lastLocation = location;
|
|
45437
|
-
location = isJSDocTemplateTag(location) ? getEffectiveContainerForJSDocTemplateTag(location) || location.parent : isJSDocParameterTag(location) || isJSDocReturnTag(location) ? getHostSignatureFromJSDoc(location) || location.parent : location.parent;
|
|
45438
|
-
}
|
|
45439
|
-
if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
|
|
45440
|
-
result.isReferenced |= meaning;
|
|
45441
|
-
}
|
|
45442
|
-
if (!result) {
|
|
45443
|
-
if (lastLocation) {
|
|
45444
|
-
Debug.assertNode(lastLocation, isSourceFile);
|
|
45445
|
-
if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
|
|
45446
|
-
return lastLocation.symbol;
|
|
45697
|
+
if (!suggestion && !suggestedLib && nameArg) {
|
|
45698
|
+
error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
|
|
45447
45699
|
}
|
|
45700
|
+
suggestionCount++;
|
|
45448
45701
|
}
|
|
45449
|
-
|
|
45450
|
-
|
|
45451
|
-
|
|
45452
|
-
|
|
45453
|
-
|
|
45454
|
-
|
|
45455
|
-
|
|
45456
|
-
|
|
45457
|
-
|
|
45458
|
-
|
|
45459
|
-
|
|
45460
|
-
|
|
45702
|
+
});
|
|
45703
|
+
}
|
|
45704
|
+
function onSuccessfullyResolvedSymbol(errorLocation, result, meaning, lastLocation, associatedDeclarationForContainingInitializerOrBindingName, withinDeferredContext) {
|
|
45705
|
+
addLazyDiagnostic(() => {
|
|
45706
|
+
var _a;
|
|
45707
|
+
const name = result.escapedName;
|
|
45708
|
+
const isInExternalModule = lastLocation && isSourceFile(lastLocation) && isExternalOrCommonJsModule(lastLocation);
|
|
45709
|
+
if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
|
|
45710
|
+
const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
|
|
45711
|
+
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
|
|
45712
|
+
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
|
|
45713
|
+
}
|
|
45714
|
+
}
|
|
45715
|
+
if (isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(errorLocation.flags & 16777216 /* JSDoc */)) {
|
|
45716
|
+
const merged = getMergedSymbol(result);
|
|
45717
|
+
if (length(merged.declarations) && every(merged.declarations, (d) => isNamespaceExportDeclaration(d) || isSourceFile(d) && !!d.symbol.globalExports)) {
|
|
45718
|
+
errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, unescapeLeadingUnderscores(name));
|
|
45719
|
+
}
|
|
45720
|
+
}
|
|
45721
|
+
if (associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
|
|
45722
|
+
const candidate = getMergedSymbol(getLateBoundSymbol(result));
|
|
45723
|
+
const root = getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
|
|
45724
|
+
if (candidate === getSymbolOfDeclaration(associatedDeclarationForContainingInitializerOrBindingName)) {
|
|
45725
|
+
error(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
|
|
45726
|
+
} else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && getSymbol(root.parent.locals, candidate.escapedName, meaning) === candidate) {
|
|
45727
|
+
error(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation));
|
|
45728
|
+
}
|
|
45729
|
+
}
|
|
45730
|
+
if (errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
45731
|
+
const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* Value */);
|
|
45732
|
+
if (typeOnlyDeclaration) {
|
|
45733
|
+
const message = typeOnlyDeclaration.kind === 281 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ || typeOnlyDeclaration.kind === 280 /* NamespaceExport */ ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
45734
|
+
const unescapedName = unescapeLeadingUnderscores(name);
|
|
45735
|
+
addTypeOnlyDeclarationRelatedInfo(
|
|
45736
|
+
error(errorLocation, message, unescapedName),
|
|
45737
|
+
typeOnlyDeclaration,
|
|
45738
|
+
unescapedName
|
|
45739
|
+
);
|
|
45461
45740
|
}
|
|
45462
45741
|
}
|
|
45463
|
-
|
|
45464
|
-
|
|
45465
|
-
|
|
45466
|
-
|
|
45467
|
-
|
|
45468
|
-
|
|
45469
|
-
|
|
45470
|
-
diagnosticName(nameArg)
|
|
45471
|
-
);
|
|
45472
|
-
return true;
|
|
45473
|
-
}
|
|
45474
|
-
return false;
|
|
45475
|
-
}
|
|
45476
|
-
if (!result) {
|
|
45477
|
-
if (nameNotFoundMessage) {
|
|
45478
|
-
addLazyDiagnostic(() => {
|
|
45479
|
-
if (!errorLocation || errorLocation.parent.kind !== 324 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
|
|
45480
|
-
!checkAndReportErrorForInvalidInitializer() && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
|
|
45481
|
-
let suggestion;
|
|
45482
|
-
let suggestedLib;
|
|
45483
|
-
if (nameArg) {
|
|
45484
|
-
suggestedLib = getSuggestedLibForNonExistentName(nameArg);
|
|
45485
|
-
if (suggestedLib) {
|
|
45486
|
-
error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
|
|
45487
|
-
}
|
|
45488
|
-
}
|
|
45489
|
-
if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
|
|
45490
|
-
suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
|
|
45491
|
-
const isGlobalScopeAugmentationDeclaration = (suggestion == null ? void 0 : suggestion.valueDeclaration) && isAmbientModule(suggestion.valueDeclaration) && isGlobalScopeAugmentation(suggestion.valueDeclaration);
|
|
45492
|
-
if (isGlobalScopeAugmentationDeclaration) {
|
|
45493
|
-
suggestion = void 0;
|
|
45494
|
-
}
|
|
45495
|
-
if (suggestion) {
|
|
45496
|
-
const suggestionName = symbolToString(suggestion);
|
|
45497
|
-
const isUncheckedJS = isUncheckedJSSuggestion(
|
|
45498
|
-
originalLocation,
|
|
45499
|
-
suggestion,
|
|
45500
|
-
/*excludeClasses*/
|
|
45501
|
-
false
|
|
45502
|
-
);
|
|
45503
|
-
const message = meaning === 1920 /* Namespace */ || nameArg && typeof nameArg !== "string" && nodeIsSynthesized(nameArg) ? Diagnostics.Cannot_find_namespace_0_Did_you_mean_1 : isUncheckedJS ? Diagnostics.Could_not_find_name_0_Did_you_mean_1 : Diagnostics.Cannot_find_name_0_Did_you_mean_1;
|
|
45504
|
-
const diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
|
|
45505
|
-
addErrorOrSuggestion(!isUncheckedJS, diagnostic);
|
|
45506
|
-
if (suggestion.valueDeclaration) {
|
|
45507
|
-
addRelatedInfo(
|
|
45508
|
-
diagnostic,
|
|
45509
|
-
createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName)
|
|
45510
|
-
);
|
|
45511
|
-
}
|
|
45512
|
-
}
|
|
45513
|
-
}
|
|
45514
|
-
if (!suggestion && !suggestedLib && nameArg) {
|
|
45515
|
-
error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
|
|
45516
|
-
}
|
|
45517
|
-
suggestionCount++;
|
|
45518
|
-
}
|
|
45519
|
-
});
|
|
45520
|
-
}
|
|
45521
|
-
return void 0;
|
|
45522
|
-
} else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) {
|
|
45523
|
-
return void 0;
|
|
45524
|
-
}
|
|
45525
|
-
if (nameNotFoundMessage) {
|
|
45526
|
-
addLazyDiagnostic(() => {
|
|
45527
|
-
var _a2;
|
|
45528
|
-
if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
|
|
45529
|
-
const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
|
|
45530
|
-
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
|
|
45531
|
-
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
|
|
45532
|
-
}
|
|
45533
|
-
}
|
|
45534
|
-
if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 16777216 /* JSDoc */)) {
|
|
45535
|
-
const merged = getMergedSymbol(result);
|
|
45536
|
-
if (length(merged.declarations) && every(merged.declarations, (d) => isNamespaceExportDeclaration(d) || isSourceFile(d) && !!d.symbol.globalExports)) {
|
|
45537
|
-
errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, unescapeLeadingUnderscores(name));
|
|
45538
|
-
}
|
|
45539
|
-
}
|
|
45540
|
-
if (result && associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
|
|
45541
|
-
const candidate = getMergedSymbol(getLateBoundSymbol(result));
|
|
45542
|
-
const root = getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
|
|
45543
|
-
if (candidate === getSymbolOfDeclaration(associatedDeclarationForContainingInitializerOrBindingName)) {
|
|
45544
|
-
error(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
|
|
45545
|
-
} else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
|
|
45546
|
-
error(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation));
|
|
45547
|
-
}
|
|
45548
|
-
}
|
|
45549
|
-
if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
45550
|
-
const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* Value */);
|
|
45551
|
-
if (typeOnlyDeclaration) {
|
|
45552
|
-
const message = typeOnlyDeclaration.kind === 281 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ || typeOnlyDeclaration.kind === 280 /* NamespaceExport */ ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
45553
|
-
const unescapedName = unescapeLeadingUnderscores(name);
|
|
45554
|
-
addTypeOnlyDeclarationRelatedInfo(
|
|
45555
|
-
error(errorLocation, message, unescapedName),
|
|
45556
|
-
typeOnlyDeclaration,
|
|
45557
|
-
unescapedName
|
|
45558
|
-
);
|
|
45559
|
-
}
|
|
45560
|
-
}
|
|
45561
|
-
if (compilerOptions.isolatedModules && result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */) {
|
|
45562
|
-
const isGlobal = lookup(globals, name, meaning) === result;
|
|
45563
|
-
const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && lookup(lastLocation.locals, name, ~111551 /* Value */);
|
|
45564
|
-
if (nonValueSymbol) {
|
|
45565
|
-
const importDecl = (_a2 = nonValueSymbol.declarations) == null ? void 0 : _a2.find((d) => d.kind === 276 /* ImportSpecifier */ || d.kind === 273 /* ImportClause */ || d.kind === 274 /* NamespaceImport */ || d.kind === 271 /* ImportEqualsDeclaration */);
|
|
45566
|
-
if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
|
|
45567
|
-
error(importDecl, Diagnostics.Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled, unescapeLeadingUnderscores(name));
|
|
45568
|
-
}
|
|
45742
|
+
if (compilerOptions.isolatedModules && result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */) {
|
|
45743
|
+
const isGlobal = getSymbol(globals, name, meaning) === result;
|
|
45744
|
+
const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && getSymbol(lastLocation.locals, name, ~111551 /* Value */);
|
|
45745
|
+
if (nonValueSymbol) {
|
|
45746
|
+
const importDecl = (_a = nonValueSymbol.declarations) == null ? void 0 : _a.find((d) => d.kind === 276 /* ImportSpecifier */ || d.kind === 273 /* ImportClause */ || d.kind === 274 /* NamespaceImport */ || d.kind === 271 /* ImportEqualsDeclaration */);
|
|
45747
|
+
if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
|
|
45748
|
+
error(importDecl, Diagnostics.Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled, unescapeLeadingUnderscores(name));
|
|
45569
45749
|
}
|
|
45570
45750
|
}
|
|
45571
|
-
}
|
|
45572
|
-
}
|
|
45573
|
-
return result;
|
|
45751
|
+
}
|
|
45752
|
+
});
|
|
45574
45753
|
}
|
|
45575
45754
|
function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) {
|
|
45576
45755
|
if (!typeOnlyDeclaration)
|
|
@@ -45584,47 +45763,9 @@ function createTypeChecker(host) {
|
|
|
45584
45763
|
)
|
|
45585
45764
|
);
|
|
45586
45765
|
}
|
|
45587
|
-
function getIsDeferredContext(location, lastLocation) {
|
|
45588
|
-
if (location.kind !== 219 /* ArrowFunction */ && location.kind !== 218 /* FunctionExpression */) {
|
|
45589
|
-
return isTypeQueryNode(location) || (isFunctionLikeDeclaration(location) || location.kind === 172 /* PropertyDeclaration */ && !isStatic(location)) && (!lastLocation || lastLocation !== location.name);
|
|
45590
|
-
}
|
|
45591
|
-
if (lastLocation && lastLocation === location.name) {
|
|
45592
|
-
return false;
|
|
45593
|
-
}
|
|
45594
|
-
if (location.asteriskToken || hasSyntacticModifier(location, 1024 /* Async */)) {
|
|
45595
|
-
return true;
|
|
45596
|
-
}
|
|
45597
|
-
return !getImmediatelyInvokedFunctionExpression(location);
|
|
45598
|
-
}
|
|
45599
|
-
function isSelfReferenceLocation(node) {
|
|
45600
|
-
switch (node.kind) {
|
|
45601
|
-
case 262 /* FunctionDeclaration */:
|
|
45602
|
-
case 263 /* ClassDeclaration */:
|
|
45603
|
-
case 264 /* InterfaceDeclaration */:
|
|
45604
|
-
case 266 /* EnumDeclaration */:
|
|
45605
|
-
case 265 /* TypeAliasDeclaration */:
|
|
45606
|
-
case 267 /* ModuleDeclaration */:
|
|
45607
|
-
return true;
|
|
45608
|
-
default:
|
|
45609
|
-
return false;
|
|
45610
|
-
}
|
|
45611
|
-
}
|
|
45612
45766
|
function diagnosticName(nameArg) {
|
|
45613
45767
|
return isString(nameArg) ? unescapeLeadingUnderscores(nameArg) : declarationNameToString(nameArg);
|
|
45614
45768
|
}
|
|
45615
|
-
function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
|
|
45616
|
-
if (symbol.declarations) {
|
|
45617
|
-
for (const decl of symbol.declarations) {
|
|
45618
|
-
if (decl.kind === 168 /* TypeParameter */) {
|
|
45619
|
-
const parent = isJSDocTemplateTag(decl.parent) ? getJSDocHost(decl.parent) : decl.parent;
|
|
45620
|
-
if (parent === container) {
|
|
45621
|
-
return !(isJSDocTemplateTag(decl.parent) && find(decl.parent.parent.tags, isJSDocTypeAlias));
|
|
45622
|
-
}
|
|
45623
|
-
}
|
|
45624
|
-
}
|
|
45625
|
-
}
|
|
45626
|
-
return false;
|
|
45627
|
-
}
|
|
45628
45769
|
function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) {
|
|
45629
45770
|
if (!isIdentifier(errorLocation) || errorLocation.escapedText !== name || isTypeReferenceIdentifier(errorLocation) || isInTypeQuery(errorLocation)) {
|
|
45630
45771
|
return false;
|
|
@@ -45695,8 +45836,6 @@ function createTypeChecker(host) {
|
|
|
45695
45836
|
788968 /* Type */ & ~namespaceMeaning,
|
|
45696
45837
|
/*nameNotFoundMessage*/
|
|
45697
45838
|
void 0,
|
|
45698
|
-
/*nameArg*/
|
|
45699
|
-
void 0,
|
|
45700
45839
|
/*isUse*/
|
|
45701
45840
|
false
|
|
45702
45841
|
));
|
|
@@ -45730,8 +45869,6 @@ function createTypeChecker(host) {
|
|
|
45730
45869
|
~788968 /* Type */ & 111551 /* Value */,
|
|
45731
45870
|
/*nameNotFoundMessage*/
|
|
45732
45871
|
void 0,
|
|
45733
|
-
/*nameArg*/
|
|
45734
|
-
void 0,
|
|
45735
45872
|
/*isUse*/
|
|
45736
45873
|
false
|
|
45737
45874
|
));
|
|
@@ -45777,8 +45914,6 @@ function createTypeChecker(host) {
|
|
|
45777
45914
|
788968 /* Type */ & ~111551 /* Value */,
|
|
45778
45915
|
/*nameNotFoundMessage*/
|
|
45779
45916
|
void 0,
|
|
45780
|
-
/*nameArg*/
|
|
45781
|
-
void 0,
|
|
45782
45917
|
/*isUse*/
|
|
45783
45918
|
false
|
|
45784
45919
|
));
|
|
@@ -45830,8 +45965,6 @@ function createTypeChecker(host) {
|
|
|
45830
45965
|
1024 /* NamespaceModule */,
|
|
45831
45966
|
/*nameNotFoundMessage*/
|
|
45832
45967
|
void 0,
|
|
45833
|
-
/*nameArg*/
|
|
45834
|
-
void 0,
|
|
45835
45968
|
/*isUse*/
|
|
45836
45969
|
false
|
|
45837
45970
|
));
|
|
@@ -45850,8 +45983,6 @@ function createTypeChecker(host) {
|
|
|
45850
45983
|
1536 /* Module */,
|
|
45851
45984
|
/*nameNotFoundMessage*/
|
|
45852
45985
|
void 0,
|
|
45853
|
-
/*nameArg*/
|
|
45854
|
-
void 0,
|
|
45855
45986
|
/*isUse*/
|
|
45856
45987
|
false
|
|
45857
45988
|
));
|
|
@@ -45982,22 +46113,28 @@ function createTypeChecker(host) {
|
|
|
45982
46113
|
function isSyntacticDefault(node) {
|
|
45983
46114
|
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
45984
46115
|
}
|
|
45985
|
-
function
|
|
45986
|
-
return isStringLiteralLike(usage) ? host.
|
|
46116
|
+
function getEmitSyntaxForModuleSpecifierExpression(usage) {
|
|
46117
|
+
return isStringLiteralLike(usage) ? host.getEmitSyntaxForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
45987
46118
|
}
|
|
45988
46119
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
45989
46120
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
45990
46121
|
}
|
|
45991
|
-
function
|
|
45992
|
-
|
|
45993
|
-
|
|
46122
|
+
function isOnlyImportableAsDefault(usage) {
|
|
46123
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
46124
|
+
const usageMode = getEmitSyntaxForModuleSpecifierExpression(usage);
|
|
46125
|
+
return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
|
|
46126
|
+
}
|
|
46127
|
+
return false;
|
|
45994
46128
|
}
|
|
45995
46129
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
45996
|
-
const usageMode = file &&
|
|
45997
|
-
if (file && usageMode !== void 0
|
|
45998
|
-
const
|
|
45999
|
-
if (usageMode === 99 /* ESNext */
|
|
46000
|
-
return
|
|
46130
|
+
const usageMode = file && getEmitSyntaxForModuleSpecifierExpression(usage);
|
|
46131
|
+
if (file && usageMode !== void 0) {
|
|
46132
|
+
const targetMode = host.getImpliedNodeFormatForEmit(file);
|
|
46133
|
+
if (usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */ && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
46134
|
+
return true;
|
|
46135
|
+
}
|
|
46136
|
+
if (usageMode === 99 /* ESNext */ && targetMode === 99 /* ESNext */) {
|
|
46137
|
+
return false;
|
|
46001
46138
|
}
|
|
46002
46139
|
}
|
|
46003
46140
|
if (!allowSyntheticDefaultImports) {
|
|
@@ -46056,7 +46193,7 @@ function createTypeChecker(host) {
|
|
|
46056
46193
|
if (!specifier) {
|
|
46057
46194
|
return exportDefaultSymbol;
|
|
46058
46195
|
}
|
|
46059
|
-
const hasDefaultOnly =
|
|
46196
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(specifier);
|
|
46060
46197
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
46061
46198
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
46062
46199
|
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
@@ -46260,7 +46397,7 @@ function createTypeChecker(host) {
|
|
|
46260
46397
|
let symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
|
|
46261
46398
|
if (symbolFromModule === void 0 && name.escapedText === "default" /* Default */) {
|
|
46262
46399
|
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
46263
|
-
if (
|
|
46400
|
+
if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
46264
46401
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
46265
46402
|
}
|
|
46266
46403
|
}
|
|
@@ -46667,11 +46804,10 @@ function createTypeChecker(host) {
|
|
|
46667
46804
|
let left = getFirstIdentifier(node);
|
|
46668
46805
|
let symbol = resolveName(
|
|
46669
46806
|
left,
|
|
46670
|
-
left
|
|
46807
|
+
left,
|
|
46671
46808
|
111551 /* Value */,
|
|
46672
46809
|
/*nameNotFoundMessage*/
|
|
46673
46810
|
void 0,
|
|
46674
|
-
left,
|
|
46675
46811
|
/*isUse*/
|
|
46676
46812
|
true
|
|
46677
46813
|
);
|
|
@@ -46699,10 +46835,9 @@ function createTypeChecker(host) {
|
|
|
46699
46835
|
const symbolFromJSPrototype = isInJSFile(name) && !nodeIsSynthesized(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : void 0;
|
|
46700
46836
|
symbol = getMergedSymbol(resolveName(
|
|
46701
46837
|
location || name,
|
|
46702
|
-
name
|
|
46838
|
+
name,
|
|
46703
46839
|
meaning,
|
|
46704
46840
|
ignoreErrors || symbolFromJSPrototype ? void 0 : message,
|
|
46705
|
-
name,
|
|
46706
46841
|
/*isUse*/
|
|
46707
46842
|
true,
|
|
46708
46843
|
/*excludeGlobals*/
|
|
@@ -46798,11 +46933,10 @@ function createTypeChecker(host) {
|
|
|
46798
46933
|
if (secondaryLocation) {
|
|
46799
46934
|
return resolveName(
|
|
46800
46935
|
secondaryLocation,
|
|
46801
|
-
name
|
|
46936
|
+
name,
|
|
46802
46937
|
meaning,
|
|
46803
46938
|
/*nameNotFoundMessage*/
|
|
46804
46939
|
void 0,
|
|
46805
|
-
name,
|
|
46806
46940
|
/*isUse*/
|
|
46807
46941
|
true
|
|
46808
46942
|
);
|
|
@@ -46893,7 +47027,7 @@ function createTypeChecker(host) {
|
|
|
46893
47027
|
/*requireStringLiteralLikeArgument*/
|
|
46894
47028
|
true
|
|
46895
47029
|
) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, isImportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression) || ((_f = findAncestor(location, isExportDeclaration)) == null ? void 0 : _f.moduleSpecifier);
|
|
46896
|
-
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile
|
|
47030
|
+
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
|
|
46897
47031
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
46898
47032
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
46899
47033
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
@@ -47138,7 +47272,7 @@ function createTypeChecker(host) {
|
|
|
47138
47272
|
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
47139
47273
|
}
|
|
47140
47274
|
const targetFile = (_a = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
47141
|
-
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(
|
|
47275
|
+
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getEmitSyntaxForModuleSpecifierExpression(reference), host.getImpliedNodeFormatForEmit(targetFile));
|
|
47142
47276
|
if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
|
|
47143
47277
|
let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
47144
47278
|
if (!sigs || !sigs.length) {
|
|
@@ -47500,14 +47634,6 @@ function createTypeChecker(host) {
|
|
|
47500
47634
|
function symbolIsValue(symbol, includeTypeOnlyMembers) {
|
|
47501
47635
|
return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && getSymbolFlags(symbol, !includeTypeOnlyMembers) & 111551 /* Value */);
|
|
47502
47636
|
}
|
|
47503
|
-
function findConstructorDeclaration(node) {
|
|
47504
|
-
const members = node.members;
|
|
47505
|
-
for (const member of members) {
|
|
47506
|
-
if (member.kind === 176 /* Constructor */ && nodeIsPresent(member.body)) {
|
|
47507
|
-
return member;
|
|
47508
|
-
}
|
|
47509
|
-
}
|
|
47510
|
-
}
|
|
47511
47637
|
function createType(flags) {
|
|
47512
47638
|
var _a;
|
|
47513
47639
|
const result = new Type7(checker, flags);
|
|
@@ -47989,8 +48115,6 @@ function createTypeChecker(host) {
|
|
|
47989
48115
|
meaning,
|
|
47990
48116
|
/*nameNotFoundMessage*/
|
|
47991
48117
|
void 0,
|
|
47992
|
-
/*nameArg*/
|
|
47993
|
-
void 0,
|
|
47994
48118
|
/*isUse*/
|
|
47995
48119
|
false
|
|
47996
48120
|
);
|
|
@@ -49561,8 +49685,6 @@ function createTypeChecker(host) {
|
|
|
49561
49685
|
111551 /* Value */ | 1048576 /* ExportValue */,
|
|
49562
49686
|
/*nameNotFoundMessage*/
|
|
49563
49687
|
void 0,
|
|
49564
|
-
/*nameArg*/
|
|
49565
|
-
void 0,
|
|
49566
49688
|
/*isUse*/
|
|
49567
49689
|
true
|
|
49568
49690
|
);
|
|
@@ -49703,14 +49825,16 @@ function createTypeChecker(host) {
|
|
|
49703
49825
|
return symbol.escapedName.substring(1, symbol.escapedName.length - 1);
|
|
49704
49826
|
}
|
|
49705
49827
|
}
|
|
49706
|
-
if (!context.
|
|
49828
|
+
if (!context.enclosingFile || !context.tracker.moduleResolverHost) {
|
|
49707
49829
|
if (ambientModuleSymbolRegex.test(symbol.escapedName)) {
|
|
49708
49830
|
return symbol.escapedName.substring(1, symbol.escapedName.length - 1);
|
|
49709
49831
|
}
|
|
49710
49832
|
return getSourceFileOfNode(getNonAugmentationDeclaration(symbol)).fileName;
|
|
49711
49833
|
}
|
|
49712
|
-
const
|
|
49713
|
-
const
|
|
49834
|
+
const enclosingDeclaration = getOriginalNode(context.enclosingDeclaration);
|
|
49835
|
+
const originalModuleSpecifier = canHaveModuleSpecifier(enclosingDeclaration) ? tryGetModuleSpecifierFromDeclaration(enclosingDeclaration) : void 0;
|
|
49836
|
+
const contextFile = context.enclosingFile;
|
|
49837
|
+
const resolutionMode = overrideImportMode || originalModuleSpecifier && host.getModeForUsageLocation(contextFile, originalModuleSpecifier) || contextFile && host.getDefaultResolutionModeForFile(contextFile);
|
|
49714
49838
|
const cacheKey = createModeAwareCacheKey(contextFile.path, resolutionMode);
|
|
49715
49839
|
const links = getSymbolLinks(symbol);
|
|
49716
49840
|
let specifier = links.specifierCache && links.specifierCache.get(cacheKey);
|
|
@@ -49886,7 +50010,6 @@ function createTypeChecker(host) {
|
|
|
49886
50010
|
788968 /* Type */,
|
|
49887
50011
|
/*nameNotFoundMessage*/
|
|
49888
50012
|
void 0,
|
|
49889
|
-
escapedName,
|
|
49890
50013
|
/*isUse*/
|
|
49891
50014
|
false
|
|
49892
50015
|
);
|
|
@@ -50447,22 +50570,16 @@ function createTypeChecker(host) {
|
|
|
50447
50570
|
return p.name && isIdentifier(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`;
|
|
50448
50571
|
}
|
|
50449
50572
|
function rewriteModuleSpecifier(parent, lit) {
|
|
50450
|
-
if (context.bundled) {
|
|
50451
|
-
|
|
50452
|
-
|
|
50453
|
-
|
|
50454
|
-
|
|
50455
|
-
|
|
50456
|
-
getCanonicalFileName,
|
|
50457
|
-
getCurrentDirectory: () => context.tracker.moduleResolverHost.getCurrentDirectory(),
|
|
50458
|
-
getCommonSourceDirectory: () => context.tracker.moduleResolverHost.getCommonSourceDirectory()
|
|
50459
|
-
};
|
|
50460
|
-
const newName = getResolvedExternalModuleName(resolverHost, targetFile);
|
|
50461
|
-
return factory.createStringLiteral(newName);
|
|
50573
|
+
if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
|
|
50574
|
+
const targetFile = getExternalModuleFileFromDeclaration(parent);
|
|
50575
|
+
if (targetFile) {
|
|
50576
|
+
const newName = getSpecifierForModuleSymbol(targetFile.symbol, context);
|
|
50577
|
+
if (newName !== lit.text) {
|
|
50578
|
+
return setOriginalNode(factory.createStringLiteral(newName), lit);
|
|
50462
50579
|
}
|
|
50463
50580
|
}
|
|
50464
50581
|
}
|
|
50465
|
-
return lit;
|
|
50582
|
+
return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral);
|
|
50466
50583
|
}
|
|
50467
50584
|
}
|
|
50468
50585
|
}
|
|
@@ -52218,11 +52335,10 @@ function createTypeChecker(host) {
|
|
|
52218
52335
|
if (node.parent && node.parent.kind === 277 /* ExportAssignment */) {
|
|
52219
52336
|
exportSymbol = resolveName(
|
|
52220
52337
|
node,
|
|
52221
|
-
node
|
|
52338
|
+
node,
|
|
52222
52339
|
111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
|
|
52223
52340
|
/*nameNotFoundMessage*/
|
|
52224
52341
|
void 0,
|
|
52225
|
-
node,
|
|
52226
52342
|
/*isUse*/
|
|
52227
52343
|
false
|
|
52228
52344
|
);
|
|
@@ -52255,8 +52371,6 @@ function createTypeChecker(host) {
|
|
|
52255
52371
|
111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */,
|
|
52256
52372
|
/*nameNotFoundMessage*/
|
|
52257
52373
|
void 0,
|
|
52258
|
-
/*nameArg*/
|
|
52259
|
-
void 0,
|
|
52260
52374
|
/*isUse*/
|
|
52261
52375
|
false
|
|
52262
52376
|
);
|
|
@@ -56076,8 +56190,6 @@ function createTypeChecker(host) {
|
|
|
56076
56190
|
111551 /* Value */,
|
|
56077
56191
|
/*nameNotFoundMessage*/
|
|
56078
56192
|
void 0,
|
|
56079
|
-
/*nameArg*/
|
|
56080
|
-
void 0,
|
|
56081
56193
|
/*isUse*/
|
|
56082
56194
|
false
|
|
56083
56195
|
);
|
|
@@ -57111,12 +57223,9 @@ function createTypeChecker(host) {
|
|
|
57111
57223
|
name,
|
|
57112
57224
|
meaning,
|
|
57113
57225
|
diagnostic,
|
|
57114
|
-
name,
|
|
57115
57226
|
/*isUse*/
|
|
57116
57227
|
false,
|
|
57117
57228
|
/*excludeGlobals*/
|
|
57118
|
-
false,
|
|
57119
|
-
/*getSpellingSuggestions*/
|
|
57120
57229
|
false
|
|
57121
57230
|
);
|
|
57122
57231
|
}
|
|
@@ -64445,6 +64554,7 @@ function createTypeChecker(host) {
|
|
|
64445
64554
|
return type;
|
|
64446
64555
|
}
|
|
64447
64556
|
function reportWideningErrorsInType(type) {
|
|
64557
|
+
var _a;
|
|
64448
64558
|
let errorReported = false;
|
|
64449
64559
|
if (getObjectFlags(type) & 65536 /* ContainsWideningType */) {
|
|
64450
64560
|
if (type.flags & 1048576 /* Union */) {
|
|
@@ -64452,27 +64562,28 @@ function createTypeChecker(host) {
|
|
|
64452
64562
|
errorReported = true;
|
|
64453
64563
|
} else {
|
|
64454
64564
|
for (const t of type.types) {
|
|
64455
|
-
|
|
64456
|
-
errorReported = true;
|
|
64457
|
-
}
|
|
64565
|
+
errorReported || (errorReported = reportWideningErrorsInType(t));
|
|
64458
64566
|
}
|
|
64459
64567
|
}
|
|
64460
|
-
}
|
|
64461
|
-
if (isArrayOrTupleType(type)) {
|
|
64568
|
+
} else if (isArrayOrTupleType(type)) {
|
|
64462
64569
|
for (const t of getTypeArguments(type)) {
|
|
64463
|
-
|
|
64464
|
-
errorReported = true;
|
|
64465
|
-
}
|
|
64570
|
+
errorReported || (errorReported = reportWideningErrorsInType(t));
|
|
64466
64571
|
}
|
|
64467
|
-
}
|
|
64468
|
-
if (isObjectLiteralType(type)) {
|
|
64572
|
+
} else if (isObjectLiteralType(type)) {
|
|
64469
64573
|
for (const p of getPropertiesOfObjectType(type)) {
|
|
64470
64574
|
const t = getTypeOfSymbol(p);
|
|
64471
64575
|
if (getObjectFlags(t) & 65536 /* ContainsWideningType */) {
|
|
64472
|
-
|
|
64473
|
-
|
|
64576
|
+
errorReported = reportWideningErrorsInType(t);
|
|
64577
|
+
if (!errorReported) {
|
|
64578
|
+
const valueDeclaration = (_a = p.declarations) == null ? void 0 : _a.find((d) => {
|
|
64579
|
+
var _a2;
|
|
64580
|
+
return ((_a2 = d.symbol.valueDeclaration) == null ? void 0 : _a2.parent) === type.symbol.valueDeclaration;
|
|
64581
|
+
});
|
|
64582
|
+
if (valueDeclaration) {
|
|
64583
|
+
error(valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t)));
|
|
64584
|
+
errorReported = true;
|
|
64585
|
+
}
|
|
64474
64586
|
}
|
|
64475
|
-
errorReported = true;
|
|
64476
64587
|
}
|
|
64477
64588
|
}
|
|
64478
64589
|
}
|
|
@@ -64501,7 +64612,6 @@ function createTypeChecker(host) {
|
|
|
64501
64612
|
788968 /* Type */,
|
|
64502
64613
|
/*nameNotFoundMessage*/
|
|
64503
64614
|
void 0,
|
|
64504
|
-
param.name.escapedText,
|
|
64505
64615
|
/*isUse*/
|
|
64506
64616
|
true
|
|
64507
64617
|
) || originalKeywordKind && isTypeNodeKind(originalKeywordKind))) {
|
|
@@ -65723,10 +65833,9 @@ function createTypeChecker(host) {
|
|
|
65723
65833
|
if (!links.resolvedSymbol) {
|
|
65724
65834
|
links.resolvedSymbol = !nodeIsMissing(node) && resolveName(
|
|
65725
65835
|
node,
|
|
65726
|
-
node
|
|
65836
|
+
node,
|
|
65727
65837
|
111551 /* Value */ | 1048576 /* ExportValue */,
|
|
65728
65838
|
getCannotFindNameDiagnosticForName(node),
|
|
65729
|
-
node,
|
|
65730
65839
|
!isWriteOnlyAccess(node),
|
|
65731
65840
|
/*excludeGlobals*/
|
|
65732
65841
|
false
|
|
@@ -68962,7 +69071,6 @@ function createTypeChecker(host) {
|
|
|
68962
69071
|
111551 /* Value */,
|
|
68963
69072
|
/*nameNotFoundMessage*/
|
|
68964
69073
|
void 0,
|
|
68965
|
-
id.escapedText,
|
|
68966
69074
|
/*isUse*/
|
|
68967
69075
|
true
|
|
68968
69076
|
);
|
|
@@ -69012,8 +69120,6 @@ function createTypeChecker(host) {
|
|
|
69012
69120
|
111551 /* Value */,
|
|
69013
69121
|
/*nameNotFoundMessage*/
|
|
69014
69122
|
void 0,
|
|
69015
|
-
/*nameArg*/
|
|
69016
|
-
void 0,
|
|
69017
69123
|
/*isUse*/
|
|
69018
69124
|
true,
|
|
69019
69125
|
/*excludeGlobals*/
|
|
@@ -70390,7 +70496,6 @@ function createTypeChecker(host) {
|
|
|
70390
70496
|
1920 /* Namespace */,
|
|
70391
70497
|
/*nameNotFoundMessage*/
|
|
70392
70498
|
void 0,
|
|
70393
|
-
namespaceName,
|
|
70394
70499
|
/*isUse*/
|
|
70395
70500
|
false
|
|
70396
70501
|
);
|
|
@@ -70605,7 +70710,6 @@ function createTypeChecker(host) {
|
|
|
70605
70710
|
jsxFactoryNamespace,
|
|
70606
70711
|
111551 /* Value */,
|
|
70607
70712
|
jsxFactoryRefErr,
|
|
70608
|
-
jsxFactoryNamespace,
|
|
70609
70713
|
/*isUse*/
|
|
70610
70714
|
true
|
|
70611
70715
|
);
|
|
@@ -70625,7 +70729,6 @@ function createTypeChecker(host) {
|
|
|
70625
70729
|
localJsxNamespace,
|
|
70626
70730
|
111551 /* Value */,
|
|
70627
70731
|
jsxFactoryRefErr,
|
|
70628
|
-
localJsxNamespace,
|
|
70629
70732
|
/*isUse*/
|
|
70630
70733
|
true
|
|
70631
70734
|
);
|
|
@@ -71346,38 +71449,34 @@ function createTypeChecker(host) {
|
|
|
71346
71449
|
const suggestion = getSuggestedSymbolForNonexistentProperty(name, containingType);
|
|
71347
71450
|
return suggestion && symbolName(suggestion);
|
|
71348
71451
|
}
|
|
71452
|
+
function getSuggestionForSymbolNameLookup(symbols, name, meaning) {
|
|
71453
|
+
const symbol = getSymbol(symbols, name, meaning);
|
|
71454
|
+
if (symbol)
|
|
71455
|
+
return symbol;
|
|
71456
|
+
let candidates;
|
|
71457
|
+
if (symbols === globals) {
|
|
71458
|
+
const primitives = mapDefined(
|
|
71459
|
+
["string", "number", "boolean", "object", "bigint", "symbol"],
|
|
71460
|
+
(s) => symbols.has(s.charAt(0).toUpperCase() + s.slice(1)) ? createSymbol(524288 /* TypeAlias */, s) : void 0
|
|
71461
|
+
);
|
|
71462
|
+
candidates = primitives.concat(arrayFrom(symbols.values()));
|
|
71463
|
+
} else {
|
|
71464
|
+
candidates = arrayFrom(symbols.values());
|
|
71465
|
+
}
|
|
71466
|
+
return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning);
|
|
71467
|
+
}
|
|
71349
71468
|
function getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning) {
|
|
71350
71469
|
Debug.assert(outerName !== void 0, "outername should always be defined");
|
|
71351
|
-
const result =
|
|
71470
|
+
const result = resolveNameForSymbolSuggestion(
|
|
71352
71471
|
location,
|
|
71353
71472
|
outerName,
|
|
71354
71473
|
meaning,
|
|
71355
71474
|
/*nameNotFoundMessage*/
|
|
71356
71475
|
void 0,
|
|
71357
|
-
outerName,
|
|
71358
71476
|
/*isUse*/
|
|
71359
71477
|
false,
|
|
71360
71478
|
/*excludeGlobals*/
|
|
71361
|
-
false
|
|
71362
|
-
/*getSpellingSuggestions*/
|
|
71363
|
-
true,
|
|
71364
|
-
(symbols, name, meaning2) => {
|
|
71365
|
-
Debug.assertEqual(outerName, name, "name should equal outerName");
|
|
71366
|
-
const symbol = getSymbol(symbols, name, meaning2);
|
|
71367
|
-
if (symbol)
|
|
71368
|
-
return symbol;
|
|
71369
|
-
let candidates;
|
|
71370
|
-
if (symbols === globals) {
|
|
71371
|
-
const primitives = mapDefined(
|
|
71372
|
-
["string", "number", "boolean", "object", "bigint", "symbol"],
|
|
71373
|
-
(s) => symbols.has(s.charAt(0).toUpperCase() + s.slice(1)) ? createSymbol(524288 /* TypeAlias */, s) : void 0
|
|
71374
|
-
);
|
|
71375
|
-
candidates = primitives.concat(arrayFrom(symbols.values()));
|
|
71376
|
-
} else {
|
|
71377
|
-
candidates = arrayFrom(symbols.values());
|
|
71378
|
-
}
|
|
71379
|
-
return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning2);
|
|
71380
|
-
}
|
|
71479
|
+
false
|
|
71381
71480
|
);
|
|
71382
71481
|
return result;
|
|
71383
71482
|
}
|
|
@@ -72234,8 +72333,6 @@ function createTypeChecker(host) {
|
|
|
72234
72333
|
111551 /* Value */,
|
|
72235
72334
|
/*nameNotFoundMessage*/
|
|
72236
72335
|
void 0,
|
|
72237
|
-
/*nameArg*/
|
|
72238
|
-
void 0,
|
|
72239
72336
|
/*isUse*/
|
|
72240
72337
|
false
|
|
72241
72338
|
);
|
|
@@ -72575,6 +72672,7 @@ function createTypeChecker(host) {
|
|
|
72575
72672
|
candidateForTypeArgumentError = oldCandidateForTypeArgumentError;
|
|
72576
72673
|
}
|
|
72577
72674
|
function chooseOverload(candidates2, relation, isSingleNonGenericCandidate2, signatureHelpTrailingComma2 = false) {
|
|
72675
|
+
var _a, _b;
|
|
72578
72676
|
candidatesForArgumentError = void 0;
|
|
72579
72677
|
candidateForArgumentArityError = void 0;
|
|
72580
72678
|
candidateForTypeArgumentError = void 0;
|
|
@@ -72609,7 +72707,9 @@ function createTypeChecker(host) {
|
|
|
72609
72707
|
let checkCandidate;
|
|
72610
72708
|
let inferenceContext;
|
|
72611
72709
|
if (candidate.typeParameters) {
|
|
72612
|
-
|
|
72710
|
+
const paramLocation = (_b = (_a = candidate.typeParameters[0].symbol.declarations) == null ? void 0 : _a[0]) == null ? void 0 : _b.parent;
|
|
72711
|
+
const candidateParameterContext = paramLocation || (candidate.declaration && isConstructorDeclaration(candidate.declaration) ? candidate.declaration.parent : candidate.declaration);
|
|
72712
|
+
if (candidateParameterContext && findAncestor(node, (a) => a === candidateParameterContext)) {
|
|
72613
72713
|
candidate = getImplementationSignature(candidate);
|
|
72614
72714
|
}
|
|
72615
72715
|
let typeArgumentTypes;
|
|
@@ -73499,8 +73599,6 @@ function createTypeChecker(host) {
|
|
|
73499
73599
|
111551 /* Value */,
|
|
73500
73600
|
/*nameNotFoundMessage*/
|
|
73501
73601
|
void 0,
|
|
73502
|
-
/*nameArg*/
|
|
73503
|
-
void 0,
|
|
73504
73602
|
/*isUse*/
|
|
73505
73603
|
false
|
|
73506
73604
|
);
|
|
@@ -73557,7 +73655,7 @@ function createTypeChecker(host) {
|
|
|
73557
73655
|
return createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, emptyArray);
|
|
73558
73656
|
}
|
|
73559
73657
|
function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
|
|
73560
|
-
const hasDefaultOnly =
|
|
73658
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(moduleSpecifier);
|
|
73561
73659
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
73562
73660
|
const synthType = type;
|
|
73563
73661
|
if (!synthType.defaultOnlyType) {
|
|
@@ -73618,8 +73716,6 @@ function createTypeChecker(host) {
|
|
|
73618
73716
|
111551 /* Value */,
|
|
73619
73717
|
/*nameNotFoundMessage*/
|
|
73620
73718
|
void 0,
|
|
73621
|
-
/*nameArg*/
|
|
73622
|
-
void 0,
|
|
73623
73719
|
/*isUse*/
|
|
73624
73720
|
true
|
|
73625
73721
|
);
|
|
@@ -75955,7 +76051,6 @@ function createTypeChecker(host) {
|
|
|
75955
76051
|
788968 /* Type */,
|
|
75956
76052
|
/*nameNotFoundMessage*/
|
|
75957
76053
|
void 0,
|
|
75958
|
-
name,
|
|
75959
76054
|
/*isUse*/
|
|
75960
76055
|
false
|
|
75961
76056
|
);
|
|
@@ -78243,8 +78338,6 @@ function createTypeChecker(host) {
|
|
|
78243
78338
|
meaning,
|
|
78244
78339
|
/*nameNotFoundMessage*/
|
|
78245
78340
|
void 0,
|
|
78246
|
-
/*nameArg*/
|
|
78247
|
-
void 0,
|
|
78248
78341
|
/*isUse*/
|
|
78249
78342
|
true
|
|
78250
78343
|
);
|
|
@@ -78899,7 +78992,7 @@ function createTypeChecker(host) {
|
|
|
78899
78992
|
});
|
|
78900
78993
|
}
|
|
78901
78994
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
78902
|
-
if (
|
|
78995
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) >= 5 /* ES2015 */) {
|
|
78903
78996
|
return;
|
|
78904
78997
|
}
|
|
78905
78998
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -78996,8 +79089,6 @@ function createTypeChecker(host) {
|
|
|
78996
79089
|
3 /* Variable */,
|
|
78997
79090
|
/*nameNotFoundMessage*/
|
|
78998
79091
|
void 0,
|
|
78999
|
-
/*nameArg*/
|
|
79000
|
-
void 0,
|
|
79001
79092
|
/*isUse*/
|
|
79002
79093
|
false
|
|
79003
79094
|
);
|
|
@@ -80330,7 +80421,7 @@ function createTypeChecker(host) {
|
|
|
80330
80421
|
}
|
|
80331
80422
|
}
|
|
80332
80423
|
function checkClassNameCollisionWithObject(name) {
|
|
80333
|
-
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (
|
|
80424
|
+
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5 /* ES2015 */) {
|
|
80334
80425
|
error(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
|
|
80335
80426
|
}
|
|
80336
80427
|
}
|
|
@@ -81400,7 +81491,7 @@ function createTypeChecker(host) {
|
|
|
81400
81491
|
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
|
|
81401
81492
|
}
|
|
81402
81493
|
}
|
|
81403
|
-
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && (
|
|
81494
|
+
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(node.parent) === 1 /* CommonJS */) {
|
|
81404
81495
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
|
|
81405
81496
|
if (exportModifier) {
|
|
81406
81497
|
error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
@@ -81610,8 +81701,10 @@ function createTypeChecker(host) {
|
|
|
81610
81701
|
}
|
|
81611
81702
|
}
|
|
81612
81703
|
}
|
|
81613
|
-
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (
|
|
81704
|
+
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
81614
81705
|
error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
81706
|
+
} else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
81707
|
+
error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
|
|
81615
81708
|
}
|
|
81616
81709
|
}
|
|
81617
81710
|
if (isImportSpecifier(node)) {
|
|
@@ -81653,7 +81746,7 @@ function createTypeChecker(host) {
|
|
|
81653
81746
|
function checkImportBinding(node) {
|
|
81654
81747
|
checkCollisionsForDeclarationName(node, node.name);
|
|
81655
81748
|
checkAliasSymbol(node);
|
|
81656
|
-
if (node.kind === 276 /* ImportSpecifier */ && idText(node.propertyName || node.name) === "default" && getESModuleInterop(compilerOptions) &&
|
|
81749
|
+
if (node.kind === 276 /* ImportSpecifier */ && idText(node.propertyName || node.name) === "default" && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
|
|
81657
81750
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
81658
81751
|
}
|
|
81659
81752
|
}
|
|
@@ -81674,7 +81767,7 @@ function createTypeChecker(host) {
|
|
|
81674
81767
|
if (validForTypeAttributes && override) {
|
|
81675
81768
|
return;
|
|
81676
81769
|
}
|
|
81677
|
-
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier &&
|
|
81770
|
+
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier);
|
|
81678
81771
|
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
|
81679
81772
|
const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve;
|
|
81680
81773
|
return grammarErrorOnNode(node, message);
|
|
@@ -81707,7 +81800,7 @@ function createTypeChecker(host) {
|
|
|
81707
81800
|
if (importClause.namedBindings) {
|
|
81708
81801
|
if (importClause.namedBindings.kind === 274 /* NamespaceImport */) {
|
|
81709
81802
|
checkImportBinding(importClause.namedBindings);
|
|
81710
|
-
if (
|
|
81803
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && getESModuleInterop(compilerOptions)) {
|
|
81711
81804
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
81712
81805
|
}
|
|
81713
81806
|
} else {
|
|
@@ -81749,7 +81842,7 @@ function createTypeChecker(host) {
|
|
|
81749
81842
|
grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
|
|
81750
81843
|
}
|
|
81751
81844
|
} else {
|
|
81752
|
-
if (
|
|
81845
|
+
if (5 /* ES2015 */ <= moduleKind && moduleKind <= 99 /* ESNext */ && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
81753
81846
|
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
81754
81847
|
}
|
|
81755
81848
|
}
|
|
@@ -81778,7 +81871,7 @@ function createTypeChecker(host) {
|
|
|
81778
81871
|
} else if (node.exportClause) {
|
|
81779
81872
|
checkAliasSymbol(node.exportClause);
|
|
81780
81873
|
}
|
|
81781
|
-
if (
|
|
81874
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
|
|
81782
81875
|
if (node.exportClause) {
|
|
81783
81876
|
if (getESModuleInterop(compilerOptions)) {
|
|
81784
81877
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
@@ -81822,8 +81915,6 @@ function createTypeChecker(host) {
|
|
|
81822
81915
|
111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
|
|
81823
81916
|
/*nameNotFoundMessage*/
|
|
81824
81917
|
void 0,
|
|
81825
|
-
/*nameArg*/
|
|
81826
|
-
void 0,
|
|
81827
81918
|
/*isUse*/
|
|
81828
81919
|
true
|
|
81829
81920
|
);
|
|
@@ -81839,7 +81930,7 @@ function createTypeChecker(host) {
|
|
|
81839
81930
|
}
|
|
81840
81931
|
}
|
|
81841
81932
|
} else {
|
|
81842
|
-
if (getESModuleInterop(compilerOptions) &&
|
|
81933
|
+
if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && idText(node.propertyName || node.name) === "default") {
|
|
81843
81934
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
81844
81935
|
}
|
|
81845
81936
|
}
|
|
@@ -81865,7 +81956,7 @@ function createTypeChecker(host) {
|
|
|
81865
81956
|
if (typeAnnotationNode) {
|
|
81866
81957
|
checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
|
|
81867
81958
|
}
|
|
81868
|
-
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (
|
|
81959
|
+
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */;
|
|
81869
81960
|
if (node.expression.kind === 80 /* Identifier */) {
|
|
81870
81961
|
const id = node.expression;
|
|
81871
81962
|
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
@@ -81945,7 +82036,7 @@ function createTypeChecker(host) {
|
|
|
81945
82036
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
81946
82037
|
}
|
|
81947
82038
|
if (node.isExportEquals) {
|
|
81948
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node)
|
|
82039
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && host.getImpliedNodeFormatForEmit(getSourceFileOfNode(node)) === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && host.getImpliedNodeFormatForEmit(getSourceFileOfNode(node)) !== 1 /* CommonJS */)) {
|
|
81949
82040
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
81950
82041
|
} else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
|
|
81951
82042
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
@@ -83240,8 +83331,6 @@ function createTypeChecker(host) {
|
|
|
83240
83331
|
111551 /* Value */,
|
|
83241
83332
|
/*nameNotFoundMessage*/
|
|
83242
83333
|
void 0,
|
|
83243
|
-
/*nameArg*/
|
|
83244
|
-
void 0,
|
|
83245
83334
|
/*isUse*/
|
|
83246
83335
|
false
|
|
83247
83336
|
)) {
|
|
@@ -83633,8 +83722,6 @@ function createTypeChecker(host) {
|
|
|
83633
83722
|
111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */,
|
|
83634
83723
|
/*nameNotFoundMessage*/
|
|
83635
83724
|
void 0,
|
|
83636
|
-
/*nameArg*/
|
|
83637
|
-
void 0,
|
|
83638
83725
|
/*isUse*/
|
|
83639
83726
|
true
|
|
83640
83727
|
);
|
|
@@ -83650,13 +83737,9 @@ function createTypeChecker(host) {
|
|
|
83650
83737
|
111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */,
|
|
83651
83738
|
/*nameNotFoundMessage*/
|
|
83652
83739
|
void 0,
|
|
83653
|
-
/*nameArg*/
|
|
83654
|
-
void 0,
|
|
83655
83740
|
/*isUse*/
|
|
83656
83741
|
true,
|
|
83657
83742
|
/*excludeGlobals*/
|
|
83658
|
-
void 0,
|
|
83659
|
-
/*getSpellingSuggestions*/
|
|
83660
83743
|
void 0
|
|
83661
83744
|
);
|
|
83662
83745
|
}
|
|
@@ -84334,7 +84417,7 @@ function createTypeChecker(host) {
|
|
|
84334
84417
|
break;
|
|
84335
84418
|
case 95 /* ExportKeyword */:
|
|
84336
84419
|
if (compilerOptions.verbatimModuleSyntax && !(node.flags & 33554432 /* Ambient */) && node.kind !== 265 /* TypeAliasDeclaration */ && node.kind !== 264 /* InterfaceDeclaration */ && // ModuleDeclaration needs to be checked that it is uninstantiated later
|
|
84337
|
-
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && (
|
|
84420
|
+
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
84338
84421
|
return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
84339
84422
|
}
|
|
84340
84423
|
if (flags & 32 /* Export */) {
|
|
@@ -85245,7 +85328,7 @@ function createTypeChecker(host) {
|
|
|
85245
85328
|
const message = node.initializer ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type ? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations : Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
|
|
85246
85329
|
return grammarErrorOnNode(node.exclamationToken, message);
|
|
85247
85330
|
}
|
|
85248
|
-
if ((
|
|
85331
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
|
|
85249
85332
|
checkESModuleMarker(node.name);
|
|
85250
85333
|
}
|
|
85251
85334
|
return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name);
|
|
@@ -85732,7 +85815,9 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
|
|
|
85732
85815
|
isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
|
|
85733
85816
|
fileExists: (fileName) => host.fileExists(fileName),
|
|
85734
85817
|
getFileIncludeReasons: () => host.getFileIncludeReasons(),
|
|
85735
|
-
readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
|
|
85818
|
+
readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0,
|
|
85819
|
+
getDefaultResolutionModeForFile: (file) => host.getDefaultResolutionModeForFile(file),
|
|
85820
|
+
getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index)
|
|
85736
85821
|
};
|
|
85737
85822
|
}
|
|
85738
85823
|
var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
@@ -104978,6 +105063,9 @@ function transformModule(context) {
|
|
|
104978
105063
|
return updated;
|
|
104979
105064
|
}
|
|
104980
105065
|
function shouldEmitUnderscoreUnderscoreESModule() {
|
|
105066
|
+
if (hasJSFileExtension(currentSourceFile.fileName) && currentSourceFile.commonJsModuleIndicator && (!currentSourceFile.externalModuleIndicator || currentSourceFile.externalModuleIndicator === true)) {
|
|
105067
|
+
return false;
|
|
105068
|
+
}
|
|
104981
105069
|
if (!currentModuleInfo.exportEquals && isExternalModule(currentSourceFile)) {
|
|
104982
105070
|
return true;
|
|
104983
105071
|
}
|
|
@@ -105456,7 +105544,7 @@ function transformModule(context) {
|
|
|
105456
105544
|
case 354 /* PartiallyEmittedExpression */:
|
|
105457
105545
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
105458
105546
|
case 213 /* CallExpression */:
|
|
105459
|
-
if (isImportCall(node) && currentSourceFile
|
|
105547
|
+
if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
|
|
105460
105548
|
return visitImportCallExpression(node);
|
|
105461
105549
|
}
|
|
105462
105550
|
break;
|
|
@@ -108457,8 +108545,8 @@ function transformECMAScriptModule(context) {
|
|
|
108457
108545
|
}
|
|
108458
108546
|
}
|
|
108459
108547
|
|
|
108460
|
-
// src/compiler/transformers/module/
|
|
108461
|
-
function
|
|
108548
|
+
// src/compiler/transformers/module/impliedNodeFormatDependent.ts
|
|
108549
|
+
function transformImpliedNodeFormatDependentModule(context) {
|
|
108462
108550
|
const previousOnSubstituteNode = context.onSubstituteNode;
|
|
108463
108551
|
const previousOnEmitNode = context.onEmitNode;
|
|
108464
108552
|
const esmTransform = transformECMAScriptModule(context);
|
|
@@ -108469,6 +108557,7 @@ function transformNodeModule(context) {
|
|
|
108469
108557
|
const cjsTransform = transformModule(context);
|
|
108470
108558
|
const cjsOnSubstituteNode = context.onSubstituteNode;
|
|
108471
108559
|
const cjsOnEmitNode = context.onEmitNode;
|
|
108560
|
+
const getEmitModuleFormatOfFile = (file) => context.getEmitHost().getEmitModuleFormatOfFile(file);
|
|
108472
108561
|
context.onSubstituteNode = onSubstituteNode;
|
|
108473
108562
|
context.onEmitNode = onEmitNode;
|
|
108474
108563
|
context.enableSubstitution(307 /* SourceFile */);
|
|
@@ -108483,7 +108572,7 @@ function transformNodeModule(context) {
|
|
|
108483
108572
|
if (!currentSourceFile) {
|
|
108484
108573
|
return previousOnSubstituteNode(hint, node);
|
|
108485
108574
|
}
|
|
108486
|
-
if (currentSourceFile
|
|
108575
|
+
if (getEmitModuleFormatOfFile(currentSourceFile) >= 5 /* ES2015 */) {
|
|
108487
108576
|
return esmOnSubstituteNode(hint, node);
|
|
108488
108577
|
}
|
|
108489
108578
|
return cjsOnSubstituteNode(hint, node);
|
|
@@ -108496,13 +108585,13 @@ function transformNodeModule(context) {
|
|
|
108496
108585
|
if (!currentSourceFile) {
|
|
108497
108586
|
return previousOnEmitNode(hint, node, emitCallback);
|
|
108498
108587
|
}
|
|
108499
|
-
if (currentSourceFile
|
|
108588
|
+
if (getEmitModuleFormatOfFile(currentSourceFile) >= 5 /* ES2015 */) {
|
|
108500
108589
|
return esmOnEmitNode(hint, node, emitCallback);
|
|
108501
108590
|
}
|
|
108502
108591
|
return cjsOnEmitNode(hint, node, emitCallback);
|
|
108503
108592
|
}
|
|
108504
108593
|
function getModuleTransformForFile(file) {
|
|
108505
|
-
return file
|
|
108594
|
+
return getEmitModuleFormatOfFile(file) >= 5 /* ES2015 */ ? esmTransform : cjsTransform;
|
|
108506
108595
|
}
|
|
108507
108596
|
function transformSourceFile(node) {
|
|
108508
108597
|
if (node.isDeclarationFile) {
|
|
@@ -110405,17 +110494,18 @@ function isProcessedComponent(node) {
|
|
|
110405
110494
|
// src/compiler/transformer.ts
|
|
110406
110495
|
function getModuleTransformer(moduleKind) {
|
|
110407
110496
|
switch (moduleKind) {
|
|
110497
|
+
case 200 /* Preserve */:
|
|
110498
|
+
return transformECMAScriptModule;
|
|
110408
110499
|
case 99 /* ESNext */:
|
|
110409
110500
|
case 7 /* ES2022 */:
|
|
110410
110501
|
case 6 /* ES2020 */:
|
|
110411
110502
|
case 5 /* ES2015 */:
|
|
110412
|
-
case 200 /* Preserve */:
|
|
110413
|
-
return transformECMAScriptModule;
|
|
110414
|
-
case 4 /* System */:
|
|
110415
|
-
return transformSystemModule;
|
|
110416
110503
|
case 100 /* Node16 */:
|
|
110417
110504
|
case 199 /* NodeNext */:
|
|
110418
|
-
|
|
110505
|
+
case 1 /* CommonJS */:
|
|
110506
|
+
return transformImpliedNodeFormatDependentModule;
|
|
110507
|
+
case 4 /* System */:
|
|
110508
|
+
return transformSystemModule;
|
|
110419
110509
|
default:
|
|
110420
110510
|
return transformModule;
|
|
110421
110511
|
}
|
|
@@ -111139,6 +111229,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
111139
111229
|
newLine: compilerOptions.newLine,
|
|
111140
111230
|
noEmitHelpers: compilerOptions.noEmitHelpers,
|
|
111141
111231
|
module: getEmitModuleKind(compilerOptions),
|
|
111232
|
+
moduleResolution: getEmitModuleResolutionKind(compilerOptions),
|
|
111142
111233
|
target: getEmitScriptTarget(compilerOptions),
|
|
111143
111234
|
sourceMap: compilerOptions.sourceMap,
|
|
111144
111235
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
@@ -111201,6 +111292,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
111201
111292
|
newLine: compilerOptions.newLine,
|
|
111202
111293
|
noEmitHelpers: true,
|
|
111203
111294
|
module: compilerOptions.module,
|
|
111295
|
+
moduleResolution: compilerOptions.moduleResolution,
|
|
111204
111296
|
target: compilerOptions.target,
|
|
111205
111297
|
sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
|
|
111206
111298
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
@@ -116710,9 +116802,6 @@ function flattenDiagnosticMessageText(diag2, newLine, indent2 = 0) {
|
|
|
116710
116802
|
function getModeForFileReference(ref, containingFileMode) {
|
|
116711
116803
|
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
116712
116804
|
}
|
|
116713
|
-
function getModeForResolutionAtIndex(file, index, compilerOptions) {
|
|
116714
|
-
return getModeForUsageLocationWorker(file, getModuleNameStringLiteralAt(file, index), compilerOptions);
|
|
116715
|
-
}
|
|
116716
116805
|
function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
116717
116806
|
var _a;
|
|
116718
116807
|
if (isExportDeclaration(decl)) {
|
|
@@ -116727,7 +116816,6 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
|
|
|
116727
116816
|
return getModeForUsageLocationWorker(file, usage, compilerOptions);
|
|
116728
116817
|
}
|
|
116729
116818
|
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
116730
|
-
var _a;
|
|
116731
116819
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
|
|
116732
116820
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
116733
116821
|
if (isTypeOnly) {
|
|
@@ -116743,20 +116831,28 @@ function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
|
116743
116831
|
return override;
|
|
116744
116832
|
}
|
|
116745
116833
|
}
|
|
116746
|
-
if (compilerOptions &&
|
|
116747
|
-
return usage
|
|
116748
|
-
usage.parent,
|
|
116749
|
-
/*requireStringLiteralLikeArgument*/
|
|
116750
|
-
false
|
|
116751
|
-
) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
116834
|
+
if (compilerOptions && importSyntaxAffectsModuleResolution(compilerOptions)) {
|
|
116835
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions);
|
|
116752
116836
|
}
|
|
116753
|
-
|
|
116837
|
+
}
|
|
116838
|
+
function getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions) {
|
|
116839
|
+
var _a;
|
|
116840
|
+
if (!compilerOptions) {
|
|
116754
116841
|
return void 0;
|
|
116755
|
-
if (file.impliedNodeFormat !== 99 /* ESNext */) {
|
|
116756
|
-
return isImportCall(walkUpParenthesizedExpressions(usage.parent)) ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
116757
116842
|
}
|
|
116758
116843
|
const exprParentParent = (_a = walkUpParenthesizedExpressions(usage.parent)) == null ? void 0 : _a.parent;
|
|
116759
|
-
|
|
116844
|
+
if (exprParentParent && isImportEqualsDeclaration(exprParentParent) || isRequireCall(
|
|
116845
|
+
usage.parent,
|
|
116846
|
+
/*requireStringLiteralLikeArgument*/
|
|
116847
|
+
false
|
|
116848
|
+
)) {
|
|
116849
|
+
return 1 /* CommonJS */;
|
|
116850
|
+
}
|
|
116851
|
+
if (isImportCall(walkUpParenthesizedExpressions(usage.parent))) {
|
|
116852
|
+
return shouldTransformImportCallWorker(file, compilerOptions) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
116853
|
+
}
|
|
116854
|
+
const fileEmitMode = getEmitModuleFormatOfFileWorker(file, compilerOptions);
|
|
116855
|
+
return fileEmitMode === 1 /* CommonJS */ ? 1 /* CommonJS */ : emitModuleKindIsNonNodeESM(fileEmitMode) || fileEmitMode === 200 /* Preserve */ ? 99 /* ESNext */ : void 0;
|
|
116760
116856
|
}
|
|
116761
116857
|
function getResolutionModeOverride(node, grammarErrorOnNode) {
|
|
116762
116858
|
if (!node)
|
|
@@ -116816,7 +116912,7 @@ function getTypeReferenceResolutionName(entry) {
|
|
|
116816
116912
|
}
|
|
116817
116913
|
var typeReferenceResolutionNameAndModeGetter = {
|
|
116818
116914
|
getName: getTypeReferenceResolutionName,
|
|
116819
|
-
getMode: (entry, file) => getModeForFileReference(entry, file
|
|
116915
|
+
getMode: (entry, file, compilerOptions) => getModeForFileReference(entry, file && getDefaultResolutionModeForFileWorker(file, compilerOptions))
|
|
116820
116916
|
};
|
|
116821
116917
|
function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
116822
116918
|
return {
|
|
@@ -117000,13 +117096,7 @@ function getConfigFileParsingDiagnostics(configFileParseResult) {
|
|
|
117000
117096
|
return configFileParseResult.options.configFile ? [...configFileParseResult.options.configFile.parseDiagnostics, ...configFileParseResult.errors] : configFileParseResult.errors;
|
|
117001
117097
|
}
|
|
117002
117098
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
117003
|
-
|
|
117004
|
-
case 3 /* Node16 */:
|
|
117005
|
-
case 99 /* NodeNext */:
|
|
117006
|
-
return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
|
|
117007
|
-
default:
|
|
117008
|
-
return void 0;
|
|
117009
|
-
}
|
|
117099
|
+
return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
|
|
117010
117100
|
function lookupFromPackageJson() {
|
|
117011
117101
|
const state = getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
|
|
117012
117102
|
const packageJsonLocations = [];
|
|
@@ -117456,7 +117546,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117456
117546
|
isSourceFileFromExternalLibrary,
|
|
117457
117547
|
isSourceFileDefaultLibrary,
|
|
117458
117548
|
getModeForUsageLocation: getModeForUsageLocation2,
|
|
117459
|
-
|
|
117549
|
+
getEmitSyntaxForUsageLocation,
|
|
117550
|
+
getModeForResolutionAtIndex,
|
|
117460
117551
|
getSourceFileFromReference,
|
|
117461
117552
|
getLibFileFromReference,
|
|
117462
117553
|
sourceFileToPackageName,
|
|
@@ -117483,6 +117574,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117483
117574
|
forEachResolvedProjectReference: forEachResolvedProjectReference2,
|
|
117484
117575
|
isSourceOfProjectReferenceRedirect,
|
|
117485
117576
|
getRedirectReferenceForResolutionFromSourceOfProject,
|
|
117577
|
+
getCompilerOptionsForFile,
|
|
117578
|
+
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
117579
|
+
getEmitModuleFormatOfFile,
|
|
117580
|
+
getImpliedNodeFormatForEmit,
|
|
117581
|
+
shouldTransformImportCall,
|
|
117486
117582
|
emitBuildInfo,
|
|
117487
117583
|
fileExists,
|
|
117488
117584
|
readFile,
|
|
@@ -118046,6 +118142,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118046
118142
|
getSymlinkCache,
|
|
118047
118143
|
writeFile: writeFileCallback || writeFile2,
|
|
118048
118144
|
isEmitBlocked,
|
|
118145
|
+
shouldTransformImportCall,
|
|
118146
|
+
getEmitModuleFormatOfFile,
|
|
118147
|
+
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
118148
|
+
getModeForResolutionAtIndex,
|
|
118049
118149
|
readFile: (f) => host.readFile(f),
|
|
118050
118150
|
fileExists: (f) => {
|
|
118051
118151
|
const path = toPath3(f);
|
|
@@ -119081,10 +119181,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119081
119181
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
119082
119182
|
const fileName = toFileNameLowerCase(ref.fileName);
|
|
119083
119183
|
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
119084
|
-
const mode = ref.resolutionMode || file
|
|
119184
|
+
const mode = ref.resolutionMode || getDefaultResolutionModeForFile2(file);
|
|
119085
119185
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
119086
119186
|
}
|
|
119087
119187
|
}
|
|
119188
|
+
function getCompilerOptionsForFile(file) {
|
|
119189
|
+
var _a2;
|
|
119190
|
+
return ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
119191
|
+
}
|
|
119088
119192
|
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
|
|
119089
119193
|
var _a2, _b2;
|
|
119090
119194
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolution.resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : void 0 });
|
|
@@ -119232,13 +119336,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119232
119336
|
return host.getCanonicalFileName(fileName);
|
|
119233
119337
|
}
|
|
119234
119338
|
function processImportedModules(file) {
|
|
119235
|
-
var _a2;
|
|
119236
119339
|
collectExternalModuleReferences(file);
|
|
119237
119340
|
if (file.imports.length || file.moduleAugmentations.length) {
|
|
119238
119341
|
const moduleNames = getModuleNames(file);
|
|
119239
119342
|
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
119240
119343
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
119241
|
-
const optionsForFile = (
|
|
119344
|
+
const optionsForFile = getCompilerOptionsForFile(file);
|
|
119242
119345
|
const resolutionsInFile = createModeAwareCache();
|
|
119243
119346
|
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
119244
119347
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
@@ -119774,7 +119877,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119774
119877
|
fileIncludeReasons = void 0;
|
|
119775
119878
|
const location = locationReason && getReferencedFileLocation(program, locationReason);
|
|
119776
119879
|
const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
|
119777
|
-
const
|
|
119880
|
+
const optionsForFile = file && getCompilerOptionsForFile(file) || options;
|
|
119881
|
+
const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, optionsForFile);
|
|
119778
119882
|
const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
|
|
119779
119883
|
return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
|
|
119780
119884
|
function processReason(reason) {
|
|
@@ -120075,13 +120179,53 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120075
120179
|
return symlinks;
|
|
120076
120180
|
}
|
|
120077
120181
|
function getModeForUsageLocation2(file, usage) {
|
|
120078
|
-
|
|
120079
|
-
|
|
120080
|
-
|
|
120182
|
+
return getModeForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
|
|
120183
|
+
}
|
|
120184
|
+
function getEmitSyntaxForUsageLocation(file, usage) {
|
|
120185
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
|
|
120081
120186
|
}
|
|
120082
|
-
function
|
|
120187
|
+
function getModeForResolutionAtIndex(file, index) {
|
|
120083
120188
|
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
|
|
120084
120189
|
}
|
|
120190
|
+
function getDefaultResolutionModeForFile2(sourceFile) {
|
|
120191
|
+
return getDefaultResolutionModeForFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
120192
|
+
}
|
|
120193
|
+
function getImpliedNodeFormatForEmit(sourceFile) {
|
|
120194
|
+
return getImpliedNodeFormatForEmitWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
120195
|
+
}
|
|
120196
|
+
function getEmitModuleFormatOfFile(sourceFile) {
|
|
120197
|
+
return getEmitModuleFormatOfFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
120198
|
+
}
|
|
120199
|
+
function shouldTransformImportCall(sourceFile) {
|
|
120200
|
+
return shouldTransformImportCallWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
120201
|
+
}
|
|
120202
|
+
}
|
|
120203
|
+
function shouldTransformImportCallWorker(sourceFile, options) {
|
|
120204
|
+
const moduleKind = getEmitModuleKind(options);
|
|
120205
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || moduleKind === 200 /* Preserve */) {
|
|
120206
|
+
return false;
|
|
120207
|
+
}
|
|
120208
|
+
return getEmitModuleFormatOfFileWorker(sourceFile, options) < 5 /* ES2015 */;
|
|
120209
|
+
}
|
|
120210
|
+
function getEmitModuleFormatOfFileWorker(sourceFile, options) {
|
|
120211
|
+
return getImpliedNodeFormatForEmitWorker(sourceFile, options) ?? getEmitModuleKind(options);
|
|
120212
|
+
}
|
|
120213
|
+
function getImpliedNodeFormatForEmitWorker(sourceFile, options) {
|
|
120214
|
+
var _a, _b;
|
|
120215
|
+
const moduleKind = getEmitModuleKind(options);
|
|
120216
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
120217
|
+
return sourceFile.impliedNodeFormat;
|
|
120218
|
+
}
|
|
120219
|
+
if (sourceFile.impliedNodeFormat === 1 /* CommonJS */ && (((_a = sourceFile.packageJsonScope) == null ? void 0 : _a.contents.packageJsonContent.type) === "commonjs" || fileExtensionIsOneOf(sourceFile.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) {
|
|
120220
|
+
return 1 /* CommonJS */;
|
|
120221
|
+
}
|
|
120222
|
+
if (sourceFile.impliedNodeFormat === 99 /* ESNext */ && (((_b = sourceFile.packageJsonScope) == null ? void 0 : _b.contents.packageJsonContent.type) === "module" || fileExtensionIsOneOf(sourceFile.fileName, [".mjs" /* Mjs */, ".mts" /* Mts */]))) {
|
|
120223
|
+
return 99 /* ESNext */;
|
|
120224
|
+
}
|
|
120225
|
+
return void 0;
|
|
120226
|
+
}
|
|
120227
|
+
function getDefaultResolutionModeForFileWorker(sourceFile, options) {
|
|
120228
|
+
return importSyntaxAffectsModuleResolution(options) ? getImpliedNodeFormatForEmitWorker(sourceFile, options) : void 0;
|
|
120085
120229
|
}
|
|
120086
120230
|
function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
120087
120231
|
let setOfDeclarationDirectories;
|
|
@@ -122054,9 +122198,15 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
|
|
|
122054
122198
|
const nodeModulesIndex = failedLookupPathComponents.indexOf("node_modules");
|
|
122055
122199
|
if (nodeModulesIndex !== -1 && nodeModulesIndex + 1 <= perceivedOsRootLength + 1)
|
|
122056
122200
|
return void 0;
|
|
122201
|
+
const lastNodeModulesIndex = failedLookupPathComponents.lastIndexOf("node_modules");
|
|
122057
122202
|
if (isInDirectoryPath(rootPathComponents, failedLookupPathComponents)) {
|
|
122058
122203
|
if (failedLookupPathComponents.length > rootPathComponents.length + 1) {
|
|
122059
|
-
return getDirectoryOfFailedLookupWatch(
|
|
122204
|
+
return getDirectoryOfFailedLookupWatch(
|
|
122205
|
+
failedLookupComponents,
|
|
122206
|
+
failedLookupPathComponents,
|
|
122207
|
+
Math.max(rootPathComponents.length + 1, perceivedOsRootLength + 1),
|
|
122208
|
+
lastNodeModulesIndex
|
|
122209
|
+
);
|
|
122060
122210
|
} else {
|
|
122061
122211
|
return {
|
|
122062
122212
|
dir: rootDir,
|
|
@@ -122071,12 +122221,18 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
|
|
|
122071
122221
|
failedLookupPathComponents.length - 1,
|
|
122072
122222
|
perceivedOsRootLength,
|
|
122073
122223
|
nodeModulesIndex,
|
|
122074
|
-
rootPathComponents
|
|
122224
|
+
rootPathComponents,
|
|
122225
|
+
lastNodeModulesIndex
|
|
122075
122226
|
);
|
|
122076
122227
|
}
|
|
122077
|
-
function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents) {
|
|
122228
|
+
function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents, lastNodeModulesIndex) {
|
|
122078
122229
|
if (nodeModulesIndex !== -1) {
|
|
122079
|
-
return getDirectoryOfFailedLookupWatch(
|
|
122230
|
+
return getDirectoryOfFailedLookupWatch(
|
|
122231
|
+
dirComponents,
|
|
122232
|
+
dirPathComponents,
|
|
122233
|
+
nodeModulesIndex + 1,
|
|
122234
|
+
lastNodeModulesIndex
|
|
122235
|
+
);
|
|
122080
122236
|
}
|
|
122081
122237
|
let nonRecursive = true;
|
|
122082
122238
|
let length2 = dirPathComponentsLength;
|
|
@@ -122087,13 +122243,29 @@ function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dir
|
|
|
122087
122243
|
break;
|
|
122088
122244
|
}
|
|
122089
122245
|
}
|
|
122090
|
-
return getDirectoryOfFailedLookupWatch(
|
|
122246
|
+
return getDirectoryOfFailedLookupWatch(
|
|
122247
|
+
dirComponents,
|
|
122248
|
+
dirPathComponents,
|
|
122249
|
+
length2,
|
|
122250
|
+
lastNodeModulesIndex,
|
|
122251
|
+
nonRecursive
|
|
122252
|
+
);
|
|
122091
122253
|
}
|
|
122092
|
-
function getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, length2, nonRecursive) {
|
|
122254
|
+
function getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, length2, lastNodeModulesIndex, nonRecursive) {
|
|
122255
|
+
let packageDirLength;
|
|
122256
|
+
if (lastNodeModulesIndex !== -1 && lastNodeModulesIndex + 1 >= length2 && lastNodeModulesIndex + 2 < dirPathComponents.length) {
|
|
122257
|
+
if (!startsWith(dirPathComponents[lastNodeModulesIndex + 1], "@")) {
|
|
122258
|
+
packageDirLength = lastNodeModulesIndex + 2;
|
|
122259
|
+
} else if (lastNodeModulesIndex + 3 < dirPathComponents.length) {
|
|
122260
|
+
packageDirLength = lastNodeModulesIndex + 3;
|
|
122261
|
+
}
|
|
122262
|
+
}
|
|
122093
122263
|
return {
|
|
122094
122264
|
dir: getPathFromPathComponents(dirComponents, length2),
|
|
122095
122265
|
dirPath: getPathFromPathComponents(dirPathComponents, length2),
|
|
122096
|
-
nonRecursive
|
|
122266
|
+
nonRecursive,
|
|
122267
|
+
packageDir: packageDirLength !== void 0 ? getPathFromPathComponents(dirComponents, packageDirLength) : void 0,
|
|
122268
|
+
packageDirPath: packageDirLength !== void 0 ? getPathFromPathComponents(dirPathComponents, packageDirLength) : void 0
|
|
122097
122269
|
};
|
|
122098
122270
|
}
|
|
122099
122271
|
function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, filterCustomPath) {
|
|
@@ -122108,7 +122280,8 @@ function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootP
|
|
|
122108
122280
|
typeRootPathComponents.length,
|
|
122109
122281
|
perceivedOsRootLengthForWatching(typeRootPathComponents, typeRootPathComponents.length),
|
|
122110
122282
|
typeRootPathComponents.indexOf("node_modules"),
|
|
122111
|
-
rootPathComponents
|
|
122283
|
+
rootPathComponents,
|
|
122284
|
+
typeRootPathComponents.lastIndexOf("node_modules")
|
|
122112
122285
|
);
|
|
122113
122286
|
return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
|
|
122114
122287
|
}
|
|
@@ -122204,6 +122377,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122204
122377
|
const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
|
|
122205
122378
|
const rootPath = resolutionHost.toPath(rootDir);
|
|
122206
122379
|
const rootPathComponents = getPathComponents(rootPath);
|
|
122380
|
+
const isSymlinkCache = /* @__PURE__ */ new Map();
|
|
122381
|
+
const packageDirWatchers = /* @__PURE__ */ new Map();
|
|
122382
|
+
const dirPathToSymlinkPackageRefCount = /* @__PURE__ */ new Map();
|
|
122207
122383
|
const typeRootsWatches = /* @__PURE__ */ new Map();
|
|
122208
122384
|
return {
|
|
122209
122385
|
rootDirForResolution,
|
|
@@ -122215,6 +122391,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122215
122391
|
resolutionsWithOnlyAffectingLocations,
|
|
122216
122392
|
directoryWatchesOfFailedLookups,
|
|
122217
122393
|
fileWatchesOfAffectingLocations,
|
|
122394
|
+
packageDirWatchers,
|
|
122395
|
+
dirPathToSymlinkPackageRefCount,
|
|
122218
122396
|
watchFailedLookupLocationsOfExternalModuleResolutions,
|
|
122219
122397
|
getModuleResolutionCache: () => moduleResolutionCache,
|
|
122220
122398
|
startRecordingFilesWithChangedResolutions,
|
|
@@ -122249,6 +122427,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122249
122427
|
function clear2() {
|
|
122250
122428
|
clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
|
|
122251
122429
|
clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
|
|
122430
|
+
isSymlinkCache.clear();
|
|
122431
|
+
packageDirWatchers.clear();
|
|
122432
|
+
dirPathToSymlinkPackageRefCount.clear();
|
|
122252
122433
|
nonRelativeExternalModuleResolutions.clear();
|
|
122253
122434
|
closeTypeRootsWatch();
|
|
122254
122435
|
resolvedModuleNames.clear();
|
|
@@ -122315,6 +122496,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122315
122496
|
libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
122316
122497
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
122317
122498
|
nonRelativeExternalModuleResolutions.clear();
|
|
122499
|
+
isSymlinkCache.clear();
|
|
122318
122500
|
}
|
|
122319
122501
|
function cleanupLibResolutionWatching(newProgram) {
|
|
122320
122502
|
resolvedLibraries.forEach((resolution, libFileName) => {
|
|
@@ -122367,11 +122549,18 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122367
122549
|
}
|
|
122368
122550
|
directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
|
|
122369
122551
|
fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
|
|
122552
|
+
packageDirWatchers.forEach(closePackageDirWatcher);
|
|
122370
122553
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
122371
122554
|
moduleResolutionCache.isReadonly = true;
|
|
122372
122555
|
typeReferenceDirectiveResolutionCache.isReadonly = true;
|
|
122373
122556
|
libraryResolutionCache.isReadonly = true;
|
|
122374
122557
|
moduleResolutionCache.getPackageJsonInfoCache().isReadonly = true;
|
|
122558
|
+
isSymlinkCache.clear();
|
|
122559
|
+
}
|
|
122560
|
+
function closePackageDirWatcher(watcher, packageDirPath) {
|
|
122561
|
+
if (watcher.dirPathToWatcher.size === 0) {
|
|
122562
|
+
packageDirWatchers.delete(packageDirPath);
|
|
122563
|
+
}
|
|
122375
122564
|
}
|
|
122376
122565
|
function closeDirectoryWatchesOfFailedLookup(watcher, path) {
|
|
122377
122566
|
if (watcher.refCount === 0) {
|
|
@@ -122621,12 +122810,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122621
122810
|
getCurrentDirectory
|
|
122622
122811
|
);
|
|
122623
122812
|
if (toWatch) {
|
|
122624
|
-
const { dir, dirPath, nonRecursive } = toWatch;
|
|
122813
|
+
const { dir, dirPath, nonRecursive, packageDir, packageDirPath } = toWatch;
|
|
122625
122814
|
if (dirPath === rootPath) {
|
|
122626
122815
|
Debug.assert(nonRecursive);
|
|
122816
|
+
Debug.assert(!packageDir);
|
|
122627
122817
|
setAtRoot = true;
|
|
122628
122818
|
} else {
|
|
122629
|
-
setDirectoryWatcher(dir, dirPath, nonRecursive);
|
|
122819
|
+
setDirectoryWatcher(dir, dirPath, packageDir, packageDirPath, nonRecursive);
|
|
122630
122820
|
}
|
|
122631
122821
|
}
|
|
122632
122822
|
return setAtRoot;
|
|
@@ -122650,6 +122840,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122650
122840
|
setDirectoryWatcher(
|
|
122651
122841
|
rootDir,
|
|
122652
122842
|
rootPath,
|
|
122843
|
+
/*packageDir*/
|
|
122844
|
+
void 0,
|
|
122845
|
+
/*packageDirPath*/
|
|
122846
|
+
void 0,
|
|
122653
122847
|
/*nonRecursive*/
|
|
122654
122848
|
true
|
|
122655
122849
|
);
|
|
@@ -122750,14 +122944,68 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122750
122944
|
));
|
|
122751
122945
|
}
|
|
122752
122946
|
}
|
|
122753
|
-
function
|
|
122754
|
-
|
|
122947
|
+
function createDirectoryWatcherForPackageDir(dir, dirPath, packageDir, packageDirPath, nonRecursive) {
|
|
122948
|
+
Debug.assert(!nonRecursive);
|
|
122949
|
+
let isSymlink = isSymlinkCache.get(packageDirPath);
|
|
122950
|
+
let packageDirWatcher = packageDirWatchers.get(packageDirPath);
|
|
122951
|
+
if (isSymlink === void 0) {
|
|
122952
|
+
const realPath2 = resolutionHost.realpath(packageDir);
|
|
122953
|
+
isSymlink = realPath2 !== packageDir && resolutionHost.toPath(realPath2) !== packageDirPath;
|
|
122954
|
+
isSymlinkCache.set(packageDirPath, isSymlink);
|
|
122955
|
+
if (!packageDirWatcher) {
|
|
122956
|
+
packageDirWatchers.set(
|
|
122957
|
+
packageDirPath,
|
|
122958
|
+
packageDirWatcher = {
|
|
122959
|
+
dirPathToWatcher: /* @__PURE__ */ new Map(),
|
|
122960
|
+
isSymlink
|
|
122961
|
+
}
|
|
122962
|
+
);
|
|
122963
|
+
} else if (packageDirWatcher.isSymlink !== isSymlink) {
|
|
122964
|
+
packageDirWatcher.dirPathToWatcher.forEach((watcher) => {
|
|
122965
|
+
removeDirectoryWatcher(
|
|
122966
|
+
packageDirWatcher.isSymlink ? packageDirPath : dirPath,
|
|
122967
|
+
/*syncDirWatcherRemove*/
|
|
122968
|
+
false
|
|
122969
|
+
);
|
|
122970
|
+
watcher.watcher = createDirPathToWatcher();
|
|
122971
|
+
});
|
|
122972
|
+
packageDirWatcher.isSymlink = isSymlink;
|
|
122973
|
+
}
|
|
122974
|
+
} else {
|
|
122975
|
+
Debug.assertIsDefined(packageDirWatcher);
|
|
122976
|
+
Debug.assert(isSymlink === packageDirWatcher.isSymlink);
|
|
122977
|
+
}
|
|
122978
|
+
const forDirPath = packageDirWatcher.dirPathToWatcher.get(dirPath);
|
|
122979
|
+
if (forDirPath) {
|
|
122980
|
+
forDirPath.refCount++;
|
|
122981
|
+
} else {
|
|
122982
|
+
packageDirWatcher.dirPathToWatcher.set(dirPath, {
|
|
122983
|
+
watcher: createDirPathToWatcher(),
|
|
122984
|
+
refCount: 1
|
|
122985
|
+
});
|
|
122986
|
+
if (isSymlink)
|
|
122987
|
+
dirPathToSymlinkPackageRefCount.set(dirPath, (dirPathToSymlinkPackageRefCount.get(dirPath) ?? 0) + 1);
|
|
122988
|
+
}
|
|
122989
|
+
function createDirPathToWatcher() {
|
|
122990
|
+
return isSymlink ? createOrAddRefToDirectoryWatchOfFailedLookups(packageDir, packageDirPath, nonRecursive) : createOrAddRefToDirectoryWatchOfFailedLookups(dir, dirPath, nonRecursive);
|
|
122991
|
+
}
|
|
122992
|
+
}
|
|
122993
|
+
function setDirectoryWatcher(dir, dirPath, packageDir, packageDirPath, nonRecursive) {
|
|
122994
|
+
if (!packageDirPath || !resolutionHost.realpath) {
|
|
122995
|
+
createOrAddRefToDirectoryWatchOfFailedLookups(dir, dirPath, nonRecursive);
|
|
122996
|
+
} else {
|
|
122997
|
+
createDirectoryWatcherForPackageDir(dir, dirPath, packageDir, packageDirPath, nonRecursive);
|
|
122998
|
+
}
|
|
122999
|
+
}
|
|
123000
|
+
function createOrAddRefToDirectoryWatchOfFailedLookups(dir, dirPath, nonRecursive) {
|
|
123001
|
+
let dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
122755
123002
|
if (dirWatcher) {
|
|
122756
123003
|
Debug.assert(!!nonRecursive === !!dirWatcher.nonRecursive);
|
|
122757
123004
|
dirWatcher.refCount++;
|
|
122758
123005
|
} else {
|
|
122759
|
-
directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
|
|
123006
|
+
directoryWatchesOfFailedLookups.set(dirPath, dirWatcher = { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
|
|
122760
123007
|
}
|
|
123008
|
+
return dirWatcher;
|
|
122761
123009
|
}
|
|
122762
123010
|
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove) {
|
|
122763
123011
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
@@ -122770,9 +123018,27 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122770
123018
|
getCurrentDirectory
|
|
122771
123019
|
);
|
|
122772
123020
|
if (toWatch) {
|
|
122773
|
-
const { dirPath } = toWatch;
|
|
123021
|
+
const { dirPath, packageDirPath } = toWatch;
|
|
122774
123022
|
if (dirPath === rootPath) {
|
|
122775
123023
|
removeAtRoot = true;
|
|
123024
|
+
} else if (packageDirPath && resolutionHost.realpath) {
|
|
123025
|
+
const packageDirWatcher = packageDirWatchers.get(packageDirPath);
|
|
123026
|
+
const forDirPath = packageDirWatcher.dirPathToWatcher.get(dirPath);
|
|
123027
|
+
forDirPath.refCount--;
|
|
123028
|
+
if (forDirPath.refCount === 0) {
|
|
123029
|
+
removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath, syncDirWatcherRemove);
|
|
123030
|
+
packageDirWatcher.dirPathToWatcher.delete(dirPath);
|
|
123031
|
+
if (packageDirWatcher.isSymlink) {
|
|
123032
|
+
const refCount = dirPathToSymlinkPackageRefCount.get(dirPath) - 1;
|
|
123033
|
+
if (refCount === 0) {
|
|
123034
|
+
dirPathToSymlinkPackageRefCount.delete(dirPath);
|
|
123035
|
+
} else {
|
|
123036
|
+
dirPathToSymlinkPackageRefCount.set(dirPath, refCount);
|
|
123037
|
+
}
|
|
123038
|
+
}
|
|
123039
|
+
if (syncDirWatcherRemove)
|
|
123040
|
+
closePackageDirWatcher(packageDirWatcher, packageDirPath);
|
|
123041
|
+
}
|
|
122776
123042
|
} else {
|
|
122777
123043
|
removeDirectoryWatcher(dirPath, syncDirWatcherRemove);
|
|
122778
123044
|
}
|
|
@@ -122994,7 +123260,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122994
123260
|
rootPath,
|
|
122995
123261
|
rootPathComponents,
|
|
122996
123262
|
getCurrentDirectory,
|
|
122997
|
-
(dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2)
|
|
123263
|
+
(dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2) || dirPathToSymlinkPackageRefCount.has(dirPath2)
|
|
122998
123264
|
);
|
|
122999
123265
|
if (dirPath) {
|
|
123000
123266
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
@@ -123200,10 +123466,10 @@ function explainFiles(program, write) {
|
|
|
123200
123466
|
for (const file of program.getSourceFiles()) {
|
|
123201
123467
|
write(`${toFileName(file, relativeFileName)}`);
|
|
123202
123468
|
(_a = reasons.get(file.path)) == null ? void 0 : _a.forEach((reason) => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`));
|
|
123203
|
-
(_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
|
|
123469
|
+
(_b = explainIfFileIsRedirectAndImpliedFormat(file, program.getCompilerOptionsForFile(file), relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
|
|
123204
123470
|
}
|
|
123205
123471
|
}
|
|
123206
|
-
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
123472
|
+
function explainIfFileIsRedirectAndImpliedFormat(file, options, fileNameConvertor) {
|
|
123207
123473
|
var _a;
|
|
123208
123474
|
let result;
|
|
123209
123475
|
if (file.path !== file.resolvedPath) {
|
|
@@ -123223,7 +123489,7 @@ function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
|
123223
123489
|
));
|
|
123224
123490
|
}
|
|
123225
123491
|
if (isExternalOrCommonJsModule(file)) {
|
|
123226
|
-
switch (file
|
|
123492
|
+
switch (getImpliedNodeFormatForEmitWorker(file, options)) {
|
|
123227
123493
|
case 99 /* ESNext */:
|
|
123228
123494
|
if (file.packageJsonScope) {
|
|
123229
123495
|
(result ?? (result = [])).push(chainDiagnosticMessages(
|