@untool/react
Advanced tools
Comparing version 2.0.0-alpha.3 to 2.0.0-alpha.4
@@ -6,2 +6,28 @@ # Change Log | ||
# [2.0.0-alpha.4](https://github.com/untool/untool/compare/v1.10.1...v2.0.0-alpha.4) (2019-10-24) | ||
### Bug Fixes | ||
* **react:** add deprecation notice for users of `react-helmet` ([5b404e7](https://github.com/untool/untool/commit/5b404e7a3789176a7c2e5bce385673edf28c3051)) | ||
* **react:** deprecate string arguments for importComponent ([53ae307](https://github.com/untool/untool/commit/53ae307ffc6f0e46dc9a76f7d55999c6e3c4fac8)) | ||
### Features | ||
* bump all packages to their latest available versions ([884ec8e](https://github.com/untool/untool/commit/884ec8e4b918dfc7f259998d05239bf5458147c3)) | ||
* **react:** replace react-helmet with react-helmet-async ([8f6bc21](https://github.com/untool/untool/commit/8f6bc21c72c9b8301237e8ecfa5850ed99f9517c)), closes [/github.com/gaearon/react-side-effect/issues/54#issuecomment-520056590](https://github.com//github.com/gaearon/react-side-effect/issues/54/issues/issuecomment-520056590) | ||
### BREAKING CHANGES | ||
* **react:** Replace `react-helmet` with `react-helmet-async` | ||
* The following peer dependencies have increased versions | ||
- `react` & `react-dom`: 16.8.0 | ||
- `react-router-dom`: 5.0.0 | ||
# [2.0.0-alpha.3](https://github.com/untool/untool/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2019-10-02) | ||
@@ -8,0 +34,0 @@ |
const { renderToString } = require('react-dom/server'); | ||
const { | ||
Helmet: { renderStatic }, | ||
} = require('react-helmet'); | ||
module.exports = (element) => { | ||
const reactMarkup = renderToString(element); | ||
const fragments = Object.entries(renderStatic()).reduce( | ||
(result, [key, value]) => ({ ...result, [key]: value.toString() }), | ||
{ reactMarkup, headPrefix: '', headSuffix: '' } | ||
); | ||
return fragments; | ||
return { reactMarkup }; | ||
}; |
@@ -8,2 +8,3 @@ 'use strict'; | ||
const { BrowserRouter } = require('react-router-dom'); | ||
const { HelmetProvider } = require('react-helmet-async'); | ||
@@ -33,3 +34,7 @@ const isPlainObject = require('is-plain-obj'); | ||
}; | ||
return createElement(BrowserRouter, props, element); | ||
return createElement( | ||
BrowserRouter, | ||
props, | ||
createElement(HelmetProvider, {}, element) | ||
); | ||
} | ||
@@ -36,0 +41,0 @@ render() { |
@@ -11,2 +11,7 @@ 'use strict'; | ||
// TODO: remove with next major version | ||
webpackConfig.resolve.alias['react-helmet'] = require.resolve( | ||
'../lib/react-helmet-shim' | ||
); | ||
jsLoaderConfig.options.presets.push(require.resolve('@babel/preset-react')); | ||
@@ -13,0 +18,0 @@ |
@@ -7,2 +7,3 @@ 'use strict'; | ||
const { StaticRouter } = require('react-router-dom'); | ||
const { HelmetProvider } = require('react-helmet-async'); | ||
@@ -44,3 +45,7 @@ const isPlainObject = require('is-plain-obj'); | ||
}; | ||
return createElement(StaticRouter, props, element); | ||
return createElement( | ||
StaticRouter, | ||
props, | ||
createElement(HelmetProvider, { context: this.context }, element) | ||
); | ||
} | ||
@@ -65,2 +70,9 @@ renderToFragments(element) { | ||
.then((fragments) => { | ||
Object.assign( | ||
fragments, | ||
Object.entries(this.context.helmet).reduce( | ||
(result, [key, value]) => ({ ...result, [key]: value.toString() }), | ||
{ headPrefix: '', headSuffix: '' } | ||
) | ||
); | ||
if (this.context.miss) { | ||
@@ -67,0 +79,0 @@ next(); |
{ | ||
"name": "@untool/react", | ||
"version": "2.0.0-alpha.3", | ||
"version": "2.0.0-alpha.4", | ||
"description": "untool react mixin", | ||
@@ -21,6 +21,6 @@ "browser": "lib/runtime.js", | ||
"dependencies": { | ||
"@babel/core": "^7.4.0", | ||
"@babel/preset-react": "^7.0.0", | ||
"@untool/core": "^2.0.0-alpha.3", | ||
"babel-plugin-transform-react-remove-prop-types": "^0.4.19", | ||
"@babel/core": "^7.6.3", | ||
"@babel/preset-react": "^7.6.3", | ||
"@untool/core": "^2.0.0-alpha.4", | ||
"babel-plugin-transform-react-remove-prop-types": "^0.4.24", | ||
"clone": "^2.1.2", | ||
@@ -33,13 +33,14 @@ "depd": "^2.0.0", | ||
"prop-types": "^15.7.2", | ||
"serialize-javascript": "^2.0.0" | ||
"serialize-javascript": "^2.1.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.4.0", | ||
"react-dom": "^16.4.0", | ||
"react-helmet": "^5.2.0", | ||
"react-router-dom": "^4.2.2 || ^5.0.0" | ||
"react": "^16.8.0", | ||
"react-dom": "^16.8.0", | ||
"react-helmet-async": "^1.0.4", | ||
"react-router-dom": "^5.0.0" | ||
}, | ||
"engines": { | ||
"node": ">8.6.0" | ||
} | ||
}, | ||
"gitHead": "eebc0b13d754a45aee7344a8f08936c839851b30" | ||
} |
48938
15
577
+ Addedinvariant@2.2.4(transitive)
+ Addedreact-fast-compare@3.2.2(transitive)
+ Addedreact-helmet-async@1.3.0(transitive)
- Removedreact-fast-compare@2.0.4(transitive)
- Removedreact-helmet@5.2.1(transitive)
- Removedreact-side-effect@1.2.0(transitive)
Updated@babel/core@^7.6.3
Updated@babel/preset-react@^7.6.3
Updated@untool/core@^2.0.0-alpha.4
Updatedbabel-plugin-transform-react-remove-prop-types@^0.4.24
Updatedserialize-javascript@^2.1.0