Commit graph

12825 commits

Author SHA1 Message Date
Jimmy Lai
86050df666
perf: lazy eval headers from the requestStore (#41353)
The `ReadOnlyHeaders` class extends the `Headers` class that is provided
via a polyfill. This incurs some costs the first time it's created
because we need to load that polyfill. This saves approximately 10ms on
my machine on a cold request.

This is only useful when a user does not access headers during the
request of course and when the runtime does not support fetch naitvely.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `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: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-13 17:19:10 +02:00
Tim Neutkens
4ff348cbd4 v12.3.2-canary.27 2022-10-13 15:13:48 +02:00
Hannes Bornö
928ad97984
App font loader tree shaking (#41384)
Fixes tree shaking for font loaders in server components.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-13 11:26:12 +00:00
Tim Neutkens
562b5a380e
Add exports for new router (#41368)
Adds `next/navigation` and `next/headers` APIs. Docs will follow later..



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `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>
2022-10-13 09:13:39 +00:00
Lee Robinson
a315c748c7
Update node-module-in-edge-runtime.md (#41375)
To be a bit more clear.

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-10-13 04:22:04 +00:00
teobler
830750af30
docs: add tips for building first before running test for contribute Nextjs. (#41379)
close https://github.com/vercel/next.js/issues/41378

add tips for building first before running tests for contribute Nextjs

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
2022-10-13 03:45:08 +00:00
Steven
7fc301d0b5
Fix onLoad prop in next/future/image (#41374)
Fixes a bug in `next/future/image` where `onLoad` might not be called.
This is the same workaround we added for `onError`.
2022-10-12 20:36:33 -07:00
Balázs Orbán
46bdef8137
docs: clarify redirects on client-side navigation (#41362)
Ref: #41344

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-12 22:37:56 +00:00
Sukka
054393421a
refactor(#41164): polyfill-module should block hydration (#41352)
The PR continues from #41164.

`next/script` with `beforeInteractive` should not block the hydration,
**but the `polyfill-nomodule` *should* block the hydration** (and should
be loaded before other scripts), as `polyfill-nomodule` includes
multiple polyfills to even execute `main-app.[hash].js` properly on old
browsers (`Array.prototype.includes`, `String.prototype.startsWith`,
etc.).

Without `polyfill-nomodule` being loaded first, the entire
bootstrap/hydration process might not even work on old browsers. So it
should not be loaded through `__next_s`.

cc @shuding

Co-authored-by: Shu Ding <g@shud.in>
2022-10-12 14:08:36 -07:00
JJ Kasper
629fa8afa3
v12.3.2-canary.26 2022-10-12 08:45:51 -07:00
Tim Neutkens
3f1a61b18f
Ensure content is kept rendered below the error overlay on build errors in new router (#41360)
- Remove unused code
- Keep rendering underlying component tree when there is a build error
- Move error catch up one level



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-12 14:36:24 +00:00
Shu Ding
b96ff8de2f
Fix CSS imports tree-shaking (#41357)
The way we currently track server CSS imports is to collect CSS files that each **module** depends on. This happens on the module graph level which is a global thing and cannot be tree-shaken properly (check the enabled test for more details).

In this PR we collect another information, of CSS files that each **entrypoint** depends on. This is the CSS list after tree-shaken on the entry level. By intersecting these CSS imports with the module-level CSS imports, we can get the final used CSS imports for each _layout_.

cc @hanneslund 

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-12 13:41:19 +00:00
Hong-Kuan Wu
9b106db25a
add Cloudflare Turnstile example (#41283)
## Description
close #41110 

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-12 12:56:37 +00:00
Meno Abels
6652d783e4
proper error if middleware or api/route not return a Response (#41336)
## Bug

The error which is thrown if the fetch method returns not a falsy or
Response value
is misleading.

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-10-12 14:02:25 +02:00
Jimmy Lai
7b7fae5a8c
inline httpproxy usage (#41330)
Same as https://github.com/vercel/next.js/pull/41322 we inline the usage of this module because it's heavy and not always used on regular servers + not used at all on minimal mode

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-12 09:03:45 +00:00
Jiachi Liu
8db5991714
Update rsc error message (#41351)
Follow up for #41333, updating the error message with `"use client"` directives in suggestion
2022-10-12 08:35:50 +00:00
Tim Neutkens
bf630e8e57
Refactor error overlay for new router (#41343)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-10-12 09:40:44 +02:00
JJ Kasper
e0bb25806b
Ensure RSC paths are normalized in minimal mode (#41348)
This ensures we probably remove RSC from the path/URL when in minimal mode. 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

Fixes: [slack thread](https://vercel.slack.com/archives/C043ANYDB24/p1665517894397169?thread_ts=1664913868.516049&cid=C043ANYDB24)
2022-10-12 07:17:17 +00:00
Maxim Baz
de8ae7313f
Support aarch64 Linux with page size >= 16k (#41229)
Fixes https://github.com/vercel/next.js/issues/39311

Backport of upstream patch https://github.com/swc-project/swc/pull/6075

More details are described in https://github.com/swc-project/swc/issues/5967

I confirm that the swc plugin, when compiled with this patch, works on my Linux aarch64 machine.

This will work on all aarch64 Linux systems, the patch is configuring jemalloc to use largest possible page size, instead of taking the value from the machine where you are compiling it. 

And here's the compiled binary, if you want to give it a go!

[next-swc.linux-arm64-gnu.node.zip](https://github.com/vercel/next.js/files/9728262/next-swc.linux-arm64-gnu.node.zip)


Let me know if that makes sense! 🙂
2022-10-12 06:13:06 +00:00
Steven
5d7d7391e0
Update next/image codemod to handle require() (#41345)
Follow up to a comment here:

-
https://github.com/vercel/next.js/pull/41004#pullrequestreview-1137492624
2022-10-11 18:12:02 -07:00
Hannes Bornö
e1e64e072e
Test for unused css modules with layout (#41018)
Similar to #40996.

This PR only adds a failing test that should pass. Also updates wrong url of previous test.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-11 23:00:14 +00:00
JJ Kasper
5162b64c21
v12.3.2-canary.25 2022-10-11 14:28:59 -07:00
JJ Kasper
7777130324
Fix middleware URL normalize case (#41342)
Follow-up to https://github.com/vercel/next.js/pull/41341 this fixes a
related issue with the URL normalizing in middleware and updates the
regression tests.

x-ref: [slack
thread](https://vercel.slack.com/archives/C01224Q5M99/p1665161421775079?thread_ts=1664536480.045539&cid=C01224Q5M99)

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-10-11 14:27:31 -07:00
Steven
c1de0c0ce6
Add codemods for next/image (#41004)
This adds two codemods for `next/image`.

The first codemod a safe solution to upgrade from 12 to 13 by swapping
to `next/legacy/image`.

The second codemod is an experimental solution that attempts to automate
the [migration
guide](https://nextjs.org/docs/api-reference/next/future/image#migration).
2022-10-11 13:44:36 -07:00
JJ Kasper
09d642a700
Bump E2E test timeout minutes 2022-10-11 13:42:27 -07:00
Hannes Bornö
66a3028a3b
Reduce remote requests in google fonts (#41306)
Reduce remote request by reusing response between server and client
compilation. Once reused it can be removed, will be cached by webpack
after that.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-11 13:38:29 -07:00
Hannes Bornö
310b99902f
Reduce local font loader options (#41332)
Reduces the amount of options for local fonts. Adds additional regression tests.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-11 19:52:10 +00:00
JJ Kasper
31886589a0
Fix middleware rewrite for _next/data (#41341)
x-ref: [slack
thread](https://vercel.slack.com/archives/C01224Q5M99/p1665161421775079?thread_ts=1664536480.045539&cid=C01224Q5M99)

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-10-11 12:23:22 -07:00
Jiachi Liu
2b99db07f7
Client component directive: use client (#41333)
Replace `'client'` with `'use client'` as client directive for client
components in RSC

x-ref: [slack
thread](https://vercel.slack.com/archives/C035J346QQL/p1665435520907559)

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-11 10:26:45 -07:00
Donny/강동윤
6c2a0f36a6
chore: Update swc_core to v0.32.8 (#41304)
This PR updates swc crates to 018ca946e7
2022-10-11 17:12:22 +00:00
Steven
9e1d04dd93
Add pretty error when image import is invalid format (#41267)
This PR improves the error message when an invalid image is imported. It
also ensures the page that imported the image is displayed.

### Before

<img width="1062" alt="image"
src="https://user-images.githubusercontent.com/229881/194674177-70f4ae73-64c9-497f-8e20-098f949a4219.png">


### After

<img width="1002" alt="image"
src="https://user-images.githubusercontent.com/229881/194716285-27dd3455-60a9-440f-a50e-eff8d49e764b.png">

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-10-11 18:22:13 +02:00
Jimmy Lai
c6a8675c35
misc: add minimal server bench setup (#41328)
This PR adds a script to run a minimal Next server in order to reproduce more easily the cold boot conditions in production.

You can use it by using `pnpm start` after having built your app with `pnpm next-react-exp build bench/minimal-server/benchmar-app` from the root of this repo.

<img width="338" alt="image" src="https://user-images.githubusercontent.com/11064311/195102966-6997b957-1e6b-433f-b611-e0eaec9462fa.png">

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-11 15:53:26 +00:00
Jimmy Lai
ba08576e4a
perf: lazyload the edge runtime in NextServer (#41322)
## Context

I'm investigating cold boot perf

## This PR

Did some manual analysis on next cold boot for the "regular" node target
and found out that we are spending a good 10ms evaluating the edge
runtime module when we shouldn't be in most cases.

This is a quick fix to only load it when actually required.

## Test plan

I have a simple script which I'll push in a separate PR to measure the
cold boot.

Results:


before:
<img width="230" alt="image"
src="https://user-images.githubusercontent.com/11064311/195073994-c3d28961-5d22-401f-a4b0-026c791ff2bd.png">

after:
<img width="275" alt="image"
src="https://user-images.githubusercontent.com/11064311/195073941-a0897532-6e9f-482d-a1f0-8b9c9231c6b0.png">

it appears to be a 10~15ms win on cold boot 

## Following up

We probably want a separate NextMinimalServer type of build?

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-11 17:29:08 +02:00
Balázs Orbán
701e8d2c0f
fix(standalone): support type: "module" (#41268)
Fixes #41258

When we detect `type: "module"` in `package.json`:

~1. generate `server.mjs`~ Not necessary when `type: "module"` is set.
2. use `import` instead of `require`
3. replace `__dirname` with [ESM compatible
alternative](https://blog.logrocket.com/alternatives-dirname-node-js-es-modules/)

In this PR, I also moved some tests (those using `output: "standalone"`)
to a new `test/production/standalone-mode` directory for easier
discoverability in the future.

Run the related test with `pnpm test
test/production/standalone-mode/type-module/index.test.ts`

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-11 17:04:37 +02:00
Luca Forstner
93bdaf1078
Remove references to withSentry function in with-sentry example (#41326)
<!--
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 that you're making:
-->

## Documentation / Examples

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

## Content

In version
[`7.15.0`](https://github.com/getsentry/sentry-javascript/releases/tag/7.15.0)
of the `@sentry/nextjs` SDK we introduced a new build-time feature that
removes the need for manually wrapping API routes.

This PR removes all manual `withSentry` calls from the `with-sentry`
example.

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-10-11 16:16:16 +02:00
Tim Neutkens
e3df5909cb
Handle error overlay for new router (#41325) 2022-10-11 16:11:57 +02:00
Balázs Orbán
2060d0e3e9
fix(image): don't show placeholder warning in Jest (#41329)
In Jest, we were mocking the `next/image` imports with a width and
height of `24`. If the developer set `placeholder="blur"` on their
images though, this triggered the warning:

> Image with src "/img.jpg" is smaller than 40x40. Consider removing the
"placeholder='blur'" property to improve performance.

Since we cannot reliably hide this warning without knowing the actual
image dimensions, and we also provide a `blurDataURL` by default, we
should increase the mock image size to suppress the warning.

Note that using `moduleNameMapper` in `jest.config.js`, the developer
can already tweak the mock behavior:


a78163dc61/packages/next/build/jest/jest.ts (L111-L121)

Fixes #41248
2022-10-11 16:06:54 +02:00
Jiachi Liu
a78163dc61
Global layouts error boundary (#41305) 2022-10-11 11:17:10 +02:00
JJ Kasper
3c8727dcab
v12.3.2-canary.24 2022-10-10 17:05:15 -07:00
Maria José Solano
1ca80a5db6
Update security-headers doc (#41312)
<!--
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 that you're making:
-->

## Documentation / Examples

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

Just fixing an error in the documentation where the text doesn't match
what the code snippet is doing.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-10 17:03:58 -07:00
JJ Kasper
acb46e1090
Fix NextUrl trailing slash normalize for data route (#41311)
x-ref: [slack
thread](https://vercel.slack.com/archives/C045FKE5P51/p1665074590321179)

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-10-10 16:50:31 -07:00
JJ Kasper
35308c668e
Update middleware query hydration handling (#41243)
This updates to skip the data request done during query hydration when
middleware is present as it was mainly to gather query params from any
potential rewrites in middleware although this is usually not needed for
static pages and the context can be gathered in different ways on the
client.

x-ref: [slack
thread](https://vercel.slack.com/archives/C045FKE5P51/p1665082474010149)

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-10-10 12:58:18 -07:00
Hannes Bornö
05498a0988
Local font files adjust fallbacks (#41180)
When using `@next/font/local` we can't have pre calculated metrics for the font. This PR uses fontkit to read metadata about the imported local font in order to generate a fallback.

Also removes some props from the api that's better done automatically in the future.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-10 18:54:34 +00:00
გიორგი George Dav
6e4f1e2851
chore(examples): upgrade Auth0 example (#41284)
feat: [...auth0] 

Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2022-10-10 14:31:36 +00:00
Tim Neutkens
3d499a627f
Add test for link back to original page (#41297)
- Implements failing test
- Implemented handling for the case where the router tree does not match up with the segment path being navigated to. This is what caused the underlying error. 



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-10 12:42:46 +00:00
Crazy Urus
d74f34021b
Add --frozen-lockfile in Docker example when using pnpm (#41291)
It seems that lock file is used when using npm and yarn, but pnpm doesn't, complete this code.

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-10 12:10:14 +00:00
Shu Ding
e933e1d211
Load beforeInteractive scripts properly without blocking hydration (#41164)
This PR ensures that for the app directory, `beforeInteractive`, `afterInteractive` and `lazyOnload` scripts via `next/script` are properly supported.

For both `beforeInteractive` and `afterInteractive` scripts, a preload link tag needs to be injected by Float. For `beforeInteractive` scripts and Next.js' polyfills, they need to be manually executed in order before starting the Next.js' runtime, without blocking the downloading of HTML and other scripts.

This PR doesn't include the `worker` type of scripts yet.

Note: in this PR I changed the inlined flight data `__next_s` to `__next_f`, and use `__next_s` for scripts data, because I can't find a better name for `next/script` that is also short at the same time.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [x] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-09 15:08:51 +00:00
Tim Neutkens
425490c2b1
Add test for link to catchall route in new router (#41289) 2022-10-09 08:18:56 +02:00
Tim Neutkens
f7a7c3fafa
Handle as on next/link with new router (#41285)
Kudos @dferber90 who found this issue. Added a test and handled it gracefully for now. Keep in mind the behavior can't be 1-1 so it takes the `as` as the `href` value given that masking of parameters in this way is no longer supported, that will be superseded by parallel routes / route interception.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `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`
- [ ] Integration 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-08 17:42:55 +00:00
Tim Neutkens
52a69e6117 v12.3.2-canary.23 2022-10-08 19:11:53 +02:00