fix(electron): retain unknown external module ownership (#7950)

This commit is contained in:
morluto authored and GitHub committed 2026-10-29 09:20:53 +08:00
1 parent 3536ea2f49
commit 59a895a193
4 files changed
+77 -5

No files matched your search

@@ -4494,3 +4494,28 @@ describe("package metadata at archive module boundaries", () => {
},
);
});
it("distinguishes an unobserved bare package from builtins and blocked aliases", () => {
const files = aliasFiles({
"package.json": JSON.stringify({
imports: { "#blocked": null, "#builtin": "node:path" },
}),
"main.js": "",
});
const resolveName = (declaredPath: string) =>
resolve({
declaredPath,
sourcePath: "main.js",
context: "module-specifier",
moduleKind: "require",
files,
});
expect(resolveName("outside-package")).toMatchObject({
resolution_status: "external",
unexamined_module_imports: true,
});
for (const name of ["node:path", "electron", "#blocked", "#builtin"])
expect(resolveName(name), name).not.toHaveProperty(
"unexamined_module_imports",
);
});