Follow and respect export maps when generating module specifiers (#46159)

* Follow and respect export maps when generating module specifiers

* Type baseline updates from master merge
This commit is contained in:
Wesley Wigham
2021-10-01 13:54:07 -07:00
committed by GitHub
parent 9ed49b6ba7
commit a02a7ab8e9
40 changed files with 1695 additions and 11 deletions
+10 -8
View File
@@ -1708,7 +1708,8 @@ namespace ts {
return idx === -1 ? { packageName: moduleName, rest: "" } : { packageName: moduleName.slice(0, idx), rest: moduleName.slice(idx + 1) };
}
function allKeysStartWithDot(obj: MapLike<unknown>) {
/* @internal */
export function allKeysStartWithDot(obj: MapLike<unknown>) {
return every(getOwnKeys(obj), k => startsWith(k, "."));
}
@@ -1922,14 +1923,15 @@ namespace ts {
}
return toSearchResult(/*value*/ undefined);
}
}
function isApplicableVersionedTypesKey(conditions: string[], key: string) {
if (conditions.indexOf("types") === -1) return false; // only apply versioned types conditions if the types condition is applied
if (!startsWith(key, "types@")) return false;
const range = VersionRange.tryParse(key.substring("types@".length));
if (!range) return false;
return range.test(version);
}
/* @internal */
export function isApplicableVersionedTypesKey(conditions: string[], key: string) {
if (conditions.indexOf("types") === -1) return false; // only apply versioned types conditions if the types condition is applied
if (!startsWith(key, "types@")) return false;
const range = VersionRange.tryParse(key.substring("types@".length));
if (!range) return false;
return range.test(version);
}
function loadModuleFromNearestNodeModulesDirectory(extensions: Extensions, moduleName: string, directory: string, state: ModuleResolutionState, cache: ModuleResolutionCache | undefined, redirectedReference: ResolvedProjectReference | undefined): SearchResult<Resolved> {