Commit graph

10735 commits

Author SHA1 Message Date
JJ Kasper
1b17070a29
v12.1.1-canary.6 2022-03-02 12:12:15 -08:00
Steven
65e704daa4
Fix next/image noscript when blur and priority (#34973)
Fixes a bug where browsers with scripts disabled did not work with `<Image placeholder="blur" priority />`.

- Introduced in #32918
2022-03-02 19:59:02 +00:00
Shu Ding
a518036246
Refactor export marks of server components (#34945)
* refactor rsc export marks

* fix failed test
2022-03-02 19:29:54 +01:00
Jiachi Liu
d9d494adaf
Provide page runtime parsing utils (#34922)
* parse runtime config

* add test

* fix typing

* fix lint warning

* change branch purging condition

* dont fallback to global runtime
2022-03-02 09:41:41 -08:00
Gal Schlezinger
7b2fb70a67
Expose WASM bindings in Middleware (#34437)
This PR introduces a way to use WASM in middlewares.
Next.js will find all `.wasm` imports in middlewares and load them as `WebAssembly.Module` objects, which then can be later instantiated.
The metadata will be stored in `middleware-manifest.json`

## 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-02 15:09:36 +00:00
Sacha
b579a35e83
[examples] Update styled-components to use SWC (#34770)
* rename example with-styled-components to with-styled-components-babel

* update with-styled-components references

* update docs on react hydratation erros for styled components

* clone with-styled-components-babel without babel config

* add styledComponents to compiler options in next.config

* replace babel dependency with Next.js SWC compiler

* upgrade example typescript version

example with-typescript-styled-components had a typescript dependency
lower than the recommended version. Upgraded from 4.2.4 to 4.5.5.

* Apply suggestions from code review

* update readme for with-styled-components-babel

remove Notes section since it describes a workaround which is no longer
required to work with `next/link`.

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-03-02 03:43:34 +01:00
Lydia Hallie
abe4936701
Update cms-wordpress example (#34944)
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-03-02 01:48:05 +00:00
Cody Olsen
21c07ebf9e
docs: update cms-sanity example (#34898)
Upgrades `next-sanity` to the latest version and applies breaking changes.
Improves the docs for the Sanity example.

## Documentation / Examples

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



Co-authored-by: even westvang <172952+evenwestvang@users.noreply.github.com>
2022-03-01 23:42:00 +00:00
Shu Ding
9c0c93eb16
Optimize component type filters (#34941)
Since we are applying this loader to more files, and these two simple RegExp filters will be executed ~70 times per entry, it's an easy optimization to move the RegExp creation outside and merge related testers into the RegExp.

## 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-01 23:28:34 +00:00
JJ Kasper
b6b5250c46
Ensure non-matching API routes can be rewritten (#33966)
This ensures non-matching API routes can be rewritten with i18n configured as currently we bail and render the 404 page when a locale prefixed API route is requested. 

## Bug

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

x-ref: [slack thread](https://vercel.slack.com/archives/CGU8HUTUH/p1643930049224689)
closes: https://github.com/vercel/next.js/issues/28921
2022-03-01 15:53:25 -05:00
Jiachi Liu
7c1a51a94f
Refactor next-flight-server-loader (#34902) 2022-03-01 10:27:59 -08:00
JJ Kasper
abed2f7334
v12.1.1-canary.5 2022-03-01 09:56:23 -08:00
Donny/강동윤
6814852ffa
feat(next-swc): Update swc (#34878)
* Update swc

* lockfile

* Update more swc crates

* Update minifier

* chore: update types

* style: fix

* Update deps

Co-authored-by: evilebottnawi <sheo13666q@gmail.com>
2022-03-01 09:41:31 -08:00
Sigurd Spieckermann
721dc7bccd
Add missing closing parenthesis in docs (#34924)
A closing parenthesis was missing in the docs about static HTML export.
2022-03-01 16:48:08 +00:00
Steven
0816b775b8
Fix image optimization invalid internal upstream image (#34899)
This gracefully handles errors when the `url` query string param looks like an internal image because it starts with `/` but it is not pointing to an internal image.

Previously, this was printing an unnecessary stack trace when the upstream content-type was undefined.

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-03-01 16:38:51 +00:00
Cody Olsen
6b37d6c39e
docs: update CMS examples to use the new tw grid gaps (#34917) 2022-03-01 07:47:28 -06:00
Jiachi Liu
57702cb2a9
Only warn styles and scripts under next head in concurrent mode (#34897)
x-ref: #34021 , #34004

Only log each warning once and only trigger in concurrent mode


## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
2022-02-28 22:39:51 +00:00
Jiachi Liu
8e3b6fc4b9
Fix only byte stream writing is allowed in CF workers (#34893)
CF worker doesn't allow to use `writer.write(string)` but only byte stream, we have to transform the Uint8Array stream

![image](https://user-images.githubusercontent.com/4800338/156043536-25fcdb15-3f69-427e-9e31-97169609eb7a.png)
2022-02-28 21:57:08 +00:00
Sukka
7ca78dd036
refactor: re-use existed escapeRegex (#34470)
## 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`

`escape-regex.ts` will always be included in the bundle, so not re-using it actually makes the size larger.
2022-02-28 19:50:57 +00:00
JJ Kasper
7f9b476341
Update to use whatwg validator for test (#34891)
The w3c validator seems to be down and this shouldn't block our tests so this uses the whatwg validator instead

x-ref: https://github.com/vercel/next.js/runs/5361585193?check_suite_focus=true
x-ref: https://github.com/vercel/next.js/runs/5356851471?check_suite_focus=true
x-ref: https://github.com/vercel/next.js/runs/5361463120?check_suite_focus=true
2022-02-28 19:24:42 +00:00
Alessandro
281ef22eba
Fix broken link in react-18 streaming docs. (#34884)
A link leads to a 404 page due to a missing  `/ `
2022-02-28 15:09:09 +00:00
Shu Ding
8ba2aec022
Fix flight loader for shared components (#34692)
* fix flight loader for shared components

* add tests

* fix condition
2022-02-28 16:00:28 +01:00
Lee Robinson
175e081e86
Improve TypeScript documentation. (#34690)
- Moves example out of hidden dropdown at the top and features more prominently
- Adds a clone and deploy link for those looking to get started immediately
- Cross-posts ignoring TS errors docs over, because I've personally assumed it should be on this page and then ctrl+f found nothing
- Added version history to the top, based on contents of this file
- Remove custom app caveats from code snippet to improve copy-paste ability
2022-02-28 08:32:27 +00:00
JJ Kasper
ed43c03ebb
Add CLI command typo detection (#34836)
* Add CLI command typo detection

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>
2022-02-26 07:05:26 -08:00
JJ Kasper
0aba3072cc
Fix issues in getStaticPaths docs (#34840) 2022-02-25 20:36:05 -08:00
JJ Kasper
ec2a88516d
v12.1.1-canary.4 2022-02-25 18:48:08 -08:00
Alex Kolarski
89c9ce8edf
Update eslint-plugin-react to latest version (#34819)
* Update eslint-plugin-react to latest version

There is currently a bug in eslint-plugin-react https://github.com/yannickcr/eslint-plugin-react/issues/3215.
The bug was just fixed in 7.29.1

* update lockfile

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-02-25 18:22:41 -08:00
JJ Kasper
70ddd154ca
Update test concurrency for CI (#34827)
As discussed [in slack](https://vercel.slack.com/archives/C5MDPQUBU/p1645742977019439?thread_ts=1645562784.286099&cid=C5MDPQUBU) we have more concurrency available to us now and we are currently reaching almost 40 minutes for tests in CI so this parallelizes our jobs more to decrease our test times and leverage this additional concurrency. This brings our CI times closer to around 12 - 15 minutes.
2022-02-25 23:36:25 +00:00
JJ Kasper
c947c93206
Ensure unstable_revalidate does not error from notFound: true (#34826)
* Ensure unstable_revalidate does not error from notFound: true

* add more cache header tests
2022-02-25 14:17:07 -08:00
JJ Kasper
d118d024f7
Clean-up error when starting next with non-existent dir (#34830) 2022-02-25 14:08:08 -08:00
JJ Kasper
1cf2cc8809
lock eslint-config-next dependencies (#34823) 2022-02-25 12:21:01 -08:00
JJ Kasper
d09fb1dc08
Add warning for Yarn PnP v3 with Node.js < 16.14 (#34818)
* Add warning for Yarn PnP v3 with Node.js < 16.14

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

* lint-fix

Co-authored-by: Steven <steven@ceriously.com>
2022-02-25 11:54:12 -08:00
JJ Kasper
35a1af4cf4
Add redirect for error doc rename (#34791) 2022-02-25 11:09:04 -08:00
JJ Kasper
e6f14fa456
Update to ncc dev overlay during build instead of pre-compile (#34813)
* Update to ncc dev overlay during build instead of pre-compile

* update config
2022-02-25 11:02:48 -08:00
Andrew Hollenbach
0ec57da3a9
Update inlineCode reference (#34817)
Howdy!

MDX no longer has an `inlineCode` component in their MDXProvider ([source](https://mdxjs.com/table-of-components/)). They've migrated to a `pre` component for blocks of code and a `code` component for inline code snippets, so I've updated the example to reflect this.

I validated this locally with these example components:

```jsx
const Code = (props) => (
  <code>
    {props.children}
  </code>
);

const Pre = (props) => (
  <pre>
    {props.children}
  </pre>
);

const components = {
  pre: Pre,
  code: Code,
  ...
};
```

Applied to a test `mdx` file:

```md
This is an `inline` example.

~~~
<p>Test code</p>
~~~
```

Which generates the following html:

```html
<p>This is an <code>inline</code> example.</p>
<pre>
  <code>&lt;p&gt;Test code&lt;/p&gt;</code>
</pre>
```

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-02-25 18:41:05 +00:00
Aman Mittal
f32fd48ee7
Add Error Handling document (#34329)
* Add Error Handling document

* Update error-handling.md

* Add more services on client errors after Jeff's recommendation

* Update docs/advanced-features/error-handling.md

Co-authored-by: Steven <steven@ceriously.com>

* Update docs/advanced-features/error-handling.md

Co-authored-by: Steven <steven@ceriously.com>

* Update error-handling.md

* Add info about handling file not found error

* Add a screenshot of overlay when in development mode

Co-authored-by: Steven <steven@ceriously.com>
2022-02-25 11:34:00 -05:00
Eugene
3d5dd58251
fix: #34711 ensure distDir inside project folder (#34795)
Fixes https://github.com/vercel/next.js/issues/34711
2022-02-25 12:40:24 +00:00
Tim Neutkens
aecfe4dc49 v12.1.1-canary.3 2022-02-25 11:15:18 +01:00
Thibaut SABOT
99713baf3f
fix eslint-plugin-react version to avoid jsx-key error (#34800)
Fixes https://github.com/vercel/next.js/discussions/34797.

Context: https://github.com/yannickcr/eslint-plugin-react was released in 7.29.0 2h ago and breaks the linting of a default create-next-app.

See: https://github.com/yannickcr/eslint-plugin-react/issues/3215

This PR locks the version to the latest working one.
2022-02-25 10:12:38 +00:00
Lee Robinson
5ebee5f566
Some minor adjustments to MySQL example. (#34792) 2022-02-24 20:47:58 -08:00
Sukka
3ee458e376
fix(#34030): ignore non-checkable jsx spread attribute (#34473)
## Bug

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

Fixes #34030.

The PR is still WIP as the test case hasn't been added, help or change is welcome.

cc @no-ya @ijjk 

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-02-25 04:15:25 +00:00
Lee Robinson
fe312ed4bd
Update MySQL example. (#34784)
Changes from https://github.com/planetscale/nextjs-starter.

Realized the current example was not only out of date, but the demo was broken. Will update the demo site post-merge here 👍
2022-02-25 03:41:41 +00:00
Colin Rice
079b507327
Add API config to allow disabling response size warning (#34700)
Adds an API config option that disables warning a user when their API response body is over 4 megs. This has been added for users who'd like to stream larger amounts of data from their API acknowledging the drawbacks. This config mirrors the existing [`externalResolver` config](https://nextjs.org/docs/api-routes/api-middlewares#custom-config).

Closes: [#33162](https://github.com/vercel/next.js/issues/33162)

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-02-25 02:04:02 +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
Hassan El Mghari
ae2d901eed
Improve rewrites documentation (#34725)
This is a PR to update the rewrites documentation. This is after struggling to get rewrites to work with `trailingSlash` for a customer as this wasn't documented. The main culprit was the `:path*` wildcard not catching trailing slashes. The changes made to for this commit were:

- [x] Added example for redirecting to blog and docs
- [x] Expanded on original code example for external URLs
- [x] Added code example for using rewrites with `trailingSlash`

### Context

For a reproduction of the `:path*` wildcard not catching trailing slashes as expected, see below. Click on the "not working" demo link below, navigate to a specific blog post, then reload the page. It will redirect infinitely.

- [Not working demo of main repo with `:path*`](https://redirect-demo-git-not-working-nutlope.vercel.app/blog/)
- [Working demo of main repo with `:path(.+)`](https://redirect-demo.vercel.app/blog/)

If you want to take a look at the code, here are the full repos. They both have `trailingSlash: true`:

- [not working main repo](https://github.com/Nutlope/redirect-demo/tree/not-working) 
- [working main repo](https://github.com/Nutlope/redirect-demo)
- [blog repo](https://github.com/Nutlope/starter-blog-example)
2022-02-24 22:25:56 +00:00
Shu Ding
ceecf91225
Refactor entries generation in hot-reloader (#34733)
* refactor entries generation of hot-reloader

* change parameter name
2022-02-24 14:19:53 -08:00
Keen Yee Liau
fbb8536956
collect telemetry for ESLint rules (#34564)
This commit adds functionality to track usage of `@next/next/*` ESLint rules and their severity levels.

## 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`
- [x] Integration tests added
- [ ] Documentation added
- [x] 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-02-24 20:43:28 +00:00
Eungyeol
58ab94bef7
feat(create-next-app): add @types/react-dom to TS template (#34623)
* Add @types/react-dom devDependencies

* fix: eslint error

* fix: eslint error 2
2022-02-24 21:04:15 +01:00
Shu Ding
c9863c8794
Reduce the size of web server (#34767)
By moving `setRevalidateHeaders` to a separate file we can shake off the dependency of `etag` and a polyfill for `Buffer` from the web server (which brings hundreds of kilobytes).

## 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-02-24 19:53:17 +00:00
Gal Schlezinger
1a0d149c9f
produce source maps for middlewares (#34409)
This PR will generate source maps for middlewares. It's not under any flag (should it be?)

Closes #34523
2022-02-24 15:56:40 +00:00