From 5d3bc2b55ad24d6fd8f3d3fffb0fd4390be924f8 Mon Sep 17 00:00:00 2001 From: Benjamin Woodruff Date: Fri, 1 Nov 2024 13:23:30 -0700 Subject: [PATCH 01/28] perf(turbo-tasks): Call `.shrink_to_fit()` on common collection types when constructing a cell (#72113) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cell contents are immutable once constructed, so there's no chance that they'll grow in size again. Common collections can be shrunk to avoid storing empty spare capacity in this case (note: if they're already correctly sized, `shrink_to_fit` bails out early). **Result:** This gives a ~1.4% decrease in top-line peak memory consumption, for a theoretical CPU/Wall time cost that's too small to measure. **Inspiration:** The inspiration for this was vercel/turborepo#2873, which decreased task storage (not the top-line memory usage?) by ~14%, vercel/turborepo#8657, and other similar optimization PRs. ## Additional Opportunities - There may be more places where cell are constructed (e.g. persistent storage deserialization) where a cell's `SharedReference` is constructed that is not currently captured by this. - Depending on the library used, deserialization may already construct exact-sized collections. - As an additional example, manually constructing a `ReadRef` and converting it into a cell skips this optimization because `ReadRef::cell` internally uses the type-erased shared-reference `raw_cell` API which is incompatible with this optimization. We could special-case that in the `ReadRef::new_owned` constructor (not in `ReadRef::new_arc` though), but nobody should be manually constructing `ReadRef`s. - We still don't use `shrink_to_fit` on `RcStr` types. Some of these are in-place extended (when they have a refcount of 1) with `RcStr::map`, so we probably don't want to be too aggressive about this to avoid `O(n^2)` time complexity blowups. ## Memory Benchmark Setup ```bash cd ~/next.js cargo run -p next-build-test --release -- generate ~/shadcn-ui/apps/www/ > ~/shadcn-ui/apps/www/project_options.json pnpm pack-next --project ~/shadcn-ui/apps/www/ ``` ```bash cd ~/shadcn-ui pnpm i cd ~/shadcn-ui/apps/www/ heaptrack ~/next.js/target/release/next-build-test run sequential 1 1 '/sink' heaptrack --analyze ~/shadcn-ui/apps/www/heaptrack.next-build-test.3604648.zst ``` ### Memory Before (canary branch) First Run: ``` peak heap memory consumption: 3.23G peak RSS (including heaptrack overhead): 4.75G ``` Second Run: ``` peak heap memory consumption: 3.23G peak RSS (including heaptrack overhead): 4.75G ``` ### Memory After (this PR) First Run: ``` peak heap memory consumption: 3.18G peak RSS (including heaptrack overhead): 4.74G ``` Second Run: ``` peak heap memory consumption: 3.19G peak RSS (including heaptrack overhead): 4.73G ``` This is about a 1.4% decrease in top-line memory consumption. ## Wall Time with `hyperfine` (Counter-Metric) This is theoretically a time-memory tradeoff, as we'll spend some time `memcpy`ing things into smaller allocations, though in some cases reducing memory usage can improve cache locality, so it's not always obvious. ``` hyperfine --warmup 3 -r 30 --time-unit millisecond '~/next.js/target/release/next-build-test run sequential 1 1 /sink' ``` This benchmark is slow and takes about 30 minutes to run. Before: ``` Benchmark 1: ~/next.js/target/release/next-build-test run sequential 1 1 /sink Time (mean ± σ): 56387.5 ms ± 212.6 ms [User: 107807.5 ms, System: 9509.8 ms] Range (min … max): 55934.4 ms … 56872.9 ms 30 runs ``` After: ``` Benchmark 1: ~/next.js/target/release/next-build-test run sequential 1 1 /sink Time (mean ± σ): 56020.9 ms ± 235.4 ms [User: 107483.8 ms, System: 9371.8 ms] Range (min … max): 55478.2 ms … 56563.6 ms 30 runs ``` This is a ~0.65% *reduction* in wall time. This is small enough (<2 standard deviations) to likely just be noise. ## Wall Time with `turbopack-bench` (Counter-Metric) ``` cargo bench -p turbopack-bench -p turbopack-cli -- "hmr_to_eval/Turbopack CSR" ``` Gives: ``` bench_hmr_to_eval/Turbopack CSR/1000 modules time: [15.123 ms 15.208 ms 15.343 ms] change: [-0.8471% +0.4882% +1.9719%] (p = 0.55 > 0.05) No change in performance detected. ``` Using https://github.com/bgw/benchmark-scripts/ In practice, it's not really possible to measure changes in wall time <1%, so this is within "noise" territory (as noted in the criterion output). Closes PACK-3361 --- .../tests/shrink_to_fit.rs | 1 + .../src/primitive_input.rs | 35 +++++++- .../turbo-tasks-macros/src/derive/mod.rs | 2 + .../src/derive/shrink_to_fit_macro.rs | 53 +++++++++++ .../crates/turbo-tasks-macros/src/lib.rs | 5 ++ .../turbo-tasks-macros/src/primitive_macro.rs | 12 ++- .../turbo-tasks-macros/src/value_macro.rs | 62 ++++++------- .../turbo-tasks-memory/tests/shrink_to_fit.rs | 1 + .../tests/shrink_to_fit.rs | 27 ++++++ turbopack/crates/turbo-tasks/src/lib.rs | 2 + .../crates/turbo-tasks/src/macro_helpers.rs | 63 ++++++++++++- .../crates/turbo-tasks/src/primitives.rs | 8 +- .../crates/turbo-tasks/src/shrink_to_fit.rs | 89 +++++++++++++++++++ .../crates/turbo-tasks/src/task/function.rs | 6 +- turbopack/crates/turbo-tasks/src/vc/mod.rs | 15 +++- turbopack/crates/turbo-tasks/src/vc/read.rs | 26 ++++-- turbopack/crates/turbo-tasks/src/vc/traits.rs | 4 +- 17 files changed, 357 insertions(+), 54 deletions(-) create mode 120000 turbopack/crates/turbo-tasks-backend/tests/shrink_to_fit.rs create mode 100644 turbopack/crates/turbo-tasks-macros/src/derive/shrink_to_fit_macro.rs create mode 120000 turbopack/crates/turbo-tasks-memory/tests/shrink_to_fit.rs create mode 100644 turbopack/crates/turbo-tasks-testing/tests/shrink_to_fit.rs create mode 100644 turbopack/crates/turbo-tasks/src/shrink_to_fit.rs diff --git a/turbopack/crates/turbo-tasks-backend/tests/shrink_to_fit.rs b/turbopack/crates/turbo-tasks-backend/tests/shrink_to_fit.rs new file mode 120000 index 0000000000000..bd2c655c31c6b --- /dev/null +++ b/turbopack/crates/turbo-tasks-backend/tests/shrink_to_fit.rs @@ -0,0 +1 @@ +../../turbo-tasks-testing/tests/shrink_to_fit.rs \ No newline at end of file diff --git a/turbopack/crates/turbo-tasks-macros-shared/src/primitive_input.rs b/turbopack/crates/turbo-tasks-macros-shared/src/primitive_input.rs index de4eb53398642..ee17010baeacc 100644 --- a/turbopack/crates/turbo-tasks-macros-shared/src/primitive_input.rs +++ b/turbopack/crates/turbo-tasks-macros-shared/src/primitive_input.rs @@ -1,16 +1,47 @@ +use proc_macro2::Span; use syn::{ parse::{Parse, ParseStream}, - Result, Type, + punctuated::Punctuated, + spanned::Spanned, + Meta, Result, Token, Type, }; #[derive(Debug)] pub struct PrimitiveInput { pub ty: Type, + pub manual_shrink_to_fit: Option, } impl Parse for PrimitiveInput { fn parse(input: ParseStream) -> Result { let ty: Type = input.parse()?; - Ok(PrimitiveInput { ty }) + let mut parsed_input = PrimitiveInput { + ty, + manual_shrink_to_fit: None, + }; + if input.parse::>()?.is_some() { + let punctuated: Punctuated = input.parse_terminated(Meta::parse)?; + for meta in punctuated { + match ( + meta.path() + .get_ident() + .map(ToString::to_string) + .as_deref() + .unwrap_or_default(), + &meta, + ) { + ("manual_shrink_to_fit", Meta::Path(_)) => { + parsed_input.manual_shrink_to_fit = Some(meta.span()) + } + (_, meta) => { + return Err(syn::Error::new_spanned( + meta, + "unexpected token, expected: \"manual_shrink_to_fit\"", + )) + } + } + } + } + Ok(parsed_input) } } diff --git a/turbopack/crates/turbo-tasks-macros/src/derive/mod.rs b/turbopack/crates/turbo-tasks-macros/src/derive/mod.rs index d8c507574ab3b..631c0c4d440aa 100644 --- a/turbopack/crates/turbo-tasks-macros/src/derive/mod.rs +++ b/turbopack/crates/turbo-tasks-macros/src/derive/mod.rs @@ -1,6 +1,7 @@ mod deterministic_hash_macro; mod key_value_pair_macro; mod resolved_value_macro; +mod shrink_to_fit_macro; mod task_input_macro; mod trace_raw_vcs_macro; mod value_debug_format_macro; @@ -9,6 +10,7 @@ mod value_debug_macro; pub use deterministic_hash_macro::derive_deterministic_hash; pub use key_value_pair_macro::derive_key_value_pair; pub use resolved_value_macro::derive_resolved_value; +pub use shrink_to_fit_macro::derive_shrink_to_fit; use syn::{spanned::Spanned, Attribute, Meta, MetaList, NestedMeta}; pub use task_input_macro::derive_task_input; pub use trace_raw_vcs_macro::derive_trace_raw_vcs; diff --git a/turbopack/crates/turbo-tasks-macros/src/derive/shrink_to_fit_macro.rs b/turbopack/crates/turbo-tasks-macros/src/derive/shrink_to_fit_macro.rs new file mode 100644 index 0000000000000..219b9922a0386 --- /dev/null +++ b/turbopack/crates/turbo-tasks-macros/src/derive/shrink_to_fit_macro.rs @@ -0,0 +1,53 @@ +use proc_macro::TokenStream; +use proc_macro2::TokenStream as TokenStream2; +use quote::quote; +use syn::{parse_macro_input, DeriveInput, FieldsNamed, FieldsUnnamed}; +use turbo_tasks_macros_shared::{generate_exhaustive_destructuring, match_expansion}; + +pub fn derive_shrink_to_fit(input: TokenStream) -> TokenStream { + let derive_input = parse_macro_input!(input as DeriveInput); + let ident = &derive_input.ident; + let (impl_generics, ty_generics, where_clause) = derive_input.generics.split_for_impl(); + + let shrink_items = match_expansion(&derive_input, &shrink_named, &shrink_unnamed, &shrink_unit); + quote! { + impl #impl_generics turbo_tasks::ShrinkToFit for #ident #ty_generics #where_clause { + fn shrink_to_fit(&mut self) { + #shrink_items + } + } + } + .into() +} + +fn shrink_named(_ident: TokenStream2, fields: &FieldsNamed) -> (TokenStream2, TokenStream2) { + let (captures, fields_idents) = generate_exhaustive_destructuring(fields.named.iter()); + ( + captures, + quote! { + {#( + turbo_tasks::macro_helpers::ShrinkToFitDerefSpecialization::new( + #fields_idents, + ).shrink_to_fit(); + )*} + }, + ) +} + +fn shrink_unnamed(_ident: TokenStream2, fields: &FieldsUnnamed) -> (TokenStream2, TokenStream2) { + let (captures, fields_idents) = generate_exhaustive_destructuring(fields.unnamed.iter()); + ( + captures, + quote! { + {#( + turbo_tasks::macro_helpers::ShrinkToFitDerefSpecialization::new( + #fields_idents, + ).shrink_to_fit(); + )*} + }, + ) +} + +fn shrink_unit(_ident: TokenStream2) -> TokenStream2 { + quote! { { } } +} diff --git a/turbopack/crates/turbo-tasks-macros/src/lib.rs b/turbopack/crates/turbo-tasks-macros/src/lib.rs index 30716e0f2e412..f372ad8d52529 100644 --- a/turbopack/crates/turbo-tasks-macros/src/lib.rs +++ b/turbopack/crates/turbo-tasks-macros/src/lib.rs @@ -22,6 +22,11 @@ pub fn derive_trace_raw_vcs_attr(input: TokenStream) -> TokenStream { derive::derive_trace_raw_vcs(input) } +#[proc_macro_derive(ShrinkToFit, attributes(turbo_tasks))] +pub fn derive_shrink_to_fit(input: TokenStream) -> TokenStream { + derive::derive_shrink_to_fit(input) +} + #[proc_macro_derive(ResolvedValue, attributes(turbo_tasks))] pub fn derive_resolved_value_attr(input: TokenStream) -> TokenStream { derive::derive_resolved_value(input) diff --git a/turbopack/crates/turbo-tasks-macros/src/primitive_macro.rs b/turbopack/crates/turbo-tasks-macros/src/primitive_macro.rs index 2d0b99e857ae6..53a2b2613e264 100644 --- a/turbopack/crates/turbo-tasks-macros/src/primitive_macro.rs +++ b/turbopack/crates/turbo-tasks-macros/src/primitive_macro.rs @@ -16,6 +16,16 @@ pub fn primitive(input: TokenStream) -> TokenStream { .into(); }; + let value_shrink_to_fit_impl = if input.manual_shrink_to_fit.is_none() { + Some(quote! { + impl turbo_tasks::ShrinkToFit for #ty { + fn shrink_to_fit(&mut self) {} + } + }) + } else { + None + }; + let value_debug_impl = quote! { #[turbo_tasks::value_impl] impl turbo_tasks::debug::ValueDebug for #ty { @@ -62,7 +72,7 @@ pub fn primitive(input: TokenStream) -> TokenStream { #value_type_and_register #value_debug_impl - + #value_shrink_to_fit_impl #value_default_impl } .into() diff --git a/turbopack/crates/turbo-tasks-macros/src/value_macro.rs b/turbopack/crates/turbo-tasks-macros/src/value_macro.rs index 570aeea20b3f3..0df3027bec1a6 100644 --- a/turbopack/crates/turbo-tasks-macros/src/value_macro.rs +++ b/turbopack/crates/turbo-tasks-macros/src/value_macro.rs @@ -349,49 +349,46 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream { quote! {} }; - let derive = match serialization_mode { + let mut struct_attributes = vec![quote! { + #[derive(turbo_tasks::ShrinkToFit, turbo_tasks::trace::TraceRawVcs)] + }]; + match serialization_mode { + SerializationMode::Auto | SerializationMode::AutoForInput => { + struct_attributes.push(quote! { + #[derive( + turbo_tasks::macro_helpers::serde::Serialize, + turbo_tasks::macro_helpers::serde::Deserialize, + )] + #[serde(crate = "turbo_tasks::macro_helpers::serde")] + }) + } SerializationMode::None | SerializationMode::Custom | SerializationMode::CustomForInput => { - quote! { - #[derive(turbo_tasks::trace::TraceRawVcs)] - } } - SerializationMode::Auto | SerializationMode::AutoForInput => quote! { - #[derive( - turbo_tasks::trace::TraceRawVcs, - turbo_tasks::macro_helpers::serde::Serialize, - turbo_tasks::macro_helpers::serde::Deserialize, - )] - #[serde(crate = "turbo_tasks::macro_helpers::serde")] - }, }; - let debug_derive = if inner_type.is_some() { + if inner_type.is_some() { // Transparent structs have their own manual `ValueDebug` implementation. - quote! { + struct_attributes.push(quote! { #[repr(transparent)] - } + }); } else { - quote! { + struct_attributes.push(quote! { #[derive( turbo_tasks::debug::ValueDebugFormat, turbo_tasks::debug::internal::ValueDebug, )] - } - }; - let eq_derive = if manual_eq { - quote!() - } else { - quote!( + }); + } + if !manual_eq { + struct_attributes.push(quote! { #[derive(PartialEq, Eq)] - ) - }; - let resolved_derive = if let Some(span) = resolved { - quote_spanned!( + }); + } + if let Some(span) = resolved { + struct_attributes.push(quote_spanned! { span => #[derive(turbo_tasks::ResolvedValue)] - ) - } else { - quote!() - }; + }); + } let new_value_type = match serialization_mode { SerializationMode::None => quote! { @@ -449,10 +446,7 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream { ); let expanded = quote! { - #derive - #debug_derive - #eq_derive - #resolved_derive + #(#struct_attributes)* #item impl #ident { diff --git a/turbopack/crates/turbo-tasks-memory/tests/shrink_to_fit.rs b/turbopack/crates/turbo-tasks-memory/tests/shrink_to_fit.rs new file mode 120000 index 0000000000000..bd2c655c31c6b --- /dev/null +++ b/turbopack/crates/turbo-tasks-memory/tests/shrink_to_fit.rs @@ -0,0 +1 @@ +../../turbo-tasks-testing/tests/shrink_to_fit.rs \ No newline at end of file diff --git a/turbopack/crates/turbo-tasks-testing/tests/shrink_to_fit.rs b/turbopack/crates/turbo-tasks-testing/tests/shrink_to_fit.rs new file mode 100644 index 0000000000000..e7cd5232b9558 --- /dev/null +++ b/turbopack/crates/turbo-tasks-testing/tests/shrink_to_fit.rs @@ -0,0 +1,27 @@ +#![feature(arbitrary_self_types)] +#![feature(arbitrary_self_types_pointers)] +#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this + +use anyhow::Result; +use turbo_tasks::Vc; +use turbo_tasks_testing::{register, run, Registration}; + +static REGISTRATION: Registration = register!(); + +#[turbo_tasks::value(transparent)] +struct Wrapper(Vec); + +#[tokio::test] +async fn test_shrink_to_fit() -> Result<()> { + run(®ISTRATION, || async { + // `Vec::shrink_to_fit` is implicitly called when a cell is constructed. + let a: Vc = Vc::cell(Vec::with_capacity(100)); + assert_eq!(a.await?.capacity(), 0); + + let b: Vc = Vc::local_cell(Vec::with_capacity(100)); + assert_eq!(b.await?.capacity(), 0); + + Ok(()) + }) + .await +} diff --git a/turbopack/crates/turbo-tasks/src/lib.rs b/turbopack/crates/turbo-tasks/src/lib.rs index 9ba9671fe2b38..ea0f1d5935ed4 100644 --- a/turbopack/crates/turbo-tasks/src/lib.rs +++ b/turbopack/crates/turbo-tasks/src/lib.rs @@ -66,6 +66,7 @@ mod read_ref; pub mod registry; mod scope; mod serialization_invalidation; +mod shrink_to_fit; pub mod small_duration; mod state; pub mod task; @@ -111,6 +112,7 @@ pub use read_ref::ReadRef; use rustc_hash::FxHasher; pub use scope::scope; pub use serialization_invalidation::SerializationInvalidator; +pub use shrink_to_fit::ShrinkToFit; pub use state::{State, TransientState}; pub use task::{task_input::TaskInput, SharedReference, TypedSharedReference}; pub use trait_ref::{IntoTraitRef, TraitRef}; diff --git a/turbopack/crates/turbo-tasks/src/macro_helpers.rs b/turbopack/crates/turbo-tasks/src/macro_helpers.rs index fef19848c5b05..0b7a9fa56bac3 100644 --- a/turbopack/crates/turbo-tasks/src/macro_helpers.rs +++ b/turbopack/crates/turbo-tasks/src/macro_helpers.rs @@ -1,4 +1,6 @@ //! Runtime helpers for [turbo-tasks-macro]. +use std::ops::{Deref, DerefMut}; + pub use async_trait::async_trait; pub use once_cell::sync::{Lazy, OnceCell}; pub use serde; @@ -9,8 +11,8 @@ pub use super::{ manager::{find_cell_by_type, notify_scheduled_tasks, spawn_detached_for_testing}, }; use crate::{ - debug::ValueDebugFormatString, task::TaskOutput, RawVc, ResolvedValue, TaskInput, - TaskPersistence, Vc, + debug::ValueDebugFormatString, shrink_to_fit::ShrinkToFit, task::TaskOutput, RawVc, + ResolvedValue, TaskInput, TaskPersistence, Vc, }; #[inline(never)] @@ -56,3 +58,60 @@ macro_rules! stringify_path { stringify!($path) }; } + +/// A wrapper type that uses the [autoderef specialization hack][autoderef] to call +/// [`ShrinkToFit::shrink_to_fit`] on types that implement [`ShrinkToFit`]. +/// +/// This uses a a no-op method [`ShrinkToFitFallbackNoop::shrink_to_fit`] on types that do not +/// implement [`ShrinkToFit`]. +/// +/// This is used by the derive macro for [`ShrinkToFit`], which is called by the +/// [turbo_tasks::value][crate::value] macro. +/// +/// [autoderef]: http://lukaskalbertodt.github.io/2019/12/05/generalized-autoref-based-specialization.html +pub struct ShrinkToFitDerefSpecialization<'a, T> { + inner: ShrinkToFitFallbackNoop<'a, T>, +} + +impl<'a, T> ShrinkToFitDerefSpecialization<'a, T> { + pub fn new(real: &'a mut T) -> Self { + Self { + inner: ShrinkToFitFallbackNoop { real }, + } + } +} + +impl ShrinkToFitDerefSpecialization<'_, T> +where + T: ShrinkToFit, +{ + pub fn shrink_to_fit(&mut self) { + // call the real `ShrinkToFit::shrink_to_fit` method + self.inner.real.shrink_to_fit() + } +} + +impl<'a, T> Deref for ShrinkToFitDerefSpecialization<'a, T> { + type Target = ShrinkToFitFallbackNoop<'a, T>; + + fn deref(&self) -> &Self::Target { + &self.inner + } +} + +impl DerefMut for ShrinkToFitDerefSpecialization<'_, T> { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.inner + } +} + +// Implements `ShrinkToFit` using a no-op `ShrinkToFit::shrink_to_fit` method. +pub struct ShrinkToFitFallbackNoop<'a, T> { + real: &'a mut T, +} + +impl ShrinkToFitFallbackNoop<'_, T> { + /// A no-op function called as part of [`ShrinkToFitDerefSpecialization`] when `T` does not + /// implement [`ShrinkToFit`]. + pub fn shrink_to_fit(&mut self) {} +} diff --git a/turbopack/crates/turbo-tasks/src/primitives.rs b/turbopack/crates/turbo-tasks/src/primitives.rs index 1be86461db572..bf27ef537ef9e 100644 --- a/turbopack/crates/turbo-tasks/src/primitives.rs +++ b/turbopack/crates/turbo-tasks/src/primitives.rs @@ -8,11 +8,11 @@ use crate::{ }; __turbo_tasks_internal_primitive!(()); -__turbo_tasks_internal_primitive!(String); +__turbo_tasks_internal_primitive!(String, manual_shrink_to_fit); __turbo_tasks_internal_primitive!(RcStr); __turbo_tasks_internal_primitive!(Option); __turbo_tasks_internal_primitive!(Option); -__turbo_tasks_internal_primitive!(Vec); +__turbo_tasks_internal_primitive!(Vec, manual_shrink_to_fit); __turbo_tasks_internal_primitive!(Option); __turbo_tasks_internal_primitive!(Option); __turbo_tasks_internal_primitive!(bool); @@ -30,8 +30,8 @@ __turbo_tasks_internal_primitive!(usize); __turbo_tasks_internal_primitive!(isize); __turbo_tasks_internal_primitive!(serde_json::Value); __turbo_tasks_internal_primitive!(Duration); -__turbo_tasks_internal_primitive!(Vec); -__turbo_tasks_internal_primitive!(Vec); +__turbo_tasks_internal_primitive!(Vec, manual_shrink_to_fit); +__turbo_tasks_internal_primitive!(Vec, manual_shrink_to_fit); #[turbo_tasks::value(transparent, eq = "manual")] #[derive(Debug, Clone)] diff --git a/turbopack/crates/turbo-tasks/src/shrink_to_fit.rs b/turbopack/crates/turbo-tasks/src/shrink_to_fit.rs new file mode 100644 index 0000000000000..0db1b3e8acbbe --- /dev/null +++ b/turbopack/crates/turbo-tasks/src/shrink_to_fit.rs @@ -0,0 +1,89 @@ +use std::{ + collections::{BinaryHeap, HashMap, VecDeque}, + ffi::OsString, + hash::{BuildHasher, Hash}, + path::PathBuf, +}; + +use indexmap::{IndexMap, IndexSet}; +pub use turbo_tasks_macros::ShrinkToFit; + +/// A type that might have memory capacity that can be shrunk. See [`Vec::shrink_to_fit`] as an +/// example. +/// +/// This method may be a no-op. Due to limitaitons of Rust's macro system, it is derived for every +/// [`VcValueType`][crate::VcValueType], even if that type contains no shrinkable collections. +pub trait ShrinkToFit { + fn shrink_to_fit(&mut self); +} + +impl ShrinkToFit for String { + fn shrink_to_fit(&mut self) { + String::shrink_to_fit(self); + } +} + +impl ShrinkToFit for OsString { + fn shrink_to_fit(&mut self) { + OsString::shrink_to_fit(self); + } +} + +impl ShrinkToFit for PathBuf { + fn shrink_to_fit(&mut self) { + PathBuf::shrink_to_fit(self); + } +} + +impl ShrinkToFit for Vec { + // NOTE: without real specialization (not the autoderef specialization hack that works in + // macros, but not generics) or negative impls, we cannot call `shrink_to_fit` on nested + // collections inside `T`, so we have to settle with just shrinking the outermost collection. + fn shrink_to_fit(&mut self) { + Vec::shrink_to_fit(self); + } +} + +impl ShrinkToFit for VecDeque { + fn shrink_to_fit(&mut self) { + VecDeque::shrink_to_fit(self); + } +} + +impl ShrinkToFit for HashMap +where + K: Hash + Eq, + S: BuildHasher, +{ + fn shrink_to_fit(&mut self) { + HashMap::shrink_to_fit(self); + } +} + +impl ShrinkToFit for BinaryHeap { + fn shrink_to_fit(&mut self) { + BinaryHeap::shrink_to_fit(self); + } +} + +// indexmap 2.x reduces some of these type bounds, but we're still on 1.9.3 +impl ShrinkToFit for IndexMap +where + K: Hash + Eq, + S: BuildHasher, +{ + fn shrink_to_fit(&mut self) { + IndexMap::shrink_to_fit(self); + } +} + +// indexmap 2.x reduces some of these type bounds, but we're still on 1.9.3 +impl ShrinkToFit for IndexSet +where + T: Hash + Eq, + S: BuildHasher, +{ + fn shrink_to_fit(&mut self) { + IndexSet::shrink_to_fit(self); + } +} diff --git a/turbopack/crates/turbo-tasks/src/task/function.rs b/turbopack/crates/turbo-tasks/src/task/function.rs index 12e83ab98a0f2..d09d91471213f 100644 --- a/turbopack/crates/turbo-tasks/src/task/function.rs +++ b/turbopack/crates/turbo-tasks/src/task/function.rs @@ -370,7 +370,7 @@ task_inputs_impl! { A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 } #[cfg(test)] mod tests { use super::*; - use crate::{RcStr, VcCellNewMode, VcDefaultRead}; + use crate::{RcStr, ShrinkToFit, VcCellNewMode, VcDefaultRead}; #[test] fn test_task_fn() { @@ -417,6 +417,10 @@ mod tests { async fn inherent_method(&self) {} } + impl ShrinkToFit for Struct { + fn shrink_to_fit(&mut self) {} + } + unsafe impl VcValueType for Struct { type Read = VcDefaultRead; diff --git a/turbopack/crates/turbo-tasks/src/vc/mod.rs b/turbopack/crates/turbo-tasks/src/vc/mod.rs index 2f7552b19244c..107dad4ec673c 100644 --- a/turbopack/crates/turbo-tasks/src/vc/mod.rs +++ b/turbopack/crates/turbo-tasks/src/vc/mod.rs @@ -30,7 +30,7 @@ use crate::{ manager::{create_local_cell, try_get_function_meta}, registry, trace::{TraceRawVcs, TraceRawVcsContext}, - CellId, CollectiblesSource, RawVc, ResolveTypeError, SharedReference, + CellId, CollectiblesSource, RawVc, ResolveTypeError, SharedReference, ShrinkToFit, }; /// A Value Cell (`Vc` for short) is a reference to a memoized computation @@ -251,7 +251,10 @@ where { // called by the `.cell()` method generated by the `#[turbo_tasks::value]` macro #[doc(hidden)] - pub fn cell_private(inner: >::Target) -> Self { + pub fn cell_private(mut inner: >::Target) -> Self { + // cell contents are immutable, so go ahead and shrink the cell's contents + ShrinkToFit::shrink_to_fit(>::target_to_value_mut_ref(&mut inner)); + if try_get_function_meta() .map(|meta| meta.local_cells) .unwrap_or(false) @@ -265,7 +268,13 @@ where // called by the `.local_cell()` method generated by the `#[turbo_tasks::value]` // macro #[doc(hidden)] - pub fn local_cell_private(inner: >::Target) -> Self { + pub fn local_cell_private(mut inner: >::Target) -> Self { + // Cell contents are immutable, so go ahead and shrink the cell's contents. Ideally we'd + // wait until the cell is upgraded from local to global to pay the cost of shrinking, but by + // that point it's too late to get a mutable reference (the `SharedReference` type has + // already been constructed). + ShrinkToFit::shrink_to_fit(>::target_to_value_mut_ref(&mut inner)); + // `T::CellMode` isn't applicable here, we always create new local cells. Local // cells aren't stored across executions, so there can be no concept of // "updating" the cell across multiple executions. diff --git a/turbopack/crates/turbo-tasks/src/vc/read.rs b/turbopack/crates/turbo-tasks/src/vc/read.rs index 5fb7c9fc11ad0..ec856635e83ee 100644 --- a/turbopack/crates/turbo-tasks/src/vc/read.rs +++ b/turbopack/crates/turbo-tasks/src/vc/read.rs @@ -48,6 +48,9 @@ where /// Convert a reference to a target type to a reference to a value. fn target_to_value_ref(target: &Self::Target) -> &T; + /// Convert a mutable reference to a target type to a reference to a value. + fn target_to_value_mut_ref(target: &mut Self::Target) -> &mut T; + /// Convert the target type to the repr. fn target_to_repr(target: Self::Target) -> Self::Repr; @@ -84,6 +87,10 @@ where target } + fn target_to_value_mut_ref(target: &mut Self::Target) -> &mut T { + target + } + fn target_to_repr(target: Self::Target) -> Self::Repr { target } @@ -120,28 +127,37 @@ where } fn value_to_repr(value: T) -> Self::Repr { - // Safety: see `Self::value_to_target` above. + // Safety: see `Self::value_to_target_ref` above. unsafe { std::mem::transmute_copy::, Self::Repr>(&ManuallyDrop::new(value)) } } fn target_to_value(target: Self::Target) -> T { - // Safety: see `Self::value_to_target` above. + // Safety: see `Self::value_to_target_ref` above. unsafe { std::mem::transmute_copy::, T>(&ManuallyDrop::new(target)) } } fn target_to_value_ref(target: &Self::Target) -> &T { - // Safety: see `Self::value_to_target` above. + // Safety: see `Self::value_to_target_ref` above. unsafe { std::mem::transmute_copy::, &T>(&ManuallyDrop::new(target)) } } + fn target_to_value_mut_ref(target: &mut Self::Target) -> &mut T { + // Safety: see `Self::value_to_target_ref` above. + unsafe { + std::mem::transmute_copy::, &mut T>(&ManuallyDrop::new( + target, + )) + } + } + fn target_to_repr(target: Self::Target) -> Self::Repr { - // Safety: see `Self::value_to_target` above. + // Safety: see `Self::value_to_target_ref` above. unsafe { std::mem::transmute_copy::, Self::Repr>(&ManuallyDrop::new( target, @@ -150,7 +166,7 @@ where } fn repr_to_value_ref(repr: &Self::Repr) -> &T { - // Safety: see `Self::value_to_target` above. + // Safety: see `Self::value_to_target_ref` above. unsafe { std::mem::transmute_copy::, &T>(&ManuallyDrop::new(repr)) } diff --git a/turbopack/crates/turbo-tasks/src/vc/traits.rs b/turbopack/crates/turbo-tasks/src/vc/traits.rs index a4dbad46e5c35..9bff007466d80 100644 --- a/turbopack/crates/turbo-tasks/src/vc/traits.rs +++ b/turbopack/crates/turbo-tasks/src/vc/traits.rs @@ -1,5 +1,5 @@ use super::{cell_mode::VcCellMode, read::VcRead}; -use crate::{TraitTypeId, ValueTypeId}; +use crate::{ShrinkToFit, TraitTypeId, ValueTypeId}; /// A trait implemented on all values types that can be put into a Value Cell /// ([`Vc`][crate::Vc]). @@ -11,7 +11,7 @@ use crate::{TraitTypeId, ValueTypeId}; /// generate invalid reads, for instance by using /// [`VcTransparentRead`][crate::VcTransparentRead] for a value type that is not /// `#[repr(transparent)]`. -pub unsafe trait VcValueType: Sized + Send + Sync + 'static { +pub unsafe trait VcValueType: ShrinkToFit + Sized + Send + Sync + 'static { /// How to read the value. type Read: VcRead; From e8421c560394c79141c62be7ebf1aa80683fcd94 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Fri, 1 Nov 2024 21:52:02 +0100 Subject: [PATCH 02/28] perf: merge app metadata route and rsc layer (#71167) --- packages/next/src/build/webpack-config.ts | 2 +- packages/next/src/lib/constants.ts | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/next/src/build/webpack-config.ts b/packages/next/src/build/webpack-config.ts index 3fa6a051fb746..09714824c9f24 100644 --- a/packages/next/src/build/webpack-config.ts +++ b/packages/next/src/build/webpack-config.ts @@ -1311,7 +1311,7 @@ export default async function getBaseWebpackConfig( resourceQuery: new RegExp( WEBPACK_RESOURCE_QUERIES.metadataRoute ), - layer: WEBPACK_LAYERS.appMetadataRoute, + layer: WEBPACK_LAYERS.reactServerComponents, }, { // Ensure that the app page module is in the client layers, this diff --git a/packages/next/src/lib/constants.ts b/packages/next/src/lib/constants.ts index cdf9181450fea..fa5efaee99b57 100644 --- a/packages/next/src/lib/constants.ts +++ b/packages/next/src/lib/constants.ts @@ -107,7 +107,7 @@ const WEBPACK_LAYERS_NAMES = { shared: 'shared', /** * The layer for server-only runtime and picking up `react-server` export conditions. - * Including app router RSC pages and app router custom routes. + * Including app router RSC pages and app router custom routes and metadata routes. */ reactServerComponents: 'rsc', /** @@ -138,10 +138,6 @@ const WEBPACK_LAYERS_NAMES = { * The browser client bundle layer for App directory. */ appPagesBrowser: 'app-pages-browser', - /** - * The server bundle layer for metadata routes. - */ - appMetadataRoute: 'app-metadata-route', } as const export type WebpackLayerName = @@ -153,12 +149,10 @@ const WEBPACK_LAYERS = { builtinReact: [ WEBPACK_LAYERS_NAMES.reactServerComponents, WEBPACK_LAYERS_NAMES.actionBrowser, - WEBPACK_LAYERS_NAMES.appMetadataRoute, ], serverOnly: [ WEBPACK_LAYERS_NAMES.reactServerComponents, WEBPACK_LAYERS_NAMES.actionBrowser, - WEBPACK_LAYERS_NAMES.appMetadataRoute, WEBPACK_LAYERS_NAMES.instrument, WEBPACK_LAYERS_NAMES.middleware, ], @@ -173,7 +167,6 @@ const WEBPACK_LAYERS = { bundled: [ WEBPACK_LAYERS_NAMES.reactServerComponents, WEBPACK_LAYERS_NAMES.actionBrowser, - WEBPACK_LAYERS_NAMES.appMetadataRoute, WEBPACK_LAYERS_NAMES.serverSideRendering, WEBPACK_LAYERS_NAMES.appPagesBrowser, WEBPACK_LAYERS_NAMES.shared, From a7610a63c7980cce822cec4ed539b92c6ebd83eb Mon Sep 17 00:00:00 2001 From: Zack Tanner <1939140+ztanner@users.noreply.github.com> Date: Fri, 1 Nov 2024 14:40:56 -0700 Subject: [PATCH 03/28] skip seeding prefetch cache in development (#72191) Since prefetching is disabled in development, seeding the prefetch cache for the initially rendered page can lead to an inconsistent navigation experience, where the initially visited page won't behave the same as subsequent pages that you navigate to. We should ultimately get to a place where the prefetch behavior is consistent between dev/start to keep the production behavior as consistent as possible with the development experience, but when we do so, we would want to enable it across the board. This happens to fix a bug with dynamicIO because the server-patch action (which happens when data is missing for a rendered segment) was mismatching the router state tree, which triggers a hard navigation to recover. This happens to fix the issue because the router never hits the server patch case, which is when the hard navigation could occur. Separately, we're working to verify why the seeded prefetch entry might have caused this change in behavior only in dev. Note: this modifies a navigation test that was asserting on RSC requests taking place, which will now happen in dev as there'll be no prefetch entry. Fixes #72150 --- .../router-reducer/create-initial-router-state.ts | 5 ++++- test/e2e/app-dir/navigation/navigation.test.ts | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/next/src/client/components/router-reducer/create-initial-router-state.ts b/packages/next/src/client/components/router-reducer/create-initial-router-state.ts index d804448b6b1db..c4535d4023361 100644 --- a/packages/next/src/client/components/router-reducer/create-initial-router-state.ts +++ b/packages/next/src/client/components/router-reducer/create-initial-router-state.ts @@ -105,10 +105,13 @@ export function createInitialRouterState({ null, } - if (location) { + if (process.env.NODE_ENV !== 'development' && location) { // Seed the prefetch cache with this page's data. // This is to prevent needlessly re-prefetching a page that is already reusable, // and will avoid triggering a loading state/data fetch stall when navigating back to the page. + // We don't currently do this in development because links aren't prefetched in development + // so having a mismatch between prefetch/no prefetch provides inconsistent behavior based on which page + // was loaded first. const url = new URL( `${location.pathname}${location.search}`, location.origin diff --git a/test/e2e/app-dir/navigation/navigation.test.ts b/test/e2e/app-dir/navigation/navigation.test.ts index 4704e271f5306..1d6fdcace0577 100644 --- a/test/e2e/app-dir/navigation/navigation.test.ts +++ b/test/e2e/app-dir/navigation/navigation.test.ts @@ -192,12 +192,17 @@ describe('app dir - navigation', () => { await checkLink('top', 0) await checkLink('non-existent', 0) - // there should have been no RSC calls to fetch data - expect(hasRscRequest).toBe(false) + if (!isNextDev) { + // there should have been no RSC calls to fetch data + // this is skipped in development because there'll never be a prefetch cache + // entry for the loaded page and so every request will be a cache miss. + expect(hasRscRequest).toBe(false) + } - // There should be an RSC request if the query param is changed await checkLink('query-param', 2284) await browser.waitForIdleNetwork() + + // There should be an RSC request if the query param is changed expect(hasRscRequest).toBe(true) }) From 13fafe6c4970f404b881c532cb574783a02af753 Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Fri, 1 Nov 2024 22:16:48 +0000 Subject: [PATCH 04/28] v15.0.3-canary.4 --- lerna.json | 2 +- packages/create-next-app/package.json | 2 +- packages/eslint-config-next/package.json | 4 ++-- packages/eslint-plugin-next/package.json | 2 +- packages/font/package.json | 2 +- packages/next-bundle-analyzer/package.json | 2 +- packages/next-codemod/package.json | 2 +- packages/next-env/package.json | 2 +- packages/next-mdx/package.json | 2 +- packages/next-plugin-storybook/package.json | 2 +- packages/next-polyfill-module/package.json | 2 +- packages/next-polyfill-nomodule/package.json | 2 +- packages/next-swc/package.json | 2 +- packages/next/package.json | 14 +++++++------- packages/react-refresh-utils/package.json | 2 +- packages/third-parties/package.json | 4 ++-- pnpm-lock.yaml | 16 ++++++++-------- 17 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lerna.json b/lerna.json index 46904807f710a..0ad6b2987f5c5 100644 --- a/lerna.json +++ b/lerna.json @@ -16,5 +16,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "15.0.3-canary.3" + "version": "15.0.3-canary.4" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 0fde43b24577e..1766213015e48 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "15.0.3-canary.3", + "version": "15.0.3-canary.4", "keywords": [ "react", "next", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index 3c12f6999d1ac..8a9a9592227f5 100644 --- a/packages/eslint-config-next/package.json +++ b/packages/eslint-config-next/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-next", - "version": "15.0.3-canary.3", + "version": "15.0.3-canary.4", "description": "ESLint configuration used by Next.js.", "main": "index.js", "license": "MIT", @@ -10,7 +10,7 @@ }, "homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config", "dependencies": { - "@next/eslint-plugin-next": "15.0.3-canary.3", + "@next/eslint-plugin-next": "15.0.3-canary.4", "@rushstack/eslint-patch": "^1.10.3", "@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", "@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index 290509ae75c6c..48ae30fb90fa5 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "15.0.3-canary.3", + "version": "15.0.3-canary.4", "description": "ESLint plugin for Next.js.", "main": "dist/index.js", "license": "MIT", diff --git a/packages/font/package.json b/packages/font/package.json index 9e9b4cb6da159..3eb9569feb19a 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -1,7 +1,7 @@ { "name": "@next/font", "private": true, - "version": "15.0.3-canary.3", + "version": "15.0.3-canary.4", "repository": { "url": "vercel/next.js", "directory": "packages/font" diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index 0cb3196f4ca92..83a2ea7c6132b 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "15.0.3-canary.3", + "version": "15.0.3-canary.4", "main": "index.js", "types": "index.d.ts", "license": "MIT", diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index adf2e147b2194..ddd26545eb2cb 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "15.0.3-canary.3", + "version": "15.0.3-canary.4", "license": "MIT", "repository": { "type": "git", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index ae06c95f857fa..5ee75a9bfe014 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "15.0.3-canary.3", + "version": "15.0.3-canary.4", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index 4db7037388fe9..c8f2bd168f8ee 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "15.0.3-canary.3", + "version": "15.0.3-canary.4", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 66dd7f0fff016..04249523294e7 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "15.0.3-canary.3", + "version": "15.0.3-canary.4", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-module/package.json b/packages/next-polyfill-module/package.json index 5c637577eda86..d2bb3c65e25c1 100644 --- a/packages/next-polyfill-module/package.json +++ b/packages/next-polyfill-module/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-module", - "version": "15.0.3-canary.3", + "version": "15.0.3-canary.4", "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)", "main": "dist/polyfill-module.js", "license": "MIT", diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index 455877f6766e9..7dedcb87fbd0f 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "15.0.3-canary.3", + "version": "15.0.3-canary.4", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index 5e7dbc14c432b..f5a8af0a247cd 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "15.0.3-canary.3", + "version": "15.0.3-canary.4", "private": true, "scripts": { "clean": "node ../../scripts/rm.mjs native", diff --git a/packages/next/package.json b/packages/next/package.json index 0865bc667b5f5..32867471b1c8f 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "15.0.3-canary.3", + "version": "15.0.3-canary.4", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -97,7 +97,7 @@ ] }, "dependencies": { - "@next/env": "15.0.3-canary.3", + "@next/env": "15.0.3-canary.4", "@swc/counter": "0.1.3", "@swc/helpers": "0.5.13", "busboy": "1.6.0", @@ -161,11 +161,11 @@ "@jest/types": "29.5.0", "@mswjs/interceptors": "0.23.0", "@napi-rs/triples": "1.2.0", - "@next/font": "15.0.3-canary.3", - "@next/polyfill-module": "15.0.3-canary.3", - "@next/polyfill-nomodule": "15.0.3-canary.3", - "@next/react-refresh-utils": "15.0.3-canary.3", - "@next/swc": "15.0.3-canary.3", + "@next/font": "15.0.3-canary.4", + "@next/polyfill-module": "15.0.3-canary.4", + "@next/polyfill-nomodule": "15.0.3-canary.4", + "@next/react-refresh-utils": "15.0.3-canary.4", + "@next/swc": "15.0.3-canary.4", "@opentelemetry/api": "1.6.0", "@playwright/test": "1.41.2", "@swc/core": "1.7.0-nightly-20240714.1", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index d8de3329f61ed..3ac7b2a3a0575 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "15.0.3-canary.3", + "version": "15.0.3-canary.4", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/packages/third-parties/package.json b/packages/third-parties/package.json index 7f8479da335b4..5e3e5637d3e69 100644 --- a/packages/third-parties/package.json +++ b/packages/third-parties/package.json @@ -1,6 +1,6 @@ { "name": "@next/third-parties", - "version": "15.0.3-canary.3", + "version": "15.0.3-canary.4", "repository": { "url": "vercel/next.js", "directory": "packages/third-parties" @@ -26,7 +26,7 @@ "third-party-capital": "1.0.20" }, "devDependencies": { - "next": "15.0.3-canary.3", + "next": "15.0.3-canary.4", "outdent": "0.8.0", "prettier": "2.5.1", "typescript": "5.5.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c70ff443ad5b8..e3179f199b41b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -795,7 +795,7 @@ importers: packages/eslint-config-next: dependencies: '@next/eslint-plugin-next': - specifier: 15.0.3-canary.3 + specifier: 15.0.3-canary.4 version: link:../eslint-plugin-next '@rushstack/eslint-patch': specifier: ^1.10.3 @@ -859,7 +859,7 @@ importers: packages/next: dependencies: '@next/env': - specifier: 15.0.3-canary.3 + specifier: 15.0.3-canary.4 version: link:../next-env '@swc/counter': specifier: 0.1.3 @@ -987,19 +987,19 @@ importers: specifier: 1.2.0 version: 1.2.0 '@next/font': - specifier: 15.0.3-canary.3 + specifier: 15.0.3-canary.4 version: link:../font '@next/polyfill-module': - specifier: 15.0.3-canary.3 + specifier: 15.0.3-canary.4 version: link:../next-polyfill-module '@next/polyfill-nomodule': - specifier: 15.0.3-canary.3 + specifier: 15.0.3-canary.4 version: link:../next-polyfill-nomodule '@next/react-refresh-utils': - specifier: 15.0.3-canary.3 + specifier: 15.0.3-canary.4 version: link:../react-refresh-utils '@next/swc': - specifier: 15.0.3-canary.3 + specifier: 15.0.3-canary.4 version: link:../next-swc '@opentelemetry/api': specifier: 1.6.0 @@ -1633,7 +1633,7 @@ importers: version: 1.0.20 devDependencies: next: - specifier: 15.0.3-canary.3 + specifier: 15.0.3-canary.4 version: link:../next outdent: specifier: 0.8.0 From 0c14b38c47f0fccee4ca9bce8ba729f97ef46214 Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Sun, 3 Nov 2024 22:16:56 +0800 Subject: [PATCH 05/28] docs(cacheTag): remove unused `cacheLife` import and add missing `switcher` (#72217) This PR fixes two issues on the [cacheTag](https://nextjs.org/docs/canary/app/api-reference/functions/cacheTag) documentation page: 1. Remove the unused `unstable_cacheLife` import in the TypeScript codeblock of [Creating tags from external data](https://nextjs.org/docs/canary/app/api-reference/functions/cacheTag#creating-tags-from-external-data) section: ![image](https://github.com/user-attachments/assets/db401635-f07b-4e48-bd39-9a21adedce41) 2. Missing `switcher` for TS codeblock in [Creating tags from external data](https://nextjs.org/docs/canary/app/api-reference/functions/cacheTag#creating-tags-from-external-data) and [Invalidating tagged cache](https://nextjs.org/docs/canary/app/api-reference/functions/cacheTag#invalidating-tagged-cache) sections. We already have the corresponding JS codeblock in the Markdown. ![image](https://github.com/user-attachments/assets/33a36ac4-d936-47dd-8e96-df9e67366680) ![image](https://github.com/user-attachments/assets/2f91f7de-f440-439c-9cce-1749e9645516) Signed-off-by: Eng Zer Jun --- docs/02-app/02-api-reference/04-functions/cacheTag.mdx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/02-app/02-api-reference/04-functions/cacheTag.mdx b/docs/02-app/02-api-reference/04-functions/cacheTag.mdx index 39a0d7e9e202c..db90a2e7199ce 100644 --- a/docs/02-app/02-api-reference/04-functions/cacheTag.mdx +++ b/docs/02-app/02-api-reference/04-functions/cacheTag.mdx @@ -143,11 +143,8 @@ export async function Bookings({ type = 'haircut' }) { You can use the data returned from an async function to tag the cache entry. -```tsx filename="app/components/bookings.tsx" -import { - unstable_cacheTag as cacheTag, - unstable_cacheLife as cacheLife, -} from 'next/cache' +```tsx filename="app/components/bookings.tsx" switcher +import { unstable_cacheTag as cacheTag } from 'next/cache' interface BookingsProps { type: string @@ -182,7 +179,7 @@ export async function Bookings({ type = 'haircut' }) { Using [`revalidateTag`](/docs/app/api-reference/functions/revalidateTag), you can invalidate the cache for a specific tag when needed: -```tsx filename="app/actions.ts" +```tsx filename="app/actions.ts" switcher 'use server' import { revalidateTag } from 'next/cache' From 9409a46218cfdebb18b0e2975e9159acb4802443 Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Sun, 3 Nov 2024 22:19:57 +0800 Subject: [PATCH 06/28] docs(draft-mode): fix missing `switcher` for TS and JS codeblock (#72215) The same codeblock is displayed twice. ![image](https://github.com/user-attachments/assets/01da38e1-4437-4b0a-a08e-a911bf9fea94) ![image](https://github.com/user-attachments/assets/5194faf6-7d5f-44aa-a445-21e02e635809) Signed-off-by: Eng Zer Jun Co-authored-by: Jiwon Choi --- docs/02-app/02-api-reference/04-functions/draft-mode.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/02-app/02-api-reference/04-functions/draft-mode.mdx b/docs/02-app/02-api-reference/04-functions/draft-mode.mdx index c3bd0e1c43f73..a47adb1102540 100644 --- a/docs/02-app/02-api-reference/04-functions/draft-mode.mdx +++ b/docs/02-app/02-api-reference/04-functions/draft-mode.mdx @@ -10,7 +10,7 @@ related: `draftMode` is an **async** function allows you to enable and disable [Draft Mode](/docs/app/building-your-application/configuring/draft-mode), as well as check if Draft Mode is enabled in a [Server Component](/docs/app/building-your-application/rendering/server-components). -```tsx filename="app/page.ts" +```tsx filename="app/page.ts" switcher import { draftMode } from 'next/headers' export default async function Page() { @@ -18,7 +18,7 @@ export default async function Page() { } ``` -```jsx filename="app/page.js" +```jsx filename="app/page.js" switcher import { draftMode } from 'next/headers' export default async function Page() { @@ -101,7 +101,7 @@ Then, send a request to invoke the Route Handler. If calling the route using the You can check if Draft Mode is enabled in a Server Component with the `isEnabled` property: -```tsx filename="app/page.ts" +```tsx filename="app/page.ts" switcher import { draftMode } from 'next/headers' export default async function Page() { @@ -115,7 +115,7 @@ export default async function Page() { } ``` -```jsx filename="app/page.js" +```jsx filename="app/page.js" switcher import { draftMode } from 'next/headers' export default async function Page() { From aee9c1ef063f2e6e0abc1c612424ce2d7f6e100a Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Sun, 3 Nov 2024 22:21:30 +0800 Subject: [PATCH 07/28] docs(cacheLife): fix incorrect highlight and missing `switcher` (#72216) This PR fixes two issues on the [cacheLife](https://nextjs.org/docs/canary/app/api-reference/functions/cacheLife) documentation page: 1. Incorrect highlight for `biweekly` in [Defining reusable cache profiles](https://nextjs.org/docs/canary/app/api-reference/functions/cacheLife#defining-reusable-cache-profiles) section. It should highlight `biweekly` but not `export default async function Page()` ![image](https://github.com/user-attachments/assets/f5b331cf-a5eb-41b0-8cba-08b2a2ff836d) 2. Missing `switcher` for TS and JS codeblock in [Defining cache profiles inline](https://nextjs.org/docs/canary/app/api-reference/functions/cacheLife#defining-cache-profiles-inline) section. Codeblock is displayed twice ![image](https://github.com/user-attachments/assets/e618f806-674f-4c21-8e02-8c90dd2308a5) Signed-off-by: Eng Zer Jun Co-authored-by: Jiwon Choi --- docs/02-app/02-api-reference/04-functions/cacheLife.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/02-app/02-api-reference/04-functions/cacheLife.mdx b/docs/02-app/02-api-reference/04-functions/cacheLife.mdx index 15fcf71c7e68e..247e60e10e25b 100644 --- a/docs/02-app/02-api-reference/04-functions/cacheLife.mdx +++ b/docs/02-app/02-api-reference/04-functions/cacheLife.mdx @@ -142,7 +142,7 @@ module.exports = nextConfig The example above caches for 14 days, checks for updates daily, and expires the cache after 14 days. You can then reference this profile throughout your application by its name: -```tsx filename="app/page.tsx" highlight={4} +```tsx filename="app/page.tsx" highlight={5} 'use cache' import { unstable_cacheLife as cacheLife } from 'next/cache' @@ -181,7 +181,7 @@ module.exports = nextConfig For specific use cases, you can set a custom cache profile by passing an object to the `cacheLife` function: -```tsx filename="app/page.tsx" highlight={5-9} +```tsx filename="app/page.tsx" highlight={5-9} switcher 'use cache' import { unstable_cacheLife as cacheLife } from 'next/cache' @@ -196,7 +196,7 @@ export default async function Page() { } ``` -```jsx filename="app/page.js" highlight={5-9} +```jsx filename="app/page.js" highlight={5-9} switcher 'use cache' import { unstable_cacheLife as cacheLife } from 'next/cache' From 2f427f33b21812e940dea229b0d4a1d9d6b71505 Mon Sep 17 00:00:00 2001 From: Arfa Ahmed Date: Sun, 3 Nov 2024 19:24:43 +0500 Subject: [PATCH 08/28] docs(server-actions-mutations): Add missing TS/JS switcher to `Passing Additional Arguments` section in `Server Actions and Mutations` docs (#72226) This PR adds a missing TypeScript/JavaScript code switcher to the [Passing Additional Arguments](https://nextjs.org/docs/canary/app/building-your-application/data-fetching/server-actions-and-mutations#passing-additional-arguments) section in the [Server Actions and Mutations](https://nextjs.org/docs/canary/app/building-your-application/data-fetching/server-actions-and-mutations) documentation. This enhancement improves accessibility for users by providing both TypeScript and JavaScript code examples, making it easier for developers to follow along in their preferred language. ![image](https://github.com/user-attachments/assets/d8225abc-c1d0-478f-afc1-6830f83587c4) Co-authored-by: Jiwon Choi --- .../02-data-fetching/03-server-actions-and-mutations.mdx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/02-app/01-building-your-application/02-data-fetching/03-server-actions-and-mutations.mdx b/docs/02-app/01-building-your-application/02-data-fetching/03-server-actions-and-mutations.mdx index f975b7ef01166..31a02375f9c1d 100644 --- a/docs/02-app/01-building-your-application/02-data-fetching/03-server-actions-and-mutations.mdx +++ b/docs/02-app/01-building-your-application/02-data-fetching/03-server-actions-and-mutations.mdx @@ -219,7 +219,13 @@ export function UserProfile({ userId }) { The Server Action will receive the `userId` argument, in addition to the form data: -```js filename="app/actions.js" +```ts filename="app/actions.ts" switcher +'use server' + +export async function updateUser(userId: string, formData: FormData) {} +``` + +```js filename="app/actions.js" switcher 'use server' export async function updateUser(userId, formData) {} From 94eca4bb5654359ce491daa83e4461066678f5e6 Mon Sep 17 00:00:00 2001 From: Jam Balaya Date: Mon, 4 Nov 2024 01:05:40 +0900 Subject: [PATCH 09/28] docs: change `NextAuth.js` to `Auth.js` (#72201) ## Summary [`NextAuth.js`](https://next-auth.js.org/) is becoming [`Auth.js`](https://authjs.dev/)! Then update new documentation link. ### Improving Documentation - [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com> --- .../01-building-your-application/09-authentication/index.mdx | 2 +- docs/02-app/index.mdx | 2 +- examples/auth/README.md | 2 +- examples/auth/app/layout.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/02-app/01-building-your-application/09-authentication/index.mdx b/docs/02-app/01-building-your-application/09-authentication/index.mdx index dfefa42ac8786..c26bead977281 100644 --- a/docs/02-app/01-building-your-application/09-authentication/index.mdx +++ b/docs/02-app/01-building-your-application/09-authentication/index.mdx @@ -1642,10 +1642,10 @@ Now that you've learned about authentication in Next.js, here are Next.js-compat ### Auth Libraries +- [Auth.js](https://authjs.dev/getting-started/installation?framework=next.js) - [Auth0](https://auth0.com/docs/quickstart/webapp/nextjs/01-login) - [Clerk](https://clerk.com/docs/quickstarts/nextjs) - [Kinde](https://kinde.com/docs/developer-tools/nextjs-sdk) -- [NextAuth.js](https://authjs.dev/getting-started/installation?framework=next.js) - [Ory](https://www.ory.sh/docs/getting-started/integrate-auth/nextjs) - [Stack Auth](https://docs.stack-auth.com/getting-started/setup) - [Supabase](https://supabase.com/docs/guides/getting-started/quickstarts/nextjs) diff --git a/docs/02-app/index.mdx b/docs/02-app/index.mdx index f517cdf2bafc6..bc4f5050b03a2 100644 --- a/docs/02-app/index.mdx +++ b/docs/02-app/index.mdx @@ -35,7 +35,7 @@ You can use [`redirect`](/docs/app/api-reference/functions/redirect) to redirect Here are some common authentication solutions that support the App Router: -- [NextAuth.js](https://next-auth.js.org/configuration/nextjs#in-app-router) +- [Auth.js](https://authjs.dev/getting-started/installation?framework=Next.js) - [Clerk](https://clerk.com/docs/quickstarts/nextjs) - [Stack Auth](https://docs.stack-auth.com/getting-started/setup) - [Auth0](https://github.com/auth0/nextjs-auth0#app-router) diff --git a/examples/auth/README.md b/examples/auth/README.md index aa0e14c8c5cb2..a191dd76470b4 100644 --- a/examples/auth/README.md +++ b/examples/auth/README.md @@ -1,6 +1,6 @@ # Authentication -This is an example using NextAuth.js for authentication. +This is an example using [Auth.js](https://authjs.dev/) for authentication. ## Deploy your own diff --git a/examples/auth/app/layout.tsx b/examples/auth/app/layout.tsx index 48f0ecfeb66aa..65fc27eabb947 100644 --- a/examples/auth/app/layout.tsx +++ b/examples/auth/app/layout.tsx @@ -2,7 +2,7 @@ import "./globals.css"; export const metadata = { title: "Next.js Authentication", - description: "Example using NextAuth.js", + description: "Example using Auth.js", }; export default function RootLayout({ From c479c04e3ee766a4a0a2c170478d18b12baf1528 Mon Sep 17 00:00:00 2001 From: Vercel Release Bot <88769842+vercel-release-bot@users.noreply.github.com> Date: Sun, 3 Nov 2024 10:11:20 -0800 Subject: [PATCH 10/28] Upgrade React from `603e6108-20241029` to `7c8e5e7a-20241101` (#72199) --- examples/reproduction-template/package.json | 4 +- package.json | 34 +- packages/create-next-app/templates/index.ts | 2 +- packages/next/package.json | 4 +- .../cjs/react-dom-client.development.js | 33 +- .../cjs/react-dom-client.production.js | 33 +- .../cjs/react-dom-profiling.development.js | 33 +- .../cjs/react-dom-profiling.profiling.js | 33 +- ...t-dom-server-legacy.browser.development.js | 2 +- ...ct-dom-server-legacy.browser.production.js | 2 +- ...eact-dom-server-legacy.node.development.js | 2 +- ...react-dom-server-legacy.node.production.js | 2 +- .../react-dom-server.browser.development.js | 6 +- .../react-dom-server.browser.production.js | 6 +- .../cjs/react-dom-server.bun.production.js | 6 +- .../cjs/react-dom-server.edge.development.js | 6 +- .../cjs/react-dom-server.edge.production.js | 6 +- .../cjs/react-dom-server.node.development.js | 6 +- .../cjs/react-dom-server.node.production.js | 6 +- .../react-dom-unstable_testing.development.js | 33 +- .../react-dom-unstable_testing.production.js | 33 +- .../cjs/react-dom.development.js | 2 +- .../cjs/react-dom.production.js | 2 +- .../cjs/react-dom.react-server.development.js | 2 +- .../cjs/react-dom.react-server.production.js | 2 +- .../react-dom-experimental/package.json | 4 +- .../cjs/react-dom-client.development.js | 33 +- .../cjs/react-dom-client.production.js | 33 +- .../cjs/react-dom-profiling.development.js | 33 +- .../cjs/react-dom-profiling.profiling.js | 33 +- ...t-dom-server-legacy.browser.development.js | 2 +- ...ct-dom-server-legacy.browser.production.js | 2 +- ...eact-dom-server-legacy.node.development.js | 2 +- ...react-dom-server-legacy.node.production.js | 2 +- .../react-dom-server.browser.development.js | 6 +- .../react-dom-server.browser.production.js | 6 +- .../cjs/react-dom-server.bun.production.js | 6 +- .../cjs/react-dom-server.edge.development.js | 6 +- .../cjs/react-dom-server.edge.production.js | 6 +- .../cjs/react-dom-server.node.development.js | 6 +- .../cjs/react-dom-server.node.production.js | 6 +- .../react-dom/cjs/react-dom.development.js | 2 +- .../react-dom/cjs/react-dom.production.js | 2 +- .../cjs/react-dom.react-server.development.js | 2 +- .../cjs/react-dom.react-server.production.js | 2 +- .../next/src/compiled/react-dom/package.json | 4 +- .../cjs/react.development.js | 2 +- .../cjs/react.production.js | 2 +- .../cjs/react.react-server.development.js | 2 +- .../cjs/react.react-server.production.js | 2 +- .../next/src/compiled/react-is/package.json | 2 +- ...om-turbopack-client.browser.development.js | 4 +- ...om-turbopack-server.browser.development.js | 45 ++- ...r-dom-turbopack-server.edge.development.js | 45 ++- ...r-dom-turbopack-server.node.development.js | 45 ++- .../package.json | 4 +- ...om-turbopack-client.browser.development.js | 4 +- ...om-turbopack-server.browser.development.js | 45 ++- ...r-dom-turbopack-server.edge.development.js | 45 ++- ...r-dom-turbopack-server.node.development.js | 45 ++- .../react-server-dom-turbopack/package.json | 4 +- ...-dom-webpack-client.browser.development.js | 4 +- ...-dom-webpack-server.browser.development.js | 45 ++- ...ver-dom-webpack-server.edge.development.js | 45 ++- ...ver-dom-webpack-server.node.development.js | 45 ++- ...bpack-server.node.unbundled.development.js | 45 ++- .../package.json | 4 +- ...-dom-webpack-client.browser.development.js | 4 +- ...-dom-webpack-server.browser.development.js | 45 ++- ...ver-dom-webpack-server.edge.development.js | 45 ++- ...ver-dom-webpack-server.node.development.js | 45 ++- ...bpack-server.node.unbundled.development.js | 45 ++- .../react-server-dom-webpack/package.json | 4 +- .../compiled/react/cjs/react.development.js | 2 +- .../compiled/react/cjs/react.production.js | 2 +- .../cjs/react.react-server.development.js | 2 +- .../cjs/react.react-server.production.js | 2 +- .../next/src/compiled/unistore/unistore.js | 2 +- packages/third-parties/package.json | 2 +- pnpm-lock.yaml | 376 +++++++++--------- run-tests.js | 2 +- test/.stats-app/package.json | 4 +- .../first-time-setup-js/package.json | 4 +- .../first-time-setup-ts/package.json | 4 +- test/lib/next-modes/base.ts | 2 +- 85 files changed, 973 insertions(+), 601 deletions(-) diff --git a/examples/reproduction-template/package.json b/examples/reproduction-template/package.json index e647846a50e06..bbf0f4745d626 100644 --- a/examples/reproduction-template/package.json +++ b/examples/reproduction-template/package.json @@ -7,8 +7,8 @@ }, "dependencies": { "next": "canary", - "react": "19.0.0-rc-603e6108-20241029", - "react-dom": "19.0.0-rc-603e6108-20241029" + "react": "19.0.0-rc-7c8e5e7a-20241101", + "react-dom": "19.0.0-rc-7c8e5e7a-20241101" }, "devDependencies": { "@types/node": "20.12.12", diff --git a/package.json b/package.json index 4acc072c54e3a..ba39b8ce6cce3 100644 --- a/package.json +++ b/package.json @@ -209,19 +209,19 @@ "pretty-bytes": "5.3.0", "pretty-ms": "7.0.0", "random-seed": "0.3.0", - "react": "19.0.0-rc-603e6108-20241029", + "react": "19.0.0-rc-7c8e5e7a-20241101", "react-17": "npm:react@17.0.2", - "react-builtin": "npm:react@19.0.0-rc-603e6108-20241029", - "react-dom": "19.0.0-rc-603e6108-20241029", + "react-builtin": "npm:react@19.0.0-rc-7c8e5e7a-20241101", + "react-dom": "19.0.0-rc-7c8e5e7a-20241101", "react-dom-17": "npm:react-dom@17.0.2", - "react-dom-builtin": "npm:react-dom@19.0.0-rc-603e6108-20241029", - "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-603e6108-20241029", - "react-experimental-builtin": "npm:react@0.0.0-experimental-603e6108-20241029", - "react-is-builtin": "npm:react-is@19.0.0-rc-603e6108-20241029", - "react-server-dom-turbopack": "19.0.0-rc-603e6108-20241029", - "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-603e6108-20241029", - "react-server-dom-webpack": "19.0.0-rc-603e6108-20241029", - "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-603e6108-20241029", + "react-dom-builtin": "npm:react-dom@19.0.0-rc-7c8e5e7a-20241101", + "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-7c8e5e7a-20241101", + "react-experimental-builtin": "npm:react@0.0.0-experimental-7c8e5e7a-20241101", + "react-is-builtin": "npm:react-is@19.0.0-rc-7c8e5e7a-20241101", + "react-server-dom-turbopack": "19.0.0-rc-7c8e5e7a-20241101", + "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-7c8e5e7a-20241101", + "react-server-dom-webpack": "19.0.0-rc-7c8e5e7a-20241101", + "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-7c8e5e7a-20241101", "react-ssr-prepass": "1.0.8", "react-virtualized": "9.22.3", "relay-compiler": "13.0.2", @@ -231,8 +231,8 @@ "resolve-from": "5.0.0", "sass": "1.54.0", "satori": "0.10.9", - "scheduler-builtin": "npm:scheduler@0.25.0-rc-603e6108-20241029", - "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-603e6108-20241029", + "scheduler-builtin": "npm:scheduler@0.25.0-rc-7c8e5e7a-20241101", + "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-7c8e5e7a-20241101", "seedrandom": "3.0.5", "semver": "7.3.7", "shell-quote": "1.7.3", @@ -272,10 +272,10 @@ "@babel/traverse": "7.22.5", "@types/react": "npm:types-react@19.0.0-rc.0", "@types/react-dom": "npm:types-react-dom@19.0.0-rc.0", - "react": "19.0.0-rc-603e6108-20241029", - "react-dom": "19.0.0-rc-603e6108-20241029", - "react-is": "19.0.0-rc-603e6108-20241029", - "scheduler": "0.25.0-rc-603e6108-20241029" + "react": "19.0.0-rc-7c8e5e7a-20241101", + "react-dom": "19.0.0-rc-7c8e5e7a-20241101", + "react-is": "19.0.0-rc-7c8e5e7a-20241101", + "scheduler": "0.25.0-rc-7c8e5e7a-20241101" }, "patchedDependencies": { "webpack-sources@3.2.3": "patches/webpack-sources@3.2.3.patch" diff --git a/packages/create-next-app/templates/index.ts b/packages/create-next-app/templates/index.ts index f9bf99c639567..e996dafd5f8c2 100644 --- a/packages/create-next-app/templates/index.ts +++ b/packages/create-next-app/templates/index.ts @@ -13,7 +13,7 @@ import { GetTemplateFileArgs, InstallTemplateArgs } from "./types"; // Do not rename or format. sync-react script relies on this line. // prettier-ignore -const nextjsReactPeerVersion = "19.0.0-rc-603e6108-20241029"; +const nextjsReactPeerVersion = "19.0.0-rc-7c8e5e7a-20241101"; /** * Get the file path for a given file in a template, e.g. "next.config.js". diff --git a/packages/next/package.json b/packages/next/package.json index 32867471b1c8f..80984e6b28118 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -109,8 +109,8 @@ "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.41.2", "babel-plugin-react-compiler": "*", - "react": "^18.2.0 || 19.0.0-rc-603e6108-20241029", - "react-dom": "^18.2.0 || 19.0.0-rc-603e6108-20241029", + "react": "^18.2.0 || 19.0.0-rc-7c8e5e7a-20241101", + "react-dom": "^18.2.0 || 19.0.0-rc-7c8e5e7a-20241101", "sass": "^1.3.0" }, "peerDependenciesMeta": { diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.development.js index 13d8873248f97..dcf6ef4bf90c5 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.development.js @@ -12039,7 +12039,8 @@ ); break; case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); + offscreenSubtreeWasHidden || + safelyDetachRef(deletedFiber, nearestMountedAncestor); offscreenSubtreeWasHidden = (prevHostParent = offscreenSubtreeWasHidden) || null !== deletedFiber.memoizedState; @@ -12196,8 +12197,9 @@ recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); flags & 64 && offscreenSubtreeIsHidden && ((flags = finishedWork.updateQueue), @@ -12213,8 +12215,9 @@ recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (flags & 4) if ( ((root = null !== current ? current.memoizedState : null), @@ -12404,8 +12407,9 @@ recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (finishedWork.flags & 32) { root = finishedWork.stateNode; try { @@ -12510,8 +12514,9 @@ break; case 22: flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); i = null !== finishedWork.memoizedState; nextNode = null !== current && null !== current.memoizedState; nodeName = offscreenSubtreeIsHidden; @@ -24913,11 +24918,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24954,11 +24959,11 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-experimental-603e6108-20241029", + version: "19.0.0-experimental-7c8e5e7a-20241101", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-603e6108-20241029" + reconcilerVersion: "19.0.0-experimental-7c8e5e7a-20241101" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25100,7 +25105,7 @@ listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.0.0-experimental-603e6108-20241029"; + exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.production.js index 315f8ebfc102f..a5d6054c293fe 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.production.js @@ -8296,7 +8296,8 @@ function commitDeletionEffectsOnFiber( ); break; case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); + offscreenSubtreeWasHidden || + safelyDetachRef(deletedFiber, nearestMountedAncestor); offscreenSubtreeWasHidden = (prevHostParent = offscreenSubtreeWasHidden) || null !== deletedFiber.memoizedState; @@ -8417,8 +8418,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); flags & 64 && offscreenSubtreeIsHidden && ((finishedWork = finishedWork.updateQueue), @@ -8434,8 +8436,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (flags & 4) { var currentResource = null !== current ? current.memoizedState : null; flags = finishedWork.memoizedState; @@ -8615,8 +8618,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (finishedWork.flags & 32) { hoistableRoot = finishedWork.stateNode; try { @@ -8694,8 +8698,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { break; case 22: flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); node = null !== finishedWork.memoizedState; nextNode = null !== current && null !== current.memoizedState; nodeName = offscreenSubtreeIsHidden; @@ -15133,14 +15138,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1669 = React.version; if ( - "19.0.0-experimental-603e6108-20241029" !== + "19.0.0-experimental-7c8e5e7a-20241101" !== isomorphicReactPackageVersion$jscomp$inline_1669 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1669, - "19.0.0-experimental-603e6108-20241029" + "19.0.0-experimental-7c8e5e7a-20241101" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15162,11 +15167,11 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2135 = { bundleType: 0, - version: "19.0.0-experimental-603e6108-20241029", + version: "19.0.0-experimental-7c8e5e7a-20241101", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-603e6108-20241029" + reconcilerVersion: "19.0.0-experimental-7c8e5e7a-20241101" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2136 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15270,4 +15275,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.0.0-experimental-603e6108-20241029"; +exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.development.js index 6cdf4f161f98c..d500eee739c84 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.development.js @@ -12047,7 +12047,8 @@ ); break; case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); + offscreenSubtreeWasHidden || + safelyDetachRef(deletedFiber, nearestMountedAncestor); offscreenSubtreeWasHidden = (prevHostParent = offscreenSubtreeWasHidden) || null !== deletedFiber.memoizedState; @@ -12204,8 +12205,9 @@ recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); flags & 64 && offscreenSubtreeIsHidden && ((flags = finishedWork.updateQueue), @@ -12221,8 +12223,9 @@ recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (flags & 4) if ( ((root = null !== current ? current.memoizedState : null), @@ -12412,8 +12415,9 @@ recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (finishedWork.flags & 32) { root = finishedWork.stateNode; try { @@ -12518,8 +12522,9 @@ break; case 22: flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); i = null !== finishedWork.memoizedState; nextNode = null !== current && null !== current.memoizedState; nodeName = offscreenSubtreeIsHidden; @@ -24970,11 +24975,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -25011,11 +25016,11 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-experimental-603e6108-20241029", + version: "19.0.0-experimental-7c8e5e7a-20241101", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-603e6108-20241029" + reconcilerVersion: "19.0.0-experimental-7c8e5e7a-20241101" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25487,7 +25492,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-experimental-603e6108-20241029"; + exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.profiling.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.profiling.js index dc19ed2bde5f2..d60aab09e4124 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.profiling.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.profiling.js @@ -8770,7 +8770,8 @@ function commitDeletionEffectsOnFiber( ); break; case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); + offscreenSubtreeWasHidden || + safelyDetachRef(deletedFiber, nearestMountedAncestor); offscreenSubtreeWasHidden = (prevHostParent = offscreenSubtreeWasHidden) || null !== deletedFiber.memoizedState; @@ -8905,8 +8906,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); flags & 64 && offscreenSubtreeIsHidden && ((flags = finishedWork.updateQueue), @@ -8922,8 +8924,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (flags & 4) if ( ((root = null !== current ? current.memoizedState : null), @@ -9103,8 +9106,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (finishedWork.flags & 32) { root = finishedWork.stateNode; try { @@ -9187,8 +9191,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { break; case 22: flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); node = null !== finishedWork.memoizedState; nextNode = null !== current && null !== current.memoizedState; nodeName = offscreenSubtreeIsHidden; @@ -16023,14 +16028,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1742 = React.version; if ( - "19.0.0-experimental-603e6108-20241029" !== + "19.0.0-experimental-7c8e5e7a-20241101" !== isomorphicReactPackageVersion$jscomp$inline_1742 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1742, - "19.0.0-experimental-603e6108-20241029" + "19.0.0-experimental-7c8e5e7a-20241101" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -16052,11 +16057,11 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2181 = { bundleType: 0, - version: "19.0.0-experimental-603e6108-20241029", + version: "19.0.0-experimental-7c8e5e7a-20241101", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-603e6108-20241029" + reconcilerVersion: "19.0.0-experimental-7c8e5e7a-20241101" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2182 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -16321,7 +16326,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-experimental-603e6108-20241029"; +exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js index 403dfb2ff6c7a..b377d5e34a7db 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js @@ -9295,5 +9295,5 @@ 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-experimental-603e6108-20241029"; + exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.js index 4ef8b3cfecacc..a2f6adb433951 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.js @@ -6060,4 +6060,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-experimental-603e6108-20241029"; +exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.development.js index a4b7dbe114e1e..ccbaee582e3b6 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.development.js @@ -9295,5 +9295,5 @@ 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToPipeableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-experimental-603e6108-20241029"; + exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.production.js index f460569c1038e..285185498c1df 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.production.js @@ -6152,4 +6152,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToPipeableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-experimental-603e6108-20241029"; +exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.development.js index 29e1538c05940..0eb43104efda5 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.development.js @@ -8193,11 +8193,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react-experimental"), @@ -9977,5 +9977,5 @@ startWork(request); }); }; - exports.version = "19.0.0-experimental-603e6108-20241029"; + exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.production.js index e32045d269937..9e71d2bb24082 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.production.js @@ -6589,12 +6589,12 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion, - "19.0.0-experimental-603e6108-20241029" + "19.0.0-experimental-7c8e5e7a-20241101" ) ); } @@ -6849,4 +6849,4 @@ exports.resumeAndPrerender = function (children, postponedState, options) { startWork(request); }); }; -exports.version = "19.0.0-experimental-603e6108-20241029"; +exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.bun.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.bun.production.js index 1ed1665a4e08c..0b5bff3cb316c 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.bun.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.bun.production.js @@ -6071,13 +6071,13 @@ function addToReplayParent(node, parentKeyPath, trackedPostpones) { } var isomorphicReactPackageVersion$jscomp$inline_779 = React.version; if ( - "19.0.0-experimental-603e6108-20241029" !== + "19.0.0-experimental-7c8e5e7a-20241101" !== isomorphicReactPackageVersion$jscomp$inline_779 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_779 + - "\n - react-dom: 19.0.0-experimental-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); exports.renderToReadableStream = function (children, options) { return new Promise(function (resolve, reject) { @@ -6168,4 +6168,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.0.0-experimental-603e6108-20241029"; +exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.development.js index 362f45e71f9f1..c32a38154831a 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.development.js @@ -8210,11 +8210,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react-experimental"), @@ -10001,5 +10001,5 @@ const setTimeoutOrImmediate = ? globalThis['set' + 'Immediate'] : setTimeout; - exports.version = "19.0.0-experimental-603e6108-20241029"; + exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.production.js index 65cce74155ddd..75ad2f7f8ba7c 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.production.js @@ -6691,11 +6691,11 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -6960,4 +6960,4 @@ const setTimeoutOrImmediate = ? globalThis['set' + 'Immediate'] : setTimeout; -exports.version = "19.0.0-experimental-603e6108-20241029"; +exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.development.js index b0bc215f277ea..7a4958770c70f 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.development.js @@ -8074,11 +8074,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); } function createDrainHandler(destination, request) { @@ -9851,5 +9851,5 @@ } }; }; - exports.version = "19.0.0-experimental-603e6108-20241029"; + exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.production.js index 3ce75f7853478..d59c8e73266ca 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.production.js @@ -6570,11 +6570,11 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -6825,4 +6825,4 @@ exports.resumeToPipeableStream = function (children, postponedState, options) { } }; }; -exports.version = "19.0.0-experimental-603e6108-20241029"; +exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.development.js index 689f0fae8b99a..fcd40554e2660 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.development.js @@ -12080,7 +12080,8 @@ ); break; case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); + offscreenSubtreeWasHidden || + safelyDetachRef(deletedFiber, nearestMountedAncestor); offscreenSubtreeWasHidden = (prevHostParent = offscreenSubtreeWasHidden) || null !== deletedFiber.memoizedState; @@ -12237,8 +12238,9 @@ recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); flags & 64 && offscreenSubtreeIsHidden && ((flags = finishedWork.updateQueue), @@ -12254,8 +12256,9 @@ recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (flags & 4) if ( ((root = null !== current ? current.memoizedState : null), @@ -12445,8 +12448,9 @@ recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (finishedWork.flags & 32) { root = finishedWork.stateNode; try { @@ -12551,8 +12555,9 @@ break; case 22: flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); i = null !== finishedWork.memoizedState; nextNode = null !== current && null !== current.memoizedState; nodeName = offscreenSubtreeIsHidden; @@ -25247,11 +25252,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -25288,11 +25293,11 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-experimental-603e6108-20241029", + version: "19.0.0-experimental-7c8e5e7a-20241101", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-603e6108-20241029" + reconcilerVersion: "19.0.0-experimental-7c8e5e7a-20241101" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25600,5 +25605,5 @@ } }; }; - exports.version = "19.0.0-experimental-603e6108-20241029"; + exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.production.js index e2dacd4f8b0d8..cd7f9b43be9e6 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.production.js @@ -8382,7 +8382,8 @@ function commitDeletionEffectsOnFiber( ); break; case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); + offscreenSubtreeWasHidden || + safelyDetachRef(deletedFiber, nearestMountedAncestor); offscreenSubtreeWasHidden = (prevHostParent = offscreenSubtreeWasHidden) || null !== deletedFiber.memoizedState; @@ -8503,8 +8504,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); flags & 64 && offscreenSubtreeIsHidden && ((finishedWork = finishedWork.updateQueue), @@ -8520,8 +8522,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (flags & 4) { var currentResource = null !== current ? current.memoizedState : null; flags = finishedWork.memoizedState; @@ -8701,8 +8704,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (finishedWork.flags & 32) { hoistableRoot = finishedWork.stateNode; try { @@ -8780,8 +8784,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { break; case 22: flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); node = null !== finishedWork.memoizedState; nextNode = null !== current && null !== current.memoizedState; nodeName = offscreenSubtreeIsHidden; @@ -15462,14 +15467,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1698 = React.version; if ( - "19.0.0-experimental-603e6108-20241029" !== + "19.0.0-experimental-7c8e5e7a-20241101" !== isomorphicReactPackageVersion$jscomp$inline_1698 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1698, - "19.0.0-experimental-603e6108-20241029" + "19.0.0-experimental-7c8e5e7a-20241101" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15491,11 +15496,11 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2169 = { bundleType: 0, - version: "19.0.0-experimental-603e6108-20241029", + version: "19.0.0-experimental-7c8e5e7a-20241101", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-603e6108-20241029" + reconcilerVersion: "19.0.0-experimental-7c8e5e7a-20241101" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2170 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15750,4 +15755,4 @@ exports.observeVisibleRects = function ( } }; }; -exports.version = "19.0.0-experimental-603e6108-20241029"; +exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.development.js index f13523f9a5ba9..c130831f85f66 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.development.js @@ -416,7 +416,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-experimental-603e6108-20241029"; + exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.production.js index 142124b8f90c1..77f0c5f0066b9 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.production.js @@ -207,4 +207,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-experimental-603e6108-20241029"; +exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.development.js index 2580861540167..86bd4636c32cc 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.development.js @@ -336,5 +336,5 @@ })) : Internals.d.m(href)); }; - exports.version = "19.0.0-experimental-603e6108-20241029"; + exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.production.js index 774cb291eac31..1c63cb60ff8ca 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.production.js @@ -149,4 +149,4 @@ exports.preloadModule = function (href, options) { }); } else Internals.d.m(href); }; -exports.version = "19.0.0-experimental-603e6108-20241029"; +exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom-experimental/package.json b/packages/next/src/compiled/react-dom-experimental/package.json index 53c9747d8a574..a15689914ba7f 100644 --- a/packages/next/src/compiled/react-dom-experimental/package.json +++ b/packages/next/src/compiled/react-dom-experimental/package.json @@ -72,10 +72,10 @@ "./package.json": "./package.json" }, "dependencies": { - "scheduler": "0.0.0-experimental-603e6108-20241029" + "scheduler": "0.0.0-experimental-7c8e5e7a-20241101" }, "peerDependencies": { - "react": "0.0.0-experimental-603e6108-20241029" + "react": "0.0.0-experimental-7c8e5e7a-20241101" }, "browser": { "./server.js": "./server.browser.js", diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-client.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-client.development.js index 33b58615b3eb9..7a92221202edc 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-client.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-client.development.js @@ -11776,7 +11776,8 @@ ); break; case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); + offscreenSubtreeWasHidden || + safelyDetachRef(deletedFiber, nearestMountedAncestor); offscreenSubtreeWasHidden = (prevHostParent = offscreenSubtreeWasHidden) || null !== deletedFiber.memoizedState; @@ -11931,8 +11932,9 @@ recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); flags & 64 && offscreenSubtreeIsHidden && ((finishedWork = finishedWork.updateQueue), @@ -11948,8 +11950,9 @@ recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (flags & 4) if ( ((root = null !== current ? current.memoizedState : null), @@ -12139,8 +12142,9 @@ recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (finishedWork.flags & 32) { root = finishedWork.stateNode; try { @@ -12245,8 +12249,9 @@ break; case 22: flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); i = null !== finishedWork.memoizedState; nextNode = null !== current && null !== current.memoizedState; nodeName = offscreenSubtreeIsHidden; @@ -24440,11 +24445,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24481,11 +24486,11 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-rc-603e6108-20241029", + version: "19.0.0-rc-7c8e5e7a-20241101", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-603e6108-20241029" + reconcilerVersion: "19.0.0-rc-7c8e5e7a-20241101" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -24629,7 +24634,7 @@ listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.0.0-rc-603e6108-20241029"; + exports.version = "19.0.0-rc-7c8e5e7a-20241101"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-client.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-client.production.js index 6a48b7309c721..983a7f4cd422b 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-client.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-client.production.js @@ -8139,7 +8139,8 @@ function commitDeletionEffectsOnFiber( ); break; case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); + offscreenSubtreeWasHidden || + safelyDetachRef(deletedFiber, nearestMountedAncestor); offscreenSubtreeWasHidden = (prevHostParent = offscreenSubtreeWasHidden) || null !== deletedFiber.memoizedState; @@ -8260,8 +8261,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); flags & 64 && offscreenSubtreeIsHidden && ((finishedWork = finishedWork.updateQueue), @@ -8277,8 +8279,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (flags & 4) { var currentResource = null !== current ? current.memoizedState : null; flags = finishedWork.memoizedState; @@ -8458,8 +8461,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (finishedWork.flags & 32) { hoistableRoot = finishedWork.stateNode; try { @@ -8537,8 +8541,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { break; case 22: flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); node = null !== finishedWork.memoizedState; nextNode = null !== current && null !== current.memoizedState; nodeName = offscreenSubtreeIsHidden; @@ -14971,14 +14976,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1676 = React.version; if ( - "19.0.0-rc-603e6108-20241029" !== + "19.0.0-rc-7c8e5e7a-20241101" !== isomorphicReactPackageVersion$jscomp$inline_1676 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1676, - "19.0.0-rc-603e6108-20241029" + "19.0.0-rc-7c8e5e7a-20241101" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15000,11 +15005,11 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2148 = { bundleType: 0, - version: "19.0.0-rc-603e6108-20241029", + version: "19.0.0-rc-7c8e5e7a-20241101", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-603e6108-20241029" + reconcilerVersion: "19.0.0-rc-7c8e5e7a-20241101" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2149 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15108,4 +15113,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.0.0-rc-603e6108-20241029"; +exports.version = "19.0.0-rc-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.development.js index af607adacd2fa..9a5d591f69d35 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.development.js @@ -11784,7 +11784,8 @@ ); break; case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); + offscreenSubtreeWasHidden || + safelyDetachRef(deletedFiber, nearestMountedAncestor); offscreenSubtreeWasHidden = (prevHostParent = offscreenSubtreeWasHidden) || null !== deletedFiber.memoizedState; @@ -11939,8 +11940,9 @@ recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); flags & 64 && offscreenSubtreeIsHidden && ((finishedWork = finishedWork.updateQueue), @@ -11956,8 +11958,9 @@ recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (flags & 4) if ( ((root = null !== current ? current.memoizedState : null), @@ -12147,8 +12150,9 @@ recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (finishedWork.flags & 32) { root = finishedWork.stateNode; try { @@ -12253,8 +12257,9 @@ break; case 22: flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); i = null !== finishedWork.memoizedState; nextNode = null !== current && null !== current.memoizedState; nodeName = offscreenSubtreeIsHidden; @@ -24497,11 +24502,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24538,11 +24543,11 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-rc-603e6108-20241029", + version: "19.0.0-rc-7c8e5e7a-20241101", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-603e6108-20241029" + reconcilerVersion: "19.0.0-rc-7c8e5e7a-20241101" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25016,7 +25021,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-rc-603e6108-20241029"; + exports.version = "19.0.0-rc-7c8e5e7a-20241101"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.profiling.js b/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.profiling.js index b17be4fb223a4..4f40f85e4a3f0 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.profiling.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.profiling.js @@ -8532,7 +8532,8 @@ function commitDeletionEffectsOnFiber( ); break; case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); + offscreenSubtreeWasHidden || + safelyDetachRef(deletedFiber, nearestMountedAncestor); offscreenSubtreeWasHidden = (prevHostParent = offscreenSubtreeWasHidden) || null !== deletedFiber.memoizedState; @@ -8665,8 +8666,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); flags & 64 && offscreenSubtreeIsHidden && ((finishedWork = finishedWork.updateQueue), @@ -8682,8 +8684,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (flags & 4) if ( ((root = null !== current ? current.memoizedState : null), @@ -8863,8 +8866,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); if (finishedWork.flags & 32) { root = finishedWork.stateNode; try { @@ -8947,8 +8951,9 @@ function commitMutationEffectsOnFiber(finishedWork, root) { break; case 22: flags & 512 && - null !== current && - safelyDetachRef(current, current.return); + (offscreenSubtreeWasHidden || + null === current || + safelyDetachRef(current, current.return)); node = null !== finishedWork.memoizedState; nextNode = null !== current && null !== current.memoizedState; nodeName = offscreenSubtreeIsHidden; @@ -15623,14 +15628,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1767 = React.version; if ( - "19.0.0-rc-603e6108-20241029" !== + "19.0.0-rc-7c8e5e7a-20241101" !== isomorphicReactPackageVersion$jscomp$inline_1767 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1767, - "19.0.0-rc-603e6108-20241029" + "19.0.0-rc-7c8e5e7a-20241101" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15652,11 +15657,11 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_1774 = { bundleType: 0, - version: "19.0.0-rc-603e6108-20241029", + version: "19.0.0-rc-7c8e5e7a-20241101", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-603e6108-20241029", + reconcilerVersion: "19.0.0-rc-7c8e5e7a-20241101", getLaneLabelMap: function () { for ( var map = new Map(), lane = 1, index$274 = 0; @@ -15936,7 +15941,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-rc-603e6108-20241029"; +exports.version = "19.0.0-rc-7c8e5e7a-20241101"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js index da2df1959cd8d..6246dcb586382 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js @@ -8570,5 +8570,5 @@ 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-rc-603e6108-20241029"; + exports.version = "19.0.0-rc-7c8e5e7a-20241101"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.js index 61efba0129850..d9e37ac7c547a 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.js @@ -5623,4 +5623,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-rc-603e6108-20241029"; +exports.version = "19.0.0-rc-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.development.js index ec2d0ce974855..ac95c818578e0 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.development.js @@ -8570,5 +8570,5 @@ 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToPipeableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-rc-603e6108-20241029"; + exports.version = "19.0.0-rc-7c8e5e7a-20241101"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.production.js index 8c79217150715..cc466d5e0000e 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.production.js @@ -5701,4 +5701,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToPipeableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-rc-603e6108-20241029"; +exports.version = "19.0.0-rc-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.development.js index d677ebd1b17d4..b170eb2ef9bfc 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.development.js @@ -7296,11 +7296,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react"), @@ -8952,5 +8952,5 @@ startWork(request); }); }; - exports.version = "19.0.0-rc-603e6108-20241029"; + exports.version = "19.0.0-rc-7c8e5e7a-20241101"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.production.js index 1f469687866fa..c2a13f2ee8e51 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.production.js @@ -5956,12 +5956,12 @@ function abort(request, reason) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion, - "19.0.0-rc-603e6108-20241029" + "19.0.0-rc-7c8e5e7a-20241101" ) ); } @@ -6108,4 +6108,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.0.0-rc-603e6108-20241029"; +exports.version = "19.0.0-rc-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.bun.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.bun.production.js index fe88b7c0463ea..01dd8abc7a230 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.bun.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.bun.production.js @@ -5594,13 +5594,13 @@ function abort(request, reason) { } var isomorphicReactPackageVersion$jscomp$inline_731 = React.version; if ( - "19.0.0-rc-603e6108-20241029" !== + "19.0.0-rc-7c8e5e7a-20241101" !== isomorphicReactPackageVersion$jscomp$inline_731 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_731 + - "\n - react-dom: 19.0.0-rc-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); exports.renderToReadableStream = function (children, options) { return new Promise(function (resolve, reject) { @@ -5691,4 +5691,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.0.0-rc-603e6108-20241029"; +exports.version = "19.0.0-rc-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.development.js index 64411eee18bd2..3580b3f1766ed 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.development.js @@ -7313,11 +7313,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react"), @@ -8976,5 +8976,5 @@ const setTimeoutOrImmediate = ? globalThis['set' + 'Immediate'] : setTimeout; - exports.version = "19.0.0-rc-603e6108-20241029"; + exports.version = "19.0.0-rc-7c8e5e7a-20241101"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.production.js index 85f6ea6d95109..395ff3a0adea8 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.production.js @@ -6044,11 +6044,11 @@ function abort(request, reason) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -6205,4 +6205,4 @@ const setTimeoutOrImmediate = ? globalThis['set' + 'Immediate'] : setTimeout; -exports.version = "19.0.0-rc-603e6108-20241029"; +exports.version = "19.0.0-rc-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.development.js index ea6f0bbec3db7..8152eb5df3bb3 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.development.js @@ -7188,11 +7188,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); } function createDrainHandler(destination, request) { @@ -8839,5 +8839,5 @@ } }; }; - exports.version = "19.0.0-rc-603e6108-20241029"; + exports.version = "19.0.0-rc-7c8e5e7a-20241101"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.production.js index 6341a19157e51..e2c5b10f17c19 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.production.js @@ -5936,11 +5936,11 @@ function abort(request, reason) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-603e6108-20241029" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-7c8e5e7a-20241101" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-603e6108-20241029\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-7c8e5e7a-20241101\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -6089,4 +6089,4 @@ exports.renderToPipeableStream = function (children, options) { } }; }; -exports.version = "19.0.0-rc-603e6108-20241029"; +exports.version = "19.0.0-rc-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom.development.js index ecd8b2e039928..8ea4b5b68be9d 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom.development.js @@ -416,7 +416,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-rc-603e6108-20241029"; + exports.version = "19.0.0-rc-7c8e5e7a-20241101"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom.production.js index fa2152fee101a..c7d4c70753384 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom.production.js @@ -207,4 +207,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-rc-603e6108-20241029"; +exports.version = "19.0.0-rc-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.development.js index 07d21de5d9ca3..37a5df6b5142f 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.development.js @@ -336,5 +336,5 @@ })) : Internals.d.m(href)); }; - exports.version = "19.0.0-rc-603e6108-20241029"; + exports.version = "19.0.0-rc-7c8e5e7a-20241101"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.production.js index 382dca0572246..d548051335039 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.production.js @@ -149,4 +149,4 @@ exports.preloadModule = function (href, options) { }); } else Internals.d.m(href); }; -exports.version = "19.0.0-rc-603e6108-20241029"; +exports.version = "19.0.0-rc-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-dom/package.json b/packages/next/src/compiled/react-dom/package.json index 542694df95491..c70932e12c3b2 100644 --- a/packages/next/src/compiled/react-dom/package.json +++ b/packages/next/src/compiled/react-dom/package.json @@ -67,10 +67,10 @@ "./package.json": "./package.json" }, "dependencies": { - "scheduler": "0.25.0-rc-603e6108-20241029" + "scheduler": "0.25.0-rc-7c8e5e7a-20241101" }, "peerDependencies": { - "react": "19.0.0-rc-603e6108-20241029" + "react": "19.0.0-rc-7c8e5e7a-20241101" }, "browser": { "./server.js": "./server.browser.js", diff --git a/packages/next/src/compiled/react-experimental/cjs/react.development.js b/packages/next/src/compiled/react-experimental/cjs/react.development.js index e8c3fb5aa0cec..a827ec85f8c75 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.development.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.development.js @@ -1237,7 +1237,7 @@ exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.0.0-experimental-603e6108-20241029"; + exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-experimental/cjs/react.production.js b/packages/next/src/compiled/react-experimental/cjs/react.production.js index fe724d72a6562..7cb05904ffd87 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.production.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.production.js @@ -567,4 +567,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-experimental-603e6108-20241029"; +exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-experimental/cjs/react.react-server.development.js b/packages/next/src/compiled/react-experimental/cjs/react.react-server.development.js index 1556883bb965d..514a3c2b89299 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.react-server.development.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.react-server.development.js @@ -978,5 +978,5 @@ exports.useMemo = function (create, deps) { return resolveDispatcher().useMemo(create, deps); }; - exports.version = "19.0.0-experimental-603e6108-20241029"; + exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; })(); diff --git a/packages/next/src/compiled/react-experimental/cjs/react.react-server.production.js b/packages/next/src/compiled/react-experimental/cjs/react.react-server.production.js index 933c416664079..7cfd414bd76e5 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.react-server.production.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.react-server.production.js @@ -567,4 +567,4 @@ exports.useId = function () { exports.useMemo = function (create, deps) { return ReactSharedInternals.H.useMemo(create, deps); }; -exports.version = "19.0.0-experimental-603e6108-20241029"; +exports.version = "19.0.0-experimental-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react-is/package.json b/packages/next/src/compiled/react-is/package.json index 90552da7836c6..ab841256389f1 100644 --- a/packages/next/src/compiled/react-is/package.json +++ b/packages/next/src/compiled/react-is/package.json @@ -1,6 +1,6 @@ { "name": "react-is", - "version": "19.0.0-rc-603e6108-20241029", + "version": "19.0.0-rc-7c8e5e7a-20241101", "description": "Brand checking of React Elements.", "main": "index.js", "sideEffects": false, diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js index aa1b0eef0a662..cfa59349b9df9 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js @@ -2654,10 +2654,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-experimental-603e6108-20241029", + version: "19.0.0-experimental-7c8e5e7a-20241101", rendererPackageName: "react-server-dom-turbopack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-experimental-603e6108-20241029", + reconcilerVersion: "19.0.0-experimental-7c8e5e7a-20241101", getCurrentComponentInfo: function () { return currentOwnerInDEV; } diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.development.js index fefe2ae42a1df..c8109d7335dcb 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.development.js @@ -2412,8 +2412,7 @@ : "unknown type " + typeof value; } function outlineConsoleValue(request, counter, model) { - "object" === typeof model && null !== model && doNotLimit.add(model); - var json = stringify(model, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2428,7 +2427,16 @@ x.message ); } - }); + } + "object" === typeof model && null !== model && doNotLimit.add(model); + try { + var json = stringify(model, replacer); + } catch (x) { + json = stringify( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); + } request.pendingChunks++; model = request.nextChunkId++; json = model.toString(16) + ":" + json + "\n"; @@ -2444,12 +2452,7 @@ stackTrace, args ) { - var counter = { objectLimit: 500 }; - null != owner && outlineComponentInfo(request, owner); - var env = (0, request.environmentName)(); - methodName = [methodName, stackTrace, owner, env]; - methodName.push.apply(methodName, args); - args = stringify(methodName, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2464,8 +2467,28 @@ x.message ); } - }); - id = serializeRowHeader("W", id) + args + "\n"; + } + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(), + payload = [methodName, stackTrace, owner, env]; + payload.push.apply(payload, args); + try { + var json = stringify(payload, replacer); + } catch (x) { + json = stringify( + [ + methodName, + stackTrace, + owner, + env, + "Unknown Value: React could not send it from the server.", + x + ], + replacer + ); + } + id = serializeRowHeader("W", id) + json + "\n"; id = stringToChunk(id); request.completedRegularChunks.push(id); } diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.development.js index 5375d87fb3ecf..7e01de85221ba 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.development.js @@ -2491,8 +2491,7 @@ : "unknown type " + typeof value; } function outlineConsoleValue(request, counter, model) { - "object" === typeof model && null !== model && doNotLimit.add(model); - var json = stringify(model, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2507,7 +2506,16 @@ x.message ); } - }); + } + "object" === typeof model && null !== model && doNotLimit.add(model); + try { + var json = stringify(model, replacer); + } catch (x) { + json = stringify( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); + } request.pendingChunks++; model = request.nextChunkId++; json = model.toString(16) + ":" + json + "\n"; @@ -2523,12 +2531,7 @@ stackTrace, args ) { - var counter = { objectLimit: 500 }; - null != owner && outlineComponentInfo(request, owner); - var env = (0, request.environmentName)(); - methodName = [methodName, stackTrace, owner, env]; - methodName.push.apply(methodName, args); - args = stringify(methodName, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2543,8 +2546,28 @@ x.message ); } - }); - id = serializeRowHeader("W", id) + args + "\n"; + } + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(), + payload = [methodName, stackTrace, owner, env]; + payload.push.apply(payload, args); + try { + var json = stringify(payload, replacer); + } catch (x) { + json = stringify( + [ + methodName, + stackTrace, + owner, + env, + "Unknown Value: React could not send it from the server.", + x + ], + replacer + ); + } + id = serializeRowHeader("W", id) + json + "\n"; id = stringToChunk(id); request.completedRegularChunks.push(id); } diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.development.js index c305c3559330c..59a0ee48898d8 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.development.js @@ -2470,8 +2470,7 @@ : "unknown type " + typeof value; } function outlineConsoleValue(request, counter, model) { - "object" === typeof model && null !== model && doNotLimit.add(model); - var json = stringify(model, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2486,7 +2485,16 @@ x.message ); } - }); + } + "object" === typeof model && null !== model && doNotLimit.add(model); + try { + var json = stringify(model, replacer); + } catch (x) { + json = stringify( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); + } request.pendingChunks++; model = request.nextChunkId++; json = model.toString(16) + ":" + json + "\n"; @@ -2501,12 +2509,7 @@ stackTrace, args ) { - var counter = { objectLimit: 500 }; - null != owner && outlineComponentInfo(request, owner); - var env = (0, request.environmentName)(); - methodName = [methodName, stackTrace, owner, env]; - methodName.push.apply(methodName, args); - args = stringify(methodName, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2521,8 +2524,28 @@ x.message ); } - }); - id = serializeRowHeader("W", id) + args + "\n"; + } + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(), + payload = [methodName, stackTrace, owner, env]; + payload.push.apply(payload, args); + try { + var json = stringify(payload, replacer); + } catch (x) { + json = stringify( + [ + methodName, + stackTrace, + owner, + env, + "Unknown Value: React could not send it from the server.", + x + ], + replacer + ); + } + id = serializeRowHeader("W", id) + json + "\n"; request.completedRegularChunks.push(id); } function forwardDebugInfo(request, id, debugInfo) { diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/package.json b/packages/next/src/compiled/react-server-dom-turbopack-experimental/package.json index 42e49607964cc..f5931256f1aa4 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/package.json +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/package.json @@ -48,7 +48,7 @@ "neo-async": "^2.6.1" }, "peerDependencies": { - "react": "0.0.0-experimental-603e6108-20241029", - "react-dom": "0.0.0-experimental-603e6108-20241029" + "react": "0.0.0-experimental-7c8e5e7a-20241101", + "react-dom": "0.0.0-experimental-7c8e5e7a-20241101" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js index aac7122eb060d..d97da302ca414 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js @@ -2450,10 +2450,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-rc-603e6108-20241029", + version: "19.0.0-rc-7c8e5e7a-20241101", rendererPackageName: "react-server-dom-turbopack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-rc-603e6108-20241029", + reconcilerVersion: "19.0.0-rc-7c8e5e7a-20241101", getCurrentComponentInfo: function () { return currentOwnerInDEV; } diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js index a9f6fc2eec118..e8db31328d3e9 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js @@ -2073,8 +2073,7 @@ : "unknown type " + typeof value; } function outlineConsoleValue(request, counter, model) { - "object" === typeof model && null !== model && doNotLimit.add(model); - var json = stringify(model, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2089,7 +2088,16 @@ x.message ); } - }); + } + "object" === typeof model && null !== model && doNotLimit.add(model); + try { + var json = stringify(model, replacer); + } catch (x) { + json = stringify( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); + } request.pendingChunks++; model = request.nextChunkId++; json = model.toString(16) + ":" + json + "\n"; @@ -2105,12 +2113,7 @@ stackTrace, args ) { - var counter = { objectLimit: 500 }; - null != owner && outlineComponentInfo(request, owner); - var env = (0, request.environmentName)(); - methodName = [methodName, stackTrace, owner, env]; - methodName.push.apply(methodName, args); - args = stringify(methodName, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2125,8 +2128,28 @@ x.message ); } - }); - id = serializeRowHeader("W", id) + args + "\n"; + } + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(), + payload = [methodName, stackTrace, owner, env]; + payload.push.apply(payload, args); + try { + var json = stringify(payload, replacer); + } catch (x) { + json = stringify( + [ + methodName, + stackTrace, + owner, + env, + "Unknown Value: React could not send it from the server.", + x + ], + replacer + ); + } + id = serializeRowHeader("W", id) + json + "\n"; id = stringToChunk(id); request.completedRegularChunks.push(id); } diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js index f38c2d9fe62b9..a0eb0d6d194fc 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js @@ -2101,8 +2101,7 @@ : "unknown type " + typeof value; } function outlineConsoleValue(request, counter, model) { - "object" === typeof model && null !== model && doNotLimit.add(model); - var json = stringify(model, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2117,7 +2116,16 @@ x.message ); } - }); + } + "object" === typeof model && null !== model && doNotLimit.add(model); + try { + var json = stringify(model, replacer); + } catch (x) { + json = stringify( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); + } request.pendingChunks++; model = request.nextChunkId++; json = model.toString(16) + ":" + json + "\n"; @@ -2133,12 +2141,7 @@ stackTrace, args ) { - var counter = { objectLimit: 500 }; - null != owner && outlineComponentInfo(request, owner); - var env = (0, request.environmentName)(); - methodName = [methodName, stackTrace, owner, env]; - methodName.push.apply(methodName, args); - args = stringify(methodName, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2153,8 +2156,28 @@ x.message ); } - }); - id = serializeRowHeader("W", id) + args + "\n"; + } + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(), + payload = [methodName, stackTrace, owner, env]; + payload.push.apply(payload, args); + try { + var json = stringify(payload, replacer); + } catch (x) { + json = stringify( + [ + methodName, + stackTrace, + owner, + env, + "Unknown Value: React could not send it from the server.", + x + ], + replacer + ); + } + id = serializeRowHeader("W", id) + json + "\n"; id = stringToChunk(id); request.completedRegularChunks.push(id); } diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js index 1414231b8a0ca..4feeb52a76e31 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js @@ -2105,8 +2105,7 @@ : "unknown type " + typeof value; } function outlineConsoleValue(request, counter, model) { - "object" === typeof model && null !== model && doNotLimit.add(model); - var json = stringify(model, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2121,7 +2120,16 @@ x.message ); } - }); + } + "object" === typeof model && null !== model && doNotLimit.add(model); + try { + var json = stringify(model, replacer); + } catch (x) { + json = stringify( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); + } request.pendingChunks++; model = request.nextChunkId++; json = model.toString(16) + ":" + json + "\n"; @@ -2136,12 +2144,7 @@ stackTrace, args ) { - var counter = { objectLimit: 500 }; - null != owner && outlineComponentInfo(request, owner); - var env = (0, request.environmentName)(); - methodName = [methodName, stackTrace, owner, env]; - methodName.push.apply(methodName, args); - args = stringify(methodName, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2156,8 +2159,28 @@ x.message ); } - }); - id = serializeRowHeader("W", id) + args + "\n"; + } + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(), + payload = [methodName, stackTrace, owner, env]; + payload.push.apply(payload, args); + try { + var json = stringify(payload, replacer); + } catch (x) { + json = stringify( + [ + methodName, + stackTrace, + owner, + env, + "Unknown Value: React could not send it from the server.", + x + ], + replacer + ); + } + id = serializeRowHeader("W", id) + json + "\n"; request.completedRegularChunks.push(id); } function forwardDebugInfo(request, id, debugInfo) { diff --git a/packages/next/src/compiled/react-server-dom-turbopack/package.json b/packages/next/src/compiled/react-server-dom-turbopack/package.json index 10ed8b8ca1ecc..8cadf22b55485 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/package.json +++ b/packages/next/src/compiled/react-server-dom-turbopack/package.json @@ -48,7 +48,7 @@ "neo-async": "^2.6.1" }, "peerDependencies": { - "react": "19.0.0-rc-603e6108-20241029", - "react-dom": "19.0.0-rc-603e6108-20241029" + "react": "19.0.0-rc-7c8e5e7a-20241101", + "react-dom": "19.0.0-rc-7c8e5e7a-20241101" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js index 6d446a6bf02f9..e78eb2f17c12d 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js @@ -2669,10 +2669,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-experimental-603e6108-20241029", + version: "19.0.0-experimental-7c8e5e7a-20241101", rendererPackageName: "react-server-dom-webpack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-experimental-603e6108-20241029", + reconcilerVersion: "19.0.0-experimental-7c8e5e7a-20241101", getCurrentComponentInfo: function () { return currentOwnerInDEV; } diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.development.js index 957a54e887e45..0d6be3029f0d3 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.development.js @@ -2412,8 +2412,7 @@ : "unknown type " + typeof value; } function outlineConsoleValue(request, counter, model) { - "object" === typeof model && null !== model && doNotLimit.add(model); - var json = stringify(model, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2428,7 +2427,16 @@ x.message ); } - }); + } + "object" === typeof model && null !== model && doNotLimit.add(model); + try { + var json = stringify(model, replacer); + } catch (x) { + json = stringify( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); + } request.pendingChunks++; model = request.nextChunkId++; json = model.toString(16) + ":" + json + "\n"; @@ -2444,12 +2452,7 @@ stackTrace, args ) { - var counter = { objectLimit: 500 }; - null != owner && outlineComponentInfo(request, owner); - var env = (0, request.environmentName)(); - methodName = [methodName, stackTrace, owner, env]; - methodName.push.apply(methodName, args); - args = stringify(methodName, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2464,8 +2467,28 @@ x.message ); } - }); - id = serializeRowHeader("W", id) + args + "\n"; + } + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(), + payload = [methodName, stackTrace, owner, env]; + payload.push.apply(payload, args); + try { + var json = stringify(payload, replacer); + } catch (x) { + json = stringify( + [ + methodName, + stackTrace, + owner, + env, + "Unknown Value: React could not send it from the server.", + x + ], + replacer + ); + } + id = serializeRowHeader("W", id) + json + "\n"; id = stringToChunk(id); request.completedRegularChunks.push(id); } diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.development.js index 623584f06f810..964dbad276c3a 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.development.js @@ -2491,8 +2491,7 @@ : "unknown type " + typeof value; } function outlineConsoleValue(request, counter, model) { - "object" === typeof model && null !== model && doNotLimit.add(model); - var json = stringify(model, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2507,7 +2506,16 @@ x.message ); } - }); + } + "object" === typeof model && null !== model && doNotLimit.add(model); + try { + var json = stringify(model, replacer); + } catch (x) { + json = stringify( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); + } request.pendingChunks++; model = request.nextChunkId++; json = model.toString(16) + ":" + json + "\n"; @@ -2523,12 +2531,7 @@ stackTrace, args ) { - var counter = { objectLimit: 500 }; - null != owner && outlineComponentInfo(request, owner); - var env = (0, request.environmentName)(); - methodName = [methodName, stackTrace, owner, env]; - methodName.push.apply(methodName, args); - args = stringify(methodName, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2543,8 +2546,28 @@ x.message ); } - }); - id = serializeRowHeader("W", id) + args + "\n"; + } + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(), + payload = [methodName, stackTrace, owner, env]; + payload.push.apply(payload, args); + try { + var json = stringify(payload, replacer); + } catch (x) { + json = stringify( + [ + methodName, + stackTrace, + owner, + env, + "Unknown Value: React could not send it from the server.", + x + ], + replacer + ); + } + id = serializeRowHeader("W", id) + json + "\n"; id = stringToChunk(id); request.completedRegularChunks.push(id); } diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.development.js index 23bf0625dfc23..32d4c507a27d1 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.development.js @@ -2470,8 +2470,7 @@ : "unknown type " + typeof value; } function outlineConsoleValue(request, counter, model) { - "object" === typeof model && null !== model && doNotLimit.add(model); - var json = stringify(model, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2486,7 +2485,16 @@ x.message ); } - }); + } + "object" === typeof model && null !== model && doNotLimit.add(model); + try { + var json = stringify(model, replacer); + } catch (x) { + json = stringify( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); + } request.pendingChunks++; model = request.nextChunkId++; json = model.toString(16) + ":" + json + "\n"; @@ -2501,12 +2509,7 @@ stackTrace, args ) { - var counter = { objectLimit: 500 }; - null != owner && outlineComponentInfo(request, owner); - var env = (0, request.environmentName)(); - methodName = [methodName, stackTrace, owner, env]; - methodName.push.apply(methodName, args); - args = stringify(methodName, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2521,8 +2524,28 @@ x.message ); } - }); - id = serializeRowHeader("W", id) + args + "\n"; + } + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(), + payload = [methodName, stackTrace, owner, env]; + payload.push.apply(payload, args); + try { + var json = stringify(payload, replacer); + } catch (x) { + json = stringify( + [ + methodName, + stackTrace, + owner, + env, + "Unknown Value: React could not send it from the server.", + x + ], + replacer + ); + } + id = serializeRowHeader("W", id) + json + "\n"; request.completedRegularChunks.push(id); } function forwardDebugInfo(request, id, debugInfo) { diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.development.js index c9ae351fcd428..1489964b46de1 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.development.js @@ -2470,8 +2470,7 @@ : "unknown type " + typeof value; } function outlineConsoleValue(request, counter, model) { - "object" === typeof model && null !== model && doNotLimit.add(model); - var json = stringify(model, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2486,7 +2485,16 @@ x.message ); } - }); + } + "object" === typeof model && null !== model && doNotLimit.add(model); + try { + var json = stringify(model, replacer); + } catch (x) { + json = stringify( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); + } request.pendingChunks++; model = request.nextChunkId++; json = model.toString(16) + ":" + json + "\n"; @@ -2501,12 +2509,7 @@ stackTrace, args ) { - var counter = { objectLimit: 500 }; - null != owner && outlineComponentInfo(request, owner); - var env = (0, request.environmentName)(); - methodName = [methodName, stackTrace, owner, env]; - methodName.push.apply(methodName, args); - args = stringify(methodName, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2521,8 +2524,28 @@ x.message ); } - }); - id = serializeRowHeader("W", id) + args + "\n"; + } + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(), + payload = [methodName, stackTrace, owner, env]; + payload.push.apply(payload, args); + try { + var json = stringify(payload, replacer); + } catch (x) { + json = stringify( + [ + methodName, + stackTrace, + owner, + env, + "Unknown Value: React could not send it from the server.", + x + ], + replacer + ); + } + id = serializeRowHeader("W", id) + json + "\n"; request.completedRegularChunks.push(id); } function forwardDebugInfo(request, id, debugInfo) { diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/package.json b/packages/next/src/compiled/react-server-dom-webpack-experimental/package.json index 7b2a1b9ea2e2f..aa2a486f481f4 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/package.json +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/package.json @@ -64,8 +64,8 @@ "webpack-sources": "^3.2.0" }, "peerDependencies": { - "react": "0.0.0-experimental-603e6108-20241029", - "react-dom": "0.0.0-experimental-603e6108-20241029", + "react": "0.0.0-experimental-7c8e5e7a-20241101", + "react-dom": "0.0.0-experimental-7c8e5e7a-20241101", "webpack": "^5.59.0" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js index 37320e2c4f09f..d27917c296256 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js @@ -2465,10 +2465,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-rc-603e6108-20241029", + version: "19.0.0-rc-7c8e5e7a-20241101", rendererPackageName: "react-server-dom-webpack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-rc-603e6108-20241029", + reconcilerVersion: "19.0.0-rc-7c8e5e7a-20241101", getCurrentComponentInfo: function () { return currentOwnerInDEV; } diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js index fc1a9de762ee5..9171f6e8e2800 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js @@ -2073,8 +2073,7 @@ : "unknown type " + typeof value; } function outlineConsoleValue(request, counter, model) { - "object" === typeof model && null !== model && doNotLimit.add(model); - var json = stringify(model, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2089,7 +2088,16 @@ x.message ); } - }); + } + "object" === typeof model && null !== model && doNotLimit.add(model); + try { + var json = stringify(model, replacer); + } catch (x) { + json = stringify( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); + } request.pendingChunks++; model = request.nextChunkId++; json = model.toString(16) + ":" + json + "\n"; @@ -2105,12 +2113,7 @@ stackTrace, args ) { - var counter = { objectLimit: 500 }; - null != owner && outlineComponentInfo(request, owner); - var env = (0, request.environmentName)(); - methodName = [methodName, stackTrace, owner, env]; - methodName.push.apply(methodName, args); - args = stringify(methodName, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2125,8 +2128,28 @@ x.message ); } - }); - id = serializeRowHeader("W", id) + args + "\n"; + } + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(), + payload = [methodName, stackTrace, owner, env]; + payload.push.apply(payload, args); + try { + var json = stringify(payload, replacer); + } catch (x) { + json = stringify( + [ + methodName, + stackTrace, + owner, + env, + "Unknown Value: React could not send it from the server.", + x + ], + replacer + ); + } + id = serializeRowHeader("W", id) + json + "\n"; id = stringToChunk(id); request.completedRegularChunks.push(id); } diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js index 933b06a40671b..253c468148c74 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js @@ -2101,8 +2101,7 @@ : "unknown type " + typeof value; } function outlineConsoleValue(request, counter, model) { - "object" === typeof model && null !== model && doNotLimit.add(model); - var json = stringify(model, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2117,7 +2116,16 @@ x.message ); } - }); + } + "object" === typeof model && null !== model && doNotLimit.add(model); + try { + var json = stringify(model, replacer); + } catch (x) { + json = stringify( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); + } request.pendingChunks++; model = request.nextChunkId++; json = model.toString(16) + ":" + json + "\n"; @@ -2133,12 +2141,7 @@ stackTrace, args ) { - var counter = { objectLimit: 500 }; - null != owner && outlineComponentInfo(request, owner); - var env = (0, request.environmentName)(); - methodName = [methodName, stackTrace, owner, env]; - methodName.push.apply(methodName, args); - args = stringify(methodName, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2153,8 +2156,28 @@ x.message ); } - }); - id = serializeRowHeader("W", id) + args + "\n"; + } + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(), + payload = [methodName, stackTrace, owner, env]; + payload.push.apply(payload, args); + try { + var json = stringify(payload, replacer); + } catch (x) { + json = stringify( + [ + methodName, + stackTrace, + owner, + env, + "Unknown Value: React could not send it from the server.", + x + ], + replacer + ); + } + id = serializeRowHeader("W", id) + json + "\n"; id = stringToChunk(id); request.completedRegularChunks.push(id); } diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js index cd438ec92aed5..a3ae92c1c02c2 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js @@ -2105,8 +2105,7 @@ : "unknown type " + typeof value; } function outlineConsoleValue(request, counter, model) { - "object" === typeof model && null !== model && doNotLimit.add(model); - var json = stringify(model, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2121,7 +2120,16 @@ x.message ); } - }); + } + "object" === typeof model && null !== model && doNotLimit.add(model); + try { + var json = stringify(model, replacer); + } catch (x) { + json = stringify( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); + } request.pendingChunks++; model = request.nextChunkId++; json = model.toString(16) + ":" + json + "\n"; @@ -2136,12 +2144,7 @@ stackTrace, args ) { - var counter = { objectLimit: 500 }; - null != owner && outlineComponentInfo(request, owner); - var env = (0, request.environmentName)(); - methodName = [methodName, stackTrace, owner, env]; - methodName.push.apply(methodName, args); - args = stringify(methodName, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2156,8 +2159,28 @@ x.message ); } - }); - id = serializeRowHeader("W", id) + args + "\n"; + } + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(), + payload = [methodName, stackTrace, owner, env]; + payload.push.apply(payload, args); + try { + var json = stringify(payload, replacer); + } catch (x) { + json = stringify( + [ + methodName, + stackTrace, + owner, + env, + "Unknown Value: React could not send it from the server.", + x + ], + replacer + ); + } + id = serializeRowHeader("W", id) + json + "\n"; request.completedRegularChunks.push(id); } function forwardDebugInfo(request, id, debugInfo) { diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js index ad79b26da9fc5..e89068bf09a85 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js @@ -2105,8 +2105,7 @@ : "unknown type " + typeof value; } function outlineConsoleValue(request, counter, model) { - "object" === typeof model && null !== model && doNotLimit.add(model); - var json = stringify(model, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2121,7 +2120,16 @@ x.message ); } - }); + } + "object" === typeof model && null !== model && doNotLimit.add(model); + try { + var json = stringify(model, replacer); + } catch (x) { + json = stringify( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); + } request.pendingChunks++; model = request.nextChunkId++; json = model.toString(16) + ":" + json + "\n"; @@ -2136,12 +2144,7 @@ stackTrace, args ) { - var counter = { objectLimit: 500 }; - null != owner && outlineComponentInfo(request, owner); - var env = (0, request.environmentName)(); - methodName = [methodName, stackTrace, owner, env]; - methodName.push.apply(methodName, args); - args = stringify(methodName, function (parentPropertyName, value) { + function replacer(parentPropertyName, value) { try { return renderConsoleValue( request, @@ -2156,8 +2159,28 @@ x.message ); } - }); - id = serializeRowHeader("W", id) + args + "\n"; + } + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(), + payload = [methodName, stackTrace, owner, env]; + payload.push.apply(payload, args); + try { + var json = stringify(payload, replacer); + } catch (x) { + json = stringify( + [ + methodName, + stackTrace, + owner, + env, + "Unknown Value: React could not send it from the server.", + x + ], + replacer + ); + } + id = serializeRowHeader("W", id) + json + "\n"; request.completedRegularChunks.push(id); } function forwardDebugInfo(request, id, debugInfo) { diff --git a/packages/next/src/compiled/react-server-dom-webpack/package.json b/packages/next/src/compiled/react-server-dom-webpack/package.json index 3ce2ddcdd9b7b..a85b56389eb52 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/package.json +++ b/packages/next/src/compiled/react-server-dom-webpack/package.json @@ -64,8 +64,8 @@ "webpack-sources": "^3.2.0" }, "peerDependencies": { - "react": "19.0.0-rc-603e6108-20241029", - "react-dom": "19.0.0-rc-603e6108-20241029", + "react": "19.0.0-rc-7c8e5e7a-20241101", + "react-dom": "19.0.0-rc-7c8e5e7a-20241101", "webpack": "^5.59.0" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react/cjs/react.development.js b/packages/next/src/compiled/react/cjs/react.development.js index 60b9cfea1a064..cddedf2ea6ae0 100644 --- a/packages/next/src/compiled/react/cjs/react.development.js +++ b/packages/next/src/compiled/react/cjs/react.development.js @@ -1520,7 +1520,7 @@ exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.0.0-rc-603e6108-20241029"; + exports.version = "19.0.0-rc-7c8e5e7a-20241101"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react/cjs/react.production.js b/packages/next/src/compiled/react/cjs/react.production.js index 456542bf7acf1..37402ffe8209d 100644 --- a/packages/next/src/compiled/react/cjs/react.production.js +++ b/packages/next/src/compiled/react/cjs/react.production.js @@ -536,4 +536,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-rc-603e6108-20241029"; +exports.version = "19.0.0-rc-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/react/cjs/react.react-server.development.js b/packages/next/src/compiled/react/cjs/react.react-server.development.js index a4471434db41a..79bd3d553fa88 100644 --- a/packages/next/src/compiled/react/cjs/react.react-server.development.js +++ b/packages/next/src/compiled/react/cjs/react.react-server.development.js @@ -1117,5 +1117,5 @@ exports.useMemo = function (create, deps) { return resolveDispatcher().useMemo(create, deps); }; - exports.version = "19.0.0-rc-603e6108-20241029"; + exports.version = "19.0.0-rc-7c8e5e7a-20241101"; })(); diff --git a/packages/next/src/compiled/react/cjs/react.react-server.production.js b/packages/next/src/compiled/react/cjs/react.react-server.production.js index b34786259f89e..c8f28472fedcf 100644 --- a/packages/next/src/compiled/react/cjs/react.react-server.production.js +++ b/packages/next/src/compiled/react/cjs/react.react-server.production.js @@ -424,4 +424,4 @@ exports.useId = function () { exports.useMemo = function (create, deps) { return ReactSharedInternals.H.useMemo(create, deps); }; -exports.version = "19.0.0-rc-603e6108-20241029"; +exports.version = "19.0.0-rc-7c8e5e7a-20241101"; diff --git a/packages/next/src/compiled/unistore/unistore.js b/packages/next/src/compiled/unistore/unistore.js index f881eb6b898e6..1f5295423fd61 100644 --- a/packages/next/src/compiled/unistore/unistore.js +++ b/packages/next/src/compiled/unistore/unistore.js @@ -1 +1 @@ -(()=>{var t={561:t=>{function n(t,i){for(var _ in i)t[_]=i[_];return t}t.exports=function(t){var i=[];function u(t){for(var _=[],a=0;a{var t={94:t=>{function n(t,i){for(var _ in i)t[_]=i[_];return t}t.exports=function(t){var i=[];function u(t){for(var _=[],a=0;a=18'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-603e6108-20241029 - react-dom: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 + react-dom: 19.0.0-rc-7c8e5e7a-20241101 peerDependenciesMeta: '@types/react': optional: true @@ -10547,7 +10547,7 @@ packages: lucide-react@0.383.0: resolution: {integrity: sha512-13xlG0CQCJtzjSQYwwJ3WRqMHtRj3EXmLlorrARt7y+IHnxUCp3XyFNL1DfaGySWxHObDvnu1u1dV+0VMKHUSg==} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 lz-string@1.5.0: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} @@ -12756,28 +12756,28 @@ packages: resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} hasBin: true - react-dom@0.0.0-experimental-603e6108-20241029: - resolution: {integrity: sha512-ZwknB9idq09uCVPZQanwbWY0Ioak+sXrwjXE3Yr6z2USMySsIBoLgMjOQkSoWpwOQlQ8Q7UKQ74+v0wBz+XIgg==} + react-dom@0.0.0-experimental-7c8e5e7a-20241101: + resolution: {integrity: sha512-RVtqvMj1mShKMoBPabkOzjMqTOAri2j5uRsR5lZKkUhDZZXbN7fp+aiL6OQac17nnXrZWqVeBHpP63m37wQkHA==} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 react-dom@17.0.2: resolution: {integrity: sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 - react-dom@19.0.0-rc-603e6108-20241029: - resolution: {integrity: sha512-1jaWZcv3V6R39ZnDU3FtGSXtEm/z/lCRFnWmvbp019wPffFGKoXDv+i5KoyQ5yUBpwumImFrKTWXYQluOnm7Jw==} + react-dom@19.0.0-rc-7c8e5e7a-20241101: + resolution: {integrity: sha512-p2d+9xTM1xifv0VJd8WJ6WkdaWKaJfOcVIcHKskgaEic+bktU+SvdSzF5K7KpnUdgU9fZA0EAqurLMyqZaheYg==} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 react-dom@19.0.0-rc-f90a6bcc-20240827: resolution: {integrity: sha512-oUa/reDvGtjRcxi8u+GYHaDHanudaO28+G+Wvxm50CItW1xwIFN2Nn7foJxxDS9lFLGdRWZvjxldZEPAUSuXbg==} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 - react-is@19.0.0-rc-603e6108-20241029: - resolution: {integrity: sha512-0pkN/IUe6YPyrJf3CEOPrqup/r2/BWWbVqR09MncM2wNil+S0YNnMVMprhnOKnBr1kR02gPcTJpFesG/3G3r+g==} + react-is@19.0.0-rc-7c8e5e7a-20241101: + resolution: {integrity: sha512-5MThWcQSkQZwg57Ea3InmZb2o5YVAwM28u3SrukOgfvy3HB8FgngW3kmfmazWezT5M+a2BgZAbTvfBXTHEGQSA==} react-is@19.0.0-rc-f90a6bcc-20240827: resolution: {integrity: sha512-1tXoLFzVbqHAQeY3CwpyF5IYbkwgSoNHhrhS8qOrfiZIh2461h/C1BP/JVIxwyL51wHhUgLsAc/M8g0OcEhV1A==} @@ -12788,8 +12788,8 @@ packages: react-number-format@5.4.0: resolution: {integrity: sha512-NWdICrqLhI7rAS8yUeLVd6Wr4cN7UjJ9IBTS0f/a9i7UB4x4Ti70kGnksBtZ7o4Z7YRbvCMMR/jQmkoOBa/4fg==} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 - react-dom: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 + react-dom: 19.0.0-rc-7c8e5e7a-20241101 react-refresh@0.12.0: resolution: {integrity: sha512-suLIhrU2IHKL5JEKR/fAwJv7bbeq4kJ+pJopf77jHwuR+HmJS/HbrPIGsTBUVfw7tXPOmYv7UJ7PCaN49e8x4A==} @@ -12800,7 +12800,7 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 peerDependenciesMeta: '@types/react': optional: true @@ -12810,58 +12810,58 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 peerDependenciesMeta: '@types/react': optional: true - react-server-dom-turbopack@0.0.0-experimental-603e6108-20241029: - resolution: {integrity: sha512-2k6vy/MvHX+4PULy/GFTaIlXkG93zimtC+f9zGp2c9rk6s/1cicQv2C7lZYFD3YPNgeSJUo1GU6CRhh/1qK/Mg==} + react-server-dom-turbopack@0.0.0-experimental-7c8e5e7a-20241101: + resolution: {integrity: sha512-Z+dmhQnFEgU+Kfr296vas91247uo7VvErHwFxGLsyrsyQAMUZxKuBlO4K8HHrq57ocWonAWtxHnO3BqCNK1EmQ==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 - react-dom: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 + react-dom: 19.0.0-rc-7c8e5e7a-20241101 - react-server-dom-turbopack@19.0.0-rc-603e6108-20241029: - resolution: {integrity: sha512-HNE0vgT8lUHdNLhL3V4780V5ImzqaZCAGcoEryyHyWRrS1y9rhF8+byQUyCwhMzQuXc02xtElfHq9N1bto+DZA==} + react-server-dom-turbopack@19.0.0-rc-7c8e5e7a-20241101: + resolution: {integrity: sha512-tSf/g/q0S2kLDKyWivuMRH1CQXTOwYqreiM0sBW96tu3oxZw6jjA+8jy0Xm163su+7bAWpugb20NBGzb3smTnQ==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 - react-dom: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 + react-dom: 19.0.0-rc-7c8e5e7a-20241101 - react-server-dom-webpack@0.0.0-experimental-603e6108-20241029: - resolution: {integrity: sha512-nuQCqG3hJGV9XCvzEPz9qBOJ8vyUxgf1j+Fm1Z2nPjRjnZEppJn2ZvlA9xtV+PPr8/2TNtCzRagtRUJRwVEI5A==} + react-server-dom-webpack@0.0.0-experimental-7c8e5e7a-20241101: + resolution: {integrity: sha512-HtglG7DGwF9E9uoMV1dcbkbpLQ22aDrF9nMfr1wV5KfZKnxw45qV9mJQ1eAWGGBUcxF00df+Os6Ytm8SxoIpHA==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 - react-dom: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 + react-dom: 19.0.0-rc-7c8e5e7a-20241101 webpack: 5.90.0 - react-server-dom-webpack@19.0.0-rc-603e6108-20241029: - resolution: {integrity: sha512-tVxpxVKm9xZpQ+lQEVBN0mDKxoPX9dnWN9PETsIE7kHfqKISH34m63LGK58s7ncFKaOoEQA5bPTqILqk4tb5pw==} + react-server-dom-webpack@19.0.0-rc-7c8e5e7a-20241101: + resolution: {integrity: sha512-j2zsf8HZTWcbF0J5Lh04NrL+W3CybWquBuysI4dONW7y8qcXn4o1zBb21OCVPX+AEJajuIXgywOdlQ5RcZTl1w==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 - react-dom: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 + react-dom: 19.0.0-rc-7c8e5e7a-20241101 webpack: 5.90.0 react-shallow-renderer@16.15.0: resolution: {integrity: sha512-oScf2FqQ9LFVQgA73vr86xl2NaOIX73rh+YFqcOp68CWj56tSfgtGKrEbyhCj0rSijyG9M1CYprTh39fBi5hzA==} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 react-ssr-prepass@1.0.8: resolution: {integrity: sha512-O0gfRA1SaK+9ITKxqfnXsej2jF+OHGP/+GxD4unROQaM/0/UczGF9fuF+wTboxaQoKdIf4FvS3h/OigWh704VA==} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 - react-is: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 + react-is: 19.0.0-rc-7c8e5e7a-20241101 react-style-singleton@2.2.1: resolution: {integrity: sha512-ZWj0fHEMyWkHzKYUr2Bs/4zU6XLmq9HsgBURm7g5pAVfyn49DgUiNgY2d4lXRlYSiCif9YBGpQleewkcqddc7g==} engines: {node: '>=10'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 peerDependenciesMeta: '@types/react': optional: true @@ -12869,30 +12869,30 @@ packages: react-test-renderer@18.2.0: resolution: {integrity: sha512-JWD+aQ0lh2gvh4NM3bBM42Kx+XybOxCpgYK7F8ugAlpaTSnWsX+39Z4XkOykGZAHrjwwTZT3x3KxswVWxHPUqA==} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 react-textarea-autosize@8.5.3: resolution: {integrity: sha512-XT1024o2pqCuZSuBt9FwHlaDeNtVrtCXu0Rnz88t1jUGheCLa3PhjE1GH8Ctm2axEtvdCl5SUHYschyQ0L5QHQ==} engines: {node: '>=10'} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 react-virtualized@9.22.3: resolution: {integrity: sha512-MKovKMxWTcwPSxE1kK1HcheQTWfuCxAuBoSTf2gwyMM21NdX/PXUhnoP8Uc5dRKd+nKm8v41R36OellhdCpkrw==} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 - react-dom: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 + react-dom: 19.0.0-rc-7c8e5e7a-20241101 - react@0.0.0-experimental-603e6108-20241029: - resolution: {integrity: sha512-l38d0rLUpruYn62/r4mGslmlD21+wdjXZkjx0jN3PYWezV6KaaRsUTxselvx3TcToCjsJrW+hwp4KqPGc4BVFg==} + react@0.0.0-experimental-7c8e5e7a-20241101: + resolution: {integrity: sha512-r2pZLu0pdXbGK3rzvUqXvf0uDS7YyJ0daygdj2zyBL+liIIuqOebs4wDwSllOy+hoHzs55ISRDn/zQdM95peWg==} engines: {node: '>=0.10.0'} react@17.0.2: resolution: {integrity: sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==} engines: {node: '>=0.10.0'} - react@19.0.0-rc-603e6108-20241029: - resolution: {integrity: sha512-NXn7GRnAqiL12ZxUJCUjKT5T7jtqHzYp/4moEYZ4Uv0mUhBT4kFbuYQcPSAJTuP67kENUw79DgWfGbqg5qnh1w==} + react@19.0.0-rc-7c8e5e7a-20241101: + resolution: {integrity: sha512-oinEuyXWHxS9R7lfvdXcW1K3KgN9b7QQeKmO3M/mJZVMutvAYotRjiMKZjlEz0XsomWl/JZb4EYIO1JfcltL2w==} engines: {node: '>=0.10.0'} react@19.0.0-rc-f90a6bcc-20240827: @@ -13412,11 +13412,11 @@ packages: resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} engines: {node: '>=v12.22.7'} - scheduler@0.0.0-experimental-603e6108-20241029: - resolution: {integrity: sha512-0v6T8YH9fRvUmE9VDxwK84i/iCaflKxErL9ofuFmkw5ZOy8ji1qZWQnMIXFWO6kyjCQpyS4bUlNSv04lQ9ZcwQ==} + scheduler@0.0.0-experimental-7c8e5e7a-20241101: + resolution: {integrity: sha512-9l9yCDz0HRPR7agh0tHvOrCPZOPqkSamqP6JeiKU5PFRPVffYu81ImUTv1IrVc9XWAJJTcPztKiknMYzymWehw==} - scheduler@0.25.0-rc-603e6108-20241029: - resolution: {integrity: sha512-pFwF6H1XrSdYYNLfOcGlM28/j8CGLu8IvdrxqhjWULe2bPcKiKW4CV+OWqR/9fT52mywx65l7ysNkjLKBda7eA==} + scheduler@0.25.0-rc-7c8e5e7a-20241101: + resolution: {integrity: sha512-6mc2ctXvVbpv4oEFIPjCacS+f+NaydfjptZx+8BK4aFr5WsqwcZYYekwCFnbACkcROBH1yeqOy/WilmCdMKw8A==} schema-utils@2.7.1: resolution: {integrity: sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==} @@ -13961,8 +13961,8 @@ packages: engines: {node: '>= 16'} peerDependencies: babel-plugin-styled-components: '>= 2' - react: 19.0.0-rc-603e6108-20241029 - react-dom: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 + react-dom: 19.0.0-rc-7c8e5e7a-20241101 peerDependenciesMeta: babel-plugin-styled-components: optional: true @@ -13976,7 +13976,7 @@ packages: peerDependencies: '@babel/core': '*' babel-plugin-macros: '*' - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 peerDependenciesMeta: '@babel/core': optional: true @@ -14053,7 +14053,7 @@ packages: swr@2.2.4: resolution: {integrity: sha512-njiZ/4RiIhoOlAaLYDqwz5qH/KZXVilRLvomrx83HjzCWTfa+InyfAjv05PSFxnmLzZkNO9ZfvgoqzAaEI4sGQ==} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 symbol-observable@1.0.1: resolution: {integrity: sha512-Kb3PrPYz4HanVF1LVGuAdW6LoVgIwjUYJGzFe7NDrBLCN4lsV/5J0MFurV+ygS4bRVwrCEt2c7MQ1R2a72oJDw==} @@ -14774,7 +14774,7 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 peerDependenciesMeta: '@types/react': optional: true @@ -14782,13 +14782,13 @@ packages: use-composed-ref@1.3.0: resolution: {integrity: sha512-GLMG0Jc/jiKov/3Ulid1wbv3r54K9HlMW29IWcDFPEqFkSO2nS0MuefWgMJpeHQ9YJeXDL3ZUF+P3jdXlZX/cQ==} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 use-isomorphic-layout-effect@1.1.2: resolution: {integrity: sha512-49L8yCO3iGT/ZF9QttjwLF/ZD9Iwto5LnH5LmEdk/6cFmXddqi2ulF0edxTwjj+7mqvpVVGQWvbXZdn32wRSHA==} peerDependencies: '@types/react': '*' - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 peerDependenciesMeta: '@types/react': optional: true @@ -14797,7 +14797,7 @@ packages: resolution: {integrity: sha512-xA+AVm/Wlg3e2P/JiItTziwS7FK92LWrDB0p+hgXloIMuVCeJJ8v6f0eeHyPZaJrM+usM1FkFfbNCrJGs8A/zw==} peerDependencies: '@types/react': '*' - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 peerDependenciesMeta: '@types/react': optional: true @@ -14807,7 +14807,7 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 peerDependenciesMeta: '@types/react': optional: true @@ -14815,7 +14815,7 @@ packages: use-sync-external-store@1.2.0: resolution: {integrity: sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==} peerDependencies: - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} @@ -17471,17 +17471,17 @@ snapshots: '@emotion/memoize@0.8.1': {} - '@emotion/react@11.11.1(react@19.0.0-rc-603e6108-20241029)(types-react@19.0.0-rc.0)': + '@emotion/react@11.11.1(react@19.0.0-rc-7c8e5e7a-20241101)(types-react@19.0.0-rc.0)': dependencies: '@babel/runtime': 7.22.5 '@emotion/babel-plugin': 11.11.0 '@emotion/cache': 11.11.0 '@emotion/serialize': 1.1.2 - '@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@19.0.0-rc-603e6108-20241029) + '@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@19.0.0-rc-7c8e5e7a-20241101) '@emotion/utils': 1.2.1 '@emotion/weak-memoize': 0.3.1 hoist-non-react-statics: 3.3.2 - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 optionalDependencies: '@types/react': types-react@19.0.0-rc.0 transitivePeerDependencies: @@ -17499,9 +17499,9 @@ snapshots: '@emotion/unitless@0.8.1': {} - '@emotion/use-insertion-effect-with-fallbacks@1.0.1(react@19.0.0-rc-603e6108-20241029)': + '@emotion/use-insertion-effect-with-fallbacks@1.0.1(react@19.0.0-rc-7c8e5e7a-20241101)': dependencies: - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 '@emotion/utils@1.2.1': {} @@ -18894,11 +18894,11 @@ snapshots: transitivePeerDependencies: - supports-color - '@mdx-js/react@2.2.1(react@19.0.0-rc-603e6108-20241029)': + '@mdx-js/react@2.2.1(react@19.0.0-rc-7c8e5e7a-20241101)': dependencies: '@types/mdx': 2.0.3 '@types/react': types-react@19.0.0-rc.0 - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 '@mdx-js/react@2.2.1(react@19.0.0-rc-f90a6bcc-20240827)': dependencies: @@ -19714,13 +19714,13 @@ snapshots: '@types/jest': 29.5.5 jest: 29.7.0(@types/node@20.12.3)(babel-plugin-macros@3.1.0) - '@testing-library/react@15.0.7(react-dom@19.0.0-rc-603e6108-20241029(react@19.0.0-rc-603e6108-20241029))(react@19.0.0-rc-603e6108-20241029)(types-react@19.0.0-rc.0)': + '@testing-library/react@15.0.7(react-dom@19.0.0-rc-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101))(react@19.0.0-rc-7c8e5e7a-20241101)(types-react@19.0.0-rc.0)': dependencies: '@babel/runtime': 7.22.5 '@testing-library/dom': 10.1.0 '@types/react-dom': types-react-dom@19.0.0-rc.0 - react: 19.0.0-rc-603e6108-20241029 - react-dom: 19.0.0-rc-603e6108-20241029(react@19.0.0-rc-603e6108-20241029) + react: 19.0.0-rc-7c8e5e7a-20241101 + react-dom: 19.0.0-rc-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101) optionalDependencies: '@types/react': types-react@19.0.0-rc.0 @@ -24812,7 +24812,7 @@ snapshots: hoist-non-react-statics@3.3.2: dependencies: - react-is: 19.0.0-rc-603e6108-20241029 + react-is: 19.0.0-rc-7c8e5e7a-20241101 homedir-polyfill@1.0.3: dependencies: @@ -29113,25 +29113,25 @@ snapshots: '@jest/types': 24.9.0 ansi-regex: 4.1.0 ansi-styles: 3.2.1 - react-is: 19.0.0-rc-603e6108-20241029 + react-is: 19.0.0-rc-7c8e5e7a-20241101 pretty-format@27.5.1: dependencies: ansi-regex: 5.0.1 ansi-styles: 5.2.0 - react-is: 19.0.0-rc-603e6108-20241029 + react-is: 19.0.0-rc-7c8e5e7a-20241101 pretty-format@29.5.0: dependencies: '@jest/schemas': 29.4.3 ansi-styles: 5.2.0 - react-is: 19.0.0-rc-603e6108-20241029 + react-is: 19.0.0-rc-7c8e5e7a-20241101 pretty-format@29.7.0: dependencies: '@jest/schemas': 29.6.3 ansi-styles: 5.2.0 - react-is: 19.0.0-rc-603e6108-20241029 + react-is: 19.0.0-rc-7c8e5e7a-20241101 pretty-ms@7.0.0: dependencies: @@ -29188,7 +29188,7 @@ snapshots: dependencies: loose-envify: 1.4.0 object-assign: 4.1.1 - react-is: 19.0.0-rc-603e6108-20241029 + react-is: 19.0.0-rc-7c8e5e7a-20241101 property-information@5.6.0: dependencies: @@ -29362,29 +29362,29 @@ snapshots: minimist: 1.2.8 strip-json-comments: 2.0.1 - react-dom@0.0.0-experimental-603e6108-20241029(react@19.0.0-rc-603e6108-20241029): + react-dom@0.0.0-experimental-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101): dependencies: - react: 19.0.0-rc-603e6108-20241029 - scheduler: 0.25.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 + scheduler: 0.25.0-rc-7c8e5e7a-20241101 - react-dom@17.0.2(react@19.0.0-rc-603e6108-20241029): + react-dom@17.0.2(react@19.0.0-rc-7c8e5e7a-20241101): dependencies: loose-envify: 1.4.0 object-assign: 4.1.1 - react: 19.0.0-rc-603e6108-20241029 - scheduler: 0.25.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 + scheduler: 0.25.0-rc-7c8e5e7a-20241101 - react-dom@19.0.0-rc-603e6108-20241029(react@19.0.0-rc-603e6108-20241029): + react-dom@19.0.0-rc-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101): dependencies: - react: 19.0.0-rc-603e6108-20241029 - scheduler: 0.25.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 + scheduler: 0.25.0-rc-7c8e5e7a-20241101 react-dom@19.0.0-rc-f90a6bcc-20240827(react@19.0.0-rc-f90a6bcc-20240827): dependencies: react: 19.0.0-rc-f90a6bcc-20240827 - scheduler: 0.25.0-rc-603e6108-20241029 + scheduler: 0.25.0-rc-7c8e5e7a-20241101 - react-is@19.0.0-rc-603e6108-20241029: {} + react-is@19.0.0-rc-7c8e5e7a-20241101: {} react-is@19.0.0-rc-f90a6bcc-20240827: {} @@ -29417,48 +29417,48 @@ snapshots: optionalDependencies: '@types/react': types-react@19.0.0-rc.0 - react-server-dom-turbopack@0.0.0-experimental-603e6108-20241029(react-dom@19.0.0-rc-603e6108-20241029(react@19.0.0-rc-603e6108-20241029))(react@19.0.0-rc-603e6108-20241029): + react-server-dom-turbopack@0.0.0-experimental-7c8e5e7a-20241101(react-dom@19.0.0-rc-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101))(react@19.0.0-rc-7c8e5e7a-20241101): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-603e6108-20241029 - react-dom: 19.0.0-rc-603e6108-20241029(react@19.0.0-rc-603e6108-20241029) + react: 19.0.0-rc-7c8e5e7a-20241101 + react-dom: 19.0.0-rc-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101) - react-server-dom-turbopack@19.0.0-rc-603e6108-20241029(react-dom@19.0.0-rc-603e6108-20241029(react@19.0.0-rc-603e6108-20241029))(react@19.0.0-rc-603e6108-20241029): + react-server-dom-turbopack@19.0.0-rc-7c8e5e7a-20241101(react-dom@19.0.0-rc-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101))(react@19.0.0-rc-7c8e5e7a-20241101): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-603e6108-20241029 - react-dom: 19.0.0-rc-603e6108-20241029(react@19.0.0-rc-603e6108-20241029) + react: 19.0.0-rc-7c8e5e7a-20241101 + react-dom: 19.0.0-rc-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101) - react-server-dom-webpack@0.0.0-experimental-603e6108-20241029(react-dom@19.0.0-rc-603e6108-20241029(react@19.0.0-rc-603e6108-20241029))(react@19.0.0-rc-603e6108-20241029)(webpack@5.90.0(@swc/core@1.6.13(@swc/helpers@0.5.13))): + react-server-dom-webpack@0.0.0-experimental-7c8e5e7a-20241101(react-dom@19.0.0-rc-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101))(react@19.0.0-rc-7c8e5e7a-20241101)(webpack@5.90.0(@swc/core@1.6.13(@swc/helpers@0.5.13))): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-603e6108-20241029 - react-dom: 19.0.0-rc-603e6108-20241029(react@19.0.0-rc-603e6108-20241029) + react: 19.0.0-rc-7c8e5e7a-20241101 + react-dom: 19.0.0-rc-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101) webpack: 5.90.0(@swc/core@1.6.13(@swc/helpers@0.5.13)) webpack-sources: 3.2.3(patch_hash=jbynf5dc46ambamq3wuyho6hkq) - react-server-dom-webpack@19.0.0-rc-603e6108-20241029(react-dom@19.0.0-rc-603e6108-20241029(react@19.0.0-rc-603e6108-20241029))(react@19.0.0-rc-603e6108-20241029)(webpack@5.90.0(@swc/core@1.6.13(@swc/helpers@0.5.13))): + react-server-dom-webpack@19.0.0-rc-7c8e5e7a-20241101(react-dom@19.0.0-rc-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101))(react@19.0.0-rc-7c8e5e7a-20241101)(webpack@5.90.0(@swc/core@1.6.13(@swc/helpers@0.5.13))): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-603e6108-20241029 - react-dom: 19.0.0-rc-603e6108-20241029(react@19.0.0-rc-603e6108-20241029) + react: 19.0.0-rc-7c8e5e7a-20241101 + react-dom: 19.0.0-rc-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101) webpack: 5.90.0(@swc/core@1.6.13(@swc/helpers@0.5.13)) webpack-sources: 3.2.3(patch_hash=jbynf5dc46ambamq3wuyho6hkq) - react-shallow-renderer@16.15.0(react@19.0.0-rc-603e6108-20241029): + react-shallow-renderer@16.15.0(react@19.0.0-rc-7c8e5e7a-20241101): dependencies: object-assign: 4.1.1 - react: 19.0.0-rc-603e6108-20241029 - react-is: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 + react-is: 19.0.0-rc-7c8e5e7a-20241101 - react-ssr-prepass@1.0.8(react-is@19.0.0-rc-f90a6bcc-20240827)(react@19.0.0-rc-603e6108-20241029): + react-ssr-prepass@1.0.8(react-is@19.0.0-rc-f90a6bcc-20240827)(react@19.0.0-rc-7c8e5e7a-20241101): dependencies: object-is: 1.0.2 - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 react-is: 19.0.0-rc-f90a6bcc-20240827 react-style-singleton@2.2.1(react@19.0.0-rc-f90a6bcc-20240827)(types-react@19.0.0-rc.0): @@ -29470,12 +29470,12 @@ snapshots: optionalDependencies: '@types/react': types-react@19.0.0-rc.0 - react-test-renderer@18.2.0(react@19.0.0-rc-603e6108-20241029): + react-test-renderer@18.2.0(react@19.0.0-rc-7c8e5e7a-20241101): dependencies: - react: 19.0.0-rc-603e6108-20241029 - react-is: 19.0.0-rc-603e6108-20241029 - react-shallow-renderer: 16.15.0(react@19.0.0-rc-603e6108-20241029) - scheduler: 0.25.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 + react-is: 19.0.0-rc-7c8e5e7a-20241101 + react-shallow-renderer: 16.15.0(react@19.0.0-rc-7c8e5e7a-20241101) + scheduler: 0.25.0-rc-7c8e5e7a-20241101 react-textarea-autosize@8.5.3(react@19.0.0-rc-f90a6bcc-20240827)(types-react@19.0.0-rc.0): dependencies: @@ -29486,25 +29486,25 @@ snapshots: transitivePeerDependencies: - '@types/react' - react-virtualized@9.22.3(react-dom@19.0.0-rc-603e6108-20241029(react@19.0.0-rc-603e6108-20241029))(react@19.0.0-rc-603e6108-20241029): + react-virtualized@9.22.3(react-dom@19.0.0-rc-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101))(react@19.0.0-rc-7c8e5e7a-20241101): dependencies: '@babel/runtime': 7.22.5 clsx: 1.1.1 dom-helpers: 5.2.1 loose-envify: 1.4.0 prop-types: 15.8.1 - react: 19.0.0-rc-603e6108-20241029 - react-dom: 19.0.0-rc-603e6108-20241029(react@19.0.0-rc-603e6108-20241029) + react: 19.0.0-rc-7c8e5e7a-20241101 + react-dom: 19.0.0-rc-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101) react-lifecycles-compat: 3.0.4 - react@0.0.0-experimental-603e6108-20241029: {} + react@0.0.0-experimental-7c8e5e7a-20241101: {} react@17.0.2: dependencies: loose-envify: 1.4.0 object-assign: 4.1.1 - react@19.0.0-rc-603e6108-20241029: {} + react@19.0.0-rc-7c8e5e7a-20241101: {} react@19.0.0-rc-f90a6bcc-20240827: {} @@ -30195,9 +30195,9 @@ snapshots: dependencies: xmlchars: 2.2.0 - scheduler@0.0.0-experimental-603e6108-20241029: {} + scheduler@0.0.0-experimental-7c8e5e7a-20241101: {} - scheduler@0.25.0-rc-603e6108-20241029: {} + scheduler@0.25.0-rc-7c8e5e7a-20241101: {} schema-utils@2.7.1: dependencies: @@ -30804,7 +30804,7 @@ snapshots: dependencies: inline-style-parser: 0.1.1 - styled-components@6.0.0-rc.3(react-dom@19.0.0-rc-603e6108-20241029(react@19.0.0-rc-603e6108-20241029))(react@19.0.0-rc-603e6108-20241029): + styled-components@6.0.0-rc.3(react-dom@19.0.0-rc-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101))(react@19.0.0-rc-7c8e5e7a-20241101): dependencies: '@babel/cli': 7.21.5(@babel/core@7.22.5) '@babel/core': 7.22.5 @@ -30819,8 +30819,8 @@ snapshots: '@emotion/unitless': 0.8.1 css-to-react-native: 3.2.0 postcss: 8.4.31 - react: 19.0.0-rc-603e6108-20241029 - react-dom: 19.0.0-rc-603e6108-20241029(react@19.0.0-rc-603e6108-20241029) + react: 19.0.0-rc-7c8e5e7a-20241101 + react-dom: 19.0.0-rc-7c8e5e7a-20241101(react@19.0.0-rc-7c8e5e7a-20241101) shallowequal: 1.1.0 stylis: 4.2.0 tslib: 2.5.3 @@ -30832,10 +30832,10 @@ snapshots: postcss: 7.0.32 postcss-load-plugins: 2.3.0 - styled-jsx@5.1.6(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-603e6108-20241029): + styled-jsx@5.1.6(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-7c8e5e7a-20241101): dependencies: client-only: 0.0.1 - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 optionalDependencies: '@babel/core': 7.22.5 babel-plugin-macros: 3.1.0 @@ -30925,11 +30925,11 @@ snapshots: picocolors: 1.0.1 stable: 0.1.8 - swr@2.2.4(react@19.0.0-rc-603e6108-20241029): + swr@2.2.4(react@19.0.0-rc-7c8e5e7a-20241101): dependencies: client-only: 0.0.1 - react: 19.0.0-rc-603e6108-20241029 - use-sync-external-store: 1.2.0(react@19.0.0-rc-603e6108-20241029) + react: 19.0.0-rc-7c8e5e7a-20241101 + use-sync-external-store: 1.2.0(react@19.0.0-rc-7c8e5e7a-20241101) symbol-observable@1.0.1: {} @@ -31593,9 +31593,9 @@ snapshots: unist-util-is: 5.2.0 unist-util-visit-parents: 5.1.3 - unistore@3.4.1(react@19.0.0-rc-603e6108-20241029): + unistore@3.4.1(react@19.0.0-rc-7c8e5e7a-20241101): optionalDependencies: - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 universal-github-app-jwt@1.1.1: dependencies: @@ -31713,9 +31713,9 @@ snapshots: optionalDependencies: '@types/react': types-react@19.0.0-rc.0 - use-sync-external-store@1.2.0(react@19.0.0-rc-603e6108-20241029): + use-sync-external-store@1.2.0(react@19.0.0-rc-7c8e5e7a-20241101): dependencies: - react: 19.0.0-rc-603e6108-20241029 + react: 19.0.0-rc-7c8e5e7a-20241101 util-deprecate@1.0.2: {} diff --git a/run-tests.js b/run-tests.js index 80331f3570945..87458e313ede7 100644 --- a/run-tests.js +++ b/run-tests.js @@ -20,7 +20,7 @@ const { getTestFilter } = require('./test/get-test-filter') // Do not rename or format. sync-react script relies on this line. // prettier-ignore -const nextjsReactPeerVersion = "19.0.0-rc-603e6108-20241029"; +const nextjsReactPeerVersion = "19.0.0-rc-7c8e5e7a-20241101"; let argv = require('yargs/yargs')(process.argv.slice(2)) .string('type') diff --git a/test/.stats-app/package.json b/test/.stats-app/package.json index 1794f2522b9bf..e872ec4c2c301 100644 --- a/test/.stats-app/package.json +++ b/test/.stats-app/package.json @@ -4,8 +4,8 @@ "license": "MIT", "dependencies": { "next": "latest", - "react": "19.0.0-rc-603e6108-20241029", - "react-dom": "19.0.0-rc-603e6108-20241029" + "react": "19.0.0-rc-7c8e5e7a-20241101", + "react-dom": "19.0.0-rc-7c8e5e7a-20241101" }, "engines": { "node": ">=18.18.0" diff --git a/test/e2e/next-test/first-time-setup-js/package.json b/test/e2e/next-test/first-time-setup-js/package.json index b1629450b93f8..02123724827eb 100644 --- a/test/e2e/next-test/first-time-setup-js/package.json +++ b/test/e2e/next-test/first-time-setup-js/package.json @@ -8,7 +8,7 @@ }, "dependencies": { "next": "canary", - "react": "19.0.0-rc-603e6108-20241029", - "react-dom": "19.0.0-rc-603e6108-20241029" + "react": "19.0.0-rc-7c8e5e7a-20241101", + "react-dom": "19.0.0-rc-7c8e5e7a-20241101" } } diff --git a/test/e2e/next-test/first-time-setup-ts/package.json b/test/e2e/next-test/first-time-setup-ts/package.json index db2e7df569ccd..c014c84f6a122 100644 --- a/test/e2e/next-test/first-time-setup-ts/package.json +++ b/test/e2e/next-test/first-time-setup-ts/package.json @@ -8,8 +8,8 @@ }, "dependencies": { "next": "canary", - "react": "19.0.0-rc-603e6108-20241029", - "react-dom": "19.0.0-rc-603e6108-20241029" + "react": "19.0.0-rc-7c8e5e7a-20241101", + "react-dom": "19.0.0-rc-7c8e5e7a-20241101" }, "devDependencies": { "@types/react": "^18", diff --git a/test/lib/next-modes/base.ts b/test/lib/next-modes/base.ts index 0460b2ad9d21c..3f52c56b33a44 100644 --- a/test/lib/next-modes/base.ts +++ b/test/lib/next-modes/base.ts @@ -51,7 +51,7 @@ type OmitFirstArgument = F extends ( // Do not rename or format. sync-react script relies on this line. // prettier-ignore -const nextjsReactPeerVersion = "19.0.0-rc-603e6108-20241029"; +const nextjsReactPeerVersion = "19.0.0-rc-7c8e5e7a-20241101"; export class NextInstance { protected files: FileRef | { [filename: string]: string | FileRef } From 7e8fe8707ead2c92257f088d2cbfe827b3c8c263 Mon Sep 17 00:00:00 2001 From: Jonathan Hefner Date: Sun, 3 Nov 2024 14:48:29 -0600 Subject: [PATCH 11/28] Fix `expire` time for `cacheLife('seconds')` (#72190) ### What? Fix the `expire` time for `cacheLife('seconds')`. ### Why? The intended `expire` time is 1 minute, but the actual time is 1 second. ### How? Times are expressed in seconds, so change `1` to `60`. Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com> --- packages/next/src/server/config-shared.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/src/server/config-shared.ts b/packages/next/src/server/config-shared.ts index 0baa5bbc94a63..251d2f63943d7 100644 --- a/packages/next/src/server/config-shared.ts +++ b/packages/next/src/server/config-shared.ts @@ -1039,7 +1039,7 @@ export const defaultConfig: NextConfig = { seconds: { stale: undefined, // defaults to staleTimes.dynamic revalidate: 1, // 1 second - expire: 1, // 1 minute + expire: 60, // 1 minute }, minutes: { stale: 60 * 5, // 5 minutes From bdf8174e7e75bc91af0e0829905c28954b726273 Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Sun, 3 Nov 2024 23:25:15 +0000 Subject: [PATCH 12/28] v15.0.3-canary.5 --- lerna.json | 2 +- packages/create-next-app/package.json | 2 +- packages/eslint-config-next/package.json | 4 ++-- packages/eslint-plugin-next/package.json | 2 +- packages/font/package.json | 2 +- packages/next-bundle-analyzer/package.json | 2 +- packages/next-codemod/package.json | 2 +- packages/next-env/package.json | 2 +- packages/next-mdx/package.json | 2 +- packages/next-plugin-storybook/package.json | 2 +- packages/next-polyfill-module/package.json | 2 +- packages/next-polyfill-nomodule/package.json | 2 +- packages/next-swc/package.json | 2 +- packages/next/package.json | 14 +++++++------- packages/react-refresh-utils/package.json | 2 +- packages/third-parties/package.json | 4 ++-- pnpm-lock.yaml | 16 ++++++++-------- 17 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lerna.json b/lerna.json index 0ad6b2987f5c5..e0be532adb496 100644 --- a/lerna.json +++ b/lerna.json @@ -16,5 +16,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "15.0.3-canary.4" + "version": "15.0.3-canary.5" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 1766213015e48..4f4921ed73c6b 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "15.0.3-canary.4", + "version": "15.0.3-canary.5", "keywords": [ "react", "next", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index 8a9a9592227f5..9740c0ed4c7e1 100644 --- a/packages/eslint-config-next/package.json +++ b/packages/eslint-config-next/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-next", - "version": "15.0.3-canary.4", + "version": "15.0.3-canary.5", "description": "ESLint configuration used by Next.js.", "main": "index.js", "license": "MIT", @@ -10,7 +10,7 @@ }, "homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config", "dependencies": { - "@next/eslint-plugin-next": "15.0.3-canary.4", + "@next/eslint-plugin-next": "15.0.3-canary.5", "@rushstack/eslint-patch": "^1.10.3", "@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", "@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index 48ae30fb90fa5..4f24f0c5c3b5b 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "15.0.3-canary.4", + "version": "15.0.3-canary.5", "description": "ESLint plugin for Next.js.", "main": "dist/index.js", "license": "MIT", diff --git a/packages/font/package.json b/packages/font/package.json index 3eb9569feb19a..0c24deaba0bd1 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -1,7 +1,7 @@ { "name": "@next/font", "private": true, - "version": "15.0.3-canary.4", + "version": "15.0.3-canary.5", "repository": { "url": "vercel/next.js", "directory": "packages/font" diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index 83a2ea7c6132b..6a9cc39426e1e 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "15.0.3-canary.4", + "version": "15.0.3-canary.5", "main": "index.js", "types": "index.d.ts", "license": "MIT", diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index ddd26545eb2cb..72b083ff8f92a 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "15.0.3-canary.4", + "version": "15.0.3-canary.5", "license": "MIT", "repository": { "type": "git", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index 5ee75a9bfe014..9060a36d181ea 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "15.0.3-canary.4", + "version": "15.0.3-canary.5", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index c8f2bd168f8ee..e0eff6c58408c 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "15.0.3-canary.4", + "version": "15.0.3-canary.5", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 04249523294e7..f05b3696334d7 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "15.0.3-canary.4", + "version": "15.0.3-canary.5", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-module/package.json b/packages/next-polyfill-module/package.json index d2bb3c65e25c1..2f358e2640c8a 100644 --- a/packages/next-polyfill-module/package.json +++ b/packages/next-polyfill-module/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-module", - "version": "15.0.3-canary.4", + "version": "15.0.3-canary.5", "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)", "main": "dist/polyfill-module.js", "license": "MIT", diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index 7dedcb87fbd0f..827e76dc57a99 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "15.0.3-canary.4", + "version": "15.0.3-canary.5", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index f5a8af0a247cd..c20d8f03ed734 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "15.0.3-canary.4", + "version": "15.0.3-canary.5", "private": true, "scripts": { "clean": "node ../../scripts/rm.mjs native", diff --git a/packages/next/package.json b/packages/next/package.json index 80984e6b28118..77b927a226840 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "15.0.3-canary.4", + "version": "15.0.3-canary.5", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -97,7 +97,7 @@ ] }, "dependencies": { - "@next/env": "15.0.3-canary.4", + "@next/env": "15.0.3-canary.5", "@swc/counter": "0.1.3", "@swc/helpers": "0.5.13", "busboy": "1.6.0", @@ -161,11 +161,11 @@ "@jest/types": "29.5.0", "@mswjs/interceptors": "0.23.0", "@napi-rs/triples": "1.2.0", - "@next/font": "15.0.3-canary.4", - "@next/polyfill-module": "15.0.3-canary.4", - "@next/polyfill-nomodule": "15.0.3-canary.4", - "@next/react-refresh-utils": "15.0.3-canary.4", - "@next/swc": "15.0.3-canary.4", + "@next/font": "15.0.3-canary.5", + "@next/polyfill-module": "15.0.3-canary.5", + "@next/polyfill-nomodule": "15.0.3-canary.5", + "@next/react-refresh-utils": "15.0.3-canary.5", + "@next/swc": "15.0.3-canary.5", "@opentelemetry/api": "1.6.0", "@playwright/test": "1.41.2", "@swc/core": "1.7.0-nightly-20240714.1", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index 3ac7b2a3a0575..892314d6cdd51 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "15.0.3-canary.4", + "version": "15.0.3-canary.5", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/packages/third-parties/package.json b/packages/third-parties/package.json index 77161147cb841..1db9888a6f9d6 100644 --- a/packages/third-parties/package.json +++ b/packages/third-parties/package.json @@ -1,6 +1,6 @@ { "name": "@next/third-parties", - "version": "15.0.3-canary.4", + "version": "15.0.3-canary.5", "repository": { "url": "vercel/next.js", "directory": "packages/third-parties" @@ -26,7 +26,7 @@ "third-party-capital": "1.0.20" }, "devDependencies": { - "next": "15.0.3-canary.4", + "next": "15.0.3-canary.5", "outdent": "0.8.0", "prettier": "2.5.1", "typescript": "5.5.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c4b3459555ae3..3c3cdcf4ffed9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -795,7 +795,7 @@ importers: packages/eslint-config-next: dependencies: '@next/eslint-plugin-next': - specifier: 15.0.3-canary.4 + specifier: 15.0.3-canary.5 version: link:../eslint-plugin-next '@rushstack/eslint-patch': specifier: ^1.10.3 @@ -859,7 +859,7 @@ importers: packages/next: dependencies: '@next/env': - specifier: 15.0.3-canary.4 + specifier: 15.0.3-canary.5 version: link:../next-env '@swc/counter': specifier: 0.1.3 @@ -987,19 +987,19 @@ importers: specifier: 1.2.0 version: 1.2.0 '@next/font': - specifier: 15.0.3-canary.4 + specifier: 15.0.3-canary.5 version: link:../font '@next/polyfill-module': - specifier: 15.0.3-canary.4 + specifier: 15.0.3-canary.5 version: link:../next-polyfill-module '@next/polyfill-nomodule': - specifier: 15.0.3-canary.4 + specifier: 15.0.3-canary.5 version: link:../next-polyfill-nomodule '@next/react-refresh-utils': - specifier: 15.0.3-canary.4 + specifier: 15.0.3-canary.5 version: link:../react-refresh-utils '@next/swc': - specifier: 15.0.3-canary.4 + specifier: 15.0.3-canary.5 version: link:../next-swc '@opentelemetry/api': specifier: 1.6.0 @@ -1633,7 +1633,7 @@ importers: version: 1.0.20 devDependencies: next: - specifier: 15.0.3-canary.4 + specifier: 15.0.3-canary.5 version: link:../next outdent: specifier: 0.8.0 From 3f1e117329f8ddd084531d5502ec039458ea503d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Mon, 4 Nov 2024 17:28:43 +0900 Subject: [PATCH 13/28] fix(turbopack): Fix `EcmascriptModuleFacadeModule::ident()` (#71338) ### What? Fix `ident` implementation of `EcmascriptModuleFacadeModule`. Previous code replaces original module part, while the new implementation adds part information as a modifier. ### Why? Currently, `ident` implementations are not correctly aligned. This makes some modules returned from `references()` disappear from the final bundle. ### How? --- turbopack/crates/turbopack-core/src/ident.rs | 26 ++++++++++--------- .../crates/turbopack-css/src/chunk/mod.rs | 2 +- .../turbopack-ecmascript/src/chunk/mod.rs | 2 +- .../side_effect_optimization/facade/module.rs | 4 +-- .../src/tree_shake/mod.rs | 2 +- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/turbopack/crates/turbopack-core/src/ident.rs b/turbopack/crates/turbopack-core/src/ident.rs index 0a5e98adcb05e..475c1a18db35b 100644 --- a/turbopack/crates/turbopack-core/src/ident.rs +++ b/turbopack/crates/turbopack-core/src/ident.rs @@ -20,8 +20,8 @@ pub struct AssetIdent { pub assets: Vec<(ResolvedVc, ResolvedVc)>, /// The modifiers of this asset (e.g. `client chunks`) pub modifiers: Vec>, - /// The part of the asset that is a (ECMAScript) module - pub part: Option>, + /// The parts of the asset that are (ECMAScript) modules + pub parts: Vec>, /// The asset layer the asset was created from. pub layer: Option>, } @@ -95,12 +95,14 @@ impl ValueToString for AssetIdent { s.push(')'); } - if let Some(part) = self.part { - let part = part.to_string().await?; - // facade is not included in ident as switching between facade and non-facade shouldn't - // change the ident - if part.as_str() != "facade" { - write!(s, " <{}>", part)?; + if !self.parts.is_empty() { + for part in self.parts.iter() { + let part = part.to_string().await?; + // facade is not included in ident as switching between facade and non-facade + // shouldn't change the ident + if part.as_str() != "facade" { + write!(s, " <{}>", part)?; + } } } @@ -124,7 +126,7 @@ impl AssetIdent { fragment: None, assets: Vec::new(), modifiers: Vec::new(), - part: None, + parts: Vec::new(), layer: None, })) } @@ -146,7 +148,7 @@ impl AssetIdent { #[turbo_tasks::function] pub fn with_part(&self, part: ResolvedVc) -> Vc { let mut this = self.clone(); - this.part = Some(part); + this.parts.push(part); Self::new(Value::new(this)) } @@ -224,7 +226,7 @@ impl AssetIdent { fragment, assets, modifiers, - part, + parts, layer, } = self; let query = query.await?; @@ -255,7 +257,7 @@ impl AssetIdent { modifier.deterministic_hash(&mut hasher); has_hash = true; } - if let Some(part) = part { + for part in parts.iter() { 4_u8.deterministic_hash(&mut hasher); match &*part.await? { ModulePart::Evaluation => { diff --git a/turbopack/crates/turbopack-css/src/chunk/mod.rs b/turbopack/crates/turbopack-css/src/chunk/mod.rs index 03fb65cc737f8..e59305d0e138b 100644 --- a/turbopack/crates/turbopack-css/src/chunk/mod.rs +++ b/turbopack/crates/turbopack-css/src/chunk/mod.rs @@ -297,7 +297,7 @@ impl OutputAsset for CssChunk { fragment: None, assets, modifiers: Vec::new(), - part: None, + parts: Vec::new(), layer: None, }; diff --git a/turbopack/crates/turbopack-ecmascript/src/chunk/mod.rs b/turbopack/crates/turbopack-ecmascript/src/chunk/mod.rs index 095e09e28a91e..0d24f25a93569 100644 --- a/turbopack/crates/turbopack-ecmascript/src/chunk/mod.rs +++ b/turbopack/crates/turbopack-ecmascript/src/chunk/mod.rs @@ -117,7 +117,7 @@ impl Chunk for EcmascriptChunk { fragment: None, assets, modifiers: Vec::new(), - part: None, + parts: Vec::new(), layer: None, }; diff --git a/turbopack/crates/turbopack-ecmascript/src/side_effect_optimization/facade/module.rs b/turbopack/crates/turbopack-ecmascript/src/side_effect_optimization/facade/module.rs index 8fbfcea8b550a..30c5316ced247 100644 --- a/turbopack/crates/turbopack-ecmascript/src/side_effect_optimization/facade/module.rs +++ b/turbopack/crates/turbopack-ecmascript/src/side_effect_optimization/facade/module.rs @@ -61,10 +61,10 @@ impl EcmascriptModuleFacadeModule { #[turbo_tasks::value_impl] impl Module for EcmascriptModuleFacadeModule { #[turbo_tasks::function] - fn ident(&self) -> Vc { + async fn ident(&self) -> Result> { let inner = self.module.ident(); - inner.with_part(self.ty) + Ok(inner.with_part(self.ty)) } #[turbo_tasks::function] diff --git a/turbopack/crates/turbopack-ecmascript/src/tree_shake/mod.rs b/turbopack/crates/turbopack-ecmascript/src/tree_shake/mod.rs index b80036dd1ee73..9a76774d86017 100644 --- a/turbopack/crates/turbopack-ecmascript/src/tree_shake/mod.rs +++ b/turbopack/crates/turbopack-ecmascript/src/tree_shake/mod.rs @@ -428,7 +428,7 @@ pub(super) async fn split( parsed: Vc, ) -> Result> { // Do not split already split module - if ident.await?.part.is_some() { + if !ident.await?.parts.is_empty() { return Ok(SplitResult::Failed { parse_result: parsed, } From a5c7884921c190fe69ed30c1f401272cc9632ebe Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 4 Nov 2024 09:45:00 +0100 Subject: [PATCH 14/28] make failed fetch calls session dependent (#71667) ### What? When fetch fails we don't want to cache that persistently, but only for the session. --- turbopack/crates/turbo-tasks-fetch/src/lib.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/turbopack/crates/turbo-tasks-fetch/src/lib.rs b/turbopack/crates/turbo-tasks-fetch/src/lib.rs index 24fa58b957019..f7362a3c67117 100644 --- a/turbopack/crates/turbo-tasks-fetch/src/lib.rs +++ b/turbopack/crates/turbo-tasks-fetch/src/lib.rs @@ -3,7 +3,7 @@ #![feature(arbitrary_self_types_pointers)] use anyhow::Result; -use turbo_tasks::{RcStr, Vc}; +use turbo_tasks::{mark_session_dependent, RcStr, Vc}; use turbo_tasks_fs::FileSystemPath; use turbopack_core::issue::{Issue, IssueSeverity, IssueStage, OptionStyledString, StyledString}; @@ -83,9 +83,12 @@ pub async fn fetch( } .cell()))) } - Err(err) => Ok(Vc::cell(Err( - FetchError::from_reqwest_error(&err, url).cell() - ))), + Err(err) => { + mark_session_dependent(); + Ok(Vc::cell(Err( + FetchError::from_reqwest_error(&err, url).cell() + ))) + } } } From 927749c6b2bfd9276257ebc078cec7b8a846dbdf Mon Sep 17 00:00:00 2001 From: Hendrik Liebau Date: Mon, 4 Nov 2024 12:33:06 +0100 Subject: [PATCH 15/28] Strip `assetPrefix` when resolving external source maps of client chunks (#72258) When using Turbopack, and importing a server action into a client component, the source map for the client chunk will be requested if devtools are open. The filename for this source map request might be `/_next/static/chunks/[project]__800ed2._.js`, for example. This scenario was already handled by the dev middleware. However, it didn't consider that there might also be an `assetPrefix` defined in the `next.config.js`. In this case, the filename would be `/some-asset-prefix/_next/static/chunks/[project]__800ed2._.js`. When resolving the external source map for this file, we need to strip the asset prefix. Again, this can only be tested manually. --- .../server/middleware-turbopack.ts | 14 +++++++--- .../react-dev-overlay/server/middleware.ts | 27 +++++++++++++++---- .../src/server/dev/hot-reloader-turbopack.ts | 5 +++- .../src/server/dev/hot-reloader-webpack.ts | 4 +++ .../app-dir/source-mapping/next.config.js | 11 ++++++++ 5 files changed, 52 insertions(+), 9 deletions(-) diff --git a/packages/next/src/client/components/react-dev-overlay/server/middleware-turbopack.ts b/packages/next/src/client/components/react-dev-overlay/server/middleware-turbopack.ts index 005a8cc61d011..46caab6a7d572 100644 --- a/packages/next/src/client/components/react-dev-overlay/server/middleware-turbopack.ts +++ b/packages/next/src/client/components/react-dev-overlay/server/middleware-turbopack.ts @@ -153,7 +153,10 @@ export function getOverlayMiddleware(project: Project) { } } -export function getSourceMapMiddleware(project: Project, distDir: string) { +export function getSourceMapMiddleware( + project: Project, + options: { assetPrefix: string; distDir: string } +) { return async function ( req: IncomingMessage, res: ServerResponse, @@ -185,8 +188,13 @@ export function getSourceMapMiddleware(project: Project, distDir: string) { } try { - if (filename.startsWith('/_next/static')) { - filename = path.join(distDir, filename.replace(/^\/_next\//, '')) + const { assetPrefix, distDir } = options + + if (filename.startsWith(`${assetPrefix}/_next/static`)) { + filename = path.join( + distDir, + filename.replace(new RegExp(`^${assetPrefix}/_next/`), '') + ) } // Turbopack chunk filenames might be URL-encoded. diff --git a/packages/next/src/client/components/react-dev-overlay/server/middleware.ts b/packages/next/src/client/components/react-dev-overlay/server/middleware.ts index e656270764df5..923241cf49624 100644 --- a/packages/next/src/client/components/react-dev-overlay/server/middleware.ts +++ b/packages/next/src/client/components/react-dev-overlay/server/middleware.ts @@ -204,14 +204,20 @@ export async function getSourceMapFromCompilation( export async function getSource( filename: string, options: { + assetPrefix: string distDirectory: string getCompilations: () => webpack.Compilation[] } ): Promise { - const { distDirectory, getCompilations } = options - - if (filename.startsWith('/_next/static')) { - filename = path.join(distDirectory, filename.replace(/^\/_next\//, '')) + const { assetPrefix, distDirectory, getCompilations } = options + + // With Webpack, this branch can only be hit when manually changing from + // `eval-source-map` to `source-map` for testing purposes. + if (filename.startsWith(`${assetPrefix}/_next/static`)) { + filename = path.join( + distDirectory, + filename.replace(new RegExp(`^${assetPrefix}/_next/`), '') + ) } if (path.isAbsolute(filename)) { @@ -256,6 +262,7 @@ export async function getSource( } export function getOverlayMiddleware(options: { + assetPrefix: string distDirectory: string rootDirectory: string clientStats: () => webpack.Stats | null @@ -263,6 +270,7 @@ export function getOverlayMiddleware(options: { edgeServerStats: () => webpack.Stats | null }) { const { + assetPrefix, distDirectory, rootDirectory, clientStats, @@ -309,6 +317,7 @@ export function getOverlayMiddleware(options: { try { source = await getSource(frame.file, { + assetPrefix, distDirectory, getCompilations: () => { const compilations: webpack.Compilation[] = [] @@ -410,12 +419,19 @@ export function getOverlayMiddleware(options: { } export function getSourceMapMiddleware(options: { + assetPrefix: string distDirectory: string clientStats: () => webpack.Stats | null serverStats: () => webpack.Stats | null edgeServerStats: () => webpack.Stats | null }) { - const { distDirectory, clientStats, serverStats, edgeServerStats } = options + const { + assetPrefix, + distDirectory, + clientStats, + serverStats, + edgeServerStats, + } = options return async function ( req: IncomingMessage, @@ -438,6 +454,7 @@ export function getSourceMapMiddleware(options: { try { source = await getSource(filename, { + assetPrefix, distDirectory, getCompilations: () => { const compilations: webpack.Compilation[] = [] diff --git a/packages/next/src/server/dev/hot-reloader-turbopack.ts b/packages/next/src/server/dev/hot-reloader-turbopack.ts index 2824854db4897..591872617a6e6 100644 --- a/packages/next/src/server/dev/hot-reloader-turbopack.ts +++ b/packages/next/src/server/dev/hot-reloader-turbopack.ts @@ -569,7 +569,10 @@ export async function createHotReloaderTurbopack( const middlewares = [ getOverlayMiddleware(project), - getSourceMapMiddleware(project, distDir), + getSourceMapMiddleware(project, { + assetPrefix: nextConfig.assetPrefix.replace(/\/$/, ''), + distDir, + }), ] const versionInfoPromise = getVersionInfo( diff --git a/packages/next/src/server/dev/hot-reloader-webpack.ts b/packages/next/src/server/dev/hot-reloader-webpack.ts index a7e9e3d29d67c..b42754890140e 100644 --- a/packages/next/src/server/dev/hot-reloader-webpack.ts +++ b/packages/next/src/server/dev/hot-reloader-webpack.ts @@ -1507,8 +1507,11 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface { }), }) + const assetPrefix = this.config.assetPrefix.replace(/\/$/, '') + this.middlewares = [ getOverlayMiddleware({ + assetPrefix, distDirectory: this.distDir, rootDirectory: this.dir, clientStats: () => this.clientStats, @@ -1516,6 +1519,7 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface { edgeServerStats: () => this.edgeServerStats, }), getSourceMapMiddleware({ + assetPrefix, distDirectory: this.distDir, clientStats: () => this.clientStats, serverStats: () => this.serverStats, diff --git a/test/development/app-dir/source-mapping/next.config.js b/test/development/app-dir/source-mapping/next.config.js index 82ac8c9d9cb2e..89d625aca9245 100644 --- a/test/development/app-dir/source-mapping/next.config.js +++ b/test/development/app-dir/source-mapping/next.config.js @@ -3,6 +3,17 @@ */ const nextConfig = { + assetPrefix: '/assets/', // intentional trailing slash to ensure we handle this as well + rewrites() { + return { + beforeFiles: [ + { + source: '/assets/:path*', + destination: '/:path*', + }, + ], + } + }, experimental: { ppr: true, }, From 0ffc5f7b5901d3a6d84e9af3c5d72fe36c43d7d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Orb=C3=A1n?= Date: Mon, 4 Nov 2024 12:42:54 +0100 Subject: [PATCH 16/28] Revert "docs: change `NextAuth.js` to `Auth.js`" (#72257) --- .../01-building-your-application/09-authentication/index.mdx | 2 +- docs/02-app/index.mdx | 2 +- examples/auth/README.md | 2 +- examples/auth/app/layout.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/02-app/01-building-your-application/09-authentication/index.mdx b/docs/02-app/01-building-your-application/09-authentication/index.mdx index c26bead977281..dfefa42ac8786 100644 --- a/docs/02-app/01-building-your-application/09-authentication/index.mdx +++ b/docs/02-app/01-building-your-application/09-authentication/index.mdx @@ -1642,10 +1642,10 @@ Now that you've learned about authentication in Next.js, here are Next.js-compat ### Auth Libraries -- [Auth.js](https://authjs.dev/getting-started/installation?framework=next.js) - [Auth0](https://auth0.com/docs/quickstart/webapp/nextjs/01-login) - [Clerk](https://clerk.com/docs/quickstarts/nextjs) - [Kinde](https://kinde.com/docs/developer-tools/nextjs-sdk) +- [NextAuth.js](https://authjs.dev/getting-started/installation?framework=next.js) - [Ory](https://www.ory.sh/docs/getting-started/integrate-auth/nextjs) - [Stack Auth](https://docs.stack-auth.com/getting-started/setup) - [Supabase](https://supabase.com/docs/guides/getting-started/quickstarts/nextjs) diff --git a/docs/02-app/index.mdx b/docs/02-app/index.mdx index bc4f5050b03a2..d7645430509bf 100644 --- a/docs/02-app/index.mdx +++ b/docs/02-app/index.mdx @@ -35,7 +35,7 @@ You can use [`redirect`](/docs/app/api-reference/functions/redirect) to redirect Here are some common authentication solutions that support the App Router: -- [Auth.js](https://authjs.dev/getting-started/installation?framework=Next.js) +- [NextAuth.js](https://authjs.dev/getting-started/installation?framework=next.js) - [Clerk](https://clerk.com/docs/quickstarts/nextjs) - [Stack Auth](https://docs.stack-auth.com/getting-started/setup) - [Auth0](https://github.com/auth0/nextjs-auth0#app-router) diff --git a/examples/auth/README.md b/examples/auth/README.md index a191dd76470b4..aa0e14c8c5cb2 100644 --- a/examples/auth/README.md +++ b/examples/auth/README.md @@ -1,6 +1,6 @@ # Authentication -This is an example using [Auth.js](https://authjs.dev/) for authentication. +This is an example using NextAuth.js for authentication. ## Deploy your own diff --git a/examples/auth/app/layout.tsx b/examples/auth/app/layout.tsx index 65fc27eabb947..48f0ecfeb66aa 100644 --- a/examples/auth/app/layout.tsx +++ b/examples/auth/app/layout.tsx @@ -2,7 +2,7 @@ import "./globals.css"; export const metadata = { title: "Next.js Authentication", - description: "Example using Auth.js", + description: "Example using NextAuth.js", }; export default function RootLayout({ From 9bbf1d023cc8ae9a371c68c169869a74b39514d3 Mon Sep 17 00:00:00 2001 From: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com> Date: Mon, 4 Nov 2024 04:23:43 -0800 Subject: [PATCH 17/28] Docs: Fix css modules page in Pages docs (#72135) Re: https://vercel.slack.com/archives/C07BS1WEYAZ/p1730162050697879 --- .../05-styling/02-tailwind-css.mdx | 2 +- docs/02-app/02-api-reference/05-next-config-js/webpack.mdx | 2 +- .../04-styling/{01-css-modules.mdx => 01-css.mdx} | 4 ++-- errors/css-global.mdx | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) rename docs/03-pages/01-building-your-application/04-styling/{01-css-modules.mdx => 01-css.mdx} (82%) diff --git a/docs/02-app/01-building-your-application/05-styling/02-tailwind-css.mdx b/docs/02-app/01-building-your-application/05-styling/02-tailwind-css.mdx index f7e550889019e..e4c8dffee7b17 100644 --- a/docs/02-app/01-building-your-application/05-styling/02-tailwind-css.mdx +++ b/docs/02-app/01-building-your-application/05-styling/02-tailwind-css.mdx @@ -149,7 +149,7 @@ export default function Page() { ## Importing Styles -Add the [Tailwind CSS directives](https://tailwindcss.com/docs/functions-and-directives#directives) that Tailwind will use to inject its generated styles to a [Global Stylesheet](/docs/pages/building-your-application/styling/css-modules#global-styles) in your application, for example: +Add the [Tailwind CSS directives](https://tailwindcss.com/docs/functions-and-directives#directives) that Tailwind will use to inject its generated styles to a [Global Stylesheet](/docs/pages/building-your-application/styling/css#global-styles) in your application, for example: ```css filename="styles/globals.css" @tailwind base; diff --git a/docs/02-app/02-api-reference/05-next-config-js/webpack.mdx b/docs/02-app/02-api-reference/05-next-config-js/webpack.mdx index c3a1e58fc4dd2..79ccc4c144cb4 100644 --- a/docs/02-app/02-api-reference/05-next-config-js/webpack.mdx +++ b/docs/02-app/02-api-reference/05-next-config-js/webpack.mdx @@ -22,7 +22,7 @@ Before continuing to add custom webpack configuration to your application make s - [CSS imports](/docs/pages/building-your-application/styling) -- [CSS modules](/docs/pages/building-your-application/styling/css-modules) +- [CSS modules](/docs/pages/building-your-application/styling/css) - [Sass/SCSS imports](/docs/pages/building-your-application/styling/sass) - [Sass/SCSS modules](/docs/pages/building-your-application/styling/sass) - [Customizing babel configuration](/docs/pages/building-your-application/configuring/babel) diff --git a/docs/03-pages/01-building-your-application/04-styling/01-css-modules.mdx b/docs/03-pages/01-building-your-application/04-styling/01-css.mdx similarity index 82% rename from docs/03-pages/01-building-your-application/04-styling/01-css-modules.mdx rename to docs/03-pages/01-building-your-application/04-styling/01-css.mdx index 2d517f75aebce..5c80dbef5eb57 100644 --- a/docs/03-pages/01-building-your-application/04-styling/01-css-modules.mdx +++ b/docs/03-pages/01-building-your-application/04-styling/01-css.mdx @@ -1,6 +1,6 @@ --- -title: CSS Modules -description: Style your Next.js Application using CSS Modules. +title: CSS +description: Style your Next.js Application using CSS. source: app/building-your-application/styling/css --- diff --git a/errors/css-global.mdx b/errors/css-global.mdx index 95550d5fdafab..50a6de82a76e0 100644 --- a/errors/css-global.mdx +++ b/errors/css-global.mdx @@ -13,11 +13,11 @@ Global CSS cannot be used in files other than your [custom `_app.js` file](/docs There are two possible ways to fix this error: - Move all global CSS imports to your [`pages/_app.js` file](/docs/pages/building-your-application/routing/custom-app). -- If you do not wish your stylesheet to be global, update it to use [CSS Modules](/docs/pages/building-your-application/styling/css-modules). This will allow you to import the stylesheet and scope the styles to a specific component. +- If you do not wish your stylesheet to be global, update it to use [CSS Modules](/docs/pages/building-your-application/styling/css). This will allow you to import the stylesheet and scope the styles to a specific component. #### Example -Consider the stylesheet named [`styles.css`](/docs/pages/building-your-application/styling/css-modules) +Consider the stylesheet named [`styles.css`](/docs/pages/building-your-application/styling/css) ```css filename="styles.css" body { From f6863dd7fa2cd9a7b257f906a782a7734e7f455e Mon Sep 17 00:00:00 2001 From: Josh Story Date: Mon, 4 Nov 2024 07:52:53 -0800 Subject: [PATCH 18/28] [dynamicIO] normalize validation logic (#72145) Recently we updated the implementation of validating dynamic behavior with dynamicIO for prerenders and this updates the dev validation logic to largely match. --- .../next/src/server/app-render/app-render.tsx | 493 ++++++++---------- .../app/page.tsx | 4 +- 2 files changed, 227 insertions(+), 270 deletions(-) diff --git a/packages/next/src/server/app-render/app-render.tsx b/packages/next/src/server/app-render/app-render.tsx index d60aab21c72ef..472604e707b4e 100644 --- a/packages/next/src/server/app-render/app-render.tsx +++ b/packages/next/src/server/app-render/app-render.tsx @@ -1953,289 +1953,282 @@ async function spawnDynamicValidationInDev( ): Promise { const { componentMod: ComponentMod } = ctx + // Prerender controller represents the lifetime of the prerender. + // It will be aborted when a Task is complete or a synchronously aborting + // API is called. Notably during cache-filling renders this does not actually + // terminate the render itself which will continue until all caches are filled + const initialServerPrerenderController = new AbortController() + + // This controller represents the lifetime of the React render call. Notably + // during the cache-filling render it is different from the prerender controller + // because we don't want to end the react render until all caches are filled. + const initialServerRenderController = new AbortController() + const cacheSignal = new CacheSignal() - const firstAttemptServerController = new AbortController() - let serverDynamicTracking = createDynamicTrackingState(false) + const initialServerPrerenderStore: PrerenderStore = { + type: 'prerender', + phase: 'render', + implicitTags: ctx.requestStore.implicitTags, + renderSignal: initialServerRenderController.signal, + controller: initialServerPrerenderController, + cacheSignal, + dynamicTracking: null, + revalidate: INFINITE_CACHE, + expire: INFINITE_CACHE, + stale: INFINITE_CACHE, + tags: [...ctx.requestStore.implicitTags], + } - const firstAttemptServerPrerenderStore: PrerenderStore = { + const initialClientController = new AbortController() + const initialClientPrerenderStore: PrerenderStore = { type: 'prerender', phase: 'render', - implicitTags: [], - renderSignal: firstAttemptServerController.signal, + implicitTags: ctx.requestStore.implicitTags, + renderSignal: initialClientController.signal, + controller: initialClientController, cacheSignal, - // During the prospective render we don't want to synchronously abort on dynamic access - // because it could prevent us from discovering all caches in siblings. So we omit the controller - // from the prerender store this time. - controller: firstAttemptServerController, - // With PPR during Prerender we don't need to track individual dynamic reasons - // because we will always do a final render after caches have filled and we - // will track it again there dynamicTracking: null, revalidate: INFINITE_CACHE, expire: INFINITE_CACHE, stale: INFINITE_CACHE, - tags: [], - // Dev only property that allows certain logs to be suppressed - validating: true, + tags: [...ctx.requestStore.implicitTags], } + // We're not going to use the result of this render because the only time it could be used + // is if it completes in a microtask and that's likely very rare for any non-trivial app const firstAttemptRSCPayload = await workUnitAsyncStorage.run( - firstAttemptServerPrerenderStore, + initialServerPrerenderStore, getRSCPayload, tree, ctx, isNotFound ) - let reactServerStream = await workUnitAsyncStorage.run( - firstAttemptServerPrerenderStore, - ComponentMod.renderToReadableStream, - firstAttemptRSCPayload, - clientReferenceManifest.clientModules, - { - signal: firstAttemptServerController.signal, - onError: () => {}, + let initialServerStream + try { + initialServerStream = workUnitAsyncStorage.run( + initialServerPrerenderStore, + ComponentMod.renderToReadableStream, + firstAttemptRSCPayload, + clientReferenceManifest.clientModules, + { + onError: (err: unknown) => { + if ( + initialServerPrerenderController.signal.aborted || + initialServerRenderController.signal.aborted + ) { + // The render aborted before this error was handled which indicates + // the error is caused by unfinished components within the render + return + } else if ( + process.env.NEXT_DEBUG_BUILD || + process.env.__NEXT_VERBOSE_LOGGING + ) { + printDebugThrownValueForProspectiveRender(err, route) + } + }, + signal: initialServerRenderController.signal, + } + ) + } catch (err: unknown) { + if ( + initialServerPrerenderController.signal.aborted || + initialServerRenderController.signal.aborted + ) { + // These are expected errors that might error the prerender. we ignore them. + } else if ( + process.env.NEXT_DEBUG_BUILD || + process.env.__NEXT_VERBOSE_LOGGING + ) { + // We don't normally log these errors because we are going to retry anyway but + // it can be useful for debugging Next.js itself to get visibility here when needed + printDebugThrownValueForProspectiveRender(err, route) } - ) + } + + const { ServerInsertedHTMLProvider } = createServerInsertedHTML() + const nonce = '1' + + if (initialServerStream) { + const [warmupStream, renderStream] = initialServerStream.tee() + initialServerStream = null + // Before we attempt the SSR initial render we need to ensure all client modules + // are already loaded. + await warmFlightResponse(warmupStream, clientReferenceManifest) + + const prerender = require('react-dom/static.edge') + .prerender as (typeof import('react-dom/static.edge'))['prerender'] + const pendingInitialClientResult = workUnitAsyncStorage.run( + initialClientPrerenderStore, + prerender, + {}} + clientReferenceManifest={clientReferenceManifest} + ServerInsertedHTMLProvider={ServerInsertedHTMLProvider} + nonce={nonce} + />, + { + signal: initialClientController.signal, + onError: (err: unknown, _errorInfo: ErrorInfo) => { + if (initialClientController.signal.aborted) { + // These are expected errors that might error the prerender. we ignore them. + } else if ( + process.env.NEXT_DEBUG_BUILD || + process.env.__NEXT_VERBOSE_LOGGING + ) { + // We don't normally log these errors because we are going to retry anyway but + // it can be useful for debugging Next.js itself to get visibility here when needed + printDebugThrownValueForProspectiveRender(err, route) + } + }, + } + ) + pendingInitialClientResult.catch((err: unknown) => { + if (initialClientController.signal.aborted) { + // We aborted the render normally and can ignore this error + } else { + // We're going to retry to so we normally would suppress this error but + // when verbose logging is on we print it + if (process.env.__NEXT_VERBOSE_LOGGING) { + printDebugThrownValueForProspectiveRender(err, route) + } + } + }) + } await cacheSignal.cacheReady() - firstAttemptServerController.abort() + // It is important that we abort the SSR render first to avoid + // connection closed errors from having an incomplete RSC stream + initialClientController.abort() + initialServerRenderController.abort() + initialServerPrerenderController.abort() + + // We've now filled caches and triggered any inadvertent sync bailouts + // due to lazy module initialization. We can restart our render to capture results - const secondAttemptServerController = new AbortController() - serverDynamicTracking = createDynamicTrackingState(false) + const finalServerController = new AbortController() + const serverDynamicTracking = createDynamicTrackingState(false) - const secondAttemptServerPrerenderStore: PrerenderStore = { + const finalServerPrerenderStore: PrerenderStore = { type: 'prerender', phase: 'render', - implicitTags: [], - renderSignal: secondAttemptServerController.signal, + implicitTags: ctx.requestStore.implicitTags, + renderSignal: finalServerController.signal, + controller: finalServerController, + // During the final prerender we don't need to track cache access so we omit the signal cacheSignal: null, - // During the prospective render we don't want to synchronously abort on dynamic access - // because it could prevent us from discovering all caches in siblings. So we omit the controller - // from the prerender store this time. - controller: secondAttemptServerController, - // With PPR during Prerender we don't need to track individual dynamic reasons - // because we will always do a final render after caches have filled and we - // will track it again there dynamicTracking: serverDynamicTracking, revalidate: INFINITE_CACHE, expire: INFINITE_CACHE, stale: INFINITE_CACHE, - tags: [], - // Dev only property that allows certain logs to be suppressed - validating: true, + tags: [...ctx.requestStore.implicitTags], + } + + const finalClientController = new AbortController() + const clientDynamicTracking = createDynamicTrackingState(false) + const dynamicValidation = createDynamicValidationState() + + const finalClientPrerenderStore: PrerenderStore = { + type: 'prerender', + phase: 'render', + implicitTags: ctx.requestStore.implicitTags, + renderSignal: finalClientController.signal, + controller: finalClientController, + // During the final prerender we don't need to track cache access so we omit the signal + cacheSignal: null, + dynamicTracking: clientDynamicTracking, + revalidate: INFINITE_CACHE, + expire: INFINITE_CACHE, + stale: INFINITE_CACHE, + tags: [...ctx.requestStore.implicitTags], } - const secondAttemptRSCPayload = await workUnitAsyncStorage.run( - secondAttemptServerPrerenderStore, + const finalServerPayload = await workUnitAsyncStorage.run( + finalServerPrerenderStore, getRSCPayload, tree, ctx, isNotFound ) - reactServerStream = await workUnitAsyncStorage.run( - secondAttemptServerPrerenderStore, - scheduleInSequentialTasks, - () => { - const stream = ComponentMod.renderToReadableStream( - secondAttemptRSCPayload, + const serverPrerenderStreamResult = await prerenderServerWithPhases( + finalServerController.signal, + () => + workUnitAsyncStorage.run( + finalServerPrerenderStore, + ComponentMod.renderToReadableStream, + finalServerPayload, clientReferenceManifest.clientModules, { - signal: secondAttemptServerController.signal, - onError: () => {}, + onError: (err: unknown) => { + if (finalServerController.signal.aborted) { + if (isPrerenderInterruptedError(err)) { + return err.digest + } + } + }, + signal: finalServerController.signal, } - ) - return asHaltedStream(stream, secondAttemptServerController.signal) - }, + ), () => { - secondAttemptServerController.abort() + finalServerController.abort() } ) - const [warmupStream, renderStream] = reactServerStream.tee() - - await warmFlightResponse(warmupStream, clientReferenceManifest) - - const { ServerInsertedHTMLProvider } = createServerInsertedHTML() - const nonce = '1' - - const prerender = require('react-dom/static.edge') - .prerender as (typeof import('react-dom/static.edge'))['prerender'] - - let clientDynamicTracking = createDynamicTrackingState(false) - let dynamicValidation = createDynamicValidationState() - - const firstAttemptClientController = new AbortController() - const firstAttemptClientPrerenderStore: PrerenderStore = { - type: 'prerender', - phase: 'render', - implicitTags: [], - renderSignal: firstAttemptClientController.signal, - // For HTML Generation we don't need to track cache reads (RSC only) - cacheSignal: null, - // We expect the SSR render to complete in a single Task and need to be able to synchronously abort - // When you use APIs that are considered dynamic or synchronous IO. - controller: firstAttemptClientController, - // We do track dynamic access because searchParams and certain hooks can still be - // dynamic during SSR - dynamicTracking: clientDynamicTracking, - revalidate: INFINITE_CACHE, - expire: INFINITE_CACHE, - stale: INFINITE_CACHE, - tags: [], - validating: true, - } - - const [firstAttemptReactServerStream, secondAttemptReactServerStream] = - renderStream.tee() - let hadException = false + const serverPhasedStream = serverPrerenderStreamResult.asPhasedStream() try { - await prerenderAndAbortInSequentialTasks( - async () => { - workUnitAsyncStorage - .run( - firstAttemptClientPrerenderStore, - prerender, - {}} - clientReferenceManifest={clientReferenceManifest} - ServerInsertedHTMLProvider={ServerInsertedHTMLProvider} - nonce={nonce} - />, - { - signal: firstAttemptClientController.signal, - onError: (err: unknown, errorInfo: ErrorInfo) => { - if ( - isPrerenderInterruptedError(err) || - firstAttemptServerController.signal.aborted - ) { - const componentStack: string | undefined = (errorInfo as any) - .componentStack - if ( - typeof componentStack === 'string' && - err instanceof Error - ) { - trackAllowedDynamicAccess( - route, - componentStack, - dynamicValidation, - serverDynamicTracking, - clientDynamicTracking - ) - } + const prerender = require('react-dom/static.edge') + .prerender as (typeof import('react-dom/static.edge'))['prerender'] + await prerenderClientWithPhases( + () => + workUnitAsyncStorage.run( + finalClientPrerenderStore, + prerender, + {}} + clientReferenceManifest={clientReferenceManifest} + ServerInsertedHTMLProvider={ServerInsertedHTMLProvider} + nonce={ctx.nonce} + />, + { + signal: finalClientController.signal, + onError: (err: unknown, errorInfo: ErrorInfo) => { + if ( + isPrerenderInterruptedError(err) || + finalClientController.signal.aborted + ) { + const componentStack: string | undefined = (errorInfo as any) + .componentStack + if (typeof componentStack === 'string') { + trackAllowedDynamicAccess( + route, + componentStack, + dynamicValidation, + serverDynamicTracking, + clientDynamicTracking + ) } - }, - } - ) - .catch(() => {}) - return null - }, + return + } + }, + } + ), () => { - firstAttemptClientController.abort() + finalClientController.abort() + serverPhasedStream.assertExhausted() } - ).catch(() => {}) - } catch (err: unknown) { - if (firstAttemptClientController.signal.aborted) { - // We aborted the render normally and can ignore this error + ) + } catch (err) { + if ( + isPrerenderInterruptedError(err) || + finalClientController.signal.aborted + ) { + // we don't have a root because the abort errored in the root. We can just ignore this error } else { - hadException = true - // We're going to retry to so we normally would suppress this error but - // when verbose logging is on we print it - if (process.env.__NEXT_VERBOSE_LOGGING) { - printDebugThrownValueForProspectiveRender(err, route) - } - } - } - - if (hadException || clientDynamicTracking.syncDynamicErrorWithStack) { - // We threw something unexpected in the initial render prior to aborting or - // we observed a sync abort. In either case we attempt a final render to see if - // the error was caused by module loading scope or some other transient cause - - // Reset tracking objects - clientDynamicTracking = createDynamicTrackingState(false) - dynamicValidation = createDynamicValidationState() - - const secondAttemptClientController = new AbortController() - const secondAttemptClientPrerenderStore: PrerenderStore = { - type: 'prerender', - phase: 'render', - implicitTags: [], - renderSignal: secondAttemptClientController.signal, - // For HTML Generation we don't need to track cache reads (RSC only) - cacheSignal: null, - // We expect the SSR render to complete in a single Task and need to be able to synchronously abort - // When you use APIs that are considered dynamic or synchronous IO. - controller: secondAttemptClientController, - // We do track dynamic access because searchParams and certain hooks can still be - // dynamic during SSR - dynamicTracking: clientDynamicTracking, - revalidate: INFINITE_CACHE, - expire: INFINITE_CACHE, - stale: INFINITE_CACHE, - tags: [], - validating: true, - } - - try { - await prerenderAndAbortInSequentialTasks( - async () => { - workUnitAsyncStorage - .run( - secondAttemptClientPrerenderStore, - prerender, - {}} - clientReferenceManifest={clientReferenceManifest} - ServerInsertedHTMLProvider={ServerInsertedHTMLProvider} - nonce={nonce} - />, - { - signal: secondAttemptClientController.signal, - onError: (err: unknown, errorInfo: ErrorInfo) => { - if ( - isPrerenderInterruptedError(err) || - secondAttemptClientController.signal.aborted - ) { - const componentStack: string | undefined = ( - errorInfo as any - ).componentStack - if ( - typeof componentStack === 'string' && - err instanceof Error - ) { - trackAllowedDynamicAccess( - route, - componentStack, - dynamicValidation, - serverDynamicTracking, - clientDynamicTracking - ) - } - } - }, - } - ) - .catch(() => {}) - return null - }, - () => { - secondAttemptClientController.abort() - } - ) - } catch (err) { - if (secondAttemptClientController.signal.aborted) { - // We aborted the render normally and can ignore this error - } else { - // We errored in the shell. This should also mean the normal render errored - // in the same place so we omit this log except when verbose mode is on. - if (process.env.__NEXT_VERBOSE_LOGGING) { - printDebugThrownValueForProspectiveRender(err, route) - } - } + // This error is something else and should bubble up + throw err } } @@ -2254,40 +2247,6 @@ async function spawnDynamicValidationInDev( resolveValidation() } -function asHaltedStream( - stream: ReadableStream, - signal: AbortSignal -) { - return new ReadableStream({ - start(controller: ReadableStreamDefaultController) { - const reader = stream.getReader() - function errorStream(err: unknown) { - controller.error(err) - reader.cancel(err) - } - function progressStream({ - done, - value, - }: ReadableStreamReadResult) { - if (done) { - // We don't actually close the outer stream because - // we might have aborted the inner one but we are simulating a halt - return - } else { - if (!signal.aborted) { - controller.enqueue(value) - reader.read().then(progressStream, errorStream) - } else { - // If the signal aborted we leave the stream open but no longer pull from the upstream - reader.cancel() - } - } - } - reader.read().then(progressStream, errorStream) - }, - }) -} - type PrerenderToStreamResult = { stream: ReadableStream digestErrorsMap: Map diff --git a/test/e2e/app-dir/dynamic-io-errors/fixtures/sync-client-search-with-fallback/app/page.tsx b/test/e2e/app-dir/dynamic-io-errors/fixtures/sync-client-search-with-fallback/app/page.tsx index 377ea07feadcf..342b4abb137aa 100644 --- a/test/e2e/app-dir/dynamic-io-errors/fixtures/sync-client-search-with-fallback/app/page.tsx +++ b/test/e2e/app-dir/dynamic-io-errors/fixtures/sync-client-search-with-fallback/app/page.tsx @@ -6,9 +6,7 @@ import { type UnsafeUnwrappedSearchParams } from 'next/server' import { IndirectionOne, IndirectionTwo, IndirectionThree } from './indirection' type SearchParams = { foo: string | string[] | undefined } -export default async function Page(props: { - searchParams: Promise -}) { +export default function Page(props: { searchParams: Promise }) { return ( <>

From ce8dd2d819fc1834e4b09c18ddce6a2c71a8ae4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Tue, 5 Nov 2024 01:34:10 +0900 Subject: [PATCH 19/28] feat(turbopack): Use direct import for tree shaking (#71704) ### What? I need to get the list of failing tests and diff the test result of this approach, which is the original idea of https://github.com/vercel/next.js/pull/71692, with the `__turbopack_original__` idea, which is the current idea behind #71692 ### Why? ### How? - Closes PACK-3307 --- .../src/tree_shake/graph.rs | 85 +++-- .../tests/tree-shaker/analyzer/1/output.md | 12 +- .../tests/tree-shaker/analyzer/2/output.md | 12 +- .../analyzer/amphtml-document/output.md | 96 +++--- .../tree-shaker/analyzer/app-route/output.md | 48 +-- .../tests/tree-shaker/analyzer/dce/output.md | 12 +- .../tree-shaker/analyzer/failed-2/output.md | 102 +++--- .../tree-shaker/analyzer/failed-3/output.md | 36 +- .../analyzer/ipc-evaluate/output.md | 12 +- .../tree-shaker/analyzer/ipc-index/output.md | 36 +- .../tree-shaker/analyzer/mui-sys/output.md | 264 +++++++------- .../tree-shaker/analyzer/nanoid/output.md | 44 +-- .../analyzer/next-response/output.md | 72 ++-- .../analyzer/nextjs-tracer/output.md | 24 +- .../tree-shaker/analyzer/node-fetch/output.md | 12 +- .../tree-shaker/analyzer/otel-core/output.md | 60 ++-- .../analyzer/route-handler/output.md | 12 +- .../analyzer/template-pages/output.md | 324 +++++++++--------- .../analyzer/test-config-1/output.md | 12 +- .../tree-shaker/analyzer/typeof-1/output.md | 36 +- 20 files changed, 670 insertions(+), 641 deletions(-) diff --git a/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs b/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs index b68a48ddea217..41331a1098e1a 100644 --- a/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs +++ b/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs @@ -109,8 +109,8 @@ pub(crate) struct ItemData { /// This value denotes the module specifier of the [ImportDecl] that declares this /// [ItemId]. /// - /// Used to specify the original import source of an `ImportBinding`. - pub binding_source: Option, + /// Used to optimize `ImportBinding`. + pub binding_source: Option<(Str, ImportSpecifier)>, } impl fmt::Debug for ItemData { @@ -501,14 +501,55 @@ impl DepGraph { // Instead of importing the import binding fragment, we import the original module. // In this way, we can preserve the import statement so that the other code analysis // can work. - let original_import_source = if dep_item_ids.len() == 1 { + if dep_item_ids.len() == 1 { let dep_item_id = &dep_item_ids[0]; let dep_item_data = data.get(dep_item_id).unwrap(); - dep_item_data.binding_source.clone() - } else { - None - }; + if let Some((module_specifier, import_specifier)) = + &dep_item_data.binding_source + { + // Preserve the order of the side effects by importing the + // side-effect-import fragment first. + + if let Some(import_dep) = importer.get(&module_specifier.value) { + if *import_dep != ix as u32 { + part_deps + .entry(ix as u32) + .or_default() + .push(PartId::Internal(*import_dep, true)); + + chunk.body.push(ModuleItem::ModuleDecl(ModuleDecl::Import( + ImportDecl { + span: DUMMY_SP, + specifiers: vec![], + src: Box::new(TURBOPACK_PART_IMPORT_SOURCE.into()), + type_only: false, + with: Some(Box::new(create_turbopack_part_id_assert( + PartId::Internal(*import_dep, true), + ))), + phase: Default::default(), + }, + ))); + } + } + + let specifiers = vec![import_specifier.clone()]; + + part_deps_done.insert(dep); + + chunk + .body + .push(ModuleItem::ModuleDecl(ModuleDecl::Import(ImportDecl { + span: DUMMY_SP, + specifiers, + src: Box::new(module_specifier.clone()), + type_only: false, + with: None, + phase: Default::default(), + }))); + continue; + } + } let specifiers = vec![ImportSpecifier::Named(ImportNamedSpecifier { span: DUMMY_SP, @@ -532,10 +573,9 @@ impl DepGraph { specifiers, src: Box::new(TURBOPACK_PART_IMPORT_SOURCE.into()), type_only: false, - with: Some(Box::new(add_original_import_source( - create_turbopack_part_id_assert(PartId::Internal(dep, false)), - original_import_source, - ))), + with: Some(Box::new(create_turbopack_part_id_assert(PartId::Internal( + dep, false, + )))), phase: Default::default(), }))); } @@ -1060,7 +1100,12 @@ impl DepGraph { specifiers: vec![s.clone()], ..item.clone() })), - binding_source: Some(*item.src.clone()), + binding_source: if item.with.is_none() { + // Optimize by directly binding to the source + Some((*item.src.clone(), s.clone())) + } else { + None + }, ..Default::default() }, ); @@ -1384,7 +1429,6 @@ impl DepGraph { } const ASSERT_CHUNK_KEY: &str = "__turbopack_part__"; -const ASSERT_ORIGINAL_IMPORT_SOURCE_KEY: &str = "__turbopack_original__"; #[derive(Debug, Clone)] pub(crate) enum PartId { @@ -1395,21 +1439,6 @@ pub(crate) enum PartId { Internal(u32, bool), } -pub(crate) fn add_original_import_source(mut item: ObjectLit, source: Option) -> ObjectLit { - if let Some(source) = source { - item.props - .push(PropOrSpread::Prop(Box::new(Prop::KeyValue(KeyValueProp { - key: PropName::Ident(IdentName::new( - ASSERT_ORIGINAL_IMPORT_SOURCE_KEY.into(), - DUMMY_SP, - )), - value: Box::new(Expr::Lit(Lit::Str(source))), - })))); - } - - item -} - pub(crate) fn create_turbopack_part_id_assert(dep: PartId) -> ObjectLit { // We can't use quote! as `with` is not standard yet ObjectLit { diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md index 13e42b2ea75a5..8dbc78fa2bf30 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md @@ -593,10 +593,10 @@ foobarCopy += "Unused"; import { d as foobar } from "__TURBOPACK_PART__" assert { __turbopack_part__: -7 }; -import { e as upper } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6, - __turbopack_original__: "module" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 }; +import { upper } from "module"; import "__TURBOPACK_PART__" assert { __turbopack_part__: 12 }; @@ -842,10 +842,10 @@ foobarCopy += "Unused"; import { d as foobar } from "__TURBOPACK_PART__" assert { __turbopack_part__: -7 }; -import { e as upper } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6, - __turbopack_original__: "module" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 }; +import { upper } from "module"; import "__TURBOPACK_PART__" assert { __turbopack_part__: 12 }; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md index df3232e50a5f5..75e32ebec9bce 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md @@ -632,10 +632,10 @@ foobarCopy += "Unused"; import { d as foobar } from "__TURBOPACK_PART__" assert { __turbopack_part__: -8 }; -import { f as upper } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: "module" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; +import { upper } from "module"; import "__TURBOPACK_PART__" assert { __turbopack_part__: 13 }; @@ -889,10 +889,10 @@ foobarCopy += "Unused"; import { d as foobar } from "__TURBOPACK_PART__" assert { __turbopack_part__: -8 }; -import { f as upper } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: "module" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; +import { upper } from "module"; import "__TURBOPACK_PART__" assert { __turbopack_part__: 13 }; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/amphtml-document/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/amphtml-document/output.md index 8b4b8d2eec88b..9f89d5810a29c 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/amphtml-document/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/amphtml-document/output.md @@ -437,38 +437,38 @@ export { NextScript as i } from "__TURBOPACK_VAR__" assert { ``` ## Part 12 ```js -import { e as Document } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: 'next/document' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; -import { c as _jsxs } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4, - __turbopack_original__: "react/jsx-runtime" +import Document from 'next/document'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 }; -import { d as _Fragment } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5, - __turbopack_original__: "react/jsx-runtime" +import { jsxs as _jsxs } from "react/jsx-runtime"; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 }; -import { b as _jsx } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3, - __turbopack_original__: "react/jsx-runtime" +import { Fragment as _Fragment } from "react/jsx-runtime"; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 }; -import { f as Html } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8, - __turbopack_original__: 'next/document' +import { jsx as _jsx } from "react/jsx-runtime"; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; -import { g as Head } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -9, - __turbopack_original__: 'next/document' +import { Html } from 'next/document'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; -import { h as Main } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10, - __turbopack_original__: 'next/document' +import { Head } from 'next/document'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; -import { i as NextScript } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -11, - __turbopack_original__: 'next/document' +import { Main } from 'next/document'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; +import { NextScript } from 'next/document'; class MyDocument extends Document { static async getInitialProps(ctx) { const initialProps = await Document.getInitialProps(ctx); @@ -667,38 +667,38 @@ export { NextScript as i } from "__TURBOPACK_VAR__" assert { ``` ## Part 12 ```js -import { e as Document } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: 'next/document' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; -import { c as _jsxs } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4, - __turbopack_original__: "react/jsx-runtime" +import Document from 'next/document'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 }; -import { d as _Fragment } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5, - __turbopack_original__: "react/jsx-runtime" +import { jsxs as _jsxs } from "react/jsx-runtime"; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 }; -import { b as _jsx } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3, - __turbopack_original__: "react/jsx-runtime" +import { Fragment as _Fragment } from "react/jsx-runtime"; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 }; -import { f as Html } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8, - __turbopack_original__: 'next/document' +import { jsx as _jsx } from "react/jsx-runtime"; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; -import { g as Head } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -9, - __turbopack_original__: 'next/document' +import { Html } from 'next/document'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; -import { h as Main } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10, - __turbopack_original__: 'next/document' +import { Head } from 'next/document'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; -import { i as NextScript } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -11, - __turbopack_original__: 'next/document' +import { Main } from 'next/document'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; +import { NextScript } from 'next/document'; class MyDocument extends Document { static async getInitialProps(ctx) { const initialProps = await Document.getInitialProps(ctx); diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/app-route/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/app-route/output.md index b31662410bcf7..012da73bc2ade 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/app-route/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/app-route/output.md @@ -524,18 +524,18 @@ export { userland as j } from "__TURBOPACK_VAR__" assert { ``` ## Part 15 ```js -import { g as AppRouteRouteModule } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8, - __turbopack_original__: '../../server/future/route-modules/app-route/module.compiled' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 }; -import { h as RouteKind } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10, - __turbopack_original__: '../../server/future/route-kind' +import { AppRouteRouteModule } from '../../server/future/route-modules/app-route/module.compiled'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 }; -import { j as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14, - __turbopack_original__: 'VAR_USERLAND' +import { RouteKind } from '../../server/future/route-kind'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 13 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 13 }; @@ -589,10 +589,10 @@ export { originalPathname as a } from "__TURBOPACK_VAR__" assert { import { f as workAsyncStorage } from "__TURBOPACK_PART__" assert { __turbopack_part__: -16 }; -import { i as _patchFetch } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12, - __turbopack_original__: '../../server/lib/patch-fetch' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 }; +import { patchFetch as _patchFetch } from '../../server/lib/patch-fetch'; import { e as serverHooks } from "__TURBOPACK_PART__" assert { __turbopack_part__: -16 }; @@ -803,18 +803,18 @@ export { userland as j } from "__TURBOPACK_VAR__" assert { ``` ## Part 15 ```js -import { g as AppRouteRouteModule } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8, - __turbopack_original__: '../../server/future/route-modules/app-route/module.compiled' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 }; -import { h as RouteKind } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10, - __turbopack_original__: '../../server/future/route-kind' +import { AppRouteRouteModule } from '../../server/future/route-modules/app-route/module.compiled'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 }; -import { j as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14, - __turbopack_original__: 'VAR_USERLAND' +import { RouteKind } from '../../server/future/route-kind'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 13 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 13 }; @@ -865,10 +865,10 @@ export { originalPathname as a } from "__TURBOPACK_VAR__" assert { import { f as workAsyncStorage } from "__TURBOPACK_PART__" assert { __turbopack_part__: -16 }; -import { i as _patchFetch } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12, - __turbopack_original__: '../../server/lib/patch-fetch' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 }; +import { patchFetch as _patchFetch } from '../../server/lib/patch-fetch'; import { e as serverHooks } from "__TURBOPACK_PART__" assert { __turbopack_part__: -16 }; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/dce/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/dce/output.md index e0163f514ef15..b6a348cd811f4 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/dce/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/dce/output.md @@ -125,10 +125,10 @@ export { baz as a } from "__TURBOPACK_VAR__" assert { ``` ## Part 3 ```js -import { a as baz } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -2, - __turbopack_original__: './module' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 1 }; +import { baz } from './module'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 1 }; @@ -186,10 +186,10 @@ export { baz as a } from "__TURBOPACK_VAR__" assert { ``` ## Part 3 ```js -import { a as baz } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -2, - __turbopack_original__: './module' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 1 }; +import { baz } from './module'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 1 }; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-2/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-2/output.md index 1314293d20303..cb4ab688bceca 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-2/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-2/output.md @@ -794,10 +794,10 @@ export { getPathname as l } from "__TURBOPACK_VAR__" assert { ``` ## Part 17 ```js -import { i as React } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10, - __turbopack_original__: 'react' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 }; +import React from 'react'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 15 }; @@ -851,18 +851,18 @@ export { createPrerenderState as c } from "__TURBOPACK_VAR__" assert { ``` ## Part 19 ```js -import { j as DynamicServerError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12, - __turbopack_original__: '../../client/components/hooks-server-context' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 }; -import { l as getPathname } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -16, - __turbopack_original__: '../../lib/url' +import { DynamicServerError } from '../../client/components/hooks-server-context'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 15 }; -import { k as StaticGenBailoutError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14, - __turbopack_original__: '../../client/components/static-generation-bailout' +import { getPathname } from '../../lib/url'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 13 }; +import { StaticGenBailoutError } from '../../client/components/static-generation-bailout'; import { n as postponeWithTracking } from "__TURBOPACK_PART__" assert { __turbopack_part__: -17 }; @@ -891,18 +891,18 @@ export { markCurrentScopeAsDynamic as e } from "__TURBOPACK_VAR__" assert { ``` ## Part 20 ```js -import { j as DynamicServerError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12, - __turbopack_original__: '../../client/components/hooks-server-context' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 }; -import { l as getPathname } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -16, - __turbopack_original__: '../../lib/url' +import { DynamicServerError } from '../../client/components/hooks-server-context'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 15 }; -import { k as StaticGenBailoutError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14, - __turbopack_original__: '../../client/components/static-generation-bailout' +import { getPathname } from '../../lib/url'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 13 }; +import { StaticGenBailoutError } from '../../client/components/static-generation-bailout'; import { n as postponeWithTracking } from "__TURBOPACK_PART__" assert { __turbopack_part__: -17 }; @@ -992,10 +992,10 @@ export { formatDynamicAPIAccesses as d } from "__TURBOPACK_VAR__" assert { ``` ## Part 25 ```js -import { i as React } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10, - __turbopack_original__: 'react' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 }; +import React from 'react'; import { o as assertPostpone } from "__TURBOPACK_PART__" assert { __turbopack_part__: -17 }; @@ -1232,10 +1232,10 @@ export { getPathname as l } from "__TURBOPACK_VAR__" assert { ``` ## Part 17 ```js -import { i as React } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10, - __turbopack_original__: 'react' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 }; +import React from 'react'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 15 }; @@ -1260,18 +1260,18 @@ export { createPrerenderState as c } from "__TURBOPACK_VAR__" assert { ``` ## Part 19 ```js -import { j as DynamicServerError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12, - __turbopack_original__: '../../client/components/hooks-server-context' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 }; -import { l as getPathname } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -16, - __turbopack_original__: '../../lib/url' +import { DynamicServerError } from '../../client/components/hooks-server-context'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 15 }; -import { k as StaticGenBailoutError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14, - __turbopack_original__: '../../client/components/static-generation-bailout' +import { getPathname } from '../../lib/url'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 13 }; +import { StaticGenBailoutError } from '../../client/components/static-generation-bailout'; import { n as postponeWithTracking } from "__TURBOPACK_PART__" assert { __turbopack_part__: -23 }; @@ -1300,18 +1300,18 @@ export { markCurrentScopeAsDynamic as e } from "__TURBOPACK_VAR__" assert { ``` ## Part 20 ```js -import { j as DynamicServerError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12, - __turbopack_original__: '../../client/components/hooks-server-context' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 }; -import { l as getPathname } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -16, - __turbopack_original__: '../../lib/url' +import { DynamicServerError } from '../../client/components/hooks-server-context'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 15 }; -import { k as StaticGenBailoutError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14, - __turbopack_original__: '../../client/components/static-generation-bailout' +import { getPathname } from '../../lib/url'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 13 }; +import { StaticGenBailoutError } from '../../client/components/static-generation-bailout'; import { n as postponeWithTracking } from "__TURBOPACK_PART__" assert { __turbopack_part__: -23 }; @@ -1367,10 +1367,10 @@ export { trackDynamicFetch as g } from "__TURBOPACK_VAR__" assert { ``` ## Part 23 ```js -import { i as React } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10, - __turbopack_original__: 'react' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 }; +import React from 'react'; import { o as assertPostpone } from "__TURBOPACK_PART__" assert { __turbopack_part__: -26 }; @@ -1442,10 +1442,10 @@ export { assertPostpone as o } from "__TURBOPACK_VAR__" assert { ``` ## Part 27 ```js -import { i as React } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10, - __turbopack_original__: 'react' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 }; +import React from 'react'; import { o as assertPostpone } from "__TURBOPACK_PART__" assert { __turbopack_part__: -26 }; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-3/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-3/output.md index 33aac24f37d4f..b9cba87c40340 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-3/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-3/output.md @@ -1225,14 +1225,14 @@ export { getProperError as e } from "__TURBOPACK_VAR__" assert { ``` ## Part 9 ```js -import { d as parseStackTrace } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6, - __turbopack_original__: "../compiled/stacktrace-parser" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 }; -import { e as getProperError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8, - __turbopack_original__: "./error" +import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 }; +import { getProperError } from "./error"; function structuredError(e) { e = getProperError(e); return { @@ -1251,10 +1251,10 @@ export { structuredError as b } from "__TURBOPACK_VAR__" assert { import { b as structuredError } from "__TURBOPACK_PART__" assert { __turbopack_part__: -9 }; -import { c as createConnection } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4, - __turbopack_original__: "node:net" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 }; +import { createConnection } from "node:net"; function createIpc(port) { const socket = createConnection(port, "127.0.0.1"); const packetQueue = []; @@ -1976,14 +1976,14 @@ export { getProperError as e } from "__TURBOPACK_VAR__" assert { ``` ## Part 9 ```js -import { d as parseStackTrace } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6, - __turbopack_original__: "../compiled/stacktrace-parser" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 }; -import { e as getProperError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8, - __turbopack_original__: "./error" +import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 }; +import { getProperError } from "./error"; function structuredError(e) { e = getProperError(e); return { @@ -2002,10 +2002,10 @@ export { structuredError as b } from "__TURBOPACK_VAR__" assert { import { b as structuredError } from "__TURBOPACK_PART__" assert { __turbopack_part__: -9 }; -import { c as createConnection } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4, - __turbopack_original__: "node:net" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 }; +import { createConnection } from "node:net"; function createIpc(port) { const socket = createConnection(port, "127.0.0.1"); const packetQueue = []; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-evaluate/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-evaluate/output.md index 7393de21722be..21008d9ecc201 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-evaluate/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-evaluate/output.md @@ -278,10 +278,10 @@ export { IPC as b } from "__TURBOPACK_VAR__" assert { ``` ## Part 4 ```js -import { b as IPC } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3, - __turbopack_original__: "./index" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 }; +import { IPC } from "./index"; const ipc = IPC; export { ipc as c } from "__TURBOPACK_VAR__" assert { __turbopack_var__: true @@ -466,10 +466,10 @@ export { IPC as b } from "__TURBOPACK_VAR__" assert { ``` ## Part 4 ```js -import { b as IPC } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3, - __turbopack_original__: "./index" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 }; +import { IPC } from "./index"; const ipc = IPC; export { ipc as c } from "__TURBOPACK_VAR__" assert { __turbopack_var__: true diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/output.md index 33aac24f37d4f..b9cba87c40340 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/output.md @@ -1225,14 +1225,14 @@ export { getProperError as e } from "__TURBOPACK_VAR__" assert { ``` ## Part 9 ```js -import { d as parseStackTrace } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6, - __turbopack_original__: "../compiled/stacktrace-parser" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 }; -import { e as getProperError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8, - __turbopack_original__: "./error" +import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 }; +import { getProperError } from "./error"; function structuredError(e) { e = getProperError(e); return { @@ -1251,10 +1251,10 @@ export { structuredError as b } from "__TURBOPACK_VAR__" assert { import { b as structuredError } from "__TURBOPACK_PART__" assert { __turbopack_part__: -9 }; -import { c as createConnection } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4, - __turbopack_original__: "node:net" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 }; +import { createConnection } from "node:net"; function createIpc(port) { const socket = createConnection(port, "127.0.0.1"); const packetQueue = []; @@ -1976,14 +1976,14 @@ export { getProperError as e } from "__TURBOPACK_VAR__" assert { ``` ## Part 9 ```js -import { d as parseStackTrace } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6, - __turbopack_original__: "../compiled/stacktrace-parser" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 }; -import { e as getProperError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8, - __turbopack_original__: "./error" +import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 }; +import { getProperError } from "./error"; function structuredError(e) { e = getProperError(e); return { @@ -2002,10 +2002,10 @@ export { structuredError as b } from "__TURBOPACK_VAR__" assert { import { b as structuredError } from "__TURBOPACK_PART__" assert { __turbopack_part__: -9 }; -import { c as createConnection } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4, - __turbopack_original__: "node:net" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 }; +import { createConnection } from "node:net"; function createIpc(port) { const socket = createConnection(port, "127.0.0.1"); const packetQueue = []; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/mui-sys/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/mui-sys/output.md index 9cec84aee04df..100f739fbad63 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/mui-sys/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/mui-sys/output.md @@ -1299,18 +1299,18 @@ export { responsivePropType as s } from "__TURBOPACK_VAR__" assert { ``` ## Part 25 ```js -import { p as createUnaryUnit } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -19, - __turbopack_original__: './spacing' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 18 }; -import { q as getValue } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20, - __turbopack_original__: './spacing' +import { createUnaryUnit } from './spacing'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 18 }; -import { r as handleBreakpoints } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22, - __turbopack_original__: './breakpoints' +import { getValue } from './spacing'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 21 }; +import { handleBreakpoints } from './breakpoints'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 23 }; @@ -1334,10 +1334,10 @@ export { gap as c } from "__TURBOPACK_VAR__" assert { import { c as gap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -25 }; -import { s as responsivePropType } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: './responsivePropType' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import responsivePropType from './responsivePropType'; gap.propTypes = process.env.NODE_ENV !== 'production' ? { gap: responsivePropType } : {}; @@ -1358,18 +1358,18 @@ gap.filterProps = [ ``` ## Part 28 ```js -import { p as createUnaryUnit } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -19, - __turbopack_original__: './spacing' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 18 }; -import { q as getValue } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20, - __turbopack_original__: './spacing' +import { createUnaryUnit } from './spacing'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 18 }; -import { r as handleBreakpoints } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22, - __turbopack_original__: './breakpoints' +import { getValue } from './spacing'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 21 }; +import { handleBreakpoints } from './breakpoints'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 26 }; @@ -1393,10 +1393,10 @@ export { columnGap as b } from "__TURBOPACK_VAR__" assert { import { b as columnGap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -28 }; -import { s as responsivePropType } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: './responsivePropType' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import responsivePropType from './responsivePropType'; columnGap.propTypes = process.env.NODE_ENV !== 'production' ? { columnGap: responsivePropType } : {}; @@ -1417,18 +1417,18 @@ columnGap.filterProps = [ ``` ## Part 31 ```js -import { p as createUnaryUnit } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -19, - __turbopack_original__: './spacing' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 18 }; -import { q as getValue } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20, - __turbopack_original__: './spacing' +import { createUnaryUnit } from './spacing'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 18 }; -import { r as handleBreakpoints } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22, - __turbopack_original__: './breakpoints' +import { getValue } from './spacing'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 21 }; +import { handleBreakpoints } from './breakpoints'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 29 }; @@ -1452,10 +1452,10 @@ export { rowGap as m } from "__TURBOPACK_VAR__" assert { import { m as rowGap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -31 }; -import { s as responsivePropType } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: './responsivePropType' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import responsivePropType from './responsivePropType'; rowGap.propTypes = process.env.NODE_ENV !== 'production' ? { rowGap: responsivePropType } : {}; @@ -1476,10 +1476,10 @@ rowGap.filterProps = [ ``` ## Part 34 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 32 }; @@ -1493,10 +1493,10 @@ export { gridColumn as h } from "__TURBOPACK_VAR__" assert { ``` ## Part 35 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 34 }; @@ -1510,10 +1510,10 @@ export { gridRow as i } from "__TURBOPACK_VAR__" assert { ``` ## Part 36 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 35 }; @@ -1527,10 +1527,10 @@ export { gridAutoFlow as f } from "__TURBOPACK_VAR__" assert { ``` ## Part 37 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 36 }; @@ -1544,10 +1544,10 @@ export { gridAutoColumns as e } from "__TURBOPACK_VAR__" assert { ``` ## Part 38 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 37 }; @@ -1561,10 +1561,10 @@ export { gridAutoRows as g } from "__TURBOPACK_VAR__" assert { ``` ## Part 39 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 38 }; @@ -1578,10 +1578,10 @@ export { gridTemplateColumns as k } from "__TURBOPACK_VAR__" assert { ``` ## Part 40 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 39 }; @@ -1595,10 +1595,10 @@ export { gridTemplateRows as l } from "__TURBOPACK_VAR__" assert { ``` ## Part 41 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 40 }; @@ -1612,10 +1612,10 @@ export { gridTemplateAreas as j } from "__TURBOPACK_VAR__" assert { ``` ## Part 42 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 41 }; @@ -1629,10 +1629,10 @@ export { gridArea as d } from "__TURBOPACK_VAR__" assert { ``` ## Part 43 ```js -import { o as compose } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -17, - __turbopack_original__: './compose' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 16 }; +import compose from './compose'; import { c as gap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -25 }; @@ -2022,18 +2022,18 @@ export { responsivePropType as s } from "__TURBOPACK_VAR__" assert { ``` ## Part 25 ```js -import { p as createUnaryUnit } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -19, - __turbopack_original__: './spacing' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 18 }; -import { q as getValue } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20, - __turbopack_original__: './spacing' +import { createUnaryUnit } from './spacing'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 18 }; -import { r as handleBreakpoints } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22, - __turbopack_original__: './breakpoints' +import { getValue } from './spacing'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 21 }; +import { handleBreakpoints } from './breakpoints'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 23 }; @@ -2057,10 +2057,10 @@ export { gap as c } from "__TURBOPACK_VAR__" assert { import { c as gap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -25 }; -import { s as responsivePropType } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: './responsivePropType' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import responsivePropType from './responsivePropType'; gap.propTypes = process.env.NODE_ENV !== 'production' ? { gap: responsivePropType } : {}; @@ -2081,18 +2081,18 @@ gap.filterProps = [ ``` ## Part 28 ```js -import { p as createUnaryUnit } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -19, - __turbopack_original__: './spacing' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 18 }; -import { q as getValue } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20, - __turbopack_original__: './spacing' +import { createUnaryUnit } from './spacing'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 18 }; -import { r as handleBreakpoints } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22, - __turbopack_original__: './breakpoints' +import { getValue } from './spacing'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 21 }; +import { handleBreakpoints } from './breakpoints'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 26 }; @@ -2116,10 +2116,10 @@ export { columnGap as b } from "__TURBOPACK_VAR__" assert { import { b as columnGap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -28 }; -import { s as responsivePropType } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: './responsivePropType' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import responsivePropType from './responsivePropType'; columnGap.propTypes = process.env.NODE_ENV !== 'production' ? { columnGap: responsivePropType } : {}; @@ -2140,18 +2140,18 @@ columnGap.filterProps = [ ``` ## Part 31 ```js -import { p as createUnaryUnit } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -19, - __turbopack_original__: './spacing' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 18 }; -import { q as getValue } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20, - __turbopack_original__: './spacing' +import { createUnaryUnit } from './spacing'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 18 }; -import { r as handleBreakpoints } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22, - __turbopack_original__: './breakpoints' +import { getValue } from './spacing'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 21 }; +import { handleBreakpoints } from './breakpoints'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 29 }; @@ -2175,10 +2175,10 @@ export { rowGap as m } from "__TURBOPACK_VAR__" assert { import { m as rowGap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -31 }; -import { s as responsivePropType } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: './responsivePropType' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import responsivePropType from './responsivePropType'; rowGap.propTypes = process.env.NODE_ENV !== 'production' ? { rowGap: responsivePropType } : {}; @@ -2199,10 +2199,10 @@ rowGap.filterProps = [ ``` ## Part 34 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 32 }; @@ -2216,10 +2216,10 @@ export { gridColumn as h } from "__TURBOPACK_VAR__" assert { ``` ## Part 35 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 34 }; @@ -2233,10 +2233,10 @@ export { gridRow as i } from "__TURBOPACK_VAR__" assert { ``` ## Part 36 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 35 }; @@ -2250,10 +2250,10 @@ export { gridAutoFlow as f } from "__TURBOPACK_VAR__" assert { ``` ## Part 37 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 36 }; @@ -2267,10 +2267,10 @@ export { gridAutoColumns as e } from "__TURBOPACK_VAR__" assert { ``` ## Part 38 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 37 }; @@ -2284,10 +2284,10 @@ export { gridAutoRows as g } from "__TURBOPACK_VAR__" assert { ``` ## Part 39 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 38 }; @@ -2301,10 +2301,10 @@ export { gridTemplateColumns as k } from "__TURBOPACK_VAR__" assert { ``` ## Part 40 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 39 }; @@ -2318,10 +2318,10 @@ export { gridTemplateRows as l } from "__TURBOPACK_VAR__" assert { ``` ## Part 41 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 40 }; @@ -2335,10 +2335,10 @@ export { gridTemplateAreas as j } from "__TURBOPACK_VAR__" assert { ``` ## Part 42 ```js -import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15, - __turbopack_original__: './style' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 14 }; +import style from './style'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 41 }; @@ -2352,10 +2352,10 @@ export { gridArea as d } from "__TURBOPACK_VAR__" assert { ``` ## Part 43 ```js -import { o as compose } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -17, - __turbopack_original__: './compose' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 16 }; +import compose from './compose'; import { c as gap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -25 }; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nanoid/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nanoid/output.md index 54c4ac7fd0ecd..8d1d2a02c32c9 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nanoid/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nanoid/output.md @@ -459,10 +459,10 @@ export { random }; ``` ## Part 5 ```js -import { e as urlAlphabet } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -9, - __turbopack_original__: './url-alphabet/index.js' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 }; +import { urlAlphabet } from './url-alphabet/index.js'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 17 }; @@ -480,7 +480,7 @@ import "__TURBOPACK_PART__" assert { __turbopack_part__: 6 }; import crypto from 'crypto'; -export { crypto as f } from "__TURBOPACK_VAR__" assert { +export { crypto as e } from "__TURBOPACK_VAR__" assert { __turbopack_var__: true }; @@ -499,7 +499,7 @@ import "__TURBOPACK_PART__" assert { __turbopack_part__: 8 }; import { urlAlphabet } from './url-alphabet/index.js'; -export { urlAlphabet as e } from "__TURBOPACK_VAR__" assert { +export { urlAlphabet as f } from "__TURBOPACK_VAR__" assert { __turbopack_var__: true }; @@ -536,10 +536,10 @@ import { h as pool } from "__TURBOPACK_PART__" assert { import { g as POOL_SIZE_MULTIPLIER } from "__TURBOPACK_PART__" assert { __turbopack_part__: -10 }; -import { f as crypto } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: 'crypto' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; +import crypto from 'crypto'; import { i as poolOffset } from "__TURBOPACK_PART__" assert { __turbopack_part__: -12 }; @@ -629,10 +629,10 @@ import { j as fillPool } from "__TURBOPACK_PART__" assert { import { i as poolOffset } from "__TURBOPACK_PART__" assert { __turbopack_part__: -12 }; -import { e as urlAlphabet } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -9, - __turbopack_original__: './url-alphabet/index.js' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 }; +import { urlAlphabet } from './url-alphabet/index.js'; import { h as pool } from "__TURBOPACK_PART__" assert { __turbopack_part__: -11 }; @@ -747,10 +747,10 @@ export { random }; ``` ## Part 5 ```js -import { e as urlAlphabet } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -9, - __turbopack_original__: './url-alphabet/index.js' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 }; +import { urlAlphabet } from './url-alphabet/index.js'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 17 }; @@ -768,7 +768,7 @@ import "__TURBOPACK_PART__" assert { __turbopack_part__: 6 }; import crypto from 'crypto'; -export { crypto as f } from "__TURBOPACK_VAR__" assert { +export { crypto as e } from "__TURBOPACK_VAR__" assert { __turbopack_var__: true }; @@ -787,7 +787,7 @@ import "__TURBOPACK_PART__" assert { __turbopack_part__: 8 }; import { urlAlphabet } from './url-alphabet/index.js'; -export { urlAlphabet as e } from "__TURBOPACK_VAR__" assert { +export { urlAlphabet as f } from "__TURBOPACK_VAR__" assert { __turbopack_var__: true }; @@ -824,10 +824,10 @@ import { h as pool } from "__TURBOPACK_PART__" assert { import { g as POOL_SIZE_MULTIPLIER } from "__TURBOPACK_PART__" assert { __turbopack_part__: -10 }; -import { f as crypto } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: 'crypto' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; +import crypto from 'crypto'; import { i as poolOffset } from "__TURBOPACK_PART__" assert { __turbopack_part__: -12 }; @@ -917,10 +917,10 @@ import { j as fillPool } from "__TURBOPACK_PART__" assert { import { i as poolOffset } from "__TURBOPACK_PART__" assert { __turbopack_part__: -12 }; -import { e as urlAlphabet } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -9, - __turbopack_original__: './url-alphabet/index.js' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 }; +import { urlAlphabet } from './url-alphabet/index.js'; import { h as pool } from "__TURBOPACK_PART__" assert { __turbopack_part__: -11 }; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/next-response/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/next-response/output.md index fe6bbe013a70c..8ac16378fb8d2 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/next-response/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/next-response/output.md @@ -629,36 +629,36 @@ export { handleMiddlewareField as j } from "__TURBOPACK_VAR__" assert { ``` ## Part 16 ```js -import { g as ResponseCookies } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12, - __turbopack_original__: './cookies' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 }; -import { b as stringifyCookie } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3, - __turbopack_original__: '../../web/spec-extension/cookies' +import { ResponseCookies } from './cookies'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 }; +import { stringifyCookie } from '../../web/spec-extension/cookies'; import { j as handleMiddlewareField } from "__TURBOPACK_PART__" assert { __turbopack_part__: -15 }; -import { f as ReflectAdapter } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10, - __turbopack_original__: './adapters/reflect' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 }; +import { ReflectAdapter } from './adapters/reflect'; import { h as INTERNALS } from "__TURBOPACK_PART__" assert { __turbopack_part__: -13 }; -import { c as NextURL } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5, - __turbopack_original__: '../next-url' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 }; -import { d as toNodeOutgoingHttpHeaders } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: '../utils' +import { NextURL } from '../next-url'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; -import { e as validateURL } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8, - __turbopack_original__: '../utils' +import { toNodeOutgoingHttpHeaders } from '../utils'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; +import { validateURL } from '../utils'; import { i as REDIRECTS } from "__TURBOPACK_PART__" assert { __turbopack_part__: -14 }; @@ -954,36 +954,36 @@ export { handleMiddlewareField as j } from "__TURBOPACK_VAR__" assert { ``` ## Part 16 ```js -import { g as ResponseCookies } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12, - __turbopack_original__: './cookies' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 }; -import { b as stringifyCookie } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3, - __turbopack_original__: '../../web/spec-extension/cookies' +import { ResponseCookies } from './cookies'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 }; +import { stringifyCookie } from '../../web/spec-extension/cookies'; import { j as handleMiddlewareField } from "__TURBOPACK_PART__" assert { __turbopack_part__: -15 }; -import { f as ReflectAdapter } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10, - __turbopack_original__: './adapters/reflect' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 }; +import { ReflectAdapter } from './adapters/reflect'; import { h as INTERNALS } from "__TURBOPACK_PART__" assert { __turbopack_part__: -13 }; -import { c as NextURL } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5, - __turbopack_original__: '../next-url' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 }; -import { d as toNodeOutgoingHttpHeaders } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: '../utils' +import { NextURL } from '../next-url'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; -import { e as validateURL } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8, - __turbopack_original__: '../utils' +import { toNodeOutgoingHttpHeaders } from '../utils'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; +import { validateURL } from '../utils'; import { i as REDIRECTS } from "__TURBOPACK_PART__" assert { __turbopack_part__: -14 }; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nextjs-tracer/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nextjs-tracer/output.md index a9f0276da60d3..65d218c4173fc 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nextjs-tracer/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nextjs-tracer/output.md @@ -964,10 +964,10 @@ import { j as propagation } from "__TURBOPACK_PART__" assert { import { s as clientTraceDataSetter } from "__TURBOPACK_PART__" assert { __turbopack_part__: -20 }; -import { g as NextVanillaSpanAllowlist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8, - __turbopack_original__: './constants' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; +import { NextVanillaSpanAllowlist } from './constants'; import { l as ROOT_CONTEXT } from "__TURBOPACK_PART__" assert { __turbopack_part__: -11 }; @@ -980,10 +980,10 @@ import { p as rootSpanIdKey } from "__TURBOPACK_PART__" assert { import { o as rootSpanAttributesStore } from "__TURBOPACK_PART__" assert { __turbopack_part__: -16 }; -import { f as LogSpanAllowList } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: './constants' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; +import { LogSpanAllowList } from './constants'; import { n as closeSpanWithError } from "__TURBOPACK_PART__" assert { __turbopack_part__: -15 }; @@ -1481,10 +1481,10 @@ import { j as propagation } from "__TURBOPACK_PART__" assert { import { s as clientTraceDataSetter } from "__TURBOPACK_PART__" assert { __turbopack_part__: -20 }; -import { g as NextVanillaSpanAllowlist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8, - __turbopack_original__: './constants' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; +import { NextVanillaSpanAllowlist } from './constants'; import { l as ROOT_CONTEXT } from "__TURBOPACK_PART__" assert { __turbopack_part__: -11 }; @@ -1497,10 +1497,10 @@ import { p as rootSpanIdKey } from "__TURBOPACK_PART__" assert { import { o as rootSpanAttributesStore } from "__TURBOPACK_PART__" assert { __turbopack_part__: -16 }; -import { f as LogSpanAllowList } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: './constants' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; +import { LogSpanAllowList } from './constants'; import { n as closeSpanWithError } from "__TURBOPACK_PART__" assert { __turbopack_part__: -15 }; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/node-fetch/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/node-fetch/output.md index f8545f62488f9..e300c3ef45d82 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/node-fetch/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/node-fetch/output.md @@ -190,10 +190,10 @@ export { Stream as b } from "__TURBOPACK_VAR__" assert { ``` ## Part 4 ```js -import { b as Stream } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3, - __turbopack_original__: 'node:stream' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 }; +import Stream from 'node:stream'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 2 }; @@ -288,10 +288,10 @@ export { Stream as b } from "__TURBOPACK_VAR__" assert { ``` ## Part 4 ```js -import { b as Stream } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3, - __turbopack_original__: 'node:stream' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 }; +import Stream from 'node:stream'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 2 }; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/otel-core/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/otel-core/output.md index e8c30d34915d3..b1936992abf5e 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/otel-core/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/otel-core/output.md @@ -282,18 +282,18 @@ export { _globalThis as e } from "__TURBOPACK_VAR__" assert { ``` ## Part 8 ```js -import { c as DEFAULT_ENVIRONMENT } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4, - __turbopack_original__: '../../utils/environment' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 }; -import { d as parseEnvironment } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5, - __turbopack_original__: '../../utils/environment' +import { DEFAULT_ENVIRONMENT } from '../../utils/environment'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 }; -import { e as _globalThis } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: './globalThis' +import { parseEnvironment } from '../../utils/environment'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; +import { _globalThis } from './globalThis'; function getEnv() { var globalEnv = parseEnvironment(_globalThis); return Object.assign({}, DEFAULT_ENVIRONMENT, globalEnv); @@ -305,14 +305,14 @@ export { getEnv as a } from "__TURBOPACK_VAR__" assert { ``` ## Part 9 ```js -import { e as _globalThis } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: './globalThis' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; -import { d as parseEnvironment } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5, - __turbopack_original__: '../../utils/environment' +import { _globalThis } from './globalThis'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 }; +import { parseEnvironment } from '../../utils/environment'; function getEnvWithoutDefaults() { return parseEnvironment(_globalThis); } @@ -428,18 +428,18 @@ export { _globalThis as e } from "__TURBOPACK_VAR__" assert { ``` ## Part 8 ```js -import { c as DEFAULT_ENVIRONMENT } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4, - __turbopack_original__: '../../utils/environment' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 }; -import { d as parseEnvironment } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5, - __turbopack_original__: '../../utils/environment' +import { DEFAULT_ENVIRONMENT } from '../../utils/environment'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 }; -import { e as _globalThis } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: './globalThis' +import { parseEnvironment } from '../../utils/environment'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; +import { _globalThis } from './globalThis'; function getEnv() { var globalEnv = parseEnvironment(_globalThis); return Object.assign({}, DEFAULT_ENVIRONMENT, globalEnv); @@ -451,14 +451,14 @@ export { getEnv as a } from "__TURBOPACK_VAR__" assert { ``` ## Part 9 ```js -import { e as _globalThis } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: './globalThis' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; -import { d as parseEnvironment } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5, - __turbopack_original__: '../../utils/environment' +import { _globalThis } from './globalThis'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 }; +import { parseEnvironment } from '../../utils/environment'; function getEnvWithoutDefaults() { return parseEnvironment(_globalThis); } diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/route-handler/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/route-handler/output.md index 7f6b54a7f6403..7c80e6a414aef 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/route-handler/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/route-handler/output.md @@ -187,10 +187,10 @@ export { NextResponse as c } from "__TURBOPACK_VAR__" assert { ``` ## Part 5 ```js -import { c as NextResponse } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4, - __turbopack_original__: "next/server" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 }; +import { NextResponse } from "next/server"; const GET = (req)=>{ return NextResponse.json({ pathname: req.nextUrl.pathname @@ -286,10 +286,10 @@ export { NextResponse as c } from "__TURBOPACK_VAR__" assert { ``` ## Part 5 ```js -import { c as NextResponse } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4, - __turbopack_original__: "next/server" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 }; +import { NextResponse } from "next/server"; const GET = (req)=>{ return NextResponse.json({ pathname: req.nextUrl.pathname diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/template-pages/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/template-pages/output.md index b424299d9ea9d..4e207fe99b0d3 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/template-pages/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/template-pages/output.md @@ -1031,14 +1031,14 @@ export { userland as r } from "__TURBOPACK_VAR__" assert { ``` ## Part 25 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 23 }; @@ -1050,14 +1050,14 @@ export { __TURBOPACK__default__export__ as a } from "__TURBOPACK_VAR__" assert { ``` ## Part 26 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 25 }; @@ -1069,14 +1069,14 @@ export { getStaticProps as e } from "__TURBOPACK_VAR__" assert { ``` ## Part 27 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 26 }; @@ -1088,14 +1088,14 @@ export { getStaticPaths as d } from "__TURBOPACK_VAR__" assert { ``` ## Part 28 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 27 }; @@ -1107,14 +1107,14 @@ export { getServerSideProps as c } from "__TURBOPACK_VAR__" assert { ``` ## Part 29 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 28 }; @@ -1126,14 +1126,14 @@ export { config as b } from "__TURBOPACK_VAR__" assert { ``` ## Part 30 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 29 }; @@ -1145,14 +1145,14 @@ export { reportWebVitals as f } from "__TURBOPACK_VAR__" assert { ``` ## Part 31 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 30 }; @@ -1164,14 +1164,14 @@ export { unstable_getStaticProps as l } from "__TURBOPACK_VAR__" assert { ``` ## Part 32 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 31 }; @@ -1183,14 +1183,14 @@ export { unstable_getStaticPaths as k } from "__TURBOPACK_VAR__" assert { ``` ## Part 33 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 32 }; @@ -1202,14 +1202,14 @@ export { unstable_getStaticParams as j } from "__TURBOPACK_VAR__" assert { ``` ## Part 34 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 33 }; @@ -1221,14 +1221,14 @@ export { unstable_getServerProps as h } from "__TURBOPACK_VAR__" assert { ``` ## Part 35 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 34 }; @@ -1240,26 +1240,26 @@ export { unstable_getServerSideProps as i } from "__TURBOPACK_VAR__" assert { ``` ## Part 36 ```js -import { m as PagesRouteModule } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14, - __turbopack_original__: '../../server/future/route-modules/pages/module.compiled' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 13 }; -import { n as RouteKind } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -16, - __turbopack_original__: '../../server/future/route-kind' +import { PagesRouteModule } from '../../server/future/route-modules/pages/module.compiled'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 15 }; -import { q as App } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22, - __turbopack_original__: 'VAR_MODULE_APP' +import { RouteKind } from '../../server/future/route-kind'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 21 }; -import { p as Document } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20, - __turbopack_original__: 'VAR_MODULE_DOCUMENT' +import App from 'VAR_MODULE_APP'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 19 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import Document from 'VAR_MODULE_DOCUMENT'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 35 }; @@ -1594,14 +1594,14 @@ export { userland as r } from "__TURBOPACK_VAR__" assert { ``` ## Part 25 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 23 }; @@ -1613,14 +1613,14 @@ export { __TURBOPACK__default__export__ as a } from "__TURBOPACK_VAR__" assert { ``` ## Part 26 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 25 }; @@ -1632,14 +1632,14 @@ export { getStaticProps as e } from "__TURBOPACK_VAR__" assert { ``` ## Part 27 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 26 }; @@ -1651,14 +1651,14 @@ export { getStaticPaths as d } from "__TURBOPACK_VAR__" assert { ``` ## Part 28 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 27 }; @@ -1670,14 +1670,14 @@ export { getServerSideProps as c } from "__TURBOPACK_VAR__" assert { ``` ## Part 29 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 28 }; @@ -1689,14 +1689,14 @@ export { config as b } from "__TURBOPACK_VAR__" assert { ``` ## Part 30 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 29 }; @@ -1708,14 +1708,14 @@ export { reportWebVitals as f } from "__TURBOPACK_VAR__" assert { ``` ## Part 31 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 30 }; @@ -1727,14 +1727,14 @@ export { unstable_getStaticProps as l } from "__TURBOPACK_VAR__" assert { ``` ## Part 32 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 31 }; @@ -1746,14 +1746,14 @@ export { unstable_getStaticPaths as k } from "__TURBOPACK_VAR__" assert { ``` ## Part 33 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 32 }; @@ -1765,14 +1765,14 @@ export { unstable_getStaticParams as j } from "__TURBOPACK_VAR__" assert { ``` ## Part 34 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 33 }; @@ -1784,14 +1784,14 @@ export { unstable_getServerProps as h } from "__TURBOPACK_VAR__" assert { ``` ## Part 35 ```js -import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18, - __turbopack_original__: './helpers' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 17 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import { hoist } from './helpers'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 34 }; @@ -1803,26 +1803,26 @@ export { unstable_getServerSideProps as i } from "__TURBOPACK_VAR__" assert { ``` ## Part 36 ```js -import { m as PagesRouteModule } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14, - __turbopack_original__: '../../server/future/route-modules/pages/module.compiled' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 13 }; -import { n as RouteKind } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -16, - __turbopack_original__: '../../server/future/route-kind' +import { PagesRouteModule } from '../../server/future/route-modules/pages/module.compiled'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 15 }; -import { q as App } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22, - __turbopack_original__: 'VAR_MODULE_APP' +import { RouteKind } from '../../server/future/route-kind'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 21 }; -import { p as Document } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20, - __turbopack_original__: 'VAR_MODULE_DOCUMENT' +import App from 'VAR_MODULE_APP'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 19 }; -import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24, - __turbopack_original__: 'VAR_USERLAND' +import Document from 'VAR_MODULE_DOCUMENT'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 23 }; +import * as userland from 'VAR_USERLAND'; import "__TURBOPACK_PART__" assert { __turbopack_part__: 35 }; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md index ab72d78730a73..fb8e228ca8270 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md @@ -593,10 +593,10 @@ foobarCopy += "Unused"; import { d as foobar } from "__TURBOPACK_PART__" assert { __turbopack_part__: -7 }; -import { e as upper } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6, - __turbopack_original__: "module" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 }; +import { upper } from "module"; import "__TURBOPACK_PART__" assert { __turbopack_part__: 12 }; @@ -842,10 +842,10 @@ foobarCopy += "Unused"; import { d as foobar } from "__TURBOPACK_PART__" assert { __turbopack_part__: -7 }; -import { e as upper } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6, - __turbopack_original__: "module" +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 }; +import { upper } from "module"; import "__TURBOPACK_PART__" assert { __turbopack_part__: 12 }; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/typeof-1/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/typeof-1/output.md index 8136c78b28982..7406312682392 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/typeof-1/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/typeof-1/output.md @@ -264,18 +264,18 @@ export { MyModuleClientComponent as d } from "__TURBOPACK_VAR__" assert { ``` ## Part 8 ```js -import { d as MyModuleClientComponent } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: 'my-module/MyModuleClientComponent' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; -import { b as NextResponse } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3, - __turbopack_original__: 'next/server' +import { MyModuleClientComponent } from 'my-module/MyModuleClientComponent'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 }; -import { c as ClientComponent } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5, - __turbopack_original__: '../../ClientComponent' +import { NextResponse } from 'next/server'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 }; +import { ClientComponent } from '../../ClientComponent'; function GET() { return NextResponse.json({ clientComponent: typeof ClientComponent, @@ -388,18 +388,18 @@ export { MyModuleClientComponent as d } from "__TURBOPACK_VAR__" assert { ``` ## Part 8 ```js -import { d as MyModuleClientComponent } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7, - __turbopack_original__: 'my-module/MyModuleClientComponent' +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 }; -import { b as NextResponse } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3, - __turbopack_original__: 'next/server' +import { MyModuleClientComponent } from 'my-module/MyModuleClientComponent'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 }; -import { c as ClientComponent } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5, - __turbopack_original__: '../../ClientComponent' +import { NextResponse } from 'next/server'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 }; +import { ClientComponent } from '../../ClientComponent'; function GET() { return NextResponse.json({ clientComponent: typeof ClientComponent, From 640a6acedc4840709c85edcf33eaae9ad5ec7174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Tue, 5 Nov 2024 01:38:48 +0900 Subject: [PATCH 20/28] perf(turbopack): Optimize read-write analysis of tree shaking (#71546) ### What? Implement r/w/rw optimization for tree shaking. ### Why? This can reduce the number of fragments or at least the number of `references()` call --- .../src/tree_shake/mod.rs | 64 +- .../tests/tree-shaker/analyzer/1/output.md | 26 - .../tests/tree-shaker/analyzer/2/output.md | 26 - .../tree-shaker/analyzer/effects-1/input.js | 40 + .../tree-shaker/analyzer/effects-1/output.md | 763 ++++++++++++++++++ .../tree-shaker/analyzer/grouping/output.md | 31 - .../shared-and-side-effects/output.md | 7 - .../analyzer/test-config-1/output.md | 26 - 8 files changed, 852 insertions(+), 131 deletions(-) create mode 100644 turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/effects-1/input.js create mode 100644 turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/effects-1/output.md diff --git a/turbopack/crates/turbopack-ecmascript/src/tree_shake/mod.rs b/turbopack/crates/turbopack-ecmascript/src/tree_shake/mod.rs index 9a76774d86017..c6e3390da00fa 100644 --- a/turbopack/crates/turbopack-ecmascript/src/tree_shake/mod.rs +++ b/turbopack/crates/turbopack-ecmascript/src/tree_shake/mod.rs @@ -1,4 +1,4 @@ -use std::{borrow::Cow, fmt::Write}; +use std::fmt::Write; use anyhow::{bail, Result}; use rustc_hash::FxHashMap; @@ -51,14 +51,14 @@ struct VarState { last_writes: Vec, /// The module items that might read that variable. last_reads: Vec, + + last_op: Option, } -fn get_var<'a>(map: &'a FxHashMap, id: &Id) -> Cow<'a, VarState> { - let v = map.get(id); - match v { - Some(v) => Cow::Borrowed(v), - None => Cow::Owned(Default::default()), - } +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum VarOp { + Read, + Write, } impl Analyzer<'_> { @@ -147,11 +147,12 @@ impl Analyzer<'_> { // For each var in READ_VARS: for id in item.read_vars.iter() { - // Create a strong dependency to all module items listed in LAST_WRITES for that - // var. + // read (last: read) -> ref last_writes, push last_reads + // read (last: (read +) write) -> ref last_writes, clear last_reads, push + // last_reads // (the writes need to be executed before this read) - let state = get_var(&self.vars, id); + let state = self.vars.entry(id.clone()).or_default(); self.g.add_strong_deps(item_id, state.last_writes.iter()); if let Some(declarator) = &state.declarator { @@ -161,6 +162,10 @@ impl Analyzer<'_> { .add_strong_deps(item_id, [declarator].iter().copied()); } } + + if state.last_op == Some(VarOp::Write) && !item.write_vars.contains(id) { + state.last_reads.clear(); + } } // For each var in WRITE_VARS: @@ -171,7 +176,7 @@ impl Analyzer<'_> { // (the reads need to be executed before this write, when // it’s needed) - let state = get_var(&self.vars, id); + let state = self.vars.entry(id.clone()).or_default(); self.g.add_weak_deps(item_id, state.last_reads.iter()); if let Some(declarator) = &state.declarator { @@ -180,6 +185,28 @@ impl Analyzer<'_> { self.g.add_strong_deps(item_id, [declarator]); } } + + if !item.read_vars.contains(id) { + // write (last: read) -> weak_ref last_reads, clear last_writes, push + // last_writes + + if state.last_op == Some(VarOp::Read) { + state.last_writes.clear(); + } else if state.last_op == Some(VarOp::Write) { + // write (last: (read +) write) -> weak_ref last_reads, push last_writes + } + } else { + // read+write (last: read) -> weak_ref last_reads, ref last_writes, clear + // last_reads, clear last_writes, push last_reads, push last_writes + + // read+write (last: (read +) write) -> ref last_writes, clear + // last_reads, clear last_writes, push + // last_reads, push last_writes + if state.last_op.is_some() { + state.last_reads.clear(); + state.last_writes.clear(); + } + } } if item.side_effects { @@ -191,7 +218,7 @@ impl Analyzer<'_> { // Create weak dependencies to all LAST_WRITES and // LAST_READS. for id in eventual_ids.iter() { - let state = get_var(&self.vars, id); + let state = self.vars.entry(id.clone()).or_default(); self.g.add_weak_deps(item_id, state.last_writes.iter()); self.g.add_weak_deps(item_id, state.last_reads.iter()); @@ -241,6 +268,13 @@ impl Analyzer<'_> { state .last_reads .retain(|last_read| !self.g.has_dep(item_id, last_read, true)); + + state.last_op = Some(VarOp::Read); + } + + for id in item.write_vars.iter() { + let state = self.vars.entry(id.clone()).or_default(); + state.last_op = Some(VarOp::Write); } if item.side_effects { @@ -260,7 +294,7 @@ impl Analyzer<'_> { // Create a strong dependency to all module items listed in // LAST_WRITES for that var. - let state = get_var(&self.vars, id); + let state = self.vars.entry(id.clone()).or_default(); self.g.add_strong_deps(item_id, state.last_writes.iter()); if let Some(declarator) = &state.declarator { @@ -276,7 +310,7 @@ impl Analyzer<'_> { // Create a weak dependency to all module items listed in // LAST_READS for that var. - let state = get_var(&self.vars, id); + let state = self.vars.entry(id.clone()).or_default(); self.g.add_weak_deps(item_id, state.last_reads.iter()); @@ -308,7 +342,7 @@ impl Analyzer<'_> { ItemIdGroupKind::Export(local, _) => { // Create a strong dependency to LAST_WRITES for this var - let state = get_var(&self.vars, local); + let state = self.vars.entry(local.clone()).or_default(); self.g.add_strong_deps(item_id, state.last_writes.iter()); } diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md index 8dbc78fa2bf30..ce799fef02fb4 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md @@ -207,13 +207,11 @@ graph TD Item7 --> Item3; Item8 --> Item6; Item8 --> Item3; - Item8 -.-> Item4; Item8 -.-> Item7; Item9 --> Item7; Item9 --> Item1; Item9 -.-> Item2; Item9 -.-> Item8; - Item9 -.-> Item4; Item9 -.-> Item11; Item10 --> Item7; Item10 -.-> Item9; @@ -257,13 +255,11 @@ graph TD Item7 --> Item3; Item8 --> Item6; Item8 --> Item3; - Item8 -.-> Item4; Item8 -.-> Item7; Item9 --> Item7; Item9 --> Item1; Item9 -.-> Item2; Item9 -.-> Item8; - Item9 -.-> Item4; Item9 -.-> Item11; Item10 --> Item7; Item10 -.-> Item9; @@ -278,8 +274,6 @@ graph TD Item12 --> Item11; Item12 --> Item8; Item12 --> Item3; - Item13 -.-> Item4; - Item13 -.-> Item7; Item13 -.-> Item15; Item13 --> Item3; ``` @@ -317,13 +311,11 @@ graph TD Item7 --> Item3; Item8 --> Item6; Item8 --> Item3; - Item8 -.-> Item4; Item8 -.-> Item7; Item9 --> Item7; Item9 --> Item1; Item9 -.-> Item2; Item9 -.-> Item8; - Item9 -.-> Item4; Item9 -.-> Item11; Item10 --> Item7; Item10 -.-> Item9; @@ -338,8 +330,6 @@ graph TD Item12 --> Item11; Item12 --> Item8; Item12 --> Item3; - Item13 -.-> Item4; - Item13 -.-> Item7; Item13 -.-> Item15; Item13 --> Item3; Item14 --> Item9; @@ -373,13 +363,11 @@ graph TD N11 --> N7; N12 --> N10; N12 --> N7; - N12 -.-> N8; N12 -.-> N11; N13 --> N11; N13 --> N5; N13 -.-> N6; N13 -.-> N12; - N13 -.-> N8; N13 -.-> N15; N14 --> N11; N14 -.-> N13; @@ -394,8 +382,6 @@ graph TD N16 --> N15; N16 --> N12; N16 --> N7; - N17 -.-> N8; - N17 -.-> N11; N17 -.-> N4; N17 --> N7; N0 --> N13; @@ -545,9 +531,6 @@ import { d as foobar } from "__TURBOPACK_PART__" assert { import "__TURBOPACK_PART__" assert { __turbopack_part__: 10 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 8 -}; import "__TURBOPACK_PART__" assert { __turbopack_part__: 11 }; @@ -568,9 +551,6 @@ import "__TURBOPACK_PART__" assert { import "__TURBOPACK_PART__" assert { __turbopack_part__: 12 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 8 -}; import "__TURBOPACK_PART__" assert { __turbopack_part__: 15 }; @@ -632,12 +612,6 @@ export { external1 as a } from "__TURBOPACK_VAR__" assert { import { d as foobar } from "__TURBOPACK_PART__" assert { __turbopack_part__: -7 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 8 -}; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 11 -}; import "__TURBOPACK_PART__" assert { __turbopack_part__: 4 }; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md index 75e32ebec9bce..31e5486093bfd 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md @@ -221,13 +221,11 @@ graph TD Item9 --> Item5; Item10 --> Item8; Item10 --> Item5; - Item10 -.-> Item6; Item10 -.-> Item9; Item11 --> Item9; Item11 --> Item2; Item11 -.-> Item13; Item11 -.-> Item10; - Item11 -.-> Item6; Item11 -.-> Item4; Item12 --> Item9; Item12 -.-> Item11; @@ -273,13 +271,11 @@ graph TD Item9 --> Item5; Item10 --> Item8; Item10 --> Item5; - Item10 -.-> Item6; Item10 -.-> Item9; Item11 --> Item9; Item11 --> Item2; Item11 -.-> Item13; Item11 -.-> Item10; - Item11 -.-> Item6; Item11 -.-> Item4; Item12 --> Item9; Item12 -.-> Item11; @@ -294,8 +290,6 @@ graph TD Item13 --> Item4; Item13 --> Item10; Item13 --> Item5; - Item14 -.-> Item6; - Item14 -.-> Item9; Item14 -.-> Item17; Item14 --> Item5; ``` @@ -335,13 +329,11 @@ graph TD Item9 --> Item5; Item10 --> Item8; Item10 --> Item5; - Item10 -.-> Item6; Item10 -.-> Item9; Item11 --> Item9; Item11 --> Item2; Item11 -.-> Item13; Item11 -.-> Item10; - Item11 -.-> Item6; Item11 -.-> Item4; Item12 --> Item9; Item12 -.-> Item11; @@ -356,8 +348,6 @@ graph TD Item13 --> Item4; Item13 --> Item10; Item13 --> Item5; - Item14 -.-> Item6; - Item14 -.-> Item9; Item14 -.-> Item17; Item14 --> Item5; Item15 --> Item11; @@ -393,13 +383,11 @@ graph TD N12 --> N8; N13 --> N11; N13 --> N8; - N13 -.-> N9; N13 -.-> N12; N14 --> N12; N14 --> N18; N14 -.-> N16; N14 -.-> N13; - N14 -.-> N9; N14 -.-> N7; N15 --> N12; N15 -.-> N14; @@ -414,8 +402,6 @@ graph TD N16 --> N7; N16 --> N13; N16 --> N8; - N17 -.-> N9; - N17 -.-> N12; N17 -.-> N4; N17 --> N8; N0 --> N14; @@ -584,9 +570,6 @@ import { d as foobar } from "__TURBOPACK_PART__" assert { import "__TURBOPACK_PART__" assert { __turbopack_part__: 11 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 9 -}; import "__TURBOPACK_PART__" assert { __turbopack_part__: 12 }; @@ -607,9 +590,6 @@ import "__TURBOPACK_PART__" assert { import "__TURBOPACK_PART__" assert { __turbopack_part__: 13 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 9 -}; import "__TURBOPACK_PART__" assert { __turbopack_part__: 7 }; @@ -652,12 +632,6 @@ export { internal as e } from "__TURBOPACK_VAR__" assert { import { d as foobar } from "__TURBOPACK_PART__" assert { __turbopack_part__: -8 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 9 -}; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 12 -}; import "__TURBOPACK_PART__" assert { __turbopack_part__: 4 }; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/effects-1/input.js b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/effects-1/input.js new file mode 100644 index 0000000000000..4ee741108e5f9 --- /dev/null +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/effects-1/input.js @@ -0,0 +1,40 @@ +let x = 0; + +// 1 read +console.log(x); + +// 2 read +console.log(x); + +// 3 write -> 1*, 2* +x = 1; + +// 4 write -> 1*, 2* +x = 2; + +// 5 read -> 3, 4 +let y = x; + +// 6 read -> 3, 4 +let z = x; + +// 7 write -> 5*, 6* +x = y + z; + +// 8 read + write -> 7 +x = x + 1; + +// 9 read + write -> 8 +x *= 2; + +// 10 read -> 9 +console.log(x); + +// 11 read -> 9 +let a = x; + +// 12 read + write -> 9, 10*, 11* +x = x + a + 5; + +// 13 write -> 12* +x = 100; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/effects-1/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/effects-1/output.md new file mode 100644 index 0000000000000..469079d8b23ab --- /dev/null +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/effects-1/output.md @@ -0,0 +1,763 @@ +# Items + +Count: 15 + +## Item 1: Stmt 0, `VarDeclarator(0)` + +```js +let x = 0; + +``` + +- Declares: `x` +- Write: `x` + +## Item 2: Stmt 1, `Normal` + +```js +console.log(x); + +``` + +- Side effects +- Reads: `x` + +## Item 3: Stmt 2, `Normal` + +```js +console.log(x); + +``` + +- Side effects +- Reads: `x` + +## Item 4: Stmt 3, `Normal` + +```js +x = 1; + +``` + +- Write: `x` + +## Item 5: Stmt 4, `Normal` + +```js +x = 2; + +``` + +- Write: `x` + +## Item 6: Stmt 5, `VarDeclarator(0)` + +```js +let y = x; + +``` + +- Declares: `y` +- Reads: `x` +- Write: `y` + +## Item 7: Stmt 6, `VarDeclarator(0)` + +```js +let z = x; + +``` + +- Declares: `z` +- Reads: `x` +- Write: `z` + +## Item 8: Stmt 7, `Normal` + +```js +x = y + z; + +``` + +- Reads: `y`, `z` +- Write: `x` + +## Item 9: Stmt 8, `Normal` + +```js +x = x + 1; + +``` + +- Reads: `x` +- Write: `x` + +## Item 10: Stmt 9, `Normal` + +```js +x *= 2; + +``` + +- Reads: `x` +- Write: `x` + +## Item 11: Stmt 10, `Normal` + +```js +console.log(x); + +``` + +- Side effects +- Reads: `x` + +## Item 12: Stmt 11, `VarDeclarator(0)` + +```js +let a = x; + +``` + +- Declares: `a` +- Reads: `x` +- Write: `a` + +## Item 13: Stmt 12, `Normal` + +```js +x = x + a + 5; + +``` + +- Reads: `x`, `a` +- Write: `x` + +## Item 14: Stmt 13, `Normal` + +```js +x = 100; + +``` + +- Write: `x` + +# Phase 1 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item9; + Item10; + Item11; + Item12; + Item13; + Item14; + Item15; + Item15["ModuleEvaluation"]; +``` +# Phase 2 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item9; + Item10; + Item11; + Item12; + Item13; + Item14; + Item15; + Item15["ModuleEvaluation"]; + Item2 --> Item1; + Item3 --> Item1; + Item3 --> Item2; + Item4 -.-> Item3; + Item4 --> Item1; + Item5 -.-> Item3; + Item5 --> Item1; + Item6 --> Item5; + Item6 --> Item1; + Item7 --> Item5; + Item7 --> Item1; + Item8 --> Item6; + Item8 --> Item7; + Item8 --> Item1; + Item9 --> Item8; + Item9 --> Item1; + Item9 -.-> Item6; + Item9 -.-> Item7; + Item10 --> Item9; + Item10 --> Item1; + Item11 --> Item10; + Item11 --> Item1; + Item11 --> Item3; + Item12 --> Item10; + Item12 --> Item1; + Item13 --> Item10; + Item13 --> Item1; + Item13 --> Item12; + Item13 -.-> Item11; + Item14 -.-> Item13; + Item14 --> Item1; +``` +# Phase 3 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item9; + Item10; + Item11; + Item12; + Item13; + Item14; + Item15; + Item15["ModuleEvaluation"]; + Item2 --> Item1; + Item3 --> Item1; + Item3 --> Item2; + Item4 -.-> Item3; + Item4 --> Item1; + Item5 -.-> Item3; + Item5 --> Item1; + Item6 --> Item5; + Item6 --> Item1; + Item7 --> Item5; + Item7 --> Item1; + Item8 --> Item6; + Item8 --> Item7; + Item8 --> Item1; + Item9 --> Item8; + Item9 --> Item1; + Item9 -.-> Item6; + Item9 -.-> Item7; + Item10 --> Item9; + Item10 --> Item1; + Item11 --> Item10; + Item11 --> Item1; + Item11 --> Item3; + Item12 --> Item10; + Item12 --> Item1; + Item13 --> Item10; + Item13 --> Item1; + Item13 --> Item12; + Item13 -.-> Item11; + Item14 -.-> Item13; + Item14 --> Item1; +``` +# Phase 4 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item9; + Item10; + Item11; + Item12; + Item13; + Item14; + Item15; + Item15["ModuleEvaluation"]; + Item2 --> Item1; + Item3 --> Item1; + Item3 --> Item2; + Item4 -.-> Item3; + Item4 --> Item1; + Item5 -.-> Item3; + Item5 --> Item1; + Item6 --> Item5; + Item6 --> Item1; + Item7 --> Item5; + Item7 --> Item1; + Item8 --> Item6; + Item8 --> Item7; + Item8 --> Item1; + Item9 --> Item8; + Item9 --> Item1; + Item9 -.-> Item6; + Item9 -.-> Item7; + Item10 --> Item9; + Item10 --> Item1; + Item11 --> Item10; + Item11 --> Item1; + Item11 --> Item3; + Item12 --> Item10; + Item12 --> Item1; + Item13 --> Item10; + Item13 --> Item1; + Item13 --> Item12; + Item13 -.-> Item11; + Item14 -.-> Item13; + Item14 --> Item1; + Item15 --> Item11; +``` +# Final +```mermaid +graph TD + N0["Items: [ItemId(ModuleEvaluation)]"]; + N1["Items: [ItemId(0, VarDeclarator(0))]"]; + N2["Items: [ItemId(1, Normal)]"]; + N3["Items: [ItemId(2, Normal)]"]; + N4["Items: [ItemId(3, Normal)]"]; + N5["Items: [ItemId(4, Normal)]"]; + N6["Items: [ItemId(5, VarDeclarator(0))]"]; + N7["Items: [ItemId(6, VarDeclarator(0))]"]; + N8["Items: [ItemId(7, Normal)]"]; + N9["Items: [ItemId(8, Normal)]"]; + N10["Items: [ItemId(9, Normal)]"]; + N11["Items: [ItemId(10, Normal)]"]; + N12["Items: [ItemId(11, VarDeclarator(0))]"]; + N13["Items: [ItemId(12, Normal)]"]; + N14["Items: [ItemId(13, Normal)]"]; + N2 --> N1; + N3 --> N1; + N3 --> N2; + N4 -.-> N3; + N4 --> N1; + N5 -.-> N3; + N5 --> N1; + N6 --> N5; + N6 --> N1; + N7 --> N5; + N7 --> N1; + N8 --> N6; + N8 --> N7; + N8 --> N1; + N9 --> N8; + N9 --> N1; + N9 -.-> N6; + N9 -.-> N7; + N10 --> N9; + N10 --> N1; + N11 --> N10; + N11 --> N1; + N11 --> N3; + N12 --> N10; + N12 --> N1; + N13 --> N10; + N13 --> N1; + N13 --> N12; + N13 -.-> N11; + N14 -.-> N13; + N14 --> N1; + N0 --> N11; +``` +# Entrypoints + +``` +{ + ModuleEvaluation: 0, + Exports: 15, +} +``` + + +# Modules (dev) +## Part 0 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 +}; +"module evaluation"; + +``` +## Part 1 +```js +let x = 0; +export { x as a } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 2 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +console.log(x); + +``` +## Part 3 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 +}; +console.log(x); + +``` +## Part 4 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +x = 1; + +``` +## Part 5 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +x = 2; + +``` +## Part 6 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +let y = x; +export { y as b } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 7 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +let z = x; +export { z as c } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 8 +```js +import { b as y } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -6 +}; +import { c as z } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -7 +}; +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +x = y + z; + +``` +## Part 9 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +x = x + 1; + +``` +## Part 10 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +x *= 2; + +``` +## Part 11 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 10 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +console.log(x); + +``` +## Part 12 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 10 +}; +let a = x; +export { a as d } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 13 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import { d as a } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -12 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 10 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 +}; +x = x + a + 5; + +``` +## Part 14 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 13 +}; +x = 100; + +``` +## Part 15 +```js + +``` +## Merged (module eval) +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 +}; +"module evaluation"; + +``` +# Entrypoints + +``` +{ + ModuleEvaluation: 0, + Exports: 15, +} +``` + + +# Modules (prod) +## Part 0 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 +}; +"module evaluation"; + +``` +## Part 1 +```js +let x = 0; +export { x as a } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 2 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +console.log(x); + +``` +## Part 3 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 2 +}; +console.log(x); + +``` +## Part 4 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +x = 1; + +``` +## Part 5 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +x = 2; + +``` +## Part 6 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +let y = x; +export { y as b } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 7 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +let z = x; +export { z as c } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 8 +```js +import { b as y } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -6 +}; +import { c as z } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -7 +}; +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +x = y + z; + +``` +## Part 9 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +x = x + 1; + +``` +## Part 10 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +x *= 2; + +``` +## Part 11 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 10 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +console.log(x); + +``` +## Part 12 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 10 +}; +let a = x; +export { a as d } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 13 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +import { d as a } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -12 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 10 +}; +x = x + a + 5; + +``` +## Part 14 +```js +import { a as x } from "__TURBOPACK_PART__" assert { + __turbopack_part__: -1 +}; +x = 100; + +``` +## Part 15 +```js + +``` +## Merged (module eval) +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 +}; +"module evaluation"; + +``` diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/grouping/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/grouping/output.md index 42ce05855b4cb..d796bb39d81d7 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/grouping/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/grouping/output.md @@ -158,19 +158,15 @@ graph TD Item5 --> Item1; Item6 -.-> Item4; Item6 --> Item1; - Item7 --> Item3; Item7 --> Item6; Item7 --> Item1; Item7 -.-> Item4; Item8 --> Item7; Item8 --> Item1; - Item8 -.-> Item4; Item9 --> Item8; Item9 --> Item1; - Item9 -.-> Item4; Item10 --> Item9; Item10 --> Item1; - Item10 -.-> Item4; Item11 --> Item10; Item11 --> Item1; Item13 --> Item10; @@ -205,19 +201,15 @@ graph TD Item5 --> Item1; Item6 -.-> Item4; Item6 --> Item1; - Item7 --> Item3; Item7 --> Item6; Item7 --> Item1; Item7 -.-> Item4; Item8 --> Item7; Item8 --> Item1; - Item8 -.-> Item4; Item9 --> Item8; Item9 --> Item1; - Item9 -.-> Item4; Item10 --> Item9; Item10 --> Item1; - Item10 -.-> Item4; Item11 --> Item10; Item11 --> Item1; Item13 --> Item10; @@ -252,19 +244,15 @@ graph TD Item5 --> Item1; Item6 -.-> Item4; Item6 --> Item1; - Item7 --> Item3; Item7 --> Item6; Item7 --> Item1; Item7 -.-> Item4; Item8 --> Item7; Item8 --> Item1; - Item8 -.-> Item4; Item9 --> Item8; Item9 --> Item1; - Item9 -.-> Item4; Item10 --> Item9; Item10 --> Item1; - Item10 -.-> Item4; Item11 --> Item10; Item11 --> Item1; Item13 --> Item10; @@ -297,19 +285,15 @@ graph TD N7 --> N3; N8 -.-> N6; N8 --> N3; - N9 --> N5; N9 --> N8; N9 --> N3; N9 -.-> N6; N10 --> N9; N10 --> N3; - N10 -.-> N6; N11 --> N10; N11 --> N3; - N11 -.-> N6; N12 --> N11; N12 --> N3; - N12 -.-> N6; N13 --> N12; N13 --> N3; N1 --> N12; @@ -423,9 +407,6 @@ x = 5; import { a as x } from "__TURBOPACK_PART__" assert { __turbopack_part__: -3 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 5 -}; import "__TURBOPACK_PART__" assert { __turbopack_part__: 8 }; @@ -443,9 +424,6 @@ import { a as x } from "__TURBOPACK_PART__" assert { import "__TURBOPACK_PART__" assert { __turbopack_part__: 9 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 6 -}; x += 7; ``` @@ -457,9 +435,6 @@ import { a as x } from "__TURBOPACK_PART__" assert { import "__TURBOPACK_PART__" assert { __turbopack_part__: 10 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 6 -}; x += 8; ``` @@ -471,9 +446,6 @@ import { a as x } from "__TURBOPACK_PART__" assert { import "__TURBOPACK_PART__" assert { __turbopack_part__: 11 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 6 -}; x += 9; ``` @@ -609,9 +581,6 @@ x = 5; import { a as x } from "__TURBOPACK_PART__" assert { __turbopack_part__: -3 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 5 -}; import "__TURBOPACK_PART__" assert { __turbopack_part__: 8 }; diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-and-side-effects/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-and-side-effects/output.md index 28d27283258ca..22f970497fb5a 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-and-side-effects/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-and-side-effects/output.md @@ -153,7 +153,6 @@ graph TD Item8 -.-> Item7; Item9 --> Item8; Item9 --> Item6; - Item9 -.-> Item7; Item11 --> Item8; Item12 --> Item9; ``` @@ -187,7 +186,6 @@ graph TD Item8 -.-> Item7; Item9 --> Item8; Item9 --> Item6; - Item9 -.-> Item7; Item11 --> Item8; Item12 --> Item9; ``` @@ -221,7 +219,6 @@ graph TD Item8 -.-> Item7; Item9 --> Item8; Item9 --> Item6; - Item9 -.-> Item7; Item11 --> Item8; Item12 --> Item9; Item10 --> Item7; @@ -253,7 +250,6 @@ graph TD N10 -.-> N9; N11 --> N10; N11 --> N8; - N11 -.-> N9; N1 --> N10; N2 --> N11; N0 --> N9; @@ -399,9 +395,6 @@ import { f as shared } from "__TURBOPACK_PART__" assert { import "__TURBOPACK_PART__" assert { __turbopack_part__: 10 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 9 -}; const b = { shared, b: "bbbbbbbbbbb" diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md index fb8e228ca8270..83cefa06986d9 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md @@ -207,13 +207,11 @@ graph TD Item7 --> Item3; Item8 --> Item6; Item8 --> Item3; - Item8 -.-> Item4; Item8 -.-> Item7; Item9 --> Item7; Item9 --> Item1; Item9 -.-> Item2; Item9 -.-> Item8; - Item9 -.-> Item4; Item9 -.-> Item11; Item10 --> Item7; Item10 -.-> Item9; @@ -257,13 +255,11 @@ graph TD Item7 --> Item3; Item8 --> Item6; Item8 --> Item3; - Item8 -.-> Item4; Item8 -.-> Item7; Item9 --> Item7; Item9 --> Item1; Item9 -.-> Item2; Item9 -.-> Item8; - Item9 -.-> Item4; Item9 -.-> Item11; Item10 --> Item7; Item10 -.-> Item9; @@ -278,8 +274,6 @@ graph TD Item12 --> Item11; Item12 --> Item8; Item12 --> Item3; - Item13 -.-> Item4; - Item13 -.-> Item7; Item13 -.-> Item15; Item13 --> Item3; ``` @@ -317,13 +311,11 @@ graph TD Item7 --> Item3; Item8 --> Item6; Item8 --> Item3; - Item8 -.-> Item4; Item8 -.-> Item7; Item9 --> Item7; Item9 --> Item1; Item9 -.-> Item2; Item9 -.-> Item8; - Item9 -.-> Item4; Item9 -.-> Item11; Item10 --> Item7; Item10 -.-> Item9; @@ -338,8 +330,6 @@ graph TD Item12 --> Item11; Item12 --> Item8; Item12 --> Item3; - Item13 -.-> Item4; - Item13 -.-> Item7; Item13 -.-> Item15; Item13 --> Item3; Item14 --> Item9; @@ -373,13 +363,11 @@ graph TD N11 --> N7; N12 --> N10; N12 --> N7; - N12 -.-> N8; N12 -.-> N11; N13 --> N11; N13 --> N5; N13 -.-> N6; N13 -.-> N12; - N13 -.-> N8; N13 -.-> N15; N14 --> N11; N14 -.-> N13; @@ -394,8 +382,6 @@ graph TD N16 --> N15; N16 --> N12; N16 --> N7; - N17 -.-> N8; - N17 -.-> N11; N17 -.-> N4; N17 --> N7; N0 --> N13; @@ -545,9 +531,6 @@ import { d as foobar } from "__TURBOPACK_PART__" assert { import "__TURBOPACK_PART__" assert { __turbopack_part__: 10 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 8 -}; import "__TURBOPACK_PART__" assert { __turbopack_part__: 11 }; @@ -568,9 +551,6 @@ import "__TURBOPACK_PART__" assert { import "__TURBOPACK_PART__" assert { __turbopack_part__: 12 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 8 -}; import "__TURBOPACK_PART__" assert { __turbopack_part__: 15 }; @@ -632,12 +612,6 @@ export { external1 as a } from "__TURBOPACK_VAR__" assert { import { d as foobar } from "__TURBOPACK_PART__" assert { __turbopack_part__: -7 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 8 -}; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 11 -}; import "__TURBOPACK_PART__" assert { __turbopack_part__: 4 }; From b2c9e45fbb186daf74e2f28341652bf298cdd118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Tue, 5 Nov 2024 02:05:48 +0900 Subject: [PATCH 21/28] perf(turbopack): Do not store export star in internal fragments (#71550) ### What? Do not store `export *` in internal fragments. ### Why? It results in large number of fragments. ### How? Closes PACK-3264 --- .../turbopack-ecmascript/src/tree_shake/graph.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs b/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs index 41331a1098e1a..d590a70bf4624 100644 --- a/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs +++ b/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs @@ -624,6 +624,22 @@ impl DepGraph { } } + // Do not store export * in internal part fragments. + if let ModuleItem::ModuleDecl(ModuleDecl::ExportAll(export)) = &data[g].content { + // Preserve side effects of import caused by export * + chunk + .body + .push(ModuleItem::ModuleDecl(ModuleDecl::Import(ImportDecl { + span: export.span, + specifiers: Default::default(), + src: export.src.clone(), + type_only: false, + with: export.with.clone(), + phase: Default::default(), + }))); + continue; + } + chunk.body.push(data[g].content.clone()); } From 4be2fb185f6423547309e16c9aee8f4a41f369a1 Mon Sep 17 00:00:00 2001 From: Will Binns-Smith Date: Mon, 4 Nov 2024 09:40:21 -0800 Subject: [PATCH 22/28] Turbopack: font weight sorting feedback (#72109) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This addresses @bgw’s feedback for #72043: - Defers cloning https://github.com/vercel/next.js/pull/72043#discussion_r1821815860 - Uses a `BTreeSet` in `FontAxesWeights::Fixed` to ensure it’s always sorted, rather than sorting at url-generation-time https://github.com/vercel/next.js/pull/72043#discussion_r1821821359 - `RcStr` `.to_owned()` -> `.clone()` Test Plan: Unit tests Co-authored-by: Benjamin Woodruff Closes PACK-3360 Co-authored-by: Benjamin Woodruff --- crates/next-core/src/next_font/google/util.rs | 46 ++++++++----------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/crates/next-core/src/next_font/google/util.rs b/crates/next-core/src/next_font/google/util.rs index ca0adb4779f73..1ab332ee93832 100644 --- a/crates/next-core/src/next_font/google/util.rs +++ b/crates/next-core/src/next_font/google/util.rs @@ -1,4 +1,4 @@ -use std::cmp::Ordering; +use std::{cmp::Ordering, collections::BTreeSet}; use anyhow::{anyhow, bail, Context, Result}; use turbo_tasks::{FxIndexSet, RcStr}; @@ -15,12 +15,13 @@ pub(super) struct FontAxes { #[derive(Debug, PartialEq, Eq, Hash)] pub(super) enum FontAxesWeights { Variable(Option), - Fixed(Vec), + // A list of fixed weights. Sorted in ascending order as a BTreeSet. + Fixed(BTreeSet), } impl Default for FontAxesWeights { fn default() -> Self { - FontAxesWeights::Fixed(vec![]) + FontAxesWeights::Fixed(Default::default()) } } @@ -104,7 +105,7 @@ pub(super) fn get_font_axes( } FontWeights::Fixed(weights) => Ok(FontAxes { - wght: FontAxesWeights::Fixed(weights.to_owned()), + wght: FontAxesWeights::Fixed(weights.iter().copied().collect()), ital, variable_axes: None, }), @@ -156,16 +157,12 @@ pub(super) fn get_stylesheet_url( let weights = match &axes.wght { FontAxesWeights::Variable(Some(wght)) => { - vec![VariantValue::String(wght.to_owned())] + vec![VariantValue::String(wght.clone())] } FontAxesWeights::Variable(None) => { vec![] } - FontAxesWeights::Fixed(wghts) => { - let mut wghts = wghts.clone(); - wghts.sort(); - wghts.iter().map(|w| VariantValue::U16(*w)).collect() - } + FontAxesWeights::Fixed(wghts) => wghts.iter().map(|w| VariantValue::U16(*w)).collect(), }; if weights.is_empty() { @@ -258,13 +255,8 @@ pub(super) fn get_stylesheet_url( let mut variant_values = variants .iter() - .map(|variant| { - variant - .iter() - .map(|pair| pair.1.clone()) - .collect::>() - }) - .collect::>>(); + .map(|variant| variant.iter().map(|pair| &pair.1).collect::>()) + .collect::>>(); variant_values.sort(); // An encoding of the series of sorted variant values, with variants delimited @@ -274,11 +266,11 @@ pub(super) fn get_stylesheet_url( .iter() .map(|v| { v.iter() - .map(|vv| std::convert::Into::::into(vv.clone())) - .collect::>() + .map(|vv| RcStr::from((*vv).clone())) + .collect::>() .join(",") }) - .collect::>() + .collect::>() .join(";"); Ok(format!( @@ -295,6 +287,8 @@ pub(super) fn get_stylesheet_url( #[cfg(test)] mod tests { + use std::collections::BTreeSet; + use anyhow::Result; use turbo_tasks::fxindexset; use turbo_tasks_fs::json::parse_json_with_source_context; @@ -462,7 +456,7 @@ mod tests { assert_eq!( get_font_axes(&data, "Hind", &FontWeights::Fixed(vec![500]), &[], &None)?, FontAxes { - wght: FontAxesWeights::Fixed(vec![500]), + wght: FontAxesWeights::Fixed(BTreeSet::from([500])), ..Default::default() } ); @@ -476,7 +470,7 @@ mod tests { GOOGLE_FONTS_STYLESHEET_URL, "Roboto Mono", &FontAxes { - wght: FontAxesWeights::Fixed(vec![500]), + wght: FontAxesWeights::Fixed(BTreeSet::from([500])), ital: fxindexset! {FontStyle::Normal}, variable_axes: None }, @@ -495,7 +489,7 @@ mod tests { GOOGLE_FONTS_STYLESHEET_URL, "Roboto Serif", &FontAxes { - wght: FontAxesWeights::Fixed(vec![500]), + wght: FontAxesWeights::Fixed(BTreeSet::from([500])), ital: fxindexset! {FontStyle::Normal}, variable_axes: Some(vec![ ("GRAD".into(), "-50..100".into()), @@ -518,7 +512,7 @@ mod tests { GOOGLE_FONTS_STYLESHEET_URL, "Roboto Serif", &FontAxes { - wght: FontAxesWeights::Fixed(vec![1000, 500, 200]), + wght: FontAxesWeights::Fixed(BTreeSet::from([1000, 500, 200])), ital: fxindexset! {FontStyle::Normal}, variable_axes: None }, @@ -537,7 +531,7 @@ mod tests { GOOGLE_FONTS_STYLESHEET_URL, "Roboto Serif", &FontAxes { - wght: FontAxesWeights::Fixed(vec![500, 300]), + wght: FontAxesWeights::Fixed(BTreeSet::from([500, 300])), ital: fxindexset! {FontStyle::Normal, FontStyle::Italic}, variable_axes: Some(vec![ ("GRAD".into(), "-50..100".into()), @@ -615,7 +609,7 @@ mod tests { GOOGLE_FONTS_STYLESHEET_URL, "Hind", &FontAxes { - wght: FontAxesWeights::Fixed(vec![500]), + wght: FontAxesWeights::Fixed(BTreeSet::from([500])), ..Default::default() }, "optional" From f771c6d78783684629c143329273b348990fcbe0 Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Mon, 4 Nov 2024 12:44:33 -0500 Subject: [PATCH 23/28] fix(cli): respect SIGTERM and SIGINT exit codes in next build (#64871) This PR updates the SIGTERM and SIGINT exit codes to 143 and 130 respectively. These updated codes are what other tooling, such as Nx/Turborepo, expects when running commands that did not completely successfully due to receiving SIGTERM and SIGINT. For Nx, the SIGINT (e.g. `Ctrl+C`) causes a bad build cache. Both Nx and Turborepo will have bad cache when SIGTERM is received, which can happen in a CI environment if a job times out, runs out of memory, etc. I have a [repo here](https://github.com/jaysoo/next-cli-signals) that demonstrates the wrong behavior with Turborepo. By exiting with the wrong code, it can result in bad cache in CI or Docker. Closes: https://github.com/vercel/next.js/issues/62906 --------- Co-authored-by: Sam Ko Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com> --- packages/next/src/cli/next-build.ts | 4 ++-- test/integration/cli/test/index.test.js | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/next/src/cli/next-build.ts b/packages/next/src/cli/next-build.ts index aee2877aafd6e..3eec722958141 100755 --- a/packages/next/src/cli/next-build.ts +++ b/packages/next/src/cli/next-build.ts @@ -24,8 +24,8 @@ export type NextBuildOptions = { } const nextBuild = (options: NextBuildOptions, directory?: string) => { - process.on('SIGTERM', () => process.exit(0)) - process.on('SIGINT', () => process.exit(0)) + process.on('SIGTERM', () => process.exit(143)) + process.on('SIGINT', () => process.exit(130)) const { debug, diff --git a/test/integration/cli/test/index.test.js b/test/integration/cli/test/index.test.js index 1768f3aca3417..a18c3a3e778c3 100644 --- a/test/integration/cli/test/index.test.js +++ b/test/integration/cli/test/index.test.js @@ -52,7 +52,8 @@ const runAndCaptureOutput = async ({ port }) => { const testExitSignal = async ( killSignal = '', args = [], - readyRegex = /Creating an optimized production/ + readyRegex = /Creating an optimized production/, + expectedCode = 0 ) => { let instance const killSigint = (inst) => { @@ -76,7 +77,7 @@ const testExitSignal = async ( // See: https://nodejs.org/api/process.html#process_signal_events const expectedExitSignal = process.platform === `win32` ? killSignal : null expect(signal).toBe(expectedExitSignal) - expect(code).toBe(0) + expect(code).toBe(expectedCode) } describe('CLI Usage', () => { @@ -342,11 +343,11 @@ describe('CLI Usage', () => { }) test('should exit when SIGINT is signalled', async () => { - await testExitSignal('SIGINT', ['build', dirBasic]) + await testExitSignal('SIGINT', ['build', dirBasic], undefined, 130) }) test('should exit when SIGTERM is signalled', async () => { - await testExitSignal('SIGTERM', ['build', dirBasic]) + await testExitSignal('SIGTERM', ['build', dirBasic], undefined, 143) }) test('invalid directory', async () => { From e9a90d954cd762e57d667a52cf21355898458d24 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Mon, 4 Nov 2024 20:52:25 +0100 Subject: [PATCH 24/28] test: fix snapshots in next build and lint test (#72283) --- .../test/__snapshots__/next-build-and-lint.test.ts.snap | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/production/eslint/test/__snapshots__/next-build-and-lint.test.ts.snap b/test/production/eslint/test/__snapshots__/next-build-and-lint.test.ts.snap index df623a132d387..2aab7678c7f8d 100644 --- a/test/production/eslint/test/__snapshots__/next-build-and-lint.test.ts.snap +++ b/test/production/eslint/test/__snapshots__/next-build-and-lint.test.ts.snap @@ -594,6 +594,9 @@ exports[`Next Build production mode first time setup with TypeScript - ESLint v8 "no-array-constructor": [ "off", ], + "no-class-assign": [ + "off", + ], "no-const-assign": [ "off", ], @@ -927,6 +930,9 @@ exports[`Next Build production mode first time setup with TypeScript - ESLint v9 "no-array-constructor": [ "off", ], + "no-class-assign": [ + "off", + ], "no-const-assign": [ "off", ], From 3287d70959e4a1779d86fdb5d5fe3c3664aa6ad4 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Mon, 4 Nov 2024 15:15:46 -0500 Subject: [PATCH 25/28] Generate per-segment prefetch responses (#72168) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow up to #71113. This generates a prefetch response for route segments, so the client can request them individually, and reuse shared layouts between separate page prefetches. Since this is exclusive to PPR, segment prefetches are always static and do not reach the application layer. They are served directly from cache. (This part was implemented in the previous PR.) The prerendered segment data is generated (and revalidated) simultaneously with the prerender of the entire page, to ensure consistency between parent and child segments. Since we always rebuild the whole page, we can save an extra render of each segment by reusing the Flight response that was used to generate the initial HTML. We do this by decoding the page data using a server-side Flight consumer, picking out an individual segment's data, then re-encoding it as its own Flight response. We have to do this once per segment — not ideal, but for now it's the only way to make sure the side effects from the original Flight stream (e.g. Float preloads) are transferred to the per-segment streams. This PR does not yet include any updates to the client router. --- .../next/src/server/app-render/app-render.tsx | 133 ++++++-- .../app-render/collect-segment-data.tsx | 319 ++++++++++++++++++ .../next/src/server/app-render/entry-base.ts | 1 + .../simple/per-segment-prefetching.test.ts | 8 +- 4 files changed, 425 insertions(+), 36 deletions(-) create mode 100644 packages/next/src/server/app-render/collect-segment-data.tsx diff --git a/packages/next/src/server/app-render/app-render.tsx b/packages/next/src/server/app-render/app-render.tsx index 472604e707b4e..60af7e14ae3a2 100644 --- a/packages/next/src/server/app-render/app-render.tsx +++ b/packages/next/src/server/app-render/app-render.tsx @@ -19,7 +19,10 @@ import type { RequestStore } from '../app-render/work-unit-async-storage.externa import type { NextParsedUrlQuery } from '../request-meta' import type { LoaderTree } from '../lib/app-dir-module' import type { AppPageModule } from '../route-modules/app-page/module' -import type { ClientReferenceManifest } from '../../build/webpack/plugins/flight-manifest-plugin' +import type { + ClientReferenceManifest, + ManifestNode, +} from '../../build/webpack/plugins/flight-manifest-plugin' import type { DeepReadonly } from '../../shared/lib/deep-readonly' import type { BaseNextRequest, BaseNextResponse } from '../base-http' import type { IncomingHttpHeaders } from 'http' @@ -1253,32 +1256,6 @@ async function renderToHTMLOrFlightImpl( } } - // Per-segment prefetch data - // - // All of the segments for a page are generated simultaneously, including - // during revalidations. This is to ensure consistency, because it's - // possible for a mismatch between a layout and page segment can cause the - // client to error during rendering. We want to preserve the ability of the - // client to recover from such a mismatch by re-requesting all the segments - // to get a consistent view of the page. - // - // TODO (Per Segment Prefetching): This is placeholder data. Populate with - // the actual data generated during prerender. - if (renderOpts.experimental.isRoutePPREnabled === true) { - const placeholder = Buffer.from( - 'TODO (Per Segment Prefetching): Not yet implemented\n' - ) - metadata.segmentFlightData = new Map([ - // Root segment - ['/', placeholder], - ['/blog', placeholder], - // TODO: Update the client to use the same encoding for segment paths that - // we use here, so we don't have to convert between them. Needs to be - // filesystem safe. - ['/blog/[post]-1-d', placeholder], - ]) - } - return new RenderResult(await streamToString(response.stream), options) } else { // We're rendering dynamically @@ -2720,7 +2697,14 @@ async function prerenderToStream( tracingMetadata: tracingMetadata, }) - metadata.flightData = await streamToBuffer(reactServerResult.asStream()) + const flightData = await streamToBuffer(reactServerResult.asStream()) + metadata.flightData = flightData + metadata.segmentFlightData = await collectSegmentData( + finalAttemptRSCPayload, + flightData, + ComponentMod, + renderOpts + ) if (serverIsDynamic || clientIsDynamic) { if (postponed != null) { @@ -3171,9 +3155,16 @@ async function prerenderToStream( // const reactServerResult = // await createReactServerPrerenderResultFromRender(reactServerStream!) - metadata.flightData = await streamToBuffer( + const flightData = await streamToBuffer( serverPrerenderStreamResult.asStream() ) + metadata.flightData = flightData + metadata.segmentFlightData = await collectSegmentData( + finalServerPayload, + flightData, + ComponentMod, + renderOpts + ) const getServerInsertedHTML = makeGetServerInsertedHTML({ polyfills, @@ -3296,6 +3287,12 @@ async function prerenderToStream( if (shouldGenerateStaticFlightData(workStore)) { metadata.flightData = flightData + metadata.segmentFlightData = await collectSegmentData( + RSCPayload, + flightData, + ComponentMod, + renderOpts + ) } /** @@ -3475,7 +3472,14 @@ async function prerenderToStream( ) if (shouldGenerateStaticFlightData(workStore)) { - metadata.flightData = await streamToBuffer(reactServerResult.asStream()) + const flightData = await streamToBuffer(reactServerResult.asStream()) + metadata.flightData = flightData + metadata.segmentFlightData = await collectSegmentData( + RSCPayload, + flightData, + ComponentMod, + renderOpts + ) } const getServerInsertedHTML = makeGetServerInsertedHTML({ @@ -3627,9 +3631,16 @@ async function prerenderToStream( }) if (shouldGenerateStaticFlightData(workStore)) { - metadata.flightData = await streamToBuffer( + const flightData = await streamToBuffer( reactServerPrerenderResult.asStream() ) + metadata.flightData = flightData + metadata.segmentFlightData = await collectSegmentData( + errorRSCPayload, + flightData, + ComponentMod, + renderOpts + ) } const validateRootLayout = renderOpts.dev @@ -3756,3 +3767,63 @@ const getGlobalErrorStyles = async ( return globalErrorStyles } + +async function collectSegmentData( + rscPayload: InitialRSCPayload, + fullPageDataBuffer: Buffer, + ComponentMod: AppPageModule, + renderOpts: RenderOpts +): Promise | undefined> { + // Per-segment prefetch data + // + // All of the segments for a page are generated simultaneously, including + // during revalidations. This is to ensure consistency, because it's + // possible for a mismatch between a layout and page segment can cause the + // client to error during rendering. We want to preserve the ability of the + // client to recover from such a mismatch by re-requesting all the segments + // to get a consistent view of the page. + // + // For performance, we reuse the Flight output that was created when + // generating the initial page HTML. The Flight stream for the whole page is + // decomposed into a separate stream per segment. + + const clientReferenceManifest = renderOpts.clientReferenceManifest + if ( + !clientReferenceManifest || + renderOpts.experimental.isRoutePPREnabled !== true + ) { + return + } + + // FlightDataPath is an unsound type, hence the additional checks. + const flightDataPaths = rscPayload.f + if (flightDataPaths.length !== 1 && flightDataPaths[0].length !== 3) { + console.error( + 'Internal Next.js error: InitialRSCPayload does not match the expected ' + + 'shape for a prerendered page during segment prefetch generation.' + ) + return + } + const routeTree: FlightRouterState = flightDataPaths[0][0] + + // Manifest passed to the Flight client for reading the full-page Flight + // stream. Based off similar code in use-cache-wrapper.ts. + const isEdgeRuntime = process.env.NEXT_RUNTIME === 'edge' + const serverConsumerManifest = { + // moduleLoading must be null because we don't want to trigger preloads of ClientReferences + // to be added to the consumer. Instead, we'll wait for any ClientReference to be emitted + // which themselves will handle the preloading. + moduleLoading: null, + moduleMap: isEdgeRuntime + ? clientReferenceManifest.edgeRscModuleMapping + : clientReferenceManifest.rscModuleMapping, + serverModuleMap: null, + } + + return await ComponentMod.collectSegmentData( + routeTree, + fullPageDataBuffer, + clientReferenceManifest.clientModules as ManifestNode, + serverConsumerManifest + ) +} diff --git a/packages/next/src/server/app-render/collect-segment-data.tsx b/packages/next/src/server/app-render/collect-segment-data.tsx new file mode 100644 index 0000000000000..7f51d178c8195 --- /dev/null +++ b/packages/next/src/server/app-render/collect-segment-data.tsx @@ -0,0 +1,319 @@ +import type { + CacheNodeSeedData, + FlightRouterState, + InitialRSCPayload, + Segment, +} from './types' +import type { ManifestNode } from '../../build/webpack/plugins/flight-manifest-plugin' + +// eslint-disable-next-line import/no-extraneous-dependencies +import { createFromReadableStream } from 'react-server-dom-webpack/client.edge' +// eslint-disable-next-line import/no-extraneous-dependencies +import { renderToReadableStream } from 'react-server-dom-webpack/server.edge' + +import { + streamFromBuffer, + streamToBuffer, +} from '../stream-utils/node-web-streams-helper' +import { UNDERSCORE_NOT_FOUND_ROUTE } from '../../api/constants' +import { waitAtLeastOneReactRenderTask } from '../../lib/scheduler' +import type { LoadingModuleData } from '../../shared/lib/app-router-context.shared-runtime' + +export async function collectSegmentData( + routeTree: FlightRouterState, + fullPageDataBuffer: Buffer, + clientModules: ManifestNode, + serverConsumerManifest: any +): Promise> { + // Traverse the router tree. For each segment, decode the Flight stream for + // the page, pick out its segment data, and re-encode it to a new Flight + // stream. This will be served when performing a client-side prefetch. + + // Before we start, warm up the module cache by decoding the page data once. + // Then we can assume that any remaining async tasks that occur the next time + // are due to hanging promises caused by dynamic data access. Note we only + // have to do this once per page, not per individual segment. + // + // Based on similar strategy in warmFlightResponse. + try { + await createFromReadableStream(streamFromBuffer(fullPageDataBuffer), { + serverConsumerManifest, + }) + await waitAtLeastOneReactRenderTask() + } catch {} + + // A mutable map to collect the results as we traverse the route tree. + const segmentBufferMap = new Map() + // A mutable array to collect the promises for each segment stream, so that + // they can run in parallel. + const collectedTasks: Array> = [] + + collectSegmentDataImpl( + routeTree, + fullPageDataBuffer, + clientModules, + serverConsumerManifest, + [], + '', + segmentBufferMap, + collectedTasks + ) + + // This will resolve either after a microtask (if none of the segments + // have dynamic data) or in the next tick (because of the abort signal passed + // to renderToReadableStream). + await Promise.all(collectedTasks) + + return segmentBufferMap +} + +function collectSegmentDataImpl( + route: FlightRouterState, + fullPageDataBuffer: Buffer, + clientModules: ManifestNode, + serverConsumerManifest: any, + segmentPath: Array<[string, Segment]>, + segmentPathStr: string, + segmentBufferMap: Map, + collectedTasks: Array> +): void { + const children = route[1] + for (const parallelRouteKey in children) { + const childRoute = children[parallelRouteKey] + const childSegment = childRoute[0] + const childSegmentPath = segmentPath.concat([ + [parallelRouteKey, childSegment], + ]) + const childSegmentPathStr = + segmentPathStr + + '/' + + encodeChildSegmentAsFilesystemSafePathname(parallelRouteKey, childSegment) + collectSegmentDataImpl( + childRoute, + fullPageDataBuffer, + clientModules, + serverConsumerManifest, + childSegmentPath, + childSegmentPathStr, + segmentBufferMap, + collectedTasks + ) + } + + // Spawn a task to render the segment data to a stream. + collectedTasks.push( + renderSegmentDataToStream( + fullPageDataBuffer, + clientModules, + serverConsumerManifest, + segmentPath, + segmentPathStr, + segmentBufferMap + ) + ) +} + +async function renderSegmentDataToStream( + fullPageDataBuffer: Buffer, + clientModules: ManifestNode, + serverConsumerManifest: any, + segmentPath: Array<[string, Segment]>, + segmentPathStr: string, + segmentBufferMap: Map +) { + // Create a new Flight response that contains data only for this segment. + try { + // Since all we're doing is decoding and re-encoding a cached prerender, if + // it takes longer than a microtask, it must because of hanging promises + // caused by dynamic data. Abort the stream at the end of the current task. + const abortController = new AbortController() + waitAtLeastOneReactRenderTask().then(() => abortController.abort()) + + const segmentStream = renderToReadableStream( + // SegmentPrefetch is not a valid return type for a React component, but + // we need to use a component so that when we decode the original stream + // inside of it, the side effects are transferred to the new stream. + // @ts-expect-error + , + clientModules, + { + signal: abortController.signal, + onError() { + // Ignore any errors. These would have already been reported when + // we created the full page data. + }, + } + ) + const segmentBuffer = await streamToBuffer(segmentStream) + // Add the buffer to the result map. + if (segmentPathStr === '') { + segmentBufferMap.set('/', segmentBuffer) + } else { + segmentBufferMap.set(segmentPathStr, segmentBuffer) + } + } catch { + // If there are any errors, then we skip the segment. The effect is that + // a prefetch for this segment will 404. + } +} + +type SegmentPrefetch = { + rsc: React.ReactNode | null + loading: LoadingModuleData +} + +async function PickSegment({ + fullPageDataBuffer, + serverConsumerManifest, + segmentPath, +}: { + fullPageDataBuffer: Buffer + serverConsumerManifest: any + segmentPath: Array<[string, Segment]> +}): Promise { + // We're currently rendering a Flight response for a segment prefetch. + // Decode the Flight stream for the whole page, then pick out the data for the + // segment at the given path. This ends up happening once per segment. Not + // ideal, but we do it this way so that that we can transfer the side effects + // from the original Flight stream (e.g. Float preloads) onto the Flight + // stream for each segment's prefetch. + // + // This does mean that a prefetch for an individual segment will include the + // resources for the entire page it belongs to, but this is a reasonable + // trade-off for now. The main downside is a bit of extra bandwidth. + const replayConsoleLogs = true + const rscPayload: InitialRSCPayload = await createFromReadableStream( + streamFromBuffer(fullPageDataBuffer), + { + serverConsumerManifest, + replayConsoleLogs, + } + ) + + // FlightDataPaths is an unsound type, hence the additional checks. + const flightDataPaths = rscPayload.f + if (flightDataPaths.length !== 1 && flightDataPaths[0].length !== 3) { + console.error( + 'Internal Next.js error: InitialRSCPayload does not match the expected ' + + 'shape for a prerendered page during segment prefetch generation.' + ) + return null + } + + // This starts out as the data for the whole page. Use the segment path to + // find the data for the desired segment. + let seedData: CacheNodeSeedData = flightDataPaths[0][1] + for (const [parallelRouteKey] of segmentPath) { + // Normally when traversing a route tree we would compare the segments to + // confirm that they match (i.e. are representations of the same tree), + // but we don't bother to do that here because because the path was + // generated from the same data tree that we're currently traversing. + const children = seedData[2] + const child = children[parallelRouteKey] + if (!child) { + // No child found for this segment path. Exit. Again, this should be + // unreachable because the segment path was computed using the same + // source as the page data, but the type system doesn't know that. + return null + } else { + // Keep traversing down the segment path + seedData = child + } + } + + // We've reached the end of the segment path. seedData now represents the + // correct segment. + // + // In the future, this is where we can include additional metadata, like the + // stale time and cache tags. + const rsc = seedData[1] + const loading = seedData[3] + return { + rsc, + loading, + } +} + +// TODO: Consider updating or unifying this encoding logic for segments with +// createRouterCacheKey on the client, perhaps by including it as part of +// the FlightRouterState. Theoretically the client should never have to do its +// own encoding of segment keys; it can pass back whatever the server gave it. +function encodeChildSegmentAsFilesystemSafePathname( + parallelRouteKey: string, + segment: Segment +): string { + // Encode a child segment and its corresponding parallel route key to a + // filesystem-safe pathname. The format is internal-only and can be somewhat + // arbitrary as long as there are no collisions, because these will be used + // as filenames during build and in the incremental cache. They will also + // be sent by the client to request the corresponding segment, but they + // do not need to be decodable. The server will merely look for a matching + // file in the cache. + // + // For ease of debugging, the format looks roughly similar to the App Router + // convention for defining routes in the source, but again the exact format is + // not important as long as it's consistent between the client and server and + // meets the above requirements. + // + // TODO: If the segment did not read from params, then we can omit the + // params from the cache key. Need to track this during the prerender somehow. + let safeSegmentValue + if (typeof segment === 'string') { + safeSegmentValue = encodeParamValue(segment) + } else { + // Parameterized segments. + const [paramName, paramValue, paramType] = segment + let paramPrefix + switch (paramType) { + case 'c': + case 'ci': + paramPrefix = `[...${paramName}]` + break + case 'oc': + paramPrefix = `[[...${paramName}]]` + break + case 'd': + case 'di': + paramPrefix = `[${paramName}]` + break + default: + throw new Error('Unknown dynamic param type') + } + safeSegmentValue = `${paramPrefix}-${encodeParamValue(paramValue)}` + } + let result + if (parallelRouteKey === 'children') { + // Omit the parallel route key for children, since this is the most + // common case. Saves some bytes. + result = `${safeSegmentValue}` + } else { + result = `@${parallelRouteKey}/${safeSegmentValue}` + } + return result +} + +// Define a regex pattern to match the most common characters found in a route +// param. It excludes anything that might not be cross-platform filesystem +// compatible, like |. It does not need to be precise because the fallback is to +// just base64url-encode the whole parameter, which is fine; we just don't do it +// by default for compactness, and for easier debugging. +const simpleParamValueRegex = /^[a-zA-Z0-9\-_@]+$/ + +function encodeParamValue(segment: string): string { + if (segment === UNDERSCORE_NOT_FOUND_ROUTE) { + // TODO: FlightRouterState encodes Not Found routes as "/_not-found". But + // params typically don't include the leading slash. We should use a + // different encoding to avoid this special case. + return '_not-found' + } + if (simpleParamValueRegex.test(segment)) { + return segment + } + // If there are any unsafe characters, base64url-encode the entire segment. + // We also add a $ prefix so it doesn't collide with the simple case. + return '$' + Buffer.from(segment, 'utf-8').toString('base64url') +} diff --git a/packages/next/src/server/app-render/entry-base.ts b/packages/next/src/server/app-render/entry-base.ts index 9fe0b0f4a05f4..f7a1a0f693659 100644 --- a/packages/next/src/server/app-render/entry-base.ts +++ b/packages/next/src/server/app-render/entry-base.ts @@ -42,6 +42,7 @@ import { import { preloadStyle, preloadFont, preconnect } from './rsc/preloads' import { Postpone } from './rsc/postpone' import { taintObjectReference } from './rsc/taint' +export { collectSegmentData } from './collect-segment-data' // patchFetch makes use of APIs such as `React.unstable_postpone` which are only available // in the experimental channel of React, so export it from here so that it comes from the bundled runtime diff --git a/test/e2e/app-dir/ppr-navigations/simple/per-segment-prefetching.test.ts b/test/e2e/app-dir/ppr-navigations/simple/per-segment-prefetching.test.ts index b92dfcda1638f..3fef0d6623487 100644 --- a/test/e2e/app-dir/ppr-navigations/simple/per-segment-prefetching.test.ts +++ b/test/e2e/app-dir/ppr-navigations/simple/per-segment-prefetching.test.ts @@ -24,11 +24,9 @@ describe('per segment prefetching', () => { }) expect(response.status).toBe(200) const responseText = await response.text() - expect(responseText.trim()).toBe( - // The actual data is not yet generated, but this indicates that the - // request was handled correctly. - 'TODO (Per Segment Prefetching): Not yet implemented' - ) + // This is a basic check to ensure that the name of an expected field is + // somewhere in the Flight stream. + expect(responseText).toInclude('"rsc"') }) it('respond with 404 if the segment does not have prefetch data', async () => { From 916c855b34e70cca74a20af70c4ae9f23375c170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=A3=A8=EB=B0=80LuMir?= Date: Tue, 5 Nov 2024 06:56:12 +0900 Subject: [PATCH 26/28] fix: `next info` command does not output the versions of `npm` `yarn` and `pnpm` correctly (#71134) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # 🐛Fixed a bug Hello, I've fixed a bug where the `next info` command does not correctly output the versions of `npm`, `yarn`, and `pnpm` especially in **Windows**. ## Why? Although `npm`, `yarn`, and `pnpm` are correctly installed, the `next info` command does not accurately display their versions, as shown in the screenshot below. ![image](https://github.com/user-attachments/assets/efcda4c6-0a54-4421-8500-86acda3155b9) ## How? ### 1. Fallback to `execSync` If `execFileSync` throws an error (indicating that the command could not be executed or the output was not valid), the code now attempts to run the same command using `execSync`. This provides a second chance to retrieve the version. ### 2. Error Handling Both `execFileSync` and `execSync` are wrapped in their respective try-catch blocks. If both attempts fail, the function will return `'N/A'`, just like before. This change enhances the robustness of the function by ensuring that it can still retrieve the version information even if the first method fails due to environment variable issues or other reasons related to how the command is executed. > `execSync` and `execFileSync` execute processes in different ways in Node.js. The differences between these two functions can lead to variations in the output of the Package Manager's version. > > `execSync` > > `execSync` accepts commands as strings and executes them in a shell. During this process, all shell environment variables are applied, allowing the command to run with any environment variables related to Package Managers. For example, calling `execSync('npm --version')` will utilize all environment variables associated with the current user's environment, ensuring that `npm` is correctly installed and located. > > `execFileSync` > > `execFileSync`, on the other hand, takes the executable file and its arguments as an array and runs the file directly. This means that it starts the process without going through the shell, so shell environment variables and settings are not applied. Since Package Managers are generally designed to work correctly when executed in a shell, running Package Managers via `execFileSync` may lead to missing environment variables, resulting in incorrect output. ## Result It now works properly. ![image](https://github.com/user-attachments/assets/93ab0389-bce9-4674-b458-2df1c57a5b5d) --- - fixes: I tried to find but no related issues. Co-authored-by: Sam Ko --- packages/next/src/cli/next-info.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/next/src/cli/next-info.ts b/packages/next/src/cli/next-info.ts index 7c68c35954586..0e2c36df3f8bb 100755 --- a/packages/next/src/cli/next-info.ts +++ b/packages/next/src/cli/next-info.ts @@ -82,7 +82,11 @@ function getBinaryVersion(binaryName: string) { .toString() .trim() } catch { - return 'N/A' + try { + return childProcess.execSync(`${binaryName} --version`).toString().trim() + } catch { + return 'N/A' + } } } From 6cf63ff83005c3de720cec3d6a09a2ddd8a3e8c2 Mon Sep 17 00:00:00 2001 From: Sam Ko Date: Mon, 4 Nov 2024 14:12:12 -0800 Subject: [PATCH 27/28] docs(use-cache): fix typo and link (#72292) ## Why? We have a typo and incorrect link. - Fixes https://github.com/vercel/next.js/issues/72266 --- docs/02-app/02-api-reference/01-directives/use-cache.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/02-app/02-api-reference/01-directives/use-cache.mdx b/docs/02-app/02-api-reference/01-directives/use-cache.mdx index 982d6ae575239..85b972967246a 100644 --- a/docs/02-app/02-api-reference/01-directives/use-cache.mdx +++ b/docs/02-app/02-api-reference/01-directives/use-cache.mdx @@ -127,7 +127,7 @@ export default Page() { } ``` -> This is recommended for applications that previously used the [`export const dynamic = "force-cache"`](/docs/app/building-your-application/caching#opting-out-1) option, and will ensure the entire route is prerendered. +> This is recommended for applications that previously used the [`export const dynamic = "force-static"`](/docs/app/api-reference/file-conventions/route-segment-config#dynamic) option, and will ensure the entire route is prerendered. ### Caching component output with `use cache` From bc5443dd3e224a0f11ae16cd74f8aae8eadc9c12 Mon Sep 17 00:00:00 2001 From: Jude Gao Date: Mon, 4 Nov 2024 17:33:06 -0500 Subject: [PATCH 28/28] patchFile awaits compilation (#72267) We will wait the server to respond with a compile success message after a file is patched before proceeding to the next steps in the test to reduce flakiness. By doing so, we uncovered a few tests that were passing accidentally due to flakiness of `patchFile`, and fixed them in the PR. --- test/development/middleware-errors/index.test.ts | 8 ++++---- test/e2e/prerender.test.ts | 7 +------ test/e2e/prerender/pages/index.js | 1 - test/lib/next-modes/base.ts | 1 + test/lib/next-modes/next-dev.ts | 12 ++++++++++++ 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/test/development/middleware-errors/index.test.ts b/test/development/middleware-errors/index.test.ts index 1dd3d45f1ee61..110846256309c 100644 --- a/test/development/middleware-errors/index.test.ts +++ b/test/development/middleware-errors/index.test.ts @@ -55,7 +55,7 @@ describe('middleware - development errors', () => { const browser = await next.browser('/') await assertHasRedbox(browser) await next.patchFile('middleware.js', `export default function () {}`) - await assertHasRedbox(browser) + await assertNoRedbox(browser) }) }) @@ -160,7 +160,7 @@ describe('middleware - development errors', () => { await assertHasRedbox(browser) expect(await getRedboxSource(browser)).toContain(`eval('test')`) await next.patchFile('middleware.js', `export default function () {}`) - await assertHasRedbox(browser) + await assertNoRedbox(browser) }) }) @@ -207,7 +207,7 @@ describe('middleware - development errors', () => { expect(source).toContain('middleware.js') expect(source).not.toContain('//middleware.js') await next.patchFile('middleware.js', `export default function () {}`) - await assertHasRedbox(browser) + await assertNoRedbox(browser) }) }) @@ -311,7 +311,7 @@ describe('middleware - development errors', () => { await browser.elementByCss('#nextjs__container_errors_desc').text() ).toEqual('Failed to compile') await next.patchFile('middleware.js', `export default function () {}`) - await assertHasRedbox(browser) + await assertNoRedbox(browser) expect(await browser.elementByCss('#page-title')).toBeTruthy() }) }) diff --git a/test/e2e/prerender.test.ts b/test/e2e/prerender.test.ts index 48b4a223ccd3d..3d5d6ac1746de 100644 --- a/test/e2e/prerender.test.ts +++ b/test/e2e/prerender.test.ts @@ -1133,13 +1133,8 @@ describe('Prerender', () => { await next.patchFile( 'pages/index.js', - (content) => - content - .replace('// throw new', 'throw new') - .replace('{/* */}', ''), + (content) => content.replace('// throw new', 'throw new'), async () => { - await browser.waitForElementByCss('#after-change') // we need to reload the page to trigger getStaticProps await browser.refresh() diff --git a/test/e2e/prerender/pages/index.js b/test/e2e/prerender/pages/index.js index a28d2e6bbaa6a..af9e8cb032c37 100644 --- a/test/e2e/prerender/pages/index.js +++ b/test/e2e/prerender/pages/index.js @@ -12,7 +12,6 @@ export async function getStaticProps() { const Page = ({ world, time }) => { return ( <> - {/*

idk
*/}

hello {world}

time: {time} diff --git a/test/lib/next-modes/base.ts b/test/lib/next-modes/base.ts index 3f52c56b33a44..a3d6a45217026 100644 --- a/test/lib/next-modes/base.ts +++ b/test/lib/next-modes/base.ts @@ -74,6 +74,7 @@ export class NextInstance { public forcedPort?: string public dirSuffix: string = '' public serverReadyPattern?: RegExp = / ✓ Ready in / + public serverCompiledPattern?: RegExp = / ✓ Compiled / constructor(opts: NextInstanceOpts) { this.env = {} diff --git a/test/lib/next-modes/next-dev.ts b/test/lib/next-modes/next-dev.ts index 78ffcc1fc1a35..3be1ea027455e 100644 --- a/test/lib/next-modes/next-dev.ts +++ b/test/lib/next-modes/next-dev.ts @@ -174,6 +174,18 @@ export class NextDevInstance extends NextInstance { throw new Error('Server has not finished restarting.') } }) + } else { + try { + await retry(async () => { + const cliOutput = this.cliOutput.slice(cliOutputLength) + + if (!this.serverCompiledPattern.test(cliOutput)) { + throw new Error('Server has not finished restarting.') + } + }, 5000) + } catch (e) { + /** Fail silently because not all change will be reflected in the server output */ + } } } }