Commit graph

545 commits

Author SHA1 Message Date
JJ Kasper
af64047d99 v13.3.1-canary.11 2023-04-17 22:40:37 +00:00
Connor Prussin
a92c5465ca
Make jest config serializable (#47620)
### What?

This PR ensures the jest configuration is json-serializable. It also
adds a bunch of typescript types.

### Why?

Jest requires that the configuration be json-serializable. See #47407
for details on the issues caused when it isn't. However, prior to this
commit, we were passing the entire next config as a property in the swc
jest transformer options. The next config includes some fields that are
not serializable, such as some functions.

### How?

In this PR we instead pluck the fields out of the next config that we
actually need and pass only those into the swc transformer.

This PR also adds a bunch of more precise typescript types where we were
previously just using `any`. This helps confirm that the configs are
being threaded through correctly. I think this type safety is enough to
confirm this commit and adding tests would just be redundant.

Closes NEXT-901
Fixes #47407
fix NEXT-901 ([link](https://linear.app/vercel/issue/NEXT-901))

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-04-17 18:52:52 +00:00
JJ Kasper
e329b31d90 v13.3.1-canary.10 2023-04-17 17:04:11 +00:00
Tobias Koppers
6be8c59075
app dir fixes (#48025)
### What?

* fix app dir chunking
* fix app dir 404s
* improve app dir performance
* rerender shadowportal on errors to re-add nextjs-portal to avoid empty
page
* inject polyfills before user code
* fix manifest generation

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

### Why?

App dir was very slow and lead to 404 errors

### How?

add included metadata to chunks to allow deduplicate chunk loads at
runtime
2023-04-17 17:58:33 +02:00
JJ Kasper
bc5be2f76c v13.3.1-canary.9 2023-04-17 13:46:08 +00:00
Shu Ding
f6604d4afe
Revert "Re-land "Vendor react@experimental under an experimentalReact flag"" (#48478)
Reverts vercel/next.js#48041
fix NEXT-926
2023-04-17 15:00:02 +02:00
JJ Kasper
20c5a23a90 v13.3.1-canary.8 2023-04-15 15:24:28 +00:00
Tobias Koppers
51defb249a
provide the PORT env var based on server port, update turbopack (#48347)
### What?

gives user code access to `process.env.PORT` as current server port
avoid injecting env vars into code on server

### Why?

it might need construct an addr to fetch from api routes

fixes WEB-868

### Turbopack changes

* https://github.com/vercel/turbo/pull/4565 <!-- Tobias Koppers - Bind
to IPv6 and IPv4 -->
* https://github.com/vercel/turbo/pull/4570 <!-- Tobias Koppers - review
follow ups -->
* https://github.com/vercel/turbo/pull/4585 <!-- Tobias Koppers - fixup
bind v6 PR: add missing listen call -->
* ~https://github.com/vercel/turbo/pull/4546~ <!-- Alex Kirszenberg -
Chunking Context Refactor pt. 3: Address PR comments from pt. 2 -->
* https://github.com/vercel/turbo/pull/4580 <!-- Tobias Koppers - remove
circular dependency -->
* https://github.com/vercel/turbo/pull/4582 <!-- Tobias Koppers - ignore
internal and server-relative url() in CSS -->
* https://github.com/vercel/turbo/pull/4579 <!-- Tobias Koppers - make
node bootstrap asset lazy -->
* https://github.com/vercel/turbo/pull/4581 <!-- Tobias Koppers - allow
to create stress test for client components -->
* https://github.com/vercel/turbo/pull/4584 <!-- Tobias Koppers -
improve node.js receive timeout -->
* https://github.com/vercel/turbo/pull/4583 <!-- Tobias Koppers - remove
panic since this might happen due to eventual consistency -->

fixes WEB-871
2023-04-14 23:04:14 +02:00
JJ Kasper
54fb4b6e0b v13.3.1-canary.7 2023-04-14 17:02:43 +00:00
JJ Kasper
557084a331
Fix fetch cache body handling and update edge-runtime deps (#48365)
This ensures we don't fail to return the full body when storing to
fetch-cache in edge-runtime. Also ensures the fetch cache tests are
running for Node.js v16 correctly.

Fetch handling was also failing on Node.js v16 due to react's use of
`res.clone()` being broken with undici which is fixed in the latest
version of edge-runtime so this bumps that.

x-ref: [slack
thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1681310566927429)
2023-04-13 22:00:20 -07:00
Tobias Koppers
d4d779145c
refactor shared logic for turbopack-cli (#48307)
### What?

* move some shared runtime logic to turbopack
* use relative imports from internal code when possible
* move react-refresh logic to turbopack
* move benchmark code logic to turobpack

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

### Why?

We want to have benchmarking again for turbopack PRs
We want to have a standalone turbopack cli (eventually)
We want to avoid duplicating the runtime code

### How?

refactoring, moving code
2023-04-13 14:54:34 +02:00
JJ Kasper
e8f6ddcae8 v13.3.1-canary.6 2023-04-13 01:22:55 +00:00
JJ Kasper
8273ba5660 v13.3.1-canary.5 2023-04-12 13:16:22 +00:00
Alex Kirszenberg
ce42173eae
Chunking Refactor pt. 2 (#47961)
See https://github.com/vercel/turbo/pull/4450

This PR updates Turbopack to turbopack-230411.2:

## Miscellaneous

* https://github.com/vercel/turbo/pull/4450 <!-- Alex Kirszenberg -
Chunking Refactor pt. 2 -->
2023-04-11 11:08:37 -07:00
JJ Kasper
b896a12867 v13.3.1-canary.4 2023-04-10 17:07:34 +00:00
Shu Ding
9c0e520896
Re-land "Vendor react@experimental under an experimentalReact flag" (#48041)
Reverts vercel/next.js#48038

fix NEXT-926

---

The root cause was that when copying the package.json, I removed all
fields except for a few (such as `exports`) but missed the `browser`
field. That caused the client bundle to resolve to the Node.js version
of React DOM, and then we had the `async_hooks` error. Added it back in
99c9b9e51f8b0d4e4503ece9d07bce09161f3341.

I reproduced the error with next-site earlier and confirmed that this
fix is good.
2023-04-08 17:16:24 +02:00
JJ Kasper
2bcdfbb6ab v13.3.1-canary.3 2023-04-08 01:47:09 +00:00
JJ Kasper
b5f785aab1 v13.3.1-canary.2 2023-04-07 18:04:26 +00:00
JJ Kasper
0097c12a92 v13.3.1-canary.1 2023-04-07 13:29:08 +00:00
JJ Kasper
883933b6c5 v13.3.1-canary.0 2023-04-07 03:15:57 +00:00
Justin Ridgewell
8d3e42e556
turbopack: bind server to IPv6 loopback (#47948)
This accomplishes 2 things:
1. binds the turbopack dev server to the IPv6 unspecified address
2. initializes our router with the same hostname/port of the turobpack
server

The first matches the behavior of the Node.js dev server. The IPv6
unspecified address is similar to IPv4's `0.0.0.0` address, allowing us
to accept connection from anywhere. Importantly, it _also_ allows
accepting IPv4 connections, making this address truly universal.

The second means the `request` parameter to any middleware will have the
correct origin, and the request's URL can be used to craft fetch
requests to API endpoints. `new URL(req.url).origin` will be the origin
of the turbopack dev server.

Fixes https://github.com/vercel/turbo/issues/4456
Fixes WEB-855
2023-04-06 17:58:26 -07:00
JJ Kasper
79031e608a
v13.3.0 2023-04-06 13:47:03 -07:00
JJ Kasper
b8e7646fdc v13.2.5-canary.34 2023-04-06 19:48:01 +00:00
JJ Kasper
9448913149
Revert "Vendor react@experimental under an experimentalReact flag" (#48038)
x-ref: [slack
thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1680804950611789?thread_ts=1680791613.468109&cid=C04DUD7EB1B)

Reverts vercel/next.js#47759
fix NEXT-926
2023-04-06 11:48:09 -07:00
JJ Kasper
200e83245c v13.2.5-canary.33 2023-04-06 14:52:28 +00:00
JJ Kasper
5eec452f78 v13.2.5-canary.32 2023-04-06 06:23:44 +00:00
JJ Kasper
be2237fc92 v13.2.5-canary.31 2023-04-05 23:30:33 +00:00
Shu Ding
89b4605f1a
Vendor react@experimental under an experimentalReact flag (#47759)
Next.js includes various feature sets that depend on specific release
channels of React. However, our current setup only includes the `next`
channel of React, which restricts our ability to integrate with features
available on the `experimental` channel.

To address this limitation, this pull request introduces the following
changes:
- Vendors the `react@experimental` version, along with the corresponding
`react-dom` and `scheduler` packages.
- Modifies the `sync-react` script to also update the `experimental`
channel and removes `--version` as they're always synced to the latest
now.
- Retains the default behavior of using the `next` channel in the
`appDir` directory.
- Adds an option to switch to the `experimental` channel by setting
`experimental.experimentalReact: true` in the configuration.

fix NEXT-926 ([link](https://linear.app/vercel/issue/NEXT-926))
2023-04-05 14:05:47 +00:00
JJ Kasper
95ca6f48c6 v13.2.5-canary.30 2023-04-04 19:41:51 +00:00
JJ Kasper
43ff6cfd99 v13.2.5-canary.29 2023-04-04 13:44:22 +00:00
Shu Ding
a22d6a181e
Change package path from gitpkg.now.sh to gitpkg.vercel.app (#47879)
Avoids a couple of hops when installing packages as `.now.sh` returns a
redirection.
2023-04-03 17:21:15 -07:00
JJ Kasper
e034df0b13 v13.2.5-canary.28 2023-04-03 07:16:33 +00:00
JJ Kasper
26e8197d7b v13.2.5-canary.27 2023-04-02 13:22:34 +00:00
JJ Kasper
c1a2b4f15e v13.2.5-canary.26 2023-04-02 06:31:25 +00:00
JJ Kasper
7c189c5c08 v13.2.5-canary.25 2023-04-01 03:32:33 +00:00
JJ Kasper
f798c95f72 v13.2.5-canary.24 2023-03-31 20:58:12 +00:00
JJ Kasper
f090f321ee v13.2.5-canary.23 2023-03-31 13:53:10 +00:00
Jiachi Liu
d71cbe9116
Vendor @vercel/og and expose ImageResponse (#47715)
- Reverts #47711 
- Disable image response for turbopack
2023-03-31 02:29:10 +00:00
JJ Kasper
a6e504933b v13.2.5-canary.22 2023-03-31 00:57:10 +00:00
JJ Kasper
2ac022391c
Revert "Vendor @vercel/og and expose ImageResponse (#47657" (#47711)
Reverts vercel/next.js#47657
2023-03-30 12:24:02 -07:00
Shu Ding
6eaca5d5b2
Revert "Revert "Update vendored react to 18.3.0-next-85de6fde5-20230328"" (#47700
Reverts vercel/next.js#47687
2023-03-30 19:40:13 +02:00
Jiachi Liu
99cdb36663
Vendor @vercel/og and expose ImageResponse (#47657
### What?

This PR vendors @vercel/og and export `ImageResponse` from
`next/server`. When you render a opengraph image the below code snippets
will be legit:

```tsx
import { ImageResponse } from 'next/server'

export default function og() {
  return new ImageResponse(<div style={{ width: '100%', height: '100%' }}>hello</div>)
}
```

### Why?

To make development more easier, user can directly use `@vercel/og`
Image Response with nextjs instead of install it and use it. This makes
building metadata icons, og or twitter images more convenient.

### How?

Closes NEXT-899
2023-03-30 13:06:30 +02:00
Shu Ding
90922acd73
Revert "Update vendored react to 18.3.0-next-85de6fde5-20230328" (#47687)
Reverts vercel/next.js#47675
2023-03-30 11:06:04 +00:00
JJ Kasper
4803102a24 v13.2.5-canary.21 2023-03-30 05:16:37 +00:00
Jiachi Liu
0a94e2221f
Update vendored react to 18.3.0-next-85de6fde5-20230328 (#47675)
Changelog from react side

```
-  85de6fde5 Refactor DOM special cases per tags including controlled fields (#26501) (Sebastian Markbåge)
-  5cbe6258b Remove unnecessary CIRCLE_CI_API_TOKEN checks (#26499) (Mengdi Chen)
-  1f5cdf8c7 Update Suspense fuzz tests to use `act` (#26498) (Andrew Clark)
-  f62cb39ee Make disableSchedulerTimeoutInWorkLoop a static ff (#26497) (Ricky)
-  f71819931 [DevTools] browser extension: improve script injection logic (#26492) (Mengdi Chen)
-  41b4714f1 Remove disableNativeComponentFrames (#26490) (Ricky)
-  fc90eb636 Codemod more tests to waitFor pattern (#26494) (Andrew Clark)
-  e0bbc2662 Improve tests that deal with microtasks (#26493) (Andrew Clark)
-  8faf75193 Codemod some expiration tests to waitForExpired (#26491) (Andrew Clark)
-  8342a0992 Remove unused feature flag disableSchedulerTimeoutBasedOnReactExpirationTime (#26488) (Jan Kassens)
-  afea1d0c5 [flow] make Flow suppressions explicit on the error (#26487) (Jan Kassens)
-  768f965de Suspensily committing a prerendered tree (#26434) (Andrew Clark)
-  d12bdcda6 Fix Flow types of useEffectEvent (#26468) (Sebastian Silbermann)
-  73b6435ca [Float][Fiber] Implement waitForCommitToBeReady for stylesheet resources (#26450) (Josh Story)
-  175962c10 Fix remaining CommonJS imports after Rollup upgrade (#26473) (dan)
-  3fcf209ea React DevTools 4.27.3 -> 4.27.4 (#26470) (Mengdi Chen)
-  bde974ae4 [DevTools] missing file name in package.json (#26469) (Mengdi Chen)
-  909c6dacf Update Rollup to 3.x (#26442) (Mark Erikson)
-  9c54b29b4 Remove ReactFabricPublicInstance and used definition from ReactNativePrivateInterface (#26437) (Rubén Norte)
-  f77099b6f Remove layout effect warning on the server (#26395) (Ricky)
-  51a7c45f8 Bugfix: SuspenseList incorrectly forces a fallback (#26453) (Andrew Clark)
-  afb3d51dc Fix enableClientRenderFallbackOnTextMismatch flag (#26457) (Sebastian Markbåge)
-  8e17bfd14 Make InternalInstanceHandle type opaque in ReactNativeTypes (#26461) (Rubén Norte)
-  8bdf162bc React DevTools 4.27.2 -> 4.27.3 (#26459) (Mengdi Chen)
-  b93b4f074 Should not throw for children of iframe or object (#26458) (Sebastian Markbåge)
-  c0b34bc5f chore: update links of docs and api (#26455) (Leedom)
-  56f7a90e6 chore: update new docs links for react-dom (#26456) (Leedom)
-  bd5e32309 Small Flow upgrade to 0.202.0 (#26435) (Jan Kassens)
-  ffb6733ee fix docs link for useSyncExternalStore (#26452) (Valor(华洛))
-  0018cf224 Add REVISION file to react-fbsource-import (#26448) (Samuel Susla)
```

Also merge react and react-server-dom-webpack vendor job into one
2023-03-29 23:21:33 +00:00
Tobias Koppers
18131c7dab v13.2.5-canary.20 2023-03-28 08:18:00 +00:00
JJ Kasper
53bcdea01c v13.2.5-canary.19 2023-03-27 07:05:28 +00:00
Janicklas Ralph
83c2a3f09c
Integrating capsize latest (#47428)
Integrating capsize latest

<!-- 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 or adding/fixing 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-03-26 20:29:28 -07:00
JJ Kasper
bd8ba61bca
Update release package.json scripts (#47529)
We should no longer be starting releases from local and instead use the
GH action so this updates the scripts to point to there.
2023-03-25 12:59:51 -07:00
Tim Neutkens
266fd1cd67 v13.2.5-canary.18 2023-03-25 20:39:25 +01:00