Skip to content

Commit 2d7949b

Browse files
authored
Merge branch 'canary' into update/fonts-data-1723075867139
2 parents 6365cd4 + c86062a commit 2d7949b

File tree

150 files changed

+1564
-1041
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+1564
-1041
lines changed

.github/.react-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19.0.0-rc-06d0b89e-20240801
1+
19.0.0-rc-187dd6a7-20240806

crates/next-core/src/next_import_map.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -682,9 +682,9 @@ async fn rsc_aliases(
682682
"react/jsx-dev-runtime" => format!("next/dist/compiled/react{react_channel}/jsx-dev-runtime"),
683683
"react/compiler-runtime" => format!("next/dist/compiled/react{react_channel}/compiler-runtime"),
684684
"react-dom/client" => format!("next/dist/compiled/react-dom{react_channel}/{react_client_package}"),
685-
"react-dom/static" => format!("next/dist/compiled/react-dom-experimental/static"),
686-
"react-dom/static.edge" => format!("next/dist/compiled/react-dom-experimental/static.edge"),
687-
"react-dom/static.browser" => format!("next/dist/compiled/react-dom-experimental/static.browser"),
685+
"react-dom/static" => format!("next/dist/compiled/react-dom{react_channel}/static"),
686+
"react-dom/static.edge" => format!("next/dist/compiled/react-dom{react_channel}/static.edge"),
687+
"react-dom/static.browser" => format!("next/dist/compiled/react-dom{react_channel}/static.browser"),
688688
"react-dom/server" => format!("next/dist/compiled/react-dom{react_channel}/server"),
689689
"react-dom/server.edge" => format!("next/dist/compiled/react-dom{react_channel}/server.edge"),
690690
"react-dom/server.browser" => format!("next/dist/compiled/react-dom{react_channel}/server.browser"),

crates/next-custom-transforms/src/transforms/react_server_components.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,24 @@ fn collect_top_level_directives_and_imports(
377377
}
378378
}
379379
}
380-
ModuleItem::ModuleDecl(ModuleDecl::Import(import)) => {
380+
ModuleItem::ModuleDecl(ModuleDecl::Import(
381+
import @ ImportDecl {
382+
type_only: false, ..
383+
},
384+
)) => {
381385
let source = import.src.value.clone();
382386
let specifiers = import
383387
.specifiers
384388
.iter()
389+
.filter(|specifier| {
390+
!matches!(
391+
specifier,
392+
ImportSpecifier::Named(ImportNamedSpecifier {
393+
is_type_only: true,
394+
..
395+
})
396+
)
397+
})
385398
.map(|specifier| match specifier {
386399
ImportSpecifier::Named(named) => match &named.imported {
387400
Some(imported) => match &imported {
@@ -561,7 +574,6 @@ impl ReactServerComponentValidator {
561574
// assert_invalid_server_lib_apis("react", import)
562575
// assert_invalid_server_lib_apis("react-dom", import)
563576
fn assert_invalid_server_lib_apis(&self, import_source: String, import: &ModuleImports) {
564-
// keys of invalid_server_lib_apis_mapping
565577
let invalid_apis = self
566578
.invalid_server_lib_apis_mapping
567579
.get(import_source.as_str());

crates/next-custom-transforms/tests/fixture.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,28 @@ fn shake_exports_fixture_default(input: PathBuf) {
309309
);
310310
}
311311

312+
#[fixture("tests/fixture/react-server-components/**/input.ts")]
313+
fn react_server_components_typescript(input: PathBuf) {
314+
use next_custom_transforms::transforms::react_server_components::{Config, Options};
315+
let output = input.parent().unwrap().join("output.ts");
316+
test_fixture(
317+
Syntax::Typescript(Default::default()),
318+
&|tr| {
319+
server_components(
320+
FileName::Real(PathBuf::from("/some-project/src/some-file.js")),
321+
Config::WithOptions(Options {
322+
is_react_server_layer: true,
323+
}),
324+
tr.comments.as_ref().clone(),
325+
None,
326+
)
327+
},
328+
&input,
329+
&output,
330+
Default::default(),
331+
);
332+
}
333+
312334
#[fixture("tests/fixture/react-server-components/server-graph/**/input.js")]
313335
fn react_server_components_server_graph_fixture(input: PathBuf) {
314336
use next_custom_transforms::transforms::react_server_components::{Config, Options};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// This fails if the `type` keyword is removed
2+
import { type usePathname } from 'next/navigation'
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// This fails if the `type` keyword is removed
2+
import { type usePathname } from 'next/navigation';

docs/02-app/01-building-your-application/11-upgrading/02-version-15.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ pnpm up next@rc react@rc react-dom@rc eslint-config-next@rc
2525
bun add next@rc react@rc react-dom@rc eslint-config-next@rc
2626
```
2727

28-
> **Good to know:** If you are using TypeScript, ensure you also upgrade `@types/react` and `@types/react-dom` to their latest versions.
28+
> **Good to know:**
29+
>
30+
> - If you see a peer dependencies warning, you may need to update `react` and `react-dom` to the suggested versions, or you use the `--force` or `--legacy-peer-deps` flag to ignore the warning. This won't be necessary once both Next.js 15 and React 19 are stable.
31+
> - If you are using TypeScript, you'll need to temporarily override the React types. See the [React 19 RC upgrade guide](https://react.dev/blog/2024/04/25/react-19-upgrade-guide#installing) for more information.
2932
3033
## Minimum React version
3134

docs/02-app/02-api-reference/05-next-config-js/assetPrefix.mdx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,25 @@ description: Learn how to use the assetPrefix config option to configure your CD
2323
> suited for hosting your application on a sub-path like `/docs`.
2424
> We do not suggest you use a custom Asset Prefix for this use case.
2525
26-
To set up a [CDN](https://en.wikipedia.org/wiki/Content_delivery_network), you can set up an asset prefix and configure your CDN's origin to resolve to the domain that Next.js is hosted on.
27-
28-
Open `next.config.js` and add the `assetPrefix` config:
26+
## Set up a CDN
2927

30-
```js filename="next.config.js"
31-
const isProd = process.env.NODE_ENV === 'production'
28+
To set up a [CDN](https://en.wikipedia.org/wiki/Content_delivery_network), you can set up an asset prefix and configure your CDN's origin to resolve to the domain that Next.js is hosted on.
3229

33-
module.exports = {
34-
// Use the CDN in production and localhost for development.
35-
assetPrefix: isProd ? 'https://cdn.mydomain.com' : undefined,
30+
Open `next.config.mjs` and add the `assetPrefix` config based on the [phase](/docs/app/api-reference/next-config-js#async-configuration):
31+
32+
```js filename="next.config.mjs"
33+
// @ts-check
34+
import { PHASE_DEVELOPMENT_SERVER } from 'next/constants'
35+
36+
export default (phase) => {
37+
const isDev = phase === PHASE_DEVELOPMENT_SERVER
38+
/**
39+
* @type {import('next').NextConfig}
40+
*/
41+
const nextConfig = {
42+
assetPrefix: isDev ? undefined : 'https://cdn.mydomain.com',
43+
}
44+
return nextConfig
3645
}
3746
```
3847

docs/02-app/02-api-reference/05-next-config-js/devIndicators.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ description: Optimized pages include an indicator to let you know if it's being
2424

2525
Next.js displays a static indicator in the bottom corner of the screen that signals if a route will be prerendered at build time. This makes it easier to understand whether a route is static or dynamic, and for you to identify if a route [opts out of static rendering](#static-route-not-showing-the-indicator).
2626

27-
{/* TODO: Add screenshot - waiting for design */}
27+
<Image
28+
alt="App Folder Structure"
29+
srcLight="/docs/light/static-indicator.png"
30+
srcDark="/docs/dark/static-indicator.png"
31+
width="1600"
32+
height="208"
33+
/>
2834

2935
You can disable the indicator by closing it, or using the config option `next.config.js`:
3036

examples/reproduction-template/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
},
88
"dependencies": {
99
"next": "canary",
10-
"react": "19.0.0-rc-06d0b89e-20240801",
11-
"react-dom": "19.0.0-rc-06d0b89e-20240801"
10+
"react": "19.0.0-rc-187dd6a7-20240806",
11+
"react-dom": "19.0.0-rc-187dd6a7-20240806"
1212
},
1313
"devDependencies": {
1414
"@types/node": "20.12.12",

0 commit comments

Comments
 (0)