diff --git a/packages/redux-devtools-inspector/demo/src/.noderequirer.json b/packages/redux-devtools-inspector/demo/src/.noderequirer.json deleted file mode 100644 index 20e76308..00000000 --- a/packages/redux-devtools-inspector/demo/src/.noderequirer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "import": true -} diff --git a/packages/redux-devtools-inspector/demo/src/js/DemoApp.jsx b/packages/redux-devtools-inspector/demo/src/js/DemoApp.jsx index 9786fdf6..24db5c7d 100644 --- a/packages/redux-devtools-inspector/demo/src/js/DemoApp.jsx +++ b/packages/redux-devtools-inspector/demo/src/js/DemoApp.jsx @@ -12,7 +12,7 @@ import InputGroup from 'react-bootstrap/lib/InputGroup'; import * as base16 from 'base16'; import * as inspectorThemes from '../../../src/themes'; import getOptions from './getOptions'; -import { push as pushRoute } from 'react-router-redux'; +import { push as pushRoute } from 'connected-react-router'; const styles = { wrapper: { @@ -85,7 +85,7 @@ function buildUrl(options) { class DemoApp extends React.Component { render() { - const options = getOptions(); + const options = getOptions(this.props.router.location); return (
@@ -193,7 +193,7 @@ class DemoApp extends React.Component {
{(options.useExtension ? 'Disable' : 'Enable') + - ' Chrome Extension'} + ' Chrome Extension (will reload this page)'} {(options.supportImmutable ? 'Disable' : 'Enable') + @@ -205,15 +205,16 @@ class DemoApp extends React.Component { } toggleExtension = () => { - const options = getOptions(); + const options = getOptions(this.props.router.location); - this.props.pushRoute( - buildUrl({ ...options, useExtension: !options.useExtension }) - ); + window.location.href = buildUrl({ + ...options, + useExtension: !options.useExtension, + }); }; toggleImmutableSupport = () => { - const options = getOptions(); + const options = getOptions(this.props.router.location); this.props.pushRoute( buildUrl({ ...options, supportImmutable: !options.supportImmutable }) @@ -221,7 +222,7 @@ class DemoApp extends React.Component { }; toggleTheme = () => { - const options = getOptions(); + const options = getOptions(this.props.router.location); this.props.pushRoute(buildUrl({ ...options, dark: !options.dark })); }; diff --git a/packages/redux-devtools-inspector/demo/src/js/DevTools.jsx b/packages/redux-devtools-inspector/demo/src/js/DevTools.jsx new file mode 100644 index 00000000..54ec696b --- /dev/null +++ b/packages/redux-devtools-inspector/demo/src/js/DevTools.jsx @@ -0,0 +1,56 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import { createDevTools } from 'redux-devtools'; +import DockMonitor from 'redux-devtools-dock-monitor'; +import DevtoolsInspector from '../../../src/DevtoolsInspector'; +import getOptions from './getOptions'; + +const CustomComponent = () => ( +
+
Custom Tab Content
+
+); + +export const getDevTools = (location) => + createDevTools( + + [ + { + name: 'Custom Tab', + component: CustomComponent, + }, + ...defaultTabs, + ]} + /> + + ); + +const UnconnectedDevTools = ({ location }) => { + const DevTools = getDevTools(location); + return ; +}; + +const mapStateToProps = (state) => ({ + location: state.router.location, +}); + +export const ConnectedDevTools = connect(mapStateToProps)(UnconnectedDevTools); diff --git a/packages/redux-devtools-inspector/demo/src/js/getOptions.js b/packages/redux-devtools-inspector/demo/src/js/getOptions.js index f18e133d..b26e8222 100644 --- a/packages/redux-devtools-inspector/demo/src/js/getOptions.js +++ b/packages/redux-devtools-inspector/demo/src/js/getOptions.js @@ -1,11 +1,11 @@ -export default function getOptions() { +export default function getOptions(location) { return { - useExtension: window.location.search.indexOf('ext') !== -1, - supportImmutable: window.location.search.indexOf('immutable') !== -1, + useExtension: location.search.indexOf('ext') !== -1, + supportImmutable: location.search.indexOf('immutable') !== -1, theme: do { - const match = window.location.search.match(/theme=([^&]+)/); + const match = location.search.match(/theme=([^&]+)/); match ? match[1] : 'inspector'; }, - dark: window.location.search.indexOf('dark') !== -1, + dark: location.search.indexOf('dark') !== -1, }; } diff --git a/packages/redux-devtools-inspector/demo/src/js/index.js b/packages/redux-devtools-inspector/demo/src/js/index.js index cf32cff1..bf54b977 100644 --- a/packages/redux-devtools-inspector/demo/src/js/index.js +++ b/packages/redux-devtools-inspector/demo/src/js/index.js @@ -3,76 +3,35 @@ import React from 'react'; import { render } from 'react-dom'; import DemoApp from './DemoApp'; import { Provider } from 'react-redux'; -import reducers from './reducers'; -import { createStore, applyMiddleware, compose, combineReducers } from 'redux'; +import createRootReducer from './reducers'; +import { createStore, applyMiddleware, compose } from 'redux'; import logger from 'redux-logger'; -import { Router, Route, browserHistory } from 'react-router'; -import { - syncHistoryWithStore, - routerReducer, - routerMiddleware, -} from 'react-router-redux'; -import { createDevTools, persistState } from 'redux-devtools'; -import DevtoolsInspector from '../../../src/DevtoolsInspector'; -import DockMonitor from 'redux-devtools-dock-monitor'; +import { Route } from 'react-router'; +import { createBrowserHistory } from 'history'; +import { ConnectedRouter, routerMiddleware } from 'connected-react-router'; +import { persistState } from 'redux-devtools'; import getOptions from './getOptions'; +import { ConnectedDevTools, getDevTools } from './DevTools'; function getDebugSessionKey() { const matches = window.location.href.match(/[?&]debug_session=([^&#]+)\b/); return matches && matches.length > 0 ? matches[1] : null; } -const CustomComponent = () => ( -
-
Custom Tab Content
-
-); - -const getDevTools = (options) => - createDevTools( - - [ - { - name: 'Custom Tab', - component: CustomComponent, - }, - ...defaultTabs, - ]} - /> - - ); - const ROOT = process.env.NODE_ENV === 'production' ? '/redux-devtools-inspector/' : '/'; -let DevTools = getDevTools(getOptions()); +const DevTools = getDevTools(window.location); -const reduxRouterMiddleware = routerMiddleware(browserHistory); +const history = createBrowserHistory(); + +const useDevtoolsExtension = + !!window.__REDUX_DEVTOOLS_EXTENSION__ && + getOptions(window.location).useExtension; const enhancer = compose( - applyMiddleware(logger, reduxRouterMiddleware), + applyMiddleware(logger, routerMiddleware(history)), (...args) => { - const useDevtoolsExtension = - !!window.__REDUX_DEVTOOLS_EXTENSION__ && getOptions().useExtension; const instrument = useDevtoolsExtension ? window.__REDUX_DEVTOOLS_EXTENSION__() : DevTools.instrument(); @@ -81,41 +40,16 @@ const enhancer = compose( persistState(getDebugSessionKey()) ); -const store = createStore( - combineReducers({ - ...reducers, - routing: routerReducer, - }), - {}, - enhancer +const store = createStore(createRootReducer(history), {}, enhancer); + +render( + + + + + + {!useDevtoolsExtension && } + + , + document.getElementById('root') ); - -const history = syncHistoryWithStore(browserHistory, store); - -const handleRouterUpdate = () => { - renderApp(getOptions()); -}; - -const router = ( - - - -); - -const renderApp = (options) => { - DevTools = getDevTools(options); - const useDevtoolsExtension = - !!window.__REDUX_DEVTOOLS_EXTENSION__ && options.useExtension; - - return render( - -
- {router} - {!useDevtoolsExtension && } -
-
, - document.getElementById('root') - ); -}; - -renderApp(getOptions()); diff --git a/packages/redux-devtools-inspector/demo/src/js/reducers.js b/packages/redux-devtools-inspector/demo/src/js/reducers.js index 30d27612..aa7be2d1 100644 --- a/packages/redux-devtools-inspector/demo/src/js/reducers.js +++ b/packages/redux-devtools-inspector/demo/src/js/reducers.js @@ -1,5 +1,7 @@ import Immutable from 'immutable'; import shuffle from 'lodash.shuffle'; +import { combineReducers } from 'redux'; +import { connectRouter } from 'connected-react-router'; const NESTED = { long: { @@ -77,66 +79,70 @@ function createIterator() { const DEFAULT_SHUFFLE_ARRAY = [0, 1, null, { id: 1 }, { id: 2 }, 'string']; -export default { - timeoutUpdateEnabled: (state = false, action) => - action.type === 'TOGGLE_TIMEOUT_UPDATE' - ? action.timeoutUpdateEnabled - : state, - store: (state = 0, action) => - action.type === 'INCREMENT' ? state + 1 : state, - undefined: (state = { val: undefined }) => state, - null: (state = null) => state, - func: (state = () => {}) => state, - array: (state = [], action) => - action.type === 'PUSH' - ? [...state, Math.random()] - : action.type === 'POP' - ? state.slice(0, state.length - 1) - : action.type === 'REPLACE' - ? [Math.random(), ...state.slice(1)] - : state, - hugeArrays: (state = [], action) => - action.type === 'PUSH_HUGE_ARRAY' ? [...state, ...HUGE_ARRAY] : state, - hugeObjects: (state = [], action) => - action.type === 'ADD_HUGE_OBJECT' ? [...state, HUGE_OBJECT] : state, - iterators: (state = [], action) => - action.type === 'ADD_ITERATOR' ? [...state, createIterator()] : state, - nested: (state = NESTED, action) => - action.type === 'CHANGE_NESTED' - ? { - ...state, - long: { - nested: [ - { - path: { - to: { - a: state.long.nested[0].path.to.a + '!', +const createRootReducer = (history) => + combineReducers({ + router: connectRouter(history), + timeoutUpdateEnabled: (state = false, action) => + action.type === 'TOGGLE_TIMEOUT_UPDATE' + ? action.timeoutUpdateEnabled + : state, + store: (state = 0, action) => + action.type === 'INCREMENT' ? state + 1 : state, + undefined: (state = { val: undefined }) => state, + null: (state = null) => state, + func: (state = () => {}) => state, + array: (state = [], action) => + action.type === 'PUSH' + ? [...state, Math.random()] + : action.type === 'POP' + ? state.slice(0, state.length - 1) + : action.type === 'REPLACE' + ? [Math.random(), ...state.slice(1)] + : state, + hugeArrays: (state = [], action) => + action.type === 'PUSH_HUGE_ARRAY' ? [...state, ...HUGE_ARRAY] : state, + hugeObjects: (state = [], action) => + action.type === 'ADD_HUGE_OBJECT' ? [...state, HUGE_OBJECT] : state, + iterators: (state = [], action) => + action.type === 'ADD_ITERATOR' ? [...state, createIterator()] : state, + nested: (state = NESTED, action) => + action.type === 'CHANGE_NESTED' + ? { + ...state, + long: { + nested: [ + { + path: { + to: { + a: state.long.nested[0].path.to.a + '!', + }, }, }, - }, - ], - }, - } - : state, - recursive: (state = [], action) => - action.type === 'ADD_RECURSIVE' ? [...state, { ...RECURSIVE }] : state, - immutables: (state = [], action) => - action.type === 'ADD_IMMUTABLE_MAP' ? [...state, IMMUTABLE_MAP] : state, - maps: (state = [], action) => - action.type === 'ADD_NATIVE_MAP' ? [...state, NATIVE_MAP] : state, - immutableNested: (state = IMMUTABLE_NESTED, action) => - action.type === 'CHANGE_IMMUTABLE_NESTED' - ? state.updateIn( - ['long', 'nested', 0, 'path', 'to', 'a'], - (str) => str + '!' - ) - : state, - addFunction: (state = null, action) => - action.type === 'ADD_FUNCTION' ? { f: FUNC } : state, - addSymbol: (state = null, action) => - action.type === 'ADD_SYMBOL' - ? { s: window.Symbol('symbol'), error: new Error('TEST') } - : state, - shuffleArray: (state = DEFAULT_SHUFFLE_ARRAY, action) => - action.type === 'SHUFFLE_ARRAY' ? shuffle(state) : state, -}; + ], + }, + } + : state, + recursive: (state = [], action) => + action.type === 'ADD_RECURSIVE' ? [...state, { ...RECURSIVE }] : state, + immutables: (state = [], action) => + action.type === 'ADD_IMMUTABLE_MAP' ? [...state, IMMUTABLE_MAP] : state, + maps: (state = [], action) => + action.type === 'ADD_NATIVE_MAP' ? [...state, NATIVE_MAP] : state, + immutableNested: (state = IMMUTABLE_NESTED, action) => + action.type === 'CHANGE_IMMUTABLE_NESTED' + ? state.updateIn( + ['long', 'nested', 0, 'path', 'to', 'a'], + (str) => str + '!' + ) + : state, + addFunction: (state = null, action) => + action.type === 'ADD_FUNCTION' ? { f: FUNC } : state, + addSymbol: (state = null, action) => + action.type === 'ADD_SYMBOL' + ? { s: window.Symbol('symbol'), error: new Error('TEST') } + : state, + shuffleArray: (state = DEFAULT_SHUFFLE_ARRAY, action) => + action.type === 'SHUFFLE_ARRAY' ? shuffle(state) : state, + }); + +export default createRootReducer; diff --git a/packages/redux-devtools-inspector/package.json b/packages/redux-devtools-inspector/package.json index e3389a18..df7309f4 100644 --- a/packages/redux-devtools-inspector/package.json +++ b/packages/redux-devtools-inspector/package.json @@ -33,21 +33,24 @@ "babel-loader": "^8.1.0", "base16": "^1.0.0", "clean-webpack-plugin": "^3.0.0", + "connected-react-router": "^6.8.0", "cross-env": "^7.0.2", + "history": "^4.10.1", "html-webpack-plugin": "^4.3.0", "immutable": "^4.0.0-rc.12", + "lodash.isequalwith": "^4.4.0", "lodash.shuffle": "^4.2.0", "react": "^16.13.1", "react-bootstrap": "^0.30.10", "react-dom": "^16.13.1", "react-redux": "^7.2.1", - "react-router": "^3.2.6", - "react-router-redux": "^4.0.8", + "react-router": "^5.2.0", "react-transform-hmr": "^1.0.4", "redux": "^4.0.5", "redux-devtools": "^3.6.0", "redux-devtools-dock-monitor": "^1.1.3", "redux-logger": "^3.0.6", + "seamless-immutable": "^7.1.4", "webpack": "^4.44.1", "webpack-cli": "^3.3.12", "webpack-dev-server": "^3.11.0" diff --git a/packages/redux-devtools-test-generator/demo/src/js/DemoApp.jsx b/packages/redux-devtools-test-generator/demo/src/js/DemoApp.jsx index 70bdc712..8b6cb822 100644 --- a/packages/redux-devtools-test-generator/demo/src/js/DemoApp.jsx +++ b/packages/redux-devtools-test-generator/demo/src/js/DemoApp.jsx @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import pkg from '../../../package.json'; import { Button, Toolbar, Spacer } from 'devui'; import getOptions from './getOptions'; -import { push as pushRoute } from 'react-router-redux'; +import { push as pushRoute } from 'connected-react-router'; const styles = { wrapper: { @@ -26,7 +26,7 @@ const ROOT = '/'; // process.env.NODE_ENV === 'production' ? '/' : '/'; class DemoApp extends React.Component { render() { - const options = getOptions(); + const options = getOptions(this.props.router.location); return (
diff --git a/packages/redux-devtools-test-generator/demo/src/js/DevTools.jsx b/packages/redux-devtools-test-generator/demo/src/js/DevTools.jsx new file mode 100644 index 00000000..2cee7cdb --- /dev/null +++ b/packages/redux-devtools-test-generator/demo/src/js/DevTools.jsx @@ -0,0 +1,42 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import { createDevTools } from 'redux-devtools'; +import DevtoolsInspector from 'redux-devtools-inspector'; +import DockMonitor from 'redux-devtools-dock-monitor'; +import getOptions from './getOptions'; +import TestGenerator from '../../../src'; + +export const getDevTools = (location) => + createDevTools( + + [ + { + name: 'Test', + component: TestGenerator, + }, + ...defaultTabs, + ]} + /> + + ); + +const UnconnectedDevTools = ({ location }) => { + const DevTools = getDevTools(location); + return ; +}; + +const mapStateToProps = (state) => ({ + location: state.router.location, +}); + +export const ConnectedDevTools = connect(mapStateToProps)(UnconnectedDevTools); diff --git a/packages/redux-devtools-test-generator/demo/src/js/getOptions.js b/packages/redux-devtools-test-generator/demo/src/js/getOptions.js index f18e133d..b26e8222 100644 --- a/packages/redux-devtools-test-generator/demo/src/js/getOptions.js +++ b/packages/redux-devtools-test-generator/demo/src/js/getOptions.js @@ -1,11 +1,11 @@ -export default function getOptions() { +export default function getOptions(location) { return { - useExtension: window.location.search.indexOf('ext') !== -1, - supportImmutable: window.location.search.indexOf('immutable') !== -1, + useExtension: location.search.indexOf('ext') !== -1, + supportImmutable: location.search.indexOf('immutable') !== -1, theme: do { - const match = window.location.search.match(/theme=([^&]+)/); + const match = location.search.match(/theme=([^&]+)/); match ? match[1] : 'inspector'; }, - dark: window.location.search.indexOf('dark') !== -1, + dark: location.search.indexOf('dark') !== -1, }; } diff --git a/packages/redux-devtools-test-generator/demo/src/js/index.js b/packages/redux-devtools-test-generator/demo/src/js/index.js index d2f8d902..da3e7cfb 100644 --- a/packages/redux-devtools-test-generator/demo/src/js/index.js +++ b/packages/redux-devtools-test-generator/demo/src/js/index.js @@ -5,62 +5,37 @@ import { render } from 'react-dom'; import { Container } from 'devui'; import DemoApp from './DemoApp'; import { Provider } from 'react-redux'; -import reducers from './reducers'; -import { createStore, applyMiddleware, compose, combineReducers } from 'redux'; +import createRootReducer from './reducers'; +import { createStore, applyMiddleware, compose } from 'redux'; import logger from 'redux-logger'; -import { Router, Route, browserHistory } from 'react-router'; -import { - syncHistoryWithStore, - routerReducer, - routerMiddleware, -} from 'react-router-redux'; -import { createDevTools, persistState } from 'redux-devtools'; -import DevtoolsInspector from 'redux-devtools-inspector'; -import DockMonitor from 'redux-devtools-dock-monitor'; +import { Route } from 'react-router'; +import { createBrowserHistory } from 'history'; +import { ConnectedRouter, routerMiddleware } from 'connected-react-router'; +import { persistState } from 'redux-devtools'; import getOptions from './getOptions'; -import TestGenerator from '../../../src'; +import { ConnectedDevTools, getDevTools } from './DevTools'; function getDebugSessionKey() { const matches = window.location.href.match(/[?&]debug_session=([^&#]+)\b/); return matches && matches.length > 0 ? matches[1] : null; } -const getDevTools = (options) => - createDevTools( - - [ - { - name: 'Test', - component: TestGenerator, - }, - ...defaultTabs, - ]} - /> - - ); - const ROOT = - process.env.NODE_ENV === 'production' ? '/redux-devtools-inspector/' : '/'; + process.env.NODE_ENV === 'production' + ? '/redux-devtools-test-generator/' + : '/'; -let DevTools = getDevTools(getOptions()); +const DevTools = getDevTools(window.location); -const reduxRouterMiddleware = routerMiddleware(browserHistory); +const history = createBrowserHistory(); + +const useDevtoolsExtension = + !!window.__REDUX_DEVTOOLS_EXTENSION__ && + getOptions(window.location).useExtension; const enhancer = compose( - applyMiddleware(logger, reduxRouterMiddleware), + applyMiddleware(logger, routerMiddleware(history)), (...args) => { - const useDevtoolsExtension = - !!window.__REDUX_DEVTOOLS_EXTENSION__ && getOptions().useExtension; const instrument = useDevtoolsExtension ? window.__REDUX_DEVTOOLS_EXTENSION__() : DevTools.instrument(); @@ -69,43 +44,20 @@ const enhancer = compose( persistState(getDebugSessionKey()) ); -const store = createStore( - combineReducers({ - ...reducers, - routing: routerReducer, - }), - {}, - enhancer -); +const store = createStore(createRootReducer(history), {}, enhancer); -const history = syncHistoryWithStore(browserHistory, store); - -const handleRouterUpdate = () => { - renderApp(getOptions()); -}; - -const router = ( - - - -); - -const renderApp = (options) => { - DevTools = getDevTools(options); - const useDevtoolsExtension = - !!window.__REDUX_DEVTOOLS_EXTENSION__ && options.useExtension; - - return render( - +render( + + - {router} - {!useDevtoolsExtension && } + + + + {!useDevtoolsExtension && } - , - document.getElementById('root') - ); -}; - -renderApp(getOptions()); + + , + document.getElementById('root') +); diff --git a/packages/redux-devtools-test-generator/demo/src/js/reducers.js b/packages/redux-devtools-test-generator/demo/src/js/reducers.js index 1a8947c9..c82bc80c 100644 --- a/packages/redux-devtools-test-generator/demo/src/js/reducers.js +++ b/packages/redux-devtools-test-generator/demo/src/js/reducers.js @@ -1,5 +1,7 @@ import Immutable from 'immutable'; import shuffle from 'lodash.shuffle'; +import { combineReducers } from 'redux'; +import { connectRouter } from 'connected-react-router'; const NESTED = { long: { @@ -58,62 +60,66 @@ function createIterator() { const DEFAULT_SHUFFLE_ARRAY = [0, 1, null, { id: 1 }, { id: 2 }, 'string']; -export default { - timeoutUpdateEnabled: (state = false, action) => - action.type === 'TOGGLE_TIMEOUT_UPDATE' - ? action.timeoutUpdateEnabled - : state, - store: (state = 0, action) => - action.type === 'INCREMENT' ? state + 1 : state, - undefined: (state = { val: undefined }) => state, - null: (state = null) => state, - func: (state = () => {}) => state, - array: (state = [], action) => - action.type === 'PUSH' - ? [...state, Math.random()] - : action.type === 'POP' - ? state.slice(0, state.length - 1) - : action.type === 'REPLACE' - ? [Math.random(), ...state.slice(1)] - : state, - hugeArrays: (state = [], action) => - action.type === 'PUSH_HUGE_ARRAY' ? [...state, ...HUGE_ARRAY] : state, - hugeObjects: (state = [], action) => - action.type === 'ADD_HUGE_OBJECT' ? [...state, HUGE_OBJECT] : state, - iterators: (state = [], action) => - action.type === 'ADD_ITERATOR' ? [...state, createIterator()] : state, - nested: (state = NESTED, action) => - action.type === 'CHANGE_NESTED' - ? { - ...state, - long: { - nested: [ - { - path: { - to: { - a: state.long.nested[0].path.to.a + '!', +const createRootReducer = (history) => + combineReducers({ + router: connectRouter(history), + timeoutUpdateEnabled: (state = false, action) => + action.type === 'TOGGLE_TIMEOUT_UPDATE' + ? action.timeoutUpdateEnabled + : state, + store: (state = 0, action) => + action.type === 'INCREMENT' ? state + 1 : state, + undefined: (state = { val: undefined }) => state, + null: (state = null) => state, + func: (state = () => {}) => state, + array: (state = [], action) => + action.type === 'PUSH' + ? [...state, Math.random()] + : action.type === 'POP' + ? state.slice(0, state.length - 1) + : action.type === 'REPLACE' + ? [Math.random(), ...state.slice(1)] + : state, + hugeArrays: (state = [], action) => + action.type === 'PUSH_HUGE_ARRAY' ? [...state, ...HUGE_ARRAY] : state, + hugeObjects: (state = [], action) => + action.type === 'ADD_HUGE_OBJECT' ? [...state, HUGE_OBJECT] : state, + iterators: (state = [], action) => + action.type === 'ADD_ITERATOR' ? [...state, createIterator()] : state, + nested: (state = NESTED, action) => + action.type === 'CHANGE_NESTED' + ? { + ...state, + long: { + nested: [ + { + path: { + to: { + a: state.long.nested[0].path.to.a + '!', + }, }, }, - }, - ], - }, - } - : state, - recursive: (state = [], action) => - action.type === 'ADD_RECURSIVE' ? [...state, { ...RECURSIVE }] : state, - immutables: (state = [], action) => - action.type === 'ADD_IMMUTABLE_MAP' ? [...state, IMMUTABLE_MAP] : state, - immutableNested: (state = IMMUTABLE_NESTED, action) => - action.type === 'CHANGE_IMMUTABLE_NESTED' - ? state.updateIn( - ['long', 'nested', 0, 'path', 'to', 'a'], - (str) => str + '!' - ) - : state, - addFunction: (state = null, action) => - action.type === 'ADD_FUNCTION' ? { f: FUNC } : state, - addSymbol: (state = null, action) => - action.type === 'ADD_SYMBOL' ? { s: window.Symbol('symbol') } : state, - shuffleArray: (state = DEFAULT_SHUFFLE_ARRAY, action) => - action.type === 'SHUFFLE_ARRAY' ? shuffle(state) : state, -}; + ], + }, + } + : state, + recursive: (state = [], action) => + action.type === 'ADD_RECURSIVE' ? [...state, { ...RECURSIVE }] : state, + immutables: (state = [], action) => + action.type === 'ADD_IMMUTABLE_MAP' ? [...state, IMMUTABLE_MAP] : state, + immutableNested: (state = IMMUTABLE_NESTED, action) => + action.type === 'CHANGE_IMMUTABLE_NESTED' + ? state.updateIn( + ['long', 'nested', 0, 'path', 'to', 'a'], + (str) => str + '!' + ) + : state, + addFunction: (state = null, action) => + action.type === 'ADD_FUNCTION' ? { f: FUNC } : state, + addSymbol: (state = null, action) => + action.type === 'ADD_SYMBOL' ? { s: window.Symbol('symbol') } : state, + shuffleArray: (state = DEFAULT_SHUFFLE_ARRAY, action) => + action.type === 'SHUFFLE_ARRAY' ? shuffle(state) : state, + }); + +export default createRootReducer; diff --git a/packages/redux-devtools-test-generator/package.json b/packages/redux-devtools-test-generator/package.json index 635bd9a1..033cf29f 100644 --- a/packages/redux-devtools-test-generator/package.json +++ b/packages/redux-devtools-test-generator/package.json @@ -44,26 +44,29 @@ "@babel/preset-react": "^7.10.4", "babel-loader": "^8.1.0", "clean-webpack-plugin": "^3.0.0", + "connected-react-router": "^6.8.0", "css-loader": "^4.2.1", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.3", "enzyme-to-json": "^3.5.0", "expect": "^26.2.0", "file-loader": "^6.0.0", + "history": "^4.10.1", "html-webpack-plugin": "^4.3.0", "immutable": "^4.0.0-rc.12", "jest": "^26.2.2", + "lodash.isequalwith": "^4.4.0", "lodash.shuffle": "^4.2.0", "react-dom": "^16.13.1", "react-redux": "^7.2.1", - "react-router": "^3.2.6", - "react-router-redux": "^4.0.8", + "react-router": "^5.2.0", "redux": "^4.0.5", "redux-devtools": "^3.6.0", "redux-devtools-dock-monitor": "^1.1.3", "redux-devtools-inspector": "^0.13.0", "redux-logger": "^3.0.6", "rimraf": "^3.0.2", + "seamless-immutable": "^7.1.4", "style-loader": "^1.2.1", "webpack": "^4.44.1", "webpack-dev-server": "^3.11.0" diff --git a/yarn.lock b/yarn.lock index 5f38892c..9dd23389 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5443,6 +5443,13 @@ connect-history-api-fallback@^1.6.0: resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc" integrity sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg== +connected-react-router@^6.8.0: + version "6.8.0" + resolved "https://registry.yarnpkg.com/connected-react-router/-/connected-react-router-6.8.0.tgz#ddc687b31d498322445d235d660798489fa56cae" + integrity sha512-E64/6krdJM3Ag3MMmh2nKPtMbH15s3JQDuaYJvOVXzu6MbHbDyIvuwLOyhQIuP4Om9zqEfZYiVyflROibSsONg== + dependencies: + prop-types "^15.7.2" + console-browserify@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336" @@ -5708,7 +5715,7 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: safe-buffer "^5.0.1" sha.js "^2.4.8" -create-react-class@^15.5.1, create-react-class@^15.6.2: +create-react-class@^15.6.2: version "15.6.3" resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.3.tgz#2d73237fb3f970ae6ebe011a9e66f46dbca80036" integrity sha512-M+/3Q6E6DLO6Yx3OwrWjwHBnvfXXYA7W+dFjt/ZDBemHO1DDZhsalX/NUtnTYclN6GfnBDRh4qRHjcDHmlJBJg== @@ -8364,15 +8371,17 @@ hex-rgba@^1.0.2: resolved "https://registry.yarnpkg.com/hex-rgba/-/hex-rgba-1.0.2.tgz#b7cfbd24c6c736277cf88dd6d41b672ea336574c" integrity sha512-MKla68wFGv+i7zU3Q4giWN74f+zWdkuf2Tk21fISV7aw55r8dH/noBbH5JsVlM4Z2WRTYCEmSxsoZ1QR/o68jg== -history@^3.0.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/history/-/history-3.3.0.tgz#fcedcce8f12975371545d735461033579a6dae9c" - integrity sha1-/O3M6PEpdTcVRdc1RhAzV5ptrpw= +history@^4.10.1, history@^4.9.0: + version "4.10.1" + resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3" + integrity sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew== dependencies: - invariant "^2.2.1" + "@babel/runtime" "^7.1.2" loose-envify "^1.2.0" - query-string "^4.2.2" - warning "^3.0.0" + resolve-pathname "^3.0.0" + tiny-invariant "^1.0.2" + tiny-warning "^1.0.0" + value-equal "^1.0.1" hmac-drbg@^1.0.0: version "1.0.1" @@ -8388,7 +8397,7 @@ hoist-non-react-statics@1.x.x, hoist-non-react-statics@^1.2.0: resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz#aa448cf0986d55cc40773b17174b7dd066cb7cfb" integrity sha1-qkSM8JhtVcxAdzsXF0t90GbLfPs= -hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2: +hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0: version "3.3.2" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== @@ -10534,6 +10543,11 @@ lodash.isequal@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= +lodash.isequalwith@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/lodash.isequalwith/-/lodash.isequalwith-4.4.0.tgz#266726ddd528f854f21f4ea98a065606e0fbc6b0" + integrity sha1-Jmcm3dUo+FTyH06pigZWBuD7xrA= + lodash.isinteger@^4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz#619c0af3d03f8b04c31f5882840b77b11cd68343" @@ -11028,6 +11042,14 @@ min-indent@^1.0.0: resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== +mini-create-react-context@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/mini-create-react-context/-/mini-create-react-context-0.4.0.tgz#df60501c83151db69e28eac0ef08b4002efab040" + integrity sha512-b0TytUgFSbgFJGzJqXPKCFCBWigAjpjo+Fl7Vf7ZbKRDptszpppKxXH6DRXEABZ/gcEQczeb0iZ7JvL8e8jjCA== + dependencies: + "@babel/runtime" "^7.5.5" + tiny-warning "^1.0.3" + mini-css-extract-plugin@^0.4.4: version "0.4.5" resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.4.5.tgz#c99e9e78d54f3fa775633aee5933aeaa4e80719a" @@ -12230,6 +12252,13 @@ path-to-regexp@0.1.7: resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= +path-to-regexp@^1.7.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.8.0.tgz#887b3ba9d84393e87a0a0b9f4cb756198b53548a" + integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA== + dependencies: + isarray "0.0.1" + path-type@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" @@ -12839,14 +12868,6 @@ qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -query-string@^4.2.2: - version "4.3.4" - resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.3.4.tgz#bbb693b9ca915c232515b228b1a02b609043dbeb" - integrity sha1-u7aTucqRXCMlFbIosaArYJBD2+s= - dependencies: - object-assign "^4.1.0" - strict-uri-encode "^1.0.0" - querystring-es3@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" @@ -13127,7 +13148,7 @@ react-inspector@^2.3.0: is-dom "^1.0.9" prop-types "^15.6.1" -react-is@^16.12.0, react-is@^16.13.0, react-is@^16.13.1, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6, react-is@^16.9.0: +react-is@^16.12.0, react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6, react-is@^16.9.0: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== @@ -13202,24 +13223,21 @@ react-redux@^7.2.1: prop-types "^15.7.2" react-is "^16.9.0" -react-router-redux@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/react-router-redux/-/react-router-redux-4.0.8.tgz#227403596b5151e182377dab835b5d45f0f8054e" - integrity sha1-InQDWWtRUeGCN32rg1tdRfD4BU4= - -react-router@^3.2.6: - version "3.2.6" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-3.2.6.tgz#cad202796a7bba3efc2100da453b3379c9d4aeb4" - integrity sha512-nlxtQE8B22hb/JxdaslI1tfZacxFU8x8BJryXOnR2RxB4vc01zuHYAHAIgmBkdk1kzXaA25hZxK6KAH/+CXArw== +react-router@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.2.0.tgz#424e75641ca8747fbf76e5ecca69781aa37ea293" + integrity sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw== dependencies: - create-react-class "^15.5.1" - history "^3.0.0" - hoist-non-react-statics "^3.3.2" - invariant "^2.2.1" - loose-envify "^1.2.0" - prop-types "^15.7.2" - react-is "^16.13.0" - warning "^3.0.0" + "@babel/runtime" "^7.1.2" + history "^4.9.0" + hoist-non-react-statics "^3.1.0" + loose-envify "^1.3.1" + mini-create-react-context "^0.4.0" + path-to-regexp "^1.7.0" + prop-types "^15.6.2" + react-is "^16.6.0" + tiny-invariant "^1.0.2" + tiny-warning "^1.0.0" react-select@^1.3.0: version "1.3.0" @@ -13801,6 +13819,11 @@ resolve-from@^5.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== +resolve-pathname@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-3.0.0.tgz#99d02224d3cf263689becbb393bc560313025dcd" + integrity sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng== + resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" @@ -14083,6 +14106,11 @@ schema-utils@^2.6.5, schema-utils@^2.6.6, schema-utils@^2.7.0: ajv "^6.12.2" ajv-keywords "^3.4.1" +seamless-immutable@^7.1.4: + version "7.1.4" + resolved "https://registry.yarnpkg.com/seamless-immutable/-/seamless-immutable-7.1.4.tgz#6e9536def083ddc4dea0207d722e0e80d0f372f8" + integrity sha512-XiUO1QP4ki4E2PHegiGAlu6r82o5A+6tRh7IkGGTVg/h+UoeX4nFBeCGPOhb4CYjvkqsfm/TUtvOMYC1xmV30A== + select-hose@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" @@ -14795,11 +14823,6 @@ stream-shift@^1.0.0: resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d" integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== -strict-uri-encode@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" - integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= - string-argv@0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da" @@ -15470,6 +15493,16 @@ timers-browserify@^2.0.4: dependencies: setimmediate "^1.0.4" +tiny-invariant@^1.0.2: + version "1.1.0" + resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.1.0.tgz#634c5f8efdc27714b7f386c35e6760991d230875" + integrity sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw== + +tiny-warning@^1.0.0, tiny-warning@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" + integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== + tinycolor2@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/tinycolor2/-/tinycolor2-1.4.1.tgz#f4fad333447bc0b07d4dc8e9209d8f39a8ac77e8" @@ -16007,6 +16040,11 @@ validate-npm-package-name@^3.0.0: dependencies: builtins "^1.0.3" +value-equal@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c" + integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw== + vary@^1, vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"