Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge latest main and retain the upstream wrapper ownership correction
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
  • Loading branch information
N0zoM1z0 and kaoru0822-kitauji committed Oct 14, 2026
commit a89ce212d6fe6a813f9160b2d4ea3f76deebd6c5
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,20 @@ describe("TypeScript import-equals links", () => {
});

describe("CommonJS wrapper parameter redeclarations", () => {
it("keeps a top-level wrapper require redeclaration", () => {
const path = "app/main.cjs";
it("does not infer a CommonJS wrapper from resolution mode in an explicit module", () => {
const path = "app/main.mjs";
const parsed = parseJavaScriptSource(
'var require; require("./wrapper.cjs");',
'var require; require("./dependency.cjs");',
path,
);
expect(parsed).not.toBeNull();
expect(parsed?.program.sourceType).toBe("module");
const ir = analyzeParsedJavaScriptSemantics(
parsed!,
moduleResolutionModeForJavaScriptReference(path, "static-import"),
);
expect(ir.moduleLinks).toContainEqual(
expect.objectContaining({ kind: "require", specifier: "./wrapper.cjs" }),
expect(ir.moduleLinks).not.toContainEqual(
expect.objectContaining({ specifier: "./dependency.cjs" }),
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ it("does not resolve a parameter named require as a module dependency", () => {
);
});

it("keeps a formatless top-level require redeclaration unresolved", () => {
it("keeps a top-level wrapper require redeclaration", () => {
const analysis = analyzeJavaScriptStaticSource(
`var require; require("./wrapper.cjs");`,
);
expect(analysis.references).toContainEqual(
expect.objectContaining({ kind: "require", specifier: null }),
expect.objectContaining({ specifier: "./wrapper.cjs" }),
);
});

Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.