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

Performance History

Latest Results

refactor(es/minifier): merge the rest param bailout into the existing check
baltasarblanco:fix/iife-rest-param-multiple-evaluation
9 minutes ago
fix(native): Allow unmapped overflow owners in Linux cache ancestors (#12547) <!-- Note: CI script will automatically rebase your PR so please do not rebase unless required --> <!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. --> **Description:** Linux user namespaces can report root-owned cache ancestors as owned by the unmapped overflow UID. The native cache rejected these ancestors, so both the user cache and `/tmp` fallback failed. Treat an overflow owner like root only when `/proc/self/uid_map` confirms that the UID is unmapped. Read proc information lazily, reuse it within one path validation, and retain the existing checks if reading or parsing fails. Directory mode, sticky-bit, symlink, and private cache entry checks remain enforced. Add mapping and permission fixtures plus a subprocess regression test that loads a real native fixture from the default, custom, temporary, and `/tmp` fallback caches, with and without a user namespace. Validation of the code commit `7b3c6a3cd5` (the following commit adds only a changeset): - `cargo fmt --all` passed. - `cargo clippy --all --all-targets -- -D warnings` passed on macOS. Cargo profile and Clippy MSRV configuration warnings remain. - `cargo test -p swc_native_addon` passed on macOS with the temporary directory canonicalized, as in CI. - `cargo test -p swc_native_addon` passed in Ubuntu 24.04 on Linux arm64, both normally and under `unshare --user --map-current-user` as UID/GID 1000. `SWC_TEST_REQUIRE_USERNS=1` ensured the namespace test did not skip; the security opt-out was unset. - `cargo clippy -p swc_native_addon --all-targets -- -D warnings` passed on Linux. - All crate tests passed with Rust 1.85.0 on Linux using an isolated copy and the repository lockfile. - The new namespace regression test failed against the unchanged original implementation: `/` appeared as UID 65534 with mode 0755, and both primary and fallback caches were rejected. It passed with this fix. Docker used a read-only repository mount, a separate build/cache volume, and `seccomp=unconfined` plus `apparmor=unconfined` to permit unprivileged user namespaces. **BREAKING CHANGE:** None. **Related issue (if exists):** Closes #12542
main
10 hours ago
chore: Add changeset
kdy1/fix-native-cache-userns
11 hours ago
fix(es/minifier): preserve rest array identity when its reference runs more than once
baltasarblanco:fix/iife-rest-param-multiple-evaluation
13 hours ago
fix(es/codegen): emit space after div if rhs starts with a regex (#12544) **Description:** With `minify: true`, a division whose right operand starts with a regular expression literal is printed without a space, so the `/` operator and the opening `/` of the regex become a `//` line comment: ```js var f = (a) => a / /ab/.source.length; console.log(f(4)); // 2 ``` is printed as `var f=a=>a//ab/.source.length;console.log(f(4));` (with `compress: false, mangle: false`; the defaults print `o=>o//ab/...`). The rest of the line is commented out, so nothing is logged and there is no error. In other positions the output fails to parse (`console.log(1 / /x/.exec("x").length)` becomes `console.log(1//x/.exec("x").length)`). With compress enabled the pattern can come from code that has no regex after the `/`: `1 / new RegExp("ab").source.length` becomes `1//ab/.source.length`. Reproduced with `@swc/core` 1.16.18 and 1.16.19-nightly-20261015.1, with and without compress and mangle. A `/` followed by a leading comment already gets a space since #9631, and `<` walks the emitted left edge of its right operand since #12523 (`starts_with_lt`). A `/` whose right operand starts with a regex literal never got either check: for `/`, `emit_bin_expr_trailing` only looks at `span.is_pure()` and leading comments. This adds `starts_with_regex` next to `starts_with_lt` in `util/token_boundaries.rs`. It follows the same emitted left edge (left operands of binary, conditional and sequence expressions, member objects, callees, optional chains, tagged template tags, postfix updates, and TypeScript `!`, `as`, `satisfies`, `as const` and instantiation expressions) and returns `true` when it reaches `Lit::Regex`. Parentheses and prefix operators already separate the tokens, so the walk stops there. The `/` arm of `emit_bin_expr_trailing` now also emits the space when it returns `true`. Only outputs that contain `//` at that boundary today change; `a /= /x/`, `a / (/x/, b)`, `a / -/x/` and a regex on the left (`/x/ / 2`) print as before. The check only runs in minify mode for the `/` operator, after the two existing checks. It stops at the first node that is not on the left edge (an identifier or a number returns on the first `match`) and does not allocate. **Tests:** New fixtures in `tests/fixture/regex-division-boundary/`: - `js/input.js` (`check_ast` and `exec`): a bare regex, flags, `/=/`, member, call, computed member, optional chain, tagged template, `**`, chained divisions, a regex on both sides, and a regex after `/` inside a template, an object, an array, an arrow body, a `return` and a class field. It also keeps the `/=`, parenthesized and unary cases, which were already correct. - `ts/input.ts` (`check_ast`): `/x/!` and `/x/<T>` on the right of `/`. Both fail without the change (`generated code failed to parse` for `js`, `generated code changed the AST` for `ts`; the minified output contains `a//x/`) and pass with it. The new minified `js` output is the old one with a space added at each of its 19 `/` + regex boundaries, and nothing else. - `cargo test -p swc_ecma_codegen --no-fail-fast`: 4213 passed, 0 failed (4211 on `main` plus the 2 new fixtures). - `cargo test -p swc_ecma_minifier --no-fail-fast`: 8023 passed, 0 failed, same as `main`, with no fixture or snapshot output changes. - `crates/swc_ecma_minifier/scripts/exec.sh`: passes. - `cargo clippy -p swc_ecma_codegen --all-targets -- -D warnings` and `cargo fmt --all -- --check`: clean. **Related issue (if exists):** Closes #12530 --- Found with a differential fuzzer. Drafted with AI assistance.
main
14 hours ago

Latest Branches

CodSpeed Performance Gauge
+4%
fix(es/codegen): preserve optional call type arguments#12549
4 hours ago
f94be83
fix/optional-call-type-arguments
CodSpeed Performance Gauge
+4%
22 hours ago
26b0b89
fix/ts-namespace-enum-bindings
CodSpeed Performance Gauge
+3%
fix(native): Allow unmapped overflow owners in Linux cache ancestors#12547
11 hours ago
c0a4cc5
kdy1/fix-native-cache-userns
© 2026 CodSpeed Technology
Home Terms Privacy Docs