Commit graph

131 commits

Author SHA1 Message Date
JJ Kasper
be850d0353
Add warning when empty object is returned from getInitialProps (#8474)
* Add warning when empty object is returned
from getInitialProps

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>

* Apply suggestions from code review

Co-Authored-By: Jan Potoms <potoms.jan@gmail.com>
2019-08-22 12:06:30 -05:00
Joe Haddad
847e892d71
Remove Flying Shuttle experiment (#8433)
* Remove Flying Shuttle experiment

* Remove more old tests

* Remove minify loader
2019-08-20 11:07:57 -04:00
Lukáš Huvar
b47348bdf8 Change componentWillMount to UNSAFE (#8357)
* Change to unsafe

* Ignore
2019-08-14 18:19:13 -04:00
JJ Kasper
57d91f7d38 Fix AppTree type not allowing extra props (#8352) 2019-08-13 16:15:44 -04:00
JJ Kasper
8c19d78a08 Also provide AppTree in NextPageContext (#8223)
* Also provide AppTree in NextPageContext

* Don't predefine AppTree as null in ctx

* Make update smaller

* Don’t reassign variable

* Add test for AppTree in NextPageContext

* Update utils.ts
2019-08-13 11:33:48 +02:00
JJ Kasper
fc7e235f2c Followup optimizations for new experimentalPrerender (#8287)
* Add checking for hybrid AMP during static check

* Update to always hit server for prerender data

* Add removing of SPR code when not used

* Add checking for hybrid AMP during static check

* Update to always hit server for prerender data

* Add removing of SPR code when not used

* Update dead code elimination
2019-08-11 21:56:57 -04:00
Tim Neutkens
35e7b21df1 Remove extra variable (#8329) 2019-08-11 20:38:42 -04:00
Tim Neutkens
2b62c33f25
Only add flying-shuttle code when enabled (#8330)
Follow-up of #7536, small optimization / code removal when the feature is not enabled.
2019-08-12 00:03:11 +02:00
Houssein Djirdeh
d190f2e112 Adds user timing marks and measures for hydration/render (#8069)
* adds user timing marks for hydration step

* changes measure names and removes window namespaces by adding performance as a global to standard

* separates hydrate and render marks

* Add performance mark to router change instead of link click

* Changes performance mark name at router change

* adds checks for performance

* creates constants utils for performance and user timings
2019-08-09 15:43:29 -04:00
JJ Kasper
8e4509caf2 Add warning for invalid href being passed to router (#8231)
* Add warning for bad href being passed to router

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Inline invalidHref for better code elimination
2019-08-07 10:47:13 -04:00
JJ Kasper
ca13752e24
Implement experimentalPrerender option (#7983)
* Revert "Remove Old Prerender Implementation (#8218)"

This reverts commit 2ab300dd81.

* Add contentHandler for page config

* Rename config from contentHandler to re-use
experimentalPrerender

* Remove un-needed changes

* Replace backslashes for manifest

* Update manifest output format

* Make prerender: true enable SPR behavior and update
to merge prerender-manifest for flying-shuttle

* Fix output path for / prerender file

* Add dynamic routes to test suite

* Add generating and previewing of skeletons
for prerendered dynamic routes

* remove inline prerender option

* update to not replace getInitialProps which allows
nested getInitialProps and add query when fetching prerender

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Remove legacy prerender option

* Apply suggestions from review

* Apply more suggestions from review

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Add handling of error when parsing json

* Update handling of moving exported pages

* Rename nextPreviewSkeleton to _nextPreviewSkeleton

* bump
2019-08-06 15:26:01 -05:00
Joe Haddad
2ab300dd81
Remove Old Prerender Implementation (#8218)
* Remove Prerender Implementation

* Fix PageConfig

* Fix next server

* Fix two more files

* Fix render

* Fix render

* Try to fix up page config

* Correct build file

* Switch back static checker

* Turn stuff back

* Add missing newline

* Revert changes

* Add missing newline

* Fix types
2019-08-02 10:28:03 -04:00
Natalie Marleny
b8aee7af77 fix: Add error message for duplicate route param name (#8047)
* Add error message for duplicate slug name within a dynamic path

* Update based on feedback

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>

* WIP - committed with no-verify - progress

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>

* Remove old test placeholder

* Add test for re-used names
2019-07-30 16:21:36 -05:00
JJ Kasper
4850bd03ef Provide AppTree to getInitialProps for getDataFromTree (#7732)
* Provide AppContainer to getInitialProps for getDataFromTree

* Update to only pass AppTree component instead of AppContainer

* Clean up props and remove extra imports

* Make updates from review

* De-dupe AppTree a bit

* Re-use wrapApp in router

* Remove un-needed change

* revert changes to examples until on stable

* Add test for AppTree
2019-07-30 14:00:19 -04:00
Adam Misiorny
68e3223cd8 Improve type definitions (#8117) 2019-07-26 13:09:16 -05:00
Gerald Monaco
e68307df3a Add next-head-count & remove next-head class (#8020)
Fixes #3494

Removes `class="next-head"` from the children of the `<Head>` component. Instead, a single sentinel meta element named `next-head-count` is appended. The content is the number of contiguous elements immediately preceding the sentinel that _would have had_ the `class="next-head"` attribute.

During an update, instead of searching for `class="next-head"`, the sentinel is located and the N previous elements are considered candidates for `oldTags`. New elements are inserted before the sentinel, and finally the sentinel is updated to reflect the new count.
2019-07-25 16:39:09 +00:00
Joe Haddad
f8b56da7e1 Revert "Improve type definitions" (#8098)
Reverts zeit/next.js#8097

This PR caused bundle sizes to increase. We need to fix this bug before we continue adding invalid TypeScript exports to our code.
2019-07-25 13:58:24 +00:00
Adam Misiorny
55e87ea50c Improve types (#8097) 2019-07-24 21:48:38 -05:00
Tim Neutkens
5030486a5d
Don’t add loadable if it’s not used (#7995) 2019-07-16 14:52:01 +02:00
JJ Kasper
e5e74dabdc Add warning for experimental config usage (#7985)
* Add warning for experimental config usage

* Update config.ts
2019-07-16 13:07:07 +02:00
Lukáš Huvar
c6928dcfd8 Fix GIP type in /_error page (#7952) 2019-07-15 16:16:40 -07:00
Joe Haddad
60b4e678b0
Fix client-side hydration with dynamic routes (#7986)
* Add a test for the hash case

* Add a special hydration option to router

* Add additional tests wrt scrolling
2019-07-15 16:07:04 -07:00
Felix Mosheev
8c5e85d44c Check if dynamicOptions has the deprecated method property, (#7973)
* Check if dynamicOptions has the deprecated `method` property, closes #7972

* Update dynamic.tsx
2019-07-15 16:35:36 +02:00
Luis Fernando Alvarez D
b94123ccc9 Improve exported router types (#7853)
* Added the RouteUrl type and improved router types

* Added more tests for router types

* Add build test for typescript types

* Add next-env.d.ts to the typescript test

* Removed next-env.d.ts

* Added next-env.d.ts to gitignore

* Remove route url re-exports

* renamed PublicRouterInstance to be NextRouter

* export the Url type

* Replaced BaseRouter with NextRouter in server/utils

* Don't export the Url type

* Update tsconfig.json
2019-07-11 13:35:39 -04:00
JJ Kasper
bf7af1d16b Add default values for runtime config (#7847)
* Add default values for runtime config

* Add test to ensure default values are set
for runtime config

* Only add runtimeConfig if it's not empty

* Only add runtimeConfig if it's not empty

* Simplify default value adding

* Reduce bundle size

* remove comment changes

* Fix typos

* Add test for runtimeConfig in __NEXT_DATA__
2019-07-10 10:43:04 -04:00
Joe Haddad
b430a4919e
Allow React.Fragment for Document styles (#7863)
* Allow React.Fragment for Document styles

Fixes https://github.com/zeit/next.js/issues/7784
Closes https://github.com/zeit/next.js/pull/7860

* Fix types

* Remove `Without`
2019-07-10 01:39:07 -04:00
Joe Haddad
437140a048
Add UrlObject to router methods (#7859) 2019-07-10 00:10:44 -04:00
Vincent Cordobes
a137447151 Improve NextApiResponse typing (#7841)
* Fix NextApiResponse.status type signature

* Improve NextApiResponse typing
2019-07-09 13:02:46 -04:00
Joe Haddad
6a35b1d302
Set cancelled property on routeChangeError error (#7790)
* Set `cancelled` property on routeChangeError error

* Add route cancellation tests
2019-07-08 15:25:46 -04:00
JJ Kasper
a7171db2ca Remove previous cache logic (#7794)
* Remove previous cache logic

* Remove old test
2019-07-08 14:59:45 -04:00
Alexander Kachkaev
e995c73b2c [typings] Allow getInitialProps to be sync (#7763) 2019-07-07 14:52:59 -04:00
JJ Kasper
80b46c1d28 Update to have default pageProps of {} instead of null (#7734)
* Update to have default pageProps of {} instead of null

* Update test

* Test for empty object
2019-07-05 11:00:23 -04:00
JJ Kasper
7ac8dcbec0 Add deprecation message for next/dynamic modules (#7750) 2019-07-04 23:36:53 -04:00
JJ Kasper
6ce7c06d9c Add initial static indicator (#7682)
* Add initial static indicator

* Update indicator text to pre-rendered

* Update naming from static to prerender

* Update to not re-use nextExport var

* Update positioning of indicator to prevent overlap
2019-07-02 20:42:41 -04:00
Joe Haddad
7439a773b0 Nit: Change Pre-render to Prerender (#7733) 2019-07-02 22:51:12 +02:00
JJ Kasper
0ca8087565
Add prerender PageConfig option (#7699)
* Add prerender PageConfig option

* Update PageConfig type

* Add inlining of data when pre-render is set and add tests

* Update types import

* Add check for props

* Rename prerender to experimentalPrerender for now
2019-07-01 14:13:52 -07:00
Joe Haddad
5493f2e8b3
Remove Next.js debug mode (#7719) 2019-07-01 13:13:06 -04:00
JJ Kasper
356636c80f Add updated de-duping logic for next/dynamic (#7705) 2019-06-28 20:48:28 -04:00
Joe Haddad
39761e5ce7 Remove withAmp and do not expose isInAmpMode (#7690)
* Remove `withAmp` and do not expose `isInAmpMode`
This pull request removes the `withAmp` higher-order component in favor of the exported configuration object.
Retaining this backwards compatibility isn't worth the extra maintenance burden, given it hasn't been released for very long and the migration is ultra-simple.

I'm 👎 on retaining backwards compatibility just for the sake of it.

Migration example follows. I'm willing to write a codemod if reviewers feel it's necessary.

*Before*
```js
import { withAmp } from 'next/amp'

function Home() {
  return <h1>My AMP Page</h1>
}

export default withAmp(Home)
// or
export default withAmp(Home, { hybrid: true })
```

*After*
```js
export default function Home() {
  return <h1>My AMP Page</h1>
}

export const config = {
  amp: true,
  // or
  amp: 'hybrid',
}
```

* Fix { amp: 'hybrid' }

Co-Authored-By: JJ Kasper <jj@jjsweb.site>
2019-06-28 15:04:24 -07:00
JJ Kasper
291eb83923 Revert "Remove modules option from dynamic (#7688)" (#7701)
This reverts commit 0fd7e68556.
2019-06-28 13:39:23 -04:00
JJ Kasper
0fd7e68556 Remove modules option from dynamic (#7688)
* Remove modules option from dynamic

* Remove old test
2019-06-28 09:02:33 -04:00
Taro Shono
ec958a3bd0 refactor: default dynamic loading component to null (#7543) 2019-06-27 18:07:07 -07:00
JJ Kasper
5e70a2f74c Make DefaultLoading return null (#7695) 2019-06-27 19:05:10 -04:00
JJ Kasper
b4e4bcda9b Clean up AMP logic and naming (#7669)
* Clean up AMP logic

* Tweak AMP logic some more

* Rename hasAmpVersion to hybridAmp
2019-06-27 10:22:24 -04:00
Joe Haddad
6c625703ed
Dynamic Routes: Change impl from $param to [param] (#7623)
* Dynamic Routes: Change impl from $param to [param]

* Update expected test snapshot

* Update test to use new syntax

* Update test file

* Test more behavior

* Update route sorter for new param syntax

* Update dynamic routing tests

* Update danging test file

* Tweak test

* Fix dev and update tests
2019-06-20 18:27:04 -04:00
Joe Haddad
eddc852de3
Extract isDynamicRoute helper (#7622) 2019-06-20 14:41:02 -04:00
JJ Kasper
fbc20a5401 Strip queries before matching route on client (#7566) 2019-06-13 09:35:47 -04:00
Joe Haddad
3b66fd3be5
Remove invalid meta type (#7549) 2019-06-10 12:41:43 -04:00
JJ Kasper
fa45fa0a60
Add export const config support and make withAmp a no-op (#7525)
* Add export const config support and make withAmp a no-op

* Use babel plugin for PageConfig

* Fix serverless-loader exports

* Add backwards compatibility for withAmp
2019-06-09 17:16:14 -07:00
Tim Neutkens
7e7f2c0a6d
Simplify a few parts of the codebase (#7506)
* Move client-side dev JS to dev folder

* Move eventsource polyfill

* Move source-map-support

* Move error boundary

* Deprecate Container in _app

* Make initialRender check better

* Remove unused code

* Only support one subscription as there is only one

* Don’t spread object

* Shorten property name

* Add container in development too

* Simplify query update logic
2019-06-05 20:15:42 +02:00