isomorfeus-redux 4.2.0 → 22.9.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +176 -0
- data/lib/app_state.rb +25 -0
- data/lib/isomorfeus/browser_store_api.rb +0 -16
- data/lib/isomorfeus/redux/config.rb +97 -14
- data/lib/isomorfeus/redux/handler.rb +35 -0
- data/lib/isomorfeus/redux/version.rb +5 -0
- data/lib/isomorfeus/redux_imports.rb +14 -0
- data/lib/{redux/reducers.rb → isomorfeus/redux_reducers.rb} +15 -13
- data/lib/isomorfeus-redux.rb +18 -30
- data/lib/local_store.rb +27 -30
- data/lib/redux/store.rb +156 -120
- data/lib/session_store.rb +28 -30
- metadata +24 -247
- data/lib/app_store.rb +0 -42
- data/lib/isomorfeus/core_ext/hash/deep_merge.rb +0 -34
- data/lib/isomorfeus/core_ext/kernel.rb +0 -30
- data/lib/isomorfeus/execution_environment.rb +0 -67
- data/lib/isomorfeus/redux/imports.rb +0 -17
- data/lib/redux/version.rb +0 -3
- data/lib/redux.rb +0 -118
- data/node_modules/.package-lock.json +0 -31
- data/node_modules/@babel/runtime/LICENSE +0 -22
- data/node_modules/@babel/runtime/README.md +0 -19
- data/node_modules/@babel/runtime/helpers/AsyncGenerator.js +0 -99
- data/node_modules/@babel/runtime/helpers/AwaitValue.js +0 -6
- data/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js +0 -31
- data/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +0 -12
- data/node_modules/@babel/runtime/helpers/arrayWithHoles.js +0 -6
- data/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js +0 -8
- data/node_modules/@babel/runtime/helpers/assertThisInitialized.js +0 -10
- data/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js +0 -57
- data/node_modules/@babel/runtime/helpers/asyncIterator.js +0 -16
- data/node_modules/@babel/runtime/helpers/asyncToGenerator.js +0 -38
- data/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js +0 -8
- data/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js +0 -8
- data/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js +0 -23
- data/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js +0 -10
- data/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js +0 -14
- data/node_modules/@babel/runtime/helpers/classCallCheck.js +0 -8
- data/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js +0 -8
- data/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js +0 -8
- data/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js +0 -10
- data/node_modules/@babel/runtime/helpers/classNameTDZError.js +0 -6
- data/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js +0 -11
- data/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js +0 -11
- data/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js +0 -9
- data/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js +0 -10
- data/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js +0 -8
- data/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js +0 -12
- data/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js +0 -10
- data/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js +0 -9
- data/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js +0 -6
- data/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js +0 -14
- data/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js +0 -14
- data/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js +0 -15
- data/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js +0 -9
- data/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js +0 -6
- data/node_modules/@babel/runtime/helpers/construct.js +0 -26
- data/node_modules/@babel/runtime/helpers/createClass.js +0 -18
- data/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js +0 -61
- data/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js +0 -25
- data/node_modules/@babel/runtime/helpers/createSuper.js +0 -25
- data/node_modules/@babel/runtime/helpers/decorate.js +0 -401
- data/node_modules/@babel/runtime/helpers/defaults.js +0 -17
- data/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js +0 -25
- data/node_modules/@babel/runtime/helpers/defineProperty.js +0 -17
- data/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js +0 -95
- data/node_modules/@babel/runtime/helpers/esm/AwaitValue.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js +0 -28
- data/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +0 -9
- data/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +0 -4
- data/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js +0 -54
- data/node_modules/@babel/runtime/helpers/esm/asyncIterator.js +0 -13
- data/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +0 -35
- data/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js +0 -4
- data/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js +0 -20
- data/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js +0 -11
- data/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js +0 -6
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js +0 -6
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js +0 -4
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js +0 -8
- data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js +0 -8
- data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js +0 -9
- data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/construct.js +0 -18
- data/node_modules/@babel/runtime/helpers/esm/createClass.js +0 -15
- data/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js +0 -57
- data/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js +0 -21
- data/node_modules/@babel/runtime/helpers/esm/createSuper.js +0 -19
- data/node_modules/@babel/runtime/helpers/esm/decorate.js +0 -396
- data/node_modules/@babel/runtime/helpers/esm/defaults.js +0 -14
- data/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js +0 -22
- data/node_modules/@babel/runtime/helpers/esm/defineProperty.js +0 -14
- data/node_modules/@babel/runtime/helpers/esm/extends.js +0 -17
- data/node_modules/@babel/runtime/helpers/esm/get.js +0 -20
- data/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +0 -6
- data/node_modules/@babel/runtime/helpers/esm/inherits.js +0 -15
- data/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +0 -6
- data/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js +0 -9
- data/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/instanceof.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js +0 -51
- data/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +0 -12
- data/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +0 -29
- data/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js +0 -14
- data/node_modules/@babel/runtime/helpers/esm/jsx.js +0 -46
- data/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js +0 -9
- data/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/objectSpread.js +0 -19
- data/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +0 -39
- data/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +0 -19
- data/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +0 -14
- data/node_modules/@babel/runtime/helpers/esm/package.json +0 -3
- data/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +0 -11
- data/node_modules/@babel/runtime/helpers/esm/readOnlyError.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/set.js +0 -51
- data/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +0 -8
- data/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/superPropBase.js +0 -9
- data/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js +0 -11
- data/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js +0 -8
- data/node_modules/@babel/runtime/helpers/esm/tdz.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/temporalRef.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js +0 -1
- data/node_modules/@babel/runtime/helpers/esm/toArray.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -13
- data/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +0 -6
- data/node_modules/@babel/runtime/helpers/esm/typeof.js +0 -15
- data/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +0 -9
- data/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js +0 -6
- data/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js +0 -37
- data/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js +0 -65
- data/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js +0 -3
- data/node_modules/@babel/runtime/helpers/extends.js +0 -21
- data/node_modules/@babel/runtime/helpers/get.js +0 -27
- data/node_modules/@babel/runtime/helpers/getPrototypeOf.js +0 -10
- data/node_modules/@babel/runtime/helpers/inherits.js +0 -19
- data/node_modules/@babel/runtime/helpers/inheritsLoose.js +0 -10
- data/node_modules/@babel/runtime/helpers/initializerDefineProperty.js +0 -12
- data/node_modules/@babel/runtime/helpers/initializerWarningHelper.js +0 -6
- data/node_modules/@babel/runtime/helpers/instanceof.js +0 -10
- data/node_modules/@babel/runtime/helpers/interopRequireDefault.js +0 -8
- data/node_modules/@babel/runtime/helpers/interopRequireWildcard.js +0 -54
- data/node_modules/@babel/runtime/helpers/isNativeFunction.js +0 -6
- data/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js +0 -15
- data/node_modules/@babel/runtime/helpers/iterableToArray.js +0 -6
- data/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js +0 -32
- data/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js +0 -17
- data/node_modules/@babel/runtime/helpers/jsx.js +0 -50
- data/node_modules/@babel/runtime/helpers/maybeArrayLike.js +0 -13
- data/node_modules/@babel/runtime/helpers/newArrowCheck.js +0 -8
- data/node_modules/@babel/runtime/helpers/nonIterableRest.js +0 -6
- data/node_modules/@babel/runtime/helpers/nonIterableSpread.js +0 -6
- data/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js +0 -6
- data/node_modules/@babel/runtime/helpers/objectSpread.js +0 -23
- data/node_modules/@babel/runtime/helpers/objectSpread2.js +0 -42
- data/node_modules/@babel/runtime/helpers/objectWithoutProperties.js +0 -23
- data/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +0 -17
- data/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js +0 -16
- data/node_modules/@babel/runtime/helpers/readOnlyError.js +0 -6
- data/node_modules/@babel/runtime/helpers/set.js +0 -55
- data/node_modules/@babel/runtime/helpers/setPrototypeOf.js +0 -12
- data/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js +0 -10
- data/node_modules/@babel/runtime/helpers/slicedToArray.js +0 -14
- data/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js +0 -14
- data/node_modules/@babel/runtime/helpers/superPropBase.js +0 -13
- data/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js +0 -14
- data/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js +0 -11
- data/node_modules/@babel/runtime/helpers/tdz.js +0 -6
- data/node_modules/@babel/runtime/helpers/temporalRef.js +0 -10
- data/node_modules/@babel/runtime/helpers/temporalUndefined.js +0 -4
- data/node_modules/@babel/runtime/helpers/toArray.js +0 -14
- data/node_modules/@babel/runtime/helpers/toConsumableArray.js +0 -14
- data/node_modules/@babel/runtime/helpers/toPrimitive.js +0 -17
- data/node_modules/@babel/runtime/helpers/toPropertyKey.js +0 -11
- data/node_modules/@babel/runtime/helpers/typeof.js +0 -22
- data/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +0 -13
- data/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js +0 -10
- data/node_modules/@babel/runtime/helpers/wrapNativeSuper.js +0 -45
- data/node_modules/@babel/runtime/helpers/wrapRegExp.js +0 -72
- data/node_modules/@babel/runtime/helpers/writeOnlyError.js +0 -6
- data/node_modules/@babel/runtime/package.json +0 -848
- data/node_modules/@babel/runtime/regenerator/index.js +0 -1
- data/node_modules/redux/LICENSE.md +0 -21
- data/node_modules/redux/README.md +0 -322
- data/node_modules/redux/dist/redux.js +0 -768
- data/node_modules/redux/dist/redux.min.js +0 -1
- data/node_modules/redux/es/redux.js +0 -716
- data/node_modules/redux/es/redux.mjs +0 -1
- data/node_modules/redux/index.d.ts +0 -776
- data/node_modules/redux/lib/redux.js +0 -730
- data/node_modules/redux/package.json +0 -108
- data/node_modules/redux/src/applyMiddleware.js +0 -41
- data/node_modules/redux/src/bindActionCreators.js +0 -52
- data/node_modules/redux/src/combineReducers.js +0 -175
- data/node_modules/redux/src/compose.js +0 -22
- data/node_modules/redux/src/createStore.js +0 -347
- data/node_modules/redux/src/index.js +0 -37
- data/node_modules/redux/src/utils/actionTypes.js +0 -17
- data/node_modules/redux/src/utils/formatProdErrorMessage.js +0 -15
- data/node_modules/redux/src/utils/isPlainObject.js +0 -14
- data/node_modules/redux/src/utils/kindOf.js +0 -70
- data/node_modules/redux/src/utils/symbol-observable.js +0 -3
- data/node_modules/redux/src/utils/warning.js +0 -19
- data/node_modules/regenerator-runtime/LICENSE +0 -21
- data/node_modules/regenerator-runtime/README.md +0 -31
- data/node_modules/regenerator-runtime/package.json +0 -19
- data/node_modules/regenerator-runtime/path.js +0 -11
- data/node_modules/regenerator-runtime/runtime.js +0 -754
- data/package.json +0 -6
@@ -1,347 +0,0 @@
|
|
1
|
-
import $$observable from './utils/symbol-observable'
|
2
|
-
|
3
|
-
import ActionTypes from './utils/actionTypes'
|
4
|
-
import isPlainObject from './utils/isPlainObject'
|
5
|
-
import { kindOf } from './utils/kindOf'
|
6
|
-
|
7
|
-
/**
|
8
|
-
* @deprecated
|
9
|
-
*
|
10
|
-
* **We recommend using the `configureStore` method
|
11
|
-
* of the `@reduxjs/toolkit` package**, which replaces `createStore`.
|
12
|
-
*
|
13
|
-
* Redux Toolkit is our recommended approach for writing Redux logic today,
|
14
|
-
* including store setup, reducers, data fetching, and more.
|
15
|
-
*
|
16
|
-
* **For more details, please read this Redux docs page:**
|
17
|
-
* **https://redux.js.org/introduction/why-rtk-is-redux-today**
|
18
|
-
*
|
19
|
-
* `configureStore` from Redux Toolkit is an improved version of `createStore` that
|
20
|
-
* simplifies setup and helps avoid common bugs.
|
21
|
-
*
|
22
|
-
* You should not be using the `redux` core package by itself today, except for learning purposes.
|
23
|
-
* The `createStore` method from the core `redux` package will not be removed, but we encourage
|
24
|
-
* all users to migrate to using Redux Toolkit for all Redux code.
|
25
|
-
*
|
26
|
-
* If you want to use `createStore` without this visual deprecation warning, use
|
27
|
-
* the `legacy_createStore` import instead:
|
28
|
-
*
|
29
|
-
* `import { legacy_createStore as createStore} from 'redux'`
|
30
|
-
*
|
31
|
-
*/
|
32
|
-
export function createStore(reducer, preloadedState, enhancer) {
|
33
|
-
if (
|
34
|
-
(typeof preloadedState === 'function' && typeof enhancer === 'function') ||
|
35
|
-
(typeof enhancer === 'function' && typeof arguments[3] === 'function')
|
36
|
-
) {
|
37
|
-
throw new Error(
|
38
|
-
'It looks like you are passing several store enhancers to ' +
|
39
|
-
'createStore(). This is not supported. Instead, compose them ' +
|
40
|
-
'together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.'
|
41
|
-
)
|
42
|
-
}
|
43
|
-
|
44
|
-
if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
|
45
|
-
enhancer = preloadedState
|
46
|
-
preloadedState = undefined
|
47
|
-
}
|
48
|
-
|
49
|
-
if (typeof enhancer !== 'undefined') {
|
50
|
-
if (typeof enhancer !== 'function') {
|
51
|
-
throw new Error(
|
52
|
-
`Expected the enhancer to be a function. Instead, received: '${kindOf(
|
53
|
-
enhancer
|
54
|
-
)}'`
|
55
|
-
)
|
56
|
-
}
|
57
|
-
|
58
|
-
return enhancer(createStore)(reducer, preloadedState)
|
59
|
-
}
|
60
|
-
|
61
|
-
if (typeof reducer !== 'function') {
|
62
|
-
throw new Error(
|
63
|
-
`Expected the root reducer to be a function. Instead, received: '${kindOf(
|
64
|
-
reducer
|
65
|
-
)}'`
|
66
|
-
)
|
67
|
-
}
|
68
|
-
|
69
|
-
let currentReducer = reducer
|
70
|
-
let currentState = preloadedState
|
71
|
-
let currentListeners = []
|
72
|
-
let nextListeners = currentListeners
|
73
|
-
let isDispatching = false
|
74
|
-
|
75
|
-
/**
|
76
|
-
* This makes a shallow copy of currentListeners so we can use
|
77
|
-
* nextListeners as a temporary list while dispatching.
|
78
|
-
*
|
79
|
-
* This prevents any bugs around consumers calling
|
80
|
-
* subscribe/unsubscribe in the middle of a dispatch.
|
81
|
-
*/
|
82
|
-
function ensureCanMutateNextListeners() {
|
83
|
-
if (nextListeners === currentListeners) {
|
84
|
-
nextListeners = currentListeners.slice()
|
85
|
-
}
|
86
|
-
}
|
87
|
-
|
88
|
-
/**
|
89
|
-
* Reads the state tree managed by the store.
|
90
|
-
*
|
91
|
-
* @returns {any} The current state tree of your application.
|
92
|
-
*/
|
93
|
-
function getState() {
|
94
|
-
if (isDispatching) {
|
95
|
-
throw new Error(
|
96
|
-
'You may not call store.getState() while the reducer is executing. ' +
|
97
|
-
'The reducer has already received the state as an argument. ' +
|
98
|
-
'Pass it down from the top reducer instead of reading it from the store.'
|
99
|
-
)
|
100
|
-
}
|
101
|
-
|
102
|
-
return currentState
|
103
|
-
}
|
104
|
-
|
105
|
-
/**
|
106
|
-
* Adds a change listener. It will be called any time an action is dispatched,
|
107
|
-
* and some part of the state tree may potentially have changed. You may then
|
108
|
-
* call `getState()` to read the current state tree inside the callback.
|
109
|
-
*
|
110
|
-
* You may call `dispatch()` from a change listener, with the following
|
111
|
-
* caveats:
|
112
|
-
*
|
113
|
-
* 1. The subscriptions are snapshotted just before every `dispatch()` call.
|
114
|
-
* If you subscribe or unsubscribe while the listeners are being invoked, this
|
115
|
-
* will not have any effect on the `dispatch()` that is currently in progress.
|
116
|
-
* However, the next `dispatch()` call, whether nested or not, will use a more
|
117
|
-
* recent snapshot of the subscription list.
|
118
|
-
*
|
119
|
-
* 2. The listener should not expect to see all state changes, as the state
|
120
|
-
* might have been updated multiple times during a nested `dispatch()` before
|
121
|
-
* the listener is called. It is, however, guaranteed that all subscribers
|
122
|
-
* registered before the `dispatch()` started will be called with the latest
|
123
|
-
* state by the time it exits.
|
124
|
-
*
|
125
|
-
* @param {Function} listener A callback to be invoked on every dispatch.
|
126
|
-
* @returns {Function} A function to remove this change listener.
|
127
|
-
*/
|
128
|
-
function subscribe(listener) {
|
129
|
-
if (typeof listener !== 'function') {
|
130
|
-
throw new Error(
|
131
|
-
`Expected the listener to be a function. Instead, received: '${kindOf(
|
132
|
-
listener
|
133
|
-
)}'`
|
134
|
-
)
|
135
|
-
}
|
136
|
-
|
137
|
-
if (isDispatching) {
|
138
|
-
throw new Error(
|
139
|
-
'You may not call store.subscribe() while the reducer is executing. ' +
|
140
|
-
'If you would like to be notified after the store has been updated, subscribe from a ' +
|
141
|
-
'component and invoke store.getState() in the callback to access the latest state. ' +
|
142
|
-
'See https://redux.js.org/api/store#subscribelistener for more details.'
|
143
|
-
)
|
144
|
-
}
|
145
|
-
|
146
|
-
let isSubscribed = true
|
147
|
-
|
148
|
-
ensureCanMutateNextListeners()
|
149
|
-
nextListeners.push(listener)
|
150
|
-
|
151
|
-
return function unsubscribe() {
|
152
|
-
if (!isSubscribed) {
|
153
|
-
return
|
154
|
-
}
|
155
|
-
|
156
|
-
if (isDispatching) {
|
157
|
-
throw new Error(
|
158
|
-
'You may not unsubscribe from a store listener while the reducer is executing. ' +
|
159
|
-
'See https://redux.js.org/api/store#subscribelistener for more details.'
|
160
|
-
)
|
161
|
-
}
|
162
|
-
|
163
|
-
isSubscribed = false
|
164
|
-
|
165
|
-
ensureCanMutateNextListeners()
|
166
|
-
const index = nextListeners.indexOf(listener)
|
167
|
-
nextListeners.splice(index, 1)
|
168
|
-
currentListeners = null
|
169
|
-
}
|
170
|
-
}
|
171
|
-
|
172
|
-
/**
|
173
|
-
* Dispatches an action. It is the only way to trigger a state change.
|
174
|
-
*
|
175
|
-
* The `reducer` function, used to create the store, will be called with the
|
176
|
-
* current state tree and the given `action`. Its return value will
|
177
|
-
* be considered the **next** state of the tree, and the change listeners
|
178
|
-
* will be notified.
|
179
|
-
*
|
180
|
-
* The base implementation only supports plain object actions. If you want to
|
181
|
-
* dispatch a Promise, an Observable, a thunk, or something else, you need to
|
182
|
-
* wrap your store creating function into the corresponding middleware. For
|
183
|
-
* example, see the documentation for the `redux-thunk` package. Even the
|
184
|
-
* middleware will eventually dispatch plain object actions using this method.
|
185
|
-
*
|
186
|
-
* @param {Object} action A plain object representing “what changed”. It is
|
187
|
-
* a good idea to keep actions serializable so you can record and replay user
|
188
|
-
* sessions, or use the time travelling `redux-devtools`. An action must have
|
189
|
-
* a `type` property which may not be `undefined`. It is a good idea to use
|
190
|
-
* string constants for action types.
|
191
|
-
*
|
192
|
-
* @returns {Object} For convenience, the same action object you dispatched.
|
193
|
-
*
|
194
|
-
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
|
195
|
-
* return something else (for example, a Promise you can await).
|
196
|
-
*/
|
197
|
-
function dispatch(action) {
|
198
|
-
if (!isPlainObject(action)) {
|
199
|
-
throw new Error(
|
200
|
-
`Actions must be plain objects. Instead, the actual type was: '${kindOf(
|
201
|
-
action
|
202
|
-
)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`
|
203
|
-
)
|
204
|
-
}
|
205
|
-
|
206
|
-
if (typeof action.type === 'undefined') {
|
207
|
-
throw new Error(
|
208
|
-
'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.'
|
209
|
-
)
|
210
|
-
}
|
211
|
-
|
212
|
-
if (isDispatching) {
|
213
|
-
throw new Error('Reducers may not dispatch actions.')
|
214
|
-
}
|
215
|
-
|
216
|
-
try {
|
217
|
-
isDispatching = true
|
218
|
-
currentState = currentReducer(currentState, action)
|
219
|
-
} finally {
|
220
|
-
isDispatching = false
|
221
|
-
}
|
222
|
-
|
223
|
-
const listeners = (currentListeners = nextListeners)
|
224
|
-
for (let i = 0; i < listeners.length; i++) {
|
225
|
-
const listener = listeners[i]
|
226
|
-
listener()
|
227
|
-
}
|
228
|
-
|
229
|
-
return action
|
230
|
-
}
|
231
|
-
|
232
|
-
/**
|
233
|
-
* Replaces the reducer currently used by the store to calculate the state.
|
234
|
-
*
|
235
|
-
* You might need this if your app implements code splitting and you want to
|
236
|
-
* load some of the reducers dynamically. You might also need this if you
|
237
|
-
* implement a hot reloading mechanism for Redux.
|
238
|
-
*
|
239
|
-
* @param {Function} nextReducer The reducer for the store to use instead.
|
240
|
-
* @returns {void}
|
241
|
-
*/
|
242
|
-
function replaceReducer(nextReducer) {
|
243
|
-
if (typeof nextReducer !== 'function') {
|
244
|
-
throw new Error(
|
245
|
-
`Expected the nextReducer to be a function. Instead, received: '${kindOf(
|
246
|
-
nextReducer
|
247
|
-
)}`
|
248
|
-
)
|
249
|
-
}
|
250
|
-
|
251
|
-
currentReducer = nextReducer
|
252
|
-
|
253
|
-
// This action has a similiar effect to ActionTypes.INIT.
|
254
|
-
// Any reducers that existed in both the new and old rootReducer
|
255
|
-
// will receive the previous state. This effectively populates
|
256
|
-
// the new state tree with any relevant data from the old one.
|
257
|
-
dispatch({ type: ActionTypes.REPLACE })
|
258
|
-
}
|
259
|
-
|
260
|
-
/**
|
261
|
-
* Interoperability point for observable/reactive libraries.
|
262
|
-
* @returns {observable} A minimal observable of state changes.
|
263
|
-
* For more information, see the observable proposal:
|
264
|
-
* https://github.com/tc39/proposal-observable
|
265
|
-
*/
|
266
|
-
function observable() {
|
267
|
-
const outerSubscribe = subscribe
|
268
|
-
return {
|
269
|
-
/**
|
270
|
-
* The minimal observable subscription method.
|
271
|
-
* @param {Object} observer Any object that can be used as an observer.
|
272
|
-
* The observer object should have a `next` method.
|
273
|
-
* @returns {subscription} An object with an `unsubscribe` method that can
|
274
|
-
* be used to unsubscribe the observable from the store, and prevent further
|
275
|
-
* emission of values from the observable.
|
276
|
-
*/
|
277
|
-
subscribe(observer) {
|
278
|
-
if (typeof observer !== 'object' || observer === null) {
|
279
|
-
throw new TypeError(
|
280
|
-
`Expected the observer to be an object. Instead, received: '${kindOf(
|
281
|
-
observer
|
282
|
-
)}'`
|
283
|
-
)
|
284
|
-
}
|
285
|
-
|
286
|
-
function observeState() {
|
287
|
-
if (observer.next) {
|
288
|
-
observer.next(getState())
|
289
|
-
}
|
290
|
-
}
|
291
|
-
|
292
|
-
observeState()
|
293
|
-
const unsubscribe = outerSubscribe(observeState)
|
294
|
-
return { unsubscribe }
|
295
|
-
},
|
296
|
-
|
297
|
-
[$$observable]() {
|
298
|
-
return this
|
299
|
-
},
|
300
|
-
}
|
301
|
-
}
|
302
|
-
|
303
|
-
// When a store is created, an "INIT" action is dispatched so that every
|
304
|
-
// reducer returns their initial state. This effectively populates
|
305
|
-
// the initial state tree.
|
306
|
-
dispatch({ type: ActionTypes.INIT })
|
307
|
-
|
308
|
-
return {
|
309
|
-
dispatch,
|
310
|
-
subscribe,
|
311
|
-
getState,
|
312
|
-
replaceReducer,
|
313
|
-
[$$observable]: observable,
|
314
|
-
}
|
315
|
-
}
|
316
|
-
|
317
|
-
/**
|
318
|
-
* Creates a Redux store that holds the state tree.
|
319
|
-
*
|
320
|
-
* **We recommend using `configureStore` from the
|
321
|
-
* `@reduxjs/toolkit` package**, which replaces `createStore`:
|
322
|
-
* **https://redux.js.org/introduction/why-rtk-is-redux-today**
|
323
|
-
*
|
324
|
-
* The only way to change the data in the store is to call `dispatch()` on it.
|
325
|
-
*
|
326
|
-
* There should only be a single store in your app. To specify how different
|
327
|
-
* parts of the state tree respond to actions, you may combine several reducers
|
328
|
-
* into a single reducer function by using `combineReducers`.
|
329
|
-
*
|
330
|
-
* @param {Function} reducer A function that returns the next state tree, given
|
331
|
-
* the current state tree and the action to handle.
|
332
|
-
*
|
333
|
-
* @param {any} [preloadedState] The initial state. You may optionally specify it
|
334
|
-
* to hydrate the state from the server in universal apps, or to restore a
|
335
|
-
* previously serialized user session.
|
336
|
-
* If you use `combineReducers` to produce the root reducer function, this must be
|
337
|
-
* an object with the same shape as `combineReducers` keys.
|
338
|
-
*
|
339
|
-
* @param {Function} [enhancer] The store enhancer. You may optionally specify it
|
340
|
-
* to enhance the store with third-party capabilities such as middleware,
|
341
|
-
* time travel, persistence, etc. The only store enhancer that ships with Redux
|
342
|
-
* is `applyMiddleware()`.
|
343
|
-
*
|
344
|
-
* @returns {Store} A Redux store that lets you read the state, dispatch actions
|
345
|
-
* and subscribe to changes.
|
346
|
-
*/
|
347
|
-
export const legacy_createStore = createStore
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import { createStore, legacy_createStore } from './createStore'
|
2
|
-
import combineReducers from './combineReducers'
|
3
|
-
import bindActionCreators from './bindActionCreators'
|
4
|
-
import applyMiddleware from './applyMiddleware'
|
5
|
-
import compose from './compose'
|
6
|
-
import warning from './utils/warning'
|
7
|
-
import __DO_NOT_USE__ActionTypes from './utils/actionTypes'
|
8
|
-
|
9
|
-
/*
|
10
|
-
* This is a dummy function to check if the function name has been altered by minification.
|
11
|
-
* If the function has been minified and NODE_ENV !== 'production', warn the user.
|
12
|
-
*/
|
13
|
-
function isCrushed() {}
|
14
|
-
|
15
|
-
if (
|
16
|
-
process.env.NODE_ENV !== 'production' &&
|
17
|
-
typeof isCrushed.name === 'string' &&
|
18
|
-
isCrushed.name !== 'isCrushed'
|
19
|
-
) {
|
20
|
-
warning(
|
21
|
-
'You are currently using minified code outside of NODE_ENV === "production". ' +
|
22
|
-
'This means that you are running a slower development build of Redux. ' +
|
23
|
-
'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' +
|
24
|
-
'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' +
|
25
|
-
'to ensure you have the correct code for your production build.'
|
26
|
-
)
|
27
|
-
}
|
28
|
-
|
29
|
-
export {
|
30
|
-
createStore,
|
31
|
-
legacy_createStore,
|
32
|
-
combineReducers,
|
33
|
-
bindActionCreators,
|
34
|
-
applyMiddleware,
|
35
|
-
compose,
|
36
|
-
__DO_NOT_USE__ActionTypes,
|
37
|
-
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* These are private action types reserved by Redux.
|
3
|
-
* For any unknown actions, you must return the current state.
|
4
|
-
* If the current state is undefined, you must return the initial state.
|
5
|
-
* Do not reference these action types directly in your code.
|
6
|
-
*/
|
7
|
-
|
8
|
-
const randomString = () =>
|
9
|
-
Math.random().toString(36).substring(7).split('').join('.')
|
10
|
-
|
11
|
-
const ActionTypes = {
|
12
|
-
INIT: `@@redux/INIT${randomString()}`,
|
13
|
-
REPLACE: `@@redux/REPLACE${randomString()}`,
|
14
|
-
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`,
|
15
|
-
}
|
16
|
-
|
17
|
-
export default ActionTypes
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
|
3
|
-
*
|
4
|
-
* Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
|
5
|
-
* during build.
|
6
|
-
* @param {number} code
|
7
|
-
*/
|
8
|
-
function formatProdErrorMessage(code) {
|
9
|
-
return (
|
10
|
-
`Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or ` +
|
11
|
-
'use the non-minified dev environment for full errors. '
|
12
|
-
)
|
13
|
-
}
|
14
|
-
|
15
|
-
export default formatProdErrorMessage
|
@@ -1,14 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @param {any} obj The object to inspect.
|
3
|
-
* @returns {boolean} True if the argument appears to be a plain object.
|
4
|
-
*/
|
5
|
-
export default function isPlainObject(obj) {
|
6
|
-
if (typeof obj !== 'object' || obj === null) return false
|
7
|
-
|
8
|
-
let proto = obj
|
9
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
10
|
-
proto = Object.getPrototypeOf(proto)
|
11
|
-
}
|
12
|
-
|
13
|
-
return Object.getPrototypeOf(obj) === proto
|
14
|
-
}
|
@@ -1,70 +0,0 @@
|
|
1
|
-
// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of
|
2
|
-
function miniKindOf(val) {
|
3
|
-
if (val === void 0) return 'undefined'
|
4
|
-
if (val === null) return 'null'
|
5
|
-
|
6
|
-
const type = typeof val
|
7
|
-
switch (type) {
|
8
|
-
case 'boolean':
|
9
|
-
case 'string':
|
10
|
-
case 'number':
|
11
|
-
case 'symbol':
|
12
|
-
case 'function': {
|
13
|
-
return type
|
14
|
-
}
|
15
|
-
default:
|
16
|
-
break
|
17
|
-
}
|
18
|
-
|
19
|
-
if (Array.isArray(val)) return 'array'
|
20
|
-
if (isDate(val)) return 'date'
|
21
|
-
if (isError(val)) return 'error'
|
22
|
-
|
23
|
-
const constructorName = ctorName(val)
|
24
|
-
switch (constructorName) {
|
25
|
-
case 'Symbol':
|
26
|
-
case 'Promise':
|
27
|
-
case 'WeakMap':
|
28
|
-
case 'WeakSet':
|
29
|
-
case 'Map':
|
30
|
-
case 'Set':
|
31
|
-
return constructorName
|
32
|
-
default:
|
33
|
-
break
|
34
|
-
}
|
35
|
-
|
36
|
-
// other
|
37
|
-
return type.slice(8, -1).toLowerCase().replace(/\s/g, '')
|
38
|
-
}
|
39
|
-
|
40
|
-
function ctorName(val) {
|
41
|
-
return typeof val.constructor === 'function' ? val.constructor.name : null
|
42
|
-
}
|
43
|
-
|
44
|
-
function isError(val) {
|
45
|
-
return (
|
46
|
-
val instanceof Error ||
|
47
|
-
(typeof val.message === 'string' &&
|
48
|
-
val.constructor &&
|
49
|
-
typeof val.constructor.stackTraceLimit === 'number')
|
50
|
-
)
|
51
|
-
}
|
52
|
-
|
53
|
-
function isDate(val) {
|
54
|
-
if (val instanceof Date) return true
|
55
|
-
return (
|
56
|
-
typeof val.toDateString === 'function' &&
|
57
|
-
typeof val.getDate === 'function' &&
|
58
|
-
typeof val.setDate === 'function'
|
59
|
-
)
|
60
|
-
}
|
61
|
-
|
62
|
-
export function kindOf(val) {
|
63
|
-
let typeOfVal = typeof val
|
64
|
-
|
65
|
-
if (process.env.NODE_ENV !== 'production') {
|
66
|
-
typeOfVal = miniKindOf(val)
|
67
|
-
}
|
68
|
-
|
69
|
-
return typeOfVal
|
70
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Prints a warning in the console if it exists.
|
3
|
-
*
|
4
|
-
* @param {String} message The warning message.
|
5
|
-
* @returns {void}
|
6
|
-
*/
|
7
|
-
export default function warning(message) {
|
8
|
-
/* eslint-disable no-console */
|
9
|
-
if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
10
|
-
console.error(message)
|
11
|
-
}
|
12
|
-
/* eslint-enable no-console */
|
13
|
-
try {
|
14
|
-
// This error was thrown as a convenience so that if you enable
|
15
|
-
// "break on all exceptions" in your console,
|
16
|
-
// it would pause the execution at this line.
|
17
|
-
throw new Error(message)
|
18
|
-
} catch (e) {} // eslint-disable-line no-empty
|
19
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2014-present, Facebook, Inc.
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# regenerator-runtime
|
2
|
-
|
3
|
-
Standalone runtime for
|
4
|
-
[Regenerator](https://github.com/facebook/regenerator)-compiled generator
|
5
|
-
and `async` functions.
|
6
|
-
|
7
|
-
To import the runtime as a module (recommended), either of the following
|
8
|
-
import styles will work:
|
9
|
-
```js
|
10
|
-
// CommonJS
|
11
|
-
const regeneratorRuntime = require("regenerator-runtime");
|
12
|
-
|
13
|
-
// ECMAScript 2015
|
14
|
-
import regeneratorRuntime from "regenerator-runtime";
|
15
|
-
```
|
16
|
-
|
17
|
-
To ensure that `regeneratorRuntime` is defined globally, either of the
|
18
|
-
following styles will work:
|
19
|
-
```js
|
20
|
-
// CommonJS
|
21
|
-
require("regenerator-runtime/runtime");
|
22
|
-
|
23
|
-
// ECMAScript 2015
|
24
|
-
import "regenerator-runtime/runtime.js";
|
25
|
-
```
|
26
|
-
|
27
|
-
To get the absolute file system path of `runtime.js`, evaluate the
|
28
|
-
following expression:
|
29
|
-
```js
|
30
|
-
require("regenerator-runtime/path").path
|
31
|
-
```
|
@@ -1,19 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "regenerator-runtime",
|
3
|
-
"author": "Ben Newman <bn@cs.stanford.edu>",
|
4
|
-
"description": "Runtime for Regenerator-compiled generator and async functions.",
|
5
|
-
"version": "0.13.9",
|
6
|
-
"main": "runtime.js",
|
7
|
-
"keywords": [
|
8
|
-
"regenerator",
|
9
|
-
"runtime",
|
10
|
-
"generator",
|
11
|
-
"async"
|
12
|
-
],
|
13
|
-
"sideEffects": true,
|
14
|
-
"repository": {
|
15
|
-
"type": "git",
|
16
|
-
"url": "https://github.com/facebook/regenerator/tree/master/packages/runtime"
|
17
|
-
},
|
18
|
-
"license": "MIT"
|
19
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) 2014-present, Facebook, Inc.
|
3
|
-
*
|
4
|
-
* This source code is licensed under the MIT license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*/
|
7
|
-
|
8
|
-
exports.path = require("path").join(
|
9
|
-
__dirname,
|
10
|
-
"runtime.js"
|
11
|
-
);
|