Add files
This commit is contained in:
commit
bb80829159
18195 changed files with 2122994 additions and 0 deletions
95
509bba0_unpacked_with_node_modules/~/react-router/lib/AsyncUtils.js
generated
vendored
Executable file
95
509bba0_unpacked_with_node_modules/~/react-router/lib/AsyncUtils.js
generated
vendored
Executable file
|
@ -0,0 +1,95 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.loopAsync = loopAsync;
|
||||
exports.mapAsync = mapAsync;
|
||||
function loopAsync(turns, work, callback) {
|
||||
var currentTurn = 0,
|
||||
isDone = false;
|
||||
var sync = false,
|
||||
hasNext = false,
|
||||
doneArgs = void 0;
|
||||
|
||||
function done() {
|
||||
isDone = true;
|
||||
if (sync) {
|
||||
// Iterate instead of recursing if possible.
|
||||
doneArgs = [].concat(Array.prototype.slice.call(arguments));
|
||||
return;
|
||||
}
|
||||
|
||||
callback.apply(this, arguments);
|
||||
}
|
||||
|
||||
function next() {
|
||||
if (isDone) {
|
||||
return;
|
||||
}
|
||||
|
||||
hasNext = true;
|
||||
if (sync) {
|
||||
// Iterate instead of recursing if possible.
|
||||
return;
|
||||
}
|
||||
|
||||
sync = true;
|
||||
|
||||
while (!isDone && currentTurn < turns && hasNext) {
|
||||
hasNext = false;
|
||||
work.call(this, currentTurn++, next, done);
|
||||
}
|
||||
|
||||
sync = false;
|
||||
|
||||
if (isDone) {
|
||||
// This means the loop finished synchronously.
|
||||
callback.apply(this, doneArgs);
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentTurn >= turns && hasNext) {
|
||||
isDone = true;
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
function mapAsync(array, work, callback) {
|
||||
var length = array.length;
|
||||
var values = [];
|
||||
|
||||
if (length === 0) return callback(null, values);
|
||||
|
||||
var isDone = false,
|
||||
doneCount = 0;
|
||||
|
||||
function done(index, error, value) {
|
||||
if (isDone) return;
|
||||
|
||||
if (error) {
|
||||
isDone = true;
|
||||
callback(error);
|
||||
} else {
|
||||
values[index] = value;
|
||||
|
||||
isDone = ++doneCount === length;
|
||||
|
||||
if (isDone) callback(null, values);
|
||||
}
|
||||
}
|
||||
|
||||
array.forEach(function (item, index) {
|
||||
work(item, index, function (error, value) {
|
||||
done(index, error, value);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/AsyncUtils.js
|
||||
// module id = 652
|
||||
// module chunks = 4
|
36
509bba0_unpacked_with_node_modules/~/react-router/lib/History.js
generated
vendored
Executable file
36
509bba0_unpacked_with_node_modules/~/react-router/lib/History.js
generated
vendored
Executable file
|
@ -0,0 +1,36 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
var _InternalPropTypes = require('./InternalPropTypes');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* A mixin that adds the "history" instance variable to components.
|
||||
*/
|
||||
var History = {
|
||||
|
||||
contextTypes: {
|
||||
history: _InternalPropTypes.history
|
||||
},
|
||||
|
||||
componentWillMount: function componentWillMount() {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'the `History` mixin is deprecated, please access `context.router` with your own `contextTypes`. http://tiny.cc/router-historymixin') : void 0;
|
||||
this.history = this.context.history;
|
||||
}
|
||||
};
|
||||
|
||||
exports.default = History;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/History.js
|
||||
// module id = 2770
|
||||
// module chunks = 4
|
35
509bba0_unpacked_with_node_modules/~/react-router/lib/IndexLink.js
generated
vendored
Executable file
35
509bba0_unpacked_with_node_modules/~/react-router/lib/IndexLink.js
generated
vendored
Executable file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _Link = require('./Link');
|
||||
|
||||
var _Link2 = _interopRequireDefault(_Link);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* An <IndexLink> is used to link to an <IndexRoute>.
|
||||
*/
|
||||
var IndexLink = _react2.default.createClass({
|
||||
displayName: 'IndexLink',
|
||||
render: function render() {
|
||||
return _react2.default.createElement(_Link2.default, _extends({}, this.props, { onlyActiveOnIndex: true }));
|
||||
}
|
||||
});
|
||||
|
||||
exports.default = IndexLink;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/IndexLink.js
|
||||
// module id = 2771
|
||||
// module chunks = 4
|
70
509bba0_unpacked_with_node_modules/~/react-router/lib/IndexRedirect.js
generated
vendored
Executable file
70
509bba0_unpacked_with_node_modules/~/react-router/lib/IndexRedirect.js
generated
vendored
Executable file
|
@ -0,0 +1,70 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
var _invariant = require('invariant');
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _Redirect = require('./Redirect');
|
||||
|
||||
var _Redirect2 = _interopRequireDefault(_Redirect);
|
||||
|
||||
var _InternalPropTypes = require('./InternalPropTypes');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _React$PropTypes = _react2.default.PropTypes;
|
||||
var string = _React$PropTypes.string;
|
||||
var object = _React$PropTypes.object;
|
||||
|
||||
/**
|
||||
* An <IndexRedirect> is used to redirect from an indexRoute.
|
||||
*/
|
||||
|
||||
var IndexRedirect = _react2.default.createClass({
|
||||
displayName: 'IndexRedirect',
|
||||
|
||||
|
||||
statics: {
|
||||
createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) {
|
||||
/* istanbul ignore else: sanity check */
|
||||
if (parentRoute) {
|
||||
parentRoute.indexRoute = _Redirect2.default.createRouteFromReactElement(element);
|
||||
} else {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'An <IndexRedirect> does not make sense at the root of your route config') : void 0;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
propTypes: {
|
||||
to: string.isRequired,
|
||||
query: object,
|
||||
state: object,
|
||||
onEnter: _InternalPropTypes.falsy,
|
||||
children: _InternalPropTypes.falsy
|
||||
},
|
||||
|
||||
/* istanbul ignore next: sanity check */
|
||||
render: function render() {
|
||||
!false ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, '<IndexRedirect> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
|
||||
}
|
||||
});
|
||||
|
||||
exports.default = IndexRedirect;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/IndexRedirect.js
|
||||
// module id = 2772
|
||||
// module chunks = 4
|
67
509bba0_unpacked_with_node_modules/~/react-router/lib/IndexRoute.js
generated
vendored
Executable file
67
509bba0_unpacked_with_node_modules/~/react-router/lib/IndexRoute.js
generated
vendored
Executable file
|
@ -0,0 +1,67 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
var _invariant = require('invariant');
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _RouteUtils = require('./RouteUtils');
|
||||
|
||||
var _InternalPropTypes = require('./InternalPropTypes');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var func = _react2.default.PropTypes.func;
|
||||
|
||||
/**
|
||||
* An <IndexRoute> is used to specify its parent's <Route indexRoute> in
|
||||
* a JSX route config.
|
||||
*/
|
||||
|
||||
var IndexRoute = _react2.default.createClass({
|
||||
displayName: 'IndexRoute',
|
||||
|
||||
|
||||
statics: {
|
||||
createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) {
|
||||
/* istanbul ignore else: sanity check */
|
||||
if (parentRoute) {
|
||||
parentRoute.indexRoute = (0, _RouteUtils.createRouteFromReactElement)(element);
|
||||
} else {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'An <IndexRoute> does not make sense at the root of your route config') : void 0;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
propTypes: {
|
||||
path: _InternalPropTypes.falsy,
|
||||
component: _InternalPropTypes.component,
|
||||
components: _InternalPropTypes.components,
|
||||
getComponent: func,
|
||||
getComponents: func
|
||||
},
|
||||
|
||||
/* istanbul ignore next: sanity check */
|
||||
render: function render() {
|
||||
!false ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, '<IndexRoute> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
|
||||
}
|
||||
});
|
||||
|
||||
exports.default = IndexRoute;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/IndexRoute.js
|
||||
// module id = 2773
|
||||
// module chunks = 4
|
39
509bba0_unpacked_with_node_modules/~/react-router/lib/InternalPropTypes.js
generated
vendored
Executable file
39
509bba0_unpacked_with_node_modules/~/react-router/lib/InternalPropTypes.js
generated
vendored
Executable file
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.routes = exports.route = exports.components = exports.component = exports.history = undefined;
|
||||
exports.falsy = falsy;
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var func = _react.PropTypes.func;
|
||||
var object = _react.PropTypes.object;
|
||||
var arrayOf = _react.PropTypes.arrayOf;
|
||||
var oneOfType = _react.PropTypes.oneOfType;
|
||||
var element = _react.PropTypes.element;
|
||||
var shape = _react.PropTypes.shape;
|
||||
var string = _react.PropTypes.string;
|
||||
function falsy(props, propName, componentName) {
|
||||
if (props[propName]) return new Error('<' + componentName + '> should not have a "' + propName + '" prop');
|
||||
}
|
||||
|
||||
var history = exports.history = shape({
|
||||
listen: func.isRequired,
|
||||
push: func.isRequired,
|
||||
replace: func.isRequired,
|
||||
go: func.isRequired,
|
||||
goBack: func.isRequired,
|
||||
goForward: func.isRequired
|
||||
});
|
||||
|
||||
var component = exports.component = oneOfType([func, string]);
|
||||
var components = exports.components = oneOfType([component, object]);
|
||||
var route = exports.route = oneOfType([object, element]);
|
||||
var routes = exports.routes = oneOfType([route, arrayOf(route)]);
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/InternalPropTypes.js
|
||||
// module id = 250
|
||||
// module chunks = 4
|
75
509bba0_unpacked_with_node_modules/~/react-router/lib/Lifecycle.js
generated
vendored
Executable file
75
509bba0_unpacked_with_node_modules/~/react-router/lib/Lifecycle.js
generated
vendored
Executable file
|
@ -0,0 +1,75 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _invariant = require('invariant');
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var object = _react2.default.PropTypes.object;
|
||||
|
||||
/**
|
||||
* The Lifecycle mixin adds the routerWillLeave lifecycle method to a
|
||||
* component that may be used to cancel a transition or prompt the user
|
||||
* for confirmation.
|
||||
*
|
||||
* On standard transitions, routerWillLeave receives a single argument: the
|
||||
* location we're transitioning to. To cancel the transition, return false.
|
||||
* To prompt the user for confirmation, return a prompt message (string).
|
||||
*
|
||||
* During the beforeunload event (assuming you're using the useBeforeUnload
|
||||
* history enhancer), routerWillLeave does not receive a location object
|
||||
* because it isn't possible for us to know the location we're transitioning
|
||||
* to. In this case routerWillLeave must return a prompt message to prevent
|
||||
* the user from closing the window/tab.
|
||||
*/
|
||||
|
||||
var Lifecycle = {
|
||||
|
||||
contextTypes: {
|
||||
history: object.isRequired,
|
||||
// Nested children receive the route as context, either
|
||||
// set by the route component using the RouteContext mixin
|
||||
// or by some other ancestor.
|
||||
route: object
|
||||
},
|
||||
|
||||
propTypes: {
|
||||
// Route components receive the route object as a prop.
|
||||
route: object
|
||||
},
|
||||
|
||||
componentDidMount: function componentDidMount() {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'the `Lifecycle` mixin is deprecated, please use `context.router.setRouteLeaveHook(route, hook)`. http://tiny.cc/router-lifecyclemixin') : void 0;
|
||||
!this.routerWillLeave ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'The Lifecycle mixin requires you to define a routerWillLeave method') : (0, _invariant2.default)(false) : void 0;
|
||||
|
||||
var route = this.props.route || this.context.route;
|
||||
|
||||
!route ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'The Lifecycle mixin must be used on either a) a <Route component> or ' + 'b) a descendant of a <Route component> that uses the RouteContext mixin') : (0, _invariant2.default)(false) : void 0;
|
||||
|
||||
this._unlistenBeforeLeavingRoute = this.context.history.listenBeforeLeavingRoute(route, this.routerWillLeave);
|
||||
},
|
||||
componentWillUnmount: function componentWillUnmount() {
|
||||
if (this._unlistenBeforeLeavingRoute) this._unlistenBeforeLeavingRoute();
|
||||
}
|
||||
};
|
||||
|
||||
exports.default = Lifecycle;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/Lifecycle.js
|
||||
// module id = 2774
|
||||
// module chunks = 4
|
183
509bba0_unpacked_with_node_modules/~/react-router/lib/Link.js
generated
vendored
Executable file
183
509bba0_unpacked_with_node_modules/~/react-router/lib/Link.js
generated
vendored
Executable file
|
@ -0,0 +1,183 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
var _invariant = require('invariant');
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _PropTypes = require('./PropTypes');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
||||
|
||||
var _React$PropTypes = _react2.default.PropTypes;
|
||||
var bool = _React$PropTypes.bool;
|
||||
var object = _React$PropTypes.object;
|
||||
var string = _React$PropTypes.string;
|
||||
var func = _React$PropTypes.func;
|
||||
var oneOfType = _React$PropTypes.oneOfType;
|
||||
|
||||
|
||||
function isLeftClickEvent(event) {
|
||||
return event.button === 0;
|
||||
}
|
||||
|
||||
function isModifiedEvent(event) {
|
||||
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
||||
}
|
||||
|
||||
// TODO: De-duplicate against hasAnyProperties in createTransitionManager.
|
||||
function isEmptyObject(object) {
|
||||
for (var p in object) {
|
||||
if (Object.prototype.hasOwnProperty.call(object, p)) return false;
|
||||
}return true;
|
||||
}
|
||||
|
||||
function createLocationDescriptor(to, _ref) {
|
||||
var query = _ref.query;
|
||||
var hash = _ref.hash;
|
||||
var state = _ref.state;
|
||||
|
||||
if (query || hash || state) {
|
||||
return { pathname: to, query: query, hash: hash, state: state };
|
||||
}
|
||||
|
||||
return to;
|
||||
}
|
||||
|
||||
/**
|
||||
* A <Link> is used to create an <a> element that links to a route.
|
||||
* When that route is active, the link gets the value of its
|
||||
* activeClassName prop.
|
||||
*
|
||||
* For example, assuming you have the following route:
|
||||
*
|
||||
* <Route path="/posts/:postID" component={Post} />
|
||||
*
|
||||
* You could use the following component to link to that route:
|
||||
*
|
||||
* <Link to={`/posts/${post.id}`} />
|
||||
*
|
||||
* Links may pass along location state and/or query string parameters
|
||||
* in the state/query props, respectively.
|
||||
*
|
||||
* <Link ... query={{ show: true }} state={{ the: 'state' }} />
|
||||
*/
|
||||
var Link = _react2.default.createClass({
|
||||
displayName: 'Link',
|
||||
|
||||
|
||||
contextTypes: {
|
||||
router: _PropTypes.routerShape
|
||||
},
|
||||
|
||||
propTypes: {
|
||||
to: oneOfType([string, object]),
|
||||
query: object,
|
||||
hash: string,
|
||||
state: object,
|
||||
activeStyle: object,
|
||||
activeClassName: string,
|
||||
onlyActiveOnIndex: bool.isRequired,
|
||||
onClick: func,
|
||||
target: string
|
||||
},
|
||||
|
||||
getDefaultProps: function getDefaultProps() {
|
||||
return {
|
||||
onlyActiveOnIndex: false,
|
||||
style: {}
|
||||
};
|
||||
},
|
||||
handleClick: function handleClick(event) {
|
||||
if (this.props.onClick) this.props.onClick(event);
|
||||
|
||||
if (event.defaultPrevented) return;
|
||||
|
||||
!this.context.router ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, '<Link>s rendered outside of a router context cannot navigate.') : (0, _invariant2.default)(false) : void 0;
|
||||
|
||||
if (isModifiedEvent(event) || !isLeftClickEvent(event)) return;
|
||||
|
||||
// If target prop is set (e.g. to "_blank"), let browser handle link.
|
||||
/* istanbul ignore if: untestable with Karma */
|
||||
if (this.props.target) return;
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var _props = this.props;
|
||||
var to = _props.to;
|
||||
var query = _props.query;
|
||||
var hash = _props.hash;
|
||||
var state = _props.state;
|
||||
|
||||
var location = createLocationDescriptor(to, { query: query, hash: hash, state: state });
|
||||
|
||||
this.context.router.push(location);
|
||||
},
|
||||
render: function render() {
|
||||
var _props2 = this.props;
|
||||
var to = _props2.to;
|
||||
var query = _props2.query;
|
||||
var hash = _props2.hash;
|
||||
var state = _props2.state;
|
||||
var activeClassName = _props2.activeClassName;
|
||||
var activeStyle = _props2.activeStyle;
|
||||
var onlyActiveOnIndex = _props2.onlyActiveOnIndex;
|
||||
|
||||
var props = _objectWithoutProperties(_props2, ['to', 'query', 'hash', 'state', 'activeClassName', 'activeStyle', 'onlyActiveOnIndex']);
|
||||
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(!(query || hash || state), 'the `query`, `hash`, and `state` props on `<Link>` are deprecated, use `<Link to={{ pathname, query, hash, state }}/>. http://tiny.cc/router-isActivedeprecated') : void 0;
|
||||
|
||||
// Ignore if rendered outside the context of router, simplifies unit testing.
|
||||
var router = this.context.router;
|
||||
|
||||
|
||||
if (router) {
|
||||
// If user does not specify a `to` prop, return an empty anchor tag.
|
||||
if (to == null) {
|
||||
return _react2.default.createElement('a', props);
|
||||
}
|
||||
|
||||
var location = createLocationDescriptor(to, { query: query, hash: hash, state: state });
|
||||
props.href = router.createHref(location);
|
||||
|
||||
if (activeClassName || activeStyle != null && !isEmptyObject(activeStyle)) {
|
||||
if (router.isActive(location, onlyActiveOnIndex)) {
|
||||
if (activeClassName) {
|
||||
if (props.className) {
|
||||
props.className += ' ' + activeClassName;
|
||||
} else {
|
||||
props.className = activeClassName;
|
||||
}
|
||||
}
|
||||
|
||||
if (activeStyle) props.style = _extends({}, props.style, activeStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _react2.default.createElement('a', _extends({}, props, { onClick: this.handleClick }));
|
||||
}
|
||||
});
|
||||
|
||||
exports.default = Link;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/Link.js
|
||||
// module id = 1125
|
||||
// module chunks = 4
|
219
509bba0_unpacked_with_node_modules/~/react-router/lib/PatternUtils.js
generated
vendored
Executable file
219
509bba0_unpacked_with_node_modules/~/react-router/lib/PatternUtils.js
generated
vendored
Executable file
|
@ -0,0 +1,219 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.compilePattern = compilePattern;
|
||||
exports.matchPattern = matchPattern;
|
||||
exports.getParamNames = getParamNames;
|
||||
exports.getParams = getParams;
|
||||
exports.formatPattern = formatPattern;
|
||||
|
||||
var _invariant = require('invariant');
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function escapeRegExp(string) {
|
||||
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
}
|
||||
|
||||
function _compilePattern(pattern) {
|
||||
var regexpSource = '';
|
||||
var paramNames = [];
|
||||
var tokens = [];
|
||||
|
||||
var match = void 0,
|
||||
lastIndex = 0,
|
||||
matcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|\*\*|\*|\(|\)/g;
|
||||
while (match = matcher.exec(pattern)) {
|
||||
if (match.index !== lastIndex) {
|
||||
tokens.push(pattern.slice(lastIndex, match.index));
|
||||
regexpSource += escapeRegExp(pattern.slice(lastIndex, match.index));
|
||||
}
|
||||
|
||||
if (match[1]) {
|
||||
regexpSource += '([^/]+)';
|
||||
paramNames.push(match[1]);
|
||||
} else if (match[0] === '**') {
|
||||
regexpSource += '(.*)';
|
||||
paramNames.push('splat');
|
||||
} else if (match[0] === '*') {
|
||||
regexpSource += '(.*?)';
|
||||
paramNames.push('splat');
|
||||
} else if (match[0] === '(') {
|
||||
regexpSource += '(?:';
|
||||
} else if (match[0] === ')') {
|
||||
regexpSource += ')?';
|
||||
}
|
||||
|
||||
tokens.push(match[0]);
|
||||
|
||||
lastIndex = matcher.lastIndex;
|
||||
}
|
||||
|
||||
if (lastIndex !== pattern.length) {
|
||||
tokens.push(pattern.slice(lastIndex, pattern.length));
|
||||
regexpSource += escapeRegExp(pattern.slice(lastIndex, pattern.length));
|
||||
}
|
||||
|
||||
return {
|
||||
pattern: pattern,
|
||||
regexpSource: regexpSource,
|
||||
paramNames: paramNames,
|
||||
tokens: tokens
|
||||
};
|
||||
}
|
||||
|
||||
var CompiledPatternsCache = Object.create(null);
|
||||
|
||||
function compilePattern(pattern) {
|
||||
if (!CompiledPatternsCache[pattern]) CompiledPatternsCache[pattern] = _compilePattern(pattern);
|
||||
|
||||
return CompiledPatternsCache[pattern];
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to match a pattern on the given pathname. Patterns may use
|
||||
* the following special characters:
|
||||
*
|
||||
* - :paramName Matches a URL segment up to the next /, ?, or #. The
|
||||
* captured string is considered a "param"
|
||||
* - () Wraps a segment of the URL that is optional
|
||||
* - * Consumes (non-greedy) all characters up to the next
|
||||
* character in the pattern, or to the end of the URL if
|
||||
* there is none
|
||||
* - ** Consumes (greedy) all characters up to the next character
|
||||
* in the pattern, or to the end of the URL if there is none
|
||||
*
|
||||
* The function calls callback(error, matched) when finished.
|
||||
* The return value is an object with the following properties:
|
||||
*
|
||||
* - remainingPathname
|
||||
* - paramNames
|
||||
* - paramValues
|
||||
*/
|
||||
function matchPattern(pattern, pathname) {
|
||||
// Ensure pattern starts with leading slash for consistency with pathname.
|
||||
if (pattern.charAt(0) !== '/') {
|
||||
pattern = '/' + pattern;
|
||||
}
|
||||
|
||||
var _compilePattern2 = compilePattern(pattern);
|
||||
|
||||
var regexpSource = _compilePattern2.regexpSource;
|
||||
var paramNames = _compilePattern2.paramNames;
|
||||
var tokens = _compilePattern2.tokens;
|
||||
|
||||
|
||||
if (pattern.charAt(pattern.length - 1) !== '/') {
|
||||
regexpSource += '/?'; // Allow optional path separator at end.
|
||||
}
|
||||
|
||||
// Special-case patterns like '*' for catch-all routes.
|
||||
if (tokens[tokens.length - 1] === '*') {
|
||||
regexpSource += '$';
|
||||
}
|
||||
|
||||
var match = pathname.match(new RegExp('^' + regexpSource, 'i'));
|
||||
if (match == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var matchedPath = match[0];
|
||||
var remainingPathname = pathname.substr(matchedPath.length);
|
||||
|
||||
if (remainingPathname) {
|
||||
// Require that the match ends at a path separator, if we didn't match
|
||||
// the full path, so any remaining pathname is a new path segment.
|
||||
if (matchedPath.charAt(matchedPath.length - 1) !== '/') {
|
||||
return null;
|
||||
}
|
||||
|
||||
// If there is a remaining pathname, treat the path separator as part of
|
||||
// the remaining pathname for properly continuing the match.
|
||||
remainingPathname = '/' + remainingPathname;
|
||||
}
|
||||
|
||||
return {
|
||||
remainingPathname: remainingPathname,
|
||||
paramNames: paramNames,
|
||||
paramValues: match.slice(1).map(function (v) {
|
||||
return v && decodeURIComponent(v);
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
function getParamNames(pattern) {
|
||||
return compilePattern(pattern).paramNames;
|
||||
}
|
||||
|
||||
function getParams(pattern, pathname) {
|
||||
var match = matchPattern(pattern, pathname);
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var paramNames = match.paramNames;
|
||||
var paramValues = match.paramValues;
|
||||
|
||||
var params = {};
|
||||
|
||||
paramNames.forEach(function (paramName, index) {
|
||||
params[paramName] = paramValues[index];
|
||||
});
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a version of the given pattern with params interpolated. Throws
|
||||
* if there is a dynamic segment of the pattern for which there is no param.
|
||||
*/
|
||||
function formatPattern(pattern, params) {
|
||||
params = params || {};
|
||||
|
||||
var _compilePattern3 = compilePattern(pattern);
|
||||
|
||||
var tokens = _compilePattern3.tokens;
|
||||
|
||||
var parenCount = 0,
|
||||
pathname = '',
|
||||
splatIndex = 0;
|
||||
|
||||
var token = void 0,
|
||||
paramName = void 0,
|
||||
paramValue = void 0;
|
||||
for (var i = 0, len = tokens.length; i < len; ++i) {
|
||||
token = tokens[i];
|
||||
|
||||
if (token === '*' || token === '**') {
|
||||
paramValue = Array.isArray(params.splat) ? params.splat[splatIndex++] : params.splat;
|
||||
|
||||
!(paramValue != null || parenCount > 0) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'Missing splat #%s for path "%s"', splatIndex, pattern) : (0, _invariant2.default)(false) : void 0;
|
||||
|
||||
if (paramValue != null) pathname += encodeURI(paramValue);
|
||||
} else if (token === '(') {
|
||||
parenCount += 1;
|
||||
} else if (token === ')') {
|
||||
parenCount -= 1;
|
||||
} else if (token.charAt(0) === ':') {
|
||||
paramName = token.substring(1);
|
||||
paramValue = params[paramName];
|
||||
|
||||
!(paramValue != null || parenCount > 0) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'Missing "%s" parameter for path "%s"', paramName, pattern) : (0, _invariant2.default)(false) : void 0;
|
||||
|
||||
if (paramValue != null) pathname += encodeURIComponent(paramValue);
|
||||
} else {
|
||||
pathname += token;
|
||||
}
|
||||
}
|
||||
|
||||
return pathname.replace(/\/+/g, '/');
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/PatternUtils.js
|
||||
// module id = 286
|
||||
// module chunks = 4
|
108
509bba0_unpacked_with_node_modules/~/react-router/lib/PropTypes.js
generated
vendored
Executable file
108
509bba0_unpacked_with_node_modules/~/react-router/lib/PropTypes.js
generated
vendored
Executable file
|
@ -0,0 +1,108 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.router = exports.routes = exports.route = exports.components = exports.component = exports.location = exports.history = exports.falsy = exports.locationShape = exports.routerShape = undefined;
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _deprecateObjectProperties = require('./deprecateObjectProperties');
|
||||
|
||||
var _deprecateObjectProperties2 = _interopRequireDefault(_deprecateObjectProperties);
|
||||
|
||||
var _InternalPropTypes = require('./InternalPropTypes');
|
||||
|
||||
var InternalPropTypes = _interopRequireWildcard(_InternalPropTypes);
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var func = _react.PropTypes.func;
|
||||
var object = _react.PropTypes.object;
|
||||
var shape = _react.PropTypes.shape;
|
||||
var string = _react.PropTypes.string;
|
||||
var routerShape = exports.routerShape = shape({
|
||||
push: func.isRequired,
|
||||
replace: func.isRequired,
|
||||
go: func.isRequired,
|
||||
goBack: func.isRequired,
|
||||
goForward: func.isRequired,
|
||||
setRouteLeaveHook: func.isRequired,
|
||||
isActive: func.isRequired
|
||||
});
|
||||
|
||||
var locationShape = exports.locationShape = shape({
|
||||
pathname: string.isRequired,
|
||||
search: string.isRequired,
|
||||
state: object,
|
||||
action: string.isRequired,
|
||||
key: string
|
||||
});
|
||||
|
||||
// Deprecated stuff below:
|
||||
|
||||
var falsy = exports.falsy = InternalPropTypes.falsy;
|
||||
var history = exports.history = InternalPropTypes.history;
|
||||
var location = exports.location = locationShape;
|
||||
var component = exports.component = InternalPropTypes.component;
|
||||
var components = exports.components = InternalPropTypes.components;
|
||||
var route = exports.route = InternalPropTypes.route;
|
||||
var routes = exports.routes = InternalPropTypes.routes;
|
||||
var router = exports.router = routerShape;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
(function () {
|
||||
var deprecatePropType = function deprecatePropType(propType, message) {
|
||||
return function () {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, message) : void 0;
|
||||
return propType.apply(undefined, arguments);
|
||||
};
|
||||
};
|
||||
|
||||
var deprecateInternalPropType = function deprecateInternalPropType(propType) {
|
||||
return deprecatePropType(propType, 'This prop type is not intended for external use, and was previously exported by mistake. These internal prop types are deprecated for external use, and will be removed in a later version.');
|
||||
};
|
||||
|
||||
var deprecateRenamedPropType = function deprecateRenamedPropType(propType, name) {
|
||||
return deprecatePropType(propType, 'The `' + name + '` prop type is now exported as `' + name + 'Shape` to avoid name conflicts. This export is deprecated and will be removed in a later version.');
|
||||
};
|
||||
|
||||
exports.falsy = falsy = deprecateInternalPropType(falsy);
|
||||
exports.history = history = deprecateInternalPropType(history);
|
||||
exports.component = component = deprecateInternalPropType(component);
|
||||
exports.components = components = deprecateInternalPropType(components);
|
||||
exports.route = route = deprecateInternalPropType(route);
|
||||
exports.routes = routes = deprecateInternalPropType(routes);
|
||||
|
||||
exports.location = location = deprecateRenamedPropType(location, 'location');
|
||||
exports.router = router = deprecateRenamedPropType(router, 'router');
|
||||
})();
|
||||
}
|
||||
|
||||
var defaultExport = {
|
||||
falsy: falsy,
|
||||
history: history,
|
||||
location: location,
|
||||
component: component,
|
||||
components: components,
|
||||
route: route,
|
||||
// For some reason, routes was never here.
|
||||
router: router
|
||||
};
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
defaultExport = (0, _deprecateObjectProperties2.default)(defaultExport, 'The default export from `react-router/lib/PropTypes` is deprecated. Please use the named exports instead.');
|
||||
}
|
||||
|
||||
exports.default = defaultExport;
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/PropTypes.js
|
||||
// module id = 653
|
||||
// module chunks = 4
|
109
509bba0_unpacked_with_node_modules/~/react-router/lib/Redirect.js
generated
vendored
Executable file
109
509bba0_unpacked_with_node_modules/~/react-router/lib/Redirect.js
generated
vendored
Executable file
|
@ -0,0 +1,109 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _invariant = require('invariant');
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _RouteUtils = require('./RouteUtils');
|
||||
|
||||
var _PatternUtils = require('./PatternUtils');
|
||||
|
||||
var _InternalPropTypes = require('./InternalPropTypes');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _React$PropTypes = _react2.default.PropTypes;
|
||||
var string = _React$PropTypes.string;
|
||||
var object = _React$PropTypes.object;
|
||||
|
||||
/**
|
||||
* A <Redirect> is used to declare another URL path a client should
|
||||
* be sent to when they request a given URL.
|
||||
*
|
||||
* Redirects are placed alongside routes in the route configuration
|
||||
* and are traversed in the same manner.
|
||||
*/
|
||||
|
||||
var Redirect = _react2.default.createClass({
|
||||
displayName: 'Redirect',
|
||||
|
||||
|
||||
statics: {
|
||||
createRouteFromReactElement: function createRouteFromReactElement(element) {
|
||||
var route = (0, _RouteUtils.createRouteFromReactElement)(element);
|
||||
|
||||
if (route.from) route.path = route.from;
|
||||
|
||||
route.onEnter = function (nextState, replace) {
|
||||
var location = nextState.location;
|
||||
var params = nextState.params;
|
||||
|
||||
|
||||
var pathname = void 0;
|
||||
if (route.to.charAt(0) === '/') {
|
||||
pathname = (0, _PatternUtils.formatPattern)(route.to, params);
|
||||
} else if (!route.to) {
|
||||
pathname = location.pathname;
|
||||
} else {
|
||||
var routeIndex = nextState.routes.indexOf(route);
|
||||
var parentPattern = Redirect.getRoutePattern(nextState.routes, routeIndex - 1);
|
||||
var pattern = parentPattern.replace(/\/*$/, '/') + route.to;
|
||||
pathname = (0, _PatternUtils.formatPattern)(pattern, params);
|
||||
}
|
||||
|
||||
replace({
|
||||
pathname: pathname,
|
||||
query: route.query || location.query,
|
||||
state: route.state || location.state
|
||||
});
|
||||
};
|
||||
|
||||
return route;
|
||||
},
|
||||
getRoutePattern: function getRoutePattern(routes, routeIndex) {
|
||||
var parentPattern = '';
|
||||
|
||||
for (var i = routeIndex; i >= 0; i--) {
|
||||
var route = routes[i];
|
||||
var pattern = route.path || '';
|
||||
|
||||
parentPattern = pattern.replace(/\/*$/, '/') + parentPattern;
|
||||
|
||||
if (pattern.indexOf('/') === 0) break;
|
||||
}
|
||||
|
||||
return '/' + parentPattern;
|
||||
}
|
||||
},
|
||||
|
||||
propTypes: {
|
||||
path: string,
|
||||
from: string, // Alias for path
|
||||
to: string.isRequired,
|
||||
query: object,
|
||||
state: object,
|
||||
onEnter: _InternalPropTypes.falsy,
|
||||
children: _InternalPropTypes.falsy
|
||||
},
|
||||
|
||||
/* istanbul ignore next: sanity check */
|
||||
render: function render() {
|
||||
!false ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, '<Redirect> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
|
||||
}
|
||||
});
|
||||
|
||||
exports.default = Redirect;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/Redirect.js
|
||||
// module id = 1126
|
||||
// module chunks = 4
|
64
509bba0_unpacked_with_node_modules/~/react-router/lib/Route.js
generated
vendored
Executable file
64
509bba0_unpacked_with_node_modules/~/react-router/lib/Route.js
generated
vendored
Executable file
|
@ -0,0 +1,64 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _invariant = require('invariant');
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _RouteUtils = require('./RouteUtils');
|
||||
|
||||
var _InternalPropTypes = require('./InternalPropTypes');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _React$PropTypes = _react2.default.PropTypes;
|
||||
var string = _React$PropTypes.string;
|
||||
var func = _React$PropTypes.func;
|
||||
|
||||
/**
|
||||
* A <Route> is used to declare which components are rendered to the
|
||||
* page when the URL matches a given pattern.
|
||||
*
|
||||
* Routes are arranged in a nested tree structure. When a new URL is
|
||||
* requested, the tree is searched depth-first to find a route whose
|
||||
* path matches the URL. When one is found, all routes in the tree
|
||||
* that lead to it are considered "active" and their components are
|
||||
* rendered into the DOM, nested in the same order as in the tree.
|
||||
*/
|
||||
|
||||
var Route = _react2.default.createClass({
|
||||
displayName: 'Route',
|
||||
|
||||
|
||||
statics: {
|
||||
createRouteFromReactElement: _RouteUtils.createRouteFromReactElement
|
||||
},
|
||||
|
||||
propTypes: {
|
||||
path: string,
|
||||
component: _InternalPropTypes.component,
|
||||
components: _InternalPropTypes.components,
|
||||
getComponent: func,
|
||||
getComponents: func
|
||||
},
|
||||
|
||||
/* istanbul ignore next: sanity check */
|
||||
render: function render() {
|
||||
!false ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, '<Route> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
|
||||
}
|
||||
});
|
||||
|
||||
exports.default = Route;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/Route.js
|
||||
// module id = 2775
|
||||
// module chunks = 4
|
52
509bba0_unpacked_with_node_modules/~/react-router/lib/RouteContext.js
generated
vendored
Executable file
52
509bba0_unpacked_with_node_modules/~/react-router/lib/RouteContext.js
generated
vendored
Executable file
|
@ -0,0 +1,52 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var object = _react2.default.PropTypes.object;
|
||||
|
||||
/**
|
||||
* The RouteContext mixin provides a convenient way for route
|
||||
* components to set the route in context. This is needed for
|
||||
* routes that render elements that want to use the Lifecycle
|
||||
* mixin to prevent transitions.
|
||||
*/
|
||||
|
||||
var RouteContext = {
|
||||
|
||||
propTypes: {
|
||||
route: object.isRequired
|
||||
},
|
||||
|
||||
childContextTypes: {
|
||||
route: object.isRequired
|
||||
},
|
||||
|
||||
getChildContext: function getChildContext() {
|
||||
return {
|
||||
route: this.props.route
|
||||
};
|
||||
},
|
||||
componentWillMount: function componentWillMount() {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'The `RouteContext` mixin is deprecated. You can provide `this.props.route` on context with your own `contextTypes`. http://tiny.cc/router-routecontextmixin') : void 0;
|
||||
}
|
||||
};
|
||||
|
||||
exports.default = RouteContext;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/RouteContext.js
|
||||
// module id = 2776
|
||||
// module chunks = 4
|
100
509bba0_unpacked_with_node_modules/~/react-router/lib/RouteUtils.js
generated
vendored
Executable file
100
509bba0_unpacked_with_node_modules/~/react-router/lib/RouteUtils.js
generated
vendored
Executable file
|
@ -0,0 +1,100 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
exports.isReactChildren = isReactChildren;
|
||||
exports.createRouteFromReactElement = createRouteFromReactElement;
|
||||
exports.createRoutesFromReactChildren = createRoutesFromReactChildren;
|
||||
exports.createRoutes = createRoutes;
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function isValidChild(object) {
|
||||
return object == null || _react2.default.isValidElement(object);
|
||||
}
|
||||
|
||||
function isReactChildren(object) {
|
||||
return isValidChild(object) || Array.isArray(object) && object.every(isValidChild);
|
||||
}
|
||||
|
||||
function createRoute(defaultProps, props) {
|
||||
return _extends({}, defaultProps, props);
|
||||
}
|
||||
|
||||
function createRouteFromReactElement(element) {
|
||||
var type = element.type;
|
||||
var route = createRoute(type.defaultProps, element.props);
|
||||
|
||||
if (route.children) {
|
||||
var childRoutes = createRoutesFromReactChildren(route.children, route);
|
||||
|
||||
if (childRoutes.length) route.childRoutes = childRoutes;
|
||||
|
||||
delete route.children;
|
||||
}
|
||||
|
||||
return route;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a routes object from the given ReactChildren. JSX
|
||||
* provides a convenient way to visualize how routes in the hierarchy are
|
||||
* nested.
|
||||
*
|
||||
* import { Route, createRoutesFromReactChildren } from 'react-router'
|
||||
*
|
||||
* const routes = createRoutesFromReactChildren(
|
||||
* <Route component={App}>
|
||||
* <Route path="home" component={Dashboard}/>
|
||||
* <Route path="news" component={NewsFeed}/>
|
||||
* </Route>
|
||||
* )
|
||||
*
|
||||
* Note: This method is automatically used when you provide <Route> children
|
||||
* to a <Router> component.
|
||||
*/
|
||||
function createRoutesFromReactChildren(children, parentRoute) {
|
||||
var routes = [];
|
||||
|
||||
_react2.default.Children.forEach(children, function (element) {
|
||||
if (_react2.default.isValidElement(element)) {
|
||||
// Component classes may have a static create* method.
|
||||
if (element.type.createRouteFromReactElement) {
|
||||
var route = element.type.createRouteFromReactElement(element, parentRoute);
|
||||
|
||||
if (route) routes.push(route);
|
||||
} else {
|
||||
routes.push(createRouteFromReactElement(element));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return routes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns an array of routes from the given object which
|
||||
* may be a JSX route, a plain object route, or an array of either.
|
||||
*/
|
||||
function createRoutes(routes) {
|
||||
if (isReactChildren(routes)) {
|
||||
routes = createRoutesFromReactChildren(routes);
|
||||
} else if (routes && !Array.isArray(routes)) {
|
||||
routes = [routes];
|
||||
}
|
||||
|
||||
return routes;
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/RouteUtils.js
|
||||
// module id = 205
|
||||
// module chunks = 4
|
231
509bba0_unpacked_with_node_modules/~/react-router/lib/Router.js
generated
vendored
Executable file
231
509bba0_unpacked_with_node_modules/~/react-router/lib/Router.js
generated
vendored
Executable file
|
@ -0,0 +1,231 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
var _createHashHistory = require('history/lib/createHashHistory');
|
||||
|
||||
var _createHashHistory2 = _interopRequireDefault(_createHashHistory);
|
||||
|
||||
var _useQueries = require('history/lib/useQueries');
|
||||
|
||||
var _useQueries2 = _interopRequireDefault(_useQueries);
|
||||
|
||||
var _invariant = require('invariant');
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _createTransitionManager = require('./createTransitionManager');
|
||||
|
||||
var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
|
||||
|
||||
var _InternalPropTypes = require('./InternalPropTypes');
|
||||
|
||||
var _RouterContext = require('./RouterContext');
|
||||
|
||||
var _RouterContext2 = _interopRequireDefault(_RouterContext);
|
||||
|
||||
var _RouteUtils = require('./RouteUtils');
|
||||
|
||||
var _RouterUtils = require('./RouterUtils');
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
||||
|
||||
function isDeprecatedHistory(history) {
|
||||
return !history || !history.__v2_compatible__;
|
||||
}
|
||||
|
||||
/* istanbul ignore next: sanity check */
|
||||
function isUnsupportedHistory(history) {
|
||||
// v3 histories expose getCurrentLocation, but aren't currently supported.
|
||||
return history && history.getCurrentLocation;
|
||||
}
|
||||
|
||||
var _React$PropTypes = _react2.default.PropTypes;
|
||||
var func = _React$PropTypes.func;
|
||||
var object = _React$PropTypes.object;
|
||||
|
||||
/**
|
||||
* A <Router> is a high-level API for automatically setting up
|
||||
* a router that renders a <RouterContext> with all the props
|
||||
* it needs each time the URL changes.
|
||||
*/
|
||||
|
||||
var Router = _react2.default.createClass({
|
||||
displayName: 'Router',
|
||||
|
||||
|
||||
propTypes: {
|
||||
history: object,
|
||||
children: _InternalPropTypes.routes,
|
||||
routes: _InternalPropTypes.routes, // alias for children
|
||||
render: func,
|
||||
createElement: func,
|
||||
onError: func,
|
||||
onUpdate: func,
|
||||
|
||||
// Deprecated:
|
||||
parseQueryString: func,
|
||||
stringifyQuery: func,
|
||||
|
||||
// PRIVATE: For client-side rehydration of server match.
|
||||
matchContext: object
|
||||
},
|
||||
|
||||
getDefaultProps: function getDefaultProps() {
|
||||
return {
|
||||
render: function render(props) {
|
||||
return _react2.default.createElement(_RouterContext2.default, props);
|
||||
}
|
||||
};
|
||||
},
|
||||
getInitialState: function getInitialState() {
|
||||
return {
|
||||
location: null,
|
||||
routes: null,
|
||||
params: null,
|
||||
components: null
|
||||
};
|
||||
},
|
||||
handleError: function handleError(error) {
|
||||
if (this.props.onError) {
|
||||
this.props.onError.call(this, error);
|
||||
} else {
|
||||
// Throw errors by default so we don't silently swallow them!
|
||||
throw error; // This error probably occurred in getChildRoutes or getComponents.
|
||||
}
|
||||
},
|
||||
componentWillMount: function componentWillMount() {
|
||||
var _this = this;
|
||||
|
||||
var _props = this.props;
|
||||
var parseQueryString = _props.parseQueryString;
|
||||
var stringifyQuery = _props.stringifyQuery;
|
||||
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(!(parseQueryString || stringifyQuery), '`parseQueryString` and `stringifyQuery` are deprecated. Please create a custom history. http://tiny.cc/router-customquerystring') : void 0;
|
||||
|
||||
var _createRouterObjects = this.createRouterObjects();
|
||||
|
||||
var history = _createRouterObjects.history;
|
||||
var transitionManager = _createRouterObjects.transitionManager;
|
||||
var router = _createRouterObjects.router;
|
||||
|
||||
|
||||
this._unlisten = transitionManager.listen(function (error, state) {
|
||||
if (error) {
|
||||
_this.handleError(error);
|
||||
} else {
|
||||
_this.setState(state, _this.props.onUpdate);
|
||||
}
|
||||
});
|
||||
|
||||
this.history = history;
|
||||
this.router = router;
|
||||
},
|
||||
createRouterObjects: function createRouterObjects() {
|
||||
var matchContext = this.props.matchContext;
|
||||
|
||||
if (matchContext) {
|
||||
return matchContext;
|
||||
}
|
||||
|
||||
var history = this.props.history;
|
||||
var _props2 = this.props;
|
||||
var routes = _props2.routes;
|
||||
var children = _props2.children;
|
||||
|
||||
|
||||
!!isUnsupportedHistory(history) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'You have provided a history object created with history v3.x. ' + 'This version of React Router is not compatible with v3 history ' + 'objects. Please use history v2.x instead.') : (0, _invariant2.default)(false) : void 0;
|
||||
|
||||
if (isDeprecatedHistory(history)) {
|
||||
history = this.wrapDeprecatedHistory(history);
|
||||
}
|
||||
|
||||
var transitionManager = (0, _createTransitionManager2.default)(history, (0, _RouteUtils.createRoutes)(routes || children));
|
||||
var router = (0, _RouterUtils.createRouterObject)(history, transitionManager);
|
||||
var routingHistory = (0, _RouterUtils.createRoutingHistory)(history, transitionManager);
|
||||
|
||||
return { history: routingHistory, transitionManager: transitionManager, router: router };
|
||||
},
|
||||
wrapDeprecatedHistory: function wrapDeprecatedHistory(history) {
|
||||
var _props3 = this.props;
|
||||
var parseQueryString = _props3.parseQueryString;
|
||||
var stringifyQuery = _props3.stringifyQuery;
|
||||
|
||||
|
||||
var createHistory = void 0;
|
||||
if (history) {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'It appears you have provided a deprecated history object to `<Router/>`, please use a history provided by ' + 'React Router with `import { browserHistory } from \'react-router\'` or `import { hashHistory } from \'react-router\'`. ' + 'If you are using a custom history please create it with `useRouterHistory`, see http://tiny.cc/router-usinghistory for details.') : void 0;
|
||||
createHistory = function createHistory() {
|
||||
return history;
|
||||
};
|
||||
} else {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, '`Router` no longer defaults the history prop to hash history. Please use the `hashHistory` singleton instead. http://tiny.cc/router-defaulthistory') : void 0;
|
||||
createHistory = _createHashHistory2.default;
|
||||
}
|
||||
|
||||
return (0, _useQueries2.default)(createHistory)({ parseQueryString: parseQueryString, stringifyQuery: stringifyQuery });
|
||||
},
|
||||
|
||||
|
||||
/* istanbul ignore next: sanity check */
|
||||
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(nextProps.history === this.props.history, 'You cannot change <Router history>; it will be ignored') : void 0;
|
||||
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)((nextProps.routes || nextProps.children) === (this.props.routes || this.props.children), 'You cannot change <Router routes>; it will be ignored') : void 0;
|
||||
},
|
||||
componentWillUnmount: function componentWillUnmount() {
|
||||
if (this._unlisten) this._unlisten();
|
||||
},
|
||||
render: function render() {
|
||||
var _state = this.state;
|
||||
var location = _state.location;
|
||||
var routes = _state.routes;
|
||||
var params = _state.params;
|
||||
var components = _state.components;
|
||||
var _props4 = this.props;
|
||||
var createElement = _props4.createElement;
|
||||
var render = _props4.render;
|
||||
|
||||
var props = _objectWithoutProperties(_props4, ['createElement', 'render']);
|
||||
|
||||
if (location == null) return null; // Async match
|
||||
|
||||
// Only forward non-Router-specific props to routing context, as those are
|
||||
// the only ones that might be custom routing context props.
|
||||
Object.keys(Router.propTypes).forEach(function (propType) {
|
||||
return delete props[propType];
|
||||
});
|
||||
|
||||
return render(_extends({}, props, {
|
||||
history: this.history,
|
||||
router: this.router,
|
||||
location: location,
|
||||
routes: routes,
|
||||
params: params,
|
||||
components: components,
|
||||
createElement: createElement
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
exports.default = Router;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/Router.js
|
||||
// module id = 2777
|
||||
// module chunks = 4
|
163
509bba0_unpacked_with_node_modules/~/react-router/lib/RouterContext.js
generated
vendored
Executable file
163
509bba0_unpacked_with_node_modules/~/react-router/lib/RouterContext.js
generated
vendored
Executable file
|
@ -0,0 +1,163 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
var _invariant = require('invariant');
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _deprecateObjectProperties = require('./deprecateObjectProperties');
|
||||
|
||||
var _deprecateObjectProperties2 = _interopRequireDefault(_deprecateObjectProperties);
|
||||
|
||||
var _getRouteParams = require('./getRouteParams');
|
||||
|
||||
var _getRouteParams2 = _interopRequireDefault(_getRouteParams);
|
||||
|
||||
var _RouteUtils = require('./RouteUtils');
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _React$PropTypes = _react2.default.PropTypes;
|
||||
var array = _React$PropTypes.array;
|
||||
var func = _React$PropTypes.func;
|
||||
var object = _React$PropTypes.object;
|
||||
|
||||
/**
|
||||
* A <RouterContext> renders the component tree for a given router state
|
||||
* and sets the history object and the current location in context.
|
||||
*/
|
||||
|
||||
var RouterContext = _react2.default.createClass({
|
||||
displayName: 'RouterContext',
|
||||
|
||||
|
||||
propTypes: {
|
||||
history: object,
|
||||
router: object.isRequired,
|
||||
location: object.isRequired,
|
||||
routes: array.isRequired,
|
||||
params: object.isRequired,
|
||||
components: array.isRequired,
|
||||
createElement: func.isRequired
|
||||
},
|
||||
|
||||
getDefaultProps: function getDefaultProps() {
|
||||
return {
|
||||
createElement: _react2.default.createElement
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
childContextTypes: {
|
||||
history: object,
|
||||
location: object.isRequired,
|
||||
router: object.isRequired
|
||||
},
|
||||
|
||||
getChildContext: function getChildContext() {
|
||||
var _props = this.props;
|
||||
var router = _props.router;
|
||||
var history = _props.history;
|
||||
var location = _props.location;
|
||||
|
||||
if (!router) {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, '`<RouterContext>` expects a `router` rather than a `history`') : void 0;
|
||||
|
||||
router = _extends({}, history, {
|
||||
setRouteLeaveHook: history.listenBeforeLeavingRoute
|
||||
});
|
||||
delete router.listenBeforeLeavingRoute;
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
location = (0, _deprecateObjectProperties2.default)(location, '`context.location` is deprecated, please use a route component\'s `props.location` instead. http://tiny.cc/router-accessinglocation');
|
||||
}
|
||||
|
||||
return { history: history, location: location, router: router };
|
||||
},
|
||||
createElement: function createElement(component, props) {
|
||||
return component == null ? null : this.props.createElement(component, props);
|
||||
},
|
||||
render: function render() {
|
||||
var _this = this;
|
||||
|
||||
var _props2 = this.props;
|
||||
var history = _props2.history;
|
||||
var location = _props2.location;
|
||||
var routes = _props2.routes;
|
||||
var params = _props2.params;
|
||||
var components = _props2.components;
|
||||
|
||||
var element = null;
|
||||
|
||||
if (components) {
|
||||
element = components.reduceRight(function (element, components, index) {
|
||||
if (components == null) return element; // Don't create new children; use the grandchildren.
|
||||
|
||||
var route = routes[index];
|
||||
var routeParams = (0, _getRouteParams2.default)(route, params);
|
||||
var props = {
|
||||
history: history,
|
||||
location: location,
|
||||
params: params,
|
||||
route: route,
|
||||
routeParams: routeParams,
|
||||
routes: routes
|
||||
};
|
||||
|
||||
if ((0, _RouteUtils.isReactChildren)(element)) {
|
||||
props.children = element;
|
||||
} else if (element) {
|
||||
for (var prop in element) {
|
||||
if (Object.prototype.hasOwnProperty.call(element, prop)) props[prop] = element[prop];
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof components === 'undefined' ? 'undefined' : _typeof(components)) === 'object') {
|
||||
var elements = {};
|
||||
|
||||
for (var key in components) {
|
||||
if (Object.prototype.hasOwnProperty.call(components, key)) {
|
||||
// Pass through the key as a prop to createElement to allow
|
||||
// custom createElement functions to know which named component
|
||||
// they're rendering, for e.g. matching up to fetched data.
|
||||
elements[key] = _this.createElement(components[key], _extends({
|
||||
key: key }, props));
|
||||
}
|
||||
}
|
||||
|
||||
return elements;
|
||||
}
|
||||
|
||||
return _this.createElement(components, props);
|
||||
}, element);
|
||||
}
|
||||
|
||||
!(element === null || element === false || _react2.default.isValidElement(element)) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'The root route must render a single element') : (0, _invariant2.default)(false) : void 0;
|
||||
|
||||
return element;
|
||||
}
|
||||
});
|
||||
|
||||
exports.default = RouterContext;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/RouterContext.js
|
||||
// module id = 441
|
||||
// module chunks = 4
|
39
509bba0_unpacked_with_node_modules/~/react-router/lib/RouterUtils.js
generated
vendored
Executable file
39
509bba0_unpacked_with_node_modules/~/react-router/lib/RouterUtils.js
generated
vendored
Executable file
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
exports.createRouterObject = createRouterObject;
|
||||
exports.createRoutingHistory = createRoutingHistory;
|
||||
|
||||
var _deprecateObjectProperties = require('./deprecateObjectProperties');
|
||||
|
||||
var _deprecateObjectProperties2 = _interopRequireDefault(_deprecateObjectProperties);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function createRouterObject(history, transitionManager) {
|
||||
return _extends({}, history, {
|
||||
setRouteLeaveHook: transitionManager.listenBeforeLeavingRoute,
|
||||
isActive: transitionManager.isActive
|
||||
});
|
||||
}
|
||||
|
||||
// deprecated
|
||||
function createRoutingHistory(history, transitionManager) {
|
||||
history = _extends({}, history, transitionManager);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
history = (0, _deprecateObjectProperties2.default)(history, '`props.history` and `context.history` are deprecated. Please use `context.router`. http://tiny.cc/router-contextchanges');
|
||||
}
|
||||
|
||||
return history;
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/RouterUtils.js
|
||||
// module id = 1127
|
||||
// module chunks = 4
|
37
509bba0_unpacked_with_node_modules/~/react-router/lib/RoutingContext.js
generated
vendored
Executable file
37
509bba0_unpacked_with_node_modules/~/react-router/lib/RoutingContext.js
generated
vendored
Executable file
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _RouterContext = require('./RouterContext');
|
||||
|
||||
var _RouterContext2 = _interopRequireDefault(_RouterContext);
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var RoutingContext = _react2.default.createClass({
|
||||
displayName: 'RoutingContext',
|
||||
componentWillMount: function componentWillMount() {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, '`RoutingContext` has been renamed to `RouterContext`. Please use `import { RouterContext } from \'react-router\'`. http://tiny.cc/router-routercontext') : void 0;
|
||||
},
|
||||
render: function render() {
|
||||
return _react2.default.createElement(_RouterContext2.default, this.props);
|
||||
}
|
||||
});
|
||||
|
||||
exports.default = RoutingContext;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/RoutingContext.js
|
||||
// module id = 2778
|
||||
// module chunks = 4
|
129
509bba0_unpacked_with_node_modules/~/react-router/lib/TransitionUtils.js
generated
vendored
Executable file
129
509bba0_unpacked_with_node_modules/~/react-router/lib/TransitionUtils.js
generated
vendored
Executable file
|
@ -0,0 +1,129 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.runEnterHooks = runEnterHooks;
|
||||
exports.runChangeHooks = runChangeHooks;
|
||||
exports.runLeaveHooks = runLeaveHooks;
|
||||
|
||||
var _AsyncUtils = require('./AsyncUtils');
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function createTransitionHook(hook, route, asyncArity) {
|
||||
return function () {
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
hook.apply(route, args);
|
||||
|
||||
if (hook.length < asyncArity) {
|
||||
var callback = args[args.length - 1];
|
||||
// Assume hook executes synchronously and
|
||||
// automatically call the callback.
|
||||
callback();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function getEnterHooks(routes) {
|
||||
return routes.reduce(function (hooks, route) {
|
||||
if (route.onEnter) hooks.push(createTransitionHook(route.onEnter, route, 3));
|
||||
|
||||
return hooks;
|
||||
}, []);
|
||||
}
|
||||
|
||||
function getChangeHooks(routes) {
|
||||
return routes.reduce(function (hooks, route) {
|
||||
if (route.onChange) hooks.push(createTransitionHook(route.onChange, route, 4));
|
||||
return hooks;
|
||||
}, []);
|
||||
}
|
||||
|
||||
function runTransitionHooks(length, iter, callback) {
|
||||
if (!length) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
var redirectInfo = void 0;
|
||||
function replace(location, deprecatedPathname, deprecatedQuery) {
|
||||
if (deprecatedPathname) {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, '`replaceState(state, pathname, query) is deprecated; use `replace(location)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated') : void 0;
|
||||
redirectInfo = {
|
||||
pathname: deprecatedPathname,
|
||||
query: deprecatedQuery,
|
||||
state: location
|
||||
};
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
redirectInfo = location;
|
||||
}
|
||||
|
||||
(0, _AsyncUtils.loopAsync)(length, function (index, next, done) {
|
||||
iter(index, replace, function (error) {
|
||||
if (error || redirectInfo) {
|
||||
done(error, redirectInfo); // No need to continue.
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
}, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs all onEnter hooks in the given array of routes in order
|
||||
* with onEnter(nextState, replace, callback) and calls
|
||||
* callback(error, redirectInfo) when finished. The first hook
|
||||
* to use replace short-circuits the loop.
|
||||
*
|
||||
* If a hook needs to run asynchronously, it may use the callback
|
||||
* function. However, doing so will cause the transition to pause,
|
||||
* which could lead to a non-responsive UI if the hook is slow.
|
||||
*/
|
||||
function runEnterHooks(routes, nextState, callback) {
|
||||
var hooks = getEnterHooks(routes);
|
||||
return runTransitionHooks(hooks.length, function (index, replace, next) {
|
||||
hooks[index](nextState, replace, next);
|
||||
}, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs all onChange hooks in the given array of routes in order
|
||||
* with onChange(prevState, nextState, replace, callback) and calls
|
||||
* callback(error, redirectInfo) when finished. The first hook
|
||||
* to use replace short-circuits the loop.
|
||||
*
|
||||
* If a hook needs to run asynchronously, it may use the callback
|
||||
* function. However, doing so will cause the transition to pause,
|
||||
* which could lead to a non-responsive UI if the hook is slow.
|
||||
*/
|
||||
function runChangeHooks(routes, state, nextState, callback) {
|
||||
var hooks = getChangeHooks(routes);
|
||||
return runTransitionHooks(hooks.length, function (index, replace, next) {
|
||||
hooks[index](state, nextState, replace, next);
|
||||
}, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs all onLeave hooks in the given array of routes in order.
|
||||
*/
|
||||
function runLeaveHooks(routes, prevState) {
|
||||
for (var i = 0, len = routes.length; i < len; ++i) {
|
||||
if (routes[i].onLeave) routes[i].onLeave.call(routes[i], prevState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/TransitionUtils.js
|
||||
// module id = 2779
|
||||
// module chunks = 4
|
64
509bba0_unpacked_with_node_modules/~/react-router/lib/applyRouterMiddleware.js
generated
vendored
Executable file
64
509bba0_unpacked_with_node_modules/~/react-router/lib/applyRouterMiddleware.js
generated
vendored
Executable file
|
@ -0,0 +1,64 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _RouterContext = require('./RouterContext');
|
||||
|
||||
var _RouterContext2 = _interopRequireDefault(_RouterContext);
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.default = function () {
|
||||
for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
middlewares[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
middlewares.forEach(function (middleware, index) {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(middleware.renderRouterContext || middleware.renderRouteComponent, 'The middleware specified at index ' + index + ' does not appear to be ' + 'a valid React Router middleware.') : void 0;
|
||||
});
|
||||
}
|
||||
|
||||
var withContext = middlewares.map(function (middleware) {
|
||||
return middleware.renderRouterContext;
|
||||
}).filter(Boolean);
|
||||
var withComponent = middlewares.map(function (middleware) {
|
||||
return middleware.renderRouteComponent;
|
||||
}).filter(Boolean);
|
||||
|
||||
var makeCreateElement = function makeCreateElement() {
|
||||
var baseCreateElement = arguments.length <= 0 || arguments[0] === undefined ? _react.createElement : arguments[0];
|
||||
return function (Component, props) {
|
||||
return withComponent.reduceRight(function (previous, renderRouteComponent) {
|
||||
return renderRouteComponent(previous, props);
|
||||
}, baseCreateElement(Component, props));
|
||||
};
|
||||
};
|
||||
|
||||
return function (renderProps) {
|
||||
return withContext.reduceRight(function (previous, renderRouterContext) {
|
||||
return renderRouterContext(previous, renderProps);
|
||||
}, _react2.default.createElement(_RouterContext2.default, _extends({}, renderProps, {
|
||||
createElement: makeCreateElement(renderProps.createElement)
|
||||
})));
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/applyRouterMiddleware.js
|
||||
// module id = 2780
|
||||
// module chunks = 4
|
23
509bba0_unpacked_with_node_modules/~/react-router/lib/browserHistory.js
generated
vendored
Executable file
23
509bba0_unpacked_with_node_modules/~/react-router/lib/browserHistory.js
generated
vendored
Executable file
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createBrowserHistory = require('history/lib/createBrowserHistory');
|
||||
|
||||
var _createBrowserHistory2 = _interopRequireDefault(_createBrowserHistory);
|
||||
|
||||
var _createRouterHistory = require('./createRouterHistory');
|
||||
|
||||
var _createRouterHistory2 = _interopRequireDefault(_createRouterHistory);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.default = (0, _createRouterHistory2.default)(_createBrowserHistory2.default);
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/browserHistory.js
|
||||
// module id = 2781
|
||||
// module chunks = 4
|
84
509bba0_unpacked_with_node_modules/~/react-router/lib/computeChangedRoutes.js
generated
vendored
Executable file
84
509bba0_unpacked_with_node_modules/~/react-router/lib/computeChangedRoutes.js
generated
vendored
Executable file
|
@ -0,0 +1,84 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _PatternUtils = require('./PatternUtils');
|
||||
|
||||
function routeParamsChanged(route, prevState, nextState) {
|
||||
if (!route.path) return false;
|
||||
|
||||
var paramNames = (0, _PatternUtils.getParamNames)(route.path);
|
||||
|
||||
return paramNames.some(function (paramName) {
|
||||
return prevState.params[paramName] !== nextState.params[paramName];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object of { leaveRoutes, changeRoutes, enterRoutes } determined by
|
||||
* the change from prevState to nextState. We leave routes if either
|
||||
* 1) they are not in the next state or 2) they are in the next state
|
||||
* but their params have changed (i.e. /users/123 => /users/456).
|
||||
*
|
||||
* leaveRoutes are ordered starting at the leaf route of the tree
|
||||
* we're leaving up to the common parent route. enterRoutes are ordered
|
||||
* from the top of the tree we're entering down to the leaf route.
|
||||
*
|
||||
* changeRoutes are any routes that didn't leave or enter during
|
||||
* the transition.
|
||||
*/
|
||||
function computeChangedRoutes(prevState, nextState) {
|
||||
var prevRoutes = prevState && prevState.routes;
|
||||
var nextRoutes = nextState.routes;
|
||||
|
||||
var leaveRoutes = void 0,
|
||||
changeRoutes = void 0,
|
||||
enterRoutes = void 0;
|
||||
if (prevRoutes) {
|
||||
(function () {
|
||||
var parentIsLeaving = false;
|
||||
leaveRoutes = prevRoutes.filter(function (route) {
|
||||
if (parentIsLeaving) {
|
||||
return true;
|
||||
} else {
|
||||
var isLeaving = nextRoutes.indexOf(route) === -1 || routeParamsChanged(route, prevState, nextState);
|
||||
if (isLeaving) parentIsLeaving = true;
|
||||
return isLeaving;
|
||||
}
|
||||
});
|
||||
|
||||
// onLeave hooks start at the leaf route.
|
||||
leaveRoutes.reverse();
|
||||
|
||||
enterRoutes = [];
|
||||
changeRoutes = [];
|
||||
|
||||
nextRoutes.forEach(function (route) {
|
||||
var isNew = prevRoutes.indexOf(route) === -1;
|
||||
var paramsChanged = leaveRoutes.indexOf(route) !== -1;
|
||||
|
||||
if (isNew || paramsChanged) enterRoutes.push(route);else changeRoutes.push(route);
|
||||
});
|
||||
})();
|
||||
} else {
|
||||
leaveRoutes = [];
|
||||
changeRoutes = [];
|
||||
enterRoutes = nextRoutes;
|
||||
}
|
||||
|
||||
return {
|
||||
leaveRoutes: leaveRoutes,
|
||||
changeRoutes: changeRoutes,
|
||||
enterRoutes: enterRoutes
|
||||
};
|
||||
}
|
||||
|
||||
exports.default = computeChangedRoutes;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/computeChangedRoutes.js
|
||||
// module id = 2782
|
||||
// module chunks = 4
|
39
509bba0_unpacked_with_node_modules/~/react-router/lib/createMemoryHistory.js
generated
vendored
Executable file
39
509bba0_unpacked_with_node_modules/~/react-router/lib/createMemoryHistory.js
generated
vendored
Executable file
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = createMemoryHistory;
|
||||
|
||||
var _useQueries = require('history/lib/useQueries');
|
||||
|
||||
var _useQueries2 = _interopRequireDefault(_useQueries);
|
||||
|
||||
var _useBasename = require('history/lib/useBasename');
|
||||
|
||||
var _useBasename2 = _interopRequireDefault(_useBasename);
|
||||
|
||||
var _createMemoryHistory = require('history/lib/createMemoryHistory');
|
||||
|
||||
var _createMemoryHistory2 = _interopRequireDefault(_createMemoryHistory);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function createMemoryHistory(options) {
|
||||
// signatures and type checking differ between `useRoutes` and
|
||||
// `createMemoryHistory`, have to create `memoryHistory` first because
|
||||
// `useQueries` doesn't understand the signature
|
||||
var memoryHistory = (0, _createMemoryHistory2.default)(options);
|
||||
var createHistory = function createHistory() {
|
||||
return memoryHistory;
|
||||
};
|
||||
var history = (0, _useQueries2.default)((0, _useBasename2.default)(createHistory))(options);
|
||||
history.__v2_compatible__ = true;
|
||||
return history;
|
||||
}
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/createMemoryHistory.js
|
||||
// module id = 1128
|
||||
// module chunks = 4
|
26
509bba0_unpacked_with_node_modules/~/react-router/lib/createRouterHistory.js
generated
vendored
Executable file
26
509bba0_unpacked_with_node_modules/~/react-router/lib/createRouterHistory.js
generated
vendored
Executable file
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
exports.default = function (createHistory) {
|
||||
var history = void 0;
|
||||
if (canUseDOM) history = (0, _useRouterHistory2.default)(createHistory)();
|
||||
return history;
|
||||
};
|
||||
|
||||
var _useRouterHistory = require('./useRouterHistory');
|
||||
|
||||
var _useRouterHistory2 = _interopRequireDefault(_useRouterHistory);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
||||
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/createRouterHistory.js
|
||||
// module id = 1129
|
||||
// module chunks = 4
|
309
509bba0_unpacked_with_node_modules/~/react-router/lib/createTransitionManager.js
generated
vendored
Executable file
309
509bba0_unpacked_with_node_modules/~/react-router/lib/createTransitionManager.js
generated
vendored
Executable file
|
@ -0,0 +1,309 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
exports.default = createTransitionManager;
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
var _computeChangedRoutes2 = require('./computeChangedRoutes');
|
||||
|
||||
var _computeChangedRoutes3 = _interopRequireDefault(_computeChangedRoutes2);
|
||||
|
||||
var _TransitionUtils = require('./TransitionUtils');
|
||||
|
||||
var _isActive2 = require('./isActive');
|
||||
|
||||
var _isActive3 = _interopRequireDefault(_isActive2);
|
||||
|
||||
var _getComponents = require('./getComponents');
|
||||
|
||||
var _getComponents2 = _interopRequireDefault(_getComponents);
|
||||
|
||||
var _matchRoutes = require('./matchRoutes');
|
||||
|
||||
var _matchRoutes2 = _interopRequireDefault(_matchRoutes);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function hasAnyProperties(object) {
|
||||
for (var p in object) {
|
||||
if (Object.prototype.hasOwnProperty.call(object, p)) return true;
|
||||
}return false;
|
||||
}
|
||||
|
||||
function createTransitionManager(history, routes) {
|
||||
var state = {};
|
||||
|
||||
// Signature should be (location, indexOnly), but needs to support (path,
|
||||
// query, indexOnly)
|
||||
function isActive(location) {
|
||||
var indexOnlyOrDeprecatedQuery = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
|
||||
var deprecatedIndexOnly = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
|
||||
|
||||
var indexOnly = void 0;
|
||||
if (indexOnlyOrDeprecatedQuery && indexOnlyOrDeprecatedQuery !== true || deprecatedIndexOnly !== null) {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, '`isActive(pathname, query, indexOnly) is deprecated; use `isActive(location, indexOnly)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated') : void 0;
|
||||
location = { pathname: location, query: indexOnlyOrDeprecatedQuery };
|
||||
indexOnly = deprecatedIndexOnly || false;
|
||||
} else {
|
||||
location = history.createLocation(location);
|
||||
indexOnly = indexOnlyOrDeprecatedQuery;
|
||||
}
|
||||
|
||||
return (0, _isActive3.default)(location, indexOnly, state.location, state.routes, state.params);
|
||||
}
|
||||
|
||||
var partialNextState = void 0;
|
||||
|
||||
function match(location, callback) {
|
||||
if (partialNextState && partialNextState.location === location) {
|
||||
// Continue from where we left off.
|
||||
finishMatch(partialNextState, callback);
|
||||
} else {
|
||||
(0, _matchRoutes2.default)(routes, location, function (error, nextState) {
|
||||
if (error) {
|
||||
callback(error);
|
||||
} else if (nextState) {
|
||||
finishMatch(_extends({}, nextState, { location: location }), callback);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function finishMatch(nextState, callback) {
|
||||
var _computeChangedRoutes = (0, _computeChangedRoutes3.default)(state, nextState);
|
||||
|
||||
var leaveRoutes = _computeChangedRoutes.leaveRoutes;
|
||||
var changeRoutes = _computeChangedRoutes.changeRoutes;
|
||||
var enterRoutes = _computeChangedRoutes.enterRoutes;
|
||||
|
||||
|
||||
(0, _TransitionUtils.runLeaveHooks)(leaveRoutes, state);
|
||||
|
||||
// Tear down confirmation hooks for left routes
|
||||
leaveRoutes.filter(function (route) {
|
||||
return enterRoutes.indexOf(route) === -1;
|
||||
}).forEach(removeListenBeforeHooksForRoute);
|
||||
|
||||
// change and enter hooks are run in series
|
||||
(0, _TransitionUtils.runChangeHooks)(changeRoutes, state, nextState, function (error, redirectInfo) {
|
||||
if (error || redirectInfo) return handleErrorOrRedirect(error, redirectInfo);
|
||||
|
||||
(0, _TransitionUtils.runEnterHooks)(enterRoutes, nextState, finishEnterHooks);
|
||||
});
|
||||
|
||||
function finishEnterHooks(error, redirectInfo) {
|
||||
if (error || redirectInfo) return handleErrorOrRedirect(error, redirectInfo);
|
||||
|
||||
// TODO: Fetch components after state is updated.
|
||||
(0, _getComponents2.default)(nextState, function (error, components) {
|
||||
if (error) {
|
||||
callback(error);
|
||||
} else {
|
||||
// TODO: Make match a pure function and have some other API
|
||||
// for "match and update state".
|
||||
callback(null, null, state = _extends({}, nextState, { components: components }));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handleErrorOrRedirect(error, redirectInfo) {
|
||||
if (error) callback(error);else callback(null, redirectInfo);
|
||||
}
|
||||
}
|
||||
|
||||
var RouteGuid = 1;
|
||||
|
||||
function getRouteID(route) {
|
||||
var create = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
|
||||
|
||||
return route.__id__ || create && (route.__id__ = RouteGuid++);
|
||||
}
|
||||
|
||||
var RouteHooks = Object.create(null);
|
||||
|
||||
function getRouteHooksForRoutes(routes) {
|
||||
return routes.reduce(function (hooks, route) {
|
||||
hooks.push.apply(hooks, RouteHooks[getRouteID(route)]);
|
||||
return hooks;
|
||||
}, []);
|
||||
}
|
||||
|
||||
function transitionHook(location, callback) {
|
||||
(0, _matchRoutes2.default)(routes, location, function (error, nextState) {
|
||||
if (nextState == null) {
|
||||
// TODO: We didn't actually match anything, but hang
|
||||
// onto error/nextState so we don't have to matchRoutes
|
||||
// again in the listen callback.
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
// Cache some state here so we don't have to
|
||||
// matchRoutes() again in the listen callback.
|
||||
partialNextState = _extends({}, nextState, { location: location });
|
||||
|
||||
var hooks = getRouteHooksForRoutes((0, _computeChangedRoutes3.default)(state, partialNextState).leaveRoutes);
|
||||
|
||||
var result = void 0;
|
||||
for (var i = 0, len = hooks.length; result == null && i < len; ++i) {
|
||||
// Passing the location arg here indicates to
|
||||
// the user that this is a transition hook.
|
||||
result = hooks[i](location);
|
||||
}
|
||||
|
||||
callback(result);
|
||||
});
|
||||
}
|
||||
|
||||
/* istanbul ignore next: untestable with Karma */
|
||||
function beforeUnloadHook() {
|
||||
// Synchronously check to see if any route hooks want
|
||||
// to prevent the current window/tab from closing.
|
||||
if (state.routes) {
|
||||
var hooks = getRouteHooksForRoutes(state.routes);
|
||||
|
||||
var message = void 0;
|
||||
for (var i = 0, len = hooks.length; typeof message !== 'string' && i < len; ++i) {
|
||||
// Passing no args indicates to the user that this is a
|
||||
// beforeunload hook. We don't know the next location.
|
||||
message = hooks[i]();
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
var unlistenBefore = void 0,
|
||||
unlistenBeforeUnload = void 0;
|
||||
|
||||
function removeListenBeforeHooksForRoute(route) {
|
||||
var routeID = getRouteID(route, false);
|
||||
if (!routeID) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete RouteHooks[routeID];
|
||||
|
||||
if (!hasAnyProperties(RouteHooks)) {
|
||||
// teardown transition & beforeunload hooks
|
||||
if (unlistenBefore) {
|
||||
unlistenBefore();
|
||||
unlistenBefore = null;
|
||||
}
|
||||
|
||||
if (unlistenBeforeUnload) {
|
||||
unlistenBeforeUnload();
|
||||
unlistenBeforeUnload = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the given hook function to run before leaving the given route.
|
||||
*
|
||||
* During a normal transition, the hook function receives the next location
|
||||
* as its only argument and can return either a prompt message (string) to show the user,
|
||||
* to make sure they want to leave the page; or `false`, to prevent the transition.
|
||||
* Any other return value will have no effect.
|
||||
*
|
||||
* During the beforeunload event (in browsers) the hook receives no arguments.
|
||||
* In this case it must return a prompt message to prevent the transition.
|
||||
*
|
||||
* Returns a function that may be used to unbind the listener.
|
||||
*/
|
||||
function listenBeforeLeavingRoute(route, hook) {
|
||||
// TODO: Warn if they register for a route that isn't currently
|
||||
// active. They're probably doing something wrong, like re-creating
|
||||
// route objects on every location change.
|
||||
var routeID = getRouteID(route);
|
||||
var hooks = RouteHooks[routeID];
|
||||
|
||||
if (!hooks) {
|
||||
var thereWereNoRouteHooks = !hasAnyProperties(RouteHooks);
|
||||
|
||||
RouteHooks[routeID] = [hook];
|
||||
|
||||
if (thereWereNoRouteHooks) {
|
||||
// setup transition & beforeunload hooks
|
||||
unlistenBefore = history.listenBefore(transitionHook);
|
||||
|
||||
if (history.listenBeforeUnload) unlistenBeforeUnload = history.listenBeforeUnload(beforeUnloadHook);
|
||||
}
|
||||
} else {
|
||||
if (hooks.indexOf(hook) === -1) {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'adding multiple leave hooks for the same route is deprecated; manage multiple confirmations in your own code instead') : void 0;
|
||||
|
||||
hooks.push(hook);
|
||||
}
|
||||
}
|
||||
|
||||
return function () {
|
||||
var hooks = RouteHooks[routeID];
|
||||
|
||||
if (hooks) {
|
||||
var newHooks = hooks.filter(function (item) {
|
||||
return item !== hook;
|
||||
});
|
||||
|
||||
if (newHooks.length === 0) {
|
||||
removeListenBeforeHooksForRoute(route);
|
||||
} else {
|
||||
RouteHooks[routeID] = newHooks;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the API for stateful environments. As the location
|
||||
* changes, we update state and call the listener. We can also
|
||||
* gracefully handle errors and redirects.
|
||||
*/
|
||||
function listen(listener) {
|
||||
// TODO: Only use a single history listener. Otherwise we'll
|
||||
// end up with multiple concurrent calls to match.
|
||||
return history.listen(function (location) {
|
||||
if (state.location === location) {
|
||||
listener(null, state);
|
||||
} else {
|
||||
match(location, function (error, redirectLocation, nextState) {
|
||||
if (error) {
|
||||
listener(error);
|
||||
} else if (redirectLocation) {
|
||||
history.replace(redirectLocation);
|
||||
} else if (nextState) {
|
||||
listener(null, nextState);
|
||||
} else {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'Location "%s" did not match any routes', location.pathname + location.search + location.hash) : void 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
isActive: isActive,
|
||||
match: match,
|
||||
listenBeforeLeavingRoute: listenBeforeLeavingRoute,
|
||||
listen: listen
|
||||
};
|
||||
}
|
||||
|
||||
//export default useRoutes
|
||||
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/createTransitionManager.js
|
||||
// module id = 654
|
||||
// module chunks = 4
|
82
509bba0_unpacked_with_node_modules/~/react-router/lib/deprecateObjectProperties.js
generated
vendored
Executable file
82
509bba0_unpacked_with_node_modules/~/react-router/lib/deprecateObjectProperties.js
generated
vendored
Executable file
|
@ -0,0 +1,82 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.canUseMembrane = undefined;
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var canUseMembrane = exports.canUseMembrane = false;
|
||||
|
||||
// No-op by default.
|
||||
var deprecateObjectProperties = function deprecateObjectProperties(object) {
|
||||
return object;
|
||||
};
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
try {
|
||||
if (Object.defineProperty({}, 'x', {
|
||||
get: function get() {
|
||||
return true;
|
||||
}
|
||||
}).x) {
|
||||
exports.canUseMembrane = canUseMembrane = true;
|
||||
}
|
||||
/* eslint-disable no-empty */
|
||||
} catch (e) {}
|
||||
/* eslint-enable no-empty */
|
||||
|
||||
if (canUseMembrane) {
|
||||
deprecateObjectProperties = function deprecateObjectProperties(object, message) {
|
||||
// Wrap the deprecated object in a membrane to warn on property access.
|
||||
var membrane = {};
|
||||
|
||||
var _loop = function _loop(prop) {
|
||||
if (!Object.prototype.hasOwnProperty.call(object, prop)) {
|
||||
return 'continue';
|
||||
}
|
||||
|
||||
if (typeof object[prop] === 'function') {
|
||||
// Can't use fat arrow here because of use of arguments below.
|
||||
membrane[prop] = function () {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, message) : void 0;
|
||||
return object[prop].apply(object, arguments);
|
||||
};
|
||||
return 'continue';
|
||||
}
|
||||
|
||||
// These properties are non-enumerable to prevent React dev tools from
|
||||
// seeing them and causing spurious warnings when accessing them. In
|
||||
// principle this could be done with a proxy, but support for the
|
||||
// ownKeys trap on proxies is not universal, even among browsers that
|
||||
// otherwise support proxies.
|
||||
Object.defineProperty(membrane, prop, {
|
||||
get: function get() {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, message) : void 0;
|
||||
return object[prop];
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
for (var prop in object) {
|
||||
var _ret = _loop(prop);
|
||||
|
||||
if (_ret === 'continue') continue;
|
||||
}
|
||||
|
||||
return membrane;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = deprecateObjectProperties;
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/deprecateObjectProperties.js
|
||||
// module id = 442
|
||||
// module chunks = 4
|
53
509bba0_unpacked_with_node_modules/~/react-router/lib/getComponents.js
generated
vendored
Executable file
53
509bba0_unpacked_with_node_modules/~/react-router/lib/getComponents.js
generated
vendored
Executable file
|
@ -0,0 +1,53 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _AsyncUtils = require('./AsyncUtils');
|
||||
|
||||
var _makeStateWithLocation = require('./makeStateWithLocation');
|
||||
|
||||
var _makeStateWithLocation2 = _interopRequireDefault(_makeStateWithLocation);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function getComponentsForRoute(nextState, route, callback) {
|
||||
if (route.component || route.components) {
|
||||
callback(null, route.component || route.components);
|
||||
return;
|
||||
}
|
||||
|
||||
var getComponent = route.getComponent || route.getComponents;
|
||||
if (!getComponent) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
var location = nextState.location;
|
||||
|
||||
var nextStateWithLocation = (0, _makeStateWithLocation2.default)(nextState, location);
|
||||
|
||||
getComponent.call(route, nextStateWithLocation, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously fetches all components needed for the given router
|
||||
* state and calls callback(error, components) when finished.
|
||||
*
|
||||
* Note: This operation may finish synchronously if no routes have an
|
||||
* asynchronous getComponents method.
|
||||
*/
|
||||
function getComponents(nextState, callback) {
|
||||
(0, _AsyncUtils.mapAsync)(nextState.routes, function (route, index, callback) {
|
||||
getComponentsForRoute(nextState, route, callback);
|
||||
}, callback);
|
||||
}
|
||||
|
||||
exports.default = getComponents;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/getComponents.js
|
||||
// module id = 2783
|
||||
// module chunks = 4
|
33
509bba0_unpacked_with_node_modules/~/react-router/lib/getRouteParams.js
generated
vendored
Executable file
33
509bba0_unpacked_with_node_modules/~/react-router/lib/getRouteParams.js
generated
vendored
Executable file
|
@ -0,0 +1,33 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _PatternUtils = require('./PatternUtils');
|
||||
|
||||
/**
|
||||
* Extracts an object of params the given route cares about from
|
||||
* the given params object.
|
||||
*/
|
||||
function getRouteParams(route, params) {
|
||||
var routeParams = {};
|
||||
|
||||
if (!route.path) return routeParams;
|
||||
|
||||
(0, _PatternUtils.getParamNames)(route.path).forEach(function (p) {
|
||||
if (Object.prototype.hasOwnProperty.call(params, p)) {
|
||||
routeParams[p] = params[p];
|
||||
}
|
||||
});
|
||||
|
||||
return routeParams;
|
||||
}
|
||||
|
||||
exports.default = getRouteParams;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/getRouteParams.js
|
||||
// module id = 2784
|
||||
// module chunks = 4
|
23
509bba0_unpacked_with_node_modules/~/react-router/lib/hashHistory.js
generated
vendored
Executable file
23
509bba0_unpacked_with_node_modules/~/react-router/lib/hashHistory.js
generated
vendored
Executable file
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _createHashHistory = require('history/lib/createHashHistory');
|
||||
|
||||
var _createHashHistory2 = _interopRequireDefault(_createHashHistory);
|
||||
|
||||
var _createRouterHistory = require('./createRouterHistory');
|
||||
|
||||
var _createRouterHistory2 = _interopRequireDefault(_createRouterHistory);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.default = (0, _createRouterHistory2.default)(_createHashHistory2.default);
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/hashHistory.js
|
||||
// module id = 2785
|
||||
// module chunks = 4
|
163
509bba0_unpacked_with_node_modules/~/react-router/lib/index.js
generated
vendored
Executable file
163
509bba0_unpacked_with_node_modules/~/react-router/lib/index.js
generated
vendored
Executable file
|
@ -0,0 +1,163 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.createMemoryHistory = exports.hashHistory = exports.browserHistory = exports.applyRouterMiddleware = exports.formatPattern = exports.useRouterHistory = exports.match = exports.routerShape = exports.locationShape = exports.PropTypes = exports.RoutingContext = exports.RouterContext = exports.createRoutes = exports.useRoutes = exports.RouteContext = exports.Lifecycle = exports.History = exports.Route = exports.Redirect = exports.IndexRoute = exports.IndexRedirect = exports.withRouter = exports.IndexLink = exports.Link = exports.Router = undefined;
|
||||
|
||||
var _RouteUtils = require('./RouteUtils');
|
||||
|
||||
Object.defineProperty(exports, 'createRoutes', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _RouteUtils.createRoutes;
|
||||
}
|
||||
});
|
||||
|
||||
var _PropTypes2 = require('./PropTypes');
|
||||
|
||||
Object.defineProperty(exports, 'locationShape', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _PropTypes2.locationShape;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'routerShape', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _PropTypes2.routerShape;
|
||||
}
|
||||
});
|
||||
|
||||
var _PatternUtils = require('./PatternUtils');
|
||||
|
||||
Object.defineProperty(exports, 'formatPattern', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _PatternUtils.formatPattern;
|
||||
}
|
||||
});
|
||||
|
||||
var _Router2 = require('./Router');
|
||||
|
||||
var _Router3 = _interopRequireDefault(_Router2);
|
||||
|
||||
var _Link2 = require('./Link');
|
||||
|
||||
var _Link3 = _interopRequireDefault(_Link2);
|
||||
|
||||
var _IndexLink2 = require('./IndexLink');
|
||||
|
||||
var _IndexLink3 = _interopRequireDefault(_IndexLink2);
|
||||
|
||||
var _withRouter2 = require('./withRouter');
|
||||
|
||||
var _withRouter3 = _interopRequireDefault(_withRouter2);
|
||||
|
||||
var _IndexRedirect2 = require('./IndexRedirect');
|
||||
|
||||
var _IndexRedirect3 = _interopRequireDefault(_IndexRedirect2);
|
||||
|
||||
var _IndexRoute2 = require('./IndexRoute');
|
||||
|
||||
var _IndexRoute3 = _interopRequireDefault(_IndexRoute2);
|
||||
|
||||
var _Redirect2 = require('./Redirect');
|
||||
|
||||
var _Redirect3 = _interopRequireDefault(_Redirect2);
|
||||
|
||||
var _Route2 = require('./Route');
|
||||
|
||||
var _Route3 = _interopRequireDefault(_Route2);
|
||||
|
||||
var _History2 = require('./History');
|
||||
|
||||
var _History3 = _interopRequireDefault(_History2);
|
||||
|
||||
var _Lifecycle2 = require('./Lifecycle');
|
||||
|
||||
var _Lifecycle3 = _interopRequireDefault(_Lifecycle2);
|
||||
|
||||
var _RouteContext2 = require('./RouteContext');
|
||||
|
||||
var _RouteContext3 = _interopRequireDefault(_RouteContext2);
|
||||
|
||||
var _useRoutes2 = require('./useRoutes');
|
||||
|
||||
var _useRoutes3 = _interopRequireDefault(_useRoutes2);
|
||||
|
||||
var _RouterContext2 = require('./RouterContext');
|
||||
|
||||
var _RouterContext3 = _interopRequireDefault(_RouterContext2);
|
||||
|
||||
var _RoutingContext2 = require('./RoutingContext');
|
||||
|
||||
var _RoutingContext3 = _interopRequireDefault(_RoutingContext2);
|
||||
|
||||
var _PropTypes3 = _interopRequireDefault(_PropTypes2);
|
||||
|
||||
var _match2 = require('./match');
|
||||
|
||||
var _match3 = _interopRequireDefault(_match2);
|
||||
|
||||
var _useRouterHistory2 = require('./useRouterHistory');
|
||||
|
||||
var _useRouterHistory3 = _interopRequireDefault(_useRouterHistory2);
|
||||
|
||||
var _applyRouterMiddleware2 = require('./applyRouterMiddleware');
|
||||
|
||||
var _applyRouterMiddleware3 = _interopRequireDefault(_applyRouterMiddleware2);
|
||||
|
||||
var _browserHistory2 = require('./browserHistory');
|
||||
|
||||
var _browserHistory3 = _interopRequireDefault(_browserHistory2);
|
||||
|
||||
var _hashHistory2 = require('./hashHistory');
|
||||
|
||||
var _hashHistory3 = _interopRequireDefault(_hashHistory2);
|
||||
|
||||
var _createMemoryHistory2 = require('./createMemoryHistory');
|
||||
|
||||
var _createMemoryHistory3 = _interopRequireDefault(_createMemoryHistory2);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.Router = _Router3.default; /* components */
|
||||
|
||||
exports.Link = _Link3.default;
|
||||
exports.IndexLink = _IndexLink3.default;
|
||||
exports.withRouter = _withRouter3.default;
|
||||
|
||||
/* components (configuration) */
|
||||
|
||||
exports.IndexRedirect = _IndexRedirect3.default;
|
||||
exports.IndexRoute = _IndexRoute3.default;
|
||||
exports.Redirect = _Redirect3.default;
|
||||
exports.Route = _Route3.default;
|
||||
|
||||
/* mixins */
|
||||
|
||||
exports.History = _History3.default;
|
||||
exports.Lifecycle = _Lifecycle3.default;
|
||||
exports.RouteContext = _RouteContext3.default;
|
||||
|
||||
/* utils */
|
||||
|
||||
exports.useRoutes = _useRoutes3.default;
|
||||
exports.RouterContext = _RouterContext3.default;
|
||||
exports.RoutingContext = _RoutingContext3.default;
|
||||
exports.PropTypes = _PropTypes3.default;
|
||||
exports.match = _match3.default;
|
||||
exports.useRouterHistory = _useRouterHistory3.default;
|
||||
exports.applyRouterMiddleware = _applyRouterMiddleware3.default;
|
||||
|
||||
/* histories */
|
||||
|
||||
exports.browserHistory = _browserHistory3.default;
|
||||
exports.hashHistory = _hashHistory3.default;
|
||||
exports.createMemoryHistory = _createMemoryHistory3.default;
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/index.js
|
||||
// module id = 94
|
||||
// module chunks = 4
|
159
509bba0_unpacked_with_node_modules/~/react-router/lib/isActive.js
generated
vendored
Executable file
159
509bba0_unpacked_with_node_modules/~/react-router/lib/isActive.js
generated
vendored
Executable file
|
@ -0,0 +1,159 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
|
||||
|
||||
exports.default = isActive;
|
||||
|
||||
var _PatternUtils = require('./PatternUtils');
|
||||
|
||||
function deepEqual(a, b) {
|
||||
if (a == b) return true;
|
||||
|
||||
if (a == null || b == null) return false;
|
||||
|
||||
if (Array.isArray(a)) {
|
||||
return Array.isArray(b) && a.length === b.length && a.every(function (item, index) {
|
||||
return deepEqual(item, b[index]);
|
||||
});
|
||||
}
|
||||
|
||||
if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) === 'object') {
|
||||
for (var p in a) {
|
||||
if (!Object.prototype.hasOwnProperty.call(a, p)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (a[p] === undefined) {
|
||||
if (b[p] !== undefined) {
|
||||
return false;
|
||||
}
|
||||
} else if (!Object.prototype.hasOwnProperty.call(b, p)) {
|
||||
return false;
|
||||
} else if (!deepEqual(a[p], b[p])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return String(a) === String(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the current pathname matches the supplied one, net of
|
||||
* leading and trailing slash normalization. This is sufficient for an
|
||||
* indexOnly route match.
|
||||
*/
|
||||
function pathIsActive(pathname, currentPathname) {
|
||||
// Normalize leading slash for consistency. Leading slash on pathname has
|
||||
// already been normalized in isActive. See caveat there.
|
||||
if (currentPathname.charAt(0) !== '/') {
|
||||
currentPathname = '/' + currentPathname;
|
||||
}
|
||||
|
||||
// Normalize the end of both path names too. Maybe `/foo/` shouldn't show
|
||||
// `/foo` as active, but in this case, we would already have failed the
|
||||
// match.
|
||||
if (pathname.charAt(pathname.length - 1) !== '/') {
|
||||
pathname += '/';
|
||||
}
|
||||
if (currentPathname.charAt(currentPathname.length - 1) !== '/') {
|
||||
currentPathname += '/';
|
||||
}
|
||||
|
||||
return currentPathname === pathname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given pathname matches the active routes and params.
|
||||
*/
|
||||
function routeIsActive(pathname, routes, params) {
|
||||
var remainingPathname = pathname,
|
||||
paramNames = [],
|
||||
paramValues = [];
|
||||
|
||||
// for...of would work here but it's probably slower post-transpilation.
|
||||
for (var i = 0, len = routes.length; i < len; ++i) {
|
||||
var route = routes[i];
|
||||
var pattern = route.path || '';
|
||||
|
||||
if (pattern.charAt(0) === '/') {
|
||||
remainingPathname = pathname;
|
||||
paramNames = [];
|
||||
paramValues = [];
|
||||
}
|
||||
|
||||
if (remainingPathname !== null && pattern) {
|
||||
var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);
|
||||
if (matched) {
|
||||
remainingPathname = matched.remainingPathname;
|
||||
paramNames = [].concat(paramNames, matched.paramNames);
|
||||
paramValues = [].concat(paramValues, matched.paramValues);
|
||||
} else {
|
||||
remainingPathname = null;
|
||||
}
|
||||
|
||||
if (remainingPathname === '') {
|
||||
// We have an exact match on the route. Just check that all the params
|
||||
// match.
|
||||
// FIXME: This doesn't work on repeated params.
|
||||
return paramNames.every(function (paramName, index) {
|
||||
return String(paramValues[index]) === String(params[paramName]);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if all key/value pairs in the given query are
|
||||
* currently active.
|
||||
*/
|
||||
function queryIsActive(query, activeQuery) {
|
||||
if (activeQuery == null) return query == null;
|
||||
|
||||
if (query == null) return true;
|
||||
|
||||
return deepEqual(query, activeQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a <Link> to the given pathname/query combination is
|
||||
* currently active.
|
||||
*/
|
||||
function isActive(_ref, indexOnly, currentLocation, routes, params) {
|
||||
var pathname = _ref.pathname;
|
||||
var query = _ref.query;
|
||||
|
||||
if (currentLocation == null) return false;
|
||||
|
||||
// TODO: This is a bit ugly. It keeps around support for treating pathnames
|
||||
// without preceding slashes as absolute paths, but possibly also works
|
||||
// around the same quirks with basenames as in matchRoutes.
|
||||
if (pathname.charAt(0) !== '/') {
|
||||
pathname = '/' + pathname;
|
||||
}
|
||||
|
||||
if (!pathIsActive(pathname, currentLocation.pathname)) {
|
||||
// The path check is necessary and sufficient for indexOnly, but otherwise
|
||||
// we still need to check the routes.
|
||||
if (indexOnly || !routeIsActive(pathname, routes, params)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return queryIsActive(query, currentLocation.query);
|
||||
}
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/isActive.js
|
||||
// module id = 2786
|
||||
// module chunks = 4
|
56
509bba0_unpacked_with_node_modules/~/react-router/lib/makeStateWithLocation.js
generated
vendored
Executable file
56
509bba0_unpacked_with_node_modules/~/react-router/lib/makeStateWithLocation.js
generated
vendored
Executable file
|
@ -0,0 +1,56 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
exports.default = makeStateWithLocation;
|
||||
|
||||
var _deprecateObjectProperties = require('./deprecateObjectProperties');
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function makeStateWithLocation(state, location) {
|
||||
if (process.env.NODE_ENV !== 'production' && _deprecateObjectProperties.canUseMembrane) {
|
||||
var stateWithLocation = _extends({}, state);
|
||||
|
||||
// I don't use deprecateObjectProperties here because I want to keep the
|
||||
// same code path between development and production, in that we just
|
||||
// assign extra properties to the copy of the state object in both cases.
|
||||
|
||||
var _loop = function _loop(prop) {
|
||||
if (!Object.prototype.hasOwnProperty.call(location, prop)) {
|
||||
return 'continue';
|
||||
}
|
||||
|
||||
Object.defineProperty(stateWithLocation, prop, {
|
||||
get: function get() {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'Accessing location properties directly from the first argument to `getComponent`, `getComponents`, `getChildRoutes`, and `getIndexRoute` is deprecated. That argument is now the router state (`nextState` or `partialNextState`) rather than the location. To access the location, use `nextState.location` or `partialNextState.location`.') : void 0;
|
||||
return location[prop];
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
for (var prop in location) {
|
||||
var _ret = _loop(prop);
|
||||
|
||||
if (_ret === 'continue') continue;
|
||||
}
|
||||
|
||||
return stateWithLocation;
|
||||
}
|
||||
|
||||
return _extends({}, state, location);
|
||||
}
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/makeStateWithLocation.js
|
||||
// module id = 1130
|
||||
// module chunks = 4
|
90
509bba0_unpacked_with_node_modules/~/react-router/lib/match.js
generated
vendored
Executable file
90
509bba0_unpacked_with_node_modules/~/react-router/lib/match.js
generated
vendored
Executable file
|
@ -0,0 +1,90 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
var _Actions = require('history/lib/Actions');
|
||||
|
||||
var _invariant = require('invariant');
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _createMemoryHistory = require('./createMemoryHistory');
|
||||
|
||||
var _createMemoryHistory2 = _interopRequireDefault(_createMemoryHistory);
|
||||
|
||||
var _createTransitionManager = require('./createTransitionManager');
|
||||
|
||||
var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
|
||||
|
||||
var _RouteUtils = require('./RouteUtils');
|
||||
|
||||
var _RouterUtils = require('./RouterUtils');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
||||
|
||||
/**
|
||||
* A high-level API to be used for server-side rendering.
|
||||
*
|
||||
* This function matches a location to a set of routes and calls
|
||||
* callback(error, redirectLocation, renderProps) when finished.
|
||||
*
|
||||
* Note: You probably don't want to use this in a browser unless you're using
|
||||
* server-side rendering with async routes.
|
||||
*/
|
||||
function match(_ref, callback) {
|
||||
var history = _ref.history;
|
||||
var routes = _ref.routes;
|
||||
var location = _ref.location;
|
||||
|
||||
var options = _objectWithoutProperties(_ref, ['history', 'routes', 'location']);
|
||||
|
||||
!(history || location) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'match needs a history or a location') : (0, _invariant2.default)(false) : void 0;
|
||||
|
||||
history = history ? history : (0, _createMemoryHistory2.default)(options);
|
||||
var transitionManager = (0, _createTransitionManager2.default)(history, (0, _RouteUtils.createRoutes)(routes));
|
||||
|
||||
var unlisten = void 0;
|
||||
|
||||
if (location) {
|
||||
// Allow match({ location: '/the/path', ... })
|
||||
location = history.createLocation(location);
|
||||
} else {
|
||||
// Pick up the location from the history via synchronous history.listen
|
||||
// call if needed.
|
||||
unlisten = history.listen(function (historyLocation) {
|
||||
location = historyLocation;
|
||||
});
|
||||
}
|
||||
|
||||
var router = (0, _RouterUtils.createRouterObject)(history, transitionManager);
|
||||
history = (0, _RouterUtils.createRoutingHistory)(history, transitionManager);
|
||||
|
||||
transitionManager.match(location, function (error, redirectLocation, nextState) {
|
||||
callback(error, redirectLocation && router.createLocation(redirectLocation, _Actions.REPLACE), nextState && _extends({}, nextState, {
|
||||
history: history,
|
||||
router: router,
|
||||
matchContext: { history: history, transitionManager: transitionManager, router: router }
|
||||
}));
|
||||
|
||||
// Defer removing the listener to here to prevent DOM histories from having
|
||||
// to unwind DOM event listeners unnecessarily, in case callback renders a
|
||||
// <Router> and attaches another history listener.
|
||||
if (unlisten) {
|
||||
unlisten();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
exports.default = match;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/match.js
|
||||
// module id = 2787
|
||||
// module chunks = 4
|
258
509bba0_unpacked_with_node_modules/~/react-router/lib/matchRoutes.js
generated
vendored
Executable file
258
509bba0_unpacked_with_node_modules/~/react-router/lib/matchRoutes.js
generated
vendored
Executable file
|
@ -0,0 +1,258 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
|
||||
|
||||
exports.default = matchRoutes;
|
||||
|
||||
var _AsyncUtils = require('./AsyncUtils');
|
||||
|
||||
var _makeStateWithLocation = require('./makeStateWithLocation');
|
||||
|
||||
var _makeStateWithLocation2 = _interopRequireDefault(_makeStateWithLocation);
|
||||
|
||||
var _PatternUtils = require('./PatternUtils');
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
var _RouteUtils = require('./RouteUtils');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function getChildRoutes(route, location, paramNames, paramValues, callback) {
|
||||
if (route.childRoutes) {
|
||||
return [null, route.childRoutes];
|
||||
}
|
||||
if (!route.getChildRoutes) {
|
||||
return [];
|
||||
}
|
||||
|
||||
var sync = true,
|
||||
result = void 0;
|
||||
|
||||
var partialNextState = {
|
||||
location: location,
|
||||
params: createParams(paramNames, paramValues)
|
||||
};
|
||||
|
||||
var partialNextStateWithLocation = (0, _makeStateWithLocation2.default)(partialNextState, location);
|
||||
|
||||
route.getChildRoutes(partialNextStateWithLocation, function (error, childRoutes) {
|
||||
childRoutes = !error && (0, _RouteUtils.createRoutes)(childRoutes);
|
||||
if (sync) {
|
||||
result = [error, childRoutes];
|
||||
return;
|
||||
}
|
||||
|
||||
callback(error, childRoutes);
|
||||
});
|
||||
|
||||
sync = false;
|
||||
return result; // Might be undefined.
|
||||
}
|
||||
|
||||
function getIndexRoute(route, location, paramNames, paramValues, callback) {
|
||||
if (route.indexRoute) {
|
||||
callback(null, route.indexRoute);
|
||||
} else if (route.getIndexRoute) {
|
||||
var partialNextState = {
|
||||
location: location,
|
||||
params: createParams(paramNames, paramValues)
|
||||
};
|
||||
|
||||
var partialNextStateWithLocation = (0, _makeStateWithLocation2.default)(partialNextState, location);
|
||||
|
||||
route.getIndexRoute(partialNextStateWithLocation, function (error, indexRoute) {
|
||||
callback(error, !error && (0, _RouteUtils.createRoutes)(indexRoute)[0]);
|
||||
});
|
||||
} else if (route.childRoutes) {
|
||||
(function () {
|
||||
var pathless = route.childRoutes.filter(function (childRoute) {
|
||||
return !childRoute.path;
|
||||
});
|
||||
|
||||
(0, _AsyncUtils.loopAsync)(pathless.length, function (index, next, done) {
|
||||
getIndexRoute(pathless[index], location, paramNames, paramValues, function (error, indexRoute) {
|
||||
if (error || indexRoute) {
|
||||
var routes = [pathless[index]].concat(Array.isArray(indexRoute) ? indexRoute : [indexRoute]);
|
||||
done(error, routes);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
}, function (err, routes) {
|
||||
callback(null, routes);
|
||||
});
|
||||
})();
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
function assignParams(params, paramNames, paramValues) {
|
||||
return paramNames.reduce(function (params, paramName, index) {
|
||||
var paramValue = paramValues && paramValues[index];
|
||||
|
||||
if (Array.isArray(params[paramName])) {
|
||||
params[paramName].push(paramValue);
|
||||
} else if (paramName in params) {
|
||||
params[paramName] = [params[paramName], paramValue];
|
||||
} else {
|
||||
params[paramName] = paramValue;
|
||||
}
|
||||
|
||||
return params;
|
||||
}, params);
|
||||
}
|
||||
|
||||
function createParams(paramNames, paramValues) {
|
||||
return assignParams({}, paramNames, paramValues);
|
||||
}
|
||||
|
||||
function matchRouteDeep(route, location, remainingPathname, paramNames, paramValues, callback) {
|
||||
var pattern = route.path || '';
|
||||
|
||||
if (pattern.charAt(0) === '/') {
|
||||
remainingPathname = location.pathname;
|
||||
paramNames = [];
|
||||
paramValues = [];
|
||||
}
|
||||
|
||||
// Only try to match the path if the route actually has a pattern, and if
|
||||
// we're not just searching for potential nested absolute paths.
|
||||
if (remainingPathname !== null && pattern) {
|
||||
try {
|
||||
var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);
|
||||
if (matched) {
|
||||
remainingPathname = matched.remainingPathname;
|
||||
paramNames = [].concat(paramNames, matched.paramNames);
|
||||
paramValues = [].concat(paramValues, matched.paramValues);
|
||||
} else {
|
||||
remainingPathname = null;
|
||||
}
|
||||
} catch (error) {
|
||||
callback(error);
|
||||
}
|
||||
|
||||
// By assumption, pattern is non-empty here, which is the prerequisite for
|
||||
// actually terminating a match.
|
||||
if (remainingPathname === '') {
|
||||
var _ret2 = function () {
|
||||
var match = {
|
||||
routes: [route],
|
||||
params: createParams(paramNames, paramValues)
|
||||
};
|
||||
|
||||
getIndexRoute(route, location, paramNames, paramValues, function (error, indexRoute) {
|
||||
if (error) {
|
||||
callback(error);
|
||||
} else {
|
||||
if (Array.isArray(indexRoute)) {
|
||||
var _match$routes;
|
||||
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(indexRoute.every(function (route) {
|
||||
return !route.path;
|
||||
}), 'Index routes should not have paths') : void 0;
|
||||
(_match$routes = match.routes).push.apply(_match$routes, indexRoute);
|
||||
} else if (indexRoute) {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(!indexRoute.path, 'Index routes should not have paths') : void 0;
|
||||
match.routes.push(indexRoute);
|
||||
}
|
||||
|
||||
callback(null, match);
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
v: void 0
|
||||
};
|
||||
}();
|
||||
|
||||
if ((typeof _ret2 === 'undefined' ? 'undefined' : _typeof(_ret2)) === "object") return _ret2.v;
|
||||
}
|
||||
}
|
||||
|
||||
if (remainingPathname != null || route.childRoutes) {
|
||||
// Either a) this route matched at least some of the path or b)
|
||||
// we don't have to load this route's children asynchronously. In
|
||||
// either case continue checking for matches in the subtree.
|
||||
var onChildRoutes = function onChildRoutes(error, childRoutes) {
|
||||
if (error) {
|
||||
callback(error);
|
||||
} else if (childRoutes) {
|
||||
// Check the child routes to see if any of them match.
|
||||
matchRoutes(childRoutes, location, function (error, match) {
|
||||
if (error) {
|
||||
callback(error);
|
||||
} else if (match) {
|
||||
// A child route matched! Augment the match and pass it up the stack.
|
||||
match.routes.unshift(route);
|
||||
callback(null, match);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}, remainingPathname, paramNames, paramValues);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
var result = getChildRoutes(route, location, paramNames, paramValues, onChildRoutes);
|
||||
if (result) {
|
||||
onChildRoutes.apply(undefined, result);
|
||||
}
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously matches the given location to a set of routes and calls
|
||||
* callback(error, state) when finished. The state object will have the
|
||||
* following properties:
|
||||
*
|
||||
* - routes An array of routes that matched, in hierarchical order
|
||||
* - params An object of URL parameters
|
||||
*
|
||||
* Note: This operation may finish synchronously if no routes have an
|
||||
* asynchronous getChildRoutes method.
|
||||
*/
|
||||
function matchRoutes(routes, location, callback, remainingPathname) {
|
||||
var paramNames = arguments.length <= 4 || arguments[4] === undefined ? [] : arguments[4];
|
||||
var paramValues = arguments.length <= 5 || arguments[5] === undefined ? [] : arguments[5];
|
||||
|
||||
if (remainingPathname === undefined) {
|
||||
// TODO: This is a little bit ugly, but it works around a quirk in history
|
||||
// that strips the leading slash from pathnames when using basenames with
|
||||
// trailing slashes.
|
||||
if (location.pathname.charAt(0) !== '/') {
|
||||
location = _extends({}, location, {
|
||||
pathname: '/' + location.pathname
|
||||
});
|
||||
}
|
||||
remainingPathname = location.pathname;
|
||||
}
|
||||
|
||||
(0, _AsyncUtils.loopAsync)(routes.length, function (index, next, done) {
|
||||
matchRouteDeep(routes[index], location, remainingPathname, paramNames, paramValues, function (error, match) {
|
||||
if (error || match) {
|
||||
done(error, match);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
}, callback);
|
||||
}
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/matchRoutes.js
|
||||
// module id = 2788
|
||||
// module chunks = 4
|
43
509bba0_unpacked_with_node_modules/~/react-router/lib/routerWarning.js
generated
vendored
Executable file
43
509bba0_unpacked_with_node_modules/~/react-router/lib/routerWarning.js
generated
vendored
Executable file
|
@ -0,0 +1,43 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = routerWarning;
|
||||
exports._resetWarned = _resetWarned;
|
||||
|
||||
var _warning = require('warning');
|
||||
|
||||
var _warning2 = _interopRequireDefault(_warning);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var warned = {};
|
||||
|
||||
function routerWarning(falseToWarn, message) {
|
||||
// Only issue deprecation warnings once.
|
||||
if (message.indexOf('deprecated') !== -1) {
|
||||
if (warned[message]) {
|
||||
return;
|
||||
}
|
||||
|
||||
warned[message] = true;
|
||||
}
|
||||
|
||||
message = '[react-router] ' + message;
|
||||
|
||||
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
||||
args[_key - 2] = arguments[_key];
|
||||
}
|
||||
|
||||
_warning2.default.apply(undefined, [falseToWarn, message].concat(args));
|
||||
}
|
||||
|
||||
function _resetWarned() {
|
||||
warned = {};
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/routerWarning.js
|
||||
// module id = 81
|
||||
// module chunks = 4
|
30
509bba0_unpacked_with_node_modules/~/react-router/lib/useRouterHistory.js
generated
vendored
Executable file
30
509bba0_unpacked_with_node_modules/~/react-router/lib/useRouterHistory.js
generated
vendored
Executable file
|
@ -0,0 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = useRouterHistory;
|
||||
|
||||
var _useQueries = require('history/lib/useQueries');
|
||||
|
||||
var _useQueries2 = _interopRequireDefault(_useQueries);
|
||||
|
||||
var _useBasename = require('history/lib/useBasename');
|
||||
|
||||
var _useBasename2 = _interopRequireDefault(_useBasename);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function useRouterHistory(createHistory) {
|
||||
return function (options) {
|
||||
var history = (0, _useQueries2.default)((0, _useBasename2.default)(createHistory))(options);
|
||||
history.__v2_compatible__ = true;
|
||||
return history;
|
||||
};
|
||||
}
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/useRouterHistory.js
|
||||
// module id = 1131
|
||||
// module chunks = 4
|
58
509bba0_unpacked_with_node_modules/~/react-router/lib/useRoutes.js
generated
vendored
Executable file
58
509bba0_unpacked_with_node_modules/~/react-router/lib/useRoutes.js
generated
vendored
Executable file
|
@ -0,0 +1,58 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
var _useQueries = require('history/lib/useQueries');
|
||||
|
||||
var _useQueries2 = _interopRequireDefault(_useQueries);
|
||||
|
||||
var _createTransitionManager = require('./createTransitionManager');
|
||||
|
||||
var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
|
||||
|
||||
var _routerWarning = require('./routerWarning');
|
||||
|
||||
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
||||
|
||||
/**
|
||||
* Returns a new createHistory function that may be used to create
|
||||
* history objects that know about routing.
|
||||
*
|
||||
* Enhances history objects with the following methods:
|
||||
*
|
||||
* - listen((error, nextState) => {})
|
||||
* - listenBeforeLeavingRoute(route, (nextLocation) => {})
|
||||
* - match(location, (error, redirectLocation, nextState) => {})
|
||||
* - isActive(pathname, query, indexOnly=false)
|
||||
*/
|
||||
function useRoutes(createHistory) {
|
||||
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, '`useRoutes` is deprecated. Please use `createTransitionManager` instead.') : void 0;
|
||||
|
||||
return function () {
|
||||
var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
||||
|
||||
var routes = _ref.routes;
|
||||
|
||||
var options = _objectWithoutProperties(_ref, ['routes']);
|
||||
|
||||
var history = (0, _useQueries2.default)(createHistory)(options);
|
||||
var transitionManager = (0, _createTransitionManager2.default)(history, routes);
|
||||
return _extends({}, history, transitionManager);
|
||||
};
|
||||
}
|
||||
|
||||
exports.default = useRoutes;
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/useRoutes.js
|
||||
// module id = 2789
|
||||
// module chunks = 4
|
71
509bba0_unpacked_with_node_modules/~/react-router/lib/withRouter.js
generated
vendored
Executable file
71
509bba0_unpacked_with_node_modules/~/react-router/lib/withRouter.js
generated
vendored
Executable file
|
@ -0,0 +1,71 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
exports.default = withRouter;
|
||||
|
||||
var _invariant = require('invariant');
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _hoistNonReactStatics = require('hoist-non-react-statics');
|
||||
|
||||
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
|
||||
|
||||
var _PropTypes = require('./PropTypes');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function getDisplayName(WrappedComponent) {
|
||||
return WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
||||
}
|
||||
|
||||
function withRouter(WrappedComponent, options) {
|
||||
var withRef = options && options.withRef;
|
||||
|
||||
var WithRouter = _react2.default.createClass({
|
||||
displayName: 'WithRouter',
|
||||
|
||||
contextTypes: { router: _PropTypes.routerShape },
|
||||
propTypes: { router: _PropTypes.routerShape },
|
||||
|
||||
getWrappedInstance: function getWrappedInstance() {
|
||||
!withRef ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'To access the wrapped instance, you need to specify ' + '`{ withRef: true }` as the second argument of the withRouter() call.') : (0, _invariant2.default)(false) : void 0;
|
||||
|
||||
return this.wrappedInstance;
|
||||
},
|
||||
render: function render() {
|
||||
var _this = this;
|
||||
|
||||
var router = this.props.router || this.context.router;
|
||||
var props = _extends({}, this.props, { router: router });
|
||||
|
||||
if (withRef) {
|
||||
props.ref = function (c) {
|
||||
_this.wrappedInstance = c;
|
||||
};
|
||||
}
|
||||
|
||||
return _react2.default.createElement(WrappedComponent, props);
|
||||
}
|
||||
});
|
||||
|
||||
WithRouter.displayName = 'withRouter(' + getDisplayName(WrappedComponent) + ')';
|
||||
WithRouter.WrappedComponent = WrappedComponent;
|
||||
|
||||
return (0, _hoistNonReactStatics2.default)(WithRouter, WrappedComponent);
|
||||
}
|
||||
module.exports = exports['default'];
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/react-router/lib/withRouter.js
|
||||
// module id = 2790
|
||||
// module chunks = 4
|
Loading…
Add table
Add a link
Reference in a new issue