Commit graph

1745 commits

Author SHA1 Message Date
JJ Kasper
ec9ed57487
Remove import type syntax (#25145)
* Remove import type syntax

* Update build-output test
2021-05-14 13:42:36 -05:00
Tobias Koppers
84d5766f43
Disable suggesting incremental type checking (#25144)
It have performance characteristics that might not work for everyone.
You can still enable it manually.
2021-05-14 19:08:06 +02:00
Tobias Koppers
0750092cf1
add experimental.gzipSize flag which allows to switch to uncompressed sizes (#25028)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2021-05-14 16:29:49 +02:00
Tim Neutkens
c1528e4f3d
Remove experimental-modern-preset option (#25100) 2021-05-14 15:55:24 +02:00
JJ Kasper
5bff9eac08
Ensure rewrites work with manual href/as correctly (#25112)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-05-14 12:50:41 +02:00
JJ Kasper
e6a05ee940
Fix export worker threads options (#25063)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-05-14 12:50:29 +02:00
Yamagishi Kazutoshi
7f73b65849
Escape href when detecting already existing preload tags (#20782)
When Image Optimization is enabled, if the URL of the image is not correct as a regular expression (e.g. `/image.png?lang=c++`), Next.js will give an error and fail to build.
2021-05-14 02:40:20 +00:00
Janicklas Ralph
eaf74c1cb8
Improving script loading strategy (#24939) 2021-05-13 12:39:36 +02:00
Tobias Koppers
5f3351dbb8
use official mini-css-extract-plugin and experimentalUseImportModule (#24573)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

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

## Documentation / Examples

- [ ] Make sure the linting passes
2021-05-12 16:04:01 +00:00
Janicklas Ralph
6ad9172295
Font optimization bug fix (#24968) 2021-05-12 13:39:26 +02:00
Janicklas Ralph
b859c5bdf5
Refactor scriptloader option names (#25012) 2021-05-12 13:37:57 +02:00
Yamagishi Kazutoshi
f97b82a252
Skip processing when href is not a simple string (#24986) 2021-05-11 16:47:36 +02:00
JJ Kasper
e00e3c978d
Ensure webpack cache is invalidated for alias change (#24956) 2021-05-10 17:29:33 -05:00
Houssein Djirdeh
6d0150f02e
ESLint Plugin: Prevent bad imports of next/document and next/head (#24832)
Adds lint rules to the Next.js ESLint plugin to:

- Disallow importing `next/head` inside `pages/_document.js`
- Disallow importing `next/document` outside of `pages/_document.js`

Both rules will be surfaced as **errors** within the recommended config of the plugin.

Fixes #13712 #13958
2021-05-10 21:28:06 +00:00
Houssein Djirdeh
44072205d8
ESLint Plugin: Custom Font at page-level rule (#24789)
Adds a lint rule warning to the Next.js ESLint plugin if a custom Google Font is added at page-level instead of with a custom document (`.document.js`)

_Note: This will be generalized to include more font providers in the near future._
2021-05-10 19:08:14 +00:00
Houssein Djirdeh
569da9d286
ESLint Plugin: passHref is not assigned (#24670)
Adds a lint rule warning to the Next.js ESLint plugin if `passHref=true` is not assigned for `<Link>` wrapping a custom component.

Fixes #23713
2021-05-10 18:35:11 +00:00
Luigi Colombi
59564af9cb
I18n context initial props (#21930)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-05-10 14:11:19 +02:00
Janicklas Ralph
86827058e4
Refactor experimental-script component (#24940) 2021-05-10 10:39:08 +02:00
Houssein Djirdeh
59d50ff76d
ESLint Plugin: Google Font rules (#24766) 2021-05-10 10:03:28 +02:00
Radosław Grochowski
7f1c8a9bbe
fix: handle compression for custom-server render calls (#16378) (#18891)
Co-authored-by: Radosław Grochowski <radoslaw.grochowski@grupawp.pl>
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2021-05-07 19:37:51 +02:00
JJ Kasper
9d25194e7d
Ensure next/dynamic transpiles for tests (#24751)
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2021-05-07 19:21:54 +02:00
Tobias Koppers
4e8fac93fd
cache typechecking with incremental compilation (#24559)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-05-07 19:21:20 +02:00
Tobias Koppers
33e09dffb2
webpack 5 externals fixes (#24603)
* fix check in externals that validate if the require is resolve-able for the server
* performance improvements

Fixes #23130

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added

## 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`
- [x] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
2021-05-07 16:32:33 +00:00
Houssein Djirdeh
656c2ef649
ESLint Plugin: Disallow <title> in Head from next/document (#24868)
Adds lint rule warning to the Next.js ESLint plugin to disallow `<title>` in `Head` imported from `next/document`.
2021-05-07 08:49:37 +00:00
C. Lewis
9c77cda6c5
feat(create-next-app): add --ts, --typescript support (#24655)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2021-05-07 10:08:16 +02:00
JJ Kasper
802af5ff5b
Land - Font optimizations - Adobe Fonts / Typekit support (#24834)
This updates this initial PR here https://github.com/vercel/next.js/pull/18146 to resolve merge conflicts and updates tests since we aren't able to update that PR itself.

## 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

Closes: https://github.com/vercel/next.js/pull/18146
2021-05-06 04:02:07 +00:00
Vitaly Baev
54ff3223b4
Don't throw 500 error when Content-type is invalid (#24818)
Fixes #24768

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
2021-05-05 14:27:44 +00:00
Tobias Koppers
1d643eb6e1
update webpack to 5.36.2, use dependOn (#24656)
* update webpack to 5.36.2
* use dependOn to optimize chunks
* disable vendor splitting for main and _app chunks

=> decreases bundle size in general, gets rid of the 2 extra vendor chunks shared by all pages.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

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

## Documentation / Examples

- [ ] Make sure the linting passes
2021-05-03 10:25:44 +00:00
Joon Park
c76170e829
Add experimental blurry placeholder to image component (#24153)
This is the image component implementation of the blurry placeholder as described in #24004. The matching server side implementation is currently planned.

## Feature

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] Related issue #18858 
- [x] Integration tests added

(Documentation and telemetry to follow after server side is implemented)
2021-04-30 17:05:03 +00:00
Ishank Sharma
9bbb968c43
Fix/link router 24075 take asPath instead of pathName in router (#24199)
Fixes: #24075

## Bug
 
- [X] Related issues linked using `fixes #number`
- [X] Integration tests added


## Documentation / Examples

- [x] Make sure the linting passes
2021-04-30 16:34:23 +00:00
Houssein Djirdeh
e783b0a2e8
Adds ESLint with default rule-set (#23702)
This PR re-includes ESLint with some notable changes, namely a guided setup similar to how TypeScript is instantiated in a Next.js application.

To add ESLint to a project, developers will have to create an `.eslintrc` file in the root of their project or add an empty `eslintConfig` object to their `package.json` file.

```js
touch .eslintrc
```

Then running `next build` will show instructions to install the required packages needed:

<img width="862" alt="Screen Shot 2021-04-19 at 7 38 27 PM" src="https://user-images.githubusercontent.com/12476932/115316182-dfd51b00-a146-11eb-830c-90bad20ed151.png">

Once installed and `next build` is run again, `.eslintrc` will be automatically configured to include the default config:

```json
{
  "extends": "next"
}
```

In addition to this change:

- The feature is now under the experimental flag and requires opt-in. After testing and feedback, it will be switched to the top-level namespace and turned on by default.
- A new ESLint shareable configuration package is included that can be extended in any application with `{ extends: 'next' }`
  - This default config extends recommended rule sets from [`eslint-plugin-react`](https://www.npmjs.com/package/eslint-plugin-react), [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks), and [`eslint-plugin-next`](https://www.npmjs.com/package/@next/eslint-plugin-next)
- All rules in [`eslint-plugin-next`](https://www.npmjs.com/package/@next/eslint-plugin-next) have been modified to include actionable links that show more information to help resolve each issue
2021-04-30 11:09:07 +00:00
Tim Neutkens
53c19ff185
Test fixes for Babel mode (#24312)
* Try enabling Babel turbo mode

* Pass config file explicitly to babel turbo loader.

* Update NextBabelLoaderOptions to use `configFile` instead of `babelrc`.

* Re-add support for options passed to next/babel preset with new babel loader.

* Load babel config files depending on their file extension.

* Include `next/babel` if no Babel config is provided.

* Minor cleanup.

* Avoid duplicate `next/babel` entries.

* No need to pass configFile anymore.

* Fix multiple small issues in merging loader opts with cached config.

* Remove redundant logging (that also breaks a test).

* Include file extension CharacteristicsGermaneToCaching.

* bump

* Disable turboMode now that tests pass

Co-authored-by: Dale Bustad <dale@divmain.com>
2021-04-28 11:51:57 +02:00
JJ Kasper
f3d518385c
Remove experimental note for has routes (#24529)
This removes the warnings/notes for the `has` custom-routes feature being experimental

## Documentation / Examples

- [x] Make sure the linting passes
2021-04-28 09:08:38 +00:00
JJ Kasper
efa58efd0c
Ensure stalled CSS triggers fallback navigation (#24488)
This ensures when CSS requests stall that they are included in the route load timeout so that stalled CSS requests don't block us from falling back to a hard navigation. This handles a rare case noticed by @pacocoursey where a transition did not complete while attempting to load CSS assets. 

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
2021-04-27 07:49:28 +00:00
Janicklas Ralph
fff183c4cd
Font optimization bug fix (#24162)
## Bug

- [x] Related issues linked using `fixes #23896`
- [x] Integration tests added

Fixes #23896
2021-04-26 18:30:21 +00:00
JJ Kasper
cac9ccf9ce
Ensure proxy rewrite does not hang on error (#24394)
* Ensure proxy rewrite does not hang on error

* remove logs

* Listen to req close
2021-04-26 08:40:32 -05:00
Gerald Monaco
40216be6a8
Workaround for discrete passive effects change (#24369)
This test is failing for the same reason as https://github.com/facebook/react/pull/21173, so we'll borrow their fix, and follow along for updates.
2021-04-23 14:28:59 +00:00
Joe Haddad
079c629165
experimental: remove legacy plugin system (#20759)
* chore: remove old plugins implementation

* chore: remove `onErrorMiddleware`

* Reduce allowed middleware

* remove collect plugins file

* remove old tests

* remove old demo packages
2021-04-22 14:03:13 -05:00
Gerald Monaco
cce82cd7bc
Fix side effects in router-is-ready tests (#24360)
Fixes the [failing react@experimental tests](https://github.com/vercel/next.js/actions/workflows/test_react_experimental.yml).
2021-04-22 17:20:39 +00:00
Shu Ding
6cd1c87451
Fix not exposing server errors in hot reloader (#24331)
Fixes #24056.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

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

## Documentation / Examples

- [ ] Make sure the linting passes
2021-04-22 11:47:15 +00:00
JJ Kasper
85d87a3795
Ensure dev overlay is triggered for more _app/_document errors (#24328)
This expands on https://github.com/vercel/next.js/issues/24070 and ensures we show the dev overlay for additional cases like where `_app` or `_document` have syntax errors causing compilation to not be able to complete. This achieves showing the dev overlay even when compilation fails from a syntax error by doing a third minimal compilation in development with the needed client-side assets to render the dev overlay. 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

x-ref: https://github.com/vercel/next.js/issues/24070
2021-04-22 11:08:47 +00:00
Kyle Marshall
a29d8c9eaf
Ensure locale key not duplicated when navigating back to root path with a query or hash value (#24323)
This ensures that a duplicate locale key is not prepended to the path when navigating back (using browsers back button) to the root path containing query parameters or a hash value.

Current behaviour:
* `/fr?value=1` -> `/fr/another` -> click browser back button -> `/fr/fr?value=1`
* `/fr?value=1` -> `/fr?value=2` -> click browser back button -> `/fr/fr?value=1`
* `/fr#section` -> `/fr/another` -> click browser back button -> `/fr/fr#section`
* `/fr#section` -> `/fr#another` -> click browser back button -> `/fr/fr#section`

Fix:
Remove query string or hash value from path before determining whether to add the locale to the path in `addLocale` function.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

Fixes: #24287
2021-04-22 03:06:26 +00:00
JJ Kasper
a0e3198aa0
Add test for top-level _document error (#24313)
This adds an additional test for the change in https://github.com/vercel/next.js/pull/24079 to ensure top-level errors in `_document` are also handled correctly. 

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

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

## Documentation / Examples

- [ ] Make sure the linting passes
2021-04-21 15:21:23 +00:00
Tobias Koppers
08baf526ff
improve react-loadable-plugin (#24281)
Co-authored-by: JJ Kasper <jj@jjsweb.site>



## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added


Closes: https://github.com/vercel/next.js/issues/22741
2021-04-21 11:18:05 +00:00
Brandon Bayer
8ccfff10ae
fix types of next-webdriver (#23995)
This does not touch any next.js code. This improves the integration test setup by properly typing next-webdriver.
2021-04-20 18:40:51 +00:00
Gerald Monaco
1f5f0d313a
Fix metrics measurements under new root API (#24110)
Previously, we weren't recording most (all?) of the Next.js measurements like `Next.js-hydration` in Concurrent Mode. This was mainly because the new API doesn't accept a callback.

Instead of special casing this, I've refactored it so that the measurements are just recorded when Root first flushes (via `useLayoutEffect`), which should be more or less the same timing for the old API.

Concurrent Mode is a little trickier for two reasons:

1. Flushes might be (slightly) delayed due to time-slicing and prioritization
2. Selective hydration might skew measurements in cases where full hydration is aborted

I don't have a good answer for those yet, so they'll need to be addressed when the time comes.
2021-04-20 15:37:32 +00:00
JJ Kasper
e532c58c23
Ensure locale cookie does not error with similarly named cookie (#24182)
This ensures we don't error when a cookie with a similar name to the `NEXT_LOCALE` cookie is present. 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

Fixes: https://github.com/vercel/next.js/issues/23787
Closes: https://github.com/vercel/next.js/pull/23788
2021-04-20 13:41:14 +00:00
Tobias Koppers
cc246cdc41
add css to the stats-app (#24228)
add a page with CSS to the stats app

We should compare stats for CSS too
2021-04-19 17:42:40 +00:00
JJ Kasper
65588083db
Ensure query for static pages with rewrites is updated correctly (#24189)
This updates the query refreshing on the client to also refresh when rewrites are used and the page is static since additional query values can be provided from rewrites that are relied on client-side. An additional test has been added in the custom-routes suite to ensure this is working correctly. 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

Fixes: https://github.com/vercel/next.js/issues/23490
Fixes: https://github.com/vercel/next.js/issues/22931
Fixes: https://github.com/vercel/next.js/issues/21062
2021-04-18 10:00:04 +00:00
JJ Kasper
6e7245cddb
Add error for getStaticPaths on non-dynamic page (#24188)
Noticed in this issue the reproduction was using `getStaticPaths` on a non-dynamic page incorrectly although we don't currently show an error for this. 

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

x-ref: https://github.com/vercel/next.js/issues/22931
2021-04-18 09:31:40 +00:00