Commit graph

16603 commits

Author SHA1 Message Date
JJ Kasper
b4b98e84d9
Update result job condition (#52155)
Ensures when the cancelled status occurs we don't mark it as passed.
2023-07-03 16:33:22 -07:00
JJ Kasper
e477e01dbe
Update test result step (#52154)
Removes usage of custom runner on final step as it's not necessary
2023-07-03 23:07:28 +00:00
Shu Ding
d8ad0d3cbf
Fix modularizeImports transform of antd (#52148)
`antd` should be using `kebabCase`:
https://unpkg.com/browse/antd@5.6.4/es/index.js

This addresses the problem below as I tested locally:

<img width="397" alt="CleanShot 2023-07-03 at 20 45 48@2x"
src="https://github.com/vercel/next.js/assets/3676859/73ae99b9-0f3b-49ef-9675-9f45322b708d">
2023-07-03 22:48:32 +02:00
Shu Ding
3a87f0005e
Change the Server Actions feature flag to be validated at compile time (#52147)
Currently we are validating the `experimental.serverActions` flag when creating the actual entries for Server Actions, this causes two problems. One is that syntax errors caught at compilation time are still shown, even if you don't have this flag enabled. Another problem is we still traverse the client graph to collect these action modules even if the flag isn't enabled.

This PR moves that check to be happening at compilation time, which addresses the two above but also brings the extra benefit of showing the exact span and module trace that errors:

<img width="974" alt="CleanShot 2023-07-03 at 20 26 34@2x" src="https://github.com/vercel/next.js/assets/3676859/1676b1f6-e205-4963-bce4-5b515a698e9c">
2023-07-03 20:29:57 +00:00
Jiachi Liu
cd9372c175
Reland "ReverseTopological -> AdjacencyMap"" (#52142)
Reverts vercel/next.js#52139
2023-07-03 19:13:50 +00:00
vercel-release-bot
b4a875eb57 v13.4.8 2023-07-03 17:00:28 +00:00
Jiachi Liu
4b4731dfbe
Revert "ReverseTopological -> AdjacencyMap" (#52139)
Reverts vercel/next.js#52032

Will reland after the release
2023-07-03 16:33:24 +00:00
Chris Yang
11bd7725b5
Add missing url hash (#52123)
<!-- 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 #

-->

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-07-03 08:36:09 -07:00
Alex Kirszenberg
f6a152287a
ReverseTopological -> AdjacencyMap (#52032)
See https://github.com/vercel/turbo/pull/5430

## Turbopack changes

* https://github.com/vercel/turbo/pull/5430 <!-- Alex Kirszenberg -
ReverseTopological -> AdjacencyMap -->
2023-07-03 14:40:41 +02:00
vercel-release-bot
eca315308a v13.4.8-canary.15 2023-07-03 10:21:27 +00:00
Jiachi Liu
c87a1b12c3
fix: env hot reload for RSC pages (#51930)
### Issue
When you edit .env* files, the pages under app dir that using env vars are not triggering hot reload

### Fix
Triggering serverComponentChanges hot reload action when we detect env or tsconfig related change. There's a time period that we need to wait before the compilation is finished. First we save a flag `reloadOnDone` if we need to reload when after compilation is done, by determining if `envChange` is `true` (we already know this in dev server). Then in the compilation hooks, we refresh RSC page once it's finished.

### Extra change 

since we're checking `event.action` in client hot reloader, and throwing error for unknown action, filter devPagesManifestUpdate out from unexpected action as it sometimes triggered as error in console. Introduced in #51516
Fixes NEXT-1261
2023-07-03 10:11:28 +00:00
Jiachi Liu
10605a15c1
Renable flaky tests disabled before (#51680)
As we moved to new CI runner in `#50436`, try to re-enable few flaky tests we disabled before
2023-07-03 09:29:28 +00:00
Alex Kirszenberg
805bfa45e0
Remove EnvironmentIntention (#51965)
See https://github.com/vercel/turbo/pull/5420

# Turbopack changes

* https://github.com/vercel/turbo/pull/5420 
* https://github.com/vercel/turbo/pull/5387
2023-07-03 09:03:37 +00:00
Shu Ding
8eb9730607
Avoid unnecessary resolveExternal calls (#52053) 2023-07-03 10:34:46 +02:00
Tyler Lutz
967b876f6b
docs: Fix broken link (#52092)
Fix a broken link in optimizing index.mdx.
2023-07-02 18:20:27 +00:00
Tim Neutkens
ce69574c24
Add default modularizeImports for antd / ant-design/icons / ahooks (#52031)
Follow up to #50900.

Based on https://github.com/vercel/next.js/issues/48748#issuecomment-1608783867
2023-07-02 17:32:25 +00:00
Shu Ding
bd24a8eb24
Delegate static analyzation task to the router worker (#52104)
In the dev server, we need to call `getStaticInfoIncludingLayouts` for the middleware file to extract its `matchers` field. However, that's currently executed in both app and pages workers. This method is expensive as it depends on the SWC binary to be loaded.

This PR changes it to invoke it as an IPC method, so only the router worker (which runs the compilation) loads SWC, instead of all 3 of them.

This also fixes duplicated console messages of:

```
Using locally built binary of @next/swc
```

For our test app, I'm seeing a 150~250ms improvement:

![CleanShot 2023-07-02 at 18 29 22@2x](https://github.com/vercel/next.js/assets/3676859/be78b79b-2eb4-4f04-92dc-3640e12cde23)

Haven't measured about the memory impact yet, but it should be a lot.
2023-07-02 17:04:57 +00:00
MONEY
9db91ebfa0
Docs: Fix missing typings for typescript example (#52076) 2023-07-01 15:15:15 -05:00
Delba de Oliveira
cc04b62f61
[Docs] link validator: log broken links for PRs from forks (#51963) 2023-07-01 19:41:46 +00:00
Leah
5ff4817749
fix app-hmr-changes.test.ts by updating next-tweet (#52046) 2023-06-30 23:09:09 +00:00
vercel-release-bot
9f6cf08fd4 v13.4.8-canary.14 2023-06-30 22:36:17 +00:00
JJ Kasper
934a7da4d7
Ensure non-implicit unstable_cache tags are propagated (#52058)
This ensures we correctly pass up the non-implicit tags for
`unstable_cache` so that `revalidateTag` can be triggered for ISR paths
properly.

x-ref: [slack
thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1687900021175649)
2023-06-30 15:27:16 -07:00
Steven
23890fb2c9
chore(script): fix typo in sync-react.js pull request url (#52057)
Follow up to:

- https://github.com/vercel/next.js/pull/52052
2023-06-30 21:49:40 +00:00
Steven
148fb086c5
chore(script): improve markdown changelog output in sync-react.js (#52052)
This makes it really easy to copy/paste the changelog into the PR description after running `sync-react.js`.

Previously, the output would link to incorrect PRs because it didn't know the PR number was from a different repo.

We know `facebook/react` uses squash so there should always be a PR number at the end of the commit title.

Example of the new format: https://github.com/vercel/next.js/pull/52005
2023-06-30 20:21:53 +00:00
Wyatt Johnson
efe00e941b
Enable Pages Route Module Rendering for Edge (#51894)
This adapts the new route module rendering to support edge as well.

- Added a new `routeModule` export to the Edge SSR Loader
- Updated some tests to validate page state

Fixes NEXT-1327
2023-06-30 18:42:58 +00:00
Shu Ding
636c776179
Fix font missing during server HMR (#52033)
During development, for fonts created via `next/font` the file path is already containing the hash so we can always have them cached. This fixes the problem of fonts causing FOUC in HMR.

Since I can't find an easy way to test it reliably, I recorded two screenshots using the same steps as reproduced in #50879:

https://github.com/vercel/next.js/assets/3676859/5cb6a64c-cb4a-4ed4-808f-d7b2d0d6c0a3

With the fix:

https://github.com/vercel/next.js/assets/3676859/154b2332-a94b-4392-8132-4be609670745


fix #50879
fix NEXT-1334
2023-06-30 17:11:37 +00:00
Steven
97461f0bba
fix(create-next-app): consolidate messages to "Would you like to use" (#52011)
This PR ensure that `create-next-app` questions are all formatted the
same way:

```
Would you like to use <feature>?
```

fix NEXT-1333
2023-06-30 18:11:23 +02:00
Tobias Koppers
d443778163
Refactor ContentSources to RouteTree (#51660)
### What?

This fixes a performance problem when many pages are involved.

fixes WEB-1067

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

### Turbopack Changes

* https://github.com/vercel/turbo/pull/5416 
* https://github.com/vercel/turbo/pull/5360
2023-06-30 16:03:24 +00:00
Jiachi Liu
4bfc1eaf54
Revert "Optimize inlined Flight data array format" (#52039)
Reverts vercel/next.js#52028

revert temporarily and will re-land in next round release
2023-06-30 16:12:31 +02:00
Shu Ding
0123a9d5c9
Optimize inlined Flight data array format (#52028)
When looking at [some sites](https://rsc-llm-on-the-edge.vercel.app/) with a large amount of chunks streamed, I noticed that the inlined Flight data array can be optimized quite a lot. Currently we do:

```js
self.__next_f.push([1,"d5:[\"4\",[\"$\",\"$a\",null,..."])
```

1. The `self.` isn't needed (except for the initial bootstrap tag) as React itself has `<script>$RC("B:f","S:f")</script>` too.
2. After the bootstrap script tag, all items are an array with `[1, flight_data]` and `flight_data` is always a string. We can just push only these strings.
3. We use `JSON.stringify(flight_payload)` to inline the payload where the payload itself is a string with a lot of double quotes (`"`), this results in a huge amount of backslashes (`\`). Here we can instead replace it to use a pair of single quotes on the outside and un-escape the double quotes inside.

Here's a side-by-side comparison of a small page:

<img width="1710" alt="CleanShot 2023-06-30 at 11 41 02@2x" src="https://github.com/vercel/next.js/assets/3676859/398356ec-91d5-435c-892d-16fb996029e8">

For a real production page I saw the HTML payload reduced by 11,031 bytes, a 3% improvement.

Note that all the tests are not considering gzip here, so the actual traffic impact will be smaller.
2023-06-30 13:27:38 +00:00
vercel-release-bot
0dd225b128 v13.4.8-canary.13 2023-06-30 12:25:06 +00:00
Shu Ding
61ac92995a
Refactor some loaders to be synchronous (#51997)
This PR changes some Webpack loaders to be synchronous as they don't have async code inside. Some of them will scale quiet a lot such as `next-flight-client-module-loader` and we don't want to waste some extra ticks there, as well as got potentially queued after some other events like file I/O.
2023-06-30 12:19:58 +00:00
Jiachi Liu
54a963b666
Update displayed error message for rsc case (#52004)
We show the "Application error: a client-side exception has occurred (see the browser console for more information)" error incorrectly when a server-side error occurs (a digest is present) when we should be showing an error saying it is in fact a server side error and should check the logs there. This change will make the error message more accurate for users to look up

Fixes NEXT-1263
2023-06-30 11:31:19 +00:00
Josh Story
d02f60b998
Loosen metatdata test matcher (#52007)
the metadata tests have an unnecessarily strict matcher which will fail if the matched metadata isn't the first instance of the element tag type. This will cause a problem when we start to preload bootstrap scripts which will cause preload links in all test cases that did not come from the metadata api itself


Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2023-06-30 10:11:24 +00:00
Shu Ding
0fb5fa550c
Avoid disposing middleware and instrumentation hook during development (#52022)
Unlike other routes, these two entries are needed for every request so there is no reason to have them disposed. This avoids wasting extra dev server resource to get them re-compiled.
2023-06-30 09:15:11 +00:00
Shu Ding
80e05a881c
Increase time and size windows for cached on-demand entries (#52019)
Increase `maxInactiveAge` to be `60` seconds and `pagesBufferLength` to be `5`. This change makes it infrequent to have expired entry compilations from recent accessed routes when running the dev server.
2023-06-30 08:35:36 +00:00
vercel-release-bot
27953213f8 v13.4.8-canary.12 2023-06-29 23:30:23 +00:00
Justin Ridgewell
aec3c58d1c
Update edge-runtime to latest (#51944)
### What?

The updates `edge-runtime` to the latest version

### Why?

https://github.com/vercel/edge-runtime/pull/428 fixes `consumeUint8ArrayReadableStream` so that when we break iteration early (due to client disconnect), we cleanup the inner stream. That will fire the stream's `cancel` handler, and allow devs to disconnect from an AI service fetch.

### How?

`edge-runtime` maintain a `try {} finally {}` over the inner stream's iteration. When we early break, JS will call `it.return()`, and that will resume `consumeUint8ArrayReadableStream` with an abrupt completion (essentially, the `yield` turns into a `return`). We'll be able to trigger the `finally {}` block with that, and we call `inner.cancel()` to cleanup.

Fixes https://github.com/vercel-labs/ai/issues/90
2023-06-29 23:15:20 +00:00
Jiachi Liu
dfe08aed33
Fix NextRequest constructor parameters (#52001)
FIx the type change introduced in #51727
2023-06-29 22:50:53 +00:00
Jiachi Liu
2f42cf557e
Filter invalid image descriptor from metadata images (#51992)
Filter out the invalid images in metadata og/twitter `images` filter to avoid crash when falsy image slides in.
Add filtering for now as the erroring doesn't show the proper trace pointing to where it's original introduced, might introduce other validation in the future.
2023-06-29 22:17:25 +00:00
Steven
efdc026ac7
chore(docs): explain NODE_ENV environment variable (#52003)
This PR documents the `NODE_ENV` environment variable behavior.

This feature was originally added in
152c2c2af3 which was released in `next@5`.

See the current source code here:


e3e76a45ee/packages/next/src/bin/next.ts (L82)

---------
2023-06-29 14:12:37 -07:00
Timothy Vernon
0759104287
Docs: Fix broken link (#51991)
Link leads to a 404 page
2023-06-29 20:39:49 +00:00
Tim Neutkens
e10431612d
Remove test skip (#51988)
Re-enables the test disabled in #51879 as it was fixed in #51973
2023-06-29 20:23:55 +00:00
Tyler Lutz
a2df492957
Update next lint section (#51898)
App directory is stable so you no longer need appDir.

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-06-29 19:56:45 +00:00
Delba de Oliveira
18406adf9c
Make sure DevEx can approve docs PRs / Remove Spaces (#51996) 2023-06-29 17:10:53 +00:00
vercel-release-bot
152cfed6e8 v13.4.8-canary.11 2023-06-29 15:40:12 +00:00
vercel-release-bot
9ff526056b v13.4.8-canary.10 2023-06-29 13:55:17 +00:00
Tim Neutkens
ed280d2c46
Add shared input filesystem (#51879)
## What?

Currently we use 3 separate webpack compilers:

- server
- client
- edge

All of these were creating their own input filesystem (which is used to
read file, stat, etc.). Changing them to share a single inputFileSystem
allows the `cachedFileSystem` to be reused better, as `stat` and
`readFile` can be cached across the 3 compilers.

For the page on vercel.com we've been testing this shaves off 300-400ms
on a cold compile (no cache, deleted `.next`).

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

-->

---------

Co-authored-by: Shu Ding <g@shud.in>
2023-06-29 15:49:05 +02:00
Jimmy Lai
8703c55f9f
export config into functions config manifest (#51700)
remaining:
- add tests

caveat: this only works at the route level, we won't inherit from the layout or anything. I think that's fine




Co-authored-by: Florentin / 珞辰 <8146736+ecklf@users.noreply.github.com>
2023-06-29 13:42:25 +00:00
Leah
484bdebc24
Update turbopack and swc_core to v0.78.24 (#51943)
Reverts #51940

### What?

Update SWC crates and turbopack

### Turbopack Updates

* https://github.com/vercel/turbo/pull/5366 <!-- Justin Ridgewell - Fix
bug with `imports` field from a nested directory -->
* https://github.com/vercel/turbo/pull/5361 <!-- Tobias Koppers - update
for next.js changes to env vars -->
* https://github.com/vercel/turbo/pull/5311 <!-- OJ Kwon -
test(filetrace): skip failing tests -->
* https://github.com/vercel/turbo/pull/5402 <!-- Leah - reduce indent in
`analyze_ecmascript_module` by splitting the function up -->
* https://github.com/vercel/turbo/pull/5412 <!-- Leah - Update
`swc_core` to `v0.78.24` -->

Closes WEB-1174

Turbopack counterpart: https://github.com/vercel/turbo/pull/5412

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-06-29 15:11:57 +02:00