Avatar for the swc-project user
swc-project
swc
BlogDocsChangelog

Performance History

Latest Results

fix(es/minifier): preserve effects of returned value calls (#12140) **Description:** A PURE annotation on a call-like expression does not make a later invocation of that expression's returned value pure. The minifier currently reuses the inner annotation and can remove the outer invocation together with its side effects. This change excludes direct call, optional-call, constructor, and tagged-template callees from callee purity propagation. It intentionally leaves ambiguous unparenthesized chains unchanged; the regression fixture uses parentheses to make annotation ownership explicit. The compact executable fixture covers all four direct call-like forms. **Validation:** - Focused executable regression fixture - Existing `issue_281/pure_annotation_1` and `pure_annotation_2` fixtures - `cargo fmt --all -- --check` - `cargo clippy -p swc_ecma_minifier --lib -- -D warnings` - Claude Opus 5 xhigh autoreview: clean after correcting the fixture scope **Related issue (if exists):** - https://github.com/vercel/next.js/issues/97369 - Related annotation-scope precedent: https://github.com/swc-project/swc/issues/12019
main
1 hour ago
fix(es/typescript): Fold ambient const and ambient enum members `tsc` treats `declare const x = 1` and members of `declare enum` that have constant initializers as constant enum expressions, while erasing the declarations themselves. The collection pass skipped everything ambient, so both stayed opaque and the following auto-incremented members collapsed to `undefined`. Ambient consts now populate `const_vars` like any other const. Ambient enum members go to a separate `ambient_enum_record` that only the evaluator consults: `tsc` folds them inside enum and const initializers but never rewrites runtime reads of the ambient object, and the inliner keys on `enum_record` membership. Member initializers evaluate against the normal enum record with an ambient fallback, so an ambient member can read an earlier concrete enum, a const binding, and bare sibling references keep resolving. Reads reached through type syntax stay opaque: the ambient lookup is gated on `allow_const_var`, which evaluation clears when it crosses an assertion, and ambient member initializers themselves follow the const-initializer rule, so type syntax inside them removes constness. The split also reproduces enum merging: the ambient half of a merged enum folds in initializers while its runtime reads stay untouched. In an ambient `const enum` every member is constant, so the usual auto-increment applies, and its id is registered in `const_enum` so it stays resolvable under `tsEnumIsMutable`. In a plain ambient enum a member without an initializer stays opaque, matching `tsc`. The mutable-enum guard applies to this pass as well: ambient members reading a mutable enum stay opaque.
baltasarblanco:fix/11715-ts-enum-const-var-folding
3 hours ago
fix(es/typescript): Fold ambient const and ambient enum members `tsc` treats `declare const x = 1` and members of `declare enum` that have constant initializers as constant enum expressions, while erasing the declarations themselves. The collection pass skipped everything ambient, so both stayed opaque and the following auto-incremented members collapsed to `undefined`. Ambient consts now populate `const_vars` like any other const. Ambient enum members go to a separate `ambient_enum_record` that only the evaluator consults: `tsc` folds them inside enum and const initializers but never rewrites runtime reads of the ambient object, and the inliner keys on `enum_record` membership. Member initializers evaluate against the normal enum record with an ambient fallback, so an ambient member can read an earlier concrete enum, a const binding, and bare sibling references keep resolving. Reads reached through type syntax stay opaque: the ambient lookup is gated on `allow_const_var`, which evaluation clears when it crosses an assertion. The split also reproduces enum merging: the ambient half of a merged enum folds in initializers while its runtime reads stay untouched. In an ambient `const enum` every member is constant, so the usual auto-increment applies, and its id is registered in `const_enum` so it stays resolvable under `tsEnumIsMutable`. In a plain ambient enum a member without an initializer stays opaque, matching `tsc`. The mutable-enum guard applies to this pass as well: ambient members reading a mutable enum stay opaque.
baltasarblanco:fix/11715-ts-enum-const-var-folding
4 hours ago
fix(es/minifier): preserve effects of returned value calls
marcoshernanz:codex/fix-pure-callee-return-call
7 hours ago
fix(es/minifier): preserve effects of returned value calls
marcoshernanz:codex/fix-pure-callee-return-call
8 hours ago
fix(es/minifier): disambiguate pure callee comments
marcoshernanz:codex/fix-pure-callee-return-call
9 hours ago
fix(es/minifier): freshen bindings at inline clone sites
marcoshernanz:codex/fix-cloned-iife-mangle-bindings
9 hours ago

Latest Branches

CodSpeed Performance Gauge
0%
fix(es/typescript): Treat const variable references as enum constants#12101
11 hours ago
7bffbb1
baltasarblanco:fix/11715-ts-enum-const-var-folding
CodSpeed Performance Gauge
0%
fix(es/minifier): preserve effects of returned value calls#12140
8 hours ago
51fde26
marcoshernanz:codex/fix-pure-callee-return-call
CodSpeed Performance Gauge
0%
9 hours ago
c296e39
marcoshernanz:codex/fix-cloned-iife-mangle-bindings
© 2026 CodSpeed Technology
Home Terms Privacy Docs