diff --git a/flow-typed/npm/connected-react-router_vx.x.x.js b/flow-typed/npm/connected-react-router_vx.x.x.js new file mode 100644 index 0000000..32d4c79 --- /dev/null +++ b/flow-typed/npm/connected-react-router_vx.x.x.js @@ -0,0 +1,144 @@ +// flow-typed signature: 6e245267dc2c77f3c65b17a86ac788dc +// flow-typed version: <>/connected-react-router_v^4.3.0/flow_v0.63.1 + +/** + * This is an autogenerated libdef stub for: + * + * 'connected-react-router' + * + * Fill this stub out by replacing all the `any` types. + * + * Once filled out, we encourage you to share your work with the + * community by sending a pull request to: + * https://github.com/flowtype/flow-typed + */ + +declare module 'connected-react-router' { + declare module.exports: any; +} + +/** + * We include stubs for each file inside this npm package in case you need to + * require those files directly. Feel free to delete any files that aren't + * needed. + */ +declare module 'connected-react-router/immutable' { + declare module.exports: any; +} + +declare module 'connected-react-router/lib/actions' { + declare module.exports: any; +} + +declare module 'connected-react-router/lib/ConnectedRouter' { + declare module.exports: any; +} + +declare module 'connected-react-router/lib/createAll' { + declare module.exports: any; +} + +declare module 'connected-react-router/lib/immutable' { + declare module.exports: any; +} + +declare module 'connected-react-router/lib/index' { + declare module.exports: any; +} + +declare module 'connected-react-router/lib/middleware' { + declare module.exports: any; +} + +declare module 'connected-react-router/lib/reducer' { + declare module.exports: any; +} + +declare module 'connected-react-router/lib/structure/immutable/getIn' { + declare module.exports: any; +} + +declare module 'connected-react-router/lib/structure/immutable/index' { + declare module.exports: any; +} + +declare module 'connected-react-router/lib/structure/immutable/setIn' { + declare module.exports: any; +} + +declare module 'connected-react-router/lib/structure/plain/getIn' { + declare module.exports: any; +} + +declare module 'connected-react-router/lib/structure/plain/index' { + declare module.exports: any; +} + +declare module 'connected-react-router/lib/structure/plain/setIn' { + declare module.exports: any; +} + +declare module 'connected-react-router/umd/ConnectedReactRouter' { + declare module.exports: any; +} + +declare module 'connected-react-router/umd/ConnectedReactRouter.min' { + declare module.exports: any; +} + +declare module 'connected-react-router/webpack.config' { + declare module.exports: any; +} + +// Filename aliases +declare module 'connected-react-router/immutable.js' { + declare module.exports: $Exports<'connected-react-router/immutable'>; +} +declare module 'connected-react-router/lib/actions.js' { + declare module.exports: $Exports<'connected-react-router/lib/actions'>; +} +declare module 'connected-react-router/lib/ConnectedRouter.js' { + declare module.exports: $Exports<'connected-react-router/lib/ConnectedRouter'>; +} +declare module 'connected-react-router/lib/createAll.js' { + declare module.exports: $Exports<'connected-react-router/lib/createAll'>; +} +declare module 'connected-react-router/lib/immutable.js' { + declare module.exports: $Exports<'connected-react-router/lib/immutable'>; +} +declare module 'connected-react-router/lib/index.js' { + declare module.exports: $Exports<'connected-react-router/lib/index'>; +} +declare module 'connected-react-router/lib/middleware.js' { + declare module.exports: $Exports<'connected-react-router/lib/middleware'>; +} +declare module 'connected-react-router/lib/reducer.js' { + declare module.exports: $Exports<'connected-react-router/lib/reducer'>; +} +declare module 'connected-react-router/lib/structure/immutable/getIn.js' { + declare module.exports: $Exports<'connected-react-router/lib/structure/immutable/getIn'>; +} +declare module 'connected-react-router/lib/structure/immutable/index.js' { + declare module.exports: $Exports<'connected-react-router/lib/structure/immutable/index'>; +} +declare module 'connected-react-router/lib/structure/immutable/setIn.js' { + declare module.exports: $Exports<'connected-react-router/lib/structure/immutable/setIn'>; +} +declare module 'connected-react-router/lib/structure/plain/getIn.js' { + declare module.exports: $Exports<'connected-react-router/lib/structure/plain/getIn'>; +} +declare module 'connected-react-router/lib/structure/plain/index.js' { + declare module.exports: $Exports<'connected-react-router/lib/structure/plain/index'>; +} +declare module 'connected-react-router/lib/structure/plain/setIn.js' { + declare module.exports: $Exports<'connected-react-router/lib/structure/plain/setIn'>; +} +declare module 'connected-react-router/umd/ConnectedReactRouter.js' { + declare module.exports: $Exports<'connected-react-router/umd/ConnectedReactRouter'>; +} +declare module 'connected-react-router/umd/ConnectedReactRouter.min.js' { + declare module.exports: $Exports<'connected-react-router/umd/ConnectedReactRouter.min'>; +} +declare module 'connected-react-router/webpack.config.js' { + declare module.exports: $Exports<'connected-react-router/webpack.config'>; +} diff --git a/flow-typed/npm/history_vx.x.x.js b/flow-typed/npm/history_vx.x.x.js new file mode 100644 index 0000000..43ed7bd --- /dev/null +++ b/flow-typed/npm/history_vx.x.x.js @@ -0,0 +1,150 @@ +// flow-typed signature: ddd881205b06d6253ca3f8ef26407f59 +// flow-typed version: <>/history_v^4.7.2/flow_v0.63.1 + +/** + * This is an autogenerated libdef stub for: + * + * 'history' + * + * Fill this stub out by replacing all the `any` types. + * + * Once filled out, we encourage you to share your work with the + * community by sending a pull request to: + * https://github.com/flowtype/flow-typed + */ + +declare module 'history' { + declare module.exports: any; +} + +/** + * We include stubs for each file inside this npm package in case you need to + * require those files directly. Feel free to delete any files that aren't + * needed. + */ +declare module 'history/createBrowserHistory' { + declare module.exports: any; +} + +declare module 'history/createHashHistory' { + declare module.exports: any; +} + +declare module 'history/createMemoryHistory' { + declare module.exports: any; +} + +declare module 'history/createTransitionManager' { + declare module.exports: any; +} + +declare module 'history/DOMUtils' { + declare module.exports: any; +} + +declare module 'history/es/createBrowserHistory' { + declare module.exports: any; +} + +declare module 'history/es/createHashHistory' { + declare module.exports: any; +} + +declare module 'history/es/createMemoryHistory' { + declare module.exports: any; +} + +declare module 'history/es/createTransitionManager' { + declare module.exports: any; +} + +declare module 'history/es/DOMUtils' { + declare module.exports: any; +} + +declare module 'history/es/index' { + declare module.exports: any; +} + +declare module 'history/es/LocationUtils' { + declare module.exports: any; +} + +declare module 'history/es/PathUtils' { + declare module.exports: any; +} + +declare module 'history/LocationUtils' { + declare module.exports: any; +} + +declare module 'history/PathUtils' { + declare module.exports: any; +} + +declare module 'history/umd/history' { + declare module.exports: any; +} + +declare module 'history/umd/history.min' { + declare module.exports: any; +} + +// Filename aliases +declare module 'history/createBrowserHistory.js' { + declare module.exports: $Exports<'history/createBrowserHistory'>; +} +declare module 'history/createHashHistory.js' { + declare module.exports: $Exports<'history/createHashHistory'>; +} +declare module 'history/createMemoryHistory.js' { + declare module.exports: $Exports<'history/createMemoryHistory'>; +} +declare module 'history/createTransitionManager.js' { + declare module.exports: $Exports<'history/createTransitionManager'>; +} +declare module 'history/DOMUtils.js' { + declare module.exports: $Exports<'history/DOMUtils'>; +} +declare module 'history/es/createBrowserHistory.js' { + declare module.exports: $Exports<'history/es/createBrowserHistory'>; +} +declare module 'history/es/createHashHistory.js' { + declare module.exports: $Exports<'history/es/createHashHistory'>; +} +declare module 'history/es/createMemoryHistory.js' { + declare module.exports: $Exports<'history/es/createMemoryHistory'>; +} +declare module 'history/es/createTransitionManager.js' { + declare module.exports: $Exports<'history/es/createTransitionManager'>; +} +declare module 'history/es/DOMUtils.js' { + declare module.exports: $Exports<'history/es/DOMUtils'>; +} +declare module 'history/es/index.js' { + declare module.exports: $Exports<'history/es/index'>; +} +declare module 'history/es/LocationUtils.js' { + declare module.exports: $Exports<'history/es/LocationUtils'>; +} +declare module 'history/es/PathUtils.js' { + declare module.exports: $Exports<'history/es/PathUtils'>; +} +declare module 'history/index' { + declare module.exports: $Exports<'history'>; +} +declare module 'history/index.js' { + declare module.exports: $Exports<'history'>; +} +declare module 'history/LocationUtils.js' { + declare module.exports: $Exports<'history/LocationUtils'>; +} +declare module 'history/PathUtils.js' { + declare module.exports: $Exports<'history/PathUtils'>; +} +declare module 'history/umd/history.js' { + declare module.exports: $Exports<'history/umd/history'>; +} +declare module 'history/umd/history.min.js' { + declare module.exports: $Exports<'history/umd/history.min'>; +} diff --git a/flow-typed/npm/qs_v6.5.x.js b/flow-typed/npm/qs_v6.5.x.js new file mode 100644 index 0000000..59d3b29 --- /dev/null +++ b/flow-typed/npm/qs_v6.5.x.js @@ -0,0 +1,58 @@ +// flow-typed signature: 715c2f8b80fc0049acaff07253098596 +// flow-typed version: a7cda84c32/qs_v6.5.x/flow_>=v0.45.x + +declare module "qs" { + declare type ParseOptions = { + allowPrototypes?: boolean, + arrayLimit?: number, + decoder?: Function, + delimiter?: string, + depth?: number, + parameterLimit?: number, + plainObjects?: boolean, + strictNullHandling?: boolean, + ignoreQueryPrefix?: boolean, + parseArrays?: boolean, + allowDots?: boolean + }; + + declare type ArrayFormat = "brackets" | "indices" | "repeat"; + + declare type FilterFunction = (prefix: string, value: any) => any; + declare type FilterArray = Array; + declare type Filter = FilterArray | FilterFunction; + + declare type StringifyOptions = { + encoder?: Function, + delimiter?: string, + strictNullHandling?: boolean, + skipNulls?: boolean, + encode?: boolean, + sort?: Function, + allowDots?: boolean, + serializeDate?: Function, + encodeValuesOnly?: boolean, + format?: string, + addQueryPrefix?: boolean, + arrayFormat?: ArrayFormat, + filter?: Filter + }; + + declare type Formatter = (any) => string; + + declare type Formats = { + RFC1738: string, + RFC3986: string, + "default": string, + formatters: { + RFC1738: Formatter, + RFC3986: Formatter + } + }; + + declare module.exports: { + parse(str: string, opts?: ParseOptions): Object, + stringify(obj: Object | Array, opts?: StringifyOptions): string, + formats: Formats + }; +} diff --git a/flow-typed/npm/react-router-redux_vx.x.x.js b/flow-typed/npm/react-router-redux_vx.x.x.js index 28cb593..a196e14 100644 --- a/flow-typed/npm/react-router-redux_vx.x.x.js +++ b/flow-typed/npm/react-router-redux_vx.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 3e8edab923d0aa2f10c775118a333d9d -// flow-typed version: <>/react-router-redux_v^4.0.8/flow_v0.63.1 +// flow-typed signature: d718e5d55a7736869b6e8b5a06bbba23 +// flow-typed version: <>/react-router-redux_v^5.0.0-alpha.9/flow_v0.63.1 /** * This is an autogenerated libdef stub for: @@ -22,88 +22,101 @@ declare module 'react-router-redux' { * require those files directly. Feel free to delete any files that aren't * needed. */ -declare module 'react-router-redux/dist/ReactRouterRedux' { +declare module 'react-router-redux/actions' { declare module.exports: any; } -declare module 'react-router-redux/dist/ReactRouterRedux.min' { +declare module 'react-router-redux/ConnectedRouter' { declare module.exports: any; } -declare module 'react-router-redux/lib/actions' { +declare module 'react-router-redux/es/actions' { declare module.exports: any; } -declare module 'react-router-redux/lib/index' { +declare module 'react-router-redux/es/ConnectedRouter' { declare module.exports: any; } -declare module 'react-router-redux/lib/middleware' { +declare module 'react-router-redux/es/index' { declare module.exports: any; } -declare module 'react-router-redux/lib/reducer' { +declare module 'react-router-redux/es/middleware' { declare module.exports: any; } -declare module 'react-router-redux/lib/sync' { +declare module 'react-router-redux/es/reducer' { declare module.exports: any; } -declare module 'react-router-redux/src/actions' { +declare module 'react-router-redux/es/selectors' { declare module.exports: any; } -declare module 'react-router-redux/src/index' { +declare module 'react-router-redux/middleware' { declare module.exports: any; } -declare module 'react-router-redux/src/middleware' { +declare module 'react-router-redux/reducer' { declare module.exports: any; } -declare module 'react-router-redux/src/reducer' { +declare module 'react-router-redux/selectors' { declare module.exports: any; } -declare module 'react-router-redux/src/sync' { +declare module 'react-router-redux/umd/react-router-redux' { + declare module.exports: any; +} + +declare module 'react-router-redux/umd/react-router-redux.min' { declare module.exports: any; } // Filename aliases -declare module 'react-router-redux/dist/ReactRouterRedux.js' { - declare module.exports: $Exports<'react-router-redux/dist/ReactRouterRedux'>; +declare module 'react-router-redux/actions.js' { + declare module.exports: $Exports<'react-router-redux/actions'>; +} +declare module 'react-router-redux/ConnectedRouter.js' { + declare module.exports: $Exports<'react-router-redux/ConnectedRouter'>; +} +declare module 'react-router-redux/es/actions.js' { + declare module.exports: $Exports<'react-router-redux/es/actions'>; +} +declare module 'react-router-redux/es/ConnectedRouter.js' { + declare module.exports: $Exports<'react-router-redux/es/ConnectedRouter'>; } -declare module 'react-router-redux/dist/ReactRouterRedux.min.js' { - declare module.exports: $Exports<'react-router-redux/dist/ReactRouterRedux.min'>; +declare module 'react-router-redux/es/index.js' { + declare module.exports: $Exports<'react-router-redux/es/index'>; } -declare module 'react-router-redux/lib/actions.js' { - declare module.exports: $Exports<'react-router-redux/lib/actions'>; +declare module 'react-router-redux/es/middleware.js' { + declare module.exports: $Exports<'react-router-redux/es/middleware'>; } -declare module 'react-router-redux/lib/index.js' { - declare module.exports: $Exports<'react-router-redux/lib/index'>; +declare module 'react-router-redux/es/reducer.js' { + declare module.exports: $Exports<'react-router-redux/es/reducer'>; } -declare module 'react-router-redux/lib/middleware.js' { - declare module.exports: $Exports<'react-router-redux/lib/middleware'>; +declare module 'react-router-redux/es/selectors.js' { + declare module.exports: $Exports<'react-router-redux/es/selectors'>; } -declare module 'react-router-redux/lib/reducer.js' { - declare module.exports: $Exports<'react-router-redux/lib/reducer'>; +declare module 'react-router-redux/index' { + declare module.exports: $Exports<'react-router-redux'>; } -declare module 'react-router-redux/lib/sync.js' { - declare module.exports: $Exports<'react-router-redux/lib/sync'>; +declare module 'react-router-redux/index.js' { + declare module.exports: $Exports<'react-router-redux'>; } -declare module 'react-router-redux/src/actions.js' { - declare module.exports: $Exports<'react-router-redux/src/actions'>; +declare module 'react-router-redux/middleware.js' { + declare module.exports: $Exports<'react-router-redux/middleware'>; } -declare module 'react-router-redux/src/index.js' { - declare module.exports: $Exports<'react-router-redux/src/index'>; +declare module 'react-router-redux/reducer.js' { + declare module.exports: $Exports<'react-router-redux/reducer'>; } -declare module 'react-router-redux/src/middleware.js' { - declare module.exports: $Exports<'react-router-redux/src/middleware'>; +declare module 'react-router-redux/selectors.js' { + declare module.exports: $Exports<'react-router-redux/selectors'>; } -declare module 'react-router-redux/src/reducer.js' { - declare module.exports: $Exports<'react-router-redux/src/reducer'>; +declare module 'react-router-redux/umd/react-router-redux.js' { + declare module.exports: $Exports<'react-router-redux/umd/react-router-redux'>; } -declare module 'react-router-redux/src/sync.js' { - declare module.exports: $Exports<'react-router-redux/src/sync'>; +declare module 'react-router-redux/umd/react-router-redux.min.js' { + declare module.exports: $Exports<'react-router-redux/umd/react-router-redux.min'>; } diff --git a/flow-typed/npm/react-router_v4.x.x.js b/flow-typed/npm/react-router_v4.x.x.js new file mode 100644 index 0000000..6850520 --- /dev/null +++ b/flow-typed/npm/react-router_v4.x.x.js @@ -0,0 +1,125 @@ +// flow-typed signature: 1e6728f0a649edac3689d6e2db7487a7 +// flow-typed version: 01716df816/react-router_v4.x.x/flow_>=v0.53.x + +declare module "react-router" { + // NOTE: many of these are re-exported by react-router-dom and + // react-router-native, so when making changes, please be sure to update those + // as well. + declare export type Location = { + pathname: string, + search: string, + hash: string, + state?: any, + key?: string + }; + + declare export type LocationShape = { + pathname?: string, + search?: string, + hash?: string, + state?: any + }; + + declare export type HistoryAction = "PUSH" | "REPLACE" | "POP"; + + declare export type RouterHistory = { + length: number, + location: Location, + action: HistoryAction, + listen( + callback: (location: Location, action: HistoryAction) => void + ): () => void, + push(path: string | LocationShape, state?: any): void, + replace(path: string | LocationShape, state?: any): void, + go(n: number): void, + goBack(): void, + goForward(): void, + canGo?: (n: number) => boolean, + block( + callback: (location: Location, action: HistoryAction) => boolean + ): void, + // createMemoryHistory + index?: number, + entries?: Array + }; + + declare export type Match = { + params: { [key: string]: ?string }, + isExact: boolean, + path: string, + url: string + }; + + declare export type ContextRouter = {| + history: RouterHistory, + location: Location, + match: Match + |}; + + declare export type GetUserConfirmation = ( + message: string, + callback: (confirmed: boolean) => void + ) => void; + + declare type StaticRouterContext = { + url?: string + }; + + declare export class StaticRouter extends React$Component<{ + basename?: string, + location?: string | Location, + context: StaticRouterContext, + children?: React$Node + }> {} + + declare export class MemoryRouter extends React$Component<{ + initialEntries?: Array, + initialIndex?: number, + getUserConfirmation?: GetUserConfirmation, + keyLength?: number, + children?: React$Node + }> {} + + declare export class Router extends React$Component<{ + history: RouterHistory, + children?: React$Node + }> {} + + declare export class Prompt extends React$Component<{ + message: string | ((location: Location) => string | true), + when?: boolean + }> {} + + declare export class Redirect extends React$Component<{ + to: string | LocationShape, + push?: boolean + }> {} + + declare export class Route extends React$Component<{ + component?: React$ComponentType<*>, + render?: (router: ContextRouter) => React$Node, + children?: React$ComponentType | React$Node, + path?: string, + exact?: boolean, + strict?: boolean + }> {} + + declare export class Switch extends React$Component<{ + children?: React$Node + }> {} + + declare export function withRouter

( + Component: React$ComponentType<{| ...ContextRouter, ...P |}> + ): React$ComponentType

; + + declare type MatchPathOptions = { + path?: string, + exact?: boolean, + strict?: boolean, + sensitive?: boolean + }; + declare export function matchPath( + pathname: string, + options?: MatchPathOptions | string + ): null | Match; +} diff --git a/flow-typed/npm/routes_vx.x.x.js b/flow-typed/npm/routes_vx.x.x.js new file mode 100644 index 0000000..6ee9419 --- /dev/null +++ b/flow-typed/npm/routes_vx.x.x.js @@ -0,0 +1,59 @@ +// flow-typed signature: 71a1ce9a898d35cbfc48bdb31b475ff2 +// flow-typed version: <>/routes_v^2.1.0/flow_v0.63.1 + +/** + * This is an autogenerated libdef stub for: + * + * 'routes' + * + * Fill this stub out by replacing all the `any` types. + * + * Once filled out, we encourage you to share your work with the + * community by sending a pull request to: + * https://github.com/flowtype/flow-typed + */ + +declare module 'routes' { + declare module.exports: any; +} + +/** + * We include stubs for each file inside this npm package in case you need to + * require those files directly. Feel free to delete any files that aren't + * needed. + */ +declare module 'routes/dist/routes' { + declare module.exports: any; +} + +declare module 'routes/test/example' { + declare module.exports: any; +} + +declare module 'routes/test/next' { + declare module.exports: any; +} + +declare module 'routes/test/test' { + declare module.exports: any; +} + +// Filename aliases +declare module 'routes/dist/routes.js' { + declare module.exports: $Exports<'routes/dist/routes'>; +} +declare module 'routes/index' { + declare module.exports: $Exports<'routes'>; +} +declare module 'routes/index.js' { + declare module.exports: $Exports<'routes'>; +} +declare module 'routes/test/example.js' { + declare module.exports: $Exports<'routes/test/example'>; +} +declare module 'routes/test/next.js' { + declare module.exports: $Exports<'routes/test/next'>; +} +declare module 'routes/test/test.js' { + declare module.exports: $Exports<'routes/test/test'>; +} diff --git a/package-lock.json b/package-lock.json index 34588d1..38b8dd3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3060,6 +3060,15 @@ "integrity": "sha1-sGhzk0vF40T+9hGhlqb6rgruAVo=", "dev": true }, + "connected-react-router": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/connected-react-router/-/connected-react-router-4.3.0.tgz", + "integrity": "sha512-HUXyhpA2EyOcxKftkrETWwGIsJ/PQ6yjtWMAYPfwqnjVVmMOex0RfkPpub8e+/VAU/XV+DZ62YjFeDvPo6boZw==", + "requires": { + "immutable": "3.8.2", + "react-router": "4.2.0" + } + }, "console-browserify": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", @@ -3282,16 +3291,6 @@ "sha.js": "2.4.9" } }, - "create-react-class": { - "version": "15.6.2", - "resolved": "https://registry.npmjs.org/create-react-class/-/create-react-class-15.6.2.tgz", - "integrity": "sha1-zx7RXxKq1/FO9fLf4F5sQvke8Co=", - "requires": { - "fbjs": "0.8.15", - "loose-envify": "1.3.1", - "object-assign": "4.1.1" - } - }, "cross-env": { "version": "5.1.3", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-5.1.3.tgz", @@ -7491,13 +7490,14 @@ "dev": true }, "history": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/history/-/history-3.3.0.tgz", - "integrity": "sha1-/O3M6PEpdTcVRdc1RhAzV5ptrpw=", + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/history/-/history-4.7.2.tgz", + "integrity": "sha512-1zkBRWW6XweO0NBcjiphtVJVsIQ+SXF29z9DVkceeaSLVMFXHool+fdCZD4spDCfZJCILPILc3bm7Bc+HRi0nA==", "requires": { "invariant": "2.2.2", "loose-envify": "1.3.1", - "query-string": "4.3.4", + "resolve-pathname": "2.2.0", + "value-equal": "0.4.0", "warning": "3.0.0" } }, @@ -12201,7 +12201,6 @@ "version": "1.7.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", - "dev": true, "requires": { "isarray": "0.0.1" }, @@ -12209,8 +12208,7 @@ "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" } } }, @@ -15570,13 +15568,13 @@ "qs": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", - "dev": true + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" }, "query-string": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", + "dev": true, "requires": { "object-assign": "4.1.1", "strict-uri-encode": "1.1.0" @@ -16039,31 +16037,19 @@ } }, "react-router": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-3.2.0.tgz", - "integrity": "sha512-sXlLOg0TRCqnjCVskqBHGjzNjcJKUqXEKnDSuxMYJSPJNq9hROE9VsiIW2kfIq7Ev+20Iz0nxayekXyv0XNmsg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-4.2.0.tgz", + "integrity": "sha512-DY6pjwRhdARE4TDw7XjxjZsbx9lKmIcyZoZ+SDO7SBJ1KUeWNxT22Kara2AC7u6/c2SYEHlEDLnzBCcNhLE8Vg==", "requires": { - "create-react-class": "15.6.2", - "history": "3.3.0", - "hoist-non-react-statics": "1.2.0", + "history": "4.7.2", + "hoist-non-react-statics": "2.3.1", "invariant": "2.2.2", "loose-envify": "1.3.1", + "path-to-regexp": "1.7.0", "prop-types": "15.6.0", "warning": "3.0.0" - }, - "dependencies": { - "hoist-non-react-statics": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz", - "integrity": "sha1-qkSM8JhtVcxAdzsXF0t90GbLfPs=" - } } }, - "react-router-redux": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/react-router-redux/-/react-router-redux-4.0.8.tgz", - "integrity": "sha1-InQDWWtRUeGCN32rg1tdRfD4BU4=" - }, "react-styleguidist": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/react-styleguidist/-/react-styleguidist-6.1.0.tgz", @@ -16874,6 +16860,11 @@ "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", "dev": true }, + "resolve-pathname": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-2.2.0.tgz", + "integrity": "sha512-bAFz9ld18RzJfddgrO2e/0S2O81710++chRMUxHjXOYKF6jTAMrUNZrEZ1PvV0zlhfjidm08iRPdTLPno1FuRg==" + }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", @@ -16936,6 +16927,11 @@ "inherits": "2.0.3" } }, + "routes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/routes/-/routes-2.1.0.tgz", + "integrity": "sha1-R1VxGSpI+ZtsBl3ZJrt16K6D6KI=" + }, "rst-selector-parser": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz", @@ -17921,7 +17917,8 @@ "strict-uri-encode": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", + "dev": true }, "string-length": { "version": "2.0.0", @@ -19807,6 +19804,11 @@ "spdx-expression-parse": "1.0.4" } }, + "value-equal": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-0.4.0.tgz", + "integrity": "sha512-x+cYdNnaA3CxvMaTX0INdTCN8m8aF2uY9BvEqmxuYp8bL09cs/kWVQPVGcA35fMktdOsP69IgU7wFj/61dJHEw==" + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/package.json b/package.json index 012fb48..ced1ed1 100644 --- a/package.json +++ b/package.json @@ -147,18 +147,21 @@ }, "dependencies": { "classnames": "^2.2.5", + "connected-react-router": "^4.3.0", + "history": "^4.7.2", "immutable": "^3.8.2", "nskeymirror": "^0.1.2", "prop-types": "^15.6.0", + "qs": "^6.5.1", "react": "^16.2.0", "react-dom": "^16.2.0", "react-hot-loader": "^3.1.3", "react-redux": "^5.0.6", - "react-router": "^3.2.0", - "react-router-redux": "^4.0.8", + "react-router": "^4.2.0", "redux": "^3.7.2", "redux-saga": "^0.16.0", - "reselect": "^3.0.1" + "reselect": "^3.0.1", + "routes": "^2.1.0" }, "engines": { "node": "8.9.4", diff --git a/src/components/Root.jsx b/src/components/Root.jsx index 24aed05..e602c66 100644 --- a/src/components/Root.jsx +++ b/src/components/Root.jsx @@ -2,18 +2,28 @@ import React from 'react' import { Provider } from 'react-redux' -import { Router } from 'react-router' -import getRoutes from 'routes/index' -import type { Store } from 'redux' +import { ConnectedRouter } from 'connected-react-router/immutable' +import { Route, Switch } from 'react-router' +import { App, MainMenu, Level, Help, HighScores } from 'components/container' +import ROUTES from 'routes/index' type Props = { - store: Store<*, *, *>, - history: Object + store: any, + history: any } const Root = ({ store, history }: Props) => ( - {getRoutes()} + + + + + + + + + + ) diff --git a/src/components/container/App/index.jsx b/src/components/container/App/index.jsx index 99208c7..058ae2f 100644 --- a/src/components/container/App/index.jsx +++ b/src/components/container/App/index.jsx @@ -4,6 +4,7 @@ import 'styles/reset.css' import 'styles/global.css' import React, { Component } from 'react' +import { withRouter } from 'react-router' import { connect } from 'react-redux' import { clock } from 'domains/time/selectors' import { startRecording, stopRecording } from 'domains/recorder/actionCreators' @@ -109,4 +110,4 @@ class App extends Component { } } -export default connect(mapStateToProps, mapDispatchToProps)(App) +export default withRouter(connect(mapStateToProps, mapDispatchToProps)(App)) diff --git a/src/components/container/Level/index.jsx b/src/components/container/Level/index.jsx index 9d264e1..062988f 100644 --- a/src/components/container/Level/index.jsx +++ b/src/components/container/Level/index.jsx @@ -29,7 +29,7 @@ import { localState } from 'domains/local/selectors' import { GameModal } from 'components/container' import { Container, Message } from 'components/presentational' import classNames from 'classnames' -import { ROUTES } from 'routes/paths' +import ROUTES from 'routes/index' import LevelRow from './LevelRow' import styles from './styles.css' diff --git a/src/components/container/MainMenu/index.jsx b/src/components/container/MainMenu/index.jsx index 2d225e8..a13dd96 100644 --- a/src/components/container/MainMenu/index.jsx +++ b/src/components/container/MainMenu/index.jsx @@ -9,7 +9,7 @@ import { localState } from 'domains/local/selectors' import { resume, jumpToLevel, randomLevel } from 'domains/level/actionCreators' import * as LevelConstants from 'domains/level/constants' import { Container, Button } from 'components/presentational' -import { ROUTES } from 'routes/paths' +import ROUTES from 'routes/index' import styles from './styles.css' diff --git a/src/domains/navigation/ActionCreators.js b/src/domains/navigation/ActionCreators.js index 77a6b56..de08e79 100644 --- a/src/domains/navigation/ActionCreators.js +++ b/src/domains/navigation/ActionCreators.js @@ -1,4 +1,4 @@ -import { push, replace, go, goBack } from 'react-router-redux' +import { push, replace, go, goBack } from 'connected-react-router/immutable' export const navigateTo = (pathname = '', search = '') => push({ pathname, search }) diff --git a/src/domains/navigation/Constants.js b/src/domains/navigation/Constants.js deleted file mode 100644 index ab7cf19..0000000 --- a/src/domains/navigation/Constants.js +++ /dev/null @@ -1,4 +0,0 @@ -export default { - NEXT_LOCATION: 'PUSH', - PREVIOUS_LOCATION: 'POP' -} diff --git a/src/domains/navigation/Reducer.js b/src/domains/navigation/Reducer.js index aea4dfc..cfe0a87 100644 --- a/src/domains/navigation/Reducer.js +++ b/src/domains/navigation/Reducer.js @@ -1,14 +1,14 @@ import Immutable from 'immutable' -import { LOCATION_CHANGE } from 'react-router-redux' +import { LOCATION_CHANGE } from 'connected-react-router/immutable' const initialState = Immutable.fromJS({ - locationBeforeTransitions: null + location: null }) const navigationReducer = (state = initialState, action = {}) => { switch (action.type) { case LOCATION_CHANGE: - return state.set('locationBeforeTransitions', action.payload) + return state.set('location', Immutable.fromJS(action.payload)) default: return state } diff --git a/src/domains/navigation/Selectors.js b/src/domains/navigation/Selectors.js index 23954b0..123b87c 100644 --- a/src/domains/navigation/Selectors.js +++ b/src/domains/navigation/Selectors.js @@ -1,4 +1,4 @@ import Immutable from 'immutable' export const currentLocation = (state = Immutable.Map()) => - state.getIn(['navigation', 'locationBeforeTransitions']) + state.getIn(['navigation', 'location']) diff --git a/src/domains/recorder/Middleware.js b/src/domains/recorder/Middleware.js index 6b4314f..9993284 100644 --- a/src/domains/recorder/Middleware.js +++ b/src/domains/recorder/Middleware.js @@ -15,7 +15,7 @@ const recorderMiddleware = store => { const initialState = store.getState().toJS() initialState.recorder = null initialState.replayer = null - initialState.navigation.locationBeforeTransitions.key = '' + initialState.navigation.location.key = '' initialState.__META__ = {} initialState.__META__.timestamp = Date.now() diff --git a/src/features/level/saga.js b/src/features/level/saga.js index a6b91f3..59a6de2 100644 --- a/src/features/level/saga.js +++ b/src/features/level/saga.js @@ -1,14 +1,10 @@ -import { - matchPattern, - getParams, - formatPattern -} from 'react-router/lib/PatternUtils' +import { matchPath } from 'react-router' +import qs from 'qs' import { all, take, put, select } from 'redux-saga/effects' -import { LOCATION_CHANGE } from 'react-router-redux' +import { LOCATION_CHANGE } from 'connected-react-router/immutable' import { random } from 'utils' import { navigateTo } from 'domains/navigation/actionCreators' import { currentLocation } from 'domains/navigation/selectors' -import NavigationConstants from 'domains/navigation/constants' import { requestLevel, resume, @@ -21,17 +17,24 @@ import { levelId, playerMoves, boxMoves } from 'domains/level/selectors' import { randomNumberFromRange } from 'domains/level/helpers' import * as LevelConstants from 'domains/level/constants' import { setScore } from 'domains/scores/actionCreators' -import { ROUTES } from 'routes/paths' +import ROUTES from 'routes/index' + +const generatePath = (path, params) => { + let generatedPath = path + Object.keys(params).forEach(key => { + generatedPath = generatedPath.replace(`:${key}`, params[key]) + }) + return generatedPath +} function* loadLevel() { while (true) { - const { payload: { pathname, action, query } } = yield take(LOCATION_CHANGE) - if ( - matchPattern(ROUTES.LEVEL, pathname) && - (!query.resume || - (query.resume && action === NavigationConstants.PREVIOUS_LOCATION)) - ) { - const { id } = getParams(ROUTES.LEVEL, pathname) + const { payload: { location: { pathname, search } } } = yield take( + LOCATION_CHANGE + ) + const query = qs.parse(search.substring(1)) + if (matchPath(pathname, ROUTES.LEVEL) && !query.resume) { + const { params: { id } } = matchPath(pathname, ROUTES.LEVEL) yield put(requestLevel(id)) } } @@ -41,7 +44,7 @@ function* restartLevel() { while (true) { yield take(restart().type) const { pathname } = yield select(currentLocation) - const { id } = getParams(ROUTES.LEVEL, pathname) + const { params: { id } } = matchPath(pathname, ROUTES.LEVEL) yield put(requestLevel(id)) } } @@ -51,9 +54,9 @@ function* resumeLevel() { yield take(resume().type) const id = yield select(levelId) if (id) { - yield put(navigateTo(formatPattern(ROUTES.LEVEL, { id }), '?resume=1')) + yield put(navigateTo(generatePath(ROUTES.LEVEL, { id }), '?resume=1')) } else { - yield put(navigateTo(formatPattern(ROUTES.LEVEL, { id: 1 }))) + yield put(navigateTo(generatePath(ROUTES.LEVEL, { id: 1 }))) } } } @@ -68,14 +71,12 @@ function* nextLevel() { if (currentLevel > 0 && currentLevel <= LevelConstants.NUMBER_OF_LEVELS) { yield put(setScore(currentLevel, currentPlayerMoves, currentBoxMoves)) } - let nextLevelAfterCurrentLevel = currentLevel + 1 - if (nextLevelAfterCurrentLevel > LevelConstants.NUMBER_OF_LEVELS) { - nextLevelAfterCurrentLevel = 1 + let nextLevelAfterCurrent = currentLevel + 1 + if (nextLevelAfterCurrent > LevelConstants.NUMBER_OF_LEVELS) { + nextLevelAfterCurrent = 1 } yield put( - navigateTo( - formatPattern(ROUTES.LEVEL, { id: nextLevelAfterCurrentLevel }) - ) + navigateTo(generatePath(ROUTES.LEVEL, { id: nextLevelAfterCurrent })) ) } } @@ -83,7 +84,7 @@ function* nextLevel() { function* jumpToLevel() { while (true) { const { payload: { id } } = yield take(requestJumpToLevel().type) - yield put(navigateTo(formatPattern(ROUTES.LEVEL, { id }))) + yield put(navigateTo(generatePath(ROUTES.LEVEL, { id }))) } } @@ -96,7 +97,7 @@ function* randomLevel() { LevelConstants.NUMBER_OF_LEVELS ) yield put( - navigateTo(formatPattern(ROUTES.LEVEL, { id: generatedRandomLevel })) + navigateTo(generatePath(ROUTES.LEVEL, { id: generatedRandomLevel })) ) } } diff --git a/src/index.jsx b/src/index.jsx index ff304da..cd77037 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -1,26 +1,10 @@ import React from 'react' import { render } from 'react-dom' import { AppContainer } from 'react-hot-loader' -import { syncHistoryWithStore } from 'react-router-redux' -import originalHistory from 'routes/history' import store from 'store' +import history from 'routes/history' import Root from 'components/Root' -const history = syncHistoryWithStore(originalHistory, store, { - selectLocationState: state => { - const locationBeforeTransitions = state.getIn([ - 'navigation', - 'locationBeforeTransitions' - ]) - return { - locationBeforeTransitions: - locationBeforeTransitions && locationBeforeTransitions.toJS - ? locationBeforeTransitions.toJS() - : locationBeforeTransitions - } - } -}) - const rootElement = global.document.getElementById('root') const renderApp = RootComponent => { diff --git a/src/routes/history.js b/src/routes/history.js index 4d38f9b..277aac1 100644 --- a/src/routes/history.js +++ b/src/routes/history.js @@ -1,6 +1,5 @@ -import { useRouterHistory } from 'react-router' -import createBrowserHistory from 'history/lib/createBrowserHistory' // eslint-disable-line import/no-extraneous-dependencies +import createBrowserHistory from 'history/createBrowserHistory' -const history = useRouterHistory(createBrowserHistory)() +const history = createBrowserHistory() export default history diff --git a/src/routes/paths.js b/src/routes/index.js similarity index 92% rename from src/routes/paths.js rename to src/routes/index.js index bdf0795..699cf9b 100644 --- a/src/routes/paths.js +++ b/src/routes/index.js @@ -12,4 +12,4 @@ Object.keys(PATHS).forEach(key => { PATHS[key] === PATHS.ROOT ? PATHS[key] : `${PATHS.ROOT}${PATHS[key]}` }) -export { PATHS, ROUTES } +export default ROUTES diff --git a/src/routes/index.jsx b/src/routes/index.jsx deleted file mode 100644 index 73def81..0000000 --- a/src/routes/index.jsx +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react' -import { Route, IndexRoute } from 'react-router' -import { App, MainMenu, Level, Help, HighScores } from 'components/container' -import { PATHS } from './paths' - -const getRoutes = () => ( - - - - - - -) - -export default getRoutes diff --git a/src/store/index.js b/src/store/index.js index 0977241..ed860a9 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -4,7 +4,10 @@ import createSagaMiddleware from 'redux-saga' import history from 'routes/history' import { bindKeys, keyPress } from 'domains/interaction/actionCreators' import { convertPayloadValuesToBooleans } from 'domains/interaction/helpers' -import { LOCATION_CHANGE } from 'react-router-redux' +import { + connectRouter, + LOCATION_CHANGE +} from 'connected-react-router/immutable' import { stopRecording } from 'domains/recorder/actionCreators' import { startReplaying, @@ -115,7 +118,7 @@ const filterRecorderMiddleware = middleware => store => next => { actionReference.payload ) } else if (actionReference.type === LOCATION_CHANGE) { - actionReference.payload.key = '' + actionReference.payload.location.key = '' } else if (actionReference.type === keyPress().type) { actionReference.payload = { code: actionReference.payload.code } } else if (actionReference.type === stopReplaying().type) { @@ -133,7 +136,11 @@ const appMiddleware = applyMiddleware( replayerMiddleware ) -const store = createStore(appReducer, savedState, appMiddleware) +const store = createStore( + connectRouter(history)(appReducer), + savedState, + appMiddleware +) task = sagaMiddleware.run(currentAppSaga) @@ -158,7 +165,7 @@ if (module.hot) { const nextReducersArray = Object.keys(nextReducers) const nextAppReducer = getAppReducer(nextReducers, nextReducersArray) - store.replaceReducer(nextAppReducer) + store.replaceReducer(connectRouter(history)(nextAppReducer)) }) module.hot.accept('./sagas', () => { diff --git a/src/store/middlewares.js b/src/store/middlewares.js index 3c4cb6a..1ab2547 100644 --- a/src/store/middlewares.js +++ b/src/store/middlewares.js @@ -1,4 +1,4 @@ -import { routerMiddleware as createNavigationMiddleware } from 'react-router-redux' +import { routerMiddleware as createNavigationMiddleware } from 'connected-react-router/immutable' export { default as interactionMiddleware