From 55e7cc20dbd0dc1d8359a43e58e17efb103d9143 Mon Sep 17 00:00:00 2001 From: Malte Ubl Date: Mon, 26 Oct 2026 16:35:52 -0700 Subject: [PATCH 1/2] Have orderkit require its part when it loads Main resolves computed createRequire specifiers at run time, so a computed require inside a function no longer makes an island; one in module code still does. --- .../node-island/order/node_modules/orderkit/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/fixtures/node-island/order/node_modules/orderkit/index.js b/tests/fixtures/node-island/order/node_modules/orderkit/index.js index 072e3c4ff..9d4bfa8f4 100644 --- a/tests/fixtures/node-island/order/node_modules/orderkit/index.js +++ b/tests/fixtures/node-island/order/node_modules/orderkit/index.js @@ -1,5 +1,6 @@ "use strict"; -// Loads its part through a computed specifier, so it runs in a Node island. +// Loads its part through a computed specifier when it loads, so it runs in +// a Node island. const { createRequire } = require("node:module"); -const parts = ["./thing"].map((p) => createRequire(__filename)(p)); +const parts = [createRequire(__filename)(["./thing"][0])]; exports.make = () => new parts[0].Thing(); From a53c7eea6d104b7ff56d886095c4a94ba350d446 Mon Sep 17 00:00:00 2001 From: Malte Ubl Date: Mon, 26 Oct 2026 16:35:52 -0700 Subject: [PATCH 2/2] Do not count a synthesized fence as module code Main's lookup for builtin globals read through the global object lowers every global's value, and its fences have no source position, so they were marked as module-init fences and made packages like jose islands. The lookup runs when the program calls it. --- packages/compiler/src/frontend/lowering/lowerer.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/compiler/src/frontend/lowering/lowerer.ts b/packages/compiler/src/frontend/lowering/lowerer.ts index 9acba4606..d1eb4bd7a 100644 --- a/packages/compiler/src/frontend/lowering/lowerer.ts +++ b/packages/compiler/src/frontend/lowering/lowerer.ts @@ -1168,6 +1168,10 @@ export function lowerToIr( function markModuleInitFences(program: ts.Program, fences: readonly ScrDiagnostic[]): void { for (const d of fences) { if (!d.loc.file.includes("/node_modules/")) continue; + // A fence without a source position belongs to synthesized code, such + // as the global object's lookup (global-values.ts), which runs when the + // program calls it, not when the module evaluates. + if (d.loc.start < 0) continue; const sf = program.getSourceFile(d.loc.file); if (sf === undefined) continue; let inFunction = false;