@@ -18,7 +18,7 @@ and limitations under the License.
1818
1919// src/compiler/corePublic.ts
2020var versionMajorMinor = "5.4";
21- var version = "5.4.3 ";
21+ var version = "5.4.4 ";
2222
2323// src/compiler/core.ts
2424var emptyArray = [];
@@ -4145,14 +4145,17 @@ function createDynamicPriorityPollingWatchFile(host) {
41454145 pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
41464146 }
41474147}
4148- function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2) {
4148+ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp ) {
41494149 const fileWatcherCallbacks = createMultiMap();
4150+ const fileTimestamps = fsWatchWithTimestamp ? /* @__PURE__ */ new Map() : void 0;
41504151 const dirWatchers = /* @__PURE__ */ new Map();
41514152 const toCanonicalName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
41524153 return nonPollingWatchFile;
41534154 function nonPollingWatchFile(fileName, callback, _pollingInterval, fallbackOptions) {
41544155 const filePath = toCanonicalName(fileName);
4155- fileWatcherCallbacks.add(filePath, callback);
4156+ if (fileWatcherCallbacks.add(filePath, callback).length === 1 && fileTimestamps) {
4157+ fileTimestamps.set(filePath, getModifiedTime3(fileName) || missingFileModifiedTime);
4158+ }
41564159 const dirPath = getDirectoryPath(filePath) || ".";
41574160 const watcher = dirWatchers.get(dirPath) || createDirectoryWatcher(getDirectoryPath(fileName) || ".", dirPath, fallbackOptions);
41584161 watcher.referenceCount++;
@@ -4172,14 +4175,31 @@ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFi
41724175 const watcher = fsWatch(
41734176 dirName,
41744177 1 /* Directory */,
4175- (_eventName , relativeFileName, modifiedTime ) => {
4178+ (eventName , relativeFileName) => {
41764179 if (!isString(relativeFileName))
41774180 return;
41784181 const fileName = getNormalizedAbsolutePath(relativeFileName, dirName);
4179- const callbacks = fileName && fileWatcherCallbacks.get(toCanonicalName(fileName));
4182+ const filePath = toCanonicalName(fileName);
4183+ const callbacks = fileName && fileWatcherCallbacks.get(filePath);
41804184 if (callbacks) {
4185+ let currentModifiedTime;
4186+ let eventKind = 1 /* Changed */;
4187+ if (fileTimestamps) {
4188+ const existingTime = fileTimestamps.get(filePath);
4189+ if (eventName === "change") {
4190+ currentModifiedTime = getModifiedTime3(fileName) || missingFileModifiedTime;
4191+ if (currentModifiedTime.getTime() === existingTime.getTime())
4192+ return;
4193+ }
4194+ currentModifiedTime || (currentModifiedTime = getModifiedTime3(fileName) || missingFileModifiedTime);
4195+ fileTimestamps.set(filePath, currentModifiedTime);
4196+ if (existingTime === missingFileModifiedTime)
4197+ eventKind = 0 /* Created */;
4198+ else if (currentModifiedTime === missingFileModifiedTime)
4199+ eventKind = 2 /* Deleted */;
4200+ }
41814201 for (const fileCallback of callbacks) {
4182- fileCallback(fileName, 1 /* Changed */, modifiedTime );
4202+ fileCallback(fileName, eventKind, currentModifiedTime );
41834203 }
41844204 }
41854205 },
@@ -4573,7 +4593,7 @@ function createSystemWatchFunctions({
45734593 );
45744594 case 5 /* UseFsEventsOnParentDirectory */:
45754595 if (!nonPollingWatchFile) {
4576- nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2);
4596+ nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp );
45774597 }
45784598 return nonPollingWatchFile(fileName, callback, pollingInterval, getFallbackOptions(options));
45794599 default:
@@ -4748,7 +4768,7 @@ function createSystemWatchFunctions({
47484768 return watchPresentFileSystemEntryWithFsWatchFile();
47494769 }
47504770 try {
4751- const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
4771+ const presentWatcher = (entryKind === 1 /* Directory */ || !fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
47524772 fileOrDirectory,
47534773 recursive,
47544774 inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
@@ -42862,13 +42882,21 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
4286242882 }
4286342883 const nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, getDirectoryPath(modulePath));
4286442884 const nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
42865- if (nearestSourcePackageJson !== nearestTargetPackageJson) {
42885+ const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
42886+ if (!packageJsonPathsAreEqual(nearestTargetPackageJson, nearestSourcePackageJson, ignoreCase)) {
4286642887 return maybeNonRelative;
4286742888 }
4286842889 return relativePath;
4286942890 }
4287042891 return isPathRelativeToParent(maybeNonRelative) || countPathComponents(relativePath) < countPathComponents(maybeNonRelative) ? relativePath : maybeNonRelative;
4287142892}
42893+ function packageJsonPathsAreEqual(a, b, ignoreCase) {
42894+ if (a === b)
42895+ return true;
42896+ if (a === void 0 || b === void 0)
42897+ return false;
42898+ return comparePaths(a, b, ignoreCase) === 0 /* EqualTo */;
42899+ }
4287242900function countPathComponents(path) {
4287342901 let count = 0;
4287442902 for (let i = startsWith(path, "./") ? 2 : 0; i < path.length; i++) {
@@ -47996,15 +48024,19 @@ function createTypeChecker(host) {
4799648024 return true;
4799748025 }
4799848026 }
47999- function isEntityNameVisible (entityName, enclosingDeclaration ) {
48027+ function getMeaningOfEntityNameReference (entityName) {
4800048028 let meaning;
4800148029 if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */) {
4800248030 meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
48003- } else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */) {
48031+ } else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */ || entityName.parent.kind === 166 /* QualifiedName */ && entityName.parent.left === entityName || entityName.parent.kind === 211 /* PropertyAccessExpression */ && entityName.parent.expression === entityName || entityName.parent.kind === 212 /* ElementAccessExpression */ && entityName.parent.expression === entityName ) {
4800448032 meaning = 1920 /* Namespace */;
4800548033 } else {
4800648034 meaning = 788968 /* Type */;
4800748035 }
48036+ return meaning;
48037+ }
48038+ function isEntityNameVisible(entityName, enclosingDeclaration) {
48039+ const meaning = getMeaningOfEntityNameReference(entityName);
4800848040 const firstIdentifier = getFirstIdentifier(entityName);
4800948041 const symbol = resolveName(
4801048042 enclosingDeclaration,
@@ -50065,9 +50097,10 @@ function createTypeChecker(host) {
5006550097 introducesError = true;
5006650098 return { introducesError, node };
5006750099 }
50100+ const meaning = getMeaningOfEntityNameReference(node);
5006850101 const sym = resolveEntityName(
5006950102 leftmost,
50070- -1 /* All */ ,
50103+ meaning ,
5007150104 /*ignoreErrors*/
5007250105 true,
5007350106 /*dontResolveAlias*/
@@ -50077,13 +50110,13 @@ function createTypeChecker(host) {
5007750110 if (isSymbolAccessible(
5007850111 sym,
5007950112 context.enclosingDeclaration,
50080- -1 /* All */ ,
50113+ meaning ,
5008150114 /*shouldComputeAliasesToMakeVisible*/
5008250115 false
5008350116 ).accessibility !== 0 /* Accessible */) {
5008450117 introducesError = true;
5008550118 } else {
50086- context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */ );
50119+ context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning );
5008750120 includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
5008850121 }
5008950122 if (isIdentifier(node)) {
@@ -57990,6 +58023,9 @@ function createTypeChecker(host) {
5799058023 } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
5799158024 removeFromEach(typeSet, 65536 /* Null */);
5799258025 result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
58026+ } else if (typeSet.length >= 4) {
58027+ const middle = Math.floor(typeSet.length / 2);
58028+ result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle)), getIntersectionType(typeSet.slice(middle))], aliasSymbol, aliasTypeArguments);
5799358029 } else {
5799458030 if (!checkCrossProductUnion(typeSet)) {
5799558031 return errorType;
0 commit comments