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:
abi: msvc
arch:
x86_64: {}
aarch64:
build_task: build-native-no-plugin-release
aarch64: {}
linux:
host: "['self-hosted', 'linux', 'x64', 'metal']"
docker: next-swc-builder:latest
......@@ -199,6 +198,9 @@ jobs:
name: stable - ${{ matrix.target }} - node@20
runs-on: ${{ fromJSON(matrix.host) }}
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:
# Enable long paths on Windows to avoid MAX_PATH (260 char) errors
# with deeply nested node_modules/.pnpm paths
......@@ -238,7 +240,7 @@ jobs:
run: node scripts/normalize-version-bump.js
- 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
with:
save-if: 'true'
......@@ -251,11 +253,11 @@ jobs:
# Try to restore the native binary BEFORE loading the Docker image.
# If the binary cache hits, we skip the expensive Docker image restore entirely.
- 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}
- name: Restore native binary cache
if: ${{ matrix.docker }}
if: ${{ matrix.docker && !env.NEXT_SKIP_BUILD_CACHE }}
id: native-cache
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:
run: |
docker run --rm \
-e CI -e RUST_BACKTRACE -e CARGO_TERM_COLOR \
-e CARGO_INCREMENTAL=0 -e CARGO_REGISTRIES_CRATES_IO_PROTOCOL -e TURBO_API \
-e TURBO_TEAM -e TURBO_TOKEN -e TURBO_VERSION -e TURBO_CACHE="remote:rw" \
-e CARGO_INCREMENTAL=0 -e CARGO_REGISTRIES_CRATES_IO_PROTOCOL \
${{ 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 ABI="${{ matrix.abi }}" \
-e ARCH="${{ matrix.arch }}" \
......@@ -284,7 +286,7 @@ jobs:
-xeo pipefail scripts/docker-native-build.sh
- 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 }}
- name: 'Build'
......@@ -297,7 +299,8 @@ jobs:
rustc --version --verbose || true
node -v
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
strip -x packages/next-swc/native/next-swc.*.node
fi
......
......@@ -88,7 +88,7 @@ jobs:
- name: Build next-swc
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"
- name: Build next.js
......
......@@ -4989,7 +4989,6 @@ dependencies = [
"turbo-unix-path",
"turbopack-core",
"turbopack-ecmascript-hmr-protocol",
"turbopack-ecmascript-plugins",
"turbopack-node",
"turbopack-trace-server",
"turbopack-trace-utils",
......@@ -10133,6 +10132,7 @@ dependencies = [
name = "turbo-tasks-malloc"
version = "0.1.0"
dependencies = [
"libmimalloc-sys",
"mimalloc",
]
......@@ -10481,6 +10481,7 @@ dependencies = [
"tracing",
"turbo-bincode",
"turbo-esregex",
"turbo-frozenmap",
"turbo-rcstr",
"turbo-tasks",
"turbo-tasks-backend",
......
......@@ -87,7 +87,7 @@ inherits = "release"
debug = true
# 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]
opt-level = "s"
......
import type { Metadata } from 'next'
import type React from 'react'
// @ts-expect-error - Fixed once Next.js 16.2.0 is used.
import './globals.css'
export const metadata: Metadata = {
......
......@@ -3,10 +3,10 @@
"version": "16.0.2-canary.16",
"private": true,
"scripts": {
"build": "cross-env NEXT_TEST_NATIVE_IGNORE_LOCAL_INSTALL=true NEXT_TEST_NATIVE_DIR=no NEXT_TEST_WASM= next build --no-mangling",
"dev": "cross-env NEXT_TEST_NATIVE_IGNORE_LOCAL_INSTALL=true NEXT_TEST_NATIVE_DIR=no next dev",
"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 dev",
"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": {
"@radix-ui/react-dialog": "1.1.4",
......@@ -20,7 +20,7 @@
"clsx": "^2.1.1",
"cmdk": "1.0.4",
"lucide-react": "^0.554.0",
"next": "16.0.8",
"next": "16.2.3",
"next-themes": "^0.4.6",
"polished": "^4.3.1",
"react": "19.2.0",
......
......@@ -12,7 +12,7 @@
"fumadocs-core": "15.7.12",
"fumadocs-mdx": "11.10.0",
"fumadocs-ui": "15.7.12",
"next": "15.5.8",
"next": "16.2.3",
"react": "19.1.1",
"react-dom": "19.1.1"
},
......
......@@ -92,6 +92,7 @@ fn main() {
*cell = Some(Instant::now());
}
});
TurboMalloc::thread_park();
})
.build()
.unwrap()
......
......@@ -92,11 +92,6 @@ default = ["process_pool"]
process_pool = ["turbopack-node/process_pool"]
worker_pool = ["turbopack-node/worker_pool"]
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-avif = ["turbopack-image/avif"]
......
......@@ -14,9 +14,7 @@
"jsx": "react-jsx",
"lib": ["ESNext", "DOM"],
"target": "esnext",
"ignoreDeprecations": "6.0",
// modules
"baseUrl": ".",
"module": "node16",
"moduleResolution": "node16",
"resolveJsonModule": true,
......
use anyhow::Result;
#[allow(unused_imports)]
use turbo_rcstr::RcStr;
use turbo_tasks::Vc;
use turbo_tasks_fs::FileSystemPath;
use turbopack::module_options::ModuleRule;
#[allow(unused_imports)]
use turbopack_core::{context::AssetContext, resolve::origin::ResolveOrigin};
use crate::next_config::NextConfig;
......@@ -15,30 +13,19 @@ pub async fn get_swc_ecma_transform_plugin_rule(
) -> Result<Option<ModuleRule>> {
let plugin_configs = next_config.experimental_swc_plugins().await?;
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
}
#[cfg(not(feature = "plugin"))]
{
let _ = project_path; // To satisfy lint
Ok(None)
}
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
} else {
Ok(None)
}
}
/// A resolve origin without any asset_context, intended for handle_resolve_error
#[cfg(feature = "plugin")]
#[turbo_tasks::value]
pub struct DummyResolveOrigin {
origin_path: FileSystemPath,
}
#[cfg(feature = "plugin")]
#[turbo_tasks::value_impl]
impl DummyResolveOrigin {
#[turbo_tasks::function]
......@@ -47,7 +34,6 @@ impl DummyResolveOrigin {
}
}
#[cfg(feature = "plugin")]
#[turbo_tasks::value_impl]
impl ResolveOrigin for DummyResolveOrigin {
#[turbo_tasks::function]
......@@ -61,7 +47,6 @@ impl ResolveOrigin for DummyResolveOrigin {
}
}
#[cfg(feature = "plugin")]
pub async fn get_swc_ecma_transform_rule_impl(
project_path: FileSystemPath,
plugin_configs: &[(RcStr, serde_json::Value)],
......
......@@ -119,6 +119,9 @@ pub struct NextSegmentConfig {
#[turbo_tasks(trace_ignore)]
#[bincode(with_serde)]
pub unstable_instant: Option<Span>,
#[turbo_tasks(trace_ignore)]
#[bincode(with_serde)]
pub unstable_prefetch: Option<Span>,
}
#[turbo_tasks::value_impl]
......@@ -533,9 +536,25 @@ pub async fn parse_segment_config_from_source(
"unstable_instant",
span,
rcstr!(
"App pages 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 to \
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,
IssueSeverity::Error,
......@@ -962,6 +981,9 @@ async fn parse_config_value(
"unstable_instant" => {
config.unstable_instant = Some(span);
}
"unstable_prefetch" => {
config.unstable_prefetch = Some(span);
}
_ => {}
}
......
......@@ -4,20 +4,6 @@ name = "next-custom-transforms"
version = "0.0.0"
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]
workspace = true
......@@ -64,7 +50,6 @@ styled_components = { workspace = true }
styled_jsx = { workspace = true }
swc_emotion = { workspace = true }
swc_relay = { workspace = true }
turbopack-ecmascript-plugins = { workspace = true, optional = true }
turbo-rcstr = { workspace = true }
urlencoding = { workspace = true }
next-taskless = { workspace = true }
......@@ -75,7 +60,6 @@ preset_env_base = { workspace = true }
[dev-dependencies]
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_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
crate-type = ["cdylib"]
[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-avif = ["next-core/image-avif"]
# Enable all the available image codec support.
......@@ -50,11 +33,6 @@ ignored = [
# we need to set features on these packages when building for WASM, but we don't directly use them
"getrandom",
"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]
......@@ -105,13 +83,16 @@ swc_core = { workspace = true, features = [
"ecma_transforms_typescript",
"ecma_utils",
"ecma_visit",
"__plugin_transform_host",
"__plugin_transform_host_schema_v1",
"plugin_transform_host_native_filesystem_cache",
] }
# Dependencies for the native, non-wasm32 build.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
lightningcss-napi = { workspace = true }
swc_plugin_backend_wasmtime = { workspace = true, optional = true }
lightningcss = { workspace = true }
swc_plugin_backend_wasmtime = { workspace = true }
tokio = { workspace = true, features = ["full"] }
turbo-rcstr = { workspace = true, features = ["napi"] }
turbo-tasks = { workspace = true }
......@@ -132,7 +113,6 @@ turbopack-core = { workspace = true }
turbopack-ecmascript-hmr-protocol = { workspace = true }
turbopack-trace-utils = { workspace = true }
turbopack-trace-server = { workspace = true }
turbopack-ecmascript-plugins = { workspace = true, optional = true }
turbopack-node = { workspace = true, default-features = false, features = ["worker_pool"] }
[target.'cfg(windows)'.dependencies]
......
......@@ -106,6 +106,7 @@ fn init() {
*cell = Some(Instant::now());
}
});
TurboMalloc::thread_park();
})
.worker_threads(worker_threads)
// Avoid a limit on threads to avoid deadlocks due to usage of block_in_place
......
......@@ -31,6 +31,7 @@ use std::{
fs::read_to_string,
panic::{AssertUnwindSafe, catch_unwind},
rc::Rc,
sync::Arc,
};
use anyhow::{Context as _, anyhow, bail};
......@@ -41,10 +42,11 @@ use once_cell::sync::Lazy;
use rustc_hash::{FxHashMap, FxHashSet};
use swc_core::{
atoms::Atom,
base::{Compiler, TransformOutput, try_with_handler},
base::{Compiler, TransformOutput, config::RuntimeOptions, try_with_handler},
common::{FileName, GLOBALS, Mark, comments::SingleThreadedComments, errors::ColorConfig},
ecma::ast::noop_pass,
};
use swc_plugin_backend_wasmtime::WasmtimeRuntime;
use crate::{complete_output, get_compiler, util::MapErr};
......@@ -128,15 +130,8 @@ impl Task for TransformTask {
let unresolved_mark = Mark::new();
let mut options = options.patch(&fm);
options.swc.unresolved_mark = Some(unresolved_mark);
#[cfg(feature = "plugin")]
{
options.swc.runtime_options =
swc_core::base::config::RuntimeOptions::default()
.plugin_runtime(std::sync::Arc::new(
swc_plugin_backend_wasmtime::WasmtimeRuntime,
));
}
options.swc.runtime_options =
RuntimeOptions::default().plugin_runtime(Arc::new(WasmtimeRuntime));
let cm = self.c.cm.clone();
let file = fm.clone();
......
......@@ -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.
## 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
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`](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:
## 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.
- 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.
- [`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
......
......@@ -15,5 +15,5 @@
"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",
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"keywords": [
"react",
"next",
......
{
"name": "eslint-config-next",
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"description": "ESLint configuration used by Next.js.",
"license": "MIT",
"repository": {
......@@ -12,7 +12,7 @@
"dist"
],
"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-typescript": "^3.5.2",
"eslint-plugin-import": "^2.32.0",
......
{
"name": "@next/eslint-plugin-internal",
"private": true,
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"description": "ESLint plugin for working on Next.js.",
"exports": {
".": "./src/eslint-plugin-internal.js"
......
{
"name": "@next/eslint-plugin-next",
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"description": "ESLint plugin for Next.js.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
......
{
"name": "@next/font",
"private": true,
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
......
{
"name": "@next/bundle-analyzer",
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
......
{
"name": "@next/codemod",
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"license": "MIT",
"repository": {
"type": "git",
......
......@@ -5,8 +5,6 @@
"esModuleInterop": true,
"noImplicitAny": false,
"target": "ES2022",
"downlevelIteration": true,
"ignoreDeprecations": "6.0",
"preserveWatchOutput": true,
"strictFunctionTypes": false,
"strictNullChecks": false,
......
{
"name": "@next/env",
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"keywords": [
"react",
"next",
......
{
"name": "@next/mdx",
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"main": "index.js",
"license": "MIT",
"repository": {
......
{
"name": "@next/playwright",
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-playwright"
......
{
"name": "@next/plugin-storybook",
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
......
{
"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+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
......
{
"name": "@next/polyfill-nomodule",
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
......
{
"name": "@next/routing",
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"keywords": [
"react",
"next",
......
{
"name": "next-rspack",
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-rspack"
......
{
"name": "@next/swc",
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"private": true,
"files": [
"native/"
......@@ -8,11 +8,9 @@
"scripts": {
"build-native-auto": "node maybe-build-native.mjs",
"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-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-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-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": "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 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-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-wasm": "wasm-pack build ../../crates/wasm --scope=next",
......
......@@ -46,16 +46,6 @@
"inputs": ["../../target/.rust-fingerprint"],
"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": {
"dependsOn": ["rust-fingerprint"],
"inputs": ["../../target/.rust-fingerprint"],
......
......@@ -1156,5 +1156,9 @@
"1155": "Not implemented",
"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.",
"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",
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
......@@ -101,7 +101,7 @@
]
},
"dependencies": {
"@next/env": "16.2.1-canary.38",
"@next/env": "16.2.1-canary.42",
"@swc/helpers": "0.5.15",
"baseline-browser-mapping": "^2.9.19",
"caniuse-lite": "^1.0.30001579",
......@@ -165,11 +165,11 @@
"@modelcontextprotocol/sdk": "1.18.1",
"@mswjs/interceptors": "0.23.0",
"@napi-rs/triples": "1.2.0",
"@next/font": "16.2.1-canary.38",
"@next/polyfill-module": "16.2.1-canary.38",
"@next/polyfill-nomodule": "16.2.1-canary.38",
"@next/react-refresh-utils": "16.2.1-canary.38",
"@next/swc": "16.2.1-canary.38",
"@next/font": "16.2.1-canary.42",
"@next/polyfill-module": "16.2.1-canary.42",
"@next/polyfill-nomodule": "16.2.1-canary.42",
"@next/react-refresh-utils": "16.2.1-canary.42",
"@next/swc": "16.2.1-canary.42",
"@opentelemetry/api": "1.6.0",
"@playwright/test": "1.58.2",
"@rspack/core": "1.6.7",
......
......@@ -681,13 +681,26 @@ export async function getAppPageStaticInfo({
// Prevent use client and unstable_instant in the same file.
if (directives?.has('client') && 'unstable_instant' in config) {
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) {
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([
z.literal(false),
])
const PrefetchSchema = z.enum(['static', 'runtime'])
export type Instant = InstantConfigStatic | InstantConfigRuntime | false
export type Prefetch = 'static' | 'runtime'
export type InstantConfigForTypeCheckInternal = __GenericInstantConfig | Instant
// the __GenericPrefetch type is used to avoid type widening issues with
// our choice to make exports the medium for programming a Next.js application
......@@ -145,6 +149,13 @@ const AppSegmentConfigSchema = z.object({
*/
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.
* Controls how long the client-side router cache retains dynamic page data.
......@@ -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`,
}
}
case 'unstable_prefetch': {
return {
message: `Invalid unstable_prefetch value ${JSON.stringify(ctx.data)} on "${route}", must be "static" or "runtime".`,
}
}
case 'unstable_dynamicStaleTime': {
return {
message: `Invalid unstable_dynamicStaleTime value ${JSON.stringify(ctx.data)} on "${route}", must be a non-negative number`,
......@@ -254,6 +270,13 @@ export type AppSegmentConfig = {
*/
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.
* Controls how long the client-side router cache retains dynamic page data.
......
......@@ -54,7 +54,7 @@ ${
: `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')
......@@ -72,6 +72,7 @@ checkFields<Diff<{
config?: {}
generateStaticParams?: Function
unstable_instant?: InstantConfigForTypeCheckInternal
unstable_prefetch?: Prefetch
unstable_dynamicStaleTime?: number
revalidate?: RevalidateRange<TEntry> | false
dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'
......
......@@ -384,7 +384,7 @@ export class Head extends React.Component<HeadProps> {
getCssLinks(files: DocumentFiles): JSX.Element[] | null {
const {
assetPrefix,
assetQueryString,
cssAssetQueryString,
dynamicImports,
dynamicCssManifest,
crossOrigin,
......@@ -422,7 +422,7 @@ export class Head extends React.Component<HeadProps> {
rel="preload"
href={`${assetPrefix}/_next/${encodeURIPath(
file
)}${assetQueryString}`}
)}${cssAssetQueryString}`}
as="style"
crossOrigin={this.props.crossOrigin || crossOrigin}
/>
......@@ -436,7 +436,7 @@ export class Head extends React.Component<HeadProps> {
rel="stylesheet"
href={`${assetPrefix}/_next/${encodeURIPath(
file
)}${assetQueryString}`}
)}${cssAssetQueryString}`}
crossOrigin={this.props.crossOrigin || crossOrigin}
data-n-g={isUnmanagedFile ? undefined : isSharedFile ? '' : undefined}
data-n-p={
......@@ -589,7 +589,7 @@ export class Head extends React.Component<HeadProps> {
optimizeCss,
assetPrefix,
nextFontManifest,
assetQueryString,
cssAssetQueryString,
} = this.context
const disableRuntimeJS = unstable_runtimeJS === false
......@@ -659,7 +659,7 @@ export class Head extends React.Component<HeadProps> {
nextFontManifest,
dangerousAsPath,
assetPrefix,
assetQueryString
cssAssetQueryString
)
const tracingMetadata = getTracedMetadata(
......
......@@ -487,7 +487,9 @@ async function collectPrefetchHintsImpl(
const childRoute = children[parallelRouteKey]
const childSegment = childRoute[0]
const childSeedData =
seedDataChildren !== null ? seedDataChildren[parallelRouteKey] : null
seedDataChildren !== null
? (seedDataChildren[parallelRouteKey] ?? null)
: null
const childRequestKey = appendSegmentRequestKeyPart(
requestKey,
......@@ -870,7 +872,9 @@ function collectSegmentDataImpl(
const childRoute = children[parallelRouteKey]
const childSegment = childRoute[0]
const childSeedData =
seedDataChildren !== null ? seedDataChildren[parallelRouteKey] : null
seedDataChildren !== null
? (seedDataChildren[parallelRouteKey] ?? null)
: null
const childRequestKey = appendSegmentRequestKeyPart(
requestKey,
......
......@@ -243,13 +243,10 @@ async function createComponentTreeInternal(
})
: []
const instantConfig = layoutOrPageMod
? (layoutOrPageMod as AppSegmentConfig).unstable_instant
const prefetchConfig = layoutOrPageMod
? (layoutOrPageMod as AppSegmentConfig).unstable_prefetch
: undefined
const hasRuntimePrefetch =
instantConfig && typeof instantConfig === 'object'
? instantConfig.prefetch === 'runtime'
: false
const hasRuntimePrefetch = prefetchConfig === 'runtime'
const isRuntimePrefetchable = hasRuntimePrefetch || parentRuntimePrefetchable
const [Forbidden, forbiddenStyles] =
......
......@@ -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 instantConfig = mod
? (mod as AppSegmentConfig).unstable_instant
: undefined
const prefetchConfig = mod
? (mod as AppSegmentConfig).unstable_prefetch
: undefined
let prefetchHints = 0
// Union in the precomputed build-time hints (e.g. segment inlining
......@@ -89,9 +92,10 @@ async function createFlightRouterStateFromLoaderTreeImpl(
prefetchHints |= PrefetchHint.PrefetchDisabled
} else if (instantConfig && typeof instantConfig === 'object') {
prefetchHints |= PrefetchHint.SubtreeHasInstant
if (instantConfig.prefetch === 'runtime') {
prefetchHints |= PrefetchHint.HasRuntimePrefetch
}
}
if (prefetchConfig === 'runtime') {
prefetchHints |= PrefetchHint.HasRuntimePrefetch
}
// Check if this segment has a loading boundary
......
......@@ -16,14 +16,10 @@ export async function anySegmentHasRuntimePrefetchEnabled(
const { mod: layoutOrPageMod } = await getLayoutOrPageModule(tree)
// TODO(restart-on-cache-miss): Does this work correctly for client page/layout modules?
const instantConfig = layoutOrPageMod
? (layoutOrPageMod as AppSegmentConfig).unstable_instant
const prefetchConfig = layoutOrPageMod
? (layoutOrPageMod as AppSegmentConfig).unstable_prefetch
: undefined
const hasRuntimePrefetch =
instantConfig && typeof instantConfig === 'object'
? instantConfig.prefetch === 'runtime'
: false
if (hasRuntimePrefetch) {
if (prefetchConfig === 'runtime') {
return true
}
......
......@@ -1146,10 +1146,13 @@ export async function createCombinedPayloadAtDepth(
: createChildSegmentPath(parentPath, key!, segment)
let instantConfig: Instant | null = null
let prefetchConfig: AppSegmentConfig['unstable_prefetch'] | null = null
let localCreateInstantStack: (() => Error) | null = null
if (layoutOrPageMod !== undefined) {
instantConfig =
(layoutOrPageMod as AppSegmentConfig).unstable_instant ?? null
prefetchConfig =
(layoutOrPageMod as AppSegmentConfig).unstable_prefetch ?? null
if (instantConfig && typeof instantConfig === 'object') {
const rawFactory: unknown = (layoutOrPageMod as any)
.__debugCreateInstantConfigStack
......@@ -1158,14 +1161,12 @@ export async function createCombinedPayloadAtDepth(
}
}
const segmentHasRuntimePrefetch = prefetchConfig === 'runtime'
let childIsInsideRuntimePrefetch = isInsideRuntimePrefetch
let stage: SegmentStage
if (!isInsideRuntimePrefetch) {
if (
instantConfig &&
typeof instantConfig === 'object' &&
instantConfig.prefetch === 'runtime'
) {
if (segmentHasRuntimePrefetch) {
stage = RenderStage.Runtime
childIsInsideRuntimePrefetch = true
hasRuntimeSegments = true
......
......@@ -812,7 +812,52 @@ export async function continueStaticFallbackPrerender(
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,
opts: import('./stream-ops.web').ContinueDynamicHTMLResumeOptions
): Promise<AnyStream> {
......
......@@ -35,7 +35,8 @@ export const continueStaticPrerender = _m.continueStaticPrerender
export const continueDynamicPrerender = _m.continueDynamicPrerender
export const 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 chainStreams = _m.chainStreams
export const createDocumentClosingStream = _m.createDocumentClosingStream
......
......@@ -141,7 +141,7 @@ export async function continueStaticFallbackPrerender(
)
}
export async function continueDynamicHTMLResume(
export async function continueDynamicHTMLResumeWeb(
renderStream: AnyStream,
opts: ContinueDynamicHTMLResumeOptions
): Promise<AnyStream> {
......@@ -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> {
return webStreamToBuffer(stream as ReadableStream<Uint8Array>)
}
......
......@@ -72,8 +72,6 @@ export type AppPageRenderResultMetadata = {
export type PagesRenderResultMetadata = {
pageData?: any
cacheControl?: CacheControl
assetQueryString?: string
mutableAssetQueryString?: string
isNotFound?: boolean
isRedirect?: boolean
}
......
......@@ -254,7 +254,6 @@ export type RenderOptsPartial = {
optimizeCss: any
nextConfigOutput?: 'standalone' | 'export'
nextScriptWorkers: any
assetQueryString?: string
resolvedUrl?: string
resolvedAsPath?: string
setIsrStatus?: (key: string, value: boolean | undefined) => void
......@@ -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(
req: IncomingMessage,
res: ServerResponse,
......@@ -458,35 +467,30 @@ export async function renderToHTMLImpl(
// Adds support for reading `cookies` in `getServerSideProps` when SSR.
setLazyProp({ req: req as any }, 'cookies', getCookieParser(req.headers))
let baseAssetQueryString =
(process.env.__NEXT_DEV_SERVER && renderOpts.assetQueryString) || ''
if (process.env.__NEXT_DEV_SERVER && !baseAssetQueryString) {
const userAgent = (req.headers['user-agent'] || '').toLowerCase()
if (userAgent.includes('safari') && !userAgent.includes('chrome')) {
// In dev we invalidate the cache by appending a timestamp to the resource URL.
// This is a workaround to fix https://github.com/vercel/next.js/issues/5860
// TODO: remove this workaround when https://bugs.webkit.org/show_bug.cgi?id=187726 is fixed.
// Note: The workaround breaks breakpoints on reload since the script url always changes,
// so we only apply it to Safari.
baseAssetQueryString = `?ts=${Date.now()}`
}
}
const mutableAssetQueryString =
baseAssetQueryString +
(sharedContext.deploymentId
? `${baseAssetQueryString ? '&' : '?'}dpl=${sharedContext.deploymentId}`
: '')
const assetQueryString =
baseAssetQueryString +
// cssCacheBuster is a workaround for a Safari bug
// (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
// to CSS and font assets — not to script tags — because the Turbopack
// runtime infers ASSET_SUFFIX from the executing script's query string and
// leaks it onto all static asset URLs (including images), causing
// next/image validation errors.
// See https://github.com/vercel/next.js/issues/92118.
const cssCacheBuster = getSafariCacheBusterQueryString(req)
const mutableAssetQueryString = sharedContext.deploymentId
? `?dpl=${sharedContext.deploymentId}`
: ''
const assetQueryString = sharedContext.clientAssetToken
? `?dpl=${sharedContext.clientAssetToken}`
: ''
// cssAssetQueryString is assetQueryString with the cacheBuster prepended.
// Use this for CSS and font URLs; use assetQueryString for script URLs.
const cssAssetQueryString =
cssCacheBuster +
(sharedContext.clientAssetToken
? `${baseAssetQueryString ? '&' : '?'}dpl=${sharedContext.clientAssetToken}`
? `${cssCacheBuster ? '&' : '?'}dpl=${sharedContext.clientAssetToken}`
: '')
const metadata: PagesRenderResultMetadata = {
assetQueryString,
mutableAssetQueryString,
}
const metadata: PagesRenderResultMetadata = {}
// don't modify original query object
query = Object.assign({}, query)
......@@ -1530,8 +1534,9 @@ export async function renderToHTMLImpl(
? pageConfig.unstable_runtimeJS
: undefined,
unstable_JsPreload: pageConfig.unstable_JsPreload,
assetQueryString: assetQueryString || '',
mutableAssetQueryString: mutableAssetQueryString || '',
assetQueryString,
cssAssetQueryString,
mutableAssetQueryString,
scriptLoader,
locale,
disableOptimizedLoading,
......
......@@ -31,6 +31,11 @@ export type HtmlProps = {
unstable_JsPreload?: false
assetQueryString: string
mutableAssetQueryString: string
/**
* Asset query string for CSS and font assets.
* See https://github.com/vercel/next.js/issues/92118.
*/
cssAssetQueryString: string
scriptLoader: {
afterInteractive?: string[]
beforeInteractive?: any[]
......
{
"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.",
"repository": {
"url": "vercel/next.js",
......
......@@ -6,8 +6,6 @@
"esModuleInterop": true,
"target": "es2015",
"lib": ["dom", "es2020"],
"downlevelIteration": true,
"ignoreDeprecations": "6.0",
"preserveWatchOutput": true,
"skipLibCheck": true,
"outDir": "dist",
......
{
"name": "@next/third-parties",
"version": "16.2.1-canary.38",
"version": "16.2.1-canary.42",
"repository": {
"url": "vercel/next.js",
"directory": "packages/third-parties"
......@@ -27,7 +27,7 @@
"third-party-capital": "1.0.20"
},
"devDependencies": {
"next": "16.2.1-canary.38",
"next": "16.2.1-canary.42",
"outdent": "0.8.0",
"prettier": "2.5.1",
"typescript": "6.0.2"
......
This diff is collapsed.
......@@ -819,18 +819,23 @@ function generateIndexMd(
'',
`## 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++) {
const thread = reviewThreads[i]
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 status = thread.isResolved ? 'Resolved' : 'Open'
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'
import { Suspense } from 'react'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
const CACHE_KEY = __dirname + '/__PAGE__'
......
......@@ -3,6 +3,7 @@ import { UncachedFetch, CachedData } from '../data-fetching'
import { PrivateCachedData } from './data-fetching'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
const CACHE_KEY = '/private-cache/__LAYOUT__'
......
......@@ -3,6 +3,7 @@ import { UncachedFetch, CachedData } from '../data-fetching'
import { ShortLivedCache } from './data-fetching'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
const CACHE_KEY = __dirname + '/__LAYOUT__'
......
......@@ -2,6 +2,7 @@ import { Suspense } from 'react'
import { UncachedFetch, CachedFetch, CachedData } from '../data-fetching'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
const CACHE_KEY = __dirname + '/__LAYOUT__'
......
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
export default async function Page() {
return (
......
......@@ -3,6 +3,7 @@ import { CachedData, getCachedData } from '../../data-fetching'
import { cookies } from 'next/headers'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
const CACHE_KEY = __dirname + '/__PAGE__'
......
import { CachedData, getCachedData } from '../../data-fetching'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
const CACHE_KEY = __dirname + '/__PAGE__'
......
......@@ -2,6 +2,7 @@ import { Suspense } from 'react'
import { Static, Runtime, Dynamic } from '../shared'
export const unstable_instant = { prefetch: 'runtime', samples: [{}] }
export const unstable_prefetch = 'runtime'
export default function Root({ children }: { children: React.ReactNode }) {
return (
......
......@@ -5,6 +5,7 @@ export const unstable_instant = {
prefetch: 'runtime',
samples: [{ searchParams: { myParam: 'testValue' } }],
}
export const unstable_prefetch = 'runtime'
type SearchParams = { [key: string]: string | string[] | undefined }
......
......@@ -6,6 +6,7 @@ export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'runtime'
export default async function Page() {
return (
......
......@@ -6,6 +6,7 @@ export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'runtime'
export default async function Page() {
return (
......
......@@ -6,6 +6,7 @@ export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'runtime'
export default async function Page() {
return (
......
......@@ -15,6 +15,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
export default async function Page() {
return (
......
......@@ -10,6 +10,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
export default async function Page() {
return (
......
......@@ -10,6 +10,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
export default async function Page() {
return (
......
......@@ -16,6 +16,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
export function generateStaticParams() {
return [{ slug: 'foo' }, { slug: 'bar' }]
......
......@@ -6,6 +6,7 @@ export const unstable_instant = {
prefetch: 'runtime',
samples: [{ headers: [] }],
}
export const unstable_prefetch = 'runtime'
export default async function Page() {
return (
......
......@@ -6,6 +6,7 @@ export const unstable_instant = {
prefetch: 'runtime',
samples: [{ headers: [] }],
}
export const unstable_prefetch = 'runtime'
export default async function Page() {
return (
......
......@@ -6,6 +6,7 @@ export const unstable_instant = {
prefetch: 'runtime',
samples: [{ headers: [] }],
}
export const unstable_prefetch = 'runtime'
export default async function Page() {
return (
......
......@@ -15,6 +15,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
export default async function Page() {
return (
......
......@@ -10,6 +10,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
export default async function Page() {
return (
......
......@@ -10,6 +10,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
export default async function Page() {
return (
......
......@@ -5,6 +5,7 @@ export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [{ name: 'auth', value: '1' }] }],
}
export const unstable_prefetch = 'runtime'
export default async function Page() {
const c = await cookies()
......
......@@ -13,6 +13,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
export default async function Page({
params,
......
......@@ -13,6 +13,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
export default async function Page({
params,
......
......@@ -12,6 +12,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
export default async function Page({
params,
......
......@@ -5,6 +5,7 @@ export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [{ params: { slug: 'hello' } }],
}
export const unstable_prefetch = 'runtime'
export default async function Page({
params,
......
......@@ -5,6 +5,7 @@ export const unstable_instant: Instant = {
prefetch: 'runtime',
samples: [{ params: { slug: 'hello' } }],
}
export const unstable_prefetch = 'runtime'
export default async function Page({
params,
......
......@@ -4,6 +4,7 @@ export const unstable_instant = {
prefetch: 'runtime',
samples: [{ searchParams: { q: 'test' } }],
}
export const unstable_prefetch = 'runtime'
export default async function Page({
searchParams,
......
......@@ -4,6 +4,7 @@ export const unstable_instant = {
prefetch: 'runtime',
samples: [{ searchParams: { q: 'test' } }],
}
export const unstable_prefetch = 'runtime'
export default async function Page({
searchParams,
......
......@@ -12,6 +12,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
export default function Page() {
return (
......
......@@ -11,6 +11,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
export default function Page() {
return (
......
......@@ -16,6 +16,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
type SearchParams = Record<string, string | string[]>
......
......@@ -12,6 +12,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
export default async function Page({
searchParams,
......
......@@ -14,6 +14,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
export default async function Page({
searchParams,
......
......@@ -14,6 +14,7 @@ export const unstable_instant: Instant = {
},
],
}
export const unstable_prefetch = 'runtime'
export default function Page() {
return (
......
......@@ -5,6 +5,7 @@ export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'runtime'
export default function Page() {
return (
......
......@@ -4,6 +4,7 @@ export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'runtime'
export default function Page() {
return (
......
......@@ -4,6 +4,7 @@ export const unstable_instant = {
prefetch: 'runtime',
samples: [{ cookies: [] }],
}
export const unstable_prefetch = 'runtime'
export default function Page() {
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