@typescript-deploys/pr-build 5.4.0-pr-56403-3 → 5.4.0-pr-55015-10
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 +191 -50
- package/lib/tsserver.js +178 -51
- package/lib/typescript.js +178 -51
- package/lib/typingsInstaller.js +3 -18
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -4521,7 +4521,6 @@ function createSystemWatchFunctions({
|
|
|
4521
4521
|
useNonPollingWatchers,
|
|
4522
4522
|
tscWatchDirectory,
|
|
4523
4523
|
inodeWatching,
|
|
4524
|
-
fsWatchWithTimestamp,
|
|
4525
4524
|
sysLog: sysLog2
|
|
4526
4525
|
}) {
|
|
4527
4526
|
const pollingWatches = /* @__PURE__ */ new Map();
|
|
@@ -4760,7 +4759,7 @@ function createSystemWatchFunctions({
|
|
|
4760
4759
|
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
4761
4760
|
}
|
|
4762
4761
|
try {
|
|
4763
|
-
const presentWatcher =
|
|
4762
|
+
const presentWatcher = fsWatchWorker(
|
|
4764
4763
|
fileOrDirectory,
|
|
4765
4764
|
recursive,
|
|
4766
4765
|
inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
|
|
@@ -4823,18 +4822,6 @@ function createSystemWatchFunctions({
|
|
|
4823
4822
|
);
|
|
4824
4823
|
}
|
|
4825
4824
|
}
|
|
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
|
-
}
|
|
4838
4825
|
}
|
|
4839
4826
|
function patchWriteFileEnsuringDirectory(sys2) {
|
|
4840
4827
|
const originalWriteFile = sys2.writeFile;
|
|
@@ -4863,13 +4850,12 @@ var sys = (() => {
|
|
|
4863
4850
|
let activeSession;
|
|
4864
4851
|
let profilePath = "./profile.cpuprofile";
|
|
4865
4852
|
const Buffer = require("buffer").Buffer;
|
|
4866
|
-
const
|
|
4867
|
-
const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
|
|
4853
|
+
const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
4868
4854
|
const platform = _os.platform();
|
|
4869
4855
|
const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
|
|
4870
4856
|
const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
|
|
4871
4857
|
const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
|
|
4872
|
-
const fsSupportsRecursiveFsWatch = process.platform === "win32" ||
|
|
4858
|
+
const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
|
|
4873
4859
|
const getCurrentDirectory = memoize(() => process.cwd());
|
|
4874
4860
|
const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
|
|
4875
4861
|
pollingWatchFileWorker: fsWatchFileWorker,
|
|
@@ -4889,7 +4875,6 @@ var sys = (() => {
|
|
|
4889
4875
|
useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
|
|
4890
4876
|
tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
|
|
4891
4877
|
inodeWatching: isLinuxOrMacOs,
|
|
4892
|
-
fsWatchWithTimestamp: isMacOs,
|
|
4893
4878
|
sysLog
|
|
4894
4879
|
});
|
|
4895
4880
|
const nodeSystem = {
|
|
@@ -16463,6 +16448,22 @@ function getResolvePackageJsonExports(compilerOptions) {
|
|
|
16463
16448
|
}
|
|
16464
16449
|
return false;
|
|
16465
16450
|
}
|
|
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
|
+
}
|
|
16466
16467
|
function getResolveJsonModule(compilerOptions) {
|
|
16467
16468
|
if (compilerOptions.resolveJsonModule !== void 0) {
|
|
16468
16469
|
return compilerOptions.resolveJsonModule;
|
|
@@ -42376,6 +42377,13 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu
|
|
|
42376
42377
|
}
|
|
42377
42378
|
|
|
42378
42379
|
// src/compiler/moduleSpecifiers.ts
|
|
42380
|
+
function safeJsonRead(packageJsonPath, readFile) {
|
|
42381
|
+
try {
|
|
42382
|
+
return JSON.parse(readFile(packageJsonPath));
|
|
42383
|
+
} catch {
|
|
42384
|
+
return {};
|
|
42385
|
+
}
|
|
42386
|
+
}
|
|
42379
42387
|
function getPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
42380
42388
|
const preferredEnding = getPreferredEnding();
|
|
42381
42389
|
return {
|
|
@@ -42568,7 +42576,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
42568
42576
|
const { sourceDirectory, getCanonicalFileName } = info;
|
|
42569
42577
|
const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
|
|
42570
42578
|
const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
|
|
42571
|
-
if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
|
|
42579
|
+
if (!baseUrl && !paths && !getResolvePackageJsonImports(compilerOptions) || relativePreference === 0 /* Relative */) {
|
|
42572
42580
|
return pathsOnly ? void 0 : relativePath;
|
|
42573
42581
|
}
|
|
42574
42582
|
const baseDirectory = getNormalizedAbsolutePath(getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory());
|
|
@@ -42576,11 +42584,12 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
42576
42584
|
if (!relativeToBaseUrl) {
|
|
42577
42585
|
return pathsOnly ? void 0 : relativePath;
|
|
42578
42586
|
}
|
|
42579
|
-
const
|
|
42587
|
+
const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, compilerOptions, host, importMode);
|
|
42588
|
+
const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
|
|
42580
42589
|
if (pathsOnly) {
|
|
42581
42590
|
return fromPaths;
|
|
42582
42591
|
}
|
|
42583
|
-
const maybeNonRelative = fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths;
|
|
42592
|
+
const maybeNonRelative = fromPackageJsonImports ?? (fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths);
|
|
42584
42593
|
if (!maybeNonRelative) {
|
|
42585
42594
|
return relativePath;
|
|
42586
42595
|
}
|
|
@@ -42619,8 +42628,8 @@ function getNearestAncestorDirectoryWithPackageJson(host, fileName) {
|
|
|
42619
42628
|
if (host.getNearestAncestorDirectoryWithPackageJson) {
|
|
42620
42629
|
return host.getNearestAncestorDirectoryWithPackageJson(fileName);
|
|
42621
42630
|
}
|
|
42622
|
-
return
|
|
42623
|
-
return host.fileExists(combinePaths(directory, "package.json")) ?
|
|
42631
|
+
return forEachAncestorDirectory(fileName, (directory) => {
|
|
42632
|
+
return host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0;
|
|
42624
42633
|
});
|
|
42625
42634
|
}
|
|
42626
42635
|
function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
|
|
@@ -42791,8 +42800,40 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
|
|
|
42791
42800
|
return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
|
|
42792
42801
|
}
|
|
42793
42802
|
}
|
|
42794
|
-
function
|
|
42803
|
+
function getOutputPath(targetFilePath, options, commonSourceDirectory) {
|
|
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) {
|
|
42795
42833
|
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);
|
|
42796
42837
|
const pathOrPattern = getNormalizedAbsolutePath(
|
|
42797
42838
|
combinePaths(packageDirectory, exports),
|
|
42798
42839
|
/*currentDirectory*/
|
|
@@ -42801,11 +42842,24 @@ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory,
|
|
|
42801
42842
|
const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
|
|
42802
42843
|
switch (mode) {
|
|
42803
42844
|
case 0 /* Exact */:
|
|
42804
|
-
if (comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ ||
|
|
42845
|
+
if (extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern) === 0 /* EqualTo */ || comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ || outputFile && comparePaths(outputFile, pathOrPattern) === 0 /* EqualTo */ || declarationFile && comparePaths(declarationFile, pathOrPattern) === 0 /* EqualTo */) {
|
|
42805
42846
|
return { moduleFileToTry: packageName };
|
|
42806
42847
|
}
|
|
42807
42848
|
break;
|
|
42808
42849
|
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
|
+
}
|
|
42809
42863
|
if (containsPath(pathOrPattern, targetFilePath)) {
|
|
42810
42864
|
const fragment = getRelativePathFromDirectory(
|
|
42811
42865
|
pathOrPattern,
|
|
@@ -42819,48 +42873,136 @@ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory,
|
|
|
42819
42873
|
void 0
|
|
42820
42874
|
) };
|
|
42821
42875
|
}
|
|
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
|
+
}
|
|
42822
42894
|
break;
|
|
42823
42895
|
case 2 /* Pattern */:
|
|
42824
42896
|
const starPos = pathOrPattern.indexOf("*");
|
|
42825
42897
|
const leadingSlice = pathOrPattern.slice(0, starPos);
|
|
42826
42898
|
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
|
+
}
|
|
42827
42903
|
if (startsWith(targetFilePath, leadingSlice) && endsWith(targetFilePath, trailingSlice)) {
|
|
42828
42904
|
const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
|
|
42829
42905
|
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
42830
42906
|
}
|
|
42831
|
-
if (
|
|
42832
|
-
const starReplacement =
|
|
42907
|
+
if (outputFile && startsWith(outputFile, leadingSlice) && endsWith(outputFile, trailingSlice)) {
|
|
42908
|
+
const starReplacement = outputFile.slice(leadingSlice.length, outputFile.length - trailingSlice.length);
|
|
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);
|
|
42833
42913
|
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
42834
42914
|
}
|
|
42835
42915
|
break;
|
|
42836
42916
|
}
|
|
42837
42917
|
} else if (Array.isArray(exports)) {
|
|
42838
|
-
return forEach(exports, (e) =>
|
|
42918
|
+
return forEach(exports, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
|
|
42839
42919
|
} else if (typeof exports === "object" && exports !== null) {
|
|
42840
|
-
|
|
42841
|
-
|
|
42842
|
-
const
|
|
42843
|
-
|
|
42844
|
-
|
|
42845
|
-
|
|
42846
|
-
);
|
|
42847
|
-
const mode2 = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
42848
|
-
return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports[k], conditions, mode2);
|
|
42849
|
-
});
|
|
42850
|
-
} else {
|
|
42851
|
-
for (const key of getOwnKeys(exports)) {
|
|
42852
|
-
if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) {
|
|
42853
|
-
const subTarget = exports[key];
|
|
42854
|
-
const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
|
|
42855
|
-
if (result) {
|
|
42856
|
-
return result;
|
|
42857
|
-
}
|
|
42920
|
+
for (const key of getOwnKeys(exports)) {
|
|
42921
|
+
if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
|
|
42922
|
+
const subTarget = exports[key];
|
|
42923
|
+
const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
|
|
42924
|
+
if (result) {
|
|
42925
|
+
return result;
|
|
42858
42926
|
}
|
|
42859
42927
|
}
|
|
42860
42928
|
}
|
|
42861
42929
|
}
|
|
42862
42930
|
return void 0;
|
|
42863
42931
|
}
|
|
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
|
+
}
|
|
42864
43006
|
function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) {
|
|
42865
43007
|
const normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
|
|
42866
43008
|
if (normalizedTargetPaths === void 0) {
|
|
@@ -42934,16 +43076,15 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
42934
43076
|
let maybeBlockedByTypesVersions = false;
|
|
42935
43077
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
42936
43078
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
42937
|
-
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) ||
|
|
43079
|
+
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || safeJsonRead(packageJsonPath, host.readFile);
|
|
42938
43080
|
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
42939
43081
|
if (getResolvePackageJsonExports(options)) {
|
|
42940
43082
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
42941
43083
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
42942
43084
|
const conditions = getConditions(options, importMode);
|
|
42943
|
-
const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
|
|
43085
|
+
const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, host, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
|
|
42944
43086
|
if (fromExports) {
|
|
42945
|
-
|
|
42946
|
-
return { ...withJsExtension, verbatimFromExports: true };
|
|
43087
|
+
return { ...fromExports, verbatimFromExports: true };
|
|
42947
43088
|
}
|
|
42948
43089
|
if (packageJsonContent.exports) {
|
|
42949
43090
|
return { moduleFileToTry: path, blockedByExports: true };
|
package/lib/tsserver.js
CHANGED
|
@@ -8041,7 +8041,6 @@ function createSystemWatchFunctions({
|
|
|
8041
8041
|
useNonPollingWatchers,
|
|
8042
8042
|
tscWatchDirectory,
|
|
8043
8043
|
inodeWatching,
|
|
8044
|
-
fsWatchWithTimestamp,
|
|
8045
8044
|
sysLog: sysLog2
|
|
8046
8045
|
}) {
|
|
8047
8046
|
const pollingWatches = /* @__PURE__ */ new Map();
|
|
@@ -8280,7 +8279,7 @@ function createSystemWatchFunctions({
|
|
|
8280
8279
|
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
8281
8280
|
}
|
|
8282
8281
|
try {
|
|
8283
|
-
const presentWatcher =
|
|
8282
|
+
const presentWatcher = fsWatchWorker(
|
|
8284
8283
|
fileOrDirectory,
|
|
8285
8284
|
recursive,
|
|
8286
8285
|
inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
|
|
@@ -8343,18 +8342,6 @@ function createSystemWatchFunctions({
|
|
|
8343
8342
|
);
|
|
8344
8343
|
}
|
|
8345
8344
|
}
|
|
8346
|
-
function fsWatchWorkerHandlingTimestamp(fileOrDirectory, recursive, callback) {
|
|
8347
|
-
let modifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
|
|
8348
|
-
return fsWatchWorker(fileOrDirectory, recursive, (eventName, relativeFileName, currentModifiedTime) => {
|
|
8349
|
-
if (eventName === "change") {
|
|
8350
|
-
currentModifiedTime || (currentModifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime);
|
|
8351
|
-
if (currentModifiedTime.getTime() === modifiedTime.getTime())
|
|
8352
|
-
return;
|
|
8353
|
-
}
|
|
8354
|
-
modifiedTime = currentModifiedTime || getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
|
|
8355
|
-
callback(eventName, relativeFileName, modifiedTime);
|
|
8356
|
-
});
|
|
8357
|
-
}
|
|
8358
8345
|
}
|
|
8359
8346
|
function patchWriteFileEnsuringDirectory(sys2) {
|
|
8360
8347
|
const originalWriteFile = sys2.writeFile;
|
|
@@ -8383,13 +8370,12 @@ var sys = (() => {
|
|
|
8383
8370
|
let activeSession;
|
|
8384
8371
|
let profilePath = "./profile.cpuprofile";
|
|
8385
8372
|
const Buffer2 = require("buffer").Buffer;
|
|
8386
|
-
const
|
|
8387
|
-
const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
|
|
8373
|
+
const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
8388
8374
|
const platform = _os.platform();
|
|
8389
8375
|
const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
|
|
8390
8376
|
const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
|
|
8391
8377
|
const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
|
|
8392
|
-
const fsSupportsRecursiveFsWatch = process.platform === "win32" ||
|
|
8378
|
+
const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
|
|
8393
8379
|
const getCurrentDirectory = memoize(() => process.cwd());
|
|
8394
8380
|
const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
|
|
8395
8381
|
pollingWatchFileWorker: fsWatchFileWorker,
|
|
@@ -8409,7 +8395,6 @@ var sys = (() => {
|
|
|
8409
8395
|
useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
|
|
8410
8396
|
tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
|
|
8411
8397
|
inodeWatching: isLinuxOrMacOs,
|
|
8412
|
-
fsWatchWithTimestamp: isMacOs,
|
|
8413
8398
|
sysLog
|
|
8414
8399
|
});
|
|
8415
8400
|
const nodeSystem = {
|
|
@@ -47054,6 +47039,13 @@ __export(ts_moduleSpecifiers_exports, {
|
|
|
47054
47039
|
});
|
|
47055
47040
|
|
|
47056
47041
|
// src/compiler/moduleSpecifiers.ts
|
|
47042
|
+
function safeJsonRead(packageJsonPath, readFile) {
|
|
47043
|
+
try {
|
|
47044
|
+
return JSON.parse(readFile(packageJsonPath));
|
|
47045
|
+
} catch {
|
|
47046
|
+
return {};
|
|
47047
|
+
}
|
|
47048
|
+
}
|
|
47057
47049
|
function getPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
47058
47050
|
const preferredEnding = getPreferredEnding();
|
|
47059
47051
|
return {
|
|
@@ -47276,7 +47268,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
47276
47268
|
const { sourceDirectory, getCanonicalFileName } = info;
|
|
47277
47269
|
const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
|
|
47278
47270
|
const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
|
|
47279
|
-
if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
|
|
47271
|
+
if (!baseUrl && !paths && !getResolvePackageJsonImports(compilerOptions) || relativePreference === 0 /* Relative */) {
|
|
47280
47272
|
return pathsOnly ? void 0 : relativePath;
|
|
47281
47273
|
}
|
|
47282
47274
|
const baseDirectory = getNormalizedAbsolutePath(getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory());
|
|
@@ -47284,11 +47276,12 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
47284
47276
|
if (!relativeToBaseUrl) {
|
|
47285
47277
|
return pathsOnly ? void 0 : relativePath;
|
|
47286
47278
|
}
|
|
47287
|
-
const
|
|
47279
|
+
const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, compilerOptions, host, importMode);
|
|
47280
|
+
const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
|
|
47288
47281
|
if (pathsOnly) {
|
|
47289
47282
|
return fromPaths;
|
|
47290
47283
|
}
|
|
47291
|
-
const maybeNonRelative = fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths;
|
|
47284
|
+
const maybeNonRelative = fromPackageJsonImports ?? (fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths);
|
|
47292
47285
|
if (!maybeNonRelative) {
|
|
47293
47286
|
return relativePath;
|
|
47294
47287
|
}
|
|
@@ -47327,8 +47320,8 @@ function getNearestAncestorDirectoryWithPackageJson(host, fileName) {
|
|
|
47327
47320
|
if (host.getNearestAncestorDirectoryWithPackageJson) {
|
|
47328
47321
|
return host.getNearestAncestorDirectoryWithPackageJson(fileName);
|
|
47329
47322
|
}
|
|
47330
|
-
return
|
|
47331
|
-
return host.fileExists(combinePaths(directory, "package.json")) ?
|
|
47323
|
+
return forEachAncestorDirectory(fileName, (directory) => {
|
|
47324
|
+
return host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0;
|
|
47332
47325
|
});
|
|
47333
47326
|
}
|
|
47334
47327
|
function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
|
|
@@ -47499,8 +47492,40 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
|
|
|
47499
47492
|
return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
|
|
47500
47493
|
}
|
|
47501
47494
|
}
|
|
47502
|
-
function
|
|
47495
|
+
function getOutputPath(targetFilePath, options, commonSourceDirectory) {
|
|
47496
|
+
return changeExtension(
|
|
47497
|
+
options.outDir ? resolvePath(
|
|
47498
|
+
options.outDir,
|
|
47499
|
+
getRelativePathFromDirectory(
|
|
47500
|
+
commonSourceDirectory,
|
|
47501
|
+
targetFilePath,
|
|
47502
|
+
/*ignoreCase*/
|
|
47503
|
+
false
|
|
47504
|
+
)
|
|
47505
|
+
) : targetFilePath,
|
|
47506
|
+
getOutputExtension(targetFilePath, options)
|
|
47507
|
+
);
|
|
47508
|
+
}
|
|
47509
|
+
function getOutputDeclarationPath(targetFilePath, options, commonSourceDirectory) {
|
|
47510
|
+
const declarationDir = options.declarationDir || options.outDir;
|
|
47511
|
+
return changeExtension(
|
|
47512
|
+
declarationDir ? resolvePath(
|
|
47513
|
+
declarationDir,
|
|
47514
|
+
getRelativePathFromDirectory(
|
|
47515
|
+
commonSourceDirectory,
|
|
47516
|
+
targetFilePath,
|
|
47517
|
+
/*ignoreCase*/
|
|
47518
|
+
false
|
|
47519
|
+
)
|
|
47520
|
+
) : targetFilePath,
|
|
47521
|
+
getDeclarationEmitExtensionForPath(targetFilePath)
|
|
47522
|
+
);
|
|
47523
|
+
}
|
|
47524
|
+
function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions, mode, isImports) {
|
|
47503
47525
|
if (typeof exports === "string") {
|
|
47526
|
+
const commonSourceDirectory = host.getCommonSourceDirectory();
|
|
47527
|
+
const outputFile = isImports && getOutputPath(targetFilePath, options, commonSourceDirectory);
|
|
47528
|
+
const declarationFile = isImports && getOutputDeclarationPath(targetFilePath, options, commonSourceDirectory);
|
|
47504
47529
|
const pathOrPattern = getNormalizedAbsolutePath(
|
|
47505
47530
|
combinePaths(packageDirectory, exports),
|
|
47506
47531
|
/*currentDirectory*/
|
|
@@ -47509,11 +47534,24 @@ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory,
|
|
|
47509
47534
|
const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
|
|
47510
47535
|
switch (mode) {
|
|
47511
47536
|
case 0 /* Exact */:
|
|
47512
|
-
if (comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ ||
|
|
47537
|
+
if (extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern) === 0 /* EqualTo */ || comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ || outputFile && comparePaths(outputFile, pathOrPattern) === 0 /* EqualTo */ || declarationFile && comparePaths(declarationFile, pathOrPattern) === 0 /* EqualTo */) {
|
|
47513
47538
|
return { moduleFileToTry: packageName };
|
|
47514
47539
|
}
|
|
47515
47540
|
break;
|
|
47516
47541
|
case 1 /* Directory */:
|
|
47542
|
+
if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget)) {
|
|
47543
|
+
const fragment = getRelativePathFromDirectory(
|
|
47544
|
+
pathOrPattern,
|
|
47545
|
+
extensionSwappedTarget,
|
|
47546
|
+
/*ignoreCase*/
|
|
47547
|
+
false
|
|
47548
|
+
);
|
|
47549
|
+
return { moduleFileToTry: getNormalizedAbsolutePath(
|
|
47550
|
+
combinePaths(combinePaths(packageName, exports), fragment),
|
|
47551
|
+
/*currentDirectory*/
|
|
47552
|
+
void 0
|
|
47553
|
+
) };
|
|
47554
|
+
}
|
|
47517
47555
|
if (containsPath(pathOrPattern, targetFilePath)) {
|
|
47518
47556
|
const fragment = getRelativePathFromDirectory(
|
|
47519
47557
|
pathOrPattern,
|
|
@@ -47527,48 +47565,136 @@ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory,
|
|
|
47527
47565
|
void 0
|
|
47528
47566
|
) };
|
|
47529
47567
|
}
|
|
47568
|
+
if (outputFile && containsPath(pathOrPattern, outputFile)) {
|
|
47569
|
+
const fragment = getRelativePathFromDirectory(
|
|
47570
|
+
pathOrPattern,
|
|
47571
|
+
outputFile,
|
|
47572
|
+
/*ignoreCase*/
|
|
47573
|
+
false
|
|
47574
|
+
);
|
|
47575
|
+
return { moduleFileToTry: combinePaths(packageName, fragment) };
|
|
47576
|
+
}
|
|
47577
|
+
if (declarationFile && containsPath(pathOrPattern, declarationFile)) {
|
|
47578
|
+
const fragment = getRelativePathFromDirectory(
|
|
47579
|
+
pathOrPattern,
|
|
47580
|
+
declarationFile,
|
|
47581
|
+
/*ignoreCase*/
|
|
47582
|
+
false
|
|
47583
|
+
);
|
|
47584
|
+
return { moduleFileToTry: combinePaths(packageName, fragment) };
|
|
47585
|
+
}
|
|
47530
47586
|
break;
|
|
47531
47587
|
case 2 /* Pattern */:
|
|
47532
47588
|
const starPos = pathOrPattern.indexOf("*");
|
|
47533
47589
|
const leadingSlice = pathOrPattern.slice(0, starPos);
|
|
47534
47590
|
const trailingSlice = pathOrPattern.slice(starPos + 1);
|
|
47591
|
+
if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice) && endsWith(extensionSwappedTarget, trailingSlice)) {
|
|
47592
|
+
const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
|
|
47593
|
+
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
47594
|
+
}
|
|
47535
47595
|
if (startsWith(targetFilePath, leadingSlice) && endsWith(targetFilePath, trailingSlice)) {
|
|
47536
47596
|
const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
|
|
47537
47597
|
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
47538
47598
|
}
|
|
47539
|
-
if (
|
|
47540
|
-
const starReplacement =
|
|
47599
|
+
if (outputFile && startsWith(outputFile, leadingSlice) && endsWith(outputFile, trailingSlice)) {
|
|
47600
|
+
const starReplacement = outputFile.slice(leadingSlice.length, outputFile.length - trailingSlice.length);
|
|
47601
|
+
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
47602
|
+
}
|
|
47603
|
+
if (declarationFile && startsWith(declarationFile, leadingSlice) && endsWith(declarationFile, trailingSlice)) {
|
|
47604
|
+
const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
|
|
47541
47605
|
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
47542
47606
|
}
|
|
47543
47607
|
break;
|
|
47544
47608
|
}
|
|
47545
47609
|
} else if (Array.isArray(exports)) {
|
|
47546
|
-
return forEach(exports, (e) =>
|
|
47610
|
+
return forEach(exports, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
|
|
47547
47611
|
} else if (typeof exports === "object" && exports !== null) {
|
|
47548
|
-
|
|
47549
|
-
|
|
47550
|
-
const
|
|
47551
|
-
|
|
47552
|
-
|
|
47553
|
-
|
|
47554
|
-
);
|
|
47555
|
-
const mode2 = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
47556
|
-
return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports[k], conditions, mode2);
|
|
47557
|
-
});
|
|
47558
|
-
} else {
|
|
47559
|
-
for (const key of getOwnKeys(exports)) {
|
|
47560
|
-
if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) {
|
|
47561
|
-
const subTarget = exports[key];
|
|
47562
|
-
const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
|
|
47563
|
-
if (result) {
|
|
47564
|
-
return result;
|
|
47565
|
-
}
|
|
47612
|
+
for (const key of getOwnKeys(exports)) {
|
|
47613
|
+
if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
|
|
47614
|
+
const subTarget = exports[key];
|
|
47615
|
+
const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
|
|
47616
|
+
if (result) {
|
|
47617
|
+
return result;
|
|
47566
47618
|
}
|
|
47567
47619
|
}
|
|
47568
47620
|
}
|
|
47569
47621
|
}
|
|
47570
47622
|
return void 0;
|
|
47571
47623
|
}
|
|
47624
|
+
function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions) {
|
|
47625
|
+
if (typeof exports === "object" && exports !== null && !Array.isArray(exports) && allKeysStartWithDot(exports)) {
|
|
47626
|
+
return forEach(getOwnKeys(exports), (k) => {
|
|
47627
|
+
const subPackageName = getNormalizedAbsolutePath(
|
|
47628
|
+
combinePaths(packageName, k),
|
|
47629
|
+
/*currentDirectory*/
|
|
47630
|
+
void 0
|
|
47631
|
+
);
|
|
47632
|
+
const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
47633
|
+
return tryGetModuleNameFromExportsOrImports(
|
|
47634
|
+
options,
|
|
47635
|
+
host,
|
|
47636
|
+
targetFilePath,
|
|
47637
|
+
packageDirectory,
|
|
47638
|
+
subPackageName,
|
|
47639
|
+
exports[k],
|
|
47640
|
+
conditions,
|
|
47641
|
+
mode,
|
|
47642
|
+
/*isImports*/
|
|
47643
|
+
false
|
|
47644
|
+
);
|
|
47645
|
+
});
|
|
47646
|
+
}
|
|
47647
|
+
return tryGetModuleNameFromExportsOrImports(
|
|
47648
|
+
options,
|
|
47649
|
+
host,
|
|
47650
|
+
targetFilePath,
|
|
47651
|
+
packageDirectory,
|
|
47652
|
+
packageName,
|
|
47653
|
+
exports,
|
|
47654
|
+
conditions,
|
|
47655
|
+
0 /* Exact */,
|
|
47656
|
+
/*isImports*/
|
|
47657
|
+
false
|
|
47658
|
+
);
|
|
47659
|
+
}
|
|
47660
|
+
function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
|
|
47661
|
+
var _a, _b, _c;
|
|
47662
|
+
if (!host.readFile || !getResolvePackageJsonImports(options)) {
|
|
47663
|
+
return void 0;
|
|
47664
|
+
}
|
|
47665
|
+
const ancestorDirectoryWithPackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
|
|
47666
|
+
if (!ancestorDirectoryWithPackageJson) {
|
|
47667
|
+
return void 0;
|
|
47668
|
+
}
|
|
47669
|
+
const packageJsonPath = combinePaths(ancestorDirectoryWithPackageJson, "package.json");
|
|
47670
|
+
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
47671
|
+
if (typeof cachedPackageJson !== "object" && cachedPackageJson !== void 0 || !host.fileExists(packageJsonPath)) {
|
|
47672
|
+
return void 0;
|
|
47673
|
+
}
|
|
47674
|
+
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || safeJsonRead(packageJsonPath, host.readFile);
|
|
47675
|
+
const imports = packageJsonContent == null ? void 0 : packageJsonContent.imports;
|
|
47676
|
+
if (!imports) {
|
|
47677
|
+
return void 0;
|
|
47678
|
+
}
|
|
47679
|
+
const conditions = getConditions(options, importMode);
|
|
47680
|
+
return (_c = forEach(getOwnKeys(imports), (k) => {
|
|
47681
|
+
if (!startsWith(k, "#") || k === "#" || startsWith(k, "#/"))
|
|
47682
|
+
return void 0;
|
|
47683
|
+
const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
47684
|
+
return tryGetModuleNameFromExportsOrImports(
|
|
47685
|
+
options,
|
|
47686
|
+
host,
|
|
47687
|
+
moduleFileName,
|
|
47688
|
+
ancestorDirectoryWithPackageJson,
|
|
47689
|
+
k,
|
|
47690
|
+
imports[k],
|
|
47691
|
+
conditions,
|
|
47692
|
+
mode,
|
|
47693
|
+
/*isImports*/
|
|
47694
|
+
true
|
|
47695
|
+
);
|
|
47696
|
+
})) == null ? void 0 : _c.moduleFileToTry;
|
|
47697
|
+
}
|
|
47572
47698
|
function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) {
|
|
47573
47699
|
const normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
|
|
47574
47700
|
if (normalizedTargetPaths === void 0) {
|
|
@@ -47642,16 +47768,15 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
47642
47768
|
let maybeBlockedByTypesVersions = false;
|
|
47643
47769
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
47644
47770
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
47645
|
-
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) ||
|
|
47771
|
+
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || safeJsonRead(packageJsonPath, host.readFile);
|
|
47646
47772
|
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
47647
47773
|
if (getResolvePackageJsonExports(options)) {
|
|
47648
47774
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
47649
47775
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
47650
47776
|
const conditions = getConditions(options, importMode);
|
|
47651
|
-
const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
|
|
47777
|
+
const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, host, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
|
|
47652
47778
|
if (fromExports) {
|
|
47653
|
-
|
|
47654
|
-
return { ...withJsExtension, verbatimFromExports: true };
|
|
47779
|
+
return { ...fromExports, verbatimFromExports: true };
|
|
47655
47780
|
}
|
|
47656
47781
|
if (packageJsonContent.exports) {
|
|
47657
47782
|
return { moduleFileToTry: path, blockedByExports: true };
|
|
@@ -133025,7 +133150,8 @@ function createModuleSpecifierResolutionHost(program, host) {
|
|
|
133025
133150
|
getProjectReferenceRedirect: (fileName) => program.getProjectReferenceRedirect(fileName),
|
|
133026
133151
|
isSourceOfProjectReferenceRedirect: (fileName) => program.isSourceOfProjectReferenceRedirect(fileName),
|
|
133027
133152
|
getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson),
|
|
133028
|
-
getFileIncludeReasons: () => program.getFileIncludeReasons()
|
|
133153
|
+
getFileIncludeReasons: () => program.getFileIncludeReasons(),
|
|
133154
|
+
getCommonSourceDirectory: () => program.getCommonSourceDirectory()
|
|
133029
133155
|
};
|
|
133030
133156
|
}
|
|
133031
133157
|
function getModuleSpecifierResolverHost(program, host) {
|
|
@@ -135751,6 +135877,7 @@ var DocumentHighlights;
|
|
|
135751
135877
|
case 127 /* YieldKeyword */:
|
|
135752
135878
|
return highlightSpans(getYieldOccurrences(node));
|
|
135753
135879
|
case 103 /* InKeyword */:
|
|
135880
|
+
case 147 /* OutKeyword */:
|
|
135754
135881
|
return void 0;
|
|
135755
135882
|
default:
|
|
135756
135883
|
return isModifierKind(node.kind) && (isDeclaration(node.parent) || isVariableStatement(node.parent)) ? highlightSpans(getModifierOccurrences(node.kind, node.parent)) : void 0;
|
package/lib/typescript.js
CHANGED
|
@@ -5779,7 +5779,6 @@ ${lanes.join("\n")}
|
|
|
5779
5779
|
useNonPollingWatchers,
|
|
5780
5780
|
tscWatchDirectory,
|
|
5781
5781
|
inodeWatching,
|
|
5782
|
-
fsWatchWithTimestamp,
|
|
5783
5782
|
sysLog: sysLog2
|
|
5784
5783
|
}) {
|
|
5785
5784
|
const pollingWatches = /* @__PURE__ */ new Map();
|
|
@@ -6018,7 +6017,7 @@ ${lanes.join("\n")}
|
|
|
6018
6017
|
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
6019
6018
|
}
|
|
6020
6019
|
try {
|
|
6021
|
-
const presentWatcher =
|
|
6020
|
+
const presentWatcher = fsWatchWorker(
|
|
6022
6021
|
fileOrDirectory,
|
|
6023
6022
|
recursive,
|
|
6024
6023
|
inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
|
|
@@ -6081,18 +6080,6 @@ ${lanes.join("\n")}
|
|
|
6081
6080
|
);
|
|
6082
6081
|
}
|
|
6083
6082
|
}
|
|
6084
|
-
function fsWatchWorkerHandlingTimestamp(fileOrDirectory, recursive, callback) {
|
|
6085
|
-
let modifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
|
|
6086
|
-
return fsWatchWorker(fileOrDirectory, recursive, (eventName, relativeFileName, currentModifiedTime) => {
|
|
6087
|
-
if (eventName === "change") {
|
|
6088
|
-
currentModifiedTime || (currentModifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime);
|
|
6089
|
-
if (currentModifiedTime.getTime() === modifiedTime.getTime())
|
|
6090
|
-
return;
|
|
6091
|
-
}
|
|
6092
|
-
modifiedTime = currentModifiedTime || getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
|
|
6093
|
-
callback(eventName, relativeFileName, modifiedTime);
|
|
6094
|
-
});
|
|
6095
|
-
}
|
|
6096
6083
|
}
|
|
6097
6084
|
function patchWriteFileEnsuringDirectory(sys2) {
|
|
6098
6085
|
const originalWriteFile = sys2.writeFile;
|
|
@@ -6152,13 +6139,12 @@ ${lanes.join("\n")}
|
|
|
6152
6139
|
let activeSession;
|
|
6153
6140
|
let profilePath = "./profile.cpuprofile";
|
|
6154
6141
|
const Buffer2 = require("buffer").Buffer;
|
|
6155
|
-
const
|
|
6156
|
-
const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
|
|
6142
|
+
const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
6157
6143
|
const platform = _os.platform();
|
|
6158
6144
|
const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
|
|
6159
6145
|
const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
|
|
6160
6146
|
const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
|
|
6161
|
-
const fsSupportsRecursiveFsWatch = process.platform === "win32" ||
|
|
6147
|
+
const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
|
|
6162
6148
|
const getCurrentDirectory = memoize(() => process.cwd());
|
|
6163
6149
|
const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
|
|
6164
6150
|
pollingWatchFileWorker: fsWatchFileWorker,
|
|
@@ -6178,7 +6164,6 @@ ${lanes.join("\n")}
|
|
|
6178
6164
|
useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
|
|
6179
6165
|
tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
|
|
6180
6166
|
inodeWatching: isLinuxOrMacOs,
|
|
6181
|
-
fsWatchWithTimestamp: isMacOs,
|
|
6182
6167
|
sysLog
|
|
6183
6168
|
});
|
|
6184
6169
|
const nodeSystem = {
|
|
@@ -44917,6 +44902,13 @@ ${lanes.join("\n")}
|
|
|
44917
44902
|
});
|
|
44918
44903
|
|
|
44919
44904
|
// src/compiler/moduleSpecifiers.ts
|
|
44905
|
+
function safeJsonRead(packageJsonPath, readFile) {
|
|
44906
|
+
try {
|
|
44907
|
+
return JSON.parse(readFile(packageJsonPath));
|
|
44908
|
+
} catch {
|
|
44909
|
+
return {};
|
|
44910
|
+
}
|
|
44911
|
+
}
|
|
44920
44912
|
function getPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
44921
44913
|
const preferredEnding = getPreferredEnding();
|
|
44922
44914
|
return {
|
|
@@ -45139,7 +45131,7 @@ ${lanes.join("\n")}
|
|
|
45139
45131
|
const { sourceDirectory, getCanonicalFileName } = info;
|
|
45140
45132
|
const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
|
|
45141
45133
|
const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
|
|
45142
|
-
if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
|
|
45134
|
+
if (!baseUrl && !paths && !getResolvePackageJsonImports(compilerOptions) || relativePreference === 0 /* Relative */) {
|
|
45143
45135
|
return pathsOnly ? void 0 : relativePath;
|
|
45144
45136
|
}
|
|
45145
45137
|
const baseDirectory = getNormalizedAbsolutePath(getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory());
|
|
@@ -45147,11 +45139,12 @@ ${lanes.join("\n")}
|
|
|
45147
45139
|
if (!relativeToBaseUrl) {
|
|
45148
45140
|
return pathsOnly ? void 0 : relativePath;
|
|
45149
45141
|
}
|
|
45150
|
-
const
|
|
45142
|
+
const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, compilerOptions, host, importMode);
|
|
45143
|
+
const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
|
|
45151
45144
|
if (pathsOnly) {
|
|
45152
45145
|
return fromPaths;
|
|
45153
45146
|
}
|
|
45154
|
-
const maybeNonRelative = fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths;
|
|
45147
|
+
const maybeNonRelative = fromPackageJsonImports ?? (fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths);
|
|
45155
45148
|
if (!maybeNonRelative) {
|
|
45156
45149
|
return relativePath;
|
|
45157
45150
|
}
|
|
@@ -45190,8 +45183,8 @@ ${lanes.join("\n")}
|
|
|
45190
45183
|
if (host.getNearestAncestorDirectoryWithPackageJson) {
|
|
45191
45184
|
return host.getNearestAncestorDirectoryWithPackageJson(fileName);
|
|
45192
45185
|
}
|
|
45193
|
-
return
|
|
45194
|
-
return host.fileExists(combinePaths(directory, "package.json")) ?
|
|
45186
|
+
return forEachAncestorDirectory(fileName, (directory) => {
|
|
45187
|
+
return host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0;
|
|
45195
45188
|
});
|
|
45196
45189
|
}
|
|
45197
45190
|
function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
|
|
@@ -45362,8 +45355,40 @@ ${lanes.join("\n")}
|
|
|
45362
45355
|
return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
|
|
45363
45356
|
}
|
|
45364
45357
|
}
|
|
45365
|
-
function
|
|
45358
|
+
function getOutputPath(targetFilePath, options, commonSourceDirectory) {
|
|
45359
|
+
return changeExtension(
|
|
45360
|
+
options.outDir ? resolvePath(
|
|
45361
|
+
options.outDir,
|
|
45362
|
+
getRelativePathFromDirectory(
|
|
45363
|
+
commonSourceDirectory,
|
|
45364
|
+
targetFilePath,
|
|
45365
|
+
/*ignoreCase*/
|
|
45366
|
+
false
|
|
45367
|
+
)
|
|
45368
|
+
) : targetFilePath,
|
|
45369
|
+
getOutputExtension(targetFilePath, options)
|
|
45370
|
+
);
|
|
45371
|
+
}
|
|
45372
|
+
function getOutputDeclarationPath(targetFilePath, options, commonSourceDirectory) {
|
|
45373
|
+
const declarationDir = options.declarationDir || options.outDir;
|
|
45374
|
+
return changeExtension(
|
|
45375
|
+
declarationDir ? resolvePath(
|
|
45376
|
+
declarationDir,
|
|
45377
|
+
getRelativePathFromDirectory(
|
|
45378
|
+
commonSourceDirectory,
|
|
45379
|
+
targetFilePath,
|
|
45380
|
+
/*ignoreCase*/
|
|
45381
|
+
false
|
|
45382
|
+
)
|
|
45383
|
+
) : targetFilePath,
|
|
45384
|
+
getDeclarationEmitExtensionForPath(targetFilePath)
|
|
45385
|
+
);
|
|
45386
|
+
}
|
|
45387
|
+
function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions, mode, isImports) {
|
|
45366
45388
|
if (typeof exports === "string") {
|
|
45389
|
+
const commonSourceDirectory = host.getCommonSourceDirectory();
|
|
45390
|
+
const outputFile = isImports && getOutputPath(targetFilePath, options, commonSourceDirectory);
|
|
45391
|
+
const declarationFile = isImports && getOutputDeclarationPath(targetFilePath, options, commonSourceDirectory);
|
|
45367
45392
|
const pathOrPattern = getNormalizedAbsolutePath(
|
|
45368
45393
|
combinePaths(packageDirectory, exports),
|
|
45369
45394
|
/*currentDirectory*/
|
|
@@ -45372,11 +45397,24 @@ ${lanes.join("\n")}
|
|
|
45372
45397
|
const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
|
|
45373
45398
|
switch (mode) {
|
|
45374
45399
|
case 0 /* Exact */:
|
|
45375
|
-
if (comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ ||
|
|
45400
|
+
if (extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern) === 0 /* EqualTo */ || comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ || outputFile && comparePaths(outputFile, pathOrPattern) === 0 /* EqualTo */ || declarationFile && comparePaths(declarationFile, pathOrPattern) === 0 /* EqualTo */) {
|
|
45376
45401
|
return { moduleFileToTry: packageName };
|
|
45377
45402
|
}
|
|
45378
45403
|
break;
|
|
45379
45404
|
case 1 /* Directory */:
|
|
45405
|
+
if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget)) {
|
|
45406
|
+
const fragment = getRelativePathFromDirectory(
|
|
45407
|
+
pathOrPattern,
|
|
45408
|
+
extensionSwappedTarget,
|
|
45409
|
+
/*ignoreCase*/
|
|
45410
|
+
false
|
|
45411
|
+
);
|
|
45412
|
+
return { moduleFileToTry: getNormalizedAbsolutePath(
|
|
45413
|
+
combinePaths(combinePaths(packageName, exports), fragment),
|
|
45414
|
+
/*currentDirectory*/
|
|
45415
|
+
void 0
|
|
45416
|
+
) };
|
|
45417
|
+
}
|
|
45380
45418
|
if (containsPath(pathOrPattern, targetFilePath)) {
|
|
45381
45419
|
const fragment = getRelativePathFromDirectory(
|
|
45382
45420
|
pathOrPattern,
|
|
@@ -45390,48 +45428,136 @@ ${lanes.join("\n")}
|
|
|
45390
45428
|
void 0
|
|
45391
45429
|
) };
|
|
45392
45430
|
}
|
|
45431
|
+
if (outputFile && containsPath(pathOrPattern, outputFile)) {
|
|
45432
|
+
const fragment = getRelativePathFromDirectory(
|
|
45433
|
+
pathOrPattern,
|
|
45434
|
+
outputFile,
|
|
45435
|
+
/*ignoreCase*/
|
|
45436
|
+
false
|
|
45437
|
+
);
|
|
45438
|
+
return { moduleFileToTry: combinePaths(packageName, fragment) };
|
|
45439
|
+
}
|
|
45440
|
+
if (declarationFile && containsPath(pathOrPattern, declarationFile)) {
|
|
45441
|
+
const fragment = getRelativePathFromDirectory(
|
|
45442
|
+
pathOrPattern,
|
|
45443
|
+
declarationFile,
|
|
45444
|
+
/*ignoreCase*/
|
|
45445
|
+
false
|
|
45446
|
+
);
|
|
45447
|
+
return { moduleFileToTry: combinePaths(packageName, fragment) };
|
|
45448
|
+
}
|
|
45393
45449
|
break;
|
|
45394
45450
|
case 2 /* Pattern */:
|
|
45395
45451
|
const starPos = pathOrPattern.indexOf("*");
|
|
45396
45452
|
const leadingSlice = pathOrPattern.slice(0, starPos);
|
|
45397
45453
|
const trailingSlice = pathOrPattern.slice(starPos + 1);
|
|
45454
|
+
if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice) && endsWith(extensionSwappedTarget, trailingSlice)) {
|
|
45455
|
+
const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
|
|
45456
|
+
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
45457
|
+
}
|
|
45398
45458
|
if (startsWith(targetFilePath, leadingSlice) && endsWith(targetFilePath, trailingSlice)) {
|
|
45399
45459
|
const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
|
|
45400
45460
|
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
45401
45461
|
}
|
|
45402
|
-
if (
|
|
45403
|
-
const starReplacement =
|
|
45462
|
+
if (outputFile && startsWith(outputFile, leadingSlice) && endsWith(outputFile, trailingSlice)) {
|
|
45463
|
+
const starReplacement = outputFile.slice(leadingSlice.length, outputFile.length - trailingSlice.length);
|
|
45464
|
+
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
45465
|
+
}
|
|
45466
|
+
if (declarationFile && startsWith(declarationFile, leadingSlice) && endsWith(declarationFile, trailingSlice)) {
|
|
45467
|
+
const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
|
|
45404
45468
|
return { moduleFileToTry: packageName.replace("*", starReplacement) };
|
|
45405
45469
|
}
|
|
45406
45470
|
break;
|
|
45407
45471
|
}
|
|
45408
45472
|
} else if (Array.isArray(exports)) {
|
|
45409
|
-
return forEach(exports, (e) =>
|
|
45473
|
+
return forEach(exports, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
|
|
45410
45474
|
} else if (typeof exports === "object" && exports !== null) {
|
|
45411
|
-
|
|
45412
|
-
|
|
45413
|
-
const
|
|
45414
|
-
|
|
45415
|
-
|
|
45416
|
-
|
|
45417
|
-
);
|
|
45418
|
-
const mode2 = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
45419
|
-
return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports[k], conditions, mode2);
|
|
45420
|
-
});
|
|
45421
|
-
} else {
|
|
45422
|
-
for (const key of getOwnKeys(exports)) {
|
|
45423
|
-
if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) {
|
|
45424
|
-
const subTarget = exports[key];
|
|
45425
|
-
const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
|
|
45426
|
-
if (result) {
|
|
45427
|
-
return result;
|
|
45428
|
-
}
|
|
45475
|
+
for (const key of getOwnKeys(exports)) {
|
|
45476
|
+
if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
|
|
45477
|
+
const subTarget = exports[key];
|
|
45478
|
+
const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
|
|
45479
|
+
if (result) {
|
|
45480
|
+
return result;
|
|
45429
45481
|
}
|
|
45430
45482
|
}
|
|
45431
45483
|
}
|
|
45432
45484
|
}
|
|
45433
45485
|
return void 0;
|
|
45434
45486
|
}
|
|
45487
|
+
function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions) {
|
|
45488
|
+
if (typeof exports === "object" && exports !== null && !Array.isArray(exports) && allKeysStartWithDot(exports)) {
|
|
45489
|
+
return forEach(getOwnKeys(exports), (k) => {
|
|
45490
|
+
const subPackageName = getNormalizedAbsolutePath(
|
|
45491
|
+
combinePaths(packageName, k),
|
|
45492
|
+
/*currentDirectory*/
|
|
45493
|
+
void 0
|
|
45494
|
+
);
|
|
45495
|
+
const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
45496
|
+
return tryGetModuleNameFromExportsOrImports(
|
|
45497
|
+
options,
|
|
45498
|
+
host,
|
|
45499
|
+
targetFilePath,
|
|
45500
|
+
packageDirectory,
|
|
45501
|
+
subPackageName,
|
|
45502
|
+
exports[k],
|
|
45503
|
+
conditions,
|
|
45504
|
+
mode,
|
|
45505
|
+
/*isImports*/
|
|
45506
|
+
false
|
|
45507
|
+
);
|
|
45508
|
+
});
|
|
45509
|
+
}
|
|
45510
|
+
return tryGetModuleNameFromExportsOrImports(
|
|
45511
|
+
options,
|
|
45512
|
+
host,
|
|
45513
|
+
targetFilePath,
|
|
45514
|
+
packageDirectory,
|
|
45515
|
+
packageName,
|
|
45516
|
+
exports,
|
|
45517
|
+
conditions,
|
|
45518
|
+
0 /* Exact */,
|
|
45519
|
+
/*isImports*/
|
|
45520
|
+
false
|
|
45521
|
+
);
|
|
45522
|
+
}
|
|
45523
|
+
function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
|
|
45524
|
+
var _a, _b, _c;
|
|
45525
|
+
if (!host.readFile || !getResolvePackageJsonImports(options)) {
|
|
45526
|
+
return void 0;
|
|
45527
|
+
}
|
|
45528
|
+
const ancestorDirectoryWithPackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
|
|
45529
|
+
if (!ancestorDirectoryWithPackageJson) {
|
|
45530
|
+
return void 0;
|
|
45531
|
+
}
|
|
45532
|
+
const packageJsonPath = combinePaths(ancestorDirectoryWithPackageJson, "package.json");
|
|
45533
|
+
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
45534
|
+
if (typeof cachedPackageJson !== "object" && cachedPackageJson !== void 0 || !host.fileExists(packageJsonPath)) {
|
|
45535
|
+
return void 0;
|
|
45536
|
+
}
|
|
45537
|
+
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || safeJsonRead(packageJsonPath, host.readFile);
|
|
45538
|
+
const imports = packageJsonContent == null ? void 0 : packageJsonContent.imports;
|
|
45539
|
+
if (!imports) {
|
|
45540
|
+
return void 0;
|
|
45541
|
+
}
|
|
45542
|
+
const conditions = getConditions(options, importMode);
|
|
45543
|
+
return (_c = forEach(getOwnKeys(imports), (k) => {
|
|
45544
|
+
if (!startsWith(k, "#") || k === "#" || startsWith(k, "#/"))
|
|
45545
|
+
return void 0;
|
|
45546
|
+
const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
45547
|
+
return tryGetModuleNameFromExportsOrImports(
|
|
45548
|
+
options,
|
|
45549
|
+
host,
|
|
45550
|
+
moduleFileName,
|
|
45551
|
+
ancestorDirectoryWithPackageJson,
|
|
45552
|
+
k,
|
|
45553
|
+
imports[k],
|
|
45554
|
+
conditions,
|
|
45555
|
+
mode,
|
|
45556
|
+
/*isImports*/
|
|
45557
|
+
true
|
|
45558
|
+
);
|
|
45559
|
+
})) == null ? void 0 : _c.moduleFileToTry;
|
|
45560
|
+
}
|
|
45435
45561
|
function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) {
|
|
45436
45562
|
const normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
|
|
45437
45563
|
if (normalizedTargetPaths === void 0) {
|
|
@@ -45505,16 +45631,15 @@ ${lanes.join("\n")}
|
|
|
45505
45631
|
let maybeBlockedByTypesVersions = false;
|
|
45506
45632
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
45507
45633
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
45508
|
-
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) ||
|
|
45634
|
+
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || safeJsonRead(packageJsonPath, host.readFile);
|
|
45509
45635
|
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
45510
45636
|
if (getResolvePackageJsonExports(options)) {
|
|
45511
45637
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
45512
45638
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
45513
45639
|
const conditions = getConditions(options, importMode);
|
|
45514
|
-
const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
|
|
45640
|
+
const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, host, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
|
|
45515
45641
|
if (fromExports) {
|
|
45516
|
-
|
|
45517
|
-
return { ...withJsExtension, verbatimFromExports: true };
|
|
45642
|
+
return { ...fromExports, verbatimFromExports: true };
|
|
45518
45643
|
}
|
|
45519
45644
|
if (packageJsonContent.exports) {
|
|
45520
45645
|
return { moduleFileToTry: path, blockedByExports: true };
|
|
@@ -131295,7 +131420,8 @@ ${lanes.join("\n")}
|
|
|
131295
131420
|
getProjectReferenceRedirect: (fileName) => program.getProjectReferenceRedirect(fileName),
|
|
131296
131421
|
isSourceOfProjectReferenceRedirect: (fileName) => program.isSourceOfProjectReferenceRedirect(fileName),
|
|
131297
131422
|
getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson),
|
|
131298
|
-
getFileIncludeReasons: () => program.getFileIncludeReasons()
|
|
131423
|
+
getFileIncludeReasons: () => program.getFileIncludeReasons(),
|
|
131424
|
+
getCommonSourceDirectory: () => program.getCommonSourceDirectory()
|
|
131299
131425
|
};
|
|
131300
131426
|
}
|
|
131301
131427
|
function getModuleSpecifierResolverHost(program, host) {
|
|
@@ -134082,6 +134208,7 @@ ${lanes.join("\n")}
|
|
|
134082
134208
|
case 127 /* YieldKeyword */:
|
|
134083
134209
|
return highlightSpans(getYieldOccurrences(node));
|
|
134084
134210
|
case 103 /* InKeyword */:
|
|
134211
|
+
case 147 /* OutKeyword */:
|
|
134085
134212
|
return void 0;
|
|
134086
134213
|
default:
|
|
134087
134214
|
return isModifierKind(node.kind) && (isDeclaration(node.parent) || isVariableStatement(node.parent)) ? highlightSpans(getModifierOccurrences(node.kind, node.parent)) : void 0;
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -3934,7 +3934,6 @@ function createSystemWatchFunctions({
|
|
|
3934
3934
|
useNonPollingWatchers,
|
|
3935
3935
|
tscWatchDirectory,
|
|
3936
3936
|
inodeWatching,
|
|
3937
|
-
fsWatchWithTimestamp,
|
|
3938
3937
|
sysLog: sysLog2
|
|
3939
3938
|
}) {
|
|
3940
3939
|
const pollingWatches = /* @__PURE__ */ new Map();
|
|
@@ -4173,7 +4172,7 @@ function createSystemWatchFunctions({
|
|
|
4173
4172
|
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
4174
4173
|
}
|
|
4175
4174
|
try {
|
|
4176
|
-
const presentWatcher =
|
|
4175
|
+
const presentWatcher = fsWatchWorker(
|
|
4177
4176
|
fileOrDirectory,
|
|
4178
4177
|
recursive,
|
|
4179
4178
|
inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
|
|
@@ -4236,18 +4235,6 @@ function createSystemWatchFunctions({
|
|
|
4236
4235
|
);
|
|
4237
4236
|
}
|
|
4238
4237
|
}
|
|
4239
|
-
function fsWatchWorkerHandlingTimestamp(fileOrDirectory, recursive, callback) {
|
|
4240
|
-
let modifiedTime = getModifiedTime2(fileOrDirectory) || missingFileModifiedTime;
|
|
4241
|
-
return fsWatchWorker(fileOrDirectory, recursive, (eventName, relativeFileName, currentModifiedTime) => {
|
|
4242
|
-
if (eventName === "change") {
|
|
4243
|
-
currentModifiedTime || (currentModifiedTime = getModifiedTime2(fileOrDirectory) || missingFileModifiedTime);
|
|
4244
|
-
if (currentModifiedTime.getTime() === modifiedTime.getTime())
|
|
4245
|
-
return;
|
|
4246
|
-
}
|
|
4247
|
-
modifiedTime = currentModifiedTime || getModifiedTime2(fileOrDirectory) || missingFileModifiedTime;
|
|
4248
|
-
callback(eventName, relativeFileName, modifiedTime);
|
|
4249
|
-
});
|
|
4250
|
-
}
|
|
4251
4238
|
}
|
|
4252
4239
|
function patchWriteFileEnsuringDirectory(sys2) {
|
|
4253
4240
|
const originalWriteFile = sys2.writeFile;
|
|
@@ -4276,13 +4263,12 @@ var sys = (() => {
|
|
|
4276
4263
|
let activeSession;
|
|
4277
4264
|
let profilePath = "./profile.cpuprofile";
|
|
4278
4265
|
const Buffer2 = require("buffer").Buffer;
|
|
4279
|
-
const
|
|
4280
|
-
const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
|
|
4266
|
+
const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
4281
4267
|
const platform = _os.platform();
|
|
4282
4268
|
const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
|
|
4283
4269
|
const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
|
|
4284
4270
|
const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
|
|
4285
|
-
const fsSupportsRecursiveFsWatch = process.platform === "win32" ||
|
|
4271
|
+
const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
|
|
4286
4272
|
const getCurrentDirectory = memoize(() => process.cwd());
|
|
4287
4273
|
const { watchFile, watchDirectory } = createSystemWatchFunctions({
|
|
4288
4274
|
pollingWatchFileWorker: fsWatchFileWorker,
|
|
@@ -4302,7 +4288,6 @@ var sys = (() => {
|
|
|
4302
4288
|
useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
|
|
4303
4289
|
tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
|
|
4304
4290
|
inodeWatching: isLinuxOrMacOs,
|
|
4305
|
-
fsWatchWithTimestamp: isMacOs,
|
|
4306
4291
|
sysLog
|
|
4307
4292
|
});
|
|
4308
4293
|
const nodeSystem = {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.4.0-pr-
|
|
5
|
+
"version": "5.4.0-pr-55015-10",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"node": "20.1.0",
|
|
116
116
|
"npm": "8.19.4"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "d6f199d69cfaf8f69510f81d95c5358f1f16e9a7"
|
|
119
119
|
}
|