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

88 commits

Author SHA1 Message Date
Arunoda Susiripala 0c4362e440 Load chunks in SSR mode only if they exists in the filesystem (#2196)
* Always check with the fs when gettings chunks.

* Add a new set of test cases for dynamic imports in dev.

* Add dynamic import test cases for production.

* Add availableChunks support for static exports.
2017-06-08 19:41:22 +02:00
Arunoda Susiripala 13a51e0a75 Merge master into v3-beta. 2017-06-07 11:43:05 +05:30
Arunoda Susiripala 7cd2bb69ea Squashed commit of the following:
commit ced48c3fcfd1880016b08590e1b50827247b7cfb
Author: Arunoda Susiripala <arunoda.susiripala@gmail.com>
Date:   Wed Jun 7 11:28:43 2017 +0530

    Make sure XSS fix doesn't break our 404 support.

commit d40c833aa16660d547df785bb52e69ecf9a717f2
Author: Arunoda Susiripala <arunoda.susiripala@gmail.com>
Date:   Wed Jun 7 09:08:41 2017 +0530

    Prevent url path based XSS attacks.
2017-06-07 11:37:28 +05:30
Guillermo Rauch 850a931e88 Merge branch 'master' into v3-beta 2017-06-01 18:30:57 -07:00
Arunoda Susiripala 9121a9d22e Never cache assets and HTML in the dev mode. (#2045)
* Never cache assets and HTML in the dev mode.

* Move etags test to the production.

Now it won't work in dev because of no-cache settings.
2017-05-25 18:28:08 +02:00
Xuezheng Ma d36118ab02 Check if _document.js returns a react element before using (#2013)
* Check if _document.js returns a react element before using

* Use capital letter R in 'React'
2017-05-20 00:02:01 +02:00
Arunoda Susiripala 4d0147385c Merge v3-beta in dynamic-imports 2017-05-15 09:41:42 +05:30
Arunoda Susiripala 6f674b8c0a Get rid of realPathname for consistant page file structure. 2017-05-10 20:01:42 -07:00
Arunoda Susiripala 147a5ce641 Fix server rendering issue for normal apps. 2017-05-08 23:42:37 -07:00
Arunoda Susiripala 311e4ca0ee Make sure the router is aware of the nextExport
Based on the we can change the routing to do SSR always.
Also make sure pageLoader don't download the page via
client side twice.
2017-05-08 18:20:50 -07:00
Arunoda Susiripala be2e5a8c23 Use the realPathname for script tags in document.js
This will help us to fetch these scripts directly from a
static server since these paths are resolved.
2017-05-07 19:36:11 -07:00
Arunoda Susiripala 24f3f143a6 Introduce "asPath" into router and getInitialProps (#1857)
* Add asPath to next/router and getInitialProps context.

* Add test cases.

* Update docs.

* Build as-path pages before they use.
2017-05-03 09:40:09 -07:00
Dieter Luypaert cb635dd9a5 use configured distDir where required (#1816) 2017-05-01 17:42:01 -07:00
Arunoda Susiripala 686dd4c4dd Merge master into dynamic-import. 2017-04-27 08:48:43 -07:00
Arunoda Susiripala 84d00ad14d Always send an error to client if there is. (#1800)
In the production, we need to send a dummy error.
2017-04-25 09:45:58 +05:30
Arunoda Susiripala da775f2e11 Fix error pages' cdn cache issue. (#1794)
We do this by providing some headers mentioning not to cache.
2017-04-24 13:48:34 -07:00
Arunoda Susiripala 90ea471aa7 Merge master into dynamic-import. 2017-04-18 21:42:21 +05:30
Arunoda Susiripala f82e52935d Implement ETag support for server rendered pages. (#1693) 2017-04-18 21:15:42 +05:30
Arunoda Susiripala b3f15f8d5c Fix a typo. (#1749) 2017-04-18 19:14:26 +05:30
Arunoda Susiripala dec85fe6c4 Add CDN support with assetPrefix (#1700)
* Introduce script tag based page loading system.

* Call ensurePage only in the dev mode.

* Implement router using the page-loader.

* Fix a typo and remove unwanted code.

* Fix some issues related to rendering.

* Fix production tests.

* Fix ondemand test cases.

* Fix unit tests.

* Get rid of eval completely.

* Remove all the inline code.

* Remove the json-pages plugin.

* Rename NEXT_PAGE_LOADER into __NEXT_PAGE_LOADER__

* Rename NEXT_LOADED_PAGES into __NEXT_LOADED_PAGES__

* Remove some unwanted code.

* Load everything async.

* Remove lib/eval-script.js
We no longer need it.

* Move webpack idle wait code to the page-loader.
Because that's the place to do it.

* Remove pageNotFound key from the error.

* Remove unused error field 'buildError'

* Add much better logic to normalize routes.

* Get rid of mitt.

* Introduce a better way to register pages.

* Came back to the mitt() based page-loader.

* Add link rel=preload support.

* Add assetPrefix support to add support for CDNs.

* Add assetPrefix support for preload links.

* Update readme.md
2017-04-17 21:18:43 -07:00
Arunoda Susiripala dfa28815a5 Add server side rendering for dynamic imports. 2017-04-18 01:45:50 +05:30
Arunoda Susiripala 6f735eeb05 Fix a typo. 2017-04-12 21:42:04 +05:30
Arunoda Susiripala 7997c1fd3c Introduce a better way to register pages. 2017-04-11 20:03:18 +05:30
Arunoda Susiripala 6f9b51fce6 Remove pageNotFound key from the error. 2017-04-11 14:51:28 +05:30
Arunoda Susiripala 866319c76d Merge with master. 2017-04-06 15:44:05 +05:30
alex newman 9347c8bdd0 Specify a different build directory for #1513 (#1599)
* Update references to `.next`

* Remove console logs and extraneous semi colons

* Remove lint errors

* Update references to .next and update docs

* Update options from nested to flat with `distDir`

* Add integration tests, and update `.gitignore`

* Rename integration folder to dist-dir to match standards
2017-04-06 15:39:26 +05:30
Arunoda Susiripala 4f26e84ff2 Move webpack idle wait code to the page-loader.
Because that's the place to do it.
2017-04-06 12:19:00 +05:30
Arunoda Susiripala f6f175db73 Remove some unwanted code. 2017-04-06 11:01:44 +05:30
Arunoda Susiripala 65a2603917 Rename NEXT_LOADED_PAGES into __NEXT_LOADED_PAGES__ 2017-04-06 10:58:04 +05:30
Arunoda Susiripala 32cdf3f2d0 Rename NEXT_PAGE_LOADER into __NEXT_PAGE_LOADER__ 2017-04-06 10:56:13 +05:30
Arunoda Susiripala 5aa02d0727 Remove the json-pages plugin. 2017-04-06 10:33:11 +05:30
Arunoda Susiripala 76bfc38a09 Remove all the inline code. 2017-04-05 17:13:34 +05:30
Arunoda Susiripala 822a99b0d5 Get rid of eval completely. 2017-04-05 12:15:39 +05:30
Arunoda Susiripala e3d68ff401 Fix a typo and remove unwanted code. 2017-04-05 02:05:25 +05:30
Arunoda Susiripala c95d2b28d0 Implement router using the page-loader. 2017-04-05 01:25:56 +05:30
Arunoda Susiripala 5fcb49632e Introduce better debug error handling (#1592)
* Introduce better debug error handling
With this we are rendering runtime and debug errors inside
a it's own error root.
That gives us better error handling and control.
Also, now we are patching React core to capture runtime errors.

* Render the initial error on the server.
2017-04-01 14:03:40 -07:00
Arunoda Susiripala bc2d5f3bdb Show errored file always in the error overlay. (#1470)
This was not happening when there's module not found errors.
Now we try to do this for all the errors if possible.
2017-03-23 04:43:23 +05:30
Arunoda Susiripala 6979e35947 Add content based HASH to main.js and common.js (#1336)
* Use file hashes instead of BUILD_ID.
Now JSON pages also not prefixed with a hash and
doesn't support immutable caching.
Instead it supports Etag bases caching.

* Remove appUpdated Router Events hook.
Becuase now we don't need it because there's no buildId validation.

* Remove buildId generation.

* Turn off hash checks in the dev mode.

* Update tests.

* Revert "Remove buildId generation."

This reverts commit fdd36a5a0a307becdbd1d85ae3881b3a15b03d26.

* Bring back the buildId validation.

* Handle buildId validation only in production.

* Add BUILD_ID to path again.

* Remove duplicate immutable header.

* Fix tests.
2017-03-07 10:43:56 -08:00
Arunoda Susiripala d3b1ead149 Implement "on demand entries" (#1111)
* Add a plan for dynamic entry middleware.

* Use dynamic pages middleware to load pages in dev.

* Add the first version of middleware but not tested.

* Integrated.

* Disable prefetching in development.
Otherwise it'll discard the use of dynamic-entries.

* Build custom document and error always.

* Refactor code base.

* Change branding as on-demand entries.

* Fix tests.

* Add a client side pinger for on-demand-entries.

* Dispose inactive entries.

* Add proper logs.

* Update grammer changes.

* Add integration tests for ondemand entries.

* Improve ondemand entry disposing logic.

* Try to improve testing.

*  Make sure entries are not getting disposed in basic integration tests.

* Resolve conflicts.

* Fix tests.

* Fix issue when running Router.onRouteChangeComplete

* Simplify state management.

* Make sure we don't dispose the last active page.

* Reload invalid pages detected with the client side ping.

* Improve the pinger code.

* Touch the first page to speed up the future rebuild times.

* Add Websockets based pinger.

* Revert "Add Websockets based pinger."

This reverts commit f706a49a3d886d0231259b7a1fded750ced2e48f.

* Do not send requests per every route change.

* Make sure we are completing the middleware request always.

* Make sure test pages are prebuilt.
2017-02-26 11:45:16 -08:00
Tim Neutkens fca186f9e7 Remove pre-gzip support (#1155) 2017-02-15 15:49:45 +01:00
Naoyuki Kanezawa ed00eb7236 ensure not to render ErrorDebug on production (#1064) 2017-02-10 10:05:22 +01:00
Tim Neutkens aa971d6a1c Disallow directories in /static (#1028) 2017-02-08 05:43:25 +05:30
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 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
Naoyuki Kanezawa e3e0a68b9a Fix handling http methods (#748)
* support HEAD method

* respond with 501 if method is not GET or HEAD
2017-01-12 07:38:43 -08:00
Arunoda Susiripala 1dc52dbc6c New test setup (#640)
* Use jest-cli instead of gulp plugin.

* Use jest-cli instead of gulp plugin.

* Move fixtures into the examples dir.

* Move test code of example app to the basic example.

* Add isolated tests for server/resolve

* Allow tests to use cheerio.

* Use portfinder to get a unique port.

* Move back integration tests into the example dir.

* Introduce next-test-utils.

* Remove gulp-jest

* Add coveralls support.

* Use transpiled version of code in dist.
This is to make sure same file gets covered
by both unit/isolated tests and integration tests.

* Add support for source maps.

* Use code from dist always.

* Use nyc to stop instrument.

* Add integration test suite for production usage.

* Use jest-cli.

* Add support for running e2e tests.

* Check gzipPath with fs.stat before serving
Otherwise, serve package might throw issues other than ENOENT

* Install chromedriver with npm install.

* Install chrome on travis-ci.

* Add --forceExit to Jest.

* Run tests only on Node v6.
That's because selenium-webdriver only supports
Node 6 LTS.

* Use chromedriver NPM module to install chromedriver.

* Use wd as the webdriver client.

* Run chromedriver before tests.

* Run travis for both node 4 and 6

* Remove unwanted npm install script.

* Move some common text utilities to next-test-utils

* Add lint checks and testing in npm prepublish hook.

* Use npm on travis-ci.
We are having some caching issues with yarn and chromedriver.

* Make tests work on windows.\n But chromedriver doesn't work.

* Clean up dependencies.

* Run chromedriver in background without any tools.

* Fix a typo in the code.

* Use ES6 features used in node4 inside the gulpfile.

* Add some comments.

* Add support for running in windows.

* Stop chromedriver properly on windows.

* Fix typos.
2017-01-12 13:14:49 +09: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
Arunoda Susiripala d7eac7fa2c Check the existence of the gzipped path explicitly (#704)
* Check the existance of the gzipped path explicitely.

* Fix a typo in the comments.

* Fix a typo.
2017-01-08 19:01:25 -08:00
Arunoda Susiripala 042ffa1175 Add correct content-type header for gzipped version. (#705) 2017-01-08 18:12:10 -08:00