Commit graph

19233 commits

Author SHA1 Message Date
Yuto Yoshino
04860649da
examples: Change "pages" to "apps" in the Image Component Example description. (#60929) 2024-01-21 09:52:10 -06:00
Jason
39589ff350
docs: Improves generateViewport documentation (#60396) 2024-01-20 21:11:05 -06:00
Ahmed Abdelbaset
e4172ea373
docs: mention missing optimized by default packages in optimizePackageImports (#60058)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-20 20:54:20 -06:00
Ziya Fenn
499fd9302a
docs: clarify redirects behavior with pages router (#60610)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-20 20:47:14 -06:00
Arseny
3b46f22bb1
Update Redis Cache example with stabilized API (#60800)
This pull request updates the `cache-handler-redis` example with a
stabilized API. The updated `next.config.js` now uses the stable
`cacheHandler` option instead of the
`experimental.incrementalCacheHandlerPath`.
2024-01-21 02:40:54 +00:00
Ethan Arrowood
a1610fecd8
Fix basic-app benchmark application (#60842)
Fairly basic PR that just fixes the `basic-app` benchmark application.
The api route was throwing an error since it wasn't returning a
`Response`, and renamed some `pages/` directory routes so they become
available.
2024-01-20 20:35:20 -06:00
Sam Ko
43227c0dd5
chore: remove lock from with-algolia-react-instantsearch example (#60910)
## Changes

- Remove `pnpm-lock.yaml` from with-algolia-react-instantsearch example

Closes NEXT-2174
2024-01-20 20:34:37 -06:00
vercel-release-bot
48533617d1 v14.1.1-canary.4 2024-01-20 23:23:00 +00:00
Will Binns-Smith
498f342b35
Turbopack: always log HMR rebuild times (#60908)
This removes the need for `NEXT_HMR_TIMING` to do this.


Closes PACK-2264

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-01-19 17:07:22 -08:00
Rishabh Poddar
7d4888d961
Updates with-supertokens example app (#60901)
Refactors with-supertokens example app to move some of the helper
functions into the SDK.
2024-01-20 00:35:28 +00:00
vercel-release-bot
5c0e1419ef v14.1.1-canary.3 2024-01-19 23:39:47 +00:00
Will Binns-Smith
7b9e711ed5
Report HMR latency as trace spans for Turbopack (#60799)
This:
- Makes makes reporting hmr changes more accurate by emitting an
explicit start event and lowering the aggregation period for reporting
completed turbo tasks
- Parameterizes the aggregation period, allowing JS subscribers to
request different intervals, such as for the next-rs-api test
- Aligns path pattern with webpack by normalizing its layer names
- Fixes a bug in `drainAndGetNext` where the stream never could drain
past the first item
- Sends `client-hmr-latency` spans from Turbopack in both page and app
router pages


Closes PACK-2252

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2024-01-19 15:34:17 -08:00
vercel-release-bot
f6da5a0fe2 v14.1.1-canary.2 2024-01-19 23:21:34 +00:00
Lee Robinson
40e2c4623e
docs: small tweak to videos (#60904) 2024-01-19 16:01:50 -06:00
Lee Robinson
ae46eb8835
docs: small tweaks on video docs (#60902)
https://nextjs.org/docs/app/building-your-application/optimizing/videos
2024-01-19 15:28:30 -06:00
Sukka
53a0a0fb87
chore: replace micromatch w/ picomatch (#60699)
The PR continues from #58038 aiming to reduce the installation size
further, and **improve performance in doing so**.

Most of `micromatch`'s APIs are essentially wrappers/alias of
`picomatch`, supplemented with additional features facilitated by a
transitive dependency `braces`. However, Next.js doesn't use those
"extra features". Switching from `micromatch` to `picomatch` can avoid
introducing the transitive dependency `braces`.

The PR also improves some globs' performance by hoisting.

- `micromatch.makeRe` is just an alias of `picomatch.makeRe`
-
90dc0cd3e1/index.js (L387C30-L387C30)
- `micromatch.isMatch(str, patterns, options)` equals
`picomatch(patterns, options)(str)`
-
90dc0cd3e1/index.js (L123)
- `micromatch.matcher` is just an alias of `picomatch`
-
90dc0cd3e1/index.js (L104C1-L104C40)

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-19 19:56:16 +00:00
Stephanie Dietz
4a74492196
Add documentation page on video optimization (#60574)
I've added a new page to the Next.js docs about optimizing videos. It
covers:

- the native video and iframe tag
- displaying externally hosted videos (i.e. from youtube) 
- self hosting strategies and best practices 
- Video optimization techniques

---------

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Co-authored-by: Josh Lubawy <jlubawy@gmail.com>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2024-01-19 13:09:48 -06:00
Dima Voytenko
35422800fa
Telemetry: createComponentTree span (#60857)
This span is meant to be a parent for all "resolve segment modules"
spans.
2024-01-19 10:40:08 -08:00
Liam Laverty
adae5f2cdf
Adds a link to CSP where it's first referenced in the headers docs (#60871)
### What?
Adds a link to CSP documentation the first time it's mentioned in the
headers page here:
https://nextjs.org/docs/app/building-your-application/configuring/content-security-policy

### Why?
Convenience for users, as it's unclear at that point in the document
that `CSP` is discussing `Content-Security-Policy`, and the first
reference to its docs are at the end of the page.

### How?
Added a link to the CSP doc here
https://nextjs.org/docs/app/building-your-application/configuring/content-security-policy
2024-01-19 18:38:33 +00:00
Balázs Orbán
6217e3fb10
chore: fix core team members (#60900)
### What?

Removing an outdated entry, and fixing the casing of another so Workflow
runs are auto-approved.

### Why?

https://github.com/vercel/next.js/pull/60574 fails the CI Workflow Run,
because of a mismatch in GitHub actor and the actual username set in
`labeler.json`


[Ref](c26bc3f265/validate-job.js (L39-L42)),
[Slack
thread](https://vercel.slack.com/archives/C03S9JCH2Q5/p1705684536884389?thread_ts=1705436555.494229&cid=C03S9JCH2Q5)

Closes NEXT-2172
2024-01-19 10:19:32 -08:00
Balázs Orbán
dc109bf6c9
chore: indicate staleness more prominently in next info output (#60376)
### What?

Improve the `next info` output.

<details>
<summary>Before:
</summary>
<img
src="https://github.com/vercel/next.js/assets/18369201/735da72f-6746-42a0-838d-e10db78b2db3">
</details>

<details>
<summary>After:
</summary>
<img
src="https://github.com/vercel/next.js/assets/18369201/d72c0027-71d9-494c-bb98-dd0fed99c8d9">
</details>

### Why?

People have been ignoring the ask to check `next@canary` before opening
a new issue, which results in triaging overhead. This PR inlines the
warning into `next info` that would make it an extra effort to remove
the warning without reading the message, hopefully leading to not
ignoring the message anymore.

### How?

Reusing the same logic from the version staleness indicator from Error
Overlay.

[Slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1704364764719949)
2024-01-19 18:36:19 +01:00
Tobias Koppers
f3e6755356
flag test as failing (#60892)
Closes PACK-2258
2024-01-19 16:04:03 +01:00
Vercel Release Bot
c170efe115
Update Turbopack test manifest (#60870)
This auto-generated PR updates the integration test manifest used when
testing Turbopack.
2024-01-19 15:04:59 +01:00
Damien Simonin Feugas
821849261d
Deprecation warning for config.analyticsId (#60677)
###  🧐 What's in there?

`config.analyticsId` is a rarely-used mechanism, initially intended to
Next.js users hosting their application themselves and willing to report
Core Web Vitals to Vercel Speed Insights.

This platform specific mechanism can be replaced with the built-in
[`useReportWebVitals`](https://nextjs.org/docs/app/api-reference/functions/use-report-web-vitals).

### 🧪 How to test?

1. make a new Next.js app
1. define env variable `VERCEL_ANALYTICS_ID` to a dummy value
1. start your application in dev mode:
   ```shell
⚠ config.analyticsId is deprecated and will be removed in next major
version. Read more:
https://nextjs.org/docs/messages/deprecated-analyticsid
   
      ▲ Next.js 14.0.5-canary.58
      - Local:        http://localhost:3000
    ✓ Ready in 917ms
   ```
1. build your application:
   ```shell
      ▲ Next.js 14.0.5-canary.58
   
      Creating an optimized production build ...
    ✓ Compiled successfully
      Linting and checking validity of types  .
⚠ The Next.js plugin was not detected in your ESLint configuration. See
https://nextjs.org/docs/basic-features/eslint#migrating-existing-config
    ✓ Linting and checking validity of types
    ✓ Collecting page data
    ✓ Generating static pages (4/4)
⚠ `config.analyticsId` is deprecated and will be removed in next major
version. Read more:
https://nextjs.org/docs/messages/deprecated-analyticsid
    ```
1. remove the env variable, add a `next.config.js` file with a dummy
`analyticsId` variable:
   ```js
   module.exports = { analyticsId: "UA-12345678-9" };
   ```
1. start your application in dev mode: it'll issue the same warning.
1. build your application: it'll issue the same warning.

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2024-01-19 14:45:05 +01:00
Victor Eke
2de7f953b1
correct description of skipMiddlewareUrlNormalize in advanced middleware flags (#60841)
I think there's some form of typographical error in the
`skipMiddlewareUrlNormalize` line under the advanced middleware flags
section of the docs.

This is the line from the docs [Source
link](https://nextjs.org/docs/app/building-your-application/routing/middleware#advanced-middleware-flags):

> `skipMiddlewareUrlNormalize` allows disabling the URL normalizing
Next.js does to make handling direct visits and client-transitions the
same. There are some advanced cases where you need full control using
the original URL which this unlocks.

Corrected to:

> `skipMiddlewareUrlNormalize` allows disabling URL normalizing in
Next.js to make handling direct visits and client-transitions the same.
There are some advanced cases where you need full control using the
original URL which this unlocks.


<!-- 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: Sam Ko <sam@vercel.com>
2024-01-19 06:06:42 +00:00
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