Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-esc-resolver

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-esc-resolver - npm Package Compare versions

Comparing version 4.0.0-beta.29 to 4.0.0-beta.30

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

<a name="4.0.0-beta.30"></a>
# [4.0.0-beta.30](https://github.com/TriPSs/react-esc/compare/v4.0.0-beta.29...v4.0.0-beta.30) (2018-05-19)
### Bug Fixes
* **resolver:** Check in the render client witch method to use ([b2c6114](https://github.com/TriPSs/react-esc/commit/b2c6114))
* **resolver:** Revert last change ([9bb14e2](https://github.com/TriPSs/react-esc/commit/9bb14e2))
<a name="4.0.0-beta.29"></a>

@@ -8,0 +20,0 @@ # [4.0.0-beta.29](https://github.com/TriPSs/react-esc/compare/v4.0.0-beta.28...v4.0.0-beta.29) (2018-05-19)

4

cjs/react-esc-resolver.development.js

@@ -287,5 +287,3 @@ 'use strict';

Resolver.renderClient = function (render, node) {
var renderMethod = !!module.hot ? ReactDOM.render : ReactDOM.hydrate;
renderMethod(React.createElement(
ReactDOM.hydrate(React.createElement(
Resolver,

@@ -292,0 +290,0 @@ null,

@@ -1,2 +0,2 @@

"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var _Promise=_interopDefault(require("babel-runtime/core-js/promise")),_extends=_interopDefault(require("babel-runtime/helpers/extends")),_typeof=_interopDefault(require("babel-runtime/helpers/typeof")),_Object$keys=_interopDefault(require("babel-runtime/core-js/object/keys")),_Object$getPrototypeOf=_interopDefault(require("babel-runtime/core-js/object/get-prototype-of")),_classCallCheck=_interopDefault(require("babel-runtime/helpers/classCallCheck")),_createClass=_interopDefault(require("babel-runtime/helpers/createClass")),_possibleConstructorReturn=_interopDefault(require("babel-runtime/helpers/possibleConstructorReturn")),_inherits=_interopDefault(require("babel-runtime/helpers/inherits")),React=_interopDefault(require("react")),PropTypes=_interopDefault(require("prop-types")),ReactDOM=_interopDefault(require("react-dom")),server=require("react-dom/server"),_defineProperty=_interopDefault(require("babel-runtime/helpers/defineProperty")),canUseDom=function(){return"undefined"!=typeof window},capitalize=function(e){return e.replace(/^./,function(e){return e.toUpperCase()})},hasOwnProperty=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},HAS_RESOLVED="ReactResolver.HAS_RESOLVED",IS_CLIENT="ReactResolver.IS_CLIENT",Resolver=function(e){function t(e,r){_classCallCheck(this,t);var n=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,e,r));return n.unMounted=!0,n[HAS_RESOLVED]=!1,n[IS_CLIENT]=!1,n.state=n.computeState(n.props,{pending:{},resolved:{}}),n.isPending(n.state)?(n.resolve(n.state),n[HAS_RESOLVED]=!1):n[HAS_RESOLVED]=!0,n}return _inherits(t,e),_createClass(t,[{key:"cached",value:function(e){var t=this.props,r=t.props;if(t.cache||!canUseDom()){if(hasOwnProperty(r,e))return r[e];if(this.context.resolver)return this.context.resolver.cached(e)}return null}},{key:"componentWillMount",value:function(){this.unMounted=!1}},{key:"componentDidMount",value:function(){this[IS_CLIENT]=!0}},{key:"componentWillUnmount",value:function(){this.unMounted=!0}},{key:"componentWillReceiveProps",value:function(e){var t=this.computeState(e,this.state),r={pending:t.pending,resolved:t.resolved};this.setAtomicState(r)}},{key:"computeState",value:function(e,t){var r=this,n=e.resolve,o=t;return _Object$keys(n).forEach(function(e){var s=r.cached(e);hasOwnProperty(t.resolved,e)||hasOwnProperty(t.pending,e)||r.isValidCache(s)?s&&(o.resolved[e]=!0):o.pending[e]=n[e]}),o}},{key:"getChildContext",value:function(){return{resolver:this}}},{key:"isValidCache",value:function(e){return null!==e&&void 0!==e&&("object"!==(void 0===e?"undefined":_typeof(e))||_Object$keys(e).length>0)&&(!Array.isArray(e)||e.length>0)}},{key:"isPending",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state;return _Object$keys(e.pending).length>0}},{key:"isParentPending",value:function(){var e=this.context.resolver;return!!e&&(e.isPending()||e.isParentPending())}},{key:"onResolve",value:function(e){return this.props.onResolve?this.props.onResolve(e):this.context.resolver?this.context.resolver.onResolve(e):e}},{key:"render",value:function(){return!!this[HAS_RESOLVED]&&(this.isPending(this.state)&&this.resolve(this.state),this.props.children(_extends({},this.props.props)))}},{key:"resolve",value:function(e){var t=this,r=this.props.props,n=_Object$keys(e.pending).map(function(t){return{name:t,func:e.pending[t]}}),o=n.map(function(e){return(0,e.func)(r)}),s=_Promise.all(o).then(function(e){return e.reduce(function(e,t,r){return e[n[r].name]=!0,e},{})});(s=this.onResolve(s)).then(function(r){if(t[HAS_RESOLVED]=!0,!t[IS_CLIENT])return!1;var n={pending:{},resolved:_extends({},e.resolved,r)};t.setAtomicState(n)})}},{key:"shouldComponentUpdate",value:function(e,t){return!this.isParentPending()&&(!this.isPending(t)&&this[HAS_RESOLVED])}},{key:"setAtomicState",value:function(e){this.unMounted||this.setState(e)}}]),t}(React.Component);Resolver.childContextTypes={resolver:PropTypes.object},Resolver.contextTypes={resolver:PropTypes.object},Resolver.defaultProps={props:{},resolve:{}},Resolver.displayName="Resolver",Resolver.propTypes={children:PropTypes.func.isRequired,props:PropTypes.object,resolve:PropTypes.object},Resolver.renderClient=function(e,t){(module.hot?ReactDOM.render:ReactDOM.hydrate)(React.createElement(Resolver,null,e),t)},Resolver.renderServer=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[];return server.renderToStaticMarkup(React.createElement(Resolver,{onResolve:function(e){return r.push(e),_Promise.resolve(!0)}},e)),_Promise.all(r).then(function(r){var n={};r.forEach(function(e){return _Object$keys(e).forEach(function(t){n[t]=e[t]})});var o=_extends({},t,n);if(_Object$keys(t).length<_Object$keys(o).length)return Resolver.renderServer(e,o);var s=function(t){function r(){return _classCallCheck(this,r),_possibleConstructorReturn(this,(r.__proto__||_Object$getPrototypeOf(r)).apply(this,arguments))}return _inherits(r,t),_createClass(r,[{key:"render",value:function(){return React.createElement(Resolver,null,e)}}]),r}(React.Component);return s.displayName="Resolved",s})};var resolve=function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n="object"===(void 0===e?"undefined":_typeof(e))?e:_defineProperty({},e,t),o=_Object$keys(n).map(capitalize).join(""),s="object"===(void 0===e?"undefined":_typeof(e))&&"boolean"==typeof t?t:r;return function(e){var t,r;return r=t=function(t){function r(){return _classCallCheck(this,r),_possibleConstructorReturn(this,(r.__proto__||_Object$getPrototypeOf(r)).apply(this,arguments))}return _inherits(r,t),_createClass(r,[{key:"render",value:function(){return React.createElement(Resolver,{props:this.props,resolve:n,cache:s},function(t){return React.createElement(e,t)})}}]),r}(React.Component),t.displayName=o+"Resolver",r}},client=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n="string"==typeof e?[e]:e,o=n.map(capitalize).join("");return function(e){var s,i;return i=s=function(o){function s(e,t){_classCallCheck(this,s);var o=_possibleConstructorReturn(this,(s.__proto__||_Object$getPrototypeOf(s)).call(this,e,t));return o.enqueue=function(e){return o.queue.push(e),e},o.isLoaded=function(){var e=!0;return n.forEach(function(t){hasOwnProperty(o.props,t)&&o.props[t]||(e=!1)}),e},o.queue=[],o.state={bypass:!canUseDom()&&!r||"test"===process.env.NODE_ENV,loaded:o.isLoaded(e)},o}return _inherits(s,o),_createClass(s,[{key:"componentDidMount",value:function(){r&&r(this.props)}},{key:"render",value:function(){var n=this;return this.state.bypass||this.isLoaded()?React.createElement(e,this.props):React.createElement(React.Fragment,null,React.createElement(t,null),!r&&React.createElement("div",{style:{display:"none"}},React.createElement(Resolver,{onResolve:this.enqueue},function(t){return React.createElement(e,_extends({},n.props,t))})))}}]),s}(React.Component),s.displayName=o+"ClientResolver",s.contextTypes={resolver:PropTypes.instanceOf(Resolver)},i}};exports.resolve=resolve,exports.client=client,exports.Resolver=Resolver;
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var _Promise=_interopDefault(require("babel-runtime/core-js/promise")),_extends=_interopDefault(require("babel-runtime/helpers/extends")),_typeof=_interopDefault(require("babel-runtime/helpers/typeof")),_Object$keys=_interopDefault(require("babel-runtime/core-js/object/keys")),_Object$getPrototypeOf=_interopDefault(require("babel-runtime/core-js/object/get-prototype-of")),_classCallCheck=_interopDefault(require("babel-runtime/helpers/classCallCheck")),_createClass=_interopDefault(require("babel-runtime/helpers/createClass")),_possibleConstructorReturn=_interopDefault(require("babel-runtime/helpers/possibleConstructorReturn")),_inherits=_interopDefault(require("babel-runtime/helpers/inherits")),React=_interopDefault(require("react")),PropTypes=_interopDefault(require("prop-types")),ReactDOM=_interopDefault(require("react-dom")),server=require("react-dom/server"),_defineProperty=_interopDefault(require("babel-runtime/helpers/defineProperty")),canUseDom=function(){return"undefined"!=typeof window},capitalize=function(e){return e.replace(/^./,function(e){return e.toUpperCase()})},hasOwnProperty=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},HAS_RESOLVED="ReactResolver.HAS_RESOLVED",IS_CLIENT="ReactResolver.IS_CLIENT",Resolver=function(e){function t(e,r){_classCallCheck(this,t);var n=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,e,r));return n.unMounted=!0,n[HAS_RESOLVED]=!1,n[IS_CLIENT]=!1,n.state=n.computeState(n.props,{pending:{},resolved:{}}),n.isPending(n.state)?(n.resolve(n.state),n[HAS_RESOLVED]=!1):n[HAS_RESOLVED]=!0,n}return _inherits(t,e),_createClass(t,[{key:"cached",value:function(e){var t=this.props,r=t.props;if(t.cache||!canUseDom()){if(hasOwnProperty(r,e))return r[e];if(this.context.resolver)return this.context.resolver.cached(e)}return null}},{key:"componentWillMount",value:function(){this.unMounted=!1}},{key:"componentDidMount",value:function(){this[IS_CLIENT]=!0}},{key:"componentWillUnmount",value:function(){this.unMounted=!0}},{key:"componentWillReceiveProps",value:function(e){var t=this.computeState(e,this.state),r={pending:t.pending,resolved:t.resolved};this.setAtomicState(r)}},{key:"computeState",value:function(e,t){var r=this,n=e.resolve,o=t;return _Object$keys(n).forEach(function(e){var s=r.cached(e);hasOwnProperty(t.resolved,e)||hasOwnProperty(t.pending,e)||r.isValidCache(s)?s&&(o.resolved[e]=!0):o.pending[e]=n[e]}),o}},{key:"getChildContext",value:function(){return{resolver:this}}},{key:"isValidCache",value:function(e){return null!==e&&void 0!==e&&("object"!==(void 0===e?"undefined":_typeof(e))||_Object$keys(e).length>0)&&(!Array.isArray(e)||e.length>0)}},{key:"isPending",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state;return _Object$keys(e.pending).length>0}},{key:"isParentPending",value:function(){var e=this.context.resolver;return!!e&&(e.isPending()||e.isParentPending())}},{key:"onResolve",value:function(e){return this.props.onResolve?this.props.onResolve(e):this.context.resolver?this.context.resolver.onResolve(e):e}},{key:"render",value:function(){return!!this[HAS_RESOLVED]&&(this.isPending(this.state)&&this.resolve(this.state),this.props.children(_extends({},this.props.props)))}},{key:"resolve",value:function(e){var t=this,r=this.props.props,n=_Object$keys(e.pending).map(function(t){return{name:t,func:e.pending[t]}}),o=n.map(function(e){return(0,e.func)(r)}),s=_Promise.all(o).then(function(e){return e.reduce(function(e,t,r){return e[n[r].name]=!0,e},{})});(s=this.onResolve(s)).then(function(r){if(t[HAS_RESOLVED]=!0,!t[IS_CLIENT])return!1;var n={pending:{},resolved:_extends({},e.resolved,r)};t.setAtomicState(n)})}},{key:"shouldComponentUpdate",value:function(e,t){return!this.isParentPending()&&(!this.isPending(t)&&this[HAS_RESOLVED])}},{key:"setAtomicState",value:function(e){this.unMounted||this.setState(e)}}]),t}(React.Component);Resolver.childContextTypes={resolver:PropTypes.object},Resolver.contextTypes={resolver:PropTypes.object},Resolver.defaultProps={props:{},resolve:{}},Resolver.displayName="Resolver",Resolver.propTypes={children:PropTypes.func.isRequired,props:PropTypes.object,resolve:PropTypes.object},Resolver.renderClient=function(e,t){ReactDOM.hydrate(React.createElement(Resolver,null,e),t)},Resolver.renderServer=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[];return server.renderToStaticMarkup(React.createElement(Resolver,{onResolve:function(e){return r.push(e),_Promise.resolve(!0)}},e)),_Promise.all(r).then(function(r){var n={};r.forEach(function(e){return _Object$keys(e).forEach(function(t){n[t]=e[t]})});var o=_extends({},t,n);if(_Object$keys(t).length<_Object$keys(o).length)return Resolver.renderServer(e,o);var s=function(t){function r(){return _classCallCheck(this,r),_possibleConstructorReturn(this,(r.__proto__||_Object$getPrototypeOf(r)).apply(this,arguments))}return _inherits(r,t),_createClass(r,[{key:"render",value:function(){return React.createElement(Resolver,null,e)}}]),r}(React.Component);return s.displayName="Resolved",s})};var resolve=function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n="object"===(void 0===e?"undefined":_typeof(e))?e:_defineProperty({},e,t),o=_Object$keys(n).map(capitalize).join(""),s="object"===(void 0===e?"undefined":_typeof(e))&&"boolean"==typeof t?t:r;return function(e){var t,r;return r=t=function(t){function r(){return _classCallCheck(this,r),_possibleConstructorReturn(this,(r.__proto__||_Object$getPrototypeOf(r)).apply(this,arguments))}return _inherits(r,t),_createClass(r,[{key:"render",value:function(){return React.createElement(Resolver,{props:this.props,resolve:n,cache:s},function(t){return React.createElement(e,t)})}}]),r}(React.Component),t.displayName=o+"Resolver",r}},client=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n="string"==typeof e?[e]:e,o=n.map(capitalize).join("");return function(e){var s,i;return i=s=function(o){function s(e,t){_classCallCheck(this,s);var o=_possibleConstructorReturn(this,(s.__proto__||_Object$getPrototypeOf(s)).call(this,e,t));return o.enqueue=function(e){return o.queue.push(e),e},o.isLoaded=function(){var e=!0;return n.forEach(function(t){hasOwnProperty(o.props,t)&&o.props[t]||(e=!1)}),e},o.queue=[],o.state={bypass:!canUseDom()&&!r||"test"===process.env.NODE_ENV,loaded:o.isLoaded(e)},o}return _inherits(s,o),_createClass(s,[{key:"componentDidMount",value:function(){r&&r(this.props)}},{key:"render",value:function(){var n=this;return this.state.bypass||this.isLoaded()?React.createElement(e,this.props):React.createElement(React.Fragment,null,React.createElement(t,null),!r&&React.createElement("div",{style:{display:"none"}},React.createElement(Resolver,{onResolve:this.enqueue},function(t){return React.createElement(e,_extends({},n.props,t))})))}}]),s}(React.Component),s.displayName=o+"ClientResolver",s.contextTypes={resolver:PropTypes.instanceOf(Resolver)},i}};exports.resolve=resolve,exports.client=client,exports.Resolver=Resolver;
//# sourceMappingURL=react-esc-resolver.production.js.map
{
"name": "react-esc-resolver",
"version": "4.0.0-beta.29",
"version": "4.0.0-beta.30",
"description": "Easy to use Client and Server Resolver",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc