Commit graph

18114 commits

Author SHA1 Message Date
vercel-release-bot
e5c082418d v13.5.7-canary.14 2023-10-21 23:23:17 +00:00
Tobias Koppers
31dddcaa47
Turbopack: reenable some skipped test cases (#57177)
### What?

### Why?

better CI coverage

### How?



Closes WEB-1820
2023-10-21 15:11:27 -07:00
Tim Neutkens
488a61fd50
Skip output export production tests for Turbopack (#57197)
- Skips production tests for Turbopack
- Ensures the `suite` is not `undefined` because there was no describe block.
2023-10-21 22:10:36 +00:00
OJ Kwon
3c3744631e
fix(loader_tree): propagate metadata to corresponding layout (#56956)
### What?

- fixes test 17553c5e25/test/e2e/app-dir/metadata/metadata.test.ts (L487)

The way next.js collects static metadata is read static metadata, and then read layout metadata to merge multiple metadatas into a single layout path (17553c5e25/packages/next/src/lib/metadata/resolve-metadata.ts (L347-L352))

When turbopack creates LoaderTree for the corresponding directory tree, it extracts `page` but skips metadata  in result there are orphan components that have a metadata doesn't have layout metadata, as well as a component have a layout doesn't have metadata. Latter is being rendered as a page (since it have correct layout), which eventually falls back to the default metadata instead.

PR trickles down the metadata when extracting page (creating a new component with `page`) to consolidates those.

Also PR expands Metadata to have base_page property to capture where it has been originally exists, as we clone down metadata then do `fillMetadataSegment` against the current page where LoaderTree is being created it creates a wrong relative path. For example, currently

```
/icon.svg
 - opengragph/
      - static -> path being `/opengraph/.../icon.svg` instead of `/icon.svg`
```

When recursively traverse directory tree, capture each components with corresponding base_page to calculate instead.

Unfortunately this doesn't make pass all of the metadata tests; there are lot to dig more. Would like to scope PR in a reasonable size.


Closes WEB-1795
2023-10-21 21:24:40 +00:00
Tim Neutkens
8502d0aab0
Skip webpack test in Turbopack test run (#57195)
This test checks webpack loaders so can be safely disabled for Turbopack.
2023-10-21 20:58:11 +00:00
Tim Neutkens
23bcfffad2
Fix SCSS and SCSS loader handling tests for Turbopack (#57192)
These tests depend on the order of test runs in order to run, so they fail if the first test has not run. This ensures it's skipped for the others.
2023-10-21 20:45:57 +00:00
Tim Neutkens
2bb9b2a7c2
Fix two tests that use exportPathMap for Turbopack (#57194)
More Turbopack test fixes.

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

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating 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-10-21 13:32:48 -07:00
Zack Tanner
eae65fa7b9
improve server actions error when on unsupported node version (#57191)
When using server actions on an unsupported version of Node, you might see the following errors:

> NotSupportedError: multipart/form-data not supported

Support in Undici was landed in 5.11.0 which made it into Node v18.11.0

> TypeError: e._formData.forEach is not a function

Earlier versions of v18 (such as 18.0.0) did not have a `.forEach` implementation on FormData

This throws a better error before the user can get to the point of seeing these more confusing errors.

Closes NEXT-1658
Fixes #55932
2023-10-21 19:32:46 +00:00
Jiachi Liu
c43c915961
Polish auto create layout warning color (#57190)
### After
<img width="643" alt="image" src="https://github.com/vercel/next.js/assets/4800338/254f2ecf-1a22-4756-baf8-d497fa9485ee">

### Before
![image](https://github.com/vercel/next.js/assets/4800338/8acf8c6e-690f-4827-a8fb-bd729e276f0f)
2023-10-21 19:21:22 +00:00
Shu Ding
458e1998e1
Refactor code (#57189)
Refactored some code.
2023-10-21 18:50:56 +00:00
Tim Neutkens
d99602da87
Remove printing fixed issues for Turbopack (#57188)
We'll revisit this after Turbopack is stable.
2023-10-21 18:30:23 +00:00
Shu Ding
a383b93556
Encoding and decoding variables of Server Actions from the closure (#56377)
This PR implements encryption and decryption for Server Action bound values that are from the closure level. Explicit `.bind` values, function arguments and module-level values are NOT handled.

### Compiler

The compiler now groups all closure bound values to an array which gets wrapped with `encrypt`. And then inside the action body, it prepends an expression to recreate the values via `await decrypt`.

Since closure-closed variables will only exist on the server layer, the encryption utility has `"server-only"` annotated.

### Encryption

During build time, a private AES-GCM encryption key is randomly generated and stored in the built server manifest. Before encrypting/decrypting, an extra round of Flight server and client will be used to serialize/deserialize the value.

When encrypting, a salt that contains the action ID is provided to prevent replay attack towards different API endpoints. The encryption key can be overridden via the `NEXT_SERVER_ACTIONS_ENCRYPTION_KEY` env variable so it can be built on multiple machines on scale.

A global singleton for storing the client reference manifest was made for Flight's serialization/deserialization as that might happen outside of rendering.

After encryption, we then serialize the ArrayBuffer as Base64 to send it to the client.
2023-10-21 17:52:06 +00:00
Ryo Matsukawa
9a8b14632c
chore: Add condition to skip update-fonts workflow on forks (#57165)
<!-- 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

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating 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?
Added a condition to skip the update-fonts workflow for forked
repositories.

### Why?
To optimize CI resources and prevent extra runs on forks.

### How?
By checking the repository name and comparing it with the main
repository before executing the workflow.
2023-10-21 00:50:36 -07:00
Jimmy Lai
4e27b908fe
misc: fix injecting --inspect with NODE_OPTIONS (#57159)
This PR fixes the passing of the `--inspect` option when calling Next.js with it. It's still not great because you need to target the next file in node_modules directly but I'll add a `next --inspect` option in the future.
2023-10-21 00:49:41 +00:00
Will Binns-Smith
1ffef0f1a3
Turbopack: support more server code in tracing error stack frames (#57156)
This:
- Uses `isServer` to use the appropriate Turbopack `FileSystem` when
creating `FileSystemPath`s
- Properly uri decodes path segments originating from `file://` uris
- Correctly reads chunks starting at the project path instead of the
root path


Closes WEB-1815

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-20 17:09:10 -07:00
Leah
0d2edbb23f
chore: move layer from chunking context to asset context (#57149)
The asset context is a better place to store the layer, because it's
affected by transitions unlike the chunking context

This PR also removes a bunch of unused code

### Why?

See https://github.com/vercel/turbo/pull/6237 for the rationale
Also needs to wait for that PR to be merged

Closes NEXT-1814

#### Turbopack Changes
* https://github.com/vercel/turbo/pull/6237 <!-- Leah - chore: move
layer from chunking context to asset context -->

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2023-10-21 02:05:00 +02:00
Wyatt Johnson
8afbce84de
Cleanup Request Meta (#57144)
This cleans up the meta for requests by removing the legacy `_next` prefixes and removing some unused ones.
2023-10-20 23:40:37 +00:00
vercel-release-bot
d0a1199a36 v13.5.7-canary.13 2023-10-20 23:23:41 +00:00
Jiachi Liu
e6fbeabd1a
Display experimental features for next build (#57152)
Display full information of experimental features in `next build`, so we'll have full insights for build logs


Close NEXT-1697

* `next build`
<img width="668" alt="image" src="https://github.com/vercel/next.js/assets/4800338/6ab75923-0336-4624-905f-347fedbff5a9">
2023-10-20 22:37:23 +00:00
Steven
4d31506960
Revert "Add retry for fetching subsetted Google Fonts" (#57154)
Reverts vercel/next.js#56583 due to missing dependency

```
app/layout.jsx
An error occured in 'next/font'.
Error: Cannot find module 'async-retry'
Require stack:
- node_modules/•pnpm/next@13.5.7-canary.12_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/@next/font/dist/google/retry.js
- node_modules/-pnpm/next@13.5.7-canary-12_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/@next/font/dist/google/fetch-css-from-google-fonts.js
```
2023-10-20 22:14:24 +00:00
Wyatt Johnson
354705d1c3
Route Handler Types (#57070)
This updates the handle functions on the server to share a common type that simplifies the signature.
2023-10-20 21:21:18 +00:00
Phil Wolstenholme
aa1ee5995c
Mark most GTMParams as optional (#57153)
Fixes #57126

The `<GoogleTagManager>` types in `@next/third-parties` seem incorrect compared to [e2e test usage](https://github.com/vercel/next.js/blob/canary/test/e2e/third-parties/pages/gtm.js#L11) where only the `gtmId` is shown/needed.

```
<GoogleTagManager gtmId="GTM-XYZ" />
```


The extra options (datalayer name etc) are not needed as the `GoogleTagManager` has defaults: https://github.com/vercel/next.js/blob/v13.5.7-canary.11/packages/third-parties/src/google/gtm.tsx#L24-L32
2023-10-20 21:04:00 +00:00
Josh Story
5528cc6d4e
Remove the experimental serverActions flag (#57145)
Remove the experimental `serverActions` flag

Co-authored-by: Shu Ding <3676859+shuding@users.noreply.github.com>
Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2023-10-20 20:45:25 +00:00
Leah
2f2e8e26e2
chore: create template from next-edge-ssr-loader (#56715)
### Description

- Splits the generated code of the `next-edge-ssr-loader` out into 2 templates
- This PR also adds support for optional imports in templates

Closes WEB-1761
2023-10-20 20:19:49 +00:00
JJ Kasper
888c3a7439
Reduce e2e deploy concurrency (#57142)
Attempting to reduce our time outs for this job by reducing concurrency
2023-10-20 19:56:13 +00:00
Balázs Orbán
f9bd6f7621
chore: drop web streams polyfilling on globalThis (#57077)
### What?

`globalThis.ReadableStream` and `globalThis.WriteableStream` has been exposed since Node.js 18, which is our new default requirement. (#56943)

### Why?

This simplifies the code and might result in slightly better performance.

### How?

Drop any checks of `globalThis` properties that are always defined now.
2023-10-20 19:38:35 +00:00
Balázs Orbán
2277797dc2
chore: drop form-data (#57141)
### What?

Dropping `form-data` polyfill as Node.js 18+ versions all expose it on `globalThis`

### Why?

Reduce the amount of shipped code in Next.js

### How?

Similar to #56899

See: https://nodejs.org/docs/latest-v18.x/api/globals.html#class-formdata
2023-10-20 19:25:42 +00:00
JJ Kasper
4acaded2f4
Update eslint config (#57146) 2023-10-20 19:15:24 +00:00
JJ Kasper
254d6d5d6d
Refine eslint rule (#57143)
As discussed with @sokra @ForsakenHarmony @gnoff
2023-10-20 11:15:31 -07:00
Tobias Koppers
4a75e71d25
prefer Option<Vc<IssueSource>> over Vc<OptionIssueSource> (#57104)
### What?

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

### Why?

### How?


Closes WEB-1808
2023-10-20 18:06:23 +00:00
Tobias Koppers
a63c74924a
make test case less flaky (#57138)
### What?

test case is flaky

### Why?

### How?


Closes WEB-1813
2023-10-20 19:46:02 +02:00
Josh Story
920a7e8ba6
Update React from a41957507 to d803f519e (#57015)
## React upstream Changes

- https://github.com/facebook/react/pull/27542
- https://github.com/facebook/react/pull/27551
- https://github.com/facebook/react/pull/27537
- https://github.com/facebook/react/pull/27549
- https://github.com/facebook/react/pull/27544
- https://github.com/facebook/react/pull/27543
- https://github.com/facebook/react/pull/27541
- https://github.com/facebook/react/pull/27538
- https://github.com/facebook/react/pull/27536
2023-10-20 17:42:27 +00:00
vercel-release-bot
2b60475c2b v13.5.7-canary.12 2023-10-20 17:19:41 +00:00
berlysia
c84f5ed794
Add retry for fetching subsetted Google Fonts (#56583)
### What?
Add the same re-retrieval process for subseted font files of Google Font as for CSS files.

+ make use of [async-retry](https://github.com/vercel/async-retry)

### Why?
It was reported in #45080 that Japanese fonts such as Noto Sans JP were frequently `Failed to fetch`.
A retry process was added in #51890, but it did not resolve the issue completely ( https://github.com/vercel/next.js/pull/51890#issuecomment-1614558064 ).

Here is my reproduction code with 13.5.5-canary.4 (please run locally).
https://stackblitz.com/edit/stackblitz-starters-n8zxlq?file=app%2Fpage.tsx

<details>
<summary>And my local error log is here(folded)</summary>

```
$ npm run -- dev

> nextjs@0.1.0 dev
> next dev

 ⚠ Port 3000 is in use, trying 3001 instead.
  ▲ Next.js 13.5.5-canary.4
  - Local:        http://localhost:3001

 ✓ Ready in 23.9s
 ○ Compiling /page ...
FetchError: request to https://fonts.gstatic.com/s/notosansjp/v52/-F6jfjtqLzI2JPCgQBnw7HFyzSD-AsregP8VFBEj757Y0rw_qMHVdbR2L8Y9QTJ1LwkRmR5GprQAe69m.4.woff2 failed, reason: 
    at ClientRequest.<anonymous> (/mnt/c/Users/berlysia/Downloads/stackblitz-starters-n8zxlq/node_modules/next/dist/compiled/node-fetch/index.js:1:65756)
    at ClientRequest.emit (node:events:514:28)
    at TLSSocket.socketErrorListener (node:_http_client:495:9)
    at TLSSocket.emit (node:events:514:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT'
}
 ⨯ Failed to download `Noto Sans JP` from Google Fonts. Using fallback font instead.

Failed to fetch `Noto Sans JP` from Google Fonts.}
FetchError: request to https://fonts.gstatic.com/s/notosansjp/v52/-F6jfjtqLzI2JPCgQBnw7HFyzSD-AsregP8VFBEj757Y0rw_qMHVdbR2L8Y9QTJ1LwkRmR5GprQAe69m.28.woff2 failed, reason: 
    at ClientRequest.<anonymous> (/mnt/c/Users/berlysia/Downloads/stackblitz-starters-n8zxlq/node_modules/next/dist/compiled/node-fetch/index.js:1:65756)
    at ClientRequest.emit (node:events:514:28)
    at TLSSocket.socketErrorListener (node:_http_client:495:9)
    at TLSSocket.emit (node:events:514:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
    at runNextTicks (node:internal/process/task_queues:64:3)
    at listOnTimeout (node:internal/timers:540:9)
    at process.processTimers (node:internal/timers:514:7) {
  type: 'system',
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT'
}
...(15 errors emitted)
```
</details>

I've found that the issue is not limited to fetching CSS, fetching subset font files is also failing.
By adding retry handling to the fetch of individual subseted font files as well, I (almost) never see `Failed to fetch` anymore.

The issue tends to become more apparent when downloading a larger number of subsetted fonts.
This suggests that the problem is more likely to occur with larger fonts, such as those designed for CJK languages.

### How?
Add the same re-retrieval process for subseted font files of Google Font as for CSS files.


Related to #51890 #53239 #45080 #53279
2023-10-20 17:10:53 +00:00
Shu Ding
0a7dd4ac8a
Remove warning messages (#57087)
We no longer need these for the next major.
2023-10-20 14:42:07 +00:00
Jiachi Liu
5d6592d895
Upgrade edge-runtime/cookies (#57124)
Backport fix on 13.5.6 to canary

x-ref: #57021
2023-10-20 13:56:04 +00:00
Vercel Release Bot
6ad017d23f
Update font data (#57094)
This auto-generated PR updates font data with latest available
2023-10-20 04:44:45 +00:00
Sebastian Markbåge
c41debd23a
Expose Experimental Taint APIs (#56507)
Exposes the new experimental Taint APIs using the `taint` flag which
enables experimental React.

As an example for how we can use it, I use it to taint `process.env`
with a better error message. I'm not sure where this should live since
it's a global init but it needs access to the global config. It's
unnecessary to retaint it for every render but not sure if there's a
better place for it.

---------

Co-authored-by: Jimmy Lai <laijimmy0@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-19 19:02:37 -07:00
Jimmy Lai
6d2df8636a
build: don't error when bundling optional peer deps (#57073)
This PR adds a resolver plugin to verify during bundling that when a module is unresolved, that it is not an optional peer dependency specified in the package.json of the caller. An error would happen if you try to bundle packages like `typeorm` since there are `require` calls in the code to those dependencies.

Also, swallow dynamic dependencies warnings in `require` calls error if they come from `node_modules`. They are not actionable at all generally.
2023-10-20 00:57:06 +00:00
Tobias Koppers
040a4f75e8
update test manifest (#56938)
Update test manifest from daily test run

Closes WEB-1792
2023-10-20 00:43:56 +00:00
JJ Kasper
a8bc1a1cf2
Update runner for e2e deploy tests (#57089)
This attempts to fix our tests timing out from an obscure lost
connection to runner message


![CleanShot 2023-10-19 at 16 29
50@2x](https://github.com/vercel/next.js/assets/22380829/594b21c4-4df9-418b-afbb-5e290020d25d)
2023-10-19 17:34:18 -07:00
JJ Kasper
2faacf17fc
Update flakey build trace case (#57092)
This updates to tolerate ENOENT during build tracing as this can expectedly occur since we run static optimization in parallel to the tracing which static generation can remove server files and replace them with their HTML files. 

x-ref: https://github.com/vercel/next.js/actions/runs/6581290033/job/17880939489?pr=57088
2023-10-20 00:17:25 +00:00
JJ Kasper
477cf794e1
Update CNA tests more (#57088)
Follow-up to https://github.com/vercel/next.js/pull/57025 this updates other places we run the `create-next-app` CLI in tests.
2023-10-19 23:49:31 +00:00
vercel-release-bot
e437f72662 v13.5.7-canary.11 2023-10-19 23:22:57 +00:00
vercel-release-bot
143d79f733 v13.5.7-canary.10 2023-10-19 22:41:38 +00:00
OJ Kwon
68edcc3e37
build(cargo): bump up turbopack (#57081)
### What?

Picks up latest turbopack to get some changes.

Closes WEB-1802
2023-10-19 22:21:27 +00:00
Will Binns-Smith
0e4fe2ffe3
Code frame and sourcemapped error support for Turbopack (#56727)
This implements support for properly tracing sourcemaps when presenting
error stacks to the user. It also adds code frames when possible.


Closes WEB-1764

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-19 14:51:40 -07:00
Steven
a3aa6590ff
chore(next/image)!: mark domains as deprecated in favor remotePatterns (#57062)
We already had `domains` as "not recommended" but this PR marks it as "deprecated" and prints a warning if its detected.

I also updated all examples to switch from `domains` to `remotePatterns`.
2023-10-19 20:24:48 +00:00
Jiachi Liu
194e94ed6e
codemod: migrate ImageResponse imports (#57074)
Adding codemod for #56662 for easier migration of `ImageResponse` from `"next/server"` to `"next/og"`
2023-10-19 20:02:25 +00:00
vercel-release-bot
ed6b60c55a v13.5.7-canary.9 2023-10-19 19:15:58 +00:00