Commit graph

2723 commits

Author SHA1 Message Date
Tim Neutkens
e8e59a175e v9.5.2-canary.12 2020-08-10 14:35:25 +02:00
Tim Neutkens
d1701091b8
Add cli for @next/codemod (#16039)
Largely based on the code @threepointone wrote for react-codemod.

Co-Authored-By: Sunil Pai <threepointone@gmail.com>

Co-authored-by: Sunil Pai <threepointone@gmail.com>
2020-08-10 14:34:35 +02:00
Tim Neutkens
281318d50e v9.5.2-canary.11 2020-08-10 11:49:45 +02:00
Tim Neutkens
1738c02ae0 Update version of next-codemod to prepare for publishing 2020-08-10 11:49:13 +02:00
Tim Neutkens
37d2d15b6e
Resolve aliases modules (#16033)
Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
2020-08-10 11:45:10 +02:00
Tim Neutkens
62031ff24f
Move next-codemod to Next.js monorepo (#15536) 2020-08-10 11:14:53 +02:00
Tim Neutkens
f4433ceaa2 v9.5.2-canary.10 2020-08-10 09:50:15 +02:00
Tim Neutkens
843d58425b
Add browser polyfils for Node.js modules (webpack 5 backwards compat) (#16022)
This adds the following Node.js core polyfills only when the import is used:

- `path`
- `stream`
- `vm`
- `crypto`
- `buffer`

Fixes #15948

We'll have a separate issue about adding warnings for the usage of these modules in the browser, some polyfills like crypto are quite heavy and generally not needed for most applications (included accidentally through node_modules).
2020-08-10 01:26:21 +00:00
Amirali Esmaeili
4b6e9a45a3
Fix amphtml link rel not respecting basePath (#15949)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-08-08 15:15:00 +02:00
Prateek Bhatnagar
d8edb2eaa5
Bug fix: Font optimization (#15984)
Bug fix
- Do not remove spaces as it might mangle font names
2020-08-08 13:14:03 +00:00
Tim Neutkens
6f7dfe111c
Make helpers.ts compatible with ie11 (#15973)
Fixes #15680

This does not solve the issue that an error triggered will fail on shadowroots being created, however it does fix the general failure

Closes https://github.com/vercel/next.js/pull/15825
2020-08-07 14:13:24 +00:00
Tim Neutkens
7fc92a6c78 v9.5.2-canary.9 2020-08-07 09:39:18 +02:00
JJ Kasper
b1ef76df31
Fix asPath normalizing for non-dynamic pages (#15960) 2020-08-07 09:01:34 +02:00
Markoz Peña
6375026a41
Added Friendly error for res.redirect 🐝 (#15844)
## Which solves this PR

 Displaying a friendly error, when the user is only passing `statusOrUrl`(type number) and the second argument `url` is ignored.

**Example**

`res.redirect(307);` // Show friendly error

Closes: https://github.com/vercel/next.js/issues/15594
x-ref: https://github.com/vercel/next.js/pull/15603
2020-08-06 22:53:09 +00:00
Tom Dohnal
eb4be226fd
notify component when route hash changes (#13894)
This resolves https://github.com/vercel/next.js/issues/13659
2020-08-06 22:04:47 +00:00
Evil Rabbit
8fed0c3ab5
Improve Vercel's badge (#15946) 2020-08-06 12:35:36 -04:00
Jan Potoms
cbfb8cbcc7
Remove querystring from the client (#15378) 2020-08-06 12:32:58 -04:00
Joe Haddad
882288b532
Warn when Fast Refresh is disabled (React <16.10) (#15931) 2020-08-06 10:41:11 -04:00
Joe Haddad
2d42b8e076
Delay server start message until it's listening (#15929)
Fixes #15928

---

This would cause us to print the message too early and open the browser to a server that wasn't started yet. This waits until we're listening, but before the app is ready fully.
2020-08-06 06:47:01 +00:00
Joe Haddad
0923ee6db4
v9.5.2-canary.8 2020-08-05 16:46:28 -04:00
Joris
0fd1958ae4
Disallow re-export all exports from Next.js pages (#14325)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-08-05 16:21:40 -04:00
Joe Haddad
3c04111c9c
Adjust overlay modal padding on mobile (#15915)
This PR reduces padding on all [iPhone models](https://developer.apple.com/library/archive/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/Displays/Displays.html) to make the error easier to see when you have the debugger open.

Before
![image](https://user-images.githubusercontent.com/616428/89454188-5a334b80-d72e-11ea-8e0b-ce392615d814.png)


After
![image](https://user-images.githubusercontent.com/616428/89454129-40920400-d72e-11ea-903d-8a8178da2966.png)

---

Fixes #14702
Closes #14767
2020-08-05 19:51:46 +00:00
JJ Kasper
7d7a8fc300
Normalize serverless asPath value (#15914)
Since we now use query parameters to pass dynamic route params while routing on Vercel, this makes sure we normalize the request URL before populating the `asPath`

Fixes: https://github.com/vercel/next.js/issues/15879
2020-08-05 19:29:38 +00:00
Tim Neutkens
405e42e41e
Enhance module not found error (#15860)
Adds handling for module not found errors exposed by webpack. This ensures you see the actual stack line and code instead of a short message where you don't know where to go.

### Previous

<img width="794" alt="Screen Shot 2020-08-05 at 18 02 06" src="https://user-images.githubusercontent.com/6324199/89435935-d5542c00-d745-11ea-9ca7-c67f553364f9.png">


### New

<img width="769" alt="Screen Shot 2020-08-05 at 14 20 23" src="https://user-images.githubusercontent.com/6324199/89412212-f6595480-d726-11ea-81a3-398ab7036338.png">


Fixes #14711
2020-08-05 19:11:35 +00:00
Joe Haddad
46488fbcc6
v9.5.2-canary.7 2020-08-05 14:25:00 -04:00
Jan Potoms
5dbe0d0215
Allow absolute urls in router and Link (#15792)
Fixes https://github.com/vercel/next.js/issues/15639
Fixes https://github.com/vercel/next.js/issues/15820

To Do:
- [x] Doesn't work with `basePath` yet
2020-08-05 18:12:17 +00:00
Alex Castle
b6060fa4a5
Add experimental image post-processing (#15875)
This PR adds a second experimental post-processing step for the framework introduced by @prateekbh in #14746. The image post-processing step scans the rendered document for the first few images and uses a simple heuristic to determine if the images should be automatically preloaded.

Analysis of quite a few production Next apps has shown that a lot of sites are taking a substantial hit to their [LCP](https://web.dev/lcp/) score because an image that's part of the "hero" element on the page is not preloaded and is getting downloaded with lower priority than the JavaScript bundles. This post-processor should automatically fix that for a lot of sites, without causing any real performance effects in cases where it fails to identify the hero image.

This feature is behind an experimental flag, and will be subject to quite a bit of experimentation and tweaking before it's ready to be made a default setting.
2020-08-05 17:49:44 +00:00
Joe Haddad
fce1830d35
v9.5.2-canary.6 2020-08-04 22:28:36 -04:00
Joe Haddad
754ec6642a
Run Fast Refresh Loader in Babel Loader (#15851)
Next.js plugins like `@next/mdx` inject additional webpack loaders to compile files, but they omit the necessary loader for Fast Refresh to work.

Instead of making these files deopt out of Fast Refresh, we can automatically detect and inject the loader in these cases.

Fixes #13574
2020-08-04 21:24:56 +00:00
Joe Haddad
1968f7f552
v9.5.2-canary.5 2020-08-04 13:52:26 -04:00
Jan Potoms
92304404a4
Disallow basePath: false for internal routes (#15837) 2020-08-04 17:50:09 +00:00
jiangtao
35e4a370d9
fixed issue with runtime-config returning undefined when building or in a development environment (#15777)
fix https://github.com/vercel/next.js/issues/7713#issuecomment-643632270
2020-08-04 16:47:37 +00:00
Joe Haddad
e818389999
Add support for fallback: 'blocking' (#15672)
By popular request, this pull request adds support for returning `fallback: 'blocking'` from `getStaticPaths`.

This new mode will cause unknown paths to be rendered on-demand ("SSR") without the static (placeholder) fallback.

This feature is **currently experimental and should not be used in production yet**. It's currently flagged behind `unstable_`:

```
fallback: 'unstable_blocking'
```

TODO:

- [x] Next.js tests
- [ ] Add Vercel support
- [ ] Vercel tests

---

Fixes #15637
2020-08-04 15:10:31 +00:00
Tim Neutkens
668cc6a6f1 v9.5.2-canary.4 2020-08-04 12:35:24 +02:00
Darsh Patel
96a66c4bd3
incremental static generation and regeneration support in build manifest (#14365)
The icon is just something I thought might look good, can certainly be changed.
I've currently added incremental static generation support

Edit: Updated screenshot after 8037981
![Screenshot 2020-08-04 at 1 51 14 PM](https://user-images.githubusercontent.com/11258286/89270960-afe9f400-d659-11ea-8f18-197dc53b8beb.png)





Fixes: #14204
2020-08-04 08:42:18 +00:00
Jonathan G
6c59cbb46a
[Feature] Progress bar for static build (#15297)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-08-04 09:58:23 +02:00
Prateek Bhatnagar
1ea8bdcdc7
Bug fix: Font optimization (#15644)
- Fixes the serverless build for font optimizations
2020-08-04 07:54:08 +00:00
Kristóf Poduszló
aef6726eb8
Add missing nomodule polyfills and suggest using features only up to ES2019 for browser compatibility (#15772)
These changes aim to resolve most of the concerns raised in #15756. It adds missing polyfills for legacy browsers up until ES2019:

- Number.{parseFloat,parseInt}
- ~Math.{acosh,asinh,atanh,cbrt,clz32,cosh,expm1,fround,hypot,imul,log10p,log1p,log2,sign,sinh,tanh,trunc}~ _[Removed as these are [not widely used](https://github.com/vercel/next.js/pull/15772#discussion_r463957931)]_
  - While these may seem to weigh a lot, they barely add 1 kB to the resulting bundle:
    <img width="492" alt="gzip: 32 kB vs. 30.9 kB, Brotli: 28.8 kB vs. 27.8 kB" src="https://user-images.githubusercontent.com/14854048/89100961-1376e600-d3fc-11ea-90fd-3e6632b70220.png">
- ~Object.fromEntries~ _[Removed as [it's rarely used in user code](https://github.com/vercel/next.js/pull/15772#discussion_r463984612)]_

Also, the following features are now supported with build-time transforms:

- ~`globalThis` (gets transformed into `window` in browser environments)~ _[Removed as it [could break existing applications](https://github.com/vercel/next.js/pull/15772#discussion_r463956269)]_
- `export * as ns from 'module'`

The suggested TypeScript library version has been set to ES2018, so the features below become unavailable in type-checked files (they're not evenly supported by module-compatible browsers, either):

- Object.fromEntries
- String.prototype.matchAll
- String.prototype.replaceAll
- Promise.any + AggregateError
- WeakRef

As for the `import.meta` support, [webpack v5 seems to fix that](https://github.com/webpack/webpack/pull/11075), so it should eventually become an issue of the past.

---

Fixes #15756
2020-08-04 06:03:52 +00:00
Joe Haddad
8285df5ed2
v9.5.2-canary.3 2020-08-04 00:08:28 -04:00
Joe Haddad
48ca2f2cc5
Fix CSS grid-column shorthand syntax (#15848) 2020-08-04 00:08:09 -04:00
Tim Neutkens
e8c3190255
Support persisting the dev cache buster (#15827)
Same as #15483 but couldn't push to it

---

Closes #15483
Fixes #15828
2020-08-03 14:22:55 +00:00
Jan Potoms
b87e4989e2
Rename exportTrailingSlash to existing trailingSlash property (#15768)
In terms of url rewriting, `trailingSlash` supports everything `exportTrailingSlash` does. We can just share all other code paths and deprecate `exportTrailingSlash`.

This PR shows a deprecation warning when `exportTrailingSlash` is used.

Also fixes https://github.com/vercel/next.js/issues/15774

We can update the tests now or later. (I kept them the same to prove it's non-breaking)

To do:
- [x] Do we want to keep this? => nope 841d4efc51/packages/next/next-server/lib/router/router.ts (L329)
- [x] I kept `exportTrailingSlash` here. Do we want to rename that as well? => nope 2d9d649d49/packages/next/build/index.ts (L959)
2020-08-03 14:03:11 +00:00
Tim Neutkens
60f1d58c83
Fix some webpack 5 deprecation warnings (#15797)
- Use latest terser version (still 1 warning in the stable version which is an open PR)
- Add emitOnErrors instead of noEmitOnErrors
- Added trace-deprecations for Next.js core development
2020-08-03 12:57:17 +00:00
Tim Neutkens
210a6980d2
Solve large portion of webpack 5 deprecation warnings (#15806)
- Using `namedChunks` where possible, this will also allow for faster access to the chunks as we no longer have to look them up like we did before using `find`
- Using the new asset hooks introduced in the latest webpack beta
- Using the new externals function signature
2020-08-03 12:26:23 +00:00
Joe Haddad
ed0a47b110
v9.5.2-canary.2 2020-08-03 01:47:42 -04:00
JJ Kasper
9dd974dfca
Fix dotenv loading with cascading values (#15799)
Adds additional test cases for cascading env values and corrects behavior

Fixes: https://github.com/vercel/next.js/issues/15744
2020-08-02 20:15:11 +00:00
Jan Potoms
841d4efc51
Improve router types (#15775) 2020-08-01 18:13:03 +00:00
Jan Potoms
1b033423dc
Fix asPath of rewrite without basePath (#15760)
Fixes https://github.com/vercel/next.js/issues/15755
2020-08-01 11:51:47 +00:00
Joe Haddad
6366727550
v9.5.2-canary.1 2020-07-31 13:31:49 -04:00
Jan Potoms
ad5c736798
Remove unused error (#15748)
Irrelevant since https://github.com/vercel/next.js/pull/15379
2020-07-31 17:29:09 +00:00
Rafau
bcd1ba622e
[webpack5] Complile for ES5 (#15708)
I think this is necessary for IE11.

via [Webpack docs](https://webpack.js.org/migrate/5/#turn-off-es2015-syntax-in-runtime-code-if-necessary)


> By default, webpack's runtime code uses ES2015 syntax to build smaller bundles. If your build targets environments that don't support this syntax (like IE11), you'll need to set output.ecmaVersion: 5 to revert to ES5 syntax.


Thank you
2020-07-31 08:50:54 +00:00
Jan Potoms
c9e379c3bf
Fix wrong asPath on 404 (#15728)
Caught this while reviewing router code for https://github.com/vercel/next.js/pull/15710
2020-07-31 06:38:39 +00:00
Joe Haddad
dcb69ee92f
Strictly type react-dev-overlay (#15669)
Fixes #15668
2020-07-30 06:55:23 +00:00
Arsalan Khattak
3caa996096
Error overlay should not be dismissable for a server error (#14011) 2020-07-30 00:57:29 -04:00
JJ Kasper
ce56b60166
Add additional pageProps check (#15667)
`pageProps` should always be defined to ensure everything is working as expected although to prevent a breaking change this adds an additional check before attempting to access `pageProps` before hydration. It also adds tests to prevent regressing on this

Closes: https://github.com/vercel/next.js/issues/15647
2020-07-30 04:47:20 +00:00
Joe Haddad
6a48e3de60
v9.5.2-canary.0 2020-07-29 23:53:24 -04:00
Joe Haddad
cac35c389a
Fix hot reloader edge case with broken webpack plugins (#15659) 2020-07-29 23:44:25 -04:00
Joe Haddad
6b0c4948f0
v9.5.1 2020-07-29 23:11:48 -04:00
Joe Haddad
662d84b95b
v9.5.1-canary.3 2020-07-29 22:36:18 -04:00
Joe Haddad
8f914a3bcb
Fix error overlay hotlinking (#15658)
This pull request:

1. Relocates tests to correct location
1. Tests more scenarios
1. Fixes a bug with anchors at the start of error message
1. Fixes react key warning error

Fixes #15599
2020-07-30 00:58:36 +00:00
Darsh Patel
c1e5b66cd7
Fix: space issue in error overlay and add tests (#15617) 2020-07-29 19:30:18 -04:00
Joe Haddad
3d98171dab
Test webpack 5 beta (#15645) 2020-07-29 19:19:32 -04:00
Joe Haddad
b748b5a443
v9.5.1-canary.2 2020-07-29 13:18:18 -04:00
Jan Potoms
80998a05f7
Don't use assetprefix on getServerSideProps and getStaticProps (#15634)
Strictly use `basePath` and not `assetPrefix` on `getStaticProps` and `getServerSideProps`

Fixes https://github.com/vercel/next.js/issues/15563
2020-07-29 16:51:51 +00:00
JJ Kasper
1a0cdbeacb
v9.5.1-canary.1 2020-07-29 09:58:32 -05:00
JJ Kasper
dd6a08980a
Normalize missing optional value on Vercel (#15593)
This updates collecting dynamic route params on Vercel to make sure that missing optional dynamic routes are undefined. Additional tests for this mode have also been added to ensure the params are being collected properly

Closes: https://github.com/vercel/next.js/issues/15579
2020-07-29 14:19:25 +00:00
JJ Kasper
fc2167311e
Update header replacing to be more relaxed (#15592)
Instead of trying to parse header values as URLs and then replace path segments in them this switches to escaping characters that can break `path-to-regexp` compiling

Fixes: https://github.com/vercel/next.js/issues/15580
x-ref: https://github.com/vercel/vercel/pull/4942
2020-07-29 08:47:23 +00:00
Robert van Steen
6eea915456
Add better typing for redirect (#15603) 2020-07-29 09:01:21 +02:00
JJ Kasper
86ba29f654
Make sure link can render without router (#15604)
This ensures rendering `next/link` doesn't fail without being nested under the router context.

Closes: https://github.com/vercel/next.js/issues/15543
2020-07-29 06:56:33 +00:00
Christopher Robert Van Wiemeersch
3405fb9453
fix typo in eslint-plugin-next code comments (#15583)
(p.s. excited to use this package. thank you.)
2020-07-28 16:34:00 +00:00
Tim Neutkens
4730a1061d v9.5.1-canary.0 2020-07-28 14:08:23 +02:00
Darsh Patel
23eb267499
Make Links rendered in the error overlay clickable [ 14017 ] (#14055)
Co-authored-by: TodorTotev <51530311+TodorTotev@users.noreply.github.com>
2020-07-28 13:22:28 +02:00
Arsalan Khattak
edbb32cac9
Next.js prefetching should use requestIdleCallback (#14580) 2020-07-28 13:13:44 +02:00
Prateek Bhatnagar
fb81ecb2bd
Font optimizations (#14746)
Co-authored-by: atcastle <atcastle@gmail.com>
2020-07-28 12:19:28 +02:00
Darsh Patel
27c207da7b
Fix: UnhandledPromiseRejectionWarning when unknown flag provided for cli commands (#15422) 2020-07-28 12:12:57 +02:00
Jan Potoms
91242ca6d7
Ignore history state not created by next.js (#15379)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-28 12:02:00 +02:00
Jean Helou
17420c785c
improves baseUrl resolution in typescript monorepos (#13542) 2020-07-28 12:00:27 +02:00
Tim Neutkens
fdfc508a61
Add polyfill for process and Buffer in webpack 5 (#15499) 2020-07-28 11:33:21 +02:00
Gerald Monaco
71bc0db92a
Combine sendPayload and sendHTML (#15475) 2020-07-27 16:19:30 -04:00
Sebastian Benz
5636748708
upgrade @ampproject/toolbox-optimizer to 2.5.14 (#15463) 2020-07-27 18:12:33 +00:00
Tim Neutkens
d33dbea8dc v9.5.0 2020-07-27 16:55:16 +02:00
Joe Haddad
1ee151640e
v9.4.5-canary.45 2020-07-27 01:59:19 -04:00
Joe Haddad
ac12c07ce5
Fix peer dependency (#15511) 2020-07-27 01:58:36 -04:00
Joe Haddad
3accce37a7
v9.4.5-canary.44 2020-07-27 00:23:23 -04:00
Joe Haddad
e837c2253d
Upgrade cssnano-simple dependency (#15488) 2020-07-26 23:56:36 -04:00
Jan Potoms
574fe0b582
Make dynamic routes case-sensitive (#15444)
Fixes https://github.com/vercel/next.js/issues/15377
Closes https://github.com/vercel/next.js/pull/15394
2020-07-25 05:11:42 +00:00
James Mosier
f22f88fd73
Always resolve after router.prefetch() (#15448)
In development or with an invalid href, `await router.prefetch()` would not resolve the promise. This PR ensures that `await router.prefetch()` always resolves, no matter if it succeeds or not.

Fixes: https://github.com/vercel/next.js/issues/15436
Relevant discussion: https://github.com/vercel/next.js/discussions/15431#discussioncomment-41264
2020-07-25 04:36:43 +00:00
Tim Neutkens
c5f29b76ea
Update webpack to land chokidar patch for all Next.js users (#15460)
Forces all Next.js users to have this patch installed: https://twitter.com/timneutkens/status/1282129714627448832

Huge thanks to @paulmillr and @sokra 🙏
2020-07-24 19:23:23 +00:00
Luis Alvarez D
681ebfa5cb
Fix lint (#15449) 2020-07-23 21:10:41 -05:00
Mehedi Hassan
00ebce5553
More helpful README (#14830)
* More helpful README

Updated to include more details about Next.js, link to the interactive tutorial, showcase, etc. Content mostly based on the official Next.js site.

* create-next-app readme

An updated readme with more details on options, benefits, etc.

* Apply edits from code review

Co-authored-by: Luis Alvarez D. <luis@vercel.com>

* Remove redundant intro

* Update packages/create-next-app/README.md

* Remove introduction and list in showcase

* Apply suggestions from code review

* Update packages/next/README.md

Co-authored-by: Luis Alvarez D. <luis@vercel.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-23 20:56:32 -05:00
Joe Haddad
53a3ffea25
v9.4.5-canary.43 2020-07-22 02:20:02 -04:00
Joe Haddad
4898d24f9a
Fix Peer Dependency in React Refresh Utils (#15375)
Fixes #15342
2020-07-21 13:33:25 -04:00
Jan Potoms
fcfbceaa7e
Fix cancellation control flow (#15361) 2020-07-21 13:33:11 -04:00
Joe Haddad
0866ce3f5c
v9.4.5-canary.42 2020-07-20 16:19:48 -04:00
Jan Potoms
7dd61b47a2
Fix basepath router events (#14848)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-07-20 16:03:49 -04:00
Joe Haddad
d5c1addd64
Simplify trailing slash regex (#15335) 2020-07-20 14:24:43 -04:00
Tim Neutkens
c40f407d82
Stabilize revalidate (#15338) 2020-07-20 14:23:51 -04:00
Joe Haddad
a45def87a2
v9.4.5-canary.41 2020-07-20 13:00:54 -04:00
Joe Haddad
a11d99390a
Stabilize Trailing Slash API (#15331)
Closes #15330
2020-07-20 16:16:59 +00:00
Tim Neutkens
047b73b824 v9.4.5-canary.40 2020-07-20 17:39:41 +02:00