ReviewOS

home-lang/home

Bun.Transpiler.scan: preserve sorted export-name contract

#575
Closed chris opened this 10 days ago ·
10 days ago

Follow-up to #66, found while verifying #567 against the unchanged transpiler corpus at Bun source pin 4982b91e3702094330f3be3883354c52b8c01323.

The unchanged bundler/transpiler/transpiler.test.js case Bun.Transpiler > scan > reports all export names expects ["action", "default", "loader"]. Native Home returned the underlying hash-map iteration order beginning with "loader", so the case failed before its import assertions. Installed Bun 1.3.14 and the pinned Zig implementation sort the named-export map by its string keys before producing the JavaScript array.

Port that actual sorting step in namedExportsToJS. Verify the unchanged pinned assertion plus repeated standalone scans, including declarations whose source order differs from lexical order. Do not special-case these names or sort the JavaScript result after conversion.

This is independent of the async diagnostic/placeholder-AST crash in #567 and parser stack exhaustion in #574.

10 days ago

Resolved on main by f8d70bcd2.

namedExportsToJS now applies the pinned Bun StringArrayByIndexSorter to the named-export map before producing the JavaScript array. The unchanged corpus assertion now passes with ["action", "default", "loader"].

Verification:

  • unchanged pinned case: 1 pass / 188 filtered out / 0 fail / 8 assertions;
  • standalone lexical-order control: 128 scans per run, eight consecutive Home runs;
  • installed Bun 1.3.14 control passes;
  • full native runtime regression batch: 59 pass / 0 fail;
  • debug build, focused Pickier, Zig formatting, and whitespace checks pass.

No names or fixture paths are special-cased. Parser stack exhaustion remains separate in #574; full parity remains #66.

Sign in to comment on this issue.