Commit graph

1258 commits

Author SHA1 Message Date
Josh Story
eb79555827
Updated React from 7508dcd5c to 746890329 (#58233)
Updated React from 7508dcd5c to 746890329.

- https://github.com/facebook/react/pull/27674
2023-11-08 18:30:45 -08:00
Josh Story
1b5e307f6b
Update React from 2983249dd to 7508dcd5c (#58216)
Updated React from 2983249dd to 7508dcd5c.

- https://github.com/facebook/react/pull/27672
- https://github.com/facebook/react/pull/27132
- https://github.com/facebook/react/pull/27646
- https://github.com/facebook/react/pull/26446
2023-11-08 19:36:54 +00:00
Josh Story
fe99b53d7f
Update React from 08a39539f to 2983249dd. (#58154)
Updates React from 08a39539f to 2983249dd.

### React upstream changes

- https://github.com/facebook/react/pull/27641
- https://github.com/facebook/react/pull/27661
- https://github.com/facebook/react/pull/27640
- https://github.com/facebook/react/pull/27595
- https://github.com/facebook/react/pull/27600
- https://github.com/facebook/react/pull/27598
- https://github.com/facebook/react/pull/27590
- https://github.com/facebook/react/pull/27606
- https://github.com/facebook/react/pull/27608
- https://github.com/facebook/react/pull/27601
- https://github.com/facebook/react/pull/27616
- https://github.com/facebook/react/pull/27615
- https://github.com/facebook/react/pull/27614
- https://github.com/facebook/react/pull/27599
- https://github.com/facebook/react/pull/27597
- https://github.com/facebook/react/pull/27525
- https://github.com/facebook/react/pull/27571


Updates @types/react to 18.2.37
Updates @types/react-dom to 18.2.15
2023-11-07 23:55:06 +00:00
Thomas Knickman
348c550120
feat(turbo): use turbo gen instead of plop (#53684)
### What?

Use [Turborepo generators](https://turbo.build/repo/docs/core-concepts/monorepos/code-generation#custom-generators) instead of plop. 

Turborepo generators are built on top of plop, but include some additional tooling to make working in monorepos easier. It also supports zero config typescript for configs. 

### Why?
Same Team!

### How?
Ported the existing plopfile to a turbo generator config


Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2023-11-03 01:25:18 +00:00
Zack Tanner
c82f6a83ef
Update React from 0c6348758 to 08a39539f (#57852)
Updates React from 0c6348758 to 08a39539f.

### React upstream changes

- https://github.com/facebook/react/pull/27634
- https://github.com/facebook/react/pull/27632
2023-11-01 02:22:59 +00:00
Josh Story
e26c9011d6
Update React from 8c8ee9ee6 to 0c6348758 and types (#57772)
Update React from 8c8ee9ee6 to 0c6348758

- https://github.com/facebook/react/pull/27627
- https://github.com/facebook/react/pull/27624
- https://github.com/facebook/react/pull/27610
- https://github.com/facebook/react/pull/27592
- https://github.com/facebook/react/pull/27593
- https://github.com/facebook/react/pull/27588
- https://github.com/facebook/react/pull/27591
- https://github.com/facebook/react/pull/27587

Update @types/react to 18.2.33
Update @types/react-dom to 18.2.14
2023-10-30 11:31:38 -07:00
Andrew Clark
00df11b0a7
Update React from a9985529f to 8c8ee9ee6 (#57483)
React upstream changes:

- https://github.com/facebook/react/pull/27594
- https://github.com/facebook/react/pull/27584

Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2023-10-26 07:10:27 +00:00
Josh Story
fcc28999bf
Update React from b8e47d988 to a9985529f. (#57442)
React upstream changes:

- https://github.com/facebook/react/pull/27586
- https://github.com/facebook/react/pull/27577
- https://github.com/facebook/react/pull/27576

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-25 13:29:47 -07: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
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
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
Balázs Orbán
33db463fe4
chore: upgrade jest (#56909)
### What?

Upgrade jest to its latest version

### Why?

#56899 fails because historically Jest stripped the globals in Node.js, but 28+ isn't doing that anymore. If we upgrade, we don't have to keep track of Node.js globals and when they are added. This will be useful in removing even more polyfills for things that are natively shipped in Node.js now.

### How?

Jest 29 introduced a change to the snapshot format: https://jestjs.io/blog/2022/08/25/jest-29

First, I tried setting the old compat option to not require updating snapshots, but some tests were still failing: https://dev.azure.com/nextjs/next.js/_build/results?buildId=70633&view=logs&j=8af7cf9c-43a1-584d-6f5c-57bad8880974&t=7ae70e63-3625-50f4-6764-5b3e72b4bd7a&l=273 So going through the pain now instead.
2023-10-19 17:38:24 +00:00
Zack Tanner
975c999451
Update React from 09fbee89d to a41957507 (#56970)
Update React from from 09fbee89d to a41957507.

### React upstream changes

- https://github.com/facebook/react/pull/27472
- https://github.com/facebook/react/pull/27512
- https://github.com/facebook/react/pull/27509
- https://github.com/facebook/react/pull/27517
- https://github.com/facebook/react/pull/27523
- https://github.com/facebook/react/pull/27516
- https://github.com/facebook/react/pull/27505
2023-10-18 01:15:55 +00:00
Balázs Orbán
523474c8be
chore: lower Node.js version requirement (#56943) 2023-10-17 23:15:31 +02:00
Mateusz Burzyński
db214214d6
Update Babel dependencies (#51962)
### What?

Update Babel packages across the board

### Why?

Since you ship vendored presets and plugins it's impossible for people to update this stuff at their own pace - independently from Next. So users of `next/babel` are currently stuck with old versions and, for example, they might not be able to use the TS `satisfies` operator.

### How?

I just updated ranges (to pinned ones) where I could find them, run `corepack pnpm i` and re-run build scripts in the `packages/next`.

Fixes #43799
2023-10-17 02:25:57 +00:00
Josh Story
0a80017d03
Update React from d900fadbf to 09fbee89d. Removes server context and experimental prefix for server action APIs (#56809)
The latest React canary builds have a few changes that need to be
adopted for compatability.

1. the `useFormState` and `useFormStatus` hooks in `react-dom` and the
`formData` opiont in `react-dom/server` are no longer prefixed with
`experimental_`
2. server content (an undocumented React feature) has been removed. Next
only had trivial intenral use of this API and did not expose a coherent
feature to Next users (no ability to seed context on refetches). It is
still possible that some users used the React server context APIs which
is why this should go into Next 14.

### React upstream changes

- https://github.com/facebook/react/pull/27513
- https://github.com/facebook/react/pull/27514
- https://github.com/facebook/react/pull/27511
- https://github.com/facebook/react/pull/27508
- https://github.com/facebook/react/pull/27502
- https://github.com/facebook/react/pull/27474
- https://github.com/facebook/react/pull/26789
- https://github.com/facebook/react/pull/27500
- https://github.com/facebook/react/pull/27488
- https://github.com/facebook/react/pull/27458
- https://github.com/facebook/react/pull/27471
- https://github.com/facebook/react/pull/27470
- https://github.com/facebook/react/pull/27464
- https://github.com/facebook/react/pull/27456
- https://github.com/facebook/react/pull/27462
- https://github.com/facebook/react/pull/27461
- https://github.com/facebook/react/pull/27460
- https://github.com/facebook/react/pull/27459
- https://github.com/facebook/react/pull/27454
- https://github.com/facebook/react/pull/27457
- https://github.com/facebook/react/pull/27453
- https://github.com/facebook/react/pull/27401
- https://github.com/facebook/react/pull/27443
- https://github.com/facebook/react/pull/27445
- https://github.com/facebook/react/pull/27364
- https://github.com/facebook/react/pull/27440
- https://github.com/facebook/react/pull/27436

---------

Co-authored-by: Zack Tanner <zacktanner@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-10-16 15:46:10 -07:00
Balázs Orbán
1ff7f07875
feat: drop Node.js 16 (#56896)
### What?

BREAKING CHANGE: Bump the minimum required Node.js version.

### Why?

Node.js 16 has reached end-of-life in September.

Bumped to `18.18.2` since it contained some security-related patches: https://nodejs.org/en/blog/vulnerability/october-2023-security-releases

### How?

Bumped `engines` where needed, upgraded the workflows.

This will allow us to remove quite a few polyfills, I'll open separate PRs for those.
2023-10-16 21:41:38 +00:00
Kiko Beats
8f2fd2e7d5
bump: edge-runtime (#56856)
It bumps Edge Runtime to include the latest fixes, such as:

- https://github.com/vercel/edge-runtime/pull/622
- https://github.com/vercel/edge-runtime/pull/640

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-16 09:08:44 +02:00
Jimmy Lai
62ab0e33a2
ci: add job summary to the test suite runs (#56742)
This PR adds Github Actions summaries to the test suite that runs in the CI so that you can easily visualise which tests failed + what the relevant log was instead of parsing the logs yourself.

Example here https://github.com/vercel/next.js/actions/runs/6495658699

![CleanShot 2023-10-12 at 14 57 32@2x](https://github.com/vercel/next.js/assets/11064311/7d65496b-6e28-460a-8bef-3f2e91266d00)
2023-10-12 13:57:09 +00:00
Jimmy Lai
56fe014532
chore: bump pnpm to 8.9 (#56649)
There's allegedly a bump in performance for mac for pnpm 8.9 so upgrading it in the repo.
2023-10-10 11:23:10 +00:00
Tim Neutkens
c60ecfcc1c
Ensure react-server-dom-turbopack-experimental uses the right package (#56560)
Was investigating why Turbopack with `serverActions: true` sometimes
crashes with a webpack specific error. Found it wasn't using the right
package.

<!-- 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-07 19:37:58 +02:00
Josh Story
09b0ca42fb
App Router - preinitialize chunks during SSR (#54752)
Today when we hydrate an SSR'd RSC response on the client we encounter import chunks which initiate code loading for client components. However we only start fetching these chunks after hydration has begun which is necessarily after the initial chunks for the entrypoint have loaded.

React has upstream changes that need to land which will preinitialize the rendered chunks for all client components used during the SSR pass. This will cause a `<script async="" src... />` tag to be emitted in the head for each chunk we need to load during hydration which allows the browser to start fetching these resources even before the entrypoint has started to execute.

Additionally the implementation for webpack and turbopack is different enough that there will be a new `react-server-dom-turbopack` package in the React repo which should be used when using Turbopack with Next.

This PR also removes a number of patches to React src that proxy loading (`__next_chunk_load__`) and bundler requires (`__next_require__`) through the `globalThis` object. Now the react packages can be fully responsible for implementing chunk loading and all Next needs to do is supply the necessary information such as chunk prefix and crossOrigin attributes necessary for this loading. This information is produced as part of the client-manifest by either a Webpack plugin or Turbopack.

Additionally any modifications to the chunk filename that were previously done at runtime need to be made in the manifest itself now. This means we need to encode the deployment id for skew protection and encode the filename to make it match our static path matching (and resolutions on s3) when using `[` and `]` segment characters.

There are a few followup items to consider in later PRs
1. we currently bundle a node and edge version of react-server-dom-webpack/client. The node version has an implementation for busboy whereas the edge version does not. Next is currently configured to use busboy when handling a fetch action sent as multipart with a node runtime. Ideally we'd only bundle the one platform we are buliding for but some additional refactoring to support better forking is possibly required here

This PR also updates react from 09285d5a7 to d900fadbf.

### React upstream changes

- https://github.com/facebook/react/pull/27439
- https://github.com/facebook/react/pull/26763
- https://github.com/facebook/react/pull/27434
- https://github.com/facebook/react/pull/27433
- https://github.com/facebook/react/pull/27424
- https://github.com/facebook/react/pull/27428
- https://github.com/facebook/react/pull/27427
- https://github.com/facebook/react/pull/27315
- https://github.com/facebook/react/pull/27314
- https://github.com/facebook/react/pull/27400
- https://github.com/facebook/react/pull/27421
- https://github.com/facebook/react/pull/27419
- https://github.com/facebook/react/pull/27418
2023-10-03 21:40:25 +00:00
Balázs Orbán
61180cfc84
chore: bump postcss (#56225)
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-09-29 21:57:35 +00:00
Steven
12c800e35c
chore: remove chalk in favor of picocolors (#55992)
Similar to PR https://github.com/vercel/next.js/pull/53115, this PR removes `chalk` in favor of `picocolors`
2023-09-27 21:00:52 +00:00
Shu Ding
974e41ccbb
Update vendored React (#56012)
### React upstream changes

- https://github.com/facebook/react/pull/27417
- https://github.com/facebook/react/pull/27408
- https://github.com/facebook/react/pull/27409
- https://github.com/facebook/react/pull/27405
- https://github.com/facebook/react/pull/27375
- https://github.com/facebook/react/pull/27407
- https://github.com/facebook/react/pull/27365
- https://github.com/facebook/react/pull/27399
- https://github.com/facebook/react/pull/27395
- https://github.com/facebook/react/pull/27394
- https://github.com/facebook/react/pull/27397
- https://github.com/facebook/react/pull/26992
- https://github.com/facebook/react/pull/27388
- https://github.com/facebook/react/pull/27373
- https://github.com/facebook/react/pull/27332
2023-09-26 12:39:09 +00:00
Tim Neutkens
b5c399698d
Remove next-typescript check in webpack config (#55819)
This package has been legacy for multiple years and has been marked
deprecated, this check is no longer useful.

<!-- 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-09-22 19:43:16 +02:00
Balázs Orbán
38877dda37
chore: bump @vercel/og and satori (#55654)
### What?

Bump these packages to their latest. (Bumped `satori` too to avoid multiple versions in the repo)

### Why?

Follow-up of https://github.com/vercel/next.js/pull/55187

### How?

Updated the original package applying the changes from #55187

Closes NEXT-1639
Fixes #55604

[Slack thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1695169119558899)
2023-09-20 12:16:49 +00:00
Zack Tanner
bb13bb4799
Update React from d6dcad6a8 to 2807d781a (#55590)
Update React from d6dcad6a8 to 2807d781a.

### React upstream changes

- https://github.com/facebook/react/pull/27387
- https://github.com/facebook/react/pull/27386
- https://github.com/facebook/react/pull/27385
- https://github.com/facebook/react/pull/27379
- https://github.com/facebook/react/pull/27382

Closes NEXT-1637
2023-09-20 00:09:34 +00:00
Donny/강동윤
ad79325a9f
Update swc_core to v0.83.12 (#55216)
### What?

I made `styled-jsx` configurable. It uses `swc_css` by default, and with
`useLigntningcss: true`, it uses it.

https://github.com/swc-project/plugins/pull/207

### Why?

### How?

Closes NEXT-
Fixes #



Closes WEB-1532
2023-09-15 17:41:05 +02:00
Andrew Clark
6f2e9aec21
Update React from dd480ef92 to d6dcad6a8. (#55399)
### React upstream changes:

- https://github.com/facebook/react/pull/27374
- https://github.com/facebook/react/pull/27369
- https://github.com/facebook/react/pull/27372
- https://github.com/facebook/react/pull/27371
- https://github.com/facebook/react/pull/27370
- https://github.com/facebook/react/pull/27321
- https://github.com/facebook/react/pull/27368
- https://github.com/facebook/react/pull/27367
- https://github.com/facebook/react/pull/27366
- https://github.com/facebook/react/pull/27360
- https://github.com/facebook/react/pull/27361
- https://github.com/facebook/react/pull/27357
- https://github.com/facebook/react/pull/27359
- https://github.com/facebook/react/pull/27358
- https://github.com/facebook/react/pull/27330
- https://github.com/facebook/react/pull/27347
- https://github.com/facebook/react/pull/27307
- https://github.com/facebook/react/pull/27346
- https://github.com/facebook/react/pull/27342
- https://github.com/facebook/react/pull/27340
- https://github.com/facebook/react/pull/27328
- https://github.com/facebook/react/pull/27327
- https://github.com/facebook/react/pull/27325
- https://github.com/facebook/react/pull/27337
- https://github.com/facebook/react/pull/27336
- https://github.com/facebook/react/pull/27323
- https://github.com/facebook/react/pull/27320
- https://github.com/facebook/react/pull/27317
- https://github.com/facebook/react/pull/27318
- https://github.com/facebook/react/pull/27316
- https://github.com/facebook/react/pull/27313
- https://github.com/facebook/react/pull/27309
- https://github.com/facebook/react/pull/27302
- https://github.com/facebook/react/pull/27297
- https://github.com/facebook/react/pull/27295
- https://github.com/facebook/react/pull/27305
- https://github.com/facebook/react/pull/27215
- https://github.com/facebook/react/pull/27304
- https://github.com/facebook/react/pull/27067
- https://github.com/facebook/react/pull/27179
- https://github.com/facebook/react/pull/27278
- https://github.com/facebook/react/pull/27277
- https://github.com/facebook/react/pull/27282
- https://github.com/facebook/react/pull/27230
- https://github.com/facebook/react/pull/27260
- https://github.com/facebook/react/pull/27270
- https://github.com/facebook/react/pull/27273
- https://github.com/facebook/react/pull/27268
- https://github.com/facebook/react/pull/27269
2023-09-14 17:42:33 +00:00
OJ Kwon
92e1b3fef9
test(fixture): improve finding ports to reduce flaky (#55151)
### What

Found a flaky test like https://github.com/vercel/next.js/actions/runs/6125719281/job/16628276301?pr=55118#step:29:174, `get-port` throws by port is not available. Peeking bit, there seems an upstream fix hope to improve the situation but unfortunately it happened after get-port switched to native esm only, so bumping is non trivial work. Instead adapting get-port-please as a replacwement but leave get-port as fallback for a while to verify its stability. Once we are certain, we can remove old get-port entirely.
2023-09-11 21:48:29 +00:00
Balázs Orbán
068002bb3a
chore: upgrade to TypeScript 5.2.2 (#55105)
### What?

Upgrade TypeScript to the latest version as of this PR. **This does not affect users, as the change is only for our repository.**

### Why?

Part of some upcoming PRs to try to clean up cookie handling, now that `getSetCookie` is available. Since we use `undici`, which [implements it](https://github.com/nodejs/undici/pull/1915), we can get rid of some code to rely more on the platform.

This PR is needed to get the types for `Headers#getSetCookie` which was added in 5.2

### How?

I needed to update some dependency types to get build to pass, but other than that, only needed to bump from `5.1.6` to `5.2.2`, so hopefully all is fine.
2023-09-07 18:46:05 +00:00
Ryota Murakami
7decb13000
chore(ci): bump pnpm v8.6.11 to v8.7.1 (#54873)
My "pnpm@v8.7.0" was not working and I noticed it by accident and sent a PR.

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-09-06 00:39:44 +00:00
Damien Simonin Feugas
3338dd0b31
fix(next-swc): skips client/server only checks when running with Jest to unblock testing (#54891)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-09-04 13:53:41 +02:00
Jiachi Liu
1be02e36fe
Update @vercel/og to latest (#54849)
Upgrade `@vercel/og` to `0.5.12` and satori to the corresponding version
2023-08-31 17:17:07 +00:00
Kiko Beats
08b117ac5c
upgrade Edge Runtime dependency (#54489) 2023-08-24 11:00:31 +00:00
Jiachi Liu
9834ab7e15
Fix not found css not being preloaded while navigation (#53906)
### Problem

One style of `not-found` has `precendence` property with "undefined" value, which can't be handled by React Float, then during navigation the style could not load properly, lead to the style missing in issue #53210.

### Solution

Always enable `precendence` for all links, so all the css styles of page and convention components can be hoist by react properly. Float will decide which one should be handled. Previously this change only applies to template, actually we can apply it to all components so that they can all be handled properly especially during client navigation.

Related react change: https://github.com/facebook/react/pull/27265
Fixes #53210
2023-08-23 13:07:30 +00:00
Jiachi Liu
6d769d0eb8
Upgrade vendored react (#54399)
### React upstream changes

- https://github.com/facebook/react/pull/27265
- https://github.com/facebook/react/pull/27259
- https://github.com/facebook/react/pull/27264
- https://github.com/facebook/react/pull/27257
- https://github.com/facebook/react/pull/27258
- https://github.com/facebook/react/pull/27187
- https://github.com/facebook/react/pull/27243
- https://github.com/facebook/react/pull/27205
- https://github.com/facebook/react/pull/27220
- https://github.com/facebook/react/pull/27238
- https://github.com/facebook/react/pull/27234
- https://github.com/facebook/react/pull/27224
- https://github.com/facebook/react/pull/27223
- https://github.com/facebook/react/pull/27222

This will help unblock https://github.com/vercel/next.js/pull/53906
2023-08-22 22:27:54 +00:00
Jiachi Liu
311eea4c6a
Fix emotion-js transform for server components (#54284)
### What & Why

emotion-js has its own [jsx transform](https://emotion.sh/docs/typescript#emotionreact) which is being applied when `compiler.emotion` is enabled in `next.config.js`.

Thanks to emotion-js team that provided an emotion-js example setup with app router [here](https://github.com/emotion-js/emotion/issues/2928#issuecomment-1319792703), so that we can use it as test example with app router. Based on the setup, we create a test case working with emotion js but failed with error mentioned in #41994 that some client hooks appearing in server components. That is because the emotion-js jsx factory includes some client hooks.

### How

For server components, css-in-js is not recommended to apply so we disabled the transform before, the emotion jsx factory is a separate config that should also not be applied in server components. So in this case we still use react jsx factory instead of the emotion-js one for server components then it won't error. The test case can also be used as an example for basic emotion-js use case with app router.


Fixes #41994
Closes NEXT-1368
2023-08-20 03:14:16 +00:00
Tim Neutkens
819a163fce
Update dd-trace used for internal tools (#54214)
This is only used for internal tools 👍
2023-08-18 13:55:22 +00:00
Kiko Beats
b676fce090
upgrade edge-runtime dependency (#54117)
Hello,

This PR upgrades `edge-runtime` and associated packages, mostly fixing issues.
2023-08-16 13:57:01 +00:00
Josh Story
2b38118ea0
Update React ot latest canary (#53881)
Updated React from cb3404a0c to f359f9b41.

### React upstream changes

- https://github.com/facebook/react/pull/27191
- https://github.com/facebook/react/pull/27209
- https://github.com/facebook/react/pull/27199
- https://github.com/facebook/react/pull/27218
- https://github.com/facebook/react/pull/27217
- https://github.com/facebook/react/pull/27212
2023-08-12 17:20:14 +00:00
Dima Voytenko
4c14482553
[chore] Upgrade playwright to 1.35.1 (#53875) 2023-08-11 23:25:01 +00:00
Josh Story
f0dab3a8da
update vendored React packages to the the latest canary (#53742)
Updated React from 9377e1010 to cb3404a0c.

### React upstream changes

- https://github.com/facebook/react/pull/27190
- https://github.com/facebook/react/pull/27189
- https://github.com/facebook/react/pull/27201
- https://github.com/facebook/react/pull/27147
- https://github.com/facebook/react/pull/26949
- https://github.com/facebook/react/pull/27058
- https://github.com/facebook/react/pull/27142
- https://github.com/facebook/react/pull/27133
- https://github.com/facebook/react/pull/27130
- https://github.com/facebook/react/pull/27105
- https://github.com/facebook/react/pull/27117
- https://github.com/facebook/react/pull/27057
2023-08-08 20:16:24 +00:00
Thomas Knickman
3db5c16546
fix(node): pnpm 8.6 needs node 16.14 (#53677)
The `pnpm` version was recently updated to `8.6`, however the node version was left at `16.8`. `pnpm@8.6` requires at least `node@16.14` ([source](https://github.com/pnpm/pnpm/blob/main/pnpm/package.json#L145)).

This fixes the engines spec to avoid conflicting versions.
2023-08-07 15:15:26 +00:00
JJ Kasper
6483903372
Add update fonts workflow (#53645)
This adds a workflow to auto update our fonts data so we can stay up to date easier. 

Closes: https://github.com/vercel/next.js/pull/53246
Closes: https://github.com/vercel/next.js/pull/53510
2023-08-07 00:11:03 +00:00
JJ Kasper
7bf3d77b5e
Revert "Implement new forking technique for vendored packages. (#51083)" (#53640)
This reverts commit e06880ea4c.

reverts: https://github.com/vercel/next.js/pull/51083

x-ref: [slack
thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1691349686136519)
x-ref: [slack
thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1691349579712979?thread_ts=1691217652.833079&cid=C03S8ED1DKM)
2023-08-06 13:00:12 -07:00
Josh Story
e06880ea4c
Implement new forking technique for vendored packages. (#51083)
## Vendoring

Updates all module resolvers (node, webpack, nft for entrypoints, and nft for next-server) to consider whether vendored packages are suitable for a given resolve request and resolves them in an import semantics preserving way.

### Problem

Prior to the proposed change, vendoring has been accomplished but aliasing module requests from one specifier to a different specifier. For instance if we are using the built-in react packages for a build/runtime we might replace `require('react')` with `require('next/dist/compiled/react')`.

However this aliasing introduces a subtle bug. The React package has an export map that considers the condition `react-server` and when you require/import `'react'` the conditions should be considered and the underlying implementation of react may differ from one environment to another. In particular if you are resolving with the `react-server` condition you will be resolving the `react.shared-subset.js` implementation of React. This aliasing however breaks these semantics because it turns a bare specifier resolution of `react` with path `'.'` into a resolution with bare specifier `next` with path `'/dist/compiled/react'`. Module resolvers consider export maps of the package being imported from but in the case of `next` there is no consideration for the condition `react-server` and this resolution ends up pulling in the `index.js` implementation inside the React package by doing a simple path resolution to that package folder.

To work around this bug there is a prevalence of encoding the "right" resolution into the import itself. We for instance directly alias `react` to `next/dist/compiled/react/react.shared-subset.js` in certain cases. Other times we directly specify the runtime variant for instance `react-server-dom-webpack/server.edge` rather than `react-server-dom-wegbpack/server`, bypassing the export map altogether by selecting the runtime specific variant. However some code is meant to run in more than one runtime, for instance anything that is part of the client bundle which executes on the server during SSR and in the browser. There are workaround like using `require` conditionally or `import(...)` dynamically but these all have consequences for bundling and treeshaking and they still require careful consideration of the environment you are running in and which variant needs to load.

The result is that there is a large amount of manual pinning of aliases and additional complexity in the code and an inability to trust the package to specify the right resolution potentially causing conflicts in future versions as packages are updated.

It should be noted that aliasing is not in and of itself problematic when we are trying to implement a sort of lightweight forking based on build or runtime conditions. We have good examples of this for instance with the `next/head` package which within App Router should export a noop function. The problem is when we are trying to vendor an entire package and have the package behave semantically the same as if you had installed it yourself via node_modules

### Solution

The fix is seemingly straight forward. We need to stop aliasing these module specifiers and instead customize the resolution process to resolve from a location that will contain the desired vendored packages. We can then start simplifying our imports to use top level package resources and generally and let import conditions control the process of providing the right variant in the right context.

It should be said that vendoring is conditional. Currently we only vendor react pacakges for App Router runtimes. The implementation needs to be able to conditionally determine where a package resolves based on whether we're in an App Router context vs a Page Router one.

Additionally the implementation needs to support alternate packages such as supporting the experimental channel for React when using features that require this version.

### Implementation

The first step is to put the vendored packages inside a node_modules folder. This is essential to the correct resolving of packages by most tools that implement module resolution. For packages that are meant to be vendored, meaning whole package substitution we move the from `next/(src|dist)/compiled/...` to `next/(src|dist)/vendored/node_modules`. The purpose of this move is to clarify that vendored packages operate with a different implementation. This initial PR moves the react dependencies for App Router and `client-only` and `server-only` packages into this folder. In the future we can decide which other precompiled dependencies are best implemented as vendored packages and move them over.

It should be noted that because of our use of `JestWorker` we can get warnings for duplicate package names so we modify the vendored pacakges for react adding either `-vendored` or `-experimental-vendored` depending on which release channel the package came from. While this will require us to alter the request string for a module specifier it will still be treating the react package as the bare specifier and thus use the export map as required.

#### module resolvers
The next thing we need to do is have all systems that do module resolution implement an custom module resolution step. There are five different resolvers that need to be considered

##### node runtime
Updated the require-hook to resolve from the vendored directory without rewriting the request string to alter which package is identified in the bare specifier. For react packages we only do this vendoring if the `process.env.__NEXT_PRIVATE_PREBUNDLED_REACT` envvar is set indicating the runtime is server App Router builds. If we need a single node runtime to be able to conditionally resolve to both vendored and non vendored versions we will need to combine this with aliasing and encode whether the request is for the vendored version in the request string. Our current architecture does not require this though so we will just rely on the envvar for now

##### webpack runtime
Removed all aliases configured for react packages. Rely on the node-runtime to properly alias external react dependencies. Add a resolver plugin `NextAppResolverPlugin` to preempt perform resolution from the context of the vendored directory when encountering a vendored eligible package.

##### turbopack runtime
updated the aliasing rules for react packages to resolve from the vendored directory when in an App Router context. This implementation is all essentially config b/c the capability of doing the resolve from any position (i.e. the vendored directory) already exists

##### nft entrypoints runtime
track chunks to trace for App Router separate from Pages Router. For the trace for App Router chunks use a custom resolve hook in nft which performs the resolution from the vendored directory when appropriate.

##### nft next-server runtime
The current implementation for next-server traces both node_modules and vendored version of packages so all versions are included. This is necessary because the next server can run in either context (App vs Page router) and may depend on any possible variants. We could in theory make two traces rather than a combined one but this will require additional downstream changes so for now it is the most conservative thing to do and is correct

Once we have the correct resolution semantics for all resolvers we can start to remove instances targeting our precompiled instances for instance making `import ... from "next/dist/compiled/react-server-dom-webpack/client"` and replacing with `import ... from "react-server-dom-webpack/client"`

We can also stop requiring runtime specific variants like `import ... from "react-server-dom-webpack/client.edge"` replacing it with the generic export `"react-server-dom-webpack/client"`

There are still two special case aliases related to react
1. In profiling mode (browser only) we rewrite `react-dom` to `react-dom/profiling` and `scheduler/tracing` to `scheduler/tracing-profiling`. This can be moved to using export maps and conditions once react publishses updates that implement this on the package side.
2. When resolving `react-dom` on the server we rewrite this to `react-dom/server-rendering-stub`. This is to avoid loading the entire react-dom client bundle on the server when most of it goes unused. In the next major react will update this top level export to only contain the parts that are usable in any runtime and this alias can be dropped entirely

There are two non-react packages currently be vendored that I have maintained but think we ought to discuss the validity of vendoring. The `client-only` and `server-only` packages are vendored so you can use them without having to remember to install them into your project. This is convenient but does perhaps become surprising if you don't realize what is happening. We should consider not doing this but we can make that decision in another discussion/PR.

#### Webpack Layers
One of the things our webpack config implements for App Router is layers which allow us to have separate instances of packages for the server components graph and the client (ssr) graph. The way we were managing layer selection was a but arbitrary so in addition to the other webpack changes the way you cause a file to always end up in a specific layer is to end it with `.serverlayer`, `.clientlayer` or `.sharedlayer`. These act as layer portals so something in the server layer can import `foo.clientlayer` and that module will in fact be bundled in the client layer.

#### Packaging Changes
Most package managers are fine with this resolution redirect however yarn berry (yarn 2+ with PnP) will not resolve packages that are not defined in a package.json as a dependency. This was not a problem with the prior strategy because it was never resolving these vendored packages it was always resolving the next package and then just pointing to a file within it that happened to be from react or a related package.

To get around this issue vendored packages are both committed in src and packed as a tgz file. Then in the next package.json we define these vendored packages as `optionalDependency` pointing to these tarballs. For yarn PnP these packed versions will get used and resolved rather than the locally commited src files. For other package managers the optional dependencies may or may not get installed but the resolution will still resolve to the checked in src files. This isn't a particularly satisfying implemenation and if pnpm were to be updated to have consistent behavior installing from tarballs we could actually move the vendoring entirely to dependencies and simplify our resolvers a fair bit. But this will require an upstream chagne in pnpm and would take time to propogate in the community since many use older versions

#### Upstream Changes

As part of this work I landed some other changes upstream that were necessary. One was to make our packing use `npm` to match our publishing step. This also allows us to pack `node_modules` folders which is normally not supported but is possible if you define the folder in the package.json's files property.

See: #52563

Additionally nft did not provide a way to use the internal resolver if you were going to use the resolve hook so that is now exposed

See: https://github.com/vercel/nft/pull/354

#### additional PR trivia
* When we prepare to make an isolated next install for integration tests we exclude node_modules by default so we have a special case to allow `/vendored/node_modules`

* The webpack module rules were refactored to be a little easier to reason about and while they do work as is it would be better for some of them to be wrapped in a `oneOf` rule however there is a bug in our css loader implementation that causes these oneOf rules to get deleted. We should fix this up in a followup to make the rules a little more robuts.


## Edits
* I removed `.sharedlayer` since this concept is leaky (not really related to the client/server boundary split) and it is getting refactored anyway soon into a precompiled runtime.
2023-08-04 23:47:10 +00:00
Leah
542c4fc26a
chore: update to pnpm@8.6.11 (#50923)
https://github.com/pnpm/pnpm/releases/tag/v8.0.0
2023-08-04 19:40:20 +00:00
Steven
8c6da3f72d
chore(test): move build-spinners node-pty test to isolated (#53408)
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-08-01 00:30:22 +00:00