mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-31 07:23:06 +08:00
- export default <mutable let> registers Node's snapshot as const storage keyed by the default alias symbol; resolveValueSymbol's default-hop walk stops importer reads there instead of chasing to the live let (corpus 2426 pins the snapshot/live split against export { x as default })
- named re-exports from installed npm packages lower as import-plus-export plumbing: the island load registers at the statement's position and bindings key the aliased symbols direct imports use (npm case npm-reexport covers named, renamed, CJS, and as-default spellings)
- node:perf_hooks joins the supported builtins: performance.now() lowers to scr_perf_now (the uptime anchor's monotonic clock, fractional ms), and performance.now.bind(performance) lowers as a () => number function value (corpus 2427); both backends
13 lines
353 B
TypeScript
13 lines
353 B
TypeScript
// `export default <mutable identifier>` — Node SNAPSHOTS the value when the
|
|
// export statement runs; later writes to the let stay invisible through the
|
|
// importer's default binding (the named exports below stay LIVE).
|
|
let v = 1;
|
|
v = v + 1;
|
|
export default v;
|
|
export function bump(): void {
|
|
v = 99;
|
|
}
|
|
export function read(): number {
|
|
return v;
|
|
}
|