Socket
Socket
Sign inDemoInstall

react-redux

Package Overview
Dependencies
6
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.4.2 to 4.4.3

lib/utils/warning.js

150

dist/react-redux.js

@@ -10,3 +10,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

root["ReactRedux"] = factory(root["React"], root["Redux"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_12__) {
})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_13__) {
return /******/ (function(modules) { // webpackBootstrap

@@ -63,7 +63,7 @@ /******/ // The module cache

var _Provider = __webpack_require__(3);
var _Provider = __webpack_require__(4);
var _Provider2 = _interopRequireDefault(_Provider);
var _connect = __webpack_require__(4);
var _connect = __webpack_require__(5);

@@ -101,2 +101,31 @@ var _connect2 = _interopRequireDefault(_connect);

/* 3 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports["default"] = warning;
/**
* Prints a warning in the console if it exists.
*
* @param {String} message The warning message.
* @returns {void}
*/
function warning(message) {
/* eslint-disable no-console */
if (typeof console !== 'undefined' && typeof console.error === 'function') {
console.error(message);
}
/* eslint-enable no-console */
try {
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
/* eslint-disable no-empty */
} catch (e) {}
/* eslint-enable no-empty */
}
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {

@@ -115,2 +144,6 @@

var _warning = __webpack_require__(3);
var _warning2 = _interopRequireDefault(_warning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -133,3 +166,3 @@

if (typeof console !== 'undefined' && typeof console.error === 'function') {
console.error('<Provider> does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reactjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
(0, _warning2["default"])('<Provider> does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reactjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
}

@@ -186,3 +219,3 @@ /* eslint-disable no-console */

/***/ },
/* 4 */
/* 5 */
/***/ function(module, exports, __webpack_require__) {

@@ -203,19 +236,23 @@

var _shallowEqual = __webpack_require__(5);
var _shallowEqual = __webpack_require__(6);
var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
var _wrapActionCreators = __webpack_require__(6);
var _wrapActionCreators = __webpack_require__(7);
var _wrapActionCreators2 = _interopRequireDefault(_wrapActionCreators);
var _isPlainObject = __webpack_require__(11);
var _warning = __webpack_require__(3);
var _warning2 = _interopRequireDefault(_warning);
var _isPlainObject = __webpack_require__(12);
var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
var _hoistNonReactStatics = __webpack_require__(7);
var _hoistNonReactStatics = __webpack_require__(8);
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
var _invariant = __webpack_require__(8);
var _invariant = __webpack_require__(9);

@@ -246,7 +283,2 @@ var _invariant2 = _interopRequireDefault(_invariant);

function checkStateShape(stateProps, dispatch) {
(0, _invariant2["default"])((0, _isPlainObject2["default"])(stateProps), '`%sToProps` must return an object. Instead received %s.', dispatch ? 'mapDispatch' : 'mapState', stateProps);
return stateProps;
}
// Helps track hot reloading.

@@ -260,4 +292,12 @@ var nextVersion = 0;

var mapState = mapStateToProps || defaultMapStateToProps;
var mapDispatch = (0, _isPlainObject2["default"])(mapDispatchToProps) ? (0, _wrapActionCreators2["default"])(mapDispatchToProps) : mapDispatchToProps || defaultMapDispatchToProps;
var mapDispatch = undefined;
if (typeof mapDispatchToProps === 'function') {
mapDispatch = mapDispatchToProps;
} else if (!mapDispatchToProps) {
mapDispatch = defaultMapDispatchToProps;
} else {
mapDispatch = (0, _wrapActionCreators2["default"])(mapDispatchToProps);
}
var finalMergeProps = mergeProps || defaultMergeProps;

@@ -274,9 +314,19 @@ var _options$pure = options.pure;

function computeMergedProps(stateProps, dispatchProps, parentProps) {
var mergedProps = finalMergeProps(stateProps, dispatchProps, parentProps);
(0, _invariant2["default"])((0, _isPlainObject2["default"])(mergedProps), '`mergeProps` must return an object. Instead received %s.', mergedProps);
return mergedProps;
}
return function wrapWithConnect(WrappedComponent) {
var connectDisplayName = 'Connect(' + getDisplayName(WrappedComponent) + ')';
return function wrapWithConnect(WrappedComponent) {
function checkStateShape(props, methodName) {
if (!(0, _isPlainObject2["default"])(props)) {
(0, _warning2["default"])(methodName + '() in ' + connectDisplayName + ' must return a plain object. ' + ('Instead received ' + props + '.'));
}
}
function computeMergedProps(stateProps, dispatchProps, parentProps) {
var mergedProps = finalMergeProps(stateProps, dispatchProps, parentProps);
if (true) {
checkStateShape(mergedProps, 'mergeProps');
}
return mergedProps;
}
var Connect = function (_Component) {

@@ -297,3 +347,3 @@ _inherits(Connect, _Component);

(0, _invariant2["default"])(_this.store, 'Could not find "store" in either the context or ' + ('props of "' + _this.constructor.displayName + '". ') + 'Either wrap the root component in a <Provider>, ' + ('or explicitly pass "store" as a prop to "' + _this.constructor.displayName + '".'));
(0, _invariant2["default"])(_this.store, 'Could not find "store" in either the context or ' + ('props of "' + connectDisplayName + '". ') + 'Either wrap the root component in a <Provider>, ' + ('or explicitly pass "store" as a prop to "' + connectDisplayName + '".'));

@@ -314,3 +364,6 @@ var storeState = _this.store.getState();

return checkStateShape(stateProps);
if (true) {
checkStateShape(stateProps, 'mapStateToProps');
}
return stateProps;
};

@@ -325,3 +378,10 @@

return isFactory ? this.computeStateProps(store, props) : checkStateShape(mappedState);
if (isFactory) {
return this.computeStateProps(store, props);
}
if (true) {
checkStateShape(mappedState, 'mapStateToProps');
}
return mappedState;
};

@@ -338,3 +398,6 @@

return checkStateShape(dispatchProps, true);
if (true) {
checkStateShape(dispatchProps, 'mapDispatchToProps');
}
return dispatchProps;
};

@@ -349,3 +412,10 @@

return isFactory ? this.computeDispatchProps(store, props) : checkStateShape(mappedDispatch, true);
if (isFactory) {
return this.computeDispatchProps(store, props);
}
if (true) {
checkStateShape(mappedDispatch, 'mapDispatchToProps');
}
return mappedDispatch;
};

@@ -496,3 +566,3 @@

Connect.displayName = 'Connect(' + getDisplayName(WrappedComponent) + ')';
Connect.displayName = connectDisplayName;
Connect.WrappedComponent = WrappedComponent;

@@ -524,3 +594,3 @@ Connect.contextTypes = {

/***/ },
/* 5 */
/* 6 */
/***/ function(module, exports) {

@@ -556,3 +626,3 @@

/***/ },
/* 6 */
/* 7 */
/***/ function(module, exports, __webpack_require__) {

@@ -565,3 +635,3 @@

var _redux = __webpack_require__(12);
var _redux = __webpack_require__(13);

@@ -575,3 +645,3 @@ function wrapActionCreators(actionCreators) {

/***/ },
/* 7 */
/* 8 */
/***/ function(module, exports) {

@@ -618,3 +688,3 @@

/***/ },
/* 8 */
/* 9 */
/***/ function(module, exports, __webpack_require__) {

@@ -676,3 +746,3 @@

/***/ },
/* 9 */
/* 10 */
/***/ function(module, exports) {

@@ -703,3 +773,3 @@

/***/ },
/* 10 */
/* 11 */
/***/ function(module, exports) {

@@ -738,7 +808,7 @@

/***/ },
/* 11 */
/* 12 */
/***/ function(module, exports, __webpack_require__) {
var isHostObject = __webpack_require__(9),
isObjectLike = __webpack_require__(10);
var isHostObject = __webpack_require__(10),
isObjectLike = __webpack_require__(11);

@@ -813,6 +883,6 @@ /** `Object#toString` result references. */

/***/ },
/* 12 */
/* 13 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_12__;
module.exports = __WEBPACK_EXTERNAL_MODULE_13__;

@@ -819,0 +889,0 @@ /***/ }

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("redux")):"function"==typeof define&&define.amd?define(["react","redux"],e):"object"==typeof exports?exports.ReactRedux=e(require("react"),require("redux")):t.ReactRedux=e(t.React,t.Redux)}(this,function(t,e){return function(t){function e(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return t[o].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0,e.connect=e.Provider=void 0;var n=r(3),s=o(n),i=r(4),a=o(i);e.Provider=s["default"],e.connect=a["default"]},function(e,r){e.exports=t},function(t,e,r){"use strict";e.__esModule=!0;var o=r(1);e["default"]=o.PropTypes.shape({subscribe:o.PropTypes.func.isRequired,dispatch:o.PropTypes.func.isRequired,getState:o.PropTypes.func.isRequired})},function(t,e,r){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0,e["default"]=void 0;var a=r(1),p=r(2),u=o(p),c=function(t){function e(r,o){n(this,e);var i=s(this,t.call(this,r,o));return i.store=r.store,i}return i(e,t),e.prototype.getChildContext=function(){return{store:this.store}},e.prototype.render=function(){var t=this.props.children;return a.Children.only(t)},e}(a.Component);e["default"]=c,c.propTypes={store:u["default"].isRequired,children:a.PropTypes.element.isRequired},c.childContextTypes={store:u["default"].isRequired}},function(t,e,r){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){return t.displayName||t.name||"Component"}function p(t,e){return(0,w["default"])((0,m["default"])(t),"`%sToProps` must return an object. Instead received %s.",e?"mapDispatch":"mapState",t),t}function u(t,e,r){function o(t,e,r){var o=v(t,e,r);return(0,w["default"])((0,m["default"])(o),"`mergeProps` must return an object. Instead received %s.",o),o}var u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},h=!!t,l=t||x,P=(0,m["default"])(e)?(0,b["default"])(e):e||C,v=r||T,g=u.pure,O=void 0===g?!0:g,_=u.withRef,j=void 0===_?!1:_,D=O&&v!==T,R=M++;return function(t){var e=function(e){function r(t,o){n(this,r);var i=s(this,e.call(this,t,o));i.version=R,i.store=t.store||o.store,(0,w["default"])(i.store,'Could not find "store" in either the context or '+('props of "'+i.constructor.displayName+'". ')+"Either wrap the root component in a <Provider>, "+('or explicitly pass "store" as a prop to "'+i.constructor.displayName+'".'));var a=i.store.getState();return i.state={storeState:a},i.clearCache(),i}return i(r,e),r.prototype.shouldComponentUpdate=function(){return!O||this.haveOwnPropsChanged||this.hasStoreStateChanged},r.prototype.computeStateProps=function(t,e){if(!this.finalMapStateToProps)return this.configureFinalMapState(t,e);var r=t.getState(),o=this.doStatePropsDependOnOwnProps?this.finalMapStateToProps(r,e):this.finalMapStateToProps(r);return p(o)},r.prototype.configureFinalMapState=function(t,e){var r=l(t.getState(),e),o="function"==typeof r;return this.finalMapStateToProps=o?r:l,this.doStatePropsDependOnOwnProps=1!==this.finalMapStateToProps.length,o?this.computeStateProps(t,e):p(r)},r.prototype.computeDispatchProps=function(t,e){if(!this.finalMapDispatchToProps)return this.configureFinalMapDispatch(t,e);var r=t.dispatch,o=this.doDispatchPropsDependOnOwnProps?this.finalMapDispatchToProps(r,e):this.finalMapDispatchToProps(r);return p(o,!0)},r.prototype.configureFinalMapDispatch=function(t,e){var r=P(t.dispatch,e),o="function"==typeof r;return this.finalMapDispatchToProps=o?r:P,this.doDispatchPropsDependOnOwnProps=1!==this.finalMapDispatchToProps.length,o?this.computeDispatchProps(t,e):p(r,!0)},r.prototype.updateStatePropsIfNeeded=function(){var t=this.computeStateProps(this.store,this.props);return this.stateProps&&(0,y["default"])(t,this.stateProps)?!1:(this.stateProps=t,!0)},r.prototype.updateDispatchPropsIfNeeded=function(){var t=this.computeDispatchProps(this.store,this.props);return this.dispatchProps&&(0,y["default"])(t,this.dispatchProps)?!1:(this.dispatchProps=t,!0)},r.prototype.updateMergedPropsIfNeeded=function(){var t=o(this.stateProps,this.dispatchProps,this.props);return this.mergedProps&&D&&(0,y["default"])(t,this.mergedProps)?!1:(this.mergedProps=t,!0)},r.prototype.isSubscribed=function(){return"function"==typeof this.unsubscribe},r.prototype.trySubscribe=function(){h&&!this.unsubscribe&&(this.unsubscribe=this.store.subscribe(this.handleChange.bind(this)),this.handleChange())},r.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},r.prototype.componentDidMount=function(){this.trySubscribe()},r.prototype.componentWillReceiveProps=function(t){O&&(0,y["default"])(t,this.props)||(this.haveOwnPropsChanged=!0)},r.prototype.componentWillUnmount=function(){this.tryUnsubscribe(),this.clearCache()},r.prototype.clearCache=function(){this.dispatchProps=null,this.stateProps=null,this.mergedProps=null,this.haveOwnPropsChanged=!0,this.hasStoreStateChanged=!0,this.renderedElement=null,this.finalMapDispatchToProps=null,this.finalMapStateToProps=null},r.prototype.handleChange=function(){if(this.unsubscribe){var t=this.state.storeState,e=this.store.getState();O&&t===e||(this.hasStoreStateChanged=!0,this.setState({storeState:e}))}},r.prototype.getWrappedInstance=function(){return(0,w["default"])(j,"To access the wrapped instance, you need to specify { withRef: true } as the fourth argument of the connect() call."),this.refs.wrappedInstance},r.prototype.render=function(){var e=this.haveOwnPropsChanged,r=this.hasStoreStateChanged,o=this.renderedElement;this.haveOwnPropsChanged=!1,this.hasStoreStateChanged=!1;var n=!0,s=!0;O&&o&&(n=r||e&&this.doStatePropsDependOnOwnProps,s=e&&this.doDispatchPropsDependOnOwnProps);var i=!1,a=!1;n&&(i=this.updateStatePropsIfNeeded()),s&&(a=this.updateDispatchPropsIfNeeded());var p=!0;return p=i||a||e?this.updateMergedPropsIfNeeded():!1,!p&&o?o:this.renderedElement=j?(0,f.createElement)(t,c({},this.mergedProps,{ref:"wrappedInstance"})):(0,f.createElement)(t,this.mergedProps)},r}(f.Component);return e.displayName="Connect("+a(t)+")",e.WrappedComponent=t,e.contextTypes={store:d["default"]},e.propTypes={store:d["default"]},(0,S["default"])(e,t)}}var c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t};e.__esModule=!0,e["default"]=u;var f=r(1),h=r(2),d=o(h),l=r(5),y=o(l),P=r(6),b=o(P),v=r(11),m=o(v),g=r(7),S=o(g),O=r(8),w=o(O),x=function(t){return{}},C=function(t){return{dispatch:t}},T=function(t,e,r){return c({},r,t,e)},M=0},function(t,e){"use strict";function r(t,e){if(t===e)return!0;var r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return!1;for(var n=Object.prototype.hasOwnProperty,s=0;r.length>s;s++)if(!n.call(e,r[s])||t[r[s]]!==e[r[s]])return!1;return!0}e.__esModule=!0,e["default"]=r},function(t,e,r){"use strict";function o(t){return function(e){return(0,n.bindActionCreators)(t,e)}}e.__esModule=!0,e["default"]=o;var n=r(12)},function(t,e){"use strict";var r={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0};t.exports=function(t,e){for(var n=Object.getOwnPropertyNames(e),s=0;n.length>s;++s)r[n[s]]||o[n[s]]||(t[n[s]]=e[n[s]]);return t}},function(t,e,r){"use strict";var o=function(t,e,r,o,n,s,i,a){if(!t){var p;if(void 0===e)p=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[r,o,n,s,i,a],c=0;p=Error(e.replace(/%s/g,function(){return u[c++]})),p.name="Invariant Violation"}throw p.framesToPop=1,p}};t.exports=o},function(t,e){function r(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(r){}return e}t.exports=r},function(t,e){function r(t){return!!t&&"object"==typeof t}t.exports=r},function(t,e,r){function o(t){if(!s(t)||c.call(t)!=i||n(t))return!1;var e=a;if("function"==typeof t.constructor&&(e=f(t)),null===e)return!0;var r=e.constructor;return"function"==typeof r&&r instanceof r&&p.call(r)==u}var n=r(9),s=r(10),i="[object Object]",a=Object.prototype,p=Function.prototype.toString,u=p.call(Object),c=a.toString,f=Object.getPrototypeOf;t.exports=o},function(t,r){t.exports=e}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("redux")):"function"==typeof define&&define.amd?define(["react","redux"],e):"object"==typeof exports?exports.ReactRedux=e(require("react"),require("redux")):t.ReactRedux=e(t.React,t.Redux)}(this,function(t,e){return function(t){function e(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return t[o].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0,e.connect=e.Provider=void 0;var n=r(4),s=o(n),i=r(5),a=o(i);e.Provider=s["default"],e.connect=a["default"]},function(e,r){e.exports=t},function(t,e,r){"use strict";e.__esModule=!0;var o=r(1);e["default"]=o.PropTypes.shape({subscribe:o.PropTypes.func.isRequired,dispatch:o.PropTypes.func.isRequired,getState:o.PropTypes.func.isRequired})},function(t,e){"use strict";function r(t){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t);try{throw Error(t)}catch(e){}}e.__esModule=!0,e["default"]=r},function(t,e,r){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0,e["default"]=void 0;var a=r(1),p=r(2),u=o(p),c=r(3),f=(o(c),function(t){function e(r,o){n(this,e);var i=s(this,t.call(this,r,o));return i.store=r.store,i}return i(e,t),e.prototype.getChildContext=function(){return{store:this.store}},e.prototype.render=function(){var t=this.props.children;return a.Children.only(t)},e}(a.Component));e["default"]=f,f.propTypes={store:u["default"].isRequired,children:a.PropTypes.element.isRequired},f.childContextTypes={store:u["default"].isRequired}},function(t,e,r){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){return t.displayName||t.name||"Component"}function p(t,e,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},p=!!t,f=t||w,d=void 0;d="function"==typeof e?e:e?(0,P["default"])(e):x;var y=r||C,b=o.pure,v=void 0===b?!0:b,g=o.withRef,S=void 0===g?!1:g,T=v&&y!==C,_=M++;return function(t){function e(t,e,r){var o=y(t,e,r);return o}var r="Connect("+a(t)+")",o=function(o){function a(t,e){n(this,a);var i=s(this,o.call(this,t,e));i.version=_,i.store=t.store||e.store,(0,O["default"])(i.store,'Could not find "store" in either the context or '+('props of "'+r+'". ')+"Either wrap the root component in a <Provider>, "+('or explicitly pass "store" as a prop to "'+r+'".'));var p=i.store.getState();return i.state={storeState:p},i.clearCache(),i}return i(a,o),a.prototype.shouldComponentUpdate=function(){return!v||this.haveOwnPropsChanged||this.hasStoreStateChanged},a.prototype.computeStateProps=function(t,e){if(!this.finalMapStateToProps)return this.configureFinalMapState(t,e);var r=t.getState(),o=this.doStatePropsDependOnOwnProps?this.finalMapStateToProps(r,e):this.finalMapStateToProps(r);return o},a.prototype.configureFinalMapState=function(t,e){var r=f(t.getState(),e),o="function"==typeof r;return this.finalMapStateToProps=o?r:f,this.doStatePropsDependOnOwnProps=1!==this.finalMapStateToProps.length,o?this.computeStateProps(t,e):r},a.prototype.computeDispatchProps=function(t,e){if(!this.finalMapDispatchToProps)return this.configureFinalMapDispatch(t,e);var r=t.dispatch,o=this.doDispatchPropsDependOnOwnProps?this.finalMapDispatchToProps(r,e):this.finalMapDispatchToProps(r);return o},a.prototype.configureFinalMapDispatch=function(t,e){var r=d(t.dispatch,e),o="function"==typeof r;return this.finalMapDispatchToProps=o?r:d,this.doDispatchPropsDependOnOwnProps=1!==this.finalMapDispatchToProps.length,o?this.computeDispatchProps(t,e):r},a.prototype.updateStatePropsIfNeeded=function(){var t=this.computeStateProps(this.store,this.props);return this.stateProps&&(0,l["default"])(t,this.stateProps)?!1:(this.stateProps=t,!0)},a.prototype.updateDispatchPropsIfNeeded=function(){var t=this.computeDispatchProps(this.store,this.props);return this.dispatchProps&&(0,l["default"])(t,this.dispatchProps)?!1:(this.dispatchProps=t,!0)},a.prototype.updateMergedPropsIfNeeded=function(){var t=e(this.stateProps,this.dispatchProps,this.props);return this.mergedProps&&T&&(0,l["default"])(t,this.mergedProps)?!1:(this.mergedProps=t,!0)},a.prototype.isSubscribed=function(){return"function"==typeof this.unsubscribe},a.prototype.trySubscribe=function(){p&&!this.unsubscribe&&(this.unsubscribe=this.store.subscribe(this.handleChange.bind(this)),this.handleChange())},a.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},a.prototype.componentDidMount=function(){this.trySubscribe()},a.prototype.componentWillReceiveProps=function(t){v&&(0,l["default"])(t,this.props)||(this.haveOwnPropsChanged=!0)},a.prototype.componentWillUnmount=function(){this.tryUnsubscribe(),this.clearCache()},a.prototype.clearCache=function(){this.dispatchProps=null,this.stateProps=null,this.mergedProps=null,this.haveOwnPropsChanged=!0,this.hasStoreStateChanged=!0,this.renderedElement=null,this.finalMapDispatchToProps=null,this.finalMapStateToProps=null},a.prototype.handleChange=function(){if(this.unsubscribe){var t=this.state.storeState,e=this.store.getState();v&&t===e||(this.hasStoreStateChanged=!0,this.setState({storeState:e}))}},a.prototype.getWrappedInstance=function(){return(0,O["default"])(S,"To access the wrapped instance, you need to specify { withRef: true } as the fourth argument of the connect() call."),this.refs.wrappedInstance},a.prototype.render=function(){var e=this.haveOwnPropsChanged,r=this.hasStoreStateChanged,o=this.renderedElement;this.haveOwnPropsChanged=!1,this.hasStoreStateChanged=!1;var n=!0,s=!0;v&&o&&(n=r||e&&this.doStatePropsDependOnOwnProps,s=e&&this.doDispatchPropsDependOnOwnProps);var i=!1,a=!1;n&&(i=this.updateStatePropsIfNeeded()),s&&(a=this.updateDispatchPropsIfNeeded());var p=!0;return p=i||a||e?this.updateMergedPropsIfNeeded():!1,!p&&o?o:this.renderedElement=S?(0,c.createElement)(t,u({},this.mergedProps,{ref:"wrappedInstance"})):(0,c.createElement)(t,this.mergedProps)},a}(c.Component);return o.displayName=r,o.WrappedComponent=t,o.contextTypes={store:h["default"]},o.propTypes={store:h["default"]},(0,m["default"])(o,t)}}var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t};e.__esModule=!0,e["default"]=p;var c=r(1),f=r(2),h=o(f),d=r(6),l=o(d),y=r(7),P=o(y),b=r(3),v=(o(b),r(12)),g=(o(v),r(8)),m=o(g),S=r(9),O=o(S),w=function(t){return{}},x=function(t){return{dispatch:t}},C=function(t,e,r){return u({},r,t,e)},M=0},function(t,e){"use strict";function r(t,e){if(t===e)return!0;var r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return!1;for(var n=Object.prototype.hasOwnProperty,s=0;r.length>s;s++)if(!n.call(e,r[s])||t[r[s]]!==e[r[s]])return!1;return!0}e.__esModule=!0,e["default"]=r},function(t,e,r){"use strict";function o(t){return function(e){return(0,n.bindActionCreators)(t,e)}}e.__esModule=!0,e["default"]=o;var n=r(13)},function(t,e){"use strict";var r={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0};t.exports=function(t,e){for(var n=Object.getOwnPropertyNames(e),s=0;n.length>s;++s)r[n[s]]||o[n[s]]||(t[n[s]]=e[n[s]]);return t}},function(t,e,r){"use strict";var o=function(t,e,r,o,n,s,i,a){if(!t){var p;if(void 0===e)p=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[r,o,n,s,i,a],c=0;p=Error(e.replace(/%s/g,function(){return u[c++]})),p.name="Invariant Violation"}throw p.framesToPop=1,p}};t.exports=o},function(t,e){function r(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(r){}return e}t.exports=r},function(t,e){function r(t){return!!t&&"object"==typeof t}t.exports=r},function(t,e,r){function o(t){if(!s(t)||c.call(t)!=i||n(t))return!1;var e=a;if("function"==typeof t.constructor&&(e=f(t)),null===e)return!0;var r=e.constructor;return"function"==typeof r&&r instanceof r&&p.call(r)==u}var n=r(10),s=r(11),i="[object Object]",a=Object.prototype,p=Function.prototype.toString,u=p.call(Object),c=a.toString,f=Object.getPrototypeOf;t.exports=o},function(t,r){t.exports=e}])});

@@ -22,2 +22,6 @@ 'use strict';

var _warning = require('../utils/warning');
var _warning2 = _interopRequireDefault(_warning);
var _isPlainObject = require('lodash/isPlainObject');

@@ -57,7 +61,2 @@

function checkStateShape(stateProps, dispatch) {
(0, _invariant2["default"])((0, _isPlainObject2["default"])(stateProps), '`%sToProps` must return an object. Instead received %s.', dispatch ? 'mapDispatch' : 'mapState', stateProps);
return stateProps;
}
// Helps track hot reloading.

@@ -71,4 +70,12 @@ var nextVersion = 0;

var mapState = mapStateToProps || defaultMapStateToProps;
var mapDispatch = (0, _isPlainObject2["default"])(mapDispatchToProps) ? (0, _wrapActionCreators2["default"])(mapDispatchToProps) : mapDispatchToProps || defaultMapDispatchToProps;
var mapDispatch = undefined;
if (typeof mapDispatchToProps === 'function') {
mapDispatch = mapDispatchToProps;
} else if (!mapDispatchToProps) {
mapDispatch = defaultMapDispatchToProps;
} else {
mapDispatch = (0, _wrapActionCreators2["default"])(mapDispatchToProps);
}
var finalMergeProps = mergeProps || defaultMergeProps;

@@ -85,9 +92,19 @@ var _options$pure = options.pure;

function computeMergedProps(stateProps, dispatchProps, parentProps) {
var mergedProps = finalMergeProps(stateProps, dispatchProps, parentProps);
(0, _invariant2["default"])((0, _isPlainObject2["default"])(mergedProps), '`mergeProps` must return an object. Instead received %s.', mergedProps);
return mergedProps;
}
return function wrapWithConnect(WrappedComponent) {
var connectDisplayName = 'Connect(' + getDisplayName(WrappedComponent) + ')';
return function wrapWithConnect(WrappedComponent) {
function checkStateShape(props, methodName) {
if (!(0, _isPlainObject2["default"])(props)) {
(0, _warning2["default"])(methodName + '() in ' + connectDisplayName + ' must return a plain object. ' + ('Instead received ' + props + '.'));
}
}
function computeMergedProps(stateProps, dispatchProps, parentProps) {
var mergedProps = finalMergeProps(stateProps, dispatchProps, parentProps);
if (process.env.NODE_ENV !== 'production') {
checkStateShape(mergedProps, 'mergeProps');
}
return mergedProps;
}
var Connect = function (_Component) {

@@ -108,3 +125,3 @@ _inherits(Connect, _Component);

(0, _invariant2["default"])(_this.store, 'Could not find "store" in either the context or ' + ('props of "' + _this.constructor.displayName + '". ') + 'Either wrap the root component in a <Provider>, ' + ('or explicitly pass "store" as a prop to "' + _this.constructor.displayName + '".'));
(0, _invariant2["default"])(_this.store, 'Could not find "store" in either the context or ' + ('props of "' + connectDisplayName + '". ') + 'Either wrap the root component in a <Provider>, ' + ('or explicitly pass "store" as a prop to "' + connectDisplayName + '".'));

@@ -125,3 +142,6 @@ var storeState = _this.store.getState();

return checkStateShape(stateProps);
if (process.env.NODE_ENV !== 'production') {
checkStateShape(stateProps, 'mapStateToProps');
}
return stateProps;
};

@@ -136,3 +156,10 @@

return isFactory ? this.computeStateProps(store, props) : checkStateShape(mappedState);
if (isFactory) {
return this.computeStateProps(store, props);
}
if (process.env.NODE_ENV !== 'production') {
checkStateShape(mappedState, 'mapStateToProps');
}
return mappedState;
};

@@ -149,3 +176,6 @@

return checkStateShape(dispatchProps, true);
if (process.env.NODE_ENV !== 'production') {
checkStateShape(dispatchProps, 'mapDispatchToProps');
}
return dispatchProps;
};

@@ -160,3 +190,10 @@

return isFactory ? this.computeDispatchProps(store, props) : checkStateShape(mappedDispatch, true);
if (isFactory) {
return this.computeDispatchProps(store, props);
}
if (process.env.NODE_ENV !== 'production') {
checkStateShape(mappedDispatch, 'mapDispatchToProps');
}
return mappedDispatch;
};

@@ -307,3 +344,3 @@

Connect.displayName = 'Connect(' + getDisplayName(WrappedComponent) + ')';
Connect.displayName = connectDisplayName;
Connect.WrappedComponent = WrappedComponent;

@@ -310,0 +347,0 @@ Connect.contextTypes = {

@@ -12,2 +12,6 @@ 'use strict';

var _warning = require('../utils/warning');
var _warning2 = _interopRequireDefault(_warning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -30,3 +34,3 @@

if (typeof console !== 'undefined' && typeof console.error === 'function') {
console.error('<Provider> does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reactjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
(0, _warning2["default"])('<Provider> does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reactjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
}

@@ -33,0 +37,0 @@ /* eslint-disable no-console */

{
"name": "react-redux",
"version": "4.4.2",
"version": "4.4.3",
"description": "Official React bindings for Redux",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -5,2 +5,3 @@ import { Component, createElement } from 'react'

import wrapActionCreators from '../utils/wrapActionCreators'
import warning from '../utils/warning'
import isPlainObject from 'lodash/isPlainObject'

@@ -22,12 +23,2 @@ import hoistStatics from 'hoist-non-react-statics'

function checkStateShape(stateProps, dispatch) {
invariant(
isPlainObject(stateProps),
'`%sToProps` must return an object. Instead received %s.',
dispatch ? 'mapDispatch' : 'mapState',
stateProps
)
return stateProps
}
// Helps track hot reloading.

@@ -39,6 +30,12 @@ let nextVersion = 0

const mapState = mapStateToProps || defaultMapStateToProps
const mapDispatch = isPlainObject(mapDispatchToProps) ?
wrapActionCreators(mapDispatchToProps) :
mapDispatchToProps || defaultMapDispatchToProps
let mapDispatch
if (typeof mapDispatchToProps === 'function') {
mapDispatch = mapDispatchToProps
} else if (!mapDispatchToProps) {
mapDispatch = defaultMapDispatchToProps
} else {
mapDispatch = wrapActionCreators(mapDispatchToProps)
}
const finalMergeProps = mergeProps || defaultMergeProps

@@ -51,13 +48,22 @@ const { pure = true, withRef = false } = options

function computeMergedProps(stateProps, dispatchProps, parentProps) {
const mergedProps = finalMergeProps(stateProps, dispatchProps, parentProps)
invariant(
isPlainObject(mergedProps),
'`mergeProps` must return an object. Instead received %s.',
mergedProps
)
return mergedProps
}
return function wrapWithConnect(WrappedComponent) {
const connectDisplayName = `Connect(${getDisplayName(WrappedComponent)})`
return function wrapWithConnect(WrappedComponent) {
function checkStateShape(props, methodName) {
if (!isPlainObject(props)) {
warning(
`${methodName}() in ${connectDisplayName} must return a plain object. ` +
`Instead received ${props}.`
)
}
}
function computeMergedProps(stateProps, dispatchProps, parentProps) {
const mergedProps = finalMergeProps(stateProps, dispatchProps, parentProps)
if (process.env.NODE_ENV !== 'production') {
checkStateShape(mergedProps, 'mergeProps')
}
return mergedProps
}
class Connect extends Component {

@@ -75,5 +81,5 @@ shouldComponentUpdate() {

`Could not find "store" in either the context or ` +
`props of "${this.constructor.displayName}". ` +
`props of "${connectDisplayName}". ` +
`Either wrap the root component in a <Provider>, ` +
`or explicitly pass "store" as a prop to "${this.constructor.displayName}".`
`or explicitly pass "store" as a prop to "${connectDisplayName}".`
)

@@ -96,3 +102,6 @@

return checkStateShape(stateProps)
if (process.env.NODE_ENV !== 'production') {
checkStateShape(stateProps, 'mapStateToProps')
}
return stateProps
}

@@ -107,5 +116,10 @@

return isFactory ?
this.computeStateProps(store, props) :
checkStateShape(mappedState)
if (isFactory) {
return this.computeStateProps(store, props)
}
if (process.env.NODE_ENV !== 'production') {
checkStateShape(mappedState, 'mapStateToProps')
}
return mappedState
}

@@ -123,3 +137,6 @@

return checkStateShape(dispatchProps, true)
if (process.env.NODE_ENV !== 'production') {
checkStateShape(dispatchProps, 'mapDispatchToProps')
}
return dispatchProps
}

@@ -134,5 +151,10 @@

return isFactory ?
this.computeDispatchProps(store, props) :
checkStateShape(mappedDispatch, true)
if (isFactory) {
return this.computeDispatchProps(store, props)
}
if (process.env.NODE_ENV !== 'production') {
checkStateShape(mappedDispatch, 'mapDispatchToProps')
}
return mappedDispatch
}

@@ -296,3 +318,3 @@

Connect.displayName = `Connect(${getDisplayName(WrappedComponent)})`
Connect.displayName = connectDisplayName
Connect.WrappedComponent = WrappedComponent

@@ -299,0 +321,0 @@ Connect.contextTypes = {

import { Component, PropTypes, Children } from 'react'
import storeShape from '../utils/storeShape'
import warning from '../utils/warning'

@@ -13,3 +14,3 @@ let didWarnAboutReceivingStore = false

if (typeof console !== 'undefined' && typeof console.error === 'function') {
console.error(
warning(
'<Provider> does not support changing `store` on the fly. ' +

@@ -16,0 +17,0 @@ 'It is most likely that you see this error because you updated to ' +

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc