From e33df93a8cdea7faf7f485ef93cded7397bb4e3a Mon Sep 17 00:00:00 2001 From: zoomdong <1344492820@qq.com> Date: Wed, 25 Feb 2026 15:57:00 +0800 Subject: [PATCH 1/4] refactor(pack): remove emotion react transform --- crates/pack-core/Cargo.toml | 4 +-- crates/pack-core/src/client/context.rs | 3 +- crates/pack-core/src/config.rs | 20 +------------ .../src/shared/transforms/emotion.rs | 30 ------------------- crates/pack-core/src/shared/transforms/mod.rs | 1 - crates/pack-schema/src/lib.rs | 4 --- crates/pack-tests/Cargo.toml | 2 +- next.js | 2 +- packages/pack-shared/src/config.ts | 1 - packages/pack/config_schema.json | 27 +++++++++++++++-- packages/pack/docs/features-list.json | 6 ---- 11 files changed, 30 insertions(+), 70 deletions(-) delete mode 100644 crates/pack-core/src/shared/transforms/emotion.rs diff --git a/crates/pack-core/Cargo.toml b/crates/pack-core/Cargo.toml index c7ee6837fc..c00a7e6dad 100644 --- a/crates/pack-core/Cargo.toml +++ b/crates/pack-core/Cargo.toml @@ -70,11 +70,11 @@ turbopack-static = { workspace = true } [target.'cfg(not(all(target_family = "wasm", target_os = "unknown")))'.dependencies] turbo-tasks-fetch = { workspace = true } -turbopack-ecmascript-plugins = { workspace = true, default-features = true, features = ["transform_emotion"] } +turbopack-ecmascript-plugins = { workspace = true, default-features = true } [target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dependencies] getrandom = { version = "0.3", features = ["wasm_js"] } -turbopack-ecmascript-plugins = { workspace = true, default-features = false, features = ["transform_emotion"] } +turbopack-ecmascript-plugins = { workspace = true, default-features = false } [lints] workspace = true diff --git a/crates/pack-core/src/client/context.rs b/crates/pack-core/src/client/context.rs index cbd2b69f44..dbb5fdb8ae 100644 --- a/crates/pack-core/src/client/context.rs +++ b/crates/pack-core/src/client/context.rs @@ -53,7 +53,7 @@ use crate::{ classic_jsx_react_import::get_classic_jsx_react_import_rule, css_modules::get_auto_css_modules_rule, default_export_namer::get_default_export_namer_rule, - emotion::get_emotion_transform_rule, remove_console::get_remove_console_transform_rule, + remove_console::get_remove_console_transform_rule, styled_components::get_styled_components_transform_rule, styled_jsx::get_styled_jsx_transform_rule, swc_ecma_transform_plugins::get_swc_ecma_transform_plugin_rule, @@ -335,7 +335,6 @@ pub async fn get_client_module_options_context( let additional_rules: Vec = vec![ get_swc_ecma_transform_plugin_rule(config, project_path.clone()).await?, - get_emotion_transform_rule(config).await?, get_styled_components_transform_rule(config).await?, get_styled_jsx_transform_rule(config, target_browsers).await?, get_remove_console_transform_rule(config).await?, diff --git a/crates/pack-core/src/config.rs b/crates/pack-core/src/config.rs index 773b81e372..098007dae1 100644 --- a/crates/pack-core/src/config.rs +++ b/crates/pack-core/src/config.rs @@ -23,7 +23,7 @@ use turbopack_core::{ }; use turbopack_ecmascript::{OptionTreeShaking, TreeShakingMode}; use turbopack_ecmascript_plugins::transform::{ - emotion::EmotionTransformConfig, styled_components::StyledComponentsTransformConfig, + styled_components::StyledComponentsTransformConfig, }; use turbopack_node::transforms::webpack::{WebpackLoaderItem, WebpackLoaderItems}; @@ -270,7 +270,6 @@ pub struct ReactConfig { #[derive(Clone, Debug, PartialEq, Default, Deserialize, OperationValue)] #[serde(rename_all = "camelCase")] pub struct StyleConfig { - pub emotion: Option, pub styled_components: Option, #[bincode(with = "turbo_bincode::serde_self_describing")] sass: Option, @@ -687,23 +686,6 @@ impl PartialEq for SizeLimit { impl Eq for SizeLimit {} -#[turbo_tasks::value] -#[derive(Clone, Debug, Deserialize, OperationValue)] -#[serde(untagged)] -pub enum EmotionTransformOptionsOrBoolean { - Boolean(bool), - Options(EmotionTransformConfig), -} - -impl EmotionTransformOptionsOrBoolean { - pub fn is_enabled(&self) -> bool { - match self { - Self::Boolean(enabled) => *enabled, - _ => true, - } - } -} - #[turbo_tasks::value] #[derive(Clone, Debug, Deserialize, OperationValue)] #[serde(untagged)] diff --git a/crates/pack-core/src/shared/transforms/emotion.rs b/crates/pack-core/src/shared/transforms/emotion.rs deleted file mode 100644 index bbcc68a627..0000000000 --- a/crates/pack-core/src/shared/transforms/emotion.rs +++ /dev/null @@ -1,30 +0,0 @@ -use anyhow::Result; -use turbo_tasks::Vc; -use turbopack::module_options::ModuleRule; -use turbopack_ecmascript_plugins::transform::emotion::EmotionTransformer; - -use super::get_ecma_transform_rule; -use crate::{ - config::{Config, EmotionTransformOptionsOrBoolean}, - shared::transforms::EcmascriptTransformStage, -}; - -pub async fn get_emotion_transform_rule(config: Vc) -> Result> { - let module_rule = config - .styles() - .await? - .emotion - .as_ref() - .and_then(|config| match config { - EmotionTransformOptionsOrBoolean::Boolean(true) => { - EmotionTransformer::new(&Default::default()) - } - EmotionTransformOptionsOrBoolean::Options(value) => EmotionTransformer::new(value), - _ => None, - }) - .map(|transformer| { - get_ecma_transform_rule(Box::new(transformer), false, EcmascriptTransformStage::Main) - }); - - Ok(module_rule) -} diff --git a/crates/pack-core/src/shared/transforms/mod.rs b/crates/pack-core/src/shared/transforms/mod.rs index b4e2ef0223..034f352e88 100644 --- a/crates/pack-core/src/shared/transforms/mod.rs +++ b/crates/pack-core/src/shared/transforms/mod.rs @@ -11,7 +11,6 @@ use wasm::StaticWasmModuleType; pub mod classic_jsx_react_import; pub mod css_modules; pub mod default_export_namer; -pub mod emotion; pub mod image; pub mod modularize_imports; pub mod remove_console; diff --git a/crates/pack-schema/src/lib.rs b/crates/pack-schema/src/lib.rs index 6745d4cc10..ac239e0bbf 100644 --- a/crates/pack-schema/src/lib.rs +++ b/crates/pack-schema/src/lib.rs @@ -729,10 +729,6 @@ pub struct SchemaImageConfig { #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct SchemaStyleConfig { - /// Emotion transform configuration - #[serde(skip_serializing_if = "Option::is_none")] - #[schemars(description = "Emotion transform configuration")] - pub emotion: Option, /// Styled components configuration #[serde(skip_serializing_if = "Option::is_none")] diff --git a/crates/pack-tests/Cargo.toml b/crates/pack-tests/Cargo.toml index 7703a9e2e1..e613ced7e5 100644 --- a/crates/pack-tests/Cargo.toml +++ b/crates/pack-tests/Cargo.toml @@ -34,7 +34,7 @@ turbo-unix-path = { workspace = true } turbopack = { workspace = true } turbopack-browser = { workspace = true, features = ["test"] } turbopack-core = { workspace = true } -turbopack-ecmascript-plugins = { workspace = true, features = ["transform_emotion"] } +turbopack-ecmascript-plugins = { workspace = true } turbopack-node = { workspace = true, default-features = false, features = ["process_pool"] } turbopack-nodejs = { workspace = true, features = ["test"] } turbopack-resolve = { workspace = true } diff --git a/next.js b/next.js index 1e570f0320..8b2ba15454 160000 --- a/next.js +++ b/next.js @@ -1 +1 @@ -Subproject commit 1e570f0320190f12b0c67c2f7155014fc77d5c1f +Subproject commit 8b2ba154541003b71a4a5f6c3bf100da70f2b621 diff --git a/packages/pack-shared/src/config.ts b/packages/pack-shared/src/config.ts index 711e820dcc..d506a57ef9 100644 --- a/packages/pack-shared/src/config.ts +++ b/packages/pack-shared/src/config.ts @@ -184,7 +184,6 @@ export interface ConfigComplete { }; styledComponents?: boolean | StyledComponentsConfig; - emotion?: boolean | EmotionConfig; }; images?: { inlineLimit?: number; diff --git a/packages/pack/config_schema.json b/packages/pack/config_schema.json index 2ffd6a5e44..6ffb2de606 100644 --- a/packages/pack/config_schema.json +++ b/packages/pack/config_schema.json @@ -1021,6 +1021,13 @@ "null" ] }, + "chunkLoadingGlobal": { + "description": "The global variable name used by the runtime for loading chunks. Default: 'TURBOPACK'", + "type": [ + "string", + "null" + ] + }, "clean": { "description": "Whether to clean output directory before build", "type": [ @@ -1038,6 +1045,13 @@ "$ref": "#/definitions/SchemaCopyItem" } }, + "entryRootExport": { + "description": "Expose entry module exports to global scope with the specified name. When set, all named exports from the entry module will be available on window/globalThis under the specified name. If set to empty string, will use package.json name. Default: None (no exposure)", + "type": [ + "string", + "null" + ] + }, "filename": { "description": "Filename pattern for main files", "type": [ @@ -1207,9 +1221,6 @@ "description": "Style configuration", "type": "object", "properties": { - "emotion": { - "description": "Emotion transform configuration" - }, "inlineCss": { "description": "Inline CSS configuration" }, @@ -1261,6 +1272,16 @@ "description": "Whether to watch the filesystem for file changes.", "type": "boolean" }, + "ignored": { + "description": "Paths to ignore when watching for file changes. By default, ignores: node_modules", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, "pollInterval": { "description": "Enable polling at a certain interval if the native file watching doesn't work (e.g. docker).", "type": [ diff --git a/packages/pack/docs/features-list.json b/packages/pack/docs/features-list.json index b03300d150..02d1cb2165 100644 --- a/packages/pack/docs/features-list.json +++ b/packages/pack/docs/features-list.json @@ -285,12 +285,6 @@ "featureDetails": "[Styled Components](https://github.com/styled-components/styled-components)", "remarks": "" }, - { - "featureLevel2": "`emotion`", - "featureStatus": "✅", - "featureDetails": "[Emotion.js](https://github.com/emotion-js/emotion)", - "remarks": "" - }, { "featureLevel2": "`css parse, transform, minify`", "featureStatus": "✅", From 369e8fdae98146bb2a0cd0895549a0813bfd16ef Mon Sep 17 00:00:00 2001 From: zoomdong <1344492820@qq.com> Date: Wed, 25 Feb 2026 15:57:20 +0800 Subject: [PATCH 2/4] refactor(pack): remove emotion react transform --- crates/pack-core/src/config.rs | 4 +--- crates/pack-schema/src/lib.rs | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/pack-core/src/config.rs b/crates/pack-core/src/config.rs index 098007dae1..5095781958 100644 --- a/crates/pack-core/src/config.rs +++ b/crates/pack-core/src/config.rs @@ -22,9 +22,7 @@ use turbopack_core::{ resolve::ResolveAliasMap, }; use turbopack_ecmascript::{OptionTreeShaking, TreeShakingMode}; -use turbopack_ecmascript_plugins::transform::{ - styled_components::StyledComponentsTransformConfig, -}; +use turbopack_ecmascript_plugins::transform::styled_components::StyledComponentsTransformConfig; use turbopack_node::transforms::webpack::{WebpackLoaderItem, WebpackLoaderItems}; use crate::{ diff --git a/crates/pack-schema/src/lib.rs b/crates/pack-schema/src/lib.rs index ac239e0bbf..ebd3a66186 100644 --- a/crates/pack-schema/src/lib.rs +++ b/crates/pack-schema/src/lib.rs @@ -729,7 +729,6 @@ pub struct SchemaImageConfig { #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct SchemaStyleConfig { - /// Styled components configuration #[serde(skip_serializing_if = "Option::is_none")] #[schemars(description = "Styled components configuration")] From c1552d6653599137ead1fbf57f4ef3d47dd05c28 Mon Sep 17 00:00:00 2001 From: zoomdong <1344492820@qq.com> Date: Wed, 25 Feb 2026 16:00:21 +0800 Subject: [PATCH 3/4] refactor(pack): remove emotion react transform --- next.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/next.js b/next.js index 8b2ba15454..1e570f0320 160000 --- a/next.js +++ b/next.js @@ -1 +1 @@ -Subproject commit 8b2ba154541003b71a4a5f6c3bf100da70f2b621 +Subproject commit 1e570f0320190f12b0c67c2f7155014fc77d5c1f From 99fb91853d01bed50f4109b6fa273f36b7a0a7d4 Mon Sep 17 00:00:00 2001 From: zoomdong <1344492820@qq.com> Date: Wed, 25 Feb 2026 16:07:58 +0800 Subject: [PATCH 4/4] refactor(pack): remove emotion react transform --- packages/pack-shared/src/config.ts | 14 -------------- packages/pack/README.md | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/packages/pack-shared/src/config.ts b/packages/pack-shared/src/config.ts index d506a57ef9..f9852fea46 100644 --- a/packages/pack-shared/src/config.ts +++ b/packages/pack-shared/src/config.ts @@ -235,20 +235,6 @@ export interface StyledComponentsConfig { cssProp?: boolean; } -export interface EmotionConfig { - sourceMap?: boolean; - autoLabel?: "dev-only" | "always" | "never"; - labelFormat?: string; - importMap?: { - [importName: string]: { - [exportName: string]: { - canonicalImport?: [string, string]; - styledBaseImport?: [string, string]; - }; - }; - }; -} - export interface BundleOptions { /** * The utoo pack configs. diff --git a/packages/pack/README.md b/packages/pack/README.md index 5967730c48..caa3f9abff 100644 --- a/packages/pack/README.md +++ b/packages/pack/README.md @@ -22,7 +22,7 @@ - **Resolve**: Full support for `alias` and `extensions`. - **Styles**: Built-in support for Less, Sass, PostCSS, CSS Modules, and LightningCSS. - **Optimization**: Minification, Tree Shaking, Module Concatenation, and more. -- **Frameworks**: Optimized for React (including `styled-jsx`, `emotion`, `styled-components`). +- **Frameworks**: Optimized for React (including `styled-jsx`, `styled-components`). - **Tools**: Integrated Bundle Analyzer and Tracing Logs. > [!TIP]