@@ -18,7 +18,7 @@ and limitations under the License.
18
18
19
19
// src/compiler/corePublic.ts
20
20
var versionMajorMinor = "5.4";
21
- var version = "5.4.3 ";
21
+ var version = "5.4.4 ";
22
22
23
23
// src/compiler/core.ts
24
24
var emptyArray = [];
@@ -4145,14 +4145,17 @@ function createDynamicPriorityPollingWatchFile(host) {
4145
4145
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
4146
4146
}
4147
4147
}
4148
- function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2) {
4148
+ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp ) {
4149
4149
const fileWatcherCallbacks = createMultiMap();
4150
+ const fileTimestamps = fsWatchWithTimestamp ? /* @__PURE__ */ new Map() : void 0;
4150
4151
const dirWatchers = /* @__PURE__ */ new Map();
4151
4152
const toCanonicalName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
4152
4153
return nonPollingWatchFile;
4153
4154
function nonPollingWatchFile(fileName, callback, _pollingInterval, fallbackOptions) {
4154
4155
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
+ }
4156
4159
const dirPath = getDirectoryPath(filePath) || ".";
4157
4160
const watcher = dirWatchers.get(dirPath) || createDirectoryWatcher(getDirectoryPath(fileName) || ".", dirPath, fallbackOptions);
4158
4161
watcher.referenceCount++;
@@ -4172,14 +4175,31 @@ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFi
4172
4175
const watcher = fsWatch(
4173
4176
dirName,
4174
4177
1 /* Directory */,
4175
- (_eventName , relativeFileName, modifiedTime ) => {
4178
+ (eventName , relativeFileName) => {
4176
4179
if (!isString(relativeFileName))
4177
4180
return;
4178
4181
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);
4180
4184
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
+ }
4181
4201
for (const fileCallback of callbacks) {
4182
- fileCallback(fileName, 1 /* Changed */, modifiedTime );
4202
+ fileCallback(fileName, eventKind, currentModifiedTime );
4183
4203
}
4184
4204
}
4185
4205
},
@@ -4573,7 +4593,7 @@ function createSystemWatchFunctions({
4573
4593
);
4574
4594
case 5 /* UseFsEventsOnParentDirectory */:
4575
4595
if (!nonPollingWatchFile) {
4576
- nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2);
4596
+ nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp );
4577
4597
}
4578
4598
return nonPollingWatchFile(fileName, callback, pollingInterval, getFallbackOptions(options));
4579
4599
default:
@@ -4748,7 +4768,7 @@ function createSystemWatchFunctions({
4748
4768
return watchPresentFileSystemEntryWithFsWatchFile();
4749
4769
}
4750
4770
try {
4751
- const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
4771
+ const presentWatcher = (entryKind === 1 /* Directory */ || !fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
4752
4772
fileOrDirectory,
4753
4773
recursive,
4754
4774
inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
@@ -42862,13 +42882,21 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
42862
42882
}
42863
42883
const nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, getDirectoryPath(modulePath));
42864
42884
const nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
42865
- if (nearestSourcePackageJson !== nearestTargetPackageJson) {
42885
+ const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
42886
+ if (!packageJsonPathsAreEqual(nearestTargetPackageJson, nearestSourcePackageJson, ignoreCase)) {
42866
42887
return maybeNonRelative;
42867
42888
}
42868
42889
return relativePath;
42869
42890
}
42870
42891
return isPathRelativeToParent(maybeNonRelative) || countPathComponents(relativePath) < countPathComponents(maybeNonRelative) ? relativePath : maybeNonRelative;
42871
42892
}
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
+ }
42872
42900
function countPathComponents(path) {
42873
42901
let count = 0;
42874
42902
for (let i = startsWith(path, "./") ? 2 : 0; i < path.length; i++) {
@@ -47996,15 +48024,19 @@ function createTypeChecker(host) {
47996
48024
return true;
47997
48025
}
47998
48026
}
47999
- function isEntityNameVisible (entityName, enclosingDeclaration ) {
48027
+ function getMeaningOfEntityNameReference (entityName) {
48000
48028
let meaning;
48001
48029
if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */) {
48002
48030
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 ) {
48004
48032
meaning = 1920 /* Namespace */;
48005
48033
} else {
48006
48034
meaning = 788968 /* Type */;
48007
48035
}
48036
+ return meaning;
48037
+ }
48038
+ function isEntityNameVisible(entityName, enclosingDeclaration) {
48039
+ const meaning = getMeaningOfEntityNameReference(entityName);
48008
48040
const firstIdentifier = getFirstIdentifier(entityName);
48009
48041
const symbol = resolveName(
48010
48042
enclosingDeclaration,
@@ -50065,9 +50097,10 @@ function createTypeChecker(host) {
50065
50097
introducesError = true;
50066
50098
return { introducesError, node };
50067
50099
}
50100
+ const meaning = getMeaningOfEntityNameReference(node);
50068
50101
const sym = resolveEntityName(
50069
50102
leftmost,
50070
- -1 /* All */ ,
50103
+ meaning ,
50071
50104
/*ignoreErrors*/
50072
50105
true,
50073
50106
/*dontResolveAlias*/
@@ -50077,13 +50110,13 @@ function createTypeChecker(host) {
50077
50110
if (isSymbolAccessible(
50078
50111
sym,
50079
50112
context.enclosingDeclaration,
50080
- -1 /* All */ ,
50113
+ meaning ,
50081
50114
/*shouldComputeAliasesToMakeVisible*/
50082
50115
false
50083
50116
).accessibility !== 0 /* Accessible */) {
50084
50117
introducesError = true;
50085
50118
} else {
50086
- context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */ );
50119
+ context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning );
50087
50120
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
50088
50121
}
50089
50122
if (isIdentifier(node)) {
@@ -57990,6 +58023,9 @@ function createTypeChecker(host) {
57990
58023
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
57991
58024
removeFromEach(typeSet, 65536 /* Null */);
57992
58025
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);
57993
58029
} else {
57994
58030
if (!checkCrossProductUnion(typeSet)) {
57995
58031
return errorType;
0 commit comments