Commit graph

21439 commits

Author SHA1 Message Date
Jiwon Choi
a2deeeba72
refactor(next): package.json keywords back-end should be backend (#66974)
### Why?

Following of #64173, keyword `back-end` was `backend`


https://github.com/vercel/next.js/assets/120007119/644fe2fb-3db4-4b47-9070-7c504987bdc2
2024-06-18 06:05:07 -07:00
Zack Tanner
24d7a3c7dc
Remove lazyDataResolved flag (#66578)
This removes the `lazyDataResolved` property on the CacheNode -- it was
added to avoid repeatedly applying the server-patch action while data is
missing (and while waiting for the server to respond), but if we just
move the patch action be attached to then server fetch, there's no need
to separate these (we're already suspending indefinitely while data is
missing)
2024-06-18 15:00:19 +02:00
JJ Kasper
61ee393fb4
Refactor internal routing headers to use request meta (#66987)
This refactors our handling of passing routing information to the render
logic via headers which is legacy from when we had separate routing and
render workers. Now this will just attach this meta in our normal
request meta handling which is more consistent and type safe.
2024-06-18 05:59:36 -07:00
Sangmin Park
6a18991d3e
docs: replace let with const for useState (#66988)
### What?

I replaced `let` with `const` for `useState`.

### Why?

Since in these examples, it doesn't need to be a `let`, as it doesn't do
any reassignment.
2024-06-18 05:59:20 -07:00
Vercel Release Bot
14fdc8ab71
Update font data (#66969)
This auto-generated PR updates font data with latest available
2024-06-18 05:59:07 -07:00
Sam Ko
8415161671
chore(github-workflow): bankrupt issues (#66581)
## Why?

Let's start bankrupting older issues (e.g., issues 2019 and older), with
a message indicating users should re-open the issue using the current
[bug
report](https://github.com/vercel/next.js/issues/new?assignees=&labels=template:+bug&projects=&template=1.bug_report.yml)
if the issue is still relevant.

Need to merge this first so we can give an input to the job.
2024-06-18 12:57:21 +00:00
versecafe
eeb87fa21e
NEXT-66966 fix title inconsistency with unstable_ functions in Docs (#66967)
add (Experimental) to title for `unstable_rethrow` to match all other
`unstable_` functions

### Fixing a bug

- Related issues linked using `fixes #66966`

<img width="1287" alt="image"
src="https://github.com/vercel/next.js/assets/147033096/5a790b63-30c9-4605-b0e8-73899afb8e59">

## For Maintainers

`unstable_rethrow` has a different title scheme compared to all other
`unstable_` functions this is just a quick fix for this since it was
bugging me.

Closes NEXT-66966
Fixes #66966

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-06-18 09:25:31 +00:00
Aldo Schumann
86dbcbea43
fix: Prevent MongoDB client promise being cached (#66977)
### What?
Update to
[examples/with-mongodb](https://github.com/vercel/next.js/tree/canary/examples/with-mongodb)
to incorporate fix from the MongoDB team. This should prevent
intermittent serverless function timeouts due to cached promise.

### Why?

Vercel users reported intermittent 500 errors when connecting to their
MongoDB Atlas clusters in production environments.

Full bug report: [NODE-6179](https://jira.mongodb.org/browse/NODE-6179)

Related issues:
- [10671](https://github.com/vercel/vercel/issues/10671)
- [5708](https://github.com/orgs/vercel/discussions/5708)
- [4297](https://github.com/orgs/vercel/discussions/4297)

### How?

Solution by @baileympearson – thank you 🖤

[View
commit](c08bc96353)
in `mongodb-developer/nextjs-with-mongodb`

---

- [x] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
- [x] Make sure the linting passes by running `pnpm build && pnpm lint`.
[See linting
docs](https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md).
2024-06-18 09:47:07 +02:00
Dima Voytenko
dc461512d3
Testmode: use ipv4 address to reduce dependency on local system configuration (#66968)
We've run into numerous issues with local system configurations that
prefer ipv6 and failing to connect to the test proxy.

---------

Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2024-06-18 07:24:59 +00:00
Donny/강동윤
e931ec671c
build: Update swc_core to v0.95.2 (#66902)
# Turbopack

* https://github.com/vercel/turbo/pull/8473 <!-- Donny/강동윤 - feat: Check
the number of direct dependants while tree shaking -->
* https://github.com/vercel/turbo/pull/8420 <!-- Tobias Koppers - Tree
Shaking grouping of items -->
* https://github.com/vercel/turbo/pull/8510 <!-- Tobias Koppers - read
larger chunks when reading a trace file -->
* https://github.com/vercel/turbo/pull/8509 <!-- Tobias Koppers - avoid
duplicates in primary_modules -->
* https://github.com/vercel/turbo/pull/8508 <!-- Tobias Koppers - only
create spans for nodes that are actually visited -->
* https://github.com/vercel/turbo/pull/8502 <!-- Donny/강동윤 - build:
Update `swc_core` to `v0.95.2` -->


### What?

Update `swc_core`.

- [CHANGELOG](064af5391d/CHANGELOG.md (160---2024-06-15))


### Why?

I improved the performance of the parser by margin.
2024-06-18 03:27:52 +00:00
Tobias Koppers
c9eab6ea7a
small memory and tracing improvement (#66899)
### What?

* reduce resolve tasks
* fix name for tracing
2024-06-18 04:34:27 +02:00
vercel-release-bot
83f21e98c5 v15.0.0-canary.36 2024-06-17 23:23:31 +00:00
Sebastian Silbermann
6282423fd7
Remove worker condition name when resolving files in the Edge runtime (#66808) 2024-06-17 18:00:23 +02:00
Andrii Bodnar
aa54867e4e
chore(docs): add Lingui to the Internationalization Page (#66953)
### What?

This PR adds [Lingui](https://lingui.dev) to the list of i18n resources
on the
[Internationalization](https://nextjs.org/docs/app/building-your-application/routing/internationalization#resources)
page for the App Router.

### Why?

Recently, Lingui got some great improvements regarding RSC support. We
also have a new separate article [Lingui with React Server
Components](https://lingui.dev/tutorials/react-rsc) and sample projects
that show how to use Lingui for i18n in Next.js project with App Router
(by @vonovak).

So I think it would be great to add Lingui to this list.

### How?

Add a new list item.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-06-17 08:34:03 -07:00
Tobias Koppers
50c7e939b6
fix benchmark script (#66789)
### What?

* fix CLI output regex for updates text
* bench all scenarios
* bench correct folder
* make an real change instead of only a comment
2024-06-17 13:10:35 +02:00
Tobias Koppers
5346185d37
improve and skip test case (#66952)
### What?

Source Maps for edge are broken, but the test that verifies it is also
broken. This fixes and skips the test.
2024-06-17 11:26:41 +02:00
Keisuke Nagakawa
cf754976e5
Update sitemap.mdx (#66950)
Fix: Correct URL generation in sitemap to use product.id

- Updated sitemap function to correctly use product.id for URL
generation instead of id.
- Ensured each product's URL is accurately reflected in the sitemap
output.
2024-06-17 08:17:57 +00:00
Sebastian Silbermann
cbbe586f2f
Current behavior of import conditions (#66829) 2024-06-17 10:05:29 +02:00
Ivan Torres
13f7ad3204
Add protocol node: imports (#66813)
I have added to all packages that are imported from node, the `node:`
and I have reordered the imports, first the `node:` ones to make it more
readable, as well as only importing the necessary functions.

I ran a `node --prof` before and after the modifications and it seems to
be more optimal now than before.

Co-authored-by: torresgol10.itd <torresgol10.itd@gmail.com>
Co-authored-by: Sam Ko <sam@vercel.com>
2024-06-17 00:31:10 -07:00
Ivan Torres
a4208200fb
Bump ci-info to 4.0.0 (#66810)
Bump ci-info to 4.0.0, deleted from devDevpendecy: @types/ci-info , now
the dependency brings the types.

Co-authored-by: torresgol10.itd <torresgol10.itd@gmail.com>
Co-authored-by: Sam Ko <sam@vercel.com>
2024-06-17 00:14:50 -07:00
vercel-release-bot
e07b8b8e15 v15.0.0-canary.35 2024-06-16 23:23:54 +00:00
Lee Robinson
c037473531
Move create-next-app public/ assets from local folder→ remote URL (#66931)
To reduce the number of files cloned during `create-next-app`, this PR
shifts the SVG assets placed in the `public/` folder to instead by
consumed from the Next.js site.

Since these are SVG files (vector images), the Image component does
_not_ optimize them with image optimization. Image optimization only
applies to raster images (like `.png` or `.jpg`). This means it's
effectively similar to using the `unoptimized` prop on the `Image`
component, which means you don't need to add `remotePatterns` to
`next.config.js` – which would be midly annoying for the
`create-next-app` starter.

I also renamed `file-text.svg` to `file.svg` so the URL is shorter.
These assets will be live on .org any minute now.
2024-06-16 11:42:27 -07:00
vercel-release-bot
3dba220b0b v15.0.0-canary.34 2024-06-15 23:22:41 +00:00
Jiachi Liu
cb2663aead
Fix: remove enegine requried pnpm version (#66914) 2024-06-15 13:50:18 -07:00
vercel-release-bot
5e30f86bc7 v15.0.0-canary.33 2024-06-15 18:23:39 +00:00
Zack Tanner
d46596d323
Fix workflow typo (#66903)
Accidentally introduced in #66888
2024-06-15 07:04:50 -07:00
Zack Tanner
c1898916ae
skip incompatible deploy test (#66886)
This is only available at runtime, so wouldn't be in build logs.
2024-06-15 06:03:26 -07:00
Tobias Koppers
70df7cfb01
[Turbopack] improve memory measurement suite (#66748)
### What?

* adds next-build-test to the workspace
* use multiple turbo-tasks root tasks to be more realistic
* add tracing support
* run pages in order
* add development mode with HMR
* updates for RcStr

### Why?

### How?
2024-06-15 10:04:29 +00:00
Benjamin Woodruff
0b1209edfa
Revert "Revert "Use turbo-tasks-malloc on all platforms" (#66884)", fix aarch64 compilation in CI (#66885)
We either need GCC >= 4.9 or we need to link with libatomic:
https://github.com/microsoft/mimalloc/issues/443

Unfortunately, manylinux2014-cross ships with GCC 4.8.5:
https://github.com/rust-cross/manylinux-cross/blob/main/manylinux2014/aarch64/Dockerfile#L71

We already appear to override the compiler toolchain in CI for x86_64 to
use clang (which is why mimalloc works there), so let's go ahead and do
that here too. This at least means we're using the same compiler across
both architectures.

I'm leaving the aarch64-musl codepath the same (using gcc) because (1)
we don't use mimalloc there yet and (2) it's a bit harder for me to test
as thoroughly.

# Testing

## Local Compilation

Run bash inside the docker image (I also had to install rosetta2 inside
my Linux VM, as this is an x86_64 image used for cross-compilation to
aarch64):

```
podman run --platform=linux/amd64 -t -i ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2023-09-17-aarch64 bash -l
```

```
git clone https://github.com/vercel/next.js.git --filter=blob:none --branch canary --single-branch
cd next.js
git checkout 6ae9828cce
```

Run the build locally:

```
apt update &&
apt install -y pkg-config xz-utils dav1d libdav1d-dev &&
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
rustup show &&
rustup target add aarch64-unknown-linux-gnu &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" &&
export CC_aarch64_unknown_linux_gnu=/usr/bin/clang &&
export CFLAGS_aarch64_unknown_linux_gnu="--target=aarch64-unknown-linux-gnu --sysroot=/usr/aarch64-unknown-linux-gnu" &&
cd packages/next-swc && npm run build-native-release -- --target aarch64-unknown-linux-gnu &&
llvm-strip -x native/next-swc.*.node &&
objdump -T native/next-swc.*.node | grep GLIBC_
```

Sanity check that the result is an aarch64 binary

```
$ file native/next-swc.linux-arm64-gnu.node
native/next-swc.linux-arm64-gnu.node: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, not stripped
```

## Verifying the binary works

Copy the next-swc binary into a copy of shadcn-ui I have sitting around:

```
podman cp 4e8f61b17965:/next.js/packages/next-swc/native/next-swc.linux-arm64-gnu.node ~/ui/node_modules/.pnpm/file+..+nextpack+tarballs+next-swc.tar/node_modules/@next/swc/native/next-swc.linux-arm64-gnu.node
```

and then try running the dev server and loading pages from it in the
browser:

```
pnpm --filter=www dev --turbo
```

## In CI


https://github.com/vercel/next.js/actions/runs/9523143080/job/26254016137
2024-06-15 03:39:24 +00:00
vercel-release-bot
d12b7a5d2a v15.0.0-canary.32 2024-06-14 23:23:00 +00:00
Zack Tanner
7fd37cc95c
split CI retry workflows (#66888)
Splitting these workflows up to improve readability & control the
`workflow_run` condition a bit better.
2024-06-14 15:11:52 -07:00
JJ Kasper
c28ed58d65
Handle action middleware rewrite case (#66852)
This handles the case where a middleware rewrite causes us to fail to
resolve the correct dynamic route params for an action sent to a
prerendered ISR path since the matched path wouldn't be the original
source path like we expect and instead is the prerendered path so we
need to parse the params out instead.

---------

Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2024-06-14 14:57:47 -07:00
Kevin Mårtensson
1e0634069a
fix: wait for playwright fixture to setup before running test (#66842)
### What?

Sometimes, probably when you have a lot of tests, I've noticed that some
tests are failing with the error `browserContext.route: Test ended`.
After some debugging I found that `page.route(…)` needs to be awaited
before continuing.

### Why?

So that Playwright works correctly with the `next` fixture.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-06-14 14:02:45 -07:00
vercel-release-bot
6306ea3c1a v15.0.0-canary.31 2024-06-14 20:56:05 +00:00
JJ Kasper
fd9c524a72
Revert "Use turbo-tasks-malloc on all platforms" (#66884)
Reverting while we investigate further 

Reverts vercel/next.js#66815
2024-06-14 13:36:19 -07:00
Zack Tanner
6ae9828cce
de-flake next-image test (#66882)
This navigation event is timing out in Turbopack builds, but not for any
particularly good reason: I think the link click is just taking a while,
due to builds still being fairly experimental.

Rather than clicking a link to navigate to the client side test suite,
this just starts the test there, which is similar to how the server test
works anyway and still accomplishes what this test is intended for.

Flakes:

[1](https://github.com/vercel/next.js/actions/runs/9520142937/job/26245881436)

[2](https://github.com/vercel/next.js/actions/runs/9520142937/job/26245558183)

[3](https://github.com/vercel/next.js/actions/runs/9520142937/job/26244822150)

[4](https://github.com/vercel/next.js/actions/runs/9519242919/job/26244323363)
2024-06-14 13:26:30 -07:00
Zack Tanner
f8f27734f8
fix webhook token (#66883)
Accidentally inverted these
2024-06-14 13:10:56 -07:00
Sam Ko
710b0b7cd4
chore(github): update users (#66877)
## Why?

Update the labeler list.
2024-06-14 11:20:29 -07:00
Ankit Tiwari
14b7b37a84
Update with-supertokens example (#66827)
Updates the with-supertokens example to replace `getSSRSession` usage
with manual JWT parsing in SSR as shown in
https://github.com/supertokens/create-supertokens-app/pull/107

Co-authored-by: Sam Ko <sam@vercel.com>
2024-06-14 18:06:20 +00:00
Eng Zer Jun
642e93c6f2
docs: update code block filename in Module Aliases section (#66825)
The filenames of the last two code blocks on this page
https://nextjs.org/docs/app/building-your-application/configuring/absolute-imports-and-module-aliases#module-aliases
are written as comment instead of using the `filename` prop.


![image](https://github.com/vercel/next.js/assets/20135478/6186ea56-6ea8-4fe9-ba29-e8036aee5f9d)

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-06-14 11:01:36 -07:00
Albert Chang
61897f2c21
Update use-search-params.mdx (#66857)
add missing 'use client' to the example code in
https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams

<!-- 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: Sam Ko <sam@vercel.com>
2024-06-14 17:46:30 +00:00
Zack Tanner
c436a83c65
tweak deploy test jobs (#66856)
- remove fail fast so we can get a full picture of what's failing
- remove alerting/retrying to existing job

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-06-14 10:37:28 -07:00
Jiachi Liu
ce69888af1
Reland "Middleware to use react-server condition" (#66534) 2024-06-14 17:41:12 +02:00
vercel-release-bot
e4d107cc93 v15.0.0-canary.30 2024-06-14 15:05:15 +00:00
Hendrik Liebau
b8bf2c84b9
[ppr] Improve DX for static shell debugging in dev mode (#66806)
Users that experiment with PPR and might have seen #61798, or #62703, or
most recently #65483, may try the `__nextppronly=1` query param to debug
the static shell. This will lead to the following uncaught error and
blank page:

<img width="1045" alt="static shell debugging hydration error"
src="https://github.com/vercel/next.js/assets/761683/ed382d97-82ae-4a23-9930-bb4d4419e88e">

It might not be immediately obvious that javascript must be disabled to
see the static shell. To improve the DX in this scenario we can omit the
bootstrap script to skip hydration, and thus prevent the error. Then
debugging the static shell works even without disabling javascript in
the devtools.

<img width="1045" alt="static shell debugging without hydration"
src="https://github.com/vercel/next.js/assets/761683/57f6cb88-f5b4-473f-963f-7fda8c8e7f00">

In addition, we should add the closing body and html tags to the shell
so that a valid HTML document is returned.
2024-06-14 11:29:11 +00:00
Benjamin Woodruff
a00146e001
Use turbo-tasks-malloc on all platforms (#66815)
This was previously disabled on `aarch64-unknown-linux-musl` and `wasm`,
due to compilation errors.
    
I moved the logic to disable `mimalloc` on these platforms into the
`turbo-tasks-malloc` crates in https://github.com/vercel/turbo/pull/8462
(which this PR depends on).
    
In addition to centralizing mimalloc platform support logic, this means
that we can get allocation data from these platforms while using the
system allocator.

**Depends on:** https://github.com/vercel/turbo/pull/8462

Included turbopack changes:
* https://github.com/vercel/turbo/pull/8409 <!-- hrmny -
fix(turbopack-ecmascript-runtime): prevent hanging when top level await
is skipped -->
* https://github.com/vercel/turbo/pull/8466 <!-- hrmny - fix(turbopack):
make external module wrapper return not found instead of panicking -->
* https://github.com/vercel/turbo/pull/8469 <!-- hrmny - fix(turbopack):
add ecmascript options to mdx -->
* https://github.com/vercel/turbo/pull/8447 <!-- Donny/강동윤 - build:
Update `swc_core` to `v0.93.4` -->
* https://github.com/vercel/turbo/pull/8472 <!-- Donny/강동윤 - feat:
Reduce the number of parts created by tree shaking -->
* https://github.com/vercel/turbo/pull/8480 <!-- Will Binns-Smith -
Publish `@vercel/devlow-bench` -->
* https://github.com/vercel/turbo/pull/8481 <!-- Will Binns-Smith -
chore: release npm packages -->
* https://github.com/vercel/turbo/pull/8462 <!-- Benjamin Woodruff -
Update mimalloc, enable for glibc Linux aarch64, explicitly disable for
wasm and musl -->
2024-06-14 04:56:04 +00:00
Zack Tanner
1b93f366fc
de-flake interception-route-prefetch-cache test (#66854)
All deployed apps looked/worked fine -- I think just weren't handling
the timing right in this test. When replaying locally, it seemed the
browser was clicking the various links pre-hydration and missing the
route interception cue.

<details>
<summary>View Runs</summary>

- Run 1
![CleanShot 2024-06-13 at 19 24
20@2x](https://github.com/vercel/next.js/assets/1939140/8997255b-7812-4266-a9dc-c839b74abb37)

- Run 2
![CleanShot 2024-06-13 at 19 44
29@2x](https://github.com/vercel/next.js/assets/1939140/75968aa5-ac98-4170-b23d-f0c395f748d9)

- Run 3
![CleanShot 2024-06-13 at 19 47
59@2x](https://github.com/vercel/next.js/assets/1939140/f1314f07-b989-4687-a134-f25b57a5c6a2)


</details>
2024-06-14 02:52:32 +00:00
vercel-release-bot
c0b3c47059 v15.0.0-canary.29 2024-06-14 00:14:19 +00:00
Zack Tanner
02de207967
fix actions-navigation deploy test (#66850)
Switches to reading action result from state rather than runtime logs.
2024-06-13 16:57:26 -07:00
Zack Tanner
4dd26753d9
fix deploy tests that patch node_modules (#66849)
`node_modules` gets ignored when deployed unless explicitly allowed, and
the regular install command will clobber what was in there.

This allowlists the `node_modules` directory and copies it into a new
folder, runs the install command, and then merges the patched
`node_modules` in so the patched modules are available in the test.
2024-06-13 23:21:34 +00:00