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

203 commits

Author SHA1 Message Date
Arunoda Susiripala ea77b41570 Use babel-loader 7 beta. (#1495)
* Use babel-loader 7 beta.
This will get rid of the DeprecationWarning printed while
starting next.
Also this is the version recommened to use with Webpack 2.

* Update to the babel-loader-7
2017-04-22 07:18:53 +05:30
Arunoda Susiripala f82e52935d Implement ETag support for server rendered pages. (#1693) 2017-04-18 21:15:42 +05:30
Arunoda Susiripala e0f71d8448 Use babel-preset-env instead of babel-preset-latest. (#1701)
Here we don't use the full capabilities of babel-preset-env.
But it's recommended to use it without browser configs as
a substitute for babel-preset-latest.
That's why we did this.
2017-04-18 19:28:34 +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
C. T. Lin 8e6615dcf9 upgrade react to v15.5 and use prop-types instead of React.PropTypes (#1684)
* upgrade react to v15.5 and use prop-types instead of React.PropTypes

* Update package.json
2017-04-11 00:05:26 +05:30
Arunoda Susiripala 060cac3e3f Move all the modules used in 1/2 of all pages into the common chunks. (#1659) 2017-04-07 11:39:00 -07:00
Arunoda Susiripala 0007cd2a97 [custom server] Handle internal routes automatically (#1658)
* Implement the initial version.

* Improve the render logic a bit.

* Move all the webpack paths under /_next/

* Keep the log:false flag.
2017-04-07 10:58:35 -07:00
alex newman 8d2bbf940d Refactor the build server to remove tie to fs (#1656) 2017-04-07 09:52:12 -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 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 87ff667e6e Revert "Introduce better debug error handling (#1590)" (#1591)
This reverts commit 0bdd321654.
2017-04-01 13:23:09 -07:00
Arunoda Susiripala 0bdd321654 Introduce better debug error handling (#1590)
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.
2017-04-01 13:09:16 -07:00
Arunoda Susiripala bd80b78f5d Handle undefined assets when combining. (#1569)
It's possible for common.js to be empty in certain cases.
So, we need to handle it.
2017-03-30 16:35:53 +02:00
Arunoda Susiripala bb72e19190 Move all NPM modules into a single chunk in dev mode. (#1512)
This will isolate all the NPM modules into a single chunk.
That chunk won't touch by webpack unless, there's a new NPM module.
That gives us much better re-build performance.
2017-03-26 13:48:59 -07:00
Guillermo Rauch 50274959cb Revert "Move all NPM modules into a single chunk in dev mode. (#1505)"
This reverts commit a879f47f9a.
2017-03-26 11:24:58 -07:00
Arunoda Susiripala a879f47f9a Move all NPM modules into a single chunk in dev mode. (#1505)
This will isolate all the NPM modules into a single chunk.
That chunk won't touch by webpack unless, there's a new NPM module.
That gives us much better re-build performance.
2017-03-25 10:26:08 -07:00
Arunoda Susiripala 32af8294a7 Load the main JS bundle in production with async (#1485)
* Use a webpack plugin to combine assets.

* Add comments and make this releseable.

* Fix some typos.

* Fix some typos.
2017-03-24 13:21:34 +05:30
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 b2fabf0fe0 Load script with the defer attribute (#1437)
Load script with the defer attribute
2017-03-19 18:46:50 +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
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 ef2bbfee5a Add default entries to main.js (#1343)
So, we don't need to add them to individual pages.
This also fix the issue where, error pages doesn't ping the server.
2017-03-04 17:29:35 -08:00
Tim Neutkens 2a1f8ad387 Fix linting errors in standard 9.0 (#1333)
* Fix linting errors in standard 9.0

* Update lockfile
2017-03-02 16:17:41 -08:00
Arana Jhonny bc47aac8f4 Fixed some problems with standard (#1331) 2017-03-02 22:46:16 +01:00
Tim Neutkens 40738c6e44 Throw Error when url.parse without true is parsed (#1282)
* Throw Error when url.parse without true is parsed

This is a bit more descriptive when this mistake is made by the user.

* Parse when needed

* Parse querystring if it is not provided
2017-03-01 15:30:07 -08:00
Arunoda Susiripala fd430e53bf Revert "Ignore .next from hot reload watcher" (#1313) 2017-02-28 09:46:11 +01:00
Arunoda Susiripala c79d2676d2 Disable common chunks plugin in dev. (#1311)
With the on-demand-entires, this makes no sense.
2017-02-27 21:49:49 -08:00
Tim Neutkens 4620cd8cd6 Ignore .next from hot reload watcher (#1307)
* Move on-demand-entries-ping to _next namespace

* Ignore .next from watching
2017-02-27 13:35:17 -08:00
Arunoda Susiripala ee56636660 Make sure to invalidate only once before webpack complete the build. (#1297)
* Make sure to invalidate only once before webpack complete the build.

* Increase the touch timeout to 1 sec.
2017-02-27 12:05:10 -08:00
Tim Neutkens b37431461d Move on-demand-entries-ping to _next namespace (#1305) 2017-02-27 12:04:01 -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
Joe Lutz e3bf20cbcf Fix relative module aliases for Windows (#1249)
* Fix relative module aliases for Windows

* Update regular expressions to use `path.sep` instead of `[\\/]`

* Make the minimal changes possible.
2017-02-24 04:49:34 +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
Joe Lutz 2e0db62b52 Fix "EXDEV: cross-device link not permitted" error (#1174)
* Fix "EXDEV: cross-device link not permitted" error

* Fix lint errors

Not sure why standard passes in my dev environment, but hopefully this fixes the CI errors.

* Fix logic mistake

Wow, my bad :/
2017-02-16 15:16:02 +01:00
Fin Hopkins 47d57f4bcd Async render fixes for #1170 (#1172)
The change in #1155 to remove server-side gzipping changed static
rendering to no longer return a promise, which broke the Hapi example
that was waiting for a resolved promise before closing the request.

This PR fixes up all render or serve methods of server.js to
consistently either await and/or return. Additionally, it collapses
serveStatic and _serveStatic, as _serveStatic no longer needs to be
factored out.
2017-02-15 23:48:35 -03:00
Fin Hopkins 8a5250985f Changes hard-coded module aliases to be relative (#1164)
Without this, modules built with Babel or Webpack would have hard-coded absolute paths
all the way back to the root of the filesystem. This prevented compilation and running
on different machines or even from different directories on the same machine.

With this change, paths are hard-coded to the top-most node_madules directory found,
which should make them portable relative to the app.

Fixes #1160
2017-02-16 07:37:29 +05:30
Arunoda Susiripala b2360ec567 Completely delete the build dir. (#1158) 2017-02-15 17:31:21 +01:00
Tim Neutkens fca186f9e7 Remove pre-gzip support (#1155) 2017-02-15 15:49:45 +01:00
Naoyuki Kanezawa 141ab99888 build on tmp dir (#1150) 2017-02-15 10:03:33 -03:00
Thomas Lindstrøm acc1983f80 Don't delete .next folder before a replacement is built (#1139) 2017-02-14 20:14:30 -03:00
Arunoda Susiripala 9d529ea0b1 Remove babell-plugin-transform-react-constant-elements. (#1102)
* Remove babell-plugin-transform-react-constant-elements.
With this, our shared-modules example's counter won't work in
production mode. (as this plugin enabled)
So, we could see more issues like this.
That's why we don't need this at this time.

* Update package.json.
2017-02-14 07:37:34 +05:30
Tim Neutkens 77c14f96b1 Add react-jsx-source for development (#1115) 2017-02-14 07:24:01 +05:30
sfhardman dbc2ceefde Return a promise from getRequestHandler execution, await _serveStatic in serveStaticWithGzip, update custom-server-hapi to complete request lifecycle (#1099) 2017-02-12 23:12:32 -03:00
Arunoda Susiripala b220193167 Babelrc false babelrc (#1094)
* Detect babelrc disabling via babelrc.

* Simplify boolean condition.
2017-02-13 06:18:22 +09:00
Tim Neutkens f93bacfaba Use minimist string option for hostname (#1090)
* Use minimist string option

* Consistently use --hostname

* Code style

* Show hostname
2017-02-13 01:23:42 +09:00
Jesse Hattabaugh c4a22abb4c adding hostname argument to CLI (#1017)
* adding hostname argument to CLI

* using -H instead of -hn

* removing hostname default

* checking that hostname has a truthy value that's not a boolean

* making the log message match the hostname

* oops
2017-02-12 12:26:10 +01:00
Tim Neutkens faef6e48e0 Remove pure-class-to-function (#1077)
* Optimize React

* Remove unused preset

* Remove pure-class-to-function
2017-02-11 07:42:12 +05:30