v2.12.0
Playground/Docs
- Fixed opening files in the sidebar for windows (#40)
- Added various examples, docs for common errors
Unminify
- Unminify
typeof a > "u"->typeof a === "undefined" - Convert for to while:
for (;;) b()->while (true) b();for (; a(); ) b();->while (a()) b();
- Extract sequence from while loop:
while (a(), b()) c();->a(); while (b()) c(); - Split vars in for loop:
for (var i = 0, j = 1;;) {}->var i = 0; var j = 1; while (true) {}thanks to @kuizuo (#37) - Invert boolean logic:
!(a <= b)->a > b - Fixed a mangle error when default parameters are used (#42)
- Option to disable:
await webcrack(source, { unminify: false })
Transpile
New WIP category for converting transpiled code of Babel/TypeScript/SWC/esbuild back to modern syntax:
- Merge any expression into template literals:
a + "b".concat(c)-> `${a}b${c}` - Fixed template literal escaping for
\0\b\f\n\r\t\v - Logical assignments:
x && (x = y)->x &&= yvar _x$y; (_x$y = x.y()).z || (_x$y.z = b);->x.y().z ||= b;
- Nullish coalescing:
var _a; (_a = a) !== null && _a !== undefined ? _a : b;->a ?? b - Nullish coalescing assignment:
var _a; (_a = a) !== null && _a !== void 0 ? _a : a = b;->a ??= b; - Optional chaining:
a === null || a === undefined ? undefined : a.b->a?.b
Unpack Bundle
- Detect webpack 5 bundle without entry id (#33)
JSX
- Create component variables:
jsx(r ? "a" : "div", {});->const Component = r ? "a" : "div"; <Component />(#38)
Deobfuscate
- Inline variables that are assigned later:
let a; ...; a = 1; let b = a;->let b = 1(#36)