Commit graph

15227 commits

Author SHA1 Message Date
Vishal Jagtap
75c76ea772
Update error-handling.md (#47779)
Updated the react error boundary doc link. old one is depricated

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation or adding/fixing Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-04-01 14:15:02 -07:00
Sukka
b132efc5c4
fix(export): make static export work with worker_threads (#47784)
Fixes #46993.

The issue is introduced in #46705 by @ijjk 

Next.js uses `jest-worker` for multiprocessing. `jest-worker` supports both `child_process` and `worker_threads` modes. Next.js use `child_process` mode by default, but can also switch to using `worker_threads` mode with an experimental flag `config.experimental.workerThreads`.

In #46705, @ijjk applies a fix that works for the `child_process` mode, which breaks the `worker_threads` mode (`jest-worker`'s `NodeThreadWorker` interface doesn't have the private property `_child`), causing static HTML export to fail with the following error (#46993):

```
> Build error occurred
TypeError: Cannot read properties of undefined (reading 'on')
    at createWorker (/Users/[redacted]/node_modules/next/dist/lib/worker.js:32:31)
    at new Worker (/Users/[redacted]/node_modules/next/dist/lib/worker.js:42:9)
    at /Users/[redacted]/node_modules/next/dist/build/index.js:629:35
    at async Span.traceAsyncFn (/Users/[redacted]/node_modules/next/dist/trace/trace.js:79:20)
    at async Object.build [as default] (/Users/[redacted]/node_modules/next/dist/build/index.js:74:29)
```

The PR fixes that.
2023-04-01 17:43:59 +00:00
Justin Ridgewell
2abc824869
Turbopack: Use SharedError for body streaming (#47677)
Pending https://github.com/vercel/turbo/pull/4392 landing in Turbopack (and https://github.com/vercel/next.js/pull/47476 landing here), this removes `BodyError` and switches to `SharedError`. That should allow us to preserve the source chain of errors for when we finally display it to the dev, aiding debugging.
2023-04-01 11:37:17 +00:00
Tobias Koppers
f978e70053
provide full polyfill for process (#47764)
### What?

see also https://github.com/vercel/turbo/pull/4415

We need a full process polyfill to fix some edge cases

Also disables SourceMap for edge chunks, since they are not used

### Why?

Some packages do weird things, e. g.

```
var isBrowser = process.title === 'browser'
```
2023-04-01 12:06:36 +02:00
JJ Kasper
083dd2a59f
Tweak canary undrafting (#47777)
Fixes:
https://github.com/vercel/next.js/actions/runs/4581084068/jobs/8090349455#step:10:661
2023-03-31 21:06:51 -07:00
JJ Kasper
7c189c5c08 v13.2.5-canary.25 2023-04-01 03:32:33 +00:00
JJ Kasper
fb98b7382f
Update metadata e2e test on deploy (#47776)
x-ref:
https://github.com/vercel/next.js/actions/runs/4579107074/jobs/8087256711
2023-03-31 20:17:32 -07:00
Maia Teegarden
7d27895c57
Fix typo in error overlay (#47762)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation or adding/fixing Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
2023-03-31 19:08:01 -07:00
JJ Kasper
6e5eb2c4d2
Update publish canary to undraft automatically (#47775)
x-ref: [slack
thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1680313038895799?thread_ts=1680303743.811339&cid=C04DUD7EB1B)
2023-03-31 19:00:12 -07:00
OJ Kwon
d66236f2d8
test(turbopack): blocking CI for turbopack integration test (#47709)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation or adding/fixing Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

- closes WEB-766.

This PR enables a new job for running tests, against turbopack. Since we
have observed some flakiness across turbopack test execution, it starts
from absolute minimum set of tests to not block any CI due to unexpected
failure.

Ran manual workflow roughly ~50 times and looks like these set of tests
are fine to make it as blocking check for the PR. In the future, depends
on the stability we'll increase number of test gradually.
2023-03-31 18:50:35 -07:00
Shu Ding
0e5fb49600
Add test to ensure image generation works in the Node.js runtime (#47719)
Check the test case for more details.
2023-03-31 18:36:10 -07:00
JJ Kasper
7f0638869c
Fix skipMiddlewareUrlNormalize with i18n (#47773)
This ensures we don't normalize locales in the URL with the
skipMiddlewareUrlNormalize flag enabled so that casing redirects can be
applied correctly for locales.
2023-03-31 18:24:20 -07:00
Justin Ridgewell
82787dba9d
turbopack: ensure ENV values are available in middleware (#47767)
Turbopack starts up the router process with all ENV values, but the edge
function definition didn't list any `env` keys for the function
invocation. So, middleware couldn't access any ENV values.

Turbopack doesn't currently have a way to determine what ENV keys are
actually used by the source program, so I'm just passing everything
defined. I'm not sure if that's an issue during dev (I could see it
being one for the build process, but that doesn't matter for this case).

Fixes #47766
Fixes WEB-831
Fixes WEB-834
2023-03-31 17:22:27 -07:00
Tobias Koppers
2820f07875
add consistent import sorting/grouping to rustfmt (#47745)
### What?

Better auto format

### Why?

imports are inconsistently grouped and ordered

### How?

configure cargo fmt
2023-03-31 22:12:54 +00:00
JJ Kasper
f798c95f72 v13.2.5-canary.24 2023-03-31 20:58:12 +00:00
Steven
3f35608fdc
fix: improve error message pages for output: export (#47765)
fix NEXT-928 ([link](https://linear.app/vercel/issue/NEXT-928))
2023-03-31 13:23:51 -07:00
Javi Velasco
2adc1f6c54
Document node.js APIs for Edge Runtime (#47760) 2023-03-31 19:54:22 +00:00
JJ Kasper
53e4627ce5
Update app router filter handling (#47761)
This ensures we check if a path is `appRouter` during prefetching so
that we can trigger hard navigations quicker when routing from pages ->
app. An additional config is also exposed to allow configuring the
potential false positive rate for the client filter.

x-ref: [slack
thread](https://vercel.slack.com/archives/C017QMYC5FB/p1680225393243459)
2023-03-31 12:19:47 -07:00
Justin Ridgewell
0413fea8ea
Turobpack: Implement Streaming App/API rendering (#47476)
Paired with https://github.com/vercel/turbo/pull/4329, this implements
streaming responses for App and API renders. This is accomplished by
sending an initial `headers` message (carrying the status code and
headers list), N `body-chunk` messages of bytes, and a final `body-end`
message to signal completion.

Once sent to Turbopack, these chunk messages will be streamed out of the
node rendering process directly into the HTTP server's response.

Closes WEB-27

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-03-31 20:58:04 +02:00
Steven
4c60b7b6ae
feat: bump minimum ts version to 4.5.2 (#47712)
Fixes an issue with newer app directory usage:

```
Failed to compile.
../../node_modules/next/dist/server/future/route-handlers/app-route-route-handler.d.ts:11:15
Type error: ',' expected.
```

---------
2023-03-31 11:37:09 -07:00
Hofer Ivan
9ab6ca5d5f
chore(docs): add typesafe-i18n as a new i18n option (#47315)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation or adding/fixing Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
2023-03-31 11:28:28 -07:00
Shu Ding
5ad1b77704
Restart static paths worker after finishing task (#47716)
Noticed this optimization when debugging something else - we restart
this worker if it's not fresh, to make sure module instances are new
created. This has some perf overhead and it happens right before running
the task and it's blocking the request. This PR changes that to be after
the old task, and the difference is noticeable on dev (~20ms).

Before:

<img width="1363" alt="CleanShot-2023-03-30-jTT9W48H@2x"
src="https://user-images.githubusercontent.com/3676859/228965542-e0d6892f-3989-4da5-96a4-5fc8b4155041.png">

After:

<img width="1363" alt="CleanShot-2023-03-30-PRrYQMg7@2x"
src="https://user-images.githubusercontent.com/3676859/228965566-42e04f8d-0cc3-447c-adc8-3840b23b9fa5.png">
2023-03-31 19:16:48 +02:00
Jay
247ea65edb
Linking to SST Next.js tutorial. (#47752)
Updating the SST link to a Next.js tutorial: https://docs.sst.dev/start/nextjs
2023-03-31 17:13:31 +00:00
Leah
5cb370f517
remove next-core package.json dev script (#47746)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-03-31 17:58:17 +02:00
Jiachi Liu
04bfb314e0
Support relative path for metadata alternates urls (#47743)
Allow to use relative paths which starting with dot (e.g. `./[paths]`) for urls under `metadata.alternates`.
This allow user to simplify setting `canonical` or other such like `languages` once in root layout with `metadataBase` and a simple relative path, then next.js will resolve it with current pathname of the page.

For example
```js
export const metadata = {
  metadataBase: new URL('https://mydomain.com'),
  alternates: {
    canonical: './'
  }
}
```
Then:
for page `/` it will generate `https://mydomain.com`;
for page `/about` it will generate `https://mydomain.com/about`

as your cononical url

Closes NEXT-897

### Minor changes

- always remove trailing slash for `URL.href`
2023-03-31 15:44:39 +00:00
Wyatt Johnson
e1a397d750
fix: correctly handle Set-Cookie headers (#47718)
## What

This fix serves to address issues where multiple `Set-Cookie` headers
were combined in some runtimes.

## Why

This is because `set-cookie` behaves differently than other headers in
some cases.

Eg. when iterating on a `Headers` instance, multiple set-cookie headers
are folded. To set them correctly, we need to split them. But it'd not
be enough to naively split on the first occurrence, because `,` is a
valid cookie value when for example it's used in `Expires` in a date
string.

So we use a method to correctly detect where to split the cookie.

This should fix all runtimes.

Note, the spec now has `Headers#getSetCookie` which should be preferred
if it's present. https://github.com/whatwg/fetch/pull/1346. We are using
the [`edge-runtime`](https://github.com/vercel/edge-runtime), so this
should be fixed upstream and then reused in Next.js in the future.

## How

Wherever we can, we reuse the `fromNodeHeaders` and `toNodeHeaders`
methods that have the correct implementation. This should be preferred
in the future in other parts of the codebase. We fixed some related TS
issues as well.

Fixes #46579, supersedes #40579
fix NEXT-735 ([link](https://linear.app/vercel/issue/NEXT-735))

---------

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2023-03-31 16:35:47 +02:00
JJ Kasper
f090f321ee v13.2.5-canary.23 2023-03-31 13:53:10 +00:00
Alex Kirszenberg
5950e2b3b0
Small fixes to copy of Turbopack errors (#47734)
This also removes next-swc's Prettier configuration, which we weren't
following anyway.
2023-03-31 11:12:12 +00:00
Jiachi Liu
6563174176
Add NEXT_RUNTIME process env to turbopack (#47713)
Support `process.env.NEXT_RUNTIME` in turbopack, define it in node server / edge, leave client as undefined
2023-03-31 09:48:15 +00:00
OJ Kwon
a34f02b3d2
feat(next-swc): add compile-time heap profiler flag (#47729)
### What?

This PR adds an internal compile time flags for the `next-swc`, which exposes two runtime apis into next.js to initialize heap-profiling enabled memory allocator and teardown those once next.js exits. While there are newly added 2 js interfaces (`initHeapProfiler`, `teardownHeapProfiler`) underlying napi binary itself have compile time flags to actually  enable those feature: any user who runs npm-published next.js cannot enable this features with any kind of runtime configuration. Only manually built next-swc binary with specific flag can enable this. Since this is primarily for the CI testing workflow only, those flag / configs are not visibily exposed as well.


### Why?

It is for some experiments on the CI to see if it can observe some of memory pressure issues (WEB-593, WEB-804) while it is not easily reproducible on the local machines.
2023-03-31 08:37:17 +00:00
Shu Ding
a52ebf4089
Add tests for Suspensey CSS (#47708)
This PR adds a test to confirm that the component will be committed
after the stylesheet is loaded, by delaying the CSS request in
middleware and then check the active style in `useEffect` (technically
it should be `useLayoutEffect`). Since our current timeout for that is
set to 500ms, I also added a test with 1000ms delay to rule out false
negative cases.
2023-03-31 10:06:17 +02:00
Rishabh Poddar
c9c8f6cde0
Updates with-supertokens example app (#47701)
Co-authored-by: NkxxkN <kevin@supertokens.io>
Co-authored-by: NkxxkN <kevin.antoine@protonmail.com>
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Rishabh <rishabh@supertokens.io>
Co-authored-by: Bhumil Sarvaiya <sarvaiyabhumil@gmail.com>
Co-authored-by: jscyo <joelsteve97@hotmail.com>
Co-authored-by: Mihaly Lengyel <mihaly.lengyel@tresorit.com>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
Co-authored-by: Mihaly Lengyel <mihaly@lengyel.tech>
Co-authored-by: Alisher <alisher@supertokens.com>
Co-authored-by: Nemi Shah <nemishah1212@gmail.com>
2023-03-31 05:38:58 +00:00
Wyatt Johnson
2642d0a83e
Combine Route Handlers with Route Modules (#47679)
Based on some suggestions from @sokra, this serves to unify the Route Handlers and Route Modules to provide a unified interface for defining route modules and handlers and defining their dependancies.
2023-03-31 04:52:48 +00:00
Steven
d83f68ccf7
chore(ci): fix codemod tests (#47710)
These tests were failing with the following error:

```
Failed to fetch origin/canary Error: Command failed: git fetch origin canary
fatal: could not read Username for 'https://github.com/': No such device or address
```

https://github.com/vercel/next.js/actions/runs/4220015224/jobs/7325960064#step:5:13

- Follow up to https://github.com/vercel/next.js/pull/46068
2023-03-31 04:27:16 +00:00
Justin Ridgewell
43872c7572
Turbopack: Fix images.remotePatterns port/protocol serialization (#47721)
By default, `serde-json` will transform a `None` into a `null` value, and Next's [default image loader][loader] will perform strict `=== undefined` [equality checks][checks] on the fields. Because `null !== undefined`, a missing `protocol` or `port` will always be checked, and `null` will never match either.

Fixes #46758
Fixes vercel/turbo#4347
Fixes WEB-770
fix NEXT-793 ([link](https://linear.app/vercel/issue/NEXT-793))

[loader]: 35cf930572/packages/next/src/shared/lib/image-loader.ts (L50)
[checks]: 35cf930572/packages/next/src/shared/lib/match-remote-pattern.ts (L5)
2023-03-31 03:26:38 +00:00
Insik-Han
47152638d4
Replace AWS Serverless to SST in Serverless (#47725)
AWS Serverless(a.k.a Serverless Next.js) is not suitable for versions of
Next.js 12 or higher. As an alternative, I recommend SST.

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation or adding/fixing Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
2023-03-30 21:45:05 -05:00
Jiachi Liu
d71cbe9116
Vendor @vercel/og and expose ImageResponse (#47715)
- Reverts #47711 
- Disable image response for turbopack
2023-03-31 02:29:10 +00:00
Steven
af49d5098b
chore(docs): update next export to output: 'export' (#47717)
fix NEXT-927 ([link](https://linear.app/vercel/issue/NEXT-927))
2023-03-31 02:04:23 +00:00
JJ Kasper
a6e504933b v13.2.5-canary.22 2023-03-31 00:57:10 +00:00
Jiachi Liu
2d796ed594
Fix duplicated default metadata tags (#47690)
Adding default metadata before causes duplicated metadata tags when
adding server inserted html. Remove the ones in the not found boundary
Now we use same way to render metadata to render the default metadata in
error html

Fixes the issue introduced in #47404

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-03-30 17:17:52 -07:00
Leah
614a14bc6c
Update CODEOWNERS to override image wildcard (#47722) 2023-03-31 00:07:22 +00:00
Jiachi Liu
6dbb6318a1
Provide default metadataBase for local and vercel deployment (#47568)
### What?

- Provide a default `metadataBase` 
- Always resolve urls that could be resolved as absolute with
`metadataBase`, e.g. tw/og urls, canonical urls
- Give a warning in dev mode if user doesn't provide one in dev
- Error if you don't have it but it's required in production

On production it will leverage `VERCEL_URL` if users expose it to the
deployment

### Why?

OG image urls are required to be absolute urls instead of relative urls.
For metadata image conventions we let users don't have to provide
`metadataBase` explicitly when they expect it should be the origin of
their next app.

### How?

Closes NEXT-887

---------
2023-03-30 16:27:24 -07:00
Jiachi Liu
35cf930572
Update MetadataRoute to namespace (#47674)
### What?

Followup for #47630 , use ts namespace to group MetadataRoute.

`MetadataRoute['xxx']` -> `MetadataRoute.xxx`

### Why?

namespace is convenient to write for these grouped types such as
`MetadataRoute.Robots`. And `MetadataRoute` itself is not actually a
type. So it can be conveniently typed by ts users.

### How?

Closes NEXT-912

---------
2023-03-30 15:27:44 -07:00
Leah
97b158cc81
Fix turbopack _devPagesManifest.json on next-site (#47427)
just took a bit of banging my head against the wall 👀

the `'dynamic route/page check'` route resolves `fsRoutes` (which leads to an object with `{pages: undefined}` because the route doesn't have the list of pages(?))

that route only gets enabled if you have fallback rewrites though
2023-03-30 21:44:02 +00:00
Jiachi Liu
dbc4320035
test: remove unreliable font test (#47714)
x-ref:
https://github.com/vercel/next.js/pull/47674#issuecomment-1490914270

as discussed with @ijjk , we decided to remove the test as it's not
reailable due to random updates from google endpoint
2023-03-30 14:16:05 -07:00
Jiachi Liu
0616f1b432
Add not found boundary and move head cache to app router (#47688)
### What?

- Add not found boundary to app router
- Move `head` cache back to app router

### Why?

We want the head to be rendered separately from body, previously to be
able to use `redirect()` and `notFound()` in `generateMetadata` we move
the head cache into layout-router to be wrapped by not found and
redirect boundaries. Since redirect boudary is already moved to
app-router, so we only need to add not found boundary and move head
cache to app router.

Notice: there's a limitation that we can't find the corresponding not
found of page if you throw notFound in generateMetadata, the root layout
+ root/default not found will be used to generate the 404 page

### How?

Closes NEXT-864
Fixes #46738

fix NEXT-888 ([link](https://linear.app/vercel/issue/NEXT-888))

---------
2023-03-30 14:08:37 -07:00
Steven
b9d77321d2
fix: handle empty src prop on next/image (#47695)
Previously, `next start` was incorrectly trying to optimize an empty `src` prop.

This PR fixes the behavior so that empty `src` will automatically set `unoptimized` (same behavior as data urls).

fix NEXT-915 ([link](https://linear.app/vercel/issue/NEXT-915))
2023-03-30 20:02:47 +00:00
JJ Kasper
2ac022391c
Revert "Vendor @vercel/og and expose ImageResponse (#47657" (#47711)
Reverts vercel/next.js#47657
2023-03-30 12:24:02 -07:00
Shu Ding
6eaca5d5b2
Revert "Revert "Update vendored react to 18.3.0-next-85de6fde5-20230328"" (#47700
Reverts vercel/next.js#47687
2023-03-30 19:40:13 +02:00
Tobias Koppers
ebe0686a9d
Run turbopack integration tests for next.js changes too (#47608)
### What?

Turbopack tests need to run on any change

### Why?

Next.js changes might break turbopack and we want to avoid that.

### How?

Change CI job

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-03-30 18:21:19 +02:00