Commit graph

17399 commits

Author SHA1 Message Date
Daigo Shitara
49a876d456
Update route-segment-config.mdx for fix broken link (#55212)
Fixed link to `Node.js Runtime` in the revalidate section, as the link
was broken by the leading `/`.

Co-authored-by: Steven <steven@ceriously.com>
2023-09-12 15:43:19 -04:00
Mayank
546bd28c00
fix: upgrade react-native-web from 0.11.7 to 0.19.7 (#55221)
upgrade react-native-web from 0.11.7 to 0.19.7.




Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-12 19:36:33 +00:00
JJ Kasper
c2f587640a
Update docs for revalidatePath fix (#55083)
This updates docs for the fixes landed in
https://github.com/vercel/next.js/pull/53321 related to
`revalidatePath`.

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

---------

Co-authored-by: Lee Robinson <me@leerob.io>
2023-09-12 11:28:16 -07:00
OJ Kwon
45fbd4db14
refactor(next-font): use next-transform-font (#55252)
Closes WEB-1539

### What?

It looks like there are duplicated codes between `next-font` and `next-transform-font`, and the prior is not being referenced anywhere.
2023-09-12 17:48:58 +00:00
Wyatt Johnson
e6ec464e58
fix: removed unused intercepting route definition references (#55285)
This removes unused references to intercepting routes that was not fully implemented.
2023-09-12 17:10:19 +00:00
Pekka Enberg
45ee4ed260
Add libsql to external package list (#55266)
The `libsql` package is a fork of `better-sqlite3` that powers the Turso database client. Let's add `libsql` to the list of external packages, like `better-sqlite3`, so that people don't have to add extra configuration for their Next.js applications.
2023-09-12 16:48:48 +00:00
OJ Kwon
0bf5cbb901
feat(next-dev): reenable turbopack beta message (#55116)
### What?
Minor PR brings back turbopack beta message. We'll need to improve the actual checks per progress, but that might need auditing what's working vs not later.


Closes WEB-1517
2023-09-12 16:39:26 +00:00
Wyatt Johnson
d3656cc42b
reafactor: renamed pathname -> page (#55282) 2023-09-12 16:02:43 +00:00
Mayank
9f852403f0
fix: upgrade sharp from 0.29.3 to 0.32.5 (#55254)
upgrade sharp from 0.29.3 to 0.32.5.

Fix Remote Code Execution (RCE)
[SNYK-JS-SHARP-2848109](https://snyk.io/vuln/SNYK-JS-SHARP-2848109)




Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-12 15:38:10 +00:00
Mayank
c91e6609bf
fix: upgrade date-fns from 2.28.0 to 2.30.0 (#55274)
to upgrade date-fns from 2.28.0 to 2.30.0.



Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-12 15:26:49 +00:00
vercel-release-bot
366885f387 v13.4.20-canary.26 2023-09-12 13:20:27 +00:00
Jimmy Lai
2a7f5cdb0a
build: fix minimal trace caching (#55279)
This PR fixes a small issue where we would not save nor read the minimal
server trace file from the cache, meaning that whenever you would do two
builds in a row, the build would skip the tracing of the server as
expected but not include a minimal server trace in the dist folder.

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

-->
2023-09-12 15:15:43 +02:00
Jiachi Liu
180d55248f
Make open editor icon size non-shrink in error overlay (#55273)
In error overlay when the error trace file path is too long, the open editor icon on the right side get shrinked to very small. Mark it as `flex-shrink: 0` to avoid the unexpected size change

### After

![image](https://github.com/vercel/next.js/assets/4800338/31d93520-ee82-4867-97b3-9e22e5f71da7)


### Before

![image](https://github.com/vercel/next.js/assets/4800338/57c27636-b9e6-4e1d-b68b-0247dbd882cd)
2023-09-12 11:17:30 +00:00
vercel-release-bot
8e1626851e v13.4.20-canary.25 2023-09-12 10:34:24 +00:00
Jimmy Lai
f4e6dea1f2
build: fix externals resolution when importing from next/dist (#55269)
This fixes a "bug" where Sentry was trying to access some of the internal async storages and it would fail because their imports would be compiled as-is instead of using the special rules for Next externals as we are short-cutting it for `next/dist` requests for some reason.

Not a bug per se because this is technically an undocumented API but I think it's a reasonable fix since we don't provide an API for that. The alternative for them would be to try to play around with the bundling, which is not a good use of anyone's time.
2023-09-12 10:26:34 +00:00
Nick Olinger
3afba0d12d
feat: add reserved port validation (#55237)
### Fixing a bug

- [x] Related issues linked using `fixes #number`
- [x] Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- [x] Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md

Closes NEXT-
Fixes #55050 


Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2023-09-12 07:31:35 +00:00
OJ Kwon
92e1b3fef9
test(fixture): improve finding ports to reduce flaky (#55151)
### What

Found a flaky test like https://github.com/vercel/next.js/actions/runs/6125719281/job/16628276301?pr=55118#step:29:174, `get-port` throws by port is not available. Peeking bit, there seems an upstream fix hope to improve the situation but unfortunately it happened after get-port switched to native esm only, so bumping is non trivial work. Instead adapting get-port-please as a replacwement but leave get-port as fallback for a while to verify its stability. Once we are certain, we can remove old get-port entirely.
2023-09-11 21:48:29 +00:00
OJ Kwon
ddc26c9904
test(turbopack): migrate 404-related tests from next-dev (#55243)
Closes WEB-1535
2023-09-11 21:16:51 +00:00
vercel-release-bot
476fe4a1f6 v13.4.20-canary.24 2023-09-11 20:24:23 +00:00
Lee Robinson
591d4e11ef
docs: clarify setting cookies docs (#55149) 2023-09-11 15:19:57 -05:00
JJ Kasper
7d93808c43
Remove render workers in favor of esm loader (#54813)
Currently we create separate workers to isolate `pages` and `app`
routers due to differing react versions being used between the two. This
adds overhead and complexity in the rendering process which we can avoid
by leveraging an `esm-loader` similar to our `require-hook` to properly
alias `pages` router to the bundled react version to match `app` router
when both are leveraged together.

This aims to seamlessly inject the `esm-loader` by restarting the
process with the loader arg added whenever `next` is imported so that
this also works with custom-servers and fixes the issue with custom
req/res fields not working after upgrading.


x-ref: https://github.com/vercel/next.js/issues/53883
x-ref: https://github.com/vercel/next.js/issues/54288
x-ref: https://github.com/vercel/next.js/issues/54129
x-ref: https://github.com/vercel/next.js/issues/54435
closes: https://github.com/vercel/next.js/issues/54440
closes: https://github.com/vercel/next.js/issues/52702
x-ref: [slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1693348443932499?thread_ts=1693275196.347509&cid=C03KAR5DCKC)

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Zack Tanner <zacktanner@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-11 22:17:52 +02:00
Daniel Salvadori
e486d74464
Fix typo (#55245)
This PR fixes a single character typo.
2023-09-11 12:09:06 -07:00
OJ Kwon
360142d409
tests(next-dev): migrate basic tailwind tests for turbopack (#55118)
Closes WEB-1518

### What?

This PR refactors test cases from next-dev, tests basic tailwind rendering with turbopack. It still runs against plain next.js too. While checking, noticed there's a stub fixture (css-fixture/with-tailwindcss) but those fixture seems not being used in the test. Moved those and utilized. Since this test runs against next.js / turbopack both anyway, moving fixture should not be a huge regression I believe.
2023-09-11 15:44:39 +00:00
OJ Kwon
40da1aeb92
test(nexttestsetup): teardown nextinstance gracefully (#55144)
### What?

https://vercel.slack.com/archives/C04KC8A53T7/p1694190462958199

I realized we throws an error attempt to destory against undefined instance when `beforeAll` fails in any reason. This is quite redundant error since if next instance doesn't exist, likely there's an upstream test failures already and destory against undefined error is not useful to debug anyway.

PR replaces `nextTestSetup`'s teardown first, for the remaining places calling `next.destory` explicitly will be amended later.
2023-09-11 15:29:49 +00:00
Vũ Văn Dũng
e1bc270830
Ensure ImageResponse extends Response (#55187)
### Why?

The `ImageResponse` class constructor returns a `Response` instance, but doesn't extend `Response`, so it doesn't pass the type check introduced in #51394.

### How?

Make the `ImageResponse` class a subclass of `Response`.

### Notes

I can't find any tests to check for the types so didn't add any tests here; but shouldn't there be one?
2023-09-11 14:14:39 +00:00
Mayank
80654c1e30
chore(examples): upgrade @keystone-next/keystone (#55210)
…ilities

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-PROMPTS-1729737
- https://snyk.io/vuln/SNYK-JS-SHELLQUOTE-1766506
- https://snyk.io/vuln/SNYK-JS-TAR-1579147
- https://snyk.io/vuln/SNYK-JS-TAR-1579152
- https://snyk.io/vuln/SNYK-JS-TAR-1579155




Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-11 14:02:20 +00:00
Lee Robinson
9d529e525f
docs: satisfies follow up (#55234)
Follow up from https://github.com/vercel/next.js/pull/55205/files#r1321306801.
2023-09-11 13:59:27 +00:00
Mayank
31f28287bf
fix: upgrade recoil from 0.7.6 to 0.7.7 (#55222)
upgrade recoil from 0.7.6 to 0.7.7

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
Co-authored-by: Steven <steven@ceriously.com>
2023-09-11 09:56:43 -04:00
Jimmy Lai
df76f6633f
server: remove turbopack-specific code when compiling with webpack (#55226)
This PR tweaks the webpack config so that when we compile user code with webpack, we remove all branches of code that are guarded with `process.env.TURBOPACK`. I noticed that the bundle runtime was not tree-shaken correctly, this fixes that.
2023-09-11 12:23:02 +00:00
Lee Robinson
9de2fd53e8
docs: use satisfies for TypeScript code blocks (#55205)
Yay, TS 4.9!

https://twitter.com/leeerob/status/1563540593003106306
2023-09-11 10:04:54 +00:00
Mayank
1097ab279a
examples: update KeystoneJS version (#55201)
…ilities

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-APOLLOSERVERCORE-2928764
- https://snyk.io/vuln/SNYK-JS-LOADERUTILS-3042992
- https://snyk.io/vuln/SNYK-JS-LOADERUTILS-3043105
- https://snyk.io/vuln/SNYK-JS-LOADERUTILS-3105943
- https://snyk.io/vuln/SNYK-JS-NEXT-1540422
- https://snyk.io/vuln/SNYK-JS-NEXT-1577139
- https://snyk.io/vuln/SNYK-JS-NEXT-2405694
- https://snyk.io/vuln/SNYK-JS-NODEFETCH-2342118
- https://snyk.io/vuln/SNYK-JS-SHELLQUOTE-1766506




Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-10 19:41:51 +00:00
Mayank
606c73a548
examples: upgrade @makeswift/runtime from 0.2.2 to 0.10.13 (#55203)
Snyk has created this PR to upgrade @makeswift/runtime from 0.2.2 to 0.10.13.




Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-10 19:39:18 +00:00
Lee Robinson
9b98e1ccc6
docs: fix nested list (#55178)
Seems to be rendering fine here (https://nextjs.org/docs/messages/react-hydration-error) with actual numbering
2023-09-10 13:08:29 +00:00
Mayank
0f212096f6
Fix/security (#55189)
Update to fix vulnerability in @builder.io/react@1.1.52 

Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-10 13:01:27 +00:00
Vercel Release Bot
a4094e28a1
Update font data (#55155)
This auto-generated PR updates font data with latest available
2023-09-09 00:43:34 +00:00
vercel-release-bot
c6ce87f021 v13.4.20-canary.23 2023-09-08 21:41:11 +00:00
Leah
6e3ef5b01c
feat: support expanding urls in nexturbo (and fix static files) (#55147)
Closes WEB-1525
2023-09-08 21:35:33 +00:00
vercel-release-bot
d61c6ba4aa v13.4.20-canary.22 2023-09-08 21:10:48 +00:00
Will Binns-Smith
8f30255922
Revert swc versions to one that doesn't use lightningcss (#55148)
Using lightningcss results in a breaking change to Next.js, so let's revert swc for now.


Closes WEB-1526
2023-09-08 20:02:51 +00:00
Jimmy Lai
6e5b935fd7
server: require hook hotfix (#55146)
This PR fixes a bug in the require hook implementation where the variable used might not exist depending on the environment. In order to fix that, we can use the variable used to define the version of React used instead as it is already present and a proxy of the same information.




Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-09-08 19:02:17 +00:00
Leah
b5d752667a
feat(turbopack): add dynamic metadata support (#54995)
Closes NEXT-1435
Closes WEB-1435
2023-09-08 18:25:13 +00:00
Tobias Koppers
f569cb1316
enable all passing turbopack tests for CI (#55100)
Closes WEB-1514

Co-authored-by: OJ Kwon <1210596+kwonoj@users.noreply.github.com>
2023-09-08 17:30:07 +00:00
Jimmy Lai
5217e7eb06
server: re-land bundled runtimes (#55139)
see https://github.com/vercel/next.js/pull/52997

also added a fix by @jridgewell to fix turbopack





Co-authored-by: Justin Ridgewell <112982+jridgewell@users.noreply.github.com>
2023-09-08 16:05:29 +00:00
Dima Voytenko
5b85a40142
Set test headers via page.router API (#55087)
This change enables the test code to use `setExtraHTTPHeaders` without affecting the testmode functions.

Fixes: #54706.
2023-09-08 15:50:44 +00:00
Lee Robinson
12252c2711
examples: Update strict-csp example with better nonce (#55131)
Follow up to https://github.com/vercel/next.js/pull/55039.
2023-09-08 05:12:22 +00:00
Vũ Văn Dũng
f47c409174
Check for type of route handler returned value at build time (via the TS plugin) and at runtime (#51394)
### What?

Fixes #51130. Before this PR, the package assumes that route handlers return a `Response` which is not necessarily the case.

The linked issue specified three suggestions to resolve this

1. Return a default 200 response
2. Throw a better error message
3. or both

~~In this issue I implemented (3), except that it is a warning and not an error. Do tell if the team wants to follow a different approach, as it is not too hard to change this.~~

This PR implements (2).

### How?

The returned value of the handler is checked at runtime to ensure it is actually a `Response` instance.

The return type `AppRouteHandlerFn` is also modified to `unknown` to avoid similar assumptions elsewhere.

The TS plugin is also modified to check for the return type during build time.



Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-09-08 03:26:53 +00:00
Jiachi Liu
6ffb8dafbd
Reenable app-static usePathname tests (#55065)
Re-enable `usePathname` related tests

Closes NEXT-112
2023-09-08 00:30:41 +00:00
Siddharth Gaikwad
56eeedff30
Update pull_request_template.md (#55098)
just added the ")" to the documentation
2023-09-08 00:19:49 +00:00
Jiachi Liu
60d3ab3e47
Filter out pages tree view for app dir only output (#55120)
Only output app routes if there's no pages routes in next build output


For hello world app you'll only see app dir routes
```
Route (app)                              Size     First Load JS
+ First Load JS shared by all            78.1 kB
  ├ chunks/main-app-e4c0616da69beffe.js  76.5 kB
  └ chunks/webpack-bf1a64d1eafd2816.js   1.61 kB


○  (Static)  automatically rendered as static HTML (uses no initial props)
```

Also filter out `/favicon.ico` static route as it's confusing
2023-09-08 00:06:05 +00:00
Jiachi Liu
8076d0c68a
Add option to support log full request url in verbose mode (#55111)
Fixes #52239
Closes NEXT-1604

Change the logging option to object for flexibility
```js
experimental: {
  logging: {
    level: 'verbose', // control log level
    fullUrl: true, // console fetching url logging
  }
}
```

### After vs Before
<img src="https://github.com/vercel/next.js/assets/4800338/e0a05e2d-b69e-4075-afe1-8179c827f548" width="400">
<img src="https://github.com/vercel/next.js/assets/4800338/89a73ae3-1999-49ac-86f0-2c7248adc22c" width="400">
2023-09-07 23:58:09 +00:00