Commit graph

20766 commits

Author SHA1 Message Date
vercel-release-bot
cb744ecfbd v14.3.0-canary.4 2024-04-15 23:22:22 +00:00
Evan Winter
8f85d9f7e9
Typo "Minifer" in config.ts (#64359) 2024-04-15 22:35:01 +00:00
Jaaneek
2646cd04b6
feat: add information that revalidate interval is in seconds (#64229)
Add information that revalidate interval is in seconds to unstable_cache

It's not obvious as "usually" time is in milliseconds

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-04-15 15:19:04 -07:00
Sam Ko
be2c20a6e2
chore(next/font): update @capsizecss/metrics package (#64528)
## Why?

Having the latest `@capsizecss/metrics` package allows us to have the
latest font fallbacks when using
[`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts).

- x-ref:
https://github.com/vercel/next.js/issues/47115#issuecomment-2051755660
- x-ref:
https://github.com/vercel/next.js/issues/47115#issuecomment-2055079526
-
https://github.com/seek-oss/capsize/releases/tag/%40capsizecss%2Fmetrics%403.0.0

Closes NEXT-3123
2024-04-15 15:14:58 -07:00
vercel-release-bot
b647facf0b v14.3.0-canary.3 2024-04-15 22:05:01 +00:00
Adam Jones
f563940f69
next/script: Correctly apply async and defer props (#52939)
### Summary

Fixes #52935

`next/script` has a `Script` component that supports an `async` prop.
However, when scripts are loaded with the `async` prop set to false, the
script is loaded as if async was set to true. This may cause scripts to
execute out of order. Repro:
https://github.com/domdomegg/next-async-script-reproduction

I think this is occurring because Next uses setAttribute to set the
async and defer attributes. However, this is not a valid way to set
these properties on a script. This is because . Demo:
https://jsfiddle.net/6ktpfae1/

This PR fixes this behaviour by using removeAttribute after calling
setAttribute (rather than using setAttribute "false"). This appears to
result in correct behaviour.

Given it appears this workaround was already applied in `next/head`,
I've harmonised the code between these two.

### Next steps

I think this PR is ready for review. I acknowledge there are no test
changes, but there are no existing tests for `next/script` at all and
creating them I think would be disproportionally difficult given issues
in #52943.

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Sam Ko <sam@vercel.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-04-15 15:01:50 -07:00
JJ Kasper
c9bfe4c892
Require turbopack build jobs (#64526)
These should be required for the workflow to be considered passing so
that we don't accidentally forget to update the manifests

Closes NEXT-3122
2024-04-15 21:53:23 +00:00
vercel-release-bot
a9adf0db67 v14.3.0-canary.2 2024-04-15 21:45:17 +00:00
Will Binns-Smith
cd36a8f217
Turbopack: don’t show long internal stack traces on build errors (#64427)
Turbopack: don’t show long internal stack traces on build errors
    
Fixes PACK-2909

Looks like this may have been introduced in #61929, when code was moved
out of `setup-dev-bundler.ts`, `ModuleBuildError` was duplicated and no
longer satisfied the `instanceof` check.

Closes PACK-2951
2024-04-15 14:40:56 -07:00
Jiachi Liu
d1e7847ad1
refactor: remove always truthy flag (#64522)
Remove the `this.exportRuntime` flag in build manifest plugin where it's
always true

Closes NEXT-3118
2024-04-15 23:33:07 +02:00
Will Binns-Smith
f79440260c
Turbopack: Allow client components to be imported in app routes (#64520)
Resolves #64412

This adds a client transition to the app route `ModuleAssetContext` and
the corresponding transforms so that client components can be safely
imported and referenced (as their proxies) in app routes.

Test Plan: Added an integration test


Closes PACK-2964
2024-04-15 14:18:56 -07:00
JJ Kasper
24575b3a09
Update to latest rust-cache (#64524)
Updates to latest version which bumps Node.js version to avoid v16
deprecation.

Closes NEXT-3120
2024-04-15 21:15:10 +00:00
vercel-release-bot
19c206038b v14.3.0-canary.1 2024-04-15 21:13:24 +00:00
Tobias Koppers
3491417ac5
update turbopack (#64501)
* https://github.com/vercel/turbo/pull/7858 <!-- Tobias Koppers -
refactor GlobalCssAsset to fix dynamic import of css -->
* https://github.com/vercel/turbo/pull/7944 <!-- Will Binns-Smith -
Update lockfile for compatibility with next.js -->
* https://github.com/vercel/turbo/pull/7936 <!-- Tobias Koppers - fix
panic when searching an the root span -->
* https://github.com/vercel/turbo/pull/7959 <!-- Tobias Koppers - fix
missing async loader -->
2024-04-15 22:19:31 +02:00
Kenji
bde895191d
docs(09-authentication): fixes link to NextAuth.js (#64457)
There's a TODO above the links, I didn't understand if it was related to
this PR as the domain was already authjs.dev

### What?

- Fixes the link to NextAuth in the `Examples` section

### How?

- Changes https://authjs.dev/guides/upgrade-to-v5 to
https://authjs.dev/getting-started/migrating-to-v5

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-04-15 12:49:53 -07:00
Jiwon Choi
81450de6af
hotfix: hardcoded skip turbopack tests to manifest (#64515)
cc @shuding 

CI run failed after #63053 on turbo production, which had not yet been
targeted for turbo.

x-ref: #63103

---------

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
Co-authored-by: Leah <8845940+ForsakenHarmony@users.noreply.github.com>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2024-04-15 19:46:42 +00:00
Tobias Koppers
6178693b39
disable production chunking in dev (#64488)
### What?

The production chunking plugin shouldn't be enabled in development

### Why?

It doesn't handle HMR yet


Closes PACK-2956
2024-04-15 21:22:22 +02:00
Jiwon Choi
2bd27e72e5
fix(next): Metadata.openGraph values not resolving basic values when type is set (#63620)
### What?

The string value of `Metadata.openGraph.emails` throws error:

```tsx
export const metadata = {
  openGraph: {
    type: 'article',
    emails: 'author@vercel.com',
  },
};
```

Error:

```sh
r.map is not a function
```

The type is:

```tsx
type OpenGraphMetadata = {
  // ...
  emails?: string | Array<string>
}
```

### Why?

Basic values such as `emails` and `phoneNumbers` were not included when
`ogType` was set while resolving the values.

### How?

Include basic values when resolving the metadata.

Fixes #63415
2024-04-15 21:17:48 +02:00
Ethan Arrowood
64da71cfc9
fix: lib/helpers/install.ts to better support pnpm and properly respect root argument (#64418)
This fixes and improves the `lib/helpers/install.ts` file (`install()`)
method to better support pnpm and properly respect the `root` argument.

I encountered an issue where by running `next <command> <project-dir>`,
and the `<command>` involved installing missing dependencies (like
`lint` or my upcoming `experimental-test`), it was not executing pnpm in
my `<project-dir>` because pnpm doesn't have a `--cwd` flag.



Closes NEXT-3092

Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2024-04-15 17:26:41 +00:00
vercel-release-bot
03b7a0fb12 v14.3.0-canary.0 2024-04-15 17:24:31 +00:00
JJ Kasper
4024a89ee8
Fix DynamicServerError not being thrown in fetch (#64511)
This ensures we properly skip calling a fetch during build-time that has
`cache: 'no-store'` as it should only be called during runtime instead.

Fixes: https://github.com/vercel/next.js/issues/64462

Closes NEXT-3114
2024-04-15 10:09:57 -07:00
Jiwon Choi
c325ecd69c
chore(next): add keywords on package.json (#64173)
I'm assuming leaving keywords blank is intended, but with 🖤 for Next.js,
I added 10 keywords to increase the traction of users.

- react
- web
- server
- node
- nextjs
- vercel

Also, included relative keywords that can be easily accessed from the
landing of [npm](https://www.npmjs.com).
 
 - framework
 - front-end
 - back-end
 - cli
 
![Screenshot 2024-04-07 at 11 27
50 PM](https://github.com/vercel/next.js/assets/120007119/37bfe915-61e5-42db-94c3-597391b6e74c)

Co-authored-by: Shu Ding <g@shud.in>
2024-04-15 16:33:32 +00:00
Jiwon Choi
30521f20ff
fix(next): global not-found not working on multi-root layouts (#63053)
## Why?

For multi-root layouts (route groups on the root with their root
layouts, no layout file on the root), it is not possible to use global
`not-found` since the `layout` is missing on the root.

```sh
.
└── app/
    ├── (main)/
    │   └── layout.js
    ├── (sub)/
    │   └── layout.js
    └── not-found.js --> ERR: missing layout
```

Current Behavior:

```sh
not-found.js doesn't have a root layout. To fix this error, make sure every page has a root layout.
```

## What?

Let multi-root layouts also benefit from the global `not-found`.

## How?

Wrap root `not-found` with default layout if root layout does not exist.
Although this solution is not `multi-root` specific, it won't produce
critical issues since a root `layout` is required for other cases.

Fixes #55191 #54980 #59180
2024-04-15 18:25:53 +02:00
vercel-release-bot
97b4a99b0b v14.2.1-canary.7 2024-04-15 16:21:28 +00:00
Sebastian Silbermann
edb9f7a142
Add typechecking test for all entrypoints (#64478) 2024-04-15 17:52:44 +02:00
Arne Wiese
2be9ccb658
Fix typo in dynamic-rendering.ts (#64365)
Super small PR - "oustide" should be "outside"

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

-->
2024-04-15 15:50:04 +00:00
Jeffrey Zutt
512cabc1ee
feat: strip traceparent header from cachekey (#64499)
### What?
We strip the `traceparent` header from the cache-key.

### Why?
The traceparent header forms part of the W3C Trace Context standard,
installed to track individual HTTP requests from start to end across
multiple services. That means each individual HTTP request will have a
unique traceparent value, reflecting its unique journey across servers
and services.

If we include the traceparent header in the cache key, the uniqueness of
the traceparent means the cache key would always be different even for
requests that should yield the same response. This would cause the cache
to always miss and re-process the request.

Effectively rendering fetch-cache useless.

Co-authored-by: Jeffrey <jeffrey@jeffreyzutt.nl>
2024-04-15 15:24:27 +00:00
Damien Simonin Feugas
e7a8645cb8
BREAKING CHANGE: remove deprecated analyticsId from config, and the corresponding performance-relayer files and tests (#64199)
### 🤔 What's in there?

We've deprecated config's `analyticsId` in 14.1.1 [almost 3 months
ago](https://github.com/vercel/next.js/releases/tag/v14.1.1-canary.2).
Users can opt in fot `@vercel/speed-insights`, or use
`useReportWebVitals` to report to any provider they'd like.

This PR:
- removes `analyticsId` key from configuration
- stops setting `__NEXT_PUBLIC_ANALYTICS_ID` env variable when the key
was present
- stops injecting `performance-relayer` file, when the variable is set
- cleans up related test code.
2024-04-15 15:23:30 +00:00
Vercel Release Bot
bf8aecb182
Update font data (#64481)
This auto-generated PR updates font data with latest available

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-04-15 15:10:22 +00:00
Abhay
d6476dae84
chore(docs): Add example usage of PixelBin custom image loader (#64074)
### Improving Documentation
Integrate PixelBin Custom Image Loader for optimized image handling

PixelBin is Real-time image transformations with automatic optimization,
image URL and storage for efficient image organization

### References

- [Resize
Doc](https://www.pixelbin.io/docs/transformations/basic/resize/#width-w)
- [Optimize Doc](
https://www.pixelbin.io/docs/optimizations/quality/#image-quality-when-delivering)

### Contributors

- @pnutmath
- @umesh162


Co-authored-by: Steven <steven@ceriously.com>
2024-04-15 15:10:07 +00:00
JJ Kasper
9c83a3458c
Fix missing PagesOnly in 05-mdx (#64505)
Looks like we have a syntax error in
https://github.com/vercel/next.js/pull/63568 from missing closing
`</PagessOnly>` tag.

```sh
b383-75ab3d452c93.mdx:0:0: ERROR: [plugin: @mdx-js/esbuild] Expected a closing tag for `</PagesOnly>` (503:1-503:12)
```

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

Closes NEXT-3111
2024-04-15 07:56:53 -07:00
Ryota Murakami
4623eace76
chore: Update pnpm v8.15.1 to v8.15.7 (#64479)
Here are the release notes for pnpm versions v8.15.2 through v8.15.7,

- [v8.15.2 Release
Notes](https://github.com/pnpm/pnpm/releases/tag/v8.15.2)
- [v8.15.3 Release
Notes](https://github.com/pnpm/pnpm/releases/tag/v8.15.3)
- [v8.15.4 Release
Notes](https://github.com/pnpm/pnpm/releases/tag/v8.15.4)
- [v8.15.5 Release
Notes](https://github.com/pnpm/pnpm/releases/tag/v8.15.5)
- [v8.15.6 Release
Notes](https://github.com/pnpm/pnpm/releases/tag/v8.15.6)
- [v8.15.7 Release
Notes](https://github.com/pnpm/pnpm/releases/tag/v8.15.7)
2024-04-15 14:54:28 +00:00
vercel-release-bot
f9cd55ff32 v14.2.1-canary.6 2024-04-15 10:45:59 +00:00
Tobias Koppers
2766ebc8d3
improve turborepo caching (#64493)
### What?

There is a race condition in the `pull-build-cache` script. When the
remote cache entry was removed between the dry run and the real run, it
will run the command and caches whatever is in the native folder.

Seems like there are some very old leftover files there which lead to an
broken publish.

This changes the command to fail when there are no files and empties the
folder before running the script. This should lead to pull-build-cache
to failing instead.

Closes PACK-2957
Fixes #64468
2024-04-15 12:42:28 +02:00
vercel-release-bot
33e8334d35 v14.2.1-canary.5 2024-04-14 21:39:40 +00:00
Jiachi Liu
cb8fb3291a
Fix client boundary inheritance for barrel optimization (#64467)
### What

Inherit the client boudaries from the found matched target in load
barrel

### Why
The root cause with the barrel transform, we missed the client boundary
directive during the transform.
Since the new version of mui's case looks like this:

Import path
page.js (server module) -> `<module>/index.js` (shared module) ->
`<module/subpath>/index.js` (client module) ->
`<module/subpath/sub-module.js> (client module)

After our transform, we lost the `"use client"` which causes the
mismatch of the transform:

In `rsc` layer: the file pointing to the sub module entry
(`<module/subpath>/index.js`), but without the client boundary.


Fixes #64369 
Closes NEXT-3101
2024-04-14 23:36:20 +02:00
Lee Robinson
50ed4542df
docs: fix config variable usage in memory docs (#64469)
Closes https://github.com/vercel/feedback/issues/61864
2024-04-14 11:00:36 -05:00
vercel-release-bot
2a605af154 v14.2.1-canary.4 2024-04-13 23:23:45 +00:00
Michael Novotny
fbc0a0eb8c
docs: Adds MDX Components file convention page and updates MDX page (#63568)
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Ethan Arrowood <ethan@arrowood.dev>
2024-04-13 13:07:18 -05:00
Zack Tanner
a5bb7c46b1
router restore should take priority over pending actions (#64449)
Since the router processes events sequentially, we special case
`ACTION_NAVIGATE` events to "discard" a pending server action so that it
can process the navigation with higher priority. We should apply this
same logic to `ACTION_RESTORE` events (e.g. `router.back()`) for the
same reason.

Fixes #64432


Closes NEXT-3098
2024-04-13 10:49:57 -07:00
Zack Tanner
f602b2979c
default fetchCache to no-store when force-dynamic is set (#64145)
`fetchCache` is a more fine-grained segment level cache-control
configuration that most people shouldn't have to use. Current semantics
of `dynamic = "force-dynamic"` will still treat the fetch as cacheable
unless explicitly overriding it in the fetch, or setting a segment level
`fetchCache`.

The `dynamic` cache configuration should be seen as a "top-level"
configuration, while more fine-grained controls should inherit logical
defaults from the top-level. Otherwise this forces people to opt-into
the `fetchCache` configuration, or manually override each `fetch` call,
which isn't what you'd expect when forcing a segment to be dynamic.

This will default to not attempting to cache the fetch when
`force-dynamic` is used. As a result, I had to update one of the
`app-static` tests to use `revalidate: 0` rather than `force-dynamic`,
as the revalidate behavior is slightly different in that it won't modify
the revalidation time on a fetch if it's non-zero.

Closes NEXT-2067
2024-04-13 17:05:47 +00:00
Zack Tanner
14ed612dbc
tweak test for Azure (#64424)
Looks like the `useTempDir` function throws when running in Azure rather
than piping the message to stderr. This makes the test resilient to both
cases.

<!-- 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-3095
2024-04-13 10:05:25 -07:00
kxlow
9b77edee06
Fix optimizePackageImports docs for Pages Router (#64439)
The current documentation displays the docs for the `compress` option
instead of the `optimizePackageImports` option.


https://nextjs.org/docs/pages/api-reference/next-config-js/optimizePackageImports
2024-04-13 16:46:06 +00:00
Jiachi Liu
7ef6c4eb17
Revert "Fix: css in next/dynamic component in edge runtime" (#64442)
The fix is not correct, we already have request ALS wrapping the request
in app-render, shouldn't get another one for edge adapter. This is
actually a bundler bug

Reverts vercel/next.js#64382

Closes NEXT-3097
2024-04-13 13:32:18 +02:00
Hung Doan
904908cf33
docs(pages): update slug value for optional catch all routes (#64381)
## Why?

When you do, →

```
  const router = useRouter()
  console.log('[test] router =', router.query.slug)
 ```
 
 the value of `router.query.slug` should be undefined in this instance.
 
 (screenshot from current docs)
![CleanShot 2024-04-13 at 00 18 14@2x](https://github.com/vercel/next.js/assets/28912696/6cd79b3e-9258-4fcb-8685-dc6fe4d336e8)

it should be `slug: undefined`.
2024-04-13 04:23:45 +00:00
vercel-release-bot
68f722ba2d v14.2.1-canary.3 2024-04-12 23:19:45 +00:00
Colton Ehrman
9994e74a6c
fix(next-lint): update option --report-unused-disable-directives to --report-unused-disable-directives-severity (#64405)
## Why?

The Option name and type has been incorrect for
`--report-unused-disable-directives` (it's likely that
https://github.com/vercel/next.js/pull/61877 exposed this.

For correctness, we have updated the name to
`--report-unsed-disable-directives-severity` →
https://eslint.org/docs/v8.x/use/command-line-interface#--report-unused-disable-directives-severity.

- Fixes https://github.com/vercel/next.js/issues/64402

---------

Co-authored-by: samcx <sam@vercel.com>
2024-04-12 22:09:05 +00:00
Shu Ding
d06c54767b
Fix the method prop case in Server Actions transform (#64398)
This PR fixes the case where object method and class method prop
functions are not considered as a new scope. Closes #63603.

Closes NEXT-3088
2024-04-13 00:05:50 +02:00
Shu Ding
52ae1f8a55
Improve rendering performance (#64408)
This PR improves the server rendering performance a bit, especially for
the App Router. It has mainly 2 changes.

A rough benchmark test with a 300kB Lorem Ipsum page, SSR is about 18%
faster.

### Improve `getServerInsertedHTML`

- Avoid an extra `renderToReadableStream` if we already know the content
will be empty
- Avoid `await stream.allReady` for better parallelism with
`streamToString()`
- Increase the `progressiveChunkSize`

### Improve `createHeadInsertionTransformStream`

- Only do chunk splitting and enqueuing if the inserted string is not
empty
2024-04-13 00:03:11 +02:00
Will Binns-Smith
b7b7f97359
Update lockfile for compatibility with turbo (#64360)
Closes PACK-2940
2024-04-12 12:12:47 -07:00