Commit graph

16086 commits

Author SHA1 Message Date
vercel-release-bot
41d92fe3fd v13.4.5-canary.11 2023-06-10 19:47:11 +00:00
Pau Fernández
bd97c01fca
docs: remove added verb and fix good to know section. (#51054) 2023-06-10 11:55:27 -07:00
Arun S V
6a9fb9e77f
Update 03-linking-and-navigating.mdx (#51084)
Fixed a typo in 'Scrolling to an id' section.

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

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

-->
2023-06-10 11:53:42 -07:00
Michael Novotny
8366f1af31
docs: Clarify manual graceful shutdown in dev server (#51078)
Replaces #50481

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Co-authored-by: Lee Robinson <me@leerob.io>
2023-06-10 07:24:25 -07:00
Michael Novotny
e797546ee3
Adds missing and in How to Use These Docs section (#51058)
Fixes #50227
2023-06-10 13:15:02 +00:00
Michael Novotny
83860091a6
Removes PORT from .env concatenation example (#51063)
This is to [avoid confusion](https://github.com/vercel/next.js/issues/32603#issuecomment-996751692) about being able to set Next.js's port via `.env`, which is currently not allowed.
2023-06-10 10:47:49 +00:00
OJ Kwon
9bc73dbc1a
ci(workflow): generate run summary for all build targets (#51057)
### What?

I noticed some deploy job fails at

https://github.com/vercel/next.js/actions/runs/5222848985/jobs/9428961695#step:15:20

when there's no summary exists by missing necessary flags for the few platform targets.
2023-06-10 00:27:44 +00:00
vercel-release-bot
387430c659 v13.4.5-canary.10 2023-06-09 23:46:48 +00:00
JJ Kasper
32a9c3553f
Fix another case with app router revalidation (#51076)
This ensures we don't attempt streaming a response during revalidation
in deployed environments.

x-ref: https://github.com/vercel/next.js/pull/51062
x-ref: [slack
thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1686216024812579)
2023-06-09 16:40:41 -07:00
Delba de Oliveira
ccc64d96b6
[Docs] Remove html <b> from summaries (#51008)
This PR removes manual HTML `<b>` tags in `<details><summary>...` titles. They are unnecessary because we add bold styling in CSS.

Also did a tiny fix to some other unnecessary inline HTML.
2023-06-09 22:12:58 +00:00
Michael Novotny
9fad474018
Adds the "why" for next/image optimization (#51066)
Give a touch more context as to why one would want to use image optimization.

Fixes #30220
2023-06-09 22:02:35 +00:00
Steven
1a0b5d25c6
fix: moduleResolution: bundler support in tsconfig.json (#51065)
- Fixes https://github.com/vercel/next.js/issues/47858
- Closes https://github.com/vercel/next.js/pull/50289

fix #47858
fix NEXT-1281

Co-authored-by: Kevin Wolf <3157426+kevinwolfcr@users.noreply.github.com>
2023-06-09 21:48:13 +00:00
JJ Kasper
90ee9589d6
Update response cache test (#51072)
x-ref: https://github.com/vercel/next.js/pull/51062
2023-06-09 14:14:30 -07:00
Jiachi Liu
2bc1061609
Apply optimization to middleware when using babel (#51067)
Like how we handled RSC loader transform before, we also apply swc
loader to middleware to make sure the imports optimization is applied so
og package won't be bundled

Fixes #50492
2023-06-09 13:33:14 -07:00
JJ Kasper
804552590e
Update app router revalidate handling on deploy (#51062)
This ensures we clear the RSC headers during revalidate when deployed so
that the HTML revalidation isn't treated as the RSC revalidation.
2023-06-09 13:23:44 -07:00
Steven
761e372d68
chore: remove skip to renable tsconfig tests (#51061)
These tests were disabled temporarily in PR #49088 so we can enable once
again now.
2023-06-09 15:45:30 -04:00
Simon Podlipsky
be960ccd02
fix: verbatimModuleSyntax: true support in tsconfig.json (#48018)
### What?

When `verbatimModuleSyntax: true` is set, `isolatedModules: true` are not allowed by TS

### Why?

Next always adds `isolatedModules: true` which causes TS error.

### How?

- Fixes #46509

fix NEXT-689

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-06-09 19:07:30 +00:00
Jiachi Liu
558632b5f2
Avoid server insertion react key warning (#51053)
Wrap server inseration children with react key to avoid react key
warning display
2023-06-09 10:18:19 -07:00
JJ Kasper
4080f63505
Ensure id handling applies for dynamic import in pages (#51049)
Noticed this case wasn't handled in pages so added additional test
coverage and patched the case.
2023-06-09 09:51:51 -07:00
JJ Kasper
480df20086
Ensure headers instance is serialized (#51047)
This makes sure we properly include headers in the cache key when a
headers instance is used.

x-ref: [slack
thread](https://vercel.slack.com/archives/C042LHPJ1NX/p1686234796532989)
2023-06-09 09:35:45 -07:00
Steven
2226d2935f
chore: drop unused @webassemblyjs (#51045)
Remove these dependencies since they appear to be unused

- Closes https://github.com/vercel/next.js/pull/50928
- Closes https://github.com/vercel/next.js/pull/50123
2023-06-09 16:03:15 +00:00
Delba de Oliveira
9c44c1dca1
[Docs] Add section on how to preview docs changes on VSCode (#51019) 2023-06-09 15:16:19 +00:00
Steven
f1f5734e91
chore: pin to npm@9.6.7 (#51044)
This might fix the npm publish error

```
Error: Command failed with exit code 254 (Unknown system error -254): npm publish /home/runner/work/next.js/next.js/packages/next --access public --tag canary
```


https://github.com/vercel/next.js/actions/runs/5219901558/jobs/9422546478#step:11:9353
2023-06-09 07:58:32 -07:00
Michael Novotny
55b29fb351
Updates prettier to latest version. (#51000)
There are some incoming docs / MDX changes where prettier will throw an error when using the older version. Updating prettier before I bring in those changes.

Looks like the most notable change is adding parentheses around `typeof` checks in TypeScript. 

**Before**

```
export type Locale = typeof i18n['locales'][number]
```

**After**

```
export type Locale = (typeof i18n)['locales'][number]
```
2023-06-09 14:58:19 +00:00
Jiachi Liu
2a2890cae6
Fix esm module import warning for middleware loader (#51014)
We need to spread the module into an object instead of access the module exports that could not exist, to avoid triggering the warning. Fix the bad loader change introduced in #50548 

```
Attempted import error: './middleware.js' does not contain a default export (imported as '
mod').
- info Using locally built binary of @next/swc
- warn You are using an experimental edge runtime, the API might change.
- wait compiling...
- warn ../../../../packages/next/dist/build/webpack/loaders/next-middleware-loader.js?abso
lutePagePath=%2FUsers%2Fhuozhi%2Fworkspace%2Fnext.js%2Ftest%2Fe2e%2Fapp-dir%2Fapp%2Fmiddle
ware.js&page=%2Fmiddleware&rootDir=%2FUsers%2Fhuozhi%2Fworkspace%2Fnext.js%2Ftest%2Fe2e%2F
app-dir%2Fapp&matchers=!
Attempted import error: './middleware.js' does not contain a default export (imported as '
mod').
- wait compiling...
```
2023-06-09 14:14:50 +00:00
Delba de Oliveira
9800eaf467
[Docs] Clarify a few things about the instrumentation.ts file (#51034)
There was some confusion about where to place it.
2023-06-09 13:40:53 +00:00
Jimmy Lai
41675c07cb
edge: use JSON parse instead of inlining the manifests objects (#50960)
Manifests tend to be really big and our strategy is to inline them in the edge function script itself and we're hitting some constraints this way. 

This PR switches this behaviour via inlining the script and creating a JS object at runtime instead, with the hope that the parsing time will be faster as JSON.parse is very well optimised in V8.

The end goal ofc is to have smaller manifests but this should be a good stopgap.



link NEXT-1273
2023-06-09 12:58:55 +00:00
Alain Kaiser
8370e52a32
Fix Typo in Metadata API Description (#51024)
### Fix Typo in Metadata API Description

#### Description:

This PR fixes a minor typo in the description of the Metadata API.

#### Changes:

- Fixed typo in the Metadata API description. 

**File:** `docs/02-app/01-building-your-application/05-optimizing/04-metadata.mdx`

**Old Sentence:**

> Next.js has a Metadata API that can used to define your application metadata (e.g. `meta` and `link` tags inside your HTML `head` element) for improved SEO and web shareability.

**New Sentence:**

> Next.js has a Metadata API that can be used to define your application metadata (e.g. `meta` and `link` tags inside your HTML `head` element) for improved SEO and web shareability.

This change helps improve the readability and understanding of the documentation for readers and users.

#### Checks:

- [x] Followed the Docs Contribution Guide
- [x] Linting passes (`pnpm build && pnpm lint`)
2023-06-09 12:20:41 +00:00
Jiachi Liu
f19b31ad93
Fix rsc payload fetch failures due to state tree encoding (#51017)
Encode the state tree where the content could contain unicode when
request the RSC payload, to avoid the fetch failure due to bad encoding
for headers

Fixes #48728
fix NEXT-1258
2023-06-09 12:06:00 +02:00
Balázs Orbán
96e47d3f37
chore: mark forceOptimisticNavigation as internal (#47905)
### What?

Hide internal API.

### Why?

Ref: https://vercel.slack.com/archives/C035J346QQL/p1669125601246609?thread_ts=1669125167.045259&cid=C035J346QQL

### How?

Mark the internal property with `@internal` so it's not shown by IntelliSense.

Related #47894
2023-06-09 09:36:36 +00:00
vercel-release-bot
f2dfa1a92a v13.4.5-canary.9 2023-06-09 08:30:52 +00:00
Kevin Ang
e5b88caed7
fix revalidateTag import (#51005)
This PR fixes the erroneous `revalidateTag` import on certain examples.
It was imported from `next/server`, but should be imported from
`next/cache` instead.

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2023-06-09 09:23:58 +01:00
Taylor Bryant
8484a6b9c2
Fix typos in 01-contribution-guide.mdx (#51006)
This PR fixes some small typos in the Contribution Guide.
2023-06-09 08:16:12 +00:00
Tyler Lutz
aef03cf3a5
docs: update ESLint prompt output. (#50986)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-06-08 19:07:58 -07:00
PatrickCodes_
3817770bc0
docs: update Route Handlers to have JS/TS code snippet. (#51003)
Added a TS and JS switcher. Previously the code snippet did not have a
switcher. The file extension was .js when the code was TypeScript which
made it confusing to try to read.

---------

Co-authored-by: Lee Robinson <me@leerob.io>
2023-06-08 19:06:08 -07:00
JJ Kasper
cdd366fd97
Fix usage of router.refresh() with Draft Mode in App Router (#50941)
After enabling Draft Mode, `router.refresh()` was incorrectly causing the page to crash and do a full page refresh.

This PR fixes this case.

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-06-09 00:15:55 +00:00
Will Binns-Smith
994c61a807
Turbopack next/font/google: Use capsize's xWidthAvg to compute fallbacks (#50878)
Instead of using azAvgWidth for next/font/google, use xWidthAvg as the webpack implementation does. For now, next/font/local in both the webpack and Turbopack implementations continue to use azAvgWidth. We should align these in the future.

Test Plan: We now pass 26 next/font tests in Turbopack, up from 22.
2023-06-08 23:02:28 +00:00
vikas singh
13bd196d08
Added Azure Cosmos DB started code, containing a minimal app and README.md (#49128)
These changes contain Started Code for Azure Cosmos DB.
2023-06-08 21:42:46 +00:00
Michael Novotny
9c4b0ec9e9
Adds missing JavaScript codeblock in Opengraph Image API reference (#50996)
Also changes JavaScript examples to use `.jsx` extensions so IDEs better recognize the JSX allowed as the first argument to `ImageResponse`. 

Fixes #50141
2023-06-08 21:29:47 +00:00
JJ Kasper
1be0bdd081
Add max job timeout for build workflow (#50998)
Ensures we don't allow jobs like this one back up the queue indefinitely https://github.com/vercel/next.js/actions/runs/5214838162/jobs/9411777984?pr=50904
2023-06-08 20:58:35 +00:00
Jiachi Liu
f2e637d24d
Upgrade webpack to 5.86.0 (#50992)
To resolve issue #49382, we found layer doesn't get applied for dynamic imports, so we fixed it on webpack side in https://github.com/webpack/webpack/pull/17310

This PR is to upgrade webpack to 5.86.0 with that patch as a precedence. After this we need to fix the `next/image` client components is missing in client reference manifest when using dynamic imports to fix the issue.
2023-06-08 20:35:12 +00:00
Mingjie Jiang
8811c1f3f6
Add appDir-specific guidance for next-router-not-mounted error (#50076)
The error `next-router-not-mounted` can also happen when one tries to use the `next/router` hook inside the app directory. The error page has been updated to reflect that, and migration guides are linked. 

Closes #47038.
2023-06-08 20:08:26 +00:00
didemkkaslan
f2cbfe3147
docs: Fix typo in colocation documentation. (#50975) 2023-06-08 12:16:48 -07:00
Tyler Lutz
3ccbe82280
Update create-next-app docs (#50981)
### What?

Update the create-next-app prompts and create-next-app --help
documentation
2023-06-08 12:16:05 -07:00
Ethan Mick
9a08206242
docs: Correct useFormStatus to be a client component (#50991)
### What?

The `useFormStatus` needs to be used in a client component. That
component should be used within a `form` for the `pending` property to
reflect the form status.

### Why?

The docs are currently not accurate.

### Notes

I could also update the name of the file to not be `form.js`, which
implies this is the entire form instead of just the submit button being
used as a component within the form.
2023-06-08 12:13:13 -07:00
Michael Novotny
61a553963d
Adds missing async to Opengraph Image code example. (#50990) 2023-06-08 12:08:04 -07:00
Shu Ding
5150506452
Move required chunk collection to the upper level (#50983)
This is an optimization to make the plugin faster, we're currently doing
redundant work `getAppPathRequiredChunks()` for all modules during
`recordModule()` while it's not changing.
2023-06-08 20:22:38 +02:00
Shu Ding
b8e308f511
Add test for hidden form fields at the beginning of a Server Action form (#50978)
Fixes #50087. The root cause was fixed in upstream React and here's a
test to ensure it works end to end.
fix NEXT-1228
2023-06-08 19:25:56 +02:00
Steven
9a9d095b54
Bump to typescript@5.1 (#50557)
We need to upgrade TypeScript to land the following fixes:

- https://github.com/vercel/next.js/pull/50289
- https://github.com/vercel/next.js/pull/48018

And it should fix async components:
- https://twitter.com/sebsilbermann/status/1664356039876124672

Also see this related TS 5.0 issue:

- https://github.com/microsoft/TypeScript/issues/53402
2023-06-08 17:18:37 +00:00
Jiachi Liu
a035224dc3
Pick esm main fields and condition names first for RSC server layer (#50548)
For RSC server layer so far we bundle all dependencies, ESM format is the better one rather than CJS to analyze and tree-shake out the unused parts. This PR changes pick the condition names that are in ESM format first for server layer.

Also fixes the misorder of condition names of edge runtime, `conditionNames` should only contain either ESM or CJS, previously the main fields are mixed with conditon names which is not expected for webpack, we separate them now.

Since we're picking ESM instead CJS now, the error of require `exports * from` doesn't exist anymore, but if you're using a CJS dependency which require a ESM package, it will error. This is the existing behavior for our webpack configuration but could happen on server layer bundling

Other related changes:

* Imports are hoisted in ESM, so migrate`enhanceGlobals` to a imported module
* Use `...` to pick the proper imports by import expression, and prefer the `react-server` / `edge-light` condition names for corresponding cases
* Remove edge SSR duplicated `middleware` export checking
2023-06-08 16:24:03 +00:00