Commit graph

19208 commits

Author SHA1 Message Date
vercel-release-bot
0fc29480fc v14.1.1-canary.1 2024-01-19 06:02:07 +00:00
JJ Kasper
bde427a7d7
Optimize build trace ignores (#60859)
It seems that when tracing build dependencies our server tracing was
analyzing all server chunks un-necessarily and when a very large
dependency like `ace-builds` is creating large chunks it can slow down
builds drastically so this ensures we eagerly apply our shared ignores
to avoid this over tracing.

Build times before [with provided
repro](https://github.com/MartinXPN/next-slow-build-reproduction):

```sh
▲ Next.js 14.1.0

   Creating an optimized production build ...
 ✓ Compiled successfully
 ✓ Linting and checking validity of types
 ✓ Collecting page data
 ✓ Generating static pages (5/5)
 ✓ Collecting build traces
 ✓ Finalizing page optimization

  Done in 437.29s.
```

Build times after [with provided
repro](https://github.com/MartinXPN/next-slow-build-reproduction):

```sh
▲ Next.js 14.1.1-canary.0

   Creating an optimized production build ...
 ✓ Compiled successfully
 ✓ Linting and checking validity of types
 ✓ Collecting page data
 ✓ Generating static pages (5/5)
 ✓ Collecting build traces
 ✓ Finalizing page optimization

  Done in 42.38s.
```


Closes: https://github.com/vercel/next.js/issues/58759
Closes NEXT-2161
2024-01-18 21:58:05 -08:00
Sam Ko
3a8436b128
chore: update issue_popular workflow to 90 days (#60860)
## Changes

- Update issue_popular to 90 days for broader look at issues

Closes NEXT-2163
2024-01-19 05:52:27 +00:00
Jesse Koldewijn
3734ae8890
fix: added @sentry/profiling-node to sep list to prevent build/bundle breakage (#60855)
Issue: https://github.com/vercel/next.js/issues/60853

### What?
Added `@sentry/profiling-node` to the server-external-package object so
that sentry users who want to use this package don't have to manually
add this package in the experimental nextjs config entry.

### Why?
Package bundling will fail as shown in the following issue if not added
to this exclude list.
https://github.com/getsentry/profiling-node/issues/170

---

Fixes #60853
2024-01-19 05:16:03 +00:00
Taishi
f000352723
upgrade @types/react-dom to v18.2.18 to import useFormState for server actions in with-supabase example (#60822)
### Adding or Updating Examples

I can't import `useFormState` from `react-dom` with
`@types/react-dom@18.2.5`, so I upgrade it to the latest version of it.

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-19 04:19:11 +00:00
Lee Robinson
4f07843de5
docs: another fix for code block (#60856) 2024-01-18 18:09:11 -06:00
Delba de Oliveira
cb42417985
Docs: Update parallel routes docs, add default.js pt 1. (#60806) 2024-01-18 17:57:54 -06:00
Lee Robinson
1cafe945ab
docs: fix JS/TS code block (#60854)
And also making it more clear it doesn't have to be two separate files.
2024-01-18 17:48:24 -06:00
vercel-release-bot
fcfa45cd8e v14.1.1-canary.0 2024-01-18 23:23:12 +00:00
Lee Robinson
1941fc1672
docs: Improve useSearchParams bailout error page (#60852) 2024-01-18 17:12:50 -06:00
JJ Kasper
a90e5d6e4b
Fix last stable tag for release stats (#60850)
x-ref:
https://github.com/vercel/next.js/actions/runs/7576301894/job/20635069339

Closes NEXT-2159
2024-01-18 14:50:31 -08:00
JJ Kasper
75f73fe93d
Update build worker warning to use debug (#60847)
Since we are enabling `webpackBuildWorker` by default now we should move
this warning to debug since it can be confusing without additional
context.

x-ref: [slack
thread](https://vercel.slack.com/archives/C04KC8A53T7/p1705612748627769?thread_ts=1705599489.811039&cid=C04KC8A53T7)

Closes NEXT-2158
2024-01-18 14:35:13 -08:00
vercel-release-bot
16e7a5bd93 v14.1.0 2024-01-18 21:41:02 +00:00
Ethan Arrowood
8a3881fef0
Update labeler.json (#60843)
Add @Ethan-Arrowood to labeler list
2024-01-18 12:15:15 -08:00
vercel-release-bot
1b255a6c5b v14.0.5-canary.68 2024-01-18 20:14:53 +00:00
Jiachi Liu
02c2f11ec9
Enable missing suspense bailout by default (#60840)
`experimental.missingSuspenseWithCSRBailout` should be enabled by
default to help users to disciver unwrapped suspense boundaries.

Add more notes in the error doc about deprecation and temporary
workaround to disable it.

Closes NEXT-2157

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-01-18 21:11:22 +01:00
vercel-release-bot
2096dfa687 v14.0.5-canary.67 2024-01-18 17:48:11 +00:00
Jiachi Liu
b8d8e6e7cc
dx: warn the deprecated cache configs are used (#60836)
Follow up for #57953 for DX, give better warnings

x-ref:
https://github.com/vercel/next.js/pull/60828#discussion_r1457736645

Closes NEXT-2156
2024-01-18 18:38:29 +01:00
Jiachi Liu
c192f4ec2f
turbopack: rename custom cache handler configs (#60828)
Follow up for #57953 for turbopack side

Closes NEXT-2153
2024-01-18 18:10:10 +01:00
Steven
2227ae5f34
Revert "Fix: Throw an error for empty array return in generateStaticParams with output:export" (#60831)
Reverts vercel/next.js#57053 per this comment:
https://github.com/vercel/next.js/pull/57053#issuecomment-1892747474

Instead of erroring, we should warn (and only in dev mode). That can be
added in a future PR.

Closes NEXT-2155
2024-01-18 18:02:07 +01:00
Jiachi Liu
b7f5107544
Fix: respect init.cache if fetch input is request instance (#60821)
When there’s a request input instance and init object present the same
time, we should respect init as preferred

Closes NEXT-2149
2024-01-18 17:54:36 +01:00
JJ Kasper
752c15e798
Add metrics names for unstable_cache (#60802)
This ensures we add params for `unstable_cache` so it can be identified
the same was as fetches instead of being unlabeled.

Closes NEXT-2143
2024-01-18 17:49:35 +01:00
JJ Kasper
e733853cf5
Ensure request specific caches for revalidate are reset (#60810)
This ensures our in memory cache leveraged for the `fetch-cache`
interface is reset per-request instead of using an arbitrary timeout so
that we are always pulling the revalidate state from upstream correctly
on new requests.

Before:
https://vercel-revalidate-3zi8wpexo-vtest314-ijjk-testing.vercel.app/
After:
https://vercel-revalidate-70y5a8dbh-vtest314-ijjk-testing.vercel.app/

Closes: https://github.com/vercel/next.js/issues/60680

Closes NEXT-2144
2024-01-18 16:43:55 +00:00
Lee Robinson
ecbc36cdd2
Fix error from the auth docs. (#60829) 2024-01-18 10:24:39 -06:00
Leah
c2473471e2
feat: support custom image loaders in turbopack (#60736)
### What?
We were missing the alias (and config field) for custom image loaders.

Closes PACK-2190
Fixes #60097
2024-01-18 16:23:06 +00:00
Steven
cb71d80879
chore(deps): update browserslist and caniuse-lite (#60827)
Closes #57872
Closes NEXT-2152
2024-01-18 16:14:38 +00:00
Delba de Oliveira
54f73a218e
Docs: Use JS comment for MDX (#60825)
Co-authored-by: Stephanie Dietz <49788645+StephDietz@users.noreply.github.com>
2024-01-18 09:56:53 -06:00
Jiachi Liu
d450ff787d
docs: add build worker optout error back with upgrade advice (#60826)
x-ref: https://github.com/vercel/next.js/pull/60820/files#r1457566492

Closes NEXT-2151
2024-01-18 15:43:19 +00:00
Steven
afcafcdd29
chore(docs): fix example documentation for Art Direction (#60823)
This PR fixes a few typos in the docs from
https://github.com/vercel/next.js/pull/60739
2024-01-18 09:31:00 -06:00
Jiachi Liu
7472cefb42
Remove the warning for build worker when custom webpack present (#60820)
Drop the warning of build worker due to the common usage of custom
webpack

Closes NEXT-2148
2024-01-18 15:06:08 +00:00
Stephanie Dietz
65fce8aa6b
add authentication docs page (#60388)
I've updated the Next.js documentation to include a new page covering
the best practices for implementing authentication. This doc covers the
essential concepts of authentication in Next.js, focusing on practical
strategies, effective session management, and robust authorization
techniques.

Key aspects of the update:

- Core Authentication Concepts: Introduced foundational concepts of
authentication, detailing their relevance and application in Next.js
projects.
- Diverse Authentication Strategies: Expanded on various authentication
strategies, providing insights on when and how to use them effectively
in different scenarios.
- Implementing Authentication in Next.js: Guided through the
implementation process, illustrating the use of middleware, server
actions, and route handlers to create a secure and user-friendly
authentication system.
- Session Management Techniques: Discussed different approaches to
session management, highlighting their pros and cons to aid in choosing
the most suitable method for specific project needs.
- Securing Application Access: Detailed how to protect routes and manage
user permissions, ensuring that access is granted appropriately based on
user roles and authentication status.
- Next.js Compatible Solutions: Included references to several
compatible authentication solutions for Next.js, facilitating easy
integration and setup.

---------

Co-authored-by: Balázs Orbán <info@balazsorban.com>
Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-01-18 15:21:56 +01:00
Balázs Orbán
b14c1eb991
fix(ts): auto-complete next/headers (#60817)
### What?

Add support for auto-importing `headers()` and `cookies()`

### Why?

Improve the auto-import experience in IDEs like VScode

### How?

Re-export the `next/headers` type references

Closes NEXT-2146
2024-01-18 15:01:22 +01:00
vercel-release-bot
8179e7008e v14.0.5-canary.66 2024-01-18 12:52:28 +00:00
Jiachi Liu
e0399ca6dc
Support next/og usage in ESM nextjs app (#60818)
### What 

Follow up for #59852 , now you can use `next/og` if your nextjs app is
marked as ESM with `"type": "module"` in package.json.

### How

It's a bug in external handling, we shouldn't ESM import error for local
requests. Previously you'll see the below error but the
og import shouldn't be errored as it's not external package

```
Module not found: ESM packages (/.../app/opengraph-image.js) need to be imported. Use 'import' to reference the package instead
 https://nextjs.org/docs/messages/import-esm-externals
```


Closes NEXT-2147
2024-01-18 13:44:50 +01:00
Tim Neutkens
299d145303
Use snapshots for component-stack tests (#60768)
### What?

Follow-up to #60579 and #60750. Checking `startsWith` is not enough
because it hides the rest of the stack. Changed the test to check the
snapshot for Turbopack and webpack.

Fixes a bug where the stack lines showed `http (NaN:NaN)` as the source
lines.

Added support for source lines that don't have a open in editor.

<!-- 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-2128
2024-01-18 13:44:03 +01:00
Tim Neutkens
486567d2d7
Update ReactRefreshRegression test snapshot for Turbopack (#60767)
## What?

While looking at some tests that use this helper I noticed we have the
helper duplicated currently. This ensures the session uses the same
helper.

<!-- 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-2127
2024-01-18 11:06:04 +01:00
Willi#m ⬣
c5bdc5c54f
add missing function call to normalize-catchall-routes test case (#60777)
### Fixed a Test Case

- Tests fixed:
`packages/next/src/build/normalize-catchall-routes.test.ts`, the
function call `normalizeCatchAllRoutes(appPaths)` was removed by
accident in this [merged commit
](efebba80a7 (diff-e3c0d3c6e15d8b035a3252a1ada2b04d5dd33010885fed8f6d689f75aa80bff5))
rendering the test case pointless

REF NEXT-1984
2024-01-18 00:33:54 -08:00
Dima Voytenko
9e8e44e530
Dev Server: Preserve globals overwrites in the initialization hook (#60796)
The original dev server implementation records globals in the server
constructor and thus overwrites the values initialized in the
instrumentation hook. This is a major delta from the `next start` where
the instrumentation values are preserved.

Fixes: https://github.com/vercel/next.js/issues/47596
Fixes: https://github.com/vercel/next.js/issues/53407
2024-01-17 16:32:54 -08:00
Shu Ding
fd59a007e1
Fix Server Actions compiler bug (#60794)
This PR fixes the issue where an inline Server Action gets exported. As
this isn't the designed use case for inline Server Actions (they're
supposed to be defined and used inside another closure, such as
components), we are not handling the export cases currently:

```ts
export async function action() {
  "use server"
  ...
}

<form action={action}/>
```

...which gets compiled into:

```ts
export async function action() {} // No-op function

<form action={...actionReference...}/>
```

Note that everything works inside this module until you `import` that
action and use it in another module.

To tackle that, this PR changes how that works as described in
`server/27/output.js`.

Closes NEXT-2140
2024-01-18 01:29:07 +01:00
Steven
4b50313fd9
feat: stabilize unstable_getImgProps() => getImageProps() (#60739)
This PR renames `unstable_getImgProps` to `getImageProps()` (originally
introduced in PR #51205).

Most feedback [after
announcing](https://twitter.com/leeerob/status/1674250190432116736)
looks positive so it seems like we can safely stabilize this API now.
Its unlikely to change.

I also added documentation with example usage.

Closes NEXT-2120
Fixes https://github.com/vercel/next.js/issues/56009
2024-01-17 18:28:49 -05:00
vercel-release-bot
70fc4028eb v14.0.5-canary.65 2024-01-17 23:23:34 +00:00
Lee Robinson
16dcebe792
Stabilize custom cache handlers and changing memory size. (#57953)
This PR stabilizes the previously introduced experimental config options
for providing a custom cache handler (for both ISR as well as the Data
Cache) and for disabling or configuring the in-memory cache size. The
example usage would be as follows:

```js
// next.config.js
module.exports = {
  cacheHandler: require.resolve('./cache-handler.js'),
  cacheMaxMemorySize: 0 // disable default in-memory caching
}
```

This PR also updates the documentation to better reflect how to use the
custom cache handler when self-hosting. Further information will be
added in a following PR that also includes a full example of a custom
cache handler that implements `revalidateTag` as well as passing in
custom cache tags. The API reference docs have been updated here, as
well as a version history added.

I also noticed that we currently have two duplicated versions of the ISR
docs in the Pages Router docs: both for rendering and for data fetching.
Data Fetching is the correct location for this page. There were no other
references to the rendering version in the docs, so that must have been
an accident. I'll need to a get a redirect going for that regardless.

Tests have been updated for `cacheHandler` and I added a new test for
`cacheMaxMemorySize`.

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2024-01-17 23:42:52 +01:00
JJ Kasper
8e216ecb8d
Fix locale domain public files check (#60749)
This ensures we properly handle serving public files when routing via a
locale domain and adds regression tests for this case.

Closes: https://github.com/vercel/next.js/issues/54765
Closes: https://github.com/vercel/next.js/pull/59773
Closes: https://github.com/vercel/next.js/pull/55137
Closes NEXT-2123
2024-01-17 13:41:16 -08:00
vercel-release-bot
8d4e5be736 v14.0.5-canary.64 2024-01-17 17:59:57 +00:00
Tobias Koppers
861b472b12
fix layout segment key to match up with manifest (#60783)
### What?

When webpack loaders are applied on a page file and it's renamed with
the `as` key, layout segment key no longer matches. This fixes that

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes PACK-2251
2024-01-17 17:11:50 +00:00
JJ Kasper
72e381c8b0
Fix tests exit race condition (#60757)
This ensures we don't allow a following exit condition to override a
previous as async work is done before the `process.exit` actually occurs
so a follow-up one could override the first giving a false negative.

Closes NEXT-1911
2024-01-17 17:09:57 +01:00
vercel-release-bot
a211566655 v14.0.5-canary.63 2024-01-17 15:14:46 +00:00
Tobias Koppers
b24ba17cc7
apply page transforms only on pages (#60779)
### What?

apply page transforms only on pages as intended

### Why?

Before they were applied on all files


Closes PACK-2250
2024-01-17 16:11:09 +01:00
Tim Neutkens
4548fed1cf
Skip postcss config location resolving in node_modules (#60697)
## What?

Skip postcss config resolving in node_modules for Turbopack. This
matches current Next.js on webpack closer as that only resolves the
postcss config from the project root. The additional feature Turbopack
has is that it can find a postcss config relative to the css being
compiled. This is useful for e.g. reducing the amount of overhead
certain postcss plugins that only have to run against a single file take
(i.e. Tailwindcss).


Depends on github.com/vercel/turbo/pull/7012 landing first.

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

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2024-01-17 13:54:17 +00:00
vercel-release-bot
c583528116 v14.0.5-canary.62 2024-01-17 11:37:23 +00:00