@typescript-deploys/pr-build 5.4.0-pr-55015-10 → 5.4.0-pr-56418-6
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 +72 -210
- package/lib/tsserver.js +73 -196
- package/lib/typescript.js +73 -196
- package/lib/typingsInstaller.js +20 -6
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -4521,6 +4521,7 @@ function createSystemWatchFunctions({
|
|
|
4521
4521
|
useNonPollingWatchers,
|
|
4522
4522
|
tscWatchDirectory,
|
|
4523
4523
|
inodeWatching,
|
|
4524
|
+
fsWatchWithTimestamp,
|
|
4524
4525
|
sysLog: sysLog2
|
|
4525
4526
|
}) {
|
|
4526
4527
|
const pollingWatches = /* @__PURE__ */ new Map();
|
|
@@ -4759,7 +4760,7 @@ function createSystemWatchFunctions({
|
|
|
4759
4760
|
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
4760
4761
|
}
|
|
4761
4762
|
try {
|
|
4762
|
-
const presentWatcher = fsWatchWorker(
|
|
4763
|
+
const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
|
|
4763
4764
|
fileOrDirectory,
|
|
4764
4765
|
recursive,
|
|
4765
4766
|
inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
|
|
@@ -4822,6 +4823,18 @@ function createSystemWatchFunctions({
|
|
|
4822
4823
|
);
|
|
4823
4824
|
}
|
|
4824
4825
|
}
|
|
4826
|
+
function fsWatchWorkerHandlingTimestamp(fileOrDirectory, recursive, callback) {
|
|
4827
|
+
let modifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
|
|
4828
|
+
return fsWatchWorker(fileOrDirectory, recursive, (eventName, relativeFileName, currentModifiedTime) => {
|
|
4829
|
+
if (eventName === "change") {
|
|
4830
|
+
currentModifiedTime || (currentModifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime);
|
|
4831
|
+
if (currentModifiedTime.getTime() === modifiedTime.getTime())
|
|
4832
|
+
return;
|
|
4833
|
+
}
|
|
4834
|
+
modifiedTime = currentModifiedTime || getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
|
|
4835
|
+
callback(eventName, relativeFileName, modifiedTime);
|
|
4836
|
+
});
|
|
4837
|
+
}
|
|
4825
4838
|
}
|
|
4826
4839
|
function patchWriteFileEnsuringDirectory(sys2) {
|
|
4827
4840
|
const originalWriteFile = sys2.writeFile;
|
|
@@ -4850,12 +4863,13 @@ var sys = (() => {
|
|
|
4850
4863
|
let activeSession;
|
|
4851
4864
|
let profilePath = "./profile.cpuprofile";
|
|
4852
4865
|
const Buffer = require("buffer").Buffer;
|
|
4853
|
-
const
|
|
4866
|
+
const isMacOs = process.platform === "darwin";
|
|
4867
|
+
const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
|
|
4854
4868
|
const platform = _os.platform();
|
|
4855
4869
|
const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
|
|
4856
4870
|
const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
|
|
4857
4871
|
const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
|
|
4858
|
-
const fsSupportsRecursiveFsWatch = process.platform === "win32" ||
|
|
4872
|
+
const fsSupportsRecursiveFsWatch = process.platform === "win32" || isMacOs;
|
|
4859
4873
|
const getCurrentDirectory = memoize(() => process.cwd());
|
|
4860
4874
|
const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
|
|
4861
4875
|
pollingWatchFileWorker: fsWatchFileWorker,
|
|
@@ -4875,6 +4889,7 @@ var sys = (() => {
|
|
|
4875
4889
|
useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
|
|
4876
4890
|
tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
|
|
4877
4891
|
inodeWatching: isLinuxOrMacOs,
|
|
4892
|
+
fsWatchWithTimestamp: isMacOs,
|
|
4878
4893
|
sysLog
|
|
4879
4894
|
});
|
|
4880
4895
|
const nodeSystem = {
|
|
@@ -6667,6 +6682,7 @@ var Diagnostics = {
|
|
|
6667
6682
|
Type_0_is_generic_and_can_only_be_indexed_for_reading: diag(2862, 1 /* Error */, "Type_0_is_generic_and_can_only_be_indexed_for_reading_2862", "Type '{0}' is generic and can only be indexed for reading."),
|
|
6668
6683
|
A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values: diag(2863, 1 /* Error */, "A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values_2863", "A class cannot extend a primitive type like '{0}'. Classes can only extend constructable values."),
|
|
6669
6684
|
A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types: diag(2864, 1 /* Error */, "A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types_2864", "A class cannot implement a primitive type like '{0}'. It can only implement other named object types."),
|
|
6685
|
+
Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled: diag(2865, 1 /* Error */, "Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_2865", "Import '{0}' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled."),
|
|
6670
6686
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
6671
6687
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
6672
6688
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -10961,7 +10977,7 @@ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
|
|
|
10961
10977
|
return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */ || kind === 205 /* ImportType */;
|
|
10962
10978
|
}
|
|
10963
10979
|
function isCallLikeOrFunctionLikeExpression(node) {
|
|
10964
|
-
return isCallLikeExpression(node) ||
|
|
10980
|
+
return isCallLikeExpression(node) || isFunctionExpressionOrArrowFunction(node);
|
|
10965
10981
|
}
|
|
10966
10982
|
function isCallLikeExpression(node) {
|
|
10967
10983
|
switch (node.kind) {
|
|
@@ -16448,22 +16464,6 @@ function getResolvePackageJsonExports(compilerOptions) {
|
|
|
16448
16464
|
}
|
|
16449
16465
|
return false;
|
|
16450
16466
|
}
|
|
16451
|
-
function getResolvePackageJsonImports(compilerOptions) {
|
|
16452
|
-
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
16453
|
-
if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
16454
|
-
return false;
|
|
16455
|
-
}
|
|
16456
|
-
if (compilerOptions.resolvePackageJsonExports !== void 0) {
|
|
16457
|
-
return compilerOptions.resolvePackageJsonExports;
|
|
16458
|
-
}
|
|
16459
|
-
switch (moduleResolution) {
|
|
16460
|
-
case 3 /* Node16 */:
|
|
16461
|
-
case 99 /* NodeNext */:
|
|
16462
|
-
case 100 /* Bundler */:
|
|
16463
|
-
return true;
|
|
16464
|
-
}
|
|
16465
|
-
return false;
|
|
16466
|
-
}
|
|
16467
16467
|
function getResolveJsonModule(compilerOptions) {
|
|
16468
16468
|
if (compilerOptions.resolveJsonModule !== void 0) {
|
|
16469
16469
|
return compilerOptions.resolveJsonModule;
|
|
@@ -18839,10 +18839,8 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
18839
18839
|
return update(updated, original);
|
|
18840
18840
|
}
|
|
18841
18841
|
function createNumericLiteral(value, numericLiteralFlags = 0 /* None */) {
|
|
18842
|
-
const text = typeof value === "number" ? value + "" : value;
|
|
18843
|
-
Debug.assert(text.charCodeAt(0) !== 45 /* minus */, "Negative numbers should be created in combination with createPrefixUnaryExpression");
|
|
18844
18842
|
const node = createBaseDeclaration(9 /* NumericLiteral */);
|
|
18845
|
-
node.text =
|
|
18843
|
+
node.text = typeof value === "number" ? value + "" : value;
|
|
18846
18844
|
node.numericLiteralFlags = numericLiteralFlags;
|
|
18847
18845
|
if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */)
|
|
18848
18846
|
node.transformFlags |= 1024 /* ContainsES2015 */;
|
|
@@ -42377,13 +42375,6 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu
|
|
|
42377
42375
|
}
|
|
42378
42376
|
|
|
42379
42377
|
// src/compiler/moduleSpecifiers.ts
|
|
42380
|
-
function safeJsonRead(packageJsonPath, readFile) {
|
|
42381
|
-
try {
|
|
42382
|
-
return JSON.parse(readFile(packageJsonPath));
|
|
42383
|
-
} catch {
|
|
42384
|
-
return {};
|
|
42385
|
-
}
|
|
42386
|
-
}
|
|
42387
42378
|
function getPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
42388
42379
|
const preferredEnding = getPreferredEnding();
|
|
42389
42380
|
return {
|
|
@@ -42576,7 +42567,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
42576
42567
|
const { sourceDirectory, getCanonicalFileName } = info;
|
|
42577
42568
|
const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
|
|
42578
42569
|
const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
|
|
42579
|
-
if (!baseUrl && !paths
|
|
42570
|
+
if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
|
|
42580
42571
|
return pathsOnly ? void 0 : relativePath;
|
|
42581
42572
|
}
|
|
42582
42573
|
const baseDirectory = getNormalizedAbsolutePath(getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory());
|
|
@@ -42584,12 +42575,11 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
42584
42575
|
if (!relativeToBaseUrl) {
|
|
42585
42576
|
return pathsOnly ? void 0 : relativePath;
|
|
42586
42577
|
}
|
|
42587
|
-
const
|
|
42588
|
-
const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
|
|
42578
|
+
const fromPaths = paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions);
|
|
42589
42579
|
if (pathsOnly) {
|
|
42590
42580
|
return fromPaths;
|
|
42591
42581
|
}
|
|
42592
|
-
const maybeNonRelative =
|
|
42582
|
+
const maybeNonRelative = fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths;
|
|
42593
42583
|
if (!maybeNonRelative) {
|
|
42594
42584
|
return relativePath;
|
|
42595
42585
|
}
|
|
@@ -42628,8 +42618,8 @@ function getNearestAncestorDirectoryWithPackageJson(host, fileName) {
|
|
|
42628
42618
|
if (host.getNearestAncestorDirectoryWithPackageJson) {
|
|
42629
42619
|
return host.getNearestAncestorDirectoryWithPackageJson(fileName);
|
|
42630
42620
|
}
|
|
42631
|
-
return forEachAncestorDirectory(fileName, (directory) => {
|
|
42632
|
-
return host.fileExists(combinePaths(directory, "package.json")) ?
|
|
42621
|
+
return !!forEachAncestorDirectory(fileName, (directory) => {
|
|
42622
|
+
return host.fileExists(combinePaths(directory, "package.json")) ? true : void 0;
|
|
42633
42623
|
});
|
|
42634
42624
|
}
|
|
42635
42625
|
function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
|
|
@@ -42800,40 +42790,8 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
|
|
|
42800
42790
|
return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
|
|
42801
42791
|
}
|
|
42802
42792
|
}
|
|
42803
|
-
function
|
|
42804
|
-
return changeExtension(
|
|
42805
|
-
options.outDir ? resolvePath(
|
|
42806
|
-
options.outDir,
|
|
42807
|
-
getRelativePathFromDirectory(
|
|
42808
|
-
commonSourceDirectory,
|
|
42809
|
-
targetFilePath,
|
|
42810
|
-
/*ignoreCase*/
|
|
42811
|
-
false
|
|
42812
|
-
)
|
|
42813
|
-
) : targetFilePath,
|
|
42814
|
-
getOutputExtension(targetFilePath, options)
|
|
42815
|
-
);
|
|
42816
|
-
}
|
|
42817
|
-
function getOutputDeclarationPath(targetFilePath, options, commonSourceDirectory) {
|
|
42818
|
-
const declarationDir = options.declarationDir || options.outDir;
|
|
42819
|
-
return changeExtension(
|
|
42820
|
-
declarationDir ? resolvePath(
|
|
42821
|
-
declarationDir,
|
|
42822
|
-
getRelativePathFromDirectory(
|
|
42823
|
-
commonSourceDirectory,
|
|
42824
|
-
targetFilePath,
|
|
42825
|
-
/*ignoreCase*/
|
|
42826
|
-
false
|
|
42827
|
-
)
|
|
42828
|
-
) : targetFilePath,
|
|
42829
|
-
getDeclarationEmitExtensionForPath(targetFilePath)
|
|
42830
|
-
);
|
|
42831
|
-
}
|
|
42832
|
-
function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions, mode, isImports) {
|
|
42793
|
+
function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, exports, conditions, mode = 0 /* Exact */) {
|
|
42833
42794
|
if (typeof exports === "string") {
|
|
42834
|
-
const commonSourceDirectory = host.getCommonSourceDirectory();
|
|
42835
|
-
const outputFile = isImports && getOutputPath(targetFilePath, options, commonSourceDirectory);
|
|
42836
|
-
const declarationFile = isImports && getOutputDeclarationPath(targetFilePath, options, commonSourceDirectory);
|
|
42837
42795
|
const pathOrPattern = getNormalizedAbsolutePath(
|
|
42838
42796
|
combinePaths(packageDirectory, exports),
|
|
42839
42797
|
/*currentDirectory*/
|
|
@@ -42842,24 +42800,11 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
42842
42800
|
const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
|
|
42843
42801
|
switch (mode) {
|
|
42844
42802
|
case 0 /* Exact */:
|
|
42845
|
-
if (
|
|
42803
|
+
if (comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ || extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern) === 0 /* EqualTo */) {
|
|
42846
42804
|
return { moduleFileToTry: packageName };
|
|
42847
42805
|
}
|
|
42848
42806
|
break;
|
|
42849
42807
|
case 1 /* Directory */:
|
|
42850
|
-
if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget)) {
|
|
42851
|
-
const fragment = getRelativePathFromDirectory(
|
|
42852
|
-
pathOrPattern,
|
|
42853
|
-
extensionSwappedTarget,
|
|
42854
|
-
/*ignoreCase*/
|
|
42855
|
-
false
|
|
42856
|
-
);
|
|
42857
|
-
return { moduleFileToTry: getNormalizedAbsolutePath(
|
|
42858
|
-
combinePaths(combinePaths(packageName, exports), fragment),
|
|
42859
|
-
/*currentDirectory*/
|
|
42860
|
-
void 0
|
|
42861
|
-
) };
|
|
42862
|
-
}
|
|
42863
42808
|
if (containsPath(pathOrPattern, targetFilePath)) {
|
|
42864
42809
|
const fragment = getRelativePathFromDirectory(
|
|
42865
42810
|
pathOrPattern,
|
|
@@ -42873,136 +42818,48 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
|
|
|
42873
42818
|
void 0
|
|
42874
42819
|
) };
|
|
42875
42820
|
}
|
|
42876
|
-
if (outputFile && containsPath(pathOrPattern, outputFile)) {
|
|
42877
|
-
const fragment = getRelativePathFromDirectory(
|
|
42878
|
-
pathOrPattern,
|
|
42879
|
-
outputFile,
|
|
42880
|
-
/*ignoreCase*/
|
|
42881
|
-
false
|
|
42882
|
-
);
|
|
42883
|
-
return { moduleFileToTry: combinePaths(packageName, fragment) };
|
|
42884
|
-
}
|
|
42885
|
-
if (declarationFile && containsPath(pathOrPattern, declarationFile)) {
|
|
42886
|
-
const fragment = getRelativePathFromDirectory(
|
|
42887
|
-
pathOrPattern,
|
|
42888
|
-
declarationFile,
|
|
42889
|
-
/*ignoreCase*/
|
|
42890
|
-
false
|
|
42891
|
-
);
|
|
42892
|
-
return { moduleFileToTry: combinePaths(packageName, fragment) };
|
|
42893
|
-
}
|
|
42894
42821
|
break;
|
|
42895
42822
|
case 2 /* Pattern */:
|
|
42896
42823
|
const starPos = pathOrPattern.indexOf("*");
|
|
42897
42824
|
const leadingSlice = pathOrPattern.slice(0, starPos);
|
|
42898
42825
|
const trailingSlice = pathOrPattern.slice(starPos + 1);
|
|
42899
|
-
if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice) && endsWith(extensionSwappedTarget, trailingSlice)) {
|
|
42900
|
-
const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
|
|
42901
|
-
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
42902
|
-
}
|
|
42903
42826
|
if (startsWith(targetFilePath, leadingSlice) && endsWith(targetFilePath, trailingSlice)) {
|
|
42904
42827
|
const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
|
|
42905
42828
|
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
42906
42829
|
}
|
|
42907
|
-
if (
|
|
42908
|
-
const starReplacement =
|
|
42909
|
-
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
42910
|
-
}
|
|
42911
|
-
if (declarationFile && startsWith(declarationFile, leadingSlice) && endsWith(declarationFile, trailingSlice)) {
|
|
42912
|
-
const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
|
|
42830
|
+
if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice) && endsWith(extensionSwappedTarget, trailingSlice)) {
|
|
42831
|
+
const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
|
|
42913
42832
|
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
42914
42833
|
}
|
|
42915
42834
|
break;
|
|
42916
42835
|
}
|
|
42917
42836
|
} else if (Array.isArray(exports)) {
|
|
42918
|
-
return forEach(exports, (e) =>
|
|
42837
|
+
return forEach(exports, (e) => tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, e, conditions));
|
|
42919
42838
|
} else if (typeof exports === "object" && exports !== null) {
|
|
42920
|
-
|
|
42921
|
-
|
|
42922
|
-
const
|
|
42923
|
-
|
|
42924
|
-
|
|
42925
|
-
|
|
42839
|
+
if (allKeysStartWithDot(exports)) {
|
|
42840
|
+
return forEach(getOwnKeys(exports), (k) => {
|
|
42841
|
+
const subPackageName = getNormalizedAbsolutePath(
|
|
42842
|
+
combinePaths(packageName, k),
|
|
42843
|
+
/*currentDirectory*/
|
|
42844
|
+
void 0
|
|
42845
|
+
);
|
|
42846
|
+
const mode2 = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
42847
|
+
return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports[k], conditions, mode2);
|
|
42848
|
+
});
|
|
42849
|
+
} else {
|
|
42850
|
+
for (const key of getOwnKeys(exports)) {
|
|
42851
|
+
if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) {
|
|
42852
|
+
const subTarget = exports[key];
|
|
42853
|
+
const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
|
|
42854
|
+
if (result) {
|
|
42855
|
+
return result;
|
|
42856
|
+
}
|
|
42926
42857
|
}
|
|
42927
42858
|
}
|
|
42928
42859
|
}
|
|
42929
42860
|
}
|
|
42930
42861
|
return void 0;
|
|
42931
42862
|
}
|
|
42932
|
-
function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions) {
|
|
42933
|
-
if (typeof exports === "object" && exports !== null && !Array.isArray(exports) && allKeysStartWithDot(exports)) {
|
|
42934
|
-
return forEach(getOwnKeys(exports), (k) => {
|
|
42935
|
-
const subPackageName = getNormalizedAbsolutePath(
|
|
42936
|
-
combinePaths(packageName, k),
|
|
42937
|
-
/*currentDirectory*/
|
|
42938
|
-
void 0
|
|
42939
|
-
);
|
|
42940
|
-
const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
42941
|
-
return tryGetModuleNameFromExportsOrImports(
|
|
42942
|
-
options,
|
|
42943
|
-
host,
|
|
42944
|
-
targetFilePath,
|
|
42945
|
-
packageDirectory,
|
|
42946
|
-
subPackageName,
|
|
42947
|
-
exports[k],
|
|
42948
|
-
conditions,
|
|
42949
|
-
mode,
|
|
42950
|
-
/*isImports*/
|
|
42951
|
-
false
|
|
42952
|
-
);
|
|
42953
|
-
});
|
|
42954
|
-
}
|
|
42955
|
-
return tryGetModuleNameFromExportsOrImports(
|
|
42956
|
-
options,
|
|
42957
|
-
host,
|
|
42958
|
-
targetFilePath,
|
|
42959
|
-
packageDirectory,
|
|
42960
|
-
packageName,
|
|
42961
|
-
exports,
|
|
42962
|
-
conditions,
|
|
42963
|
-
0 /* Exact */,
|
|
42964
|
-
/*isImports*/
|
|
42965
|
-
false
|
|
42966
|
-
);
|
|
42967
|
-
}
|
|
42968
|
-
function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
|
|
42969
|
-
var _a, _b, _c;
|
|
42970
|
-
if (!host.readFile || !getResolvePackageJsonImports(options)) {
|
|
42971
|
-
return void 0;
|
|
42972
|
-
}
|
|
42973
|
-
const ancestorDirectoryWithPackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
|
|
42974
|
-
if (!ancestorDirectoryWithPackageJson) {
|
|
42975
|
-
return void 0;
|
|
42976
|
-
}
|
|
42977
|
-
const packageJsonPath = combinePaths(ancestorDirectoryWithPackageJson, "package.json");
|
|
42978
|
-
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
42979
|
-
if (typeof cachedPackageJson !== "object" && cachedPackageJson !== void 0 || !host.fileExists(packageJsonPath)) {
|
|
42980
|
-
return void 0;
|
|
42981
|
-
}
|
|
42982
|
-
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || safeJsonRead(packageJsonPath, host.readFile);
|
|
42983
|
-
const imports = packageJsonContent == null ? void 0 : packageJsonContent.imports;
|
|
42984
|
-
if (!imports) {
|
|
42985
|
-
return void 0;
|
|
42986
|
-
}
|
|
42987
|
-
const conditions = getConditions(options, importMode);
|
|
42988
|
-
return (_c = forEach(getOwnKeys(imports), (k) => {
|
|
42989
|
-
if (!startsWith(k, "#") || k === "#" || startsWith(k, "#/"))
|
|
42990
|
-
return void 0;
|
|
42991
|
-
const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
42992
|
-
return tryGetModuleNameFromExportsOrImports(
|
|
42993
|
-
options,
|
|
42994
|
-
host,
|
|
42995
|
-
moduleFileName,
|
|
42996
|
-
ancestorDirectoryWithPackageJson,
|
|
42997
|
-
k,
|
|
42998
|
-
imports[k],
|
|
42999
|
-
conditions,
|
|
43000
|
-
mode,
|
|
43001
|
-
/*isImports*/
|
|
43002
|
-
true
|
|
43003
|
-
);
|
|
43004
|
-
})) == null ? void 0 : _c.moduleFileToTry;
|
|
43005
|
-
}
|
|
43006
42863
|
function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) {
|
|
43007
42864
|
const normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
|
|
43008
42865
|
if (normalizedTargetPaths === void 0) {
|
|
@@ -43076,15 +42933,16 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
43076
42933
|
let maybeBlockedByTypesVersions = false;
|
|
43077
42934
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
43078
42935
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
43079
|
-
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) ||
|
|
42936
|
+
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
43080
42937
|
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
43081
42938
|
if (getResolvePackageJsonExports(options)) {
|
|
43082
42939
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
43083
42940
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
43084
42941
|
const conditions = getConditions(options, importMode);
|
|
43085
|
-
const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options,
|
|
42942
|
+
const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
|
|
43086
42943
|
if (fromExports) {
|
|
43087
|
-
|
|
42944
|
+
const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
|
|
42945
|
+
return { ...withJsExtension, verbatimFromExports: true };
|
|
43088
42946
|
}
|
|
43089
42947
|
if (packageJsonContent.exports) {
|
|
43090
42948
|
return { moduleFileToTry: path, blockedByExports: true };
|
|
@@ -43848,7 +43706,7 @@ function createTypeChecker(host) {
|
|
|
43848
43706
|
const nodeLinks2 = getNodeLinks(node);
|
|
43849
43707
|
cachedResolvedSignatures.push([nodeLinks2, nodeLinks2.resolvedSignature]);
|
|
43850
43708
|
nodeLinks2.resolvedSignature = void 0;
|
|
43851
|
-
if (
|
|
43709
|
+
if (isFunctionExpressionOrArrowFunction(node)) {
|
|
43852
43710
|
const symbolLinks2 = getSymbolLinks(getSymbolOfDeclaration(node));
|
|
43853
43711
|
const type = symbolLinks2.type;
|
|
43854
43712
|
cachedTypes2.push([symbolLinks2, type]);
|
|
@@ -49676,7 +49534,7 @@ function createTypeChecker(host) {
|
|
|
49676
49534
|
return factory.createStringLiteral(name, !!singleQuote);
|
|
49677
49535
|
}
|
|
49678
49536
|
if (isNumericLiteralName(name) && startsWith(name, "-")) {
|
|
49679
|
-
return factory.createComputedPropertyName(factory.
|
|
49537
|
+
return factory.createComputedPropertyName(factory.createNumericLiteral(+name));
|
|
49680
49538
|
}
|
|
49681
49539
|
return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
|
|
49682
49540
|
}
|
|
@@ -75559,14 +75417,9 @@ function createTypeChecker(host) {
|
|
|
75559
75417
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
75560
75418
|
case 11 /* StringLiteral */:
|
|
75561
75419
|
return hasSkipDirectInferenceFlag(node) ? blockedStringType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
|
|
75562
|
-
case 9 /* NumericLiteral */:
|
|
75420
|
+
case 9 /* NumericLiteral */:
|
|
75563
75421
|
checkGrammarNumericLiteral(node);
|
|
75564
|
-
|
|
75565
|
-
if (!isFinite(value)) {
|
|
75566
|
-
return numberType;
|
|
75567
|
-
}
|
|
75568
|
-
return getFreshTypeOfLiteralType(getNumberLiteralType(value));
|
|
75569
|
-
}
|
|
75422
|
+
return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
|
|
75570
75423
|
case 10 /* BigIntLiteral */:
|
|
75571
75424
|
checkGrammarBigIntLiteral(node);
|
|
75572
75425
|
return getFreshTypeOfLiteralType(getBigIntLiteralType({
|
|
@@ -75683,7 +75536,7 @@ function createTypeChecker(host) {
|
|
|
75683
75536
|
const modifiers = getTypeParameterModifiers(typeParameter) & (8192 /* In */ | 16384 /* Out */);
|
|
75684
75537
|
if (modifiers) {
|
|
75685
75538
|
const symbol = getSymbolOfDeclaration(node.parent);
|
|
75686
|
-
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
75539
|
+
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (4 /* Reference */ | 16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
75687
75540
|
error(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
75688
75541
|
} else if (modifiers === 8192 /* In */ || modifiers === 16384 /* Out */) {
|
|
75689
75542
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
@@ -80471,6 +80324,16 @@ function createTypeChecker(host) {
|
|
|
80471
80324
|
if (targetFlags & excludedMeanings) {
|
|
80472
80325
|
const message = node.kind === 281 /* ExportSpecifier */ ? Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
|
|
80473
80326
|
error(node, message, symbolToString(symbol));
|
|
80327
|
+
} else if (node.kind !== 281 /* ExportSpecifier */) {
|
|
80328
|
+
const appearsValueyToTranspiler = compilerOptions.isolatedModules && !findAncestor(node, isTypeOnlyImportOrExportDeclaration);
|
|
80329
|
+
if (appearsValueyToTranspiler && symbol.flags & (111551 /* Value */ | 1048576 /* ExportValue */)) {
|
|
80330
|
+
error(
|
|
80331
|
+
node,
|
|
80332
|
+
Diagnostics.Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled,
|
|
80333
|
+
symbolToString(symbol),
|
|
80334
|
+
isolatedModulesLikeFlagName
|
|
80335
|
+
);
|
|
80336
|
+
}
|
|
80474
80337
|
}
|
|
80475
80338
|
if (getIsolatedModules(compilerOptions) && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 33554432 /* Ambient */)) {
|
|
80476
80339
|
const typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
|
|
@@ -82567,7 +82430,7 @@ function createTypeChecker(host) {
|
|
|
82567
82430
|
if (enumResult)
|
|
82568
82431
|
return enumResult;
|
|
82569
82432
|
const literalValue = type.value;
|
|
82570
|
-
return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "
|
|
82433
|
+
return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "number" ? factory.createNumericLiteral(literalValue) : factory.createStringLiteral(literalValue);
|
|
82571
82434
|
}
|
|
82572
82435
|
function createLiteralConstValue(node, tracker) {
|
|
82573
82436
|
const type = getTypeOfSymbol(getSymbolOfDeclaration(node));
|
|
@@ -88996,7 +88859,7 @@ function transformTypeScript(context) {
|
|
|
88996
88859
|
function transformEnumMemberDeclarationValue(member) {
|
|
88997
88860
|
const value = resolver.getConstantValue(member);
|
|
88998
88861
|
if (value !== void 0) {
|
|
88999
|
-
return typeof value === "string" ? factory2.createStringLiteral(value) :
|
|
88862
|
+
return typeof value === "string" ? factory2.createStringLiteral(value) : factory2.createNumericLiteral(value);
|
|
89000
88863
|
} else {
|
|
89001
88864
|
enableSubstitutionForNonQualifiedEnumMembers();
|
|
89002
88865
|
if (member.initializer) {
|
|
@@ -103316,7 +103179,7 @@ function transformGenerators(context) {
|
|
|
103316
103179
|
if (labelExpressions === void 0) {
|
|
103317
103180
|
labelExpressions = [];
|
|
103318
103181
|
}
|
|
103319
|
-
const expression = factory2.createNumericLiteral(
|
|
103182
|
+
const expression = factory2.createNumericLiteral(-1);
|
|
103320
103183
|
if (labelExpressions[label] === void 0) {
|
|
103321
103184
|
labelExpressions[label] = [expression];
|
|
103322
103185
|
} else {
|
|
@@ -109191,8 +109054,7 @@ function transformDeclarations(context) {
|
|
|
109191
109054
|
if (shouldStripInternal(m))
|
|
109192
109055
|
return;
|
|
109193
109056
|
const constValue = resolver.getConstantValue(m);
|
|
109194
|
-
|
|
109195
|
-
return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m);
|
|
109057
|
+
return preserveJsDoc(factory2.updateEnumMember(m, m.name, constValue !== void 0 ? typeof constValue === "string" ? factory2.createStringLiteral(constValue) : factory2.createNumericLiteral(constValue) : void 0), m);
|
|
109196
109058
|
}))
|
|
109197
109059
|
));
|
|
109198
109060
|
}
|