Commit graph

25 commits

Author SHA1 Message Date
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
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
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
Vincent Cordobes
a137447151 Improve NextApiResponse typing (#7841)
* Fix NextApiResponse.status type signature

* Improve NextApiResponse typing
2019-07-09 13:02: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
356636c80f Add updated de-duping logic for next/dynamic (#7705) 2019-06-28 20:48:28 -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
Lukáš Huvar
c821e83048 API interface extensions (#7363)
* Cookies and Query parsing for API request

* Adding JSON and SEND

* First body parsing

* Body parsing

* Remove extra try catch

* Fix tests

* Only server bundling for API routes

* Update packages/next-server/server/api-utils.ts

Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>

* Revert on demand server changes

* Use content-type for parsing

* Update packages/next-server/server/api-utils.ts

Co-Authored-By: Jan Potoms <potoms.jan@gmail.com>

* Add tests for server compilation

* Add body limit

* Change API to function chaining

* Limit test
2019-06-05 13:22:09 +02:00
Tim Neutkens
3e51ddb8af
Move syntax formatting to prettier (#7454)
* Run prettier over packages/**/*.js

* Run prettier over packages/**/*.ts

* Run prettier over examples

* Remove tslint

* Run prettier over examples

* Run prettier over all markdown files

* Run prettier over json files
2019-05-29 13:57:26 +02:00
JJ Kasper
24034ec957 Add amp.canonicalBase option to set absolute URL (#7262)
* Add canonicalBase config to allow setting
absolute path for canonical link

* Make sure canonicalBase is set for
export and serverless

* Move canonicalBase to amp.canonicalBase

* Update tests with canonicalBase config

* Update tests

* run lint-fix

* Fix canonicalBase config parsing

* Fix canonicalBase during export

* Update amphtml tests
2019-05-28 17:32:17 -07:00
JJ Kasper
77b23264bb Opt out of cache header if _app has custom getInitialProps (#7409)
* Opt out of cache header if _app has custom
getInitialProps to match autoExport behavior

* Fix wrong component

* Add test for cache header
2019-05-23 20:24:02 -07:00
Lukáš Huvar
bf294ee494
Types description (#7217)
* App, Document, Page, Error types description

* Router description

* Added head changed router

* Additions

* Fix examples

* Push and replace details

* Update packages/next-server/lib/head.tsx

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>

* Update packages/next-server/lib/utils.ts

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>

* Update packages/next/types/index.d.ts

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>

* Update packages/next/pages/_document.tsx

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>

* Update packages/next/pages/_document.tsx

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>

* Update packages/next/pages/_app.tsx

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>

* Update packages/next/pages/_document.tsx

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>
2019-05-23 21:31:22 +02:00
Luis Fernando Alvarez D
a7ca031313
Renamed IContext to be NextPageContext (#7272) 2019-05-06 16:42:04 -05:00
JJ Kasper
e3f0236887 Make sure Cache-Control header is set when no getInitialProps (#7202)
* Remove loadGetInitialProps from _app and fix
cache-control header not being

* Update to still use loadGetInitialProps
in _app since it's simpler

* Add test for cache-control header with custom _app
2019-04-30 23:28:25 +02:00
Luis Fernando Alvarez D
ab22b58818
Allow _app and _document to be extended with other props (#7184) 2019-04-29 11:47:40 -05:00
JJ Kasper
84afda6bd1
Update cache-control header when no getInitialProps (#7185) 2019-04-28 13:28:59 -05:00
Luis Fernando Alvarez D
2eee876630
Add types for getInitialProps (#7162)
* Added types for pages
2019-04-27 19:00:31 -05:00
Luis Fernando Alvarez D
b963863106 Prefer type over interface (#7164) 2019-04-26 09:37:57 +02:00
JJ Kasper
4fefa2e4f2 Add stale-while-revalidate when no getInitialProps (#7149)
* Add stale-while-revalidate when no getInitialProps

* Make sure setHeader exists
2019-04-25 10:11:05 +02:00
Luis Fernando Alvarez D
29f71bfcba Add more TypeScript types (#7054)
* Moved server/lib/utils.js to Typescript

* moved _app.js to Typescript

* Moved _error.js to Typescript

* Added argument for custom props in _app and _error

* Moved _document.js to Typescript

* updated one test

* Updated types and added a validation for _document props

* Improved types

* Fixed some types

* Updated AppType

* Fixed some tests

* Added missing import

* Removed a not very useful type

* Fix missing type

* Move @types/styled-jsx

* Fix typescript errors
2019-04-22 19:55:03 +02:00