Commit graph

3425 commits

Author SHA1 Message Date
Alex Castle
c8bc17f330
Support for custom image loaders via image component prop (#20216)
This is a #19325 reconfigured to support a loader passed in via a `loader` prop on the Image component, rather than using a config-based approach.

The idea is that applications wanting to use a custom loader will create a wrapper element for the  image component that incorporates that loader. See a simple example of this pattern in the integration tests. 

This solution is similar to the one prototyped by @ricokahler in #20213 and described at https://github.com/vercel/next.js/issues/18606#issuecomment-720149156

---

Closes #19325
Fixes #18606
2021-01-05 20:51:34 +00:00
tarunama
575fcf3fcf
refactor(client): add return types (#20728)
## summary
- Explicitly define return types
- Add type of  [Observer](https://github.com/vercel/next.js/pull/20728/files#diff-5de64b97b2f26e4e41d197a8295e8750825c75b8ca557a4b947a4c3569345974R7)
2021-01-05 15:11:37 +00:00
Jan Varho
b944b06f30
Fix notFound false pages returning 404 (#19861)
Currently pages with `notFound: false` from `getServerSideProps` behave the same as `notFound: true`, i.e. just having the key is enough to result in a 404. This fixes the check in render.tsx and adds tests for it.
2021-01-04 22:43:53 +00:00
Joe Haddad
cb50b040ea
fix(next/head): assign bool attrs to match server (#20748)
This pull request correctly assigns boolean attributes for `<script />` to match the element as it is created by a server-side render.

Prior to this pull request, we'd double-execute `<script>` tags with the `async`, `defer`, or `nomodule` property.

---

Fixes #9070
2021-01-04 19:57:52 +00:00
matamatanot
fc75baeb3c
Move sizes var declaration just before used (#18402)
As with `const width`, it should be declared just before it is used.
2021-01-04 18:09:07 +00:00
Kristoffer K
104b8d4732
fix(next-mdx): resolve webpack loader (#17983)
**What's the problem this PR addresses?**

`@next/mdx` adds the webpack loader `@mdx-js/loader` without resolving it to an absolute path

Depends on https://github.com/vercel/next.js/pull/17606

**How did you fix it?**

`require.resolve` the webpack loader before adding it
2021-01-04 16:24:16 +00:00
Joe Haddad
246c265fca
v10.0.5-canary.9 2021-01-04 10:31:56 -05:00
Kristoffer K
e848a9e504
fix(next): add missing peer dependencies for sass support (#17606) 2021-01-04 10:30:46 -05:00
Alexander Kachkaev
7076758c8d
Call res.write('') inside apiRes.redirect() helper to prevent an edge case (#20461)
This PR is a small follow-up to #14705. It saves Next.js users from falling into a [pretty nasty trap](https://github.com/nodejs/node/issues/36620) in which I ended up last Friday. It took more than two days to investigate what was going on, so I hope I'm the last person who’s doing it 😅

Next.js-specific MWE: https://github.com/kachkaev/hanging-response-in-next-via-redirect-plus-compression (needs to be ran locally using Node 14.0.0+).

> <img width="521" alt="Screenshot 2020-12-24 at 20 50 00" src="https://user-images.githubusercontent.com/608862/103105989-a9b8dc00-4629-11eb-9be3-5108755604bf.png">

To reproduce the bug I’m fixing:

1. Pick a large http body size (64 or 128 KB)
1. Check _Call res.end() after res.redirect() in /api/redirect_
1. Navigate to a heavy page or an api handler via redirect
1. Observe that the http response is never finished.

If you set `compress` to `false` in `next.config.js` or pick a small payload size (< `zlib.Z_DEFAULT_CHUNK` after compression), the bug will not be observed. This is explained by the use of `res.on("drain", ...)` [by the `compression` package](3fea81d0ea/index.js (L193-L218)). The package itself is not the reason for an issue though, it seems to be in the Node’s built-in `http` package.

I’m happy to provide more info or GitHub CI to the MWE if needed. I was also thinking of adding some Next.js-specific testing, but could not come up with a compact and clear test plan. Happy to do this if there are any ideas.

cc @botv (author of #14705)
2021-01-04 10:14:15 +00:00
JJ Kasper
88b6c47244
Ensure isReady is set correctly for auto static dynamic route (#20729)
Follow-up to https://github.com/vercel/next.js/pull/20628 this ensures `isReady` is not initially true when the query isn't present but the page is an automatically statically optimized dynamic route
2021-01-04 08:58:52 +00:00
tarunama
8795369a2d
chore(client-image): add return types (#20686) 2021-01-03 15:59:17 +00:00
Zach Bialecki
f412547248
Don't dedupe meta tags with the same name but unique keys (#17099)
Currently there is no way to add multiple meta tags with the same name attribute to the head of a page. This PR modifies the Head component to allow multiple meta tags with the same name if they have unique keys. 

This is important for integrating with certain services like Google Scholar and Swiftype.

Fixes #10183
2021-01-03 10:35:51 +00:00
Joe Haddad
85bd4a9ccb
v10.0.5-canary.8 2021-01-01 21:40:09 -05:00
Joe Haddad
58ea3bb479
fix(next/babel): read env from caller, not process (#20679)
This PR fixes a bug where `next/babel` would accidentally enable development transforms for a production build (`next build`).

This is tested by the two updated unit tests (which removed a workaround for this bug, and one now properly enables dev transforms).

---

Fixes #18929
Fixes #19001
x-ref #19046
x-ref #17032
2021-01-02 00:36:16 +00:00
Joe Haddad
984ac96dc6
chore: remove old traces of next/data experiment (#20678)
This PR removes some left over traces of the `next/data` experiment, as it has been superseded by RSC.
2021-01-01 22:23:42 +00:00
JJ Kasper
dffb47133b v10.0.5-canary.7 2021-01-01 14:34:29 -06:00
Joe Haddad
2c75fa0d9e
fix(source map): correctly generate source maps (#20672)
Fixes #20500
2021-01-01 20:30:50 +00:00
JJ Kasper
8b803d79a9
Update error when internal href and external as are used (#20658)
* Update error when internal href and external as are used

* Update to handle error outside invariant

* Update err.sh components
2021-01-01 12:14:42 -06:00
JJ Kasper
9c8d04654e
Ensure all entries are cleared from cache on runtime change (#20652) 2021-01-01 12:39:39 -05:00
Joe Haddad
29b591b2bc
fix(next/image): do not pass-through srcSrc on lazy image (#20651)
This PR fixes a bug where we'd accidentally pass-through the user-provided `srcSet` if the image was lazy, just to then replace it when we hydrate.

---

Fixes #19041
2020-12-31 21:08:57 +00:00
子慕大诗人
088f374c16
Fix react-dev-overlay rem style conflict (#17723)
### Don‘t use rem in react-dev-overlay.
If we create a nextjs project and use css rem. We could set the html fontsize to any 'px'.  The react-dev-overlay components styles will be affected so that the style becomes larger or smaller.

![image](https://user-images.githubusercontent.com/10840654/95490394-c189a800-09ca-11eb-816a-8bcaf6bcb657.png)
## So i suggest change the rem to px.
## After modification:
![image](https://user-images.githubusercontent.com/10840654/95490703-2e9d3d80-09cb-11eb-8369-7ec650fa6c52.png)

---

Fixes #18680
2020-12-31 19:27:15 +00:00
Joe Haddad
e4a744653d
fix(overlay): skip disable & upgrade platform (#20647)
This bundles ally.js into Next.js itself to upgrade a dependency they have pinned.

I tried every other major focus trap solution, even those used by some modal libraries, and they all failed.

`ally.js` is the only library that can do it correctly, so we're going to stick with it.

I also removed the `maintain/disabled` as we have a backdrop that would effectively result in the same. This reduces CPU strain.

---

Fixes #19893
Fixes #14369
Closes #14372
2020-12-31 19:04:46 +00:00
JJ Kasper
3a9d18b549
Add isReady field on router (#20628)
Adds an `isReady` field on `next/router` specifying whether the router fields are updated client-side and ready for use. Should only be used inside of `useEffect` methods and not for conditionally rendering on the server.

Closes: https://github.com/vercel/next.js/issues/8259
Closes: https://github.com/vercel/next.js/pull/9370
2020-12-31 16:54:32 +00:00
Joe Haddad
dbe1e626f8
fix(experimental scroll): use sessionStorage instead of history (#20633)
This pull request adjusts our experimental scroll restoration behavior to use `sessionStorage` as opposed to `History#replaceState` to track scroll position.

In addition, **it eliminates a scroll event listener** and only captures when a `pushState` event happens (thereby leaving state that needs snapshotted).

These merely adjusts implementation detail, and is covered by existing tests:
```
test/integration/scroll-back-restoration/
```

---

Fixes #16690
Fixes #17073
Fixes #20486
2020-12-31 16:08:12 +00:00
JJ Kasper
fd33c9f7e1
Ensure href is updated for locale domain (#20631)
This ensures we render the locale domain on the `href` when using `next/link` previously the provided `href` was stilling being rendered which differed from the resulting `href` that was navigated to. 

Fixes: https://github.com/vercel/next.js/issues/20612
2020-12-31 08:07:51 +00:00
JJ Kasper
9fc9a6e1e4 v10.0.5-canary.6 2020-12-30 23:30:30 -06:00
Guy Bedford
b7272995b5
feat: upgrade to ncc@0.26.1 (#20627)
This upgrades to the version of ncc with subbundling support.
2020-12-31 00:50:45 +00:00
Prateek Bhatnagar
16e9de3565
Fix: fallback font tag repetition (#20382)
partially fixes #20341

- Makes sure that font fallback does not get repeated for every request.
- Adds a test for the same.
2020-12-30 23:41:33 +00:00
JJ Kasper
5324e8b6ee
Ensure SSG data 404 handles correctly for non-notFound (#20622)
Follow-up to https://github.com/vercel/next.js/pull/20594 this ensures non-notFound SSG data 404s do cause a hard navigation as this signals a new deployment has occurred and a hard navigation will load the new deployment's version of the page. 

Closes: https://github.com/vercel/next.js/issues/20623
2020-12-30 22:35:02 +00:00
Alex Castle
74909ecfd4
Move CSS Preloads to top of head at document render (#18864)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-12-30 17:12:46 -05:00
Joe Haddad
cc0dcf96d5
v10.0.5-canary.5 2020-12-30 16:38:28 -05:00
Joe Haddad
45b87aa23a
feat(next/image): preload priority images (#20615)
The HTML Living Standard explicitly says `href` should be omitted to prevent the loading of an incorrectly sized image:
https://html.spec.whatwg.org/multipage/semantics.html#attr-link-imagesrcset

![image](https://user-images.githubusercontent.com/616428/103378205-8a013800-4aaf-11eb-9085-10f547263fed.png)

Since it's in the spec, I assume this is valid-enough HTML.

This also dedupes preloads which the old implementation did not.

---

Fixes #18756
x-ref #19118
Fixes #18720
2020-12-30 21:10:28 +00:00
Tyler Deitz
ec430ea77d
Fix memory leak in useIntersection (#20407)
This pull request adds an `elements.delete` operation to the `useIntersection`'s cleanup function: `unobserve`.

Without this delete operation, next.js holds onto an unreachable reference of every observed element indefinitely (automatically every Link and Image is observed, so that means every rendered Link and Image element adds to the leak). I found this memory leak when building out an infinite feed in next.js with thousands of Link elements.

The final code block of the `unobserve` function body:

```tsx
  // Destroy observer when there's nothing left to watch:
  if (elements.size === 0) {
    observer.disconnect()
    observers.delete(id)
  }
```

Is effectively unreachable without this delete operation, as the `elements` map will never decrease in size as it is currently. This means that there will always be at least one IntersectionObserver instance in memory if useIntersection has been used once, regardless of if there are currently any components still using the hook.
2020-12-30 20:04:57 +00:00
Joe Haddad
d1c565901e
feat(next/image): reduce byte waste for 3x screens (#20610)
https://blog.twitter.com/engineering/en_us/topics/infrastructure/2019/capping-image-fidelity-on-ultra-high-resolution-devices.html

> This means that most OLED screens that say they are 3x resolution, are actually 3x in the green color, but only 1.5x in the red and blue colors. Showing a 3x resolution image in the app vs a 2x resolution image will be visually the same, though the 3x image takes significantly more data. Even true 3x resolution screens are wasteful as the human eye cannot see that level of detail without something like a magnifying glass.

> ![image](https://user-images.githubusercontent.com/616428/103366340-61b61100-4a90-11eb-9c16-8467f8930247.png)

Even the iPhone doesn't have true 3x DPI!

related: #18756
2020-12-30 18:17:46 +00:00
JJ Kasper
c0ff5ef2c4 v10.0.5-canary.4 2020-12-30 10:26:25 -06:00
Joe Haddad
7646921911
fix(router): consistent scroll behavior for Link/Router#push (#20606)
This pull request makes `Router#push` and `Router#replace` function identically to `<Link />`, i.e. reset scroll when the new render is complete.

Users can opt out of this new behavior via:
```tsx
const path = '/my-page'
router.push(path, path, { scroll: false })
```

---

Fixes #3249
2020-12-30 16:10:59 +00:00
Joe Haddad
3246274dfd
fix(build): require test files be full name or extension (#20605)
Fixes #19935
2020-12-30 15:49:37 +00:00
JJ Kasper
75509164ab
Ensure domain locales are redirected client-side (#20562)
This ensures we detect domain specific locales and redirect them client-side. Tests have been added in the `i18n` suite to ensure the domain redirect is applied correctly during a client-side navigation

Fixes: https://github.com/vercel/next.js/issues/19174
2020-12-30 06:44:07 +00:00
JJ Kasper
97e9d54f2e
Ensure index basePath is detected correctly (#20596)
This ensures we detect the `basePath` correctly for the index `basePath` route when either a `hash` or a `query` are present in the provided path. This also adds this specific test to our basePath test suite. 

Fixes: https://github.com/vercel/next.js/issues/19294
Fixes: https://github.com/vercel/next.js/issues/19437
Closes: https://github.com/vercel/next.js/pull/19444
2020-12-30 05:37:26 +00:00
JJ Kasper
949657675e
Refactor GS(S)P notFound client-side handling (#20594)
This refactors to instead of throwing a specific error when a SSG data route 404s, we return it through props and render the 404 outside of the error handling flow. No additional tests have been added as existing tests should cover this. 

Closes: https://github.com/vercel/next.js/issues/19243
2020-12-30 05:17:10 +00:00
Joe Haddad
8bab640ef6
fix(next/link): reset scroll before lifecycles (#20595)
This moves the scroll reset behavior to happen synchronously with the DOM commit, instead of a few ticks after the render completes.

This is necessary for components that read scroll state on mount.

---

Fixes #6462
2020-12-30 04:33:08 +00:00
JJ Kasper
962535752b
Ensure next/image loads correctly with basePath (#20592)
This ensures the default path used for the `next/image` component includes the `basePath` when configured. Additional tests have also been added to ensure the image component is working correctly with `basePath` configured.

Fixes: https://github.com/vercel/next.js/issues/19711
2020-12-30 01:57:08 +00:00
Tim Neutkens
5c5108fe0d
Add profiling to webpack loaders (#20392)
Follow-up to #20357 with additional tracers.
2020-12-29 21:21:35 +00:00
Joe Haddad
52270af307
Remove unnecessary unfetch polyfill for dev (#20589)
Fetch is always polyfilled in legacy browsers by `@next/polyfill-nomodule`, so we do not need to import unfetch for IE11 support.

Fixes #20588
2020-12-29 21:01:42 +00:00
Joe Haddad
61e7dea918
deps: upgrade various deps (mainly babel) (#20586)
Fixes #20585
Closes #20406 as it duplicates Babel dependencies
Closes #18926 as it's outdated
2020-12-29 20:10:08 +00:00
Jorrit Schippers
a9c7c9a5f5
Update sharp optional dependency to support NPM 7 (#20432)
Sharp 0.26.3 updates prebuild-install to ^6.0.0 which fixes an incompatibility with NPM 7.

See https://github.com/lovell/sharp/pull/2419 and https://github.com/prebuild/prebuild-install/pull/128
2020-12-29 18:03:53 +00:00
JJ Kasper
eb8e038ddb
Clean up webpack 5 version error (#20578) 2020-12-29 12:35:22 -05:00
Joe Haddad
e5b2bd1704
fix(next/image): ignore typography prose styles (#20580)
This fixes `next/image` to properly ignore inherited styles applied to the `img` tag by a parent element.

Image styling should **always** be done by a wrapper element—not to the image itself!

---

Fixes #19817
Fixes #19964
2020-12-29 17:34:11 +00:00
Luke Fender
f2f9090a50
Ignore emacs lockfiles (#20497)
Fixes: https://github.com/vercel/next.js/issues/15278

> Bug report

> When using next dev with emacs, as you develop, emacs creates symbolic link files starting with .# as lock files. Next.js seems to attempt to load these but fails, spewing out errors constantly.

Prevents dev server from crashing when emacs creates lockfiles

tested with:

- GNU Emacs 27.1
- OSX 11.1
- Node v15.4.0
2020-12-29 16:12:36 +00:00
Joe Haddad
3140e40db7
v10.0.5-canary.3 2020-12-29 00:44:11 -05:00
JJ Kasper
c93c9fcc78
Add error for invalid webpack 5 version (#20558)
Closes: https://github.com/vercel/next.js/issues/20545
2020-12-29 04:43:57 +00:00
Joe Haddad
8d4cead9fb
v10.0.5-canary.2 2020-12-28 18:32:14 -05:00
JJ Kasper
c98db81bf4
Remove import type syntax from core files (#20379)
This removes `import type` usage from our core files since `import type` requires a higher TypeScript version than currently expected.

Fixes: https://github.com/vercel/next.js/issues/19300
2020-12-28 22:04:51 +00:00
Joe Haddad
aacb529f48
v10.0.5-canary.1 2020-12-28 16:12:20 -05:00
JJ Kasper
1203b9082b
Ensure path encoding is handled consistently for prerendered pages (#19135)
This ensures we handle encoding/decoding for SSG prerendered/fallback pages correctly. Since we only encode path delimiters when outputting to the disk we need to match this encoding when building the `ssgCacheKey` to look-up the prerendered pages. This also fixes non-ascii prerendered paths (e.g. 商業日語) not matching correctly. 

This does not resolve 👉  https://github.com/vercel/next.js/issues/10084 and further investigation will be needed before addressing non-ascii paths for non-SSG pages. 

The encoding output was tested against https://tst-encoding-l7amu5b9c.vercel.app/ to ensure the values will match correctly on Vercel. 

Closes: https://github.com/vercel/next.js/issues/17582
Closes: https://github.com/vercel/next.js/issues/17642
x-ref: https://github.com/vercel/next.js/pull/14717
2020-12-28 20:08:58 +00:00
Joe Haddad
5f311cddd2
fix Fast Refresh tests with webpack@5 (#20543) 2020-12-28 14:18:51 -05:00
Joe Haddad
f02bf210ce
fix(next/image): inherit parent visibility (#20542)
This PR is an alternative to #20247 which contains tests for the expected behavior.

---

Fixes #20198
Closes #20247
2020-12-28 18:55:44 +00:00
JJ Kasper
db329fe9b0
Ensure index rewrite is matched with i18n correctly (#20509)
This makes sure we don't generate the wrong locale source variant for the rewrite requiring a `/` on the end which won't ever be added causing the rewrite to never match. Additional tests have been added to ensure this specific rewrite is working correctly. 


Fixes: https://github.com/vercel/next.js/issues/20508
2020-12-28 18:21:28 +00:00
JJ Kasper
6189fe9693
Ensure query is present with i18n and history navigation (#20441)
This makes sure the query isn't dropped when doing a history navigation with i18n. Additional tests have been added to ensure this is working correctly as well. 

Fixes: https://github.com/vercel/next.js/issues/20212
2020-12-28 17:58:07 +00:00
JJ Kasper
9b3edd3b24 v10.0.5-canary.0 2020-12-22 16:22:48 -06:00
JJ Kasper
690fc36ccc
Update revalidate checks (#19796)
This ensures we show an error for string values for `revalidate` since we currently don't handle these and instead it results in `revalidate: false` being used. This also adds tests for our `revalidate` checks to ensure they are triggered correctly and not triggered for valid values. 

x-ref: https://github.com/vercel/next.js/issues/20310
2020-12-22 20:15:26 +00:00
JJ Kasper
118588b027
Remove extra redirect for index with i18n (#20397)
This makes sure redirects to the index route properly end with a trailing slash or don't based on the `trailingSlash` config to ensure an additional redirect doesn't need to take place un-necessarily. 

Fixes: https://github.com/vercel/next.js/issues/19405
2020-12-22 17:12:53 +00:00
Joe Haddad
eeb2838511
v10.0.4 2020-12-22 10:38:34 -05:00
Joe Haddad
625d854cd4
v10.0.4-canary.10 2020-12-22 08:59:54 -05:00
Juny
5cabe5e220
fix: set empty document files for amp first (#16934)
Fixes: https://github.com/vercel/next.js/issues/16926

I do not know this is the right way.
Please review it.
2020-12-22 03:18:01 +00:00
Joe Haddad
64c1f726e0
Fix webpack 5 terser compat (#20378)
This PR fixes webpack 5 compatibility with older betas.
2020-12-22 02:53:23 +00:00
JJ Kasper
788183e8d3
Ensure only backslashes are in pages-manifest with i18n (#20376)
This ensures the pages-manifest only includes forward slashes and not backslashes when adding i18n page references, this also adds tests ensuring we don't regress on this in the i18n-support test suite. 

Fixes: https://github.com/vercel/next.js/issues/20330
2020-12-22 01:51:51 +00:00
Joe Haddad
2a6f481c71
v10.0.4-canary.9 2020-12-21 14:35:15 -05:00
Joe Haddad
260ab51974
temporary: re-flag font optimization (#20372)
There's currently two bugs with the font optimization, but we'd really like to ship a stable version.

To unblock the stable release, we're **temporarily** reflagging this. It'll be unflagged on canary again!
2020-12-21 19:26:00 +00:00
Tim Neutkens
a9f1975738
Update experimental profiling (#20357)
Adds profiling for terser and css-minimizer. Will move the old profiler to this new system as well.
2020-12-21 16:02:41 +00:00
Matt Wood
7d48241949
Extend IncomingMessage type to include cookies from middleware (#19724)
When using `getServerSideProps` with Typescript, it looks like it's expecting `req` to be a plain `IncomingMessage` from `http`, but Next middleware (?) is adding `cookies`:

![image](https://user-images.githubusercontent.com/22530815/100816292-680e8a00-340b-11eb-8c40-19ec4f9ea356.png)

Here's a reproduction showing the example:

https://codesandbox.io/s/nextjs-server-side-props-cookies-vr547?file=/pages/index.tsx

In the terminal, you can see that there is a value for cookies, but `IncomingMessage` doesn't include it by default.

I still need to get more familiar with all the Next.js internals, but I imagine there are a few other places where this type could be used if cookies are being included. Any help would be appreciated.
2020-12-18 11:29:49 +00:00
Bogdan Chadkin
36cab257ce
Upgrade webpack-bundle-analyzer (#20232)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-12-18 09:47:26 +01:00
Joe Haddad
121e88d89c
v10.0.4-canary.8 2020-12-17 16:19:18 -05:00
Tim Neutkens
72fae8bed4
Move productionBrowserSourceMaps out of experimental (#20267)
Makes https://www.npmjs.com/package/@zeit/next-source-maps a built-in feature so that it can be deprecated.
2020-12-17 15:04:17 +00:00
Leo Toneff
25cb43a73b
Added flag to identify shallow router events (#19802)
This PR is an implementation of RFC #13276 (more specifically @banerjeesouvik's [suggestion](https://github.com/vercel/next.js/discussions/13276#discussioncomment-17874)) which solves #3322 by adding an extra parameter to the router events that'll allow you to see whether or not the route is shallow.

This is a recreation of PR #13243.
2020-12-17 09:14:50 +00:00
JJ Kasper
0970873bb7 v10.0.4-canary.7 2020-12-16 17:09:51 -06:00
Joe Haddad
9661256263
Upgrade http-proxy dependency (#20239) 2020-12-16 17:02:39 -05:00
JJ Kasper
e819e00d0c
Add required server files manifest (#20035)
This keeps track of required server files in a manifest file
2020-12-16 20:46:55 +00:00
Tim Neutkens
5d5383b263
Update font-stylesheet-gathering-plugin to be webpack 5 compatible (#20229)
Solves the following warning:

> (node:1484) [DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE_FN] DeprecationWarning: MainTemplate.requireFn is deprecated (use "__webpack_require__")
2020-12-16 14:35:50 +00:00
Tim Neutkens
a7812ef7eb v10.0.4-canary.6 2020-12-16 11:23:05 +01:00
Tim Neutkens
8ed132deb6
Update import to prevent loader from erroring in webpack 5 (#20211)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-12-16 08:56:14 +01:00
Erik August Johnson
76c0efb3dd
Update README-template.md for API endpoint info (#20024)
Adds brief summary in Getting Started to explain the `pages/api` functionality. The intention here is reduce confusion to new users of Next.js as to what `pages/api` is and how it works.
2020-12-14 09:22:55 +00:00
bram-l
929f17e183
Fix prefetching for URLs including trailing slash (#19474)
Fixes  #17813
2020-12-12 22:09:09 +00:00
JJ Kasper
1132a8dedf v10.0.4-canary.5 2020-12-12 14:29:15 -06:00
Tim Neutkens
81e67ce95e
Update terser-webpack-plugin to support webpack 4 (#20089)
Solves some of the cache warnings when using webpack 5
2020-12-12 20:28:53 +00:00
JJ Kasper
5b89b1b6df
Ensure href resolvedAs is correct with locale (#20080)
This makes sure the `locale` doesn't cause the wrong `href` to be resolved, this also ensures route specificity is correct when loading dynamic routes in production mode. 

Fixes: https://github.com/vercel/next.js/issues/19747
2020-12-12 14:06:46 +00:00
Bruno Antunes
8340e6d345
[Image Component] image sizes property becomes 100vw by default (#20067)
Currently if sizes is not defined, Next.js is setting sizes as:
```
(max-width: 640px) 640px, (max-width: 750px) 750px, (max-width: 828px) 828px, (max-width: 1080px) 1080px, (max-width: 1200px) 1200px, (max-width: 1920px) 1920px, (max-width: 2048px) 2048px, 3840px'
```

This pull request will make sizes be `100vw` by default, which will allow us to download "smaller" images than what's currently happening. 

In a demo app I have, the difference is between downloading 488KB vs 1.4MB (in images)
2020-12-10 21:29:37 +00:00
Joe Haddad
f4809b950b
v10.0.4-canary.4 2020-12-10 11:54:59 -05:00
Joe Haddad
1692e931d9
Upgrade Terser (#20063)
Fixes #18056
2020-12-10 16:49:23 +00:00
Luis Alvarez D
a5fea53bc8
Update logo for dark mode (#20047)
Closes https://github.com/vercel/next.js/issues/20046
2020-12-09 23:57:07 +00:00
Lachlan Campbell
9bdb793c4e
Fix double-quoted hotlinks in dev error panel (#19974)
Fixes #19923.

Before:
<img width="564" alt="Screen Shot 2020-12-08 at 3 07 11 PM" src="https://user-images.githubusercontent.com/5074763/101535738-1adc6c00-3967-11eb-8c80-c7f2e75f8de5.png">

After:
<img width="574" alt="Screen Shot 2020-12-08 at 3 07 18 PM" src="https://user-images.githubusercontent.com/5074763/101535742-1b750280-3967-11eb-828b-1ecac08c6511.png">
2020-12-09 07:48:54 +00:00
Joe Haddad
19fed3f83b
v10.0.4-canary.3 2020-12-08 11:14:36 -05:00
Tim Neutkens
c792317295
Clear up production build missing message for next start and next export (#19777)
Adds an err.sh link to the production build missing message. Also clears up `valid` as `production`.

Also fixes an edge case where an unhelpful error would be thrown because we checked for `.next` instead of `.next/BUILD_ID`

Added the out directory location as the list line during export to make sure people know where the files are output. 

Fixes #19778
Fixes #19788
2020-12-08 15:16:56 +00:00
JJ Kasper
cf4665539a
Fix failing Azure tests (#19877)
Noticed Azure tests have started failing after https://github.com/vercel/next.js/pull/19758 due to the middleware taking longer than the allotted threshold which adds unexpected logs to stderr. This attempts to resolve these test failures by increasing the allotted time for the middleware when running on Azure. 

x-ref: https://dev.azure.com/nextjs/next.js/_build/results?buildId=22617&view=logs&jobId=5ee44de4-e310-59d9-0ba5-4a271a649fb0&j=5ee44de4-e310-59d9-0ba5-4a271a649fb0&t=af3fb693-3771-5a1a-ec97-2ba4cc77f25c
x-ref: https://dev.azure.com/nextjs/next.js/_build/results?buildId=22619&view=logs&jobId=5ee44de4-e310-59d9-0ba5-4a271a649fb0&j=5ee44de4-e310-59d9-0ba5-4a271a649fb0&t=af3fb693-3771-5a1a-ec97-2ba4cc77f25c
2020-12-08 09:24:22 +00:00
Tim Neutkens
4bca939ff7
Remove aliases that are no longer needed (#19937)
Fixes #19939
2020-12-07 22:35:28 +00:00
JJ Kasper
358861d315
Ensure trailingSlash redirect applies correctly for i18n (#19859)
This ensures locales aren't applied for the trailing slash redirect un-necessarily

Fixes: https://github.com/vercel/next.js/issues/19784
2020-12-07 17:36:46 +00:00
Daniel Kempner
90e97b535b
Custom Server with bodyParser, don't parse body again in API Route (#16169)
## Why

Some users prefer to use a custom server implementation that handles body parsing. If they do this, they have no way to opt out of all body parsing in API Routes. Requests with bodies die if next's `bodyParser` is not disabled. Requests just hang forever.

Instead of adding [this config](https://nextjs.org/docs/api-routes/api-middlewares#custom-config) to every API Route, we do a simple check to avoid parsing the body twice.

Fixes #8315
Fixes #7960
2020-12-07 13:30:38 +00:00
JJ Kasper
b403e9ec15 v10.0.4-canary.2 2020-12-04 09:48:30 -06:00
Pepijn Senders
3f730fc7b1
Improve way cache version string is created (#19763)
Nitpicky change, but the version string contained a double `|`, implying that there might be an empty value between `process.env.__NEXT_VERSION` and the environment variables.
2020-12-04 14:08:02 +00:00
JJ Kasper
42385f48db
Ensure i18n custom routes resolves correctly (#19766)
This ensures i81n custom routes are resolving correctly, it also corrects redirects for default locales when `locale: false` is not used, and this also simplifies the resolving for custom routes with i18n in `next-server` adding types for the i18n config. This also adds additional tests to prevent regression and starts leveraging a shared `NextConfig` type to allow us to share types for config values. 

Fixes: https://github.com/vercel/next.js/issues/19521
Fixes: https://github.com/vercel/next.js/issues/19403
Fixes: https://github.com/vercel/next.js/issues/19302
Fixes: https://github.com/vercel/next.js/issues/19227
2020-12-04 10:14:55 +00:00
Prateek Bhatnagar
57e156bc49
Making font optimization as default (#19758)
- Making font optimizations as default
- Re-enabling tests
- Fixes #19159
2020-12-04 09:52:54 +00:00
JJ Kasper
bb1bdbb10f
Update @ampproject/toolbox-optimizer to latest version (#19722)
This updates to the latest version of the `@ampproject/toolbox-optimizer` which contains updates for dependencies to remove the warnings on install from `npm`

x-ref: https://github.com/vercel/next.js/pull/18994
Closes: https://github.com/vercel/next.js/issues/17416
2020-12-02 12:55:43 +00:00
JJ Kasper
7ae76f4326 v10.0.4-canary.1 2020-12-01 18:00:06 -06:00
Jeff Escalante
b86a1731e1
Error Message Clarity (#16052)
* make the error message more clear if webpack config comes back undefined

* Update check and add test

* bump

* Update build-output test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-12-01 15:58:52 -06:00
JJ Kasper
d016eadeef v10.0.4-canary.0 2020-12-01 14:53:27 -06:00
Janicklas Ralph
c8cd77a856
Script loader component (#18281) 2020-12-01 19:10:16 +01:00
Janicklas Ralph
6e4632efe1
Css optimizations (#16539)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-12-01 19:02:07 +01:00
Steven
fddad89cbc
Fix cloudinary default quality to use q_auto (#19694)
The [default loader](17b91e7c76/packages/next/client/image.tsx (L488)) and [imgix loader](https://docs.imgix.com/apis/rendering/format/q) use a quality of 75 if none is specified on the Image component.

This PR does something similar for the cloudinary loader by utilizing `q_auto`, but it should yield even better results.

> This setting can significantly reduce the file size without any degradation noticeable to the human eye, and without the need for you to individually analyze every image.

https://cloudinary.com/documentation/image_optimization#use_q_auto_automatic_quality_and_encoding

### Example
- [Before](https://res.cloudinary.com/demo/image/upload/woman.jpg) - 583KB
- [After](https://res.cloudinary.com/demo/image/upload/q_auto/woman.jpg) - 46KB
2020-12-01 16:09:11 +00:00
Guy Bedford
9dd5ff2baa
fix: Revert #18921 and inline absolute babel runtime only for YarnPnp (#19542)
This reverts #18921 and ensures that the Babel runtime is only inlined as an absolute path when using PnP as before, but then including the correction this resolution as implemented by @merceyz only in the PnP cases, while keeping the diff to a minimum.
2020-11-25 22:28:39 +00:00
JJ Kasper
899a29cade
Break up the serverless loader into typed handlers (#19511)
This breaks up the `serverless-loader` into typed handlers to allow for easier maintenance and better type-checking/linting. 

Closes: https://github.com/vercel/next.js/issues/19071
2020-11-25 19:56:18 +00:00
Jamie
397a375b37
Ensure next commands respect termination signals (#19433)
Fixes #16173

## What

Restores handling of termination signals, `SIGTERM` and `SIGINT`, to allow graceful termination of next commands. Seems to have been removed during a child process refactor #6450, was this intentional?

## Why 

Currently the command processes have to be forcefully killed. This would help those using Next.js with custom servers and tools like Docker and Kubernetes that rely on termination signals to shutdown instances.

---

Where would be a good location to add some tests? [test/integration/cli/test/index.test.js](fc98c13a2e/test/integration/cli/test/index.test.js)?
2020-11-25 13:30:06 +00:00
Joe Haddad
17c81cdce3
v10.0.3 2020-11-24 01:11:41 -05:00
Joe Haddad
38df992aa6
v10.0.3-canary.3 2020-11-24 00:26:13 -05:00
Joe Haddad
b063f85f87
v10.0.3-canary.2 2020-11-23 15:13:38 -05:00
Joe Haddad
2832e753ad
Update vitals URL (#19454)
Update for rebranding purposes
2020-11-23 20:08:04 +00:00
Joe Haddad
8ddb3ad7da
v10.0.3-canary.1 2020-11-23 10:16:30 -05:00
Joe Haddad
c96c13a71b
Use render after hydrate (#19442)
Fixes #19399
2020-11-23 15:04:12 +00:00
JJ Kasper
e1737809db
Update fallback locale for locale: false (#19322)
This updates the fallback locale for `locale: false` to be the `defaultLocale` instead of the currently active `locale` as it allows passing through URLs more seamlessly as a URL without the locale prefixed can be treated as the `defaultLocale` instead of having to worry if the locale matches the currently active locale. This also ensures `locale={false}` is tested in the i18n-support-catchall suite

Closes: https://github.com/vercel/next.js/issues/19048
2020-11-20 21:50:26 +00:00
Connor Davis
c1702c2349
Exclude well known files when trailing slash: true (#19364)
* Exclude well known files when trailing slash: true

* Update manifest test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-11-20 15:17:58 -06:00
JJ Kasper
26634c475e
v10.0.3-canary.0 2020-11-20 14:39:12 -06:00
JJ Kasper
2790ea411b
Ensure i18n + trailingSlash works for different page types (#19331)
This adds additional test coverage and more handling for i18n + `trailingSlash: true`

Closes: https://github.com/vercel/next.js/issues/19069
2020-11-20 18:45:47 +00:00
JJ Kasper
7782ba6ff8
Ensure export progress handles less pages than segments (#19281)
This updates the export progress to make sure we log out the final progress update when less pages than number of progress updates (segments). This also adds tests to ensure we are logging the progress out as expected. 

Fixes: https://github.com/vercel/next.js/issues/19122
Closes: https://github.com/vercel/next.js/pull/19123
2020-11-20 16:57:34 +00:00
JJ Kasper
5959f18431
Ensure non-configured i18n locales 404 (#19338)
This ensures navigations to non-configured locales causes the 404 page to be shown, it also adds tests to ensure direct visits for non-configured locales 404s correctly. 

Fixes: https://github.com/vercel/next.js/issues/19214
2020-11-20 15:07:00 +00:00
JJ Kasper
13aa9d666c
Correct errsh links in config checks (#19280)
This makes sure we're using `next.js` in the err.sh links instead of `nextjs` since that leads to a 404
2020-11-20 13:04:18 +00:00
JJ Kasper
8193df5309
Fix serverless with next start error case (#19288)
This fixes the case where we were returning page data when rendering `/_error` in `serverless` mode with `next start`

Closes: https://github.com/vercel/next.js/issues/19068
2020-11-19 16:25:54 +00:00
Sylvain Bannier
ce7ca2487b
Rewrite locale : fix wrong error message (#19319) 2020-11-19 16:04:55 +00:00
Joe Haddad
30c2dfdc47
Remove old modern mode experiment (#19275)
This PR removes the modern mode experiment because:

- It does not yield meaningful bundle size wins when compared to other initiatives we've taken
- It's not compatible with webpack 5 (which we're upgrading to)
- It's currently broken and causes most apps to malfunction
- There's no champion currently owning the experiment

We can re-introduce this in the future when we'd like to make it a default for all Next.js apps.

Note: **Next.js still supports Differential Loading (`nomodule`) and does it by default.** This PR strictly removes the experimental modern _syntax_, and does not disable our existing modern/legacy polyfilling.

---

Fixes #19200
Fixes #18960
Fixes #14707
Fixes #14465
2020-11-18 18:30:00 +00:00
Joe Haddad
ce5d9c858b
v10.0.2 2020-11-18 08:49:17 -05:00
Joe Haddad
5e5f206bcf
v10.0.2-canary.20 2020-11-18 00:49:44 -05:00
JJ Kasper
ca590c4cb9
Ensure i18n + trailingSlash: true handles correctly (#19149)
This ensures redirects are handled properly with i18n + `trailingSlash: true`, additional tests have also been added to ensure this is covered 

Fixes: https://github.com/vercel/next.js/issues/19069
2020-11-17 21:46:46 +00:00
JJ Kasper
2750880546
v10.0.2-canary.19 2020-11-17 12:54:56 -06:00
JJ Kasper
99e10a07fb
Ensure data prefetch for default locale is correct (#19085)
This makes sure SSG data is correctly prefetched for the default locale and other locales on the same page. Tests for this behavior have been added for catch-all and normal pages. 

Closes: https://github.com/vercel/next.js/issues/19048
2020-11-17 18:04:07 +00:00
Joe Haddad
ab0e2744ee
Upgrade styled-jsx (#19241)
This fixes compatibility with React 17 and `styled-jsx`.

Fixes #19242
2020-11-17 16:53:35 +00:00
Joe Haddad
7374d4ffb9
v10.0.2-canary.18 2020-11-15 16:41:42 -05:00
JJ Kasper
00f8297c4d
Fix prefetching in IE11 (#19171)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-11-15 16:18:16 -05:00
JJ Kasper
f0d2e64371
v10.0.2-canary.17 2020-11-14 09:14:53 -06:00
Joe Haddad
61c3db7368
Fix minifying inline CSS comments (#19167)
We accidentally regressed back in 9.5 and dropped support for inline CSS comments. PostCSS always parses these as pass-through (and not a syntax error), which can cause problems when minifying.

Browsers do a similar thing and ignore the comments.

To ensure we generate valid CSS, this adds support for stripping the CSS comments from the build.

--- 

Fixes #15589
Closes #17130
2020-11-14 15:03:04 +00:00
JJ Kasper
a32b1f4870
Enable handling for revalidate and notFound (#19165)
This allows SSG pages that return `notFound` to be revalidated. 

Closes: https://github.com/vercel/next.js/issues/18651
2020-11-14 07:12:47 +00:00
Joe Haddad
c1d2c32852
v10.0.2-canary.16 2020-11-13 22:40:37 -05:00
JJ Kasper
1e61b69e31
Add locale: false for custom-routes + i18n (#19164)
This mirrors the `basePath: false` behavior for custom-routes with `locale: false` to allow users to configure the locales manually (`locale: false`) or have the locales be handled automatically for custom-routes. 

Fixes: https://github.com/vercel/next.js/issues/18927
Fixes: https://github.com/vercel/next.js/issues/18795
2020-11-14 03:35:42 +00:00
Joe Haddad
ba791d0d84
v10.0.2-canary.15 2020-11-13 16:18:27 -05:00
Steven
318a1bf309
Add "nonce" from <Head> to the injected <style> to satisfy CSP (#19150)
Fixes #18557
2020-11-13 20:29:16 +00:00
Joe Haddad
415d7fd75e
Respect next/babel user provided runtime option (#19136) 2020-11-13 02:41:54 -05:00
Joe Haddad
8ff5213614
v10.0.2-canary.14 2020-11-12 23:31:34 -05:00
Steven
20ab35128c
Add missing sizes prop on image component (#19128)
- Fixes #19120
- Closes #18413 
- Related to #19041
2020-11-13 04:30:41 +00:00
Joe Haddad
9174b7a337
Fix component lifecycle order for style swap (#19125)
Co-authored-by: Gerald Monaco <gbmonaco@google.com>
2020-11-12 22:57:15 -05:00
Joe Haddad
f108dbf2c9
v10.0.2-canary.13 2020-11-12 22:29:15 -05:00
Joe Haddad
04ab35298a
Remove preload for priority images (#19118)
Fixes #18720

This removes image preloading. It doesn't work correctly on any browser other than Chrome (with Chrome's real engine). On all other browsers, it triggers 2x the bytes to be downloaded. The tradeoff isn't worth it here IMO.

Chrome itself should be smart enough to bump an `<img />` tag's priority over other preloads that are script type during the preparse phase.

We can reintroduce this when we don't hurt non-Chrome users.
2020-11-12 19:45:50 +00:00
Steven
5562daf7a1
Fallback to default config to enable testing Image component (#19107)
Fixes #18415 by using the default config as fallback.

Users who wish to use their `next.config.js` values will still need the workaround from https://github.com/vercel/next.js/issues/18415#issuecomment-718180659
2020-11-12 19:24:08 +00:00
JJ Kasper
4866c47d9d
Ensure optional catchall prerendered indexes and i18n (#19116)
This ensures root optional-catch-all index routes with i18n are output to the correct location and are also loaded from the `prerender-manifest` correctly. 

Fixes: https://github.com/vercel/next.js/issues/19095
2020-11-12 18:50:32 +00:00
Matsumoto Toshi
c88872cea0
fix: issue #18338 - don't add a trailing slash to external links (#18595)
## Description

Fixes #18338 - Fixed an issue with `trailingSlash: true` adding a slash to the end of an external link.

After
```
<h1 class="Home_title__3DjR7">Welcome to <a href="https://nextjs.org">Without slash</a></h1>
<h1 class="Home_title__3DjR7">Welcome to <a href="https://nextjs.org">With slash?</a></h1>
```

Before
```
<h1 class="Home_title__3DjR7">Welcome to <a href="https://nextjs.org">Without slash</a></h1>
<h1 class="Home_title__3DjR7">Welcome to <a href="https://nextjs.org/">With slash?</a></h1>
```
2020-11-12 18:10:40 +00:00
Anton Rieder
62633b1af5
Fix grammar in isSerializableProps (#19072)
I believe this should read ["altogether"](https://www.merriam-webster.com/dictionary/altogether) not "all together".
2020-11-12 16:07:14 +00:00
Josh Flayhart
5afed07925
Update node-html-parser lib (#19103)
In working with @devknoll on https://github.com/vercel/next.js/pull/17770 we thought it would be a good idea to update to the latest minor version from 1.2.20 -> 1.4.9 based on some bug fixes in these minor releases. I would like to separate this out to simplify the growing changeset in https://github.com/vercel/next.js/pull/17770, where we need to use `node-html-parser` to parse HTML for custom react components.

The linked changeset above will take some time and there are some [useful bug fixes](https://github.com/taoqf/node-html-parser/commits/master) and features in this minor release we could benefit from anyway. Namely:

- add nextSibling, nextElementSibling
- missing node tag
- `<style>` tag is not parsed correctly

Also I think it's a good idea to separate this out for testing.
2020-11-12 15:46:35 +00:00
Joe Haddad
88db0c79c8
v10.0.2-canary.12 2020-11-12 02:15:14 -05:00
Joe Haddad
c78c982e0b
Adjust how CSS files are fetched (#19091) 2020-11-12 02:14:48 -05:00
Joe Haddad
6b42b5a702
v10.0.2-canary.11 2020-11-12 00:57:00 -05:00
Joe Haddad
67494bd991
Upgrade use-subscription for React 16/17 bicompat (#19087)
Fixes #18518
2020-11-12 05:53:59 +00:00
JJ Kasper
54b70425ab
Ensure i18n with basePath works properly (#19083) 2020-11-12 00:26:48 -05:00
JJ Kasper
41866a135c
Add experimental Next.js plugin version locking (#19084) 2020-11-11 23:59:57 -05:00
JJ Kasper
9f6d5b14df
Add test and errsh for mixed notFound/redirect error (#19076)
This ensures the mixed `notFound`/`redirect` error is shown correctly and adds an err.sh for the error. 

Closes: https://github.com/vercel/next.js/issues/18727
2020-11-11 22:02:11 +00:00
JJ Kasper
d1036539d6
Ensure params and locale are parsed correctly in fallback mode (#19063)
This fixes a few things related to optional catch-all routes and i18n. The first thing is it ensures the correct data route is generated on the client so that the locale isn't duplicated for an optional catch-all route, the next is it ensures the browser history is updated correctly when only a locale change is occurring, and then it also ensures we handle the locales and normalizing for fallback optional catch-all pages correctly.

Tests have been added to ensure these cases are covered properly and we don't regress on them, these changes were also tested on Vercel [here](https://next-js-bug-i18n-root-params-nybg44l0b.vercel.app/)

Fixes: https://github.com/vercel/next.js/issues/18633 
Fixes: https://github.com/vercel/next.js/issues/19059
2020-11-11 20:33:44 +00:00
Joe Haddad
0d1d3178a9
v10.0.2-canary.10 2020-11-11 13:16:41 -05:00
Joe Haddad
0d5bf65feb
Replace page loader with new route loader (#19006)
This pull request completely replaces our old page loader with a brand new route loader.

Our existing comprehensive test suite means I did not need to add a bunch of tests. I did add them where behavior was added or fixed.

Summary of the changes:

- Eagerly evaluates prefetched pages in browser idle time (speeds up transitions)
- Router is **no longer frozen** indefinitely if the Build Manifest never arrives
- Router is **no longer frozen** indefinitely if a page fails to bootstrap
- New `withFuture` utility instead of ad-hoc deduping per resource
- Prefetching is now delayed until browser idle time to not impact TTI
- Browsers without `prefetch` now fall back to eager evaluation instead of using `preload`
- We're now ready to serve non-static assets **with `no-store` without breaking prefetching**
- **Application can now hydrate without fetching CSS assets—this is a huge performance win that was previously blocking hydration**

---

The minor size increase here is unfortunate, but we have to incur it for correctness.

---

Fixes #18389
Fixes #18642
2020-11-11 18:13:16 +00:00
JJ Kasper
9cda047f0e
v10.0.2-canary.9 2020-11-11 11:10:21 -06:00
Steven
917d594ca8
Print error during next export with default image loader (#19032)
Fixes #18356
2020-11-11 15:46:48 +00:00
Kristoffer K
d40d7d6562
fix(next): resolve absolute path to @babel/runtime (#18921)
**What's the problem this PR addresses?**

https://github.com/vercel/next.js/pull/18768 started to ncc `@babel/plugin-transform-runtime` which broke its Yarn PnP support since the version of `resolve` it uses can't be patched by Yarn.

Fixes https://github.com/yarnpkg/berry/runs/1359235077?check_suite_focus=true#step:5:79

cc @guybedford

**How did you fix it?**

Resolve the absolute path to `@babel/runtime` so it doesn't have to go through `resolve`

---

Fixes https://github.com/vercel/next.js/issues/19026
2020-11-11 15:18:33 +00:00
Daniel K
a03fcbf7eb
[bundle-analyzer] Fix incorrect example (#18952)
This confused me a lot, because in the case of `withBundleAnalyzer({})` it will ignore any previous config and basically override everything.

Furthermore, it makes more sense to move the call with `enabled` option inside so it's aligned with other plugins approach.
2020-11-11 08:02:43 +00:00
JJ Kasper
ae75c6a640
Update chokidar to latest (#18995)
Updates to the latest version of `chokidar`

x-ref: https://github.com/vercel/next.js/issues/17416
2020-11-11 07:35:31 +00:00
JJ Kasper
48acc479f3
Ensure basePath behavior with GS(S)P redirect (#18988)
This ensures we match the `basePath` handling for redirects in `next.config.js` with redirects from `getStaticProps` and `getServerSideProps` and also adds a separate test suite to ensure GS(S)P redirects with `basePath` work correctly

Fixes: https://github.com/vercel/next.js/issues/18984
Closes: https://github.com/vercel/next.js/pull/18892
2020-11-11 07:13:18 +00:00
JJ Kasper
a429a47fe0
Ensure correct defaultLocale is provided for locale domain (#19040)
This ensures we use the `defaultLocale` for a locale domain when rendering non-static pages. Static pages will initially contain the global `defaultLocale` and then be updated on the client since we don't currently prerender a version of the pages for each locale domain. 

Closes: https://github.com/vercel/next.js/issues/18970
2020-11-11 02:09:45 +00:00
Lyderic Dutillieux
50400f7eeb
Fixed wrong function name in error message (#19034)
Changed function name from "getStaticProps" to "getStaticPaths" in Exception message thrown when 'paths' is invalid.
2020-11-10 23:53:08 +00:00
Joe Haddad
5927796bdf
v10.0.2-canary.8 2020-11-10 17:06:14 -05:00
Gerald Monaco
80671273ca
Revert "Remove next-head-count (#16758)" (#18713)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-11-10 16:35:47 -05:00
Joe Haddad
497cac4b93
v10.0.2-canary.7 2020-11-10 01:55:03 -05:00
Steven
9573426599
Add etag header to optimized image response (#18986)
Fixes #18563 by adding the etag header to the optimized image response.

This does _not_ change the expireAt (TTL) for cached files on the server, which still uses the max-age of the upstream response.

The new file format on disk for cached image files is the following:

```
.next/cache/images/<HASHED_QUERYSTRING>/<EXPIREAT>.<ETAG>.<EXT>
```
2020-11-10 04:40:26 +00:00
Joe Haddad
8f07aed3e8
v10.0.2-canary.6 2020-11-09 13:37:02 -05:00
iczero
5aa7606ae3
Upgrade sass-loader to 10.0.5 (#18972)
`node-sass` v5 introduced support for Node.js v15, which is not supported by v4. However, Next.js currently errors with
```
Error: Node Sass version 5.0.0 is incompatible with ^4.0.0.
```
when attempting to build with `node-sass` 5.0.0. This error comes from `sass-loader`. They have recently released version 10.0.5 which supports `node-sass` 5.0.0 (PR <https://github.com/webpack-contrib/sass-loader/pull/899>, release <https://github.com/webpack-contrib/sass-loader/releases/tag/v10.0.5>).
2020-11-09 15:14:47 +00:00
tolfino
bbde18f120
Fix false positive in isSerializable with shared references in arrays (#18232)
This replaces the seen set with a newly instantiated map of refs per
value in the array. This corrects the behavior that the refs map passed
into isSerializable contains only values along the path to the current
value: previously, because the refs map was shared among all values in
the array, this would trigger on instances such as:

```js
    const x = [];
    isSerializableProps('/', 'test', { arr: [x, [x]] });
```

... where the reference is shared but there is no cycle formed, as the
presence of elements is disjoint.

Fixes #18228.
2020-11-09 14:25:41 +00:00
Tadao Iseki
d196e72a7f
Export ImageProps from Image component (#18576)
This allows to import the type `ImageProps` from `next/image` like `next/link`.

a6660729ea/packages/next/client/link.tsx (L21)

## Usage

```tsx
import Image, { ImageProps } from 'next/image'

const CustomImage: React.FC<ImageProps> = (props) => (
  <Image {...props} unsized />
)
```
2020-11-09 06:20:54 +00:00
JJ Kasper
d10a6eca46
v10.0.2-canary.5 2020-11-08 18:13:02 -06:00
JJ Kasper
90a86e6723
Ensure auto-export dynamic routes work with i18n next start (#18930)
This ensures dynamic routes are correctly generated for `next start` with i18n and adds tests to the i18n suite to ensure they are working correctly. 

Closes: https://github.com/vercel/next.js/issues/18397
2020-11-08 02:18:13 +00:00
Joe Haddad
f1a6a36b3e
v10.0.2-canary.4 2020-11-07 12:39:58 -05:00
Steven
b2a8a2f99e
Fix html validation for Image component (#18903)
This PR fixes two bugs causing HTML validators to complain.

- Error: Bad value data:image/svg+xml;charset=utf-8, for attribute src on element img: Illegal character in scheme data: < is not allowed.
  - Fixed by using base64 for svg during `layout=intrinsic` to avoid angle brackets
- Error: Element img is missing required attribute src.
  - Fixed by using base64 transparent gif for `loading=lazy` placeholder

Fixes #18850
2020-11-07 17:39:14 +00:00
Dinesh Balaji
19febb10c0
feat: update create-next-app to init with main as initial branch (#17745)
When `create-next-app` is initialized a git repo, it now uses 'main' as the initial branch.

The branch master does not actually exist initially. The branches don't get created only when they have at least one commit. Until the branch gets created, the branch only exists in .git/HEAD. So there is no master branch initialized in the repo.

Closes: https://github.com/vercel/next.js/issues/17733

<img width="639" alt="Screenshot 2020-10-09 at 17 26 30" src="https://user-images.githubusercontent.com/4656109/95580229-9f3c6c80-0a54-11eb-967f-180eb9601c1a.png">
2020-11-07 14:46:17 +00:00
JJ Kasper
2effca8e03
Fix redirect query handling for param like values (#17448)
This makes sure to compile query values for rewrites/redirects as non-path items to prevent param like values e.g. `https://` from causing the destination to fail to compile. 

Fixes: https://github.com/vercel/next.js/issues/17440 
x-ref: https://github.com/vercel/next.js/issues/18670
2020-11-07 04:30:14 +00:00
Joe Haddad
c8fa284854
Control <Image /> prefetching with React (#18904)
This pull request fixes `<Image />` not updating when new props are passed by removing external DOM mutations and relying on React to do it instead.

As an added bonus, I've extracted the intersection observer from both the `<Image />` and `<Link />` component, as their instance can be shared!

The increase in size is minor (+3B), and actually a decrease for apps using both `<Image />` and `<Link />`.

---

Fixes #18698
Fixes #18369
2020-11-06 23:03:15 +00:00
JJ Kasper
39453bba69
v10.0.2-canary.3 2020-11-06 15:24:16 -06:00
JJ Kasper
f02f70478b
Ensure correct target is used for ncc'ing web-vitals (#18905)
This makes sure we don't use es6 syntax when compiling the `web-vitals` package with `ncc` since that breaks IE11 compatibility 

x-ref: https://github.com/vercel/ncc/pull/614
2020-11-06 21:02:28 +00:00
Joe Haddad
e9054744d8
Load CSS early instead of only preloading (#18846)
While we were fixing how Next.js handled CSS, we added a complex prefetch, preload, fetch sequence to acquire the CSS asset.

This unnecessarily overcomplicated what could've been only a `fetch()` from the very start!

---

Fixes #16932
2020-11-06 16:24:02 +00:00
Joe Haddad
6b8903f1b7
Upgrade cssnano (#18879)
Fixes #17066
2020-11-06 00:46:19 -05:00
Guy Bedford
8221c180a5
ncc 0.25.0 upgrade and fixes (#18873)
This upgrades to ncc@0.25.0 and fixes the previous bugs including:

* ncc not referenced correctly in build
* Babel type errors
* node-fetch, etag, chalk and raw-body dependencies not building with ncc - these have been "un-ncc'd" for now. As they are relatively small dependencies, this doesn't seem too much of an issue and we can follow up in the tracking ncc issue at https://github.com/vercel/ncc/issues/612.
* `yarn dev` issues

Took a lot of bisecting, but the overall diff isn't too bad here in the end.
2020-11-06 02:33:14 +00:00
Joe Haddad
80468ad4c2
Ensure we prefetch on hover (#18859)
* Ensure we prefetch on hover

* double because of hovering prefetch

* rerun workflow

* disable flaky test
2020-11-05 20:12:22 -06:00
Steven
d04186e480
Fix lazy loaded images on IE 11 when no IntersectionObserver detected (#18868)
Fixes #18827 so that lazy loading does not break IE 11.
2020-11-06 01:34:25 +00:00
Guy Bedford
4dbb65d0f1
yarn dev regression fix, ncc revert (#18861)
This fixes the current regression with an ncc revert for now.

I will continue to follow up with the ncc upgrade in https://github.com/vercel/next.js/pull/18860.
2020-11-06 00:47:31 +00:00
JJ Kasper
8799bd2b00
Fix chromedriver set-up to test electron separately (#18854)
* Fix chromedriver set-up to test electron separately

* Update workflow

* Update compiled
2020-11-05 14:45:21 -06:00
Joe Haddad
de80b0cc53
v10.0.2-canary.2 2020-11-05 14:56:52 -05:00
Steven
b684b110e4
Add props objectFit and objectPosition to Image component (#18849)
Fixes #18794
2020-11-05 19:42:55 +00:00
Joe Haddad
f8f0c6bb91
v10.0.2-canary.1 2020-11-05 09:26:25 -05:00
Guy Bedford
64850a8348
ncc Babel inlining (#18768)
This adds inlining for Babel and the Babel plugins used in next.

This is based to the PR at https://github.com/vercel/next.js/pull/18823.

The approach is to make one large bundle and then separate out the individual packages from that in order to avoid duplications.

In the first attempt the Babel bundle size was 10MB... using "resolutions" in the Yarn workspace to reduce the duplicated packages this was brought down to a 2.8MB bundle for Babel and all the used plugins which is exactly the expected file size here.

This will thus add a 2.8MB download size to the next package, but save downloading any babel dependencies separately, removing a large number of package dependencies from the overall install.
2020-11-05 14:23:01 +00:00
Bogdan Chadkin
f78ee06f5c
Upgrade browserslist (#17662)
Ref https://github.com/browserslist/browserslist/blob/master/CHANGELOG.md
2020-11-05 12:30:20 +00:00
Will Heslam
b3d9fd2a0d
Make getInlineScriptSource arg Readonly (#17281)
The rule [total-functions/no-unsafe-readonly-mutable-assignment](https://github.com/danielnixon/eslint-plugin-total-functions#total-functionsno-unsafe-readonly-mutable-assignment) triggers with this error message:
> Assigning a readonly type to a mutable type can lead to unexpected mutation in the readonly value

when invoking
```
      NextScript.getInlineScriptSource(this.props)
```
inside a `_document.tsx`'s render function.
due to `this.props` having the type:
```
props: Readonly<P> & Readonly<{ children?: ReactNode }>
```
in `@types/react`

On the other hand, this is a small, low-priority change (IMO), so an alternative work around is just to disable the lint rule for that line of course.

Lint, tests, and build passes.

Lint error was discovered using typescript@next, version `4.1.0-dev.20200921` and eslint-plugin-total-functions version `4.1.0`, but I tested the change to nextjs using typescript version `3.8.3`.
2020-11-05 12:03:45 +00:00
Joe Haddad
bc2282fa38
Speed up SSG prefetching (#18813)
This pull request speeds up Next.js' rendering pipeline by fetching data, parsing it, and loading it into memory instead of only doing the network request.

This will mainly result in improved Firefox/Safari performance since they handled prefetch incorrectly—only Chrome did it right. This also gets us closer to being able to use `no-store` in our caching headers!

---

Fixes #18639
x-ref #18802
2020-11-05 09:51:24 +00:00
Guy Bedford
7b66da83e3
Update ncc (#18823)
This updates to the latest ncc@0.24.1 release.

Initially I thought chalk needed to be removed to make this work, but it turns out it was a caching issue.

I've also added a cache clear to the rebuild command to avoid these issues hopefully in future.
2020-11-05 03:30:37 +00:00
JJ Kasper
2bafa3bdb2
v10.0.2-canary.0 2020-11-04 16:24:31 -06:00
JJ Kasper
a5cb28d907
Ensure redirects are handled properly from cache (#18806)
This updates the GS(S)P redirect handling to make sure to handle redirects correctly when coming from the incremental-cache. Additional tests have been added to ensure the redirects work correctly after the cache is populated. 

Fixes: https://github.com/vercel/next.js/issues/18735
Fixes: https://github.com/vercel/next.js/issues/18783
2020-11-04 22:18:44 +00:00
Guy Bedford
8f7f1018d2
ncc inlining optimizations (#18752)
This adds ncc inlining optimizations for the following dependencies:

* cacache
* schema-utils
* find-cache-dir
* mkdirp
* neo-async
* web-vitals

The slight increase in output in the reports here is due to the variation of the bundled version of web-vitals.

In addition, this moves ast-types to be a devDependencies entry instead of in dependencies as it was before https://github.com/vercel/next.js/pull/14746 as I could not see any production usage (ping @prateekbh). Happy to separate that out into a separate PR if preferred too.
2020-11-04 21:52:49 +00:00
Steven
b9bf68638b
Disable image optimization for Data URLs (#18804)
This PR disables image optimization and lazy loading for [Data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs), because the image data is already inlined.

Fixes #18372 
Fixes #18692
2020-11-04 21:14:55 +00:00
Steven
80fd3d5d17
Print error when Image src is protocol-relative (#18809)
This PR prints a pretty error when the Image `src` property is a [protocol-relative URL](https://www.paulirish.com/2010/the-protocol-relative-url/).

> Update 2014.12.17:
> Now that SSL is encouraged for everyone and doesn’t have performance concerns, this technique is now an anti-pattern. If the asset you need is available on SSL, then always use the https:// asset.

Fixes #18536
2020-11-04 20:47:49 +00:00
Joe Haddad
bb8a49ec83
Omit ignored property from <Image/ > to prevent confusion (#18796)
Fixes #18793
2020-11-04 16:13:07 +00:00
Tom
37ed2d23bb
Typo in err.sh url nextjs instead of next.js (#18787) 2020-11-04 14:03:16 +01:00
Guy Bedford
a1ea352911
Remove @babel/preset-modules (#18759)
This is a prerequisite to being able to ncc inline the Babel dependencies in next.js.

The removal of preset-modules is based on replacing it with preset-env under `targets: { esmodules: true }`, as per the guidance from the package (https://www.npmjs.com/package/@babel/preset-modules):

> Starting from @babel/preset-env 7.9.0, you can enable the bugfixes: true option to get the same behavior as using @babel/preset-modules, but with support for custom targets. If you need to target browsers with native modules support (like this preset does), you can use targets: { esmodules: true }.

From the above, I'm pretty sure this is entirely a backwards compatible change, apart from the change to the runtime plugin list being visible. Perhaps @developit can confirm this as well.
2020-11-04 06:53:39 +00:00
Cowboy Ho
28e12876b8
Fix router not working on some protocol (#16650)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-11-03 16:18:02 -05:00
Joe Haddad
3c3379412e
v10.0.1 2020-11-03 15:42:54 -05:00
Joe Haddad
89a3249f7c
v10.0.1-canary.7 2020-11-03 14:32:55 -05:00
JJ Kasper
f791577569
Ensure redirect from GS(S)P doesn't render (#18749)
This ensures we don't render the page un-necessarily when a redirect is returned from `getStaticProps` or `getServerSideProps`.

Possibly related: https://github.com/vercel/next.js/issues/18735
Closes: https://github.com/vercel/next.js/issues/18747
2020-11-03 16:40:50 +00:00
Eric Burel
b87b2d46ea
add rewrites in storybook preset (#18364) 2020-11-03 09:50:59 -05:00
Joe Haddad
27d7b76a39
Prevent Next.js from removing all of its styles on hydration (#18723)
Next.js would try to "recover" if its CSS assets went missing (i.e. a deployment occured) **while the page was initially loading**.

This handled a rare case where we'd try to let the Next.js complete hydrating even though a deployment occured.

However, in practice, this never worked: if the `fetch()` failed, that means the original assets never downloaded themselves (because the `fetch()` should be coming from disk cache).

Instead of letting Next.js get itself into a weird state, let's just stop hydration so that the page doesn't accidentally delete its styles.

The handle-no-styles behavior is already tested in `test/integration/css/test/index.test.js`. There was never a branch for it using its cached styles, so nothing else needs updated.

---

Fixes #17930
2020-11-03 12:50:15 +00:00
khades
b1503e13e8
Fix dynamic css unloading (#17173)
Serverside Dynamically loaded CSS module file insertion adds css-files as usual static files with special data-n-p tag, that is used in page transition logic. That files get removed on page transition cause they are not explicitly required in scope of page.

Mini-css-extract-plugin adds style tags at chunk insertion without any tags and leave them be, no matter how many page transitions were made.

I removed data-n-p tag from dynamically loaded css module files and added new data-n-d tag for it.

Fixes #16950
2020-11-03 05:23:31 +00:00
Joe Haddad
56bd464861
v10.0.1-canary.6 2020-11-02 22:31:17 -05:00
JJ Kasper
8277d4d5e3
Ensure multi-level basePath works properly (#18715)
This ensures the `basePath` property works correctly when a multi-level value is defined (`/hello/world`)

Fixes: https://github.com/vercel/next.js/issues/17889
2020-11-03 02:44:50 +00:00
Steven
2b94b1eea6
Update default widths configuration to handle 2x/3x DPI (#18717)
- Update default `deviceSizes`
- Add default `imageSizes`
- Use `layout` value to determine which `srcset` to use

Fixes #18420 
Closes #18714
2020-11-03 02:12:46 +00:00
JJ Kasper
3f84a55ba3
Ensure locale is added/stripped correctly (#18712)
This makes sure we don't incorrectly strip locale characters from the path if it is not a locale prefix e.g. `/fr` should not be removed from `/frank`. Additional tests have been added to ensure this isn't stripped for this case.

Fixes: https://github.com/vercel/next.js/issues/18332
2020-11-02 23:32:56 +00:00
JJ Kasper
7b6a61a750
Ensure correct locale is used for non-prefixed path (#18708)
When visiting a non-locale prefixed path (`/hello` instead of `/fr/hello`) we don't trigger locale redirects currently so if another locale is matched we need to ensure this is reset to the `defaultLocale` for rendering to prevent a mis-match on the client and the server.

This also fixes hydration errors from occurring with `asPath` for `getServerSideProps` pages due to `normalizeLocalePath` expecting only a pathname and `asPath` containing `hash` and `query values also. 

Fixes: https://github.com/vercel/next.js/issues/18337
Fixes: https://github.com/vercel/next.js/issues/18510
2020-11-02 23:00:41 +00:00
JJ Kasper
c8d26edf57
Allow passing statusCode for GS(S)P redirect (#18422)
This adds support for passing `statusCode` in a `redirect` from `getServerSideProps` or `getStaticProps` which matches the `redirect` shape allowed to be returned for `redirects` in `next.config.js`

Closes: https://github.com/vercel/next.js/issues/18350
2020-11-02 21:47:59 +00:00
JJ Kasper
a8d8f9aef9
Ensure localeDetection: false doesn't detect from header (#18695)
This ensures we don't detect the locale from the header when `localeDetection` is set to `false`

Fixes: https://github.com/vercel/next.js/issues/18482
2020-11-02 21:02:15 +00:00
JJ Kasper
faf4a0ab80
Ensure getStaticProps isn't called without params with i18n (#18702)
This corrects additional fallback pages being generated without the fallback flag causing `getStaticProps` to be called without params with i18n. The revalidation aspect of the issue has been corrected separately in https://github.com/vercel/next.js/pull/18569

Fixes: https://github.com/vercel/next.js/issues/18404
2020-11-02 20:41:34 +00:00
JJ Kasper
4e7835c95d
Ensure html lang is updating on locale transition (#18699)
This ensures the `html` tag's `lang` attribute is updated on client-transition when the locale is changing

Fixes: https://github.com/vercel/next.js/issues/18452
2020-11-02 18:54:20 +00:00
JJ Kasper
a529e6736f
Ensure preload works correctly with locale option (#18511)
* Ensure preload works correctly with locale option

* Fix conditional import

* Update size-limit tests

* DCE some code

* Resolve merge error

Co-authored-by: Tim Neutkens <timneutkens@me.com>
2020-11-02 11:22:40 -06:00
Joe Haddad
85e143e943
Rotate image from EXIF data (#18687)
Fixes #18643
2020-11-02 16:26:03 +00:00
Joe Haddad
2d5dbc480d
v10.0.1-canary.5 2020-11-02 09:00:01 -05:00
Carmelo Scandaliato
197d46ddb9
Remove the static optimization indicator (#18629)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-11-02 09:27:36 +01:00
Shun Kakinoki
fb58d95db7
fix: add missing dot to https://err.sh/nextjs (#18652)
Hi next.js team!
Was trying out the canary and came across the error!

The redirect to https://err.sh was to
`https://github.com/vercel/nextjs`, not
`https://github.com/vercel/next.js`
2020-11-02 02:02:28 +00:00
Steven
3fd1cc3ebb
Update 3rd party image loaders to prevent upscaling (#18647)
In PR #18147, we fixed the default loader to prevent upscaling images.

This PR fixes the same bug for 3rd party loaders.

---

Fixes #18648
2020-11-02 00:30:17 +00:00
Steven
377aa4b650
Fix image format for Safari and old browsers (#18646)
Older versions of Safari (and other browsers) do not support webp format so we were incorrectly falling back to png.

This PR fixes #18509 so that we fallback to the original image format if a modern format like webp was not explicitly provided in the Accept header.

Tests were added to ensure that the Accept header for Safari, Firefox, and Chrome work properly.
2020-11-01 23:53:36 +00:00
Joe Haddad
4dbf0d47b0
v10.0.1-canary.4 2020-11-01 01:15:03 -04:00
Minh Tu Le
ec3e41c3cb
Fix Symbol.protype.description polyfill (#18575)
Our code uses `core-js` to polyfill and because core-js [`es.symbol.description`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.description.js#L14-L16) doesn't just check for `Symbol.prototype.description`, it will try to polyfill again but fail to do so because Next.js polyfill is not configurable. By default, `Object.defineProperty` set `configurable` to `false`. 

Here are the screenshots of the error on Edge 44.18362.449.0 using Next.js v10.0.1-canary.1
![Screen Shot 2020-10-30 at 9 44 05 PM](https://user-images.githubusercontent.com/1637627/97771409-da810700-1af9-11eb-8900-fe49d718dc94.png)

![Screen Shot 2020-10-30 at 9 51 43 PM](https://user-images.githubusercontent.com/1637627/97771433-321f7280-1afa-11eb-8928-fa4d902a01dd.png)
2020-11-01 05:11:56 +00:00
JJ Kasper
fb07e95847
Ensure correct params are used with i18n revalidation (#18569)
This makes sure we don't use invalid `x-now-route-matches` which can occur when `i18n` default locale is visited and a prerendered page is matched. To correct this we first check if we are able to derive the correct params from the URL and then bail on parsing `x-now-route-matches` if we are. Additional test cases are being added in the builder to ensure we don't regress on this

x-ref: https://github.com/vercel/next.js/discussions/18443
Fixes #18602
2020-11-01 04:49:48 +00:00
Jan Potoms
c0ae2041a1
Avoid calling setState in callback ref (#18589) 2020-10-31 23:37:28 -04:00
Joe Haddad
f742b6d9bc
v10.0.1-canary.3 2020-10-31 22:52:19 -04:00
Steven
f8c32e556c
Add all deviceSizes to srcset for responsive and fill (#18594) 2020-10-31 20:26:57 -04:00
Joe Haddad
9569f5a31a
Deprecate Image unsized property and add layout="fill" (#18562)
This PR deprecates the `unsized` property from NextImage because the property did not accomplish the desired effect.

Users should rely on one of the new layouts instead:

- `<Image layout="fixed" />`
- `<Image layout="intrinsic" />`
- `<Image layout="responsive" />`
- `<Image layout="fill" />`

The `unsized` property will continue to work as-is in production but is deprecated and will throw in dev.

---

### TODO:
- [x] test `layout=fill` in typescript types
- [x] test `layout=fill` render behavior
- [x] test that `unsized` switches to `layout=fill`
- [x] test `next dev` erroring on `unsized`
- [ ] layout docs (tracked in issue #18554)
- [ ] both `layout=fill` and `layout=responsive` use all deviceWidths in the srcset

---

Fixes #18541 

Co-authored-by: Steven <steven@ceriously.com>
2020-10-31 18:34:06 -04:00
Joe Haddad
9de734a299
v10.0.1-canary.2 2020-10-31 16:03:23 -04:00
Steven
afa04d22db
Add layout prop to Image component (#18491)
This PR introduces a new `layout` property.

This allows 3 possible values (`fixed`, `intrinsic`, or `responsive`) which solve many use cases we have seen since 10.0.0 and will hopefully avoid usage of `unsized`.

Fixes #18351 

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-10-30 10:33:34 -04:00
JJ Kasper
4263318836
Ensure i18n context values are provided for blocking 404 (#18513)
This ensures we provide the current `locale`, `locales`, and `defaultLocale` in the context when rendering the 404 for a blocking SSG page

Fixes: https://github.com/vercel/next.js/issues/18505
2020-10-30 01:42:28 +00:00
JJ Kasper
598df6ac05
v10.0.1-canary.1 2020-10-29 13:02:21 -05:00
JJ Kasper
76504ebae3
Ensure custom routes handling with i18n (#18427)
This makes sure custom-routes function properly with i18n support. Since the `locale` is stripped from the `pathname` this re-adds when checking custom-routes to allow the locale to be matched against

Closes: https://github.com/vercel/next.js/issues/18349
2020-10-29 17:48:54 +00:00
Joe Haddad
50d98962c8
v10.0.1-canary.0 2020-10-29 09:34:20 -04:00
Tim Neutkens
b902ba120f
Update README.md 2020-10-29 11:50:54 +01:00
JJ Kasper
8b4d6246f3
Add err.sh for i18n config errors (#18425)
This adds an err.sh with info that can help when tracking down errors from invalid i18n config in next.config.js
2020-10-29 03:48:24 +00:00
Jason Miller
aac46c0be8
Fix Symbol.prototype.description (#18423)
Firefox 61:
<img width="513" alt="Screen Shot 2020-10-28 at 5 28 30 PM" src="https://user-images.githubusercontent.com/105127/97498751-1a51be00-1943-11eb-977a-832123363cef.png">

Chrome 61:
<img width="548" alt="Screen Shot 2020-10-28 at 5 26 55 PM" src="https://user-images.githubusercontent.com/105127/97498755-1c1b8180-1943-11eb-8423-bc4e044a1b00.png">

Safari 11:
<img width="477" alt="Screen Shot 2020-10-28 at 5 23 06 PM" src="https://user-images.githubusercontent.com/105127/97498761-1d4cae80-1943-11eb-9de2-e6b26644110a.png">

Fixes #17825
2020-10-29 03:26:32 +00:00