mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-05 08:13:06 +08:00
A native module that re-exports an island package's names (`export { Type,
Static } from "typebox"`, pi's ai/src/index.ts) was refused with SC8010: the
re-export arm of the island import collection reported every export
declaration from an island package as a boundary, so an island value in
pi-ai's public API had no way to be written.
The barrel is now a module like any other: it loads the island package at
its own %init position (nodeIsland.defer, exactly as an import does),
snapshots the CommonJS named exports it re-exports, and registers each
re-exported name against the island's own export symbol. A name imported
from the barrel reaches that symbol through the checker's alias chain
(islandReexportOf), so islandBindingOf binds it as the island value it is —
including through a second barrel (`export { Num as NumberSchema } from
"./barrel.ts"`), since every re-exporting module registers the symbol its
chain ends on.
A namespace or star re-export has no name of its own to bind and stays
refused — and now actually reaches that refusal: the npm-import collection
skipped a star or namespace re-export before the island arm ran, so the
statement was silently dropped instead of refused. The guard routes it to
the island boundary refusal (a type-only star re-export stays erased like a
type-only named one), and the path-mapped re-export case in
node-island.test.ts pins that refusal with a star re-export rather than the
named one this commit makes work.
Test: tests/corpus/6898-node-island-reexport (a two-step barrel,
differential to Node, plain and sanitized).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>