Commit graph

8450 commits

Author SHA1 Message Date
Jiachi Liu
1c67740676
Drop object config export support for app dir (#48489)
We've supported `export const config = { ... }` to sepecify `runtime`
etc. configs for pages under `app/` for a while. This PR is going to
drop it and only support `export const [config name] = [config value]`
per config

Add a warning if the legacy usage is detectd

Closes NEXT-1016
2023-04-17 20:02:32 +00:00
Connor Prussin
a92c5465ca
Make jest config serializable (#47620)
### What?

This PR ensures the jest configuration is json-serializable. It also
adds a bunch of typescript types.

### Why?

Jest requires that the configuration be json-serializable. See #47407
for details on the issues caused when it isn't. However, prior to this
commit, we were passing the entire next config as a property in the swc
jest transformer options. The next config includes some fields that are
not serializable, such as some functions.

### How?

In this PR we instead pluck the fields out of the next config that we
actually need and pass only those into the swc transformer.

This PR also adds a bunch of more precise typescript types where we were
previously just using `any`. This helps confirm that the configs are
being threaded through correctly. I think this type safety is enough to
confirm this commit and adding tests would just be redundant.

Closes NEXT-901
Fixes #47407
fix NEXT-901 ([link](https://linear.app/vercel/issue/NEXT-901))

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-04-17 18:52:52 +00:00
JJ Kasper
e329b31d90 v13.3.1-canary.10 2023-04-17 17:04:11 +00:00
Nabeel Sulieman
bf89425714
Rename originUrl to fetchUrl (#48315)
### What?

Rename originUrl to fetchUrl for clarity.
Also remove remove it from origin fetch annotation because the data is
redundant.

### Why?

- The word fetch better matches the other two parameters fetchType and
fetchIdx
- Because the fetch/origin URL is the actual URL being performed on the
origin fetch, it will always be duplicate data
2023-04-17 15:49:35 +00:00
Tobias Koppers
6be8c59075
app dir fixes (#48025)
### What?

* fix app dir chunking
* fix app dir 404s
* improve app dir performance
* rerender shadowportal on errors to re-add nextjs-portal to avoid empty
page
* inject polyfills before user code
* fix manifest generation

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

### Why?

App dir was very slow and lead to 404 errors

### How?

add included metadata to chunks to allow deduplicate chunk loads at
runtime
2023-04-17 17:58:33 +02:00
Yamagishi Kazutoshi
da8a82d6bf
Change CacheFs methods to return Buffer (#48237)
### What?

In environments where `FileSystemCache` is used, the cache for static
resources such as image files will be broken.

### Why?

Because `fs.readFile(path, 'utf8')` tries to read a file as a `string`.

### How?

Change to use `fs.readFile(path)` to always read files as binary
(`Buffer`).
2023-04-17 15:22:29 +00:00
JJ Kasper
bc5be2f76c v13.3.1-canary.9 2023-04-17 13:46:08 +00:00
Shu Ding
f6604d4afe
Revert "Re-land "Vendor react@experimental under an experimentalReact flag"" (#48478)
Reverts vercel/next.js#48041
fix NEXT-926
2023-04-17 15:00:02 +02:00
Shu Ding
2a61253f72
Fix misordered CSS resources (#48244)
### What?

This PR fixes misordered CSS `<link>` tags. CSS imports in inner layers
(e.g. a page) should always take precedence over outer layers (e.g. root
layout), but currently it's reversed.

### Why?

In layouts we usually define more general styles like globals, resets,
and layout specific things. And in inner layers and pages, things need
to be more detailed and override upper layers if there're any conflicts.

Previously we defined the component segment as

```tsx
<>
  <Component {...props} />
  {assets}
</>
```

which is necessary because of `findDOMNode` - if we put `assets` before
the component, we can't find the correct scrolling DOM and position for
that layer.

However, with `assets` being the last Float will receive the reversed
order of resources.

### How?

I changed the `createComponentTree` function to return a `Component` and
`assets` pair, so in the Layout Router they're no longer passed to the
scroll wrapper altogether but separately.

Closes NEXT-983
Fixes #47585, fixes #46347.

fix NEXT-656

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-04-17 14:11:47 +02:00
Tim Neutkens
3ac7658515
Refactor entries.ts (#48460)
Couple of small changes, I'm preparing the file for a larger refactor
around the new entries resolving.

<!-- 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-04-17 10:15:33 +02:00
Jimmy Lai
9f67638999
parallel routes: fix incorrect optimistic tree when there are multiple parallel routes (#48449)
This PR fixes parallel routes navigation with `prefetch={false}`. This
was broken because the optimistic tree created when navigating with
prefetching disabled resulted in a state where the router tree was
expecting an incorrect node to be rendered and suspended until the
imaginary data arrived.

The fix consists of updating the method that creates the optimistic tree
in order to bailout of the optimistic tree creation when there are
multiple parallel routes for the current node.

<!-- 

## 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 #

-->

fix #48122
link NEXT-1020

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-04-17 10:12:46 +02:00
Jimmy Lai
ea8c4274b8
interception routes: fix production rewrites (#48451)
This PR fixes a bug with interception where the rewritten path passed an
incorrect segment data on production, resulting in a 404.

The fix consists of moving the rewrite pre-processing step that rewrites
the dynamic segment from the originating path to when we actually
generate the rewrite. This is needed because that step does not run on
production. Now it does and signals correctly to the app-render that the
value for the segment can be determined from the path.

Also enables prod testing, which I had forgotten to enable.

<!-- 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 #

-->

fix #48406
link NEXT-1017
2023-04-17 10:08:25 +02:00
Jimmy Lai
612c8cb2bf
interception routes: support middleware rewrites (#48450)
This PR fixes an edge case when using interception routes and rewrites.
The issue was that the default state of the router tree incorrectly
assumed that the base pathname would be the referrer URL for the
interception but it turns out the tree/what we want to intercept can be
different in the case of a rewrite.

The fix consists of using the same method that we use to extract the
pathname from the current tree so that we can get the correct referrer
pathname.

## 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 #

-->

fix #48396
link NEXT-1018
2023-04-17 10:07:31 +02:00
Jimmy Lai
0741016023
parallel routes: fix next-provided default.js not being resolved if the config doesn't specify .js (#48446)
This PR fixes an edge case when the next config has `pageExtensions`
specified. When resolving the default parallel route, we use that
config. If it does not specify `.js` then it wouldn't be able to resolve
the default from Next.js

## 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 #

-->

fix #48431
link NEXT-1021
2023-04-17 10:06:50 +02:00
Jimmy Lai
2eb821ad19
parallel routes: fix catch-all routes taking precedence in dev (#48424)
This PR fixes a bug in dev with parallel routes when the given
conditions were met:
- you have a catch-all route and a more specific route
- you navigated to a catch-all route
- you navigate to the specific route that should take priority over the
catch-all

in this case, the route renderer would try to match with an incorrect
slot path and fallback to the catch all path

the fix makes the route renderer use the correct path, aka the last path
of the appPaths arrays for a given route

## 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 #

-->

link NEXT-1019
2023-04-17 10:06:30 +02:00
Tim Neutkens
33a803aaa1
Consolidate two appDir if branches (#48459)
Noticed that we had this if block but it's no longer needed as the
variable is only used in one place instead of multiple.


<!-- 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-04-17 07:03:06 +00:00
JJ Kasper
fa821702e5
Fix turbo cache for @next/env (#48466)
While testing workflow changes noticed that when turborepo cache is
leveraged the `@next/env` types are missing causing unexpected failures
since the types aren't stored in the `dist` folder which is all that is
cached for the build step.

x-ref: https://github.com/vercel/next.js/commits/ijjk/update-ci-workflow
2023-04-16 20:31:15 -07:00
Toru Kobayashi
36ea6ea160
chore: fix a typo in a local variable name (#48456)
TTSIA
I found it while reading the implementation.

<!-- 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-04-16 16:55:51 +00:00
JJ Kasper
20c5a23a90 v13.3.1-canary.8 2023-04-15 15:24:28 +00:00
Julius Marminge
97c21f2330
chore: add export ImageResponseOptions (#48418)
Exports `ImageResponseOptions` from `next/server`.

## Rationale

Today I do this:

```ts
import { ImageResponseOptions } from "next/dist/compiled/@vercel/og/types";
import { ImageResponse } from "next/server";

export const config = { runtime: "edge" };

export const GET = async (req: Request) => {
  const inter = await getFont({
    family: "Inter",
    weights: [400, 700],
  });

  const options: ImageResponseOptions = {
    width: 1200,
    height: 600,
    fonts: [
      { name: "Inter", data: inter[400], weight: 400 },
      { name: "Inter", data: inter[700], weight: 700 },
    ],
  };

  if (someCond) {
    return new ImageResponse(<>Some JSX</>, options);
  }
  
  // ...

  return new ImageResponse(<>Some other JSX</>, options);
};
```

And I never like importing stuff from an internal path such as
`dist/compiled/...`.
2023-04-15 12:46:32 +00:00
Lee Robinson
3a78711a06
Add pg (Postgres) to server components external packages. (#48402)
While exploring using
[Drizzle](https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-orm/src/pg-core/README.md#using-drizzle-orm-in-nextjs-app-router)
with the App Router, I noticed they have a callout for needing to
explicitly add `pg` to `serverComponentsExternalPackages`.

Adding `pg` here prevents manually needing to modify your configuration.
2023-04-14 22:06:16 +00:00
Maia Teegarden
4aacfe97e1
Allow some more options for Turbopack (#48401)
This adds some next.config.js options that shouldn't stop people from
using Turbopack

Closes https://linear.app/vercel/issue/WEB-892
2023-04-14 21:36:54 +00:00
Jiachi Liu
7aba242b75
feat: generate image metadata (#48362)
### What?

* Support `generateMetadata(props)` to dynamically generate multiple
metadata images at the same time

```js
// /app/opengraph-image.tsx
import { ImageResponse } from 'next/server';

export async function generateImageMetadata({params}) {
  const images = await ...;
  return images.map((img, idx) => ({
    size: { width: 1200, height: 600 },
    alt: img.text,
    contentType: 'image/png',
    id: idx,
  }));
}

export default async function ({params, id}) {
  const text = await getTextFor(id);
  return new ImageResponse(
    (
      <div
        style={{...}}>
        {text}
      </div>),
    { width: 1200, height: 600 },
  );
}
```

### How?

Use `<metadata image>/[[...__metadata_id__]]/route.js` to catch all
metadata images id, and then use this `params.__metadata_id__` as id
argument for dynamic generate image.

If there's param, then we create `<metadata image>/<id>`, if there's
only 1 static image without dynamic `generateImageMetadata` then we keep
use `<metadata image>`

Closes NEXT-896
2023-04-14 20:52:31 +00:00
Tobias Koppers
51defb249a
provide the PORT env var based on server port, update turbopack (#48347)
### What?

gives user code access to `process.env.PORT` as current server port
avoid injecting env vars into code on server

### Why?

it might need construct an addr to fetch from api routes

fixes WEB-868

### Turbopack changes

* https://github.com/vercel/turbo/pull/4565 <!-- Tobias Koppers - Bind
to IPv6 and IPv4 -->
* https://github.com/vercel/turbo/pull/4570 <!-- Tobias Koppers - review
follow ups -->
* https://github.com/vercel/turbo/pull/4585 <!-- Tobias Koppers - fixup
bind v6 PR: add missing listen call -->
* ~https://github.com/vercel/turbo/pull/4546~ <!-- Alex Kirszenberg -
Chunking Context Refactor pt. 3: Address PR comments from pt. 2 -->
* https://github.com/vercel/turbo/pull/4580 <!-- Tobias Koppers - remove
circular dependency -->
* https://github.com/vercel/turbo/pull/4582 <!-- Tobias Koppers - ignore
internal and server-relative url() in CSS -->
* https://github.com/vercel/turbo/pull/4579 <!-- Tobias Koppers - make
node bootstrap asset lazy -->
* https://github.com/vercel/turbo/pull/4581 <!-- Tobias Koppers - allow
to create stress test for client components -->
* https://github.com/vercel/turbo/pull/4584 <!-- Tobias Koppers -
improve node.js receive timeout -->
* https://github.com/vercel/turbo/pull/4583 <!-- Tobias Koppers - remove
panic since this might happen due to eventual consistency -->

fixes WEB-871
2023-04-14 23:04:14 +02:00
JJ Kasper
54fb4b6e0b v13.3.1-canary.7 2023-04-14 17:02:43 +00:00
JJ Kasper
43519cf586
Move normalizing of query for edge (#48373)
Follow-up to https://github.com/vercel/next.js/pull/48370 this just
moves the normalizing to the adapter instead of the web-server so it's
in a more specific place.
2023-04-13 23:01:04 -07:00
JJ Kasper
557084a331
Fix fetch cache body handling and update edge-runtime deps (#48365)
This ensures we don't fail to return the full body when storing to
fetch-cache in edge-runtime. Also ensures the fetch cache tests are
running for Node.js v16 correctly.

Fetch handling was also failing on Node.js v16 due to react's use of
`res.clone()` being broken with undici which is fixed in the latest
version of edge-runtime so this bumps that.

x-ref: [slack
thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1681310566927429)
2023-04-13 22:00:20 -07:00
Andrew Gadzik
d598fa1847
Ensure we handle 204 responses in fetch (#48354)
Ensure we handle the use-case where a React Server Component using
`fetch` encounters a `204` response.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-04-13 18:47:45 -07:00
JJ Kasper
9c5d0448ee
Update font handling in CNA templates (#48364)
We don't need to apply the font className to individual usage and can
just apply it to the the top element for easier usage.

x-ref: [slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1681343520829629)
2023-04-13 17:25:24 -07:00
Delba de Oliveira
ab213498d8
[create-next-app]: add mdx files to tailwind content config (#48188)
This PR updates create-next-app's tailwind config to consider .mdx files
when it generates styles.

If you're using MDX, most of a project's styles are generated by the
other file flags, which can make it tricky to debug/notice the rare
subset from .mdx only.

x-ref: https://vercel.slack.com/archives/C0290CZ3U6Q/p1680976472444189

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-04-13 16:39:36 -07:00
Tim Neutkens
37f709eeb7
Investigate redirect getting stuck (#48343)
### What?

Fixes a bug where `fetch()` to a page that calls `redirect()` would hang
infinitely.

### How?

The `Location` header was missing. The reason this wasn't surfaced
before is that we also inject the `<meta>` tag to redirect which the
browser would pick up to redirect too.

Fixes NEXT-997

<!-- 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-04-13 16:17:15 -07:00
Charles Kornoelje
a9b9561e11
fix: typo localy --> locally (#48193)
## Improving code comments

Fix a simple typo in next-font related code: localy --> locally

Thank you for the awesome work!

<!-- 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-13 16:04:44 -07:00
Wyatt Johnson
0d2b574574
Update App Route Signature (#48348)
This updates the app route handler signature to be more correct to
prevent the issue with type casting:

```diff
- (request: Request, ctx) => Response
+ (request: NextRequest, ctx) => Promise<Response> | Response
```

This also ensures that the context paramter has the correct types:

```diff
type AppRouteHandlerFnContext = {
-   params?: { [param: string]: any }
+   params?: Record<string, string | string[]>
}
```
2023-04-13 15:54:12 -07:00
JJ Kasper
a234c26c33
Fix dev getStaticPaths/generateStaticParams calling (#48322)
Since exiting in `setTimeout()` can cause a race condition with sending
the result from the worker and we don't want to destroy workers when
trying to leverage them as it has a perf impact this ensures we create
unique workers per usage and destroy them afterwards.

x-ref: https://github.com/vercel/next.js/pull/47716
Fixes: https://github.com/vercel/next.js/issues/48061
2023-04-13 15:42:55 -07:00
Leah
a140620e13
Add body to router request to fix socket hang up (#48039)
### Description
The next.js router will proxy requests if there's a rewrite with an
external URL, for POST requests this currently leads to an `ECONNRESET`,
because the client request has no body.

Fixes WEB-824

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2023-04-13 21:09:32 +00:00
Jimmy Lai
0faf8bc900
interception routes: fix support for route groups (#48351)
fixes #48104 

This PR fixes route groups breaking interception routes. I hadn't
realised that route groups were actually part of the tree router, so we
were not stripping them out in the interception matcher. Fixed now.

<!-- 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-04-13 21:00:32 +00:00
Jimmy Lai
00b1c49c2b
app router: fix scrolling behaviour for parallel routes (#48346)
This PR fixes issues where rendering a new parallel route would reset
the scroll state of the page. This would be very apparent if you
scrolled down the page and opened a modal in a parallel route.

After a bit of investigating, I found out that the scroll behaviour
worked like this:
- after a navigation, we say to the router that we should auto-scroll if
possible
- but we don't specify which node of the tree should scroll
- so what happened is that the first router node to run the auto-scroll
effect would steal the auto-scroll, even though it might have been
destined for another node

The fix consists of
- when we received the flight patch, we compute all new segment paths
that will be rendered and add them to the scroll ref
- when the router says that we should autoscroll, the autoscroll
components will now read those paths and compare them with their segment
path and if yes, they will autoscroll


<!-- 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 #

-->

link NEXT-974
2023-04-13 22:03:02 +02:00
JJ Kasper
2d420f01a9
Fix dev case when proxying to self (#48318)
This ensures we don't pass along original headers when an API route is
proxying back to the dev server.

x-ref: [slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1681231721085539)
2023-04-13 15:33:53 +00:00
Tobias Koppers
d4d779145c
refactor shared logic for turbopack-cli (#48307)
### What?

* move some shared runtime logic to turbopack
* use relative imports from internal code when possible
* move react-refresh logic to turbopack
* move benchmark code logic to turobpack

see https://github.com/vercel/turbo/pull/4553

### Why?

We want to have benchmarking again for turbopack PRs
We want to have a standalone turbopack cli (eventually)
We want to avoid duplicating the runtime code

### How?

refactoring, moving code
2023-04-13 14:54:34 +02:00
OJ Kwon
e21b93b523
feat(turbopack): initial mdxrs config support (#47886)
<!-- 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 #

-->

### What?
Part of WEB-488.

This PR implements path to the `experimental.mdxRs` config in
next.config.js pass into turbopack. Also adds a test cases supposed to
pass with turbopack when mdxRs is enabled. PR requires to land
https://github.com/vercel/turbo/pull/4442 first, so it is expected to
fail for now.

One thing this PR (and its counterpart in turbopack) did not resolve yet
is classic runtime's runtime import (import react ..)


https://github.com/vercel/next.js/compare/mdx-rs-turbopack?expand=1#diff-9c0234d0299e461e59c7cdcb853d11624fc287243a8941a61a15e4ad926be8c0R1

which is not being explicitly applied in existing test cases
(https://github.com/vercel/next.js/blob/canary/test/integration/plugin-mdx-rs/components/button.js#L1).
Bit unclear where / how does injection currently occurs, would need a
followup changes if we'd like to properly support.
2023-04-13 08:17:28 +02:00
JJ Kasper
e8f6ddcae8 v13.3.1-canary.6 2023-04-13 01:22:55 +00:00
Jiachi Liu
d569b83819
Auto collect custom manifest into metadata (#48310)
when custom manifest is found, collect it as metadata and insert into
head

Closes NEXT-988
2023-04-13 00:47:19 +00:00
Shu Ding
d105b23f7f
Fix app dir vanilla-extract support (#48306)
Closes #48222.

This PR introduces a new utility function that checks the resource path,
module type, and loaders to replace the existing CSS regex in the Flight
loaders and plugins. The new function is more robust and can be extended
to correctly support other libraries such as `vanilla-extract`.

cc @SuttonJack and @SukkaW (this could be related to the other issue
we've discussed too).
2023-04-13 00:58:30 +02:00
Jiachi Liu
1d300456c0
Fix missing favicon when other icon exist (#48311)
When collecting static icons we need both collect the one from layout
and page, but for root level route `/` we missed the `favicon.ico`
before so when other icon existed, the root page's collected icons will
cover root layout collected ones, which resulted into favicon missing

Fixes #48147
Closes NEXT-976
2023-04-12 21:07:47 +00:00
Jiachi Liu
848e6fbfaa
Support alt.txt for static metadata og image (#48290)
### What

Support `opengraph-image.alt.txt` and `twitter-image.alt.txt` for static
og/tw metadata image when they need to specify alt txt.

Closes NEXT-990

### Why

for og/tw images, you could have multiple images, so it's tricky to set
alt in metadata exports with alt text. For static case we want it can
work with static files, `.alt.txt` files will be the type to provide alt
text content
2023-04-12 19:44:02 +00:00
OJ Kwon
e97100c5ea
feat(turbopack): support initial compiler.emotion / compiler.styledComponents flag (#47991)
<!-- 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

### Why?

### How?

Closes NEXT-
Fixes #

-->

### What?

Related with WEB-669 and initial support for
[WEB-670](https://linear.app/vercel/issue/WEB-670), allows to consume
compiler.emotion with latest turbopack.

I was trying to make additional changes to make test fully pass, but
there are some other failures around so this change cannot able to pass
existing tests yet.

Turbopack changes: https://github.com/vercel/turbo/pull/4482
2023-04-12 22:05:18 +02:00
Jimmy Lai
ccaa7d6482
parallel route: fix payload not being sent on refetch (#48294)
This PR fixes a bug introduced in #48253 where I inadvertently didn't
return the refetch payloads anymore

<!-- 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-04-12 17:37:37 +02:00
Avi Avinav
c57b687abb
Update metadata interface types (#48259)
<!-- 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 #

-->

This PR changes the example given in metadata interface types for google
site verification, this line:
https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/metadata/types/metadata-interface.ts#L322.

Fixes NEXT-989
Fixes #48257

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-04-12 14:30:41 +00:00
Yamagishi Kazutoshi
958150d15b
Add suffix to static metadata images (#48202)
### What?

The change in #47985 breaks the URLs of static image files like
`/(group)/opengraph-image.png` to `/opengraph-image.png-012345`.
References from `/` are also broken.

### Why?

This is because only `opengraph-image.ts` and `opengraph-image.tsx` are
considered.

### How?

In this Pull Request, we are trying to solve the problem by including
similar support for `opengraph-image.png` and `opengraph-image.jpeg`.

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-04-12 14:30:31 +00:00
Sean Massa
3003bff6fa
ensure original matcher source is free of mutations (#47980)
In a previous PR (https://github.com/vercel/next.js/pull/46753), the
`originalSource` was saved to be passed along through the build process.
This was done a bit too late in the flow, which made `originalSource`
include some transformations.

Because `originalSource` is used for display purposes, we need it
unmodified. This PR preserves `originalSource`.
2023-04-12 16:55:45 +02:00