From 18aa6775aacac6aff41a7a324b3ce2689bc63411 Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Fri, 17 Feb 2017 12:11:29 +0100 Subject: [PATCH 01/20] WIP: Partially working static rendering --- loaders/styleguide-loader.js | 2 +- package.json | 5 +- scripts/make-webpack-config.js | 48 ++- scripts/render.js | 19 + yarn.lock | 618 ++++++--------------------------- 5 files changed, 174 insertions(+), 518 deletions(-) create mode 100644 scripts/render.js diff --git a/loaders/styleguide-loader.js b/loaders/styleguide-loader.js index c66599c60..985e9b99a 100644 --- a/loaders/styleguide-loader.js +++ b/loaders/styleguide-loader.js @@ -77,5 +77,5 @@ if (module.hot) { } module.exports = ${generate(toAst(styleguide))} - `; +`; }; diff --git a/package.json b/package.json index 79a6bae65..a8d3d2be6 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "loader-utils": "^0.2.16", "lodash": "^4.17.4", "minimist": "^1.2.0", + "node-noop": "^1.0.0", "pretty-format": "^18.1.0", "react-codemirror": "^0.3.0", "react-dev-utils": "^0.5.0", @@ -67,6 +68,8 @@ "remark": "^6.2.0", "remark-parse": "^2.2.0", "semver-utils": "^1.1.1", + "static-html-webpack-plugin": "^1.2.0", + "static-site-generator-webpack-plugin": "^3.1.0", "style-loader": "^0.13.1", "to-ast": "^1.0.0", "unified": "^5.1.0", @@ -110,7 +113,7 @@ "semantic-release": "^6.3.2", "semantic-release-tamia": "^1.1.1", "strip-shebang": "^1.0.2", - "webpack": "2.2.1" + "webpack": "^2.2.1" }, "scripts": { "pretest": "npm run lint", diff --git a/scripts/make-webpack-config.js b/scripts/make-webpack-config.js index 6e5c57584..febbf1dbd 100644 --- a/scripts/make-webpack-config.js +++ b/scripts/make-webpack-config.js @@ -5,6 +5,7 @@ const path = require('path'); const webpack = require('webpack'); const HtmlWebpackPlugin = require('html-webpack-plugin'); +const StaticSiteGeneratorPlugin = require('static-site-generator-webpack-plugin'); const merge = require('webpack-merge'); const hasJsonLoader = require('./utils/hasJsonLoader'); const getWebpackVersion = require('./utils/getWebpackVersion'); @@ -21,11 +22,13 @@ module.exports = function(config, env) { const isProd = env === 'production'; let webpackConfig = { - entry: [], + entry: { + main: [], + }, output: { path: config.styleguideDir, - filename: 'build/bundle.js', - chunkFilename: 'build/[name].js', + filename: '[name].js', + chunkFilename: '[name].js', }, resolve: { extensions: isWebpack2 ? ['.js', '.jsx', '.json'] : ['.js', '.jsx', '.json', ''], @@ -35,11 +38,6 @@ module.exports = function(config, env) { }, plugins: [ new StyleguidistOptionsPlugin(config), - new HtmlWebpackPlugin({ - title: config.title, - template: `!!${htmlLoader}!${config.template}`, - inject: true, - }), new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify(env), @@ -55,7 +53,26 @@ module.exports = function(config, env) { webpackConfig = merge(webpackConfig, { devtool: false, cache: false, + entry: { + // Entry point for static rendering + server: path.join(__dirname, 'render.js'), + }, + output: { + // Required for the static rendering + libraryTarget: 'umd', + }, plugins: [ + // Do not handle CSS loading when building static HTML + new webpack.NormalModuleReplacementPlugin(/\.css$/, 'node-noop'), + // Use separate entry point `server` for static HTML + new StaticSiteGeneratorPlugin('server', ['/'], {}, { + // Mock window global + window: { + navigator: { + userAgent: 'node', + }, + }, + }), new webpack.optimize.OccurrenceOrderPlugin(), new webpack.optimize.UglifyJsPlugin({ compress: { @@ -78,9 +95,11 @@ module.exports = function(config, env) { } else { webpackConfig = merge(webpackConfig, { - entry: [ - require.resolve('react-dev-utils/webpackHotDevClient'), - ], + entry: { + main: [ + require.resolve('react-dev-utils/webpackHotDevClient'), + ], + }, cache: true, devtool: 'eval', stats: { @@ -89,6 +108,11 @@ module.exports = function(config, env) { }, plugins: [ new webpack.HotModuleReplacementPlugin(), + new HtmlWebpackPlugin({ + title: config.title, + template: `!!${htmlLoader}!${config.template}`, + inject: true, + }), ], }); } @@ -123,7 +147,7 @@ module.exports = function(config, env) { } // Add Styleguidist’s entry point after user’s entry points so things like polyfills would work - webpackConfig.entry.push(path.resolve(sourceDir, 'index')); + webpackConfig.entry.main.push(path.resolve(sourceDir, 'index')); // Add components folder alias at the end so users can override our components to customize the style guide // (their aliases should be before this one) diff --git a/scripts/render.js b/scripts/render.js new file mode 100644 index 000000000..a4fe847d3 --- /dev/null +++ b/scripts/render.js @@ -0,0 +1,19 @@ +'use strict'; + +const React = require('react'); +const { renderToString } = require('react-dom/server'); +const StyleGuide = require('rsg-components/StyleGuide').default; +const styleguide = require('!!../loaders/styleguide-loader!./index.js'); + +module.exports = function() { + return renderToString( + + ); +}; diff --git a/yarn.lock b/yarn.lock index bb86c380c..9d090e017 100644 --- a/yarn.lock +++ b/yarn.lock @@ -81,7 +81,7 @@ acorn-object-spread@^1.0.0: dependencies: acorn "^3.1.0" -acorn@4.0.4, acorn@^4.0.1, acorn@^4.0.3, acorn@^4.0.4: +acorn@4.0.4, acorn@^4.0.3, acorn@^4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" @@ -335,7 +335,7 @@ async-each@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" -async@2.1.2: +async@2.1.2, async@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/async/-/async-2.1.2.tgz#612a4ab45ef42a70cde806bad86ee6db047e8385" dependencies: @@ -349,7 +349,7 @@ async@^1.3.0, async@^1.4.0, async@^1.4.2, async@^1.5.0, async@^1.5.2: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" -async@^2.0.1, async@^2.1.2, async@^2.1.4: +async@^2.0.1, async@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/async/-/async-2.1.4.tgz#2d2160c7788032e4dd6cbe2502f1f9a2c8f6cde4" dependencies: @@ -363,7 +363,7 @@ asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" -autoprefixer@6.7.2: +autoprefixer@6.7.2, autoprefixer@^6.3.1: version "6.7.2" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-6.7.2.tgz#172ab07b998ae9b957530928a59a40be54a45023" dependencies: @@ -374,17 +374,6 @@ autoprefixer@6.7.2: postcss "^5.2.11" postcss-value-parser "^3.2.3" -autoprefixer@^6.3.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-6.5.1.tgz#ae759a5221e709f3da17c2d656230e67c43cbb75" - dependencies: - browserslist "~1.4.0" - caniuse-db "^1.0.30000554" - normalize-range "^0.1.2" - num2fraction "^1.2.2" - postcss "^5.2.4" - postcss-value-parser "^3.2.3" - aws-sign2@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" @@ -414,7 +403,7 @@ babel-cli@^6.23.0: optionalDependencies: chokidar "^1.6.1" -babel-code-frame@^6.11.0, babel-code-frame@^6.16.0, babel-code-frame@^6.20.0: +babel-code-frame@^6.11.0: version "6.20.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.20.0.tgz#b968f839090f9a8bc6d41938fb96cb84f7387b26" dependencies: @@ -422,7 +411,7 @@ babel-code-frame@^6.11.0, babel-code-frame@^6.16.0, babel-code-frame@^6.20.0: esutils "^2.0.2" js-tokens "^2.0.0" -babel-code-frame@^6.22.0: +babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" dependencies: @@ -454,31 +443,7 @@ babel-core@6.22.1: slash "^1.0.0" source-map "^0.5.0" -babel-core@^6.0.0, babel-core@^6.18.0: - version "6.21.0" - resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.21.0.tgz#75525480c21c803f826ef3867d22c19f080a3724" - dependencies: - babel-code-frame "^6.20.0" - babel-generator "^6.21.0" - babel-helpers "^6.16.0" - babel-messages "^6.8.0" - babel-register "^6.18.0" - babel-runtime "^6.20.0" - babel-template "^6.16.0" - babel-traverse "^6.21.0" - babel-types "^6.21.0" - babylon "^6.11.0" - convert-source-map "^1.1.0" - debug "^2.1.1" - json5 "^0.5.0" - lodash "^4.2.0" - minimatch "^3.0.2" - path-is-absolute "^1.0.0" - private "^0.1.6" - slash "^1.0.0" - source-map "^0.5.0" - -babel-core@^6.23.0, babel-core@^6.23.1: +babel-core@^6.0.0, babel-core@^6.23.0, babel-core@^6.23.1: version "6.23.1" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.23.1.tgz#c143cb621bb2f621710c220c5d579d15b8a442df" dependencies: @@ -536,19 +501,7 @@ babel-eslint@7.1.1, babel-eslint@^7.1.1: babylon "^6.13.0" lodash.pickby "^4.6.0" -babel-generator@^6.18.0, babel-generator@^6.21.0: - version "6.21.0" - resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.21.0.tgz#605f1269c489a1c75deeca7ea16d43d4656c8494" - dependencies: - babel-messages "^6.8.0" - babel-runtime "^6.20.0" - babel-types "^6.21.0" - detect-indent "^4.0.0" - jsesc "^1.3.0" - lodash "^4.2.0" - source-map "^0.5.0" - -babel-generator@^6.22.0, babel-generator@^6.23.0: +babel-generator@^6.18.0, babel-generator@^6.22.0, babel-generator@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.23.0.tgz#6b8edab956ef3116f79d8c84c5a3c05f32a74bc5" dependencies: @@ -586,16 +539,7 @@ babel-helper-builder-react-jsx@^6.22.0, babel-helper-builder-react-jsx@^6.23.0: esutils "^2.0.0" lodash "^4.2.0" -babel-helper-builder-react-jsx@^6.8.0: - version "6.21.1" - resolved "https://registry.yarnpkg.com/babel-helper-builder-react-jsx/-/babel-helper-builder-react-jsx-6.21.1.tgz#c4a24208655be9dc1cccf14d366da176f20645e4" - dependencies: - babel-runtime "^6.9.0" - babel-types "^6.21.0" - esutils "^2.0.0" - lodash "^4.2.0" - -babel-helper-call-delegate@^6.22.0: +babel-helper-call-delegate@^6.22.0, babel-helper-call-delegate@^6.8.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-helper-call-delegate/-/babel-helper-call-delegate-6.22.0.tgz#119921b56120f17e9dae3f74b4f5cc7bcc1b37ef" dependencies: @@ -604,24 +548,6 @@ babel-helper-call-delegate@^6.22.0: babel-traverse "^6.22.0" babel-types "^6.22.0" -babel-helper-call-delegate@^6.8.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-helper-call-delegate/-/babel-helper-call-delegate-6.18.0.tgz#05b14aafa430884b034097ef29e9f067ea4133bd" - dependencies: - babel-helper-hoist-variables "^6.18.0" - babel-runtime "^6.0.0" - babel-traverse "^6.18.0" - babel-types "^6.18.0" - -babel-helper-define-map@^6.18.0, babel-helper-define-map@^6.8.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-helper-define-map/-/babel-helper-define-map-6.18.0.tgz#8d6c85dc7fbb4c19be3de40474d18e97c3676ec2" - dependencies: - babel-helper-function-name "^6.18.0" - babel-runtime "^6.9.0" - babel-types "^6.18.0" - lodash "^4.2.0" - babel-helper-define-map@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-helper-define-map/-/babel-helper-define-map-6.23.0.tgz#1444f960c9691d69a2ced6a205315f8fd00804e7" @@ -647,17 +573,7 @@ babel-helper-explode-assignable-expression@^6.22.0: babel-traverse "^6.22.0" babel-types "^6.22.0" -babel-helper-function-name@^6.18.0, babel-helper-function-name@^6.8.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-6.18.0.tgz#68ec71aeba1f3e28b2a6f0730190b754a9bf30e6" - dependencies: - babel-helper-get-function-arity "^6.18.0" - babel-runtime "^6.0.0" - babel-template "^6.8.0" - babel-traverse "^6.18.0" - babel-types "^6.18.0" - -babel-helper-function-name@^6.22.0, babel-helper-function-name@^6.23.0: +babel-helper-function-name@^6.18.0, babel-helper-function-name@^6.22.0, babel-helper-function-name@^6.23.0, babel-helper-function-name@^6.8.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-6.23.0.tgz#25742d67175c8903dbe4b6cb9d9e1fcb8dcf23a6" dependencies: @@ -667,27 +583,13 @@ babel-helper-function-name@^6.22.0, babel-helper-function-name@^6.23.0: babel-traverse "^6.23.0" babel-types "^6.23.0" -babel-helper-get-function-arity@^6.18.0, babel-helper-get-function-arity@^6.8.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.18.0.tgz#a5b19695fd3f9cdfc328398b47dafcd7094f9f24" - dependencies: - babel-runtime "^6.0.0" - babel-types "^6.18.0" - -babel-helper-get-function-arity@^6.22.0: +babel-helper-get-function-arity@^6.22.0, babel-helper-get-function-arity@^6.8.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.22.0.tgz#0beb464ad69dc7347410ac6ade9f03a50634f5ce" dependencies: babel-runtime "^6.22.0" babel-types "^6.22.0" -babel-helper-hoist-variables@^6.18.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.18.0.tgz#a835b5ab8b46d6de9babefae4d98ea41e866b82a" - dependencies: - babel-runtime "^6.0.0" - babel-types "^6.18.0" - babel-helper-hoist-variables@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.22.0.tgz#3eacbf731d80705845dd2e9718f600cfb9b4ba72" @@ -695,13 +597,6 @@ babel-helper-hoist-variables@^6.22.0: babel-runtime "^6.22.0" babel-types "^6.22.0" -babel-helper-optimise-call-expression@^6.18.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.18.0.tgz#9261d0299ee1a4f08a6dd28b7b7c777348fd8f0f" - dependencies: - babel-runtime "^6.0.0" - babel-types "^6.18.0" - babel-helper-optimise-call-expression@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.23.0.tgz#f3ee7eed355b4282138b33d02b78369e470622f5" @@ -717,14 +612,6 @@ babel-helper-regex@^6.22.0: babel-types "^6.22.0" lodash "^4.2.0" -babel-helper-regex@^6.8.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-helper-regex/-/babel-helper-regex-6.18.0.tgz#ae0ebfd77de86cb2f1af258e2cc20b5fe893ecc6" - dependencies: - babel-runtime "^6.9.0" - babel-types "^6.18.0" - lodash "^4.2.0" - babel-helper-remap-async-to-generator@^6.16.0: version "6.20.3" resolved "https://registry.yarnpkg.com/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.20.3.tgz#9dd3b396f13e35ef63e538098500adc24c63c4e7" @@ -745,17 +632,6 @@ babel-helper-remap-async-to-generator@^6.22.0: babel-traverse "^6.22.0" babel-types "^6.22.0" -babel-helper-replace-supers@^6.18.0, babel-helper-replace-supers@^6.8.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-helper-replace-supers/-/babel-helper-replace-supers-6.18.0.tgz#28ec69877be4144dbd64f4cc3a337e89f29a924e" - dependencies: - babel-helper-optimise-call-expression "^6.18.0" - babel-messages "^6.8.0" - babel-runtime "^6.0.0" - babel-template "^6.16.0" - babel-traverse "^6.18.0" - babel-types "^6.18.0" - babel-helper-replace-supers@^6.22.0, babel-helper-replace-supers@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-helper-replace-supers/-/babel-helper-replace-supers-6.23.0.tgz#eeaf8ad9b58ec4337ca94223bacdca1f8d9b4bfd" @@ -767,14 +643,7 @@ babel-helper-replace-supers@^6.22.0, babel-helper-replace-supers@^6.23.0: babel-traverse "^6.23.0" babel-types "^6.23.0" -babel-helpers@^6.16.0: - version "6.16.0" - resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.16.0.tgz#1095ec10d99279460553e67eb3eee9973d3867e3" - dependencies: - babel-runtime "^6.0.0" - babel-template "^6.16.0" - -babel-helpers@^6.22.0, babel-helpers@^6.23.0: +babel-helpers@^6.16.0, babel-helpers@^6.22.0, babel-helpers@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.23.0.tgz#4f8f2e092d0b6a8808a4bde79c27f1e2ecf0d992" dependencies: @@ -798,30 +667,18 @@ babel-loader@6.2.10, babel-loader@~6.2.8: mkdirp "^0.5.1" object-assign "^4.0.1" -babel-messages@^6.22.0, babel-messages@^6.23.0: +babel-messages@^6.22.0, babel-messages@^6.23.0, babel-messages@^6.8.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" dependencies: babel-runtime "^6.22.0" -babel-messages@^6.8.0: - version "6.8.0" - resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.8.0.tgz#bf504736ca967e6d65ef0adb5a2a5f947c8e0eb9" - dependencies: - babel-runtime "^6.0.0" - -babel-plugin-check-es2015-constants@^6.22.0: +babel-plugin-check-es2015-constants@^6.22.0, babel-plugin-check-es2015-constants@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz#35157b101426fd2ffd3da3f75c7d1e91835bbf8a" dependencies: babel-runtime "^6.22.0" -babel-plugin-check-es2015-constants@^6.3.13: - version "6.8.0" - resolved "https://registry.yarnpkg.com/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.8.0.tgz#dbf024c32ed37bfda8dee1e76da02386a8d26fe7" - dependencies: - babel-runtime "^6.0.0" - babel-plugin-istanbul@^3.0.0: version "3.1.2" resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-3.1.2.tgz#11d5abde18425ec24b5d648c7e0b5d25cd354a22" @@ -909,31 +766,19 @@ babel-plugin-transform-class-properties@^6.23.0: babel-runtime "^6.22.0" babel-template "^6.23.0" -babel-plugin-transform-es2015-arrow-functions@^6.22.0: +babel-plugin-transform-es2015-arrow-functions@^6.22.0, babel-plugin-transform-es2015-arrow-functions@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz#452692cb711d5f79dc7f85e440ce41b9f244d221" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-arrow-functions@^6.3.13: - version "6.8.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.8.0.tgz#5b63afc3181bdc9a8c4d481b5a4f3f7d7fef3d9d" - dependencies: - babel-runtime "^6.0.0" - -babel-plugin-transform-es2015-block-scoped-functions@^6.22.0: +babel-plugin-transform-es2015-block-scoped-functions@^6.22.0, babel-plugin-transform-es2015-block-scoped-functions@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz#bbc51b49f964d70cb8d8e0b94e820246ce3a6141" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-block-scoped-functions@^6.3.13: - version "6.8.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.8.0.tgz#ed95d629c4b5a71ae29682b998f70d9833eb366d" - dependencies: - babel-runtime "^6.0.0" - -babel-plugin-transform-es2015-block-scoping@^6.22.0: +babel-plugin-transform-es2015-block-scoping@^6.22.0, babel-plugin-transform-es2015-block-scoping@^6.6.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.23.0.tgz#e48895cf0b375be148cd7c8879b422707a053b51" dependencies: @@ -943,17 +788,7 @@ babel-plugin-transform-es2015-block-scoping@^6.22.0: babel-types "^6.23.0" lodash "^4.2.0" -babel-plugin-transform-es2015-block-scoping@^6.6.0: - version "6.21.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.21.0.tgz#e840687f922e70fb2c42bb13501838c174a115ed" - dependencies: - babel-runtime "^6.20.0" - babel-template "^6.15.0" - babel-traverse "^6.21.0" - babel-types "^6.21.0" - lodash "^4.2.0" - -babel-plugin-transform-es2015-classes@^6.22.0: +babel-plugin-transform-es2015-classes@^6.22.0, babel-plugin-transform-es2015-classes@^6.6.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.23.0.tgz#49b53f326202a2fd1b3bbaa5e2edd8a4f78643c1" dependencies: @@ -967,74 +802,39 @@ babel-plugin-transform-es2015-classes@^6.22.0: babel-traverse "^6.23.0" babel-types "^6.23.0" -babel-plugin-transform-es2015-classes@^6.6.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.18.0.tgz#ffe7a17321bf83e494dcda0ae3fc72df48ffd1d9" - dependencies: - babel-helper-define-map "^6.18.0" - babel-helper-function-name "^6.18.0" - babel-helper-optimise-call-expression "^6.18.0" - babel-helper-replace-supers "^6.18.0" - babel-messages "^6.8.0" - babel-runtime "^6.9.0" - babel-template "^6.14.0" - babel-traverse "^6.18.0" - babel-types "^6.18.0" - -babel-plugin-transform-es2015-computed-properties@^6.22.0: +babel-plugin-transform-es2015-computed-properties@^6.22.0, babel-plugin-transform-es2015-computed-properties@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.22.0.tgz#7c383e9629bba4820c11b0425bdd6290f7f057e7" dependencies: babel-runtime "^6.22.0" babel-template "^6.22.0" -babel-plugin-transform-es2015-computed-properties@^6.3.13: - version "6.8.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.8.0.tgz#f51010fd61b3bd7b6b60a5fdfd307bb7a5279870" - dependencies: - babel-helper-define-map "^6.8.0" - babel-runtime "^6.0.0" - babel-template "^6.8.0" - -babel-plugin-transform-es2015-destructuring@6.16.0, babel-plugin-transform-es2015-destructuring@^6.6.0: +babel-plugin-transform-es2015-destructuring@6.16.0: version "6.16.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.16.0.tgz#050fe0866f5d53b36062ee10cdf5bfe64f929627" dependencies: babel-runtime "^6.9.0" -babel-plugin-transform-es2015-destructuring@^6.22.0: +babel-plugin-transform-es2015-destructuring@^6.22.0, babel-plugin-transform-es2015-destructuring@^6.6.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz#997bb1f1ab967f682d2b0876fe358d60e765c56d" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-duplicate-keys@^6.22.0: +babel-plugin-transform-es2015-duplicate-keys@^6.22.0, babel-plugin-transform-es2015-duplicate-keys@^6.6.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.22.0.tgz#672397031c21610d72dd2bbb0ba9fb6277e1c36b" dependencies: babel-runtime "^6.22.0" babel-types "^6.22.0" -babel-plugin-transform-es2015-duplicate-keys@^6.6.0: - version "6.8.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.8.0.tgz#fd8f7f7171fc108cc1c70c3164b9f15a81c25f7d" - dependencies: - babel-runtime "^6.0.0" - babel-types "^6.8.0" - -babel-plugin-transform-es2015-for-of@^6.22.0: +babel-plugin-transform-es2015-for-of@^6.22.0, babel-plugin-transform-es2015-for-of@^6.6.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz#f47c95b2b613df1d3ecc2fdb7573623c75248691" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-for-of@^6.6.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.18.0.tgz#4c517504db64bf8cfc119a6b8f177211f2028a70" - dependencies: - babel-runtime "^6.0.0" - -babel-plugin-transform-es2015-function-name@^6.22.0: +babel-plugin-transform-es2015-function-name@^6.22.0, babel-plugin-transform-es2015-function-name@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.22.0.tgz#f5fcc8b09093f9a23c76ac3d9e392c3ec4b77104" dependencies: @@ -1042,35 +842,13 @@ babel-plugin-transform-es2015-function-name@^6.22.0: babel-runtime "^6.22.0" babel-types "^6.22.0" -babel-plugin-transform-es2015-function-name@^6.3.13: - version "6.9.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.9.0.tgz#8c135b17dbd064e5bba56ec511baaee2fca82719" - dependencies: - babel-helper-function-name "^6.8.0" - babel-runtime "^6.9.0" - babel-types "^6.9.0" - -babel-plugin-transform-es2015-literals@^6.22.0: +babel-plugin-transform-es2015-literals@^6.22.0, babel-plugin-transform-es2015-literals@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz#4f54a02d6cd66cf915280019a31d31925377ca2e" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-literals@^6.3.13: - version "6.8.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.8.0.tgz#50aa2e5c7958fc2ab25d74ec117e0cc98f046468" - dependencies: - babel-runtime "^6.0.0" - -babel-plugin-transform-es2015-modules-amd@^6.18.0, babel-plugin-transform-es2015-modules-amd@^6.8.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.18.0.tgz#49a054cbb762bdf9ae2d8a807076cfade6141e40" - dependencies: - babel-plugin-transform-es2015-modules-commonjs "^6.18.0" - babel-runtime "^6.0.0" - babel-template "^6.8.0" - -babel-plugin-transform-es2015-modules-amd@^6.22.0: +babel-plugin-transform-es2015-modules-amd@^6.22.0, babel-plugin-transform-es2015-modules-amd@^6.8.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.22.0.tgz#bf69cd34889a41c33d90dfb740e0091ccff52f21" dependencies: @@ -1078,16 +856,7 @@ babel-plugin-transform-es2015-modules-amd@^6.22.0: babel-runtime "^6.22.0" babel-template "^6.22.0" -babel-plugin-transform-es2015-modules-commonjs@^6.18.0, babel-plugin-transform-es2015-modules-commonjs@^6.6.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.18.0.tgz#c15ae5bb11b32a0abdcc98a5837baa4ee8d67bcc" - dependencies: - babel-plugin-transform-strict-mode "^6.18.0" - babel-runtime "^6.0.0" - babel-template "^6.16.0" - babel-types "^6.18.0" - -babel-plugin-transform-es2015-modules-commonjs@^6.22.0: +babel-plugin-transform-es2015-modules-commonjs@^6.22.0, babel-plugin-transform-es2015-modules-commonjs@^6.6.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.23.0.tgz#cba7aa6379fb7ec99250e6d46de2973aaffa7b92" dependencies: @@ -1096,15 +865,7 @@ babel-plugin-transform-es2015-modules-commonjs@^6.22.0: babel-template "^6.23.0" babel-types "^6.23.0" -babel-plugin-transform-es2015-modules-systemjs@^6.12.0: - version "6.19.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.19.0.tgz#50438136eba74527efa00a5b0fefaf1dc4071da6" - dependencies: - babel-helper-hoist-variables "^6.18.0" - babel-runtime "^6.11.6" - babel-template "^6.14.0" - -babel-plugin-transform-es2015-modules-systemjs@^6.22.0: +babel-plugin-transform-es2015-modules-systemjs@^6.12.0, babel-plugin-transform-es2015-modules-systemjs@^6.22.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.23.0.tgz#ae3469227ffac39b0310d90fec73bfdc4f6317b0" dependencies: @@ -1112,15 +873,7 @@ babel-plugin-transform-es2015-modules-systemjs@^6.22.0: babel-runtime "^6.22.0" babel-template "^6.23.0" -babel-plugin-transform-es2015-modules-umd@^6.12.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.18.0.tgz#23351770ece5c1f8e83ed67cb1d7992884491e50" - dependencies: - babel-plugin-transform-es2015-modules-amd "^6.18.0" - babel-runtime "^6.0.0" - babel-template "^6.8.0" - -babel-plugin-transform-es2015-modules-umd@^6.22.0: +babel-plugin-transform-es2015-modules-umd@^6.12.0, babel-plugin-transform-es2015-modules-umd@^6.22.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.23.0.tgz#8d284ae2e19ed8fe21d2b1b26d6e7e0fcd94f0f1" dependencies: @@ -1128,21 +881,14 @@ babel-plugin-transform-es2015-modules-umd@^6.22.0: babel-runtime "^6.22.0" babel-template "^6.23.0" -babel-plugin-transform-es2015-object-super@^6.22.0: +babel-plugin-transform-es2015-object-super@^6.22.0, babel-plugin-transform-es2015-object-super@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.22.0.tgz#daa60e114a042ea769dd53fe528fc82311eb98fc" dependencies: babel-helper-replace-supers "^6.22.0" babel-runtime "^6.22.0" -babel-plugin-transform-es2015-object-super@^6.3.13: - version "6.8.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.8.0.tgz#1b858740a5a4400887c23dcff6f4d56eea4a24c5" - dependencies: - babel-helper-replace-supers "^6.8.0" - babel-runtime "^6.0.0" - -babel-plugin-transform-es2015-parameters@6.17.0, babel-plugin-transform-es2015-parameters@^6.6.0: +babel-plugin-transform-es2015-parameters@6.17.0: version "6.17.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.17.0.tgz#e06d30cef897f46adb4734707bbe128a0d427d58" dependencies: @@ -1164,7 +910,7 @@ babel-plugin-transform-es2015-parameters@6.22.0: babel-traverse "^6.22.0" babel-types "^6.22.0" -babel-plugin-transform-es2015-parameters@^6.22.0: +babel-plugin-transform-es2015-parameters@^6.22.0, babel-plugin-transform-es2015-parameters@^6.6.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.23.0.tgz#3a2aabb70c8af945d5ce386f1a4250625a83ae3b" dependencies: @@ -1175,33 +921,20 @@ babel-plugin-transform-es2015-parameters@^6.22.0: babel-traverse "^6.23.0" babel-types "^6.23.0" -babel-plugin-transform-es2015-shorthand-properties@^6.22.0: +babel-plugin-transform-es2015-shorthand-properties@^6.22.0, babel-plugin-transform-es2015-shorthand-properties@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.22.0.tgz#8ba776e0affaa60bff21e921403b8a652a2ff723" dependencies: babel-runtime "^6.22.0" babel-types "^6.22.0" -babel-plugin-transform-es2015-shorthand-properties@^6.3.13: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.18.0.tgz#e2ede3b7df47bf980151926534d1dd0cbea58f43" - dependencies: - babel-runtime "^6.0.0" - babel-types "^6.18.0" - -babel-plugin-transform-es2015-spread@^6.22.0: +babel-plugin-transform-es2015-spread@^6.22.0, babel-plugin-transform-es2015-spread@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz#d6d68a99f89aedc4536c81a542e8dd9f1746f8d1" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-spread@^6.3.13: - version "6.8.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.8.0.tgz#0217f737e3b821fa5a669f187c6ed59205f05e9c" - dependencies: - babel-runtime "^6.0.0" - -babel-plugin-transform-es2015-sticky-regex@^6.22.0: +babel-plugin-transform-es2015-sticky-regex@^6.22.0, babel-plugin-transform-es2015-sticky-regex@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.22.0.tgz#ab316829e866ee3f4b9eb96939757d19a5bc4593" dependencies: @@ -1209,39 +942,19 @@ babel-plugin-transform-es2015-sticky-regex@^6.22.0: babel-runtime "^6.22.0" babel-types "^6.22.0" -babel-plugin-transform-es2015-sticky-regex@^6.3.13: - version "6.8.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.8.0.tgz#e73d300a440a35d5c64f5c2a344dc236e3df47be" - dependencies: - babel-helper-regex "^6.8.0" - babel-runtime "^6.0.0" - babel-types "^6.8.0" - -babel-plugin-transform-es2015-template-literals@^6.22.0: +babel-plugin-transform-es2015-template-literals@^6.22.0, babel-plugin-transform-es2015-template-literals@^6.6.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz#a84b3450f7e9f8f1f6839d6d687da84bb1236d8d" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-template-literals@^6.6.0: - version "6.8.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.8.0.tgz#86eb876d0a2c635da4ec048b4f7de9dfc897e66b" - dependencies: - babel-runtime "^6.0.0" - -babel-plugin-transform-es2015-typeof-symbol@^6.22.0: +babel-plugin-transform-es2015-typeof-symbol@^6.22.0, babel-plugin-transform-es2015-typeof-symbol@^6.6.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz#dec09f1cddff94b52ac73d505c84df59dcceb372" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-typeof-symbol@^6.6.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.18.0.tgz#0b14c48629c90ff47a0650077f6aa699bee35798" - dependencies: - babel-runtime "^6.0.0" - -babel-plugin-transform-es2015-unicode-regex@^6.22.0: +babel-plugin-transform-es2015-unicode-regex@^6.22.0, babel-plugin-transform-es2015-unicode-regex@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.22.0.tgz#8d9cc27e7ee1decfe65454fb986452a04a613d20" dependencies: @@ -1249,14 +962,6 @@ babel-plugin-transform-es2015-unicode-regex@^6.22.0: babel-runtime "^6.22.0" regexpu-core "^2.0.0" -babel-plugin-transform-es2015-unicode-regex@^6.3.13: - version "6.11.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.11.0.tgz#6298ceabaad88d50a3f4f392d8de997260f6ef2c" - dependencies: - babel-helper-regex "^6.8.0" - babel-runtime "^6.0.0" - regexpu-core "^2.0.0" - babel-plugin-transform-exponentiation-operator@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.22.0.tgz#d57c8335281918e54ef053118ce6eb108468084d" @@ -1273,20 +978,13 @@ babel-plugin-transform-exponentiation-operator@^6.3.13, babel-plugin-transform-e babel-plugin-syntax-exponentiation-operator "^6.8.0" babel-runtime "^6.0.0" -babel-plugin-transform-flow-strip-types@^6.22.0: +babel-plugin-transform-flow-strip-types@^6.22.0, babel-plugin-transform-flow-strip-types@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz#84cb672935d43714fdc32bce84568d87441cf7cf" dependencies: babel-plugin-syntax-flow "^6.18.0" babel-runtime "^6.22.0" -babel-plugin-transform-flow-strip-types@^6.3.13: - version "6.21.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.21.0.tgz#2eea3f8b5bb234339b47283feac155cfb237b948" - dependencies: - babel-plugin-syntax-flow "^6.18.0" - babel-runtime "^6.0.0" - babel-plugin-transform-object-rest-spread@6.16.0: version "6.16.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.16.0.tgz#db441d56fffc1999052fdebe2e2f25ebd28e36a9" @@ -1320,40 +1018,34 @@ babel-plugin-transform-react-constant-elements@6.9.1: dependencies: babel-runtime "^6.9.1" -babel-plugin-transform-react-display-name@^6.22.0, babel-plugin-transform-react-display-name@^6.23.0: +babel-plugin-transform-react-display-name@^6.22.0, babel-plugin-transform-react-display-name@^6.23.0, babel-plugin-transform-react-display-name@^6.3.13: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-display-name/-/babel-plugin-transform-react-display-name-6.23.0.tgz#4398910c358441dc4cef18787264d0412ed36b37" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-react-display-name@^6.3.13: - version "6.8.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-display-name/-/babel-plugin-transform-react-display-name-6.8.0.tgz#f7a084977383d728bdbdc2835bba0159577f660e" - dependencies: - babel-runtime "^6.0.0" - -babel-plugin-transform-react-jsx-self@6.11.0, babel-plugin-transform-react-jsx-self@^6.11.0: +babel-plugin-transform-react-jsx-self@6.11.0: version "6.11.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx-self/-/babel-plugin-transform-react-jsx-self-6.11.0.tgz#605c9450c1429f97a930f7e1dfe3f0d9d0dbd0f4" dependencies: babel-plugin-syntax-jsx "^6.8.0" babel-runtime "^6.9.0" -babel-plugin-transform-react-jsx-self@6.22.0, babel-plugin-transform-react-jsx-self@^6.22.0: +babel-plugin-transform-react-jsx-self@6.22.0, babel-plugin-transform-react-jsx-self@^6.11.0, babel-plugin-transform-react-jsx-self@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx-self/-/babel-plugin-transform-react-jsx-self-6.22.0.tgz#df6d80a9da2612a121e6ddd7558bcbecf06e636e" dependencies: babel-plugin-syntax-jsx "^6.8.0" babel-runtime "^6.22.0" -babel-plugin-transform-react-jsx-source@6.22.0, babel-plugin-transform-react-jsx-source@^6.22.0: +babel-plugin-transform-react-jsx-source@6.22.0, babel-plugin-transform-react-jsx-source@^6.22.0, babel-plugin-transform-react-jsx-source@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx-source/-/babel-plugin-transform-react-jsx-source-6.22.0.tgz#66ac12153f5cd2d17b3c19268f4bf0197f44ecd6" dependencies: babel-plugin-syntax-jsx "^6.8.0" babel-runtime "^6.22.0" -babel-plugin-transform-react-jsx-source@6.9.0, babel-plugin-transform-react-jsx-source@^6.3.13: +babel-plugin-transform-react-jsx-source@6.9.0: version "6.9.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx-source/-/babel-plugin-transform-react-jsx-source-6.9.0.tgz#af684a05c2067a86e0957d4f343295ccf5dccf00" dependencies: @@ -1368,7 +1060,7 @@ babel-plugin-transform-react-jsx@6.22.0: babel-plugin-syntax-jsx "^6.8.0" babel-runtime "^6.22.0" -babel-plugin-transform-react-jsx@^6.22.0, babel-plugin-transform-react-jsx@^6.23.0: +babel-plugin-transform-react-jsx@^6.22.0, babel-plugin-transform-react-jsx@^6.23.0, babel-plugin-transform-react-jsx@^6.3.13: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx/-/babel-plugin-transform-react-jsx-6.23.0.tgz#23e892f7f2e759678eb5e4446a8f8e94e81b3470" dependencies: @@ -1376,15 +1068,7 @@ babel-plugin-transform-react-jsx@^6.22.0, babel-plugin-transform-react-jsx@^6.23 babel-plugin-syntax-jsx "^6.8.0" babel-runtime "^6.22.0" -babel-plugin-transform-react-jsx@^6.3.13: - version "6.8.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx/-/babel-plugin-transform-react-jsx-6.8.0.tgz#94759942f70af18c617189aa7f3593f1644a71ab" - dependencies: - babel-helper-builder-react-jsx "^6.8.0" - babel-plugin-syntax-jsx "^6.8.0" - babel-runtime "^6.0.0" - -babel-plugin-transform-regenerator@6.16.1, babel-plugin-transform-regenerator@^6.6.0: +babel-plugin-transform-regenerator@6.16.1: version "6.16.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.16.1.tgz#a75de6b048a14154aae14b0122756c5bed392f59" dependencies: @@ -1392,7 +1076,7 @@ babel-plugin-transform-regenerator@6.16.1, babel-plugin-transform-regenerator@^6 babel-types "^6.16.0" private "~0.1.5" -babel-plugin-transform-regenerator@6.22.0, babel-plugin-transform-regenerator@^6.22.0: +babel-plugin-transform-regenerator@6.22.0, babel-plugin-transform-regenerator@^6.22.0, babel-plugin-transform-regenerator@^6.6.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.22.0.tgz#65740593a319c44522157538d690b84094617ea6" dependencies: @@ -1410,13 +1094,6 @@ babel-plugin-transform-runtime@6.22.0: dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-strict-mode@^6.18.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.18.0.tgz#df7cf2991fe046f44163dcd110d5ca43bc652b9d" - dependencies: - babel-runtime "^6.0.0" - babel-types "^6.18.0" - babel-plugin-transform-strict-mode@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.22.0.tgz#e008df01340fdc87e959da65991b7e05970c8c7c" @@ -1424,15 +1101,7 @@ babel-plugin-transform-strict-mode@^6.22.0: babel-runtime "^6.22.0" babel-types "^6.22.0" -babel-polyfill@^6.16.0: - version "6.20.0" - resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.20.0.tgz#de4a371006139e20990aac0be367d398331204e7" - dependencies: - babel-runtime "^6.20.0" - core-js "^2.4.0" - regenerator-runtime "^0.10.0" - -babel-polyfill@^6.23.0: +babel-polyfill@^6.16.0, babel-polyfill@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.23.0.tgz#8364ca62df8eafb830499f699177466c3b03499d" dependencies: @@ -1660,19 +1329,7 @@ babel-preset-react@^6.23.0: babel-plugin-transform-react-jsx-source "^6.22.0" babel-preset-flow "^6.23.0" -babel-register@^6.18.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.18.0.tgz#892e2e03865078dd90ad2c715111ec4449b32a68" - dependencies: - babel-core "^6.18.0" - babel-runtime "^6.11.6" - core-js "^2.4.0" - home-or-tmp "^2.0.0" - lodash "^4.2.0" - mkdirp "^0.5.1" - source-map-support "^0.4.2" - -babel-register@^6.22.0, babel-register@^6.23.0: +babel-register@^6.18.0, babel-register@^6.22.0, babel-register@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.23.0.tgz#c9aa3d4cca94b51da34826c4a0f9e08145d74ff3" dependencies: @@ -1698,31 +1355,21 @@ babel-runtime@6.22.0: core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-runtime@^6.0.0, babel-runtime@^6.11.6, babel-runtime@^6.18.0, babel-runtime@^6.20.0, babel-runtime@^6.9.0, babel-runtime@^6.9.1, babel-runtime@^6.9.2: - version "6.20.0" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.20.0.tgz#87300bdcf4cd770f09bf0048c64204e17806d16f" - dependencies: - core-js "^2.4.0" - regenerator-runtime "^0.10.0" - -babel-runtime@^6.22.0: +babel-runtime@^6.0.0, babel-runtime@^6.18.0, babel-runtime@^6.20.0, babel-runtime@^6.22.0, babel-runtime@^6.9.0, babel-runtime@^6.9.1: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" dependencies: core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-template@^6.14.0, babel-template@^6.15.0, babel-template@^6.16.0, babel-template@^6.8.0: - version "6.16.0" - resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.16.0.tgz#e149dd1a9f03a35f817ddbc4d0481988e7ebc8ca" +babel-runtime@^6.9.2: + version "6.20.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.20.0.tgz#87300bdcf4cd770f09bf0048c64204e17806d16f" dependencies: - babel-runtime "^6.9.0" - babel-traverse "^6.16.0" - babel-types "^6.16.0" - babylon "^6.11.0" - lodash "^4.2.0" + core-js "^2.4.0" + regenerator-runtime "^0.10.0" -babel-template@^6.22.0, babel-template@^6.23.0: +babel-template@^6.16.0, babel-template@^6.22.0, babel-template@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.23.0.tgz#04d4f270adbb3aa704a8143ae26faa529238e638" dependencies: @@ -1732,21 +1379,7 @@ babel-template@^6.22.0, babel-template@^6.23.0: babylon "^6.11.0" lodash "^4.2.0" -babel-traverse@^6.15.0, babel-traverse@^6.16.0, babel-traverse@^6.18.0, babel-traverse@^6.20.0, babel-traverse@^6.21.0: - version "6.21.0" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.21.0.tgz#69c6365804f1a4f69eb1213f85b00a818b8c21ad" - dependencies: - babel-code-frame "^6.20.0" - babel-messages "^6.8.0" - babel-runtime "^6.20.0" - babel-types "^6.21.0" - babylon "^6.11.0" - debug "^2.2.0" - globals "^9.0.0" - invariant "^2.2.0" - lodash "^4.2.0" - -babel-traverse@^6.22.0, babel-traverse@^6.22.1, babel-traverse@^6.23.0, babel-traverse@^6.23.1: +babel-traverse@^6.15.0, babel-traverse@^6.16.0, babel-traverse@^6.18.0, babel-traverse@^6.20.0, babel-traverse@^6.22.0, babel-traverse@^6.22.1, babel-traverse@^6.23.0, babel-traverse@^6.23.1: version "6.23.1" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48" dependencies: @@ -1760,16 +1393,7 @@ babel-traverse@^6.22.0, babel-traverse@^6.22.1, babel-traverse@^6.23.0, babel-tr invariant "^2.2.0" lodash "^4.2.0" -babel-types@^6.15.0, babel-types@^6.16.0, babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.20.0, babel-types@^6.21.0, babel-types@^6.8.0, babel-types@^6.9.0: - version "6.21.0" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.21.0.tgz#314b92168891ef6d3806b7f7a917fdf87c11a4b2" - dependencies: - babel-runtime "^6.20.0" - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^1.0.1" - -babel-types@^6.22.0, babel-types@^6.23.0: +babel-types@^6.15.0, babel-types@^6.16.0, babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.20.0, babel-types@^6.22.0, babel-types@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" dependencies: @@ -1836,7 +1460,7 @@ bluebird@2.9.34: version "2.9.34" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.9.34.tgz#2f7b4ec80216328a9fddebdf69c8d4942feff7d8" -bluebird@^3.4.1, bluebird@^3.4.6, bluebird@^3.4.7: +bluebird@^3.0.5, bluebird@^3.4.1, bluebird@^3.4.6, bluebird@^3.4.7: version "3.4.7" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.4.7.tgz#f72d760be09b7f76d08ed8fae98b289a8d05fab3" @@ -1870,8 +1494,8 @@ braces@^1.8.2: repeat-element "^1.1.2" brorand@^1.0.1: - version "1.0.6" - resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.0.6.tgz#4028706b915f91f7b349a2e0bf3c376039d216e5" + version "1.0.7" + resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.0.7.tgz#6677fa5e4901bdbf9c9ec2a748e28dca407a9bfc" browser-resolve@^1.11.2: version "1.11.2" @@ -1936,13 +1560,7 @@ browserify-zlib@^0.1.4: dependencies: pako "~0.2.0" -browserslist@^1.4.0, browserslist@~1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-1.4.0.tgz#9cfdcf5384d9158f5b70da2aa00b30e8ff019049" - dependencies: - caniuse-db "^1.0.30000539" - -browserslist@^1.7.1: +browserslist@^1.4.0, browserslist@^1.7.1: version "1.7.3" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-1.7.3.tgz#25ead9c917b278ad668b83f39c8025697797b2ab" dependencies: @@ -2035,10 +1653,6 @@ camelcase@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" -caniuse-db@^1.0.30000539, caniuse-db@^1.0.30000554: - version "1.0.30000604" - resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000604.tgz#bc139270a777564d19c0aadcd832b491d093bda5" - caniuse-db@^1.0.30000618, caniuse-db@^1.0.30000623: version "1.0.30000624" resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000624.tgz#554b87547895e36f5fe128f4b7448a2ea5bf2213" @@ -2230,11 +1844,7 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" -codemirror@^5.18.2: - version "5.22.0" - resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.22.0.tgz#281ec76ed991ef24db4071fdf4deb746e80bff18" - -codemirror@^5.23.0: +codemirror@^5.18.2, codemirror@^5.23.0: version "5.23.0" resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.23.0.tgz#ac9b6b2e163a79e915b44cf0f43cd115cf6982dc" @@ -2933,8 +2543,8 @@ element-class@^0.2.0: resolved "https://registry.yarnpkg.com/element-class/-/element-class-0.2.2.tgz#9d3bbd0767f9013ef8e1c8ebe722c1402a60050e" elliptic@^6.0.0: - version "6.3.2" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.3.2.tgz#e4c81e0829cf0a65ab70e998b8232723b5c1bc48" + version "6.3.3" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.3.3.tgz#5482d9646d54bcb89fd7d994fc9e2e9568876e3f" dependencies: bn.js "^4.4.0" brorand "^1.0.1" @@ -2960,8 +2570,8 @@ encoding@^0.1.11: iconv-lite "~0.4.13" enhanced-resolve@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.0.2.tgz#0fa709f29e59ee23e6bbcb070c85f992d6247cd1" + version "3.1.0" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.1.0.tgz#9f4b626f577245edcf4b2ad83d86e17f4f421dec" dependencies: graceful-fs "^4.1.2" memory-fs "^0.4.0" @@ -3271,14 +2881,7 @@ eslint@^3.15.0: text-table "~0.2.0" user-home "^2.0.0" -espree@^3.3.1: - version "3.3.2" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.3.2.tgz#dbf3fadeb4ecb4d4778303e50103b3d36c88b89c" - dependencies: - acorn "^4.0.1" - acorn-jsx "^3.0.0" - -espree@^3.4.0: +espree@^3.3.1, espree@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.0.tgz#41656fa5628e042878025ef467e78f125cb86e1d" dependencies: @@ -3320,6 +2923,12 @@ etag@~1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/etag/-/etag-1.7.0.tgz#03d30b5f67dd6e632d2945d30d6652731a34d5d8" +eval@^0.1.0, eval@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/eval/-/eval-0.1.2.tgz#9f7103284c105a66df4030b2b3273165837013da" + dependencies: + require-like ">= 0.1.1" + event-emitter@~0.3.4: version "0.3.4" resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.4.tgz#8d63ddfb4cfe1fae3b32ca265c4c720222080bb5" @@ -3673,20 +3282,13 @@ fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" -fsevents@1.0.17: +fsevents@1.0.17, fsevents@^1.0.0: version "1.0.17" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.0.17.tgz#8537f3f12272678765b4fd6528c0f1f66f8f4558" dependencies: nan "^2.3.0" node-pre-gyp "^0.6.29" -fsevents@^1.0.0: - version "1.0.14" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.0.14.tgz#558e8cc38643d8ef40fe45158486d0d25758eee4" - dependencies: - nan "^2.3.0" - node-pre-gyp "^0.6.29" - fstream-ignore@~1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/fstream-ignore/-/fstream-ignore-1.0.5.tgz#9c31dae34767018fe1d249b24dada67d092da105" @@ -5634,6 +5236,10 @@ node-libs-browser@^2.0.0: util "^0.10.3" vm-browserify "0.0.4" +node-noop@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-noop/-/node-noop-1.0.0.tgz#47a3e7d80cffaa6458364bd22ed85cab3307be79" + node-notifier@^4.6.1: version "4.6.1" resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-4.6.1.tgz#056d14244f3dcc1ceadfe68af9cff0c5473a33f3" @@ -6424,23 +6030,23 @@ postcss-zindex@^2.0.1: postcss "^5.0.4" uniqs "^2.0.0" -postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0.14, postcss@^5.0.16, postcss@^5.0.2, postcss@^5.0.4, postcss@^5.0.5, postcss@^5.0.6, postcss@^5.0.8, postcss@^5.2.4, postcss@^5.2.5: - version "5.2.9" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.9.tgz#282a644f92d4b871ade2d3ce8bd0ea46f18317b6" +postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0.16, postcss@^5.0.2, postcss@^5.0.5, postcss@^5.0.8, postcss@^5.2.11, postcss@^5.2.9: + version "5.2.13" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.13.tgz#1be52a32cf2ef58c0d75f1aedb3beabcf257cef3" dependencies: chalk "^1.1.3" js-base64 "^2.1.9" source-map "^0.5.6" - supports-color "^3.1.2" + supports-color "^3.2.3" -postcss@^5.2.11, postcss@^5.2.9: - version "5.2.13" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.13.tgz#1be52a32cf2ef58c0d75f1aedb3beabcf257cef3" +postcss@^5.0.14, postcss@^5.0.4, postcss@^5.0.6, postcss@^5.2.5: + version "5.2.9" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.9.tgz#282a644f92d4b871ade2d3ce8bd0ea46f18317b6" dependencies: chalk "^1.1.3" js-base64 "^2.1.9" source-map "^0.5.6" - supports-color "^3.2.3" + supports-color "^3.1.2" pre-commit@^1.2.2: version "1.2.2" @@ -7071,6 +6677,10 @@ require-from-string@^1.1.0: version "1.2.1" resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-1.2.1.tgz#529c9ccef27380adfec9a2f965b649bbee636418" +"require-like@>= 0.1.1": + version "0.1.2" + resolved "https://registry.yarnpkg.com/require-like/-/require-like-0.1.2.tgz#ad6f30c13becd797010c468afa775c0c0a6b47fa" + require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" @@ -7369,7 +6979,7 @@ sockjs-client@1.0.1: json3 "^3.3.2" url-parse "^1.0.1" -sockjs-client@1.1.1: +sockjs-client@1.1.1, sockjs-client@^1.0.3: version "1.1.1" resolved "https://registry.yarnpkg.com/sockjs-client/-/sockjs-client-1.1.1.tgz#284843e9a9784d7c474b1571b3240fca9dda4bb0" dependencies: @@ -7380,17 +6990,6 @@ sockjs-client@1.1.1: json3 "^3.3.2" url-parse "^1.1.1" -sockjs-client@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sockjs-client/-/sockjs-client-1.0.3.tgz#b0d8280998460eb2564c5d79d7e3d7cfd8a353ad" - dependencies: - debug "^2.1.0" - eventsource "^0.1.3" - faye-websocket "~0.7.3" - inherits "^2.0.1" - json3 "^3.3.2" - url-parse "^1.0.1" - sockjs@0.3.18, sockjs@^0.3.15: version "0.3.18" resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.18.tgz#d9b289316ca7df77595ef299e075f0f937eb4207" @@ -7520,6 +7119,21 @@ state-toggle@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/state-toggle/-/state-toggle-1.0.0.tgz#d20f9a616bb4f0c3b98b91922d25b640aa2bc425" +static-html-webpack-plugin@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/static-html-webpack-plugin/-/static-html-webpack-plugin-1.2.0.tgz#4012fd61e620494b05d912b08ac2850b98e336c5" + dependencies: + eval "^0.1.1" + object-assign "^4.0.1" + +static-site-generator-webpack-plugin@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/static-site-generator-webpack-plugin/-/static-site-generator-webpack-plugin-3.1.0.tgz#7d722a46bbe7ab94bb04ec7912f4677ba3a437da" + dependencies: + bluebird "^3.0.5" + eval "^0.1.0" + webpack-sources "^0.1.2" + "statuses@>= 1.3.1 < 2", statuses@~1.3.0: version "1.3.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e" @@ -7723,8 +7337,8 @@ tapable@^0.1.8, tapable@~0.1.8: resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.1.10.tgz#29c35707c2b70e50d07482b5d202e8ed446dafd4" tapable@^0.2.5, tapable@~0.2.5: - version "0.2.5" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.5.tgz#1ff6ce7ade58e734ca9bfe36ba342304b377a4d0" + version "0.2.6" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.6.tgz#206be8e188860b514425375e6f1ae89bfb01fd8d" tar-pack@~3.3.0: version "3.3.0" @@ -8211,8 +7825,8 @@ watchpack@^0.2.1: graceful-fs "^4.1.2" watchpack@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.2.0.tgz#15d4620f1e7471f13fcb551d5c030d2c3eb42dbb" + version "1.2.1" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.2.1.tgz#01efa80c5c29e5c56ba55d6f5470a35b6402f0b2" dependencies: async "^2.1.2" chokidar "^1.4.3" @@ -8301,7 +7915,7 @@ webpack-merge@^2.6.1: dependencies: lodash "^4.17.4" -webpack-sources@^0.1.0, webpack-sources@^0.1.4: +webpack-sources@^0.1.0, webpack-sources@^0.1.2, webpack-sources@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.1.4.tgz#ccc2c817e08e5fa393239412690bb481821393cd" dependencies: @@ -8328,7 +7942,7 @@ webpack@1.14.0: watchpack "^0.2.1" webpack-core "~0.6.9" -webpack@2.2.1: +webpack@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/webpack/-/webpack-2.2.1.tgz#7bb1d72ae2087dd1a4af526afec15eed17dda475" dependencies: @@ -8369,14 +7983,10 @@ whatwg-encoding@^1.0.1: dependencies: iconv-lite "0.4.13" -whatwg-fetch@2.0.2: +whatwg-fetch@2.0.2, whatwg-fetch@>=0.10.0: version "2.0.2" resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.2.tgz#fe294d1d89e36c5be8b3195057f2e4bc74fc980e" -whatwg-fetch@>=0.10.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-1.0.0.tgz#01c2ac4df40e236aaa18480e3be74bd5c8eb798e" - whatwg-url@^4.1.0: version "4.2.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.2.0.tgz#abf1a3f5ff4bc2005b3f0c2119382631789d8e44" From d92dbcb56bcd7c10a2b2dc3de05340253a11562e Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Fri, 17 Feb 2017 18:52:41 +0100 Subject: [PATCH 02/20] WIP: Use react-html-document to render index.html for both server and client --- package.json | 2 +- scripts/make-webpack-config.js | 35 ++++++++++---------------------- scripts/render.js | 37 +++++++++++++++++++++++++++++----- yarn.lock | 25 +++++++++-------------- 4 files changed, 54 insertions(+), 45 deletions(-) diff --git a/package.json b/package.json index a8d3d2be6..e3a958da6 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "github-slugger": "^1.1.1", "glob": "^7.1.1", "highlight.js": "^9.9.0", - "html-webpack-plugin": "^2.28.0", "is-directory": "^0.3.1", "json-loader": "^0.5.4", "jss": "^6.3.0", @@ -65,6 +64,7 @@ "react-docgen": "^2.13.0", "react-docgen-displayname-handler": "^1.0.0", "react-group": "^1.0.3", + "react-html-document": "^3.1.0", "remark": "^6.2.0", "remark-parse": "^2.2.0", "semver-utils": "^1.1.1", diff --git a/scripts/make-webpack-config.js b/scripts/make-webpack-config.js index febbf1dbd..a173038e7 100644 --- a/scripts/make-webpack-config.js +++ b/scripts/make-webpack-config.js @@ -4,7 +4,6 @@ const path = require('path'); const webpack = require('webpack'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); const StaticSiteGeneratorPlugin = require('static-site-generator-webpack-plugin'); const merge = require('webpack-merge'); const hasJsonLoader = require('./utils/hasJsonLoader'); @@ -14,7 +13,6 @@ const StyleguidistOptionsPlugin = require('./utils/StyleguidistOptionsPlugin'); const isWebpack2 = getWebpackVersion() === 2; const sourceDir = path.resolve(__dirname, '../lib'); -const htmlLoader = require.resolve('html-webpack-plugin/lib/loader'); module.exports = function(config, env) { process.env.NODE_ENV = env; @@ -24,11 +22,13 @@ module.exports = function(config, env) { let webpackConfig = { entry: { main: [], + server: path.join(__dirname, 'render.js'), // Entry point for static rendering }, output: { path: config.styleguideDir, filename: '[name].js', chunkFilename: '[name].js', + libraryTarget: 'umd', // Required for the static rendering }, resolve: { extensions: isWebpack2 ? ['.js', '.jsx', '.json'] : ['.js', '.jsx', '.json', ''], @@ -43,6 +43,15 @@ module.exports = function(config, env) { NODE_ENV: JSON.stringify(env), }, }), + // Use separate entry point `server` for static HTML + new StaticSiteGeneratorPlugin('server', ['/'], { config }, { + // Mock window global + window: { + navigator: { + userAgent: 'node', + }, + }, + }), ], performance: { hints: false, @@ -53,26 +62,9 @@ module.exports = function(config, env) { webpackConfig = merge(webpackConfig, { devtool: false, cache: false, - entry: { - // Entry point for static rendering - server: path.join(__dirname, 'render.js'), - }, - output: { - // Required for the static rendering - libraryTarget: 'umd', - }, plugins: [ // Do not handle CSS loading when building static HTML new webpack.NormalModuleReplacementPlugin(/\.css$/, 'node-noop'), - // Use separate entry point `server` for static HTML - new StaticSiteGeneratorPlugin('server', ['/'], {}, { - // Mock window global - window: { - navigator: { - userAgent: 'node', - }, - }, - }), new webpack.optimize.OccurrenceOrderPlugin(), new webpack.optimize.UglifyJsPlugin({ compress: { @@ -108,11 +100,6 @@ module.exports = function(config, env) { }, plugins: [ new webpack.HotModuleReplacementPlugin(), - new HtmlWebpackPlugin({ - title: config.title, - template: `!!${htmlLoader}!${config.template}`, - inject: true, - }), ], }); } diff --git a/scripts/render.js b/scripts/render.js index a4fe847d3..559baeda6 100644 --- a/scripts/render.js +++ b/scripts/render.js @@ -1,12 +1,17 @@ 'use strict'; const React = require('react'); -const { renderToString } = require('react-dom/server'); -const StyleGuide = require('rsg-components/StyleGuide').default; -const styleguide = require('!!../loaders/styleguide-loader!./index.js'); +const { renderToStaticMarkup } = require('react-dom/server'); +const HTMLDocument = require('react-html-document').default; -module.exports = function() { - return renderToString( +let content =

Loading your styleguide in development mode...

; // TODO: Render Welcome screen + +// When building for production render the styleguide HTML completely +if (process.env.NODE_ENV === 'production') { + // TODO: Drop the usage of loader for getting config and sections + const styleguide = require('!!../loaders/styleguide-loader!./index.js'); + const StyleGuide = require('rsg-components/StyleGuide').default; + content = ( ); +} + +module.exports = function({ assets, config }) { + // TODO: Handle CSS and JS assets separately + return renderToStaticMarkup( + { + return assets[key].indexOf('server') === -1 ? assets[key] : null; + }) + .filter(Boolean) + } + metatags={[ + { name: 'charset', content: 'utf-8' }, + ]} + > + { content } + + ); }; diff --git a/yarn.lock b/yarn.lock index 9d090e017..e131214eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1460,7 +1460,7 @@ bluebird@2.9.34: version "2.9.34" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.9.34.tgz#2f7b4ec80216328a9fddebdf69c8d4942feff7d8" -bluebird@^3.0.5, bluebird@^3.4.1, bluebird@^3.4.6, bluebird@^3.4.7: +bluebird@^3.0.5, bluebird@^3.4.1, bluebird@^3.4.6: version "3.4.7" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.4.7.tgz#f72d760be09b7f76d08ed8fae98b289a8d05fab3" @@ -3627,7 +3627,7 @@ html-entities@1.2.0, html-entities@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-1.2.0.tgz#41948caf85ce82fed36e4e6a0ed371a6664379e2" -html-minifier@^3.1.0, html-minifier@^3.2.3: +html-minifier@^3.1.0: version "3.2.3" resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.2.3.tgz#d2ff536e24d95726c332493d8f77d84dbed85372" dependencies: @@ -3651,17 +3651,6 @@ html-webpack-plugin@2.24.0: pretty-error "^2.0.2" toposort "^1.0.0" -html-webpack-plugin@^2.28.0: - version "2.28.0" - resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-2.28.0.tgz#2e7863b57e5fd48fe263303e2ffc934c3064d009" - dependencies: - bluebird "^3.4.7" - html-minifier "^3.2.3" - loader-utils "^0.2.16" - lodash "^4.17.3" - pretty-error "^2.0.2" - toposort "^1.0.0" - htmlparser2@^3.9.1: version "3.9.2" resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.9.2.tgz#1bdf87acca0f3f9e53fa4fcceb0f4b4cbb00b338" @@ -4855,7 +4844,7 @@ lodash.words@^3.0.0: dependencies: lodash._root "^3.0.0" -"lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.16.4, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0: +"lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.16.4, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -6255,7 +6244,7 @@ react-docgen@^2.13.0: node-dir "^0.1.10" recast "^0.11.5" -react-dom@^15.4.2: +react-dom@^15.0.2, react-dom@^15.4.2: version "15.4.2" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.4.2.tgz#015363f05b0a1fd52ae9efdd3a0060d90695208f" dependencies: @@ -6267,6 +6256,12 @@ react-group@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/react-group/-/react-group-1.0.3.tgz#553f50e3588324c4bbb161a3e6832677a33c7a5b" +react-html-document@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/react-html-document/-/react-html-document-3.1.0.tgz#36540e7cf85bba8f042b66c72676d69a896467cb" + dependencies: + react-dom "^15.0.2" + react-modal@^1.6.5: version "1.6.5" resolved "https://registry.yarnpkg.com/react-modal/-/react-modal-1.6.5.tgz#f720d99bd81b1def5c2c32e0ffaa48bdaf484862" From 1d05a94c66430b74cdd9cd72b3654ef8d5a4da5c Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Fri, 17 Feb 2017 18:53:23 +0100 Subject: [PATCH 03/20] WIP: Some fixes for SSR --- src/rsg-components/Examples/Examples.js | 2 +- src/rsg-components/ReactComponent/ReactComponent.js | 4 ++-- src/utils/utils.js | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/rsg-components/Examples/Examples.js b/src/rsg-components/Examples/Examples.js index 6b9cffc06..30f03f256 100644 --- a/src/rsg-components/Examples/Examples.js +++ b/src/rsg-components/Examples/Examples.js @@ -5,7 +5,7 @@ import Markdown from 'rsg-components/Markdown'; export default function Examples({ examples, name }, { codeKey }) { return (
- {examples.map((example, index) => { + {Array.isArray(examples) && examples.map((example, index) => { switch (example.type) { case 'code': return ( diff --git a/src/rsg-components/ReactComponent/ReactComponent.js b/src/rsg-components/ReactComponent/ReactComponent.js index 4127be6f1..aa839ef18 100644 --- a/src/rsg-components/ReactComponent/ReactComponent.js +++ b/src/rsg-components/ReactComponent/ReactComponent.js @@ -15,8 +15,8 @@ export default function ReactComponent({ component }, { isolatedComponent = fals pathLine={pathLine} description={description && } props={props && } - methods={methods.length > 0 && } - examples={examples.length > 0 && } + methods={methods && methods.length > 0 && } + examples={examples && examples.length > 0 && } isolated={isolatedComponent} /> ); diff --git a/src/utils/utils.js b/src/utils/utils.js index ba407bbcd..993bc4e08 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -108,8 +108,10 @@ export function filterSectionsByName(sections, query) { sections: section.sections ? filterSectionsByName(section.sections, query) : [], components: section.components ? filterComponentsByName(section.components, query) : [], })) - .filter(section => section.components.length > 0 || section.sections.length > 0 || regExp.test(section.name)) - ; + .filter(section => section.components.length > 0 || + section.sections.length > 0 || + regExp.test(section.name) + ); } /** From 8c3ceedf19c7c9375cba028158c7848724273441 Mon Sep 17 00:00:00 2001 From: Artem Sapegin Date: Fri, 17 Feb 2017 21:13:13 +0100 Subject: [PATCH 04/20] Refactor: Decouple styleguide data loading from webpack loader --- loaders/__tests__/styleguide-loader.spec.js | 107 ++---------------- loaders/styleguide-loader.js | 51 ++------- loaders/utils/__tests__/getStyleguide.spec.js | 68 +++++++++++ loaders/utils/getStyleguide.js | 44 +++++++ scripts/make-webpack-config.js | 10 +- scripts/render.js | 32 +++--- scripts/schemas/config.js | 2 +- 7 files changed, 152 insertions(+), 162 deletions(-) create mode 100644 loaders/utils/__tests__/getStyleguide.spec.js create mode 100644 loaders/utils/getStyleguide.js diff --git a/loaders/__tests__/styleguide-loader.spec.js b/loaders/__tests__/styleguide-loader.spec.js index 71f1d9427..9cb7e9133 100644 --- a/loaders/__tests__/styleguide-loader.spec.js +++ b/loaders/__tests__/styleguide-loader.spec.js @@ -1,124 +1,38 @@ import vm from 'vm'; import path from 'path'; -import { readFileSync } from 'fs'; -import noop from 'lodash/noop'; import styleguideLoader from '../styleguide-loader'; -const file = './test/components/Button/Button.js'; - /* eslint-disable quotes */ -it('should return valid, parsable JS', () => { - const result = styleguideLoader.pitch.call({ - request: file, - _styleguidist: { - sections: [{ components: '../../test/components/**/*.js' }], - configDir: __dirname, - getExampleFilename: () => 'Readme.md', - getComponentPathLine: filepath => filepath, - }, - addContextDependency: noop, - }, readFileSync(file, 'utf8')); - expect(result).toBeTruthy(); - expect(new vm.Script(result)).not.toThrowError(SyntaxError); -}); +const configDir = path.resolve(__dirname, '../../test'); -it('should return correct component paths: glob', () => { +it('should return valid, parsable JS', () => { const result = styleguideLoader.pitch.call({ - request: file, _styleguidist: { sections: [{ components: 'components/**/*.js' }], - configDir: path.resolve(__dirname, '../../test'), - getExampleFilename: () => 'Readme.md', - getComponentPathLine: filepath => filepath, - }, - addContextDependency: noop, - }, readFileSync(file, 'utf8')); - expect(result).toBeTruthy(); - expect(new vm.Script(result)).not.toThrowError(SyntaxError); - expect(result).toMatch(`'filepath': 'components/Button/Button.js'`); - expect(result).toMatch(`'filepath': 'components/Placeholder/Placeholder.js'`); -}); - -it('should return correct component paths: function returning absolute paths', () => { - const result = styleguideLoader.pitch.call({ - request: file, - _styleguidist: { - sections: [{ - components: () => ([ - `${__dirname}/components/Button/Button.js`, - `${__dirname}/components/Placeholder/Placeholder.js`, - ]), - }], - configDir: __dirname, + configDir, getExampleFilename: () => 'Readme.md', getComponentPathLine: filepath => filepath, }, - addContextDependency: noop, - }, readFileSync(file, 'utf8')); + addContextDependency: () => {}, + }); expect(result).toBeTruthy(); expect(new vm.Script(result)).not.toThrowError(SyntaxError); expect(result).toMatch(`'filepath': 'components/Button/Button.js'`); expect(result).toMatch(`'filepath': 'components/Placeholder/Placeholder.js'`); }); -it('should return correct component paths: function returning relative paths', () => { - const result = styleguideLoader.pitch.call({ - request: file, - _styleguidist: { - sections: [{ - components: () => ([ - 'components/Button/Button.js', - 'components/Placeholder/Placeholder.js', - ]), - }], - configDir: __dirname, - getExampleFilename: () => 'Readme.md', - getComponentPathLine: filepath => filepath, - }, - addContextDependency: noop, - }, readFileSync(file, 'utf8')); - expect(result).toBeTruthy(); - expect(new vm.Script(result)).not.toThrowError(SyntaxError); - expect(result).toMatch(`'filepath': 'components/Button/Button.js'`); - expect(result).toMatch(`'filepath': 'components/Placeholder/Placeholder.js'`); -}); - -it('should filter out components without examples if skipComponentsWithoutExample=true', () => { - const result = styleguideLoader.pitch.call({ - request: file, - _styleguidist: { - sections: [{ - components: () => ([ - 'components/Button/Button.js', - 'components/RandomButton/RandomButton.js', - ]), - }], - configDir: path.resolve(__dirname, '../../test'), - skipComponentsWithoutExample: true, - getExampleFilename: componentPath => path.join(path.dirname(componentPath), 'Readme.md'), - getComponentPathLine: filepath => filepath, - }, - addContextDependency: noop, - }, readFileSync(file, 'utf8')); - expect(result).toBeTruthy(); - expect(new vm.Script(result)).not.toThrowError(SyntaxError); - expect(result).toMatch(`'filepath': 'components/Button/Button.js'`); - expect(result.includes('RandomButton.js')).toBeFalsy(); -}); - it('should add context dependencies to webpack from contextDependencies config option', () => { const contextDependencies = ['foo', 'bar']; const addContextDependency = jest.fn(); styleguideLoader.pitch.call({ - request: file, _styleguidist: { - sections: [{ components: 'components/**/*.js' }], - configDir: __dirname, + sections: [], + configDir, contextDependencies, }, addContextDependency, - }, readFileSync(file, 'utf8')); + }); expect(addContextDependency).toHaveBeenCalledTimes(2); expect(addContextDependency).toBeCalledWith(contextDependencies[0]); expect(addContextDependency).toBeCalledWith(contextDependencies[1]); @@ -127,15 +41,14 @@ it('should add context dependencies to webpack from contextDependencies config o it('should add common parent folder of all components to context dependencies', () => { const addContextDependency = jest.fn(); styleguideLoader.pitch.call({ - request: file, _styleguidist: { sections: [{ components: 'components/**/*.js' }], - configDir: path.resolve(__dirname, '../../test'), + configDir, getExampleFilename: () => 'Readme.md', getComponentPathLine: filepath => filepath, }, addContextDependency, - }, readFileSync(file, 'utf8')); + }); expect(addContextDependency).toHaveBeenCalledTimes(1); expect(addContextDependency).toBeCalledWith(expect.stringMatching(/test\/components\/$/)); }); diff --git a/loaders/styleguide-loader.js b/loaders/styleguide-loader.js index 985e9b99a..4386efa9c 100644 --- a/loaders/styleguide-loader.js +++ b/loaders/styleguide-loader.js @@ -1,27 +1,9 @@ 'use strict'; -const pick = require('lodash/pick'); const commonDir = require('common-dir'); const generate = require('escodegen').generate; const toAst = require('to-ast'); -const getAllComponentsWithExamples = require('./utils/getAllComponentsWithExamples'); -const getAllContentPages = require('./utils/getAllContentPages'); -const getComponentFilesFromSections = require('./utils/getComponentFilesFromSections'); -const getSections = require('./utils/getSections'); -const filterComponentsWithExample = require('./utils/filterComponentsWithExample'); - -/* eslint-disable no-console */ - -// Config options that should be passed to the client -const CLIENT_CONFIG_OPTIONS = [ - 'title', - 'highlightTheme', - 'showCode', - 'showSidebar', - 'previewDelay', - 'theme', - 'styles', -]; +const getStyleguide = require('./utils/getStyleguide'); module.exports = function() {}; module.exports.pitch = function() { @@ -31,46 +13,27 @@ module.exports.pitch = function() { } const config = this._styleguidist; + const styleguide = getStyleguide(config); - let sections = getSections(config.sections, config); - if (config.skipComponentsWithoutExample) { - sections = filterComponentsWithExample(sections); - } - - const allComponentFiles = getComponentFilesFromSections(config.sections, config.configDir); - const allContentPages = getAllContentPages(sections); - const allComponentsWithExamples = getAllComponentsWithExamples(sections); - - const welcomeScreen = { - // Nothing to show in the style guide - components: allContentPages.length === 0 && allComponentFiles.length === 0, - // All component have no example files - examples: allContentPages.length === 0 && allComponentFiles.length > 0 && allComponentsWithExamples.length === 0, - }; - + /* eslint-disable no-console */ /* istanbul ignore if */ if (config.verbose) { console.log(); console.log('Loading components:'); - console.log(allComponentFiles.join('\n')); + console.log(styleguide.allComponentFiles.join('\n')); console.log(); } + /* eslint-enable */ // Setup Webpack context dependencies to enable hot reload when adding new files if (config.contextDependencies) { config.contextDependencies.forEach(dir => this.addContextDependency(dir)); } - else if (allComponentFiles.length > 0) { + else if (styleguide.allComponentFiles.length > 0) { // Use common parent directory of all components as a context - this.addContextDependency(commonDir(allComponentFiles)); + this.addContextDependency(commonDir(styleguide.allComponentFiles)); } - const styleguide = { - config: pick(config, CLIENT_CONFIG_OPTIONS), - welcomeScreen, - sections, - }; - return ` if (module.hot) { module.hot.accept([]) diff --git a/loaders/utils/__tests__/getStyleguide.spec.js b/loaders/utils/__tests__/getStyleguide.spec.js new file mode 100644 index 000000000..d368efaff --- /dev/null +++ b/loaders/utils/__tests__/getStyleguide.spec.js @@ -0,0 +1,68 @@ +import path from 'path'; +import getStyleguide from '../getStyleguide'; + +const configDir = path.resolve(__dirname, '../../../test'); + +it('should return correct component paths: glob', () => { + const result = getStyleguide({ + sections: [{ components: 'components/**/*.js' }], + configDir, + getExampleFilename: () => 'Readme.md', + getComponentPathLine: filepath => filepath, + }); + expect(result).toBeTruthy(); + expect(result.sections[0].components[0].filepath).toBe('components/Button/Button.js'); + expect(result.sections[0].components[1].filepath).toBe('components/Placeholder/Placeholder.js'); +}); + +it('should return correct component paths: function returning absolute paths', () => { + const result = getStyleguide({ + sections: [{ + components: () => ([ + `${configDir}/components/Button/Button.js`, + `${configDir}/components/Placeholder/Placeholder.js`, + ]), + }], + configDir, + getExampleFilename: () => 'Readme.md', + getComponentPathLine: filepath => filepath, + }); + expect(result).toBeTruthy(); + expect(result.sections[0].components[0].filepath).toBe('components/Button/Button.js'); + expect(result.sections[0].components[1].filepath).toBe('components/Placeholder/Placeholder.js'); +}); + +it('should return correct component paths: function returning relative paths', () => { + const result = getStyleguide({ + sections: [{ + components: () => ([ + 'components/Button/Button.js', + 'components/Placeholder/Placeholder.js', + ]), + }], + configDir, + getExampleFilename: () => 'Readme.md', + getComponentPathLine: filepath => filepath, + }); + expect(result).toBeTruthy(); + expect(result.sections[0].components[0].filepath).toBe('components/Button/Button.js'); + expect(result.sections[0].components[1].filepath).toBe('components/Placeholder/Placeholder.js'); +}); + +it('should filter out components without examples if skipComponentsWithoutExample=true', () => { + const result = getStyleguide({ + sections: [{ + components: () => ([ + 'components/Button/Button.js', + 'components/RandomButton/RandomButton.js', + ]), + }], + configDir, + skipComponentsWithoutExample: true, + getExampleFilename: componentPath => path.join(path.dirname(componentPath), 'Readme.md'), + getComponentPathLine: filepath => filepath, + }); + expect(result).toBeTruthy(); + expect(result.sections[0].components).toHaveLength(1); + expect(result.sections[0].components[0].filepath).toBe('components/Button/Button.js'); +}); diff --git a/loaders/utils/getStyleguide.js b/loaders/utils/getStyleguide.js new file mode 100644 index 000000000..082af1fb1 --- /dev/null +++ b/loaders/utils/getStyleguide.js @@ -0,0 +1,44 @@ +'use strict'; + +const pick = require('lodash/pick'); +const getAllComponentsWithExamples = require('./getAllComponentsWithExamples'); +const getAllContentPages = require('./getAllContentPages'); +const getComponentFilesFromSections = require('./getComponentFilesFromSections'); +const getSections = require('./getSections'); +const filterComponentsWithExample = require('./filterComponentsWithExample'); + +// Config options that should be passed to the client +const CLIENT_CONFIG_OPTIONS = [ + 'title', + 'highlightTheme', + 'showCode', + 'showSidebar', + 'previewDelay', + 'theme', + 'styles', +]; + +module.exports = function getStyleguide(config) { + let sections = getSections(config.sections, config); + if (config.skipComponentsWithoutExample) { + sections = filterComponentsWithExample(sections); + } + + const allComponentFiles = getComponentFilesFromSections(config.sections, config.configDir); + const allContentPages = getAllContentPages(sections); + const allComponentsWithExamples = getAllComponentsWithExamples(sections); + + const welcomeScreen = { + // Nothing to show in the style guide + components: allContentPages.length === 0 && allComponentFiles.length === 0, + // All component have no example files + examples: allContentPages.length === 0 && allComponentFiles.length > 0 && allComponentsWithExamples.length === 0, + }; + + return { + config: pick(config, CLIENT_CONFIG_OPTIONS), + welcomeScreen, + sections, + allComponentFiles, + }; +}; diff --git a/scripts/make-webpack-config.js b/scripts/make-webpack-config.js index a173038e7..49f0c21d7 100644 --- a/scripts/make-webpack-config.js +++ b/scripts/make-webpack-config.js @@ -9,6 +9,7 @@ const merge = require('webpack-merge'); const hasJsonLoader = require('./utils/hasJsonLoader'); const getWebpackVersion = require('./utils/getWebpackVersion'); const mergeWebpackConfig = require('./utils/mergeWebpackConfig'); +const getStyleguide = require('../loaders/utils/getStyleguide'); const StyleguidistOptionsPlugin = require('./utils/StyleguidistOptionsPlugin'); const isWebpack2 = getWebpackVersion() === 2; @@ -26,8 +27,8 @@ module.exports = function(config, env) { }, output: { path: config.styleguideDir, - filename: '[name].js', - chunkFilename: '[name].js', + filename: 'build/[name].js', + chunkFilename: 'build/[name].js', libraryTarget: 'umd', // Required for the static rendering }, resolve: { @@ -44,7 +45,10 @@ module.exports = function(config, env) { }, }), // Use separate entry point `server` for static HTML - new StaticSiteGeneratorPlugin('server', ['/'], { config }, { + new StaticSiteGeneratorPlugin('server', ['/'], { + config, + styleguide: isProd && getStyleguide(config), + }, { // Mock window global window: { navigator: { diff --git a/scripts/render.js b/scripts/render.js index 559baeda6..22b0e5942 100644 --- a/scripts/render.js +++ b/scripts/render.js @@ -6,24 +6,22 @@ const HTMLDocument = require('react-html-document').default; let content =

Loading your styleguide in development mode...

; // TODO: Render Welcome screen -// When building for production render the styleguide HTML completely -if (process.env.NODE_ENV === 'production') { - // TODO: Drop the usage of loader for getting config and sections - const styleguide = require('!!../loaders/styleguide-loader!./index.js'); - const StyleGuide = require('rsg-components/StyleGuide').default; - content = ( - - ); -} +module.exports = function({ assets, config, styleguide }) { + // When building for production render the styleguide HTML completely + if (styleguide) { + const StyleGuide = require('rsg-components/StyleGuide').default; + content = ( + + ); + } -module.exports = function({ assets, config }) { // TODO: Handle CSS and JS assets separately return renderToStaticMarkup( Date: Sat, 18 Feb 2017 11:43:53 +0100 Subject: [PATCH 05/20] Add gitignore for example's builds --- examples/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 examples/.gitignore diff --git a/examples/.gitignore b/examples/.gitignore new file mode 100644 index 000000000..e315f6a47 --- /dev/null +++ b/examples/.gitignore @@ -0,0 +1 @@ +**/styleguide/*.js From 2c80a6d0aaa6b9fb4723c0391ac31f6c6f6fd5f9 Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Sat, 18 Feb 2017 11:56:09 +0100 Subject: [PATCH 06/20] Remove unused plugin --- package.json | 1 - yarn.lock | 9 +-------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/package.json b/package.json index e3a958da6..456b18bc6 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,6 @@ "remark": "^6.2.0", "remark-parse": "^2.2.0", "semver-utils": "^1.1.1", - "static-html-webpack-plugin": "^1.2.0", "static-site-generator-webpack-plugin": "^3.1.0", "style-loader": "^0.13.1", "to-ast": "^1.0.0", diff --git a/yarn.lock b/yarn.lock index e131214eb..f4ec0e510 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2923,7 +2923,7 @@ etag@~1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/etag/-/etag-1.7.0.tgz#03d30b5f67dd6e632d2945d30d6652731a34d5d8" -eval@^0.1.0, eval@^0.1.1: +eval@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/eval/-/eval-0.1.2.tgz#9f7103284c105a66df4030b2b3273165837013da" dependencies: @@ -7114,13 +7114,6 @@ state-toggle@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/state-toggle/-/state-toggle-1.0.0.tgz#d20f9a616bb4f0c3b98b91922d25b640aa2bc425" -static-html-webpack-plugin@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/static-html-webpack-plugin/-/static-html-webpack-plugin-1.2.0.tgz#4012fd61e620494b05d912b08ac2850b98e336c5" - dependencies: - eval "^0.1.1" - object-assign "^4.0.1" - static-site-generator-webpack-plugin@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/static-site-generator-webpack-plugin/-/static-site-generator-webpack-plugin-3.1.0.tgz#7d722a46bbe7ab94bb04ec7912f4677ba3a437da" From 6ca6b881e67a620039ace2dc07deebff9c459160 Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Sat, 18 Feb 2017 12:41:05 +0100 Subject: [PATCH 07/20] Extract HTML Document rendering to a separate component --- scripts/render.js | 24 ++++-------- .../HtmlDocument/HtmlDocument.spec.js | 38 +++++++++++++++++++ .../HtmlDocument/HtmlDocumentRenderer.js | 33 ++++++++++++++++ .../__snapshots__/HtmlDocument.spec.js.snap | 20 ++++++++++ src/rsg-components/HtmlDocument/index.js | 1 + 5 files changed, 99 insertions(+), 17 deletions(-) create mode 100644 src/rsg-components/HtmlDocument/HtmlDocument.spec.js create mode 100644 src/rsg-components/HtmlDocument/HtmlDocumentRenderer.js create mode 100644 src/rsg-components/HtmlDocument/__snapshots__/HtmlDocument.spec.js.snap create mode 100644 src/rsg-components/HtmlDocument/index.js diff --git a/scripts/render.js b/scripts/render.js index 22b0e5942..64eac3351 100644 --- a/scripts/render.js +++ b/scripts/render.js @@ -2,11 +2,11 @@ const React = require('react'); const { renderToStaticMarkup } = require('react-dom/server'); -const HTMLDocument = require('react-html-document').default; - -let content =

Loading your styleguide in development mode...

; // TODO: Render Welcome screen +const HtmlDocument = require('rsg-components/HtmlDocument').default; module.exports = function({ assets, config, styleguide }) { + let content =

Loading your styleguide in development mode...

; // TODO: Render Welcome screen + // When building for production render the styleguide HTML completely if (styleguide) { const StyleGuide = require('rsg-components/StyleGuide').default; @@ -24,21 +24,11 @@ module.exports = function({ assets, config, styleguide }) { // TODO: Handle CSS and JS assets separately return renderToStaticMarkup( - { - return assets[key].indexOf('server') === -1 ? assets[key] : null; - }) - .filter(Boolean) - } - metatags={[ - { name: 'charset', content: 'utf-8' }, - ]} + { content } - + ); }; diff --git a/src/rsg-components/HtmlDocument/HtmlDocument.spec.js b/src/rsg-components/HtmlDocument/HtmlDocument.spec.js new file mode 100644 index 000000000..25d78a4c0 --- /dev/null +++ b/src/rsg-components/HtmlDocument/HtmlDocument.spec.js @@ -0,0 +1,38 @@ +import React from 'react'; +import Document from './HtmlDocumentRenderer'; + +it('should render children', () => { + const actual = render( + + Hello + + ); + + expect(actual).toMatchSnapshot(); +}); + +it('should include assets in head', () => { + const actual = shallow( + + Hello + + ); + + expect(actual.prop('scripts')).toContain('/main.js'); +}); + +it('should not include server assets', () => { + const actual = shallow( + + Hello + + ); + + expect(actual.prop('scripts')).not.toContain('server'); +}); diff --git a/src/rsg-components/HtmlDocument/HtmlDocumentRenderer.js b/src/rsg-components/HtmlDocument/HtmlDocumentRenderer.js new file mode 100644 index 000000000..a5c97e715 --- /dev/null +++ b/src/rsg-components/HtmlDocument/HtmlDocumentRenderer.js @@ -0,0 +1,33 @@ +import React, { PropTypes } from 'react'; +import HTMLDocument from 'react-html-document'; + +function getScrtips(assets) { + return Object + .keys(assets) + .map(key => { + return assets[key].indexOf('server') === -1 ? assets[key] : null; + }) + .filter(Boolean); +} + +function HtmlDocumentRenderer({ assets = {}, children, title }) { + return ( + + { children } + + ); +} + +HtmlDocumentRenderer.propTypes = { + assets: PropTypes.object, + children: PropTypes.node, + title: PropTypes.string.isRequired, +}; + +export default HtmlDocumentRenderer; diff --git a/src/rsg-components/HtmlDocument/__snapshots__/HtmlDocument.spec.js.snap b/src/rsg-components/HtmlDocument/__snapshots__/HtmlDocument.spec.js.snap new file mode 100644 index 000000000..974871155 --- /dev/null +++ b/src/rsg-components/HtmlDocument/__snapshots__/HtmlDocument.spec.js.snap @@ -0,0 +1,20 @@ +exports[`test should render children 1`] = ` + + + + Test document + + + + +
+ + Hello + +
+ + +`; diff --git a/src/rsg-components/HtmlDocument/index.js b/src/rsg-components/HtmlDocument/index.js new file mode 100644 index 000000000..a43d954dc --- /dev/null +++ b/src/rsg-components/HtmlDocument/index.js @@ -0,0 +1 @@ +export { default } from './HtmlDocumentRenderer'; From 6367b369b01b04cd1073381ddba93656fa77de0f Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Sat, 18 Feb 2017 12:41:50 +0100 Subject: [PATCH 08/20] Revert "Add gitignore for example's builds" This reverts commit 37e10a5b1085ec3dbc8998babd98bb0c148fc5bb. --- examples/.gitignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 examples/.gitignore diff --git a/examples/.gitignore b/examples/.gitignore deleted file mode 100644 index e315f6a47..000000000 --- a/examples/.gitignore +++ /dev/null @@ -1 +0,0 @@ -**/styleguide/*.js From 84761be88e5f741ce7c2a7e58568a490363c99e9 Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Tue, 21 Feb 2017 16:41:21 +0100 Subject: [PATCH 09/20] WIP Working version of both client and server rendering with slugs --- scripts/build.js | 14 ++++++++++--- scripts/make-webpack-config.js | 18 ++++++++++------ src/index.js | 8 +------ .../HtmlDocument/HtmlDocumentRenderer.js | 1 + scripts/render.js => src/server.js | 21 +++++++++++-------- src/utils/utils.js | 8 +++++-- 6 files changed, 43 insertions(+), 27 deletions(-) rename scripts/render.js => src/server.js (54%) diff --git a/scripts/build.js b/scripts/build.js index 63ac28499..2574abf6d 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -4,8 +4,16 @@ const webpack = require('webpack'); const makeWebpackConfig = require('./make-webpack-config'); module.exports = function build(config, callback) { - return webpack(makeWebpackConfig(config, 'production'), (err, stats) => { - // require('fs').writeFileSync('stats.json', JSON.stringify(stats.toJson())); - callback(err, stats); + // Firstly, build static "server" bundle + return webpack(makeWebpackConfig(config, 'production', true), (err, stats) => { + if (err) { + callback(err, stats); + } + + // Then build client-side bundle + webpack(makeWebpackConfig(config, 'production'), (err, stats) => { + // require('fs').writeFileSync('stats.json', JSON.stringify(stats.toJson())); + callback(err, stats); + }); }); }; diff --git a/scripts/make-webpack-config.js b/scripts/make-webpack-config.js index 49f0c21d7..f2cb0f937 100644 --- a/scripts/make-webpack-config.js +++ b/scripts/make-webpack-config.js @@ -9,21 +9,21 @@ const merge = require('webpack-merge'); const hasJsonLoader = require('./utils/hasJsonLoader'); const getWebpackVersion = require('./utils/getWebpackVersion'); const mergeWebpackConfig = require('./utils/mergeWebpackConfig'); -const getStyleguide = require('../loaders/utils/getStyleguide'); const StyleguidistOptionsPlugin = require('./utils/StyleguidistOptionsPlugin'); const isWebpack2 = getWebpackVersion() === 2; const sourceDir = path.resolve(__dirname, '../lib'); -module.exports = function(config, env) { +module.exports = function(config, env, isServer) { process.env.NODE_ENV = env; const isProd = env === 'production'; + isServer = isServer || false; let webpackConfig = { entry: { main: [], - server: path.join(__dirname, 'render.js'), // Entry point for static rendering + server: path.join(sourceDir, 'server.js'), // Entry point for static rendering }, output: { path: config.styleguideDir, @@ -47,7 +47,6 @@ module.exports = function(config, env) { // Use separate entry point `server` for static HTML new StaticSiteGeneratorPlugin('server', ['/'], { config, - styleguide: isProd && getStyleguide(config), }, { // Mock window global window: { @@ -67,8 +66,6 @@ module.exports = function(config, env) { devtool: false, cache: false, plugins: [ - // Do not handle CSS loading when building static HTML - new webpack.NormalModuleReplacementPlugin(/\.css$/, 'node-noop'), new webpack.optimize.OccurrenceOrderPlugin(), new webpack.optimize.UglifyJsPlugin({ compress: { @@ -148,5 +145,14 @@ module.exports = function(config, env) { webpackConfig = config.updateWebpackConfig(webpackConfig, env); } + if (isServer) { + webpackConfig = merge(webpackConfig, { + plugins: [ + // Do not handle CSS loading when building static HTML + new webpack.NormalModuleReplacementPlugin(/\.css$/, 'node-noop'), + ], + }); + } + return webpackConfig; }; diff --git a/src/index.js b/src/index.js index 0c243e83c..871118549 100644 --- a/src/index.js +++ b/src/index.js @@ -8,7 +8,6 @@ import { filterComponentsInSectionsByExactName, processSections, setSlugs, - slugger, } from './utils/utils'; import StyleGuide from 'rsg-components/StyleGuide'; @@ -22,8 +21,7 @@ let codeKey = 0; function renderStyleguide() { const styleguide = require('!!../loaders/styleguide-loader!./index.js'); - - let sections = processSections(styleguide.sections); + let sections = setSlugs(processSections(styleguide.sections), true); // Parse URL hash to check if the components list must be filtered const { @@ -49,10 +47,6 @@ function renderStyleguide() { } } - // Reset slugger for each render to be deterministic - slugger.reset(); - sections = setSlugs(sections); - ReactDOM.render( Loading your styleguide in development mode...; // TODO: Render Welcome screen // When building for production render the styleguide HTML completely - if (styleguide) { + if (process.env.NODE_ENV === 'production') { + const styleguide = require('!!../loaders/styleguide-loader!./index.js'); + const sections = setSlugs(processSections(styleguide.sections), true); const StyleGuide = require('rsg-components/StyleGuide').default; content = ( ); } - // TODO: Handle CSS and JS assets separately return renderToStaticMarkup( { const { name, components, sections } = section; if (name) { From a074e7091bd8dc7185370da53e9f31243fb3ebdc Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Tue, 21 Feb 2017 21:43:35 +0100 Subject: [PATCH 10/20] Fixed tests --- scripts/__tests__/create-server.spec.js | 4 ++-- scripts/__tests__/index.spec.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/__tests__/create-server.spec.js b/scripts/__tests__/create-server.spec.js index d9d34d3c6..726e07293 100644 --- a/scripts/__tests__/create-server.spec.js +++ b/scripts/__tests__/create-server.spec.js @@ -20,7 +20,7 @@ test('createServer should return an object containing a production Webpack compi const result = createServer(config, 'production'); expect(result).toBeTruthy(); expect(result.compiler).toBeTruthy(); - expect(result.compiler.options.output.filename).toBe('build/bundle.js'); + expect(result.compiler.options.output.filename).toBe('build/[name].js'); expect(result.compiler.options.cache).toBeFalsy(); }); @@ -30,6 +30,6 @@ test('createServer should return an object containing a development Webpack comp const result = createServer(config, 'development'); expect(result).toBeTruthy(); expect(result.compiler).toBeTruthy(); - expect(result.compiler.options.output.filename).toBe('build/bundle.js'); + expect(result.compiler.options.output.filename).toBe('build/[name].js'); expect(result.compiler.options.cache).toBeTruthy(); }); diff --git a/scripts/__tests__/index.spec.js b/scripts/__tests__/index.spec.js index 4a3a56e3e..e83dab3dd 100644 --- a/scripts/__tests__/index.spec.js +++ b/scripts/__tests__/index.spec.js @@ -24,7 +24,7 @@ it('makeWebpackConfig should return development Webpack config', () => { const api = styleguidist(); const result = api.makeWebpackConfig('development'); expect(result).toBeTruthy(); - expect(result.output.filename).toBe('build/bundle.js'); + expect(result.output.filename).toBe('build/[name].js'); expect(result.cache).toBe(true); }); @@ -32,7 +32,7 @@ it('makeWebpackConfig should return production Webpack config', () => { const api = styleguidist(); const result = api.makeWebpackConfig('production'); expect(result).toBeTruthy(); - expect(result.output.filename).toBe('build/bundle.js'); + expect(result.output.filename).toBe('build/[name].js'); expect(result.cache).toBe(false); }); From 48c443df0b568ad39a92946056d9a415c071d900 Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Thu, 23 Feb 2017 11:46:23 +0100 Subject: [PATCH 11/20] Use mutli-compiler mode of webpack for both server and build --- bin/styleguidist.js | 65 ++++++++++++++++------------------ scripts/build.js | 17 ++++----- scripts/create-server.js | 5 ++- scripts/make-webpack-config.js | 22 ++++++------ 4 files changed, 51 insertions(+), 58 deletions(-) diff --git a/bin/styleguidist.js b/bin/styleguidist.js index e3f2ec848..9c8ce3d07 100755 --- a/bin/styleguidist.js +++ b/bin/styleguidist.js @@ -52,6 +52,28 @@ function printStyleguidistError(errors) { process.exit(1); } +function printCompilationDone(stats, isServer) { + isServer = isServer || false; + const messages = formatWebpackMessages(stats.toJson({}, true)); + + if (isServer && !messages.errors.length && !messages.warnings.length) { + console.log(chalk.green('Compiled successfully!')); + console.log(); + } + + // If errors exist, only show errors. + if (messages.errors.length) { + printStyleguidistError(messages.errors); + printErrors('Failed to compile.', messages.errors, stats.compilation.errors, chalk.red); + return; + } + + // Show warnings if no errors were found. + if (messages.warnings.length) { + printErrors('Compiled with warnings.', messages.warnings, stats.compilation.warnings, chalk.yellow); + } +} + function verbose(header, object) { /* istanbul ignore if */ if (argv.verbose) { @@ -113,23 +135,12 @@ function commandBuild() { }); printWebpackConfigFile(config.webpackConfigFile); - verbose('Webpack config:', compiler.options); + verbose('Webpack static config:', compiler.compilers[0].options); + verbose('Webpack client config:', compiler.compilers[1].options); // Custom error reporting - compiler.plugin('done', function(stats) { - const messages = formatWebpackMessages(stats.toJson({}, true)); - - // If errors exist, only show errors. - if (messages.errors.length) { - printStyleguidistError(messages.errors); - printErrors('Failed to compile.', messages.errors, stats.compilation.errors, chalk.red); - process.exit(1); - } - - // Show warnings if no errors were found. - if (messages.warnings.length) { - printErrors('Compiled with warnings.', messages.warnings, stats.compilation.warnings, chalk.yellow); - } + compiler.plugin('done', function(multiStats) { + multiStats.stats.forEach(stats => printCompilationDone(stats, false)); }); } @@ -166,7 +177,8 @@ function commandServer() { }); printWebpackConfigFile(config.webpackConfigFile); - verbose('Webpack config:', compiler.options); + verbose('Webpack static config:', compiler.compilers[0].options); + verbose('Webpack client config:', compiler.compilers[1].options); // Show message when Webpack is recompiling the bundle compiler.plugin('invalid', function() { @@ -174,25 +186,8 @@ function commandServer() { }); // Custom error reporting - compiler.plugin('done', function(stats) { - const messages = formatWebpackMessages(stats.toJson({}, true)); - - if (!messages.errors.length && !messages.warnings.length) { - console.log(chalk.green('Compiled successfully!')); - console.log(); - } - - // If errors exist, only show errors. - if (messages.errors.length) { - printStyleguidistError(messages.errors); - printErrors('Failed to compile.', messages.errors, stats.compilation.errors, chalk.red); - return; - } - - // Show warnings if no errors were found. - if (messages.warnings.length) { - printErrors('Compiled with warnings.', messages.warnings, stats.compilation.warnings, chalk.yellow); - } + compiler.plugin('done', function(multiStats) { + multiStats.stats.forEach(stats => printCompilationDone(stats, true)); }); } diff --git a/scripts/build.js b/scripts/build.js index 2574abf6d..9ba449b6c 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -4,16 +4,11 @@ const webpack = require('webpack'); const makeWebpackConfig = require('./make-webpack-config'); module.exports = function build(config, callback) { - // Firstly, build static "server" bundle - return webpack(makeWebpackConfig(config, 'production', true), (err, stats) => { - if (err) { - callback(err, stats); - } - - // Then build client-side bundle - webpack(makeWebpackConfig(config, 'production'), (err, stats) => { - // require('fs').writeFileSync('stats.json', JSON.stringify(stats.toJson())); - callback(err, stats); - }); + return webpack([ + makeWebpackConfig(config, 'production', true), // build static "server" bundle + makeWebpackConfig(config, 'production'), // and the clint-side bundle + ], (err, stats) => { + // require('fs').writeFileSync('stats.json', JSON.stringify(stats.toJson())); + callback(err, stats); }); }; diff --git a/scripts/create-server.js b/scripts/create-server.js index 74decf39e..8725c9b02 100644 --- a/scripts/create-server.js +++ b/scripts/create-server.js @@ -6,7 +6,10 @@ const makeWebpackConfig = require('./make-webpack-config'); module.exports = function createServer(config, env) { const webpackConfig = makeWebpackConfig(config, env); - const compiler = webpack(webpackConfig); + const compiler = webpack([ + makeWebpackConfig(config, env, true), + webpackConfig, + ]); const devServer = new WebpackDevServer(compiler, { noInfo: true, diff --git a/scripts/make-webpack-config.js b/scripts/make-webpack-config.js index f2cb0f937..5d15f2f03 100644 --- a/scripts/make-webpack-config.js +++ b/scripts/make-webpack-config.js @@ -44,17 +44,6 @@ module.exports = function(config, env, isServer) { NODE_ENV: JSON.stringify(env), }, }), - // Use separate entry point `server` for static HTML - new StaticSiteGeneratorPlugin('server', ['/'], { - config, - }, { - // Mock window global - window: { - navigator: { - userAgent: 'node', - }, - }, - }), ], performance: { hints: false, @@ -150,6 +139,17 @@ module.exports = function(config, env, isServer) { plugins: [ // Do not handle CSS loading when building static HTML new webpack.NormalModuleReplacementPlugin(/\.css$/, 'node-noop'), + // Use separate entry point `server` for static HTML + new StaticSiteGeneratorPlugin('server', ['/'], { + config, + }, { + // Mock window global + window: { + navigator: { + userAgent: 'node', + }, + }, + }), ], }); } From b6f5ac4327bc05174d23c12c67954160feb00354 Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Thu, 23 Feb 2017 11:50:20 +0100 Subject: [PATCH 12/20] Use lodash/noop instead of node-noop --- package.json | 1 - scripts/make-webpack-config.js | 2 +- yarn.lock | 4 ---- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/package.json b/package.json index 456b18bc6..3de60eb8b 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,6 @@ "loader-utils": "^0.2.16", "lodash": "^4.17.4", "minimist": "^1.2.0", - "node-noop": "^1.0.0", "pretty-format": "^18.1.0", "react-codemirror": "^0.3.0", "react-dev-utils": "^0.5.0", diff --git a/scripts/make-webpack-config.js b/scripts/make-webpack-config.js index 5d15f2f03..2c9be00c0 100644 --- a/scripts/make-webpack-config.js +++ b/scripts/make-webpack-config.js @@ -138,7 +138,7 @@ module.exports = function(config, env, isServer) { webpackConfig = merge(webpackConfig, { plugins: [ // Do not handle CSS loading when building static HTML - new webpack.NormalModuleReplacementPlugin(/\.css$/, 'node-noop'), + new webpack.NormalModuleReplacementPlugin(/\.css$/, 'lodash/noop'), // Use separate entry point `server` for static HTML new StaticSiteGeneratorPlugin('server', ['/'], { config, diff --git a/yarn.lock b/yarn.lock index f4ec0e510..5d78e063d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5225,10 +5225,6 @@ node-libs-browser@^2.0.0: util "^0.10.3" vm-browserify "0.0.4" -node-noop@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/node-noop/-/node-noop-1.0.0.tgz#47a3e7d80cffaa6458364bd22ed85cab3307be79" - node-notifier@^4.6.1: version "4.6.1" resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-4.6.1.tgz#056d14244f3dcc1ceadfe68af9cff0c5473a33f3" From e6e9e0032298a5b310f855498cf102208aeba370 Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Thu, 23 Feb 2017 12:04:08 +0100 Subject: [PATCH 13/20] Split HtmlDocument to component and renderer --- .../HtmlDocument/HtmlDocument.js | 34 ++++++++++ .../HtmlDocument/HtmlDocument.spec.js | 63 ++++++++++--------- .../HtmlDocument/HtmlDocumentRenderer.js | 23 ++----- .../__snapshots__/HtmlDocument.spec.js.snap | 5 +- src/rsg-components/HtmlDocument/index.js | 2 +- 5 files changed, 76 insertions(+), 51 deletions(-) create mode 100644 src/rsg-components/HtmlDocument/HtmlDocument.js diff --git a/src/rsg-components/HtmlDocument/HtmlDocument.js b/src/rsg-components/HtmlDocument/HtmlDocument.js new file mode 100644 index 000000000..cd6d012ec --- /dev/null +++ b/src/rsg-components/HtmlDocument/HtmlDocument.js @@ -0,0 +1,34 @@ +import React, { PropTypes } from 'react'; +import HTMLDocument from './HtmlDocumentRenderer'; + +function getScrtips(assets) { + return Object + .keys(assets) + .map(key => { + return assets[key].indexOf('server') === -1 ? assets[key] : null; + }) + .filter(Boolean); +} + +function HtmlDocument({ assets = {}, children, title }) { + // TODO: Handle CSS and JS assets separately + return ( + + { children } + + ); +} + +HtmlDocument.propTypes = { + assets: PropTypes.object, + children: PropTypes.node, + title: PropTypes.string.isRequired, +}; + +export default HtmlDocument; diff --git a/src/rsg-components/HtmlDocument/HtmlDocument.spec.js b/src/rsg-components/HtmlDocument/HtmlDocument.spec.js index 25d78a4c0..854544016 100644 --- a/src/rsg-components/HtmlDocument/HtmlDocument.spec.js +++ b/src/rsg-components/HtmlDocument/HtmlDocument.spec.js @@ -1,38 +1,43 @@ import React from 'react'; -import Document from './HtmlDocumentRenderer'; +import HtmlDocument from './HtmlDocument'; +import Renderer from './HtmlDocumentRenderer'; -it('should render children', () => { - const actual = render( - - Hello - - ); +describe('HtmlDocument', () => { + it('should include assets', () => { + const actual = shallow( + + Hello + + ); - expect(actual).toMatchSnapshot(); -}); + expect(actual.prop('scripts')).toContain('/main.js'); + }); -it('should include assets in head', () => { - const actual = shallow( - - Hello - - ); + it('should not include server assets', () => { + const actual = shallow( + + Hello + + ); - expect(actual.prop('scripts')).toContain('/main.js'); + expect(actual.prop('scripts')).not.toContain('server'); + }); }); -it('should not include server assets', () => { - const actual = shallow( - - Hello - - ); +describe('HtmlDocumentRenderer', () => { + it('should render children', () => { + const actual = render( + + Hello + + ); - expect(actual.prop('scripts')).not.toContain('server'); + expect(actual).toMatchSnapshot(); + }); }); diff --git a/src/rsg-components/HtmlDocument/HtmlDocumentRenderer.js b/src/rsg-components/HtmlDocument/HtmlDocumentRenderer.js index 580bb0332..3f5e76f56 100644 --- a/src/rsg-components/HtmlDocument/HtmlDocumentRenderer.js +++ b/src/rsg-components/HtmlDocument/HtmlDocumentRenderer.js @@ -1,24 +1,12 @@ import React, { PropTypes } from 'react'; import HTMLDocument from 'react-html-document'; -function getScrtips(assets) { - return Object - .keys(assets) - .map(key => { - return assets[key].indexOf('server') === -1 ? assets[key] : null; - }) - .filter(Boolean); -} - -function HtmlDocumentRenderer({ assets = {}, children, title }) { - // TODO: Handle CSS and JS assets separately +function HtmlDocumentRenderer({ children, scripts, stylesheets, ...props }) { return ( { children } @@ -26,7 +14,8 @@ function HtmlDocumentRenderer({ assets = {}, children, title }) { } HtmlDocumentRenderer.propTypes = { - assets: PropTypes.object, + scripts: PropTypes.array, + stylesheets: PropTypes.array, children: PropTypes.node, title: PropTypes.string.isRequired, }; diff --git a/src/rsg-components/HtmlDocument/__snapshots__/HtmlDocument.spec.js.snap b/src/rsg-components/HtmlDocument/__snapshots__/HtmlDocument.spec.js.snap index 974871155..44467bc0c 100644 --- a/src/rsg-components/HtmlDocument/__snapshots__/HtmlDocument.spec.js.snap +++ b/src/rsg-components/HtmlDocument/__snapshots__/HtmlDocument.spec.js.snap @@ -1,12 +1,9 @@ -exports[`test should render children 1`] = ` +exports[`HtmlDocumentRenderer should render children 1`] = ` Test document -
Date: Thu, 23 Feb 2017 12:08:02 +0100 Subject: [PATCH 14/20] Fixed tests for create-server --- scripts/__tests__/create-server.spec.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/__tests__/create-server.spec.js b/scripts/__tests__/create-server.spec.js index 726e07293..e40d057bf 100644 --- a/scripts/__tests__/create-server.spec.js +++ b/scripts/__tests__/create-server.spec.js @@ -14,22 +14,29 @@ test('createServer should return an object containing a server instance', () => expect(result.app).toBeTruthy(); }); -test('createServer should return an object containing a production Webpack compiler', () => { +test('createServer should return an object containing a production Webpack multi-compiler', () => { process.chdir('test/apps/basic'); const config = getConfig(); const result = createServer(config, 'production'); expect(result).toBeTruthy(); + expect(result).toBeTruthy(); expect(result.compiler).toBeTruthy(); - expect(result.compiler.options.output.filename).toBe('build/[name].js'); - expect(result.compiler.options.cache).toBeFalsy(); + expect(result.compiler.compilers).toHaveLength(2); + expect(result.compiler.compilers[0].options.output.filename).toBe('build/[name].js'); + expect(result.compiler.compilers[0].options.cache).toBeFalsy(); + expect(result.compiler.compilers[1].options.output.filename).toBe('build/[name].js'); + expect(result.compiler.compilers[1].options.cache).toBeFalsy(); }); -test('createServer should return an object containing a development Webpack compiler', () => { +test('createServer should return an object containing a development Webpack multi-compiler', () => { process.chdir('test/apps/basic'); const config = getConfig(); const result = createServer(config, 'development'); expect(result).toBeTruthy(); expect(result.compiler).toBeTruthy(); - expect(result.compiler.options.output.filename).toBe('build/[name].js'); - expect(result.compiler.options.cache).toBeTruthy(); + expect(result.compiler.compilers).toHaveLength(2); + expect(result.compiler.compilers[0].options.output.filename).toBe('build/[name].js'); + expect(result.compiler.compilers[0].options.cache).toBeTruthy(); + expect(result.compiler.compilers[1].options.output.filename).toBe('build/[name].js'); + expect(result.compiler.compilers[1].options.cache).toBeTruthy(); }); From e0916d89905ffd8c83801b16297a4b66d29a5aac Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Thu, 23 Feb 2017 12:49:34 +0100 Subject: [PATCH 15/20] Add DOCTYPE --- src/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.js b/src/server.js index b5d7c127a..1cb76d404 100644 --- a/src/server.js +++ b/src/server.js @@ -26,7 +26,7 @@ module.exports = function({ assets, config }) { ); } - return renderToStaticMarkup( + return '\n' + renderToStaticMarkup( Date: Thu, 23 Feb 2017 13:08:52 +0100 Subject: [PATCH 16/20] Fix charset metatag. This should fix phanomtjs tests on CI. - Use proper `charSet` key for the metatag as of https://github.com/venmo/react-html-document/issues/9 - Moved metatags to renderer to allow easy customization without merging --- src/rsg-components/HtmlDocument/HtmlDocument.js | 3 --- src/rsg-components/HtmlDocument/HtmlDocumentRenderer.js | 3 +++ src/server.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rsg-components/HtmlDocument/HtmlDocument.js b/src/rsg-components/HtmlDocument/HtmlDocument.js index cd6d012ec..25fef911a 100644 --- a/src/rsg-components/HtmlDocument/HtmlDocument.js +++ b/src/rsg-components/HtmlDocument/HtmlDocument.js @@ -16,9 +16,6 @@ function HtmlDocument({ assets = {}, children, title }) { { children } diff --git a/src/rsg-components/HtmlDocument/HtmlDocumentRenderer.js b/src/rsg-components/HtmlDocument/HtmlDocumentRenderer.js index 3f5e76f56..fdfc170d6 100644 --- a/src/rsg-components/HtmlDocument/HtmlDocumentRenderer.js +++ b/src/rsg-components/HtmlDocument/HtmlDocumentRenderer.js @@ -7,6 +7,9 @@ function HtmlDocumentRenderer({ children, scripts, stylesheets, ...props }) { {...props} scripts={scripts} stylesheets={stylesheets} + metatags={[ + { charSet: 'utf-8' }, + ]} > { children } diff --git a/src/server.js b/src/server.js index 1cb76d404..d474da4e9 100644 --- a/src/server.js +++ b/src/server.js @@ -26,7 +26,7 @@ module.exports = function({ assets, config }) { ); } - return '\n' + renderToStaticMarkup( + return '' + renderToStaticMarkup( Date: Thu, 23 Feb 2017 23:21:36 +0100 Subject: [PATCH 17/20] introduce sheets registry --- src/server.js | 7 +++++++ src/styles/addStyles.js | 5 ++++- src/styles/sheetsRegistry.js | 3 +++ src/styles/styles.js | 6 ++++-- 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 src/styles/sheetsRegistry.js diff --git a/src/server.js b/src/server.js index d474da4e9..4d7a147f6 100644 --- a/src/server.js +++ b/src/server.js @@ -5,6 +5,7 @@ import { setSlugs, } from './utils/utils'; import HtmlDocument from 'rsg-components/HtmlDocument'; +import sheets from './styles/sheetsRegistry'; module.exports = function({ assets, config }) { let content =

Loading your styleguide in development mode...

; // TODO: Render Welcome screen @@ -26,6 +27,12 @@ module.exports = function({ assets, config }) { ); } + // TODO implement a proper way to pass inline styles. + // This is just pseudo code. + assets.stylesheets = [ + { inline: sheets.toString() }, + ]; + return '' + renderToStaticMarkup( { const mergedTheme = merge(theme, config.theme); @@ -9,5 +10,7 @@ export default memoize((styles, config, componentName) => { styles(mergedTheme), config.styles && config.styles[componentName] ); - return jss.createStyleSheet(mergedStyles, { meta: componentName }).attach().classes; + const sheet = jss.createStyleSheet(mergedStyles, { meta: componentName }).attach(); + sheets.add(sheet); + return sheet.classes; }); diff --git a/src/styles/sheetsRegistry.js b/src/styles/sheetsRegistry.js new file mode 100644 index 000000000..7e7619c1f --- /dev/null +++ b/src/styles/sheetsRegistry.js @@ -0,0 +1,3 @@ +import { SheetsRegistry } from 'jss'; + +export default new SheetsRegistry(); diff --git a/src/styles/styles.js b/src/styles/styles.js index 2b92974c7..9d79a94e9 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -1,4 +1,5 @@ import jss from 'jss'; +import sheets from './sheetsRegistry'; const styles = { // Global styles @@ -28,5 +29,6 @@ const styles = { }; // Attach styles to body -const { body } = jss.createStyleSheet(styles).attach().classes; -document.body.classList.add(body); +const sheet = jss.createStyleSheet(styles).attach(); +sheets.add(sheet); +document.body.classList.add(sheet.classes.body); From 95d42297b4d6b0b984ca363f5d699b62443d7b70 Mon Sep 17 00:00:00 2001 From: Oleg Slobodskoi Date: Thu, 23 Feb 2017 23:23:21 +0100 Subject: [PATCH 18/20] todo to remove server-side css --- src/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.js b/src/index.js index 871118549..268899d84 100644 --- a/src/index.js +++ b/src/index.js @@ -58,6 +58,9 @@ function renderStyleguide() { />, document.getElementById('app') ); + + // TODO Remove server-side CSS here. + // JSS will generate a new one. } window.addEventListener('hashchange', renderStyleguide); From fe5237c0372771d5bc1a292116597af1811a27dd Mon Sep 17 00:00:00 2001 From: Oleg Slobodskoi Date: Fri, 24 Feb 2017 09:48:01 +0100 Subject: [PATCH 19/20] complete jss ssr --- src/index.js | 7 ++++-- .../HtmlDocument/HtmlDocument.js | 1 + src/server.js | 22 ++++++++++--------- src/styles/sheetsRegistry.js | 1 + 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/index.js b/src/index.js index 268899d84..fc2d02d48 100644 --- a/src/index.js +++ b/src/index.js @@ -59,8 +59,11 @@ function renderStyleguide() { document.getElementById('app') ); - // TODO Remove server-side CSS here. - // JSS will generate a new one. + // Currently `react-html-document` doesn't allow specifying any attributes + // for styles, so that we can remove a specific style. + // Currently we know that the first style tag is rendered on the server. + const style = document.getElementsByTagName('style')[0]; + style.parentNode.removeChild(style); } window.addEventListener('hashchange', renderStyleguide); diff --git a/src/rsg-components/HtmlDocument/HtmlDocument.js b/src/rsg-components/HtmlDocument/HtmlDocument.js index 25fef911a..d1dbc6082 100644 --- a/src/rsg-components/HtmlDocument/HtmlDocument.js +++ b/src/rsg-components/HtmlDocument/HtmlDocument.js @@ -16,6 +16,7 @@ function HtmlDocument({ assets = {}, children, title }) { { children } diff --git a/src/server.js b/src/server.js index 4d7a147f6..4ba1aa673 100644 --- a/src/server.js +++ b/src/server.js @@ -5,7 +5,6 @@ import { setSlugs, } from './utils/utils'; import HtmlDocument from 'rsg-components/HtmlDocument'; -import sheets from './styles/sheetsRegistry'; module.exports = function({ assets, config }) { let content =

Loading your styleguide in development mode...

; // TODO: Render Welcome screen @@ -15,7 +14,10 @@ module.exports = function({ assets, config }) { const styleguide = require('!!../loaders/styleguide-loader!./index.js'); const sections = setSlugs(processSections(styleguide.sections), true); const StyleGuide = require('rsg-components/StyleGuide').default; - content = ( + const sheets = require('./styles/sheetsRegistry').default; + + // We need to render sg here in order to get the styles. + content = renderToStaticMarkup( ); - } - // TODO implement a proper way to pass inline styles. - // This is just pseudo code. - assets.stylesheets = [ - { inline: sheets.toString() }, - ]; + assets.stylesheets = [{ + inline: sheets.toString(), + }]; + } - return '' + renderToStaticMarkup( + const document = renderToStaticMarkup( - { content } +
); + + return `${document}`; }; diff --git a/src/styles/sheetsRegistry.js b/src/styles/sheetsRegistry.js index 7e7619c1f..72d02e5ed 100644 --- a/src/styles/sheetsRegistry.js +++ b/src/styles/sheetsRegistry.js @@ -1,3 +1,4 @@ import { SheetsRegistry } from 'jss'; +import './setupjss'; export default new SheetsRegistry(); From c82a1574b2b0af80e3a909b36f08a969e9782710 Mon Sep 17 00:00:00 2001 From: Oleg Slobodskoi Date: Fri, 24 Feb 2017 10:07:30 +0100 Subject: [PATCH 20/20] fix ssr in dev mode --- src/server.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/server.js b/src/server.js index 4ba1aa673..7ad397b4c 100644 --- a/src/server.js +++ b/src/server.js @@ -17,7 +17,7 @@ module.exports = function({ assets, config }) { const sheets = require('./styles/sheetsRegistry').default; // We need to render sg here in order to get the styles. - content = renderToStaticMarkup( + const html = renderToStaticMarkup( ); - assets.stylesheets = [{ inline: sheets.toString(), }]; + + content =
; } const document = renderToStaticMarkup( @@ -38,7 +39,7 @@ module.exports = function({ assets, config }) { title={config.title} assets={assets} > -
+ {content} );