Skip to content

Commit

Permalink
Merge branch 'canary' into doc/isr
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored Sep 24, 2024
2 parents 490a355 + 74d2136 commit 1ceda7a
Show file tree
Hide file tree
Showing 158 changed files with 5,826 additions and 3,165 deletions.
6 changes: 3 additions & 3 deletions crates/napi/src/next_api/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ pub struct ProjectInstance {
exit_receiver: tokio::sync::Mutex<Option<ExitReceiver>>,
}

#[napi(ts_return_type = "{ __napiType: \"Project\" }")]
#[napi(ts_return_type = "Promise<{ __napiType: \"Project\" }>")]
pub async fn project_new(
options: NapiProjectOptions,
turbo_engine_options: NapiTurboEngineOptions,
Expand Down Expand Up @@ -421,7 +421,7 @@ async fn benchmark_file_io(directory: Vc<FileSystemPath>) -> Result<Vc<Completio
Ok(Completion::new())
}

#[napi(ts_return_type = "{ __napiType: \"Project\" }")]
#[napi]
pub async fn project_update(
#[napi(ts_arg_type = "{ __napiType: \"Project\" }")] project: External<ProjectInstance>,
options: NapiPartialProjectOptions,
Expand All @@ -439,7 +439,7 @@ pub async fn project_update(
Ok(())
}

#[napi(ts_return_type = "{ __napiType: \"Project\" }")]
#[napi]
pub async fn project_shutdown(
#[napi(ts_arg_type = "{ __napiType: \"Project\" }")] project: External<ProjectInstance>,
) {
Expand Down
5 changes: 0 additions & 5 deletions crates/napi/src/turbopack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,3 @@ impl From<NapiRouteHas> for RouteHas {
}
}
}

#[napi]
pub async fn experimental_turbo(_unused: Buffer) -> napi::Result<()> {
unimplemented!("__experimental_turbo is not yet implemented");
}
430 changes: 235 additions & 195 deletions crates/next-api/src/app.rs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions crates/next-api/src/instrumentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ impl InstrumentationEndpoint {
this.project.next_mode(),
)
.resolve_entries(this.asset_context),
OutputAssets::empty(),
Value::new(AvailabilityInfo::Root),
)
.await?;
Expand Down
1 change: 1 addition & 0 deletions crates/next-api/src/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ impl PageEndpoint {
ssr_entry_chunk_path,
ssr_module,
runtime_entries,
OutputAssets::empty(),
Value::new(AvailabilityInfo::Root),
)
.await?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function Layout({ children, team, analytics }) {
}
```

However, slots are **not** [route segments](/docs/app/building-your-application/routing#route-segments) and do not affect the URL structure. For example, for `/@analytics/views`, the URL will be `/views` since `@analytics` is a slot.
However, slots are **not** [route segments](/docs/app/building-your-application/routing#route-segments) and do not affect the URL structure. For example, for `/@analytics/views`, the URL will be `/views` since `@analytics` is a slot. Slots are combined with the regular [Page](/docs/app/api-reference/file-conventions/page) component to form the final page associated with the route segment. Because of this, you cannot have separate [static](/docs/app/building-your-application/rendering/server-components#static-rendering-default) and [dynamic](docs/app/building-your-application/rendering/server-components#dynamic-rendering) slots at the same route segment level. If one slot is dynamic, all slots at that level must be dynamic.

> **Good to know**:
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ let data = await fetch('https://api.vercel.app/blog', { cache: 'no-store' })

### Fetching data on the server with an ORM or database

This component will fetch and display a list of blog posts. The response from the database will be cached.
This component will fetch and display a list of blog posts. The response from the database is not cached by default but could be with [additional configuration](#caching-data-with-an-orm-or-database).

```tsx filename="app/page.tsx" switcher
import { db, posts } from '@/lib/db'
Expand Down Expand Up @@ -131,7 +131,7 @@ export default async function Page() {

If you are not using any [dynamic functions](/docs/app/building-your-application/rendering/server-components#dynamic-rendering) anywhere else in this route, it will be prerendered during `next build` to a static page. The data can then be updated using [Incremental Static Regeneration](/docs/app/building-your-application/data-fetching/incremental-static-regeneration).

If you do _not_ want to cache the response from the database, you can add the following to your file:
To prevent the page from prerendering, you can add the following to your file:

```js
export const dynamic = 'force-dynamic'
Expand Down
28 changes: 24 additions & 4 deletions docs/02-app/02-api-reference/01-components/image.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -503,15 +503,16 @@ module.exports = {
hostname: 'example.com',
port: '',
pathname: '/account123/**',
search: '',
},
],
},
}
```

> **Good to know**: The example above will ensure the `src` property of `next/image` must start with `https://example.com/account123/`. Any other protocol, hostname, port, or unmatched path will respond with 400 Bad Request.
> **Good to know**: The example above will ensure the `src` property of `next/image` must start with `https://example.com/account123/` and must not have a query string. Any other protocol, hostname, port, or unmatched path will respond with 400 Bad Request.
Below is another example of the `remotePatterns` property in the `next.config.js` file:
Below is an example of the `remotePatterns` property in the `next.config.js` file using a wildcard pattern in the `hostname`:

```js filename="next.config.js"
module.exports = {
Expand All @@ -521,13 +522,14 @@ module.exports = {
protocol: 'https',
hostname: '**.example.com',
port: '',
search: '',
},
],
},
}
```

> **Good to know**: The example above will ensure the `src` property of `next/image` must start with `https://img1.example.com` or `https://me.avatar.example.com` or any number of subdomains. Any other protocol, port, or unmatched hostname will respond with 400 Bad Request.
> **Good to know**: The example above will ensure the `src` property of `next/image` must start with `https://img1.example.com` or `https://me.avatar.example.com` or any number of subdomains. It cannot have a port or query string. Any other protocol or unmatched hostname will respond with 400 Bad Request.
Wildcard patterns can be used for both `pathname` and `hostname` and have the following syntax:

Expand All @@ -536,7 +538,25 @@ Wildcard patterns can be used for both `pathname` and `hostname` and have the fo

The `**` syntax does not work in the middle of the pattern.

> **Good to know**: When omitting `protocol`, `port` or `pathname`, then the wildcard `**` is implied. This is not recommended because it may allow malicious actors to optimize urls you did not intend.
> **Good to know**: When omitting `protocol`, `port`, `pathname`, or `search` then the wildcard `**` is implied. This is not recommended because it may allow malicious actors to optimize urls you did not intend.
Below is an example of the `remotePatterns` property in the `next.config.js` file using `search`:

```js filename="next.config.js"
module.exports = {
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'assets.example.com',
search: '?v=1727111025337',
},
],
},
}
```

> **Good to know**: The example above will ensure the `src` property of `next/image` must start with `https://assets.example.com` and must have the exact query string `?v=1727111025337`. Any other protocol or query string will respond with 400 Bad Request.
### `domains`

Expand Down
2 changes: 2 additions & 0 deletions docs/02-app/02-api-reference/05-next-config-js/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const nextConfig = {
export default nextConfig
```

> **Good to know**: `next.config` with the `.cjs`, `.cts`, or `.mts` extensions are currently **not** supported.
## Configuration as a Function

You can also use a function:
Expand Down
28 changes: 24 additions & 4 deletions docs/03-pages/02-api-reference/01-components/image-legacy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,16 @@ module.exports = {
hostname: 'example.com',
port: '',
pathname: '/account123/**',
search: '',
},
],
},
}
```

> **Good to know**: The example above will ensure the `src` property of `next/legacy/image` must start with `https://example.com/account123/`. Any other protocol, hostname, port, or unmatched path will respond with 400 Bad Request.
> **Good to know**: The example above will ensure the `src` property of `next/legacy/image` must start with `https://example.com/account123/` and must not have a query string. Any other protocol, hostname, port, or unmatched path will respond with 400 Bad Request.
Below is another example of the `remotePatterns` property in the `next.config.js` file:
Below is an example of the `remotePatterns` property in the `next.config.js` file using a wildcard pattern in the `hostname`:

```js filename="next.config.js"
module.exports = {
Expand All @@ -380,13 +381,14 @@ module.exports = {
protocol: 'https',
hostname: '**.example.com',
port: '',
search: '',
},
],
},
}
```

> **Good to know**: The example above will ensure the `src` property of `next/legacy/image` must start with `https://img1.example.com` or `https://me.avatar.example.com` or any number of subdomains. Any other protocol, port, or unmatched hostname will respond with 400 Bad Request.
> **Good to know**: The example above will ensure the `src` property of `next/legacy/image` must start with `https://img1.example.com` or `https://me.avatar.example.com` or any number of subdomains. It cannot have a port or query string. Any other protocol or unmatched hostname will respond with 400 Bad Request.
Wildcard patterns can be used for both `pathname` and `hostname` and have the following syntax:

Expand All @@ -395,7 +397,25 @@ Wildcard patterns can be used for both `pathname` and `hostname` and have the fo

The `**` syntax does not work in the middle of the pattern.

> **Good to know**: When omitting `protocol`, `port` or `pathname`, then the wildcard `**` is implied. This is not recommended because it may allow malicious actors to optimize urls you did not intend.
> **Good to know**: When omitting `protocol`, `port`, `pathname`, or `search` then the wildcard `**` is implied. This is not recommended because it may allow malicious actors to optimize urls you did not intend.
Below is an example of the `remotePatterns` property in the `next.config.js` file using `search`:

```js filename="next.config.js"
module.exports = {
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'assets.example.com',
search: '?v=1727111025337',
},
],
},
}
```

> **Good to know**: The example above will ensure the `src` property of `next/legacy/image` must start with `https://assets.example.com` and must have the exact query string `?v=1727111025337`. Any other protocol or query string will respond with 400 Bad Request.
### Domains

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-e4953922-20240919",
"react-dom": "19.0.0-rc-e4953922-20240919"
"react": "19.0.0-rc-5d19e1c8-20240923",
"react-dom": "19.0.0-rc-5d19e1c8-20240923"
},
"devDependencies": {
"@types/node": "20.12.12",
Expand Down
36 changes: 0 additions & 36 deletions examples/with-vercel-fetch/.gitignore

This file was deleted.

25 changes: 0 additions & 25 deletions examples/with-vercel-fetch/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions examples/with-vercel-fetch/github.d.ts

This file was deleted.

5 changes: 0 additions & 5 deletions examples/with-vercel-fetch/next-env.d.ts

This file was deleted.

20 changes: 0 additions & 20 deletions examples/with-vercel-fetch/package.json

This file was deleted.

21 changes: 0 additions & 21 deletions examples/with-vercel-fetch/pages/index.tsx

This file was deleted.

20 changes: 0 additions & 20 deletions examples/with-vercel-fetch/tsconfig.json

This file was deleted.

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.165"
"version": "15.0.0-canary.166"
}
Loading

0 comments on commit 1ceda7a

Please sign in to comment.