fix(javascript): resolve root package exports arrays (#1046)

Co-authored-by: N0zoM1z0 <1705004398@qq.com>
This commit is contained in:
Alex
2026-10-08 12:45:21 +08:00
committed by GitHub
parent 03424ae91e
commit 53409ab196
3 changed files with 26 additions and 4 deletions
@@ -440,12 +440,10 @@ const packageExport = (
moduleKind: ResolveArtifactPathInput["moduleKind"],
): PackageExportOutcome => {
if (typeof value === "string") return packagePathValue(value);
if (typeof value !== "object" || value === null || Array.isArray(value))
return { status: "invalid" };
if (typeof value !== "object" || value === null) return { status: "invalid" };
const root = Reflect.get(value, ".") ?? value;
if (typeof root === "string") return packagePathValue(root);
if (typeof root !== "object" || root === null || Array.isArray(root))
return { status: "invalid" };
if (typeof root !== "object" || root === null) return { status: "invalid" };
const flattened = exportTargets(root, packageExportConditions(moduleKind));
if (flattened.kind === "invalid") return { status: "invalid" };
const first =