1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
Commit graph

85 commits

Author SHA1 Message Date
Naoyuki Kanezawa 0b3db91731 Fix handling finished response (#889)
* allows to not return props if response is already finished on getInitialProps

* check res.finished after getInitialProps call of Document
2017-01-26 16:36:50 +05:30
Arunoda Susiripala b4e2b7bd4d Handles the initial popstate event of older version of Safari. (#870) 2017-01-26 01:58:26 +09:00
Guillermo Rauch 85cd38f4bd tweak font sizes again 🙈 2017-01-21 18:12:27 -08:00
Zhao 3813f73ece Fix error fonts (#826)
* add "consolas" font for windows

* fix too small font size in non-retina display
2017-01-21 18:04:41 -08:00
Naoyuki Kanezawa 98e2951f0c Use ErrorDebug component on error of react-hot-loader (#852)
* use ErrorDebug component for reporter of react-hot-loader

* app: fix props of ErrorDebug
2017-01-21 10:46:18 -08:00
Arunoda Susiripala 399e510389 Make sure lastAppProps always have some value. (#829)
* Make sure lastAppProps always have some value.

* Revert "Make sure lastAppProps always have some value."

This reverts commit b4ae722d9c1a4460e17dbdc041b111cbd492b2aa.

* Throw an error, if we found an empty object from getInitialProps.

* Add proper tests for getInitialProps empty check.
2017-01-20 11:33:46 -08:00
Dan Zajdband 70b92e6b65 Added deprecation message when adding an extra anchor in behalf of the user. (#797) 2017-01-16 22:02:11 +01:00
Tim Neutkens 8318f5b8de Add cross browser stacktrace (#776)
* Add cross browser stacktrace

* Remove unused stack variable
2017-01-16 01:17:29 +09:00
Arunoda Susiripala fae2305f46 Add correct sync version of error handling with existSync. (#769)
* Add correct sync version of error handling with existSync.

* Update utils.js
2017-01-15 21:15:06 +09:00
Tim Neutkens 23cddda9cf Only show deprecation when using next/css (#762) 2017-01-13 14:46:21 -08:00
Tim Neutkens 3b3353f821 Revert "Dont' override glamor methods, use a new object instead (#754)" (#755)
This reverts commit 86516629cf.
2017-01-12 14:52:19 -08:00
Tim Neutkens 86516629cf Dont' override glamor methods, use a new object instead (#754) 2017-01-12 12:50:21 -08:00
Naoyuki Kanezawa 0ef28ab128 Don't discard component state on error (#741)
* render debug page as overlay

* handle errors occurrred on rendering cycle for HMR

* retrieve props if required on HMR
2017-01-11 17:58:20 -08:00
Arunoda Susiripala b7e57f9347 Implement "Immutable build artifacts" feature (#745)
* Write BUILD_ID when building.
It's a random id (uuid.v4())

* Add buildId to the core JS files.

* Add immutable cache-control header.
Only if the buildId is matched.

* Set '-' as the dev buildId always.

* Add buildId handling for JSON pages.
2017-01-11 12:16:18 -08:00
Naoyuki Kanezawa 8570d19af6 Handle errors of React lifecycle methods (#661)
* handle errors of lifecycle methods

* handle errors of render method
2017-01-05 09:27:39 -08:00
Craig Smith e38cacc4c2 Prevent prefetcher from making identical requests. (#665) 2017-01-05 19:16:20 +09:00
Arunoda Susiripala 01a17738db Reset prefetchCache when reloading a route. (#617)
* Reset prefetchCache when reloading a route.

* Prefetch again when there's a HMR reload.

* Make .send() to return a promise.
2017-01-02 20:18:14 +09:00
Naoyuki Kanezawa c1a620a7c4 Support relative urls on Link component (#614)
* link: support relative urls

* link: support protocol-relative urls

* router: fix error for clicking anchor tag
2017-01-01 22:22:07 -08:00
Naoyuki Kanezawa 897c60b4fd Fix error routes (#595)
* fix router error handlings

* respond with JSON when error occurs on JSON routes
2017-01-01 11:36:37 -08:00
Arunoda Susiripala c890dc3573 Implement Router Events (#511)
* Move route loading logic to a common place.

* Add router events.

* Add EventEmitter's core API methods.

* Add example app for loading events and docs.

* Fix some typos.

* Get rid of Router.ready()

* Remove events package.
It's already shipping with webpack.

* Handling aborting properly.

* Expose simple attribute based events listener API.
Removed the proposed event listener API from the public API.

* Remove error logged when there's an abort error.
There are many other ways to capture this error.
So, it doesn't look nice to print this always.

* Change router events to pass only the current URL as arguments.

* Add a section about Cancelled Routes to README.
2016-12-30 17:15:22 -08:00
Naoyuki Kanezawa 0f11018819 fix getInitialProps called on client on first load (#572) 2016-12-30 11:55:00 -08:00
Tim Neutkens e8985b3588 Add warning for multiple children in Link (#558)
* Add warning for multiple children in Link

* Add space after if

* Use proptype validation
2016-12-29 21:53:20 +09:00
Naoyuki Kanezawa 242758e3ee fix navigation failure (#546) 2016-12-27 21:27:52 -08:00
Naoyuki Kanezawa af2d78c042 router: register initial route (#508) 2016-12-24 09:29:23 -08:00
Dan Zajdband 01e1883f79 Added glamor example and pointing warning to css migration guide (#500) 2016-12-23 11:18:25 -08:00
Naoyuki Kanezawa 74d4d22f84 router: fix route value on popstate (#490) 2016-12-23 09:14:14 -08:00
nkzawa 6b18e34f66 link: tweak scroll condition 2016-12-22 17:17:50 +09:00
James O'Dwyer 31feced24a Avoid autoscrolling anchored URLs (#474)
* force scroll to false if # is found in url

* only overwrite scroll if scroll=true is not passed in

* clean up logic around setting scroll var
2016-12-22 17:15:49 +09:00
Naoyuki Kanezawa 2a29bf6242 display deprecation warning only when method was called (#462) 2016-12-21 10:43:31 -08:00
Arunoda Susiripala 141c045c68 Make next/router a client only API. (#443)
* Prevent using 'next/router' APIs inside 'getInitialProps'

* Remove incorrect documentation.

* Make next/router a client only API.
2016-12-20 09:27:43 -08:00
Arunoda Susiripala 565bb5790b Update url.pushTo and url.replaceTo update only on dev. (#434)
In order to warn the user, now we are using a warn function
which is located in the lib/utils module.
2016-12-19 13:04:38 -08:00
Arunoda Susiripala e45cc89ce3 Add deprecate messages for url.replaceTo and url.pushTo (#433) 2016-12-19 10:49:15 -08:00
Arunoda Susiripala 22776c2eee Implement the Singleton Router API (#429)
* Immplement the initial singleton Router.

* Use the new SingletonRouter for HMR error handling.

* Use SingletonRouter inside the Link.

* Create an example app using the Router.

* Make the url parameter optional in Router.push and Router.replace

* Add a section about next/router in the README.
2016-12-19 06:40:26 -08:00
Naoyuki Kanezawa 1e70324a41 print a deprecated message for next/css (#421) 2016-12-17 13:59:38 -08:00
Arunoda Susiripala 37a9c661ff Make prefetching works again. (#422) 2016-12-17 13:59:03 -08:00
Thomas Jaggi de6521a481 Allow for custom route in pushTo and replaceTo methods (#417) 2016-12-18 05:18:50 +09:00
Arunoda Susiripala b62a0e8f55 Bundle all the modules inside the app (#414)
* Remove the use of CDN and bundle everything inside the app.
We still pre-build the prefetcher because it needs
different webpack config which only targets browsers
supports Service Workers.

* Remove cdn config item.
We no longer using it.

* Stop adding script tags when staticMarkup=true

* Remove babel-plugin-transform-remove-strict-mode NPM module.
2016-12-17 17:49:10 +09:00
Naoyuki Kanezawa 1708222381 Programmatic API (#310)
* add 'next' api

* add render APIs

* add 'as' prop to Link

* check Accept header to serve json response

* check if response was finished on getInitialProps call

* move server/app to server/index

* load webpack-hot-middleware-client by absolute path

* server: options for testing

* add tests

* example: improve

* server: make dir optional

* fix client routing

* add parameterized routing example

* link: fix display url

* Add custom-server-express example (#352)

* Add custom-server-express example

* Remove extraneous nexts in express routes defs

* Update next config in server.js

* Handle accept headers totally inside Next.js (#385)

* Handle accept headers totally inside Next.js
Now user doesn't need to handle it anymore.

* Move json pages serving to /_next/pages base path.

* Join paths correctly.

* remove next/render
2016-12-16 12:33:08 -08:00
Naoyuki Kanezawa 8ddafaea5c custom document support (#405) 2016-12-16 10:42:40 -08:00
Arunoda Susiripala 43b0e6f514 Remove console.logs (#402) 2016-12-16 11:43:46 +09:00
Arunoda Susiripala 36abdc77c5 Prefetch pages with Service Workers (#375)
* Register the service worker.

* Update prefetcher code to do prefetching.

* Implement the core prefetching API.
support "import <Link>, { prefetch } from 'next/prefetch'"

* Implement a better communication system with the service worker.

* Add a separate example for prefetching

* Fix some typos.

* Initiate service worker support even prefetching is not used.
This is pretty important since initiating will reset the cache.
If we don't do this, it's possible to have old cached resources
after the user decided to remove all of the prefetching logic.
In this case, even the page didn't prefetch it'll use the
previously cached pages. That because of there might be a already running
service worker.

* Use url module to get pathname.

* Move prefetcher code to the client from pages
Now we also do a webpack build for the prefetcher code.

* Add prefetching docs to the README.md

* Fix some typo.

* Register service worker only if asked to prefetch
We also clean the cache always, even we initialize
the service worker or not.
2016-12-15 11:13:40 -08:00
Matthew Mueller a8f58be450 fix link for environments without synthetic events (like preact/the browser) (#393) 2016-12-15 10:03:02 +05:30
Luke Edwards 249a0c4007 append bundle script to body (#353) 2016-12-07 08:53:50 +09:00
nkzawa 0b20273c77 remove workaround for react-hot-loader 2016-12-04 07:06:47 +09:00
Naoyuki Kanezawa f049a0bfa0 fix reading incorrect package.json (#323) 2016-12-02 15:56:02 +09:00
nkzawa 6ad1e23167 Merge branch 'master' into pr/259 2016-12-02 10:35:07 +09:00
Arunoda Susiripala fcd59adea1 Add support for webpack's CommonsChunkPlugin and remove next bundle (#301)
* Add example app which demonstrate the problem.

* Add the first working version.

* Fix lint issues.

* Add README.md

* Use /_next/main.js as the main file URI

* Add the support for loading the core next bundle.

* Optimize the output by removing Next modules from pages.

* Use the same package.json as master use.

* Change the example repo's README for simpler instructions.

* Change example projects package.json to support next build and start.

* Change main.js into commons.js.

* Add support for hot core reload and errors.

* Introduce require based on eval-script.

* Add error reporting support with hot reloading.

* Update README.md
2016-11-28 09:15:56 +09:00
Naoyuki Kanezawa c7ba914f52 Handle runtime errors (#268)
* display runtime errors by error-debug

* server: fix status

* render Error component on client error

* server: render runtime errors of error template

* server: handle errors of error template on render404

* server: add a comment

* server: refactor renderJSON

* recover from runtime errors

* _error: check if xhr exists

* _error: improve client error

* _error: improve error message
2016-11-24 23:03:16 +09:00
Benjamin Coe c56fde89c3
chore: add test coverage 2016-11-22 10:11:23 -08:00
zpnk e0455823a0 Add default utf-8 charset. (#270) 2016-11-17 15:06:54 -08:00