Commit graph

10875 commits

Author SHA1 Message Date
VFLC
ced2040661
docs: fix typo in Script Component docs (#35731)
Added missing closing double quote : `strategy="worker` -> `strategy="worker"`



## 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-03-30 13:42:36 +00:00
Tim Neutkens
eef557d4f8 v12.1.3-canary.2 2022-03-30 15:16:01 +02:00
Shu Ding
9fc19048bd
Ensure the app shell is rendered before rendering the document (#35732) 2022-03-30 15:15:13 +02:00
LongYinan
5a5b6174c0
Emotion css minify should not trim end spaces if item is not the last (#35697)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-03-30 15:14:29 +02:00
Tim Neutkens
d876667aef v12.1.3-canary.1 2022-03-30 14:31:26 +02: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
hiro
a00268e70f
Fix typos (#35683)
* fix(typo): wolrd -> world

* fix(typo): _lineNumer -> _lineNumber

* fix(typo): Dyanmic -> Dynamic

* fix(typo): mutliple -> multiple

* fix(typo): dyanmic -> dynamic

* fix(typo): speical -> special

* fix(typo): acceptible -> acceptable

* fix(typo): dyanmic -> dynamic

* fix(typo): nonexistant -> nonexistent

* fix(typo): nonexistant -> nonexistent

* fix(typo): nonexistant -> nonexistent

* fix(typo): nonexistant -> nonexistent

* fix(typo): nonexistant -> nonexistent

* fix(typo): nonexistant -> nonexistent

* fix(typo): accesible -> accessible

* fix(typo): explicitely -> explicitly
2022-03-28 22:53:51 -05:00
JJ Kasper
88a7e58406
v12.1.3-canary.0 2022-03-28 18:33:56 -05:00
Seth Falco
ad7cb3b207
fix: don't override user-agent in fetch if specified (#35547)
* fix: don't override user-agent in fetch if specified

* Add test for fetch user-agent in middleware

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-03-28 18:04:21 -05:00
OJ Kwon
abfbf41eec
test(integration): emit console error when test fails (#35507)
Minor improvements to the integration test runner to emit process's stdout when its execution failed.

We have `console.log` for the output, but it doesn't emit actually since jest suppresses console output unlesss _assertion_ fails. If we throws in `before*` hook, since there's no actual assertion fails jest won't release captured console logs.

PR adds one straightforward workaround (https://stackoverflow.com/questions/48695717/console-log-statements-output-nothing-at-all-in-jest) to emit if process exits with non-zero errorcode. To avoid any existing behavior, this is not enabled for the cases when process successfully exits.

## 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`
- [x] 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-03-28 21:46:56 +00:00
Naoyuki Kanezawa
53d1b00c7f
fix the dynamic routing of middleware (#32601)
* fix the dynamic routing of middleware

* add middleware to dynamicRoutes of routes-manifest

* remove unused import

* fix middleware routing with static paths

* update manifest version test

* prevent to match with api route using regex

* use iterator instead of generator

* do not use Iterator

* fix type

* fix type

* remove unused import

* apply the fix for support colons

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-03-28 16:16:43 -05:00
Luis Alvarez D
5d1f33f5c4
Add deprecated JSDoc comments for the previous middleware signature (#35448)
Something I noticed while using Middleware is that the older and no longer working methods are still accessible for the `event` with autocompletion because of their types, and the way of knowing they're deprecated is by running the app and seeing the error message, this should improve that when coding in tools like VS Code.

## 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
- [x] 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: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-03-28 21:15:08 +00:00
JJ Kasper
6a4c70e051
Update default test timeouts for yarn install times (#35669)
This updates our default test times as discussed to account for longer `yarn install` times for the isolated tests as GitHub actions network can be slow. 

x-ref: https://github.com/vercel/next.js/pull/35507#issuecomment-1074606737
x-ref: [slack thread](https://vercel.slack.com/archives/CGU8HUTUH/p1647919982840099)
2022-03-28 20:46:01 +00:00
JJ Kasper
3d5a9bf5e7
Fix next info test during stable release (#35668) 2022-03-28 15:23:39 -05:00
JJ Kasper
50be7cc17d
v12.1.2 2022-03-28 13:56:02 -05:00
JJ Kasper
825425494a
v12.1.2-canary.1 2022-03-28 13:08:22 -05:00
JJ Kasper
12e1bb7d32
Ensure eslint plugins dont conflict (#35667) 2022-03-28 12:31:30 -05:00
Tim Neutkens
65680ba3cb
Rename createRSCHook to createFlightHook (#35665)
Updates the naming of these to be in line with what it does.

## 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-03-28 16:27:50 +00:00
Luis Alvarez D
ab119bcc79
Update middleware examples list (#35622)
Logging and analytics are not provided in vercel/examples using middleware.



## 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-03-28 16:05:58 +00:00
Shu Ding
f5917ad3ee
Fix server component render condition (#35663)
We are currently using `!!ComponentMod.__next_rsc__` as the hint for the renderer to tell if the component is a server component, however that export field (`__next_rsc__`) is assigned to client components (`.client.[ext]`) as well. 

This PR adds a new `__next_rsc_server__` field which is only true when the component is a server component so the renderer can handle client components correctly.

## 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-03-28 14:24:57 +00:00
Jiachi Liu
41a2eb2303
Clean up legacy react 18 tests (#35615)
### source changes
* Error dynamic suspense option in non concurrent mode, don't check react root anymore since they should be bound

### tests changes

* Remove duplicated rsc client test
* Merge type checking cases (`next/dynamic`)
* Remove blocking rendering tests cases since we should opt-in Fizz rendering when using React.lazy
* Remove some thrown promises cases, leverage the streaming component we had in RSC test
2022-03-28 12:32:34 +00:00
Jiachi Liu
4bfcf8345c
enhance: detect ESM by ast type (#35627)
Simplify the esmodule detection. If there's any import/exprt usage, it will return `Module` in ast.type otherwise `Script` when `isModule` is set to `"unknown"`
2022-03-28 11:34:32 +00:00
TianenPang
0d401ddcb5
Fix typo in rewrites docs (#35639)
Correct the type of `trailingSlash` in config example

Modified: `docs/api-reference/next.config.js/rewrites.md`

```diff
- trailingSlash: 'true',
+ trailingSlash: true,
```
2022-03-27 18:15:08 +00:00
JJ Kasper
086cf91ada
v12.1.2-canary.0 2022-03-26 22:32:33 -05:00
Shu Ding
bb6ea6399d
Fix hydration issue in the switchable runtime tests (#35616)
In this test we are mainly focusing on the SSR'd result so hydration is't critical, but it will definitely help to get rid of these hydration errors.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] 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-03-27 01:02:17 +00:00
Jiachi Liu
27d23f5b7b
docs: update styling support for streaming (#35375)
## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-03-26 20:19:21 +00:00
Jiachi Liu
b82f546526
Fix: disable script worker in edge and fix rsc loader and runtime (#35604)
* Disable script worker for edge runtime (could lead to build error)
* Fix rsc loader CJS detection
* Fix pagePath searching for per-page runtime

test through rsc notes demo, successful deployment: https://next-rsc-notes-9bix7l1nu.vercel.sh/
2022-03-26 09:28:14 +00:00
LongYinan
24c0fc0169
Prevent spaces between expressions from being removed (#35613)
fixes https://github.com/vercel/next.js/issues/35609

## 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 by running `yarn lint`


Co-authored-by: John Daly <1719443+JohnDaly@users.noreply.github.com>
2022-03-26 09:05:01 +00:00
JJ Kasper
3a313a4ca6
Fix create-next-app failing without yarn installed (#35608)
This fixes our package manager detection which was changed slightly in https://github.com/vercel/next.js/pull/34947 for `pnpm` support to ensure the default case still attempts detecting the available package manager if no preference is specified in the command args. This also adds a test case to ensure the install succeeds when we fail to detect a valid `yarn` binary and no preference is set via the `npm_config_user_agent` env variable. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/35607
Fixes: https://github.com/vercel/next.js/issues/35599
2022-03-26 08:29:52 +00:00
Jiachi Liu
d41f8a5ecf
Update terminal tree view for switchable runtime (#35394)
* Update terminal tree view for switchable runtime

* share PageRuntime type

* fix lint
2022-03-26 02:19:51 +01:00
Shu Ding
4f6bb5e4fa
Revert "Revert "Make concurrent features independent from the global runtime option"" (#35490)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2022-03-26 00:05:35 +01:00
Jiachi Liu
d5e122594d
Update rsc refresh typing and doc example (#35543)
* Update rsc refresh typing and doc example

* Update docs/api-reference/next/streaming.md

Co-authored-by: Shu Ding <g@shud.in>

Co-authored-by: Shu Ding <g@shud.in>
2022-03-25 22:54:07 +01:00
Jiachi Liu
4e8e191a6e
RSC: handle commonjs in flight loader (#35563)
We need to handle cjs cases for client/server components when they're compiled to commonjs in some cases.
e.g. if there's an internal `_app.server.js` in nextjs, the assets in the dist files are compiled to cjs by swc. Or any 3rd party libraries are consumed could be cjs only.

### How it works

* Detect the source file is ESM or CJS first by detect if there's any ESM import/export
* Append the new exports or collect exports info based on the module type
2022-03-25 21:17:33 +00:00
JJ Kasper
79a8651bc4
v12.1.1 2022-03-25 11:45:19 -05:00
JJ Kasper
a5540e8fda
v12.1.1-canary.18 2022-03-25 10:32:52 -05:00
CommanderRoot
b21e3c258e
test: warn on substr() usage (#35499)
* test: warn on substr() usage

Don't allow any new substr() usage after #35421

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>

* Apply suggestions from code review

* Use slice in router-utils

Co-authored-by: Steven <steven@ceriously.com>
2022-03-24 18:35:33 -04:00
CommanderRoot
db2567b01b
chore: replace deprecated String.prototype.substr() (#35421)
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated
Signed-off-by: Tobias Speicher <rootcommander@gmail.com>

Co-authored-by: Steven <steven@ceriously.com>
2022-03-24 17:49:38 -04:00
hiro
f16ee05f59
Fix typo in docs (#35561)
The following files have been modified.

- `docs/api-reference/next.config.js/rewrites.md`
- `docs/basic-features/script.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-03-24 01:02:40 +00:00
Steven
ef7b53528f
Fix next info accidentally printing stderr (#35556)
I noticed a few issues that had "Output from `next info`" with the first line as

```
/bin/sh: pnpm: command not found
```

This was because `execSync()` was still printing to stderr when a command was not found.

Changing to `execFileSync()` fixed it so we no longer print to stderr when a command is not found.
2022-03-23 22:33:47 +00:00
LongYinan
59905c1001
Fix styled transform in next-swc/emotion (#35527)
Fix https://github.com/vercel/next.js/issues/35525



## 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 by running `yarn lint`
2022-03-23 20:47:44 +00:00
Shu Ding
ebe1b4cb47
Upgrade react-server-dom-webpack (#35524)
There're some changes since our last update that we'll need (e.g. server context).

## 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-03-23 19:20:36 +00:00
JJ Kasper
432261a1e1
Add link for revalidate from notFound section (#35553) 2022-03-23 13:43:12 -05:00
Jiachi Liu
2cf6696fff
Merge rsc queries handling (#35545)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-03-23 16:19:58 +01:00
JJ Kasper
9fef0d55da
Normalize ssgCacheKey for /index with minimalMode de-duping (#35536)
* Normalize ssgCacheKey for /index

* apply test changes to i18n suite as well
2022-03-23 09:28:04 -05:00
JJ Kasper
72478c5c80
Update next/link error when no children are provided (#35453)
* Update next/link error when no children are provided

* update manifest

* Apply suggestions from code review

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-03-22 13:58:55 -05:00
Malte Ubl
6da769129e
Reduce hello-world middleware bundle size from 128k to 88k (#35512)
Moves two utility functions from `server/router.ts` into their own file. This avoids the middleware pulling in the full Next.js router into its bundle.

There are probably more opportunities like this, but this is a good start. Middleware should likely be bundled by a non-chunking optimizing compiler.
2022-03-22 14:54:05 +00:00
Heyang Zhou
860c97ccf5
SWC import modularization plugin (#34969) 2022-03-22 14:20:57 +01:00
Steven
78831c3c84 v12.1.1-canary.17 2022-03-22 09:00:31 -04:00
JJ Kasper
a2accb2299
Update trace ignore check to check reasons correctly (#35511) 2022-03-22 00:03:42 -05:00
OJ Kwon
c261924756
feat(telemetry): report swc target triple to telemetry (#35420) 2022-03-21 17:09:03 -07:00