Commit graph

11421 commits

Author SHA1 Message Date
vercel-release-bot
e28be5377f v14.2.0-canary.5 2024-03-06 19:57:27 +00:00
JJ Kasper
67eca23ae5
Upgrade to latest @edge-runtime packages (#62955)
This upgrades to the latest edge-runtime packages as it includes
exposing `performance`. This was reverted previously as our publishes
were failing with a specific change that has since been removed
upstream.

Closes NEXT-2730
2024-03-06 11:43:48 -08:00
JJ Kasper
83172a90db
Allow ppr only flag in test mode (#62911) 2024-03-06 18:20:20 +00:00
Ethan Arrowood
3c75ae7cf5
simplify streamToString method from node-web-streams.helper.ts (#62841)
The `encode-decode.ts` file is completely replaceable with the
[`TextDecoderStream`](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream)
api, but also we can simplify the `streamToString` function too.

Working on some benchmarks now - wanted to get CI running to see if this
breaks anything though.
2024-03-06 18:14:58 +00:00
Sukka
c206d89ec2
feat(eslint): enhance no-unwanted-polyfill w/ new endpoints (#62719)
The PR adds the new `polyfill.io` instance endpoint (from Fastly and
Cloudflare) to the `eslint-plugin-next`'s `no-unwanted-polyfillio`
rules, so these new endpoints can be detected by the rule.

---

`polyfill.io` was acquired by **a China-based CDN company** "Funnull",
see [the announcement from the `polyfill.io` domain owner's
Twitter](https://x.com/JakeDChampion/status/1761315227008643367) and
https://github.com/polyfillpolyfill/polyfill-service/issues/2834.
Despite Funnull's claims of operating in the United States, the
predominance of Simplified Chinese on its website suggests otherwise,
and it turns out that **"Funnull" is notorious for providing service for
the betting and pornography industries**.

[The original creator of the `polyfill.io` has voiced his concern on
Twitter](https://twitter.com/triblondon/status/1761852117579427975). And
since the acquisition, numerous issues have emerged
(https://github.com/polyfillpolyfill/polyfill-service/issues/2835,
https://github.com/polyfillpolyfill/polyfill-service/issues/2838,
https://github.com/alist-org/alist/issues/6100), rendering the
`polyfill.io` service **extremely unstable**. Since then, Fastly
([Announcement](https://community.fastly.com/t/new-options-for-polyfill-io-users/2540))
and Cloudflare
([Announcement](https://blog.cloudflare.com/polyfill-io-now-available-on-cdnjs-reduce-your-supply-chain-risk))
has hosted their own instances of `polyfill.io` service.

---------

Co-authored-by: Steven <steven@ceriously.com>
2024-03-06 16:42:53 +00:00
Donny/강동윤
3ed96f92cb
feat: Introduce lightningcss-loader for webpack users (#61327)
### What?

I'm recreating a PR because CI of
https://github.com/vercel/next.js/pull/58712 uses `lightningcss@1.14.0`
for an unknown reason.

Add an opt-in feature to use `lightningcss` instead of webpack
css-loader.

### Why?

In the name of performance.

### How?


This PR is largely based on https://github.com/fz6m/lightningcss-loader
by @fz6m.
(Thank you for nice work)

Closes PACK-1998
Closes PACK-2124

---------

Co-authored-by: OJ Kwon <1210596+kwonoj@users.noreply.github.com>
2024-03-06 17:07:53 +01:00
Balázs Orbán
0a73e89880
feat(error-overlay): version staleness in Pages Router (#62942) 2024-03-06 16:00:16 +00:00
Balázs Orbán
4c62c3002e
refactor(error-overlay): improve server code for webpack/Turbopack middleware (#62396) 2024-03-06 16:43:56 +01:00
vercel-release-bot
1ad3963d44 v14.2.0-canary.4 2024-03-06 12:03:01 +00:00
Tobias Koppers
ce92c450b2
fix graph update (#62933)
### What?

fixup for #62927 


Closes PACK-2672
2024-03-06 11:20:00 +00:00
Balázs Orbán
8f5107de16
feat(error-overlay): notify about missing html/body in root layout (#62815) 2024-03-06 10:59:53 +00:00
OJ Kwon
415cd74b9a
fix(next-api): correct font manifest generation (#62916)
### What

I noticed the font manifest generated by Turbopack was always empty.
Debugging showed that the path to the client_root was always incorrect
when calculating `get_font_paths_from_root`. And also fixed an issue
where for certain paths, the (`/index`) manifest key should contain the
original path.

Closes PACK-2666
2024-03-06 11:21:39 +01:00
vercel-release-bot
6e8a859bca v14.2.0-canary.3 2024-03-06 09:51:39 +00:00
Tobias Koppers
6194e49d77
fix merge css plugin to account for css order (#62927)
### What?

Merging css chunks need to account for css order when merging chunks

### Why?

Changing the order would break css


Closes PACK-2671
2024-03-06 10:43:30 +01:00
Will Binns-Smith
f9aec9005a
Turbopack: Trace edge runtime app render errors through source maps (#62901)
Similar to #62611, this implements error stack translation for edge
runtime app render errors.

Test Plan: `TURBOPACK=1 pnpm test-dev
test/development/app-render-error-log/app-render-error-log.test.ts`

Closes PACK-2665
2024-03-05 20:40:26 -08:00
Jiachi Liu
ced7339aa6
Fix: missing crossorigin property on manifest link (#62873)
We didn't set the property of manifest before, this PR fixes the missing
prop

> If the manifest requires credentials to fetch, the crossorigin
attribute must be set to use-credentials, even if the manifest file is
in the same origin as the current page.
x-ref: https://developer.mozilla.org/en-US/docs/Web/Manifest


Fixes NEXT-2706
2024-03-06 02:04:28 +01:00
Sam Ko
bdfe247b5e
chore(cli): fix allowRetry when using port 3000 (#62840) 2024-03-05 16:19:21 -08:00
vercel-release-bot
6045048b26 v14.2.0-canary.2 2024-03-05 23:25:45 +00:00
vercel-release-bot
d0b30787e2 v14.2.0-canary.1 2024-03-05 20:48:05 +00:00
Jiwon Choi
9798ae52c5
refactor(next): fix spacing on auto-generated root layout (#62769)
![Screenshot 2024-03-03 at 5 28
23 AM](https://github.com/vercel/next.js/assets/120007119/282d65aa-71f0-410d-bd25-1352a244d2fb)

Added a space.

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-05 19:47:57 +00:00
monssef
8d8ec75912
bump @edge-runtime/cookies for Partitioned cookie support (#62889)
Bumps `@edge-runtime/cookies` to add support for `set-Cookie:
Partitioned` attribute

- https://github.com/vercel/edge-runtime/pull/825
-
https://developer.mozilla.org/en-US/docs/Web/Privacy/Privacy_sandbox/Partitioned_cookies
2024-03-05 19:34:35 +00:00
Jiachi Liu
02c4ce1acf
refactor: rename isAppDirEnabled to hasAppDir (#62837)
app dir is always "enabled", but not always exists. Rename to the proper
word to describe. Found this confusion while developing other fetaures

Closes NEXT-2691
2024-03-05 18:58:53 +01:00
Tobias Koppers
405933a0ea
update turbopack (#62884)
* https://github.com/vercel/turbo/pull/7622 <!-- Tobias Koppers - don't
apply alternatives if there is an exports field -->
2024-03-05 15:57:50 +00:00
Tobias Koppers
1d8b70411f
apply some transforms on foreign code too (#62827)
### What?

some transforms need to be applied on node_modules code too to work
correctly

### Why?

### How?


Closes PACK-2651
2024-03-05 16:03:35 +01:00
Thomas Danecker
6f5e0f3694
Don't emit crossorigin attributes for output: "export" by default (#61211)
In other output modes, link and script tags do not contain a crossorigin
attribute by default.

When using output: "export", it should also follow the other output
modes, to avoid unnecessary CORS issues, especially when hosting the
assets on a different domain (i.e. a CDN).

fixes #61210

Co-authored-by: Steven <steven@ceriously.com>
2024-03-05 14:33:37 +00:00
Almaz
473ef817a7
Update readme of @next/bundle-analyzer package (#62804)
Set actual information about output of bundle analyzer.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-03-05 05:18:22 +00:00
Shu Ding
135642b9df
Remove extra logic of Server Reference check for registering twice (#62486)
This isn't necessary as it has been landed in React already:
https://github.com/facebook/react/pull/28343.

Closes NEXT-2586
2024-03-05 03:42:46 +00:00
vercel-release-bot
07e5b60a03 v14.2.0-canary.0 2024-03-05 01:09:36 +00:00
Jacob Hummer
392507b023
fix "setBlocking is not a function" errors on StackBlitz (#62843)
To reproduce:
- go to https://next.new/
- run `next build`
- it breaks

```sh
~/projects/nextjs-pdjpmx
❯ npm install && npx next dev

added 328 packages in 6s

116 packages are looking for funding
  run `npm fund` for details
   ▲ Next.js 14.1.0
   - Local:        http://localhost:3000

   Downloading swc package @next/swc-wasm-nodejs...
 ✓ Ready in 5.7s
 ○ Compiling / ...
 ✓ Compiled / in 9.2s (510 modules)
 ✓ Compiled in 483ms (240 modules)
^C


~/projects/nextjs-pdjpmx 27s
❯ npx next build
   ▲ Next.js 14.1.0

   Creating an optimized production build ...

> Build error occurred
TypeError: process.stdout._handle.setBlocking is not a function
    at loadBindings (file:///home/projects/nextjs-pdjpmx/node_modules/next/dist/build/swc/index.js:231:32)
    at getBaseWebpackConfig (file:///home/projects/nextjs-pdjpmx/node_modules/next/dist/build/webpack-config.js:333:37)
    at eval (file:///home/projects/nextjs-pdjpmx/node_modules/next/dist/build/webpack-build/impl.js:140:40)
    at async Span.traceAsyncFn (file:///home/projects/nextjs-pdjpmx/node_modules/next/dist/trace/trace.js:151:20)
    at async webpackBuildImpl (file:///home/projects/nextjs-pdjpmx/node_modules/next/dist/build/webpack-build/impl.js:133:21)
    at async Object.workerMain (file:///home/projects/nextjs-pdjpmx/node_modules/next/dist/build/webpack-build/impl.js:313:20) {
  type: 'TypeError'
}
```

fixes #61848 

<!-- 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: JJ Kasper <jj@jjsweb.site>
2024-03-05 01:06:21 +00:00
JJ Kasper
eeb2369a5d
Update to latest version (#62850)
Updates our version to match the last backport for canaries.

Closes NEXT-2699
2024-03-04 16:04:21 -08:00
Jiwon Choi
882aa6d13c
fix(next-lint): do not pass absolute path to distDir (#62797)
This PR reverts part of #61877 passing an absolute path to the distDir
value when running `next lint`.

Fixes #62796

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-04 23:56:35 +00:00
vercel-release-bot
a1c9c3b9d4 v14.1.2-canary.7 2024-03-04 23:22:19 +00:00
Zack Tanner
9ac6c4abb2
remove reducer unit tests (#62766)
These tests were added back when the router would suspend in reducers,
primarily to test that things were working as expected during concurrent
rendering. Now that we don't suspend in reducers, most of these tests
aren't actually adding much value, and instead introduce friction
anytime we want to change the router state since they're currently
relying on snapshotting.

Before removing these tests, I verified that we have a corresponding e2e
test that covers the expected behaviors more explicitly. Specifically:

- `test/e2e/app-dir/actions` (server actions) 
- `test/e2e/app-dir/navigation` (navigation tests & router.refresh)
- `test/e2e/app-dir/app-client-cache` and
`test/e2e/app-dir/app-prefetch` (prefetch & router cache behavior)
- `test/e2e/app-dir/router-autoscroll` (navigation auto-scrolling
behavior)

<!-- 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 #

-->


Closes NEXT-2669
2024-03-04 14:42:00 -08:00
vercel-release-bot
91a84b3ee2 v14.1.2-canary.6 2024-03-04 21:47:40 +00:00
OJ Kwon
655227f4e1
Revert "refactor(analysis): rust based page-static-info, deprecate js parse interface in next-swc" (#62838)
Reverts vercel/next.js#61832

Closes PACK-2654
2024-03-04 21:43:56 +00:00
JJ Kasper
5717b9a14d
Revert "Add experimental config for navigation raf test (#62668)" (#62834)
Reverting this experimental flag as it should not be used and we are
going to investigate experimenting with this further upstream so that it
can be done properly.

This reverts commit 2bdcaa0fda.

x-ref: https://github.com/vercel/next.js/pull/62668



Closes NEXT-2689
2024-03-04 12:39:41 -08:00
OJ Kwon
6e89226615
fix(next-core): throw on invalid metadata handler (#62829)
### What

Align with original route loader, explicitly throw on invalid handler
import.

This does not fixes test currently - other failures on the specific test
need to be solved.

Closes PACK-2652
2024-03-04 11:48:50 -08:00
Shu Ding
7b2b982343
fix: Add stricter check for "use server" exports (#62821)
As mentioned in the new-added error messages, and the [linked
resources](https://react.dev/reference/react/use-server#:~:text=Because%20the%20underlying%20network%20calls%20are%20always%20asynchronous%2C%20%27use%20server%27%20can%20only%20be%20used%20on%20async%20functions.):

> Because the underlying network calls are always asynchronous, 'use
server' can only be used on async functions.
> https://react.dev/reference/react/use-server

It's a requirement that only async functions are allowed to be exported
and annotated with `'use server'`. Currently, we already have compiler
check so this will already error:

```js
'use server'

export function foo () {} // missing async
```

However, since exported values can be very dynamic the compiler can't
catch all mistakes like that. We also have a runtime check for all
exports in a `'use server'` function, but it only covers `typeof value
=== 'function'`.

This PR adds a stricter check for "use server" annotated values to also
make sure they're async functions (`value.constructor.name ===
'AsyncFunction'`).

That said, there are still cases like synchronously returning a promise
to make a function "async", but it's still very different by definition.
For example:

```js
const f = async () => { throw 1; return 1 }
const g = () => { throw 1; return Promise.resolve(1) }
```

Where `g()` can be synchronously caught (`try { g() } catch {}`) but
`f()` can't even if they have the same types. If we allow `g` to be a
Server Action, this behavior is no longer always true but depending on
where it's called (server or client).

Closes #62727.
2024-03-04 18:50:19 +01:00
vercel-release-bot
b80d388032 v14.1.2-canary.5 2024-03-04 16:11:11 +00:00
OJ Kwon
372c74b620
refactor(analysis): rust based page-static-info, deprecate js parse interface in next-swc (#61832)
Reenabling https://github.com/vercel/next.js/pull/59300 with fixes for
the unsupported inputs.

Closes [PACK-2088](https://linear.app/vercel/issue/PACK-2088)

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2024-03-04 08:07:36 -08:00
vercel-release-bot
330b04ff55 v14.1.2-canary.4 2024-03-04 12:29:28 +00:00
Tobias Koppers
92eecbfdff
Turbopack: sass support (#62717)
### What?

* upgrades turbopack for `getResolve` in webpack loaders
* add missing resolve-url-loader to turbopack for full sass support

Closes PACK-2634
2024-03-04 11:56:55 +00:00
OJ Kwon
e9862a80f8
build(cargo): update turbopack (#62744)
### What

* https://github.com/vercel/turbo/pull/7544 <!-- Tobias Koppers -
extract a turbopack-resolve crate -->
* https://github.com/vercel/turbo/pull/7547 <!-- Tobias Koppers - only
register once -->
* https://github.com/vercel/turbo/pull/7447 <!-- Leah - fix(turbopack):
catch invalid source map paths -->
* https://github.com/vercel/turbo/pull/7503 <!-- Leah -
fix(turbopack-node): don't bundle postcss config -->
* https://github.com/vercel/turbo/pull/7445 <!-- Tobias Koppers - allow
to set a name on the virtual file system -->
* https://github.com/vercel/turbo/pull/7552 <!-- Tobias Koppers - add
default_files, prefer_relative and fully_specified resolve options -->
* https://github.com/vercel/turbo/pull/7560 <!-- Tobias Koppers - remove
unused code -->
* https://github.com/vercel/turbo/pull/7562 <!-- Tobias Koppers - add
getResolve to webpack loader context -->
* https://github.com/vercel/turbo/pull/7564 <!-- Tobias Koppers - fix
serde deserialization -->
* https://github.com/vercel/turbo/pull/7566 <!-- Tobias Koppers - Revert
"add getResolve to webpack loader context" -->
* https://github.com/vercel/turbo/pull/7565 <!-- Tobias Koppers - Ignore
circular aliasing with alias field -->
* https://github.com/vercel/turbo/pull/7320 <!-- OJ Kwon -
feat(turbo-tasks-fetch): allow specifying a proxy -->
* https://github.com/vercel/turbo/pull/7573 <!-- OJ Kwon - Revert
"Remove mopa dependency in turbo-tasks" -->
* https://github.com/vercel/turbo/pull/7526 <!-- Alexander Lyon - Handle
logging story better on daemon -->

Closes PACK-2639

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2024-03-04 11:33:21 +01:00
vercel-release-bot
9fb18e6739 v14.1.2-canary.3 2024-03-03 23:21:56 +00:00
vercel-release-bot
f2d4d04ff8 v14.1.2-canary.2 2024-03-02 23:21:32 +00:00
Will Binns-Smith
be87132327
Turbopack: Trace server app render errors through source maps (#62611)
Previously, errors shown in the error overlay, these stir were left
untraced through source maps.

Test Plan: `TURBOPACK=1 pnpm test-dev
test/development/app-render-error-log/app-render-error-log.test.ts`

Closes PACK-2608
2024-03-01 16:31:02 -08:00
vercel-release-bot
d70a554032 v14.1.2-canary.1 2024-03-01 23:17:20 +00:00
Sam Ko
47f73cd8ec
refactor(cli): refactor cli to commander (#61877)
## Description
Refactor the [Next.js
CLI](https://nextjs.org/docs/app/api-reference/next-cli) to use
[commander](https://github.com/tj/commander.js) instead of
[arg](https://github.com/vercel/arg).

## Why?
- Auto-generated, properly formatted help command + output. With `arg`,
much of the help commands were manually added via a single
`console.log`, causing deviations over time.
- Ergonomic, ease of adding new subcommands and rules

## Breaking Changes
- Update the experimental `next experimental-compile` and `next
experimental-generate` build commands in favor of `next build
--experimental-build-mode=compile/generate`

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-03-01 23:12:47 +00:00
vercel-release-bot
2f7721a632 v14.1.2-canary.0 2024-03-01 21:49:46 +00:00
Zack Tanner
9529a874bd
Add a flag to disable MergeCssChunksPlugin (#62746)
This is currently on by default, but this adds a flag to allow disabling
it if it causes issues with your application's CSS.

Closes NEXT-2664
2024-03-01 21:44:28 +00:00