Commit graph

6379 commits

Author SHA1 Message Date
Joe Haddad
91664d1d02
Eliminate public folder enumeration (#14042)
This builds off of @timneutkens's PR instead of updating it because it's his `canary` branch.

Updated to still `stat`, as it's the only way to test the difference between a file and directory. 

---

Closes #13506
Fixes #12235
2020-06-10 20:35:34 +00:00
Joe Haddad
80036fd9dd
Fix Fast Refresh with Page Config (#14041)
Fixes #13978
2020-06-10 19:56:05 +00:00
JJ Kasper
d5493ff24d
Fix dynamic route match and basePath (#14036)
This correctly strips the `basePath` before generating the `route-matcher` for dynamic routes and adds regression tests to ensure these work correctly with the `basePath` feature

Closes: https://github.com/vercel/next.js/issues/13966
2020-06-10 18:26:57 +00:00
Shu Uesugi
dea4c2cbf4
ButterCMS Example (#13908)
[ch2580]

**Demo:** https://next-blog-buttercms.now.sh/
**Preview Mode:** https://next-blog-buttercms.now.sh/api/preview?secret=CdEAKMRT4tAwzqiD&slug=draft-post-test
2020-06-10 17:13:10 +00:00
JJ Kasper
ad2c1a8a16
Make sure to watch all next-server files (#14023)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-06-10 11:27:37 -05:00
stefanprobst
caddd355f7
fix: add plugin to recommended eslint-plugin-next config (#13926)
allow extending the recommended eslint-plugin-next config, without having to specify the plugin name in the plugins array. eslint does not do this automatically, see the note [here](https://eslint.org/docs/developer-guide/working-with-plugins#configs-in-plugins)
2020-06-10 15:01:57 +00:00
Ben Spinks
a9891095ec
Invert colors of compiling indicator (#13995)
Hi,

This PR inverts the colors for the compiling indicator, closes #13952.

The second commit makes the styling consistent with the prerender indicator (height and border)

From:
![before](https://user-images.githubusercontent.com/32001471/84236653-df640080-aaef-11ea-8532-a5d65cab5cc3.gif)

To:
![after](https://user-images.githubusercontent.com/32001471/84247287-c6fbe200-aaff-11ea-9eff-a16c42a7b625.gif)
2020-06-10 13:15:35 +00:00
Darsh Patel
f24eb4fd4a
Added .next folder to gitignore for examples/blog-starter (#14003)
```.next``` folder wasn't in the gitignore file causing .next folder to be tracked by git
2020-06-10 10:09:42 +00:00
Dylan Jhaveri
d5f5b5f29b
with-mux-video update (#13992)
* function rename
* update package.json dependencies to use `^` for semver. I noticed the package-lock.json is not committed in these examples, which seems to be intentional. Is it advisable to use semver for dependencies? This could actually break if someone clones, installs and a newer version of something has a breakage, but in general it might be nice to have folks installing the latest patch releases for deps.
* use Upchunk 2.0.0. with 1000x [better progress reporting on uploads](https://github.com/muxinc/upchunk/releases/tag/v2.0.0)

**Notice the progress %**

Upchunk pre 2.0:

![before-loading](https://user-images.githubusercontent.com/764988/84232581-70fa5080-aaa5-11ea-8db8-2cfe50339b43.gif)

Upchunk 2.0:

![after-loading](https://user-images.githubusercontent.com/764988/84232620-85d6e400-aaa5-11ea-82cc-b348ead1f5de.gif)
2020-06-10 07:05:14 +00:00
Joe Haddad
54ac432390
v9.4.5-canary.9 2020-06-10 00:51:04 -04:00
Joe Haddad
d874329d11
Prioritize webpack bootstrapping first (#13987)
Webpack will randomly execute script order if its runtime is not prioritized before chunks execute.

This seems to be somehow triggered in #13870 because of slightly different script ordering.

This had actually broke CSS, which is why our tests are failing 50% of the time:

Without this PR:
![image](https://user-images.githubusercontent.com/616428/84221491-57f0a000-aaa3-11ea-9dff-c27c87d29ac5.png)

However, it's still problematic to use `async` in development since we rely on script execution order. So, this PR disables `async` in development.

We're exploring `defer` in the future anyway (over `async`), which will be ordered, so I don't mind diverging between dev and prod in this way.

---

Fixes #13911
2020-06-10 04:41:59 +00:00
Luis Alvarez D
43271821f2
[Examples] Move with-typescript-graphql to SSG (#13854)
Related to https://github.com/vercel/next.js/issues/11014
2020-06-10 04:14:53 +00:00
Luis Alvarez D
9dc902835c
[Examples] Move api-routes-apollo-server-and-client-auth to SSG (#13849)
Related to https://github.com/vercel/next.js/issues/11014

The authentication method has been replaced with an improved version of the passport example.
2020-06-10 03:46:11 +00:00
James Mosier
aed8b37529
Fix variable shadowing in blog-starter example (#13988)
Sorry for the super trivial PR. I noticed this while working with the example and figured it might be worth fixing.
2020-06-10 03:30:22 +00:00
James Mosier
d51fef5fc9
chore(create-next-app): remove example picker (#13977)
If a user does not specify `--example` when using create-next-app then just spin up the default template and only prompt them for the name of their project.

if a user does specify `--example` (with no string after it) then show them the example picker. 

Closes #13960
2020-06-10 03:14:24 +00:00
Luis Alvarez D
3a9fbd8396
[Examples] Move with-apollo-and-redux to SSG (#13779)
Ref: https://github.com/vercel/next.js/pull/13742
2020-06-09 21:11:45 +00:00
JJ Kasper
06ac0adcf8
Add scroll restoration handling after render is complete (#13914)
This adds scroll restoration handling to make sure the correct scroll position is restored after navigating back/forward to a page and the rendering hasn't completed by the time the default browser scroll restoration has taken place. 

An initial failing test case was added which is working with the changes in this PR, if there are any other cases that should be added let me know and I can make sure we have them to ensure we don't regress on this behavior

---

Fixes #12530
2020-06-09 20:53:44 +00:00
Jason Miller
f2e29f6ade
[Examples] using-preact: add Prefresh, DevTools & chunking fix (#13976)
This adds [prefresh](https://github.com/JoviDeCroock/prefresh) and [preact/debug + DevTools](https://preactjs.com/guide/v10/debugging/) during development. It also fixes the chunking/splitting configuration for production builds by creating a `preact` chunk based on the existing framework chunk.

I'm still considering publishing the config here as a plugin, since I worry about the copy-paste effect on this much regex-foo.

/cc @jovidecroock
2020-06-09 20:35:52 +00:00
Jan Potoms
9da99bcb66
Prepare custom routes loading for adding additional routes (#13857)
Extracted from https://github.com/vercel/next.js/pull/13333, the same exact code lives in that PR as well, but we can merge this separately if it makes reviewing https://github.com/vercel/next.js/pull/13333 easier

This PR does 3 things 
- deduplicate code from build and next-dev-server that loads custom routes from next.config.js  (`loadCustomRoutes`)
- in `loadCustomRoutes`, load these rewrites, headers and redirects configs concurrently instead of sequentially.
- in next-server, make `this.customRoutes` always defined, this allows us to remove the big `if` around its initialization code in `generateRoutes`, which in turn makes it possible to reuse this code for other routing than user defined routes, which is how https://github.com/vercel/next.js/pull/13333 adds its redirects.
2020-06-09 20:16:23 +00:00
Joe Haddad
7d648dace1
Change text from "Attention" to "Warning" (#13973)
Fixes #13972
2020-06-09 19:43:15 +00:00
JJ Kasper
b1025995b2
Update to reject when test command fails (#13722)
As noticed in https://github.com/vercel/next.js/pull/13506 when a build or export command fails the tests can just stall. This attempts to address that by rejecting when the command doesn't exit correctly and `stdout` and `stderr` aren't being looked at
2020-06-09 18:28:15 +00:00
Jayden Seric
9fea9dbe6d
Update the with-graphql-react example (#13928)
- Removed the manual `fetch` polyfill as that is handled automatically by Next.js now.
- Updated dependencies, including [`graphql-react`](https://github.com/jaydenseric/graphql-react) and [`next-graphql-react`](https://github.com/jaydenseric/next-graphql-react).
- Removed `next.config.js` as it’s no longer required for [`next-graphql-react`](https://github.com/jaydenseric/next-graphql-react).
- Renamed the index page component from `Home` to `IndexPage`.
- Tweaked the [`graphql-react`](https://github.com/jaydenseric/graphql-react) bundle size mentioned in the readme.
2020-06-09 18:06:19 +00:00
Sebastian Benz
adf1a24ccb
Update AMP Optimizer to 2.5.1 (#13925)
Most notable new feature: automated hero image preloading.

Release notes: https://github.com/ampproject/amp-toolbox/releases/tag/v2.5.1
2020-06-09 09:08:29 +00:00
Wilbert Abreu
d3f0aee0ee
Adding Example: with-recoil (#13380)
Co-authored-by: Wilbert Abreu <wilbert.a.abreu@aexp.com>
Co-authored-by: Luis Alvarez <luis@vercel.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-06-08 21:33:08 -04:00
Todor Totev
47e2beba20
[Example] Deprecate with-sentry in favor of with-sentry-simple (#13904)
Co-authored-by: Luis Alvarez D <luis@vercel.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-06-08 21:32:23 -04:00
Tim Neutkens
2920af7cd3
Combine taskr next-server tasks into one (#13842)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-06-08 21:32:09 -04:00
Shyam Gupta
506116c7d0
chore: remove-redundant-example-react-import (#13907)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-06-08 21:31:56 -04:00
Luis Alvarez D
258f8c0e4e
[Examples] Move with-react-relay-network-modern to SSG (#13878)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-06-08 21:31:22 -04:00
Joe Haddad
72ddfeb6a1
v9.4.5-canary.8 2020-06-08 14:12:17 -04:00
Tim Neutkens
2169c0ce97
Use buildManifest to load page JS (#13870)
Initial work to use chunkhashes instead of buildid for the page files in production. This does not change the calculation of the filename itself initially.
2020-06-08 18:11:00 +00:00
Luis Alvarez D
b4ec992815
[Examples] Move with-graphql-hooks to SSG (#13858)
Related to https://github.com/vercel/next.js/issues/11014

The setup is very similar to the one used for Apollo examples.

@Joezo I've removed the demo example that you added to the readme (https://github.com/vercel/next.js/pull/6482) as it will be outdated after this PR is merged.
2020-06-08 16:23:34 +00:00
JJ Kasper
8dd3d2a8e2
Update handling for basePath to only automatically add (#13817)
As discussed, this streamlines the handling for `basePath` to not automatically strip and add the `basePath` when provided to `next/link` or `router.push/replace` and only automatically adds the `basePath` and when it is manually provided it will cause a 404 which ensures `href` still matches to the pages directory 1-to-1.

This also adds additional test cases that we discussed to ensure this behavior is working as intended

---

Fixes #13902
2020-06-08 15:59:50 +00:00
Luis Alvarez D
154c4958b0
[Examples] Move with-relay-modern to SSG (#13882)
Related to https://github.com/vercel/next.js/issues/11014
2020-06-08 15:41:47 +00:00
Todor Totev
1c91a46c3c
Fix message on getStaticPaths conflict with getServerSideProps (#13874)
* initial

* Update tests

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-06-08 10:25:37 -04:00
Jan Potoms
08b2e9b3ba
Remove some leftovers after index page updates (#13876) 2020-06-08 16:17:03 +02:00
Akindolie Oluwatayo
b922fe8abf
Update README.md (#13899)
Few text corrections.
2020-06-08 14:12:38 +00:00
not
319b858e77
fix typo in comment (#13883) 2020-06-08 01:03:38 +00:00
Simon Goldin
c61fd50419
update test snapshot in with-typescript-eslint-jest (#13847)
Updating snapshot for https://github.com/vercel/next.js/pull/13732 where the `toMatchSnapshot` expectation moved to another test.
2020-06-07 23:54:16 +00:00
Jan Potoms
989b6ad145
Preserve url better in exportTrailingSlash (#13840)
Discovered while doing https://github.com/vercel/next.js/pull/13333. `#` or `?` used to be stripped if there wasn't a value behind
2020-06-07 17:15:06 +00:00
Tim Neutkens
e125d905a0
Clean up render.tsx options (#13759)
Went through and removed a bunch of internal options which are just pass-through values of buildManifest

Closes #13851
2020-06-06 23:00:03 +00:00
Rafael Almeida
a89afc2ec6
Add FAQ section to Built-in CSS Support (#13846)
I added a FAQ section to answer questions I see frequently. Motivation: https://github.com/vercel/next.js/discussions/13625#discussioncomment-23186
2020-06-06 22:40:04 +00:00
Todor Totev
2ede86ffa9
[Examples] Remove getInitialProps from with-rematch (#13834)
Related to [11014](https://github.com/vercel/next.js/issues/11014)
2020-06-06 16:57:16 +00:00
matamatanot
38519c626e
refactor: Use native fs instead of fs-extra and promisify (#13841)
**add-comment.js**
`writeFile` is not unique to `fs-extra`. 

**lib/find-page-file.ts**
ref: #12026
2020-06-06 15:40:06 +00:00
Luis Alvarez D
792a113d48
[Examples] Move api-routes-apollo-server-and-client to SSG (#13782)
Ref: https://github.com/vercel/next.js/pull/13742
2020-06-06 13:04:52 +00:00
Shu Uesugi
1935196e5e
Prefer docs site for documentation links in CMS examples (#13826)
[ch579]

Some README files in `examples/cms-*` were linking to a documentation markdown file inside the repo (e.g. `/docs/basic-features/pages.md`) instead of the documentation website. We should always link to the documentation website from an example README file because (1) the website has better UX and (2) as we’re creating the examples pages on `next-site` (https://github.com/vercel/next-site/pull/672), we’d like to avoid extra processing of markdown content.
2020-06-06 00:23:20 +00:00
Rafael Almeida
813b1e62c5
Add App.getInitialProps example to the TypeScript page (#13785)
I added the commented code with the `AppContext` type to match the example from the [Custom App](https://nextjs.org/docs/advanced-features/custom-app) page. But since this is the TS page I think we could remove these comments and use a clean example, what do you think? 🤔
2020-06-05 18:03:31 +00:00
Ty Mick
c33757f1ad
Fix base path handling with URL queries in dev server (#13560)
So I can't *entirely* explain why, but I believe this fixes #13132. 🙈 I basically ended up looking around at other `_next` URLs (are those asset URLs?) around the project and seeing that they tended to use `delBasePath()` to remove the base path from the current page's path whenever it was used.

When testing locally with the [repo submitted with the issue](https://github.com/robertovg/next-base-path-example), I no longer experience the constant page-reloading in dev mode when adding a query string to the URL.
2020-06-05 17:47:16 +00:00
Joe Haddad
064fcb6c3d
Stabilize CSS HMR Tests (#13811)
Fixes failure seen here:
https://github.com/vercel/next.js/pull/13782#issuecomment-639563107
2020-06-05 17:28:56 +00:00
Dan Williams
2c8ab89e37
Fixed graphql-hooks example data prefetch (#13799)
- Fixes the Next.js `with-graphql-hooks` example so that data is prefetched during SSR:
    - The example was using an old version of `graphql-hooks` where SSR was broken
    - It had a bug where the `graphql-hooks` client passed in to the `AppTree` as a prop was not being used (instead was creating a new client every time)

This resolves https://github.com/nearform/graphql-hooks/issues/439 for `graphql-hooks`.
2020-06-05 17:11:40 +00:00
Todor Totev
b12f5a2669
[Examples] Remove React.FC from with-stripe-typescript (#13803)
Related to [this](https://github.com/facebook/create-react-app/pull/8177).

Let me know if you want me to change something.
2020-06-05 16:17:36 +00:00