react-redux
Advanced tools
Comparing version 4.2.0 to 4.2.1
@@ -59,7 +59,18 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var Provider = __webpack_require__(3); | ||
var connect = __webpack_require__(4); | ||
exports.__esModule = true; | ||
exports.connect = exports.Provider = undefined; | ||
module.exports = { Provider: Provider, connect: connect }; | ||
var _Provider = __webpack_require__(3); | ||
var _Provider2 = _interopRequireDefault(_Provider); | ||
var _connect = __webpack_require__(4); | ||
var _connect2 = _interopRequireDefault(_connect); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
exports.Provider = _Provider2["default"]; | ||
exports.connect = _connect2["default"]; | ||
/***/ }, | ||
@@ -77,14 +88,12 @@ /* 1 */ | ||
var _require = __webpack_require__(1); | ||
exports.__esModule = true; | ||
var PropTypes = _require.PropTypes; | ||
var _react = __webpack_require__(1); | ||
var storeShape = PropTypes.shape({ | ||
subscribe: PropTypes.func.isRequired, | ||
dispatch: PropTypes.func.isRequired, | ||
getState: PropTypes.func.isRequired | ||
exports["default"] = _react.PropTypes.shape({ | ||
subscribe: _react.PropTypes.func.isRequired, | ||
dispatch: _react.PropTypes.func.isRequired, | ||
getState: _react.PropTypes.func.isRequired | ||
}); | ||
module.exports = storeShape; | ||
/***/ }, | ||
@@ -96,37 +105,31 @@ /* 3 */ | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
exports.__esModule = true; | ||
exports["default"] = undefined; | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
var _react = __webpack_require__(1); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var _storeShape = __webpack_require__(2); | ||
var _require = __webpack_require__(1); | ||
var _storeShape2 = _interopRequireDefault(_storeShape); | ||
var Component = _require.Component; | ||
var PropTypes = _require.PropTypes; | ||
var Children = _require.Children; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var storeShape = __webpack_require__(2); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
if (true) { | ||
var warnAboutReceivingStore; | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
(function () { | ||
var didWarnAboutReceivingStore = false; | ||
/* eslint-disable no-var */ | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
warnAboutReceivingStore = function warnAboutReceivingStore() { | ||
/* eslint-enable no-var */ | ||
if (didWarnAboutReceivingStore) { | ||
return; | ||
} | ||
didWarnAboutReceivingStore = true; | ||
var didWarnAboutReceivingStore = false; | ||
function warnAboutReceivingStore() { | ||
if (didWarnAboutReceivingStore) { | ||
return; | ||
} | ||
didWarnAboutReceivingStore = true; | ||
/* eslint-disable no-console */ | ||
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/rackt/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.'); | ||
} | ||
/* eslint-disable no-console */ | ||
}; | ||
})(); | ||
/* eslint-disable no-console */ | ||
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/rackt/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.'); | ||
} | ||
/* eslint-disable no-console */ | ||
} | ||
@@ -153,8 +156,10 @@ | ||
return Children.only(children); | ||
return _react.Children.only(children); | ||
}; | ||
return Provider; | ||
}(Component); | ||
}(_react.Component); | ||
exports["default"] = Provider; | ||
if (true) { | ||
@@ -172,11 +177,9 @@ Provider.prototype.componentWillReceiveProps = function (nextProps) { | ||
Provider.propTypes = { | ||
store: storeShape.isRequired, | ||
children: PropTypes.element.isRequired | ||
store: _storeShape2["default"].isRequired, | ||
children: _react.PropTypes.element.isRequired | ||
}; | ||
Provider.childContextTypes = { | ||
store: storeShape.isRequired | ||
store: _storeShape2["default"].isRequired | ||
}; | ||
module.exports = Provider; | ||
/***/ }, | ||
@@ -190,2 +193,33 @@ /* 4 */ | ||
exports.__esModule = true; | ||
exports["default"] = connect; | ||
var _react = __webpack_require__(1); | ||
var _storeShape = __webpack_require__(2); | ||
var _storeShape2 = _interopRequireDefault(_storeShape); | ||
var _shallowEqual = __webpack_require__(5); | ||
var _shallowEqual2 = _interopRequireDefault(_shallowEqual); | ||
var _wrapActionCreators = __webpack_require__(6); | ||
var _wrapActionCreators2 = _interopRequireDefault(_wrapActionCreators); | ||
var _isPlainObject = __webpack_require__(11); | ||
var _isPlainObject2 = _interopRequireDefault(_isPlainObject); | ||
var _hoistNonReactStatics = __webpack_require__(7); | ||
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics); | ||
var _invariant = __webpack_require__(8); | ||
var _invariant2 = _interopRequireDefault(_invariant); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -197,14 +231,2 @@ | ||
var _require = __webpack_require__(1); | ||
var Component = _require.Component; | ||
var createElement = _require.createElement; | ||
var storeShape = __webpack_require__(2); | ||
var shallowEqual = __webpack_require__(5); | ||
var wrapActionCreators = __webpack_require__(6); | ||
var isPlainObject = __webpack_require__(11); | ||
var hoistStatics = __webpack_require__(7); | ||
var invariant = __webpack_require__(8); | ||
var defaultMapStateToProps = function defaultMapStateToProps(state) { | ||
@@ -232,3 +254,3 @@ return {}; | ||
var finalMapStateToProps = mapStateToProps || defaultMapStateToProps; | ||
var finalMapDispatchToProps = isPlainObject(mapDispatchToProps) ? wrapActionCreators(mapDispatchToProps) : mapDispatchToProps || defaultMapDispatchToProps; | ||
var finalMapDispatchToProps = (0, _isPlainObject2["default"])(mapDispatchToProps) ? (0, _wrapActionCreators2["default"])(mapDispatchToProps) : mapDispatchToProps || defaultMapDispatchToProps; | ||
var finalMergeProps = mergeProps || defaultMergeProps; | ||
@@ -250,3 +272,3 @@ var doStatePropsDependOnOwnProps = finalMapStateToProps.length !== 1; | ||
invariant(isPlainObject(stateProps), '`mapStateToProps` must return an object. Instead received %s.', stateProps); | ||
(0, _invariant2["default"])((0, _isPlainObject2["default"])(stateProps), '`mapStateToProps` must return an object. Instead received %s.', stateProps); | ||
return stateProps; | ||
@@ -260,3 +282,3 @@ } | ||
invariant(isPlainObject(dispatchProps), '`mapDispatchToProps` must return an object. Instead received %s.', dispatchProps); | ||
(0, _invariant2["default"])((0, _isPlainObject2["default"])(dispatchProps), '`mapDispatchToProps` must return an object. Instead received %s.', dispatchProps); | ||
return dispatchProps; | ||
@@ -267,3 +289,3 @@ } | ||
var mergedProps = finalMergeProps(stateProps, dispatchProps, parentProps); | ||
invariant(isPlainObject(mergedProps), '`mergeProps` must return an object. Instead received %s.', mergedProps); | ||
(0, _invariant2["default"])((0, _isPlainObject2["default"])(mergedProps), '`mergeProps` must return an object. Instead received %s.', mergedProps); | ||
return mergedProps; | ||
@@ -288,3 +310,3 @@ } | ||
invariant(_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 "' + _this.constructor.displayName + '". ') + 'Either wrap the root component in a <Provider>, ' + ('or explicitly pass "store" as a prop to "' + _this.constructor.displayName + '".')); | ||
@@ -299,3 +321,3 @@ var storeState = _this.store.getState(); | ||
var nextStateProps = computeStateProps(this.store, this.props); | ||
if (this.stateProps && shallowEqual(nextStateProps, this.stateProps)) { | ||
if (this.stateProps && (0, _shallowEqual2["default"])(nextStateProps, this.stateProps)) { | ||
return false; | ||
@@ -310,3 +332,3 @@ } | ||
var nextDispatchProps = computeDispatchProps(this.store, this.props); | ||
if (this.dispatchProps && shallowEqual(nextDispatchProps, this.dispatchProps)) { | ||
if (this.dispatchProps && (0, _shallowEqual2["default"])(nextDispatchProps, this.dispatchProps)) { | ||
return false; | ||
@@ -346,3 +368,3 @@ } | ||
Connect.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
if (!pure || !shallowEqual(nextProps, this.props)) { | ||
if (!pure || !(0, _shallowEqual2["default"])(nextProps, this.props)) { | ||
this.haveOwnPropsChanged = true; | ||
@@ -381,3 +403,3 @@ } | ||
Connect.prototype.getWrappedInstance = function getWrappedInstance() { | ||
invariant(withRef, 'To access the wrapped instance, you need to specify ' + '{ withRef: true } as the fourth argument of the connect() call.'); | ||
(0, _invariant2["default"])(withRef, 'To access the wrapped instance, you need to specify ' + '{ withRef: true } as the fourth argument of the connect() call.'); | ||
@@ -423,7 +445,7 @@ return this.refs.wrappedInstance; | ||
if (withRef) { | ||
this.renderedElement = createElement(WrappedComponent, _extends({}, this.mergedProps, { | ||
this.renderedElement = (0, _react.createElement)(WrappedComponent, _extends({}, this.mergedProps, { | ||
ref: 'wrappedInstance' | ||
})); | ||
} else { | ||
this.renderedElement = createElement(WrappedComponent, this.mergedProps); | ||
this.renderedElement = (0, _react.createElement)(WrappedComponent, this.mergedProps); | ||
} | ||
@@ -435,3 +457,3 @@ | ||
return Connect; | ||
}(Component); | ||
}(_react.Component); | ||
@@ -441,6 +463,6 @@ Connect.displayName = 'Connect(' + getDisplayName(WrappedComponent) + ')'; | ||
Connect.contextTypes = { | ||
store: storeShape | ||
store: _storeShape2["default"] | ||
}; | ||
Connect.propTypes = { | ||
store: storeShape | ||
store: _storeShape2["default"] | ||
}; | ||
@@ -461,8 +483,6 @@ | ||
return hoistStatics(Connect, WrappedComponent); | ||
return (0, _hoistNonReactStatics2["default"])(Connect, WrappedComponent); | ||
}; | ||
} | ||
module.exports = connect; | ||
/***/ }, | ||
@@ -474,2 +494,4 @@ /* 5 */ | ||
exports.__esModule = true; | ||
exports["default"] = shallowEqual; | ||
function shallowEqual(objA, objB) { | ||
@@ -498,4 +520,2 @@ if (objA === objB) { | ||
module.exports = shallowEqual; | ||
/***/ }, | ||
@@ -507,2 +527,5 @@ /* 6 */ | ||
exports.__esModule = true; | ||
exports["default"] = wrapActionCreators; | ||
var _redux = __webpack_require__(12); | ||
@@ -516,4 +539,2 @@ | ||
module.exports = wrapActionCreators; | ||
/***/ }, | ||
@@ -682,3 +703,3 @@ /* 7 */ | ||
/* WEBPACK VAR INJECTION */(function(global) {var isHostObject = __webpack_require__(9), | ||
var isHostObject = __webpack_require__(9), | ||
isObjectLike = __webpack_require__(10); | ||
@@ -690,6 +711,6 @@ | ||
/** Used for built-in method references. */ | ||
var objectProto = global.Object.prototype; | ||
var objectProto = Object.prototype; | ||
/** Used to resolve the decompiled source of functions. */ | ||
var funcToString = global.Function.prototype.toString; | ||
var funcToString = Function.prototype.toString; | ||
@@ -753,3 +774,2 @@ /** Used to infer the `Object` constructor. */ | ||
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()) || Function('return this')())) | ||
@@ -756,0 +776,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(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";var n=r(3),o=r(4);t.exports={Provider:n,connect:o}},function(e,r){e.exports=t},function(t,e,r){"use strict";var n=r(1),o=n.PropTypes,s=o.shape({subscribe:o.func.isRequired,dispatch:o.func.isRequired,getState:o.func.isRequired});t.exports=s},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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 s(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)}var i=r(1),u=i.Component,a=i.PropTypes,c=i.Children,p=r(2),f=function(t){function e(r,s){n(this,e);var i=o(this,t.call(this,r,s));return i.store=r.store,i}return s(e,t),e.prototype.getChildContext=function(){return{store:this.store}},e.prototype.render=function(){var t=this.props.children;return c.only(t)},e}(u);f.propTypes={store:p.isRequired,children:a.element.isRequired},f.childContextTypes={store:p.isRequired},t.exports=f},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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 s(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 i(t){return t.displayName||t.name||"Component"}function u(t,e,r){function u(t,e){var r=t.getState(),n=T?S(r,e):S(r);return v(y(n),"`mapStateToProps` must return an object. Instead received %s.",n),n}function c(t,e){var r=t.dispatch,n=E?j(r,e):j(r);return v(y(n),"`mapDispatchToProps` must return an object. Instead received %s.",n),n}function C(t,e,r){var n=R(t,e,r);return v(y(n),"`mergeProps` must return an object. Instead received %s.",n),n}var w=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},O=!!t,S=t||g,j=y(e)?l(e):e||m,R=r||P,T=1!==S.length,E=1!==j.length,I=w.pure,q=void 0===I?!0:I,N=w.withRef,_=void 0===N?!1:N,D=x++;return function(t){var e=function(e){function r(t,s){n(this,r);var i=o(this,e.call(this,t,s));i.version=D,i.store=t.store||s.store,v(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 u=i.store.getState();return i.state={storeState:u},i.clearCache(),i}return s(r,e),r.prototype.shouldComponentUpdate=function(){return!q||this.haveOwnPropsChanged||this.hasStoreStateChanged},r.prototype.updateStatePropsIfNeeded=function(){var t=u(this.store,this.props);return this.stateProps&&d(t,this.stateProps)?!1:(this.stateProps=t,!0)},r.prototype.updateDispatchPropsIfNeeded=function(){var t=c(this.store,this.props);return this.dispatchProps&&d(t,this.dispatchProps)?!1:(this.dispatchProps=t,!0)},r.prototype.updateMergedProps=function(){this.mergedProps=C(this.stateProps,this.dispatchProps,this.props)},r.prototype.isSubscribed=function(){return"function"==typeof this.unsubscribe},r.prototype.trySubscribe=function(){O&&!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){q&&d(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},r.prototype.handleChange=function(){if(this.unsubscribe){var t=this.state.storeState,e=this.store.getState();q&&t===e||(this.hasStoreStateChanged=!0,this.setState({storeState:e}))}},r.prototype.getWrappedInstance=function(){return v(_,"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,n=this.renderedElement;this.haveOwnPropsChanged=!1,this.hasStoreStateChanged=!1;var o=!0,s=!0;q&&n&&(o=r||e&&T,s=e&&E);var i=!1,u=!1;o&&(i=this.updateStatePropsIfNeeded()),s&&(u=this.updateDispatchPropsIfNeeded());var c=!0;return i||u||e?this.updateMergedProps():c=!1,!c&&n?n:this.renderedElement=_?f(t,a({},this.mergedProps,{ref:"wrappedInstance"})):f(t,this.mergedProps)},r}(p);return e.displayName="Connect("+i(t)+")",e.WrappedComponent=t,e.contextTypes={store:h},e.propTypes={store:h},b(e,t)}}var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},c=r(1),p=c.Component,f=c.createElement,h=r(2),d=r(5),l=r(6),y=r(11),b=r(7),v=r(8),g=function(t){return{}},m=function(t){return{dispatch:t}},P=function(t,e,r){return a({},r,t,e)},x=0;t.exports=u},function(t,e){"use strict";function r(t,e){if(t===e)return!0;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(var o=Object.prototype.hasOwnProperty,s=0;r.length>s;s++)if(!o.call(e,r[s])||t[r[s]]!==e[r[s]])return!1;return!0}t.exports=r},function(t,e,r){"use strict";function n(t){return function(e){return(0,o.bindActionCreators)(t,e)}}var o=r(12);t.exports=n},function(t,e){"use strict";var r={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0};t.exports=function(t,e){for(var o=Object.getOwnPropertyNames(e),s=0;o.length>s;++s)r[o[s]]||n[o[s]]||(t[o[s]]=e[o[s]]);return t}},function(t,e,r){"use strict";var n=function(t,e,r,n,o,s,i,u){if(!t){var a;if(void 0===e)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,o,s,i,u],p=0;a=Error(e.replace(/%s/g,function(){return c[p++]})),a.name="Invariant Violation"}throw a.framesToPop=1,a}};t.exports=n},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(e){function n(t){if(!s(t)||p.call(t)!=i||o(t))return!1;var e=u;if("function"==typeof t.constructor&&(e=f(t)),null===e)return!0;var r=e.constructor;return"function"==typeof r&&r instanceof r&&a.call(r)==c}var o=r(9),s=r(10),i="[object Object]",u=e.Object.prototype,a=e.Function.prototype.toString,c=a.call(Object),p=u.toString,f=Object.getPrototypeOf;t.exports=n}).call(e,function(){return this}()||Function("return this")())},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(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0,e.connect=e.Provider=void 0;var o=r(3),s=n(o),i=r(4),u=n(i);e.Provider=s["default"],e.connect=u["default"]},function(e,r){e.exports=t},function(t,e,r){"use strict";e.__esModule=!0;var n=r(1);e["default"]=n.PropTypes.shape({subscribe:n.PropTypes.func.isRequired,dispatch:n.PropTypes.func.isRequired,getState:n.PropTypes.func.isRequired})},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(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 u=r(1),a=r(2),c=n(a),p=function(t){function e(r,n){o(this,e);var i=s(this,t.call(this,r,n));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 u.Children.only(t)},e}(u.Component);e["default"]=p,p.propTypes={store:c["default"].isRequired,children:u.PropTypes.element.isRequired},p.childContextTypes={store:c["default"].isRequired}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(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 u(t){return t.displayName||t.name||"Component"}function a(t,e,r){function n(t,e){var r=t.getState(),n=_?v(r,e):v(r);return(0,C["default"])((0,m["default"])(n),"`mapStateToProps` must return an object. Instead received %s.",n),n}function a(t,e){var r=t.dispatch,n=T?g(r,e):g(r);return(0,C["default"])((0,m["default"])(n),"`mapDispatchToProps` must return an object. Instead received %s.",n),n}function f(t,e,r){var n=x(t,e,r);return(0,C["default"])((0,m["default"])(n),"`mergeProps` must return an object. Instead received %s.",n),n}var l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},y=!!t,v=t||w,g=(0,m["default"])(e)?(0,b["default"])(e):e||O,x=r||S,_=1!==v.length,T=1!==g.length,R=l.pure,E=void 0===R?!0:R,M=l.withRef,I=void 0===M?!1:M,q=j++;return function(t){var e=function(e){function r(t,n){o(this,r);var i=s(this,e.call(this,t,n));i.version=q,i.store=t.store||n.store,(0,C["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 u=i.store.getState();return i.state={storeState:u},i.clearCache(),i}return i(r,e),r.prototype.shouldComponentUpdate=function(){return!E||this.haveOwnPropsChanged||this.hasStoreStateChanged},r.prototype.updateStatePropsIfNeeded=function(){var t=n(this.store,this.props);return this.stateProps&&(0,h["default"])(t,this.stateProps)?!1:(this.stateProps=t,!0)},r.prototype.updateDispatchPropsIfNeeded=function(){var t=a(this.store,this.props);return this.dispatchProps&&(0,h["default"])(t,this.dispatchProps)?!1:(this.dispatchProps=t,!0)},r.prototype.updateMergedProps=function(){this.mergedProps=f(this.stateProps,this.dispatchProps,this.props)},r.prototype.isSubscribed=function(){return"function"==typeof this.unsubscribe},r.prototype.trySubscribe=function(){y&&!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){E&&(0,h["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},r.prototype.handleChange=function(){if(this.unsubscribe){var t=this.state.storeState,e=this.store.getState();E&&t===e||(this.hasStoreStateChanged=!0,this.setState({storeState:e}))}},r.prototype.getWrappedInstance=function(){return(0,C["default"])(I,"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,n=this.renderedElement;this.haveOwnPropsChanged=!1,this.hasStoreStateChanged=!1;var o=!0,s=!0;E&&n&&(o=r||e&&_,s=e&&T);var i=!1,u=!1;o&&(i=this.updateStatePropsIfNeeded()),s&&(u=this.updateDispatchPropsIfNeeded());var a=!0;return i||u||e?this.updateMergedProps():a=!1,!a&&n?n:this.renderedElement=I?(0,p.createElement)(t,c({},this.mergedProps,{ref:"wrappedInstance"})):(0,p.createElement)(t,this.mergedProps)},r}(p.Component);return e.displayName="Connect("+u(t)+")",e.WrappedComponent=t,e.contextTypes={store:d["default"]},e.propTypes={store:d["default"]},(0,P["default"])(e,t)}}var c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.__esModule=!0,e["default"]=a;var p=r(1),f=r(2),d=n(f),l=r(5),h=n(l),y=r(6),b=n(y),v=r(11),m=n(v),g=r(7),P=n(g),x=r(8),C=n(x),w=function(t){return{}},O=function(t){return{dispatch:t}},S=function(t,e,r){return c({},r,t,e)},j=0},function(t,e){"use strict";function r(t,e){if(t===e)return!0;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(var o=Object.prototype.hasOwnProperty,s=0;r.length>s;s++)if(!o.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 n(t){return function(e){return(0,o.bindActionCreators)(t,e)}}e.__esModule=!0,e["default"]=n;var o=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},n={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0};t.exports=function(t,e){for(var o=Object.getOwnPropertyNames(e),s=0;o.length>s;++s)r[o[s]]||n[o[s]]||(t[o[s]]=e[o[s]]);return t}},function(t,e,r){"use strict";var n=function(t,e,r,n,o,s,i,u){if(!t){var a;if(void 0===e)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,o,s,i,u],p=0;a=Error(e.replace(/%s/g,function(){return c[p++]})),a.name="Invariant Violation"}throw a.framesToPop=1,a}};t.exports=n},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 n(t){if(!s(t)||p.call(t)!=i||o(t))return!1;var e=u;if("function"==typeof t.constructor&&(e=f(t)),null===e)return!0;var r=e.constructor;return"function"==typeof r&&r instanceof r&&a.call(r)==c}var o=r(9),s=r(10),i="[object Object]",u=Object.prototype,a=Function.prototype.toString,c=a.call(Object),p=u.toString,f=Object.getPrototypeOf;t.exports=n},function(t,r){t.exports=e}])}); |
@@ -5,2 +5,33 @@ 'use strict'; | ||
exports.__esModule = true; | ||
exports["default"] = connect; | ||
var _react = require('react'); | ||
var _storeShape = require('../utils/storeShape'); | ||
var _storeShape2 = _interopRequireDefault(_storeShape); | ||
var _shallowEqual = require('../utils/shallowEqual'); | ||
var _shallowEqual2 = _interopRequireDefault(_shallowEqual); | ||
var _wrapActionCreators = require('../utils/wrapActionCreators'); | ||
var _wrapActionCreators2 = _interopRequireDefault(_wrapActionCreators); | ||
var _isPlainObject = require('lodash/isPlainObject'); | ||
var _isPlainObject2 = _interopRequireDefault(_isPlainObject); | ||
var _hoistNonReactStatics = require('hoist-non-react-statics'); | ||
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics); | ||
var _invariant = require('invariant'); | ||
var _invariant2 = _interopRequireDefault(_invariant); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -12,14 +43,2 @@ | ||
var _require = require('react'); | ||
var Component = _require.Component; | ||
var createElement = _require.createElement; | ||
var storeShape = require('../utils/storeShape'); | ||
var shallowEqual = require('../utils/shallowEqual'); | ||
var wrapActionCreators = require('../utils/wrapActionCreators'); | ||
var isPlainObject = require('lodash/isPlainObject'); | ||
var hoistStatics = require('hoist-non-react-statics'); | ||
var invariant = require('invariant'); | ||
var defaultMapStateToProps = function defaultMapStateToProps(state) { | ||
@@ -47,3 +66,3 @@ return {}; | ||
var finalMapStateToProps = mapStateToProps || defaultMapStateToProps; | ||
var finalMapDispatchToProps = isPlainObject(mapDispatchToProps) ? wrapActionCreators(mapDispatchToProps) : mapDispatchToProps || defaultMapDispatchToProps; | ||
var finalMapDispatchToProps = (0, _isPlainObject2["default"])(mapDispatchToProps) ? (0, _wrapActionCreators2["default"])(mapDispatchToProps) : mapDispatchToProps || defaultMapDispatchToProps; | ||
var finalMergeProps = mergeProps || defaultMergeProps; | ||
@@ -65,3 +84,3 @@ var doStatePropsDependOnOwnProps = finalMapStateToProps.length !== 1; | ||
invariant(isPlainObject(stateProps), '`mapStateToProps` must return an object. Instead received %s.', stateProps); | ||
(0, _invariant2["default"])((0, _isPlainObject2["default"])(stateProps), '`mapStateToProps` must return an object. Instead received %s.', stateProps); | ||
return stateProps; | ||
@@ -75,3 +94,3 @@ } | ||
invariant(isPlainObject(dispatchProps), '`mapDispatchToProps` must return an object. Instead received %s.', dispatchProps); | ||
(0, _invariant2["default"])((0, _isPlainObject2["default"])(dispatchProps), '`mapDispatchToProps` must return an object. Instead received %s.', dispatchProps); | ||
return dispatchProps; | ||
@@ -82,3 +101,3 @@ } | ||
var mergedProps = finalMergeProps(stateProps, dispatchProps, parentProps); | ||
invariant(isPlainObject(mergedProps), '`mergeProps` must return an object. Instead received %s.', mergedProps); | ||
(0, _invariant2["default"])((0, _isPlainObject2["default"])(mergedProps), '`mergeProps` must return an object. Instead received %s.', mergedProps); | ||
return mergedProps; | ||
@@ -103,3 +122,3 @@ } | ||
invariant(_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 "' + _this.constructor.displayName + '". ') + 'Either wrap the root component in a <Provider>, ' + ('or explicitly pass "store" as a prop to "' + _this.constructor.displayName + '".')); | ||
@@ -114,3 +133,3 @@ var storeState = _this.store.getState(); | ||
var nextStateProps = computeStateProps(this.store, this.props); | ||
if (this.stateProps && shallowEqual(nextStateProps, this.stateProps)) { | ||
if (this.stateProps && (0, _shallowEqual2["default"])(nextStateProps, this.stateProps)) { | ||
return false; | ||
@@ -125,3 +144,3 @@ } | ||
var nextDispatchProps = computeDispatchProps(this.store, this.props); | ||
if (this.dispatchProps && shallowEqual(nextDispatchProps, this.dispatchProps)) { | ||
if (this.dispatchProps && (0, _shallowEqual2["default"])(nextDispatchProps, this.dispatchProps)) { | ||
return false; | ||
@@ -161,3 +180,3 @@ } | ||
Connect.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
if (!pure || !shallowEqual(nextProps, this.props)) { | ||
if (!pure || !(0, _shallowEqual2["default"])(nextProps, this.props)) { | ||
this.haveOwnPropsChanged = true; | ||
@@ -196,3 +215,3 @@ } | ||
Connect.prototype.getWrappedInstance = function getWrappedInstance() { | ||
invariant(withRef, 'To access the wrapped instance, you need to specify ' + '{ withRef: true } as the fourth argument of the connect() call.'); | ||
(0, _invariant2["default"])(withRef, 'To access the wrapped instance, you need to specify ' + '{ withRef: true } as the fourth argument of the connect() call.'); | ||
@@ -238,7 +257,7 @@ return this.refs.wrappedInstance; | ||
if (withRef) { | ||
this.renderedElement = createElement(WrappedComponent, _extends({}, this.mergedProps, { | ||
this.renderedElement = (0, _react.createElement)(WrappedComponent, _extends({}, this.mergedProps, { | ||
ref: 'wrappedInstance' | ||
})); | ||
} else { | ||
this.renderedElement = createElement(WrappedComponent, this.mergedProps); | ||
this.renderedElement = (0, _react.createElement)(WrappedComponent, this.mergedProps); | ||
} | ||
@@ -250,3 +269,3 @@ | ||
return Connect; | ||
}(Component); | ||
}(_react.Component); | ||
@@ -256,6 +275,6 @@ Connect.displayName = 'Connect(' + getDisplayName(WrappedComponent) + ')'; | ||
Connect.contextTypes = { | ||
store: storeShape | ||
store: _storeShape2["default"] | ||
}; | ||
Connect.propTypes = { | ||
store: storeShape | ||
store: _storeShape2["default"] | ||
}; | ||
@@ -276,6 +295,4 @@ | ||
return hoistStatics(Connect, WrappedComponent); | ||
return (0, _hoistNonReactStatics2["default"])(Connect, WrappedComponent); | ||
}; | ||
} | ||
module.exports = connect; | ||
} |
'use strict'; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
exports.__esModule = true; | ||
exports["default"] = undefined; | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
var _react = require('react'); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var _storeShape = require('../utils/storeShape'); | ||
var _require = require('react'); | ||
var _storeShape2 = _interopRequireDefault(_storeShape); | ||
var Component = _require.Component; | ||
var PropTypes = _require.PropTypes; | ||
var Children = _require.Children; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var storeShape = require('../utils/storeShape'); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
if (process.env.NODE_ENV !== 'production') { | ||
var warnAboutReceivingStore; | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
(function () { | ||
var didWarnAboutReceivingStore = false; | ||
/* eslint-disable no-var */ | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
warnAboutReceivingStore = function warnAboutReceivingStore() { | ||
/* eslint-enable no-var */ | ||
if (didWarnAboutReceivingStore) { | ||
return; | ||
} | ||
didWarnAboutReceivingStore = true; | ||
var didWarnAboutReceivingStore = false; | ||
function warnAboutReceivingStore() { | ||
if (didWarnAboutReceivingStore) { | ||
return; | ||
} | ||
didWarnAboutReceivingStore = true; | ||
/* eslint-disable no-console */ | ||
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/rackt/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.'); | ||
} | ||
/* eslint-disable no-console */ | ||
}; | ||
})(); | ||
/* eslint-disable no-console */ | ||
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/rackt/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.'); | ||
} | ||
/* eslint-disable no-console */ | ||
} | ||
@@ -59,8 +53,10 @@ | ||
return Children.only(children); | ||
return _react.Children.only(children); | ||
}; | ||
return Provider; | ||
}(Component); | ||
}(_react.Component); | ||
exports["default"] = Provider; | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -78,9 +74,7 @@ Provider.prototype.componentWillReceiveProps = function (nextProps) { | ||
Provider.propTypes = { | ||
store: storeShape.isRequired, | ||
children: PropTypes.element.isRequired | ||
store: _storeShape2["default"].isRequired, | ||
children: _react.PropTypes.element.isRequired | ||
}; | ||
Provider.childContextTypes = { | ||
store: storeShape.isRequired | ||
}; | ||
module.exports = Provider; | ||
store: _storeShape2["default"].isRequired | ||
}; |
'use strict'; | ||
var Provider = require('./components/Provider'); | ||
var connect = require('./components/connect'); | ||
exports.__esModule = true; | ||
exports.connect = exports.Provider = undefined; | ||
module.exports = { Provider: Provider, connect: connect }; | ||
var _Provider = require('./components/Provider'); | ||
var _Provider2 = _interopRequireDefault(_Provider); | ||
var _connect = require('./components/connect'); | ||
var _connect2 = _interopRequireDefault(_connect); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
exports.Provider = _Provider2["default"]; | ||
exports.connect = _connect2["default"]; |
"use strict"; | ||
exports.__esModule = true; | ||
exports["default"] = shallowEqual; | ||
function shallowEqual(objA, objB) { | ||
@@ -24,4 +26,2 @@ if (objA === objB) { | ||
return true; | ||
} | ||
module.exports = shallowEqual; | ||
} |
'use strict'; | ||
var _require = require('react'); | ||
exports.__esModule = true; | ||
var PropTypes = _require.PropTypes; | ||
var _react = require('react'); | ||
var storeShape = PropTypes.shape({ | ||
subscribe: PropTypes.func.isRequired, | ||
dispatch: PropTypes.func.isRequired, | ||
getState: PropTypes.func.isRequired | ||
}); | ||
module.exports = storeShape; | ||
exports["default"] = _react.PropTypes.shape({ | ||
subscribe: _react.PropTypes.func.isRequired, | ||
dispatch: _react.PropTypes.func.isRequired, | ||
getState: _react.PropTypes.func.isRequired | ||
}); |
'use strict'; | ||
exports.__esModule = true; | ||
exports["default"] = wrapActionCreators; | ||
var _redux = require('redux'); | ||
@@ -9,4 +12,2 @@ | ||
}; | ||
} | ||
module.exports = wrapActionCreators; | ||
} |
{ | ||
"name": "react-redux", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"description": "Official React bindings for Redux", | ||
@@ -11,7 +11,7 @@ "main": "./lib/index.js", | ||
"build:umd:min": "cross-env NODE_ENV=production webpack src/index.js dist/react-redux.min.js", | ||
"build": "npm run build:lib && npm run build:umd && npm run build:umd:min", | ||
"build": "npm run build:lib && npm run build:umd && npm run build:umd:min && node ./prepublish", | ||
"clean": "rimraf lib dist coverage", | ||
"lint": "eslint src test", | ||
"prepublish": "npm run clean && npm run build", | ||
"test": "mocha --compilers js:babel-core/register --recursive --require ./test/setup.js", | ||
"test": "mocha --compilers js:babel-register --recursive --require ./test/setup.js", | ||
"test:watch": "npm test -- --watch", | ||
@@ -49,9 +49,30 @@ "test:cov": "babel-node ./node_modules/isparta/bin/isparta cover ./node_modules/mocha/bin/_mocha -- --recursive" | ||
"babel-core": "^6.3.26", | ||
"babel-eslint": "^5.0.0-beta4", | ||
"babel-eslint": "^5.0.0-beta9", | ||
"babel-loader": "^6.2.0", | ||
"babel-plugin-check-es2015-constants": "^6.3.13", | ||
"babel-plugin-syntax-jsx": "^6.3.13", | ||
"babel-plugin-transform-decorators-legacy": "^1.2.0", | ||
"babel-preset-es2015-loose": "^6.1.4", | ||
"babel-preset-react": "^6.3.13", | ||
"babel-preset-stage-0": "^6.3.13", | ||
"babel-plugin-transform-es2015-arrow-functions": "^6.3.13", | ||
"babel-plugin-transform-es2015-block-scoped-functions": "^6.3.13", | ||
"babel-plugin-transform-es2015-block-scoping": "^6.3.13", | ||
"babel-plugin-transform-es2015-classes": "^6.3.13", | ||
"babel-plugin-transform-es2015-computed-properties": "^6.3.13", | ||
"babel-plugin-transform-es2015-destructuring": "^6.3.13", | ||
"babel-plugin-transform-es2015-for-of": "^6.3.13", | ||
"babel-plugin-transform-es2015-function-name": "^6.3.13", | ||
"babel-plugin-transform-es2015-literals": "^6.3.13", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.3.13", | ||
"babel-plugin-transform-es2015-object-super": "^6.3.13", | ||
"babel-plugin-transform-es2015-parameters": "^6.3.13", | ||
"babel-plugin-transform-es2015-shorthand-properties": "^6.3.13", | ||
"babel-plugin-transform-es2015-spread": "^6.3.13", | ||
"babel-plugin-transform-es2015-sticky-regex": "^6.3.13", | ||
"babel-plugin-transform-es2015-template-literals": "^6.3.13", | ||
"babel-plugin-transform-es2015-unicode-regex": "^6.3.13", | ||
"babel-plugin-transform-object-rest-spread": "^6.3.13", | ||
"babel-plugin-transform-react-display-name": "^6.4.0", | ||
"babel-plugin-transform-react-jsx": "^6.4.0", | ||
"babel-register": "^6.3.13", | ||
"cross-env": "^1.0.7", | ||
"es3ify": "^0.2.0", | ||
"eslint": "^1.7.1", | ||
@@ -61,2 +82,3 @@ "eslint-config-rackt": "1.1.0", | ||
"expect": "^1.8.0", | ||
"glob": "^6.0.4", | ||
"isparta": "4.0.0", | ||
@@ -76,3 +98,3 @@ "istanbul": "^0.3.17", | ||
"invariant": "^2.0.0", | ||
"lodash": "^4.1.0", | ||
"lodash": "^4.2.0", | ||
"loose-envify": "^1.1.0" | ||
@@ -79,0 +101,0 @@ }, |
@@ -1,8 +0,8 @@ | ||
const { Component, createElement } = require('react') | ||
const storeShape = require('../utils/storeShape') | ||
const shallowEqual = require('../utils/shallowEqual') | ||
const wrapActionCreators = require('../utils/wrapActionCreators') | ||
const isPlainObject = require('lodash/isPlainObject') | ||
const hoistStatics = require('hoist-non-react-statics') | ||
const invariant = require('invariant') | ||
import { Component, createElement } from 'react' | ||
import storeShape from '../utils/storeShape' | ||
import shallowEqual from '../utils/shallowEqual' | ||
import wrapActionCreators from '../utils/wrapActionCreators' | ||
import isPlainObject from 'lodash/isPlainObject' | ||
import hoistStatics from 'hoist-non-react-statics' | ||
import invariant from 'invariant' | ||
@@ -24,3 +24,3 @@ const defaultMapStateToProps = state => ({}) // eslint-disable-line no-unused-vars | ||
function connect(mapStateToProps, mapDispatchToProps, mergeProps, options = {}) { | ||
export default function connect(mapStateToProps, mapDispatchToProps, mergeProps, options = {}) { | ||
const shouldSubscribe = Boolean(mapStateToProps) | ||
@@ -134,3 +134,3 @@ const finalMapStateToProps = mapStateToProps || defaultMapStateToProps | ||
if (shouldSubscribe && !this.unsubscribe) { | ||
this.unsubscribe = this.store.subscribe(::this.handleChange) | ||
this.unsubscribe = this.store.subscribe(this.handleChange.bind(this)) | ||
this.handleChange() | ||
@@ -278,3 +278,1 @@ } | ||
} | ||
module.exports = connect |
@@ -1,29 +0,25 @@ | ||
const { Component, PropTypes, Children } = require('react') | ||
const storeShape = require('../utils/storeShape') | ||
import { Component, PropTypes, Children } from 'react' | ||
import storeShape from '../utils/storeShape' | ||
if (process.env.NODE_ENV !== 'production') { | ||
let didWarnAboutReceivingStore = false | ||
/* eslint-disable no-var */ | ||
var warnAboutReceivingStore = function () { | ||
/* eslint-enable no-var */ | ||
if (didWarnAboutReceivingStore) { | ||
return | ||
} | ||
didWarnAboutReceivingStore = true | ||
let didWarnAboutReceivingStore = false | ||
function warnAboutReceivingStore() { | ||
if (didWarnAboutReceivingStore) { | ||
return | ||
} | ||
didWarnAboutReceivingStore = true | ||
/* eslint-disable no-console */ | ||
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/rackt/react-redux/releases/' + | ||
'tag/v2.0.0 for the migration instructions.' | ||
) | ||
} | ||
/* eslint-disable no-console */ | ||
/* eslint-disable no-console */ | ||
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/rackt/react-redux/releases/' + | ||
'tag/v2.0.0 for the migration instructions.' | ||
) | ||
} | ||
/* eslint-disable no-console */ | ||
} | ||
class Provider extends Component { | ||
export default class Provider extends Component { | ||
getChildContext() { | ||
@@ -62,3 +58,1 @@ return { store: this.store } | ||
} | ||
module.exports = Provider |
@@ -1,4 +0,4 @@ | ||
const Provider = require('./components/Provider') | ||
const connect = require('./components/connect') | ||
import Provider from './components/Provider' | ||
import connect from './components/connect' | ||
module.exports = { Provider, connect } | ||
export { Provider, connect } |
@@ -1,2 +0,2 @@ | ||
function shallowEqual(objA, objB) { | ||
export default function shallowEqual(objA, objB) { | ||
if (objA === objB) { | ||
@@ -24,3 +24,1 @@ return true | ||
} | ||
module.exports = shallowEqual |
@@ -1,4 +0,4 @@ | ||
const { PropTypes } = require('react') | ||
import { PropTypes } from 'react' | ||
const storeShape = PropTypes.shape({ | ||
export default PropTypes.shape({ | ||
subscribe: PropTypes.func.isRequired, | ||
@@ -8,3 +8,1 @@ dispatch: PropTypes.func.isRequired, | ||
}) | ||
module.exports = storeShape |
import { bindActionCreators } from 'redux' | ||
function wrapActionCreators(actionCreators) { | ||
export default function wrapActionCreators(actionCreators) { | ||
return dispatch => bindActionCreators(actionCreators, dispatch) | ||
} | ||
module.exports = wrapActionCreators |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
65967
1217
5
0
45
Updatedlodash@^4.2.0