Commit graph

6502 commits

Author SHA1 Message Date
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
Tim Neutkens
e57b2091aa
Bring over fixes from #15185 (#15326)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-07-20 11:14:02 -04:00
Bogdan Chadkin
a26c69d11d
Upgrade browserslist (#15324)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-07-20 10:01:34 -04:00
Darsh Patel
8f888c9f90
Update react-md url for with-react-md (#15325)
Low hanging fruit 🍎 
Resolves: #15321

`https://react-md.mlaursen.com/` -> `https://react-md.dev/`
2020-07-20 13:36:23 +00:00
Joe Haddad
42014a49af
v9.4.5-canary.39 2020-07-19 22:20:41 -04:00
Tim Neutkens
aa62fa7f42
Add test for main.js in webpack.config.js (#15311)
This particular variable was not being read correctly. Added a test for the behavior.

Fixes #15261
2020-07-20 02:16:50 +00:00
Jan Potoms
548ca82041
Verify that dataroutes work correctly with assetPrefix (#15309)
Fixes https://github.com/vercel/next.js/issues/12046
Fixes https://github.com/vercel/next.js/issues/11992
Closes https://github.com/vercel/next.js/pull/13456
2020-07-19 20:02:27 +00:00
Joe Haddad
13a971c8b5
Do not duplicate compilation errors (#15299)
* Do not duplicate compilation errors

* Add tests

* Attempt to fix test

* Fix test
2020-07-19 14:09:41 -04:00
Joe Haddad
2aca32d740
[internal] Fix Fast Refresh tests on macOS (#15300) 2020-07-19 03:48:58 -04:00
Joe Haddad
b8bd3c3309
Add missing gitignore files 2020-07-19 02:02:40 -04:00
Joe Haddad
b1cfa51b47
v9.4.5-canary.38 2020-07-19 01:53:53 -04:00
Necmettin Karakaya
c2f38f2af0
[Fix] common misspelling errors (#15288)
For reference: https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
2020-07-19 04:38:20 +00:00
Ayush
eb6589ab16
Updated import filename to the correct one (#15298) 2020-07-19 04:20:58 +00:00
Jan Potoms
381e44f324
Fix static data fetching when using absolute assetprefix (#15287)
Fixes https://github.com/vercel/next.js/issues/15188

`parseRelativeUrl` was used on urls that weren't always relative. It was used to generate a cache key, but we actually don't need these cache keys to be relative if the urls aren't relative.

Also took a look at the overall static data fetching logic and found a few things:

- [x] cache key is unnecessarily transformed through `prepareRoute`, we can just cache by resolved `dataHref` and remove that function. Pretty sure that `prepareRoute` was also introducing edge cases with `assetPath` and `delBasePath`
- [x] there is [a bug in the caching logic](ebdfa2e7a3/packages/next/next-server/lib/router/router.ts (L898)) that made it fail on the second visit: it should be `Promise.resolve(this.sdc[pathname])` instead of `Promise.resolve(this.sdc[dataHref])`. Also added a test for this
- [x] ~converted to async await to improve stacktraces and readability.~ I assumed this was fine since I saw some async/awaits in that file already but it seems to just blow up the size of the non-modern bundle.
- [x] extracted nested `getResponse` function and define it top level. this should improve runtime performance
- [x] convert `_getStaticData` and `_getServerData` to class methods instead of properties. Not sure why they were defined as properties but I think they belong on the prototype instead.
- [x] remove `cb` property from `fetchNextData`, it's unnecessary and makes the async flow hard to understand.  The exact same logic can go in the `.then` instead.
- [ ] data fetching logic [retries on 5xx errors](ebdfa2e7a3/packages/next/next-server/lib/router/router.ts (L157)), but not on network level errors. It should also retry on those. It should also not retry on every 5xx, probably only makes sense on 502, 503 and 504. (e.g. 500 is a server error that I wouldn't expect to succeed on a retry)

The overall result also is a few bytes smaller in size
2020-07-19 04:02:01 +00:00
Prateek Bhatnagar
4422be3276
Only required polyfill.io lint rule (#15277)
- Introduces a lint rule which points towards the unwanted polyfill.io features.
- Aim here is to make the user aware that which of the requested features are actually required vs which are already covered under `next-polyfills`

Next step: If the remaining required polyfills amounts to a only a few KBs then its better to include them in 1P javascript and remove the third party render blocking script tag.
2020-07-18 23:54:38 +00:00
Bruno Bernardino
3bfc25db9f
Clarify optional catch all vs catch all routes (#15290)
Makes the difference between optional catch all routes and catch all routes clearer.

Closes #15229
2020-07-18 20:13:47 +00:00
Jerry Gao
4a136476e7
Fix broken example link in docs for catch all routes (#15295)
Fixes a broken link on https://nextjs.org/docs/routing/dynamic-routes

This path was updated from `pages/docs/[...slug].js` to `pages/docs/[[...slug]].js`, so I've updated the link and moved that example down to the "Optional catch all routes" section.
2020-07-18 19:54:40 +00:00
Joe Haddad
f5b186cb69
Drop module: esnext requirement in tsconfig.json (#15276)
Next.js forcibly setting `module: 'esnext'` in `tsconfig.json` is necessary to prevent TypeScript from erroring on the following code:

```tsx
import dynamic from 'next/dynamic';

const A = dynamic(() => import('../A'));
```

```
ERROR in /Users/joe/Desktop/scratch/test-cjs/pages/index.tsx(5,25):
5:25 Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
  > 5 | const A = dynamic(() => import("../test"));
```

However, users may want to use one of the many other targets for better interoperability with projects that co-exist with their Next.js project (like `commonjs`).

When cross referenced with:
```
Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'.ts
```

That means we can permit any of these values:

```json5
      parsedValues: [
        ts.ModuleKind.ES2020,
        ts.ModuleKind.ESNext,
        ts.ModuleKind.CommonJS,
        ts.ModuleKind.AMD,
      ],
```

This PR updates Next.js to allow those!

---

Fixes #15275
2020-07-18 19:37:13 +00:00
Tim Neutkens
4d944a2bfb
Fix no-anon-default-export for webpack 5 (#15293)
Fixes one of the cases of https://github.com/vercel/next.js/pull/15185#issuecomment-660128647
2020-07-18 18:34:05 +00:00
João Pedro Schmitz
25488f4a03
chore(examples): update prismic-javascript to 3.0.1 (#15263)
This PR updates Prismic libraries to their latest version. 

Since the `previewSession` method was deprecated on version 3.0.1 we need to use `getPreviewResolver`. 

[Docs for in-Website Preview in Javascript
](https://prismic.io/docs/javascript/beyond-the-api/in-website-preview#17_0-processing-the-preview-token-with-getpreviewresolver-method)

ps: I have tested it and it works correctly.
2020-07-18 16:43:02 +00:00
Steven
ebdfa2e7a3
[create-next-app] Add engines to package.json (#15282)
This matches Next.js engines https://github.com/vercel/next.js/blob/canary/packages/next/package.json#L212-L214
2020-07-18 04:22:34 +00:00
Luis Alvarez D
a866937b47
[Examples] Remove with-universal-configuration-runtime (#15268) 2020-07-17 17:09:12 -04:00
David Stotijn
48621b3c7e
Update to 3.0 in api-routes-apollo-server-and-client example (#15270) 2020-07-17 16:25:41 -04:00
kevin sproles
5e9f3102b8
Update MST typescript example to use hooks (#15237)
1. Switched from class components to functional components with hooks (https://reactjs.org/docs/hooks-effect.html)
2. Removed inject pattern (which is obsolete) in favor of hooks (https://mobx-react.js.org/recipes-migration)
3. Switched to mobx-react-lite
2020-07-17 18:42:36 +00:00
Luis Alvarez D
a475480745
[Examples] Remove broken demo from with-graphql-faunadb (#15267)
Fixes https://github.com/vercel/next.js/issues/15219

This is better than replacing the demo as having a demo could allow users to post any kind of comments that we can't control.
2020-07-17 16:44:32 +00:00
Sarbast Mohammed
279da6317c
Update with-universal-configuration-build-time example (#15228)
Co-authored-by: Luis Alvarez <luis@vercel.com>
2020-07-17 11:24:23 +02:00
Tim Neutkens
569a289c84 v9.4.5-canary.37 2020-07-17 11:08:33 +02:00
Wayne Warner
7834766907
Fix DevServer#close doesn't close all resources (#15247) 2020-07-17 09:07:48 +00:00
Tim Neutkens
a33bb5bec5
Fix app-document-import-order test for webpack 5 (#15224) 2020-07-17 10:38:06 +02:00
Mario Beltrán Alarcón
56d62a52fd
docs: include test env in default env vars (#13708)
[Current Environment Variables doc](https://nextjs.org/docs/basic-features/environment-variables#default-environment-variables) mentions `development` and `production` env options but nothing about `test`. Test env is a 3rd valid option, and actually has some implications for `.env.local` from [what I can see in load env configs mechanism](https://github.com/vercel/next.js/blob/canary/packages/next/lib/load-env-config.ts#L68).

This PR aims to include corresponding `test` info for environment variables.
2020-07-17 01:36:12 +00:00
Balint Lendvai
f3f4ca3ef5
Update examples/with-carbon-components (#15190)
The example used an outdated version of carbon components v9.

The latest got a huge facelift, new components and a lot of optimizations.
I updated the example with carbon-components v10.
2020-07-17 01:17:58 +00:00
Luis Alvarez D
14eb907c60
[Examples] Improve with-sentry readme (#15205)
The current readme has wrong instructions and it's not clear enough about how to get the app running, also added deploy to Vercel buttons.
2020-07-17 00:58:43 +00:00
anotherjsguy
5d2e960c6c
(chore) Add with-filbert as example (#15161)
This PR adds an example for [filbert-js](https://filbert-js.vercel.app/docs/introduction) 🖌️
I have locally run the example & it's working as expected.
2020-07-16 23:05:04 +00:00
Jan Potoms
e56a6add8d
Add test for query param bug #15233 (#15238)
Fixes https://github.com/vercel/next.js/issues/15233
2020-07-16 22:47:46 +00:00
Tim Neutkens
bd9fc12f92
Fix ky-universal-polyfill in webpack 5 (#15227)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-07-17 00:29:34 +02:00
Jan Potoms
dad3299852
Improve query conversion logic (#15236)
`URLSearchParams` has a `forEach` method. this should simplify and shorten the logic. Perhaps it will even phix https://github.com/vercel/next.js/issues/15232
2020-07-16 20:44:45 +00:00
Tanmay Laud
f00ad581a1
Added .gitignore to examples that are deployed to vercel (#15127)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-07-16 10:52:23 -04:00
Joe Haddad
2ffe46605d
v9.4.5-canary.36 2020-07-16 10:50:28 -04:00
Joe Haddad
9d94d70d1f
Use core-js for URL(SearchParams) Polyfill (#15209)
This replaces the `url-polyfill` package with the `core-js` version which handles more edge cases in legacy browsers.

Closes #11702
Fixes #15194
2020-07-16 14:36:48 +00:00
Rafael Almeida
59f147387b
Document API Middlewares with TypeScript (#14275)
My attempt to clear things up 😅

cc @Timer
2020-07-16 05:03:48 +00:00
Joe Haddad
b9f4bdfde3
v9.4.5-canary.35 2020-07-15 21:41:55 -04:00
Jan Potoms
54d991e642
fix basepath trailing slash (#15200)
Fixes the link rewriting part of https://github.com/vercel/next.js/issues/15194
2020-07-15 23:53:31 +00:00
Tim Neutkens
1fe612e882
Make sure the correct chunk names are used in webpack 5 (#15204) 2020-07-15 19:33:41 -04:00
Nikolay Stoynov
58aa576bc1
Update README.md (#15198)
Continuation of #15177
2020-07-15 15:03:19 -05:00
Ruslan Dzyubanov
893e57d29e
Update examples/with-apollo (#15178)
apollo-client 2.6.8 -> 3.0.0
2020-07-15 18:23:22 +00:00
Tim Neutkens
14babe5b3f
Make type checking compatible with webpack 5 (#15158)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-07-15 13:56:27 -04:00
Jacky Efendi
fc082b923e
Mark preact as externals for server bundle (#15110)
Co-authored-by: Jason Miller <developit@users.noreply.github.com>
2020-07-15 11:55:43 -04:00