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

84 commits

Author SHA1 Message Date
Arunoda Susiripala 8277d43190 Rewrite url when exporting only if there's a href. (#2316) 2017-06-20 14:07:36 +05:30
Arunoda Susiripala 9df59c1176 Dynamic component support with multiple modules (#2235)
* Layout ground works for next/async

* Implement the Dynamic Bundle feature.

* Add some test cases.

* Update README.

* Implement props aware dynamic bundle API.

* Update tests and README.

* Add a test case for React Context support.
2017-06-16 18:49:34 +05:30
Arunoda Susiripala a36be58124 Rewrite urls with hashes correct for static export. (#2242)
* Rewrite urls with hashes correct for static export.

* Fix some lint issues inside an example app.
2017-06-13 11:44:31 +05:30
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
Arunoda Susiripala 8cb3e89455 Merge master into v3-beta. 2017-06-07 04:24:36 +05:30
Arunoda Susiripala 937d0e2bb6 [WIP] Reload webpack if needed (#2076)
* Reload webpack via hot-reloader when needed.
We need to do this specially we removed a previosly
built page from the filesystem.

* Make sure reloading is happen only once

* Reload only if there's a missing page error.

* Remove debug logs.

* 2.4.2

* Refactor the codebase a bit.

* Move some commonly used regexp to a utils module.

* Handle the reloading well when there's a custom error page.

* Add a HMR test case.

* Close the browser in the test case.
2017-06-06 15:32:02 -07:00
Arunoda Susiripala e1a9febe28 Get latest master into v3 (#2139)
* Merge branch 'master' into v3-beta

* Add send back to v3-beta.
2017-06-02 10:35:04 +05:30
Guillermo Rauch 850a931e88 Merge branch 'master' into v3-beta 2017-06-01 18:30:57 -07:00
Arunoda Susiripala ed3618f035 Fix test failures (#2129)
* Fix test failures due to styled-jsx change.

* Update styled-jsx to the latest.
2017-06-01 10:34:21 +05:30
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
Arunoda Susiripala 92b0a690be Add a default value of '{}' to query in the export mode. (#2003) 2017-05-18 10:54:57 +05:30
Arunoda Susiripala 00f2ab8ef5 Merge branch 'master' into v3-beta 2017-05-15 01:18:22 -07:00
Arunoda Susiripala 650bb7c51b Fix hmr failing issue. (#1968) 2017-05-15 13:47:35 +05:30
Arunoda Susiripala eb4ef544ca Possible fix for dynamic import test in travis. 2017-05-15 10:43:22 +05:30
Arunoda Susiripala aeaccf441b Add dynamic-import support for next-export. 2017-05-15 10:03:35 +05:30
Arunoda Susiripala 4d0147385c Merge v3-beta in dynamic-imports 2017-05-15 09:41:42 +05:30
Arunoda Susiripala e613882010 Update tests for the recent changes. 2017-05-15 09:31:02 +05:30
Arunoda Susiripala d7048e13fa Add some test cases for nested pages with next export. 2017-05-11 09:09:31 -07:00
Arunoda Susiripala 880eb4caff Add a test case for client side routing for next export. 2017-05-11 08:52:28 -07:00
Arunoda Susiripala 98ed666ca6 merge master into next-export 2017-05-10 19:01:01 -07:00
Arunoda Susiripala 14fa6f5893 Add browser tests for next-export 2017-05-09 18:54:08 -07:00
Arunoda Susiripala 56dc85485f Add ssr tests for next-export 2017-05-09 18:28:15 -07:00
Arunoda Susiripala 7b193f1aa7 Add basic test setup 2017-05-09 16:24:34 -07:00
Arunoda Susiripala e8ff53f519 Added the test app for static export. 2017-05-09 14:03:20 -07:00
Arunoda Susiripala 450277f294 Make sure next export doesn't break other modes. 2017-05-09 00:42:48 -07:00
Arunoda Susiripala 0edee47d07 Fix the page-loader-normalization issue on '/index' page. (#1882) 2017-05-04 13:05:47 -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
Arunoda Susiripala f578089d05 Fix page loader page normalization issue (#1844)
* Add integration tests for nested componentDidMount

* Fix the page loader normalization issue.

* Fix a typo in the url.
2017-05-01 16:26:18 -07:00
Arunoda Susiripala 753113bb9c Add some tests for dynamic rendering. 2017-04-27 08:39:52 -07:00
Arunoda Susiripala 857a1d3138 Add some test cases for the same loop promise. 2017-04-27 08:16:38 -07:00
Arunoda Susiripala f82e52935d Implement ETag support for server rendered pages. (#1693) 2017-04-18 21:15:42 +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
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 6ab3e6606d Add test cases for getInitialProps based redirect logic. (#1578)
With that, we are making sure we don't break this
functionality in the future.
2017-03-31 11:35:45 -03:00
Arunoda Susiripala 97c472c0c8 Handle pages with no default export and show an error. (#1484)
That error is meaningful and easy to find the issue.
2017-03-23 09:40:22 +05:30
Arunoda Susiripala ffade8d5ac Fix client error modal not showing in dev (HMR) (#1448)
* Fix HMR not working issue.
Our hot-reload code on the server has custom webpack error dectection logic.
Is supports only multi-modules entries.
So, we need to all entries as multi-module entries
even if there's just a single entry.

* Add a test case for showing errors over HMR.
2017-03-18 16:01:55 -07:00
Dan Zajdband d92ab55d22 Add/link replace (#1419)
* Using developit/unfetch as the Fetch API polyfill

* Added the replace prop into the Link component

* Added integration test for replace prop on Link component
2017-03-14 18:06:34 -05:00
Sergio Daniel Xalambrí 38822717a9 Add support for URL objects in Link and Router (#1345)
* Add support for URL objects in Link and Router

* Fix typo in comment

* Fix possible bug if the `href` prop is `null`

* Document the usage of URL objects in Link and Router

* Update readme.md

* Parse URL to get the host & hostname in `isLocal`

This should check if the current location and the checked URL have the same `host` or `hostname`.

* Format `as` parameter from object to string if required

* Format `href` and `as` inside the construct and componentWillReceiveProps

* Use `JSON.stringify` to compare objects

* Add usage example

* chore(package): update chromedriver to version 2.28.0 (#1386)

https://greenkeeper.io/

* Refactor the codebase a bit.

* Change the example name.

* Add a few test cases.

* Add the example to the README.
2017-03-12 09:27:51 +05:30
Arunoda Susiripala f9286f74bf [WIP] Improve test setup (#1372)
* Run tests serially.

* Make test result verbose.

* Don't wait until closing the browser.

* Add some debug logs.

* Add bailing support.

* Get the browser with a timeout.

* Add some comments.

* Remove istanbul babel tranformation.
Jest already do it and it's breaking our coveralls hit.
2017-03-08 13:23:05 +05:30
Arunoda Susiripala 08d9847ab7 Shallow routing changes (#1363)
* Fix a typo in a test suite.

* Add old props.url API with warn for all tags.
2017-03-06 10:14:10 -08:00
Arunoda Susiripala f8f3fa7dce Introducing Shallow Routing (#1357)
* Simplify route info handling.

* Add basic resolve=false support.

* Make sure to render getInitialProps always if it's the first render.

* Change resolve=false to shallow routing.

* Add test cases for shallow routing.

* Update README for shallow routing docs.

* Update docs.

* Update docs.

* Update docs.
2017-03-06 08:48:35 -08:00
Arana Jhonny bc47aac8f4 Fixed some problems with standard (#1331) 2017-03-02 22:46:16 +01:00
Arunoda Susiripala 96fca5e2ad Add better hash URL support. (#1250)
* Add better hash URL support.
1. Add scrolling to given id related to hash
2. Hash changes won't trigger getInitialProps

* Add some comments.

* Fix tests.

* Add some test cases.
2017-02-28 09:31:17 -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 408633c1dc Remove traces of glamor (#1286)
* Remove traces of glamor

As talked about with @rauchg. Glamor takes up around 60KB of the bundle (pre-gzip). Since styled-jsx is the way to go now and we support adding glamor by the user we should remove it as dependency cause it is bundled even when not used.

Added rehydration to the example, since we did that in our code.

There is only one thing I'm not sure about and want to discuss:
what should we do with next/css. Right now I added a throw for when it is imported. I'm not sure if we should do that / some other way to notify the user it has been removed. The reasoning behind the throw is that when we would do a console.warn the user would see 'css.default.<X>' not found because we don't have the glamor dependency anymore.

* Update yarn.lock

* Remove test for styles
2017-02-26 17:58:00 +05:30
Arunoda Susiripala fb496b7c9a Run tests in Travis. (#1247)
* Run tests in Travis.

* Update deps and config.

* Update jest config.

* Disable a test temp.

* Increase the timeout.
2017-02-22 23:38:49 +05:30
Arunoda Susiripala 0bd250f4aa Handle BUILD_ID mismatch error (#1224)
* Reload the page if the buildIds are mismatch.

* Reload the browser with main.js and commons.js buildId mismatch.

* Implement proper reloading with an API to persist the state.

* Add some tests for force reload.

* Change _reload to _forceReload.

* Add a section about reload hooks to the README.

* Allow to add a hook to handle BUILD_ID mismatch.

* Remove readme docs.

* Do not show a custom error to the user.

* Cancel the routing when there's a BUILD_ID mismatch.

* Fix a typo.

* Passing route to SingletonRouter.onBuildIdMismatch

* Handle buildId mismatch automatically.
2017-02-20 15:48:17 -08:00
Arunoda Susiripala f4337d3072 Make sure reading the body of same JSON page request safe. (#1185)
* Make sure reading the body of same JSON page request safe.
It's not possible to read the body twice from fetch()'s response
So, we've to clone the response before doing anything.

* Fix tests.
2017-02-17 01:12:32 -03:00