UNPKG

25.3 kBJavaScriptView Raw
1'use strict';
2
3function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
5var React = _interopDefault(require('react'));
6var PropTypes = _interopDefault(require('prop-types'));
7var history = require('history');
8var warning = _interopDefault(require('tiny-warning'));
9var createContext = _interopDefault(require('mini-create-react-context'));
10var invariant = _interopDefault(require('tiny-invariant'));
11var pathToRegexp = _interopDefault(require('path-to-regexp'));
12var reactIs = require('react-is');
13var hoistStatics = _interopDefault(require('hoist-non-react-statics'));
14
15function _extends() {
16 _extends = Object.assign || function (target) {
17 for (var i = 1; i < arguments.length; i++) {
18 var source = arguments[i];
19
20 for (var key in source) {
21 if (Object.prototype.hasOwnProperty.call(source, key)) {
22 target[key] = source[key];
23 }
24 }
25 }
26
27 return target;
28 };
29
30 return _extends.apply(this, arguments);
31}
32
33function _inheritsLoose(subClass, superClass) {
34 subClass.prototype = Object.create(superClass.prototype);
35 subClass.prototype.constructor = subClass;
36
37 _setPrototypeOf(subClass, superClass);
38}
39
40function _setPrototypeOf(o, p) {
41 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
42 o.__proto__ = p;
43 return o;
44 };
45
46 return _setPrototypeOf(o, p);
47}
48
49function _objectWithoutPropertiesLoose(source, excluded) {
50 if (source == null) return {};
51 var target = {};
52 var sourceKeys = Object.keys(source);
53 var key, i;
54
55 for (i = 0; i < sourceKeys.length; i++) {
56 key = sourceKeys[i];
57 if (excluded.indexOf(key) >= 0) continue;
58 target[key] = source[key];
59 }
60
61 return target;
62}
63
64// TODO: Replace with React.createContext once we can assume React 16+
65
66var createNamedContext = function createNamedContext(name) {
67 var context = createContext();
68 context.displayName = name;
69 return context;
70};
71
72var historyContext = /*#__PURE__*/createNamedContext("Router-History");
73
74var context = /*#__PURE__*/createNamedContext("Router");
75
76/**
77 * The public API for putting history on context.
78 */
79
80var Router = /*#__PURE__*/function (_React$Component) {
81 _inheritsLoose(Router, _React$Component);
82
83 Router.computeRootMatch = function computeRootMatch(pathname) {
84 return {
85 path: "/",
86 url: "/",
87 params: {},
88 isExact: pathname === "/"
89 };
90 };
91
92 function Router(props) {
93 var _this;
94
95 _this = _React$Component.call(this, props) || this;
96 _this.state = {
97 location: props.history.location
98 }; // This is a bit of a hack. We have to start listening for location
99 // changes here in the constructor in case there are any <Redirect>s
100 // on the initial render. If there are, they will replace/push when
101 // they mount and since cDM fires in children before parents, we may
102 // get a new location before the <Router> is mounted.
103
104 _this._isMounted = false;
105 _this._pendingLocation = null;
106
107 if (!props.staticContext) {
108 _this.unlisten = props.history.listen(function (location) {
109 if (_this._isMounted) {
110 _this.setState({
111 location: location
112 });
113 } else {
114 _this._pendingLocation = location;
115 }
116 });
117 }
118
119 return _this;
120 }
121
122 var _proto = Router.prototype;
123
124 _proto.componentDidMount = function componentDidMount() {
125 this._isMounted = true;
126
127 if (this._pendingLocation) {
128 this.setState({
129 location: this._pendingLocation
130 });
131 }
132 };
133
134 _proto.componentWillUnmount = function componentWillUnmount() {
135 if (this.unlisten) {
136 this.unlisten();
137 this._isMounted = false;
138 this._pendingLocation = null;
139 }
140 };
141
142 _proto.render = function render() {
143 return /*#__PURE__*/React.createElement(context.Provider, {
144 value: {
145 history: this.props.history,
146 location: this.state.location,
147 match: Router.computeRootMatch(this.state.location.pathname),
148 staticContext: this.props.staticContext
149 }
150 }, /*#__PURE__*/React.createElement(historyContext.Provider, {
151 children: this.props.children || null,
152 value: this.props.history
153 }));
154 };
155
156 return Router;
157}(React.Component);
158
159{
160 Router.propTypes = {
161 children: PropTypes.node,
162 history: PropTypes.object.isRequired,
163 staticContext: PropTypes.object
164 };
165
166 Router.prototype.componentDidUpdate = function (prevProps) {
167 warning(prevProps.history === this.props.history, "You cannot change <Router history>") ;
168 };
169}
170
171/**
172 * The public API for a <Router> that stores location in memory.
173 */
174
175var MemoryRouter = /*#__PURE__*/function (_React$Component) {
176 _inheritsLoose(MemoryRouter, _React$Component);
177
178 function MemoryRouter() {
179 var _this;
180
181 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
182 args[_key] = arguments[_key];
183 }
184
185 _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
186 _this.history = history.createMemoryHistory(_this.props);
187 return _this;
188 }
189
190 var _proto = MemoryRouter.prototype;
191
192 _proto.render = function render() {
193 return /*#__PURE__*/React.createElement(Router, {
194 history: this.history,
195 children: this.props.children
196 });
197 };
198
199 return MemoryRouter;
200}(React.Component);
201
202{
203 MemoryRouter.propTypes = {
204 initialEntries: PropTypes.array,
205 initialIndex: PropTypes.number,
206 getUserConfirmation: PropTypes.func,
207 keyLength: PropTypes.number,
208 children: PropTypes.node
209 };
210
211 MemoryRouter.prototype.componentDidMount = function () {
212 warning(!this.props.history, "<MemoryRouter> ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { MemoryRouter as Router }`.") ;
213 };
214}
215
216var Lifecycle = /*#__PURE__*/function (_React$Component) {
217 _inheritsLoose(Lifecycle, _React$Component);
218
219 function Lifecycle() {
220 return _React$Component.apply(this, arguments) || this;
221 }
222
223 var _proto = Lifecycle.prototype;
224
225 _proto.componentDidMount = function componentDidMount() {
226 if (this.props.onMount) this.props.onMount.call(this, this);
227 };
228
229 _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
230 if (this.props.onUpdate) this.props.onUpdate.call(this, this, prevProps);
231 };
232
233 _proto.componentWillUnmount = function componentWillUnmount() {
234 if (this.props.onUnmount) this.props.onUnmount.call(this, this);
235 };
236
237 _proto.render = function render() {
238 return null;
239 };
240
241 return Lifecycle;
242}(React.Component);
243
244/**
245 * The public API for prompting the user before navigating away from a screen.
246 */
247
248function Prompt(_ref) {
249 var message = _ref.message,
250 _ref$when = _ref.when,
251 when = _ref$when === void 0 ? true : _ref$when;
252 return /*#__PURE__*/React.createElement(context.Consumer, null, function (context) {
253 !context ? invariant(false, "You should not use <Prompt> outside a <Router>") : void 0;
254 if (!when || context.staticContext) return null;
255 var method = context.history.block;
256 return /*#__PURE__*/React.createElement(Lifecycle, {
257 onMount: function onMount(self) {
258 self.release = method(message);
259 },
260 onUpdate: function onUpdate(self, prevProps) {
261 if (prevProps.message !== message) {
262 self.release();
263 self.release = method(message);
264 }
265 },
266 onUnmount: function onUnmount(self) {
267 self.release();
268 },
269 message: message
270 });
271 });
272}
273
274{
275 var messageType = PropTypes.oneOfType([PropTypes.func, PropTypes.string]);
276 Prompt.propTypes = {
277 when: PropTypes.bool,
278 message: messageType.isRequired
279 };
280}
281
282var cache = {};
283var cacheLimit = 10000;
284var cacheCount = 0;
285
286function compilePath(path) {
287 if (cache[path]) return cache[path];
288 var generator = pathToRegexp.compile(path);
289
290 if (cacheCount < cacheLimit) {
291 cache[path] = generator;
292 cacheCount++;
293 }
294
295 return generator;
296}
297/**
298 * Public API for generating a URL pathname from a path and parameters.
299 */
300
301
302function generatePath(path, params) {
303 if (path === void 0) {
304 path = "/";
305 }
306
307 if (params === void 0) {
308 params = {};
309 }
310
311 return path === "/" ? path : compilePath(path)(params, {
312 pretty: true
313 });
314}
315
316/**
317 * The public API for navigating programmatically with a component.
318 */
319
320function Redirect(_ref) {
321 var computedMatch = _ref.computedMatch,
322 to = _ref.to,
323 _ref$push = _ref.push,
324 push = _ref$push === void 0 ? false : _ref$push;
325 return /*#__PURE__*/React.createElement(context.Consumer, null, function (context) {
326 !context ? invariant(false, "You should not use <Redirect> outside a <Router>") : void 0;
327 var history$1 = context.history,
328 staticContext = context.staticContext;
329 var method = push ? history$1.push : history$1.replace;
330 var location = history.createLocation(computedMatch ? typeof to === "string" ? generatePath(to, computedMatch.params) : _extends({}, to, {
331 pathname: generatePath(to.pathname, computedMatch.params)
332 }) : to); // When rendering in a static context,
333 // set the new location immediately.
334
335 if (staticContext) {
336 method(location);
337 return null;
338 }
339
340 return /*#__PURE__*/React.createElement(Lifecycle, {
341 onMount: function onMount() {
342 method(location);
343 },
344 onUpdate: function onUpdate(self, prevProps) {
345 var prevLocation = history.createLocation(prevProps.to);
346
347 if (!history.locationsAreEqual(prevLocation, _extends({}, location, {
348 key: prevLocation.key
349 }))) {
350 method(location);
351 }
352 },
353 to: to
354 });
355 });
356}
357
358{
359 Redirect.propTypes = {
360 push: PropTypes.bool,
361 from: PropTypes.string,
362 to: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired
363 };
364}
365
366var cache$1 = {};
367var cacheLimit$1 = 10000;
368var cacheCount$1 = 0;
369
370function compilePath$1(path, options) {
371 var cacheKey = "" + options.end + options.strict + options.sensitive;
372 var pathCache = cache$1[cacheKey] || (cache$1[cacheKey] = {});
373 if (pathCache[path]) return pathCache[path];
374 var keys = [];
375 var regexp = pathToRegexp(path, keys, options);
376 var result = {
377 regexp: regexp,
378 keys: keys
379 };
380
381 if (cacheCount$1 < cacheLimit$1) {
382 pathCache[path] = result;
383 cacheCount$1++;
384 }
385
386 return result;
387}
388/**
389 * Public API for matching a URL pathname to a path.
390 */
391
392
393function matchPath(pathname, options) {
394 if (options === void 0) {
395 options = {};
396 }
397
398 if (typeof options === "string" || Array.isArray(options)) {
399 options = {
400 path: options
401 };
402 }
403
404 var _options = options,
405 path = _options.path,
406 _options$exact = _options.exact,
407 exact = _options$exact === void 0 ? false : _options$exact,
408 _options$strict = _options.strict,
409 strict = _options$strict === void 0 ? false : _options$strict,
410 _options$sensitive = _options.sensitive,
411 sensitive = _options$sensitive === void 0 ? false : _options$sensitive;
412 var paths = [].concat(path);
413 return paths.reduce(function (matched, path) {
414 if (!path && path !== "") return null;
415 if (matched) return matched;
416
417 var _compilePath = compilePath$1(path, {
418 end: exact,
419 strict: strict,
420 sensitive: sensitive
421 }),
422 regexp = _compilePath.regexp,
423 keys = _compilePath.keys;
424
425 var match = regexp.exec(pathname);
426 if (!match) return null;
427 var url = match[0],
428 values = match.slice(1);
429 var isExact = pathname === url;
430 if (exact && !isExact) return null;
431 return {
432 path: path,
433 // the path used to match
434 url: path === "/" && url === "" ? "/" : url,
435 // the matched portion of the URL
436 isExact: isExact,
437 // whether or not we matched exactly
438 params: keys.reduce(function (memo, key, index) {
439 memo[key.name] = values[index];
440 return memo;
441 }, {})
442 };
443 }, null);
444}
445
446function isEmptyChildren(children) {
447 return React.Children.count(children) === 0;
448}
449
450function evalChildrenDev(children, props, path) {
451 var value = children(props);
452 warning(value !== undefined, "You returned `undefined` from the `children` function of " + ("<Route" + (path ? " path=\"" + path + "\"" : "") + ">, but you ") + "should have returned a React element or `null`") ;
453 return value || null;
454}
455/**
456 * The public API for matching a single path and rendering.
457 */
458
459
460var Route = /*#__PURE__*/function (_React$Component) {
461 _inheritsLoose(Route, _React$Component);
462
463 function Route() {
464 return _React$Component.apply(this, arguments) || this;
465 }
466
467 var _proto = Route.prototype;
468
469 _proto.render = function render() {
470 var _this = this;
471
472 return /*#__PURE__*/React.createElement(context.Consumer, null, function (context$1) {
473 !context$1 ? invariant(false, "You should not use <Route> outside a <Router>") : void 0;
474 var location = _this.props.location || context$1.location;
475 var match = _this.props.computedMatch ? _this.props.computedMatch // <Switch> already computed the match for us
476 : _this.props.path ? matchPath(location.pathname, _this.props) : context$1.match;
477
478 var props = _extends({}, context$1, {
479 location: location,
480 match: match
481 });
482
483 var _this$props = _this.props,
484 children = _this$props.children,
485 component = _this$props.component,
486 render = _this$props.render; // Preact uses an empty array as children by
487 // default, so use null if that's the case.
488
489 if (Array.isArray(children) && isEmptyChildren(children)) {
490 children = null;
491 }
492
493 return /*#__PURE__*/React.createElement(context.Provider, {
494 value: props
495 }, props.match ? children ? typeof children === "function" ? evalChildrenDev(children, props, _this.props.path) : children : component ? /*#__PURE__*/React.createElement(component, props) : render ? render(props) : null : typeof children === "function" ? evalChildrenDev(children, props, _this.props.path) : null);
496 });
497 };
498
499 return Route;
500}(React.Component);
501
502{
503 Route.propTypes = {
504 children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
505 component: function component(props, propName) {
506 if (props[propName] && !reactIs.isValidElementType(props[propName])) {
507 return new Error("Invalid prop 'component' supplied to 'Route': the prop is not a valid React component");
508 }
509 },
510 exact: PropTypes.bool,
511 location: PropTypes.object,
512 path: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
513 render: PropTypes.func,
514 sensitive: PropTypes.bool,
515 strict: PropTypes.bool
516 };
517
518 Route.prototype.componentDidMount = function () {
519 warning(!(this.props.children && !isEmptyChildren(this.props.children) && this.props.component), "You should not use <Route component> and <Route children> in the same route; <Route component> will be ignored") ;
520 warning(!(this.props.children && !isEmptyChildren(this.props.children) && this.props.render), "You should not use <Route render> and <Route children> in the same route; <Route render> will be ignored") ;
521 warning(!(this.props.component && this.props.render), "You should not use <Route component> and <Route render> in the same route; <Route render> will be ignored") ;
522 };
523
524 Route.prototype.componentDidUpdate = function (prevProps) {
525 warning(!(this.props.location && !prevProps.location), '<Route> elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.') ;
526 warning(!(!this.props.location && prevProps.location), '<Route> elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.') ;
527 };
528}
529
530function addLeadingSlash(path) {
531 return path.charAt(0) === "/" ? path : "/" + path;
532}
533
534function addBasename(basename, location) {
535 if (!basename) return location;
536 return _extends({}, location, {
537 pathname: addLeadingSlash(basename) + location.pathname
538 });
539}
540
541function stripBasename(basename, location) {
542 if (!basename) return location;
543 var base = addLeadingSlash(basename);
544 if (location.pathname.indexOf(base) !== 0) return location;
545 return _extends({}, location, {
546 pathname: location.pathname.substr(base.length)
547 });
548}
549
550function createURL(location) {
551 return typeof location === "string" ? location : history.createPath(location);
552}
553
554function staticHandler(methodName) {
555 return function () {
556 invariant(false, "You cannot %s with <StaticRouter>", methodName) ;
557 };
558}
559
560function noop() {}
561/**
562 * The public top-level API for a "static" <Router>, so-called because it
563 * can't actually change the current location. Instead, it just records
564 * location changes in a context object. Useful mainly in testing and
565 * server-rendering scenarios.
566 */
567
568
569var StaticRouter = /*#__PURE__*/function (_React$Component) {
570 _inheritsLoose(StaticRouter, _React$Component);
571
572 function StaticRouter() {
573 var _this;
574
575 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
576 args[_key] = arguments[_key];
577 }
578
579 _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
580
581 _this.handlePush = function (location) {
582 return _this.navigateTo(location, "PUSH");
583 };
584
585 _this.handleReplace = function (location) {
586 return _this.navigateTo(location, "REPLACE");
587 };
588
589 _this.handleListen = function () {
590 return noop;
591 };
592
593 _this.handleBlock = function () {
594 return noop;
595 };
596
597 return _this;
598 }
599
600 var _proto = StaticRouter.prototype;
601
602 _proto.navigateTo = function navigateTo(location, action) {
603 var _this$props = this.props,
604 _this$props$basename = _this$props.basename,
605 basename = _this$props$basename === void 0 ? "" : _this$props$basename,
606 _this$props$context = _this$props.context,
607 context = _this$props$context === void 0 ? {} : _this$props$context;
608 context.action = action;
609 context.location = addBasename(basename, history.createLocation(location));
610 context.url = createURL(context.location);
611 };
612
613 _proto.render = function render() {
614 var _this$props2 = this.props,
615 _this$props2$basename = _this$props2.basename,
616 basename = _this$props2$basename === void 0 ? "" : _this$props2$basename,
617 _this$props2$context = _this$props2.context,
618 context = _this$props2$context === void 0 ? {} : _this$props2$context,
619 _this$props2$location = _this$props2.location,
620 location = _this$props2$location === void 0 ? "/" : _this$props2$location,
621 rest = _objectWithoutPropertiesLoose(_this$props2, ["basename", "context", "location"]);
622
623 var history$1 = {
624 createHref: function createHref(path) {
625 return addLeadingSlash(basename + createURL(path));
626 },
627 action: "POP",
628 location: stripBasename(basename, history.createLocation(location)),
629 push: this.handlePush,
630 replace: this.handleReplace,
631 go: staticHandler("go"),
632 goBack: staticHandler("goBack"),
633 goForward: staticHandler("goForward"),
634 listen: this.handleListen,
635 block: this.handleBlock
636 };
637 return /*#__PURE__*/React.createElement(Router, _extends({}, rest, {
638 history: history$1,
639 staticContext: context
640 }));
641 };
642
643 return StaticRouter;
644}(React.Component);
645
646{
647 StaticRouter.propTypes = {
648 basename: PropTypes.string,
649 context: PropTypes.object,
650 location: PropTypes.oneOfType([PropTypes.string, PropTypes.object])
651 };
652
653 StaticRouter.prototype.componentDidMount = function () {
654 warning(!this.props.history, "<StaticRouter> ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { StaticRouter as Router }`.") ;
655 };
656}
657
658/**
659 * The public API for rendering the first <Route> that matches.
660 */
661
662var Switch = /*#__PURE__*/function (_React$Component) {
663 _inheritsLoose(Switch, _React$Component);
664
665 function Switch() {
666 return _React$Component.apply(this, arguments) || this;
667 }
668
669 var _proto = Switch.prototype;
670
671 _proto.render = function render() {
672 var _this = this;
673
674 return /*#__PURE__*/React.createElement(context.Consumer, null, function (context) {
675 !context ? invariant(false, "You should not use <Switch> outside a <Router>") : void 0;
676 var location = _this.props.location || context.location;
677 var element, match; // We use React.Children.forEach instead of React.Children.toArray().find()
678 // here because toArray adds keys to all child elements and we do not want
679 // to trigger an unmount/remount for two <Route>s that render the same
680 // component at different URLs.
681
682 React.Children.forEach(_this.props.children, function (child) {
683 if (match == null && /*#__PURE__*/React.isValidElement(child)) {
684 element = child;
685 var path = child.props.path || child.props.from;
686 match = path ? matchPath(location.pathname, _extends({}, child.props, {
687 path: path
688 })) : context.match;
689 }
690 });
691 return match ? /*#__PURE__*/React.cloneElement(element, {
692 location: location,
693 computedMatch: match
694 }) : null;
695 });
696 };
697
698 return Switch;
699}(React.Component);
700
701{
702 Switch.propTypes = {
703 children: PropTypes.node,
704 location: PropTypes.object
705 };
706
707 Switch.prototype.componentDidUpdate = function (prevProps) {
708 warning(!(this.props.location && !prevProps.location), '<Switch> elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.') ;
709 warning(!(!this.props.location && prevProps.location), '<Switch> elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.') ;
710 };
711}
712
713/**
714 * A public higher-order component to access the imperative API
715 */
716
717function withRouter(Component) {
718 var displayName = "withRouter(" + (Component.displayName || Component.name) + ")";
719
720 var C = function C(props) {
721 var wrappedComponentRef = props.wrappedComponentRef,
722 remainingProps = _objectWithoutPropertiesLoose(props, ["wrappedComponentRef"]);
723
724 return /*#__PURE__*/React.createElement(context.Consumer, null, function (context) {
725 !context ? invariant(false, "You should not use <" + displayName + " /> outside a <Router>") : void 0;
726 return /*#__PURE__*/React.createElement(Component, _extends({}, remainingProps, context, {
727 ref: wrappedComponentRef
728 }));
729 });
730 };
731
732 C.displayName = displayName;
733 C.WrappedComponent = Component;
734
735 {
736 C.propTypes = {
737 wrappedComponentRef: PropTypes.oneOfType([PropTypes.string, PropTypes.func, PropTypes.object])
738 };
739 }
740
741 return hoistStatics(C, Component);
742}
743
744var useContext = React.useContext;
745function useHistory() {
746 {
747 !(typeof useContext === "function") ? invariant(false, "You must use React >= 16.8 in order to use useHistory()") : void 0;
748 }
749
750 return useContext(historyContext);
751}
752function useLocation() {
753 {
754 !(typeof useContext === "function") ? invariant(false, "You must use React >= 16.8 in order to use useLocation()") : void 0;
755 }
756
757 return useContext(context).location;
758}
759function useParams() {
760 {
761 !(typeof useContext === "function") ? invariant(false, "You must use React >= 16.8 in order to use useParams()") : void 0;
762 }
763
764 var match = useContext(context).match;
765 return match ? match.params : {};
766}
767function useRouteMatch(path) {
768 {
769 !(typeof useContext === "function") ? invariant(false, "You must use React >= 16.8 in order to use useRouteMatch()") : void 0;
770 }
771
772 var location = useLocation();
773 var match = useContext(context).match;
774 return path ? matchPath(location.pathname, path) : match;
775}
776
777{
778 if (typeof window !== "undefined") {
779 var global = window;
780 var key = "__react_router_build__";
781 var buildNames = {
782 cjs: "CommonJS",
783 esm: "ES modules",
784 umd: "UMD"
785 };
786
787 if (global[key] && global[key] !== "cjs") {
788 var initialBuildName = buildNames[global[key]];
789 var secondaryBuildName = buildNames["cjs"]; // TODO: Add link to article that explains in detail how to avoid
790 // loading 2 different builds.
791
792 throw new Error("You are loading the " + secondaryBuildName + " build of React Router " + ("on a page that is already running the " + initialBuildName + " ") + "build, so things won't work right.");
793 }
794
795 global[key] = "cjs";
796 }
797}
798
799exports.MemoryRouter = MemoryRouter;
800exports.Prompt = Prompt;
801exports.Redirect = Redirect;
802exports.Route = Route;
803exports.Router = Router;
804exports.StaticRouter = StaticRouter;
805exports.Switch = Switch;
806exports.__HistoryContext = historyContext;
807exports.__RouterContext = context;
808exports.generatePath = generatePath;
809exports.matchPath = matchPath;
810exports.useHistory = useHistory;
811exports.useLocation = useLocation;
812exports.useParams = useParams;
813exports.useRouteMatch = useRouteMatch;
814exports.withRouter = withRouter;
815//# sourceMappingURL=react-router.js.map