Skip to content

fix(transpile): preserve Unicode core export names in asm.js - #2302

Merged
vados-cosmonic merged 1 commit into
bytecodealliance:mainfrom
vados-cosmonic:fix/asmjs-unicode-export-names
Oct 23, 2026
Merged

vados-cosmonic merged 1 commit into
bytecodealliance:mainfrom
vados-cosmonic:fix/asmjs-unicode-export-names

Conversation

@vados-cosmonic

Copy link
Copy Markdown
Collaborator

With --js, core exports containing non-ASCII characters can fail with a missing-function TypeError. For example, an export named line\u2028\u2029 is looked up under a different name from the one emitted by wasm2js. Binaryen mangles UTF-8 bytes, while asmMangle previously operated on JavaScript's UTF-16 code units.

Mangle one UTF-8 byte at a time to match Binaryen. Include the double-quoted export-name rewrite shared with #2301 so this fix works independently against main. Add execution regressions for ASCII names, escaped names, and leading or embedded two-, three-, and four-byte Unicode characters, with minification both enabled and disabled.

Validation from packages/jco-transpile:

  • Confirmed the Unicode regression cases fail before the UTF-8 conversion and pass afterward.
  • pnpm exec vitest run -c test/vitest.lts.ts test/asm.ts — 20 passed.
  • pnpm exec vitest run -c test/vitest.lts.ts test/transpile.ts -t 'transpile to JS|transpile, optimize, minify' — 2 passed.
  • pnpm exec tsc -p tsconfig.json, affected-file oxlint and oxfmt checks, and git diff --check passed.

@vados-cosmonic
vados-cosmonic force-pushed the fix/asmjs-unicode-export-names branch from e1deb8e to 65cb4d9 Compare October 23, 2026 09:14
@vados-cosmonic
vados-cosmonic added this pull request to the merge queue Oct 23, 2026
Merged via the queue into bytecodealliance:main with commit 58cc466 Oct 23, 2026
66 checks passed
@vados-cosmonic
vados-cosmonic deleted the fix/asmjs-unicode-export-names branch October 23, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant