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

270 commits

Author SHA1 Message Date
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
Naoyuki Kanezawa 8e4e2e3e01 improve prefetch (#1161) 2017-02-16 00:59:42 +05:30
Arunoda Susiripala 00e7a29731 Move the test babel setup to the main babelrc file. (#1163)
* Move the test babel setup to the main babelrc file.

* Add es2015 preset.
2017-02-16 00:43:31 +05:30
Arunoda Susiripala 412f9739d8 Reload the page if asked to change the current URL (#1159)
* Add support to reload the page when ask to change the same url.

* Do not run change() in the initial page load.

* Add integration tests.

* Add self-reload.js
2017-02-15 19:27:41 +01:00
Tim Neutkens fca186f9e7 Remove pre-gzip support (#1155) 2017-02-15 15:49:45 +01:00
Arunoda Susiripala 14c86bef1d Introduce a simple prefetching solution (#957)
* Implement a very simple prefetching solution.

* Remove next-prefetcher.

* Require 'whatwg-fetch' only in the client.

* Use xhr in the code.

* Use a simple fetching solution.

* Fix 404 and xhr status issue.

* Move the prefetching implementation to next/router.

* Add deprecated warnning for next/prefetch

* Run only 2 parellel prefetching request at a time.

* Change xhr to jsonPageRes.

* Improve the prefetching logic.

* Add unit tests covering the Router.prefetch()

* Update examples to use the new syntax.

* Update docs.

* Use execOnce() to manage warn printing.

* Remove prefetcher building from the flyfile.js
Because, we no longer use it.
2017-02-15 14:22:22 +05:30
Tim Neutkens a0453a7b84 Add tests for behaviour mentioned in #1079 (#1084) 2017-02-12 13:46:11 -03:00
Arunoda Susiripala 355c984ed8 Testing: use a better way to get a port to the test app (#753)
* Randomize the port returned from test util's findPort().

* Use http's server.listen() to bind to a random available port.

* Update yarn.lock

* Update yarn.lock
2017-02-09 14:40:09 +01:00
Arunoda Susiripala 57e9a5e5f6 Find custom babel config location properly. (#969)
* Find custom babel config location properly.
Earlier we simply check for the .bablerc file in the dir.
But the actual logic is much complex.
Now we are using the babel's actual logic to find the
custom config location.

* Fix failing tests.
2017-02-03 14:33:35 +09:00
Arunoda Susiripala ec2c8c6784 Fix .json import issue (#944)
* Fix .json import error
This is a regression we've added by #926 (tree-shaking-support)

* Add a test case.
2017-02-01 15:17:15 +09:00
Jaga Santagostino b4814e1ef9 fix typo (#916) 2017-01-29 11:32:29 +01: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 e28f80cd99 Updated <Link> in repo, always wrapping an anchor. (#798) 2017-01-16 22:27:55 +01:00
Guillermo Rauch 31ada10279 bump the test timeout for macbook 12 users :D 2017-01-12 08:15:38 -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
Naoyuki Kanezawa a87ef1a7af Incorporate styled-jsx (#420)
* integrate styled-jsx

* define styles of pages with styled-jsx

* bump styled-jsx

* bump styled-jsx

* error-debug: fix style

* bump styled-jsx

* fix examples to use styled-jsx

* bump styled-jsx
2016-12-19 10:42:19 -08:00
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
Naoyuki Kanezawa 8ddafaea5c custom document support (#405) 2016-12-16 10:42:40 -08:00
Benjamin E. Coe 0f2979b02b chore: switch from ava to jest (#381) 2016-12-12 21:31:49 +09:00
nkzawa 6ad1e23167 Merge branch 'master' into pr/259 2016-12-02 10:35:07 +09:00
nkzawa 39c6536bcc fix a test 2016-12-01 20:39:56 +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
nkzawa 83400a8f38 fix usage of next/css 2016-10-25 17:16:54 +09:00
Dan Zajdband e164074f8e Added glamor css (#38)
* Added glamor css

* Using pseudoclasses instead of calling functions

* Updated readme using style instead of default import for css
2016-10-21 09:39:20 -07:00
nkzawa ec774a39da refactor paths 2016-10-19 21:58:08 +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
Dan Zajdband 78fa6b191d Added async props test (#9) 2016-10-15 23:32:58 -05:00
Dan Zajdband 7f89c39045 Set test command and added more tests 2016-10-12 19:15:58 -04:00
nkzawa facd19b5a7 add a css test 2016-10-10 13:35:37 +09:00
nkzawa 3647ed14ac add a test 2016-10-10 13:25:08 +09:00