Commit graph

12486 commits

Author SHA1 Message Date
Hannes Bornö
9ec041efbf
Update font loader output path (#40868)
Updates the output path so it's the same as when font files are imported
in CSS: `url(./font.woff2)`

Also adds missing font types to next package.

## 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-09-26 12:59:38 -07:00
Jacob North
bb1dd47019
Correct link for "Deploy" button (#40894)
The old link was cloning the "with-chakra-ui-typescript" repo which has
been deprecated.

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

## Bug

- [x] Fixed issue with link in README.md
2022-09-26 12:51:31 -07:00
Abdallah NourAldin
194b6ad1c1
update url for React Hydration Documentation (#40883)
Docs point to old
__[hydrate()](https://reactjs.org/docs/react-dom.html#hydrate)__, which
had been replaced with
__[hydrateRoot()](https://reactjs.org/docs/react-dom-client.html#hydrateroot)__
as React 18 came:

> Note:
hydrate has been replaced with hydrateRoot in React 18. See
[hydrateRoot](https://reactjs.org/docs/react-dom-client.html#hydrateroot)
for more info.

From [react 18 docs](https://reactjs.org/docs/react-dom.html#hydrate).
2022-09-26 12:35:12 -07:00
JJ Kasper
84aa99e2c0
Update pre-compiled (#40914)
Fixes:
https://github.com/vercel/next.js/actions/runs/3128790934/jobs/5077187888
2022-09-26 10:59:04 -07:00
Jaril
904619509e
Use an ellipsis character instead (#40913)
<!--
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:
-->

For context, making a test change to allow testing CI changes in
https://github.com/vercel/next.js/pull/40910 without approval each run.

@ijjk How's this? The string's not being snapshotted so it shouldn't
break any tests.
2022-09-26 10:24:24 -07:00
Tim Neutkens
6ceda2a3a2 v12.3.2-canary.9 2022-09-26 16:57:56 +02:00
Tim Neutkens
db705bb9b6 Update pnpm-lock.yaml 2022-09-26 16:56:52 +02:00
Tim Neutkens
7ccc95c525 v12.3.2-canary.8 2022-09-26 15:52:34 +02:00
Tim Neutkens
8b802ddb88
Update handling of redirect/404 throw to cross server->client boundary (#40890) 2022-09-26 13:16:20 +02:00
Tim Neutkens
3211b3f672
Upgrade react@experimental (#40885) 2022-09-25 21:35:05 +02:00
Tim Neutkens
f6e37fd32e
Apply #40833 (#40872) 2022-09-25 11:45:00 +02:00
Shu Ding
d4d9d91566
Add optoutServerComponentsBundle option (#40770)
Follow-up for #40739 to add an option to opt-out specific packages from being bundled.

## 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-09-24 18:47:42 +00:00
Tim Neutkens
50ab2e48f7
Use startTransition for hydrateRoot to opt-in to non-blocking hydration (#40874)
As per @sebmarkbage's recommendation.



## 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-09-24 18:10:40 +00:00
Shu Ding
bf0827d0ce
Flight client navigation error (#40861)
When navigating from app to pages, we do a flight render on the server
to generate the redirected path. However due to our new bundling
strategy we can't use the bundled `ComponentMod.renderToReadableStream`
because the component is now a regular component, not a RSC. In that
case we have to import the unbundled flight server.

## 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-09-23 17:51:12 -07:00
JJ Kasper
01ecb60264
Update app-router options type (#40862)
x-ref: [slack
thread](https://vercel.slack.com/archives/C043ANYDB24/p1663973909118009?thread_ts=1663973783.142799&cid=C043ANYDB24)
2022-09-23 16:32:41 -07:00
Donny/강동윤
b68f78384e
chore: Update swc (#40832)
This PR update swc crates to
8a5ed1e0ba


Noticeable changes include

 - TS 4.9 support.
 - Huge performance improvement (of every api).
2022-09-23 14:09:41 -07:00
Henrik Wenz
cc7fd2c247
chore: refactor with-web-worker example (#40844)
## Changes

- Updated dependencies
- Migrated to typescript
- Removed `div` in favour of Fragment
- Replaces `var` with `let` since we don't need global hoisting here

## 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-09-23 14:08:30 -07:00
Miguel Afonso
6a11e22e2d
Update .env.local.example (#40839)
We use the variable "SANITY_REVALIDATE_SECRET" on the index page, but
the .env.local.example does not have this variable.

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

## 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-09-23 14:02:24 -07:00
CJ Dunteman
b3b8836e17
[docs] Update Cypress config file name (#40849)
The latest version of Cypress no longer supports `cypress.json`, use `cypress.config.js` instead. See details in the Cypress [docs](https://docs.cypress.io/guides/references/configuration).
2022-09-23 20:46:12 +00:00
Hannes Bornö
719116ac81
Allow export const in font loader (#40836)
Allow `export const font = Font()` syntax

## 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-09-23 20:40:59 +00:00
Kiko Beats
2e02204dc9
build: upgrade edge-runtime (#40788)
**TODO**

- [x] Ensure [body-stream](https://github.com/kikobeats/next.js/blob/edge-runtime/packages/next/server/body-streams.ts) is up-to-date with https://github.com/vercel/edge-runtime/blob/main/packages/runtime/src/server/body-streams.ts

Changelog: https://github.com/vercel/edge-runtime/releases/tag/edge-runtime%401.1.0-beta.33
2022-09-23 12:01:36 +00:00
Tim Neutkens
976ccce59b
Handle redirect in same way as 404 in new router (#40796) 2022-09-23 13:34:47 +02:00
JJ Kasper
5d9f390fe4
v12.3.2-canary.7 2022-09-22 19:50:38 -07:00
JJ Kasper
ce77607e50
Update error handling during app static generation (#40823)
This updates to ensure we properly error during static generation when a
non-dynamic SSR error is thrown so that unexpected errors are not
tolerated. This also fixes the static generation async storage not being
shared correctly due to different instances being created during
bundling.
2022-09-22 19:44:30 -07:00
abdennor
1bbd264216
Add additional fix in hydration error document (#40675)
I had the same issue, so the fix that worked for me was pulled from this
thread https://stackoverflow.com/a/71870995

I have been experiencing the same problem lately with NextJS and i am
not sure if my observations are applicable to other libraries. I had
been wrapping my components with an improper tag that is, NextJS is not
comfortable having a p tag wrapping your divs, sections etc so it will
yell "Hydration failed because the initial UI does not match what was
rendered on the server". So I solved this problem by examining how my
elements were wrapping each other. With material UI you would need to be
cautious for example if you use a Typography component as a wrapper, the
default value of the component prop is "p" so you will experience the
error if you don't change the component value to something semantic. So
in my own opinion based on my personal experience the problem is caused
by improper arrangement of html elements and to solve the problem in the
context of NextJS one will have to reevaluate how they are arranging
their html element

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

- [x] 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 <jj@jjsweb.site>
2022-09-22 18:14:18 -07:00
David Hay
bebf3725a8
fix/window.gtag is not defined for Next.js-hydration event(#40410) (#40645)
Next.js-hydration now triggered after gtag is initialized. Fixed by adding _document.js and appropriate script elements.
---
## Documentation / Examples

- [X] Related issues linked using fixes #40410
- [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)

Next.js-hydration now triggered after gtag is initialized.
2022-09-23 01:13:16 +00:00
JJ Kasper
f19241bf33
Update publish to skip private package (#40822)
Follow-up to https://github.com/vercel/next.js/pull/40815 ensures we
skip attempting to publish private packages like `next-swc`

x-ref:
https://github.com/vercel/next.js/actions/runs/3109438515/jobs/5039954716
2022-09-22 17:49:44 -07:00
JJ Kasper
8e1256d024
v12.3.2-canary.6 2022-09-22 16:33:46 -07:00
JJ Kasper
0e3233de53
Disable flakey dev app test temporarily (#40816)
x-ref: [slack
thread](https://vercel.slack.com/archives/C035J346QQL/p1663822388387959)
x-ref:
https://github.com/vercel/next.js/actions/runs/3108897192/jobs/5038639320
x-ref:
https://github.com/vercel/next.js/actions/runs/3107019059/jobs/5034678245
x-ref:
https://github.com/vercel/next.js/actions/runs/3104956805/jobs/5030065922
2022-09-22 16:26:31 -07:00
JJ Kasper
2cbbd61b4a
Update publish script to skip lerna (#40815)
This updates our `publish-release` script to bypass lerna so that we can
retry publishing automatically when there is an npm error and tolerate
non-fatal publish errors like already existing published versions.
Currently this will only allow publishing a canary release to ensure it
is working as expected and in a follow-up we can enable the stable
publish handling.

Separately we can investigate moving canaries away from `npm` to reduce
the number of versions being created there.

x-ref: https://github.com/vercel/next.js/pull/40812
x-ref:
https://github.com/vercel/next.js/actions/runs/3108735543/jobs/5038717354#step:10:2332
x-ref:
https://github.com/vercel/next.js/actions/runs/3108335849/jobs/5038069555
2022-09-22 16:22:17 -07:00
JJ Kasper
50b98d5081
Tolerate already published error for retrying (#40812)
This updates our `publish-native` script to tolerate the already
published npm error so that we can retry publishing on an `npm` [service
error like noticed
here](https://github.com/vercel/next.js/actions/runs/3108335849/jobs/5037966318#step:10:2076).
We probably want to migrate away from using `lerna` for publishing the
non-swc packages as well so that we can retry there as well but will
investigate that in a follow-up.

x-ref:
https://github.com/vercel/next.js/actions/runs/3108335849/jobs/5038069555
2022-09-22 14:35:09 -07:00
JJ Kasper
66ca4c21eb
v12.3.2-canary.5 2022-09-22 14:04:50 -07:00
Maurício Mutte
cbe0407b8b
Update static-html-export.md (#40808)
This fixes anchor link in `static-html-export.md`

## 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-09-22 20:37:41 +00:00
JJ Kasper
24f2c53025
v12.3.2-canary.4 2022-09-22 12:53:58 -07:00
Hannes Bornö
75bbf00a8f
Add local font loader (#40801)
Moves font related types to `next/font` so they can be reused in font
loaders.

Adds an argument to font loaders, the relative path from the app root to
the module consuming the loader. Needed for resolving local files
relative to the module calling it. Also used to improve error message.

Adds `@next/font/local` font loader. Similar to `@next/font/google` but
used to host locally downloaded font files.
2022-09-22 12:49:02 -07:00
JJ Kasper
77c8a2c4dd
Add missing release stats config for app (#40805)
Follow-up to https://github.com/vercel/next.js/pull/40780 adds the extra
config that is still needed for release stats.

x-ref:
https://github.com/vercel/next.js/actions/runs/3103134847/jobs/5026594626
2022-09-22 09:37:00 -07:00
Steven
be904d79ac
Open deploy link in new window for examples (#40804)
Let's open the deploy link in a new window so the link isn't blocked
when running an an iframe, such as Stackblitz.

Previously, this would print the following error:

> Refused to display 'https://vercel.com/' in a frame because it set
'X-Frame-Options' to 'deny'
2022-09-22 09:33:36 -07:00
Hannes Bornö
48292ba7b7
Fix required server files for font loader manifest (#40784)
The manifest currently gets added without file extensions.
2022-09-22 09:10:36 -07:00
Philipp Bosch
f16992a156
docs: Remove extraneous FallbackComponent prop from error boundary docs (#40785)
It looks like the code snippet was copied over from
https://github.com/bvaughn/react-error-boundary but the `ErrorBoundary`
component on this docs page does not have a `FallbackComponent` prop but
renders the error message content itself.


## 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-09-22 09:04:44 -07:00
Hannes Bornö
f662f18159
Fix flaky full reload hmr tests (#40786)
The issue seems to be that ` await check(() =>
browser.elementByCss('p').text(), 'hello world!!!')` sometimes tries to
get `.text()` from the DOM before the full reload and it times out.

## 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-09-22 08:56:42 -07:00
Shu Ding
06682d27bb
Fix alias paths for bundling (#40800)
In the server layer, we used to alias `react` to the resolved path e.g. `/next.js/node_modules/.pnpm/react@0.0.0-experimental-e6a062bd2-20220913/node_modules/react`, but it turns out that webpack's enhanced resolver can't handle it correctly together with conditions, and the final resolved path is `/next.js/node_modules/.pnpm/react@0.0.0-experimental-e6a062bd2-20220913/node_modules/react/index.js`. If we change the alias to `react: 'react-exp'` then it correctly resolves to `/next.js/node_modules/.pnpm/react@0.0.0-experimental-e6a062bd2-20220913/node_modules/react/react.shared-subset.js`.

## 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-09-22 14:39:19 +00:00
Tim Neutkens
c4647bb630
Add handling for 404 in new router (#40787) 2022-09-22 13:08:45 +02:00
JJ Kasper
cc1e35d821
v12.3.2-canary.3 2022-09-21 22:51:10 -07:00
JJ Kasper
f51e49f8d5
Update stats config for release stats (#40780)
This keeps the necessary config for release stats for app dir 

x-ref: https://github.com/vercel/next.js/pull/40776
Fixes:
https://github.com/vercel/next.js/actions/runs/3102008544/jobs/5025346767
2022-09-21 22:50:08 -07:00
Tomer Aberbach
4970d7a0e8
Set __NEXT_NEW_LINK_BEHAVIOR in Jest tests when newNextLinkBehavior is true (#40702)
Fixes #40463

Could use some help figuring out where to add a test! I looked around
and found
[`jest-next-swc.test.ts`](https://github.com/vercel/next.js/blob/canary/test/unit/jest-next-swc.test.ts),
but I don't think I can use that to test this fix. Anyways, from my
local testing this PR seems to fix the issue.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-09-21 22:36:59 -07:00
Hannes Bornö
bf8ee1edb4
Add support for font loaders (#40746)
For some context:
[https://vercel.slack.com/archives/CGU8HUTUH/p1662124179102509](https://vercel.slack.com/archives/CGU8HUTUH/p1662124179102509)

Continuation of #40221 and #40227

Adds `experimental.fontLoaders`.

SWC next-font-loaders (#40221) transforms font loader (e.g. #40227) call
expressions into an import with the function call arguments as a query.

The imports will be matched by `next-font-loader`. It runs the
configured font loaders - emits font files and returns CSS. Exports are
added, and the font-family is made locally scoped. The returned CSS is
turned into a CSS module with `css-loader` which lets you consume the
font-family.

`FontLoaderManifestPlugin` creates a manifest of the preloaded font
files for each entrypoint. Preload/preconnect are then added in
`_document.tsx` if any font files were found for that path.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-09-21 22:12:59 -07:00
Anthony Shew
ef9ba4509a
Fix: Contentful webhook body parse. (#40732)
## 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-09-22 01:13:54 +00:00
JJ Kasper
c2487ce262
v12.3.2-canary.2 2022-09-21 17:21:58 -07:00
Jiachi Liu
cbfab2a3b7
Strip internal pages for pagesDir in app edge ssr (#40776)
For app edge SSR, we don't need any internal pages for it since it's
handled by app-renderer. This results around reducing 20KB from app edge
SSR

# Changes
* Strip those internal pages modules when it's in app edge SSR
* Minimize edge SSR chunk to see the tree-shake result
* Add bundle analyzer with switcher in stats-app for testing. Using
`TEST_ANAYLYSE=1` to build stats-app for testing
2022-09-21 17:18:18 -07:00
Henrik Wenz
69595adc32
chore: refactor using-router example (#40774)
## Changes

- Updated dependencies
- Migrated to Typescript
- Added additional router use cases

## 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-09-21 23:37:57 +00:00