Commit graph

8871 commits

Author SHA1 Message Date
Tobias Koppers
e3e7e0840d
update webpack to 5.49.0 (#27813)
https://github.com/webpack/webpack/releases/tag/v5.49.0
2021-08-06 12:49:21 +00:00
Abdullah
c6a08f51b1
fix wrong link in readme (#27802)
## 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
2021-08-05 21:49:33 +00:00
Houssein Djirdeh
3e7fc0efac
Updates Aurora team members in labeler (#27795)
* updates Aurora team members in labeler

* lint-fix


Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-08-05 14:50:31 -05:00
Steven
88a904a381
Remove codeowners from examples (#27798)
This PR will reduce noisy notifications
2021-08-05 19:41:49 +00:00
Jiachi Liu
567d47b65c
Upgrade styled-jsx (#27782)
* Update styed-jsx to latest version, containing bugfixes for babel plugin and typings.
* Use `/// <reference>` instead of redeclaring types


## 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
2021-08-05 18:04:38 +00:00
JJ Kasper
fa01a1593e
Update client error to show link in console (#27789)
* Update client error to show link in console

* Apply suggestions from code review
2021-08-05 10:38:06 -05:00
Sjors Smits
d313855978
Wrap last return statement in else to fix tree shaking (#27788)
## Bug

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

fixes #27744
2021-08-05 13:34:22 +00:00
Orta Therox
504d478351
Minor typo fix in the @next/mdx README (#27784)
N/a
2021-08-05 09:02:38 +00:00
JJ Kasper
f15d05754d
v11.0.2-canary.26 2021-08-04 22:15:26 -05:00
Houssein Djirdeh
df83ccb7cd
[ESLint] Documentation updates + bug fixes (#26331)
Documentation:

- Expands the "Migrating Existing Config" section of ESLint doc to explain in more detail
- Minor changes to the "Ignoring ESLint" doc

Bug fixes:

- Adds `browser` and `node` environments to `eslint-config-next`. Closes #26319
- Fixes `no-document-import` rule. Closes #26159
- Fixes `no-page-custom-font` rule. Closes #26160 #26894
2021-08-05 00:58:06 +00:00
Nick Kelly
0593dbb260
remove unecessary fs.stat calls from recursive-readdir (#27769)
## Performance improvement

- [x] Performance improvement

Removes unnecessary `fs.stat` calls in `recursiveReadDir`.

`fs.readdir` had an option `withFileTypes: boolean` added NodeJS version 10. It can be used to read the directory contents and fetch its stats simultaneously, removing the need to read individual file stats after reading the directory contents.
2021-08-04 23:06:06 +00:00
Houssein Djirdeh
7a1c9eb17e
[ESLint] Introduce a new setup process when next lint is run for the first time (#26584)
This PR introduces an improved developer experience when `next lint` is run for the first time.

### Current behavior

`eslint-config-next` is a required package that must be installed before proceeding with `next lint` or `next build`:

![image](https://user-images.githubusercontent.com/12476932/123468791-43088100-d5c0-11eb-9ad0-5beb80b6c968.png)

Although this has helped many developers start using the new ESLint config, this has also resulted in a few issues:

- Users are required to install the full config (`eslint-config-next`) even if they do not use it or use the Next.js plugin directly (`eslint-plugin-next`).
  - #26348

- There's some confusion  on why `eslint-config-next` needs to be installed or how it should be used instead of `eslint-plugin-next`.
  - #26574
  - #26475
  - #26438

### New behavior

Instead of enforcing `eslint-config-next` as a required package, this PR prompts the user by asking what config they would like to start. This happens when `next lint` is run for the first time **and** if no ESLint configuration is detected in the application.

<img src="https://user-images.githubusercontent.com/12476932/124331177-e1668a80-db5c-11eb-8915-38d3dc20f5d4.gif" width="800" />

- The CLI will take care of installing `eslint` or `eslint-config-next` if either is not already installed
- Users now have the option to choose between a strict configuration (`next/core-web-vitals`) or just the base configuration (`next`)
- For users that decide to create their own ESLint configuration, or already have an existing one, **installing `eslint-config-next` will not be a requirement for `next lint` or `next build` to run**. A warning message will just show if the Next.js ESLint plugin is not detected in an ESLint config. 

  <img width="682" alt="Screen Shot 2021-06-25 at 3 02 12 PM" src="https://user-images.githubusercontent.com/12476932/123473329-6cc4a680-d5c6-11eb-9a57-d5c0b89a2732.png">

---

In addition, this PR also:

- Fixes #26348
- Updates documentation to make it more clear what approach to take for new and existing ESLint configurations
2021-08-04 21:53:15 +00:00
Artyom Kurnikov
8724352b25
Update Fauna example to create Fauna resources properly (#27757)
- fix `with-fauna` example to populate client secret properly when auto-deploy on changes happens
- improve security by avoiding usage of the `FAUNA_ADMIN_KEY` in the application, now it's used in the setup script only
2021-08-04 20:37:12 +00:00
JJ Kasper
bce06f500d
Update has query encoding when used in path (#27762)
This is a follow-up to https://github.com/vercel/next.js/pull/26963 which after discussion changes to interpolate the decoded variant of the value into the path. 

x-ref: https://github.com/vercel/next.js/issues/24775

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-08-04 20:31:12 +00:00
Steven
2061d6c4fe
Fix html validation for Image component sizer (#27767)
According to [MDN](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-hidden_attribute#deciding_between_aria-hiddentrue_rolepresentation_and_rolenone):


- `aria-hidden="true"` will remove the entire element from the accessibility API. 
- `role="presentation"` will remove the semantic meaning of an element while still exposing it to assistive technology. 

We don't need both so we'll keep `aria-hidden="true"` since the element is used for sizing, not content that should be read.

Fixes #27163
2021-08-04 18:42:59 +00:00
Steven
3ab5d600d3
Add missing removeHeader() function to image optimizer mock res (#27763)
- Related to #27724 
- Related to #19309 
- Related to #23140
2021-08-04 17:01:20 +00:00
Christian
d368f76b4d
Add a note about the existence of 'next/script' (#27725)
For users looking at the api reference for 'next/head' it might be a good idea to let them know that there is the 'next/script' component. Using 'next/script' has a lot of advantages over adding a script tag with 'next/head'

## Documentation / Examples

- [x] Make sure the linting passes
2021-08-03 21:07:58 +00:00
Maia Teegarden
204445ff2f
Add/amp attribute patcher (#27700)
* Add amp attribute transform

* Add amp attribute unit tests

* Fix ci if statements

* Checkout code in rust tests

* Add rust fixtures to eslintignore

* Add cargo config

* Configure toolchain for cross compilation
2021-08-03 09:54:57 -07:00
JJ Kasper
4ab41efdbf
Add handling for repeated slashes (#27738)
This adds handling for repeated forward/back slashes in Next.js, when these slashes are detected in a request to Next.js we will automatically remove the additional slashes redirecting with a 308 status code which prevents duplicate content when being crawled by search engines. 

Fixes: https://github.com/vercel/next.js/issues/13011
Fixes: https://github.com/vercel/next.js/issues/23772
Closes: https://github.com/vercel/next.js/pull/15171
Closes: https://github.com/vercel/next.js/pull/25745
2021-08-03 15:06:26 +00:00
강동윤
61586eda6a
Port next-ssg getStaticProps/getServerSideProps tree shaking Babel transform to rust (#27552) 2021-08-03 14:02:23 +02:00
stefanprobst
5ded742395
move next/script to pages/_app in script loader integration tests (#27626) 2021-08-03 14:01:03 +02:00
Lee Robinson
28c13bd547
Rename environment variable in Fauna example. (#27712)
To make it more clear you're using the admin key on the server.
2021-08-03 02:40:02 +00:00
Tom Chen
aa929c4bee
Fix create-strapi-app instruction in strapi example (#27707)
Need `--template` in the `yarn` command, otherwise it's not working
2021-08-03 02:08:15 +00:00
JJ Kasper
ca0c122f63
v11.0.2-canary.25 2021-08-02 20:00:21 -05:00
Sergio
bace9b4949
Add with-joi example (#25759)
* Add joi and next-joi example

* Add more README information

* Update examples/with-joi/package.json

Co-authored-by: Lee Robinson <me@leerob.io>

* Update all dependencies to latest

Co-authored-by: Lee Robinson <me@leerob.io>
2021-08-02 19:43:07 -05:00
Steven
46e7658f7e
Add next.config.js option to override default keepAlive (#27709)
Follow up to #27376 so users can disable keep-alive.

See comment https://github.com/vercel/next.js/pull/27376#issuecomment-885415623
2021-08-03 00:38:42 +00:00
Tobias Koppers
b36c66a40f
update webpack-sources to 3.2.0 for bugfixes and performance (#27673) 2021-08-03 00:01:43 +00:00
Steven
b05cdb1f64
Add naturalWidth/naturalHeight to onLoadingComplete() callback (#27695)
Resolves #27213
2021-08-02 23:14:38 +00:00
JJ Kasper
b3c959b2c2
Enforce source/destination limit for custom routes (#27703)
This ensures we enforce a limit for `source`/`destination` values on rewrites, redirects, and headers since these being too long can affect routing performance. 

Closes: https://github.com/vercel/next.js/issues/27696
2021-08-02 22:34:44 +00:00
Gerald Monaco
79e30f9cb6
More React 17 clean up (#26775)
Remove unnecessary `React.Suspense` checks, as the minimum supported version is `react@>=17.0.1`. Also removes some files from the `react-18` integration test that are no longer necessary as of #26664.
2021-08-02 19:14:31 +00:00
Lee Robinson
3c984dc5cf
Patch with-fauna example. (#27701)
A few things I noticed when deploying the example.
2021-08-02 18:01:26 +00:00
Artyom Kurnikov
fe3f520d8d
Update Fauna example with new guestbook (#27295)
Based on https://github.com/vercel/next.js/pull/26708

- Renames FaunaDB -> Fauna
- Moves to Tailwind instead of bespoke styling
- Use SWR instead of hand-rolled fetch wrapper
- List/Create API for Guestbook
- Preps for setting correct environment variables from Vercel integration
2021-08-02 17:09:04 +00:00
stefanprobst
63aeddbbe0
URI-encode url parameter in image optimizer (#27671)
fixes #27210
maybe related: #19668

currently, the image optimizer returns 400 when an image url contains non-ascii characters. this pr uri-encodes the `url` query parameter to fix it. also see https://github.com/vercel/next.js/issues/27210#issuecomment-890305204

## Bug

- [x] 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
2021-08-02 17:03:45 +00:00
Lee Robinson
74503f1b8a
Improve custom server documentation. (#27693)
Based on feedback here https://github.com/vercel/next.js/discussions/27687#discussioncomment-1121013.
2021-08-02 16:17:27 +00:00
JJ Kasper
26981aa54c
Undo sourcemap change (#27690)
This undoes the change from https://github.com/vercel/next.js/pull/27623 since it appears to be breaking source maps from changing the sources field in the generated source map to a relative path causing it to break jest's source map handling as can be seen in the `test-unit` CI job [here](https://github.com/vercel/next.js/runs/3214076727). 

This reverts commit f9ebc7772f.
2021-08-02 15:45:39 +00:00
James Howard
2cf58be228
Add missing await for API request (#27676)
`getAllPostsWithSlug` was missing an `await` on `fetchAPI`, resulting
in `data?.allPosts` always returning `undefined`. This meant SSG wasn't
aware of the paths it needed to generate.
2021-08-02 12:59:53 +00:00
Zack Sheppard
807d1ec7ef
Clarify in docs that next/script must not be in next/head (#27534)
Documentation to help future developers avoid #27498 

## Documentation / Examples

- [X] Make sure the linting passes
2021-08-01 14:26:33 +00:00
Tim Neutkens
f9ebc7772f
Ensure Next.js core development sourcemaps use correct input file (#27623)
Noticed while debugging that the error output lines did not make sense and found that `sourceFileName` is not supported in SWC yet. This is a temporary fix until @kdy1 adds the option.
2021-08-01 16:08:06 +02:00
JJ Kasper
c0bb1bc82c
Fix incorrect example in headers and rewrites docs (#27652)
x-ref: https://github.com/vercel/next.js/issues/22660#issuecomment-890400273

## Documentation / Examples

- [x] Make sure the linting passes
2021-07-31 21:53:47 +00:00
Sjors Smits
34d418c12d
[docs] Added per page layout example with TypeScript (#27488)
## Documentation / Examples

- [x] Make sure the linting passes

## Explanation
Fixes #27465 

I added some docs on how to use per page persistent layouts in TypeScript as this requires you to extend some types and it might not be trivial if you are just starting out with TypeScript.

I copied the js example so it might be better to remove some of the duplication where possible, let me know.
All feedback is welcome
2021-07-30 16:30:32 +00:00
JJ Kasper
dd7a54c509
v11.0.2-canary.24 2021-07-29 21:15:13 -05:00
Tim van de Vathorst
282ee8c9d0
Added missing 'create user' functionality (#27516)
I was trying to run the demo locally and found out that the create user function was missing, so I added it!

## Documentation / Examples

- [ ✔ ] Make sure the linting passes
2021-07-29 22:16:55 +00:00
Jiachi Liu
a6e478f9ed
Use require alias to resolve react 18 for testing (#27601)
For test only, previously the react-dom is still been resolved as react 17

## 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
2021-07-29 20:06:13 +00:00
Tim Neutkens
e6d12a9d94
Update Terser (#27600)
Fixes #27593



## 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
2021-07-29 18:08:14 +00:00
Tim Neutkens
77c385af06
Update report to leverage new variables (#27084)
## 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
2021-07-29 17:35:25 +00:00
Tobias Koppers
fabaaa903a
persistent cache need to be invalidated when source-maps are enabled (#27607) 2021-07-29 16:59:41 +00:00
Tobias Koppers
4b33cef977
upgrade to webpack 5.47.0 and webpack-sources 3.1.1 (#27538)
* improve source-map performance
* improve watch performance
* bugfixes
* improvements to Data URIs
2021-07-29 16:10:51 +00:00
JJ Kasper
f5ee9ed5af
Only output test logs on failure in CI (#27604)
This updates to only output a test's logs when it fails to reduce the noise in the CI's logs to allow easier investigating a failure. This also updates azure to leverage the `run-tests` script when testing ie11 to allow retrying similar to our other tests.
2021-07-29 15:35:13 +00:00
JJ Kasper
c63bfbe773
v11.0.2-canary.23 2021-07-28 15:19:07 -05:00
stefanprobst
0833f83c86
Fix eslint config next/core-web-vitals (#27567)
fixes what i messed up in #27363. cf. https://github.com/vercel/next.js/pull/27363#issuecomment-888495697

also added an integration test for extending from `next/core-web-vitals` eslint config

## Bug

- [x] 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
2021-07-28 19:07:54 +00:00