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

Performance History

Latest Results

ci: Check changesets with git diff
kdy1/require-crate-changesets
13 minutes ago
ci: Require changesets for crate changes
kdy1/require-crate-changesets
19 minutes ago
chore: Add changeset
kdy1/fix-minifier-version-range
21 minutes ago
fix(es/minifier): keep directive prologue when merging if returns (#12580) The `if_return` pass merged the directive prologue of a function body into a sequence expression. A directive such as `"use strict"` then became a discarded `void` operand and stopped being a directive. The function lost strict mode. For example, `this` in a strict function became the global object, and `arguments` aliased its parameters. This change keeps the leading string-literal statements of a function body out of the `if_return` merge. The pass still merges the statements after them. This applies to ordinary functions and to block-bodied arrow functions. Tests: - Add the fixtures `issues/9238`, `issues/9238-arrow` and `issues/9238-prologue`. They check `arguments` aliasing, `this` in a strict function, a returned function in a strict arrow, multiple directives, and safe merging of ordinary statements. Each fixture also has a `expected.repeat-stdout` check for two minification rounds. All new fixtures fail without the fix. - Update the `next/swc-4559` snapshot. It now keeps `"use strict"`, which the old output wrongly dropped. - Update the antd gzipped size in `libs-size.snapshot.md` (+0.01 KiB) for the same reason. Local validation (on the final revision): `cargo fmt --all`, `cargo clippy --all --all-targets -- -D warnings`, `cargo test -p swc_ecma_minifier` and `crates/swc_ecma_minifier/scripts/exec.sh` passed. CI was not run locally. Closes #9238 --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
main
11 hours ago
fix(ts/fast-strip): preserve runtime boundaries during type erasure (#12575) **Description:** Rewrite `swc_ts_fast_strip` around explicit source edits and shared statement/member context to preserve runtime boundaries during type erasure. The examples below omit the whitespace padding left by in-place erasure. 1. Preserve optional fields named `get`, `set`, or `static`. Erasing `?` can cause the field name to be parsed as an accessor keyword or a `static` modifier for the following member. Insert a semicolon to preserve the field boundary. Input: ```ts class C { get? foo() {} } ``` Before — becomes a getter: ```js class C { get foo() {} } ``` After — retains a field and a method: ```js class C { get; foo() {} } ``` 2. Preserve initializer boundaries across erased class members. Erasing a `declare` or `abstract` member can cause the following computed member to continue the preceding field initializer. Input: ```ts abstract class C { x = 1 abstract m(): void ["n"]() {} } ``` Before — the computed key continues the initializer, producing invalid JavaScript: ```js class C { x = 1 ["n"]() {} } ``` After — the erased member leaves a semicolon separator: ```js class C { x = 1 ; ["n"]() {} } ``` 3. Preserve statement boundaries after `as const`. Erasing the assertion can cause the following statement to be parsed as a call, property access, or tagged template on the preceding expression. Input: ```ts 0 as const (() => {})(); ``` Before — attempts to call `0`: ```js 0 (() => {})(); ``` After — executes two separate statements: ```js 0; (() => {})(); ``` 4. Preserve directive boundaries across erased declarations. A type declaration terminates the directive prologue. Erasing it must not allow a subsequent string literal statement to join the prologue, even when preceded by earlier directives. Input: ```ts "custom"; type T = number; "use strict"; ``` Before — unintentionally enables strict mode: ```js "custom"; "use strict"; ``` After — preserves the original directive boundary: ```js "custom"; ; "use strict"; ``` 5. Preserve required labeled statement bodies. Erasing a labeled statement's body can leave invalid JavaScript or cause the label to capture the following statement. Retain an empty statement instead. Input: ```ts label: interface I {} ``` Before — leaves a dangling label: ```js label: ``` After: ```js label: ; ``` 6. Reject assertions that expose invalid exponentiation operands. A type assertion can hide an unparenthesized unary or `await` expression on the left-hand side of `**`. Report an error during type erasure instead of emitting invalid JavaScript. Input: ```ts const y = -x as number ** 2; ``` Before — emits invalid JavaScript: ```js const y = -x ** 2; ``` After — reports an error: ```text UnsupportedSyntax ``` Explicitly parenthesized operands and transform mode remain supported. Separators are written into erased source spans while preserving UTF-16 offsets and line terminators. Also reorganize and expand the fixture suites by syntax category and issue number, retain existing diagnostic fixtures, and reparse all successful fixture outputs to catch invalid JavaScript. **Related issue (if exists):** - Closes #12568 - Supersedes #12573
main
12 hours ago

Latest Branches

CodSpeed Performance Gauge
+3%
ci: require changesets for crate changes#12583
17 minutes ago
26ac08e
kdy1/require-crate-changesets
CodSpeed Performance Gauge
+2%
fix(es/minifier): release utils API required by registry builds#12582
26 minutes ago
7bd024e
kdy1/fix-minifier-version-range
CodSpeed Performance Gauge
+6%
6 days ago
ec177e4
fix/ts-namespace-enum-bindings
© 2026 CodSpeed Technology
Home Terms Privacy Docs