Skip to content

Commit

Permalink
Merge branch 'canary' into update/fonts-data-1723075867139
Browse files Browse the repository at this point in the history
  • Loading branch information
samcx committed Aug 8, 2024
2 parents 6365cd4 + c86062a commit 2d7949b
Show file tree
Hide file tree
Showing 150 changed files with 1,564 additions and 1,041 deletions.
2 changes: 1 addition & 1 deletion .github/.react-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19.0.0-rc-06d0b89e-20240801
19.0.0-rc-187dd6a7-20240806
6 changes: 3 additions & 3 deletions crates/next-core/src/next_import_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,9 +682,9 @@ async fn rsc_aliases(
"react/jsx-dev-runtime" => format!("next/dist/compiled/react{react_channel}/jsx-dev-runtime"),
"react/compiler-runtime" => format!("next/dist/compiled/react{react_channel}/compiler-runtime"),
"react-dom/client" => format!("next/dist/compiled/react-dom{react_channel}/{react_client_package}"),
"react-dom/static" => format!("next/dist/compiled/react-dom-experimental/static"),
"react-dom/static.edge" => format!("next/dist/compiled/react-dom-experimental/static.edge"),
"react-dom/static.browser" => format!("next/dist/compiled/react-dom-experimental/static.browser"),
"react-dom/static" => format!("next/dist/compiled/react-dom{react_channel}/static"),
"react-dom/static.edge" => format!("next/dist/compiled/react-dom{react_channel}/static.edge"),
"react-dom/static.browser" => format!("next/dist/compiled/react-dom{react_channel}/static.browser"),
"react-dom/server" => format!("next/dist/compiled/react-dom{react_channel}/server"),
"react-dom/server.edge" => format!("next/dist/compiled/react-dom{react_channel}/server.edge"),
"react-dom/server.browser" => format!("next/dist/compiled/react-dom{react_channel}/server.browser"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,24 @@ fn collect_top_level_directives_and_imports(
}
}
}
ModuleItem::ModuleDecl(ModuleDecl::Import(import)) => {
ModuleItem::ModuleDecl(ModuleDecl::Import(
import @ ImportDecl {
type_only: false, ..
},
)) => {
let source = import.src.value.clone();
let specifiers = import
.specifiers
.iter()
.filter(|specifier| {
!matches!(
specifier,
ImportSpecifier::Named(ImportNamedSpecifier {
is_type_only: true,
..
})
)
})
.map(|specifier| match specifier {
ImportSpecifier::Named(named) => match &named.imported {
Some(imported) => match &imported {
Expand Down Expand Up @@ -561,7 +574,6 @@ impl ReactServerComponentValidator {
// assert_invalid_server_lib_apis("react", import)
// assert_invalid_server_lib_apis("react-dom", import)
fn assert_invalid_server_lib_apis(&self, import_source: String, import: &ModuleImports) {
// keys of invalid_server_lib_apis_mapping
let invalid_apis = self
.invalid_server_lib_apis_mapping
.get(import_source.as_str());
Expand Down
22 changes: 22 additions & 0 deletions crates/next-custom-transforms/tests/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,28 @@ fn shake_exports_fixture_default(input: PathBuf) {
);
}

#[fixture("tests/fixture/react-server-components/**/input.ts")]
fn react_server_components_typescript(input: PathBuf) {
use next_custom_transforms::transforms::react_server_components::{Config, Options};
let output = input.parent().unwrap().join("output.ts");
test_fixture(
Syntax::Typescript(Default::default()),
&|tr| {
server_components(
FileName::Real(PathBuf::from("/some-project/src/some-file.js")),
Config::WithOptions(Options {
is_react_server_layer: true,
}),
tr.comments.as_ref().clone(),
None,
)
},
&input,
&output,
Default::default(),
);
}

#[fixture("tests/fixture/react-server-components/server-graph/**/input.js")]
fn react_server_components_server_graph_fixture(input: PathBuf) {
use next_custom_transforms::transforms::react_server_components::{Config, Options};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This fails if the `type` keyword is removed
import { type usePathname } from 'next/navigation'
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This fails if the `type` keyword is removed
import { type usePathname } from 'next/navigation';
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ pnpm up next@rc react@rc react-dom@rc eslint-config-next@rc
bun add next@rc react@rc react-dom@rc eslint-config-next@rc
```

> **Good to know:** If you are using TypeScript, ensure you also upgrade `@types/react` and `@types/react-dom` to their latest versions.
> **Good to know:**
>
> - 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.
> - 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.
## Minimum React version

Expand Down
25 changes: 17 additions & 8 deletions docs/02-app/02-api-reference/05-next-config-js/assetPrefix.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,25 @@ description: Learn how to use the assetPrefix config option to configure your CD
> suited for hosting your application on a sub-path like `/docs`.
> We do not suggest you use a custom Asset Prefix for this use case.
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.

Open `next.config.js` and add the `assetPrefix` config:
## Set up a CDN

```js filename="next.config.js"
const isProd = process.env.NODE_ENV === 'production'
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.

module.exports = {
// Use the CDN in production and localhost for development.
assetPrefix: isProd ? 'https://cdn.mydomain.com' : undefined,
Open `next.config.mjs` and add the `assetPrefix` config based on the [phase](/docs/app/api-reference/next-config-js#async-configuration):

```js filename="next.config.mjs"
// @ts-check
import { PHASE_DEVELOPMENT_SERVER } from 'next/constants'

export default (phase) => {
const isDev = phase === PHASE_DEVELOPMENT_SERVER
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
assetPrefix: isDev ? undefined : 'https://cdn.mydomain.com',
}
return nextConfig
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ description: Optimized pages include an indicator to let you know if it's being

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).

{/* TODO: Add screenshot - waiting for design */}
<Image
alt="App Folder Structure"
srcLight="/docs/light/static-indicator.png"
srcDark="/docs/dark/static-indicator.png"
width="1600"
height="208"
/>

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

Expand Down
4 changes: 2 additions & 2 deletions examples/reproduction-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
},
"dependencies": {
"next": "canary",
"react": "19.0.0-rc-06d0b89e-20240801",
"react-dom": "19.0.0-rc-06d0b89e-20240801"
"react": "19.0.0-rc-187dd6a7-20240806",
"react-dom": "19.0.0-rc-187dd6a7-20240806"
},
"devDependencies": {
"@types/node": "20.12.12",
Expand Down
16 changes: 16 additions & 0 deletions examples/with-absolute-imports/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export const metadata = {
title: "Next.js",
description: "Generated by Next.js",
};

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
File renamed without changes.
12 changes: 6 additions & 6 deletions examples/with-absolute-imports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
},
"dependencies": {
"next": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/node": "^18.11.9",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.8",
"typescript": "^4.8.4"
"@types/node": "^22.1.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"typescript": "^5.5.4"
}
}
9 changes: 7 additions & 2 deletions examples/with-absolute-imports/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@
// Using "paths" allows you to configure module path aliases
"paths": {
"@/components/*": ["components/*"]
}
},
"plugins": [
{
"name": "next"
}
]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "15.0.0-canary.107"
"version": "15.0.0-canary.109"
}
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,19 +206,19 @@
"pretty-bytes": "5.3.0",
"pretty-ms": "7.0.0",
"random-seed": "0.3.0",
"react": "19.0.0-rc-06d0b89e-20240801",
"react": "19.0.0-rc-187dd6a7-20240806",
"react-17": "npm:react@17.0.2",
"react-builtin": "npm:react@19.0.0-rc-06d0b89e-20240801",
"react-dom": "19.0.0-rc-06d0b89e-20240801",
"react-builtin": "npm:react@19.0.0-rc-187dd6a7-20240806",
"react-dom": "19.0.0-rc-187dd6a7-20240806",
"react-dom-17": "npm:react-dom@17.0.2",
"react-dom-builtin": "npm:react-dom@19.0.0-rc-06d0b89e-20240801",
"react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-06d0b89e-20240801",
"react-experimental-builtin": "npm:react@0.0.0-experimental-06d0b89e-20240801",
"react-is-builtin": "npm:react-is@19.0.0-rc-06d0b89e-20240801",
"react-server-dom-turbopack": "19.0.0-rc-06d0b89e-20240801",
"react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-06d0b89e-20240801",
"react-server-dom-webpack": "19.0.0-rc-06d0b89e-20240801",
"react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-06d0b89e-20240801",
"react-dom-builtin": "npm:react-dom@19.0.0-rc-187dd6a7-20240806",
"react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-187dd6a7-20240806",
"react-experimental-builtin": "npm:react@0.0.0-experimental-187dd6a7-20240806",
"react-is-builtin": "npm:react-is@19.0.0-rc-187dd6a7-20240806",
"react-server-dom-turbopack": "19.0.0-rc-187dd6a7-20240806",
"react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-187dd6a7-20240806",
"react-server-dom-webpack": "19.0.0-rc-187dd6a7-20240806",
"react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-187dd6a7-20240806",
"react-ssr-prepass": "1.0.8",
"react-virtualized": "9.22.3",
"relay-compiler": "13.0.2",
Expand All @@ -228,8 +228,8 @@
"resolve-from": "5.0.0",
"sass": "1.54.0",
"satori": "0.10.9",
"scheduler-builtin": "npm:scheduler@0.25.0-rc-06d0b89e-20240801",
"scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-06d0b89e-20240801",
"scheduler-builtin": "npm:scheduler@0.25.0-rc-187dd6a7-20240806",
"scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-187dd6a7-20240806",
"seedrandom": "3.0.5",
"semver": "7.3.7",
"shell-quote": "1.7.3",
Expand Down Expand Up @@ -269,10 +269,10 @@
"@babel/traverse": "7.22.5",
"@types/react": "npm:types-react@19.0.0-rc.0",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
"react": "19.0.0-rc-06d0b89e-20240801",
"react-dom": "19.0.0-rc-06d0b89e-20240801",
"react-is": "19.0.0-rc-06d0b89e-20240801",
"scheduler": "0.25.0-rc-06d0b89e-20240801"
"react": "19.0.0-rc-187dd6a7-20240806",
"react-dom": "19.0.0-rc-187dd6a7-20240806",
"react-is": "19.0.0-rc-187dd6a7-20240806",
"scheduler": "0.25.0-rc-187dd6a7-20240806"
},
"patchedDependencies": {
"webpack-sources@3.2.3": "patches/webpack-sources@3.2.3.patch"
Expand Down
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "15.0.0-canary.107",
"version": "15.0.0-canary.109",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/create-next-app/templates/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ export const installTemplate = async ({
* Default dependencies.
*/
dependencies: {
react: "19.0.0-rc-06d0b89e-20240801",
"react-dom": "19.0.0-rc-06d0b89e-20240801",
react: "19.0.0-rc-187dd6a7-20240806",
"react-dom": "19.0.0-rc-187dd6a7-20240806",
next: version,
},
devDependencies: {},
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "15.0.0-canary.107",
"version": "15.0.0-canary.109",
"description": "ESLint configuration used by Next.js.",
"main": "index.js",
"license": "MIT",
Expand All @@ -10,7 +10,7 @@
},
"homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config",
"dependencies": {
"@next/eslint-plugin-next": "15.0.0-canary.107",
"@next/eslint-plugin-next": "15.0.0-canary.109",
"@rushstack/eslint-patch": "^1.3.3",
"@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0",
"@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "15.0.0-canary.107",
"version": "15.0.0-canary.109",
"description": "ESLint plugin for Next.js.",
"main": "dist/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@next/font",
"private": true,
"version": "15.0.0-canary.107",
"version": "15.0.0-canary.109",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "15.0.0-canary.107",
"version": "15.0.0-canary.109",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "15.0.0-canary.107",
"version": "15.0.0-canary.109",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "15.0.0-canary.107",
"version": "15.0.0-canary.109",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "15.0.0-canary.107",
"version": "15.0.0-canary.109",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "15.0.0-canary.107",
"version": "15.0.0-canary.109",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "15.0.0-canary.107",
"version": "15.0.0-canary.109",
"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",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "15.0.0-canary.107",
"version": "15.0.0-canary.109",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "15.0.0-canary.107",
"version": "15.0.0-canary.109",
"private": true,
"scripts": {
"clean": "node ../../scripts/rm.mjs native",
Expand Down
Loading

0 comments on commit 2d7949b

Please sign in to comment.