Commit graph

17542 commits

Author SHA1 Message Date
vercel-release-bot
aea80aa53f v13.5.2 2023-09-20 16:19:18 +00:00
vercel-release-bot
0afffdd024 v13.5.2-canary.2 2023-09-20 15:29:17 +00:00
Shu Ding
dff48cb8a7
Fix importing name multiple times with the named_import transform (#55664)
Specific case: https://twitter.com/shuding_/status/1704220735726633205


> import { User, User as foo } from 'lucide-react'
In your codebase so `User` got imported twice
2023-09-20 15:22:38 +00:00
Jiachi Liu
f5bef049f5
Polish error icon for error log (#55618)
### After 💅 

<img width="109" alt="image" src="https://github.com/vercel/next.js/assets/4800338/f90d15a1-ac6e-4fe1-8241-d9e40e9d2e0e">

 ### Before 

<img width="143" alt="image" src="https://github.com/vercel/next.js/assets/4800338/fbc09a29-cac2-459d-8a96-d1a5948947cc">
2023-09-20 14:56:34 +00:00
Tim Neutkens
23c3ea44d8
Add additional cleanup logic for forked process (#55652)
Can't verify this because there is no clear reproduction and I can't
reproduce it when manually trying, but this will probably fix #55649.
Not sure how they exit the process that it doesn't clean up on the
Node.js side though 🤔

<!-- 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: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-20 16:31:53 +02:00
Jiachi Liu
d97af317a3
Fix header resent when error occured (#55619)
When errors are thrown in middleware it could re-send headers for the same response

```
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
    at new NodeError (node:internal/errors:399:5)
    at ServerResponse.setHeader (node:_http_outgoing:645:11)
    at origSetHeader (/next.js/packages/next/src/server/base-server.ts:777:16)
    at ServerResponse._res.setHeader (/next.js/packages/next/src/server/base-s
erver.ts:777:16)
    at setHeader (/next.js/packages/next/src/server/base-http/node.ts:84:15)
    at renderErrorImpl (/next.js/packages/next/src/server/base-server.ts:2790:
11)
    at <anonymous> (/next.js/packages/next/src/server/base-server.ts:2777:19)
    at trace (/next.js/packages/next/src/server/lib/trace/tracer.ts:213:14)
    at DevServer.renderError (/next.js/packages/next/src/server/base-server.ts
:2776:24)
    at DevServer.renderError (/next.js/packages/next/src/server/next-server.ts
:1299:18)
    at DevServer.handleRequestImpl (/next.js/packages/next/src/server/base-ser
ver.ts:1185:23) {
  code: 'ERR_HTTP_HEADERS_SENT'
}
```

Migrate middleware-errors test to e2e test to avoid flaky assertion due to duplicated logging collected in integration test.

Closes NEXT-1629
2023-09-20 13:22:16 +00:00
vercel-release-bot
72434c2737 v13.5.2-canary.1 2023-09-20 12:53:30 +00:00
Balázs Orbán
38877dda37
chore: bump @vercel/og and satori (#55654)
### What?

Bump these packages to their latest. (Bumped `satori` too to avoid multiple versions in the repo)

### Why?

Follow-up of https://github.com/vercel/next.js/pull/55187

### How?

Updated the original package applying the changes from #55187

Closes NEXT-1639
Fixes #55604

[Slack thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1695169119558899)
2023-09-20 12:16:49 +00:00
GabenGar
fcca4ce955
fix(docs): internationalization middleware example (#55645)
- remove the slash before `pathname` (already included in the value).
- add `search` and `hash` values in redirected url:
   - retains these values on redirect
   - they already have `?` and `#` respectively




Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2023-09-20 11:37:15 +00:00
vercel-release-bot
ac1c062f4f v13.5.2-canary.0 2023-09-20 10:49:22 +00:00
Mayank
5591abe7ad
chore(examples): upgrade next-translate dependencies (#55637)
Snyk has created this PR to upgrade next from 13.4.7 to 13.4.19.

See this package in npm:
https://www.npmjs.com/package/next

See this project in Snyk:

https://app.snyk.io/org/mayank1513/project/e72076fc-8d2c-4d92-ac05-133865d727f0?utm_source=github&utm_medium=referral&page=upgrade-pr

<!-- 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: snyk-bot <snyk-bot@snyk.io>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2023-09-20 10:22:40 +02:00
Wyatt Johnson
56c324fb76
Simplified ensure promise handling (#55562)
In JS, Promise's are used to help manage async tasks and control flows. When code calls methods on a promise like `.then()`, `.catch()`, or `.finally()` the results of the promise are forwarded to the callback as soon as they're resolved. This serves to make a change to the promise creation such that we do not await on the promise until we're within the try/finally block. This will ensure that the promise will always be added to the map before it's resolved or rejected and it's cleanup (removing it from the active promises) is also completed.

This additionally introduces a new `scheduleOnNextTick` method and polyfill for `Promise.withResolvers()`.

`scheduleOnNextTick` is based on the scheduling algorithm used by https://github.com/graphql/dataloader which utilizes a `Promise.resolve()` combined with `process.nextTick` in order to schedule an operation to occur after the promises have resolved (see [graphql/dataloader](d336bd1528/src/index.js (L213-L255)))

The `Promise.withResolvers()` polyfill is an implementation of a soon-to-be-landed spec for inside-out promises. [Read the spec](https://tc39.es/proposal-promise-with-resolvers/)
2023-09-20 02:42:34 +00:00
Zack Tanner
0fea44654f
Run unit tests in a single job run (#55625)
These are quick so we can do it in one run

Follow up to https://github.com/vercel/next.js/pull/55621
2023-09-20 01:09:26 +00:00
Zack Tanner
7422109b8e
Run unit tests in a separate job (#55621)
This runs unit tests separate from the `test-dev` task to make it a bit more obvious these are running, and allow for an easy way to add any unit-test specific behavior in the future

[slack x-ref](https://vercel.slack.com/archives/C04DUD7EB1B/p1695150908857269)
2023-09-20 00:34:38 +00:00
Zack Tanner
bb13bb4799
Update React from d6dcad6a8 to 2807d781a (#55590)
Update React from d6dcad6a8 to 2807d781a.

### React upstream changes

- https://github.com/facebook/react/pull/27387
- https://github.com/facebook/react/pull/27386
- https://github.com/facebook/react/pull/27385
- https://github.com/facebook/react/pull/27379
- https://github.com/facebook/react/pull/27382

Closes NEXT-1637
2023-09-20 00:09:34 +00:00
Quentin
12e888126c
fix: handle string nodejs signals (#55606)
## Fixing a bug

### What?

On these versions, SIGINT signals are `string`, exit callback recieves code `number`

### How?

We use code argument to quit process for `event`, and exit with code `0` for `SIGINT` and `SIGTERM` signals 

Fixes #55605


Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2023-09-19 22:19:52 +00:00
Jiachi Liu
7e17de9880
docs: move optimizePackageImports to experimental (#55614)
Closes #55611
2023-09-19 21:49:29 +00:00
OJ Kwon
a429e04fec
test(turbopack) migrate api tests, few image tests (#55552)
### What?

PR migrates next-dev's api tests to use next.js integration tests, as well as enabling few more image tests.

Closes WEB-1599
2023-09-19 20:14:53 +00:00
Balázs Orbán
deded850c3
chore: run repro validation only on bug reports (#55610)
### What?

Continues #55525

Adding filtering for repro validation checks

### Why?

#55589 should not have been closed

### How?

ecbf8b4213
2023-09-19 20:00:06 +00:00
Jake Boone
3cd4b975c3
create-next-app templates: Change bun run dev commands to bun dev (#55603)
[As of Bun v1.0.0](https://bun.sh/blog/bun-v1.0#changelog-since-v0-8), `bun dev` runs the "dev" script from package.json. Therefore, as with Yarn and pnpm, the "run" command is not necessary.

This PR changes the `create-next-app` README templates to show `bun dev` instead of `bun run dev`.
2023-09-19 19:04:33 +00:00
Mayank
1afc38933f
fix: examples/with-grafbase/package.json to reduce vulnerabilities (#55593)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-GRAPHQL-5905181


Co-authored-by: snyk-bot <snyk-bot@snyk.io>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-19 14:46:12 -04:00
Mayank
2815c6fc2b
fix: examples/with-fauna/package.json to reduce vulnerabilities (#55594)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-GRAPHQL-5905181




Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-19 18:32:46 +00:00
Maia Teegarden
9b44963cd5
Remove link to closed discussion (#55596)
Closes WEB-1607
2023-09-19 18:30:08 +00:00
vercel-release-bot
0c1c7f847e v13.5.1 2023-09-19 17:20:54 +00:00
vercel-release-bot
974428583e v13.5.1-canary.1 2023-09-19 16:31:03 +00:00
Tobias Koppers
44eba020c6
improve publish-release (#55597)
Closes WEB-1608
2023-09-19 18:23:51 +02:00
vercel-release-bot
c652dc8811 v13.5.1-canary.0 2023-09-19 16:10:26 +00:00
vercel-release-bot
ffafad2c35 v13.5.0 2023-09-19 15:36:42 +00:00
vercel-release-bot
4a589ed83d v13.4.20-canary.41 2023-09-19 13:56:12 +00:00
Tobias Koppers
deb81cf246
fix styled-jsx alias (#55581)
### What?

makes sure that styled-jsx is always bundled as it contains `react` and
it being external would break the react vendoring
2023-09-19 15:51:14 +02:00
Tobias Koppers
1a9b0f6f7a
improve internal error logging (#55582)
### What?

Makes sure that errors that have no user code in stack trace still show
an stack trace


Closes WEB-1605
2023-09-19 15:46:26 +02:00
Jiachi Liu
063154918c
Fix react packages are not bundled for metadata routes (#55579)
`isAppLayer` condition was missing `app-metadata-route` layer, made it
as a util now like other webpack layer utils, add metadata route layer
to the group. Then `React.cache` can be available there.

Also update regex to be compatible across platform

Fixes #55561 
Closes NEXT-1635
2023-09-19 15:45:59 +02:00
Maia Teegarden
bad53655e8
Update supported config options for Turbopack (#55556)
Closes WEB-1600

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-09-19 15:33:17 +02:00
Shu Ding
8881c413a3
Fix useState function initialiser case for optimize_server_react transform (#55551)
This addresses the case mentioned in https://github.com/vercel/next.js/pull/54925#pullrequestreview-1616315332. We can't optimize the case where we can't statically determine the type of the `useState` argument as it can be a function: `useState(() => ...)`.
2023-09-19 13:32:52 +00:00
Shu Ding
10250119df
Add react-icons to optimizePackageImports (#55572)
Follow-up for #55310.
2023-09-19 11:39:16 +00:00
Balázs Orbán
d5c35a1bbb
chore: replace issue triaing actions with nissuer (#55525)
### What?

Moving maintenance to a separate repository.

### Why?

I want to make these actions reusable in other projects as they seem to work well in the Next.js repository.

### How?

The code is moved to https://github.com/balazsorban44/nissuer

I tested it on my fork, and all the following functionality is preserved: https://github.com/balazsorban44/next.js/issues/56

- [x] Close/lock/comment without a valid reproduction link
- [x] Minimize "+1"
- [x] Add labels based on user selection
- [x] Add comment based on the maintainer's label (eg.: "please add a complete reproduction")
2023-09-19 11:11:00 +00:00
Zack Tanner
33c561b21d
Consolidate experimental React opt-in & add ppr flag (#55560)
This consolidates how we're evaluating when to opt into `react@experimental` since it's sprinkled in a lot of spots. Also adds a new flag to opt into the experimental channel

Closes NEXT-1632
2023-09-19 10:45:25 +00:00
Shu Ding
f630cb8e56
Add mui-core to the default optimizePackageImports list (#55554)
Feedback from https://github.com/vercel/next.js/issues/48748#issuecomment-1714292279.

As per my testing, an App Router route of

```tsx
'use client'

import { Button } from 'mui-core'

export default function Page() {
  return <Button>Hi</Button>
}
```

was improved from `2.4s (1221 modules)` to `1458ms (649 modules)` for the local dev.
2023-09-19 10:31:38 +00:00
romeobravo
caa908326f
chore: Fix heading hierarchy in revalidateTag documentation (#55470)
### What?
Fix heading hierarchy in revalidateTag documentation (https://nextjs.org/docs/app/api-reference/functions/revalidateTag)

### Why?
Makes it consistent with https://nextjs.org/docs/app/api-reference/functions/revalidatePath
2023-09-19 01:41:18 +00:00
vercel-release-bot
d01ab6165e v13.4.20-canary.40 2023-09-18 23:29:58 +00:00
JJ Kasper
6123a9700b
Fix missing trace file and unhandledRejection in ensurePage (#55553)
Seems we occasionally have unhandledRejections with `ensurePage` due to
the our memoize handling not attaching `.catch` quick enough. This
updates to ensure `.catch()` is always present for that promise and
re-throwing separately.

Also, ensures the necessary `module.compiled` files for `route-modules`
are included in our build traces.

x-ref: [slack
thread](https://vercel.slack.com/archives/C04KC8A53T7/p1695072157528389?thread_ts=1695060035.024789&cid=C04KC8A53T7)
2023-09-18 18:22:52 -05:00
Matt Hooper
b5beb3a968
Correct spelling in playwright docs (#55557) 2023-09-18 22:59:01 +00:00
Alejandro Roigé
4c6d4b35b4
Type Error on Event Type payment_intent webhook (#55493)
changed` failed `for `payment_failed` on line 45

### What?
Error in line 45 on type of payment_intent

### Why?
Example provided does not work 

### How?
Added 'payment_'
2023-09-18 20:15:42 +00:00
vercel-release-bot
41c89f0cd8 v13.4.20-canary.39 2023-09-18 20:12:27 +00:00
Jiachi Liu
7fe01bb639
Disable client-only for middleware and pages api layer (#55541)
We need to disable the default treat `middleware` and `pages/api` as
server-only, unless users explictly import "server-only" to poison it.

This will avoid the case that when a library is mixing "client-only" API
and shared components API in one bundle, and the shared API is used in
middleware or `pages/api` that might cause error. See the test case
added.

Follow up for #55394
2023-09-18 14:59:54 -05:00
Steven
e4439b1430
chore(third-parties): replace rimraf with rm.mjs (#55547)
- Follow up to https://github.com/vercel/next.js/pull/55544
- Same pattern from https://github.com/vercel/next.js/pull/49529
2023-09-18 19:57:45 +00:00
JJ Kasper
1b8ce8f634
Add route groups example to revalidatePath doc (#55543)
Adds explicit examples for route groups as those may not be obvious from
existing examples.

x-ref:
https://github.com/vercel/next.js/issues/49387#issuecomment-1722575969
2023-09-18 14:40:30 -05:00
JJ Kasper
9697bcd3c8
Fix notFound status code with ISR in app (#55542)
This ensures we properly set/restore the status code with ISR paths in
app router so that when we set the 404 status code with `notFound` it is
persisted properly.

Fixes: https://github.com/vercel/next.js/issues/43831
Closes: https://github.com/vercel/next.js/issues/48342
x-ref:
https://github.com/vercel/next.js/issues/49387#issuecomment-1722575969
2023-09-18 14:35:00 -05:00
Tobias Koppers
0338dcdf2c
fix next.js own build on windows (#55544)
### What

allow to build next.js on windows

Closes WEB-1597

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-09-18 14:21:51 -05:00
vercel-release-bot
4f98dc6f26 v13.4.20-canary.38 2023-09-18 19:09:41 +00:00