Commit graph

21439 commits

Author SHA1 Message Date
Arinjay Dhar
303d155c08
Improve Unstable Cache Docs (#65942)
Unstable Cache has always had a very lacking documentation page, even
though it adding its own new feature ``key parts`` . Its a normal
occurrence for us in the NextJS Discord to see new people and more
advanced users question what is the use of key parts, since the example
in the docs. was very lacking.

I have made a few changes, like adding a much more functional example
which showcases all the features of unstable cache, and also a small
difference section between tags and key parts.

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-07-01 04:50:51 -07:00
vercel-release-bot
b9bd23baec v15.0.0-canary.49 2024-06-29 23:22:57 +00:00
Max Leiter
862a89667f
packages/next: opt ts-morph into serverExternalPackages (#67284) 2024-06-29 15:02:18 +02:00
vercel-release-bot
b1eab7fb5e v15.0.0-canary.48 2024-06-28 23:23:25 +00:00
Delba de Oliveira
fbede36bcc
Docs: Update fetch information in caching docs (#67279)
Updates data cache docs to reflect `fetch` behavior in Next.js 15 RC. 

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

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-06-28 10:26:02 -07:00
Sam Ko
fc87f8ee12
docs(mdx): add clarification for mdxRs (#67237)
## Why?

Add clarification that you need the experimental config:

```
module.exports = withMDX({
  experimental: {
    mdxRs: true,
  },
})
```

when using [Turbopack](https://nextjs.org/docs/architecture/turbopack).

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-06-28 05:56:25 -07:00
Sam Ko
e6983b911b
chore: update pnpm to 9.4.0 (#64945)
## Why?

Notable change of v9 is Corepack is enabled by default.  
So we can ensure all package manage/resolved exact same version of pnpm.

- [**v9.0.0**](https://github.com/pnpm/pnpm/releases/tag/v9.0.0):
Discontinued support for Node.js v16 and introduced Corepack
compatibility checks. New configuration updates include enabling
`dedupe-injected-deps` and changing the lockfile to version 9, with
better readability and resistance to Git conflicts.

...

- [**v9.4.0**](https://github.com/pnpm/pnpm/releases/tag/v9.4.0)

- Kudos to @ryota-murakami for the original :pr:! →
https://github.com/vercel/next.js/pull/64854

## Changes

- https://pnpm.io/npmrc#link-workspace-packages defaults to `false` now,
so setting it to `true`

Closes NEXT-3211
2024-06-28 04:41:35 -07:00
Zack Tanner
87e45521d2
reject actions with invalid RSC responses (#67059)
When a server action responds with something other than an RSC response,
we currently silently ignore the error and it doesn't get propagated to
any rejection handlers.

This adjusts the handling so that if the server action response is a
non-successful status code, we reject the server action promise. If the
error is `text/plain`, we'll automatically propagate the text content as
the error text. Otherwise, the promise is rejected with a fallback
message.
2024-06-28 11:18:52 +02:00
Sukka
b2eafbf6b3
refactor: replace glob w/ fast-glob in eslint plugin (#67261) 2024-06-28 08:15:35 +00:00
Sam Ko
bdd1d31d57
chore: bump turbo to 2.0.6-canary.0 (#67270) 2024-06-28 01:15:22 -07:00
GyoHeon
6474cf0fe3
chore(docs): fix miss spell (#67228)
### Improving Documentation

- Just add `'`


![image](https://github.com/vercel/next.js/assets/66263916/ce7c5e11-38e9-4937-9034-3278b36e1e2b)

Co-authored-by: Jiwon Choi <devjiwonchoi@gmail.com>
2024-06-28 07:54:33 +00:00
Mariano Álvarez
a7faeb0b80
chore(docs): improve visual appearance of badges in README.md (#67254)
## Description
This Pull Request improves the visual appearance of the badges in the
README.md file by removing unnecessary line breaks between the badge
images, eliminating the unwanted blue link lines that previously
appeared and resulting in a cleaner and more cohesive look.

### What
Removed unnecessary line breaks between badge images in the README.md
file to eliminate the unwanted blue link lines and improve the overall
visual presentation.

### Why
Previously, the badges were displayed with line breaks between them,
causing blue link lines to appear, which disrupted the clean look of the
badges. By removing these line breaks, the badges now appear without the
blue link lines, providing a more cohesive and visually appealing
README.

### How

- Removed the line breaks between badge images in the README.md file.

Co-authored-by: Jiwon Choi <devjiwonchoi@gmail.com>
2024-06-28 07:29:25 +00:00
vercel-release-bot
1441a353a9 v15.0.0-canary.47 2024-06-27 23:23:39 +00:00
Wyatt Johnson
3c6936cfbd
[ppr] Test fixes for deployment tests (#67256)
Fixes some possible race conditions by adding a few delays to the
navigation test to ensure that we wait for hydration to occur and
prefetches to finish.
2024-06-28 00:32:56 +02:00
Zack Tanner
f7d5e14863
add more examples to run-for-change script (#67250)
These examples are tested, so this ensures tests are run when these
examples change to prevent #67249
2024-06-27 19:51:06 +02:00
Zack Tanner
0a1f7e23d6
Revert "examples(with-mdx): update to MDX 3" (#67249)
Reverts vercel/next.js#62503

This is currently failing tests that use this example


[x-ref](https://github.com/vercel/next.js/actions/runs/9699835771/job/26771391310)
2024-06-27 17:24:53 +00:00
Jiachi Liu
3d3f02ecdc
fix missing command in next-codemod (#67216)
Running `pnpx @next/codemod@canary next-dynamic-access-named-export`
found the following error

```
Invalid transform choice, pick one of:
- name-default-component
- add-missing-react-import
- withamp-to-config
- url-to-withrouter
- cra-to-next
- new-link
- next-og-import
- metadata-to-viewport-export
- next-image-to-legacy-image
- next-image-experimental
- built-in-next-font
```

Turns out we're missing it in cli command list
2024-06-27 18:00:07 +02:00
Josh Goldberg ✨
72a64081b4
feat: enable @typescript-eslint/recommended in create-next-app --typescript (#52845)
Co-authored-by: eps1lon <sebastian.silbermann@vercel.com>
2024-06-27 09:37:01 +00:00
Remco Haszing
689e4b82f2
examples(with-mdx): update to MDX 3 (#62503)
### What?

Update the `with-mdx` example to MDX 3.

### Why?

The example was 2 major versions behind.

### How?

By updating the version in `package.json`. Also the `@mdx-js/react`
dependency was removed, as it doesn’t work with the app directory. Users
should use `mdx-components.tsx` instead.

Refs #59693

Co-authored-by: Sam Ko <sam@vercel.com>
2024-06-27 02:35:37 -07:00
Jophy Ye
126b9c8ff3
Update unit test docs in compliance with testing-library release (#67217)
Co-authored-by: Jiwon Choi <devjiwonchoi@gmail.com>
Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>
2024-06-27 09:32:39 +00:00
vercel-release-bot
4b7924b155 v15.0.0-canary.46 2024-06-26 23:23:20 +00:00
hrmny
18b13e04f5
fix(turbopack): add no-op resolveAbsolutePath to browser runtime (#67215)
### What?

The turbopack browser runtime was throwing an error when trying to
access `import.meta.url`.


Closes PACK-3095
Fixes https://github.com/vercel/next.js/issues/66005
2024-06-26 19:18:33 +00:00
Will Binns-Smith
c8e9e65de1
Test that nonlatin characters don’t cause hard reloads in hmr (#67077)
This test case covers https://github.com/vercel/next.js/issues/65117.

Fixes #65117
2024-06-26 11:05:26 -07:00
vercel-release-bot
ce6ce9b04b v15.0.0-canary.45 2024-06-26 14:10:16 +00:00
Wyatt Johnson
08793dd911
[ppr] Handle corrupted postponed state (#67021)
Previously, when the provided postponed state was corrupted, the render
failed which resulted in a hydration error. Instead, when the postponed
state is corrupted, we send the resume stream just for the hydration
where it'll attempt to render client side with the data that's already
available.
2024-06-26 06:52:49 -07:00
Maaz-Ahmed007
a3c36fe24c
Update 01-installation.mdx "create-next-app" had link in one place an… (#67150)
…d not in another place.

"create-next-app" in apostrophe was mentioned twice but one with link
and second without link which didn't sync together for me. So, I added
the same link to the second one, maybe I am wrong.

<!-- 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: Jiwon Choi <devjiwonchoi@gmail.com>
2024-06-26 13:36:46 +00:00
Christian Rebelsky
b9ffa84303
fix: fix entry point for storybook, add storybook static ouput to gitignore (#67207)
This PR will fix https://github.com/vercel/next.js/issues/67206

- [x] contributing guidelines for examples are followed
- [x] lint runs without errors
2024-06-26 22:25:42 +09:00
Tim Neutkens
5999c78a4b
Upgrade Turbopack (#67209)
* https://github.com/vercel/turbo/pull/8546 <!-- Benjamin Woodruff -
Decrease default scope_stress test size, add env var config -->
* https://github.com/vercel/turbo/pull/8563 <!-- Donny/강동윤 - Update
`swc_core` to `v0.95.4` -->
* https://github.com/vercel/turbo/pull/8556 <!-- Tobias Koppers - avoid
cloning the source code -->
* https://github.com/vercel/turbo/pull/8562 <!-- Will Binns-Smith - HMR:
handle non-Latin characters in text through base64-encoded sourcemaps
-->
* https://github.com/vercel/turbo/pull/8530 <!-- Benjamin Woodruff -
Support turbo tasks inside of `mod` blocks -->
* https://github.com/vercel/turbo/pull/8542 <!-- Benjamin Woodruff -
Handle `#[cfg(...)]` attributes on turbo tasks -->
* https://github.com/vercel/turbo/pull/8529 <!-- Benjamin Woodruff -
Deduplicate persistent task get_function_name logic -->
* https://github.com/vercel/turbo/pull/8547 <!-- Benjamin Woodruff - Add
new ExitHandler API as an alternative to ExitGuard -->
* https://github.com/vercel/turbo/pull/8604 <!-- Benjamin Woodruff -
Delete unused TASK_ID_MAPPING support -->
* https://github.com/vercel/turbo/pull/8605 <!-- Benjamin Woodruff -
Remove nohash-hasher dependency -->
* https://github.com/vercel/turbo/pull/8559 <!-- Tobias Koppers - move
stateful flag into Done state -->
* https://github.com/vercel/turbo/pull/8598 <!-- Tim Neutkens - MDX
support: Ensure development transform is only used in development -->
* https://github.com/vercel/turbo/pull/8557 <!-- Tobias Koppers - reduce
size of task output struct -->
* https://github.com/vercel/turbo/pull/8558 <!-- Tobias Koppers - remove
prepared task type -->


<!-- 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-06-26 14:11:23 +02:00
Joseph
c839d589ab
fix: Narrow down from string | undefined to string (#65248)
Co-authored-by: Jiwon Choi <devjiwonchoi@gmail.com>
2024-06-26 12:42:55 +02:00
Sebastian Silbermann
a832c91ae4
Make synced react-is version more obvious (#67189) 2024-06-26 11:16:47 +02:00
Tobias Koppers
d4e349f79b
make next/dynamic visit more incremental and cacheable (#66912)
### What?

This makes extracting next/dynamic cheaper when modules have been visited before

### Why?

improved HMR and page transitions

### How?

All steps for visiting a module are extracted into a single cached function. VIsiting already visited modules costs only a single cache lookup
2024-06-26 11:11:13 +02:00
Zack Tanner
a4431a9126
skip provide-paths test when deployed (#67203)
This test cannot be run in `test-deploy` because it inspects the
contents of the `.next` folder.
2024-06-26 10:22:06 +02:00
vercel-release-bot
90f564d376 v15.0.0-canary.44 2024-06-25 23:22:44 +00:00
Ivan Torres
0d9c89bf81
Remove devdependency uuid (#67190)
Co-authored-by: torresgol10.it <torresgol10.itd@gmail.com>
Co-authored-by: eps1lon <sebastian.silbermann@vercel.com>
2024-06-25 20:50:39 +00:00
Jiachi Liu
1a04d94aae
Remove extra suspense boundary for default next/dynamic (#67014)
### What

Reland #64716 

Removing the Suspense boundary on top of `next/dynamic` by default, make
it as `React.lazy` component with preloading CSS feature.

* Remove `suspense` option in `next/dynamic` since it's already
deprecated for a while
* Remove the default loading in app router implmentation of
`next/dynamic`

### Why

Extra Suspense boundary is causing extra useless rendering. For SSR, it
shouldn't render `loading` by default

Related: #64060
Related: #64687
Closes
[NEXT-3074](https://linear.app/vercel/issue/NEXT-3074/app-router-content-flickering-with-reactcreatecontext-and-nextdynamic)

This is sort of a breaking change, since removing the Suspense boundary
on top of `next/dynamic` by default. If there's error happening in side
the dynamic component you need to wrap an extra Suspense boundary on top
of it
2024-06-25 20:40:09 +02:00
Corbin Crutchley
cfacca5fad
chore: fix react-is RC version pinning (#66676) 2024-06-25 18:00:15 +02:00
Sebastian Silbermann
63908fcd2f
Test lint config after first-time setup (#67146) 2024-06-25 16:13:56 +02:00
Jiwon Choi
ebc2c68c4c
chore: upgrade ts to 5.4 (#67171)
Stepping stone before #67113

Closes NEXT-3136

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2024-06-25 23:12:28 +09:00
Hendrik Liebau
0c615f9c6e
Do not skip react-owner-stacks-svgr test for turbopack build (#67184) 2024-06-25 16:06:33 +02:00
Lee Robinson
8b5661eb45
docs: static exports (#67181) 2024-06-25 08:05:09 -05:00
Hendrik Liebau
d824059439
Create React aliases for SVG components (#67104) 2024-06-25 14:29:32 +02:00
Jiachi Liu
c8925c36db
codemod: add next/dynamic imports codemod (#67126)
### What

Provide a codemod to transform the promise of the access to named export
properties in dynamic import `next/dynamic`, this codemod transform all
the `next/dynamic` imports to ensure returning an object value with
`default` property, aligning with what `React.lazy` is returning

### Why

Follow up for #66990 

It's not allowed to do dynamic import and access it's named export while
using `next/dynamic` in server component, and the dynamic import module
is from a client component. It's like accessing the nested client side
property of a module
2024-06-25 12:17:44 +00:00
vercel-release-bot
ea8020158e v15.0.0-canary.43 2024-06-24 23:23:43 +00:00
Jiachi Liu
d8a60e3476
chore: turbopack metadata routes normalizing (#67159) 2024-06-25 00:57:16 +02:00
Will Binns-Smith
f03fed0458
Update Turbopack to turbopack-240621.2 (#67110)
Includes:
- vercel/turbo#8562
- vercel/turbo#8556
- vercel/turbo#8563
- vercel/turbo#8546
2024-06-24 09:55:54 -07:00
Jiachi Liu
7f72971039
Fix server action edge redirect with middleware rewrite (#67148)
### What

Add isEdgeRendering check condition for rewrite logic in edge adpator 

Fixes #66837 
Closes NEXT-3545

### Why

From headers `x-middleware-rewrite`, it's still relative url `/rewrite`,
reconstructing the url will lead to crash as it doesn't contain host.
2024-06-24 13:17:44 +00:00
vercel-release-bot
6604c187ec v15.0.0-canary.42 2024-06-23 23:22:39 +00:00
Shu Ding
3fb72dc658
Refactor code (#64429)
Small code refactoring to make the server do fewer work.

Closes NEXT-3096
2024-06-23 20:16:13 +00:00
Jiachi Liu
fc7f62dc4e
Fix noindex is missing on static not-found page (#67135)
### What

Render noindex into a flight data and rsc payload when page path is
`/404`

### Why

When it's static generation, noindex is not rendered due to the
statusCode from mock request is 200, but we can relying on the pagePath
as `/404` page should always contain `nonidex`

We were missing the noindex before for flight generation, now we'll
render it when it's 404 page.
2024-06-23 21:56:08 +02:00
JJ Kasper
16cf88e569
Add experimental flag for providing entry paths (#67134)
Adds a flag for experimentally building on specifically provided entry
paths. This should not be relied on as it is NOT a public facing API.
2024-06-23 10:21:10 +00:00