Commit graph

15020 commits

Author SHA1 Message Date
Mauro Mandracchia
dd1de0e4c8
[Nitpick] Remove unnecessary await in base-server (#47313)
### What?
Async functions can just be return without await.

### Why?
Is just cleaner. Not important and not crucial.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-03-20 14:40:24 -07:00
Balázs Orbán
5448c234d6
fix(cli): handle Tailwind CSS + src/ correctly (#47238)
### What?

- [x] fixes a bug in the CLI with the combination of `--tailwind` and
`--src-dir` flags.
- [x] fixes Tailwind CSS config when `--src-dir` is set
- [x] respect `NEXT_TEST_SKIP_CLEANUP` in test utils

### Why?

`pnpm create next-app@canary --tailwind --src-dir` should not fail.

### How?

We introduced the `app-tw` and `default-tw` templates, so we need to
respect them when working with files (in this case, the CLI was
erroneously assuming that if `template !== "app"` it must be a pages
template.)

I also noticed that the `tailwind.config.js` file need to also respect
`--src-dir` by prefixing the paths in `content`

Fixes #47236
fix NEXT-838 ([link](https://linear.app/vercel/issue/NEXT-838))

Related: #46927, #47276

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-03-20 14:21:29 -07:00
Tim Neutkens
5d9b166eba v13.2.5-canary.9 2023-03-20 22:06:42 +01:00
Jimmy Lai
feb2aecfa0
parallel routes: fix nested routes (#47323)
### What?

There was a bug with supporting nested routes in the parallel routes
with named slots that made the request hang

### Why?

The request was hanging suspended on the router because the
`next-app-loader` was not finding the layout component and thus, it was
falling back to a component that returned null, tripping a bit of code
in the app router that suspended.

### How?

The fix was to fix the next-app-loader loader tree generation to account
for parallel routes

Closes NEXT-
Fixes #


<!-- 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-854 ([link](https://linear.app/vercel/issue/NEXT-854))

---------

Co-authored-by: Tim Neutkens <timneutkens@users.noreply.github.com>
2023-03-20 21:59:58 +01:00
Gary Borton
47ac5d5f8c
Add a .catch to shared router for ssg fetching. (#47265)
**Description:**
I noticed that when a user is on a deployed next.js site, and a fresh
deployment is made, requests for ssg data fails w/ a 404. For prefetches
(hovering a link) this appears to be handled well, but when the user
actually clicks the link it wasn't being handled.

This doesn't seem to be a problem as the page still behaves as expected,
but the errors being generated are clogging sentry.

To fix this, I added a simple `.catch(() => false)` as the return value
didn't appear to be used at all.

I was able to verify that this works correctly by patching next in a
local project and deploying a few times then clicking around.

**Issues**
As far as I know there's no issue tracking this atm as I chatted w/ Tim
in slack and he was under the impression that all of the failures were
caught.

Console on page navigation before this change:
<img width="775" alt="image"
src="https://user-images.githubusercontent.com/4172067/226069042-afa3a23b-b575-4e81-8ec4-ac887e38444d.png">

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-03-20 13:19:25 -07:00
Jan Kaifer
7696124a5e
Remove duplicated if statement (#47322)
Came across these two if statements that had equal conditions.

The second error could never get thrown.
2023-03-20 12:36:49 -07:00
Tim Neutkens
8a4e8059ed
Add searchParams to leaf cache key (#47312)
### What?

Makes searchParams part of the cache key for dynamic rendering
responses.

### Why?

Current the cache key only includes the pathname and not the
searchParams. This causes issues in a few cases:
- Navigation to `/dashboard` then clicking a link to
`/dashboard?sort=asc` works, but then when navigating back the cache
node for `/dashboard?sort=asc` is used instead of the content for
`/dashboard`.
- Navigation between different searchParams always had to be a hard
navigation as reusing a cache node would result in the wrong result.

### How?

Changed the leaf node's name from `''` to `'__PAGE__'` so that it can be
distinguished. Then used that `__PAGE__` marker to include the
searchParams into the cache key for that leaf node in all places it's
used.

Ideally the `__PAGE__` key becomes something that can't be addressed in
the pathname, since it still has to be serializable I'm thinking a
number would be best.

Given that the server just provides the cache key and the client only
reasons about rendering the tree the current approach of stringifying
the searchParams and making that part of the cache key could be replaced
with a hash of the stringified result instead.

fix NEXT-685 ([link](https://linear.app/vercel/issue/NEXT-685))
Fixes #45026
Fixes NEXT-688
Fixes #46503
2023-03-20 19:57:29 +01:00
Yongjun Park
afd7a50a77
fix invalid comment in parseParameter function (#47291)
I noticed an incorrect comment in ```parseParameter``` function, so I fixed it and added a missing example case.
- Rename property ```name``` -> ```key```
- Add ```repeat: true, optional: false``` case

20b8dda0e8/packages/next/src/shared/lib/router/utils/route-regex.ts (L15-L21)
2023-03-20 18:11:11 +00:00
Jan Kaifer
46201e1644
Improve OTEL spans naming (#47209)
Adds bunch of default attributes and span names as discussed in https://github.com/vercel/next.js/pull/47066

Also discovered a few issues with our test setup.
It's actually quite handy to use jest snapshots for this, thanks for the tip @feedthejim 

Currently we have following spans:
- root span with name `GET /app/rsc-fetch` (both API calls and page requests)
  - `SERVER` span	
  - attributes:
    -  `"http.method": "GET"`
    -  `"http.status_code": 200`
    -  `"http.target": "/app/rsc-fetch"`
    -  `"next.span_name": "GET /app/rsc-fetch"`
    -  `"next.span_type": "BaseServer.handleRequest"`
- fetch span `fetch GET https://vercel.com/`
  - `CLIENT` span	
  - attributes:
    -  `"http.method": "GET"`
    -  `"http.url": "https://vercel.com/"`
    -  `"net.peer.name": "vercel.com"`
    -  `"next.span_name": "fetch GET https://vercel.com/"`
    -  `"next.span_type": "AppRender.fetch"`

- rendering of page `rendering /app/rsc-fetch`
  - attributes:
    -  `"next.pathname": "/app/rsc-fetch"`
    -  `"next.span_name": "rendering /app/rsc-fetch"`
    -  `"next.span_type": "BaseServer.renderToResponse"`
    
- finding the right page component `resolving route /app/rsc-fetch/page`
  - attributes
    -  `"next.route": "/app/rsc-fetch/page"`
    -  `"next.span_name": "resolving route /app/rsc-fetch/page"`
    -  `"next.span_type": "NextNodeServer.findPageComponents"`
    
- getServerSideProps `getServerSideProps /pages/getServerSideProps`
  - attributes
    -  `"next.span_name": "getServerSideProps /pages/getServerSideProps"`
    -  `"next.span_type": "Render.getServerSideProps"`
    

fix NEXT-829 ([link](https://linear.app/vercel/issue/NEXT-829))
2023-03-20 17:17:23 +00:00
Will Binns-Smith
40cb797a34
next/font/local prep: compartmentalize next/font/google (#47213)
This PR is largely preparation work for next/font/local by
compartmentalizing and modularizing existing pieces of next/font/google.
It:

* Renames the top level directory to `next_font`
* Places next/font/google-specific code into `next_font/google`
* Extracts common structures and methods into top-level
`font_fallback.rs`, `stylesheet.rs`, `util.rs`, etc.
* Updates visibility of structures and functions to use `pub(super)`
within `next/font/google`

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-03-20 08:49:23 -07:00
tka5
fd0e81342f
fix typo (#47235)
Co-authored-by: Jan Kaifer <jan@kaifer.cz>
2023-03-20 15:45:45 +00:00
Jimmy Lai
8771a5613e
parallel routes: fix duplicate dev warning (#47317)
- there's a warning that happens currently when compiling parallel
routes in dev because they all resolve to the same pathname and their
identity function is all the same
- I'm repurposing their identity fn to include the actual segment it's
referring to, instead of all of them

the `__next_prallelPaths` string doesn't seem to be used otherwise so I
think it's alright to rename


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

- there's a warning that happens currently when compiling parallel
routes in dev because they all resolve to the same pathname
- 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-831
Fixes #

-->

fix NEXT-831 ([link](https://linear.app/vercel/issue/NEXT-831))
2023-03-20 13:10:13 +01:00
Gal Schlezinger
6b09bc86a8
[edge] limit the api surface of util (#47292)
This makes sure that what works locally will work in production.
2023-03-20 10:29:00 +01:00
Steven
7cc4159561
fix: handle different cases of React fetchPriority (#47302)
In React 18.3.0 or newer, we must user camelCase `fetchPriority` prop to avoid "Warning: Invalid DOM property".

In React 18.2.0 and older, we must use the lowercase `fetchpriority` prop to avoid "Warning: Invalid DOM property".

See https://github.com/facebook/react/pull/25927
2023-03-20 00:26:00 +00:00
Vlad Filippov
23c9f0eef2
Fix contributing.md link in the rendering benchmark (#47303)
Fixes a 404 issue with the docs
2023-03-19 23:49:49 +00:00
meesvandongen
a76c929717
fix: typo in output:export error messages (#47252)
See changes
2023-03-19 19:58:56 +00:00
Lee Robinson
269780cfbf
Add note about Windows Defender (#47298)
https://twitter.com/timneutkens/status/1637504870541320193
2023-03-19 18:01:33 +00:00
Tim Neutkens
20b8dda0e8
Split app-render functions into separate files (#47282)
Splits out the app-render related functions into separate files.


<!-- 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-03-18 22:24:42 +01:00
JJ Kasper
1467be886a
v13.2.5-canary.8 2023-03-17 16:13:40 -07:00
Shu Ding
e42a3d6d48
Fix loader rule with wrong matching conditions (#47261
This Webpack loader rule should have the exactly same conditions as


828fd5a162/packages/next/src/build/webpack-config.ts (L1940-L1951)

Except that it matches 2 special layers and an extra loader.
2023-03-17 23:35:02 +01:00
Steven
5ed66e54d1
chore: add missing ts type in next-edge-app-route-loader (#47243)
Follow up to #47219
2023-03-17 22:33:10 +00:00
Steven
1aaae2998d
feat: add fetchPriority to next/image (#47222)
- Closes #43096 
- Available since Chrome 101:
https://chromestatus.com/feature/5273474901737472
- Coming to Safari: https://bugs.webkit.org/show_bug.cgi?id=252739
- Introduction blog: https://web.dev/priority-hints/


fix NEXT-319 ([link](https://linear.app/vercel/issue/NEXT-319))
2023-03-17 14:48:13 -07:00
JJ Kasper
ad223c816c
Ensure config and fetch revalidate are honored (#47255)
This ensures revalidate can be fetch specific instead of cache key
specific and adds a test case to ensure config based revalidate isn't
overridden by fetch based revalidate.
2023-03-17 14:00:07 -07:00
Jiachi Liu
e601a3b532
Support manifest.json static and dynamic route (#47240)
* Add `manifest.webmanifest` and `manifest.(j|t)xs?` support for
manifest.json route
* Add `Manifest` type for it for autocomplete purpose.

Remove the exports for `SitemapFile` and `RobotsFile` globally, will
discuss how to re-export them with better naming later

Small fix for `Robots` typing, should allow `string | string[]` for user
agent of single Robots

Closes NEXT-839

---------
2023-03-17 12:11:34 -07:00
Lee Robinson
990f62acde
Improve static export documentation (#47251)
There has been some helpful [discussion on Twitter](https://twitter.com/dan_abramov/status/1636778278882099216) around this page of documentation. I refactored the introduction to make it more clear that you also get to use SPA features when doing a static export, and underscoring the value of being able to deploy/host virtually anywhere with this approach.

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-03-17 18:54:54 +00:00
Wyatt Johnson
e29bd49d87
i18n Improvements (#47174)
This serves to correct a specific issue related to multiple locales being specified in the pathname as well as some general i18n improvements.

- Multiple locales are now parsed correctly (only taking the first locale, treating the rest of the string as the pathname)
- `LocaleRouteNormalizer` has been split into `I18NProvider` and `LocaleRouteNormalizer` (tests added)
- Adjusted the `I18NProvider.analyze` method (previously `LocaleRouteNormalizer.match`) to require the `defaultLocale: string | undefined` to ensure consistent behaviour
- Added more comments around i18n
2023-03-17 18:48:09 +00:00
AdamKatzDev
9dbd8d7741
feat(standalone): allow configuring KEEP_ALIVE_TIMEOUT via env var (#46052)
Resolves #39689, partially resolves #28642 (see notes below)
Inspired by #44627

In #28642 it was also asked to expose `server.headersTimeout`, but it is
probably not needed for most use cases and not implemented even in `next
start`. It was needed to change this option before
https://github.com/nodejs/node/issues/27363.
There also exists a rare bug that is described here
https://github.com/nodejs/node/pull/32329#issuecomment-614119125. To fix
this exposing `server.headersTimeout` might be required both in
`server.js` and in `next start`.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-03-17 11:22:43 -07:00
Mrugesh Mohapatra
539cca853a
fix: typo in message for experimental.runtime (#47248)
<!-- 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 #

-->
Fixed a typo in the warning message for the experimental.runtime check
2023-03-17 11:07:10 -07:00
Shu Ding
8b44085b70
Fix CSS not being bundled in app dir (#45787)
Currently all import CSS resources, including CSS modules, are imported lazily. This means that they can't be chunked as by definition of "lazy" they can be loaded separately.

This PR changes it to always use "eager" so if they're in the same entry, these CSS resources can be chunked together and reduce the total amount of requests. However the downside will be tree shaking, as not all modules in a chunk are used by one entry. Two entries can only share a part of it.

Since CSS modules won't have side effects this should be a good trade off.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-03-17 17:38:19 +00:00
Shu Ding
51b1fe3d2f
Emit late streaming meta tags (#47207)
Currently if `notFound()` or `redirect()` is called when the shell was already sent out, we can no longer change the status code and head tags. In that case we inject these specific meta tags into the HTML stream so specific agents can read them.

fix NEXT-220 ([link](https://linear.app/vercel/issue/NEXT-220))
2023-03-17 14:37:00 +00:00
Jiachi Liu
694e7f9e80
Generate metadata images generation with app routes (#47225)
Generated metadata icons through api routes instead of using webpack
emitting file. Each metadata image file will go through
`next-metadata-image-loader` to get the image basic info, and then it
will go through `next-metadata-route-loader` to be converted as a
routes.

Related to NEXT-264
Closes NEXT-810
2023-03-17 13:41:56 +01:00
Tim Neutkens
7a104a673b v13.2.5-canary.7 2023-03-17 13:31:21 +01:00
Gal Schlezinger
524bcd563b
[edge] support Node.js core modules in edge runtime (#47191)
This PR enables Node.js core modules in edge runtime by leaving a
`require` statement in the output source as externals

- [x] buffer
- [ ] async_hooks
- [ ] util 
- [ ] assert
- [ ] events
2023-03-17 13:29:31 +01:00
Tobias Koppers
d760c00961
print reason for compilation (#47190)
### What?

add reason of compilation to the `updated in` message.


![image](https://user-images.githubusercontent.com/1365881/225526729-7ada5e84-78a0-4518-ad9c-48178fd4e7cb.png)

### Why?

the general update in message is confusing and didn't show what is
happening.

Sometimes people are confused why turbopack compiles something. The new
messages explain that turbopack timings measure request handing duration
in addition to pure compilation time.

### How?

depends on https://github.com/vercel/turbo/pull/4208

fixes WEB-722
2023-03-17 13:22:25 +01:00
Felipe Saldanha
e49bfeaf47
Update router.md (#47210) 2023-03-17 09:39:31 +00:00
Tim Neutkens
6aa8c3768e v13.2.5-canary.6 2023-03-17 10:10:26 +01:00
Tobias Koppers
6eb33b7e68
update turbopack (#47205)
## Features

* https://github.com/vercel/turbo/pull/4208

## Testing

* https://github.com/vercel/turbo/pull/4211


Co-authored-by: Justin Ridgewell <112982+jridgewell@users.noreply.github.com>
2023-03-17 08:41:32 +00:00
Justin Ridgewell
875ddea183
next-swc: Switch to testing::fixture (#47183)
The old `test_generator::test_resources` could only find resources relative to the project root, and not relative to the test file. Because of the new nextpack directory structure, this causes all kinds of headaches between running in nextpack and running in turbo (`next.js/packages/next-swc` vs `nextpack/next.js/packages/next-swc`).
2023-03-17 06:18:25 +00:00
JJ Kasper
6a603464e4
Fix deploy example (#47228)
x-ref:
https://github.com/vercel/next.js/actions/runs/4443450845/jobs/7800761746
2023-03-16 20:02:28 -07:00
Shu Ding
922b5de06f
Support passing both closure arguments and parameters (#47212)
When calling the server (via `callServer`), we concat all closure values
(`$$bound`) and arguments of the function call into one array on the
client. Hence on the server, we will have to compile the function
differently to support that.

With this change, the compiled function will have a `$$with_bound` flag
to indicate that if it accepts closure values. If so, the only argument
passed will be an array like `[...bound_values, ...fn_args]`, and we
compile the function parameters to `(closure, arg1 = closure[N], arg2 =
closure[N + 1], ...)` where `N` is the number of the closure
identifiers. This way we can still fill these arguments by only pass an
"bound + args" array. If it doesn't accept closure values, it will be
directly called with `...fn_args` so no compilation change needed.

The reason that we use `arg1 = closure[N]` is that this can support
complex patterns in parameters such as `f(closure, {a} = closure[1], [b]
= closure[2])`.

fix NEXT-487 ([link](https://linear.app/vercel/issue/NEXT-487))
2023-03-16 19:11:13 -07:00
Franktronics
8dabe4fc96
docs: commentary correction for i18n app folder (#47226)
Simple correction of a word in the comments
2023-03-17 02:07:18 +00:00
JJ Kasper
c7534092c7
Fix failing CI checks (#47223)
x-ref:
https://github.com/vercel/next.js/actions/runs/4441543036/jobs/7796929887
x-ref:
https://github.com/vercel/next.js/actions/runs/4441543036/jobs/7796930146
2023-03-16 18:59:52 -07:00
Shu Ding
45fe26f596
Fix missing option in createFromFetch (#47216)
This PR makes sure that `callServer` is specified in all Flight response creation calls. Added a test to cover HMR.

https://vercel.slack.com/archives/C03KAR5DCKC/p1678997184339409
2023-03-17 00:46:21 +00:00
Steven
bfed3985b1
fix: show error for api route handler with output: export (#47219)
In the case when the user configured `output: export` and used an API Route Handler that cannot be converted to static, Next.js must throw an error.

fix NEXT-823 ([link](https://linear.app/vercel/issue/NEXT-823))
2023-03-16 22:38:00 +00:00
Tim Neutkens
4e96e044d2 v13.2.5-canary.5 2023-03-16 21:53:59 +01:00
Tim Neutkens
cc0da4bd29
Opt-in to dynamic rendering when reading searchParams (#46205)
Ensures that using `searchParams` opts into dynamic rendering.

Fixes #43077 
fix NEXT-601 ([link](https://linear.app/vercel/issue/NEXT-601))

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

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-16 21:46:35 +01:00
Leah
dbdf47cf61
fix build issue and future incompatibility (#47176)
It was complaining about having 2 versions of sentry for some reason
2023-03-16 19:29:24 +00:00
Shu Uesugi
723626cf48
Handle defaultLocale on client router filter (#47180)
x-ref: [slack
thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1678838567947919)

Follow-up to https://github.com/vercel/next.js/pull/46317. The issue is
that, if:

- `experimental.clientRouterFilter` is enabled
- `i18n` is enabled with `defaultLocale` set
- Next.js router navigates to a path that (1) is the same as
`defaultLocale` and (2) will be redirected,

then:

- **Expected:** Should hard-navigate to this path without any locale
prefix (and then redirect occurs)
- **Actual:** Hard-navigates to this path with `defaultLocale` prefix,
even though it's not needed (and then redirect occurrs)

### Solution

This PR fixes the above issue by adding `defaultLocale` to `addLocale`
which is passed to `handleHardNavigation`. [`addLocale` skips adding the
locale if `locale` is equal to
`defaultLocale`](02125cf3b1/packages/next/src/shared/lib/router/utils/add-locale.ts (L17)).

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

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-03-16 11:58:02 -07:00
Jiachi Liu
1255e19965
Reorganize client references manifest (#46777)
* Rename client reference plugins from `Flight*` to `ClientReference*`
* Rename `serverComponentManifest` to `clientReferenceManifest`
* Group the key/value in client reference manifest
* Update turbopack crates
2023-03-16 18:10:32 +00:00
Jan Kaifer
53f29cd633
Add OTEL tests (#47149) 2023-03-16 16:35:07 +00:00