From 342c0b891569e2146f009b8411ca552c24d1ae10 Mon Sep 17 00:00:00 2001 From: sable Date: Fri, 17 Apr 2020 13:17:50 +0900 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20ReactRouter=E3=81=AA=E3=81=A9?= =?UTF-8?q?=E3=81=A8=E5=9E=8B=E5=AE=9A=E7=BE=A9=E3=81=8C=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E3=81=AB=E3=81=AA=E3=82=8B=E3=81=AE=E3=82=92=E5=9B=9E?= =?UTF-8?q?=E9=81=BF=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/store.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/store/store.ts b/src/store/store.ts index ec4bf25..4e195ea 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -12,7 +12,7 @@ import thunkMiddleware from 'redux-thunk' const __REDUX_DEVTOOLS_EXTENSION_COMPOSE__ = '__REDUX_DEVTOOLS_EXTENSION_COMPOSE__' const __NEXT_REDUX_STORE__ = '__NEXT_REDUX_STORE__' -export class ReduxStore { +export class ReduxStore { private _store: Store private _combineReducers: Reducer get store(): Store { @@ -33,7 +33,7 @@ export class ReduxStore { } return compose } - constructor(reducers: ReducersMapObject, middlewares: Middleware[] = [], debug: boolean = false) { + constructor(reducers: ReducersMapObject, middlewares: Middleware[] = [], debug: boolean = false) { const composeEnhancers = this._createComposer(debug) this._combineReducers = combineReducers(reducers) this._store = _createStore( From 1f0b7a2a7c4dd5407b71e0eac9397c1a2bcc0ecf Mon Sep 17 00:00:00 2001 From: sable Date: Fri, 17 Apr 2020 13:19:04 +0900 Subject: [PATCH 2/4] 0.3.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3827a5d..f22bd09 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "reactex", - "version": "0.3.0", + "version": "0.3.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 02a13b4..1b2ca47 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "reactex", - "version": "0.3.0", + "version": "0.3.1", "description": "TypeSafe Redux Reducers and Actions Library", "main": "dist/index.js", "types": "dist/index.d.ts", From 1ce79d8c223f6e9e2427e8e2d7db69eee411a6f1 Mon Sep 17 00:00:00 2001 From: sable Date: Fri, 17 Apr 2020 14:01:25 +0900 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20RouterReducer=E3=81=8C=E6=AD=A3?= =?UTF-8?q?=E3=81=97=E3=81=8F=E5=AE=9A=E7=BE=A9=E3=81=A7=E3=81=8D=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/store/store.d.ts | 6 +-- example/package-lock.json | 102 +++++++++++++++++++++++++++++++++++++ example/package.json | 2 + example/src/store/store.ts | 16 +++--- src/store/store.ts | 13 ++--- 5 files changed, 124 insertions(+), 15 deletions(-) diff --git a/dist/store/store.d.ts b/dist/store/store.d.ts index fd186f7..bed7a4b 100644 --- a/dist/store/store.d.ts +++ b/dist/store/store.d.ts @@ -1,9 +1,9 @@ import { AnyAction, Middleware, Reducer, ReducersMapObject, Store } from 'redux'; -export declare class ReduxStore { +export declare class ReduxStore { private _store; private _combineReducers; - get store(): Store; + get store(): Store; get combineReducers(): Reducer; private _createComposer; - constructor(reducers: ReducersMapObject, middlewares?: Middleware[], debug?: boolean); + constructor(reducers: ReducersMapObject, middlewares?: Middleware[], debug?: boolean); } diff --git a/example/package-lock.json b/example/package-lock.json index e6227cf..c8f14f7 100644 --- a/example/package-lock.json +++ b/example/package-lock.json @@ -3473,6 +3473,14 @@ "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz", "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==" }, + "connected-react-router": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/connected-react-router/-/connected-react-router-6.8.0.tgz", + "integrity": "sha512-E64/6krdJM3Ag3MMmh2nKPtMbH15s3JQDuaYJvOVXzu6MbHbDyIvuwLOyhQIuP4Om9zqEfZYiVyflROibSsONg==", + "requires": { + "prop-types": "^15.7.2" + } + }, "console-browserify": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", @@ -5810,6 +5818,11 @@ "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=" }, + "gud": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gud/-/gud-1.0.0.tgz", + "integrity": "sha512-zGEOVKFM5sVPPrYs7J5/hYEw2Pof8KCyOwyhG8sAF26mCAeUFAcYPu1mwB7hhpIP29zOIBaDqwuHdLp0jvZXjw==" + }, "gzip-size": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-5.1.1.tgz", @@ -5940,6 +5953,19 @@ "resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz", "integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==" }, + "history": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz", + "integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==", + "requires": { + "@babel/runtime": "^7.1.2", + "loose-envify": "^1.2.0", + "resolve-pathname": "^3.0.0", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0", + "value-equal": "^1.0.1" + } + }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -8323,6 +8349,16 @@ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" }, + "mini-create-react-context": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.3.2.tgz", + "integrity": "sha512-2v+OeetEyliMt5VHMXsBhABoJ0/M4RCe7fatd/fBy6SMiKazUSEt3gxxypfnk2SHMkdBYvorHRoQxuGoiwbzAw==", + "requires": { + "@babel/runtime": "^7.4.0", + "gud": "^1.0.0", + "tiny-warning": "^1.0.2" + } + }, "mini-css-extract-plugin": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.9.0.tgz", @@ -10733,6 +10769,52 @@ "react-is": "^16.9.0" } }, + "react-router": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.1.2.tgz", + "integrity": "sha512-yjEuMFy1ONK246B+rsa0cUam5OeAQ8pyclRDgpxuSCrAlJ1qN9uZ5IgyKC7gQg0w8OM50NXHEegPh/ks9YuR2A==", + "requires": { + "@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.3.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" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "path-to-regexp": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", + "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "requires": { + "isarray": "0.0.1" + } + } + } + }, + "react-router-dom": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.1.2.tgz", + "integrity": "sha512-7BPHAaIwWpZS074UKaw1FjVdZBSVWEk8IuDXdB+OkLb8vd/WRQIpA4ag9WQk61aEfQs47wHyjWUoUGGZxpQXew==", + "requires": { + "@babel/runtime": "^7.1.2", + "history": "^4.9.0", + "loose-envify": "^1.3.1", + "prop-types": "^15.6.2", + "react-router": "5.1.2", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0" + } + }, "react-scripts": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-3.4.0.tgz", @@ -11110,6 +11192,11 @@ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=" }, + "resolve-pathname": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz", + "integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==" + }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", @@ -12521,6 +12608,16 @@ "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=" }, + "tiny-invariant": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.1.0.tgz", + "integrity": "sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw==" + }, + "tiny-warning": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", + "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==" + }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -12903,6 +13000,11 @@ "spdx-expression-parse": "^3.0.0" } }, + "value-equal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz", + "integrity": "sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==" + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/example/package.json b/example/package.json index b7230c6..5f9d39b 100644 --- a/example/package.json +++ b/example/package.json @@ -3,9 +3,11 @@ "version": "0.1.0", "private": true, "dependencies": { + "connected-react-router": "^6.8.0", "react": "^16.13.0", "react-dom": "^16.13.0", "react-redux": "^7.2.0", + "react-router-dom": "^5.1.2", "react-scripts": "^3.4.0", "reactex": "file:.." }, diff --git a/example/src/store/store.ts b/example/src/store/store.ts index c6d285b..a48843d 100644 --- a/example/src/store/store.ts +++ b/example/src/store/store.ts @@ -1,12 +1,16 @@ import { ReduxStore } from 'reactex' import { RootModule } from '../modules/Root/RootModule' import { IRootState } from '../modules/Root/RootState' - +import { connectRouter, LocationChangeAction, routerMiddleware, RouterState } from 'connected-react-router' export type IAppState = { - root: IRootState -} -const reducers = { - root: RootModule.reducer + root: IRootState, + router: RouterState } -const rStore: ReduxStore = new ReduxStore(reducers, [], true) +const rStore = new ReduxStore({ + root: RootModule.reducer, + router: connectRouter(history) +}, [ + routerMiddleware(history) +], process.env.NODE_ENV === 'development') + export default rStore.store diff --git a/src/store/store.ts b/src/store/store.ts index 4e195ea..5fab5e5 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -1,5 +1,6 @@ import { - AnyAction, applyMiddleware, + AnyAction, + applyMiddleware, combineReducers, compose, createStore as _createStore, @@ -12,10 +13,10 @@ import thunkMiddleware from 'redux-thunk' const __REDUX_DEVTOOLS_EXTENSION_COMPOSE__ = '__REDUX_DEVTOOLS_EXTENSION_COMPOSE__' const __NEXT_REDUX_STORE__ = '__NEXT_REDUX_STORE__' -export class ReduxStore { - private _store: Store +export class ReduxStore { + private _store: Store private _combineReducers: Reducer - get store(): Store { + get store(): Store { return this._store } get combineReducers(): Reducer { @@ -35,8 +36,8 @@ export class ReduxStore { } constructor(reducers: ReducersMapObject, middlewares: Middleware[] = [], debug: boolean = false) { const composeEnhancers = this._createComposer(debug) - this._combineReducers = combineReducers(reducers) - this._store = _createStore( + this._combineReducers = combineReducers(reducers) + this._store = _createStore( this._combineReducers, composeEnhancers( applyMiddleware( From 498312a5edb454ef97f18f6b3b7c01e95ea62b1c Mon Sep 17 00:00:00 2001 From: sable Date: Fri, 17 Apr 2020 14:01:40 +0900 Subject: [PATCH 4/4] 0.3.2 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index f22bd09..c5432fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "reactex", - "version": "0.3.1", + "version": "0.3.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1b2ca47..f72b46f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "reactex", - "version": "0.3.1", + "version": "0.3.2", "description": "TypeSafe Redux Reducers and Actions Library", "main": "dist/index.js", "types": "dist/index.d.ts",