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

132 commits

Author SHA1 Message Date
Arunoda Susiripala 60ec4def1e Add NODE_PATH support for resolveLoaders as well. (#778)
* Add NODE_PATH support for resolveLoaders as well.

* Remove unwanted code.
2017-01-16 14:40:14 +09:00
nkzawa 8a06c7b092 example: fix style 2017-01-15 00:30:39 +09:00
Naoyuki Kanezawa dbecc2a701 Use dynamic entry feature of webpack (#750)
* update webpack version and use dynamic entry feature of it

* fix typo
2017-01-12 07:39:04 -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
nkzawa 4c32dd96b7 remove unused module alias 2017-01-12 12:39:07 +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 8811a334f4 Remove default next pages compilation from the main babel-loader. (#731)
* Remove default next pages compilation from the main babel-loader.
This will fix the issue when the user ignore node_modules
via our .babelrc option.

* Change babel-loaders 'query' to 'options'.
That's what's supported/recommended in webpack 2
2017-01-11 17:57:33 -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 88e4adfc2a Add case sensitive checks for imports and JSON page resolver (#697)
* Add case-sensitive-paths-webpack-plugin plugin.

* Add case-sensitive check for server/resolve.
2017-01-08 18:12:29 -08:00
Arunoda Susiripala 042ffa1175 Add correct content-type header for gzipped version. (#705) 2017-01-08 18:12:10 -08:00
Naoyuki Kanezawa 929041133c resolve react-dom/server (#688) 2017-01-07 21:56:51 -08:00
Naoyuki Kanezawa 0c82d8a483 hot-reloader: return when rejected (#689) 2017-01-07 18:02:29 -08:00
Naoyuki Kanezawa b8373b847d fix HMR for dynamic entries (#652) 2017-01-05 09:29:09 -08:00
Naoyuki Kanezawa 47a7a480d4 set output.strictModuleExceptionHandling option (#655) 2017-01-05 09:28:54 -08:00
Naoyuki Kanezawa 0a3313d1b9 add the watch ignored setting (#636) 2017-01-03 10:05:04 -08:00
Arunoda Susiripala 6d6ef1ca9f Remove the use of fs.access (#625) 2017-01-02 16:50:01 -08:00
Arunoda Susiripala 4b9f3fc431 Fix JSON pages not building on Windows (#611)
* Check for .json file extension before JSON parse. Was throwing when reading js files.

* Fix cross platform regex

* Revert back to the original content in read-page.js
2017-01-01 20:06:49 -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 33fa931207 Resolve the path in renderJSON before serving. (#599) 2017-01-01 19:07:56 +09:00
Naoyuki Kanezawa 1e308c7118 fix webpack resolve paths (#592) 2016-12-31 21:57:13 -08:00
Naoyuki Kanezawa 8d543bd148 remove the monkeypatch of watchpack (#580) 2016-12-31 11:40:18 -08:00
Arunoda Susiripala 3dae510d51 Add app's node_modules dir to resolveLoaders. (#583)
Otherwise, webpack will throw an error saying
it couldn't find entries.
That's because it couldn't find babel-loader and
other loaders installed into app's node_modules dir.
2016-12-31 22:17:52 +09:00
Arunoda Susiripala 165924b71b Add Gzip support for JSON pages (#571)
* Server JSON pages directly from the filesystem.

* Make Json pages even if there's an error.

* Implement much better page serving.

* Use JsonPagesPlugin in the production mode as well.

* Add gzip support for JSON pages.

* Use glob-promise instead of recursive-readdir

* Handle renderStatic 404 properly.

* Simply the gzip code.

* Cache already read JSON pages.

* Change JSON pages extension to .json.

* Fix HMR related issue.

* Fix hot-reload for .json solely on server.

* Properly clear cache on hot-reloader.

* Convert .js pages into .json page right inside the plugin.

* Fix gzipping .json pages.

* Remove unwanted json pages cleanup.

* Get rid of deprecated fs.exists for fs.access
2016-12-31 21:46:23 +09:00
Naoyuki Kanezawa c210a2e73c check if response is already sent (#569) 2016-12-30 11:55:20 -08:00
Arunoda Susiripala 29c226771c Add AOT gzip content-encoding support for main build files. (#565)
* Add AOT gzip content-encoding support.
Currently we only do this for
main.js and commons.js only.

* Remove unwanted await.

* Use Promise.all to gzip assets in parallel.
2016-12-29 14:38:19 -08:00
Naoyuki Kanezawa ff117b7ed6 Webpack 2 (#449)
* upgrade webpack

* fix WatchRemoveEventPlugin for webpack2

* use webpack2 for building for files

* bump webpack

* bump webpack

* monkeypatch watchpack
2016-12-28 10:16:52 -08:00
Naoyuki Kanezawa 798fd3c1e8 Fix custom document compilation (#534)
* compile _document using webpack

* don't emit the bundle file of _document.js

* exclude _document.js from minChunks of CommonsChunkPlugin

* handle creation/removal of pages/_document.js

* improve path handlings
2016-12-27 15:28:19 -08:00
Naoyuki Kanezawa 815f17989b fix config path (#537) 2016-12-27 15:27:51 -08:00
Arunoda Susiripala ac2a71876d Add support for using .babelrc in the app root. (#493)
* Add support for using .babelrc in the app root.

* Update the README about the .babelrc usage.

* Fix a typo.

* Remove additional example usage.
2016-12-26 10:13:45 -08:00
Naoyuki Kanezawa ad0f0a4d79 watch-page-plugin: prevent null access (#523) 2016-12-26 10:13:28 -08:00
Naoyuki Kanezawa d1f8b1aef1 fix recovering runtime error (#515) 2016-12-25 12:03:07 -08:00
Arunoda Susiripala f7b9cb009f Add cacheDirectory support for babel-loader. (#487)
This will improve the initial babel compilation
specially for larger projects.
2016-12-23 09:49:29 +09:00
Arunoda Susiripala aa7fccbbc4 Fix incorrect babal alias for next/router. (#480) 2016-12-22 22:00:11 +09:00
Arunoda Susiripala 1719738ed1 Allow to customize our babel configuration (#466)
* Add a way to customize babel configurations.

* Add babel configuration docs to README.
2016-12-21 17:36:00 -08:00
Naoyuki Kanezawa fe962b12de make sure to flush styles and head (#459) 2016-12-21 07:57:25 -08:00
Naoyuki Kanezawa 4faa281f23 suppress logging on test (#455) 2016-12-21 06:39:08 -08:00
Arunoda Susiripala 2798df5745 Create a babel-preset for plugins and presets we use. (#445)
* Create a babel-preset for plugins and presets we use.
Anyone could get it via 'next/babel'

* Remove  'use strict' from the source.

* Add next/router to alias resolver in our babel preset.
2016-12-20 18:01:56 -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
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 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
Ives van Hoorne 5ab7463b93 Exploration of different config + expose webpack config (#222)
* Use next.config.js instead of package.json

* Remove irrelevant comment

* Integrate with custom webpack config

* Include hotReload option

* Remove async/await for getConfig

* Read package.json, show warning when webpack in config is defined

* Prepend warning message with WARNING

* Update log statements

* Documentation

* Restart server on change of config

* Fix process handling and cases where there is no config

* Also restart server when config file gets deleted

* Changed second parameter of webpack to config

* Support for returning Promise

* Update documentation, fix bug with webpack config

* Remove package.json, cdn and hotReload from config
2016-12-17 10:38:11 -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
Arunoda Susiripala aa6870a4e6 Fix #204 (#401)
React addons require React in a special way.
That causes Webpack to push React into the app's bundle.
This fix adds new externals entries to prevent that.
2016-12-15 17:45:58 -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