Commit graph

28 commits

Author SHA1 Message Date
Arunoda Susiripala
26c485a22f Add X-Powered-By header. (#416)
* Add X-Powered-By header.

* Add support to disable setting x-provided-by header

* Add some test cases.
2016-12-19 07:27:47 -08: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
nkzawa
59d514e071 stop watching files after running tests 2016-12-17 13:04:40 +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
Dmitry Poddubniy
45e36fdff7 fixed bug #362, also set chunks names (#363)
* fixed bug #362, also set chunks names

* set simple solution for minChunks

* revert in favor of #310
2016-12-16 03:59:59 +05:30
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
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
Naoyuki Kanezawa
a14cc66720 Remove webpack-dev-server (#276)
* remove webpack-dev-server

* webpack: fix publicPath
2016-11-23 10:32:49 -08:00
Chris Cunniff
880b71047b fixes #175, no longer sets process.env.NODE_ENV='production' or runs uglify in next dev mode (#274) 2016-11-18 16:26:17 +09:00
Naoyuki Kanezawa
d1a0309af9 Add pathname and query to the argument of getInitialProps (#194)
* pass pathname and query to getInitialProps on both server and client

* README: describe about the contet object of getInitialProps
2016-11-04 01:05:03 -07:00
Naoyuki Kanezawa
e775721f34 Hot reload error page (#190)
* add detach-plugin

* detach-plugin: remove unused property

* watch-pages-plugin: replace _error.js when user defined one was added/removed

* dynamic-entry-plugin: delete cache

* fix HMR settings for _error.js

* render: pass error only on dev

* hot-reload: enable to hot-reload error page

* server: check if /_error has compilation errors

* webapck-dev-client: fix reloading /_error
2016-11-04 00:12:37 +09:00
nkzawa
ec774a39da refactor paths 2016-10-19 21:58:08 +09:00
nkzawa
2e2db37ccb add error page for debug 2016-10-19 21:41:45 +09:00
nkzawa
8689af6480 server: tweak 2016-10-17 16:07:41 +09:00
nkzawa
ae5098599a hot-reloader: refactoring 2016-10-17 16:05:46 +09:00
nkzawa
1be8447a26 Merge branch 'master' into add/hot-reload 2016-10-17 11:10:16 +09:00
Dan Zajdband
1477734211 Added linting using standard (#27)
* Added linting using standard

* Linting on test
2016-10-16 17:00:17 -07:00
nkzawa
3032ade283 write assets to disk 2016-10-16 04:49:42 +09:00
nkzawa
26e6193a97 hot-reload: initial 2016-10-15 00:05:08 +09:00
nkzawa
4f21383e0f improve render 2016-10-10 13:24:30 +09:00
nkzawa
6718b05347 add _error.js, fix error handlings 2016-10-09 18:25:38 +09:00
nkzawa
429668b464 improve resolving files, cache files 2016-10-08 21:01:58 +09:00
nkzawa
5a14a7249b serve static dir 2016-10-08 14:21:10 +09:00
nkzawa
9150521c55 set dev flag when rendering 2016-10-07 10:56:48 +09:00
nkzawa
88b01e0a72 next-dev 2016-10-06 20:05:52 +09:00
nkzawa
66b224ad26 server: render .json urls 2016-10-06 16:06:55 +09:00
nkzawa
9b06a22f31 initial source 2016-10-06 08:52:50 +09:00