The headline of this release is three new bundle formats β wakaru now structurally unpacks Metro (React Native), Closure ModuleManager, and Cocos Creator 2.x bundles, alongside a hardening pass across every unpacker. It also fixes two defects shipped in v1.7.0: a --provenance crash on some scope-hoisted esbuild chunks, and an alias-inlining rule that could change program behavior.
π¦ New bundle formats
wakaru --unpack bundle.js -o out/- Metro (React Native / Expo) β plain
__d/__rbundles: numeric and string module ids, dependency-map rewriting to relative imports, ESM default/namespace import recovery, multiple entries, and stable output filenames. - Closure ModuleManager β marker- and initializer-delimited segment bundles, with entry attribution to the initializing segment and conservative rejection of ambiguous shapes.
- Cocos Creator 2.x β
window.__requireproject-script bundles (Browserify-family): string-keyed factories become named modules, dependency requests are rewritten to emitted filenames, and Cocos's basename retry is modeled for requests missing from the map. - Vercel ncc β better recovery of supported CommonJS output: inline startup sections and direct
module.exports = __nccwpck_require__(...)entries are now recognized.
π§° Unpacker hardening
- Runtime parameter renames can no longer capture your code. Normalizing factory parameters (
rβrequire,mβmodule, β¦) now checks collisions, pre-existing free references, and nested shadowing first. Conflicting bound locals are hygienically renamed; genuinely ambiguous cases (like a freetypeof requireprobe) conservatively keep the bundle unsplit instead of emitting misbound code. - Readable Browserify filenames β when every dependency request for a module agrees, it is emitted under that name (e.g.
lib/utility.js) instead ofmodule-3.js; entries stay stable and collisions deduplicate case-insensitively. - Fixed the v1.7.0
--provenancepanic ("body item already consumed") on scope-hoisted esbuild chunks where a statement was both claimed as module body and scheduled for helper cleanup. - Scope-hoisted splitting now merges synthesized clusters that would have emitted cyclic imports, preserving initialization order.
- Metro: colliding output filenames deduplicate deterministically; import temporaries that are later reassigned stay mutable locals.
- Browserify/Cocos: dynamic dependency maps no longer reject the bundle; explicit map entries stay authoritative over name fallbacks.
- Closure: entry attribution, marker parsing, and filename-extension edge cases hardened; forward graph references are rejected as invalid producer output.
- Failing synthetic-entry emission no longer drops already-extracted modules, and bundle-level inputs with source maps are rejected up front instead of misbehaving.
π New recovery
- async/await β recovers if-guarded awaits without an
else(tsc's mid-machine join shape), respects the awaiter'sthisargument when unwrapping (captured_thisaliases included), consumes proven cross-module tslib helpers, and rolls back cleanly on unsupported generator shapes. - Array rest β rebuilds nested rest patterns materialized through spread captures, detects minifier-mangled
arrayLikeToArrayhelpers by exact body semantics, and (ataggressive) recovers TypeScript's nesteditems[0]+slice(1)idiom. - Enums β safe CommonJS export recovery, preserved numeric mapping semantics, and no more duplicate recovered exports.
- ESM & interop β static live re-exports, and inline Babel default-interop wrappers collapse to plain imports.
- More shapes β TypeScript namespace-augmentation IIFEs, guarded direct calls (
a && a.b()β optional chaining), self-cachingtypeofhelpers,Object.definePropertysequences on fresh object literals, sliced callback parameters, and adjacentconstinitializers.
π‘οΈ Correctness & semantics
- Safer alias inlining β the generic temp-alias pass now requires a frozen-source proof (adjacent, single-read,
const, generated-looking names; imports and outer bindings excluded). This replaces v1.7.0's evaluation-order simulation, which could inline aliases whose source was later mutated. - Class-expression promotion is restricted to provably safe shapes, shadowed
undefinedreturns are respected, conditional object-spread branches are restored, and tracked Test262 failures were resolved.
β‘ Performance
- Prepared webpack module ASTs are reused across unpack phases, async-await rollback snapshots are deferred, statement cloning is avoided in argument-spread and inlining passes, and class-promotion analysis is hoisted. Unpack phase timings are exposed for profiling.
Full changelog: v1.7.0...v1.8.0