Commit graph

15429 commits

Author SHA1 Message Date
Tobias Koppers
c18889b6a0
add test case for alias field (#47856)
### What?

tests for https://github.com/vercel/turbo/pull/4434
2023-04-04 21:07:04 +00:00
JJ Kasper
95ca6f48c6 v13.2.5-canary.30 2023-04-04 19:41:51 +00:00
Justin Ridgewell
77b0c7b72c
turbopack: defer dev code evaluation until after page render IPC connects (#47888)
When the devs have a parse/module-eval error in their Page/App module, Turbopack's rendering process will fail to connect the IPC. This is because the entrypoint statically imports the dev module. If either fails, then we'll never reach the code to set up the IPC. This leads to a "timeout while receiving message from process" timeout error after 30s, instead of receiving an exact message/stack detailing the dev's error.

By wrapping the import code in a deferred dynamic-import closure, we're able to connect the IPC first, then evaluate the dev code. This wrapping style is a little awkward, but it's necessary with the way to inject virtual modules into our graph.

Fixes WEB-850
2023-04-04 19:24:31 +00:00
Swarnava Sengupta
a79d1efdd0
[Docs] Update react docs link (#47891)
- This PR fixed the  Documentation link of new react.dev website.
2023-04-04 11:56:03 -07:00
Jiachi Liu
dcc0ef8e47
Hide not ENOENT errors for not found in ipc server (#47854)
Not to log not found errors created from on demand handlers in ipc
server

Remove the not found error trace for dev
```
event - compiled client and server successfully in 57 ms (265 modules)
/Users/huozhi/workspace/next.js/packages/next/src/server/dev/on-demand-entry-handler.ts:450
    throw new PageNotFoundError(normalizedPagePath)
          ^

Error: Cannot find module for page: /not-found
    at findPagePathData (/Users/huozhi/workspace/next.js/packages/next/src/server/dev/on-demand-entry-handler.ts:450:11)
    at Object.ensurePage (/Users/huozhi/workspace/next.js/packages/next/src/server/dev/on-demand-entry-handler.ts:701:30)
    at Server.<anonymous> (/Users/huozhi/workspace/next.js/packages/next/src/server/lib/server-ipc.ts:29:24) {
  code: 'ENOENT'
}
```
2023-04-04 11:46:49 -07:00
Leah
53ddfc833e
mark resolve issues inside a try block as warnings (#47763)
## Description

A require call inside a try block will only emit a warning instead of an error now.

I also added source information to the resolve issues where possible

### Example
```js
try {
  require("missing-module");
} ...
```
previously this would show an error in the overlay, now it's just a warning

## Additional Turbopack Updates

* https://github.com/vercel/turbo/pull/4414 (requirement for this)
* https://github.com/vercel/turbo/pull/4434
* https://github.com/vercel/turbo/pull/4447
* https://github.com/vercel/turbo/pull/4448
* https://github.com/vercel/turbo/pull/4446
2023-04-04 17:49:43 +00:00
Shu Ding
2eeb0c7f49
Add missing module.hot.accept call to server CSS modules (#47913)
Since we compile global server CSS imports into a special module with a
checksum of the original content, it should always accept HMR updates.
This fixes `Fast Refresh had to perform a full reload` errors.
2023-04-04 18:56:54 +02:00
Jan Kaifer
a3acbf4f55
Add documentation on OTEL support (#47194)
Added docs that mention:
- important code-snippets from example
- links to official OTEL docs
- document NEXT_VERBOSE_OTEL
- explain what we provide out of the box
- what we don’t
- explain how you can add tracing yourself
- explain how instrumentation.js works
- it can be used for different types of instrumentation that don't use
OTEL. It's just a hook called when starting up a new node environment.

- list of all spans we instrument by default
 
fix NEXT-799 ([link](https://linear.app/vercel/issue/NEXT-799))

---------

Co-authored-by: S3Prototype <liuqahs15@gmail.com>
2023-04-04 14:24:46 +00:00
JJ Kasper
43ff6cfd99 v13.2.5-canary.29 2023-04-04 13:44:22 +00:00
Jan Kaifer
f621830507
Fix issue where NextServer.prepare wouldn't be called when deployed (#47899) 2023-04-04 12:43:55 +00:00
Jimmy Lai
eba1626b45
router: implement route interceptions (#47565)
This PR implements the route intercepting feature from [the layouts
RFC](https://nextjs.org/blog/layouts-rfc#intercepting-routes).

You can use route interception by adding these special markers,
`(..),(...) or (..)(..)` to your segment definition, i.e. by creating a
page with this path: `/foo/bar/(..)baz/page.ts`.

Changes in this PR:
- added a new kind of route handlers to support intercepting routes
- added a "referrer" concept that is derived from the client router
state on navigation, where we try to guess which URL you were on before
- added some units tests
- updated the renderer to allow for overrides when the path params don't
include the current dynamic param, so we rely on the passed router state
to create it

<!-- 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 or adding/fixing 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 #

-->

fix NEXT-749 ([link](https://linear.app/vercel/issue/NEXT-749))

---------

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2023-04-04 14:06:24 +02:00
Balázs Orbán
9d5a3e8c6b
chore: update labels (#47904)
### What?

Syncing https://github.com/vercel/next.js/labels with the bug report template.

### Why?

We've got some OS-related reports so it would be nice to be able to filter on that.

### How?

The label description is added as a select option to the template, which then matches one of the labels https://github.com/vercel/next.js/labels
2023-04-04 11:30:56 +00:00
Ricardo Fiorani
9d6eee11a6
Update github link (#47900) 2023-04-04 10:02:52 +00:00
Jan Kaifer
cd1d233a65
Decrease required open telemetry peer-dependency version (#47861) 2023-04-04 09:56:59 +00:00
Shu Ding
7556601c19
TS plugin: ensure error and global-error files are client components (#47882)
Add a new plugin rule to ensure that `error.tsx?` and `global-error.tsx?` files inside app dir are client components:

<img width="1157" alt="CleanShot-2023-04-04-dlEeu1P6@2x" src="https://user-images.githubusercontent.com/3676859/229643189-69da3e87-90e4-43ae-8d15-a568053c950d.png">

fix NEXT-797
2023-04-04 05:06:09 +00:00
JJ Kasper
042f4ed975
Revert "Test disabling kodiak (#47880)"
This reverts commit 9de5b7b715.
2023-04-03 21:30:08 -07:00
Shu Ding
a22d6a181e
Change package path from gitpkg.now.sh to gitpkg.vercel.app (#47879)
Avoids a couple of hops when installing packages as `.now.sh` returns a
redirection.
2023-04-03 17:21:15 -07:00
JJ Kasper
c05514079b
Ensure GH actions tests run for trunk branches (#47883)
We need to run for all branches for trunk to test correctly
2023-04-03 16:45:55 -07:00
Ian Luca
3e25b06c32
Fix type plugin for NX workspaces (#47534)
The plugin was failing in NX monorepos due to a wrong import path.

#44363, https://github.com/nrwl/nx/issues/14558

```
nx build my-next

> nx run my-next:build:production

warn  - You have enabled experimental feature (appDir) in next.config.js.
warn  - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
info  - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback

info  - Creating an optimized production build  
info  - Compiled successfully
info  - Skipping linting
info  - Checking validity of types ..Failed to compile.

Type error: Cannot find module '../../../../app/layout' or its corresponding type declarations.


 ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Ran target build for project my-next (2s)
 
    ✖    1/1 failed
```

---------

Co-authored-by: Ian Serpa <ian.serpa@imc.com>
Co-authored-by: Shu Ding <g@shud.in>
2023-04-04 01:21:01 +02:00
JJ Kasper
9de5b7b715
Test disabling kodiak (#47880)
Testing out a new alternative
2023-04-03 15:11:57 -07:00
JJ Kasper
f63463e4e3
Update dev IPC request (#47877)
This ensures we don't fail to send dev IPC requests when `localhost` resolves to an IPv6 address but the IPC server is listening on IPv4. 

<details>

<summary>example error</summary>

```sh
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11118:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async DevServer.invokeIpcMethod (/Users/test/projects/blog/node_modules/.pnpm/next@13.2.5-canary.28_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/dev/next-dev-server.js:881:25)
    at async DevServer.ensurePage (/Users/test/projects/blog/node_modules/.pnpm/next@13.2.5-canary.28_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/dev/next-dev-server.js:1199:13)
    at async Object.fn (/Users/test/projects/blog/node_modules/.pnpm/next@13.2.5-canary.28_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/next-server.js:1496:29)
    at async Router.execute (/Users/test/projects/blog/node_modules/.pnpm/next@13.2.5-canary.28_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/router.js:293:32)
    at async DevServer.runImpl (/Users/test/projects/blog/node_modules/.pnpm/next@13.2.5-canary.28_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/base-server.js:494:29)
    at async DevServer.run (/Users/test/projects/blog/node_modules/.pnpm/next@13.2.5-canary.28_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/dev/next-dev-server.js:860:20)
    at async DevServer.handleRequestImpl (/Users/test/projects/blog/node_modules/.pnpm/next@13.2.5-canary.28_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/base-server.js:437:20) {
  cause: Error: connect ECONNREFUSED ::1:49507
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16) {
    errno: -61,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '::1',
    port: 49507
  }
}
```

</details>
2023-04-03 21:52:04 +00:00
JJ Kasper
320ebe2d34
Update flakey tests and add Node.js setup retrying (#47871)
x-ref:
https://github.com/vercel/next.js/actions/runs/4599615812/jobs/8125278036
x-ref:
https://github.com/vercel/next.js/actions/runs/4598323624/jobs/8124618075?pr=47365
x-ref:
https://github.com/vercel/next.js/actions/runs/4598323624/jobs/8124612692?pr=47365
2023-04-03 13:37:14 -07:00
OJ Kwon
036f540bb4
feat(turbopack): support transform options (#47365)
<!-- 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



-->

### What?

This PR implements a feature for the turbpack to support (partial)
transform configuration inherited from ts/jsconfigs, notably for the
legacy decorators and jsx runtimes.

### Why?

### How?
- Closes WEB-667
2023-04-03 10:32:13 -07:00
Jan Kaifer
aeec6b5d0f
Hide internal fetches OTel traces in dev mode and assert duplicate OTel spans are present only in dev mode (#47822) 2023-04-03 16:56:29 +00:00
Shu Ding
da37c018f3
Memory improvements to static workers (#47823)
Continue the work to improve #32314.

This PR splits `webpack-build` into an `index` module and an `impl`
module. The `index` module invokes `impl` based on that if it should use
workers or in the same process.

Another notable change is that I modified the number of static workers,
to make it also based on remaining memory. I did some benchmarks and
found that using the number of CPUs might not be ideal. After the build
process (if `webpackBuildWorker` **isn't** enabled), the memory usage
was already very high. While the memory usage of the main process didn't
increase in the static optimization step, the overall number went high
again because we created 10 static workers:


![perf_ori](https://user-images.githubusercontent.com/3676859/229365432-ad2f3460-122d-4ded-8e02-b15d76d7687b.png)

As of today, a MacBook Pro has 10 CPU cores and 16 GB memory. The idle
memory of the system might be 8 GB, and the remaining memory when
starting the static workers might be 4~6 GB only. Here's a benchmark of
`next build` on `vercel-site`:


![CleanShot-2023-04-02-fmj2CXdK@2x](https://user-images.githubusercontent.com/3676859/229365784-20e646b3-2293-4bfc-82d9-94f33ce2461b.png)

The memory dropped there quickly because it has `webpackBuildWorker`
enabled, but then it increased again with static workers (note that we
already have `cpus: Math.round(require('node:os').cpus().length / 2) ||
1` configured in that repo). It makes more sense to limit that inside
Next.js natively.
2023-04-03 16:11:06 +02:00
Jiachi Liu
43b0043192
Polish metadata warnings (#47853)
- Add links to the error warning
- Log with warning prefix for every url that missing `metadataBase`, so users can easily locate where it's from

Closes NEXT-931
2023-04-03 14:02:48 +00:00
Tim Neutkens
06d60ac140
New app routes resolving logic for turbopack (#47737)
### What?

Refactors the resolving logic for the `app` loader tree. This PR ensures
it's used to create entrypoints in turbopack. Next up is integrating it
into the webpack build too.

These changes also ensure that parallel routes resolving is applied,
which previously wasn't supported in turbopack.

### Why?

Part of the effort to deduplicate critical logic between
turbopack/webpack in Next.js, this will help land features in
turbopack/webpack at the same time.

### How?

Quite a few changes. @sokra helped a ton on this PR. `app_structure.rs`
was changed to the new resolving logic so most of the logic is there.

Additionally we added support for calling the same function in two ways
from Node.js: `turbo.entrypoints.get` and `turbo.entrypoints.getStream`.
`get` can be used by `next build` to get the full list of
entrypoints/loadertrees once. `getStream` has watching built-in and
calls a callback function with the new list anytime a file is added that
would change the loadertree.



<!-- 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 or adding/fixing 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-04-03 13:07:28 +02:00
HarshaVardhanReddyDuvvuru
217fbbfd39
[docs] Update getting-started.md with New react docs link (#47841)
Replaced the old React Docs Link with new one




Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-04-03 07:43:34 +00:00
JJ Kasper
e034df0b13 v13.2.5-canary.28 2023-04-03 07:16:33 +00:00
JJ Kasper
b3a7d9f030
Enable context caching for middleware/edge functions in dev (#47840)
As discussed this enables the context caching for the middleware/edge
functions sandbox in development which reduces execution time noticeably
as modules don't need to be re-processed for each request unless an HMR
event related to that context has occurred.

In a follow-up PR we can investigate spreading the middleware/edge
function invocations across workers/processes now that we have detached
rendering/invoke processes from the routing process.

<details>
	<summary>before</summary>

![CleanShot 2023-04-02 at 22 23
45@2x](https://user-images.githubusercontent.com/22380829/229419430-5eed36e9-2615-44be-9314-490cb7283e5b.png)

</details>

<details>
	<summary>after</summary>

![CleanShot 2023-04-02 at 22 24
41@2x](https://user-images.githubusercontent.com/22380829/229419472-822a2d16-7e0d-4ee8-99c2-b1211010ebcf.png)


</details>

x-ref: [slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1677431214936269)
Fixes: https://github.com/vercel/next.js/issues/43999
2023-04-02 23:51:25 -07:00
Jiachi Liu
68f328f920
Fix: fill route params for dynamic route metadata images url (#47829)
Should fill dynamic routes url with params when generate the metadata
image urls.

For `/(group)`, we need to normalize the path first;
For dynamic routes `/[slug]`, we need to fill the params.

Change the image module from `() => image` to `(prop) => image(proop)`
so we can fill the runtime `params` into url

Closes NEXT-932

---------
2023-04-02 23:42:33 -07:00
JJ Kasper
de97a94d5f
Update set-cookies deploy test (#47836)
x-ref:
https://github.com/vercel/next.js/actions/runs/4587341207/jobs/8100910706#step:6:704
2023-04-02 22:18:40 -07:00
JJ Kasper
808a27ca36
Update render IPC handling (#47835)
This removes usage of fetch for render IPC calls as it introduces issues
across Node.js versions, IPC error handling is also updated here to
correctly handle instanceof check on `PageNotFoundError`.

x-ref:
https://github.com/vercel/next.js/actions/runs/4590201858/jobs/8106478191
x-ref:
https://github.com/vercel/next.js/actions/runs/4590160716/jobs/8105898749
x-ref:
https://github.com/vercel/next.js/actions/runs/4590160716/jobs/8105898965
x-ref:
https://github.com/vercel/next.js/actions/runs/4590160716/jobs/8105900628
2023-04-02 21:56:46 -07:00
JJ Kasper
400ccf7b1c
Update to retry undrafting canary (#47826)
x-ref:
https://github.com/vercel/next.js/actions/runs/4588934126/jobs/8103482375#step:10:658
2023-04-02 11:37:08 -07:00
JJ Kasper
819453e3a6
Fix dev ipc request on node v16 (#47825)
This ensures we filter conflicting headers from the initial request when
passing it to a render worker since undici in Node.js v16 fails on
these.

x-ref:
https://github.com/vercel/next.js/actions/runs/4588955268/jobs/8105263272
2023-04-02 11:27:31 -07:00
JJ Kasper
26e8197d7b v13.2.5-canary.27 2023-04-02 13:22:34 +00:00
JJ Kasper
fdacca8abc
Add initial separated route resolving (#47208)
This updates to have a separate routing process and separate rendering
processes for `pages` and `app` so that we can properly isolate the two
since they rely on different react versions.

Besides allowing the above mentioned isolation this also helps us
control recovering from process crashes easier as pieces are more
isolated from one another e.g. an infinite loop during rendering will no
longer block the compiler and can be stopped/restarted as needed.

In follow-up PRs we will continue to separate out the routing logic from
the rendering logic so that each process only loads what is relevant to
it helping simplify the flow for requests regardless of type.

---------

Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-02 15:17:15 +02:00
Jiachi Liu
fae94416ff
Move modularize imports for next/server to next-swc (#47788)
Follow up for #47715 

Moving modularize imports handlign for next/server into `next-swc` side
2023-04-02 13:00:26 +02:00
JJ Kasper
90ac02f7be
Fix failing rust-check (#47811)
This corrects a failing rust-check that slipped through in
https://github.com/vercel/next.js/pull/47677 due to the check not being
marked as required which it now is.

x-ref:
https://github.com/vercel/next.js/actions/runs/4587341207/jobs/8100906394
2023-04-02 01:03:46 -07:00
JJ Kasper
c1a2b4f15e v13.2.5-canary.26 2023-04-02 06:31:25 +00:00
Tim Neutkens
9c99d79209
Fix prefetch only being applied once (#47797)
### What / why?

Currently there is a bug because the `subTreeData` can only be applied
once, however, we reuse the same response when a url was prefetched.
During the first render of the response we apply the cacheNodes and then
these should be reused for subsequent navigations. There's currently a
bug because `fillLazyItemsTillLeafWithHead` creates `LAZY_INITIALIZED`
cache nodes that don't copy the previous cache node `parallelRoutes` and
`subTreeData` value, causing the cache nodes below where the
`subTreeData` is applied to be deleted from the cache, even when they're
not affected by the navigation.

### How?

This PR adds copying of the cache node when it exists already, I've
added a marker for `wasPrefetched` to trigger that behavior but in
talking to @feedthejim about this it seems we can swap to this behavior
always when applying the server response, that needs to be discussed
further though, this is temporary implementation with the fix for routes
that were prefetched.

Fixes NEXT-402

<!-- 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 or adding/fixing 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-04-01 23:12:49 -07:00
nivak-monarch
8e8eec3b21
fix: added tab and carriage to isWhitespace function to make robust (#47785) 2023-04-01 22:49:07 -07:00
vinay
2601f55982
(Fix)(Tests)Fix typo in unit testing (#47644)
<!-- 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 or adding/fixing 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 #

-->
Fix Typo In Unit Testing
2023-04-01 22:23:15 -07:00
Parbez
83afeb7642
fix(next-types-plugin): add ParamCheck type only for route.ts files (#47739)
<!-- 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 or adding/fixing 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

Closes NEXT-
Fixes #

-->

### What?
This pr removes `ParamCheck` type for `page` or `layout` files

### Why?
typescript throws error for unused vars with `"noUnusedLocals": true`
config

### How?
Check for `route` before defining the route
2023-04-01 22:00:05 -07:00
Shu Ding
7ef95ba77a
Add computeWorkerKey to the static optimization worker (#47792)
Since both `exportPage` and `isPageStatic` methods in the static
optimization worker involve loading the actual page component, it's
better to assign the same page to the same worker for these 2 tasks to
avoid unnecessary memory allocation.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-04-01 21:42:40 -07:00
JJ Kasper
8c7e4f9bc4
Fix fetchCache config and On-Demand Revalidate handling (#47803)
This ensures we properly honor the `export const fetchCache` config and
also ensures we properly bypass fetch-cache when an On-Demand
Revalidation is occurring.

The `export const dynamic` handling is not changed here as that was
behaving correctly and should not influence fetch cache handling only
whether a page is prerendered fully or treated as SSR.

Fixes: https://github.com/vercel/next.js/issues/47273
x-ref: [slack
thread](https://vercel.slack.com/archives/C042LHPJ1NX/p1679078572123979)
2023-04-01 21:15:13 -07:00
Jiachi Liu
225e924669
Fix module resolving error in tracer (#47786)
Fix the module resolving error found during development, because now few
app route code is bundled into RSC server layer, it can't resolve
opentelementry properly and will throw the error blow due to the check
of `require('@opentelemetry/api')` to see if it's installed.

```
Module not found: Can't resolve '@opentelemetry/api'
```

Thus I alias it to default `next/dist/compiled/@opentelemetry/api` when
it doesn't have external module

---------
2023-04-01 17:17:11 -07:00
Jiachi Liu
5c6b8ac3f2
Fix flaky css test and remove unused tests deps (#47806)
* use `check` to wait for css change
* remove unused swr deps and update them to latest
* remove swr esm test in `app-dir/app/` since it's already covered in
`app-dir/app-external/`

---------
2023-04-01 16:58:32 -07:00
Jiachi Liu
2a5c558963
Skip favicon.js for metadata (#47790)
For backward compatibility, we only handle `favicon.ico` file to
generate `/favicon.ico` route and link tag. If you want to use other
extension such as `png`, use `icon(\d)?.[ext]`
2023-04-02 01:35:24 +02:00
JJ Kasper
57d51b0e22
Tweak Vercel CLI installing for E2E tests (#47804)
Avoids accidentally running the CLI install twice at the same time due
to concurrency by pre-installing it before starting tests.

x-ref:
https://github.com/vercel/next.js/actions/runs/4581102424/jobs/8090565967
x-ref:
https://github.com/vercel/next.js/blob/canary/test/lib/next-modes/next-deploy.ts#L27
2023-04-01 15:36:21 -07:00