Commit graph

10182 commits

Author SHA1 Message Date
Wyatt Johnson
40dd14ff98
Handle Promise Rejections for Streams (#56976)
This handles the promise rejection for chained streams better and the other case in the server setup when `prepre()` is fired off early.
2023-10-18 20:25:57 +00:00
leung018
66597be8a7
Add .yarn/install-state.gz to .gitignore (#56637)
### Reason for making this change
https://yarnpkg.com/getting-started/qa#:~:text=yarn%2Finstall%2Dstate.,your%20workspaces%20all%20over%20again.
In the official documentation of `yarn`, it is stated that `.yarn/install-state.gz` is an optimization file that developer shouldn't ever have to commit. However, currently, when running `create-next-app`, `.yarn/install-state.gz` is being commited.

### Remaining work
I apologize for only modifying one template initially to initiate the discussion first.

If this change is agreed upon,  it should be synchronized with other `.gitignore` templates. Would it be possible to follow a similar approach as in https://github.com/vercel/next.js/pull/47241? I would appreciate any assistance in syncing this change.
2023-10-18 16:34:48 +00:00
Zack Tanner
c2ac8df073
add better logs around worker restarts (#57004)
We currently log when a worker is restarted but not when we send the kill signal, which can create a delta in logs of cryptic errors while the worker is exiting. This explicitly logs when we're terminating the static worker prior to a restart, and also adds an optional logger fn so that we pretty-print the messages. 

[slack x-ref](https://vercel.slack.com/archives/C061DJBG8PN/p1697491350970269)
2023-10-18 16:11:40 +00:00
vercel-release-bot
2c8606e596 v13.5.6-canary.6 2023-10-18 06:59:43 +00:00
Shu Ding
63284721be
Add @mui/icons-material to the default optimizePackageImports list (#56801)
Feedback from https://twitter.com/younguyen95/status/1712850891521568896. Tested locally.
2023-10-18 06:31:38 +00:00
Tobias Koppers
607ba02a26
Reland "feat(turbopack): support basic next/dynamic" (#56934)
This reverts commit 8a51ebcb67.

### What?

see #56389 


Closes WEB-1791
2023-10-18 02:53:40 +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
xiaolou86
b95474a9d2
fix typos (#56870) 2023-10-18 00:46:47 +00:00
vercel-release-bot
318cbbf9b1 v13.5.6-canary.5 2023-10-17 23:22:33 +00:00
vercel-release-bot
f19dabbc6d v13.5.6-canary.4 2023-10-17 21:22:19 +00:00
Balázs Orbán
523474c8be
chore: lower Node.js version requirement (#56943) 2023-10-17 23:15:31 +02:00
Steven
3a459ca986
chore(next/image)!: mark onLoadingComplete as deprecated in favor of onLoad (#56944)
## History

We used to pass `onLoad` through directly to the underlying img so `onLoadingComplete` was introduced in order to handle the case when `placeholder="blur"` was used and `onLoad` would trigger before the placeholder was removed.

We have since changed the behavior of `onLoad` so that it acts the same as `onLoadingComplete` and therefore `onLoadingComplete` is no longer needed.

## What is this PR doing?

This PR marks `onLoadingComplete` as deprecated in favor of `onLoad`. In the future, we may remove `onLoadingComplete`.
2023-10-17 21:12:22 +00:00
Wyatt Johnson
255cc9b9a7
Replace Promise.withResolvers polyfill with DetachedPromise (#56954)
In an attempt to avoid introducing experimental features into the Next.js userland space, we're reverting the `Promise.withResolvers` polyfill and preferring an internal `DetachedPromise` interface.
2023-10-17 19:15:44 +00:00
Janicklas Ralph
5e474a3f19
Adding useGoogleTagManager hook to @next/third-parties (#56106)
This PR adds the `useGoogleTagManage` hook to `@next/third-parties` repo.
2023-10-17 18:04:53 +00:00
vercel-release-bot
df1d4a16aa v13.5.6-canary.3 2023-10-17 16:36:35 +00:00
Jimmy Lai
451a54cb2e
cache: add unstable_noStore API (#56930)
This PR introduces a new API, `unstable_noStore`, which will allow users to declaratively opt out of caching anywhere during static generation in the same way that you can specify `cache: 'no-store'` on a fetch call in Next.js.

An important caveat and difference from just calling `cookies()` to opt-out of static generation is that this won't opt you out when called from within `unstable_cache` and instead defers to the cache configuration to it.

```
import {unstable_noStore as noStore} from 'next/cache';

export default async function Component() {
  noStore();
  const result = await db.query(...);
}
```
2023-10-17 14:52:46 +00:00
dpnolte
218d0709eb
feat: set status code to 500 if unexpected error occurs before streaming in app router (#56236)
<!-- 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 #

-->

This PR therefore introduces to always set response status code to 500
unless it is a `NotFoundError` or `RedirectError`. This PR would fix
issue #56235. See also:
https://codesandbox.io/p/sandbox/nice-panini-2z3mcp .

**Current Behavior**
At the moment, when an unexpected error occurs during app server
rendering, a 200 ok is returned as status code. This seems to be
undesirable because of the success status CDNs will cache the error
pages and crawlers will index the page considering the error content as
the actual content.

**Desired Behavior**
This issue is related to discussion
https://github.com/vercel/next.js/discussions/53225. Even though I
understand that the response status code cannot be set if streaming has
started, in my view it would be best to set the response status to 500
whenever it can (so before the streaming has started) for SEO and (CDN)
http caching. This would also be consistent with how 404s currently
work; that is, response status code is set to 404 if `NotFoundError`
occurred before streaming (related
[issue](https://github.com/vercel/next.js/issues/43831) &
[PR](https://github.com/vercel/next.js/pull/55542)).

Ideally, when a runtime error happens after streaming, a `<meta
name="robots" content="noindex" />` would also be added. But I didn't
want to make the PR too complex before receiving feedback.

---------

Co-authored-by: Vũ Văn Dũng <me@joulev.dev>
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2023-10-17 15:32:20 +02:00
vercel-release-bot
ee9bee96af v13.5.6-canary.2 2023-10-17 13:26:58 +00:00
Donny/강동윤
4b3dfdaa95
build: Update swc_core to v0.86.1 (#56770)
### What?

Update SWC crates, to apply bugfixes.

### Why?

We adjusted the mangling option to make it identical with `swcMinify:
false` with https://github.com/vercel/next.js/pull/56281, and it
revealed some bugs of the name mangler of the SWC minifier.

### How?


 - Fixes #56550
 - Fixes #56614

 - Turbopack counterpart: https://github.com/vercel/turbo/pull/6171

### Other Turbopack Changes

* https://github.com/vercel/turbo/pull/6177 <!-- Tim Neutkens - Add
support for FreeVarReference::Error -->
* https://github.com/vercel/turbo/pull/6180 <!-- Tobias Koppers - fix
chunk loading in build runtime -->
* https://github.com/vercel/turbo/pull/6191 <!-- Justin Ridgewell -
Deduplicate referenced_output_assets -->
* https://github.com/vercel/turbo/pull/6171 <!-- Donny/강동윤 - build:
Update `swc_core` to `v0.86.1` -->

Closes WEB-1775

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2023-10-17 15:19:28 +02:00
Jimmy Lai
552b9747ff
perf: fix tracing for routes (#56924)
follow up to #56898 where I noticed that we don't apply any filtering to the trace files for the user routes, resulting in files that would need to be filtered like `caniuse` not being filtered out correctly. This fixes that.

A lambda in my test project goes from `2.7MB` to `1.4MB`

followup: add some snapshot tests

before
```
Serverless function size info
Serverless Function's pages: _not-found.js, index.js
Large Dependencies                                                     Uncompressed size  Compressed size
node_modules/.pnpm/next@13.5.6-canary.1_react-dom@18.2.0_react@18.2.0            4.61 MB          1.35 MB
node_modules/.pnpm/caniuse-lite@1.0.30001517                                   909.73 KB        327.14 KB
node_modules/.pnpm/react-dom@18.2.0_react@18.2.0                               546.21 KB        138.87 KB

All dependencies                                                                 3.66 MB          2.01 MB
Serverless Function's page: favicon.ico.js
Large Dependencies                                                     Uncompressed size  Compressed size
node_modules/.pnpm/next@13.5.6-canary.1_react-dom@18.2.0_react@18.2.0            6.71 MB          2.05 MB
node_modules/.pnpm/caniuse-lite@1.0.30001517                                   909.73 KB        327.14 KB
node_modules/.pnpm/react-dom@18.2.0_react@18.2.0                               546.21 KB        138.87 KB

All dependencies                                                                 5.78 MB          2.71 MB
Serverless Function's page: api/hello-world.js
Large Dependencies                                                     Uncompressed size  Compressed size
node_modules/.pnpm/next@13.5.6-canary.1_react-dom@18.2.0_react@18.2.0            4.61 MB          1.35 MB
node_modules/.pnpm/caniuse-lite@1.0.30001517                                   909.73 KB        327.14 KB
node_modules/.pnpm/react-dom@18.2.0_react@18.2.0                               546.21 KB        138.87 KB

All dependencies                                                                 3.65 MB          2.01 MB
```

after

```
Large Dependencies                                                                          Uncompressed size  Compressed size
node_modules/.pnpm/file+next-canary+next-13.5.6-canary.1.tgz_react-dom@18.2.0_react@18.2.0            2.87 MB         844.1 KB

All dependencies                                                                                    341.31 KB        992.45 KB
Serverless Function's page: favicon.ico.js
Large Dependencies                                                                          Uncompressed size  Compressed size
node_modules/.pnpm/file+next-canary+next-13.5.6-canary.1.tgz_react-dom@18.2.0_react@18.2.0            4.97 MB          1.52 MB

All dependencies                                                                                      2.45 MB          1.67 MB
Serverless Function's page: api/hello-world.js
Large Dependencies                                                                          Uncompressed size  Compressed size
node_modules/.pnpm/file+next-canary+next-13.5.6-canary.1.tgz_react-dom@18.2.0_react@18.2.0            2.87 MB         844.1 KB

All dependencies                                                                                    328.64 KB        989.23 KB
````
2023-10-17 09:09:40 +00: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
Juan Martín Seery
308a327923
feat(env): upgrade dotenv (#38481)
Upgraded dotenv to v16. Breaking changes are:

- Multiline parsing support
- Support inline comments
- Backtick support

[See their changelog](https://github.com/motdotla/dotenv/blob/master/CHANGELOG.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`


Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2023-10-17 00:57:51 +00:00
vercel-release-bot
24a146680f v13.5.6-canary.1 2023-10-16 23:24:30 +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
vercel-release-bot
3c7d15b992 v13.5.6-canary.0 2023-10-16 22:04:56 +00: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
Jimmy Lai
9fda481af1
perf: fix server trace file logic (#56898) 2023-10-16 22:29:07 +02:00
vercel-release-bot
54145b49f9 v13.5.5 2023-10-16 14:54:10 +00:00
vercel-release-bot
1609da2d95 v13.5.5-canary.19 2023-10-16 13:44:03 +00:00
Tobias Koppers
8a51ebcb67
Revert "feat(turbopack): support basic next/dynamic" (#56885) 2023-10-16 06:37:41 -07:00
vercel-release-bot
c1c419fde0 v13.5.5-canary.18 2023-10-16 12:28:32 +00:00
OJ Kwon
5b52e7772d
feat(turbopack): support basic next/dynamic (#56389)
Closes WEB-1702

This PR implements initial support for the `next/dynamic` in Turbopack,
more specifically resolving some hydration errors and other components
boot up cases.

Previously, turbopack had partial next/dynamic support via its own mode
(https://github.com/vercel/next.js/pull/56389/files#diff-e1af4f79cb88a73f819a25443d15ed4b1ffabcbb879256caa59b751fad46d7c4L68),
which does a transform against `next/dynamic` wrapped import to embed
dynamically resolvable chunk ids like
(ad42b610c2/packages/next-swc/crates/next-transform-dynamic/tests/fixture/wrapped-import/output-turbo-dev-server.js).

However, since next.js relies on static path to the chunks to the
dynamic import and passing those ids in between client-server to ensure
component load (and avoid hydration errors), it doesn't work out of the
box. This PR changes turbopack's behavior to closely mimic what current
next.js's webpack plugin does, by

1. Traverse the module graph, find out `dynamic(import())`
2. Generate chunks for those imports, creates a partial LoadableManifest
per each imports
3. Merge partial manifest into a single `react-loadable-manifest.json`
4. For the id, use static (Webpack mode) instead of dynamic so we can
embed it in `react-loadable-manifest` as well as next.js can use it to
pass it between server-client context.

I left a small comment to the implementation
(https://github.com/vercel/next.js/pull/56389/files#diff-bf12ed2c69d0bc89a06884779da4ae44967eb8becada031dea12bedef28e2622R155)
for the lifecycle of this feature in case to fix further.

This makes to pass most of the basic next-dynamic related integration
tests, except if the import have webpack specific features like
ad42b610c2/test/development/basic/next-dynamic/pages/dynamic/multiple-modules.js (L5).

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-10-16 10:24:54 +02: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
vercel-release-bot
e5ad069c6a v13.5.5-canary.17 2023-10-15 23:22:55 +00:00
Balázs Orbán
b660eef8a2
chore: bump undici (#56851) 2023-10-14 23:45:02 +00:00
vercel-release-bot
297efa7bc9 v13.5.5-canary.16 2023-10-14 23:22:14 +00:00
Tim Neutkens
dc1b565f58
Implement getOptimizedModuleAliases for Turbopack (#56839)
This ensures `import url from 'url'` works in the edge runtime when using Turbopack. It also ensures the stubs for fetch / object.assignare applied to the client and edge compilation.
2023-10-14 17:21:52 +00:00
Jiachi Liu
5d9f4193f9
Revert "Drop ipc server headers filters (#56226)" (#56836)
x-ref: https://github.com/vercel/next.js/issues/56038#issuecomment-1762855556
x-ref: https://github.com/vercel/next.js/issues/56038#issuecomment-1746864558

http header `connection` could still fail the image requests while running next build
2023-10-14 12:51:20 +00:00
JJ Kasper
d390c3d56e
Fix build traces case (#56817)
This ensures our `readFile` handling for tracing we previously had is
maintained.

Test deployment with the provided reproduction can be seen here:
https://react-pdf-repro-jeqgyhmek-vtest314-ijjk-testing.vercel.app/

Fixes: https://github.com/vercel/next.js/issues/56676
2023-10-13 16:46:56 -07:00
vercel-release-bot
46d56c6bca v13.5.5-canary.15 2023-10-13 23:22:28 +00:00
vercel-release-bot
f3973d84a5 v13.5.5-canary.14 2023-10-13 22:44:36 +00:00
Tim Neutkens
313ceac475
Implement preferredRegion array in Turbopack (#56743)
This implements support for `export const preferredRegion = ['sfo1', 'lhr1']` in Turbopack. Previously this caused an error.
2023-10-13 18:58:03 +00:00
Leah
f9d12d1092
fix(turbopack): middleware path and aliases (#56804)
### Description

- Adds the page path to the middleware template (and also uses the template from the next.js loader)
- ESM aliases for the edge context
- Fix for the process polyfill to make it possible to import from `dist/esm`
- Fix for the `server-only`/`client-only` aliases


Closes WEB-1779
2023-10-13 18:41:52 +00:00
Balázs Orbán
fe0bfbf911
fix: add x-forwarded-* headers (#56797)
### What?

Adding back `x-forwarded-*` headers.


### Why?

Starting with #52492, these headers were lost.

### How?

We can populate these headers before executing a request.

Closes NEXT-1663
Fixes #55942
2023-10-13 17:58:33 +00:00
vercel-release-bot
f95a11f804 v13.5.5-canary.13 2023-10-13 16:34:44 +00:00
Tobias Koppers
cb8361aca6
put app code into a separate layer (#56800)
### What?

app code is different from pages code and need to be in a separate layer

### Why?

Otherwise it tries to share chunks and will cause conflicting writes

### How?


Closes WEB-1778
2023-10-13 18:29:48 +02:00
vercel-release-bot
489a528003 v13.5.5-canary.12 2023-10-13 13:23:54 +00:00
Tobias Koppers
a40a350155
Chunking Refactoring followup fixes (#56789)
### What?

fix some minor bugs
Make the page-loader reuse the client chunks

Closes WEB-1777
2023-10-13 12:38:59 +00:00
Tobias Koppers
04bad16bf4
Turbopack: Chunking Refactoring (#56756)
### What?

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

### Turbopack Changes

* https://github.com/vercel/turbo/pull/6116 
* https://github.com/vercel/turbo/pull/6140 
* https://github.com/vercel/turbo/pull/6118 
* https://github.com/vercel/turbo/pull/6128 
* https://github.com/vercel/turbo/pull/6129 
* https://github.com/vercel/turbo/pull/6160 


Closes WEB-1772

Co-authored-by: Justin Ridgewell <112982+jridgewell@users.noreply.github.com>
2023-10-13 11:44:44 +00:00
Zack Tanner
3264d91dab
memoize useParams (#56771)
`useParams` is not referentially equal between renders which can lead to unexpected behavior when used as a dep. 
This memoizes the response from `useParams` similar to `useSearchParams`.

[slack x-ref](https://vercel.slack.com/archives/C04DUD7EB1B/p1697145987740229)
2023-10-13 07:47:05 +00:00
vercel-release-bot
e0cd06531b v13.5.5-canary.11 2023-10-12 23:23:04 +00:00
vercel-release-bot
f306108b37 v13.5.5-canary.10 2023-10-12 23:09:37 +00:00
Zack Tanner
10ba5f772b
Revert static worker refactor (#56767)
The changes to this worker from #55841 seem to also cause strange behavior where the process doesn't exit despite sending an exit signal. Reverting until we can spend the time to investigate what the issue is. 

[slack x-ref](https://vercel.slack.com/archives/C03S8ED1DKM/p1697129702263269)
[slack x-ref](https://vercel.slack.com/archives/C056QDZARTM/p1697149427099799?thread_ts=1696351087.736439&cid=C056QDZARTM)
2023-10-12 23:03:48 +00:00
Wyatt Johnson
786ef25e52
Revalidate Type (#56763)
This adds a new `Revalidate` type which is used internally by Next.js to associate the user inputted value of `revalidate` from `getStaticProps` or the exported `revalidate` variable in app directory.
2023-10-12 22:20:50 +00:00
Hamir Mahal
9288ef4921
feat: add self-documenting .env.example file (#56469)
- fixes #56468

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-10-12 21:55:14 +00:00
Zack Tanner
476af24628
Revert "Prefer module over main on main fields for app router server compiler" (#56766)
This was causing some issues with our deployments.

[slack x-ref](https://vercel.slack.com/archives/C04DUD7EB1B/p1697146531305779)
2023-10-12 21:38:44 +00:00
Wyatt Johnson
961fd01ebc
Utilize Promise.withResolvers (#56764)
This utilizes `Promise.withResolvers` in a few places where it was done the old way. This also rearranges some imports and typings.
2023-10-12 21:10:19 +00:00
Leah
230099b57f
fix(turbopack): always alias server-only and client-only (#56760)
Closes WEB-1773
2023-10-12 19:17:01 +00:00
Dima Voytenko
3da643a8b0
OpenTelemetry: ignore bubble errors to avoid spamming traces (#56625)
The "bubble" errors are created here: 3f25a2e747/packages/next/src/server/next-server.ts (L1636-L1639)

These errors do not appear to be true errors, but they tend to spam tracing. E.g.

<img width="1412" alt="image" src="https://github.com/vercel/next.js/assets/726049/d62f3116-5f94-45ac-947c-e59ac4bfa533">
2023-10-12 18:37:25 +00:00
vercel-release-bot
8013ef7372 v13.5.5-canary.9 2023-10-12 17:27:01 +00:00
Shu Ding
e057c26329
Check origins of Server Action requests (#56753)
This check ensures that the `x-forwarded-host` (fallbacks to `host` if missing) header matches the request's `origin` header.
2023-10-12 16:43:31 +00:00
Jiachi Liu
6814ff147a
Prefer module over main on main fields for app router server compiler (#56532)
This change is to pick the esm assets for RSC server layer and server rendering side, this is for production and development perf purpose, also to let them apply with the ESM related optimization such as tree-shaking, barrel files optimizations, etc.

We found a few packages that can't be optimized easily in bundling because we're using "main" field so the packages are not able to be tree-shaked, ending up with large bundle in the dist. This will change a lot for the bundling improvements as some packages are only having "main" and "module" field. So switching from CJS to ESM means better bundling, more optimization, and faster code.

#56501 was a precondition for this, as previously the bundling strategy was applied to some library but triggered the invalid hooks erroring.

### Other Monior Change
Previously we'll prefer to resolve CJS as there're 2 versions of react, using CJS assets will help let them pass by require-hook to use canary react for app router bundling assets. But now we changed the approach to bundling nextjs runtime and react packages. Now we dropped the condition that prefered to resolve CJS exports for externals, since if you're putting them in `serverComponentsExternalPackages`, they're not using the built-in react, so could potentially having trouble if any dependency is using react but excluded in bundles. So far we didn't see any report to this.

Closes NEXT-1286
2023-10-12 16:10:55 +00:00
Tim Neutkens
f2ce230728
Fix ensurePage for client-side navigation to / in Turbopack (#56704)
While investigating the failing test case of `test/integration/scroll-forward-restoration/test/index.test.js` I found that navigating from `/another` to `/` using `next/link` with a `href="/"` errored on `ensurePage` as "this page was not built". Turns normalization wasn't applied on these so the input `page` was `/index` instead of `/`, where it expects `/` as the input.
2023-10-12 08:38:31 +00:00
Tim Neutkens
c1a1583dd0
Fix reconnection loop when devserver is offline (#56698)
Ensures the webpack-hmr socket is not reconnected infinitely while (and
very quickly) when the dev server is offline. I've implemented a gradual
backoff, after 5 tries at 1 second it'll try 20 times at 5 seconds.
After those 25 retries it reloads the page as something must be wrong
(i.e. the server is offline).

<!-- 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-12 10:07:02 +02:00
vercel-release-bot
7d8cf1f9f3 v13.5.5-canary.8 2023-10-12 00:58:02 +00:00
Shu Ding
41e1dcae88
Improve internal waitUntil utility (#56720)
⚠️ This is an internal API and will be removed soon. Please do not use.

Refactors #56404 to have a better internal API used by both Edge SSR and Edge Route Handlers.

This new API can buffer non-synchronously created "waitUntil"s even after the response has been returned, just need to make sure that there's at least one "waitUntil" queued. E.g.:

```js
async function handler() {
  internal_runWithWaitUntil(async () => { // ← no await
    await taskA()

    internal_runWithWaitUntil(async () => { // ← no await
      await longRunningTaskB()
    })

    await taskC()
  }) 

  return Response(...)
}
```

Internally, the "waitUntil" promise will resolve after all tasks are finished.

cc @ijjk @cramforce @feedthejim as we've synced about some of the details here. Not using ALS because of some promise-related issues.
2023-10-12 00:52:32 +00:00
Zack Tanner
d735d317d1
fix static worker restart behavior (#56728)
In [55841](https://github.com/vercel/next.js/pull/55841), this file was reworked to improve type safety and readability, but it changed the behavior of how we were invoking methods on the worker. Specifically, when a restart occurred, this timeout wrapping function was referencing an already ended worker, resulting in a "Farm is ended, no more calls can be done to it" build error.

This PR ensures that we're fetching the method from the current `this._worker` at the time of invocation, not at the time of method creation.

[Slack x-ref](https://vercel.slack.com/archives/C04KC8A53T7/p1697064752635179?thread_ts=1696952142.759769&cid=C04KC8A53T7)
2023-10-12 00:19:29 +00:00
vercel-release-bot
ec0a8dac03 v13.5.5-canary.7 2023-10-11 13:05:55 +00:00
Tim Neutkens
d6a1b5d533
Ensure rewrites are included in build manifest when using Turbopack (#56692)
The build manifest when using webpack includes the rewrites config so
that the Pages Router can correctly match the path. The manifest for
Turbopack was missing these properties which caused a bunch of the
middleware tests to fail. This PR reuses the function to generate
rewrites from build-manifest-plugin.

<!-- 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-11 13:20:03 +02:00
vercel-release-bot
e8048b9974 v13.5.5-canary.6 2023-10-11 04:25:10 +00:00
JJ Kasper
dabeb51fff
Fix SSG query with experimental-compile (#56680)
Ensures query isn't omitted when using experimental compile mode with SSG pages as it skips the isReady delay that is normally done with prerendering.
2023-10-11 01:52:36 +00:00
OJ Kwon
d79f8a2f03
fix(next-core): allow sass loader for foreign codes (#56679)
### What?

- closes https://github.com/vercel/next.js/issues/55785

Similar to https://github.com/vercel/next.js/pull/56539, next.config's sass applies webpack loaders to node_modules implicitly and this PR mimics those for the turbopack.


Closes WEB-1753
2023-10-10 23:16:12 +00:00
JJ Kasper
7a08f0082d
Fix trace ignore handling (#56674)
This ensures we separate our ignore handling for next-server runtime entries and `.next/server` chunks. When these were combined our ignores caused modules that should were actually needed by user code to be excluded. 

Verified patch against the provided minimal repros

![CleanShot 2023-10-10 at 11 56 36@2x](https://github.com/vercel/next.js/assets/22380829/1dd83996-fa95-462a-98ed-485ce6c4d3f5)

![CleanShot 2023-10-10 at 12 01 08@2x](https://github.com/vercel/next.js/assets/22380829/c17c6147-0e3e-422b-bf2d-5fedfd6827ef)


x-ref: https://github.com/vercel/next.js/pull/56048#discussion_r1345651964
Fixes: https://github.com/vercel/next.js/issues/56357
2023-10-10 19:41:44 +00:00
vercel-release-bot
1b7895e0a4 v13.5.5-canary.5 2023-10-10 16:04:34 +00:00
Steven
35f507242c
fix: next dev with edge runtime on windows (#56502)
- Reverts https://github.com/vercel/next.js/pull/44616
- Regression introduced in https://github.com/vercel/next.js/pull/51651
- Fixes https://github.com/vercel/next.js/issues/55013
2023-10-10 14:03:03 +00:00
Jiachi Liu
5d2c503eac
remove unnecessary structuredClone (#56570)
An issue discovered from #56502 in azure pipeline

```
> Build error occurred
ReferenceError: structuredClone is not defined
```

`structuredClone` is not supported until nodejs 17, here we actually don't need to use `structuredClone` as the values are almost primitives, the deepMerge case we're using mainly objects and array, which are already handled above
2023-10-10 13:43:04 +00:00
Jimmy Lai
d4fcd03966
misc: split app-render into smaller functions (#56611)
This PR splits apart the function used to render App Router pages into smaller chunks for better readability + testing. A lot of the complexity is tied by the fact that a lot of the code of the function relied on closures so I had to coalesce a lot of the captured variables used into one big context that is then passed around during render.

There are a lot of things to slim down further but I don't have the energy to dig more.
2023-10-10 12:18:36 +00:00
Shu Ding
260ea16467
Improve error handling of Server Actions with skewed deployment (#56618)
When there's a version skew, it might be possible that the Action's ID has changed and we're no longer able to locate it. By definition, that means we **should** return a 404 because it might have a different implementation now. Currently this throws a "cannot access workers of undefined" error which doesn't make sense.

Please review with whitespace ignored.
2023-10-09 20:42:41 +00:00
Leah
b4660d8f25
feat(turbopack): add support for edge app pages (#56426)
<!-- 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: Tim Neutkens <tim@timneutkens.nl>
2023-10-09 16:32:20 +02:00
Jiachi Liu
dbf35a7fd4
Fix build restart log (#56543)
### Observed Issue
```
⚠ Restarted collecting page data for [object Object] because it took more than 60 seconds
```

### Fix
The original issue is caused because the path is assigned to the `argument` array itself. Passing the argument type to the he worker, so in restart callback we're type safe, can the value will be correct.
2023-10-07 22:17: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
Zack Tanner
e039cc72fc
enable verbatimModuleSyntax to make type imports/exports explicit (#56551)
This has come up in code review a few times, so enabling the tsconfig setting so it's more easily caught.
2023-10-07 15:09:54 +00:00
stefanprobst
e75c366826
fix: don't add isolateModules to tsconfig when extending from tsconfig with verbatimModuleSyntax (#54164)
<!-- 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 #

-->

this is a follow-up to #48018 (don't add `isolatedModules: true` to
`tsconfig.json` when `verbatimModuleSyntax: true` is set), which also
handles the case where `verbatimModuleSyntax: true` is set in a base
tsconfig which is being referenced via `tsconfig#extends`.

---------

Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2023-10-07 07:38:56 -07:00
Wyatt Johnson
4d9b00ada3
refactor: cleanup app render (#56538)
This is just moving the `wrappedRender` function out of the `renderToHTMLOrFlight` function so that it's defined in the module scope.

You'll want to turn on hide whitespace during review 😉
2023-10-07 04:49:51 +00:00
Wyatt Johnson
50dff93902
Unsilence Taskr Webpack errors (#56542)
Discovered while investigating https://github.com/vercel/next.js/pull/56526, turns out errors occuring during webpack builds do not fail the `pnpm build` which kicks off `taskr`. This is because `taskr` runs their plugins within coroutines, which based on the result, was not handling the promise rejections as expected.
2023-10-06 23:38:18 +00:00
Balázs Orbán
67cd9146c6
fix: log error cause (#56528)
### What?

While debugging #56456, I noticed that we cut useful information, namely the `Error` instances' [`cause` property](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause).

### Why?

In #56456, it was hiding the following:

```sh
Error: getaddrinfo EAI_AGAIN undefined
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26)
    at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
  errno: -3001,
  code: 'EAI_AGAIN',
  syscall: 'getaddrinfo',
  hostname: 'undefined'
}
```

which might be an indicator to the user what was going wrong with the `fetch` call.

### How?

If there is a `err.cause` property, log it together with `err.digest`


Note, this does not fix #56456 but might be useful to debug similar issues as well.
2023-10-06 23:22:13 +00:00
Will Binns-Smith
3c326ea5e8
Turbopack + app router: always use externals for predefined packages (#56440)
This applies the predefined list of packages in server-external-packages.json as always external when used by app router in Turbopack

Test Plan: Added integration tests

Closes WEB-1709
2023-10-06 19:08:01 +00:00
vercel-release-bot
78b91243dd v13.5.5-canary.4 2023-10-06 15:46:54 +00:00
Shu Ding
9b671046b9
Flatten recursive wildcard exports in barrel optimization (#56489)
This PR flattens the recursive optimization logic of our barrel optimization loader. So now if there're any recursive `export * from ...`, they won't be created as multiple individual Webpack modules, but optimized in one module.

With this change, we are running SWC transform to get the export map directly inside the barrel loader (instead of a separate loader rule). And that map is recursively calculated and cached in memory.

I also published https://unpkg.com/browse/recursive-barrel@1.0.0/ to give this a test. It contains 4 levels of 10 `export *` expressions, which is 10,000 modules in total. Without this change, it takes ~30s to compile and with this change, it goes down to ~7s.
2023-10-06 15:39:15 +00:00
Justin Ridgewell
c6f5089ef2
turbopack: Extract as_chunk into shared ChunkType trait (#56506)
### What?

Step 3 in our chunking refactors extracts ChunkItem::as_chunk into a new ChunkType trait. This new trait isn't useful yet, but will eventually allow us to collect ChunkItems of a similar type into a lists, and perform chunking over all similar items at once.

### Why?

In the end we want to avoid creating chunks from modules directly, but enforce everything going through the ChunkingContext to be chunked. This allows us to replace the existing chunking algorithm with a much more efficient one that avoid duplication between chunks in first place and doesn't require a post-chunking optimization.

### How?

https://github.com/vercel/turbo/pull/6123

Re: https://github.com/vercel/next.js/pull/56504

Closes WEB-1724

Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
2023-10-06 15:28:57 +00:00
Jimmy Lai
bc15b5803c
misc: fix wrong next start start duration (#56512)
This PR fixes `next start` and `next dev` so that they show the correct server boot-up time. The previous way of computing the start time was incorrect and misleading as it did not start exactly when next started.

Before:
> ✓ Ready in 120ms

After:
> ✓ Ready in 286ms
2023-10-06 14:57:59 +00:00
Tim Neutkens
61122ebc40
Improve failed to fetch RSC error (#56517)
Ensures the specific URL that failed is highlighted in this error. Useful for debugging when the fetch fails.
2023-10-06 14:14:40 +00:00
vercel-release-bot
5aca71cfa6 v13.5.5-canary.3 2023-10-06 12:00:47 +00:00
Tim Neutkens
bfdb349eba
Remove ServerDirectiveTransformer (#56496)
As discussed with @jridgewell this removes the hard error when using
`"use server"` in Turbopack.

<!-- 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-06 11:16:57 +02:00
Tobias Koppers
c95e4b7841
update turbopack, fix sass peer dependency (#56508)
* https://github.com/vercel/turbo/pull/6076 <!-- Tobias Koppers -
Performance Improvements (5) !-->

Closes WEB-1725
2023-10-06 10:59:43 +02:00
Justin Ridgewell
2af1e784c2
turbopack: Chunking Refactor Step 2 (#56504)
### What?

The second step in our chunking refactoring, this removes our use of Module::as_chunk and Module::as_root_chunk. Instead, the only way to generate a chunk is directly from a root ChunkItem.

### Why?

In the end we want to avoid creating chunks from modules directly, but enforce everything going through the ChunkingContext to be chunked. This allows us to replace the existing chunking algorithm with a much more efficient one that avoid duplication between chunks in first place and doesn't require a post-chunking optimization.

### How?

https://github.com/vercel/turbo/pull/6120

Re: https://github.com/vercel/next.js/pull/56467
Closes WEB-1721

Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
2023-10-06 06:29:14 +00:00
Jiachi Liu
9d150b116d
Loose RSC import restrictions for 3rd party packages (#56501)
When we landed #51179 it broke library like `apollo-client` as it's bundling client hooks into RSC bundle, so our RSC linter caught them and reported fatal errors. But those client hook APIs won't get executed in RSC. The original purpose of erroring on invalid hooks for server & client components was to catch bugs easier, but it might be too strict for the 3rd party libraries like `apollo-client` due to few reasons. 

We changed the rules only applying on user land source code. For 3rd party packages if they're not being imported correctly into proper server or client components, we're still showing runtime errors instead of fatal build errors.

x-ref: https://github.com/apollographql/apollo-client/issues/10974
Closes NEXT-1673
2023-10-05 23:59:22 +00:00
Will Binns-Smith
35e4539304
Use native node:fs in taskfile.js (#56491)
This is the first in a series of PRs replacing our use of fs-extra with node's own `node:fs`.

Test Plan:

With clean and existing artifacts in each case, ran:

- `pnpm build`
- `pnpm dev`
- `./node_modules/.bin/taskr ncc`


Closes WEB-1717
2023-10-05 22:01:45 +00:00
Tobias Koppers
666ce7bd8b
Chunking Refactor Step 1 (#56467)
### What?

This change moves a few methods around.

Module::as_chunk is moved to ChunkItem::as_chunk as temporary intermediate state.
EcmascriptPlaceable::as_chunk_item is moved to ChunkableModule::as_chunk_item. This generalizes the concept of converting a Module into a ChunkItem


### Why?

This is the first step of refactoring the chunking. In the end we want to avoid creating chunks from modules directly, but enforce everything going through the ChunkingContext to be chunked. This allows us to replace the existing chunking algorithm with a much more efficient one that avoid duplication between chunks in first place and doesn't require a post-chunking optimization.

### How?

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

Closes WEB-1715

Co-authored-by: Justin Ridgewell <112982+jridgewell@users.noreply.github.com>
2023-10-05 20:05:05 +00:00
Leah
11c1d07b89
feat(turbopack): port next.js template loading logic (#56425)
Closes WEB-1706
2023-10-05 18:38:46 +00:00