Skip to content

Conversation

@fireairforce
Copy link

从 turbopack 分支 cherry-pick 了两个 swc 版本 bump 的 commit,utoopack 需要用到 swc plugins 提供的一些 transform plugins 特性。

xusd320 and others added 7 commits July 29, 2025 23:54
* feat(turbopack): apply utoo patches to canary

* chore: update external code

---------

Co-authored-by: zoomdong <1344492820@qq.com>
* feat(turbopack): externalType support umd

* fix: clippy

* fix: use CompileTimeDefineValue::Evaluate

---------

Co-authored-by: xusd320 <xusd320@gmail.com>
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @fireairforce, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在将项目中的SWC依赖升级到最新版本(v36),以利用其提供的最新功能,特别是SWC插件的转换特性,这对于utoopack的正常运行至关重要。此次升级涉及更新多个Rust包及其依赖,并相应调整了部分代码和测试用例,以确保与新版SWC的兼容性。

Highlights

  • SWC版本升级: 将swc_core及其相关依赖升级到36.0.1版本,并更新了Cargo.lock中大量swc_*系列的crate版本。
  • 引入Wasmer后端: 新增swc_plugin_backend_wasmer依赖,并在crates/napi/Cargo.toml和turbopack/crates/turbopack-ecmascript-plugins/Cargo.toml中启用其特性。
  • 插件编译优化: turbopack/crates/turbopack-ecmascript-plugins/src/transform/swc_ecma_transform_plugins.rs中更新了插件模块的编译方式,使用WasmerRuntime进行优化。
  • 模块化导入配置: 在modularize_imports.rs中为ModularizeImportsConfig结构体添加了style: None字段。
  • 测试用例更新: 调整了多个测试文件(包括ReactRefreshLogBox.test.ts和error-recovery.test.ts)中预期的错误信息,以匹配新版SWC的输出。
  • 代码分析器改进: turbopack/crates/turbopack-ecmascript/src/analyzer/graph.rs中contains_ident_ref函数的调用方式进行了微调。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the swc version and its dependencies in the project. It also includes changes to incorporate swc_plugin_backend_wasmer for plugin execution and fixes some error message displays in tests. The review focuses on ensuring the updates are correctly applied and the new features are properly integrated.

"cfg-if",
"constant_time_eq",
"digest",
]

Choose a reason for hiding this comment

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

medium

The digest dependency is removed. Verify that this doesn't break any functionality that relies on it. If it's no longer needed, this is fine, but confirm it's intentional.

"swc_ecma_visit",
"swc_error_reporters",
"swc_node_comments",
"swc_plugin_backend_wasmer",

Choose a reason for hiding this comment

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

medium

The swc_plugin_proxy dependency is added. Ensure that this is the correct version and that it is compatible with the other swc packages.

Comment on lines +8176 to +8189
name = "swc_plugin_backend_wasmer"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d888829d5c88ed444eea30e63b18155fb0b4197bb6e43e6c50439bb5ad220a4b"
dependencies = [
"anyhow",
"enumset",
"parking_lot",
"swc_common",
"swc_plugin_runner",
"wasmer",
"wasmer-compiler-cranelift",
"wasmer-wasix",
]

Choose a reason for hiding this comment

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

medium

A new dependency swc_plugin_backend_wasmer is added. Confirm that all its dependencies are aligned with the project's requirements and that there are no version conflicts.

"ecma_loader_parking_lot",
"parallel_rayon",
] }
swc_plugin_backend_wasmer = { version = "2.0.0" }

Choose a reason for hiding this comment

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

medium

The swc_plugin_backend_wasmer dependency is added. Ensure that this is the correct version and that it is compatible with the other swc packages.

"swc_core/plugin_transform_host_native",
"swc_core/plugin_transform_host_native_filesystem_cache",
"swc_core/plugin_transform_host_native_shared_runtime",
"swc_core/plugin_backend_wasmer",

Choose a reason for hiding this comment

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

medium

The swc_core/plugin_backend_wasmer feature is enabled. Ensure that this feature is correctly enabled and that it doesn't conflict with other features.

@xusd320
Copy link

xusd320 commented Sep 3, 2025

能整个基线同步吗?cp 会让我们的基线变乱

@fireairforce
Copy link
Author

直接把 next.js rebase 到最新吗?这里其实也不算cp,我把升级的两个commit 手动处理成一个了,到时候rebase更新的的时候,这里的改动应该不会冲突

@fireairforce
Copy link
Author

能整个基线同步吗?cp 会让我们的基线变乱

线下讨论了一下,直接把 utoo 分支 更新到 next.js canary 最新

@fireairforce
Copy link
Author

utoo 分支同步了 next.js/canary 该 pr 先关闭

@xusd320 xusd320 deleted the bump-swc branch November 25, 2025 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants