mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
Three fixes. A function-local island handle read inside a closure, such as an island array spread in an arrow (`() => [...local]`), resolved to the enclosing function's binding without registering a capture, so the closure referred to a local it does not have (SC9001). The handle is now read through resolveLocal after its binding is retyped checked-dynamic, which captures it like any other local. A static island import or re-export loaded the island module in the importer's %init prelude, after every native dependency the file imports. A native module imported after the island package therefore evaluated first, which reverses Node's dependency order. The load now runs in its statement's place among the dependencies' %init calls. An island statement the import order leaves out keeps the prelude's place. Tests: 6897-node-island-declared-arrays gains closures that read, measure and spread a function-local island array. node-island-import-order checks evaluation order when an island re-export precedes a native import, and when an island import sits between two native imports. The SC1010 refusal of an import or re-export that resolves to type declarations now applies only when the declaration has no runtime file beside it (x.js for x.d.ts, x.mjs for x.d.mts, x.cjs for x.d.cts). A relative import of `./node_modules/dependency/index.js` names a module Node loads, and keeps its previous SC2013. The noUnusedLocals test reaches its declaration file through a type-only re-export, since a runtime import of a declaration-only file is now refused, as Node fails to load it.