Skip to content

feat: upgrade to typescript v6 & binaryen v129#8

Open
BlobMaster41 wants to merge 4 commits intov0.29from
feat/typescript-v6-migration
Open

feat: upgrade to typescript v6 & binaryen v129#8
BlobMaster41 wants to merge 4 commits intov0.29from
feat/typescript-v6-migration

Conversation

@BlobMaster41
Copy link
Copy Markdown

@BlobMaster41 BlobMaster41 commented Apr 26, 2026

Adapt project to updated Binaryen / wasm IR and toolchain behavior. Key changes:

  • Updated TypeScript glue for Binaryen: use bigint for i64/f64-bits literals, add MemoryOrder parameter to atomic ops and default to SeqCst, change AtomicFence signature, adjust string/table/memory segment APIs, and rename/fix several function signatures to match the new Binaryen runtime.
  • Modified module.ts to add new feature flags, expression ids, MemoryOrder enum, atomic helpers that pass the memory order, updated i64 literal construction to use BigInt, and added addTable helper handling addressType.
  • Pre-create default memory in compiler.ts so Binaryen helpers can resolve memory references earlier in compilation.
  • build-dts.js: drop side-effect-only imports when generating declaration bundles to avoid TS2882 with nodenext resolution.
  • package.json: relax/adjust tsc script flags for config and ignoreConfig to better fit the build/check workflows.
  • Updated many emitted .wat tests to reflect new codegen (reordered memory.size usage, local.set vs local.tee changes, br_table target canonicalization, stack handling and inlining/folding changes, etc.).

These updates align the codebase with the newer Binaryen API and ensure correct declaration output and wasm code generation under the updated toolchain.

  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

Bump development dependencies (ESLint toolchain, TypeScript, esbuild, @typescript-eslint and related packages) and regenerate the lockfile. Remove the custom "indent" rule from eslint.config.js to simplify formatting/style enforcement. Apply small, related adjustments in tsconfig-base.json, std/assembly/util/number.ts and tests/allocators/runner.js.
Adapt project to updated Binaryen / wasm IR and toolchain behavior. Key changes:

- Updated TypeScript glue for Binaryen: use bigint for i64/f64-bits literals, add MemoryOrder parameter to atomic ops and default to SeqCst, change AtomicFence signature, adjust string/table/memory segment APIs, and rename/fix several function signatures to match the new Binaryen runtime.
- Modified module.ts to add new feature flags, expression ids, MemoryOrder enum, atomic helpers that pass the memory order, updated i64 literal construction to use BigInt, and added addTable helper handling addressType.
- Pre-create default memory in compiler.ts so Binaryen helpers can resolve memory references earlier in compilation.
- build-dts.js: drop side-effect-only imports when generating declaration bundles to avoid TS2882 with nodenext resolution.
- package.json: relax/adjust tsc script flags for config and ignoreConfig to better fit the build/check workflows.
- Updated many emitted .wat tests to reflect new codegen (reordered memory.size usage, local.set vs local.tee changes, br_table target canonicalization, stack handling and inlining/folding changes, etc.).

These updates align the codebase with the newer Binaryen API and ensure correct declaration output and wasm code generation under the updated toolchain.
@BlobMaster41 BlobMaster41 changed the title Feat/typescript v6 migration feat: upgrade to typescript v6 & binaryen v129 Apr 26, 2026
Multiple changes:

- scripts/build-dts.js: Removed the previous drop-for-side-effect-only-imports logic and instead emit an explicit empty module stub for 'src/glue/js/index' to avoid TS2882 under TS >= 6 (nod e n e x t module resolution) while keeping the ambient declarations already emitted.

- src/compiler.ts: Add a duplicate-function check for semantically named declarations that compares source and start position to distinguish recompilation from true duplicate implementations; emit DiagnosticCode.Duplicate_function_implementation and return unreachable on error. Also minor reordering of the local module variable.

- src/glue/binaryen.d.ts: Introduce DataSegmentRef = Ref and update Binaryen memory segment APIs to use DataSegmentRef for segment parameters (get offset/length and copy functions).

These changes fix TypeScript declaration generation issues, improve duplicate-implementation detection, and correct Binaryen typings for data segments.
Add a JS wrapper that patches the binaryen export to provide (low, high) i64 literal/const accessors on top of binaryen 129's BigInt-based C-ABI (with a sentinel to avoid double-patching). Update TypeScript declarations and glue to reflect the new low/high signatures, re-export the wrapped functions, and adjust Module usages to call the new APIs (including replacing inline BigInt packing and adding explicit <u8> casts for MemoryOrder in atomic ops). This preserves compatibility with AssemblyScript callers and the bootstrapped wasm host shim that expect the legacy split i64 convention.
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