Commit graph

18085 commits

Author SHA1 Message Date
Shu Ding
7aef93dd14
Get rid of semver from the server bundle (#57321)
This is a 6.6kB (gzipped) win for the Node.js worker size baseline. `jsonwebtoken` uses semver to ensure that the Node.js version is larger than `16.9.0` (which is always true with Next.js) so we can just alias it to be a noop function that returns `true`.
2023-10-24 18:05:56 +00:00
Jiachi Liu
8734a03ff5
fix metadata url resolving with path posix (#57343)
x-ref: [https://dev.azure.com/nextjs/next.js/_build/results?buildId=71881&view=logs&jobId=8[…]-584d-6f5c-57bad8880974&t=7ae70e63-3625-50f4-6764-5b3e72b4bd7a](https://dev.azure.com/nextjs/next.js/_build/results?buildId=71881&view=logs&jobId=8af7cf9c-43a1-584d-6f5c-57bad8880974&j=8af7cf9c-43a1-584d-6f5c-57bad8880974&t=7ae70e63-3625-50f4-6764-5b3e72b4bd7a)

Follow up for: https://github.com/vercel/next.js/pull/57265
2023-10-24 17:16:25 +00:00
Zack Tanner
fdd8bd95e0
fix async-modules test (#57320)
Doesn't seem like we need a `.babelrc` here and it's causing turbopack test failures
2023-10-24 17:03:23 +00:00
JJ Kasper
ae10b5c82b
Fix app ISR error handling (#57332)
This ensures when an error occurs during a revalidate in app router that
properly throw the error fully and don't store the error page in the
cache which matches the expected behavior for full route ISR as errors
are not meant to update the cache so that the last successful cache
entry can continue being served.

Fix was tested against the provided reproduction here
https://app-dir-example-ghl01cxtn-basement.vercel.app/

Fixes: https://github.com/vercel/next.js/issues/53195
2023-10-24 09:38:30 -07:00
Zack Tanner
63aa0fe8ac
taint flag should enable experimental react in turbopack (#57315)
Matches behavior here: https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/needs-experimental-react.ts#L4
2023-10-24 16:37:37 +00:00
Wyatt Johnson
741a08bc25
fix: ensure generateStaticParams isn't required for PPR (#57333) 2023-10-24 14:18:11 +00:00
Wyatt Johnson
06b9fb7bb8
PPR Support (#57319) 2023-10-24 09:23:52 +00:00
vercel-release-bot
2fc2a52652 v13.5.7-canary.23 2023-10-24 08:22:51 +00:00
JJ Kasper
5428e5a7a1
Fix trace ignores (#57331)
Fixes some of the ignores that were moved around in
https://github.com/vercel/next.js/pull/57280

x-ref:
https://github.com/vercel/vercel/actions/runs/6620930801/job/17989126942?pr=10756
2023-10-24 00:43:34 -07:00
Donny/강동윤
2b16a745ae
feat: Add __nextjs_pure back (#57328)
### What?

Add a magic to next-swc, agina.


### Why?

It's required, but it causes some issues with build process.

### How?



Closes WEB-1838
2023-10-24 07:29:24 +00:00
Wyatt Johnson
c05a11924d
PPR Fetch Fix (#57327) 2023-10-24 06:48:26 +00:00
JJ Kasper
02fad82933
Revert "Increase build-native CI job timeout (#57314)" (#57325)
This reverts commit 003ec7a15b.

Re-adding this as a safe guard as the stalling was a real issue
2023-10-24 06:19:28 +00:00
Zack Tanner
56d74f42f4
bundle analyzer artifacts (#57307)
This uploads bundle analyzer artifacts during CI
2023-10-24 05:48:41 +00:00
vercel-release-bot
c77fec827f v13.5.7-canary.22 2023-10-24 05:34:15 +00:00
JJ Kasper
2275bf1a22
Revert "Add __nextjs_pure helper " (#57318)
This seems to be causing our Windows x86_64 next-swc build to stall for
some reason so reverting so we can unblock canaries while we investigate
further

Reverts vercel/next.js#57286

x-ref:
https://github.com/vercel/next.js/actions/runs/6620707993/job/17986458061
x-ref:
https://github.com/vercel/next.js/actions/runs/6620707993/job/17986458061
2023-10-23 22:06:36 -07:00
JJ Kasper
8b01e2578e
Fix nested unstable_cache revalidating (#57316)
This ensures when we call `revalidateTag` and there are nested `unstable_cache` entries we properly revalidate.
2023-10-24 05:01:00 +00:00
Tobias Koppers
a929bf7c04
update turbopack and add HMR test case (#57304)
### What?

adds a test case for HMR, which is fixed by the turbopack update

### Why?

### How?

### Turbopack Changes

* https://github.com/vercel/turbo/pull/6245 
* https://github.com/vercel/turbo/pull/6212 
* https://github.com/vercel/turbo/pull/6255 
* https://github.com/vercel/turbo/pull/6259 
* https://github.com/vercel/turbo/pull/6261 
* https://github.com/vercel/turbo/pull/6260 

Closes WEB-1836
2023-10-24 04:38:05 +00:00
vercel-release-bot
96337342e4 v13.5.7-canary.21 2023-10-24 03:58:21 +00:00
JJ Kasper
ec4e32c764
Fix no-store/revalidate 0 inside of unstable_cache (#57313)
This ensures we don't unexpectedly error when a fetch attempts to cache
inside of `unstable_cache`, this also ensures `only-on-store` doesn't
unexpectedly error when `revalidate: 0` is set.
2023-10-23 20:52:56 -07:00
JJ Kasper
003ec7a15b
Increase build-native CI job timeout (#57314)
This is currently timing out so this increases the timeout for Windows
specifically
2023-10-23 20:52:39 -07:00
Jimmy Lai
cb5d075758
misc: fix bundling of experimental (#57311)
this removes the call to experimental static react when not using the experimental build
2023-10-24 03:30:08 +00:00
Shu Ding
4eaefbab66
Optimize server bundle size (#57305)
These are not used by the Next.js server and can save up to 15% size of the base Edge worker by ignoring them.
2023-10-24 02:18:27 +00:00
Wyatt Johnson
69388a52fe
Partial Prerendering (#57287)
This PR introduces a build optimization to create a "partial prerender" of the page.

1. During compilation, we create a static shell for the page using your existing Suspense boundaries. Components that can be static will be included in this static shell, leaving holes for the dynamic components.
1. Using `<Suspense />`, we can define fallbacks to be included in the partial prerender, as well as the holes for the dynamic components to stream into.

This means Next.js can initially serve a static loading skeleton, kicking off the dynamic parts in parallel. Then, the dynamic components stream in on demand. Dynamic components can use `cookies()`, `headers()`, `'cache': 'no-store'`, or `unstable_noStore()` to opt-into dynamic rendering.

Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2023-10-24 01:13:05 +00:00
Leah
679a398e49
fix(turbopack): write manifests for edge app pages and use proper edge entry (#56675)
### Description

- We previously didn't write to the shared `middleware-manifest.json` for edge app pages
- We also need to manually write to the `_ENTRIES` object in turbopack entries because it currently doesn't have a way to change the output type like webpack: https://webpack.js.org/configuration/output/#type-assign-properties
- Also need to write a bunch of manifests as JS files to be able to load them from the edge runtime.
- Some import map fixes were needed as well.

This only fixes dev, build will need more work.

Closes WEB-1698
2023-10-24 00:47:55 +00:00
vercel-release-bot
dc7b5d806e v13.5.7-canary.20 2023-10-24 00:35:28 +00:00
Shu Ding
78ffea42ee
Fix client reference proxies (#57301)
Each individual exported component should be a proxied reference. Not sure why it's been broken for so long and it didn't trigger any error.
2023-10-24 00:24:22 +00:00
Jimmy Lai
ce085b56dd
revert "React Aliases (#57283)" (#57299)
This reverts commit 9f512f1cca.

<!-- 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: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-23 16:59:55 -07:00
Zack Tanner
b1d1ed6087
only log export-no-custom-routes warning if unsupported (#57298)
This doesn't need to error, we can instead warn that the functionality will not work as expected out of the box. Support can be added for outside of Next for this to behave as expected. 

These are supported when deployed via the Nextjs builder ([x-ref](https://github.com/vercel/vercel/blob/main/packages/next/src/index.ts#L851-L855)).
2023-10-23 23:58:41 +00:00
Donny/강동윤
4bbf9b6c70
Add __nextjs_pure helper (#57286)
### What?

Safely drop `__nextjs_pure` from next internals in transform

```js
import {__nextjs_pure} from 'next/dist/build/swc/helpers'

__nextjs_pure(console.log("test!"))


```

becomes


```js
/*#__PURE__*/ console.log("test!");

```

so it will be dropped by the minifier - terser and swc minifier will
both work.

### Why?

Adding pure comments from JS world with swc transform is complex. This
would be a helper for the case if we want to create "pure" expressions.


### How?



Closes WEB-1829

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-10-23 16:44:44 -07:00
Jon Meyers
d0e92b19af
chore: Refactor with-supabase example to use ssr package (#57100)
### What?

[1] Refactors `with-supabase` example to use new `@supabase/ssr` package
[2] Makes landing page dynamic steps to connect Next.js to Supabase
[3] Fixes a range of small bugs

### Why?

[1] Simplifies creating a Supabase client
[2] People were not understanding how to connect this template to Supabase
[3] People don't like bugs

### How?

[1] Declares a separate `createClient` function for client and server. Client version is used in Client Components, server version is used every where else - Server Components, Route Handlers, Server Actions, Middleware
[2] Makes landing page a dynamic list of next steps to guide the user to success
[3] Writing code to squash the bugs!
2023-10-23 23:34:10 +00:00
vercel-release-bot
7c803a762e v13.5.7-canary.19 2023-10-23 23:24:21 +00:00
Shu Ding
661c598a21
Improve encryption of Server Actions bound values (#57297)
Removes the constant prefix and action ID from the IV value and makes it a fully random string. Then, we prefix the actual payload with the action ID to avoid submitting the payload from a different action, as well as using it as the checksum of the encryption data to ensure it's not damaged.
2023-10-23 23:18:49 +00:00
Andrew Clark
a77acd22ad
Update React from d803f519e to b8e47d988 (#57296)
React upstream changes:

- https://github.com/facebook/react/pull/27570
- https://github.com/facebook/react/pull/27569
- https://github.com/facebook/react/pull/27550
- https://github.com/facebook/react/pull/27559
- https://github.com/facebook/react/pull/27552
- https://github.com/facebook/react/pull/27504
- https://github.com/facebook/react/pull/27522




Co-authored-by: Josh Story <2716369+gnoff@users.noreply.github.com>
2023-10-23 22:58:50 +00:00
vercel-release-bot
8fb5c8517f v13.5.7-canary.18 2023-10-23 22:17:01 +00:00
Jimmy Lai
9e050fba94
perf: remove parse-body from the server runtime (#57280)
This PR removes the `raw-body` dependency from the server runtime. It
still is used in the pages runtime but at least if you're only using
app, you won't bundle your server function with it.

<!-- 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-23 15:11:09 -07:00
JJ Kasper
7a1b01b85d
Skip i18n-ignore-rewrite-basepath-source irrelevant tests with turbopack (#57295)
Same as https://github.com/vercel/next.js/pull/57289 for another test
suite.
2023-10-23 15:01:24 -07:00
JJ Kasper
dc4138db0a
Update unrelated mdx tests with turbopack (#57294)
The non-mdxrs version of the plugin isn't expected to work with
turbopack so this skips it in that mode
2023-10-23 14:48:39 -07:00
JJ Kasper
639bc3af10
Increase concurrency for turbopack test run (#57290)
Aims to reduce run time by leveraging more concurrency

x-ref: https://github.com/vercel/next.js/actions/runs/6618039974/job/17975622987
2023-10-23 21:27:17 +00:00
JJ Kasper
1275cffe78
Skip i18n-ignore-rewrite-source irrelevant tests with turbopack (#57289)
These tests are expecting files to be written but this isn't the case
with turbopack for client files.
2023-10-23 14:13:49 -07:00
Wyatt Johnson
9f512f1cca
React Aliases (#57283)
This adds aliases to the new react packages being used by Next.js.
2023-10-23 21:04:26 +00:00
Wyatt Johnson
4661764621
Enhance Buffered Transform Stream (#57267)
This adds some better handling around the buffered transform streams to handle error cases a bit better.
2023-10-23 20:05:57 +00:00
Wyatt Johnson
f154bb8313
Revalidate Header Updates (#57162)
Update the revalidate handling to perform the revalidate option coalescing in the render function closer to the render result output. This helps reduce the amount of scope leak from the render.
2023-10-23 19:37:46 +00:00
Jiachi Liu
cc4cceb4f0
Polish compiling and turbopack logging (#57270)
## Make server info log faster

Change to display the server info earlier before server handler is ready

## Make "compiling" message less laggy.

Change to log the compiling logs as previous timer which trying to skip the logging short-time compiling message makes it bit laggy, so we're removing it for now. Reduce the timer from 3s to 500ms

<img width="360" alt="image" src="https://github.com/vercel/next.js/assets/4800338/19afb2d6-ec42-4a67-b664-60f8c36b5287">


## Remove the turbopack

### Now
<img width="398" alt="image" src="https://github.com/vercel/next.js/assets/4800338/fb24d83f-66d0-4383-a42b-fdeff4fe223a">

### Before

<img width="398" alt="image" src="https://github.com/vercel/next.js/assets/4800338/59d6a6f2-32d6-41d1-a80d-12c599165e6a">
2023-10-23 19:28:36 +00:00
JJ Kasper
191faf392c
Import turbo daily integration test workflows (#57083)
As discussed this imports our daily turbo integration tests workflow
into the Next.js repo
2023-10-23 11:48:38 -07:00
Jiachi Liu
4e1429182f
Move logging option to stable (#56791)
We introduced a data fetching logging before, and the control option was under experimental. After a bit experiments turns out users really loves it. We decide to move it to a stable option.

### Changes
We're going to move the `logging` option outside of `experimental`, and scope the `fetches` related config under `logging.fetches`.

```js
// next.config.js
logging?: {
    fetches?: {
      fullUrl?: boolean
    }
}
```
2023-10-23 18:45:00 +00:00
Wyatt Johnson
b3845460f8
Update Pathname Normalizers (#57161)
This collects some of the request pathname normalization code into some helpers.

Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2023-10-23 18:25:49 +00:00
vercel-release-bot
799e6ca65a v13.5.7-canary.17 2023-10-23 18:13:11 +00:00
Shu Ding
a255e02879
Simplify iv prefixing of Server Actions encryption (#57274)
Since we have a fixed length of the random bytes prefixed to the iv,
there's no need to split by `:`.
2023-10-23 11:06:59 -07:00
Steven
ab9bada7b7
chore(export)!: remove next export in favor of output: export in next.config.js (#57085)
BREAKING CHANGE

Since `next export` has been printing a deprecation warning since https://github.com/vercel/next.js/pull/47376, its safe to remove in semver-major.

The upgrade path is to simply add `output: 'export'` in `next.config.js` - everything will continue to work the same.

This config greatly improves the `next dev` experience today. And in the future, it will improve performance of `next build` because we no longer need to do two passes (build then export).
2023-10-23 18:03:58 +00:00
Jimmy Lai
7208535786
perf: fix memory leaks in the edge runtime in dev (#57235)
This PR fixes a memory leak when using `next dev` where on HMR, we would always retain the memory associated with the old VM instance, leading to pretty egregious usage of RAM after only a few edits.

The leak itself comes from methods like `setTimeout` and `setInterval` capturing the context in which they were called and somehow never releasing, even if the timeout happened, when running in a Node.js `vm`. This is probably a Node.js bug.

The fix consists of taking ownership of all timeouts and clearing them ourselves manually at the end of each VM lifecycle.

Tested manually:
- hello world Next.js app with edge runtime
- triggered hmr 10 times
- memory usage
  - base: 400MB
  -  before: 800MB
  - after: 400MB
2023-10-23 17:51:06 +00:00