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
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.
### 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>
### 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
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
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
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
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>
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>
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>
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
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
### 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
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.
### What?
* upgrades turbopack for `getResolve` in webpack loaders
* add missing resolve-url-loader to turbopack for full sass support
Closes PACK-2634
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
## 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>