Commit graph

1289 commits

Author SHA1 Message Date
Jan Kaifer
53f29cd633
Add OTEL tests (#47149) 2023-03-16 16:35:07 +00:00
Balázs Orbán
8c98a207f2
feat(cli): introduce --tailwind flag (#46927)
### What?

This PR introduces a new `--tailwind` flag to the `create-next-app` CLI,
to make it easier to bootstrap a Next.js app with Tailwind CSS
pre-configured. This is going to be the **default**. To opt-out of
Tailwind CSS, you can use the `--no-tailwind` flag.

### Why?

Tailwind CSS is one of the most popular styling solutions right now, and
we would like to make it easier to get started.

Currently, the closest you can come to this is by running `pnpm create
next-app -e with-tailwindcss` which will clone the
https://github.com/vercel/next.js/tree/canary/examples/with-tailwindcss
example. But that example is not configured for the App Router. This PR
will let you add Tailwind CSS to both `app/`, `pages/`, and start out
with TypeScript or JavaScript via the CLI prompts.

(Some community feedback
https://twitter.com/dev_jonaskaas/status/1632367991827443713,
https://twitter.com/samselikoff/status/1634662473331617794)

### How?

We are adding 4 new templates to the CLI bundle.

> Note: The styling is not pixel-perfect compared to the current
templates (using CSS modules) to require fewer overrides, but I tried to
match it as close as possible. Here are a few screenshots:

<details>
<summary><b>Current, light</b></summary>
<img
src="https://user-images.githubusercontent.com/18369201/224733372-9dba86fe-9191-471d-ad9f-ab904c47f544.png"/>
</details>

<details>
<summary><b>Tailwind (new), light</b></summary>
<img
src="https://user-images.githubusercontent.com/18369201/224733610-038d9d0f-634d-4b69-b5c2-a5056b56760c.png"/>
</details>

<details>
<summary><b>Current, dark, responsive</b></summary>
<img
src="https://user-images.githubusercontent.com/18369201/224733790-9b4d730c-0336-4dbe-bc10-1cae1d7fd145.png"/>
</details>

<details>
<summary><b>Tailwind (new), dark, responsive</b></summary>
<img
src="https://user-images.githubusercontent.com/18369201/224734375-28384bbc-2c3a-4125-8f29-c102f3b7aa1d.png"/>
</details>

#### For reviewers

This introduces 4 new templates, with a very similar code base to the
original ones. To keep the PR focused, I decided to copy over duplicate
code, but we could potentially create a shared folder for files that are
the same across templates to somewhat reduce the CLI size. Not sure if
it's worth it, let me know. Probably fine for now, but something to
consider if we are adding more permutations in the future.

---

~Work remaining:~

- [x] app+ts
	- [x] layout
	- [x] dark mode
	- [x] media queries
	- [x] animations
- [x] app+js
- [x] pages+ts
- [x] pages+js
- [x] prompt/config
- [x] deprecate Tailwind CSS example in favor of CLI
- [x] update docs
- [x] add test
- [x] add [Prettier
plugin](https://github.com/tailwindlabs/prettier-plugin-tailwindcss)
 
Closes NEXT-772
Related #45814, #44286
2023-03-16 16:06:27 +01:00
Jiachi Liu
1e7f4a58fe
Update vendored react (#46970)
Update to latest next channel of react

mainly for https://github.com/facebook/react/pull/26353

```
-  3706edb81 [Float][Fizz]: Don't preload nomodule scripts (#26353) (Josh Story)
-  2b003a5cc Split out ServerReferenceMetadata into Id and Bound Arguments (#26351) (Sebastian Markbåge)
-  62cd5af08 Codemod redundant async act scopes (#26350) (Andrew Clark)
-  037378202 Internal `act`: Call scope function after an async gap (#26347) (Andrew Clark)
-  d8e49f2af Use setTimeout to schedule work on the server in Edge environments (#26348) (Sebastian Markbåge)
-  83643778b Internal test helpers: Use Node's MessageChannel to queue task (#26345) (Andrew Clark)
-  f36ab0e37 Remove timers from ReactDOMSuspensePlaceholder tests (#26346) (Andrew Clark)
-  44d380794 Move internalAct to internal-test-utils package (#26344) (Andrew Clark)
-  8c100620c Build: specify Node.js 16 as minimum for dev (#26343) (Jan Kassens)
-  d81447304 [Internal API only] Delete non-awaited form of act (#26339) (Andrew Clark)
-  702fc984e Codemod act -> await act (4/?) (#26338) (Andrew Clark)
-  9fb2469a6 Restore definition of NativeMethods as an object for React Native (#26341) (Rubén Norte)
-  aef930314 [DevTools] upgrade electron to latest version & security improvements (#26337) (Mengdi Chen)
-  161f6ae42 Codemod act -> await act (3/?) (#26336) (Andrew Clark)
-  58605f798 Codemod act -> await act (2/?) (#26335) (Andrew Clark)
```
2023-03-09 11:44:33 -08:00
Jiachi Liu
292f65f6d3
Fix unexpected hoist meta tags by react in app dir (#46917)
### Bug Fix

Update vendor react to fix the unexpected hoist tags issue

x-ref: https://github.com/facebook/react/pull/26256

* Fixes #42648
* Closes NEXT-655
* tests added
2023-03-08 11:34:51 +00:00
Shu Ding
7e933a094c
Revert "Revert "Update vendored React"" (#46881)
Reverts vercel/next.js#46861. This requires
https://github.com/vercel/turbo/pull/4102 to be released and bindings to
be updated first.

~Also depends on #46896 to be merged first, and conflicts to be
resolved.~
2023-03-07 13:04:08 -08:00
Sukka
26768571ad
test(unit): add cases for cssnano simple (#46862)
Continues from #46380. The PR migrates the unit test cases from the original repo into the Next.js repo.
2023-03-07 06:28:53 +00:00
JJ Kasper
0f621cb133
Revert "Update vendored React" (#46861)
Reverting temporarily as this breaks turbopack support for app dir 

x-ref:
https://github.com/vercel/next.js/actions/runs/4349458918/jobs/7600147372
x-ref:
https://github.com/vercel/next.js/actions/runs/4349607013/jobs/7600148420

Reverts vercel/next.js#46826
2023-03-06 21:17:15 -08:00
Shu Ding
003b3af700
Update vendored React (#46826)
This PR updates vendored React to the latest `@next` version, as well as
corresponding changes to the manifest and module reference generation
code.

The new React version includes the following upstream changes:

- 49f741046 Fix: Infinite act loop caused by wrong shouldYield (#26317)
(Andrew Clark)
-  106ea1c58 Support Iterables in Flight (#26313) (Sebastian Markbåge)
- f905da227 [Flight] Send server reference error chunks to the client
(#26293) (Hendrik Liebau)
- e0241b660 Simplify Webpack References by encoding file path + export
name as single id (#26300) (Sebastian Markbåge)
- 25685d8a9 Codemod tests to waitFor pattern (9/?) (#26309) (Andrew
Clark)
- 64dde7082 Codemod tests to waitFor pattern (8/?) (#26308) (Andrew
Clark)
- 3cb5afb82 Codemod tests to waitFor pattern (7/?) (#26307) (Andrew
Clark)
- e98695db9 Codemod tests to waitFor pattern (6/?) (#26305) (Andrew
Clark)
- 9a52cc8bc Convert ReactLazy-test to waitFor pattern (#26304) (Andrew
Clark)
- 03462cfc7 [Fizz] External runtime: fix bug in processing existing
elements (#26303) (mofeiZ)
- faacefb4d Codemod tests to waitFor pattern (4/?) (#26302) (Andrew
Clark)
- 06460b6fb Remove unnecessary (and incorrect) code for compatibility
with Paper in the Fabric version of GlobalResponderHandler (#26290)
(Rubén Norte)
- e64a8f403 Codemod tests to waitFor pattern (3/?) (#26299) (Andrew
Clark)
- ce8a72fd4 Codemod tests to waitFor pattern (2/?) (#26296) (Andrew
Clark)
- 1f1f8eb55 [Float][Fizz][Fiber]: Refactor <style> Resource
implementation to group on flush (#26280) (Josh Story)
- 5c633a48f Add back accidentally deleted test comments (#26294) (Andrew
Clark)
- b073104c2 [DevTools] improve troubleshooting in README (#26235)
(Mengdi Chen)
- fcf218791 [DevTools] Remove renderer.js from extension build (#26234)
(Mengdi Chen)
- b72ed698f Fixed incorrect value returned as public instance from
reconciler (#26283) (Rubén Norte)
- 25a8b9735 Codemod tests to waitFor pattern (1/?) (#26288) (Andrew
Clark)
- e52446733 New internal testing helpers: waitFor, waitForAll,
waitForPaint (#26285) (Andrew Clark)
- d49e0e0be Removed unused imperative events implementation from React
Native renderer (#26282) (Rubén Norte)

---------
2023-03-06 16:51:10 -08:00
JJ Kasper
ed6cd410d7
Ensure test-unit includes package unit tests (#46707)
Seems the unit tests from our packages haven't been running as a few haven't been updated and had failing assertions.
2023-03-02 23:09:48 +00:00
Andrew Clark
2e23cd7535
Add script to automate updating vendored React version (#46663)
Since we intend to update our vendored copy of React frequently, I wrote
a script to automate the steps.

Basic usage (defaults to most recent React canary version):

```sh
pnpm run sync-react
```

Specify a canary version:

```sh
pnpm run sync-react --version 18.3.0-next-41110021f-20230301
```

Update package.json but skip installing the dependencies automatically:

```sh
pnpm run sync-react --no-install
```

At the end it will print out a changelog so you can copy/paste it into
the PR description.

<!--
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-02 02:15:02 +00:00
Andrew Clark
5c18e9ac92
Update vendored React packages to next-41110021f (#46636)
Notable changes:

- https://github.com/facebook/react/pull/26275
- https://github.com/facebook/react/pull/26232
- https://github.com/facebook/react/pull/26239
- https://github.com/facebook/react/pull/26237

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

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-03-01 20:15:50 +01:00
Shu Ding
877f2f5996
Upgrade precompiled react packages (#46365)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-02-28 10:13:02 +01:00
Jiachi Liu
5a304817cb
Update app-dir react bundle to leverage edge build (#46208)
Leverage edge build of react-server-dom-webpack on server and keep
browser build of it for client build

Closes NEXT-606

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-02-23 00:24:26 +01:00
Balázs Orbán
be5a9f53a8
chore(deps): use external @edge-runtime/cookies (#42736)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-02-17 15:10:09 +01:00
Tim Neutkens
1faa599568
Add additional tests for @next/mdx (#45585)Co-authored-by: Shu Ding <g@shud.in>
Adds additional integration tests for `@next/mdx`.

- Test mdx-rs
- Test `mdx-components.tsx`
- Tests development and production. Previously it only checked
development.

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

---------

Co-authored-by: Shu Ding <g@shud.in>
2023-02-11 13:37:00 +01:00
SCG82
4a472abc89
chore: simplify package scripts (#45226)
<!--
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`](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

- [x] 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 <jj@jjsweb.site>
2023-02-07 15:30:02 -08:00
Jiachi Liu
c6fe3f3224
Update app dir react for client reference updates (#45490)
x-ref: https://github.com/facebook/react/pull/26059
x-ref: https://github.com/facebook/react/pull/26083
x-ref: https://github.com/facebook/react/pull/26093
x-ref: https://github.com/facebook/react/pull/26083
Closes NEXT-445

* Remove extra `await`
* Check if a component result is client reference, then we access for
other exports
2023-02-07 19:32:49 +01:00
Wyatt Johnson
57ba24e39a
Improved pnpm clean (#45312)
When incompatibilities with upgrades to `swc` occur between releases,
these changes expand the existing `pnpm clean` script to additionally
run any `clean` script under any of the lerna packages. In this case, a
new script was created under `packages/next-swc` that removes
`packages/next-swc/native/*`, allowing the default to automatically use
the WASM build.

Users wanting to reset their repository can now run:

```sh
pnpm clean
```

Future packages or outputs that are built should have their `clean`
script remove them to allow for easy repository resetting.
2023-01-26 13:24:19 -08:00
JJ Kasper
8f05c0c07e
Update flakey test cases (#45290) 2023-01-25 22:55:49 -08:00
Jan Kaifer
d7307cffb7
Fix turbo usage in tests (#44715) 2023-01-18 20:35:28 +01:00
JJ Kasper
8613297cd4
Fix prepublish compiled handling (#44914) 2023-01-15 20:21:39 -08:00
JJ Kasper
d4a3c66479
Update pre-compiled (#44874) 2023-01-13 17:52:35 -08:00
Valentin Politov
9168dffc02
examples: Bump SWR to v2.0.0 (#44790) 2023-01-12 09:36:29 -08:00
JJ Kasper
12bfabd179
Update to latest version of pnpm (#44791) 2023-01-11 17:36:52 -08:00
Steven
862deb5a13
Disable telemetry for pnpm next when contributing locally (#44610)
This PR fixes telemetry so it no longer reports `pnpm next` when
contributing to Next.js
2023-01-05 13:27:05 -08:00
Jan Kaifer
cafbe2a0ad
Revert "Use turbo for packing files in test setup (#44074)" (#44566)
This reverts commit fd9ec646ac.

It seems that there is an issue with caching of inputs which uses stale
files.

We also had to disable caching of `pnpm-lock.yaml` because it requires
stable package locations chich we removed.
2023-01-04 10:23:21 -08:00
JJ Kasper
87c3578cc4
Update json5 dependency to latest (#44548)
Updates to latest version of the dependency.
2023-01-03 15:45:05 -08:00
Jan Kaifer
d6a09be303
add testonly variants for all test modes and refactored test as alias of testheadless (#44528)
So that we don't need to use `NEXT_TEST_MODE=...` ever again manually.
2023-01-03 14:43:55 -08:00
Jan Kaifer
fd9ec646ac
Use turbo for packing files in test setup (#44074) 2022-12-22 16:36:24 +01:00
Jiachi Liu
e27a7bd7a4
Update styled-jsx (#44070)
x-ref: https://github.com/vercel/styled-jsx/releases/tag/v5.1.1
2022-12-19 23:58:50 +00:00
Tim Neutkens
e45bbbe734
Add jsdoc/no-types eslint rule for TypeScript files (#44049)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-12-19 10:21:08 +01:00
Jiachi Liu
6aae39c759
Fix app client entry key for windows (#44011)
## Bug

The app client entry key was in win32 slashes like `app\blog`, and when
we add the new layer checking logic in #43197, `name.startsWith('app/')`
doesn't work.

Fixes #43854
Fixes #43902

<img width="862" alt="image"
src="https://user-images.githubusercontent.com/4800338/207641886-08ffc159-0516-4609-9a1f-8c8693586122.png">


- [x] 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)
2022-12-14 19:52:52 +01:00
Jiachi Liu
a97e6fff31
Upgrade playwright to 1.28.1 (#43818)
Upgrade playwright to see if the playwright installation job will be
back to normal

x-ref:
https://github.com/vercel/next.js/actions/runs/3639757976/jobs/6143653702
2022-12-07 14:14:55 -08:00
JJ Kasper
a704b71cba
Lock pnpm version during publish (#43820)
x-ref: [slack thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1670409758653869)
2022-12-07 17:24:43 +00:00
Jan Kaifer
aa7cdf35ea
Remove notifications emitted during pnpm dev (#43801)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-12-07 17:11:29 +01:00
JJ Kasper
90f022aeb6
Update test config (#43661)
Updates our test config to take advantage of more concurrency and also
updates to leverage the playwright docker image to reduce flakes from
actions/setup-node stalling or playwright dependencies stalling on `apt
install`.

This reduces our test times from upwards of 30 minutes down to back
around 15 minutes.
2022-12-03 19:49:00 -08:00
Jiachi Liu
48290c6a05
Update react next tag (#43617)
Fixes #43033

Also remove the unsued react-dom files: bundles for bun, and
react-dom-test-utils

x-ref: https://github.com/facebook/react/pull/25713

## Bug

- [x] 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)
2022-12-01 20:15:54 -08:00
Jiachi Liu
e901feffc3
Update precompiled react (#43288)
Update pre-compiled react to fix the streaming issue with node 18.
x-ref: https://github.com/facebook/react/pull/25645

Fixes: #42466
Manually tested locally works for the reproduction from the issue

## Bug

- [x] 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)
2022-11-23 15:57:38 +00:00
Donny/강동윤
3d62f467cf
chore: Update swc_core to v0.43.23 (#42977)
This PR updates swc crates to
a4ed624f81

---

 - Closes https://github.com/vercel/next.js/issues/42978
 - Closes https://github.com/vercel/next.js/issues/42801

<img width="1840" alt="image"
src="https://user-images.githubusercontent.com/29931815/202788043-4ba0c3a4-b4c5-43e7-8eb3-42b8341e5d5f.png">

 - Closes https://github.com/vercel/next.js/issues/43027
<img width="1840" alt="image"
src="https://user-images.githubusercontent.com/29931815/202788522-e4884f91-c83c-45e8-983a-f210144effef.png">

 - Closes https://github.com/vercel/next.js/issues/43042
<img width="1840" alt="image"
src="https://user-images.githubusercontent.com/29931815/202788866-2c319588-5a01-4628-95cc-47bb51e19153.png">

 - Closes https://github.com/vercel/next.js/issues/43060

<img width="1840" alt="image"
src="https://user-images.githubusercontent.com/29931815/202789993-2bf3af55-9752-4aa8-bcc2-98f08ecd47b7.png">


 - Closes https://github.com/vercel/next.js/issues/42852

<img width="1840" alt="image"
src="https://user-images.githubusercontent.com/29931815/202804509-88bb3d55-182d-457d-b59e-d12b30c52100.png">
2022-11-19 18:18:31 -08:00
JJ Kasper
c3993c828f
Update to latest version of turbo CLI (#42803)
Continuation of https://github.com/vercel/next.js/pull/42711 fixing
latest turbo usage in musl environment

## 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 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)
2022-11-14 11:52:12 -08:00
Jiachi Liu
b180becad5
Update bundle analyzer dependency and output (#42797)
* Update `webpack-bundle-analyzer` to 4.7.0
* Change the output file paths of bundle analyzing results to
`./next/analyze/<nodejs|edge|client>.html`
2022-11-11 16:39:45 -08:00
Shu Ding
f612acffbc
Add test case for image generation (#42693)
This PR adds a basic test case to ensure Next.js and Edge Runtime
changes don't break the image generation feature, as well as record the
usage.

## 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
- [x] 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 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)
2022-11-10 09:26:36 -08:00
JJ Kasper
abaaf80f51
Revert "Update to latest version of turbo CLI (#42711)"
This reverts commit 2c199c4c19.
2022-11-09 21:15:36 -08:00
JJ Kasper
2c199c4c19
Update to latest version of turbo CLI (#42711)
Ensures we have latest patches in turbo CLI. 

## 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 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)
2022-11-09 18:22:15 -08:00
Josh Story
677c04f088
update react builtin deps for next channel (#42639)
Updates builtin react to latest release on next channel

## 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 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)
2022-11-08 10:35:17 -08:00
OJ Kwon
5654cae2d7
feat(next/mdx): support experimental mdx-rs loader (#41919)
<!--
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:
-->

This PR implements a configuration option in `next.config.js` to support
for rust-based MDX compiler (https://github.com/wooorm/mdxjs-rs).
Currently it is marked as experimental, as mdx-rs and loader both may
need some iteration to fix regressions.

When a new experimental flag is set (`mdxRs: true`), instead of using
`@mdx/js` loader `next/mdx` loads a new webpack loader instead.
Internally, it mostly mimics mdx/js's loader behavior, however actual
compilation will be delegated into next/swc's binding to call mdx-rs's
compiler instead.

I choose to use next-swc to expose its binding function, as mdx-rs
internally uses swc already and creating new binary can double up
bytesize (with all the complex processes of publishing new 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-11-02 18:24:05 -07:00
Jiachi Liu
6dbf9c32ec
Handle dynamic css-in-js styles under suspense (#42293)
We insert the content returning from `useServerInsertedHTML` to head
element for app dir, but it shouldn't only inject once since there're
suspense boundaries that could hold insertions.

## Bug

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

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-11-02 14:18:08 +01:00
Kiko Beats
137008e613
[middleware] add tests for body reading methods #37980 (#41718) 2022-11-01 20:45:58 -07:00
Jiachi Liu
70e7e58c37
Update react next channel (#42021)
Update react channel for `fetch` patching updates 

x-ref: [slack
thread](https://vercel.slack.com/archives/C03ENM5HB4K/p1666802006931969?thread_ts=1666799939.726859&cid=C03ENM5HB4K)
2022-10-27 17:33:47 -07:00
Kiko Beats
288144c7e5
Upgrade Edge Runtime (#41987)
dropped node12 support

Co-authored-by: Steven <steven@ceriously.com>
2022-10-27 15:07:05 -04:00
Steven
a5d674237a
Bump minimum Node.js version to 14.6.0 (#41765)
We found a case where 14.0.0 breaking with private class methods, such
as:

```js
class C {
  #x() { return 42; }
  x() {
    return this.#x();
  }
}
```

This feature was introduced in Node.js 14.6.0, so we can bump the
minimum version.

See https://node.green
2022-10-24 21:47:54 -07:00
Jiachi Liu
78bf0a792b
Update react next channel (#41761)
apply react updates x-ref: https://github.com/facebook/react/pull/25560
2022-10-25 02:32:20 +00:00
Kiko Beats
89355298f2
Upgrade Edge Runtime v.1.1.0 (#41727)
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-10-24 10:49:49 -07:00
Jiachi Liu
20f5db06fa
Update precompiled react to next channel (#41708)
Precompile `react@next` and to unlock `cache` and `use` API
2022-10-24 00:31:52 -07:00
JJ Kasper
b6ed1a7e5f
Update to latest react experimental (#41671)
x-ref: [slack
thread](https://vercel.slack.com/archives/C035J346QQL/p1666452328526929)
2022-10-23 13:10:44 -07:00
Jiachi Liu
b0f87fbc7c
Bundle ssr client layer excepts react externals (#41606)
Bundle the ssr client layer for RSC, this solves the problem when
there's an esm package is using on client components, but esm imports
the installed react instead of the built-in react version since esm
imports is not intercepted by require hook.

After bundling the ssr client layer and treating react as externals, now
react compiles as cjs externals and could be intercepted by require
hook, other code are bundled together which can also get optimized.

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

Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-22 16:33:51 -07:00
Javi Velasco
392c4d0b7c
Update @types/node to 14.14.31 (#41634)
This PR updates `@types/node` to `14.14.31`. The most important type is
that `ParsedUrlQuery` can hold `undefined` so we are updating the code
here to explicitly handle those cases. Aside from it we are adding a
global definition taken from NodeJS for `AsyncLocalStorage` that we
export in `server.d.ts`
2022-10-22 11:19:14 -07:00
Jiachi Liu
3a87e816fc
Disable using prebundled of react for appDir (#41635)
reverting https://github.com/vercel/next.js/pull/41337

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-21 23:55:19 -07:00
Tim Neutkens
14c9376899
BREAKING CHANGE: Remove React 17 (#41629)
Next.js 13 will require React 18.

In this PR I've only updated the peerDependency and removed the test runs in GH actions. Further cleanup will follow later, this allows us to remove the code supporting it 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: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2022-10-21 22:20:36 +00:00
Jiachi Liu
bc335d7ef7
Prebundle react for appDir (#41337)
Inline a react and react-dom for app dir, when `appDir` flag is enabled
opt into the built-in version for all.

For server layer react, use the react share subset for server
components.
For all server side of react-dom usage, use the server-rendering-stub.

Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-18 16:32:23 -07:00
Kiko Beats
ebae05eeed
Update edge runtime to 1.1.0-beta.40 (#41513)
changes: https://github.com/vercel/edge-runtime/compare/edge-runtime@1.1.0-beta.39...edge-runtime@1.1.0-beta.40
2022-10-18 13:57:11 +00:00
Kiko Beats
8c4ef5cbc7
Update edge runtime to 1.1.0-beta.39 (#41418)
https://github.com/vercel/edge-runtime/compare/edge-runtime%401.1.0-beta.37...edge-runtime%401.1.0-beta.39
2022-10-14 09:48:32 -07:00
Tim Neutkens
8f49ffc488
Upgrade React experimental (#41419) 2022-10-14 16:25:49 +02:00
Shu Ding
24b600303f
Do not bundle react-dom in the SSR build (#41227)
Currently `react-dom` isn't handled as an external dependency in SSR,
unlike `react`. This means that the ReactDOM imported by client
components isn't the same instance as the ReactDOM that does SSR.

This PR also upgrades React experimental to the latest version.

## 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-06 20:27:24 +02:00
Shu Ding
c6dc62ef04
Upgrade React experimental (#41222)
<!--
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-10-06 18:06:14 +02:00
Meno Abels
374ab4bf66
Update edge runtime to 1.1.0-beta.37 (#41211)
update of the edge-runtime to 1.1.0-beta.37.



Co-authored-by: Kiko Beats <2096101+Kikobeats@users.noreply.github.com>
2022-10-06 11:45:16 +00:00
JJ Kasper
51552c1a02
Update minimum required Node.js version to v14 (#41150)
As discussed this updates our required minimum Node.js version to `v14` as `v12` is no longer being maintained. Since our targets for babel and swc already target the actively used Node.js version no change has been made there.
2022-10-04 08:59:35 +00:00
Jiachi Liu
3e8af93220
Align pnpm version (#41123)
Align pnpm version in build pipelines with 7.3.0 to make sure lock files
are generated correctly
2022-10-03 17:07:52 +02:00
Balázs Orbán
a83cfcdc78
chore: make sure polyfills are built for pnpm dev (#41062)
Re-lands #40335 but without modifying the lock file.


## 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-30 14:54:38 +00:00
Tim Neutkens
a78ce92ede Revert "chore: make sure polyfills are built for pnpm dev (#40335)"
This reverts commit 24f573f8be.
2022-09-30 15:16:17 +02:00
Balázs Orbán
24f573f8be
chore: make sure polyfills are built for pnpm dev (#40335)
Utilize `turbo` for `dev`, and make sure polyfills are built. Fixes #40334

Another option would be to document that an initial `pnpm build` is necessary in  [`CONTRIBUTING.md`](https://github.com/vercel/next.js/blob/canary/contributing.md#developing).

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 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.md#adding-examples)
2022-09-30 02:03:47 +00:00
Jaril
06607e3dd1
Add Replay integration for dev e2e tests (#40955)
<!--
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)

@ijjk moving this here.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-09-29 14:45:10 -07: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
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
Hannes Bornö
1264196897
Add next font package (#40227)
For some context:
https://vercel.slack.com/archives/CGU8HUTUH/p1662124179102509

Adds `@next/font` package.

`scripts/update-google-fonts.js` generates functions and metadata for
all available google fonts. The metadata is used in `loader.ts` to
validate font options (from #40221). It then fetches the CSS from google
fonts, downloads the font files and emits them as static assets.

The actual integration with `packages/next` and integration tests
depends on #40221, will follow up with new PR.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-09-21 15:10:24 -07:00
Henrik Wenz
3943b20f55
fix: InferGetServerSidePropsType and InferGetStaticPropsType (#40635)
## Problem

Currently the Next.js infer utility (`InferGetServerSidePropsType` and
`InferGetStaticPropsType`) types can lead to a wrong inferred types
(`never`). This happens if these functions return something different
than: `{props: {}}`.

**Example:** `getServerSideProps`

```typescript
export async function getServerSideProps({ query }: GetServerSidePropsContext) {
  if (query.foo) {
    return {
      notFound: true,
    }
  }

  return {
    props: { 
      foo: "bar"
    },
  }
}

type PageProps = InferGetServerSidePropsType<typeof getServerSideProps>
// => type PageProps = never
```

**Example:** `getStaticProps`

```typescript
import type { InferGetStaticPropsType, GetStaticPropsContext } from 'next'

export async function getStaticProps(context: GetStaticPropsContext) {
  if (context.params?.bar) {
    return {
      notFound: true,
    }
  }

  return {
    props: {
      foo: 'bar',
    },
  }
}

type PageProps = InferGetStaticPropsType<typeof getStaticProps>
// => type PageProps = never
```

This is because the first infer condition of the utility type is not
satified leading to a never result.

```typescript
export type InferGetServerSidePropsType<T> = T extends GetServerSideProps<
  infer P, // <- NOT SATISFIED
  any
>
  ? P
  : T extends (
      context?: GetServerSidePropsContext<any>
    ) => Promise<GetServerSidePropsResult<infer P>>
  ? P
  : never  // <- NOT SATISFIED
```

## Solution

I have experimented with different solutions ending with a much simpler
type, that is faster to execute, easier to read and universally usable
for both prop variations.

```typescript
/**
 * Flow:
 * - Make sure getStaticProps is a function
 * - Get its return type
 * - Extract the one that contains {props: any}
 * - Return the props
 */
export type InferGetStaticPropsType<T extends (args: any) => any> = Extract<
  Awaited<ReturnType<T>>,
  { props: any }
>['props']
```

## Bug

- [x] Related issues: fixes #36615, #15913,
https://twitter.com/leeerob/status/1563540593003106306
- [x] Type tests added

## Future thoughts

Since `InferGetStaticPropsType` and `InferGetServerSidePropsType` are
now the same, it's api could be merged into one utility type (e.g:
InferNextProps). I recommend doing this in a different PR.

## Additional info

I have tested this approach using the following [external
package](https://www.npmjs.com/package/infer-next-props-type)
(@timneutkens sorry for the late PR). Since about 12 Month I haven't
received any negative feedback (issues) regarding this approach.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-09-20 15:25:01 -07:00
Jimmy Lai
9b0c00a5b2
misc: update caniuse-lite to latest (#40680)
Fixes build errors related to
https://github.com/browserslist/caniuse-lite/issues/102

see
https://github.com/vercel/next.js/actions/runs/3082979772/jobs/4983345078


## 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-19 16:48:41 +02:00
Tim Neutkens
6df8770734
Upgrade to latest React experimental (#40672)
Only upgrade react-exp.


## 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-19 13:26:06 +00:00
Balázs Orbán
3ff21ed178
refactor: split up CONTRIBUTING.md (#40515)
Continues #39778

Closes #40499

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 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.md#adding-examples)

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-09-16 14:54:58 -07:00
Tim Neutkens
385e3f0380
Wrap parallel routes tests in describe (#40546)
Small changes:
- Group parallel routes tests
- Upgrade tests to latest react experimental
2022-09-14 09:09:01 +00:00
Tim Neutkens
629c7f584e
Clean up startTransition in Link (#40505)
- Use React.startTransition instead of useTransition
- Upgrade to latest React experimental
- Split router cache invalidate into separate function

Some minor cleanup while verifying behaviors.
2022-09-13 11:47:20 +00:00
Wyatt Johnson
c6ef857d57
Subresource Integrity for App Directory (#39729)
<!--
Thanks for opening a PR! Your contribution is much appreciated.
In order 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:
-->

This serves to add support for [Subresource
Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity)
hashes for scripts added from the new app directory. This also has
support for utilizing nonce values passed from request headers (expected
to be generated per request in middleware) in the bootstrapping scripts
via the `Content-Security-Policy` header as such:

```
Content-Security-Policy: script-src 'nonce-2726c7f26c'
```

Which results in the inline scripts having a new `nonce` attribute hash
added. These features combined support for setting an aggressive Content
Security Policy on scripts loaded.

## Bug

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

Co-authored-by: Steven <steven@ceriously.com>
2022-09-08 15:17:15 -07:00
Jiachi Liu
c8d3fa6a77
Update react-server-dom-webpack (#40356)
Bump `react-server-dom-webpack` for support of `experimental_use` API
2022-09-08 18:10:32 +00:00
Donny/강동윤
6356095481
chore: Update swc (#39965)
This PR updates SWC crates to f2a0eef4f1

---


 - Closes #17056

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-04 12:13:22 +02:00
Jiachi Liu
8668020a54
Upgrade typescript to 4.8.2 (#39979)
Typescript published 4.8.2 today and it fails CI, bump our typescript version to 4.8.2 and tweak some typings to make existing e2e typescript tests work properly

* Bump web-vitals from 3.0.0-beta to 3.0.0 stable for typing fix (there's an undefined type but it wasn't caught by ts 4.7), also force compiled it as CJS for pre-compiled
* Bump ncc to 3.34.0 for ts-loader compatibility for new typescript version, ncc 3.33.x cannot work with ts 4.8
* Update pre-compiled
2022-08-29 16:56:02 +00:00
Jiachi Liu
b4f74ee1c1
Handle async module for client components (#39953)
### Problem

esm modules imports from client components will be compiled to `m = import('module-name')` when webpack bundles them for server components flight rendering. In this case, they will all become async modules since dyanmic imports will return a promise which react flight cannot handle it then results into module resolving error on server flight rendering.

### Solution

* React flight renderer supports handling async modules in https://github.com/facebook/react/pull/25138
* On next.js side leverage the module proxy change for each client reference, to make sure it always resolve the correct client module

The idea is wrapping each module with a module proxy, and if the module is async and accessed as thenable, it will return a new module reference with `async` label to tell react to handle it as async modules:

exported client reference `*` --> not async module (non thenable) --> original module reference `''`
exported client reference `*` --> it's async module (thenable) --> wrapped module reference `'*'` with `async` label

### Note

Since we need to check if user having incorrect gSSP/gSP specifying in layout client componet, so we still need to parse it and assign those info to the proxy (Does client module containing `ssr`, `ssg` exports). Otherwise the proxy will return the cached module reference
2022-08-29 14:47:06 +00:00
Kiko Beats
8958867d91
build: upgrade edge-runtime (#39898)
https://github.com/vercel/edge-runtime/compare/v1.1.0-beta.27...v1.1.0-beta.31

Related: https://github.com/vercel/next.js/issues/38658
2022-08-24 23:59:12 +00:00
Kiko Beats
28746520b6
build: upgrade edge-runtime (#39749)
https://github.com/vercel/edge-runtime/compare/v1.1.0-beta.26...v1.1.0-beta.27
2022-08-22 09:28:58 +00:00
Shu Ding
c79b67cced
Improved server CSS handling (#39664)
Upgrade experimental React, and render link tags directly in the tree during development. The client bundle won't import CSS anymore, and server CSS imports will be transpiled into no-op strings just for HMR to use.

## Follow Ups
- [ ] Flash of unstyled elements when reloading styles
- [ ] Collect client style imports
- [ ] Console warning for duplicated resources
- [ ] Tests

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 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.md#adding-examples)
2022-08-17 10:56:52 +00:00
Steven
53f0e2b31c
Update image tests files from *.js to *.ts (#39663)
Let's utilize typescript for our tests
2022-08-16 23:29:55 +00:00
JJ Kasper
6fd2a7fa31
Remove webpack4 types (#39631)
These types are no longer needed as we are only leveraging webpack 5 so this finishes migrating our types away from webpack 4's types.
2022-08-16 09:55:37 +00:00
Gal Schlezinger
b899d01fff
Bump edge-runtime packages (#39450)
This version fixes a bug where [crypto buffers (ArrayBuffer, Uint8Array) not compatible with text decoding](17475e4df7).
2022-08-10 09:19:48 +00:00
Jiachi Liu
71f5f258ab
Setup require hook in next-server for styled-jsx resolving (#39305)
* Use require hook and alias to resolve styled-jsx

* re-export styled-jsx types from compiled

* fix lint

* add test for styled-jsx css

* setup require hook in server

* compile import path to styled-jsx/style

* revert require hook

* add test for server styled-jsx resolving

* update test

* pre copy styled-jsx assets

* fix styled-jsx dts

* add npmrc for styled-jsx e2e test

* load require hook directly

* rm legacy test

* fix lint

* fix pnpm install error

* split require hook

* only alias styled-jsx

* make styled-jsx resolving statically analyzable

* update test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-08-08 20:27:42 -05:00
Michael Novotny
ab48f54786
Adds eslint-plugin-eslint-plugin to ensure eslint-plugin-next rules follow ESLint rule best practices along with enforcing some consistency. (#37920)
* Adds eslint-plugin-eslint-plugin and recommended rules.

* Removes `fixable` as none of the rules contain fixers.

* Adds description and url rules.

* Adds message format.

* Removes optional dependencies.

* Lints eslint-plugin-next tests too.

* Removes optional dependencies from pnpm lock file.

* Resets pnpm lock file.

* Resets package.json too.

* Fixes pnpm lockfile.
2022-08-07 23:52:02 -05:00
Jiachi Liu
4d0783d9be
Flush styles effects (#39268)
Use flush effects to custom apply css-in-js solution to app. Re-introduce flush effects to app-render, and remove default support of styled-jsx in `app/`. So that users will choose their own css-in-js solution if they need any customization. styled-jsx won't appear in client bundle if you didn't use it.

For now we have to inject the initial styles before `</head>` to avoid hydration errors. Later on we can remove this once react can handle it.

- [x] inject styles before end of head element
- [x] add tests
2022-08-03 16:21:20 +00:00
Gal Schlezinger
e3181c2d77
Export URLPattern from next/server (#39219)
This commit allows the users to import URLPattern from `next/server`,
by defining a key that uses `global.URLPattern`.

Why is this any good? or: why don't we add URLPattern to the global namespace?

URLPattern is exposed as global on Edge Runtime _only_. This means that if we define a
constructor in global namespace in our TypeScript definitions, people might
have runtime errors in their Node.js functions.

Importing from `next/server` enables users to get the constructor without
risking in runtime errors and wrong type definitions.

Keep in mind, that with the current implementation, we do not check if the
constructor actually exists, but `next/server` shouldn't be imported in
Node.js functions, AFAIK.

## Related

- Fixes #38131

## Bug

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


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-08-02 02:04:08 +00:00
Kiko Beats
0ebd53fdb5
fix: print Request & Response properties (#38903)
* Add inspect symbol for request

WIP

* Add inspect symbol for response

* build: upgrade edge-runtime
2022-07-27 09:16:16 -05:00
JJ Kasper
90ddd0dc83
Replace node-sass test dependency with sass (#39053)
* Replace node-sass test dependency with sass

* breakup css/scss tests for more parallelism

* update compiled
2022-07-26 23:12:54 -05:00
Tobias Koppers
8324cf5218
update webpack (#38988)
https://github.com/webpack/webpack/releases/tag/v5.74.0

There is a nice little performance fix for rebuild performance in this release.
It also fixes the edge case @Kikobeats did run into: https://vercel.slack.com/archives/CGU8HUTUH/p1656505879286119
2022-07-25 15:47:11 +00:00
Javi Velasco
14463ddd10
Update Edge Runtime (#38862)
This PR updates the Edge Runtime to use a new version that loads dependencies differently. This addresses https://github.com/vercel/next.js/pull/38766 so `instanceof` works as expected.

It involved a few code changes, mostly regarding to types. The most important change is that the `Runner` function in the sandbox doesn't take a `ReadableStream` as `body` anymore since this implies creating the instance on "node land" and makes the runtime `fetch` function not to be able to compare with `ReadableStream` using `instanceof`.  Instead we introduce a "clonable body" abstraction that allows to create the `ReadableStream` from `Readable` by using the edge runtime primitive which would hold the correct prototype.

Also, this PR changes the way we pre-compile the Edge Runtime to adapt it to the new version.
2022-07-21 18:29:19 +00:00
JJ Kasper
ff148a0fb4
Update to latest version of turbo (#38629)
Updates to latest turbo which includes patches for cached files. 

x-ref: [slack thread](https://vercel.slack.com/archives/C02CDC2ALJH/p1657767763630359?thread_ts=1657757803.039099&cid=C02CDC2ALJH)

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 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.md#adding-examples)
2022-07-14 09:03:35 +00:00
Tim Neutkens
1e2b30dd51
Pass server context to Flight render (#38582)
Ensures you can use server context when navigating.


## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 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.md#adding-examples)
2022-07-13 09:40:09 +00:00
Gal Schlezinger
62eb16b603
Upgrade edge-runtime + make EdgeRuntime value overridable with an env var on compilation (#38331)
This PR introduces an environment variable that allows to modify the `EdgeRuntime` value on compilation time.
This is done to allow cloud providers like Vercel to have a different value, and enable user code and 3rd party libraries to have different code paths depending on the Edge Functions provider.

## Related

- Related to #30739

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-07-12 15:18:59 +00:00
Tim Neutkens
f113141389
Implement new client-side router (#37551)
## Client-side router for `app` directory

This PR implements the new router that leverages React 18 concurrent features like Suspense and startTransition.
It also integrates with React Server Components and builds on top of it to allow server-centric routing that only renders the part of the page that has to change.

It's one of the pieces of the implementation of https://nextjs.org/blog/layouts-rfc.

## Details

I'm going to document the differences with the current router here (will be reworked for the upgrade guide)

### Client-side cache

In the current router we have an in-memory cache for getStaticProps data so that if you prefetch and then navigate to a route that has been prefetched it'll be near-instant. For getServerSideProps the behavior is different, any navigation to a page with getServerSideProps fetches the data again.

In the new model the cache is a fundamental piece, it's more granular than at the page level and is set up to ensure consistency across concurrent renders. It can also be invalidated at any level.

#### Push/Replace (also applies to next/link)

The new router still has a `router.push` / `router.replace` method.

There are a few differences in how it works though:

- It only takes `href` as an argument, historically you had to provide `href` (the page path) and `as` (the actual url path) to do dynamic routing. In later versions of Next.js this is no longer required and in the majority of cases `as` was no longer needed. In the new router there's no way to reason about `href` vs `as` because there is no notion of "pages" in the browser.
- Both methods now use `startTransition`, you can wrap these in your own `startTransition` to get `isPending`
- The push/replace support concurrent rendering. When a render is bailed by clicking a different link to navigate to a completely different page that still works and doesn't cause race conditions.
- Support for optimistic loading states when navigating

##### Hard/Soft push/replace

Because of the client-side cache being reworked this now allows us to cover two cases: hard push and soft push.

The main difference between the two is if the cache is reused while navigating. The default for `next/link` is a `hard` push which means that the part of the cache affected by the navigation will be invalidated, e.g. if you already navigated to `/dashboard` and you `router.push('/dashboard')` again it'll get the latest version. This is similar to the existing `getServerSideProps` handling.

In case of a soft push (API to be defined but for testing added `router.softPush('/')`) it'll reuse the existing cache and not invalidate parts that are already filled in. In practice this means it's more like the `getStaticProps` client-side navigation because it does not fetch on navigation except if a part of the page is missing.

#### Back/Forward navigation

Back and Forward navigation ([popstate](https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event)) are always handled as a soft navigation, meaning that the cache is reused, this ensures back/forward navigation is near-instant when it's in the client-side cache. This will also allow back/forward navigation to be a high priority update instead of a transition as it is based on user interaction. Note: in this PR it still uses `startTransition` as there's no way to handle the high priority update suspending which happens in case of missing data in the cache. We're working with the React team on a solution for this particular case.

### Layouts

Note: this section assumes you've read [The layouts RFC](https://nextjs.org/blog/layouts-rfc) and [React Server Components RFC](https://reactjs.org/blog/2020/12/21/data-fetching-with-react-server-components.html)

React Server Components rendering leverages the Flight streaming mechanism in React 18, this allows sending a serializable representation of the rendered React tree on the server to the browser, the client-side React can use this serialized representation to render components client-side without the JavaScript being sent to the browser. This is one of the building blocks of Server Components. This allows a bunch of interesting features but for now I'll keep it to how it affects layouts.

When you have a `app/dashboard/layout.js` and `app/dashboard/page.js` the page will render as children of the layout, when you add another page like `app/dashboard/integrations/page.js` that page falls under the dashboard layout as well. When client-side navigating the new router automatically figures out if the page you're navigating to can be a smaller render than the whole page, in this case `app/dashboard/page.js` and `app/dashboard/integrations/page.js` share the `app/dashboard/layout.js` so instead of rendering the whole page we render below the layout component, this means the layout itself does not get re-rendered, the layout's `getServerSideProps` would not be called, and the Flight response would only hold the result of `app/dashboard/integrations/page.js`, effectively giving you the smallest patch for the UI.

---

Note: the commits in this PR were mostly work in progress to ensure it wasn't lost along the way. The implementation was reworked a bunch of times to where it is now.

Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-07-06 21:16:47 +00:00
JJ Kasper
9573174196
Replace pre-commit with husky (#38350)
* Replace pre-commit with husky

* update lock

* actually update lock
2022-07-06 11:14:16 -05:00
Steven
fb8686055a
Revert "chore: remove workspace from package.json since we have `pnpm-works…" (#38376)
Revert "chore: remove workspace from `package.json` since we have `pnpm-works… (#38166)"

This reverts commit a37abc62ee.
2022-07-06 17:08:00 +02:00
Anjorin Damilare
a37abc62ee
chore: remove workspace from package.json since we have `pnpm-works… (#38166)
chore: remove workspace from `package.json` since we have `pnpm-workspace`
2022-07-06 16:26:20 +02:00
Jiachi Liu
bfaffbdd3f
Alias react and react-dom by default (#38245)
Previously we use custom webpack alias for specific react versions for non server side node runtime aliases. This PR alias the entire folders of `react/` and `react-dom/` so that no more alias in next.config is required but only the nodejs require hook.

* Alias `react` and `react-dom` by default
* Use `react@experimental` to run server components integration test
* Drop with-react-17 test util, add `__NEXT_REACT_CHANNEL` as an env var for testing and development to specify the react channel is 17 or new experimental version
2022-07-01 23:57:45 +00:00
Michael Novotny
edd395a7d3
Adds tests to ensure eslint-plugin-next's available rules are properly exported and recommended rules are correctly defined. (#38183)
* Adds tests to ensure `eslint-plugin-next`'s available rules are properly exported and recommended rules are defined correctly.

* Condenses imports.

* Sets default recommended value.

* replace Object.hasOwn for node 14

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-06-30 11:31:33 -05:00
Wyatt Johnson
23b8b982df
Fix missing trace script devDependencies (#38172)
Adds missing devDependencies required by the `trace-to-tree.mjs` script used here to the workspace root.

c64af8aa34/scripts/trace-to-tree.mjs (L2-L3)
2022-06-29 20:57:51 +00:00
Kiko Beats
9cc1c3c576
Upgrade Edge Runtime (#38105) 2022-06-28 07:48:23 -05:00
Kiko Beats
5819dd5540
Upgrade Edge Runtime (#38069)
This new version renamed `globalThis.Edge` into `globalThis.EdgeRuntime`.
2022-06-27 18:44:02 +00:00
Steven
8302a3ff7c
Move rimraf from root packages using it (#37996)
In a previous PR (#37278), the dependencies for benchmarks were moved to a subdirectory.

This ensures the same is done for other packages using `rimraf` which means we can remove it from the root package.json
2022-06-24 21:08:52 +00:00
Steven
880d4fb5c9
Bump release to 6.3.1 (#37995) 2022-06-24 15:02:40 -05:00
JJ Kasper
658a7f550f
Update to latest version of turbo (#37976) 2022-06-24 09:31:26 -05:00
Leah
7c20918bc7
feat: enable configuration of styled-components transform and enable css prop support (#37861)
This allows configuring / overriding the default options of the `styled-components` swc transform and allows using the `css` prop support, which was already implemented, but not available.

Edit: made the CSS prop transform run before the display name, so it gets picked up by that and receives the (deterministic) name.

Relates to #30802
2022-06-23 16:55:05 +00:00
Donny/강동윤
ee7648ae0a
Update swc (#37607)
* Update swc

* Update again

* fixup

* Bump

* Update

* fixup

* Update test refs

* Update minifier

* Parser

* Update swc

* Bump version

* Update

* fixup

* Update test refs

* Bump

* Update `@swc/helpers`

* lockfile

* lints

* FIx

* [TRY] Update @swc/core
2022-06-21 10:51:47 -05:00
JJ Kasper
081c21bc1c
Revert "Enable externalHelpers when pre compiling Next.js' code" (#37829)
Revert "Enable `externalHelpers` when pre compiling Next.js' code (#37164)"

This reverts commit 4671010169.
2022-06-19 13:19:23 -05:00
Sukka
4671010169
Enable externalHelpers when pre compiling Next.js' code (#37164)
* chore: enable `externalHelpers` for pre-compile

* chore(devDeps): update @swc/core@1.2.203
2022-06-19 10:03:50 -05:00
JJ Kasper
924582b52c
Update to use latest version of pnpm (#37794)
* Update to use latest version of pnpm

* add packageManager field
2022-06-17 12:36:37 -05:00
Damien Simonin Feugas
c2b8006485
refactor(middleware): leverages edge-runtime builtins to decorate errors in dev (#37718)
### What's in there?

This is a followup of https://github.com/vercel/next.js/pull/37695.
For the dev server to clean stacktraces, we're decorating errors caught during code evaluation (`getServerSideProps` or middleware).
However, when these errors are asynchronously raised, we can't decorate them before processing them, leading to this fallback logic:

bf7bf8217f/packages/next/server/dev/next-dev-server.ts (L775-L779)

Thanks to latest improvement of the edge-runtime in 1.1.0-beta.4, we can now catch unhandled rejection and uncaught exception, and decorate them.

### How to test?

Please reuse the existing tests who already covered these cases:
`pnpm testheadless --testPathPattern middleware-dev-errors`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-06-17 15:06:30 +00:00
Jiachi Liu
40b0dae558
chore: bump react dev dep to 18.2 (#37697)
* chore: bump react dev dep to 18.2

* fix test and exclude inc cache path for edge

* update compiled

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-06-15 10:14:43 -05:00
Javi Velasco
7584b02b34
Remove Middleware Preflight (#37490)
* Refactor data fetching to support getting headers

* Relax `getNextPathnameInfo` type

* Add test for middleware internal redirects

* Export `ParsedRelativeUrl` type

* Refactor `getMiddlewareEffects`

* Move rewrite i18n test to middleware rewrite tests

* Fix bug parsing pathname info

* Normalize data requests to page requests for middleware

* Ensure there is a header `x-nextjs-matched-path` for middleware rewrites on data requests

* Extract `getDataHref` to a function

* Stop using `getDataHref` for flight

* Always set the query in `dataHref` independently of if it is SSG

* Add test for recursive rewrites

* Refactor dynamicPath validation to `matchHrefAndAsPath`

* Add `dataHref` to `FetchDataOutput`

* Extract `matchesMiddleware` function

* Add `hasMiddleware` option to `fetchNextData`

* Move preflight test

* Remove preflight test

* Add middleware prefetch tests

* Remove preflight

* Attempt to reduce bundle size

Include `withMiddlewareEffects` and `matchHrefAndAsPath` into `router`

Bring `getDataHref` back to `page-loader`

Bring `resolveDynamicRoute` back to `router`

* Reduce arg duplication for `withMiddlewareEffects`

* Remove some async/await and spreads to reduce bundle size

* Upgrade `edge-runtime` & clone `Request` on redirects to mutate headers

* Add some rewrite tests

Co-authored-by: Kiko Beats <josefrancisco.verdu@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-06-08 10:41:28 -05:00
JJ Kasper
01ecff3b09
Update to latest version of @swc/helpers (#37531)
* Update to latest version of @swc/helpers

* update lock
2022-06-08 11:52:26 +02:00
Keen Yee Liau
1fcf21c7e7
test: upgrade playwright-chromium from 1.14.1 to 1.22.2 (#37436)
* test: upgrade playwright-chromium from 1.14.1 to 1.22.2

This is a prereq for #36490 because the Events Timing API
used to measure Interaction to Next Paint (INP, experiemental web vital)
is only available in Chromium >= v98.

* update test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-06-06 23:37:01 -05:00
Tobias Koppers
273da9e118
update webpack and watchpack (#37397)
https://github.com/webpack/watchpack/releases/tag/v2.4.0
https://github.com/webpack/webpack/releases/tag/v5.73.0

and let pnpm clean up some stuff
2022-06-02 13:09:21 +00:00
7iomka
7b91a1c156
Update of @babel/core (#37145)
Update of @babel/core to fix Type-only import specifiers issue


Fixes [#37016](https://github.com/vercel/next.js/issues/37016)


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-31 01:00:12 +00:00
JJ Kasper
1d1ffc88b7
Update to leverage turbo for build/prepublish (#37280)
* Update to leverage turbo for build/prepublish

* update path

* remove extra turbo config
2022-05-30 19:05:27 -05:00
Kiko Beats
6ebe0fa0cd
declare pnpm7 as engine (#37303)
Ensure to use npm v7, otherwise the lockfile will be messed with previous versions

Related: https://pnpm.io/npmrc#lockfile
2022-05-30 13:13:36 +00:00
Kiko Beats
fafbea8b74
Use Edge Runtime for running Edge Functions locally (#37024)
This PR introduces [Edge Runtime](https://edge-runtime.vercel.app/) for emulating [Edge Functions](https://vercel.com/features/edge-functions) locally.

Every time you run a [middleware](https://nextjs.org/docs/advanced-features/middleware) locally via `next dev`, an isolated edge runtime context will be created.

These contexts have the same constraints as production servers, plus they don't pollute the global scope; Instead, all the code run in a vm on top of a Node.js process.

Additionally, `@edge-runtime/jest-environment` has been added to make easier testing Edge Functions in a programmatic way.

It dropped the following polyfills from Next.js codebase, since they are now part of Edge Runtime:

- abort-controller
- formdata
- uuid
- web-crypto
- web-streams

Co-authored-by: Gal Schlezinger <2054772+Schniz@users.noreply.github.com>
2022-05-30 12:01:36 +00:00
JJ Kasper
df2f1f01fa
add version step for publish 2022-05-29 14:59:38 -05:00
Remco Haszing
a7eb6695aa
Add type definitions for next/mdx (#36815)
Although it’s not intended for use in TypeScript, TypeScript still offers some nice features when it’s used in next.config.js (completion, hovers, `"checkJs": true`).

## Bug

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

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-29 05:21:25 +00:00
JJ Kasper
f7b81316ae
Update to leverage pnpm for monorepo (#37259)
* Update to leverage pnpm for monorepo

* update compiled

* update stats action

* update ci install step

* update ci

* add test dep

* update invoking scripts

* update caching

* skip cache for now

* update dep

* update packages and fix babel

* update compiled

* update lint

* update test

* update ci

* update pnpm store caching

* update path for windows

* update restore-key config

* update caching

* remove extra build azure stage

* re-add checkout

* update setting pnpm store

* bump

* remove azure caching as pnpm is faster to download

* update contributing

* apply suggestions

* remove install-peers

* prepublish -> prepublishOnly

* prepublish -> prepublishOnly more

* more yarn -> pnpm references

* more yarn -> pnpm references take 2

* use workspace protocol for root package.json

Co-authored-by: Steven <steven@ceriously.com>
2022-05-28 23:35:16 -05:00
JJ Kasper
b68d9eafa4
Rename app paths folder (#37146) 2022-05-25 11:46:26 +02:00
JJ Kasper
b4af2f3f0d
Update to latest version of turbo (#37046)
Updates our turbo version to the latest
2022-05-19 20:59:06 +00:00
LongYinan
2012f4e7c6
Update components in GitHub Actions (#36669)
`build-native` jobs tested on https://github.com/vercel/next.js/runs/6288266017
2022-05-04 18:51:25 +00:00
Justin Goping
44c89e50c8
Route Loader Trusted Types Violation Fix (#34730)
Linked to issue #32209.

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] 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 helpful link attached, see `contributing.md`

## Documentation
There is one tsec violation that is fixed in this PR:
### 1. ban-script-src-assignment: route-loader.ts
XSS can occur with the line script.src = src in appendScript(src, script) if src can be controlled by a malicious user. From tracing through the code, it was determined that src comes from the function `getFilesForRoute(route)`. The behaviour of this function differs depending on the environment (development vs. production), but in both cases the function will construct strings that lead to valid file paths. These strings depend on two variables: `assetPrefix` and `route`, but due to the nature of the constructed strings it was determined that the scripts here are safe to use. Thus, the solution was to promote these strings to `TrustedScriptURL`s. This is the Trusted Types way of declaring that the script URL passed to the DOM sink is safe from DOM XSS attacks.

To create a `TrustedScriptURL`, a policy needs to be created. This policy was put in its own file: `client/trusted-types.ts`. This policy has the name `nextjs`. If this name should be changed to something else, feel free to change it now. However, once it is released to the public and application developers begin using it, it may be harder to change the value since any application developers with a custom policy name allowlist would now need to update their `next.config.js` headers to allow this new name.

The code was tested in a sample application to ensure it behaved as expected.
2022-05-03 23:22:08 +00:00
Jiachi Liu
ea81df0a83
Bump react dev dep to 18.1 (#36491)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-04-28 11:29:30 +02:00
Balázs Orbán
0e02f20462
chore: upgrade PostCSS dependencies (#34354)
Co-authored-by: balazsorban44 <balazsorban44@users.noreply.github.com>
2022-04-22 13:14:29 +02:00
Steven
4c15f89b53
Add support for tsconfig moduleResolution node | node12 | nodenext (#36189)
- Fixes #35572 

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-04-15 17:09:12 +00:00
JJ Kasper
4a7ab34baf
Update repo to use react 18 by default (#35888)
This updates our `yarn next` command to leverage react v18 by default and removes the need for the test require hook/config modifying when testing react 18. There are some fixtures we need to investigate react 18 support in follow-ups:

- `test/integration/client-navigation-a11y`
- `test/integration/critical-css`
- `test/integration/custom-error-page-exception`
- `test/integration/font-optimization`
- AMP specific tests
2022-04-05 21:51:47 +00:00
Tim Neutkens
62bb3482fe
Fix Fast Refresh for React 18 (#35718)
- Updates the React 18 test suite to the latest React version.
- Upgrade `react-refresh` module

Fixes #35518
Fixes #35703

## Bug

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2022-03-30 12:16:17 +00:00
Jiachi Liu
9bff48b9d5
Adopt react 18 rc2 (#35161)
* Adopt react 18 rc2

* execute shouldUseReactRoot only once

* update test

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-03-09 21:12:36 +01:00
OJ Kwon
8d0561ebf8
feat(trace): postprocess trace reporter for datadog (#35032)
* feat(trace): include clocktime for span

* build(package): bump up devdependencies

* feat(trace): postprocess trace reporter for datadog

* build(package): update precompile pkgs

* update compiled

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-03-08 08:15:09 -08:00
Steven
b25f7f84b1
Fix animated png bypass from Image Optimization API (#35120)
- Fixes #34807
- Related commit 69dad3cdf9

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-03-07 20:29:11 +00:00
Jiachi Liu
ff6b75027b
Enable import assertion syntax parsing (#33750)
## Feature

Enable import assertion syntax parsing for ecmascript/typescript. Since webpack has already supported it, enable import assertion parsing and leave them to webpack to handle

#### Upgration
* tooling: `@swc/core`, `@swc/cli`, prettier to support importAssertion related flags
* typescript related: `typescript` >= 4.5
* babel related: `@babel/plugin-syntax-import-assertions`
* lint parser: `@typescript-eslint/parser`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-03-06 20:41:22 +00:00
Brian Noguchi
01268f61ce
dep: upgrade @swc/core v1.2.148 , @swc/cli v0.1.55 (#35054)
## Feature

Upgrades `@swc/core` to `1.2.148`, which includes this critical fix https://github.com/swc-project/swc/pull/3824

Also upgrades `@swc/cli` to `v0.1.55`
2022-03-05 21:45:30 +00:00
Jiachi Liu
e3d0d645af
Adopt react 18 rc1 (#34972)
### Changes

* Remove top-level suspense boundary
* Pipe stream resolved from returned promimse of `renderToReadableStream`
* Remove jsx-runtime alias hack

### Test Changes

Since top level suspense boundary is removed, now content are filled in 1st SSR
2022-03-02 21:21:18 +00:00
Justin Goping
ce4923c659
Integrate tsec into the linting process (#33746)
* Integrate tsec into the linting process

* Update tsec-exemptions.json
2022-02-24 16:59:18 -08:00
JJ Kasper
06b263021a
Update to latest version of amphtml-validator (#33967)
* Update to latest version of amphtml-validator

* update compiled

* bump compiled
2022-02-03 20:33:38 -06:00
JJ Kasper
3e60c232a8
Relay Support in Rust Compiler (#33702)
Reverts vercel/next.js#33699

This re-opens the support for relay in swc, although we need to narrow in the causes for the build failures in https://github.com/vercel/next.js/runs/4950448889?check_suite_focus=true

Co-authored-by: Andrey Lunyov <102968+alunyov@users.noreply.github.com>
2022-02-01 18:18:55 +00:00
Divlo
e0095faf23
fix(next/image): render valid html according to W3C (#33825)
## Bug

- [x] Fixes #33809
- [x] Related to #33218
- [x] Integration tests added: Usage of [html-validator](https://www.npmjs.com/package/html-validator) to validate the HTML.
- [x] Errors have helpful link attached, see `contributing.md` (N/A)
2022-01-31 19:13:46 -05:00
Steven
b9c012f49d
Fix duplicate image src causing canceled request (#33776)
In PR #26968, we added Set of loaded images that was removed in #33474 erroneously.

We still need to track loaded images since we can't rely on `img.complete`, especially if the parent uses `react-virtualized`.

Tested on https://nextjs.org/showcase
2022-01-28 23:50:36 +00:00
JJ Kasper
b5d4564cca
Revert "Relay Support in Rust Compiler" (#33699) 2022-01-26 17:26:32 +01:00
Terence Bezman
b20eb99a4d
Relay Support in Rust Compiler (#33240)
## Feature

Implements feature requested in https://github.com/vercel/next.js/issues/30805. 

A few people including myself have been looking to use Relay with Next.JS and want to use the new Rust Compiler. This is my stab at an implementation. 

### How it works?
Finds all  `graphql` tagged template experssions and replaces them with `require`s to the file generated by Relay.

### Where I need help
- I've only worked with Rust a handful of times so I would appreciate any feedback on my use of language features.
- Is there any performance overhead to many duplicate usages of `require`? I imagine there's a cache in place but I want to be sure.
- I've added some unit tests & integration tests but I might be missing some use cases. Feel free to comment some use cases I'm not thinking about.

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Documentation added
  - I haven't added any docs since this is an experimental API.

## Documentation / Examples

You're expected to be running the Relay Compiler along side Next.JS when you're developing. This is pretty standard. I wouldn't expect people to have any problem with this.

### Usage
In your `next.config.js`
```js
module.exports = {
  experimental: {
    relay: {
      language: 'typescript', // or 'javascript`
      artifactDirectory: 'path/to/you/artifact/directory' // you can leave this undefined if you did not specify one in the `relay.json`
    }
  }
}
```


Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2022-01-26 08:23:57 +00:00
JJ Kasper
562439d710
Update to latest version of turbo (#33613) 2022-01-24 14:43:45 -06:00
Balázs Orbán
1d4f364515
chore(deps): upgrade node-fetch (#33466)
Fixes #33462 

Tried upgrading to v3, but we rely on the `timeout` property:

e5dee17f77/packages/next/telemetry/post-payload.ts (L12)

Which was removed since it's non-standard:

https://github.com/node-fetch/node-fetch/blob/main/docs/v3-UPGRADE-GUIDE.md#the-timeout-option-was-removed

I wanted to keep this PR minimal, so I did not try to work around the above.

## Bug

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-01-19 16:48:11 +00:00
JJ Kasper
efabf81e23
Add util for generating new tests/error documents (#33001)
* Add util for generating new tests/error documents

* update compiled

* lint-fix

* apply suggestions

* update wording

* update compiled
2022-01-06 09:45:04 -06:00
JJ Kasper
5e5f1df445
Re-enable turbo caching for swc build jobs (#32617)
* Fix build-native jobs

* Update to latest turbo

* fix extra space

* fix windows shell

* Update to latest turbo

* Bump Turbo (#32703)

* Bump turbo to canary

* Bump turbo

* Update yaml too

* add less specific restore key

* update more restore keys

* Fix non-unique key and cache wasm build

* ensure turbo is installed for new jobs

* remove old wasm cache

* update directory check

* bump

* re-add if publish checks

Co-authored-by: Jared Palmer <jared@jaredpalmer.com>
2022-01-04 15:10:16 -06:00
Balázs Orbán
3ad2035ae6
feat(cli): introduce next info CLI command (#32972)
This PR adds a new command to the `next` CLI.

Running `next info` will print useful information to the terminal about how/where Next.js is run. This information can be added to the Bug report when opening an issue in the repository.

This makes reporting issues more accurate and doesn't require the user to guess certain details, the command will retrieve it on their behalf.

Example output:

```sh
$ npx --no-install next info

    Operating System:
      Platform: linux
      Version: #22-Ubuntu SMP Fri Nov 5 13:21:36 UTC 2021
    Binaries:
      Node: 16.13.0
      npm: 8.1.0
      Yarn: 1.22.17
      pnpm: 6.24.2
    Relevant packages:
      next: 12.0.8-canary.14
      react: 17.0.2
      react-dom: 17.0.2


```

The idea is based on #32858

## Bug

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

## Feature

- [x] 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2022-01-04 15:35:32 +00:00
JJ Kasper
c9c3183292
Remove un-needed test dependency (#32616)
* Remove un-needed test dependency

* update test

* update compiled
2022-01-03 10:08:30 -06:00
Tim Neutkens
88a5f263f1
Move resolve-url-loader into Next.js (#32932)
* Move resolve-url-loader into Next.js

Fixes #32157

Moves resolve-url-loader into Next.js and strips out all features that are not used like `rework` support. Will reduce install size as well as allow for optimizing the approach in the near future.

* Update precompiled

* Use loader-utils 2

* Update trace test

* Revert "Update trace test"

This reverts commit 7c09a07871cc0ab72d5fcd4151a2d8efbc1aad8f.

* Add es5-ext as it's used in trace tests

* Update join-function.js

* Update bundle5.js
2022-01-02 16:16:17 -06:00
Jiachi Liu
b3b92b610f
Upgrade react 18 to rc, drop prerelease warning (#32619)
### Enhancement

* Auto enable reactRoot API for react 18 since the legacy render in `react-dom` is dropped
* Remove prelrease warning
2021-12-20 13:43:42 +00:00
Jared Palmer
ed022eda0f
Add turbo / improve Rust build caching in GitHub Actions (#31464)
Implements Turborepo for the Next.js repository and leverage it for native build caching.

Co-authored-by: Maia Teegarden <2865858+padmaia@users.noreply.github.com>
2021-12-16 20:10:45 +00:00
JJ Kasper
5011937aff
chore(deps): upgrade browserslist (#32300)
* chore(deps): upgrade `browserlist`

* update compiled

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2021-12-08 17:51:35 -06:00
C. T. Lin
3a5e4244c5
Fix the testall npm script (#32081)
`yarn test` has been removed by #32042, so it should be replaced by the other test scripts.
2021-12-03 19:02:28 +00:00
Tim Neutkens
b6914198b4
Remove "yarn jest" from Next.js repo scripts (#32042)
Removes `yarn test` from the scripts as it has the wrong options. `yarn testonly` or `yarn testheadless` are the way to run tests. Fixes #32031


## Bug

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-12-03 06:02:59 +00:00
Jiachi Liu
d2cef24d5d
Fix image related link prop warning with react 18 beta (#31895)
## Bug

Fixes #31892 

react 18: requires camelcase for those props 
```
Warning: Invalid DOM property `imagesrcset`. Did you mean `imageSrcSet`
```
react 17: requires lowercase for those props

```
Warning: React does not recognize the `imageSrcSet` prop on a DOM element.
```

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


### Utils

* Add command `yarn next-react-18 test/integration/any-react-18-app/`
* Add util `withReact18`

```js
const withReact18 = require('../../react-18/test/with-react-18')

module.exports = withReact18({
  experimental: {
    concurrentFeatures: true,
  },
})
```
2021-11-30 18:37:22 +00:00
Steven
44b4dbcd41
Adjust AVIF size so that its smaller than WebP size (#31494)
Generally, AVIF quality can be lower compared to WebP so we can adjust this for the user so that it looks roughly the same depending on if the browser supports AVIF or WebP.

- Fixes #31254 
- Related to https://github.com/lovell/sharp/issues/2850
2021-11-17 20:31:16 +00:00
Tim Neutkens
4223611af8
Ensure Git feature.manyFiles is enabled (#31408) 2021-11-15 11:37:44 +01:00
Donny/강동윤
54ca8f41ce
next-swc: Add displayNameAndId of styled-components (#31189)
## Bug

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`




Related to: https://github.com/vercel/next.js/issues/30802
2021-11-09 10:05:31 +00:00
Maia Teegarden
bc88831619
Add next-swc jest transform (#30993)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-11-08 17:35:04 +01:00
Shu Ding
5e185fc5da
Upgrade React alpha and experimental dependencies to latest (#31039)
Ensuring that our tests are not broken with latest React changes.

## Bug

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-11-06 12:08:03 +00:00
Maia Teegarden
b2b7e78cef
Add postinstall script to install native packages (#30850)
* Add postinstall script to install native packages

* Use a subdirectory of tmpdir

* Ensure tmpdir exists

* Remove tmpdir once done

Co-authored-by: JJ Kasper <jj@jjsweb.site>

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-11-02 16:37:25 -07:00
PrashoonB
147b0f9ebc
Upgraded the node-notifier version to 8.0.1 (#30777)
## Bug

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-11-02 10:05:26 +00:00
Maia Teegarden
b5a89160f7
Chore/rust workflow (#30577)
* Remove prebuilt binaries from repo

* Prefer locally built binary

* Add binary packages as optionalDependencies

* Remove build-native workflow for prebuilt binaries

* Remove binaries from checkCompiled job

* Change build-native command to default to dev

* Add build-native-dev and have tests depend on it

* Update contributing

* Run ls to make inspect artifact download

* Use correct artifact download path

* Try using reusable workflows

* Resort to duplication for now

* Inspect artifact download

* Ensure native is copied for PR stats

* Copy after ref checkout and log binaries for PR stats

* fix typo

* copy right before linking/packing

* Use fs.copy

* fix test for now

Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-10-29 13:56:56 -05:00
Tobias Koppers
c03e28425b
make sure "webpack" exists in the repo for typings (#30371)
fixes "yarn types" needed before "yarn dev"
use incremental typescript for next package
2021-10-29 17:57:55 +00:00
JJ Kasper
842a130218
Update to latest shell-quote (#30621) 2021-10-29 11:12:46 -05:00
Shu Ding
5ddee4494b
Add new target for middleware (#30299)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2021-10-26 18:50:56 +02:00
Tim Neutkens
08a7f7f31a
Enable SWC by default when there is no custom Babel config (#29811)
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
Co-authored-by: Maia Teegarden <dev@padmaia.rocks>
Co-authored-by: padmaia <padmaia@users.noreply.github.com>
2021-10-23 10:21:44 +02:00
JJ Kasper
3274efc398
Update to latest caniuse-lite version (#30194) 2021-10-22 20:36:33 -05:00
Tim Neutkens
7e370134fb
Use import() to load next.config.js (#29935)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Steven <steven@ceriously.com>
2021-10-16 14:22:42 +02:00
Steven
fdb2cc80b1
Bump "engines" to node >= 12.22.0 (#29949)
Older versions of Node.js don't have a stable ESM implementation

https://nodejs.org/api/esm.html#esm_modules_ecmascript_modules
2021-10-15 20:55:14 +00:00
Tim Neutkens
aa8a885599
Remove webpack 4 support (#29660)
Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-10-06 17:40:01 +02:00
Tobias Koppers
4f212ee91d
the way towards webpack 5 typings (#29105)
Co-authored-by: sokra <sokra@users.noreply.github.com>
2021-09-21 19:17:16 +02:00
JJ Kasper
8e52126ea6
Migrate prerender tests to new set-up (#29245) 2021-09-21 16:21:05 +02:00
JJ Kasper
7a7cb91e80
Update swc dependencies (#29151)
Updates to the latest `@swc/core` and `@swc/jest` versions that we use for running tests with jest.
2021-09-16 19:34:33 +00:00
Tobias Koppers
d78bb6fe46
upgrade to typescript 4.4.3 (#29112)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-16 18:06:57 +02:00
Tim Neutkens
c1e5f5b260
Make traces in development reliable (#28990)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2021-09-13 15:49:29 +02:00
JJ Kasper
a92a5caec2
Update test set-up to leverage playwright when able to (#28634)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-13 14:36:25 +02:00
강동윤
a84389591d
Update swc (#28946)
## Bug

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

## Documentation / Examples

- [ ] Make sure the linting passes



I updated rust dependencies and node dependencies.
2021-09-09 09:30:22 +00:00
Adrien HARNAY
2abc4f2d6a
Support node-sass@6 (#28710)
* support node-sass@6

* bump sass-loader

* Update precompiled

Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-09 11:00:19 +02:00
Tim Neutkens
9a56fdba82
Use consistent postcss version for all transforms (#28529)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-09-02 08:45:35 +02:00
Hunter Tunnicliff
877f982924
Use recommended pattern in testing example (#28404)
* Use recommended pattern in testing example

Since the official linter for testing library, `eslint-plugin-testing-library` recommends using `screen` to write queries, this MR updates the testing library example to follow the pattern recommended by the linter.

> DOM Testing Library (and other Testing Library frameworks built on top of it) exports a screen object which has every query (and a debug method). This works better with autocomplete and makes each test a little simpler to write and maintain.

> This rule aims to force writing tests using built-in queries directly from screen object rather than destructuring them from render result. Given the screen component does not expose utility methods such as rerender() or the container property, it is correct to use the render returned value in those scenarios.

See the `prefer-screen-queries` rules docs for more info: https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-screen-queries.md

* Update devDependencies

* Install and configure test linting

* Use recommended pattern in test

* Update test names for consistency

* Update docs

* Set jest environment in each file

* Use root true in `with-jest` eslint config

* Ensure nested .eslintrcs are not loaded for repo lint

Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-08-25 12:33:57 -05:00
JJ Kasper
005b13f1ac
Move unit tests to one folder and migrate them to TypeScript (#28427)
* Move unit tests to one folder

* Migrate unit tests to TypeScript

* add test types to lint

* Ensure ts(x) tests are run with util

* Add tsx extension to jest config

* bump
2021-08-24 07:52:45 -05:00
JJ Kasper
ece79a4e00
Update test config to leverage swc (#28400)
This updates our `jest` configuration to no longer use `babel-jest` and instead uses `@swc/jest` which is much faster. This also updates to the latest version of `jest`, fixes our `tsconfig.json` used for tests (previously types in `node_modules` weren't resolved correctly), and ensures `next/dist` isn't un-necessarily transpiled in `jest`. 

Timings for `yarn testheadless test/unit/` on CI
- before: 3m 30s - 4m ([example run](https://github.com/vercel/next.js/runs/3394701995))
- after: under 1m ([example run](https://github.com/vercel/next.js/pull/28400/checks?check_run_id=3395161621))

Timings for `yarn testheadless test/unit/` locally on m1 mac 
- before: 90.16 seconds
- after: 29.92 seconds
2021-08-23 18:36:56 +00:00
Jesse Jafa
8737ac08fc
feat: upgrade swc/core to 1.2.80 (#28347)
* feat: upgrade swc/core to 1.2.80

* fix: add lock file
2021-08-20 14:54:21 -05:00
Tim Neutkens
2b7d4619ed
Improve jaeger traces (#28168)
Co-authored-by: Harsh Karande <harshskarande@gmail.com>
2021-08-17 09:18:47 +02:00
JJ Kasper
5544adc481
Update to latest babel versions (#28174) 2021-08-17 09:18:08 +02:00