redux-devtools
Advanced tools
Comparing version 3.4.2 to 3.5.0-beta
@@ -31,2 +31,10 @@ 'use strict'; | ||
function logError(type) { | ||
if (type === 'NoStore') { | ||
console.error('Redux DevTools could not render. You must pass the Redux store ' + 'to <DevTools> either as a "store" prop or by wrapping it in a ' + '<Provider store={store}>.'); | ||
} else { | ||
console.error('Redux DevTools could not render. Did you forget to include ' + 'DevTools.instrument() in your store enhancer chain before ' + 'using createStore()?'); | ||
} | ||
} | ||
function createDevTools(children) { | ||
@@ -50,4 +58,11 @@ var _class, _temp; | ||
if (_reactRedux.ReactReduxContext) { | ||
if (_this.props.store && !_this.props.store.liftedStore) { | ||
logError('NoLiftedStore'); | ||
} | ||
return _possibleConstructorReturn(_this); | ||
} | ||
if (!props.store && !context.store) { | ||
console.error('Redux DevTools could not render. You must pass the Redux store ' + 'to <DevTools> either as a "store" prop or by wrapping it in a ' + '<Provider store={store}>.'); | ||
logError('NoStore'); | ||
return _possibleConstructorReturn(_this); | ||
@@ -63,3 +78,3 @@ } | ||
if (!_this.liftedStore) { | ||
console.error('Redux DevTools could not render. Did you forget to include ' + 'DevTools.instrument() in your store enhancer chain before ' + 'using createStore()?'); | ||
logError('NoLiftedStore'); | ||
} | ||
@@ -70,2 +85,35 @@ return _this; | ||
DevTools.prototype.render = function render() { | ||
if (_reactRedux.ReactReduxContext) { | ||
// For react-redux@6 | ||
if (this.props.store) { | ||
if (!this.props.store.liftedStore) { | ||
return null; | ||
} | ||
return _react2.default.createElement( | ||
_reactRedux.Provider, | ||
{ store: this.props.store.liftedStore }, | ||
_react2.default.createElement(ConnectedMonitor, monitorProps) | ||
); | ||
} | ||
return _react2.default.createElement( | ||
_reactRedux.ReactReduxContext.Consumer, | ||
null, | ||
function (props) { | ||
if (!props || !props.store) { | ||
logError('NoStore'); | ||
return null; | ||
} | ||
if (!props.store.liftedStore) { | ||
logError('NoLiftedStore'); | ||
return null; | ||
} | ||
return _react2.default.createElement( | ||
_reactRedux.Provider, | ||
{ store: props.store.liftedStore }, | ||
_react2.default.createElement(ConnectedMonitor, monitorProps) | ||
); | ||
} | ||
); | ||
} | ||
if (!this.liftedStore) { | ||
@@ -75,4 +123,3 @@ return null; | ||
return _react2.default.createElement(ConnectedMonitor, _extends({}, monitorProps, { | ||
store: this.liftedStore })); | ||
return _react2.default.createElement(ConnectedMonitor, _extends({}, monitorProps, { store: this.liftedStore })); | ||
}; | ||
@@ -79,0 +126,0 @@ |
{ | ||
"name": "redux-devtools", | ||
"version": "3.4.2", | ||
"version": "3.5.0-beta", | ||
"description": "Redux DevTools with hot reloading and time travel", | ||
@@ -13,3 +13,4 @@ "main": "lib/index.js", | ||
"test:cov": "babel-node ./node_modules/.bin/isparta cover ./node_modules/.bin/_mocha -- --recursive", | ||
"prepublish": "npm run lint && npm run test && npm run clean && npm run build" | ||
"prepare": "npm run build", | ||
"prepublishOnly": "npm run lint && npm run test && npm run clean && npm run build" | ||
}, | ||
@@ -22,3 +23,3 @@ "files": [ | ||
"type": "git", | ||
"url": "https://github.com/gaearon/redux-devtools.git" | ||
"url": "https://github.com/reduxjs/redux-devtools.git" | ||
}, | ||
@@ -36,5 +37,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/gaearon/redux-devtools/issues" | ||
"url": "https://github.com/reduxjs/redux-devtools/issues" | ||
}, | ||
"homepage": "https://github.com/gaearon/redux-devtools", | ||
"homepage": "https://github.com/reduxjs/redux-devtools", | ||
"devDependencies": { | ||
@@ -57,7 +58,6 @@ "babel-cli": "^6.3.17", | ||
"mocha-jsdom": "^1.0.0", | ||
"react": "^0.14.9", | ||
"react-addons-test-utils": "^0.14.0", | ||
"react-dom": "^0.14.0", | ||
"react-redux": "^4.0.0", | ||
"redux": "^3.5.2", | ||
"react": "^16.0.0", | ||
"react-dom": "^16.0.0", | ||
"react-redux": "^6.0.0", | ||
"redux": "^4.0.0", | ||
"rimraf": "^2.3.4", | ||
@@ -68,3 +68,3 @@ "webpack": "^1.11.0" | ||
"react": "^0.14.9 || ^15.3.0 || ^16.0.0", | ||
"react-redux": "^4.0.0 || ^5.0.0", | ||
"react-redux": "^4.0.0 || ^5.0.0 || ^6.0.0", | ||
"redux": "^3.5.2 || ^4.0.0" | ||
@@ -71,0 +71,0 @@ }, |
@@ -18,3 +18,3 @@ Redux DevTools | ||
[![build status](https://img.shields.io/travis/gaearon/redux-devtools/master.svg?style=flat-square)](https://travis-ci.org/gaearon/redux-devtools) | ||
[![build status](https://img.shields.io/travis/reduxjs/redux-devtools/master.svg?style=flat-square)](https://travis-ci.org/reduxjs/redux-devtools) | ||
[![npm version](https://img.shields.io/npm/v/redux-devtools.svg?style=flat-square)](https://www.npmjs.com/package/redux-devtools) | ||
@@ -53,7 +53,7 @@ [![npm downloads](https://img.shields.io/npm/dm/redux-devtools.svg?style=flat-square)](https://www.npmjs.com/package/redux-devtools) | ||
``` | ||
git clone https://github.com/gaearon/redux-devtools.git | ||
cd redux-devtools | ||
git clone https://github.com/reduxjs/redux-devtools.git | ||
cd redux-devtools/packages/redux-devtools | ||
``` | ||
Run `npm install` in the root folder: | ||
Run `npm install` in the package folder: | ||
@@ -86,3 +86,3 @@ ``` | ||
**[I challenge you to build a custom monitor for Redux DevTools!](https://github.com/gaearon/redux-devtools/issues/3)** | ||
**[I challenge you to build a custom monitor for Redux DevTools!](https://github.com/reduxjs/redux-devtools/issues/3)** | ||
@@ -89,0 +89,0 @@ Some crazy ideas for custom monitors: |
import React, { Children, Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { connect } from 'react-redux'; | ||
import { connect, Provider, ReactReduxContext } from 'react-redux'; | ||
import instrument from 'redux-devtools-instrument'; | ||
function logError(type) { | ||
if (type === 'NoStore') { | ||
console.error( | ||
'Redux DevTools could not render. You must pass the Redux store ' + | ||
'to <DevTools> either as a "store" prop or by wrapping it in a ' + | ||
'<Provider store={store}>.' | ||
); | ||
} else { | ||
console.error( | ||
'Redux DevTools could not render. Did you forget to include ' + | ||
'DevTools.instrument() in your store enhancer chain before ' + | ||
'using createStore()?' | ||
); | ||
} | ||
} | ||
export default function createDevTools(children) { | ||
@@ -29,8 +45,11 @@ const monitorElement = Children.only(children); | ||
if (ReactReduxContext) { | ||
if (this.props.store && !this.props.store.liftedStore) { | ||
logError('NoLiftedStore'); | ||
} | ||
return; | ||
} | ||
if (!props.store && !context.store) { | ||
console.error( | ||
'Redux DevTools could not render. You must pass the Redux store ' + | ||
'to <DevTools> either as a "store" prop or by wrapping it in a ' + | ||
'<Provider store={store}>.' | ||
); | ||
logError('NoStore'); | ||
return; | ||
@@ -46,7 +65,3 @@ } | ||
if (!this.liftedStore) { | ||
console.error( | ||
'Redux DevTools could not render. Did you forget to include ' + | ||
'DevTools.instrument() in your store enhancer chain before ' + | ||
'using createStore()?' | ||
); | ||
logError('NoLiftedStore'); | ||
} | ||
@@ -56,2 +71,35 @@ } | ||
render() { | ||
if (ReactReduxContext) { | ||
// For react-redux@6 | ||
if (this.props.store) { | ||
if (!this.props.store.liftedStore) { | ||
return null; | ||
} | ||
return ( | ||
<Provider store={this.props.store.liftedStore}> | ||
<ConnectedMonitor {...monitorProps} /> | ||
</Provider> | ||
); | ||
} | ||
return ( | ||
<ReactReduxContext.Consumer> | ||
{props => { | ||
if (!props || !props.store) { | ||
logError('NoStore'); | ||
return null; | ||
} | ||
if (!props.store.liftedStore) { | ||
logError('NoLiftedStore'); | ||
return null; | ||
} | ||
return ( | ||
<Provider store={props.store.liftedStore}> | ||
<ConnectedMonitor {...monitorProps} /> | ||
</Provider> | ||
); | ||
}} | ||
</ReactReduxContext.Consumer> | ||
); | ||
} | ||
if (!this.liftedStore) { | ||
@@ -62,4 +110,3 @@ return null; | ||
return ( | ||
<ConnectedMonitor {...monitorProps} | ||
store={this.liftedStore} /> | ||
<ConnectedMonitor {...monitorProps} store={this.liftedStore} /> | ||
); | ||
@@ -66,0 +113,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
23274
22
358
0
9
1