Skip to content

Conversation

@CPunisher
Copy link
Contributor

@CPunisher CPunisher commented Oct 29, 2025

Summary

Bump swc related crates.

.to_lossy boundary segmentation might not be optimal.

Related links

breaking changes:

  1. fix(es/ast): Fix unicode unpaired surrogates handling swc-project/swc#11144
  2. refactor(es/ast): Replace Literal with StringLiteral in JSXAttrValue type swc-project/swc#10763

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@netlify
Copy link

netlify bot commented Oct 29, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 3bf7f7f
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/690314b98f9cc400081650bd

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Oct 29, 2025
@CPunisher CPunisher requested a review from h-a-n-a October 29, 2025 11:26
@github-actions
Copy link
Contributor

github-actions bot commented Oct 29, 2025

📦 Binary Size-limit

Comparing 3bf7f7f to fix(wasm): add another SharedArrayBuffer instance check (#12037) by CPunisher

❌ Size increased by 36.88KB from 47.81MB to 47.84MB (⬆️0.08%)

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 29, 2025

CodSpeed Performance Report

Merging #12032 will not alter performance

Comparing 10-29-chore/swc (3bf7f7f) with main (046bae4)

Summary

✅ 17 untouched

@chenjiahan chenjiahan changed the title chore: bump swc chore(deps)!: bump swc_core to v46 Oct 29, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 30, 2025

📝 Benchmark detail: Open

Name Base (2025-10-30 84d653c) Current Change
10000_big_production-mode_disable-minimize + exec 27.4 s ± 1.23 s 27.4 s ± 768 ms -0.04 %
10000_development-mode + exec 1.31 s ± 18 ms 1.31 s ± 4.4 ms -0.11 %
10000_development-mode_hmr + exec 625 ms ± 9.1 ms 647 ms ± 26 ms +3.54 %
10000_development-mode_noop-loader + exec 2.22 s ± 39 ms 2.23 s ± 29 ms +0.76 %
10000_production-mode + exec 1.4 s ± 19 ms 1.38 s ± 63 ms -0.95 %
10000_production-mode_persistent-cold + exec 1.58 s ± 182 ms 1.55 s ± 105 ms -1.72 %
10000_production-mode_persistent-hot + exec 1.08 s ± 37 ms 1.06 s ± 25 ms -1.54 %
arco-pro_development-mode + exec 1.61 s ± 92 ms 1.59 s ± 71 ms -1.07 %
arco-pro_development-mode_hmr + exec 358 ms ± 0.71 ms 358 ms ± 1.5 ms +0.18 %
arco-pro_production-mode + exec 2.95 s ± 169 ms 2.93 s ± 81 ms -0.66 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 2.98 s ± 146 ms 3.02 s ± 63 ms +1.50 %
arco-pro_production-mode_persistent-cold + exec 2.98 s ± 128 ms 2.99 s ± 116 ms +0.32 %
arco-pro_production-mode_persistent-hot + exec 1.69 s ± 56 ms 1.7 s ± 21 ms +0.56 %
arco-pro_production-mode_traverse-chunk-modules + exec 2.94 s ± 129 ms 2.97 s ± 115 ms +0.94 %
large-dyn-imports_development-mode + exec 1.57 s ± 34 ms 1.58 s ± 45 ms +0.57 %
large-dyn-imports_production-mode + exec 1.6 s ± 24 ms 1.61 s ± 39 ms +0.79 %
threejs_development-mode_10x + exec 1.32 s ± 20 ms 1.3 s ± 39 ms -1.84 %
threejs_development-mode_10x_hmr + exec 945 ms ± 27 ms 907 ms ± 17 ms -3.98 %
threejs_production-mode_10x + exec 4.08 s ± 33 ms 4.1 s ± 255 ms +0.43 %
threejs_production-mode_10x_persistent-cold + exec 4.25 s ± 315 ms 4.25 s ± 333 ms -0.10 %
threejs_production-mode_10x_persistent-hot + exec 3.76 s ± 233 ms 3.68 s ± 27 ms -2.13 %
10000_big_production-mode_disable-minimize + rss memory 8734 MiB ± 65.3 MiB 8768 MiB ± 132 MiB +0.38 %
10000_development-mode + rss memory 603 MiB ± 27.8 MiB 622 MiB ± 35.2 MiB +3.28 %
10000_development-mode_hmr + rss memory 762 MiB ± 21.9 MiB 779 MiB ± 10.1 MiB +2.25 %
10000_development-mode_noop-loader + rss memory 921 MiB ± 25.7 MiB 920 MiB ± 32.3 MiB -0.08 %
10000_production-mode + rss memory 634 MiB ± 41.6 MiB 630 MiB ± 36.5 MiB -0.69 %
10000_production-mode_persistent-cold + rss memory 710 MiB ± 14.9 MiB 719 MiB ± 27.9 MiB +1.19 %
10000_production-mode_persistent-hot + rss memory 713 MiB ± 47 MiB 705 MiB ± 73.2 MiB -1.09 %
arco-pro_development-mode + rss memory 506 MiB ± 40.4 MiB 549 MiB ± 37.7 MiB +8.53 %
arco-pro_development-mode_hmr + rss memory 430 MiB ± 9.94 MiB 428 MiB ± 21.2 MiB -0.49 %
arco-pro_production-mode + rss memory 685 MiB ± 102 MiB 671 MiB ± 51.9 MiB -2.09 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 688 MiB ± 83.9 MiB 700 MiB ± 94.8 MiB +1.68 %
arco-pro_production-mode_persistent-cold + rss memory 803 MiB ± 97.1 MiB 751 MiB ± 60.6 MiB -6.50 %
arco-pro_production-mode_persistent-hot + rss memory 573 MiB ± 93 MiB 550 MiB ± 137 MiB -4.02 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 679 MiB ± 69.1 MiB 658 MiB ± 52.7 MiB -3.15 %
large-dyn-imports_development-mode + rss memory 633 MiB ± 10 MiB 645 MiB ± 11.5 MiB +1.89 %
large-dyn-imports_production-mode + rss memory 577 MiB ± 10 MiB 578 MiB ± 4.17 MiB +0.14 %
threejs_development-mode_10x + rss memory 573 MiB ± 21.3 MiB 558 MiB ± 18.3 MiB -2.68 %
threejs_development-mode_10x_hmr + rss memory 788 MiB ± 27.6 MiB 796 MiB ± 54.8 MiB +1.03 %
threejs_production-mode_10x + rss memory 826 MiB ± 171 MiB 858 MiB ± 40.3 MiB +3.79 %
threejs_production-mode_10x_persistent-cold + rss memory 839 MiB ± 68.6 MiB 829 MiB ± 28.7 MiB -1.16 %
threejs_production-mode_10x_persistent-hot + rss memory 678 MiB ± 27.2 MiB 666 MiB ± 56 MiB -1.73 %

@CPunisher CPunisher marked this pull request as ready for review October 30, 2025 07:02
Copilot AI review requested due to automatic review settings October 30, 2025 07:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request upgrades the SWC (Speedy Web Compiler) core dependencies from version 45.0.1 to 46.0.2, along with related SWC ecosystem packages. This is a major infrastructure update that requires changes throughout the codebase to adapt to breaking API changes in how SWC handles string atoms and UTF-8 encoding.

Key changes:

  • Upgrade of swc_core from 45.0.1 to 46.0.2 and related SWC packages
  • Migration from Atom to Wtf8Atom for handling potentially invalid UTF-8 strings
  • Addition of to_atom_lossy(), to_string_lossy(), and as_atom() conversions throughout the codebase
  • Test snapshot updates reflecting changes in code generation (variable naming in deconfliction scenarios)

Reviewed Changes

Copilot reviewed 32 out of 34 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Cargo.toml Updates SWC package versions to 44.0.0-46.0.2 range, removes swc_ecma_lexer dependency
Cargo.lock Lock file updates for new SWC versions and hstr 3.0.1
pnpm-lock.yaml Updates @swc/plugin-remove-console from 9.1.0 to 10.0.0
tests/rspack-test/package.json Updates @swc/plugin-remove-console dependency version
crates/swc_plugin_ts_collector/src/*.rs Migrates from Atom to Wtf8Atom for enum handling and type exports
crates/rspack_plugin_javascript/src/**/*.rs Adds lossy conversions for string literals and atoms throughout parser
crates/rspack_util/src/atom.rs Adds ModuleExportNameExt trait for consistent atom access
crates/rspack_util/src/fx_hash.rs Exports indexmap publicly
tests/rspack-test/statsAPICases/exports.js Updates hash value in snapshot
tests/rspack-test/esmOutputCases/deconflict/**/*.snap.txt Updates variable naming in snapshots
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

EnumMemberValue::Number(n) => Some(EvaluatedInlinableValue::new_number(n)),
EnumMemberValue::String(s) => Some(EvaluatedInlinableValue::new_string(s)),
EnumMemberValue::String(s) => Some(EvaluatedInlinableValue::new_string(
s.to_atom_lossy().into_owned(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should use Wtf8Atom here? Enum values may contain unpaired surrogates.

pub fn eval_str(str: &Str) -> BasicEvaluatedExpression<'_> {
let mut res = BasicEvaluatedExpression::with_range(str.span().real_lo(), str.span().real_hi());
res.set_string(str.value.to_string());
res.set_string(str.value.to_string_lossy().to_string());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use Wtf8Atom or Wtf8Buf here for the string type?

EnumMemberValue::Unknown => None,
};
(id, value)
(id.to_atom_lossy().into_owned(), value)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enum name would contain unpaired surrogates as well

@CPunisher CPunisher merged commit 0b13d2e into main Oct 30, 2025
44 checks passed
@CPunisher CPunisher deleted the 10-29-chore/swc branch October 30, 2025 08:21
@CPunisher CPunisher restored the 10-29-chore/swc branch October 30, 2025 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants