[
  {
    "path": ".babelrc",
    "content": "{\n    \"presets\": [\"es2015\", \"react\", \"stage-1\"],\n    \"plugins\": [\n        \"transform-es3-member-expression-literals\",\n        \"transform-es3-property-literals\"\n    ]\n}\n"
  },
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\ninsert_final_newline = true\ncharset = utf-8\nindent_style = space\nindent_size = 2\ntrim_trailing_whitespace = true\n\n[*.md]\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": ".eslintignore",
    "content": "examples/*/node_modules/\nexamples/*/dist/\n"
  },
  {
    "path": ".eslintrc",
    "content": "{\n    \"extends\": \"react-app\"\n}\n"
  },
  {
    "path": ".gitignore",
    "content": "lib\ndist\nnode_modules\ncoverage\n*.log\n"
  },
  {
    "path": ".travis.yml",
    "content": "sudo: false\nbranches:\n  only:\n    - master\nlanguage: node_js\ncache:\n  directories:\n  - node_modules\nnode_js:\n  - \"4\"\n  - \"6\"\nbefore_script:\n    - export DISPLAY=:99.0\n    - sh -e /etc/init.d/xvfb start\nscript:\n  - npm run test\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "## [4.0.8](https://github.com/reactjs/react-router-redux/compare/v4.0.7...v4.0.8)\n\n- Don't run listeners synchronously with history 3 [`b2c2259`](https://github.com/reactjs/react-router-redux/commit/b2c2259c189cafad3e6e68eac7729e74f2bd56a9)\n\n## [4.0.7](https://github.com/reactjs/react-router-redux/compare/v4.0.6...v4.0.7)\n\n- Support history 3 [#476](https://github.com/reactjs/react-router-redux/pull/476)\n\n## [4.0.6](https://github.com/reactjs/react-router-redux/compare/v4.0.5...v4.0.6)\n\n- Makes sure the state in the store matches the state in history when using SSR [#445](https://github.com/reactjs/react-router-redux/pull/445)\n\n## [4.0.5](https://github.com/reactjs/react-router-redux/compare/v4.0.4...v4.0.5)\n\n- Initialize currentLocation to initial location from the store. [#403](https://github.com/reactjs/react-router-redux/pull/403)\n\n## [4.0.4](https://github.com/reactjs/react-router-redux/compare/v4.0.2...v4.0.4)\n\n- Added a UMD build. [#362](https://github.com/reactjs/react-router-redux/pull/362)\n\n## [4.0.2](https://github.com/reactjs/react-router-redux/compare/v4.0.1...v4.0.2)\n\n- Calling routerReducer() with no args crashes. [#350](https://github.com/reactjs/react-router-redux/pull/350)\n\n## [4.0.1](https://github.com/reactjs/react-router-redux/compare/v4.0.0...v4.0.1)\n\n- Fix IE8 compatbility. [#344](https://github.com/reactjs/react-router-redux/pull/344)\n\n## [4.0.0](https://github.com/reactjs/react-router-redux/compare/3.0.0...v4.0.0)\n\nThis is a big breaking release, but the last one for the foreseeable future. The scope of this library has changed, so please re-evaluate its usefulness to you. You may not need it and this is ok!\n\n#### Summary of Changes\n\nThe provided action creators and middleware are now separate from the history<->state syncing function. For the vast majority of cases, using action creators to trigger navigation is obsoleted by React Router's [new history singletons](https://github.com/reactjs/react-router/blob/master/upgrade-guides/v2.0.0.md#history-singletons-provided) provided in 2.0. Building this functionality in by default and coupling it to our history syncing logic no longer makes sense.\n\nWe now sync by enhancing the history instance to listen for navigation events and dispatch those into the store. The enhanced history has its `listen` method overridden to respond to store changes, rather than directly to navigation events. When this history is provided to `<Router>`, the router will listen to it and receive these store changes. This means if we time travel with the store, the router will receive those store changes and update based on the location in the store, instead of what the browser says. Normal navigation events (hitting your browser back/forward buttons, telling a history singleton to `push` a location) flow through the history's listener like normal, so all the usual stuff works A-OK.\n\n## [3.0.0](https://github.com/reactjs/react-router-redux/compare/2.1.0...3.0.0)\n\nTechnically, 2.1.0 broke semver. The appropriate @timdorr's have been flogged. So, we're bumping the major version to catch up.\n\n- Fixed Resets in Redux Dev Tools. [3ae8110f](https://github.com/reactjs/react-router-redux/commit/3ae8110f)\n- Ensure the initialState is set properly. [a00acfd4](https://github.com/reactjs/react-router-redux/commit/a00acfd4)\n- Support any number of args on action creators [524898b5](https://github.com/reactjs/react-router-redux/commit/524898b5)\n\n## [2.1.0](https://github.com/reactjs/react-router-redux/compare/2.0.4...2.1.0)\n\n- `listenForReplays` has a `selectLocationState` selector. [#218](https://github.com/reactjs/react-router-redux/pull/218)\n- Provide unscoped action creators. [#225](https://github.com/reactjs/react-router-redux/pull/225)\n- Example updated to use fully ES2015 syntax.\n\n## [2.0.4](https://github.com/reactjs/react-router-redux/compare/2.0.2...2.0.4)\n\n- Remove `history` module published within the tarball. [#133](https://github.com/reactjs/react-router-redux/issues/133)\n- Make actions conform to [Flux Standard Action](https://github.com/acdlite/flux-standard-action). [#208](https://github.com/reactjs/react-router-redux/pull/208)\n\n## [2.0.2](https://github.com/reactjs/react-router-redux/compare/1.0.2...2.0.2)\n\nVersions 2.0.0 and 2.0.1 were test releases for the 2.* series. 2.0.2 is the first public release.\n\n**A whole new API, with many breaking changes:**\n\n* `syncReduxAndRouter` is gone. Instead, call `syncHistory` with just the `history` object, which returns a middleware that you need to apply. (#141)\n* If you use redux devtools, you need to call `middleware.listenForReplays(store)` on the middleware returned from `syncHistory`. Create the store first with the middleware, then call this function with the store.\n* Action creators are now contained in a single object called `routeActions`. `go`, `goBack`, and `goForward` action creators have been added.\n* `UPDATE_PATH` is now `UPDATE_LOCATION`.\n* The fully parsed [location object](https://github.com/reactjs/history/blob/master/docs/Location.md) is now stored in the state instead of a URL string. To access the path, use `state.routing.location.pathname` instead of `state.routing.path`.\n\n[View the new docs](https://github.com/reactjs/react-router-redux#api)\n\n## [1.0.2](https://github.com/reactjs/react-router-redux/compare/1.0.1...1.0.2)\n\n* Only publish relevant files to npm\n\n## [1.0.1](https://github.com/reactjs/react-router-redux/compare/1.0.0...1.0.1)\n\n* Solve problem with `basename` causing infinite redirects (#103)\n* Switched to ES6 imports/exports internally, but should not affect outside users\n\n## [1.0.0](https://github.com/reactjs/react-router-redux/compare/0.0.10...1.0.0)\n> 2015-12-09\n\nThis release changes quite a bit so you'll have to update your code.\n\n**Breaking Changes:**\n\n* The `updatePath` action creator has been removed in favor of `pushPath` and `replacePath`. Use `pushPath` to get the same behavior as before. (#38)\n* We have added support for routing state (#38)\n* Our actions are now [FSA compliant](https://github.com/acdlite/flux-standard-action). This means if you are listening for the `UPDATE_PATH` action in a reducer you should get properties off the `payload` property. (#63)\n\nOther fixes:\n\n* Redux DevTools should now work as expected (#73)\n* As we no longer depend on `window.location`, `<base href=\"...\">` should now work (#62)\n* We've done lots of work on finding the right way to stop cycles, so hopefully we shouldn't have any unnecessary location or store updates (#50)\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright (c) 2015-present James Long\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# Project Deprecated\n\nThis project is no longer maintained. For your Redux <-> Router syncing needs with React Router 4+, please see one of these libraries instead:\n\n* [connected-react-router](https://github.com/supasate/connected-react-router)\n\n---\n\n⚠️ **This repo is for react-router-redux 4.x, which is only compatible with react-router 2.x and 3.x**\n\n# react-router-redux\n\n[![npm version](https://img.shields.io/npm/v/react-router-redux.svg?style=flat-square)](https://www.npmjs.com/package/react-router-redux) [![npm downloads](https://img.shields.io/npm/dm/react-router-redux.svg?style=flat-square)](https://www.npmjs.com/package/react-router-redux) [![build status](https://img.shields.io/travis/reactjs/react-router-redux/master.svg?style=flat-square)](https://travis-ci.org/reactjs/react-router-redux)\n\n> **Keep your router in sync with application state** :sparkles:\n\n_Formerly known as redux-simple-router_\n\nYou're a smart person. You use [Redux](https://github.com/reactjs/redux) to manage your application state. You use [React Router](https://github.com/reactjs/react-router) to do routing. All is good.\n\nBut the two libraries don't coordinate. You want to do time travel with your application state, but React Router doesn't navigate between pages when you replay actions. It controls an important part of application state: the URL.\n\nThis library helps you keep that bit of state in sync with your Redux store. We keep a copy of the current location hidden in state. When you rewind your application state with a tool like [Redux DevTools](https://github.com/gaearon/redux-devtools), that state change is propagated to React Router so it can adjust the component tree accordingly. You can jump around in state, rewinding, replaying, and resetting as much as you'd like, and this library will ensure the two stay in sync at all times.\n\n**This library is not _necessary_ for using Redux together with React Router. You can use the two together just fine without any additional libraries. It is useful if you care about recording, persisting, and replaying user actions, using time travel. If you don't care about these features, just [use Redux and React Router directly](http://stackoverflow.com/questions/36722584/how-to-sync-redux-state-and-url-hash-tag-params/36749963#36749963).**\n\n## Installation\n\n```\nnpm install --save react-router-redux\n```\n\n## How It Works\n\nThis library allows you to use React Router's APIs as they are documented. And, you can use redux like you normally would, with a single app state. The library simply enhances a history instance to allow it to synchronize any changes it receives into application state.\n\n[history](https://github.com/reactjs/history) + `store` ([redux](https://github.com/reactjs/redux)) &rarr; [**react-router-redux**](https://github.com/reactjs/react-router-redux) &rarr; enhanced [history](https://github.com/reactjs/history) &rarr; [react-router](https://github.com/reactjs/react-router)\n\n## Tutorial\n\nLet's take a look at a simple example.\n\n```js\nimport React from 'react'\nimport ReactDOM from 'react-dom'\nimport { createStore, combineReducers } from 'redux'\nimport { Provider } from 'react-redux'\nimport { Router, Route, browserHistory } from 'react-router'\nimport { syncHistoryWithStore, routerReducer } from 'react-router-redux'\n\nimport reducers from '<project-path>/reducers'\n\n// Add the reducer to your store on the `routing` key\nconst store = createStore(\n  combineReducers({\n    ...reducers,\n    routing: routerReducer\n  })\n)\n\n// Create an enhanced history that syncs navigation events with the store\nconst history = syncHistoryWithStore(browserHistory, store)\n\nReactDOM.render(\n  <Provider store={store}>\n    { /* Tell the Router to use our enhanced history */ }\n    <Router history={history}>\n      <Route path=\"/\" component={App}>\n        <Route path=\"foo\" component={Foo}/>\n        <Route path=\"bar\" component={Bar}/>\n      </Route>\n    </Router>\n  </Provider>,\n  document.getElementById('mount')\n)\n```\n\nNow any time you navigate, which can come from pressing browser buttons or navigating in your application code, the enhanced history will first pass the new location through the Redux store and then on to React Router to update the component tree. If you time travel, it will also pass the new state to React Router to update the component tree again.\n\n#### How do I watch for navigation events, such as for analytics?\n\nSimply listen to the enhanced history via `history.listen`. This takes in a function that will receive a `location` any time the store updates. This includes any time travel activity performed on the store.\n\n```js\nconst history = syncHistoryWithStore(browserHistory, store)\n\nhistory.listen(location => analyticsService.track(location.pathname))\n```\n\nFor other kinds of events in your system, you can use middleware on your Redux store like normal to watch any action that is dispatched to the store.\n\n#### What if I use Immutable.js or another state wrapper with my Redux store?\n\nWhen using a wrapper for your store's state, such as Immutable.js, you will need to change two things from the standard setup:\n\n1. By default, the library expects to find the history state at `state.routing`. If your wrapper prevents accessing properties directly, or you want to put the routing state elsewhere, pass a selector function to access the historystate via the `selectLocationState` option on `syncHistoryWithStore`.\n2. Provide your own reducer function that will receive actions of type `LOCATION_CHANGE` and return the payload merged into the `locationBeforeTransitions` property of the routing state. For example, `state.set(\"routing\", {locationBeforeTransitions: action.payload})`.\n\nThese two hooks will allow you to store the state that this library uses in whatever format or wrapper you would like.\n\n#### How do I access router state in a container component?\n\nReact Router [provides route information via a route component's props](https://github.com/ReactTraining/react-router/blob/v3/docs/Introduction.md#getting-url-parameters). This makes it easy to access them from a container component. When using [react-redux](https://github.com/reactjs/react-redux) to `connect()` your components to state, you can access the router's props from the [2nd argument of `mapStateToProps`](https://github.com/reactjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options):\n\n```js\nfunction mapStateToProps(state, ownProps) {\n  return {\n    id: ownProps.params.id,\n    filter: ownProps.location.query.filter\n  };\n}\n```\n\nYou should not read the location state directly from the Redux store. This is because React Router operates asynchronously (to handle things such as dynamically-loaded components) and your component tree may not yet be updated in sync with your Redux state. You should rely on the props passed by React Router, as they are only updated after it has processed all asynchronous code.\n\n#### What if I want to issue navigation events via Redux actions?\n\nReact Router provides singleton versions of history (`browserHistory` and `hashHistory`) that you can import and use from anywhere in your application. However, if you prefer Redux style actions, the library also provides a set of action creators and a middleware to capture them and redirect them to your history instance.\n\n```js\nimport { createStore, combineReducers, applyMiddleware } from 'redux';\nimport { routerMiddleware, push } from 'react-router-redux'\n\n// Apply the middleware to the store\nconst middleware = routerMiddleware(browserHistory)\nconst store = createStore(\n  reducers,\n  applyMiddleware(middleware)\n)\n\n// Dispatch from anywhere like normal.\nstore.dispatch(push('/foo'))\n```\n\n## Examples\n\n- [examples/basic](/examples/basic) - basic reference implementation\n\nExamples from the community:\n\n* [react-redux-styled-hot-universal](https://github.com/krasevych/react-redux-styled-hot-universal) (SSR, Universal Webpack, Redux, React-router, Webpack 2, Babel, Styled Components and more...)\n* [shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial) - react-router-redux including **Server Rendering** using [React on Rails](https://github.com/shakacode/react_on_rails/), live at [www.reactrails.com](http://www.reactrails.com/).\n* [davezuko/react-redux-starter-kit](https://github.com/davezuko/react-redux-starter-kit) - popular redux starter kit\n  * **tip**: migrating from react-router-redux `^3.0.0`? use [this commit](https://github.com/davezuko/react-redux-starter-kit/commit/0df26907) as a reference\n* [svrcekmichal/universal-react](https://github.com/svrcekmichal/universal-react) - Universal react app with async actions provided by [svrcekmichal/reasync](https://github.com/svrcekmichal/reasync) package\n* [steveniseki/react-router-redux-example](https://github.com/StevenIseki/react-router-redux-example) - minimal react-router-redux example includes css modules and universal rendering\n* [choonkending/react-webpack-node](https://github.com/choonkending/react-webpack-node) - Full-stack universal Redux App\n* [kuy/treemap-with-router](https://github.com/kuy/treemap-with-router) - An example for react-router-redux with d3's treemap.\n\n&rarr; _Have an example to add? Send us a PR!_ &larr;\n\n## API\n\n#### `routerReducer()`\n\n**You must add this reducer to your store for syncing to work.**\n\nA reducer function that stores location updates from `history`. If you use `combineReducers`, it should be nested under the `routing` key.\n\n#### `history = syncHistoryWithStore(history, store, [options])`\n\nCreates an enhanced history from the provided history. This history changes `history.listen` to pass all location updates through the provided store first. This ensures if the store is updated either from a navigation event or from a time travel action, such as a replay, the listeners of the enhanced history will stay in sync.\n\n**You must provide the enhanced history to your `<Router>` component.** This ensures your routes stay in sync with your location and your store at the same time.\n\nThe `options` object takes in the following optional keys:\n\n- `selectLocationState` - (default `state => state.routing`) A selector function to obtain the history state from your store. Useful when not using the provided `routerReducer` to store history state. Allows you to use wrappers, such as Immutable.js.\n- `adjustUrlOnReplay` - (default `true`) When `false`, the URL will not be kept in sync during time travel. This is useful when using `persistState` from Redux DevTools and not wanting to maintain the URL state when restoring state.\n\n#### `push(location)`, `replace(location)`, `go(number)`, `goBack()`, `goForward()`\n\n**You must install `routerMiddleware` for these action creators to work.**\n\nAction creators that correspond with the [history methods of the same name](https://github.com/ReactTraining/history/blob/v3/docs/GettingStarted.md#navigation). For reference they are defined as follows:\n\n- `push` - Pushes a new location to history, becoming the current location.\n- `replace` - Replaces the current location in history.\n- `go` - Moves backwards or forwards a relative number of locations in history.\n- `goForward` - Moves forward one location. Equivalent to `go(1)`\n- `goBack` - Moves backwards one location. Equivalent to `go(-1)`\n\nBoth `push` and `replace` take in a [location descriptor](https://github.com/ReactTraining/history/blob/v3/docs/Location.md), which can be an object describing the URL or a plain string URL.\n\nThese action creators are also available in one single object as `routerActions`, which can be used as a convenience when using Redux's `bindActionCreators()`.\n\n#### `routerMiddleware(history)`\n\nA middleware you can apply to your Redux `store` to capture dispatched actions created by the action creators. It will redirect those actions to the provided `history` instance.\n\n#### `LOCATION_CHANGE`\n\nAn action type that you can listen for in your reducers to be notified of route updates. Fires *after* any changes to history.\n"
  },
  {
    "path": "examples/.gitignore",
    "content": "node_modules/\ndist/\n*.log\n"
  },
  {
    "path": "examples/basic/.babelrc",
    "content": "{\n    \"presets\": [\"es2015\", \"react\", \"stage-1\"]\n}\n"
  },
  {
    "path": "examples/basic/README.md",
    "content": "react-router-redux basic example\n=================================\n\nThis is a basic example that demonstrates rendering components based\non URLs with `react-router` as well as connecting them to Redux state.\nIt uses both `<Link>` elements as well as the `push` action creator\nprovided by react-router-redux.\n\nThis example also demonstrates integration with\n**[redux-devtools](https://github.com/gaearon/redux-devtools) ^3.0.0**\n\n**To run, follow these steps:**\n\n1. Install dependencies with `npm install` in this directory (make sure it creates a local node_modules)\n2. By default, it uses the local version from `src` of react-router-redux, so you need to run `npm install` from there first. If you want to use a version straight from npm, remove the lines in `webpack.config.js` at the bottom.\n3. Start build with `npm start`\n4. Open [http://localhost:8080/](http://localhost:8080/)\n\n-\n\nIf you want to run the example from the npm published version of\n**react-router-redux**, remove the alias in `webpack.config`\nto the source from line 21.\n\nThis example uses the latest version, switch to a specific tag to use a stable version:\n\ne.g. [react-router-redux tag 1.0.2](https://github.com/reactjs/react-router-redux/tree/1.0.2/examples/basic)\n"
  },
  {
    "path": "examples/basic/actions/count.js",
    "content": "import { INCREASE, DECREASE } from '../constants'\n\nexport function increase(n) {\n  return {\n    type: INCREASE,\n    amount: n\n  }\n}\n\nexport function decrease(n) {\n  return {\n    type: DECREASE,\n    amount: n\n  }\n}\n"
  },
  {
    "path": "examples/basic/app.js",
    "content": "import { createDevTools } from 'redux-devtools'\nimport LogMonitor from 'redux-devtools-log-monitor'\nimport DockMonitor from 'redux-devtools-dock-monitor'\n\nimport React from 'react'\nimport ReactDOM from 'react-dom'\nimport { createStore, combineReducers } from 'redux'\nimport { Provider } from 'react-redux'\nimport { Router, Route, IndexRoute, browserHistory } from 'react-router'\nimport { syncHistoryWithStore, routerReducer } from 'react-router-redux'\n\nimport * as reducers from './reducers'\nimport { App, Home, Foo, Bar } from './components'\n\nconst reducer = combineReducers({\n  ...reducers,\n  routing: routerReducer\n})\n\nconst DevTools = createDevTools(\n  <DockMonitor toggleVisibilityKey=\"ctrl-h\" changePositionKey=\"ctrl-q\">\n    <LogMonitor theme=\"tomorrow\" preserveScrollTop={false} />\n  </DockMonitor>\n)\n\nconst store = createStore(\n  reducer,\n  DevTools.instrument()\n)\nconst history = syncHistoryWithStore(browserHistory, store)\n\nReactDOM.render(\n  <Provider store={store}>\n    <div>\n      <Router history={history}>\n        <Route path=\"/\" component={App}>\n          <IndexRoute component={Home}/>\n          <Route path=\"foo\" component={Foo}/>\n          <Route path=\"bar\" component={Bar}/>\n        </Route>\n      </Router>\n      <DevTools />\n    </div>\n  </Provider>,\n  document.getElementById('mount')\n)\n"
  },
  {
    "path": "examples/basic/components/App.js",
    "content": "import React from 'react'\nimport { Link, browserHistory } from 'react-router'\n\nexport default function App({ children }) {\n  return (\n    <div>\n      <header>\n        Links:\n        {' '}\n        <Link to=\"/\">Home</Link>\n        {' '}\n        <Link to=\"/foo\">Foo</Link>\n        {' '}\n        <Link to=\"/bar\">Bar</Link>\n      </header>\n      <div>\n        <button onClick={() => browserHistory.push('/foo')}>Go to /foo</button>\n      </div>\n      <div style={{ marginTop: '1.5em' }}>{children}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/basic/components/Bar.js",
    "content": "import React from 'react'\n\nexport default function Bar() {\n  return <div>And I am Bar!</div>\n}\n"
  },
  {
    "path": "examples/basic/components/Foo.js",
    "content": "import React from 'react'\n\nexport default function Foo() {\n  return <div>I am Foo!</div>\n}\n"
  },
  {
    "path": "examples/basic/components/Home.js",
    "content": "import React from 'react'\nimport { connect } from 'react-redux'\nimport { increase, decrease } from '../actions/count'\n\nfunction Home({ number, increase, decrease }) {\n  return (\n    <div>\n      Some state changes:\n      {number}\n      <button onClick={() => increase(1)}>Increase</button>\n      <button onClick={() => decrease(1)}>Decrease</button>\n    </div>\n  )\n}\n\nexport default connect(\n  state => ({ number: state.count.number }),\n  { increase, decrease }\n)(Home)\n"
  },
  {
    "path": "examples/basic/components/index.js",
    "content": "export App from './App'\nexport Home from './Home'\nexport Foo from './Foo'\nexport Bar from './Bar'\n"
  },
  {
    "path": "examples/basic/constants.js",
    "content": "\nexport const INCREASE = 'INCREASE'\nexport const DECREASE = 'DECREASE'\n"
  },
  {
    "path": "examples/basic/index.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <title>react-router-redux basic example</title>\n    <meta charset=\"utf8\"/>\n  </head>\n  <body>\n    <div id=\"mount\"></div>\n    <script src=\"/bundle.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/basic/package.json",
    "content": "{\n  \"name\": \"rrr-basic-example\",\n  \"version\": \"0.0.0\",\n  \"repository\": \"reactjs/react-router-redux\",\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"react\": \"^0.14.7\",\n    \"react-dom\": \"^0.14.7\",\n    \"react-redux\": \"^4.3.0\",\n    \"react-router\": \"^2.0.0\",\n    \"redux\": \"^3.2.1\",\n    \"react-router-redux\": \"^4.0.0\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.4.5\",\n    \"babel-eslint\": \"^5.0.0-beta9\",\n    \"babel-loader\": \"^6.2.2\",\n    \"babel-preset-es2015\": \"^6.3.13\",\n    \"babel-preset-react\": \"^6.3.13\",\n    \"babel-preset-stage-1\": \"^6.3.13\",\n    \"eslint\": \"^1.10.3\",\n    \"eslint-config-rackt\": \"^1.1.1\",\n    \"eslint-plugin-react\": \"^3.16.1\",\n    \"redux-devtools\": \"^3.1.0\",\n    \"redux-devtools-dock-monitor\": \"^1.0.1\",\n    \"redux-devtools-log-monitor\": \"^1.0.4\",\n    \"webpack\": \"^1.12.13\",\n    \"webpack-dev-server\": \"^1.14.1\"\n  },\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --history-api-fallback --no-info --open\"\n  }\n}\n"
  },
  {
    "path": "examples/basic/reducers/count.js",
    "content": "import { INCREASE, DECREASE } from '../constants'\n\nconst initialState = {\n  number: 1\n}\n\nexport default function update(state = initialState, action) {\n  if(action.type === INCREASE) {\n    return { number: state.number + action.amount }\n  }\n  else if(action.type === DECREASE) {\n    return { number: state.number - action.amount }\n  }\n  return state\n}\n"
  },
  {
    "path": "examples/basic/reducers/index.js",
    "content": "export count from './count'\n"
  },
  {
    "path": "examples/basic/webpack.config.js",
    "content": "/* eslint-disable */\nconst path = require('path');\n\nmodule.exports = {\n  entry: './app.js',\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js'\n  },\n  module: {\n    loaders: [{\n      test: /\\.js$/,\n      loader: 'babel',\n      exclude: /node_modules/,\n      include: __dirname\n    }]\n  }\n}\n\n\n\n// This will make the redux-simpler-router module resolve to the\n// latest src instead of using it from npm. Remove this if running\n// outside of the source.\nvar src = path.join(__dirname, '..', '..', 'src')\nvar fs = require('fs')\nif (fs.existsSync(src)) {\n  // Use the latest src\n  module.exports.resolve = { alias: { 'react-router-redux': src } }\n  module.exports.module.loaders.push({\n    test: /\\.js$/,\n    loaders: ['babel'],\n    include: src\n  });\n}\n"
  },
  {
    "path": "examples/server/.babelrc",
    "content": "{\n  \"presets\": [\"es2015\", \"react\", \"stage-1\"],\n  \"plugins\": [\n    [\"babel-plugin-module-alias\", [\n      { \"src\": \"../../src\", \"expose\": \"react-router-redux\" }\n    ]]\n  ]\n}\n"
  },
  {
    "path": "examples/server/client.js",
    "content": "import 'babel-polyfill'\n\nimport React from 'react'\nimport { render } from 'react-dom'\n\nimport { Provider } from 'react-redux'\nimport { Router, browserHistory } from 'react-router'\nimport { syncHistoryWithStore } from 'react-router-redux'\n\nimport { configureStore, DevTools } from './store'\nimport routes from './routes'\n\nconst store = configureStore(browserHistory, window.__initialState__)\nconst history = syncHistoryWithStore(browserHistory, store)\n\nrender(\n  <Provider store={store}>\n    <Router history={history} routes={routes} />\n  </Provider>,\n  document.getElementById('root')\n)\n\nrender(\n  <Provider store={store}>\n    <DevTools/>\n  </Provider>,\n  document.getElementById('devtools')\n)\n"
  },
  {
    "path": "examples/server/index.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <title>react-router-redux server rendering example</title>\n    <meta charset=\"utf8\"/>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n    <script src=\"/bundle.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/server/package.json",
    "content": "{\n  \"name\": \"rrr-server-example\",\n  \"version\": \"0.0.0\",\n  \"repository\": \"reactjs/react-router-redux\",\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"react\": \"^0.14.7\",\n    \"react-dom\": \"^0.14.7\",\n    \"react-redux\": \"^4.3.0\",\n    \"react-router\": \"^2.0.0\",\n    \"react-router-redux\": \"^4.0.0\",\n    \"redux\": \"^3.2.1\",\n    \"serialize-javascript\": \"^1.1.2\"\n  },\n  \"devDependencies\": {\n    \"babel-cli\": \"^6.5.1\",\n    \"babel-core\": \"^6.4.5\",\n    \"babel-eslint\": \"^5.0.0-beta9\",\n    \"babel-loader\": \"^6.2.2\",\n    \"babel-plugin-module-alias\": \"^1.2.0\",\n    \"babel-preset-es2015\": \"^6.3.13\",\n    \"babel-preset-react\": \"^6.3.13\",\n    \"babel-preset-stage-1\": \"^6.3.13\",\n    \"babel-register\": \"^6.5.2\",\n    \"eslint\": \"^1.10.3\",\n    \"eslint-config-rackt\": \"^1.1.1\",\n    \"eslint-plugin-react\": \"^3.16.1\",\n    \"express\": \"^4.13.4\",\n    \"redux-devtools\": \"^3.1.1\",\n    \"redux-devtools-dock-monitor\": \"^1.0.1\",\n    \"redux-devtools-log-monitor\": \"^1.0.4\",\n    \"webpack\": \"^1.12.13\",\n    \"webpack-dev-middleware\": \"^1.5.1\"\n  },\n  \"scripts\": {\n    \"start\": \"babel-node server.js\"\n  }\n}\n"
  },
  {
    "path": "examples/server/routes.js",
    "content": "import React from 'react'\nimport { Route, IndexRoute, Link } from 'react-router'\n\nconst App = ({ children }) => (\n  <div>\n    <header>\n      Links:\n      {' '}\n      <Link to=\"/\">Home</Link>\n      {' '}\n      <Link to=\"/foo\">Foo</Link>\n      {' '}\n      <Link to=\"/bar\">Bar</Link>\n    </header>\n    {children}\n  </div>\n)\n\nconst Home = () => (<div>Home!</div>)\nconst Foo = () => (<div>Foo!</div>)\nconst Bar = () => (<div>Bar!</div>)\n\nconst routes = (\n  <Route path=\"/\" component={App}>\n    <IndexRoute component={Home}/>\n    <Route path=\"foo\" component={Foo}/>\n    <Route path=\"bar\" component={Bar}/>\n  </Route>\n)\n\nexport default routes\n"
  },
  {
    "path": "examples/server/server.js",
    "content": "/*eslint-disable no-console */\nimport express from 'express'\nimport serialize from 'serialize-javascript'\n\nimport webpack from 'webpack'\nimport webpackDevMiddleware from 'webpack-dev-middleware'\nimport webpackConfig from './webpack.config'\n\nimport React from 'react'\nimport { renderToString } from 'react-dom/server'\nimport { Provider } from 'react-redux'\nimport { createMemoryHistory, match, RouterContext } from 'react-router'\nimport { syncHistoryWithStore } from '../../src'\n\nimport { configureStore } from './store'\nimport routes from './routes'\n\nconst app = express()\n\napp.use(webpackDevMiddleware(webpack(webpackConfig), {\n  publicPath: '/__build__/',\n  stats: {\n    colors: true\n  }\n}))\n\nconst HTML = ({ content, store }) => (\n  <html>\n    <body>\n      <div id=\"root\" dangerouslySetInnerHTML={{ __html: content }}/>\n      <div id=\"devtools\"/>\n      <script dangerouslySetInnerHTML={{ __html: `window.__initialState__=${serialize(store.getState())};` }}/>\n      <script src=\"/__build__/bundle.js\"/>\n    </body>\n  </html>\n)\n\napp.use(function (req, res) {\n  const memoryHistory = createMemoryHistory(req.url)\n  const store = configureStore(memoryHistory)\n  const history = syncHistoryWithStore(memoryHistory, store)\n\n  match({ history, routes, location: req.url }, (error, redirectLocation, renderProps) => {\n    if (error) {\n      res.status(500).send(error.message)\n    } else if (redirectLocation) {\n      res.redirect(302, redirectLocation.pathname + redirectLocation.search)\n    } else if (renderProps) {\n      const content = renderToString(\n        <Provider store={store}>\n          <RouterContext {...renderProps}/>\n        </Provider>\n      )\n\n      res.send('<!doctype html>\\n' + renderToString(<HTML content={content} store={store}/>))\n    }\n  })\n})\n\napp.listen(8080, function () {\n  console.log('Server listening on http://localhost:8080, Ctrl+C to stop')\n})\n"
  },
  {
    "path": "examples/server/store.js",
    "content": "import React from 'react'\n\nimport { createStore, combineReducers, compose, applyMiddleware } from 'redux'\nimport { createDevTools } from 'redux-devtools'\nimport LogMonitor from 'redux-devtools-log-monitor'\nimport DockMonitor from 'redux-devtools-dock-monitor'\n\nimport { routerReducer, routerMiddleware } from 'react-router-redux'\n\nexport const DevTools = createDevTools(\n  <DockMonitor toggleVisibilityKey=\"ctrl-h\" changePositionKey=\"ctrl-q\">\n    <LogMonitor theme=\"tomorrow\" preserveScrollTop={false} />\n  </DockMonitor>\n)\n\nexport function configureStore(history, initialState) {\n  const reducer = combineReducers({\n    routing: routerReducer\n  })\n\n  let devTools = []\n  if (typeof document !== 'undefined') {\n    devTools = [ DevTools.instrument() ]\n  }\n\n  const store = createStore(\n    reducer,\n    initialState,\n    compose(\n      applyMiddleware(\n        routerMiddleware(history)\n      ),\n      ...devTools\n    )\n  )\n\n  return store\n}\n"
  },
  {
    "path": "examples/server/webpack.config.js",
    "content": "/* eslint-disable */\nconst path = require('path')\nconst webpack = require('webpack')\n\nmodule.exports = {\n  devtool: 'inline-source-map',\n  entry: './client.js',\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n    publicPath: '/__build__/'\n  },\n  module: {\n    loaders: [{\n      test: /\\.js$/,\n      loader: 'babel',\n      exclude: /node_modules/,\n      query: { plugins: [] }\n    }]\n  }\n}\n\n\n// This will make the redux-simpler-router module resolve to the\n// latest src instead of using it from npm. Remove this if running\n// outside of the source.\nvar src = path.join(__dirname, '../../src')\nvar fs = require('fs')\nif (fs.existsSync(src)) {\n  // Use the latest src\n  module.exports.resolve = { alias: { 'react-router-redux': src } }\n  module.exports.module.loaders.push({\n    test: /\\.js$/,\n    loaders: ['babel'],\n    include: src\n  });\n}\n"
  },
  {
    "path": "karma.conf.js",
    "content": "'use strict'\n\nconst path = require('path')\n\nmodule.exports = function (config) {\n\n  let runCoverage = process.env.COVERAGE === 'true'\n\n  let coverageLoaders = []\n  let coverageReporters = []\n\n  if (runCoverage) {\n    coverageLoaders.push({\n      test: /\\.js$/,\n      include: path.resolve('src/'),\n      loader: 'isparta'\n    }),\n\n    coverageReporters.push('coverage')\n  }\n\n  config.set({\n\n    browsers: [ 'Firefox' ],\n    frameworks: [ 'mocha' ],\n    reporters: [ 'mocha' ].concat(coverageReporters),\n\n    files: [\n      'tests.webpack.js'\n    ],\n\n    preprocessors: {\n      'tests.webpack.js': [ 'webpack', 'sourcemap' ]\n    },\n\n    singleRun: true,\n\n    webpack: {\n      devtool: 'inline-source-map',\n      module: {\n        rules: [\n          {\n            test: /\\.js$/,\n            enforce: \"pre\",\n            use: 'babel-loader',\n            include: [\n              path.resolve('src/'),\n              path.resolve('test/')\n            ]\n\n          }\n        ].concat(coverageLoaders)\n      }\n    },\n\n    webpackServer: {\n      noInfo: true\n    },\n\n    coverageReporter: {\n      reporters: [\n        { type: 'text' },\n        { type: 'json', subdir: 'browser-coverage', file: 'coverage.json' }\n      ]\n    }\n  })\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"react-router-redux\",\n  \"version\": \"4.0.8\",\n  \"description\": \"Ruthlessly simple bindings to keep react-router and redux in sync\",\n  \"main\": \"lib/index\",\n  \"files\": [\n    \"*.md\",\n    \"dist\",\n    \"LICENSE\",\n    \"lib\",\n    \"src\"\n  ],\n  \"repository\": \"reactjs/react-router-redux\",\n  \"authors\": [\n    \"James Long\",\n    \"Tim Dorr\"\n  ],\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"build\": \"npm run build:commonjs & npm run build:umd & npm run build:umd:min\",\n    \"build:commonjs\": \"mkdir -p lib && babel ./src -d lib\",\n    \"build:umd\": \"webpack dist/ReactRouterRedux.js\",\n    \"build:umd:min\": \"NODE_ENV=production webpack dist/ReactRouterRedux.min.js\",\n    \"lint\": \"eslint examples src test\",\n    \"test\": \"npm run lint && npm run test:node && npm run test:browser\",\n    \"test:node\": \"mocha --compilers js:babel-register --recursive ./test/*.spec.js\",\n    \"test:browser\": \"karma start\",\n    \"test:cov\": \"npm run test:cov:browser && npm run test:cov:node && npm run test:cov:report\",\n    \"test:cov:node\": \"babel-node $(npm bin)/isparta cover $(npm bin)/_mocha report --dir ./coverage/node-coverage -- --recursive ./test/node\",\n    \"test:cov:browser\": \"COVERAGE=true karma start\",\n    \"test:cov:report\": \"$(npm bin)/istanbul report --dir ./coverage --include **/*coverage.json html text\",\n    \"prepublish\": \"npm run build\"\n  },\n  \"tags\": [\n    \"react\",\n    \"redux\"\n  ],\n  \"keywords\": [\n    \"react\",\n    \"redux\",\n    \"router\"\n  ],\n  \"devDependencies\": {\n    \"babel-cli\": \"^6.1.2\",\n    \"babel-core\": \"^6.7.4\",\n    \"babel-eslint\": \"^7.1.1\",\n    \"babel-loader\": \"^6.2.0\",\n    \"babel-plugin-transform-es3-member-expression-literals\": \"^6.5.0\",\n    \"babel-plugin-transform-es3-property-literals\": \"^6.5.0\",\n    \"babel-polyfill\": \"^6.7.4\",\n    \"babel-preset-es2015\": \"^6.3.13\",\n    \"babel-preset-react\": \"^6.5.0\",\n    \"babel-preset-stage-1\": \"^6.3.13\",\n    \"babel-register\": \"^6.4.3\",\n    \"eslint\": \"^3.15.0\",\n    \"eslint-config-react-app\": \"^0.5.0\",\n    \"eslint-plugin-flowtype\": \"^2.29.2\",\n    \"eslint-plugin-import\": \"^2.2.0\",\n    \"eslint-plugin-jsx-a11y\": \"^4.0.0\",\n    \"eslint-plugin-react\": \"^6.8.0\",\n    \"expect\": \"^1.13.0\",\n    \"history\": \"^3.0.0\",\n    \"isparta\": \"^4.0.0\",\n    \"isparta-loader\": \"^2.0.0\",\n    \"karma\": \"^1.4.1\",\n    \"karma-coverage\": \"^1.1.1\",\n    \"karma-firefox-launcher\": \"^1.0.0\",\n    \"karma-mocha\": \"^1.3.0\",\n    \"karma-mocha-reporter\": \"^2.2.2\",\n    \"karma-sourcemap-loader\": \"^0.3.5\",\n    \"karma-webpack\": \"^2.0.2\",\n    \"mocha\": \"^3.2.0\",\n    \"react\": \"^15.4.2\",\n    \"react-dom\": \"^15.4.2\",\n    \"react-redux\": \"^5.0.2\",\n    \"react-router\": \"^3.0.0\",\n    \"redux\": \"^3.0.4\",\n    \"redux-devtools\": \"^3.0.0\",\n    \"redux-devtools-dock-monitor\": \"^1.0.1\",\n    \"redux-devtools-log-monitor\": \"^1.0.1\",\n    \"webpack\": \"^2.2.1\"\n  }\n}\n"
  },
  {
    "path": "src/actions.js",
    "content": "/**\n * This action type will be dispatched by the history actions below.\n * If you're writing a middleware to watch for navigation events, be sure to\n * look for actions of this type.\n */\nexport const CALL_HISTORY_METHOD = '@@router/CALL_HISTORY_METHOD'\n\nfunction updateLocation(method) {\n  return (...args) => ({\n    type: CALL_HISTORY_METHOD,\n    payload: { method, args }\n  })\n}\n\n/**\n * These actions correspond to the history API.\n * The associated routerMiddleware will capture these events before they get to\n * your reducer and reissue them as the matching function on your history.\n */\nexport const push = updateLocation('push')\nexport const replace = updateLocation('replace')\nexport const go = updateLocation('go')\nexport const goBack = updateLocation('goBack')\nexport const goForward = updateLocation('goForward')\n\nexport const routerActions = { push, replace, go, goBack, goForward }\n"
  },
  {
    "path": "src/index.js",
    "content": "export syncHistoryWithStore from './sync'\nexport { LOCATION_CHANGE, routerReducer } from './reducer'\n\nexport {\n  CALL_HISTORY_METHOD,\n  push, replace, go, goBack, goForward,\n  routerActions\n} from './actions'\nexport routerMiddleware from './middleware'\n"
  },
  {
    "path": "src/middleware.js",
    "content": "import { CALL_HISTORY_METHOD } from './actions'\n\n/**\n * This middleware captures CALL_HISTORY_METHOD actions to redirect to the\n * provided history object. This will prevent these actions from reaching your\n * reducer or any middleware that comes after this one.\n */\nexport default function routerMiddleware(history) {\n  return () => next => action => {\n    if (action.type !== CALL_HISTORY_METHOD) {\n      return next(action)\n    }\n\n    const { payload: { method, args } } = action\n    history[method](...args)\n  }\n}\n"
  },
  {
    "path": "src/reducer.js",
    "content": "/**\n * This action type will be dispatched when your history\n * receives a location change.\n */\nexport const LOCATION_CHANGE = '@@router/LOCATION_CHANGE'\n\nconst initialState = {\n  locationBeforeTransitions: null\n}\n\n/**\n * This reducer will update the state with the most recent location history\n * has transitioned to. This may not be in sync with the router, particularly\n * if you have asynchronously-loaded routes, so reading from and relying on\n * this state is discouraged.\n */\nexport function routerReducer(state = initialState, { type, payload } = {}) {\n  if (type === LOCATION_CHANGE) {\n    return { ...state, locationBeforeTransitions: payload }\n  }\n\n  return state\n}\n"
  },
  {
    "path": "src/sync.js",
    "content": "import { LOCATION_CHANGE } from './reducer'\n\nconst defaultSelectLocationState = state => state.routing\n\n/**\n * This function synchronizes your history state with the Redux store.\n * Location changes flow from history to the store. An enhanced history is\n * returned with a listen method that responds to store updates for location.\n *\n * When this history is provided to the router, this means the location data\n * will flow like this:\n * history.push -> store.dispatch -> enhancedHistory.listen -> router\n * This ensures that when the store state changes due to a replay or other\n * event, the router will be updated appropriately and can transition to the\n * correct router state.\n */\nexport default function syncHistoryWithStore(history, store, {\n  selectLocationState = defaultSelectLocationState,\n  adjustUrlOnReplay = true\n} = {}) {\n  // Ensure that the reducer is mounted on the store and functioning properly.\n  if (typeof selectLocationState(store.getState()) === 'undefined') {\n    throw new Error(\n      'Expected the routing state to be available either as `state.routing` ' +\n      'or as the custom expression you can specify as `selectLocationState` ' +\n      'in the `syncHistoryWithStore()` options. ' +\n      'Ensure you have added the `routerReducer` to your store\\'s ' +\n      'reducers via `combineReducers` or whatever method you use to isolate ' +\n      'your reducers.'\n    )\n  }\n\n  let initialLocation\n  let isTimeTraveling\n  let unsubscribeFromStore\n  let unsubscribeFromHistory\n  let currentLocation\n\n  // What does the store say about current location?\n  const getLocationInStore = (useInitialIfEmpty) => {\n    const locationState = selectLocationState(store.getState())\n    return locationState.locationBeforeTransitions ||\n      (useInitialIfEmpty ? initialLocation : undefined)\n  }\n\n  // Init initialLocation with potential location in store\n  initialLocation = getLocationInStore()\n\n  // If the store is replayed, update the URL in the browser to match.\n  if (adjustUrlOnReplay) {\n    const handleStoreChange = () => {\n      const locationInStore = getLocationInStore(true)\n      if (currentLocation === locationInStore || initialLocation === locationInStore) {\n        return\n      }\n\n      // Update address bar to reflect store state\n      isTimeTraveling = true\n      currentLocation = locationInStore\n      history.transitionTo({\n        ...locationInStore,\n        action: 'PUSH'\n      })\n      isTimeTraveling = false\n    }\n\n    unsubscribeFromStore = store.subscribe(handleStoreChange)\n    handleStoreChange()\n  }\n\n  // Whenever location changes, dispatch an action to get it in the store\n  const handleLocationChange = (location) => {\n    // ... unless we just caused that location change\n    if (isTimeTraveling) {\n      return\n    }\n\n    // Remember where we are\n    currentLocation = location\n\n    // Are we being called for the first time?\n    if (!initialLocation) {\n      // Remember as a fallback in case state is reset\n      initialLocation = location\n\n      // Respect persisted location, if any\n      if (getLocationInStore()) {\n        return\n      }\n    }\n\n    // Tell the store to update by dispatching an action\n    store.dispatch({\n      type: LOCATION_CHANGE,\n      payload: location\n    })\n  }\n  unsubscribeFromHistory = history.listen(handleLocationChange)\n\n  // History 3.x doesn't call listen synchronously, so fire the initial location change ourselves\n  if (history.getCurrentLocation) {\n    handleLocationChange(history.getCurrentLocation())\n  }\n\n  // The enhanced history uses store as source of truth\n  return {\n    ...history,\n    // The listeners are subscribed to the store instead of history\n    listen(listener) {\n      // Copy of last location.\n      let lastPublishedLocation = getLocationInStore(true)\n\n      // Keep track of whether we unsubscribed, as Redux store\n      // only applies changes in subscriptions on next dispatch\n      let unsubscribed = false\n      const unsubscribeFromStore = store.subscribe(() => {\n        const currentLocation = getLocationInStore(true)\n        if (currentLocation === lastPublishedLocation) {\n          return\n        }\n        lastPublishedLocation = currentLocation\n        if (!unsubscribed) {\n          listener(lastPublishedLocation)\n        }\n      })\n\n      // History 2.x listeners expect a synchronous call. Make the first call to the\n      // listener after subscribing to the store, in case the listener causes a\n      // location change (e.g. when it redirects)\n      if (!history.getCurrentLocation) {\n        listener(lastPublishedLocation)\n      }\n\n      // Let user unsubscribe later\n      return () => {\n        unsubscribed = true\n        unsubscribeFromStore()\n      }\n    },\n\n    // It also provides a way to destroy internal listeners\n    unsubscribe() {\n      if (adjustUrlOnReplay) {\n        unsubscribeFromStore()\n      }\n      unsubscribeFromHistory()\n    }\n  }\n}\n"
  },
  {
    "path": "test/.eslintrc",
    "content": "{\n  \"env\": {\n    \"mocha\": true\n  }\n}\n"
  },
  {
    "path": "test/_createSyncTest.js",
    "content": "import expect from 'expect'\n\nimport React from 'react'\nimport ReactDOM from 'react-dom'\nimport { Router, Route, useRouterHistory } from 'react-router'\nimport { Provider } from 'react-redux'\nimport { createStore, combineReducers } from 'redux'\nimport { ActionCreators, instrument } from 'redux-devtools'\n\nimport syncHistoryWithStore from '../src/sync'\nimport { routerReducer } from '../src/reducer'\n\nexpect.extend({\n  toContainLocation({\n    pathname,\n    search = '',\n    hash = '',\n    state = null,\n    query,\n    action = 'PUSH'\n  }) {\n    const { locationBeforeTransitions } = this.actual.getState().routing\n    const location = locationBeforeTransitions\n\n    expect(location.pathname).toEqual(pathname)\n    expect(location.search).toEqual(search)\n    expect(location.hash).toEqual(hash)\n    expect(location.state).toEqual(state)\n    expect(location.query).toEqual(query)\n    expect(location.action).toEqual(action)\n  }\n})\n\n\nfunction createSyncedHistoryAndStore(originalHistory) {\n\n  const store = createStore(combineReducers({\n    routing: routerReducer\n  }))\n  const history = syncHistoryWithStore(originalHistory, store)\n\n  return { history, store }\n}\n\nconst defaultReset = () => {}\n\nexport default function createTests(createHistory, name, reset = defaultReset) {\n  describe(name, () => {\n\n    beforeEach(reset)\n\n    describe('syncHistoryWithStore', () => {\n      let history, store\n\n      beforeEach(() => {\n        let synced = createSyncedHistoryAndStore(createHistory())\n        history = synced.history\n        store = synced.store\n      })\n\n      afterEach(() => {\n        history.unsubscribe()\n      })\n\n      it('syncs history -> redux', () => {\n        expect(store).toContainLocation({\n          pathname: '/',\n          action: 'POP'\n        })\n\n        history.push('/foo')\n        expect(store).toContainLocation({\n          pathname: '/foo'\n        })\n\n        history.push({ state: { bar: 'baz' }, pathname: '/foo' })\n        expect(store).toContainLocation({\n          pathname: '/foo',\n          state: { bar: 'baz' },\n          action: 'PUSH'\n        })\n\n        history.replace('/bar')\n        expect(store).toContainLocation({\n          pathname: '/bar',\n          action: 'REPLACE'\n        })\n\n        history.push('/bar')\n        expect(store).toContainLocation({\n          pathname: '/bar',\n          action: 'REPLACE' // Converted by history.\n        })\n\n        history.push('/bar?query=1')\n        expect(store).toContainLocation({\n          pathname: '/bar',\n          search: '?query=1'\n        })\n\n        history.push('/bar#baz')\n        expect(store).toContainLocation({\n          pathname: '/bar',\n          hash: '#baz'\n        })\n\n        history.replace({\n          pathname: '/bar',\n          search: '?query=1',\n          state: { bar: 'baz' }\n        })\n        expect(store).toContainLocation({\n          pathname: '/bar',\n          search: '?query=1',\n          state: { bar: 'baz' },\n          action: 'REPLACE'\n        })\n\n        history.replace({\n          pathname: '/bar',\n          search: '?query=1',\n          hash: '#hash=2',\n          state: { bar: 'baz' }\n        })\n        expect(store).toContainLocation({\n          pathname: '/bar',\n          search: '?query=1',\n          hash: '#hash=2',\n          state: { bar: 'baz' },\n          action: 'REPLACE'\n        })\n      })\n\n      it('provides an unsubscribe method to stop listening to history and store', () => {\n        history.push('/foo')\n        expect(store).toContainLocation({\n          pathname: '/foo'\n        })\n\n        history.unsubscribe()\n\n        history.push('/bar')\n        expect(store).toContainLocation({\n          pathname: '/foo'\n        })\n      })\n\n      it('updates the router even if path is the same', () => {\n        history.push('/')\n\n        const updates = []\n        const historyUnsubscribe = history.listen(location => {\n          updates.push(location.pathname)\n        })\n\n        history.push('/foo')\n        history.push('/foo')\n        history.replace('/foo')\n\n        expect(updates).toEqual([ '/foo', '/foo', '/foo' ])\n\n        historyUnsubscribe()\n      })\n    })\n\n    describe('Server', () => {\n      it('handles inital load correctly', () => {\n        // Server\n        const { store: serverStore } = createSyncedHistoryAndStore(createHistory('/'))\n        expect(serverStore).toContainLocation({\n          pathname: '/',\n          action: 'POP'\n        })\n\n        // Client\n        let clientStore = createStore(combineReducers({\n          routing: routerReducer\n        }), serverStore.getState())\n        let clientHistory = useRouterHistory(createHistory)()\n\n        const historyListen = expect.createSpy()\n        const historyUnsubscribe = clientHistory.listen(historyListen)\n\n        syncHistoryWithStore(clientHistory, clientStore)\n\n        // History v3: Listener should not be called during initialization\n        expect(historyListen.calls.length).toBe(0)\n\n        clientStore.dispatch({\n          type: 'non-router'\n        })\n\n        // We expect that we still didn't get any call to history after a non-router action is dispatched\n        expect(historyListen.calls.length).toBe(0)\n\n        historyUnsubscribe()\n      })\n    })\n\n    describe('Redux DevTools', () => {\n      let originalHistory, history, store, devToolsStore\n\n      beforeEach(() => {\n        originalHistory = createHistory()\n\n        // Set initial URL before syncing\n        originalHistory.push('/foo')\n\n        store = createStore(\n          combineReducers({\n            routing: routerReducer\n          }),\n          instrument()\n        )\n        devToolsStore = store.liftedStore\n\n        history = syncHistoryWithStore(originalHistory, store)\n      })\n\n      afterEach(() => {\n        history.unsubscribe()\n      })\n\n      it('resets to the initial url', () => {\n        let currentPath\n        const historyUnsubscribe = history.listen(location => {\n          currentPath = location.pathname\n        })\n\n        history.push('/bar')\n        devToolsStore.dispatch(ActionCreators.reset())\n\n        expect(currentPath).toEqual('/foo')\n\n        historyUnsubscribe()\n      })\n\n      it('handles toggle after history change', () => {\n        let currentPath\n        const historyUnsubscribe = history.listen(location => {\n          currentPath = location.pathname\n        })\n\n        history.push('/foo2') // DevTools action #2\n        history.push('/foo3') // DevTools action #3\n\n        // When we toggle an action, the devtools will revert the action\n        // and we therefore expect the history to update to the previous path\n        devToolsStore.dispatch(ActionCreators.toggleAction(3))\n        expect(currentPath).toEqual('/foo2')\n\n        historyUnsubscribe()\n      })\n    })\n\n    if (typeof(document) !== 'undefined') {\n      describe('Redux Router component', () => {\n        let store, history, rootElement\n\n        beforeEach(() => {\n          store = createStore(combineReducers({\n            routing: routerReducer\n          }))\n\n          history = syncHistoryWithStore(useRouterHistory(createHistory)(), store)\n\n          rootElement = document.createElement('div')\n          document.body.appendChild(rootElement)\n        })\n\n        afterEach(() => {\n          history.unsubscribe()\n          rootElement.parentNode.removeChild(rootElement)\n        })\n\n        it('syncs history -> components', () => {\n          history.push('/foo')\n\n          ReactDOM.render(\n            <Provider store={store}>\n              <Router history={history}>\n                <Route path=\"/\" component={props => (<span>{props.children}</span>)}>\n                  <Route path=\"foo\" component={() => (<span>at /foo</span>)} />\n                  <Route path=\"bar\" component={() => (<span>at /bar</span>)} />\n                </Route>\n              </Router>\n            </Provider>,\n            rootElement\n          )\n          expect(rootElement.textContent).toEqual('at /foo')\n\n          history.push('/bar')\n          expect(rootElement.textContent).toEqual('at /bar')\n        })\n\n        it('syncs history -> components when the initial route gets replaced', () => {\n          history.push('/foo')\n\n          ReactDOM.render(\n            <Provider store={store}>\n              <Router history={history}>\n                <Route path=\"/\" component={props => (<span>{props.children}</span>)}>\n                  <Route path=\"foo\" onEnter={(nextState, replace) => replace('/bar')} />\n                  <Route path=\"bar\" component={() => (<span>at /bar</span>)} />\n                </Route>\n              </Router>\n            </Provider>,\n            rootElement\n          )\n          expect(rootElement.textContent).toEqual('at /bar')\n        })\n      })\n    }\n  })\n}\n"
  },
  {
    "path": "test/actions.spec.js",
    "content": "import expect from 'expect'\n\nimport {\n  CALL_HISTORY_METHOD,\n  push, replace, go, goBack, goForward\n} from '../src/actions'\n\ndescribe('routerActions', () => {\n\n  describe('push', () => {\n    it('creates actions', () => {\n      expect(push('/foo')).toEqual({\n        type: CALL_HISTORY_METHOD,\n        payload: {\n          method: 'push',\n          args: [ '/foo' ]\n        }\n      })\n\n      expect(push({ pathname: '/foo', state: { the: 'state' } })).toEqual({\n        type: CALL_HISTORY_METHOD,\n        payload: {\n          method: 'push',\n          args: [ {\n            pathname: '/foo',\n            state: { the: 'state' }\n          } ]\n        }\n      })\n\n      expect(push('/foo', 'baz', 123)).toEqual({\n        type: CALL_HISTORY_METHOD,\n        payload: {\n          method: 'push',\n          args: [ '/foo' , 'baz', 123 ]\n        }\n      })\n    })\n  })\n\n  describe('replace', () => {\n    it('creates actions', () => {\n      expect(replace('/foo')).toEqual({\n        type: CALL_HISTORY_METHOD,\n        payload: {\n          method: 'replace',\n          args: [ '/foo' ]\n        }\n      })\n\n      expect(replace({ pathname: '/foo', state: { the: 'state' } })).toEqual({\n        type: CALL_HISTORY_METHOD,\n        payload: {\n          method: 'replace',\n          args: [ {\n            pathname: '/foo',\n            state: { the: 'state' }\n          } ]\n        }\n      })\n    })\n  })\n\n  describe('go', () => {\n    it('creates actions', () => {\n      expect(go(1)).toEqual({\n        type: CALL_HISTORY_METHOD,\n        payload: {\n          method: 'go',\n          args: [ 1 ]\n        }\n      })\n    })\n  })\n\n  describe('goBack', () => {\n    it('creates actions', () => {\n      expect(goBack()).toEqual({\n        type: CALL_HISTORY_METHOD,\n        payload: {\n          method: 'goBack',\n          args: []\n        }\n      })\n    })\n  })\n\n  describe('goForward', () => {\n    it('creates actions', () => {\n      expect(goForward()).toEqual({\n        type: CALL_HISTORY_METHOD,\n        payload: {\n          method: 'goForward',\n          args: []\n        }\n      })\n    })\n  })\n\n})\n"
  },
  {
    "path": "test/browser/index.js",
    "content": "import 'babel-polyfill'\n\nimport { createHashHistory, createHistory } from 'history'\nimport createTests from '../_createSyncTest'\n\ncreateTests(createHashHistory, 'Hash History', () => window.location = '#/')\ncreateTests(createHistory, 'Browser History', () => window.history.replaceState(null, null, '/'))\n"
  },
  {
    "path": "test/middleware.spec.js",
    "content": "import expect, { createSpy } from 'expect'\n\nimport { push, replace } from '../src/actions'\nimport routerMiddleware from '../src/middleware'\n\ndescribe('routerMiddleware', () => {\n  let history, next, dispatch\n\n  beforeEach(() => {\n    history = {\n      push: createSpy(),\n      replace: createSpy()\n    }\n    next = createSpy()\n\n    dispatch = routerMiddleware(history)()(next)\n  })\n\n\n  it('calls the appropriate history method', () => {\n    dispatch(push('/foo'))\n    expect(history.push).toHaveBeenCalled()\n\n    dispatch(replace('/foo'))\n    expect(history.replace).toHaveBeenCalled()\n\n    expect(next).toNotHaveBeenCalled()\n  })\n\n  it('ignores other actions', () => {\n    dispatch({ type: 'FOO' })\n    expect(next).toHaveBeenCalled()\n  })\n})\n"
  },
  {
    "path": "test/reducer.spec.js",
    "content": "import expect from 'expect'\n\nimport { LOCATION_CHANGE, routerReducer } from '../src/reducer'\n\ndescribe('routerReducer', () => {\n  const state = {\n    locationBeforeTransitions: {\n      pathname: '/foo',\n      action: 'POP'\n    }\n  }\n\n  it('updates the path', () => {\n    expect(routerReducer(state, {\n      type: LOCATION_CHANGE,\n      payload: {\n        path: '/bar',\n        action: 'PUSH'\n      }\n    })).toEqual({\n      locationBeforeTransitions: {\n        path: '/bar',\n        action: 'PUSH'\n      }\n    })\n  })\n\n  it('works with initialState', () => {\n    expect(routerReducer(undefined, {\n      type: LOCATION_CHANGE,\n      payload: {\n        path: '/bar',\n        action: 'PUSH'\n      }\n    })).toEqual({\n      locationBeforeTransitions: {\n        path: '/bar',\n        action: 'PUSH'\n      }\n    })\n  })\n\n\n  it('respects replace', () => {\n    expect(routerReducer(state, {\n      type: LOCATION_CHANGE,\n      payload: {\n        path: '/bar',\n        action: 'REPLACE'\n      }\n    })).toEqual({\n      locationBeforeTransitions: {\n        path: '/bar',\n        action: 'REPLACE'\n      }\n    })\n  })\n})\n"
  },
  {
    "path": "test/sync.spec.js",
    "content": "import { createMemoryHistory } from 'history'\nimport createTests from './_createSyncTest'\n\ncreateTests(createMemoryHistory, 'Memory History')\n"
  },
  {
    "path": "tests.webpack.js",
    "content": "const browserContext = require.context('./test/browser')\nbrowserContext.keys().forEach(browserContext)\n"
  },
  {
    "path": "webpack.config.js",
    "content": "var webpack = require('webpack')\n\nvar config = {\n  entry: './src/index',\n  module: {\n    rules: [\n      { test: /\\.js$/, use: [ 'babel-loader' ], exclude: /node_modules/ }\n    ]\n  },\n  output: {\n    library: 'ReactRouterRedux',\n    libraryTarget: 'umd'\n  }\n}\n\nif (process.env.NODE_ENV === 'production') {\n  config.plugins = [\n    new webpack.optimize.UglifyJsPlugin({ sourceMap: true }),\n    new webpack.LoaderOptionsPlugin({ minimize: true })\n  ]\n}\n\nmodule.exports = config\n"
  }
]