Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 50 additions & 14 deletions lib/tsc.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,7 @@ and limitations under the License.

// src/compiler/corePublic.ts
var versionMajorMinor = "5.4";
var version = "5.4.3";
var version = "5.4.321";

// src/compiler/core.ts
var emptyArray = [];
Expand DownExpand Up@@ -4145,14 +4145,17 @@ function createDynamicPriorityPollingWatchFile(host) {
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
}
}
function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2) {
function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp) {
const fileWatcherCallbacks = createMultiMap();
const fileTimestamps = fsWatchWithTimestamp ? /* @__PURE__ */ new Map() : void 0;
const dirWatchers = /* @__PURE__ */ new Map();
const toCanonicalName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
return nonPollingWatchFile;
function nonPollingWatchFile(fileName, callback, _pollingInterval, fallbackOptions) {
const filePath = toCanonicalName(fileName);
fileWatcherCallbacks.add(filePath, callback);
if (fileWatcherCallbacks.add(filePath, callback).length === 1 && fileTimestamps) {
fileTimestamps.set(filePath, getModifiedTime3(fileName) || missingFileModifiedTime);
}
const dirPath = getDirectoryPath(filePath) || ".";
const watcher = dirWatchers.get(dirPath) || createDirectoryWatcher(getDirectoryPath(fileName) || ".", dirPath, fallbackOptions);
watcher.referenceCount++;
Expand All@@ -4172,14 +4175,31 @@ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFi
const watcher = fsWatch(
dirName,
1 /* Directory */,
(_eventName, relativeFileName, modifiedTime) => {
(eventName, relativeFileName) => {
if (!isString(relativeFileName))
return;
const fileName = getNormalizedAbsolutePath(relativeFileName, dirName);
const callbacks = fileName && fileWatcherCallbacks.get(toCanonicalName(fileName));
const filePath = toCanonicalName(fileName);
const callbacks = fileName && fileWatcherCallbacks.get(filePath);
if (callbacks) {
let currentModifiedTime;
let eventKind = 1 /* Changed */;
if (fileTimestamps) {
const existingTime = fileTimestamps.get(filePath);
if (eventName === "change") {
currentModifiedTime = getModifiedTime3(fileName) || missingFileModifiedTime;
if (currentModifiedTime.getTime() === existingTime.getTime())
return;
}
currentModifiedTime || (currentModifiedTime = getModifiedTime3(fileName) || missingFileModifiedTime);
fileTimestamps.set(filePath, currentModifiedTime);
if (existingTime === missingFileModifiedTime)
eventKind = 0 /* Created */;
else if (currentModifiedTime === missingFileModifiedTime)
eventKind = 2 /* Deleted */;
}
for (const fileCallback of callbacks) {
fileCallback(fileName, 1 /* Changed */, modifiedTime);
fileCallback(fileName, eventKind, currentModifiedTime);
}
}
},
Expand DownExpand Up@@ -4573,7 +4593,7 @@ function createSystemWatchFunctions({
);
case 5 /* UseFsEventsOnParentDirectory */:
if (!nonPollingWatchFile) {
nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2);
nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp);
}
return nonPollingWatchFile(fileName, callback, pollingInterval, getFallbackOptions(options));
default:
Expand DownExpand Up@@ -4748,7 +4768,7 @@ function createSystemWatchFunctions({
return watchPresentFileSystemEntryWithFsWatchFile();
}
try {
const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
const presentWatcher = (entryKind === 1 /* Directory */ || !fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
fileOrDirectory,
recursive,
inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
Expand DownExpand Up@@ -42862,13 +42882,21 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
}
const nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, getDirectoryPath(modulePath));
const nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
if (nearestSourcePackageJson !== nearestTargetPackageJson) {
const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
if (!packageJsonPathsAreEqual(nearestTargetPackageJson, nearestSourcePackageJson, ignoreCase)) {
return maybeNonRelative;
}
return relativePath;
}
return isPathRelativeToParent(maybeNonRelative) || countPathComponents(relativePath) < countPathComponents(maybeNonRelative) ? relativePath : maybeNonRelative;
}
function packageJsonPathsAreEqual(a, b, ignoreCase) {
if (a === b)
return true;
if (a === void 0 || b === void 0)
return false;
return comparePaths(a, b, ignoreCase) === 0 /* EqualTo */;
}
function countPathComponents(path) {
let count = 0;
for (let i = startsWith(path, "./") ? 2 : 0; i < path.length; i++) {
Expand DownExpand Up@@ -47996,15 +48024,19 @@ function createTypeChecker(host) {
return true;
}
}
function isEntityNameVisible(entityName, enclosingDeclaration) {
function getMeaningOfEntityNameReference(entityName) {
let meaning;
if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */) {
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
} else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */) {
} 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) {
meaning = 1920 /* Namespace */;
} else {
meaning = 788968 /* Type */;
}
return meaning;
}
function isEntityNameVisible(entityName, enclosingDeclaration) {
const meaning = getMeaningOfEntityNameReference(entityName);
const firstIdentifier = getFirstIdentifier(entityName);
const symbol = resolveName(
enclosingDeclaration,
Expand DownExpand Up@@ -50065,9 +50097,10 @@ function createTypeChecker(host) {
introducesError = true;
return { introducesError, node };
}
const meaning = getMeaningOfEntityNameReference(node);
const sym = resolveEntityName(
leftmost,
-1 /* All */,
meaning,
/*ignoreErrors*/
true,
/*dontResolveAlias*/
Expand All@@ -50077,13 +50110,13 @@ function createTypeChecker(host) {
if (isSymbolAccessible(
sym,
context.enclosingDeclaration,
-1 /* All */,
meaning,
/*shouldComputeAliasesToMakeVisible*/
false
).accessibility !== 0 /* Accessible */) {
introducesError = true;
} else {
context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning);
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
}
if (isIdentifier(node)) {
Expand DownExpand Up@@ -57990,6 +58023,9 @@ function createTypeChecker(host) {
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
removeFromEach(typeSet, 65536 /* Null */);
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
} else if (typeSet.length >= 4) {
const middle = Math.floor(typeSet.length / 2);
result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle)), getIntersectionType(typeSet.slice(middle))], aliasSymbol, aliasTypeArguments);
} else {
if (!checkCrossProductUnion(typeSet)) {
return errorType;
Expand Down
Loading