Skip to content

Upgrade React from 197d6a04-20250424 to 0ff1d13b-20250507 #78925

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5f8ec8c
Downgrade React from `408d055a-20250430` to `197d6a04-20250424` (#78834)
eps1lon May 5, 2025
4d9f4a2
v15.4.0-canary.21
vercel-release-bot May 5, 2025
d175b07
Reland "[Link] Add prefetch="auto" option" (#78821)
eps1lon May 5, 2025
a79ccb9
v15.4.0-canary.22
vercel-release-bot May 5, 2025
e848189
Update multi-zones.mdx (#78812)
mastoj May 5, 2025
1471ba7
build: Update `@swc/core` npm package to `v1.11.24` (#77668)
kdy1 May 5, 2025
d6ce24c
chore(CI): Remove unused environment variables from `build_and_test.y…
bgw May 5, 2025
679afec
Turbopack: avoid tracking a modification when adding an already exist…
sokra May 5, 2025
1500ec1
Turbopack: reduce the amount of task modifications caused by recomput…
sokra May 5, 2025
8ea7984
Turbopack: avoid depending on the Project (#78730)
sokra May 5, 2025
94237fb
Turbopack: Implement regex support for matching webpack loaders (#78733)
wbinnssmith May 5, 2025
dad39f0
Turbopack: Add support for `extension` regex in `@next/mdx` (#78734)
wbinnssmith May 5, 2025
98d8342
Turbopack: use unstable sort for better performance (#78764)
sokra May 5, 2025
3dc2c61
v15.4.0-canary.23
vercel-release-bot May 5, 2025
5affdb0
chore(CI): Break pages-dir client-navigation dev tests into smaller p…
bgw May 6, 2025
2089c24
Turbopack: avoid storing task data and task cache concurrenctly (#78775)
sokra May 6, 2025
0cab972
Add a new `fs` method to track a glob. (#78686)
lukesandberg May 6, 2025
e0e1f5b
Add tests for normalize_path (#78840)
lukesandberg May 6, 2025
06044e2
Turbopack: flush key spaces when done with them (#78776)
sokra May 6, 2025
466a6f5
fix: error build if fixture typechecking fails (#78839)
lubieowoce May 6, 2025
5743a61
doc: add build lifecycle hooks documentation (#78842)
gaojude May 6, 2025
8312f8a
[dev-overlay] Polish mobile view (#78863)
raunofreiberg May 6, 2025
f99edde
[dev-overlay] Consider scrollbar width for drag positioning (#78865)
raunofreiberg May 6, 2025
ea6ea35
Share logic across our two transforms (#78680)
lukesandberg May 6, 2025
c65435c
Turbopack: add tracing to turbo-persistence (#78777)
sokra May 6, 2025
6736ca6
Add handling for setting deployment id via cookie (#78841)
ijjk May 6, 2025
52fbac0
Turbopack: fix task data category (#78873)
sokra May 6, 2025
80b30d2
fix(react-compiler): Fix detection of interest (#78874)
kdy1 May 6, 2025
6f1e04d
Run export child process with runtime's default `max-old-space-size` …
eps1lon May 6, 2025
a2015c6
[dynamicIO] cache tracking for import() (#74152)
lubieowoce May 6, 2025
8d460ec
v15.4.0-canary.24
vercel-release-bot May 6, 2025
cf19e5e
Update Turbopack production test manifest (#78900)
vercel-release-bot May 7, 2025
366af85
Update Turbopack development test manifest (#78901)
vercel-release-bot May 7, 2025
0247e20
[dev-overlay] solidate the line number parsing (#78868)
huozhi May 7, 2025
363fcf6
Docs IA 2.0: Fonts (#78899)
delbaoliveira May 7, 2025
456a8cd
Docs IA 2.0: Metadata (#78905)
delbaoliveira May 7, 2025
ffa5278
docs: Create tailwind guide (#78908)
delbaoliveira May 7, 2025
63ab255
Update send to v0.18.0 (#78816)
nicole0707 May 7, 2025
654c966
feat(next-swc): Add a fast path to RC detector (#78920)
kdy1 May 7, 2025
3f7d03f
Update `react@experimental`
vercel-release-bot May 7, 2025
e3b582a
Update `react`
vercel-release-bot May 7, 2025
17d24cd
Update lockfile
vercel-release-bot May 7, 2025
17ee1fd
ncc-compiled
vercel-release-bot May 7, 2025
7e5dbf1
Don't replace `setTimeout` in Fizz runtime
eps1lon May 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
21 changes: 4 additions & 17 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,13 @@ on:
pull_request:
types: [opened, synchronize]

# NOTE: anything in `afterBuild` inherits environment variables defined in
# `build_reusable.yml` (not these!) because that job executes within the context
# of that workflow. Environment variables are not automatically passed to
# reusable workflows.
env:
NAPI_CLI_VERSION: 2.14.7
TURBO_VERSION: 2.3.3
NODE_MAINTENANCE_VERSION: 18
NODE_LTS_VERSION: 20
# disable backtrace for test snapshots
RUST_BACKTRACE: 0

TURBO_TEAM: 'vercel'
TURBO_CACHE: 'remote:rw'
NEXT_TELEMETRY_DISABLED: 1
# we build a dev binary for use in CI so skip downloading
# canary next-swc binaries in the monorepo
NEXT_SKIP_NATIVE_POSTINSTALL: 1
DATADOG_API_KEY: ${{ secrets.DATA_DOG_API_KEY }}
NEXT_JUNIT_TEST_REPORT: 'true'
DD_ENV: 'ci'
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
NEXT_TEST_JOB: 1
NEXT_TEST_PREFER_OFFLINE: 1

jobs:
optimize-ci:
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pids
coverage

# test output
test/**/out*
test/**/out/*
test/**/next-env.d.ts
.DS_Store
/e2e-tests
Expand All @@ -42,7 +42,7 @@ test/traces
.nvmrc

# examples
examples/**/out
examples/**/out/*
examples/**/.env*.local

pr-stats.md
Expand Down
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions crates/next-api/src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ use crate::{
#[turbo_tasks::value]
pub struct MiddlewareEndpoint {
project: ResolvedVc<Project>,
build_id: RcStr,
asset_context: ResolvedVc<Box<dyn AssetContext>>,
source: ResolvedVc<Box<dyn Source>>,
app_dir: Option<ResolvedVc<FileSystemPath>>,
Expand All @@ -56,15 +55,13 @@ impl MiddlewareEndpoint {
#[turbo_tasks::function]
pub fn new(
project: ResolvedVc<Project>,
build_id: RcStr,
asset_context: ResolvedVc<Box<dyn AssetContext>>,
source: ResolvedVc<Box<dyn Source>>,
app_dir: Option<ResolvedVc<FileSystemPath>>,
ecmascript_client_reference_transition_name: Option<ResolvedVc<RcStr>>,
) -> Vc<Self> {
Self {
project,
build_id,
asset_context,
source,
app_dir,
Expand Down
8 changes: 6 additions & 2 deletions crates/next-api/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,11 @@ impl Project {
*self.mode
}

#[turbo_tasks::function]
pub(super) async fn is_watch_enabled(&self) -> Result<Vc<bool>> {
Ok(Vc::cell(self.watch.enable))
}

#[turbo_tasks::function]
pub(super) async fn per_page_module_graph(&self) -> Result<Vc<bool>> {
Ok(Vc::cell(*self.mode.await? == NextMode::Development))
Expand Down Expand Up @@ -944,7 +949,7 @@ impl Project {

// At this point all modules have been computed and we can get rid of the node.js
// process pools
if self.await?.watch.enable {
if *self.is_watch_enabled().await? {
turbopack_node::evaluate::scale_down();
} else {
turbopack_node::evaluate::scale_zero();
Expand Down Expand Up @@ -1412,7 +1417,6 @@ impl Project {

Ok(Vc::upcast(MiddlewareEndpoint::new(
self,
self.await?.build_id.clone(),
middleware_asset_context,
source,
app_dir.as_deref().copied(),
Expand Down
2 changes: 2 additions & 0 deletions crates/next-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ remove_console = "0.37.0"
itertools = { workspace = true }
auto-hash-map = { workspace = true }
percent-encoding = "2.3.1"
serde_path_to_error = { workspace = true }

swc_core = { workspace = true, features = [
"base",
Expand All @@ -60,6 +61,7 @@ modularize_imports = { workspace = true }
swc_relay = { workspace = true }

turbo-rcstr = { workspace = true }
turbo-esregex = { workspace = true }
turbo-tasks = { workspace = true }
turbo-tasks-bytes = { workspace = true }
turbo-tasks-env = { workspace = true }
Expand Down
70 changes: 68 additions & 2 deletions crates/next-core/src/next_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ use turbo_tasks::{
use turbo_tasks_env::EnvMap;
use turbo_tasks_fs::FileSystemPath;
use turbopack::module_options::{
module_options_context::MdxTransformOptions, LoaderRuleItem, OptionWebpackRules,
module_options_context::{
ConditionItem, ConditionPath, MdxTransformOptions, OptionWebpackConditions,
},
LoaderRuleItem, OptionWebpackRules,
};
use turbopack_core::{
issue::{Issue, IssueSeverity, IssueStage, OptionStyledString, StyledString},
Expand Down Expand Up @@ -541,11 +544,57 @@ pub struct TurbopackConfig {
/// This option has been replaced by `rules`.
pub loaders: Option<JsonValue>,
pub rules: Option<FxIndexMap<RcStr, RuleConfigItemOrShortcut>>,
#[turbo_tasks(trace_ignore)]
pub conditions: Option<FxIndexMap<RcStr, ConfigConditionItem>>,
pub resolve_alias: Option<FxIndexMap<RcStr, JsonValue>>,
pub resolve_extensions: Option<Vec<RcStr>>,
pub module_ids: Option<ModuleIds>,
}

#[derive(Clone, Debug, PartialEq, Serialize, TraceRawVcs, NonLocalValue)]
pub struct ConfigConditionItem(ConditionItem);

impl<'de> Deserialize<'de> for ConfigConditionItem {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
#[derive(Deserialize)]
struct RegexComponents {
source: RcStr,
flags: RcStr,
}

#[derive(Deserialize)]
struct ConfigPath {
path: RegexOrGlob,
}

#[derive(Deserialize)]
#[serde(tag = "type", rename_all = "lowercase")]
enum RegexOrGlob {
Regexp { value: RegexComponents },
Glob { value: String },
}

let config_path = ConfigPath::deserialize(deserializer)?;
let condition_item = match config_path.path {
RegexOrGlob::Regexp { value } => {
let regex = turbo_esregex::EsRegex::new(&value.source, &value.flags)
.map_err(serde::de::Error::custom)?;
ConditionItem {
path: ConditionPath::Regex(regex.resolved_cell()),
}
}
RegexOrGlob::Glob { value } => ConditionItem {
path: ConditionPath::Glob(value.into()),
},
};

Ok(ConfigConditionItem(condition_item))
}
}

#[derive(
Clone, Debug, PartialEq, Eq, Serialize, Deserialize, TraceRawVcs, NonLocalValue, OperationValue,
)]
Expand Down Expand Up @@ -1065,7 +1114,8 @@ impl NextConfig {
#[turbo_tasks::function]
pub async fn from_string(string: Vc<RcStr>) -> Result<Vc<Self>> {
let string = string.await?;
let config: NextConfig = serde_json::from_str(&string)
let mut jdeserializer = serde_json::Deserializer::from_str(&string);
let config: NextConfig = serde_path_to_error::deserialize(&mut jdeserializer)
.with_context(|| format!("failed to parse next.config.js: {}", string))?;
Ok(config.cell())
}
Expand Down Expand Up @@ -1227,6 +1277,22 @@ impl NextConfig {
Vc::cell(Some(ResolvedVc::cell(rules)))
}

#[turbo_tasks::function]
pub fn webpack_conditions(&self) -> Vc<OptionWebpackConditions> {
let Some(config_conditions) = self.turbopack.as_ref().and_then(|t| t.conditions.as_ref())
else {
return Vc::cell(None);
};

let conditions = FxIndexMap::from_iter(
config_conditions
.iter()
.map(|(k, v)| (k.clone(), v.0.clone())),
);

Vc::cell(Some(ResolvedVc::cell(conditions)))
}

#[turbo_tasks::function]
pub fn persistent_caching_enabled(&self) -> Result<Vc<bool>> {
Ok(Vc::cell(
Expand Down
7 changes: 7 additions & 0 deletions crates/next-core/src/next_import_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,13 @@ async fn insert_next_shared_aliases(
"next/dist/build/webpack/loaders/next-flight-loader/cache-wrapper",
),
);
import_map.insert_exact_alias(
"private-next-rsc-track-dynamic-import",
request_to_import_mapping(
project_path,
"next/dist/build/webpack/loaders/next-flight-loader/track-dynamic-import",
),
);

insert_turbopack_dev_alias(import_map).await?;
insert_package_alias(
Expand Down
8 changes: 6 additions & 2 deletions crates/next-core/src/next_server/transforms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use crate::{
next_shared::transforms::{
get_next_dynamic_transform_rule, get_next_font_transform_rule, get_next_image_rule,
get_next_lint_transform_rule, get_next_modularize_imports_rule,
get_next_pages_transforms_rule, get_server_actions_transform_rule,
next_amp_attributes::get_next_amp_attr_rule,
get_next_pages_transforms_rule, get_next_track_dynamic_imports_transform_rule,
get_server_actions_transform_rule, next_amp_attributes::get_next_amp_attr_rule,
next_cjs_optimizer::get_next_cjs_optimizer_rule,
next_disallow_re_export_all_in_page::get_next_disallow_export_all_in_page_rule,
next_edge_node_api_assert::next_edge_node_api_assert,
Expand Down Expand Up @@ -178,6 +178,10 @@ pub async fn get_next_server_transforms_rules(
ServerContextType::Middleware { .. } | ServerContextType::Instrumentation { .. } => false,
};

if is_app_dir && *next_config.enable_dynamic_io().await? {
rules.push(get_next_track_dynamic_imports_transform_rule(mdx_rs));
}

if !foreign_code {
rules.push(
get_next_dynamic_transform_rule(true, is_server_components, is_app_dir, mode, mdx_rs)
Expand Down
2 changes: 2 additions & 0 deletions crates/next-core/src/next_shared/transforms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub(crate) mod next_pure;
pub(crate) mod next_react_server_components;
pub(crate) mod next_shake_exports;
pub(crate) mod next_strip_page_exports;
pub(crate) mod next_track_dynamic_imports;
pub(crate) mod react_remove_properties;
pub(crate) mod relay;
pub(crate) mod remove_console;
Expand All @@ -30,6 +31,7 @@ pub use next_dynamic::get_next_dynamic_transform_rule;
pub use next_font::get_next_font_transform_rule;
pub use next_lint::get_next_lint_transform_rule;
pub use next_strip_page_exports::get_next_pages_transforms_rule;
pub use next_track_dynamic_imports::get_next_track_dynamic_imports_transform_rule;
pub use server_actions::get_server_actions_transform_rule;
use turbo_tasks::{ReadRef, ResolvedVc, Value};
use turbo_tasks_fs::FileSystemPath;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use anyhow::Result;
use async_trait::async_trait;
use next_custom_transforms::transforms::track_dynamic_imports::*;
use swc_core::ecma::ast::Program;
use turbopack::module_options::ModuleRule;
use turbopack_ecmascript::{CustomTransformer, TransformContext};

use super::get_ecma_transform_rule;

pub fn get_next_track_dynamic_imports_transform_rule(mdx_rs: bool) -> ModuleRule {
get_ecma_transform_rule(Box::new(NextTrackDynamicImports {}), mdx_rs, false)
}

#[derive(Debug)]
struct NextTrackDynamicImports {}

#[async_trait]
impl CustomTransformer for NextTrackDynamicImports {
#[tracing::instrument(level = tracing::Level::TRACE, name = "next_track_dynamic_imports", skip_all)]
async fn transform(&self, program: &mut Program, ctx: &TransformContext<'_>) -> Result<()> {
program.mutate(track_dynamic_imports(ctx.unresolved_mark));
Ok(())
}
}
7 changes: 5 additions & 2 deletions crates/next-core/src/next_shared/webpack_rules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@ pub async fn webpack_loader_options(
project_path: ResolvedVc<FileSystemPath>,
next_config: Vc<NextConfig>,
foreign: bool,
conditions: Vec<RcStr>,
condition_strs: Vec<RcStr>,
) -> Result<Option<ResolvedVc<WebpackLoadersOptions>>> {
let rules = *next_config.webpack_rules(conditions).await?;
let rules = *next_config.webpack_rules(condition_strs).await?;
let rules = *maybe_add_sass_loader(next_config.sass_config(), rules.map(|v| *v)).await?;
let rules = if foreign {
rules
} else {
*maybe_add_babel_loader(*project_path, rules.map(|v| *v)).await?
};

let conditions = next_config.webpack_conditions().to_resolved().await?;
Ok(if let Some(rules) = rules {
Some(
WebpackLoadersOptions {
rules,
conditions,
loader_runner_package: Some(loader_runner_package_mapping().to_resolved().await?),
}
.resolved_cell(),
Expand Down
11 changes: 11 additions & 0 deletions crates/next-custom-transforms/src/chain_transforms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ pub struct TransformOptions {

#[serde(default)]
pub css_env: Option<swc_core::ecma::preset_env::Config>,

#[serde(default)]
pub track_dynamic_imports: bool,
}

pub fn custom_before_pass<'a, C>(
Expand Down Expand Up @@ -333,6 +336,14 @@ where
)),
None => Either::Right(noop_pass()),
},
match &opts.track_dynamic_imports {
true => Either::Left(
crate::transforms::track_dynamic_imports::track_dynamic_imports(
unresolved_mark,
),
),
false => Either::Right(noop_pass()),
},
match &opts.cjs_require_optimizer {
Some(config) => Either::Left(visit_mut_pass(
crate::transforms::cjs_optimizer::cjs_optimizer(
Expand Down
Loading
Loading