Commit graph

17631 commits

Author SHA1 Message Date
Tim Neutkens
dca5e22384
Remove legacy checks for unstable_getXProps (#55813)
These methods have been landed for multiple years now, it's fine to remove the legacy checks for `unstable_`.
2023-09-22 17:22:06 +00:00
Tim Neutkens
6177f9f9c3
Move DefineEnv to separate file (#55811)
Narrowing down the webpack config a bit.

<!-- 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-22 19:07:52 +02:00
Leah
7fa1618ef7
chore: update turbopack to turbopack-230922.2 (#55828) 2023-09-22 18:52:18 +02:00
Zack Tanner
f20728ac3d
fix Image when used with --experimental-https (#55775)
The IPC request to `imageOptimizer` assumed the server was listening on http, so this updates it to pull the protocol from `getRequestMeta` instead. This also adds the option to pass in a path to the CA Root so that the dev server can add it to `NODE_EXTRA_CA_CERTS`


Closes NEXT-1646
Fixes #55706
2023-09-22 14:26:20 +00:00
Jiachi Liu
57cd1d0284
Remove unused internal env var (#55762)
`__NEXT_PREBUNDLED_REACT` is replaced by `__NEXT_EXPERIMENTAL_REACT` as we're bundling built-in react for app router
2023-09-22 00:51:11 +00:00
vercel-release-bot
0d6f3ac36b v13.5.3-canary.1 2023-09-21 23:58:45 +00:00
OJ Kwon
4484ef1106
test(turbopack): explicitly clean up instance for turbopack (#55772)
### What?

Minor improvement to test fixture to clean up the instance if explicitly specified to continue test. This is required to run turbopack related tests.

Closes WEB-1634
2023-09-21 23:50:13 +00:00
Jiachi Liu
39e688e802
Fix output log extra new line (#55770)
For progress spinner, only log new line when `process.stdout.isTTY`

## After

![image](https://github.com/vercel/next.js/assets/4800338/cb850b22-0985-4129-ba5e-961f3c914701)

## Before

![image](https://github.com/vercel/next.js/assets/4800338/5c69d964-74dd-432f-901d-ad86a4307422)

Adding extra space make sure there's loading bar between prefix text and spinner 

![image](https://github.com/vercel/next.js/assets/4800338/b99f7ec6-af9d-445b-a6ea-3d1592b4553d)


Closes NEXT-1647
2023-09-21 23:35:59 +00:00
JJ Kasper
83bea332ed
Update fnm setup for CI (#55765)
We can use the cached version if available and only install if it's missing. 

x-ref: https://github.com/vercel/next.js/actions/runs/6267098663/job/17019478099?pr=55764
2023-09-21 21:50:40 +00:00
Justin Ridgewell
9dfa2db64d
turbopack: Rewrite ESM modules to CJS during client transition (#55693)
### What?

I'm not sure if this is necessary, but while investigating #55689 I found that the RSC code that we send to the client continues to use the ESM outputs during resolution.

The problem is that the RSC server code uses ESM, then tries to send that down to the client. We have a `NextSharedRuntimeResolvePlugin` which handles rewriting _some_ modules (the shared runtimes) to CJS, but that doesn't apply to the main entry points that are RSC rendered, like `app-router`.

### Why?

Webpack seems to only resolve to CJS routes.

### How?

We manually rewrite "transition" entry points to the CJS output, just like the resolve plugin.

Closes WEB-1618
2023-09-21 21:42:38 +00:00
Zack Tanner
e0b8d3292d
fix thenable types & update another incorrect cache record (#55758)
This is a continuation from https://github.com/vercel/next.js/pull/55690 but also properly types these functions so we can catch these easier
2023-09-21 21:32:10 +00:00
Zack Tanner
ff7e4f49f3
Revert "fix: Invoke cancel, only if the stream is not closed (#55684)" (#55764)
This is causing test failures

[x-ref](https://github.com/vercel/next.js/actions/runs/6266707570/job/17018892465#step:29:704)
[x-ref](https://github.com/vercel/next.js/actions/runs/6266641982/job/17018064501#step:29:670)
2023-09-21 21:17:18 +00:00
Joseph
ea01649a47
fix: Invoke cancel, only if the stream is not closed (#55684) 2023-09-21 22:14:44 +02:00
OJ Kwon
4e877c01ba
test(fixture): prevent start failure teardowns whole process (#55760)
### What?

In some test failures we've been observing test result is not written at
all like


```
Failed to load test output [Error: ENOENT: no such file or directory, open 'test/e2e/app-dir/edge-runtime-node-compatibility/edge-runtime-node-compatibility.test.ts.results.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'test/e2e/app-dir/edge-runtime-node-compatibility/edge-runtime-node-compatibility.test.ts.results.json'
}
```

scrolling up, it was due to whole test process was taken down by calling
process.exit explicitly.

We want to collect test results for the failures still, so the PR amends
it for the cases if it's specified to continue on error.


Closes WEB-1628
2023-09-21 21:46:15 +02:00
OJ Kwon
67294fcb9d
test(turbopack): remove escape hatches for custom turbopack bindings (#55757)
### What?

This was a stopgap for the previous turbopack to ignore some config
validation, but we shouldn't need it anymore with new turbopack to run
test correctly.

Closes WEB-1626
2023-09-21 21:45:49 +02:00
Vũ Văn Dũng
a680571d04
Remove the left padding in next info output (#55704)
## Why?

Although the left padding makes the output looks good in the terminal, it causes this weird alignment in almost all bug reports:

```yaml
Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Pro
    Binaries:
      Node: 18.12.0
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant Packages:
      next: 13.5.2-canary.2
      eslint-config-next: 13.5.2
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.2.2
    Next.js Config:
      output: N/A
```

If I want it to look nice in the bug report

```yaml
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.0.0: Thu Aug 17 21:23:02 PDT 2023; root:xnu-10002.1.11~3/RELEASE_ARM64_T8112
Binaries:
  Node: 20.3.1
  npm: 9.6.7
  Yarn: 1.22.19
  pnpm: 8.6.12
Relevant Packages:
  next: 13.5.2
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A
```

I have to paste this to a text editor and manually remove the first four spaces on every lines.

### How?

This PR removes that four-space padding to make future bug reports look a bit nicer.
2023-09-21 18:26:43 +00:00
Mayank
a17c235dc9
Fix/upgrade examples data fetch (#55695)
Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-21 16:15:41 +00:00
Jimmy Lai
76c9b2c469
misc: improve profiling script (#55732)
This PR improves the minimal server script by adding a slightly better look require profiler + some misc utility changes. This is eventually gonna be the basis for a `next profile` command.

This is what the output look like + its usage.
https://app.warp.dev/block/4AtutJ2PpVcM5BFDqlk7zk

```
next-cold-start: 56.024ms
next-request: 58.462ms
next-wall-time: 128.757ms
└─ ../../../packages/next/dist/compiled/next-server/server.runtime.prod.js 39.31ms / 49.27ms
  ├─ ../../../server/lib/trace/tracer.js 9.92ms / 20.97ms
  │  ├─ ../constants.js 0.19ms / 0.19ms
  │  └─ ../../../../../../../node_modules/.pnpm/@opentelemetry+api@1.4.1/node_modules/@opentelemetry/api/build/src/index.js 10.86ms / 18.94ms
  │     ├─ ../baggage/utils.js 4.35ms / 7.41ms
  │     │  ├─ ../../api/diag.js 2.98ms / 5.70ms
  │     │  │  ├─ ../../diag/ComponentLogger.js 2.02ms / 3.66ms
  │     │  │  │  └─ ../../internal/global-utils.js 1.65ms / 2.71ms
  │     │  │  │     ├─ ../../platform/index.js 0.90ms / 1.22ms
  │     │  │  │     │  └─ ../node/index.js 0.32ms / 0.35ms
  │     │  │  │     │     └─ ../globalThis.js 0.03ms / 0.03ms
  │     │  │  │     ├─ ../../version.js 0.02ms / 0.02ms
  │     │  │  │     └─ ../semver.js 0.14ms / 0.14ms
  │     │  │  └─ ../../diag/internal/logLevelLogger.js 0.70ms / 0.76ms
  │     │  │     └─ ../../types.js 0.06ms / 0.06ms
  │     │  ├─ ../internal/baggage-impl.js 0.06ms / 0.06ms
  │     │  └─ ../internal/symbol.js 0.03ms / 0.03ms
  │     ├─ ../context/context.js 0.06ms / 0.06ms
  │     ├─ ../diag/consoleLogger.js 0.04ms / 0.04ms
  │     ├─ ../metrics/NoopMeter.js 0.12ms / 0.12ms
  │     ├─ ../metrics/Metric.js 0.03ms / 0.03ms
  │     ├─ ../propagation/TextMapPropagator.js 0.03ms / 0.03ms
  │     ├─ ../trace/ProxyTracer.js 1.69ms / 3.11ms
  │     │  └─ ../NoopTracer.js 1.42ms / 2.82ms
  │     │     ├─ ../../api/context.js 0.66ms / 0.73ms
  │     │     │  └─ ../../context/NoopContextManager.js 0.07ms / 0.07ms
  │     │     ├─ ../context-utils.js 0.70ms / 0.90ms
  │     │     │  └─ ../NonRecordingSpan.js 0.21ms / 0.55ms
  │     │     │     └─ ../invalid-span-constants.js 0.34ms / 0.37ms
  │     │     │        └─ ../trace_flags.js 0.03ms / 0.03ms
  │     │     └─ ../spancontext-utils.js 0.04ms / 0.04ms
  │     ├─ ../trace/ProxyTracerProvider.js 0.30ms / 0.33ms
  │     │  └─ ../NoopTracerProvider.js 0.03ms / 0.03ms
  │     ├─ ../trace/SamplingResult.js 0.03ms / 0.03ms
  │     ├─ ../trace/span_kind.js 0.03ms / 0.03ms
  │     ├─ ../trace/status.js 0.03ms / 0.03ms
  │     ├─ ../trace/internal/utils.js 0.44ms / 0.64ms
  │     │  └─ ../tracestate-impl.js 0.20ms / 0.25ms
  │     │     └─ ../tracestate-validators.js 0.04ms / 0.04ms
  │     ├─ ../context-api.js 0.06ms / 0.06ms
  │     ├─ ../diag-api.js 0.04ms / 0.04ms
  │     ├─ ../metrics-api.js 0.22ms / 0.48ms
  │     │  └─ ../api/metrics.js 0.26ms / 0.32ms
  │     │     └─ ../../metrics/NoopMeterProvider.js 0.06ms / 0.06ms
  │     ├─ ../propagation-api.js 0.30ms / 0.92ms
  │     │  └─ ../api/propagation.js 0.62ms / 0.74ms
  │     │     ├─ ../../propagation/NoopTextMapPropagator.js 0.03ms / 0.03ms
  │     │     └─ ../../baggage/context-helpers.js 0.09ms / 0.09ms
  │     └─ ../trace-api.js 0.31ms / 0.45ms
  │        └─ ../api/trace.js 0.15ms / 0.15ms
  ├─ ../../../shared/lib/runtime-config.external.js 0.05ms / 0.05ms
  ├─ ../../../../../../bench/basic-app/.next/server/app/page.js 4.07ms / 18.76ms
  │  ├─ ../../webpack-runtime.js 0.10ms / 0.10ms
  │  ├─ ../../chunks/388.js 0.06ms / 0.06ms
  │  ├─ ../../chunks/269.js 1.10ms / 1.10ms
  │  ├─ ../../../../../../packages/next/dist/compiled/next-server/app-page.runtime.prod.js 13.22ms / 13.63ms
  │  │  └─ ../../../client/components/request-async-storage.external.js 0.41ms / 0.47ms
  │  │     └─ ../async-local-storage.js 0.06ms / 0.06ms
  │  ├─ ../../../../../../packages/next/dist/client/components/static-generation-async-storage.external.js 0.16ms / 0.16ms
  │  └─ ../../../../../../packages/next/dist/client/components/action-async-storage.external.js 0.05ms / 0.05ms
  └─ ../../../../../../bench/basic-app/.next/server/app/page_client-reference-manifest.js 0.11ms / 0.11ms

```
2023-09-21 16:13:03 +00:00
Zack Tanner
9d089e3a0c
remove --watch from generate_types task (#55748)
This was causing issues due to needing to run the watcher in a detached process to avoid it clobbering the other build tasks. For now this disables the watcher so we still get the initial types which is generally all that's needed
2023-09-21 16:03:26 +00:00
S3Prototype
69a8878631
Feedback: Remove line saying server actions is dynamic-only (#55746)
- Removes a line from next docs that is no longer accurate:
> Currently, if a route uses a Server Action, it is required to render
dynamically.
According

With the release of Next.js 13.5, Server Actions now work with fully
static routes (including revalidating data with ISR).


<!-- 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: JJ Kasper <jj@jjsweb.site>
2023-09-21 10:43:42 -05:00
Balázs Orbán
bca6ff77f9
fix(cna): separate dependencies/devDependencies (#55730)
### What?

As [discussed](https://vercel.slack.com/archives/C04DUD7EB1B/p1692183798097169), we should follow the ecosystem standard separation of dependencies and dev dependencies.

### Why?

This is a common issue/misunderstanding that we always have to explain separately, while there is no real benefit.

One counter-argument was that install times would be increased when we had to run install for `dependencies` and `devDependencies` separately, but that's easy to work around as explained below.

### How?

Instead of passing the `dependencies` array to the package manager in the CLI, we write these to the `package.json` file and then run the package manager's install command without the dependency arguments.

This will also reduce the number of writes to the `package.json` file from two to just one.

Ref: https://github.com/vercel/next.js/pull/42218, https://github.com/vercel/next.js/pull/48076, https://github.com/vercel/next.js/issues/54105, https://github.com/vercel/next.js/pull/42012, and more

[Slack thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1692183798097169)


Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-09-21 15:30:37 +00:00
Tobias Koppers
fabab8cf05
improve CI log (#55736)
### What?

* expands the first test failure
* uses an  emoji for visibility
* adds (killed) to killed processes to not confuse them with errors

![image](https://github.com/vercel/next.js/assets/1365881/4735124b-ad76-4664-93ea-b893d41e8abd)


Closes WEB-1623
2023-09-21 15:07:00 +00:00
Balázs Orbán
5daf2ee572
fix(ts): allow auto-import of next/navigation (#55743)
Fix auto-import of `next/navigation` when a method is referenced in VSCode

Closes NEXT-1649
Fixes #55741
2023-09-21 14:25:13 +00:00
Naru
ade8d7cdc4
fix(react-refresh-utils): avoid memory leaks caused by prevExports (#53797)
This fixes memory leaks caused by `prevExports` in react-refresh-utils.
It happens in code like the following:
```tsx
const DATA = Array.from({ length: 100000 }, (_, i) => Math.random());

export const App = () => {
  return (
    <div>
      <div>REWRITE_HERE</div>
      <div>{DATA.length}</div>
    </div>
  );
};
```

After we edit this file to trigger fast refresh, previous `DATA` will be
still retained in the memory since it forms `App(new) -> prevExports ->
App(old) -> DATA` reference chain (there is some screenshots
[here](https://github.com/pmmmwh/react-refresh-webpack-plugin/pull/766)).
I believe there is no reason to retain the whole exports as
`prevExports`. We can just retain "signature" (`string[]`). By only
holding this, we no longer create reference to the old exports, which
fixes the memory leak here. Note that I filed a similar PR in
https://github.com/pmmmwh/react-refresh-webpack-plugin/pull/766 and also
https://github.com/naruaway-sandbox/fast-refresh-hmr-memory-leak-demo is
a reproducible example of this issue, which also explains that
interestingly this issue is not easily solved for Vite.


## Should we fix it?
I think yes, as long as there is no unintended side effect, it's better
to fix it since we cannot predict whether users would load large payload
AND does Fast Refresh many times without reloading the browser or not.
In [this extreme
case](https://github.com/naruaway-sandbox/fast-refresh-hmr-memory-leak-demo),
it eats several hundred mega bytes of RAM.

## Verification
I confirmed that the memory leak is gone with this change by running
https://github.com/naruaway-sandbox/fast-refresh-hmr-memory-leak-demo
with the change.

I am not sure whether new tests are needed but my concern is to
accidentally break Fast Refresh behavior somehow. I believe we have
enough existing test cases 🙏 and I also tested manually.
2023-09-21 13:33:00 +02:00
Balázs Orbán
073123234a
chore: bump nissuer (#55723)
### What?

This introduces a weighting measurement when determining comments as unhelpful.

### Why?

Too many "same issue" comments in general, but it's hard to do an exact match with only regex.

### How?

Exact code can be found here:
b3363e7948/index.js (L203-L213)

In short, by default if a comment is less than 30% different from unhelpful words, the whole comment will be considered unhelpful.

[Slack thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1695287105298299)
2023-09-21 11:04:38 +00:00
vercel-release-bot
e9148eda2a v13.5.3-canary.0 2023-09-21 09:07:13 +00:00
Zack Tanner
5f5c9a0896
ensure fetchServerResponse is a valid record when stored in router cache (#55690)
Since these values are inserted into the cache and read with
`readRecordValue`, they need to have a `status` property otherwise it'll
be re-thrown in `navigate-reducer`. Investigating if this resolves an
issue where under certain circumstances navigations get stuck
suspending.

Closes NEXT-1643
2023-09-21 11:01:29 +02:00
OJ Kwon
b811240602
ci(tests): enable turbopack /e2e tests (#55681)
### What?

Closes WEB-1615

I thought I couldn't grab the correct count of test suite in the datadog
as I was seeing huge count mismatches. Actually, it was because we were
not running all of the tests.

PR amends

- run all the tests under manifests
- ensure all the test list in the manifest actually exists

lastly and sadly
- disable few tests too flaky
2023-09-21 08:14:29 +02:00
LongYinan
d665c3df4d
Upgrade to latest NAPI-RS infra (#55505)
Should also resolve the msvc runtime issue: https://nextjs.org/docs/messages/failed-loading-swc#possible-ways-to-fix-it
2023-09-20 23:37:28 +00:00
Ryan Gillie
90b0352a3e
Docs - Fix VSCode Full Stack Debugging Regex Pattern (#55670)
The most recent Next.js update [redesigned the logging output](https://github.com/vercel/next.js/pull/54713) (which looks great btw) but it broke the uri regex for the VSCode debugger. This PR updates it to use the new pattern.

Output Pattern Before: 
![Alt Text](https://user-images.githubusercontent.com/4800338/265493587-ee181263-3dd4-40d0-9ffc-819a56b45900.png)
Regex Before: `started server on .+, url: (https?://.+)`


Output Pattern After:
![Alt Text](https://user-images.githubusercontent.com/4800338/265130260-9649b340-8241-4756-a2b3-a989f0b74003.png)
Regex After: `- Local:.+(https?:\/\/.+)`

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-09-20 23:24:12 +00:00
Yagiz Nizipli
721a270989
refactor: modernize get-online with dns/promises (#55674)
Small refactor to use `dns/promises`, `URL`, and `encoding` parameter of `execSync`.
2023-09-20 22:49:46 +00:00
Justin Ridgewell
d7818d21b6
turbopack: Update the next/dist/esm rewrite ResolvePlugin (#55689)
### What?

This updates `NextSharedRuntimeResolvePlugin` to match on `next/dist/esm` pattern instead of matching on `node_modules/next/dist`. While the old code is more correct, it prevents the plugin from working when we're developing Next.js locally, because the imported path is resolved to `packages/next/dist/esm/`, not `node_modules/next/dist/esm/`

### Why?

So that we can develop locally without bugs.

### How?

A simple glob change.

Closes NEXT-
Fixes #

-->


Closes WEB-1616
2023-09-20 22:04:29 +00:00
Wyatt Johnson
a88e9953b9
Split prerending by route kind (#55622)
In order to support updates to the prerendering pipelines, this breaks out some of the prerendering
code into discrete chunks importable for each route kind rather than them all sharing the same
function.

Some small optimizations were made, namely some matcher memoization (only the last one) that should
help with large builds locally.
2023-09-20 21:25:21 +00:00
Travis Anderson
f0ffa1c79e
add tip for case sensitivity of imports (#55662)
While an import may work on initial load, fast refresh fails, and also this can also cause issues when trying to deploy your project to Vercel, resulting in your component not being found.

This could save people time when they run into this issue, and I wish this small nuance, would've been in the docs.




Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-09-20 21:12:40 +00:00
Mayank
563019f79c
Fix/upgrade examples with clerk (#55676)
Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-20 20:28:35 +00:00
Jiachi Liu
e6910b4ca8
Capitalize compiling log (#55685)
Align "Compiling..." log with other logs, using captialized starter
2023-09-20 19:52:50 +00:00
Yagiz Nizipli
13436ba660
refactor: use fs.existsSync instead of accessSync (#55675)
There is no need to have accessSync since it throws an error, and creation of errors are costly.
2023-09-20 19:37:44 +00:00
Zack Tanner
2053bef9f4
update taskfile to generate types during build (#55628)
When running the `dev` task, types aren't emitted so there's a good chance of running into a TypeError like:
```
Type error: Module '"next/dist/lib/metadata/types/metadata-interface.js"' has no exported member 'ResolvingMetadata'.
```
during a `next build` from within the monorepo. 

This creates a task to run `types` from within taskr as part of the build step.
2023-09-20 18:19:43 +00:00
Tobias Koppers
628a19393b
only put css in entry_css_files (#55585)
### What?

Fixes the error:

```
Refused to apply style from '...'  because its MIME type ('application/javascript') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
```

Closes WEB-1606
2023-09-20 17:32:09 +00:00
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