Unverified Commit 5c693e52 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Merge branch 'canary' into revert-92733-revert-90018-fix/export-write-directly-to-server-pages

parents 17353cc6 b6cf70eb
...@@ -168,8 +168,7 @@ jobs: ...@@ -168,8 +168,7 @@ jobs:
abi: msvc abi: msvc
arch: arch:
x86_64: {} x86_64: {}
aarch64: aarch64: {}
build_task: build-native-no-plugin-release
linux: linux:
host: "['self-hosted', 'linux', 'x64', 'metal']" host: "['self-hosted', 'linux', 'x64', 'metal']"
docker: next-swc-builder:latest docker: next-swc-builder:latest
...@@ -199,6 +198,9 @@ jobs: ...@@ -199,6 +198,9 @@ jobs:
name: stable - ${{ matrix.target }} - node@20 name: stable - ${{ matrix.target }} - node@20
runs-on: ${{ fromJSON(matrix.host) }} runs-on: ${{ fromJSON(matrix.host) }}
timeout-minutes: 45 timeout-minutes: 45
env:
# Disable all build caches for production/staging/force-preview deploys
NEXT_SKIP_BUILD_CACHE: ${{ contains(fromJSON('["production","staging","force-preview"]'), needs.deploy-target.outputs.value) && '1' || '' }}
steps: steps:
# Enable long paths on Windows to avoid MAX_PATH (260 char) errors # Enable long paths on Windows to avoid MAX_PATH (260 char) errors
# with deeply nested node_modules/.pnpm paths # with deeply nested node_modules/.pnpm paths
...@@ -238,7 +240,7 @@ jobs: ...@@ -238,7 +240,7 @@ jobs:
run: node scripts/normalize-version-bump.js run: node scripts/normalize-version-bump.js
- name: Cache on ${{ github.ref_name }} - name: Cache on ${{ github.ref_name }}
if: ${{ !matrix.docker }} if: ${{ !matrix.docker && !env.NEXT_SKIP_BUILD_CACHE }}
uses: ijjk/rust-cache@a34594c450817c9860143c79797a8770c4e587f5 # turbo-cache-v1.0.9 uses: ijjk/rust-cache@a34594c450817c9860143c79797a8770c4e587f5 # turbo-cache-v1.0.9
with: with:
save-if: 'true' save-if: 'true'
...@@ -251,11 +253,11 @@ jobs: ...@@ -251,11 +253,11 @@ jobs:
# Try to restore the native binary BEFORE loading the Docker image. # Try to restore the native binary BEFORE loading the Docker image.
# If the binary cache hits, we skip the expensive Docker image restore entirely. # If the binary cache hits, we skip the expensive Docker image restore entirely.
- name: Rust fingerprint - name: Rust fingerprint
if: ${{ matrix.docker }} if: ${{ matrix.docker && !env.NEXT_SKIP_BUILD_CACHE }}
run: pnpm dlx turbo@${TURBO_VERSION} run rust-fingerprint ${TURBO_ARGS} run: pnpm dlx turbo@${TURBO_VERSION} run rust-fingerprint ${TURBO_ARGS}
- name: Restore native binary cache - name: Restore native binary cache
if: ${{ matrix.docker }} if: ${{ matrix.docker && !env.NEXT_SKIP_BUILD_CACHE }}
id: native-cache id: native-cache
run: node scripts/native-cache.js --restore --target ${{ matrix.target }} && echo "HIT=yes" >> $GITHUB_OUTPUT || echo "HIT=no" >> $GITHUB_OUTPUT run: node scripts/native-cache.js --restore --target ${{ matrix.target }} && echo "HIT=yes" >> $GITHUB_OUTPUT || echo "HIT=no" >> $GITHUB_OUTPUT
...@@ -269,8 +271,8 @@ jobs: ...@@ -269,8 +271,8 @@ jobs:
run: | run: |
docker run --rm \ docker run --rm \
-e CI -e RUST_BACKTRACE -e CARGO_TERM_COLOR \ -e CI -e RUST_BACKTRACE -e CARGO_TERM_COLOR \
-e CARGO_INCREMENTAL=0 -e CARGO_REGISTRIES_CRATES_IO_PROTOCOL -e TURBO_API \ -e CARGO_INCREMENTAL=0 -e CARGO_REGISTRIES_CRATES_IO_PROTOCOL \
-e TURBO_TEAM -e TURBO_TOKEN -e TURBO_VERSION -e TURBO_CACHE="remote:rw" \ ${{ env.NEXT_SKIP_BUILD_CACHE && ' ' || '-e TURBO_API -e TURBO_TEAM -e TURBO_TOKEN -e TURBO_VERSION -e TURBO_CACHE=remote:rw' }} \
-e TARGET="${{ matrix.target }}" \ -e TARGET="${{ matrix.target }}" \
-e ABI="${{ matrix.abi }}" \ -e ABI="${{ matrix.abi }}" \
-e ARCH="${{ matrix.arch }}" \ -e ARCH="${{ matrix.arch }}" \
...@@ -284,7 +286,7 @@ jobs: ...@@ -284,7 +286,7 @@ jobs:
-xeo pipefail scripts/docker-native-build.sh -xeo pipefail scripts/docker-native-build.sh
- name: Save native binary cache - name: Save native binary cache
if: ${{ matrix.docker && steps.native-cache.outputs.HIT != 'yes' }} if: ${{ matrix.docker && steps.native-cache.outputs.HIT != 'yes' && !env.NEXT_SKIP_BUILD_CACHE }}
run: node scripts/native-cache.js --save --target ${{ matrix.target }} run: node scripts/native-cache.js --save --target ${{ matrix.target }}
- name: 'Build' - name: 'Build'
...@@ -297,7 +299,8 @@ jobs: ...@@ -297,7 +299,8 @@ jobs:
rustc --version --verbose || true rustc --version --verbose || true
node -v node -v
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}"
pnpm dlx turbo@${TURBO_VERSION} run ${{ matrix.build_task }} ${TURBO_ARGS} -- --target ${{ matrix.target }} TURBO_CACHE_FLAG="${NEXT_SKIP_BUILD_CACHE:+--force}"
pnpm dlx turbo@${TURBO_VERSION} run ${{ matrix.build_task }} ${TURBO_ARGS} ${TURBO_CACHE_FLAG} -- --target ${{ matrix.target }}
if [ "${{ matrix.os }}" != "windows" ]; then if [ "${{ matrix.os }}" != "windows" ]; then
strip -x packages/next-swc/native/next-swc.*.node strip -x packages/next-swc/native/next-swc.*.node
fi fi
......
...@@ -88,7 +88,7 @@ jobs: ...@@ -88,7 +88,7 @@ jobs:
- name: Build next-swc - name: Build next-swc
run: | run: |
hyperfine --min-runs 1 --show-output 'pnpm run --filter=@next/swc build-native --features plugin --release' hyperfine --min-runs 1 --show-output 'pnpm run --filter=@next/swc build-native --release'
echo "Successfully built next-swc with published turbopack" echo "Successfully built next-swc with published turbopack"
- name: Build next.js - name: Build next.js
......
...@@ -4989,7 +4989,6 @@ dependencies = [ ...@@ -4989,7 +4989,6 @@ dependencies = [
"turbo-unix-path", "turbo-unix-path",
"turbopack-core", "turbopack-core",
"turbopack-ecmascript-hmr-protocol", "turbopack-ecmascript-hmr-protocol",
"turbopack-ecmascript-plugins",
"turbopack-node", "turbopack-node",
"turbopack-trace-server", "turbopack-trace-server",
"turbopack-trace-utils", "turbopack-trace-utils",
...@@ -10133,6 +10132,7 @@ dependencies = [ ...@@ -10133,6 +10132,7 @@ dependencies = [
name = "turbo-tasks-malloc" name = "turbo-tasks-malloc"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"libmimalloc-sys",
"mimalloc", "mimalloc",
] ]
...@@ -10481,6 +10481,7 @@ dependencies = [ ...@@ -10481,6 +10481,7 @@ dependencies = [
"tracing", "tracing",
"turbo-bincode", "turbo-bincode",
"turbo-esregex", "turbo-esregex",
"turbo-frozenmap",
"turbo-rcstr", "turbo-rcstr",
"turbo-tasks", "turbo-tasks",
"turbo-tasks-backend", "turbo-tasks-backend",
......
...@@ -87,7 +87,7 @@ inherits = "release" ...@@ -87,7 +87,7 @@ inherits = "release"
debug = true debug = true
# Size-optimized crates: determined via `cargo bloat --release --crates -p next-napi-bindings`. # Size-optimized crates: determined via `cargo bloat --release --crates -p next-napi-bindings`.
# Wasmtime/cranelift crates are used by the plugin feature (wasm builds). # Wasmtime/cranelift crates are used by the SWC plugin transform system.
[profile.release.package.browserslist-rs] [profile.release.package.browserslist-rs]
opt-level = "s" opt-level = "s"
......
import type { Metadata } from 'next' import type { Metadata } from 'next'
import type React from 'react' import type React from 'react'
// @ts-expect-error - Fixed once Next.js 16.2.0 is used.
import './globals.css' import './globals.css'
export const metadata: Metadata = { export const metadata: Metadata = {
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
"version": "16.0.2-canary.16", "version": "16.0.2-canary.16",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "cross-env NEXT_TEST_NATIVE_IGNORE_LOCAL_INSTALL=true NEXT_TEST_NATIVE_DIR=no NEXT_TEST_WASM= next build --no-mangling", "build": "cross-env NEXT_TEST_NATIVE_IGNORE_LOCAL_INSTALL=true NEXT_TEST_WASM= next build --no-mangling",
"dev": "cross-env NEXT_TEST_NATIVE_IGNORE_LOCAL_INSTALL=true NEXT_TEST_NATIVE_DIR=no next dev", "dev": "cross-env NEXT_TEST_NATIVE_IGNORE_LOCAL_INSTALL=true next dev",
"lint": "eslint .", "lint": "eslint .",
"start": "cross-env NEXT_TEST_NATIVE_IGNORE_LOCAL_INSTALL=true NEXT_TEST_NATIVE_DIR=no next start" "start": "cross-env NEXT_TEST_NATIVE_IGNORE_LOCAL_INSTALL=true next start"
}, },
"dependencies": { "dependencies": {
"@radix-ui/react-dialog": "1.1.4", "@radix-ui/react-dialog": "1.1.4",
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"clsx": "^2.1.1", "clsx": "^2.1.1",
"cmdk": "1.0.4", "cmdk": "1.0.4",
"lucide-react": "^0.554.0", "lucide-react": "^0.554.0",
"next": "16.0.8", "next": "16.2.3",
"next-themes": "^0.4.6", "next-themes": "^0.4.6",
"polished": "^4.3.1", "polished": "^4.3.1",
"react": "19.2.0", "react": "19.2.0",
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"fumadocs-core": "15.7.12", "fumadocs-core": "15.7.12",
"fumadocs-mdx": "11.10.0", "fumadocs-mdx": "11.10.0",
"fumadocs-ui": "15.7.12", "fumadocs-ui": "15.7.12",
"next": "15.5.8", "next": "16.2.3",
"react": "19.1.1", "react": "19.1.1",
"react-dom": "19.1.1" "react-dom": "19.1.1"
}, },
......
...@@ -92,6 +92,7 @@ fn main() { ...@@ -92,6 +92,7 @@ fn main() {
*cell = Some(Instant::now()); *cell = Some(Instant::now());
} }
}); });
TurboMalloc::thread_park();
}) })
.build() .build()
.unwrap() .unwrap()
......
...@@ -92,11 +92,6 @@ default = ["process_pool"] ...@@ -92,11 +92,6 @@ default = ["process_pool"]
process_pool = ["turbopack-node/process_pool"] process_pool = ["turbopack-node/process_pool"]
worker_pool = ["turbopack-node/worker_pool"] worker_pool = ["turbopack-node/worker_pool"]
next-font-local = [] next-font-local = []
plugin = [
"swc_core/__plugin_transform_host",
"swc_core/__plugin_transform_host_schema_v1",
"turbopack-ecmascript-plugins/swc_ecma_transform_plugin",
]
image-webp = ["turbopack-image/webp"] image-webp = ["turbopack-image/webp"]
image-avif = ["turbopack-image/avif"] image-avif = ["turbopack-image/avif"]
......
...@@ -14,9 +14,7 @@ ...@@ -14,9 +14,7 @@
"jsx": "react-jsx", "jsx": "react-jsx",
"lib": ["ESNext", "DOM"], "lib": ["ESNext", "DOM"],
"target": "esnext", "target": "esnext",
"ignoreDeprecations": "6.0",
// modules // modules
"baseUrl": ".",
"module": "node16", "module": "node16",
"moduleResolution": "node16", "moduleResolution": "node16",
"resolveJsonModule": true, "resolveJsonModule": true,
......
use anyhow::Result; use anyhow::Result;
#[allow(unused_imports)]
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::Vc; use turbo_tasks::Vc;
use turbo_tasks_fs::FileSystemPath; use turbo_tasks_fs::FileSystemPath;
use turbopack::module_options::ModuleRule; use turbopack::module_options::ModuleRule;
#[allow(unused_imports)]
use turbopack_core::{context::AssetContext, resolve::origin::ResolveOrigin}; use turbopack_core::{context::AssetContext, resolve::origin::ResolveOrigin};
use crate::next_config::NextConfig; use crate::next_config::NextConfig;
...@@ -15,30 +13,19 @@ pub async fn get_swc_ecma_transform_plugin_rule( ...@@ -15,30 +13,19 @@ pub async fn get_swc_ecma_transform_plugin_rule(
) -> Result<Option<ModuleRule>> { ) -> Result<Option<ModuleRule>> {
let plugin_configs = next_config.experimental_swc_plugins().await?; let plugin_configs = next_config.experimental_swc_plugins().await?;
if !plugin_configs.is_empty() { if !plugin_configs.is_empty() {
#[cfg(feature = "plugin")] let enable_mdx_rs = next_config.mdx_rs().await?.is_some();
{ get_swc_ecma_transform_rule_impl(project_path, &plugin_configs, enable_mdx_rs).await
let enable_mdx_rs = next_config.mdx_rs().await?.is_some();
get_swc_ecma_transform_rule_impl(project_path, &plugin_configs, enable_mdx_rs).await
}
#[cfg(not(feature = "plugin"))]
{
let _ = project_path; // To satisfy lint
Ok(None)
}
} else { } else {
Ok(None) Ok(None)
} }
} }
/// A resolve origin without any asset_context, intended for handle_resolve_error /// A resolve origin without any asset_context, intended for handle_resolve_error
#[cfg(feature = "plugin")]
#[turbo_tasks::value] #[turbo_tasks::value]
pub struct DummyResolveOrigin { pub struct DummyResolveOrigin {
origin_path: FileSystemPath, origin_path: FileSystemPath,
} }
#[cfg(feature = "plugin")]
#[turbo_tasks::value_impl] #[turbo_tasks::value_impl]
impl DummyResolveOrigin { impl DummyResolveOrigin {
#[turbo_tasks::function] #[turbo_tasks::function]
...@@ -47,7 +34,6 @@ impl DummyResolveOrigin { ...@@ -47,7 +34,6 @@ impl DummyResolveOrigin {
} }
} }
#[cfg(feature = "plugin")]
#[turbo_tasks::value_impl] #[turbo_tasks::value_impl]
impl ResolveOrigin for DummyResolveOrigin { impl ResolveOrigin for DummyResolveOrigin {
#[turbo_tasks::function] #[turbo_tasks::function]
...@@ -61,7 +47,6 @@ impl ResolveOrigin for DummyResolveOrigin { ...@@ -61,7 +47,6 @@ impl ResolveOrigin for DummyResolveOrigin {
} }
} }
#[cfg(feature = "plugin")]
pub async fn get_swc_ecma_transform_rule_impl( pub async fn get_swc_ecma_transform_rule_impl(
project_path: FileSystemPath, project_path: FileSystemPath,
plugin_configs: &[(RcStr, serde_json::Value)], plugin_configs: &[(RcStr, serde_json::Value)],
......
...@@ -119,6 +119,9 @@ pub struct NextSegmentConfig { ...@@ -119,6 +119,9 @@ pub struct NextSegmentConfig {
#[turbo_tasks(trace_ignore)] #[turbo_tasks(trace_ignore)]
#[bincode(with_serde)] #[bincode(with_serde)]
pub unstable_instant: Option<Span>, pub unstable_instant: Option<Span>,
#[turbo_tasks(trace_ignore)]
#[bincode(with_serde)]
pub unstable_prefetch: Option<Span>,
} }
#[turbo_tasks::value_impl] #[turbo_tasks::value_impl]
...@@ -533,9 +536,25 @@ pub async fn parse_segment_config_from_source( ...@@ -533,9 +536,25 @@ pub async fn parse_segment_config_from_source(
"unstable_instant", "unstable_instant",
span, span,
rcstr!( rcstr!(
"App pages cannot export \"unstable_instant\" from a Client Component module. \ "\"unstable_instant\" is a route segment config and can only be used when the \
To use this API, convert this module to a Server Component by removing the \ segment is a Server Component module. Remove the \"use client\" directive to \
\"use client\" directive." use this API."
),
None,
IssueSeverity::Error,
)
.await?;
}
if let Some(span) = config.unstable_prefetch {
invalid_config(
source,
"unstable_prefetch",
span,
rcstr!(
"\"unstable_prefetch\" is a route segment config and can only be used when \
the segment is a Server Component module. Remove the \"use client\" \
directive to use this API."
), ),
None, None,
IssueSeverity::Error, IssueSeverity::Error,
...@@ -962,6 +981,9 @@ async fn parse_config_value( ...@@ -962,6 +981,9 @@ async fn parse_config_value(
"unstable_instant" => { "unstable_instant" => {
config.unstable_instant = Some(span); config.unstable_instant = Some(span);
} }
"unstable_prefetch" => {
config.unstable_prefetch = Some(span);
}
_ => {} _ => {}
} }
......
...@@ -4,20 +4,6 @@ name = "next-custom-transforms" ...@@ -4,20 +4,6 @@ name = "next-custom-transforms"
version = "0.0.0" version = "0.0.0"
publish = false publish = false
[features]
plugin = [
"swc_core/__plugin_transform_host",
"swc_core/__plugin_transform_host_schema_v1",
"turbopack-ecmascript-plugins/swc_ecma_transform_plugin",
]
[package.metadata.cargo-shear]
ignored = [
# when using the `plugin` feature, we need to set a feature flag on `turbopack-ecmascript-plugins`
# so we must list it as a dependency even though we don't directly use it
"turbopack-ecmascript-plugins",
]
[lints] [lints]
workspace = true workspace = true
...@@ -64,7 +50,6 @@ styled_components = { workspace = true } ...@@ -64,7 +50,6 @@ styled_components = { workspace = true }
styled_jsx = { workspace = true } styled_jsx = { workspace = true }
swc_emotion = { workspace = true } swc_emotion = { workspace = true }
swc_relay = { workspace = true } swc_relay = { workspace = true }
turbopack-ecmascript-plugins = { workspace = true, optional = true }
turbo-rcstr = { workspace = true } turbo-rcstr = { workspace = true }
urlencoding = { workspace = true } urlencoding = { workspace = true }
next-taskless = { workspace = true } next-taskless = { workspace = true }
...@@ -75,7 +60,6 @@ preset_env_base = { workspace = true } ...@@ -75,7 +60,6 @@ preset_env_base = { workspace = true }
[dev-dependencies] [dev-dependencies]
testing = { workspace = true } testing = { workspace = true }
# effectively enable the "plugin" feature for tests
swc_core = { workspace = true, features = ["testing_transform", "__plugin_transform_host", "__plugin_transform_host_schema_v1"] } swc_core = { workspace = true, features = ["testing_transform", "__plugin_transform_host", "__plugin_transform_host_schema_v1"] }
swc_plugin_backend_wasmtime = { workspace = true } swc_plugin_backend_wasmtime = { workspace = true }
turbopack-ecmascript-plugins = { workspace = true, features = ["swc_ecma_transform_plugin"] } turbopack-ecmascript-plugins = { workspace = true }
...@@ -8,23 +8,6 @@ publish = false ...@@ -8,23 +8,6 @@ publish = false
crate-type = ["cdylib"] crate-type = ["cdylib"]
[features] [features]
# Instead of enabling all the plugin-related functionality by default, make it
# overridable when built (i.e napi --build --features plugin). This is due to
# some of transitive dependencies have features cannot be enabled at the same
# time (i.e wasmer/default vs wasmer/js-default) while cargo merges all the
# features at once.
plugin = [
# Use granular plugin features to avoid pulling in wasmer via __plugin_transform_env_native.
"swc_core/__plugin_transform_host",
"swc_core/__plugin_transform_host_schema_v1",
"swc_core/plugin_transform_host_native_filesystem_cache",
"dep:swc_plugin_backend_wasmtime",
"next-custom-transforms/plugin",
"next-core/plugin",
"turbopack-ecmascript-plugins",
"turbopack-ecmascript-plugins/swc_ecma_transform_plugin",
]
image-webp = ["next-core/image-webp"] image-webp = ["next-core/image-webp"]
image-avif = ["next-core/image-avif"] image-avif = ["next-core/image-avif"]
# Enable all the available image codec support. # Enable all the available image codec support.
...@@ -50,11 +33,6 @@ ignored = [ ...@@ -50,11 +33,6 @@ ignored = [
# we need to set features on these packages when building for WASM, but we don't directly use them # we need to set features on these packages when building for WASM, but we don't directly use them
"getrandom", "getrandom",
"iana-time-zone", "iana-time-zone",
# the plugins feature needs to set a feature on this transitively depended-on package, we never
# directly import it
"turbopack-ecmascript-plugins",
# used conditionally behind the `plugin` feature flag
"swc_plugin_backend_wasmtime",
] ]
[dependencies] [dependencies]
...@@ -105,13 +83,16 @@ swc_core = { workspace = true, features = [ ...@@ -105,13 +83,16 @@ swc_core = { workspace = true, features = [
"ecma_transforms_typescript", "ecma_transforms_typescript",
"ecma_utils", "ecma_utils",
"ecma_visit", "ecma_visit",
"__plugin_transform_host",
"__plugin_transform_host_schema_v1",
"plugin_transform_host_native_filesystem_cache",
] } ] }
# Dependencies for the native, non-wasm32 build. # Dependencies for the native, non-wasm32 build.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
lightningcss-napi = { workspace = true } lightningcss-napi = { workspace = true }
swc_plugin_backend_wasmtime = { workspace = true, optional = true }
lightningcss = { workspace = true } lightningcss = { workspace = true }
swc_plugin_backend_wasmtime = { workspace = true }
tokio = { workspace = true, features = ["full"] } tokio = { workspace = true, features = ["full"] }
turbo-rcstr = { workspace = true, features = ["napi"] } turbo-rcstr = { workspace = true, features = ["napi"] }
turbo-tasks = { workspace = true } turbo-tasks = { workspace = true }
...@@ -132,7 +113,6 @@ turbopack-core = { workspace = true } ...@@ -132,7 +113,6 @@ turbopack-core = { workspace = true }
turbopack-ecmascript-hmr-protocol = { workspace = true } turbopack-ecmascript-hmr-protocol = { workspace = true }
turbopack-trace-utils = { workspace = true } turbopack-trace-utils = { workspace = true }
turbopack-trace-server = { workspace = true } turbopack-trace-server = { workspace = true }
turbopack-ecmascript-plugins = { workspace = true, optional = true }
turbopack-node = { workspace = true, default-features = false, features = ["worker_pool"] } turbopack-node = { workspace = true, default-features = false, features = ["worker_pool"] }
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
......
...@@ -106,6 +106,7 @@ fn init() { ...@@ -106,6 +106,7 @@ fn init() {
*cell = Some(Instant::now()); *cell = Some(Instant::now());
} }
}); });
TurboMalloc::thread_park();
}) })
.worker_threads(worker_threads) .worker_threads(worker_threads)
// Avoid a limit on threads to avoid deadlocks due to usage of block_in_place // Avoid a limit on threads to avoid deadlocks due to usage of block_in_place
......
...@@ -31,6 +31,7 @@ use std::{ ...@@ -31,6 +31,7 @@ use std::{
fs::read_to_string, fs::read_to_string,
panic::{AssertUnwindSafe, catch_unwind}, panic::{AssertUnwindSafe, catch_unwind},
rc::Rc, rc::Rc,
sync::Arc,
}; };
use anyhow::{Context as _, anyhow, bail}; use anyhow::{Context as _, anyhow, bail};
...@@ -41,10 +42,11 @@ use once_cell::sync::Lazy; ...@@ -41,10 +42,11 @@ use once_cell::sync::Lazy;
use rustc_hash::{FxHashMap, FxHashSet}; use rustc_hash::{FxHashMap, FxHashSet};
use swc_core::{ use swc_core::{
atoms::Atom, atoms::Atom,
base::{Compiler, TransformOutput, try_with_handler}, base::{Compiler, TransformOutput, config::RuntimeOptions, try_with_handler},
common::{FileName, GLOBALS, Mark, comments::SingleThreadedComments, errors::ColorConfig}, common::{FileName, GLOBALS, Mark, comments::SingleThreadedComments, errors::ColorConfig},
ecma::ast::noop_pass, ecma::ast::noop_pass,
}; };
use swc_plugin_backend_wasmtime::WasmtimeRuntime;
use crate::{complete_output, get_compiler, util::MapErr}; use crate::{complete_output, get_compiler, util::MapErr};
...@@ -128,15 +130,8 @@ impl Task for TransformTask { ...@@ -128,15 +130,8 @@ impl Task for TransformTask {
let unresolved_mark = Mark::new(); let unresolved_mark = Mark::new();
let mut options = options.patch(&fm); let mut options = options.patch(&fm);
options.swc.unresolved_mark = Some(unresolved_mark); options.swc.unresolved_mark = Some(unresolved_mark);
options.swc.runtime_options =
#[cfg(feature = "plugin")] RuntimeOptions::default().plugin_runtime(Arc::new(WasmtimeRuntime));
{
options.swc.runtime_options =
swc_core::base::config::RuntimeOptions::default()
.plugin_runtime(std::sync::Arc::new(
swc_plugin_backend_wasmtime::WasmtimeRuntime,
));
}
let cm = self.c.cm.clone(); let cm = self.c.cm.clone();
let file = fm.clone(); let file = fm.clone();
......
...@@ -213,3 +213,67 @@ export default async function Page() { ...@@ -213,3 +213,67 @@ export default async function Page() {
``` ```
If you access the draft Route Handler (with `secret` and `slug`) from your headless CMS or manually using the URL, you should now be able to see the draft content. And, if you update your draft without publishing, you should be able to view the draft. If you access the draft Route Handler (with `secret` and `slug`) from your headless CMS or manually using the URL, you should now be able to see the draft content. And, if you update your draft without publishing, you should be able to view the draft.
## Draft Mode with Cache Components
When using [caching directives](/docs/app/api-reference/directives/use-cache), Draft Mode forces all cached functions and components to produce fresh results on every request. You do not need to add any special handling to your caching code.
When Draft Mode is enabled:
- All functions and components under a caching directive scope re-execute on every request instead of serving from cache.
- Results are not saved to the cache, so draft requests do not pollute cached content.
- `fetch()` calls inside cached scopes use the original `fetch` implementation directly, without the Next.js fetch cache.
- Response headers are set to `private, no-cache, no-store, max-age=0, must-revalidate`.
You can read if Draft Mode is enabled inside a caching directive scope, so you can conditionally fetch draft or published content:
```tsx filename="app/post/[slug]/page.tsx" switcher
import { draftMode } from 'next/headers'
async function Post({ slug }: { slug: string }) {
'use cache'
const { isEnabled } = await draftMode()
// Fetch draft or published content based on draft mode status
const post = isEnabled
? await fetchDraftPost(slug)
: await fetchPublishedPost(slug)
return (
<article>
<h1>{post.title}</h1>
<div>{post.content}</div>
</article>
)
}
```
```jsx filename="app/post/[slug]/page.js" switcher
import { draftMode } from 'next/headers'
async function Post({ slug }) {
'use cache'
const { isEnabled } = await draftMode()
// Fetch draft or published content based on draft mode status
const post = isEnabled
? await fetchDraftPost(slug)
: await fetchPublishedPost(slug)
return (
<article>
<h1>{post.title}</h1>
<div>{post.content}</div>
</article>
)
}
```
> **Good to know:**
>
> - You can await the `draftMode()` promise inside a caching directive scope to read `isEnabled`, but other runtime APIs like `cookies()` and `headers()` are not allowed and will throw an error, even when Draft Mode is active. (The [`"use cache: private"`](/docs/app/api-reference/directives/use-cache-private) directive does allow access to `cookies()` and `headers()`.)
> - You cannot call `draftMode().enable()` or `draftMode().disable()` inside a caching directive scope. Draft Mode can only be toggled in [Route Handlers](/docs/app/api-reference/file-conventions/route) or [Server Actions](/docs/app/getting-started/mutating-data).
If your cached function needs values from `cookies()` or `headers()`, read them outside the caching directive scope and [pass them as arguments](/docs/app/getting-started/caching#passing-runtime-values-to-cached-functions).
...@@ -210,6 +210,30 @@ If the default in-memory cache isn't enough, consider **[`use cache: remote`](/d ...@@ -210,6 +210,30 @@ If the default in-memory cache isn't enough, consider **[`use cache: remote`](/d
Very rarely, for compliance requirements or when you can't refactor your code to pass runtime data as arguments to a `use cache` scope, you might need [`use cache: private`](/docs/app/api-reference/directives/use-cache-private). Very rarely, for compliance requirements or when you can't refactor your code to pass runtime data as arguments to a `use cache` scope, you might need [`use cache: private`](/docs/app/api-reference/directives/use-cache-private).
### Draft Mode
When [Draft Mode](/docs/app/guides/draft-mode) is enabled, all cached functions and components re-execute on every request, and results are not saved to the cache. This ensures draft content is always fresh without requiring any changes to your caching code.
You can read `isEnabled` from [`draftMode()`](/docs/app/api-reference/functions/draft-mode) inside a `use cache` scope, however, other runtime APIs like `cookies()` and `headers()` are not allowed, even when Draft Mode is active. See [Passing runtime values to cached functions](/docs/app/getting-started/caching#passing-runtime-values-to-cached-functions) for the recommended pattern.
```tsx filename="app/components/content.tsx"
import { draftMode } from 'next/headers'
async function Content() {
'use cache'
const { isEnabled } = await draftMode()
const url = isEnabled
? 'https://draft.example.com/content'
: 'https://production.example.com/content'
const data = await fetch(url)
return <article>{/* ... */}</article>
}
```
Calling `enable()` or `disable()` inside a caching directive scope will also throw an error. Draft Mode can only be toggled in [Route Handlers](/docs/app/api-reference/file-conventions/route) or [Server Actions](/docs/app/getting-started/mutating-data).
### React.cache isolation ### React.cache isolation
[`React.cache`](https://react.dev/reference/react/cache) operates in an isolated scope inside `use cache` boundaries. Values stored via `React.cache` outside a `use cache` function are not visible inside it. [`React.cache`](https://react.dev/reference/react/cache) operates in an isolated scope inside `use cache` boundaries. Values stored via `React.cache` outside a `use cache` function are not visible inside it.
......
...@@ -38,10 +38,13 @@ The following methods and properties are available: ...@@ -38,10 +38,13 @@ The following methods and properties are available:
## Good to know ## Good to know
- `draftMode` is an **asynchronous** function that returns a promise. You must use `async/await` or React's [`use`](https://react.dev/reference/react/use) function. - `draftMode` is an **asynchronous** function that returns a promise. You must use `async/await` or React’s [`use`](https://react.dev/reference/react/use) function.
- In version 14 and earlier, `draftMode` was a synchronous function. To help with backwards compatibility, you can still access it synchronously in Next.js 15, but this behavior will be deprecated in the future. - In version 14 and earlier, `draftMode` was a synchronous function. To help with backwards compatibility, you can still access it synchronously in Next.js 15, but this behavior will be deprecated in the future.
- A new bypass cookie value will be generated each time you run `next build`. This ensures that the bypass cookie can’t be guessed. - A new bypass cookie value will be generated each time you run `next build`. This ensures that the bypass cookie can’t be guessed.
- To test Draft Mode locally over HTTP, your browser will need to allow third-party cookies and local storage access. - To test Draft Mode locally over HTTP, your browser will need to allow third-party cookies and local storage access.
- [`isEnabled`](#checking-if-draft-mode-is-enabled) is readable inside a [caching directive](/docs/app/api-reference/directives/use-cache) scope. Other runtime APIs like `cookies()` and `headers()` are not allowed inside caching directive scopes, even when Draft Mode is active.
- Calling `enable()` or `disable()` inside a caching directive scope will throw an error.
- When Draft Mode is enabled, all functions and components under a caching directive scope re-execute on every request and results are not saved to the cache. This ensures draft content is always fresh.
## Examples ## Examples
......
...@@ -15,5 +15,5 @@ ...@@ -15,5 +15,5 @@
"registry": "https://registry.npmjs.org/" "registry": "https://registry.npmjs.org/"
} }
}, },
"version": "16.2.1-canary.38" "version": "16.2.1-canary.42"
} }
\ No newline at end of file
{ {
"name": "create-next-app", "name": "create-next-app",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"keywords": [ "keywords": [
"react", "react",
"next", "next",
......
{ {
"name": "eslint-config-next", "name": "eslint-config-next",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"description": "ESLint configuration used by Next.js.", "description": "ESLint configuration used by Next.js.",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"dist" "dist"
], ],
"dependencies": { "dependencies": {
"@next/eslint-plugin-next": "16.2.1-canary.38", "@next/eslint-plugin-next": "16.2.1-canary.42",
"eslint-import-resolver-node": "^0.3.6", "eslint-import-resolver-node": "^0.3.6",
"eslint-import-resolver-typescript": "^3.5.2", "eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.32.0", "eslint-plugin-import": "^2.32.0",
......
{ {
"name": "@next/eslint-plugin-internal", "name": "@next/eslint-plugin-internal",
"private": true, "private": true,
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"description": "ESLint plugin for working on Next.js.", "description": "ESLint plugin for working on Next.js.",
"exports": { "exports": {
".": "./src/eslint-plugin-internal.js" ".": "./src/eslint-plugin-internal.js"
......
{ {
"name": "@next/eslint-plugin-next", "name": "@next/eslint-plugin-next",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"description": "ESLint plugin for Next.js.", "description": "ESLint plugin for Next.js.",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
......
{ {
"name": "@next/font", "name": "@next/font",
"private": true, "private": true,
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"repository": { "repository": {
"url": "vercel/next.js", "url": "vercel/next.js",
"directory": "packages/font" "directory": "packages/font"
......
{ {
"name": "@next/bundle-analyzer", "name": "@next/bundle-analyzer",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"main": "index.js", "main": "index.js",
"types": "index.d.ts", "types": "index.d.ts",
"license": "MIT", "license": "MIT",
......
{ {
"name": "@next/codemod", "name": "@next/codemod",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
"type": "git", "type": "git",
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
"esModuleInterop": true, "esModuleInterop": true,
"noImplicitAny": false, "noImplicitAny": false,
"target": "ES2022", "target": "ES2022",
"downlevelIteration": true,
"ignoreDeprecations": "6.0",
"preserveWatchOutput": true, "preserveWatchOutput": true,
"strictFunctionTypes": false, "strictFunctionTypes": false,
"strictNullChecks": false, "strictNullChecks": false,
......
{ {
"name": "@next/env", "name": "@next/env",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"keywords": [ "keywords": [
"react", "react",
"next", "next",
......
{ {
"name": "@next/mdx", "name": "@next/mdx",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"main": "index.js", "main": "index.js",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
......
{ {
"name": "@next/playwright", "name": "@next/playwright",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"repository": { "repository": {
"url": "vercel/next.js", "url": "vercel/next.js",
"directory": "packages/next-playwright" "directory": "packages/next-playwright"
......
{ {
"name": "@next/plugin-storybook", "name": "@next/plugin-storybook",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"repository": { "repository": {
"url": "vercel/next.js", "url": "vercel/next.js",
"directory": "packages/next-plugin-storybook" "directory": "packages/next-plugin-storybook"
......
{ {
"name": "@next/polyfill-module", "name": "@next/polyfill-module",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)", "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js", "main": "dist/polyfill-module.js",
"license": "MIT", "license": "MIT",
......
{ {
"name": "@next/polyfill-nomodule", "name": "@next/polyfill-nomodule",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"description": "A polyfill for non-dead, nomodule browsers.", "description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js", "main": "dist/polyfill-nomodule.js",
"license": "MIT", "license": "MIT",
......
{ {
"name": "@next/routing", "name": "@next/routing",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"keywords": [ "keywords": [
"react", "react",
"next", "next",
......
{ {
"name": "next-rspack", "name": "next-rspack",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"repository": { "repository": {
"url": "vercel/next.js", "url": "vercel/next.js",
"directory": "packages/next-rspack" "directory": "packages/next-rspack"
......
{ {
"name": "@next/swc", "name": "@next/swc",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"private": true, "private": true,
"files": [ "files": [
"native/" "native/"
...@@ -8,11 +8,9 @@ ...@@ -8,11 +8,9 @@
"scripts": { "scripts": {
"build-native-auto": "node maybe-build-native.mjs", "build-native-auto": "node maybe-build-native.mjs",
"clean": "node ../../scripts/rm.mjs native", "clean": "node ../../scripts/rm.mjs native",
"build-native": "napi build --platform -p next-napi-bindings --cargo-cwd ../../ --cargo-name next_napi_bindings --features plugin,image-extended --js false native", "build-native": "napi build --platform -p next-napi-bindings --cargo-cwd ../../ --cargo-name next_napi_bindings --features image-extended --js false native",
"build-native-release": "napi build --platform -p next-napi-bindings --cargo-cwd ../../ --cargo-name next_napi_bindings --release --features plugin,image-extended,tracing/release_max_level_trace --js false native", "build-native-release": "napi build --platform -p next-napi-bindings --cargo-cwd ../../ --cargo-name next_napi_bindings --release --features image-extended,tracing/release_max_level_trace --js false native",
"build-native-release-with-assertions": "napi build --platform -p next-napi-bindings --cargo-cwd ../../ --cargo-name next_napi_bindings --profile release-with-assertions --features plugin,image-extended,tracing/release_max_level_trace --js false native", "build-native-release-with-assertions": "napi build --platform -p next-napi-bindings --cargo-cwd ../../ --cargo-name next_napi_bindings --profile release-with-assertions --features image-extended,tracing/release_max_level_trace --js false native",
"build-native-no-plugin": "napi build --platform -p next-napi-bindings --cargo-cwd ../../ --cargo-name next_napi_bindings --features image-webp --js false native",
"build-native-no-plugin-release": "napi build --platform -p next-napi-bindings --cargo-cwd ../../ --cargo-name next_napi_bindings --release --features image-webp,tracing/release_max_level_trace --js false native",
"build-native-wasi": "npx --package=@napi-rs/cli@3.0.0-alpha.45 napi build --platform --target wasm32-wasip1-threads -p next-napi-bindings --cwd ../../ --output-dir packages/next-swc/native --no-default-features", "build-native-wasi": "npx --package=@napi-rs/cli@3.0.0-alpha.45 napi build --platform --target wasm32-wasip1-threads -p next-napi-bindings --cwd ../../ --output-dir packages/next-swc/native --no-default-features",
"build-sccache": "node ../../scripts/build-sccache.js", "build-sccache": "node ../../scripts/build-sccache.js",
"build-wasm": "wasm-pack build ../../crates/wasm --scope=next", "build-wasm": "wasm-pack build ../../crates/wasm --scope=next",
......
...@@ -46,16 +46,6 @@ ...@@ -46,16 +46,6 @@
"inputs": ["../../target/.rust-fingerprint"], "inputs": ["../../target/.rust-fingerprint"],
"outputs": ["native/*.node", "native/index.d.ts"], "outputs": ["native/*.node", "native/index.d.ts"],
}, },
"build-native-no-plugin": {
"dependsOn": ["rust-fingerprint"],
"inputs": ["../../target/.rust-fingerprint"],
"outputs": ["native/*.node", "native/index.d.ts"],
},
"build-native-no-plugin-release": {
"dependsOn": ["rust-fingerprint"],
"inputs": ["../../target/.rust-fingerprint"],
"outputs": ["native/*.node", "native/index.d.ts"],
},
"build-wasm": { "build-wasm": {
"dependsOn": ["rust-fingerprint"], "dependsOn": ["rust-fingerprint"],
"inputs": ["../../target/.rust-fingerprint"], "inputs": ["../../target/.rust-fingerprint"],
......
...@@ -1156,5 +1156,9 @@ ...@@ -1156,5 +1156,9 @@
"1155": "Not implemented", "1155": "Not implemented",
"1156": "Cannot create a replay stream after the ReplayableNodeStream has been disposed.", "1156": "Cannot create a replay stream after the ReplayableNodeStream has been disposed.",
"1157": "`unstable_io()` requires the `experimental.unstableIO` option to be enabled in your Next.js config.", "1157": "`unstable_io()` requires the `experimental.unstableIO` option to be enabled in your Next.js config.",
"1158": "The prerender-ppr work unit type has been removed. This code path should be unreachable." "1158": "The prerender-ppr work unit type has been removed. This code path should be unreachable.",
"1159": "\"unstable_instant\" is a route segment config and can only be used when the segment is a Server Component module. Remove the \"use client\" directive from \"%s\" to use this API.",
"1160": "Route \"%s\" cannot use \\`export const unstable_prefetch = ...\\` without enabling \\`cacheComponents\\`.",
"1161": "\"unstable_prefetch\" is a route segment config and can only be used when the segment is a Server Component module. Remove the \"use client\" directive from \"%s\" to use this API.",
"1162": "Route \"%s\" cannot use \\`export const unstable_instant = ...\\` without enabling \\`cacheComponents\\`."
} }
{ {
"name": "next", "name": "next",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"description": "The React Framework", "description": "The React Framework",
"main": "./dist/server/next.js", "main": "./dist/server/next.js",
"license": "MIT", "license": "MIT",
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
] ]
}, },
"dependencies": { "dependencies": {
"@next/env": "16.2.1-canary.38", "@next/env": "16.2.1-canary.42",
"@swc/helpers": "0.5.15", "@swc/helpers": "0.5.15",
"baseline-browser-mapping": "^2.9.19", "baseline-browser-mapping": "^2.9.19",
"caniuse-lite": "^1.0.30001579", "caniuse-lite": "^1.0.30001579",
...@@ -165,11 +165,11 @@ ...@@ -165,11 +165,11 @@
"@modelcontextprotocol/sdk": "1.18.1", "@modelcontextprotocol/sdk": "1.18.1",
"@mswjs/interceptors": "0.23.0", "@mswjs/interceptors": "0.23.0",
"@napi-rs/triples": "1.2.0", "@napi-rs/triples": "1.2.0",
"@next/font": "16.2.1-canary.38", "@next/font": "16.2.1-canary.42",
"@next/polyfill-module": "16.2.1-canary.38", "@next/polyfill-module": "16.2.1-canary.42",
"@next/polyfill-nomodule": "16.2.1-canary.38", "@next/polyfill-nomodule": "16.2.1-canary.42",
"@next/react-refresh-utils": "16.2.1-canary.38", "@next/react-refresh-utils": "16.2.1-canary.42",
"@next/swc": "16.2.1-canary.38", "@next/swc": "16.2.1-canary.42",
"@opentelemetry/api": "1.6.0", "@opentelemetry/api": "1.6.0",
"@playwright/test": "1.58.2", "@playwright/test": "1.58.2",
"@rspack/core": "1.6.7", "@rspack/core": "1.6.7",
......
...@@ -681,13 +681,26 @@ export async function getAppPageStaticInfo({ ...@@ -681,13 +681,26 @@ export async function getAppPageStaticInfo({
// Prevent use client and unstable_instant in the same file. // Prevent use client and unstable_instant in the same file.
if (directives?.has('client') && 'unstable_instant' in config) { if (directives?.has('client') && 'unstable_instant' in config) {
throw new Error( throw new Error(
`Page "${page}" cannot export "unstable_instant" from a Client Component module. To use this API, convert this module to a Server Component by removing the "use client" directive.` `"unstable_instant" is a route segment config and can only be used when the segment is a Server Component module. Remove the "use client" directive from "${pageFilePath}" to use this API.`
) )
} }
if ('unstable_instant' in config && !nextConfig.cacheComponents) { if ('unstable_instant' in config && !nextConfig.cacheComponents) {
throw new Error( throw new Error(
`Page "${page}" cannot use \`export const unstable_instant = ...\` without enabling \`cacheComponents\`.` `Route "${page}" cannot use \`export const unstable_instant = ...\` without enabling \`cacheComponents\`.`
)
}
// Prevent use client and unstable_prefetch in the same file.
if (directives?.has('client') && 'unstable_prefetch' in config) {
throw new Error(
`"unstable_prefetch" is a route segment config and can only be used when the segment is a Server Component module. Remove the "use client" directive from "${pageFilePath}" to use this API.`
)
}
if ('unstable_prefetch' in config && !nextConfig.cacheComponents) {
throw new Error(
`Route "${page}" cannot use \`export const unstable_prefetch = ...\` without enabling \`cacheComponents\`.`
) )
} }
......
...@@ -49,8 +49,12 @@ const InstantConfigSchema = z.union([ ...@@ -49,8 +49,12 @@ const InstantConfigSchema = z.union([
z.literal(false), z.literal(false),
]) ])
const PrefetchSchema = z.enum(['static', 'runtime'])
export type Instant = InstantConfigStatic | InstantConfigRuntime | false export type Instant = InstantConfigStatic | InstantConfigRuntime | false
export type Prefetch = 'static' | 'runtime'
export type InstantConfigForTypeCheckInternal = __GenericInstantConfig | Instant export type InstantConfigForTypeCheckInternal = __GenericInstantConfig | Instant
// the __GenericPrefetch type is used to avoid type widening issues with // the __GenericPrefetch type is used to avoid type widening issues with
// our choice to make exports the medium for programming a Next.js application // our choice to make exports the medium for programming a Next.js application
...@@ -145,6 +149,13 @@ const AppSegmentConfigSchema = z.object({ ...@@ -145,6 +149,13 @@ const AppSegmentConfigSchema = z.object({
*/ */
unstable_instant: InstantConfigSchema.optional(), unstable_instant: InstantConfigSchema.optional(),
/**
* Controls runtime prefetching for this segment.
* 'static' is a noop (default behavior).
* 'runtime' enables runtime prefetching.
*/
unstable_prefetch: PrefetchSchema.optional(),
/** /**
* The stale time for dynamic responses in seconds. * The stale time for dynamic responses in seconds.
* Controls how long the client-side router cache retains dynamic page data. * Controls how long the client-side router cache retains dynamic page data.
...@@ -195,6 +206,11 @@ export function parseAppSegmentConfig( ...@@ -195,6 +206,11 @@ export function parseAppSegmentConfig(
message: `Invalid unstable_instant value ${JSON.stringify(ctx.data)} on "${route}", must be an object with \`prefetch: "static"\` or \`prefetch: "runtime"\`, or \`false\`. Read more at https://nextjs.org/docs/messages/invalid-instant-configuration`, message: `Invalid unstable_instant value ${JSON.stringify(ctx.data)} on "${route}", must be an object with \`prefetch: "static"\` or \`prefetch: "runtime"\`, or \`false\`. Read more at https://nextjs.org/docs/messages/invalid-instant-configuration`,
} }
} }
case 'unstable_prefetch': {
return {
message: `Invalid unstable_prefetch value ${JSON.stringify(ctx.data)} on "${route}", must be "static" or "runtime".`,
}
}
case 'unstable_dynamicStaleTime': { case 'unstable_dynamicStaleTime': {
return { return {
message: `Invalid unstable_dynamicStaleTime value ${JSON.stringify(ctx.data)} on "${route}", must be a non-negative number`, message: `Invalid unstable_dynamicStaleTime value ${JSON.stringify(ctx.data)} on "${route}", must be a non-negative number`,
...@@ -254,6 +270,13 @@ export type AppSegmentConfig = { ...@@ -254,6 +270,13 @@ export type AppSegmentConfig = {
*/ */
unstable_instant?: Instant unstable_instant?: Instant
/**
* Controls runtime prefetching for this segment.
* 'static' is a noop (default behavior).
* 'runtime' enables runtime prefetching.
*/
unstable_prefetch?: Prefetch
/** /**
* The stale time for dynamic responses in seconds. * The stale time for dynamic responses in seconds.
* Controls how long the client-side router cache retains dynamic page data. * Controls how long the client-side router cache retains dynamic page data.
......
...@@ -54,7 +54,7 @@ ${ ...@@ -54,7 +54,7 @@ ${
: `import type { ResolvingMetadata, ResolvingViewport } from 'next/dist/lib/metadata/types/metadata-interface.js'` : `import type { ResolvingMetadata, ResolvingViewport } from 'next/dist/lib/metadata/types/metadata-interface.js'`
} }
import type { InstantConfigForTypeCheckInternal } from 'next/dist/build/segment-config/app/app-segment-config.js' import type { InstantConfigForTypeCheckInternal, Prefetch } from 'next/dist/build/segment-config/app/app-segment-config.js'
type TEntry = typeof import('${relativePath}.js') type TEntry = typeof import('${relativePath}.js')
...@@ -72,6 +72,7 @@ checkFields<Diff<{ ...@@ -72,6 +72,7 @@ checkFields<Diff<{
config?: {} config?: {}
generateStaticParams?: Function generateStaticParams?: Function
unstable_instant?: InstantConfigForTypeCheckInternal unstable_instant?: InstantConfigForTypeCheckInternal
unstable_prefetch?: Prefetch
unstable_dynamicStaleTime?: number unstable_dynamicStaleTime?: number
revalidate?: RevalidateRange<TEntry> | false revalidate?: RevalidateRange<TEntry> | false
dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static' dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'
......
...@@ -384,7 +384,7 @@ export class Head extends React.Component<HeadProps> { ...@@ -384,7 +384,7 @@ export class Head extends React.Component<HeadProps> {
getCssLinks(files: DocumentFiles): JSX.Element[] | null { getCssLinks(files: DocumentFiles): JSX.Element[] | null {
const { const {
assetPrefix, assetPrefix,
assetQueryString, cssAssetQueryString,
dynamicImports, dynamicImports,
dynamicCssManifest, dynamicCssManifest,
crossOrigin, crossOrigin,
...@@ -422,7 +422,7 @@ export class Head extends React.Component<HeadProps> { ...@@ -422,7 +422,7 @@ export class Head extends React.Component<HeadProps> {
rel="preload" rel="preload"
href={`${assetPrefix}/_next/${encodeURIPath( href={`${assetPrefix}/_next/${encodeURIPath(
file file
)}${assetQueryString}`} )}${cssAssetQueryString}`}
as="style" as="style"
crossOrigin={this.props.crossOrigin || crossOrigin} crossOrigin={this.props.crossOrigin || crossOrigin}
/> />
...@@ -436,7 +436,7 @@ export class Head extends React.Component<HeadProps> { ...@@ -436,7 +436,7 @@ export class Head extends React.Component<HeadProps> {
rel="stylesheet" rel="stylesheet"
href={`${assetPrefix}/_next/${encodeURIPath( href={`${assetPrefix}/_next/${encodeURIPath(
file file
)}${assetQueryString}`} )}${cssAssetQueryString}`}
crossOrigin={this.props.crossOrigin || crossOrigin} crossOrigin={this.props.crossOrigin || crossOrigin}
data-n-g={isUnmanagedFile ? undefined : isSharedFile ? '' : undefined} data-n-g={isUnmanagedFile ? undefined : isSharedFile ? '' : undefined}
data-n-p={ data-n-p={
...@@ -589,7 +589,7 @@ export class Head extends React.Component<HeadProps> { ...@@ -589,7 +589,7 @@ export class Head extends React.Component<HeadProps> {
optimizeCss, optimizeCss,
assetPrefix, assetPrefix,
nextFontManifest, nextFontManifest,
assetQueryString, cssAssetQueryString,
} = this.context } = this.context
const disableRuntimeJS = unstable_runtimeJS === false const disableRuntimeJS = unstable_runtimeJS === false
...@@ -659,7 +659,7 @@ export class Head extends React.Component<HeadProps> { ...@@ -659,7 +659,7 @@ export class Head extends React.Component<HeadProps> {
nextFontManifest, nextFontManifest,
dangerousAsPath, dangerousAsPath,
assetPrefix, assetPrefix,
assetQueryString cssAssetQueryString
) )
const tracingMetadata = getTracedMetadata( const tracingMetadata = getTracedMetadata(
......
...@@ -487,7 +487,9 @@ async function collectPrefetchHintsImpl( ...@@ -487,7 +487,9 @@ async function collectPrefetchHintsImpl(
const childRoute = children[parallelRouteKey] const childRoute = children[parallelRouteKey]
const childSegment = childRoute[0] const childSegment = childRoute[0]
const childSeedData = const childSeedData =
seedDataChildren !== null ? seedDataChildren[parallelRouteKey] : null seedDataChildren !== null
? (seedDataChildren[parallelRouteKey] ?? null)
: null
const childRequestKey = appendSegmentRequestKeyPart( const childRequestKey = appendSegmentRequestKeyPart(
requestKey, requestKey,
...@@ -870,7 +872,9 @@ function collectSegmentDataImpl( ...@@ -870,7 +872,9 @@ function collectSegmentDataImpl(
const childRoute = children[parallelRouteKey] const childRoute = children[parallelRouteKey]
const childSegment = childRoute[0] const childSegment = childRoute[0]
const childSeedData = const childSeedData =
seedDataChildren !== null ? seedDataChildren[parallelRouteKey] : null seedDataChildren !== null
? (seedDataChildren[parallelRouteKey] ?? null)
: null
const childRequestKey = appendSegmentRequestKeyPart( const childRequestKey = appendSegmentRequestKeyPart(
requestKey, requestKey,
......
...@@ -243,13 +243,10 @@ async function createComponentTreeInternal( ...@@ -243,13 +243,10 @@ async function createComponentTreeInternal(
}) })
: [] : []
const instantConfig = layoutOrPageMod const prefetchConfig = layoutOrPageMod
? (layoutOrPageMod as AppSegmentConfig).unstable_instant ? (layoutOrPageMod as AppSegmentConfig).unstable_prefetch
: undefined : undefined
const hasRuntimePrefetch = const hasRuntimePrefetch = prefetchConfig === 'runtime'
instantConfig && typeof instantConfig === 'object'
? instantConfig.prefetch === 'runtime'
: false
const isRuntimePrefetchable = hasRuntimePrefetch || parentRuntimePrefetchable const isRuntimePrefetchable = hasRuntimePrefetch || parentRuntimePrefetchable
const [Forbidden, forbiddenStyles] = const [Forbidden, forbiddenStyles] =
......
...@@ -28,11 +28,14 @@ async function createFlightRouterStateFromLoaderTreeImpl( ...@@ -28,11 +28,14 @@ async function createFlightRouterStateFromLoaderTreeImpl(
{}, {},
] ]
// Load the layout or page module to check for unstable_instant config // Load the layout or page module to check for unstable_instant/unstable_prefetch config
const mod = layout ? await layout[0]() : page ? await page[0]() : undefined const mod = layout ? await layout[0]() : page ? await page[0]() : undefined
const instantConfig = mod const instantConfig = mod
? (mod as AppSegmentConfig).unstable_instant ? (mod as AppSegmentConfig).unstable_instant
: undefined : undefined
const prefetchConfig = mod
? (mod as AppSegmentConfig).unstable_prefetch
: undefined
let prefetchHints = 0 let prefetchHints = 0
// Union in the precomputed build-time hints (e.g. segment inlining // Union in the precomputed build-time hints (e.g. segment inlining
...@@ -89,9 +92,10 @@ async function createFlightRouterStateFromLoaderTreeImpl( ...@@ -89,9 +92,10 @@ async function createFlightRouterStateFromLoaderTreeImpl(
prefetchHints |= PrefetchHint.PrefetchDisabled prefetchHints |= PrefetchHint.PrefetchDisabled
} else if (instantConfig && typeof instantConfig === 'object') { } else if (instantConfig && typeof instantConfig === 'object') {
prefetchHints |= PrefetchHint.SubtreeHasInstant prefetchHints |= PrefetchHint.SubtreeHasInstant
if (instantConfig.prefetch === 'runtime') { }
prefetchHints |= PrefetchHint.HasRuntimePrefetch
} if (prefetchConfig === 'runtime') {
prefetchHints |= PrefetchHint.HasRuntimePrefetch
} }
// Check if this segment has a loading boundary // Check if this segment has a loading boundary
......
...@@ -16,14 +16,10 @@ export async function anySegmentHasRuntimePrefetchEnabled( ...@@ -16,14 +16,10 @@ export async function anySegmentHasRuntimePrefetchEnabled(
const { mod: layoutOrPageMod } = await getLayoutOrPageModule(tree) const { mod: layoutOrPageMod } = await getLayoutOrPageModule(tree)
// TODO(restart-on-cache-miss): Does this work correctly for client page/layout modules? // TODO(restart-on-cache-miss): Does this work correctly for client page/layout modules?
const instantConfig = layoutOrPageMod const prefetchConfig = layoutOrPageMod
? (layoutOrPageMod as AppSegmentConfig).unstable_instant ? (layoutOrPageMod as AppSegmentConfig).unstable_prefetch
: undefined : undefined
const hasRuntimePrefetch = if (prefetchConfig === 'runtime') {
instantConfig && typeof instantConfig === 'object'
? instantConfig.prefetch === 'runtime'
: false
if (hasRuntimePrefetch) {
return true return true
} }
......
...@@ -1146,10 +1146,13 @@ export async function createCombinedPayloadAtDepth( ...@@ -1146,10 +1146,13 @@ export async function createCombinedPayloadAtDepth(
: createChildSegmentPath(parentPath, key!, segment) : createChildSegmentPath(parentPath, key!, segment)
let instantConfig: Instant | null = null let instantConfig: Instant | null = null
let prefetchConfig: AppSegmentConfig['unstable_prefetch'] | null = null
let localCreateInstantStack: (() => Error) | null = null let localCreateInstantStack: (() => Error) | null = null
if (layoutOrPageMod !== undefined) { if (layoutOrPageMod !== undefined) {
instantConfig = instantConfig =
(layoutOrPageMod as AppSegmentConfig).unstable_instant ?? null (layoutOrPageMod as AppSegmentConfig).unstable_instant ?? null
prefetchConfig =
(layoutOrPageMod as AppSegmentConfig).unstable_prefetch ?? null
if (instantConfig && typeof instantConfig === 'object') { if (instantConfig && typeof instantConfig === 'object') {
const rawFactory: unknown = (layoutOrPageMod as any) const rawFactory: unknown = (layoutOrPageMod as any)
.__debugCreateInstantConfigStack .__debugCreateInstantConfigStack
...@@ -1158,14 +1161,12 @@ export async function createCombinedPayloadAtDepth( ...@@ -1158,14 +1161,12 @@ export async function createCombinedPayloadAtDepth(
} }
} }
const segmentHasRuntimePrefetch = prefetchConfig === 'runtime'
let childIsInsideRuntimePrefetch = isInsideRuntimePrefetch let childIsInsideRuntimePrefetch = isInsideRuntimePrefetch
let stage: SegmentStage let stage: SegmentStage
if (!isInsideRuntimePrefetch) { if (!isInsideRuntimePrefetch) {
if ( if (segmentHasRuntimePrefetch) {
instantConfig &&
typeof instantConfig === 'object' &&
instantConfig.prefetch === 'runtime'
) {
stage = RenderStage.Runtime stage = RenderStage.Runtime
childIsInsideRuntimePrefetch = true childIsInsideRuntimePrefetch = true
hasRuntimeSegments = true hasRuntimeSegments = true
......
...@@ -812,7 +812,52 @@ export async function continueStaticFallbackPrerender( ...@@ -812,7 +812,52 @@ export async function continueStaticFallbackPrerender(
return webToReadable(webResult) return webToReadable(webResult)
} }
export async function continueDynamicHTMLResume( export async function continueDynamicHTMLResumeNode(
renderStream: AnyStream,
{
delayDataUntilFirstHtmlChunk,
inlinedDataStream,
getServerInsertedHTML,
getServerInsertedMetadata,
deploymentId,
}: import('./stream-ops.web').ContinueDynamicHTMLResumeOptions
): Promise<AnyStream> {
await waitAtLeastOneReactRenderTask()
const buffered = createBufferedTransformStream()
webToReadable(renderStream).pipe(buffered)
let source: Readable = buffered
if (deploymentId) {
const dplId = createHtmlDataDplIdTransform(deploymentId)
source.pipe(dplId)
source = dplId
}
const headInsertion = createHeadInsertionTransform(getServerInsertedHTML)
source.pipe(headInsertion)
source = headInsertion
const metadata = createMetadataTransform(getServerInsertedMetadata)
source.pipe(metadata)
source = metadata
const flightInjection = createFlightDataInjectionTransform(
webToReadable(inlinedDataStream),
delayDataUntilFirstHtmlChunk
)
source.pipe(flightInjection)
source = flightInjection
const moveSuffix = createMoveSuffixTransform()
source.pipe(moveSuffix)
source = moveSuffix
return source
}
export async function continueDynamicHTMLResumeWeb(
renderStream: AnyStream, renderStream: AnyStream,
opts: import('./stream-ops.web').ContinueDynamicHTMLResumeOptions opts: import('./stream-ops.web').ContinueDynamicHTMLResumeOptions
): Promise<AnyStream> { ): Promise<AnyStream> {
......
...@@ -35,7 +35,8 @@ export const continueStaticPrerender = _m.continueStaticPrerender ...@@ -35,7 +35,8 @@ export const continueStaticPrerender = _m.continueStaticPrerender
export const continueDynamicPrerender = _m.continueDynamicPrerender export const continueDynamicPrerender = _m.continueDynamicPrerender
export const continueStaticFallbackPrerender = export const continueStaticFallbackPrerender =
_m.continueStaticFallbackPrerender _m.continueStaticFallbackPrerender
export const continueDynamicHTMLResume = _m.continueDynamicHTMLResume export const continueDynamicHTMLResumeNode = _m.continueDynamicHTMLResumeNode
export const continueDynamicHTMLResumeWeb = _m.continueDynamicHTMLResumeWeb
export const streamToBuffer = _m.streamToBuffer export const streamToBuffer = _m.streamToBuffer
export const chainStreams = _m.chainStreams export const chainStreams = _m.chainStreams
export const createDocumentClosingStream = _m.createDocumentClosingStream export const createDocumentClosingStream = _m.createDocumentClosingStream
......
...@@ -141,7 +141,7 @@ export async function continueStaticFallbackPrerender( ...@@ -141,7 +141,7 @@ export async function continueStaticFallbackPrerender(
) )
} }
export async function continueDynamicHTMLResume( export async function continueDynamicHTMLResumeWeb(
renderStream: AnyStream, renderStream: AnyStream,
opts: ContinueDynamicHTMLResumeOptions opts: ContinueDynamicHTMLResumeOptions
): Promise<AnyStream> { ): Promise<AnyStream> {
...@@ -154,6 +154,13 @@ export async function continueDynamicHTMLResume( ...@@ -154,6 +154,13 @@ export async function continueDynamicHTMLResume(
) )
} }
export function continueDynamicHTMLResumeNode(
_renderStream: AnyStream,
_opts: ContinueDynamicHTMLResumeOptions
): Promise<AnyStream> {
throw new Error('not implemented')
}
export async function streamToBuffer(stream: AnyStream): Promise<Buffer> { export async function streamToBuffer(stream: AnyStream): Promise<Buffer> {
return webStreamToBuffer(stream as ReadableStream<Uint8Array>) return webStreamToBuffer(stream as ReadableStream<Uint8Array>)
} }
......
...@@ -72,8 +72,6 @@ export type AppPageRenderResultMetadata = { ...@@ -72,8 +72,6 @@ export type AppPageRenderResultMetadata = {
export type PagesRenderResultMetadata = { export type PagesRenderResultMetadata = {
pageData?: any pageData?: any
cacheControl?: CacheControl cacheControl?: CacheControl
assetQueryString?: string
mutableAssetQueryString?: string
isNotFound?: boolean isNotFound?: boolean
isRedirect?: boolean isRedirect?: boolean
} }
......
...@@ -254,7 +254,6 @@ export type RenderOptsPartial = { ...@@ -254,7 +254,6 @@ export type RenderOptsPartial = {
optimizeCss: any optimizeCss: any
nextConfigOutput?: 'standalone' | 'export' nextConfigOutput?: 'standalone' | 'export'
nextScriptWorkers: any nextScriptWorkers: any
assetQueryString?: string
resolvedUrl?: string resolvedUrl?: string
resolvedAsPath?: string resolvedAsPath?: string
setIsrStatus?: (key: string, value: boolean | undefined) => void setIsrStatus?: (key: string, value: boolean | undefined) => void
...@@ -445,6 +444,16 @@ function serializeError( ...@@ -445,6 +444,16 @@ function serializeError(
} }
} }
function getSafariCacheBusterQueryString(req: IncomingMessage): string {
if (process.env.__NEXT_DEV_SERVER) {
const userAgent = (req.headers['user-agent'] || '').toLowerCase()
if (userAgent.includes('safari') && !userAgent.includes('chrome')) {
return `?ts=${Date.now()}`
}
}
return ''
}
export async function renderToHTMLImpl( export async function renderToHTMLImpl(
req: IncomingMessage, req: IncomingMessage,
res: ServerResponse, res: ServerResponse,
...@@ -458,35 +467,30 @@ export async function renderToHTMLImpl( ...@@ -458,35 +467,30 @@ export async function renderToHTMLImpl(
// Adds support for reading `cookies` in `getServerSideProps` when SSR. // Adds support for reading `cookies` in `getServerSideProps` when SSR.
setLazyProp({ req: req as any }, 'cookies', getCookieParser(req.headers)) setLazyProp({ req: req as any }, 'cookies', getCookieParser(req.headers))
let baseAssetQueryString = // cssCacheBuster is a workaround for a Safari bug
(process.env.__NEXT_DEV_SERVER && renderOpts.assetQueryString) || '' // (https://bugs.webkit.org/show_bug.cgi?id=187726) where preloaded CSS
// resources are cached and not re-fetched on HMR. It must only be applied
if (process.env.__NEXT_DEV_SERVER && !baseAssetQueryString) { // to CSS and font assets — not to script tags — because the Turbopack
const userAgent = (req.headers['user-agent'] || '').toLowerCase() // runtime infers ASSET_SUFFIX from the executing script's query string and
if (userAgent.includes('safari') && !userAgent.includes('chrome')) { // leaks it onto all static asset URLs (including images), causing
// In dev we invalidate the cache by appending a timestamp to the resource URL. // next/image validation errors.
// This is a workaround to fix https://github.com/vercel/next.js/issues/5860 // See https://github.com/vercel/next.js/issues/92118.
// TODO: remove this workaround when https://bugs.webkit.org/show_bug.cgi?id=187726 is fixed. const cssCacheBuster = getSafariCacheBusterQueryString(req)
// Note: The workaround breaks breakpoints on reload since the script url always changes,
// so we only apply it to Safari. const mutableAssetQueryString = sharedContext.deploymentId
baseAssetQueryString = `?ts=${Date.now()}` ? `?dpl=${sharedContext.deploymentId}`
} : ''
} const assetQueryString = sharedContext.clientAssetToken
? `?dpl=${sharedContext.clientAssetToken}`
const mutableAssetQueryString = : ''
baseAssetQueryString + // cssAssetQueryString is assetQueryString with the cacheBuster prepended.
(sharedContext.deploymentId // Use this for CSS and font URLs; use assetQueryString for script URLs.
? `${baseAssetQueryString ? '&' : '?'}dpl=${sharedContext.deploymentId}` const cssAssetQueryString =
: '') cssCacheBuster +
const assetQueryString =
baseAssetQueryString +
(sharedContext.clientAssetToken (sharedContext.clientAssetToken
? `${baseAssetQueryString ? '&' : '?'}dpl=${sharedContext.clientAssetToken}` ? `${cssCacheBuster ? '&' : '?'}dpl=${sharedContext.clientAssetToken}`
: '') : '')
const metadata: PagesRenderResultMetadata = { const metadata: PagesRenderResultMetadata = {}
assetQueryString,
mutableAssetQueryString,
}
// don't modify original query object // don't modify original query object
query = Object.assign({}, query) query = Object.assign({}, query)
...@@ -1530,8 +1534,9 @@ export async function renderToHTMLImpl( ...@@ -1530,8 +1534,9 @@ export async function renderToHTMLImpl(
? pageConfig.unstable_runtimeJS ? pageConfig.unstable_runtimeJS
: undefined, : undefined,
unstable_JsPreload: pageConfig.unstable_JsPreload, unstable_JsPreload: pageConfig.unstable_JsPreload,
assetQueryString: assetQueryString || '', assetQueryString,
mutableAssetQueryString: mutableAssetQueryString || '', cssAssetQueryString,
mutableAssetQueryString,
scriptLoader, scriptLoader,
locale, locale,
disableOptimizedLoading, disableOptimizedLoading,
......
...@@ -31,6 +31,11 @@ export type HtmlProps = { ...@@ -31,6 +31,11 @@ export type HtmlProps = {
unstable_JsPreload?: false unstable_JsPreload?: false
assetQueryString: string assetQueryString: string
mutableAssetQueryString: string mutableAssetQueryString: string
/**
* Asset query string for CSS and font assets.
* See https://github.com/vercel/next.js/issues/92118.
*/
cssAssetQueryString: string
scriptLoader: { scriptLoader: {
afterInteractive?: string[] afterInteractive?: string[]
beforeInteractive?: any[] beforeInteractive?: any[]
......
{ {
"name": "@next/react-refresh-utils", "name": "@next/react-refresh-utils",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"description": "An experimental package providing utilities for React Refresh.", "description": "An experimental package providing utilities for React Refresh.",
"repository": { "repository": {
"url": "vercel/next.js", "url": "vercel/next.js",
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
"esModuleInterop": true, "esModuleInterop": true,
"target": "es2015", "target": "es2015",
"lib": ["dom", "es2020"], "lib": ["dom", "es2020"],
"downlevelIteration": true,
"ignoreDeprecations": "6.0",
"preserveWatchOutput": true, "preserveWatchOutput": true,
"skipLibCheck": true, "skipLibCheck": true,
"outDir": "dist", "outDir": "dist",
......
{ {
"name": "@next/third-parties", "name": "@next/third-parties",
"version": "16.2.1-canary.38", "version": "16.2.1-canary.42",
"repository": { "repository": {
"url": "vercel/next.js", "url": "vercel/next.js",
"directory": "packages/third-parties" "directory": "packages/third-parties"
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
"third-party-capital": "1.0.20" "third-party-capital": "1.0.20"
}, },
"devDependencies": { "devDependencies": {
"next": "16.2.1-canary.38", "next": "16.2.1-canary.42",
"outdent": "0.8.0", "outdent": "0.8.0",
"prettier": "2.5.1", "prettier": "2.5.1",
"typescript": "6.0.2" "typescript": "6.0.2"
......
This diff is collapsed.
...@@ -819,18 +819,23 @@ function generateIndexMd( ...@@ -819,18 +819,23 @@ function generateIndexMd(
'', '',
`## Inline Review Comments (${reviewThreads.length} threads)`, `## Inline Review Comments (${reviewThreads.length} threads)`,
'', '',
'| File | Line | Author | Replies | Status | Details |', '| File | Line | Participants | Replies | Status | Details |',
'|------|------|--------|---------|--------|---------|' '|------|------|--------------|---------|--------|---------|'
) )
for (let i = 0; i < reviewThreads.length; i++) { for (let i = 0; i < reviewThreads.length; i++) {
const thread = reviewThreads[i] const thread = reviewThreads[i]
const line = thread.line || thread.startLine || 'N/A' const line = thread.line || thread.startLine || 'N/A'
const author = thread.comments.nodes[0]?.author?.login || 'Unknown' const participants = new Set()
for (const comment of thread.comments.nodes) {
if (comment.author?.login) participants.add(comment.author.login)
}
const participantsStr =
participants.size > 0 ? [...participants].join(', ') : 'Unknown'
const replyCount = Math.max(0, thread.comments.nodes.length - 1) const replyCount = Math.max(0, thread.comments.nodes.length - 1)
const status = thread.isResolved ? 'Resolved' : 'Open' const status = thread.isResolved ? 'Resolved' : 'Open'
lines.push( lines.push(
`| ${escapeMarkdownTableCell(thread.path)} | ${line} | ${author} | ${replyCount} | ${status} | [View](thread-${i + 1}.md) |` `| ${escapeMarkdownTableCell(thread.path)} | ${line} | ${participantsStr} | ${replyCount} | ${status} | [View](thread-${i + 1}.md) |`
) )
} }
} }
......
...@@ -4,6 +4,7 @@ import { connection } from 'next/server' ...@@ -4,6 +4,7 @@ import { connection } from 'next/server'
import { Suspense } from 'react' import { Suspense } from 'react'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
const CACHE_KEY = __dirname + '/__PAGE__' const CACHE_KEY = __dirname + '/__PAGE__'
......
...@@ -3,6 +3,7 @@ import { UncachedFetch, CachedData } from '../data-fetching' ...@@ -3,6 +3,7 @@ import { UncachedFetch, CachedData } from '../data-fetching'
import { PrivateCachedData } from './data-fetching' import { PrivateCachedData } from './data-fetching'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
const CACHE_KEY = '/private-cache/__LAYOUT__' const CACHE_KEY = '/private-cache/__LAYOUT__'
......
...@@ -3,6 +3,7 @@ import { UncachedFetch, CachedData } from '../data-fetching' ...@@ -3,6 +3,7 @@ import { UncachedFetch, CachedData } from '../data-fetching'
import { ShortLivedCache } from './data-fetching' import { ShortLivedCache } from './data-fetching'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
const CACHE_KEY = __dirname + '/__LAYOUT__' const CACHE_KEY = __dirname + '/__LAYOUT__'
......
...@@ -2,6 +2,7 @@ import { Suspense } from 'react' ...@@ -2,6 +2,7 @@ import { Suspense } from 'react'
import { UncachedFetch, CachedFetch, CachedData } from '../data-fetching' import { UncachedFetch, CachedFetch, CachedData } from '../data-fetching'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
const CACHE_KEY = __dirname + '/__LAYOUT__' const CACHE_KEY = __dirname + '/__LAYOUT__'
......
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
export default async function Page() { export default async function Page() {
return ( return (
......
...@@ -3,6 +3,7 @@ import { CachedData, getCachedData } from '../../data-fetching' ...@@ -3,6 +3,7 @@ import { CachedData, getCachedData } from '../../data-fetching'
import { cookies } from 'next/headers' import { cookies } from 'next/headers'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
const CACHE_KEY = __dirname + '/__PAGE__' const CACHE_KEY = __dirname + '/__PAGE__'
......
import { CachedData, getCachedData } from '../../data-fetching' import { CachedData, getCachedData } from '../../data-fetching'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
const CACHE_KEY = __dirname + '/__PAGE__' const CACHE_KEY = __dirname + '/__PAGE__'
......
...@@ -2,6 +2,7 @@ import { Suspense } from 'react' ...@@ -2,6 +2,7 @@ import { Suspense } from 'react'
import { Static, Runtime, Dynamic } from '../shared' import { Static, Runtime, Dynamic } from '../shared'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] } export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
export default function Root({ children }: { children: React.ReactNode }) { export default function Root({ children }: { children: React.ReactNode }) {
return ( return (
......
...@@ -5,6 +5,7 @@ export const unstable_instant = { ...@@ -5,6 +5,7 @@ export const unstable_instant = {
prefetch: 'runtime', prefetch: 'runtime',
samples: [{ searchParams: { myParam: 'testValue' } }], samples: [{ searchParams: { myParam: 'testValue' } }],
} }
export const unstable_prefetch = 'runtime'
type SearchParams = { [key: string]: string | string[] | undefined } type SearchParams = { [key: string]: string | string[] | undefined }
......
...@@ -6,6 +6,7 @@ export const unstable_instant = { ...@@ -6,6 +6,7 @@ export const unstable_instant = {
prefetch: 'runtime', prefetch: 'runtime',
samples: [{ cookies: [] }], samples: [{ cookies: [] }],
} }
export const unstable_prefetch = 'runtime'
export default async function Page() { export default async function Page() {
return ( return (
......
...@@ -6,6 +6,7 @@ export const unstable_instant = { ...@@ -6,6 +6,7 @@ export const unstable_instant = {
prefetch: 'runtime', prefetch: 'runtime',
samples: [{ cookies: [] }], samples: [{ cookies: [] }],
} }
export const unstable_prefetch = 'runtime'
export default async function Page() { export default async function Page() {
return ( return (
......
...@@ -6,6 +6,7 @@ export const unstable_instant = { ...@@ -6,6 +6,7 @@ export const unstable_instant = {
prefetch: 'runtime', prefetch: 'runtime',
samples: [{ cookies: [] }], samples: [{ cookies: [] }],
} }
export const unstable_prefetch = 'runtime'
export default async function Page() { export default async function Page() {
return ( return (
......
...@@ -15,6 +15,7 @@ export const unstable_instant: Instant = { ...@@ -15,6 +15,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
export default async function Page() { export default async function Page() {
return ( return (
......
...@@ -10,6 +10,7 @@ export const unstable_instant: Instant = { ...@@ -10,6 +10,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
export default async function Page() { export default async function Page() {
return ( return (
......
...@@ -10,6 +10,7 @@ export const unstable_instant: Instant = { ...@@ -10,6 +10,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
export default async function Page() { export default async function Page() {
return ( return (
......
...@@ -16,6 +16,7 @@ export const unstable_instant: Instant = { ...@@ -16,6 +16,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
export function generateStaticParams() { export function generateStaticParams() {
return [{ slug: 'foo' }, { slug: 'bar' }] return [{ slug: 'foo' }, { slug: 'bar' }]
......
...@@ -6,6 +6,7 @@ export const unstable_instant = { ...@@ -6,6 +6,7 @@ export const unstable_instant = {
prefetch: 'runtime', prefetch: 'runtime',
samples: [{ headers: [] }], samples: [{ headers: [] }],
} }
export const unstable_prefetch = 'runtime'
export default async function Page() { export default async function Page() {
return ( return (
......
...@@ -6,6 +6,7 @@ export const unstable_instant = { ...@@ -6,6 +6,7 @@ export const unstable_instant = {
prefetch: 'runtime', prefetch: 'runtime',
samples: [{ headers: [] }], samples: [{ headers: [] }],
} }
export const unstable_prefetch = 'runtime'
export default async function Page() { export default async function Page() {
return ( return (
......
...@@ -6,6 +6,7 @@ export const unstable_instant = { ...@@ -6,6 +6,7 @@ export const unstable_instant = {
prefetch: 'runtime', prefetch: 'runtime',
samples: [{ headers: [] }], samples: [{ headers: [] }],
} }
export const unstable_prefetch = 'runtime'
export default async function Page() { export default async function Page() {
return ( return (
......
...@@ -15,6 +15,7 @@ export const unstable_instant: Instant = { ...@@ -15,6 +15,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
export default async function Page() { export default async function Page() {
return ( return (
......
...@@ -10,6 +10,7 @@ export const unstable_instant: Instant = { ...@@ -10,6 +10,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
export default async function Page() { export default async function Page() {
return ( return (
......
...@@ -10,6 +10,7 @@ export const unstable_instant: Instant = { ...@@ -10,6 +10,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
export default async function Page() { export default async function Page() {
return ( return (
......
...@@ -5,6 +5,7 @@ export const unstable_instant = { ...@@ -5,6 +5,7 @@ export const unstable_instant = {
prefetch: 'runtime', prefetch: 'runtime',
samples: [{ cookies: [{ name: 'auth', value: '1' }] }], samples: [{ cookies: [{ name: 'auth', value: '1' }] }],
} }
export const unstable_prefetch = 'runtime'
export default async function Page() { export default async function Page() {
const c = await cookies() const c = await cookies()
......
...@@ -13,6 +13,7 @@ export const unstable_instant: Instant = { ...@@ -13,6 +13,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
export default async function Page({ export default async function Page({
params, params,
......
...@@ -13,6 +13,7 @@ export const unstable_instant: Instant = { ...@@ -13,6 +13,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
export default async function Page({ export default async function Page({
params, params,
......
...@@ -12,6 +12,7 @@ export const unstable_instant: Instant = { ...@@ -12,6 +12,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
export default async function Page({ export default async function Page({
params, params,
......
...@@ -5,6 +5,7 @@ export const unstable_instant: Instant = { ...@@ -5,6 +5,7 @@ export const unstable_instant: Instant = {
prefetch: 'runtime', prefetch: 'runtime',
samples: [{ params: { slug: 'hello' } }], samples: [{ params: { slug: 'hello' } }],
} }
export const unstable_prefetch = 'runtime'
export default async function Page({ export default async function Page({
params, params,
......
...@@ -5,6 +5,7 @@ export const unstable_instant: Instant = { ...@@ -5,6 +5,7 @@ export const unstable_instant: Instant = {
prefetch: 'runtime', prefetch: 'runtime',
samples: [{ params: { slug: 'hello' } }], samples: [{ params: { slug: 'hello' } }],
} }
export const unstable_prefetch = 'runtime'
export default async function Page({ export default async function Page({
params, params,
......
...@@ -4,6 +4,7 @@ export const unstable_instant = { ...@@ -4,6 +4,7 @@ export const unstable_instant = {
prefetch: 'runtime', prefetch: 'runtime',
samples: [{ searchParams: { q: 'test' } }], samples: [{ searchParams: { q: 'test' } }],
} }
export const unstable_prefetch = 'runtime'
export default async function Page({ export default async function Page({
searchParams, searchParams,
......
...@@ -4,6 +4,7 @@ export const unstable_instant = { ...@@ -4,6 +4,7 @@ export const unstable_instant = {
prefetch: 'runtime', prefetch: 'runtime',
samples: [{ searchParams: { q: 'test' } }], samples: [{ searchParams: { q: 'test' } }],
} }
export const unstable_prefetch = 'runtime'
export default async function Page({ export default async function Page({
searchParams, searchParams,
......
...@@ -12,6 +12,7 @@ export const unstable_instant: Instant = { ...@@ -12,6 +12,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
export default function Page() { export default function Page() {
return ( return (
......
...@@ -11,6 +11,7 @@ export const unstable_instant: Instant = { ...@@ -11,6 +11,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
export default function Page() { export default function Page() {
return ( return (
......
...@@ -16,6 +16,7 @@ export const unstable_instant: Instant = { ...@@ -16,6 +16,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
type SearchParams = Record<string, string | string[]> type SearchParams = Record<string, string | string[]>
......
...@@ -12,6 +12,7 @@ export const unstable_instant: Instant = { ...@@ -12,6 +12,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
export default async function Page({ export default async function Page({
searchParams, searchParams,
......
...@@ -14,6 +14,7 @@ export const unstable_instant: Instant = { ...@@ -14,6 +14,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
export default async function Page({ export default async function Page({
searchParams, searchParams,
......
...@@ -14,6 +14,7 @@ export const unstable_instant: Instant = { ...@@ -14,6 +14,7 @@ export const unstable_instant: Instant = {
}, },
], ],
} }
export const unstable_prefetch = 'runtime'
export default function Page() { export default function Page() {
return ( return (
......
...@@ -5,6 +5,7 @@ export const unstable_instant = { ...@@ -5,6 +5,7 @@ export const unstable_instant = {
prefetch: 'runtime', prefetch: 'runtime',
samples: [{ cookies: [] }], samples: [{ cookies: [] }],
} }
export const unstable_prefetch = 'runtime'
export default function Page() { export default function Page() {
return ( return (
......
...@@ -4,6 +4,7 @@ export const unstable_instant = { ...@@ -4,6 +4,7 @@ export const unstable_instant = {
prefetch: 'runtime', prefetch: 'runtime',
samples: [{ cookies: [] }], samples: [{ cookies: [] }],
} }
export const unstable_prefetch = 'runtime'
export default function Page() { export default function Page() {
return ( return (
......
...@@ -4,6 +4,7 @@ export const unstable_instant = { ...@@ -4,6 +4,7 @@ export const unstable_instant = {
prefetch: 'runtime', prefetch: 'runtime',
samples: [{ cookies: [] }], samples: [{ cookies: [] }],
} }
export const unstable_prefetch = 'runtime'
export default function Page() { export default function Page() {
return ( return (
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment