Skip to content

Conversation

@CPunisher
Copy link
Contributor

Summary

This pr follows up to #12369

  1. Bump swc_experimental crates
  2. Apply swc_experimental to rspack_plugin_esm_library and get_renamed_inline_module. After that we can remove old IdentCollector

Checklist

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

@netlify
Copy link

netlify bot commented Dec 11, 2025

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit 85648a5
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/693bb0a0d6b4080008af9ec8
😎 Deploy Preview https://deploy-preview-12421--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added release: refactor team The issue/pr is created by the member of Rspack. labels Dec 11, 2025
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 refactors the codebase to use swc_experimental crates (version 0.2.0) for AST parsing and semantic analysis, replacing the previous implementation that used a custom IdentCollector visitor pattern. The refactoring applies to module concatenation logic in both the ESM library plugin and the JavaScript plugin.

Key changes:

  • Bumped swc_experimental_ecma_ast, swc_experimental_ecma_parser, and swc_experimental_ecma_semantic from version 0.1.1 to 0.2.0
  • Migrated parsing logic to use the new experimental parser APIs
  • Moved collect_ident function to a centralized utility in rspack_core/src/utils/concatenated_module_visitor.rs and removed the duplicate implementation from concatenated_module.rs

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Cargo.toml Bumped swc_experimental crate versions from 0.1.1 to 0.2.0
Cargo.lock Updated lock file with new swc_experimental versions and their updated dependencies
crates/rspack_core/src/utils/concatenated_module_visitor.rs Replaced old Visit-based IdentCollector with new collect_ident function using swc_experimental APIs
crates/rspack_core/src/concatenated_module.rs Migrated to swc_experimental parser, removed duplicate collect_ident implementation, updated semantic scope handling
crates/rspack_plugin_javascript/Cargo.toml Added swc_experimental dependencies
crates/rspack_plugin_javascript/src/plugin/mod.rs Migrated parsing to swc_experimental, removed old Ast wrapper usage, updated imports
crates/rspack_plugin_esm_library/Cargo.toml Added swc_experimental dependencies
crates/rspack_plugin_esm_library/src/link.rs Migrated parsing to swc_experimental, removed old Ast wrapper usage, updated imports

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 11, 2025

Rsdoctor Bundle Diff Analysis

Found 5 project(s) in monorepo.

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

📌 Baseline Commit: 127d0af7b7 | PR: #12405

Metric Current Baseline Change
📊 Total Size 5.7 MB 5.7 MB 0 B (0.0%)
📄 JavaScript 5.7 MB 5.7 MB 0 B (0.0%)
🎨 CSS 21.0 B 21.0 B 0 B (0.0%)
🌐 HTML 0 B 0 B N/A
📁 Other Assets 0 B 0 B N/A

📦 Download Diff Report: react-10k Bundle Diff

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

📌 Baseline Commit: 127d0af7b7 | PR: #12405

Metric Current Baseline Change
📊 Total Size 823.6 KB 823.6 KB 0 B (0.0%)
📄 JavaScript 823.6 KB 823.6 KB 0 B (0.0%)
🎨 CSS 0 B 0 B N/A
🌐 HTML 0 B 0 B N/A
📁 Other Assets 0 B 0 B N/A

📦 Download Diff Report: react-1k Bundle Diff

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

📌 Baseline Commit: 127d0af7b7 | PR: #12405

Metric Current Baseline Change
📊 Total Size 2.7 MB 2.7 MB 0 B (0.0%)
📄 JavaScript 2.7 MB 2.7 MB 0 B (0.0%)
🎨 CSS 21.0 B 21.0 B 0 B (0.0%)
🌐 HTML 0 B 0 B N/A
📁 Other Assets 0 B 0 B N/A

📦 Download Diff Report: react-5k Bundle Diff

📁 rome

Path: ../build-tools-performance/cases/rome/dist/rsdoctor-data.json

📌 Baseline Commit: 127d0af7b7 | PR: #12405

Metric Current Baseline Change
📊 Total Size 984.3 KB 984.3 KB 0 B (0.0%)
📄 JavaScript 984.3 KB 984.3 KB 0 B (0.0%)
🎨 CSS 0 B 0 B N/A
🌐 HTML 0 B 0 B N/A
📁 Other Assets 0 B 0 B N/A

📦 Download Diff Report: rome Bundle Diff

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

📌 Baseline Commit: 127d0af7b7 | PR: #12405

Metric Current Baseline Change
📊 Total Size 2.1 MB 2.1 MB 0 B (0.0%)
📄 JavaScript 2.0 MB 2.0 MB 0 B (0.0%)
🎨 CSS 83.0 KB 83.0 KB 0 B (0.0%)
🌐 HTML 0 B 0 B N/A
📁 Other Assets 0 B 0 B N/A

📦 Download Diff Report: ui-components Bundle Diff

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Contributor

github-actions bot commented Dec 11, 2025

📦 Binary Size-limit

Comparing 85648a5 to chore(ci): fix artifact discovery logic in Rsdoctor action (#12405) by yifancong

🎉 Size decreased by 28.50KB from 48.21MB to 48.19MB (⬇️0.06%)

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 11, 2025

CodSpeed Performance Report

Merging #12421 will not alter performance

Comparing 12-11-refactor/adapt-more-swc-experimental (85648a5) with main (127d0af)

Summary

✅ 17 untouched

@CPunisher CPunisher marked this pull request as draft December 11, 2025 09:39
@CPunisher CPunisher force-pushed the 12-11-refactor/adapt-more-swc-experimental branch from 22abe96 to 85648a5 Compare December 12, 2025 06:05
@CPunisher CPunisher marked this pull request as ready for review December 12, 2025 06:37
@CPunisher CPunisher marked this pull request as draft December 12, 2025 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants