Skip to content

Commit cad6d3a

Browse files
kwonojalexkirszForsakenHarmony
authored
refactor(next-core): deprecate custom_ecmascript_transforms (#49629)
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation or adding/fixing Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### Why? ### How? Closes NEXT- Fixes # --> ### What? WEB-1031. Deprecate old custom_ecmascript_transforms, consolidate to use ecmatransforms_plugin instead. Requires vercel/turborepo#4886 . --------- Co-authored-by: Alex Kirszenberg <[email protected]> Co-authored-by: Leah <[email protected]>
1 parent 16150a3 commit cad6d3a

File tree

7 files changed

+137
-116
lines changed

7 files changed

+137
-116
lines changed

Cargo.lock

Lines changed: 33 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ swc_core = { version = "0.75.41" }
4242
testing = { version = "0.33.4" }
4343

4444
# Turbo crates
45-
turbo-binding = { package = "turbopack-binding", git = "https://github.com/vercel/turbo.git", tag = "turbopack-230511.2" }
45+
turbo-binding = { package = "turbopack-binding", git = "https://github.com/vercel/turbo.git", tag = "turbopack-230511.3" }
4646
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros..
47-
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230511.2" }
47+
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230511.3" }
4848
# [TODO]: need to refactor embed_directory! macro usage in next-core
49-
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230511.2" }
49+
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230511.3" }
5050

5151
# General Deps
5252

packages/next-swc/crates/next-core/src/next_client/context.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ use turbo_binding::{
1919
free_var_references,
2020
},
2121
dev::{react_refresh::assert_can_resolve_react_refresh, DevChunkingContextVc},
22-
ecmascript::EcmascriptInputTransform,
22+
ecmascript::TransformPluginVc,
23+
ecmascript_plugin::transform::directives::server::ServerDirectiveTransformer,
2324
env::ProcessEnvAssetVc,
2425
node::execution_context::ExecutionContextVc,
2526
turbopack::{
@@ -196,10 +197,19 @@ pub async fn get_client_module_options_context(
196197

197198
let enable_emotion = *get_emotion_compiler_config(next_config).await?;
198199

199-
let mut source_transforms = vec![];
200-
if let Some(relay_transform_plugin) = *get_relay_transform_plugin(next_config).await? {
201-
source_transforms.push(relay_transform_plugin);
202-
}
200+
let source_transforms = vec![
201+
*get_relay_transform_plugin(next_config).await?,
202+
Some(TransformPluginVc::cell(Box::new(
203+
ServerDirectiveTransformer::new(
204+
// ServerDirective is not implemented yet and always reports an issue.
205+
// We don't have to pass a valid transition name yet, but the API is prepared.
206+
&StringVc::cell("TODO".to_string()),
207+
),
208+
))),
209+
]
210+
.into_iter()
211+
.flatten()
212+
.collect();
203213

204214
let custom_ecma_transform_plugins = Some(CustomEcmascriptTransformPluginsVc::cell(
205215
CustomEcmascriptTransformPlugins {
@@ -209,11 +219,6 @@ pub async fn get_client_module_options_context(
209219
));
210220

211221
let module_options_context = ModuleOptionsContext {
212-
custom_ecmascript_transforms: vec![EcmascriptInputTransform::ServerDirective(
213-
// ServerDirective is not implemented yet and always reports an issue.
214-
// We don't have to pass a valid transition name yet, but the API is prepared.
215-
StringVc::cell("TODO".to_string()),
216-
)],
217222
preset_env_versions: Some(env),
218223
execution_context: Some(execution_context),
219224
custom_ecma_transform_plugins,

0 commit comments

Comments
 (0)