From a9ccf1e147f8ed737dd58f6a611e01562bb92bd1 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sun, 29 Oct 2017 04:25:32 +0530 Subject: [PATCH 01/18] Make sure benchmark runs in the production mode. --- bench/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/package.json b/bench/package.json index cb942542..d39122c7 100644 --- a/bench/package.json +++ b/bench/package.json @@ -2,7 +2,7 @@ "name": "next-bench", "scripts": { "build": "next build", - "start": "npm run build && next start", + "start": "NODE_ENV=production npm run build && NODE_ENV=production next start", "bench:stateless": "ab -c1 -n3000 http://0.0.0.0:3000/stateless", "bench:stateless-big": "ab -c1 -n500 http://0.0.0.0:3000/stateless-big" } From cd7bfe890d130f08babd544ff868641db1dc4686 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Mon, 23 Oct 2017 21:36:17 +0200 Subject: [PATCH 02/18] Release 4.1.4-canary.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9e0b84ba..d91cd112 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "4.1.3", + "version": "4.1.4-canary.1", "description": "Minimalistic framework for server-rendered React applications", "main": "./dist/server/next.js", "license": "MIT", From 1f899d6b60642dc4feca107aa65601f014a4eddf Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Mon, 23 Oct 2017 22:13:59 +0200 Subject: [PATCH 03/18] Update deploy keys --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 76067578..08bb0e04 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ email: "leo@zeit.co", api_key: { secure: - "HGFqez0XKG3vWJUmDjC1veVJmdASUYviaAbJCqQi4JbgNs49AelhYk3w4vl7K6wOnS2OUPD7tICKNDpxBhunKmVlEkLQtqSnQZjmi4x2tGufGTka0c9O7qNSFsiQXAzta/97MnhmG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eO8vC8E2oGkOsAdcypiX6lFG908zyWt7X2SD+iOsK2eAHjxoAEUdrxE5a8gTDhcTH6qnmtBs9rCeEKbO3JZjEy5dvccxlX3Nd+2GC1rckayk6o5L/zveTilsUx6Auqqbwn1dT5ffQuYsV4RPofs8IMrhnizc8y+OfUcCCpBJ4ia4w7N8FEP56TnRNTFoFBGJL5Y6NfeT0HHAlClxUWMG9pRGWGN+sskODDQ9FEntGZoqwV396ogs+3YhkxbY0AIr84QOctflsFcPtOgr/CoBeOsjbB+o9+Rlsqwlf3u3B7qhtU9eV6KcMfK4x9qW+2cwTllK+gD8S9wILx5BChkfx99g/7u/Rg1PCym64tTsDOBtqTVC2YCqeYYvjmpw4Vl3ofLrFsoNQnbmb6Q5+JSpOcJ/bEj7P/FuZdlU0fNV28tFhElu5caKhSCJz/avUlXG7NeveW1Ee8gjhURC4V/l4ryacyjA2vcDY/4RRkWtHNr4=" }, skip_cleanup: true, on: { From 436a2ac73b975cf5a020bd6c432147ee52627029 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Mon, 23 Oct 2017 22:15:26 +0200 Subject: [PATCH 04/18] Release 4.1.4-canary.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d91cd112..77c0cb65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "4.1.4-canary.1", + "version": "4.1.4-canary.2", "description": "Minimalistic framework for server-rendered React applications", "main": "./dist/server/next.js", "license": "MIT", From 43148024228beb9bfa87fcbff8595d69678ce185 Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Thu, 26 Oct 2017 15:29:53 -0400 Subject: [PATCH 05/18] Update styled components for React 16 (#3187) Next 4 only works with React 16, so for this example to work we need an update. --- examples/with-styled-components/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/with-styled-components/package.json b/examples/with-styled-components/package.json index a5b15b58..9976e91b 100644 --- a/examples/with-styled-components/package.json +++ b/examples/with-styled-components/package.json @@ -9,8 +9,8 @@ "dependencies": { "babel-plugin-styled-components": "^1.1.5", "next": "latest", - "react": "^15.6.1", - "react-dom": "^15.6.1", + "react": "^16.0.0", + "react-dom": "^16.0.0", "styled-components": "^2.1.0" }, "license": "ISC" From b937ed36449e463b4656e397e596c7508dec85f4 Mon Sep 17 00:00:00 2001 From: m-allanson Date: Fri, 27 Oct 2017 12:19:30 +0100 Subject: [PATCH 06/18] Remove extra word (#3193) --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index c1b5cd51..c53082fd 100644 --- a/readme.md +++ b/readme.md @@ -62,7 +62,7 @@ npm install --save next react react-dom ``` > Next.js 4 only supports [React 16](https://reactjs.org/blog/2017/09/26/react-v16.0.html).
-> We had to drop React 15 support due to the way how React 16 works and how we use it. +> We had to drop React 15 support due to the way React 16 works and how we use it. and add a script to your package.json like this: From 741f211331c0b9049665257e10f2cefdf29eefb1 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 28 Oct 2017 05:19:56 -0200 Subject: [PATCH 07/18] with-apollo example using Apollo 2 (#3180) * Updated dependencies related to Apollo and React. * Updated libs with Apollo 2 new set of modules. * Updated to Apollo 2 react integration modules. * Updated withData to separate apollo state from the app's state. --- examples/with-apollo/components/PostList.js | 3 ++- examples/with-apollo/components/PostUpvoter.js | 3 ++- examples/with-apollo/components/Submit.js | 3 ++- examples/with-apollo/lib/initApollo.js | 15 +++++++++------ examples/with-apollo/lib/withData.js | 7 ++----- examples/with-apollo/package.json | 11 +++++++---- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/examples/with-apollo/components/PostList.js b/examples/with-apollo/components/PostList.js index 59efbcfb..ecd59292 100644 --- a/examples/with-apollo/components/PostList.js +++ b/examples/with-apollo/components/PostList.js @@ -1,4 +1,5 @@ -import { gql, graphql } from 'react-apollo' +import { graphql } from 'react-apollo' +import gql from 'graphql-tag' import ErrorMessage from './ErrorMessage' import PostUpvoter from './PostUpvoter' diff --git a/examples/with-apollo/components/PostUpvoter.js b/examples/with-apollo/components/PostUpvoter.js index 9c77e28f..05814bf6 100644 --- a/examples/with-apollo/components/PostUpvoter.js +++ b/examples/with-apollo/components/PostUpvoter.js @@ -1,5 +1,6 @@ import React from 'react' -import { gql, graphql } from 'react-apollo' +import { graphql } from 'react-apollo' +import gql from 'graphql-tag' function PostUpvoter ({ upvote, votes, id }) { return ( diff --git a/examples/with-apollo/components/Submit.js b/examples/with-apollo/components/Submit.js index 5a780c7e..792d3b5d 100644 --- a/examples/with-apollo/components/Submit.js +++ b/examples/with-apollo/components/Submit.js @@ -1,4 +1,5 @@ -import { gql, graphql } from 'react-apollo' +import { graphql } from 'react-apollo' +import gql from 'graphql-tag' function Submit ({ createPost }) { function handleSubmit (e) { diff --git a/examples/with-apollo/lib/initApollo.js b/examples/with-apollo/lib/initApollo.js index dfd1976f..5b315f92 100644 --- a/examples/with-apollo/lib/initApollo.js +++ b/examples/with-apollo/lib/initApollo.js @@ -1,4 +1,6 @@ -import { ApolloClient, createNetworkInterface } from 'react-apollo' +import { ApolloClient } from 'apollo-client' +import { HttpLink } from 'apollo-link-http' +import { InMemoryCache } from 'apollo-cache-inmemory' import fetch from 'isomorphic-fetch' let apolloClient = null @@ -10,14 +12,15 @@ if (!process.browser) { function create (initialState) { return new ApolloClient({ - initialState, + connectToDevTools: process.browser, ssrMode: !process.browser, // Disables forceFetch on the server (so queries are only run once) - networkInterface: createNetworkInterface({ + link: new HttpLink({ uri: 'https://api.graph.cool/simple/v1/cixmkt2ul01q00122mksg82pn', // Server URL (must be absolute) - opts: { // Additional fetch() options like `credentials` or `headers` - credentials: 'same-origin' + opts: { + credentials: 'same-origin' // Additional fetch() options like `credentials` or `headers` } - }) + }), + cache: new InMemoryCache().restore(initialState || {}), }) } diff --git a/examples/with-apollo/lib/withData.js b/examples/with-apollo/lib/withData.js index 47207902..10954497 100644 --- a/examples/with-apollo/lib/withData.js +++ b/examples/with-apollo/lib/withData.js @@ -48,12 +48,9 @@ export default ComposedComponent => { Head.rewind() // Extract query data from the Apollo store - const state = apollo.getInitialState() - serverState = { apollo: { - // Only include the Apollo data state - data: state.data + data: apollo.cache.extract() } } } @@ -66,7 +63,7 @@ export default ComposedComponent => { constructor (props) { super(props) - this.apollo = initApollo(this.props.serverState) + this.apollo = initApollo(this.props.serverState.apollo.data) } render () { diff --git a/examples/with-apollo/package.json b/examples/with-apollo/package.json index 9d48d3a2..2e3bdbe1 100644 --- a/examples/with-apollo/package.json +++ b/examples/with-apollo/package.json @@ -7,13 +7,16 @@ "start": "next start" }, "dependencies": { - "graphql": "^0.9.3", + "apollo-client-preset": "^1.0.1", + "graphql": "^0.11.7", + "graphql-anywhere": "^3.1.0", + "graphql-tag": "^2.5.0", "isomorphic-fetch": "^2.2.1", "next": "latest", "prop-types": "^15.5.8", - "react": "^15.5.4", - "react-dom": "^15.5.4", - "react-apollo": "^1.1.3" + "react": "^16.0.0", + "react-apollo": "^2.0.0", + "react-dom": "^16.0.0" }, "author": "", "license": "ISC" From 8578038daaa2545edb9fd767a7cd660e7779122c Mon Sep 17 00:00:00 2001 From: Remy Sharp Date: Sat, 28 Oct 2017 08:23:15 +0100 Subject: [PATCH 08/18] Change _error.js example to use `err` prop (#3197) The `jsonPageRes` isn't always there, whereas `err` is, and when used, provides a consistent statusCode in the client when compared to the server. --- readme.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index c53082fd..f6b2ad04 100644 --- a/readme.md +++ b/readme.md @@ -849,10 +849,8 @@ __Note: React-components outside of `
` will not be initialised by the br import React from 'react' export default class Error extends React.Component { - static getInitialProps({ res, jsonPageRes }) { - const statusCode = res - ? res.statusCode - : jsonPageRes ? jsonPageRes.status : null + static getInitialProps({ res, err }) { + const statusCode = res ? res.statusCode : err ? err.statusCode : null; return { statusCode } } From 015d06a331e9c67ef3d48b8cdd78b8588f61519a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismael=20Mart=C3=ADnez?= Date: Sat, 28 Oct 2017 04:26:00 -0300 Subject: [PATCH 09/18] Upgrade React for examples with next@latest (#3196) --- examples/root-static-files/package.json | 4 ++-- examples/using-inferno/package.json | 4 ++-- examples/using-preact/package.json | 4 ++-- examples/with-ant-design/package.json | 9 ++++++--- examples/with-antd-mobile/package.json | 4 ++-- examples/with-freactal/package.json | 4 ++-- examples/with-react-toolbox/package.json | 4 ++-- examples/with-react-uwp/package.json | 4 ++-- examples/with-react-with-styles/package.json | 4 ++-- examples/with-redux-code-splitting/package.json | 4 ++-- examples/with-redux-saga/package.json | 4 ++-- examples/with-webpack-bundle-analyzer/package.json | 4 ++-- examples/with-webpack-bundle-size-analyzer/package.json | 4 ++-- 13 files changed, 30 insertions(+), 27 deletions(-) diff --git a/examples/root-static-files/package.json b/examples/root-static-files/package.json index f0b2e308..f24e181b 100644 --- a/examples/root-static-files/package.json +++ b/examples/root-static-files/package.json @@ -8,7 +8,7 @@ }, "dependencies": { "next": "latest", - "react": "^15.5.4", - "react-dom": "^15.5.4" + "react": "^16.0.0", + "react-dom": "^16.0.0" } } diff --git a/examples/using-inferno/package.json b/examples/using-inferno/package.json index f3d0ff4f..f8a17a70 100644 --- a/examples/using-inferno/package.json +++ b/examples/using-inferno/package.json @@ -12,8 +12,8 @@ "inferno-server": "^1.4.0", "module-alias": "^2.0.0", "next": "latest", - "react": "^15.6.1", - "react-dom": "^15.6.1" + "react": "^16.0.0", + "react-dom": "^16.0.0" }, "license": "MIT" } diff --git a/examples/using-preact/package.json b/examples/using-preact/package.json index 1db87b8f..8c9c613d 100644 --- a/examples/using-preact/package.json +++ b/examples/using-preact/package.json @@ -11,8 +11,8 @@ "next": "latest", "preact": "^7.2.0", "preact-compat": "^3.14.0", - "react": "^15.6.1", - "react-dom": "^15.6.1" + "react": "^16.0.0", + "react-dom": "^16.0.0" }, "license": "ISC", "devDependencies": { diff --git a/examples/with-ant-design/package.json b/examples/with-ant-design/package.json index a98ee609..01718bf4 100644 --- a/examples/with-ant-design/package.json +++ b/examples/with-ant-design/package.json @@ -10,8 +10,11 @@ "antd": "^2.10.2", "babel-plugin-import": "^1.1.1", "next": "latest", - "react": "^15.5.4", - "react-dom": "^15.5.4" + "react": "^16.0.0", + "react-dom": "^16.0.0" }, - "license": "ISC" + "license": "ISC", + "devDependencies": { + "babel-plugin-transform-decorators-legacy": "^1.3.4" + } } diff --git a/examples/with-antd-mobile/package.json b/examples/with-antd-mobile/package.json index edab58eb..572e9c71 100644 --- a/examples/with-antd-mobile/package.json +++ b/examples/with-antd-mobile/package.json @@ -5,8 +5,8 @@ "antd-mobile": "1.4.0", "babel-plugin-import": "^1.2.1", "next": "latest", - "react": "^15.6.1", - "react-dom": "^15.6.1", + "react": "^16.0.0", + "react-dom": "^16.0.0", "require-hacker": "^3.0.0", "svg-sprite-loader": "0.3.1" }, diff --git a/examples/with-freactal/package.json b/examples/with-freactal/package.json index f51090ed..e2807448 100644 --- a/examples/with-freactal/package.json +++ b/examples/with-freactal/package.json @@ -10,8 +10,8 @@ "freactal": "^1.1.1", "isomorphic-fetch": "^2.2.1", "next": "latest", - "react": "^15.6.1", - "react-dom": "^15.6.1" + "react": "^16.0.0", + "react-dom": "^16.0.0" }, "license": "ISC" } diff --git a/examples/with-react-toolbox/package.json b/examples/with-react-toolbox/package.json index 2957e31c..ae98870f 100644 --- a/examples/with-react-toolbox/package.json +++ b/examples/with-react-toolbox/package.json @@ -10,9 +10,9 @@ "dependencies": { "classnames": "^2.2.5", "next": "latest", - "react": "^15.5.4", + "react": "^16.0.0", "react-addons-css-transition-group": "^15.5.2", - "react-dom": "^15.5.4", + "react-dom": "^16.0.0", "react-toolbox": "^2.0.0-beta.8" }, "devDependencies": { diff --git a/examples/with-react-uwp/package.json b/examples/with-react-uwp/package.json index e2bbb7d0..c785ada0 100644 --- a/examples/with-react-uwp/package.json +++ b/examples/with-react-uwp/package.json @@ -4,8 +4,8 @@ "dependencies": { "babel-core": "^6.25.0", "next": "latest", - "react": "^15.5.4", - "react-dom": "^15.5.4", + "react": "^16.0.0", + "react-dom": "^16.0.0", "react-uwp": "^1.0.9" }, "scripts": { diff --git a/examples/with-react-with-styles/package.json b/examples/with-react-with-styles/package.json index fbb0af3b..ad7f956b 100644 --- a/examples/with-react-with-styles/package.json +++ b/examples/with-react-with-styles/package.json @@ -9,8 +9,8 @@ "dependencies": { "aphrodite": "^1.2.1", "next": "latest", - "react": "^15.6.1", - "react-dom": "^15.6.1", + "react": "^16.0.0", + "react-dom": "^16.0.0", "react-with-styles": "^1.4.0", "react-with-styles-interface-aphrodite": "^1.2.0" }, diff --git a/examples/with-redux-code-splitting/package.json b/examples/with-redux-code-splitting/package.json index 96d2be9d..7baa1b06 100644 --- a/examples/with-redux-code-splitting/package.json +++ b/examples/with-redux-code-splitting/package.json @@ -10,8 +10,8 @@ "fast-redux": "~0.3.0", "next": "latest", "next-redux-wrapper": "~1.3.2", - "react": "~15.6.1", - "react-dom": "~15.6.1", + "react": "^16.0.0", + "react-dom": "^16.0.0", "react-redux": "~5.0.5", "redux": "~3.7.2", "redux-devtools-extension": "~2.13.2", diff --git a/examples/with-redux-saga/package.json b/examples/with-redux-saga/package.json index cbaa8d27..0414ddf4 100644 --- a/examples/with-redux-saga/package.json +++ b/examples/with-redux-saga/package.json @@ -13,8 +13,8 @@ "next": "latest", "next-redux-saga": "1.0.1", "next-redux-wrapper": "1.2.0", - "react": "15.6.1", - "react-dom": "15.6.1", + "react": "^16.0.0", + "react-dom": "^16.0.0", "react-redux": "5.0.5", "redux": "3.7.2", "redux-saga": "0.15.4" diff --git a/examples/with-webpack-bundle-analyzer/package.json b/examples/with-webpack-bundle-analyzer/package.json index 65767abd..11e9315f 100644 --- a/examples/with-webpack-bundle-analyzer/package.json +++ b/examples/with-webpack-bundle-analyzer/package.json @@ -11,8 +11,8 @@ "next": "latest", "cross-env": "^5.0.1", "faker": "^4.1.0", - "react": "^15.6.1", - "react-dom": "^15.6.1", + "react": "^16.0.0", + "react-dom": "^16.0.0", "webpack-bundle-analyzer": "^2.8.2" }, "license": "ISC" diff --git a/examples/with-webpack-bundle-size-analyzer/package.json b/examples/with-webpack-bundle-size-analyzer/package.json index 4997172f..db56f7a0 100644 --- a/examples/with-webpack-bundle-size-analyzer/package.json +++ b/examples/with-webpack-bundle-size-analyzer/package.json @@ -11,8 +11,8 @@ "cross-env": "^5.0.1", "faker": "^4.1.0", "next": "latest", - "react": "^15.6.1", - "react-dom": "^15.6.1", + "react": "^16.0.0", + "react-dom": "^16.0.0", "webpack-bundle-size-analyzer": "^2.7.0" }, "license": "ISC" From 01780fe7893b7b220b6ef10a4caf882e2884904e Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Sun, 29 Oct 2017 00:19:48 +0200 Subject: [PATCH 10/18] Make sure NODE_ENV is production for react-dom to optimize --- bin/next | 3 +++ bin/next-build | 2 -- bin/next-dev | 2 -- bin/next-export | 2 -- bin/next-start | 2 -- 5 files changed, 3 insertions(+), 8 deletions(-) diff --git a/bin/next b/bin/next index cd8efe42..d79a0123 100755 --- a/bin/next +++ b/bin/next @@ -55,6 +55,9 @@ if (commands.has(cmd)) { args = process.argv.slice(2) } +const defaultEnv = cmd === 'dev' ? 'development' : 'production' +process.env.NODE_ENV = process.env.NODE_ENV || defaultEnv + const bin = join(__dirname, 'next-' + cmd) const startProcess = () => { diff --git a/bin/next-build b/bin/next-build index fcd1347a..c9cab029 100755 --- a/bin/next-build +++ b/bin/next-build @@ -5,8 +5,6 @@ import parseArgs from 'minimist' import build from '../server/build' import { printAndExit } from '../lib/utils' -process.env.NODE_ENV = process.env.NODE_ENV || 'production' - const argv = parseArgs(process.argv.slice(2), { alias: { h: 'help' diff --git a/bin/next-dev b/bin/next-dev index 646708b8..bfdfc29c 100755 --- a/bin/next-dev +++ b/bin/next-dev @@ -7,8 +7,6 @@ import Server from '../server' import { printAndExit } from '../lib/utils' import pkgUp from 'pkg-up' -process.env.NODE_ENV = process.env.NODE_ENV || 'development' - const argv = parseArgs(process.argv.slice(2), { alias: { h: 'help', diff --git a/bin/next-export b/bin/next-export index ad9b10fd..a98f6ae7 100755 --- a/bin/next-export +++ b/bin/next-export @@ -5,8 +5,6 @@ import parseArgs from 'minimist' import exportApp from '../server/export' import { printAndExit } from '../lib/utils' -process.env.NODE_ENV = process.env.NODE_ENV || 'production' - const argv = parseArgs(process.argv.slice(2), { alias: { h: 'help', diff --git a/bin/next-start b/bin/next-start index bfd78567..fd743e3b 100755 --- a/bin/next-start +++ b/bin/next-start @@ -4,8 +4,6 @@ import { resolve } from 'path' import parseArgs from 'minimist' import Server from '../server' -process.env.NODE_ENV = process.env.NODE_ENV || 'production' - const argv = parseArgs(process.argv.slice(2), { alias: { h: 'help', From 0bdcb8ddc2b63f98817915816745ee3cb2010cbf Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Sun, 29 Oct 2017 00:39:45 +0200 Subject: [PATCH 11/18] Add note about NODE_ENV being set automatically --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index f6b2ad04..9b895cef 100644 --- a/readme.md +++ b/readme.md @@ -1035,6 +1035,8 @@ Then run `now` and enjoy! Next.js can be deployed to other hosting solutions too. Please have a look at the ['Deployment'](https://github.com/zeit/next.js/wiki/Deployment) section of the wiki. +Note: `NODE_ENV` is properly configured by the `next` subcommands, if absent, to maximize performance. if you’re using Next.js [programmatically](#custom-server-and-routing), it’s your responsibility to set `NODE_ENV=production` manually! + Note: we recommend putting `.next`, or your custom dist folder (Please have a look at ['Custom Config'](https://github.com/zeit/next.js#custom-configuration). You can set a custom folder in config, `.npmignore`, or `.gitignore`. Otherwise, use `files` or `now.files` to opt-into a whitelist of files you want to deploy (and obviously exclude `.next` or your custom dist folder). ## Static HTML export From c927c4f1ce0798e6728e5ec75f3895a67f002187 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Sun, 29 Oct 2017 01:00:16 +0200 Subject: [PATCH 12/18] Release 4.1.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 77c0cb65..0dcd2c5a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "4.1.4-canary.2", + "version": "4.1.4", "description": "Minimalistic framework for server-rendered React applications", "main": "./dist/server/next.js", "license": "MIT", From 1e151058370e127bba2f4be34b18fdda56908db1 Mon Sep 17 00:00:00 2001 From: Kevin Decker Date: Mon, 30 Oct 2017 09:55:44 -0500 Subject: [PATCH 13/18] Output webpack build stats as webpack-stats.json (#2828) --- server/build/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/build/index.js b/server/build/index.js index 92682dd6..ba311bf8 100644 --- a/server/build/index.js +++ b/server/build/index.js @@ -13,8 +13,8 @@ export default async function build (dir, conf = null) { const compiler = await webpack(dir, { buildId, buildDir, conf }) try { - await runCompiler(compiler) - await writeBuildStats(buildDir) + const stats = await runCompiler(compiler) + await writeBuildStats(buildDir, stats) await writeBuildId(buildDir, buildId) } catch (err) { console.error(`> Failed to build on ${buildDir}`) @@ -46,7 +46,7 @@ function runCompiler (compiler) { }) } -async function writeBuildStats (dir) { +async function writeBuildStats (dir, stats) { // Here we can't use hashes in webpack chunks. // That's because the "app.js" is not tied to a chunk. // It's created by merging a few assets. (commons.js and main.js) @@ -58,6 +58,9 @@ async function writeBuildStats (dir) { } const buildStatsPath = join(dir, '.next', 'build-stats.json') await fs.writeFile(buildStatsPath, JSON.stringify(assetHashMap), 'utf8') + + const statsPath = join(dir, '.next', 'webpack-stats.json') + await fs.writeFile(statsPath, JSON.stringify(stats), 'utf8') } async function writeBuildId (dir, buildId) { From 6e44cdef5f877a85d9015002d3f77640c0e1ba21 Mon Sep 17 00:00:00 2001 From: Kevin Decker Date: Mon, 30 Oct 2017 10:01:40 -0500 Subject: [PATCH 14/18] Expose mechanism to monitor render events (#2655) * Allow custom clientBootstrap entrypoint This allows for customization of the client global bootstrap. * Expose render event emitter to client * Include client entry point in npm package --- client.js | 1 + client/index.js | 16 ++++++---------- package.json | 1 + server/build/webpack.js | 1 + 4 files changed, 9 insertions(+), 10 deletions(-) create mode 100644 client.js diff --git a/client.js b/client.js new file mode 100644 index 00000000..ff71a4ae --- /dev/null +++ b/client.js @@ -0,0 +1 @@ +module.exports = require('./dist/client/index') diff --git a/client/index.js b/client/index.js index 9c8163ff..0283d981 100644 --- a/client/index.js +++ b/client/index.js @@ -56,6 +56,8 @@ let ErrorDebugComponent let Component let stripAnsi = (s) => s +export const emitter = new EventEmitter() + export default async ({ ErrorDebugComponent: passedDebugComponent, stripAnsi: passedStripAnsi } = {}) => { // Wait for all the dynamic chunks to get loaded for (const chunkName of chunks) { @@ -80,8 +82,6 @@ export default async ({ ErrorDebugComponent: passedDebugComponent, stripAnsi: pa err }) - const emitter = new EventEmitter() - router.subscribe(({ Component, props, hash, err }) => { render({ Component, props, err, hash, emitter }) }) @@ -132,7 +132,7 @@ export async function renderError (error) { } } -async function doRender ({ Component, props, hash, err, emitter }) { +async function doRender ({ Component, props, hash, err, emitter: emitterProp = emitter }) { if (!props && Component && Component !== ErrorComponent && lastAppProps.Component === ErrorComponent) { @@ -141,10 +141,6 @@ async function doRender ({ Component, props, hash, err, emitter }) { props = await loadGetInitialProps(Component, { err, pathname, query, asPath }) } - if (emitter) { - emitter.emit('before-reactdom-render', { Component, ErrorComponent }) - } - Component = Component || lastAppProps.Component props = props || lastAppProps.props @@ -152,13 +148,13 @@ async function doRender ({ Component, props, hash, err, emitter }) { // lastAppProps has to be set before ReactDom.render to account for ReactDom throwing an error. lastAppProps = appProps + emitterProp.emit('before-reactdom-render', { Component, ErrorComponent, appProps }) + // We need to clear any existing runtime error messages ReactDOM.unmountComponentAtNode(errorContainer) renderReactElement(createElement(App, appProps), appContainer) - if (emitter) { - emitter.emit('after-reactdom-render', { Component, ErrorComponent }) - } + emitterProp.emit('after-reactdom-render', { Component, ErrorComponent, appProps }) } let isInitialRender = true diff --git a/package.json b/package.json index 0dcd2c5a..43a69f0a 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "files": [ "dist", "babel.js", + "client.js", "link.js", "css.js", "head.js", diff --git a/server/build/webpack.js b/server/build/webpack.js index d080b178..2d70280e 100644 --- a/server/build/webpack.js +++ b/server/build/webpack.js @@ -43,6 +43,7 @@ export default async function createCompiler (dir, { buildId, dev = false, quiet const entries = { 'main.js': [ ...defaultEntries, + ...config.clientBootstrap || [], mainJS ] } From ba740460c8cac022e4718ca76a01009eef401a50 Mon Sep 17 00:00:00 2001 From: Thongchai Kitiyanantawong Date: Tue, 31 Oct 2017 14:58:50 +0700 Subject: [PATCH 15/18] Add more example links for CSS preprocessor solution (#3213) * Add more example link for CSS preprocessor solution * Change deprecated link --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index 9b895cef..fbaaa1d4 100644 --- a/readme.md +++ b/readme.md @@ -1170,6 +1170,8 @@ Next.js bundles [styled-jsx](https://github.com/zeit/styled-jsx) supporting scop - [with-external-scoped-css](./examples/with-external-scoped-css) - [with-scoped-stylesheets-and-postcss](./examples/with-scoped-stylesheets-and-postcss) - [with-global-stylesheet](./examples/with-global-stylesheet) +- [with-styled-jsx-scss](./examples/with-styled-jsx-scss) +- [with-styled-jsx-plugins](./examples/with-styled-jsx-plugins) From 28767c06d1eae4ce53418914d29fefcfeb55e70e Mon Sep 17 00:00:00 2001 From: Kitti Piyapan Date: Thu, 2 Nov 2017 23:56:14 +0700 Subject: [PATCH 16/18] Change file name lib on example keep the same format (#3227) Change file name format on folder lib like /examples/with-apollo and /examples/with-apollo-and-redux --- .../lib/{check-logged-in.js => checkLoggedIn.js} | 0 .../with-apollo-auth/lib/{init-apollo.js => initApollo.js} | 0 examples/with-apollo-auth/lib/{with-data.js => withData.js} | 2 +- examples/with-apollo-auth/package.json | 4 ++-- examples/with-apollo-auth/pages/create-account.js | 4 ++-- examples/with-apollo-auth/pages/index.js | 4 ++-- examples/with-apollo-auth/pages/signin.js | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) rename examples/with-apollo-auth/lib/{check-logged-in.js => checkLoggedIn.js} (100%) rename examples/with-apollo-auth/lib/{init-apollo.js => initApollo.js} (100%) rename examples/with-apollo-auth/lib/{with-data.js => withData.js} (98%) diff --git a/examples/with-apollo-auth/lib/check-logged-in.js b/examples/with-apollo-auth/lib/checkLoggedIn.js similarity index 100% rename from examples/with-apollo-auth/lib/check-logged-in.js rename to examples/with-apollo-auth/lib/checkLoggedIn.js diff --git a/examples/with-apollo-auth/lib/init-apollo.js b/examples/with-apollo-auth/lib/initApollo.js similarity index 100% rename from examples/with-apollo-auth/lib/init-apollo.js rename to examples/with-apollo-auth/lib/initApollo.js diff --git a/examples/with-apollo-auth/lib/with-data.js b/examples/with-apollo-auth/lib/withData.js similarity index 98% rename from examples/with-apollo-auth/lib/with-data.js rename to examples/with-apollo-auth/lib/withData.js index c1b550c6..d818e833 100644 --- a/examples/with-apollo-auth/lib/with-data.js +++ b/examples/with-apollo-auth/lib/withData.js @@ -3,7 +3,7 @@ import cookie from 'cookie' import PropTypes from 'prop-types' import { ApolloProvider, getDataFromTree } from 'react-apollo' -import initApollo from './init-apollo' +import initApollo from './initApollo' function parseCookies (ctx = {}, options = {}) { return cookie.parse( diff --git a/examples/with-apollo-auth/package.json b/examples/with-apollo-auth/package.json index c03fedca..be50c7ea 100644 --- a/examples/with-apollo-auth/package.json +++ b/examples/with-apollo-auth/package.json @@ -15,9 +15,9 @@ "isomorphic-fetch": "^2.2.1", "next": "latest", "prop-types": "^15.5.10", - "react": "^15.5.4", + "react": "^16.0.0", "react-apollo": "^1.1.3", - "react-dom": "^15.5.4" + "react-dom": "^16.0.0" }, "devDependencies": { "ava": "^0.19.1", diff --git a/examples/with-apollo-auth/pages/create-account.js b/examples/with-apollo-auth/pages/create-account.js index c079b8dc..75968072 100644 --- a/examples/with-apollo-auth/pages/create-account.js +++ b/examples/with-apollo-auth/pages/create-account.js @@ -4,9 +4,9 @@ import cookie from 'cookie' import Link from 'next/link' import gql from 'graphql-tag' -import withData from '../lib/with-data' +import withData from '../lib/withData' import redirect from '../lib/redirect' -import checkLoggedIn from '../lib/check-logged-in' +import checkLoggedIn from '../lib/checkLoggedIn' class CreateAccount extends React.Component { static async getInitialProps (context, apolloClient) { diff --git a/examples/with-apollo-auth/pages/index.js b/examples/with-apollo-auth/pages/index.js index 537d3677..8250bac4 100644 --- a/examples/with-apollo-auth/pages/index.js +++ b/examples/with-apollo-auth/pages/index.js @@ -2,9 +2,9 @@ import React from 'react' import cookie from 'cookie' import { withApollo, compose } from 'react-apollo' -import withData from '../lib/with-data' +import withData from '../lib/withData' import redirect from '../lib/redirect' -import checkLoggedIn from '../lib/check-logged-in' +import checkLoggedIn from '../lib/checkLoggedIn' class Index extends React.Component { static async getInitialProps (context, apolloClient) { diff --git a/examples/with-apollo-auth/pages/signin.js b/examples/with-apollo-auth/pages/signin.js index 495319e4..2c1ba925 100644 --- a/examples/with-apollo-auth/pages/signin.js +++ b/examples/with-apollo-auth/pages/signin.js @@ -4,9 +4,9 @@ import cookie from 'cookie' import Link from 'next/link' import gql from 'graphql-tag' -import withData from '../lib/with-data' +import withData from '../lib/withData' import redirect from '../lib/redirect' -import checkLoggedIn from '../lib/check-logged-in' +import checkLoggedIn from '../lib/checkLoggedIn' class Signin extends React.Component { static async getInitialProps (context, apolloClient) { From c29ec6bdd015509ca579b608f0aedc485147243a Mon Sep 17 00:00:00 2001 From: Andy Kenward Date: Sat, 4 Nov 2017 10:24:54 +0000 Subject: [PATCH 17/18] example/with-static-export update react & next dependencies (#3238) `next@latest` instead of beta react 16 --- examples/with-static-export/package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/with-static-export/package.json b/examples/with-static-export/package.json index e7f4ec6c..bb2bbcd2 100644 --- a/examples/with-static-export/package.json +++ b/examples/with-static-export/package.json @@ -1,11 +1,12 @@ { + "name": "with-static-export", "main": "server.js", "dependencies": { "express": "^4.15.3", "isomorphic-fetch": "^2.2.1", - "next": "beta", - "react": "^15.5.4", - "react-dom": "^15.5.4", + "next": "latest", + "react": "^16.0.0", + "react-dom": "^16.0.0", "serve": "^5.2.2" }, "scripts": { From 8bb31f0960978c013fddde3d0f89d57b835eee1f Mon Sep 17 00:00:00 2001 From: Andy Kenward Date: Sat, 4 Nov 2017 10:25:39 +0000 Subject: [PATCH 18/18] fix : example/with-noscript to use next@latest and react-dom (#3237) * example with-noscript use next@latest * fix : example/with-noscript react-dom/server usage Since the update to react ^16.0.0 react-dom import location has changed --- examples/with-noscript/components/Noscript.js | 2 +- examples/with-noscript/next.config.js | 2 +- examples/with-noscript/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/with-noscript/components/Noscript.js b/examples/with-noscript/components/Noscript.js index f7ed7be4..6dc37355 100644 --- a/examples/with-noscript/components/Noscript.js +++ b/examples/with-noscript/components/Noscript.js @@ -1,5 +1,5 @@ import React from 'react' -import ReactDOMServer from 'react-dom/lib/ReactDOMServer' +import ReactDOMServer from 'react-dom/server' export default function Noscript (props) { const staticMarkup = ReactDOMServer.renderToStaticMarkup(props.children) diff --git a/examples/with-noscript/next.config.js b/examples/with-noscript/next.config.js index 154a275e..4736a929 100644 --- a/examples/with-noscript/next.config.js +++ b/examples/with-noscript/next.config.js @@ -2,7 +2,7 @@ module.exports = { webpack: (config, { dev }) => { if (!dev) { config.resolve.alias = { - 'react-dom/server': require.resolve('react-dom/dist/react-dom-server.min.js') + 'react-dom/server': require.resolve('react-dom/umd/react-dom-server.browser.production.min.js') } } return config diff --git a/examples/with-noscript/package.json b/examples/with-noscript/package.json index 14cc7d3b..b1bf1cc4 100644 --- a/examples/with-noscript/package.json +++ b/examples/with-noscript/package.json @@ -7,7 +7,7 @@ "start": "next start" }, "dependencies": { - "next": "^3.0.3", + "next": "latest", "react": "^16.0.0", "react-dom": "^16.0.0", "react-lazyload": "^2.2.7"