This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

21
node_modules/react-router-config/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) React Training 2016-2018
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

271
node_modules/react-router-config/README.md generated vendored Normal file
View File

@@ -0,0 +1,271 @@
# React Router Config
Static route configuration helpers for React Router.
This is alpha software, it needs:
1. Realistic server rendering example with data preloading
2. Pending navigation example
## Installation
Using [npm](https://www.npmjs.com/):
$ npm install --save react-router-config
Then with a module bundler like [webpack](https://webpack.github.io/), use as you would anything else:
```js
// using an ES6 transpiler, like babel
import { matchRoutes, renderRoutes } from "react-router-config";
// not using an ES6 transpiler
var matchRoutes = require("react-router-config").matchRoutes;
```
The UMD build is also available on [unpkg](https://unpkg.com):
```html
<script src="https://unpkg.com/react-router-config/umd/react-router-config.min.js"></script>
```
You can find the library on `window.ReactRouterConfig`
## Motivation
With the introduction of React Router v4, there is no longer a centralized route configuration. There are some use-cases where it is valuable to know about all the app's potential routes such as:
- Loading data on the server or in the lifecycle before rendering the next screen
- Linking to routes by name
- Static analysis
This project seeks to define a shared format for others to build patterns on top of.
## Route Configuration Shape
Routes are objects with the same properties as a `<Route>` with a couple differences:
- the only render prop it accepts is `component` (no `render` or `children`)
- introduces the `routes` key for sub routes
- Consumers are free to add any additional props they'd like to a route, you can access `props.route` inside the `component`, this object is a reference to the object used to render and match.
- accepts `key` prop to prevent remounting component when transition was made from route with the same component and same `key` prop
```js
const routes = [
{
component: Root,
routes: [
{
path: "/",
exact: true,
component: Home
},
{
path: "/child/:id",
component: Child,
routes: [
{
path: "/child/:id/grand-child",
component: GrandChild
}
]
}
]
}
];
```
**Note**: Just like `<Route>`, relative paths are not (yet) supported. When it is supported there, it will be supported here.
## API
### `matchRoutes(routes, pathname)`
Returns an array of matched routes.
#### Parameters
- routes - the route configuration
- pathname - the [pathname](https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/pathname) component of the url. This must be a decoded string representing the path.
```js
import { matchRoutes } from "react-router-config";
const branch = matchRoutes(routes, "/child/23");
// using the routes shown earlier, this returns
// [
// routes[0],
// routes[0].routes[1]
// ]
```
Each item in the array contains two properties: `routes` and `match`.
- `routes`: A reference to the routes array used to match
- `match`: The match object that also gets passed to `<Route>` render methods.
```js
branch[0].match.url;
branch[0].match.isExact;
// etc.
```
You can use this branch of routes to figure out what is going to be rendered before it actually is rendered. You could do something like this on the server before rendering, or in a lifecycle hook of a component that wraps your entire app
```js
const loadBranchData = (location) => {
const branch = matchRoutes(routes, location.pathname)
const promises = branch.map(({ route, match }) => {
return route.loadData
? route.loadData(match)
: Promise.resolve(null)
})
return Promise.all(promises)
}
// useful on the server for preloading data
loadBranchData(req.url).then(data => {
putTheDataSomewhereTheClientCanFindIt(data)
})
// also useful on the client for "pending navigation" where you
// load up all the data before rendering the next page when
// the url changes
// THIS IS JUST SOME THEORETICAL PSEUDO CODE :)
class PendingNavDataLoader extends Component {
state = {
previousLocation: null,
currentLocation: this.props.location
}
static getDerivedStateFromProps(props, state) {
const currentLocation = props.location
const previousLocation = state.currentLocation
const navigated = currentLocation !== previousLocation
if (navigated) {
// save the location so we can render the old screen
return {
previousLocation,
currentLocation
}
}
return null
}
componentDidUpdate(prevProps) {
const navigated = prevProps.location !== this.props.location
if (navigated) {
// load data while the old screen remains
loadNextData(routes, this.props.location).then(data => {
putTheDataSomewhereRoutesCanFindIt(data)
// clear previousLocation so the next screen renders
this.setState({
previousLocation: null
})
})
}
}
render() {
const { children, location } = this.props
const { previousLocation } = this.state
// use a controlled <Route> to trick all descendants into
// rendering the old location
return (
<Route
location={previousLocation || location}
render={() => children}
/>
)
}
}
// wrap in withRouter
export default withRouter(PendingNavDataLoader)
/////////////
// somewhere at the top of your app
import routes from './routes'
<BrowserRouter>
<PendingNavDataLoader routes={routes}>
{renderRoutes(routes)}
</PendingNavDataLoader>
</BrowserRouter>
```
Again, that's all pseudo-code. There are a lot of ways to do server rendering with data and pending navigation and we haven't settled on one. The point here is that `matchRoutes` gives you a chance to match statically outside of the render lifecycle. We'd like to make a demo app of this approach eventually.
### `renderRoutes(routes, extraProps = {}, switchProps = {})`
In order to ensure that matching outside of render with `matchRoutes` and inside of render result in the same branch, you must use `renderRoutes` instead of `<Route>` inside your components. You can render a `<Route>` still, but know that it will not be accounted for in `matchRoutes` outside of render.
```js
import { renderRoutes } from "react-router-config";
const routes = [
{
component: Root,
routes: [
{
path: "/",
exact: true,
component: Home
},
{
path: "/child/:id",
component: Child,
routes: [
{
path: "/child/:id/grand-child",
component: GrandChild
}
]
}
]
}
];
const Root = ({ route }) => (
<div>
<h1>Root</h1>
{/* child routes won't render without this */}
{renderRoutes(route.routes)}
</div>
);
const Home = ({ route }) => (
<div>
<h2>Home</h2>
</div>
);
const Child = ({ route }) => (
<div>
<h2>Child</h2>
{/* child routes won't render without this */}
{renderRoutes(route.routes, { someProp: "these extra props are optional" })}
</div>
);
const GrandChild = ({ someProp }) => (
<div>
<h3>Grand Child</h3>
<div>{someProp}</div>
</div>
);
ReactDOM.render(
<BrowserRouter>
{/* kick it all off with the root route */}
{renderRoutes(routes)}
</BrowserRouter>,
document.getElementById("root")
);
```

View File

@@ -0,0 +1,81 @@
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var reactRouter = require('react-router');
var React = _interopDefault(require('react'));
function matchRoutes(routes, pathname,
/*not public API*/
branch) {
if (branch === void 0) {
branch = [];
}
routes.some(function (route) {
var match = route.path ? reactRouter.matchPath(pathname, route) : branch.length ? branch[branch.length - 1].match // use parent match
: reactRouter.Router.computeRootMatch(pathname); // use default "root" match
if (match) {
branch.push({
route: route,
match: match
});
if (route.routes) {
matchRoutes(route.routes, pathname, branch);
}
}
return match;
});
return branch;
}
function _extends() {
_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;
};
return _extends.apply(this, arguments);
}
function renderRoutes(routes, extraProps, switchProps) {
if (extraProps === void 0) {
extraProps = {};
}
if (switchProps === void 0) {
switchProps = {};
}
return routes ? React.createElement(reactRouter.Switch, switchProps, routes.map(function (route, i) {
return React.createElement(reactRouter.Route, {
key: route.key || i,
path: route.path,
exact: route.exact,
strict: route.strict,
render: function render(props) {
return route.render ? route.render(_extends({}, props, {}, extraProps, {
route: route
})) : React.createElement(route.component, _extends({}, props, extraProps, {
route: route
}));
}
});
})) : null;
}
exports.matchRoutes = matchRoutes;
exports.renderRoutes = renderRoutes;
//# sourceMappingURL=react-router-config.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"react-router-config.js","sources":["../modules/matchRoutes.js","../modules/renderRoutes.js"],"sourcesContent":["import { matchPath, Router } from \"react-router\";\n\nfunction matchRoutes(routes, pathname, /*not public API*/ branch = []) {\n routes.some(route => {\n const match = route.path\n ? matchPath(pathname, route)\n : branch.length\n ? branch[branch.length - 1].match // use parent match\n : Router.computeRootMatch(pathname); // use default \"root\" match\n\n if (match) {\n branch.push({ route, match });\n\n if (route.routes) {\n matchRoutes(route.routes, pathname, branch);\n }\n }\n\n return match;\n });\n\n return branch;\n}\n\nexport default matchRoutes;\n","import React from \"react\";\nimport { Switch, Route } from \"react-router\";\n\nfunction renderRoutes(routes, extraProps = {}, switchProps = {}) {\n return routes ? (\n <Switch {...switchProps}>\n {routes.map((route, i) => (\n <Route\n key={route.key || i}\n path={route.path}\n exact={route.exact}\n strict={route.strict}\n render={props =>\n route.render ? (\n route.render({ ...props, ...extraProps, route: route })\n ) : (\n <route.component {...props} {...extraProps} route={route} />\n )\n }\n />\n ))}\n </Switch>\n ) : null;\n}\n\nexport default renderRoutes;\n"],"names":["matchRoutes","routes","pathname","branch","some","route","match","path","matchPath","length","Router","computeRootMatch","push","renderRoutes","extraProps","switchProps","Switch","map","i","Route","key","exact","strict","props","render"],"mappings":";;;;;;;AAEA,SAASA,WAAT,CAAqBC,MAArB,EAA6BC,QAA7B;;AAA0DC,MAA1D,EAAuE;MAAbA,MAAa;IAAbA,MAAa,GAAJ,EAAI;;;EACrEF,MAAM,CAACG,IAAP,CAAY,UAAAC,KAAK,EAAI;QACbC,KAAK,GAAGD,KAAK,CAACE,IAAN,GACVC,qBAAS,CAACN,QAAD,EAAWG,KAAX,CADC,GAEVF,MAAM,CAACM,MAAP,GACEN,MAAM,CAACA,MAAM,CAACM,MAAP,GAAgB,CAAjB,CAAN,CAA0BH,KAD5B;MAEEI,kBAAM,CAACC,gBAAP,CAAwBT,QAAxB,CAJN,CADmB;;QAOfI,KAAJ,EAAW;MACTH,MAAM,CAACS,IAAP,CAAY;QAAEP,KAAK,EAALA,KAAF;QAASC,KAAK,EAALA;OAArB;;UAEID,KAAK,CAACJ,MAAV,EAAkB;QAChBD,WAAW,CAACK,KAAK,CAACJ,MAAP,EAAeC,QAAf,EAAyBC,MAAzB,CAAX;;;;WAIGG,KAAP;GAfF;SAkBOH,MAAP;;;;;;;;;;;;;;;;;;;;;AClBF,SAASU,YAAT,CAAsBZ,MAAtB,EAA8Ba,UAA9B,EAA+CC,WAA/C,EAAiE;MAAnCD,UAAmC;IAAnCA,UAAmC,GAAtB,EAAsB;;;MAAlBC,WAAkB;IAAlBA,WAAkB,GAAJ,EAAI;;;SACxDd,MAAM,GACX,oBAACe,kBAAD,EAAYD,WAAZ,EACGd,MAAM,CAACgB,GAAP,CAAW,UAACZ,KAAD,EAAQa,CAAR;WACV,oBAACC,iBAAD;MACE,GAAG,EAAEd,KAAK,CAACe,GAAN,IAAaF,CADpB;MAEE,IAAI,EAAEb,KAAK,CAACE,IAFd;MAGE,KAAK,EAAEF,KAAK,CAACgB,KAHf;MAIE,MAAM,EAAEhB,KAAK,CAACiB,MAJhB;MAKE,MAAM,EAAE,gBAAAC,KAAK;eACXlB,KAAK,CAACmB,MAAN,GACEnB,KAAK,CAACmB,MAAN,cAAkBD,KAAlB,MAA4BT,UAA5B;UAAwCT,KAAK,EAAEA;WADjD,GAGE,oBAAC,KAAD,CAAO,SAAP,eAAqBkB,KAArB,EAAgCT,UAAhC;UAA4C,KAAK,EAAET;WAJ1C;;MANL;GAAX,CADH,CADW,GAkBT,IAlBJ;;;;;;"}

View File

@@ -0,0 +1,2 @@
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var reactRouter=require("react-router"),React=_interopDefault(require("react"));function matchRoutes(e,r,o){return void 0===o&&(o=[]),e.some(function(e){var t=e.path?reactRouter.matchPath(r,e):o.length?o[o.length-1].match:reactRouter.Router.computeRootMatch(r);return t&&(o.push({route:e,match:t}),e.routes&&matchRoutes(e.routes,r,o)),t}),o}function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}function renderRoutes(e,r,t){return void 0===r&&(r={}),void 0===t&&(t={}),e?React.createElement(reactRouter.Switch,t,e.map(function(t,e){return React.createElement(reactRouter.Route,{key:t.key||e,path:t.path,exact:t.exact,strict:t.strict,render:function(e){return t.render?t.render(_extends({},e,{},r,{route:t})):React.createElement(t.component,_extends({},e,r,{route:t}))}})})):null}exports.matchRoutes=matchRoutes,exports.renderRoutes=renderRoutes;
//# sourceMappingURL=react-router-config.min.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"react-router-config.min.js","sources":["../modules/matchRoutes.js","../modules/renderRoutes.js"],"sourcesContent":["import { matchPath, Router } from \"react-router\";\n\nfunction matchRoutes(routes, pathname, /*not public API*/ branch = []) {\n routes.some(route => {\n const match = route.path\n ? matchPath(pathname, route)\n : branch.length\n ? branch[branch.length - 1].match // use parent match\n : Router.computeRootMatch(pathname); // use default \"root\" match\n\n if (match) {\n branch.push({ route, match });\n\n if (route.routes) {\n matchRoutes(route.routes, pathname, branch);\n }\n }\n\n return match;\n });\n\n return branch;\n}\n\nexport default matchRoutes;\n","import React from \"react\";\nimport { Switch, Route } from \"react-router\";\n\nfunction renderRoutes(routes, extraProps = {}, switchProps = {}) {\n return routes ? (\n <Switch {...switchProps}>\n {routes.map((route, i) => (\n <Route\n key={route.key || i}\n path={route.path}\n exact={route.exact}\n strict={route.strict}\n render={props =>\n route.render ? (\n route.render({ ...props, ...extraProps, route: route })\n ) : (\n <route.component {...props} {...extraProps} route={route} />\n )\n }\n />\n ))}\n </Switch>\n ) : null;\n}\n\nexport default renderRoutes;\n"],"names":["matchRoutes","routes","pathname","branch","some","route","match","path","matchPath","length","Router","computeRootMatch","push","renderRoutes","extraProps","switchProps","React","Switch","map","i","Route","key","exact","strict","render","props","component"],"mappings":"wOAEA,SAASA,YAAYC,EAAQC,EAA6BC,mBAAAA,IAAAA,EAAS,IACjEF,EAAOG,KAAK,SAAAC,OACJC,EAAQD,EAAME,KAChBC,sBAAUN,EAAUG,GACpBF,EAAOM,OACLN,EAAOA,EAAOM,OAAS,GAAGH,MAC1BI,mBAAOC,iBAAiBT,UAE1BI,IACFH,EAAOS,KAAK,CAAEP,MAAAA,EAAOC,MAAAA,IAEjBD,EAAMJ,QACRD,YAAYK,EAAMJ,OAAQC,EAAUC,IAIjCG,IAGFH,+NClBT,SAASU,aAAaZ,EAAQa,EAAiBC,mBAAjBD,IAAAA,EAAa,aAAIC,IAAAA,EAAc,IACpDd,EACLe,oBAACC,mBAAWF,EACTd,EAAOiB,IAAI,SAACb,EAAOc,UAClBH,oBAACI,mBACCC,IAAKhB,EAAMgB,KAAOF,EAClBZ,KAAMF,EAAME,KACZe,MAAOjB,EAAMiB,MACbC,OAAQlB,EAAMkB,OACdC,OAAQ,SAAAC,UACNpB,EAAMmB,OACJnB,EAAMmB,mBAAYC,KAAUX,GAAYT,MAAOA,KAE/CW,oBAACX,EAAMqB,sBAAcD,EAAWX,GAAYT,MAAOA,WAM3D"}

7
node_modules/react-router-config/es/matchRoutes.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
import warnAboutDeprecatedESMImport from "./warnAboutDeprecatedESMImport.js";
warnAboutDeprecatedESMImport("matchRoutes");
import { matchRoutes } from "../esm/react-router-config.js";
export default matchRoutes;

7
node_modules/react-router-config/es/renderRoutes.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
import warnAboutDeprecatedESMImport from "./warnAboutDeprecatedESMImport.js";
warnAboutDeprecatedESMImport("renderRoutes");
import { renderRoutes } from "../esm/react-router-config.js";
export default renderRoutes;

View File

@@ -0,0 +1,35 @@
"use strict";
var printWarning = function() {};
if (process.env.NODE_ENV !== "production") {
printWarning = function(format, subs) {
var index = 0;
var message =
"Warning: " +
(subs.length > 0
? format.replace(/%s/g, function() {
return subs[index++];
})
: format);
if (typeof console !== "undefined") {
console.error(message);
}
try {
// --- Welcome to debugging React Router ---
// This error was thrown as a convenience so that you can use the
// stack trace to find the callsite that triggered this warning.
throw new Error(message);
} catch (e) {}
};
}
export default function(member) {
printWarning(
'Please use `import { %s } from "react-router-config"` instead of `import %s from "react-router-config/%s"`. ' +
"Support for the latter will be removed in the next major release.",
[member, member]
);
}

View File

@@ -0,0 +1,59 @@
import { matchPath, Router, Switch, Route } from 'react-router';
import _extends from '@babel/runtime/helpers/esm/extends';
import React from 'react';
function matchRoutes(routes, pathname,
/*not public API*/
branch) {
if (branch === void 0) {
branch = [];
}
routes.some(function (route) {
var match = route.path ? matchPath(pathname, route) : branch.length ? branch[branch.length - 1].match // use parent match
: Router.computeRootMatch(pathname); // use default "root" match
if (match) {
branch.push({
route: route,
match: match
});
if (route.routes) {
matchRoutes(route.routes, pathname, branch);
}
}
return match;
});
return branch;
}
function renderRoutes(routes, extraProps, switchProps) {
if (extraProps === void 0) {
extraProps = {};
}
if (switchProps === void 0) {
switchProps = {};
}
return routes ? React.createElement(Switch, switchProps, routes.map(function (route, i) {
return React.createElement(Route, {
key: route.key || i,
path: route.path,
exact: route.exact,
strict: route.strict,
render: function render(props) {
return route.render ? route.render(_extends({}, props, {}, extraProps, {
route: route
})) : React.createElement(route.component, _extends({}, props, extraProps, {
route: route
}));
}
});
})) : null;
}
export { matchRoutes, renderRoutes };
//# sourceMappingURL=react-router-config.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"react-router-config.js","sources":["../modules/matchRoutes.js","../modules/renderRoutes.js"],"sourcesContent":["import { matchPath, Router } from \"react-router\";\n\nfunction matchRoutes(routes, pathname, /*not public API*/ branch = []) {\n routes.some(route => {\n const match = route.path\n ? matchPath(pathname, route)\n : branch.length\n ? branch[branch.length - 1].match // use parent match\n : Router.computeRootMatch(pathname); // use default \"root\" match\n\n if (match) {\n branch.push({ route, match });\n\n if (route.routes) {\n matchRoutes(route.routes, pathname, branch);\n }\n }\n\n return match;\n });\n\n return branch;\n}\n\nexport default matchRoutes;\n","import React from \"react\";\nimport { Switch, Route } from \"react-router\";\n\nfunction renderRoutes(routes, extraProps = {}, switchProps = {}) {\n return routes ? (\n <Switch {...switchProps}>\n {routes.map((route, i) => (\n <Route\n key={route.key || i}\n path={route.path}\n exact={route.exact}\n strict={route.strict}\n render={props =>\n route.render ? (\n route.render({ ...props, ...extraProps, route: route })\n ) : (\n <route.component {...props} {...extraProps} route={route} />\n )\n }\n />\n ))}\n </Switch>\n ) : null;\n}\n\nexport default renderRoutes;\n"],"names":["matchRoutes","routes","pathname","branch","some","route","match","path","matchPath","length","Router","computeRootMatch","push","renderRoutes","extraProps","switchProps","map","i","key","exact","strict","props","render"],"mappings":";;;;AAEA,SAASA,WAAT,CAAqBC,MAArB,EAA6BC,QAA7B;;AAA0DC,MAA1D,EAAuE;MAAbA,MAAa;IAAbA,MAAa,GAAJ,EAAI;;;EACrEF,MAAM,CAACG,IAAP,CAAY,UAAAC,KAAK,EAAI;QACbC,KAAK,GAAGD,KAAK,CAACE,IAAN,GACVC,SAAS,CAACN,QAAD,EAAWG,KAAX,CADC,GAEVF,MAAM,CAACM,MAAP,GACEN,MAAM,CAACA,MAAM,CAACM,MAAP,GAAgB,CAAjB,CAAN,CAA0BH,KAD5B;MAEEI,MAAM,CAACC,gBAAP,CAAwBT,QAAxB,CAJN,CADmB;;QAOfI,KAAJ,EAAW;MACTH,MAAM,CAACS,IAAP,CAAY;QAAEP,KAAK,EAALA,KAAF;QAASC,KAAK,EAALA;OAArB;;UAEID,KAAK,CAACJ,MAAV,EAAkB;QAChBD,WAAW,CAACK,KAAK,CAACJ,MAAP,EAAeC,QAAf,EAAyBC,MAAzB,CAAX;;;;WAIGG,KAAP;GAfF;SAkBOH,MAAP;;;AClBF,SAASU,YAAT,CAAsBZ,MAAtB,EAA8Ba,UAA9B,EAA+CC,WAA/C,EAAiE;MAAnCD,UAAmC;IAAnCA,UAAmC,GAAtB,EAAsB;;;MAAlBC,WAAkB;IAAlBA,WAAkB,GAAJ,EAAI;;;SACxDd,MAAM,GACX,oBAAC,MAAD,EAAYc,WAAZ,EACGd,MAAM,CAACe,GAAP,CAAW,UAACX,KAAD,EAAQY,CAAR;WACV,oBAAC,KAAD;MACE,GAAG,EAAEZ,KAAK,CAACa,GAAN,IAAaD,CADpB;MAEE,IAAI,EAAEZ,KAAK,CAACE,IAFd;MAGE,KAAK,EAAEF,KAAK,CAACc,KAHf;MAIE,MAAM,EAAEd,KAAK,CAACe,MAJhB;MAKE,MAAM,EAAE,gBAAAC,KAAK;eACXhB,KAAK,CAACiB,MAAN,GACEjB,KAAK,CAACiB,MAAN,cAAkBD,KAAlB,MAA4BP,UAA5B;UAAwCT,KAAK,EAAEA;WADjD,GAGE,oBAAC,KAAD,CAAO,SAAP,eAAqBgB,KAArB,EAAgCP,UAAhC;UAA4C,KAAK,EAAET;WAJ1C;;MANL;GAAX,CADH,CADW,GAkBT,IAlBJ;;;;;"}

7
node_modules/react-router-config/index.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
if (process.env.NODE_ENV === "production") {
module.exports = require("./cjs/react-router-config.min.js");
} else {
module.exports = require("./cjs/react-router-config.js");
}

3
node_modules/react-router-config/matchRoutes.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
require("./warnAboutDeprecatedCJSRequire.js")("matchRoutes");
module.exports = require("./index.js").matchRoutes;

2
node_modules/react-router-config/modules/index.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export { default as matchRoutes } from "./matchRoutes";
export { default as renderRoutes } from "./renderRoutes";

View File

@@ -0,0 +1,25 @@
import { matchPath, Router } from "react-router";
function matchRoutes(routes, pathname, /*not public API*/ branch = []) {
routes.some(route => {
const match = route.path
? matchPath(pathname, route)
: branch.length
? branch[branch.length - 1].match // use parent match
: Router.computeRootMatch(pathname); // use default "root" match
if (match) {
branch.push({ route, match });
if (route.routes) {
matchRoutes(route.routes, pathname, branch);
}
}
return match;
});
return branch;
}
export default matchRoutes;

View File

@@ -0,0 +1,26 @@
import React from "react";
import { Switch, Route } from "react-router";
function renderRoutes(routes, extraProps = {}, switchProps = {}) {
return routes ? (
<Switch {...switchProps}>
{routes.map((route, i) => (
<Route
key={route.key || i}
path={route.path}
exact={route.exact}
strict={route.strict}
render={props =>
route.render ? (
route.render({ ...props, ...extraProps, route: route })
) : (
<route.component {...props} {...extraProps} route={route} />
)
}
/>
))}
</Switch>
) : null;
}
export default renderRoutes;

52
node_modules/react-router-config/package.json generated vendored Normal file
View File

@@ -0,0 +1,52 @@
{
"name": "react-router-config",
"version": "5.1.1",
"description": "Static route config matching for React Router",
"repository": "ReactTraining/react-router",
"license": "MIT",
"authors": [
"Ryan Florence"
],
"files": [
"cjs",
"es",
"esm",
"index.js",
"matchRoutes.js",
"modules/*.js",
"modules/utils/*.js",
"renderRoutes.js",
"warnAboutDeprecatedCJSRequire.js",
"umd"
],
"main": "index.js",
"module": "esm/react-router-config.js",
"sideEffects": false,
"scripts": {
"build": "rollup -c",
"lint": "eslint modules",
"test": "jest"
},
"peerDependencies": {
"react": ">=15",
"react-router": ">=5"
},
"dependencies": {
"@babel/runtime": "^7.1.2"
},
"browserify": {
"transform": [
"loose-envify"
]
},
"keywords": [
"react",
"router",
"route",
"routing",
"static routes",
"route config",
"react router"
],
"gitHead": "fbb6358dd7f47eedd55d0b63e0725ac335d28bde"
}

3
node_modules/react-router-config/renderRoutes.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
require("./warnAboutDeprecatedCJSRequire.js")("renderRoutes");
module.exports = require("./index.js").renderRoutes;

View File

@@ -0,0 +1,86 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react-router'), require('react')) :
typeof define === 'function' && define.amd ? define(['exports', 'react-router', 'react'], factory) :
(global = global || self, factory(global.ReactRouterConfig = {}, global.ReactRouter, global.React));
}(this, function (exports, reactRouter, React) { 'use strict';
React = React && React.hasOwnProperty('default') ? React['default'] : React;
function matchRoutes(routes, pathname,
/*not public API*/
branch) {
if (branch === void 0) {
branch = [];
}
routes.some(function (route) {
var match = route.path ? reactRouter.matchPath(pathname, route) : branch.length ? branch[branch.length - 1].match // use parent match
: reactRouter.Router.computeRootMatch(pathname); // use default "root" match
if (match) {
branch.push({
route: route,
match: match
});
if (route.routes) {
matchRoutes(route.routes, pathname, branch);
}
}
return match;
});
return branch;
}
function _extends() {
_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;
};
return _extends.apply(this, arguments);
}
function renderRoutes(routes, extraProps, switchProps) {
if (extraProps === void 0) {
extraProps = {};
}
if (switchProps === void 0) {
switchProps = {};
}
return routes ? React.createElement(reactRouter.Switch, switchProps, routes.map(function (route, i) {
return React.createElement(reactRouter.Route, {
key: route.key || i,
path: route.path,
exact: route.exact,
strict: route.strict,
render: function render(props) {
return route.render ? route.render(_extends({}, props, {}, extraProps, {
route: route
})) : React.createElement(route.component, _extends({}, props, extraProps, {
route: route
}));
}
});
})) : null;
}
exports.matchRoutes = matchRoutes;
exports.renderRoutes = renderRoutes;
Object.defineProperty(exports, '__esModule', { value: true });
}));
//# sourceMappingURL=react-router-config.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"react-router-config.js","sources":["../modules/matchRoutes.js","../../node_modules/@babel/runtime/helpers/esm/extends.js","../modules/renderRoutes.js"],"sourcesContent":["import { matchPath, Router } from \"react-router\";\n\nfunction matchRoutes(routes, pathname, /*not public API*/ branch = []) {\n routes.some(route => {\n const match = route.path\n ? matchPath(pathname, route)\n : branch.length\n ? branch[branch.length - 1].match // use parent match\n : Router.computeRootMatch(pathname); // use default \"root\" match\n\n if (match) {\n branch.push({ route, match });\n\n if (route.routes) {\n matchRoutes(route.routes, pathname, branch);\n }\n }\n\n return match;\n });\n\n return branch;\n}\n\nexport default matchRoutes;\n","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","import React from \"react\";\nimport { Switch, Route } from \"react-router\";\n\nfunction renderRoutes(routes, extraProps = {}, switchProps = {}) {\n return routes ? (\n <Switch {...switchProps}>\n {routes.map((route, i) => (\n <Route\n key={route.key || i}\n path={route.path}\n exact={route.exact}\n strict={route.strict}\n render={props =>\n route.render ? (\n route.render({ ...props, ...extraProps, route: route })\n ) : (\n <route.component {...props} {...extraProps} route={route} />\n )\n }\n />\n ))}\n </Switch>\n ) : null;\n}\n\nexport default renderRoutes;\n"],"names":["matchRoutes","routes","pathname","branch","some","route","match","path","matchPath","length","Router","computeRootMatch","push","renderRoutes","extraProps","switchProps","Switch","map","i","Route","key","exact","strict","props","render"],"mappings":";;;;;;;;EAEA,SAASA,WAAT,CAAqBC,MAArB,EAA6BC,QAA7B;EAAuC;EAAmBC,MAA1D,EAAuE;EAAA,MAAbA,MAAa;EAAbA,IAAAA,MAAa,GAAJ,EAAI;EAAA;;EACrEF,EAAAA,MAAM,CAACG,IAAP,CAAY,UAAAC,KAAK,EAAI;EACnB,QAAMC,KAAK,GAAGD,KAAK,CAACE,IAAN,GACVC,qBAAS,CAACN,QAAD,EAAWG,KAAX,CADC,GAEVF,MAAM,CAACM,MAAP,GACEN,MAAM,CAACA,MAAM,CAACM,MAAP,GAAgB,CAAjB,CAAN,CAA0BH,KAD5B;EAAA,MAEEI,kBAAM,CAACC,gBAAP,CAAwBT,QAAxB,CAJN,CADmB;;EAOnB,QAAII,KAAJ,EAAW;EACTH,MAAAA,MAAM,CAACS,IAAP,CAAY;EAAEP,QAAAA,KAAK,EAALA,KAAF;EAASC,QAAAA,KAAK,EAALA;EAAT,OAAZ;;EAEA,UAAID,KAAK,CAACJ,MAAV,EAAkB;EAChBD,QAAAA,WAAW,CAACK,KAAK,CAACJ,MAAP,EAAeC,QAAf,EAAyBC,MAAzB,CAAX;EACD;EACF;;EAED,WAAOG,KAAP;EACD,GAhBD;EAkBA,SAAOH,MAAP;EACD;;ECtBc,SAAS,QAAQ,GAAG;EACnC,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,UAAU,MAAM,EAAE;EAChD,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;EAC/C,MAAM,IAAI,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;;EAEhC,MAAM,KAAK,IAAI,GAAG,IAAI,MAAM,EAAE;EAC9B,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;EAC/D,UAAU,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;EACpC,SAAS;EACT,OAAO;EACP,KAAK;;EAEL,IAAI,OAAO,MAAM,CAAC;EAClB,GAAG,CAAC;;EAEJ,EAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;EACzC;;GAAC,DCbD,SAASU,YAAT,CAAsBZ,MAAtB,EAA8Ba,UAA9B,EAA+CC,WAA/C,EAAiE;EAAA,MAAnCD,UAAmC;EAAnCA,IAAAA,UAAmC,GAAtB,EAAsB;EAAA;;EAAA,MAAlBC,WAAkB;EAAlBA,IAAAA,WAAkB,GAAJ,EAAI;EAAA;;EAC/D,SAAOd,MAAM,GACX,oBAACe,kBAAD,EAAYD,WAAZ,EACGd,MAAM,CAACgB,GAAP,CAAW,UAACZ,KAAD,EAAQa,CAAR;EAAA,WACV,oBAACC,iBAAD;EACE,MAAA,GAAG,EAAEd,KAAK,CAACe,GAAN,IAAaF,CADpB;EAEE,MAAA,IAAI,EAAEb,KAAK,CAACE,IAFd;EAGE,MAAA,KAAK,EAAEF,KAAK,CAACgB,KAHf;EAIE,MAAA,MAAM,EAAEhB,KAAK,CAACiB,MAJhB;EAKE,MAAA,MAAM,EAAE,gBAAAC,KAAK;EAAA,eACXlB,KAAK,CAACmB,MAAN,GACEnB,KAAK,CAACmB,MAAN,cAAkBD,KAAlB,MAA4BT,UAA5B;EAAwCT,UAAAA,KAAK,EAAEA;EAA/C,WADF,GAGE,oBAAC,KAAD,CAAO,SAAP,eAAqBkB,KAArB,EAAgCT,UAAhC;EAA4C,UAAA,KAAK,EAAET;EAAnD,WAJS;EAAA;EALf,MADU;EAAA,GAAX,CADH,CADW,GAkBT,IAlBJ;EAmBD;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,2 @@
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react-router"),require("react")):"function"==typeof define&&define.amd?define(["exports","react-router","react"],t):t((e=e||self).ReactRouterConfig={},e.ReactRouter,e.React)}(this,function(e,u,n){"use strict";function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}n=n&&n.hasOwnProperty("default")?n.default:n,e.matchRoutes=function r(e,n,o){return void 0===o&&(o=[]),e.some(function(e){var t=e.path?u.matchPath(n,e):o.length?o[o.length-1].match:u.Router.computeRootMatch(n);return t&&(o.push({route:e,match:t}),e.routes&&r(e.routes,n,o)),t}),o},e.renderRoutes=function(e,r,t){return void 0===r&&(r={}),void 0===t&&(t={}),e?n.createElement(u.Switch,t,e.map(function(t,e){return n.createElement(u.Route,{key:t.key||e,path:t.path,exact:t.exact,strict:t.strict,render:function(e){return t.render?t.render(o({},e,{},r,{route:t})):n.createElement(t.component,o({},e,r,{route:t}))}})})):null},Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=react-router-config.min.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"react-router-config.min.js","sources":["../../node_modules/@babel/runtime/helpers/esm/extends.js","../modules/matchRoutes.js","../modules/renderRoutes.js"],"sourcesContent":["export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","import { matchPath, Router } from \"react-router\";\n\nfunction matchRoutes(routes, pathname, /*not public API*/ branch = []) {\n routes.some(route => {\n const match = route.path\n ? matchPath(pathname, route)\n : branch.length\n ? branch[branch.length - 1].match // use parent match\n : Router.computeRootMatch(pathname); // use default \"root\" match\n\n if (match) {\n branch.push({ route, match });\n\n if (route.routes) {\n matchRoutes(route.routes, pathname, branch);\n }\n }\n\n return match;\n });\n\n return branch;\n}\n\nexport default matchRoutes;\n","import React from \"react\";\nimport { Switch, Route } from \"react-router\";\n\nfunction renderRoutes(routes, extraProps = {}, switchProps = {}) {\n return routes ? (\n <Switch {...switchProps}>\n {routes.map((route, i) => (\n <Route\n key={route.key || i}\n path={route.path}\n exact={route.exact}\n strict={route.strict}\n render={props =>\n route.render ? (\n route.render({ ...props, ...extraProps, route: route })\n ) : (\n <route.component {...props} {...extraProps} route={route} />\n )\n }\n />\n ))}\n </Switch>\n ) : null;\n}\n\nexport default renderRoutes;\n"],"names":["_extends","Object","assign","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","this","matchRoutes","routes","pathname","branch","some","route","match","path","matchPath","Router","computeRootMatch","push","extraProps","switchProps","React","Switch","map","Route","exact","strict","render","props","component"],"mappings":"wSAAe,SAASA,IAetB,OAdAA,EAAWC,OAAOC,QAAU,SAAUC,GACpC,IAAK,IAAIC,EAAI,EAAGA,EAAIC,UAAUC,OAAQF,IAAK,CACzC,IAAIG,EAASF,UAAUD,GAEvB,IAAK,IAAII,KAAOD,EACVN,OAAOQ,UAAUC,eAAeC,KAAKJ,EAAQC,KAC/CL,EAAOK,GAAOD,EAAOC,IAK3B,OAAOL,IAGOS,MAAMC,KAAMR,sECb9B,SAASS,EAAYC,EAAQC,EAA6BC,mBAAAA,IAAAA,EAAS,IACjEF,EAAOG,KAAK,SAAAC,OACJC,EAAQD,EAAME,KAChBC,YAAUN,EAAUG,GACpBF,EAAOX,OACLW,EAAOA,EAAOX,OAAS,GAAGc,MAC1BG,SAAOC,iBAAiBR,UAE1BI,IACFH,EAAOQ,KAAK,CAAEN,MAAAA,EAAOC,MAAAA,IAEjBD,EAAMJ,QACRD,EAAYK,EAAMJ,OAAQC,EAAUC,IAIjCG,IAGFH,2BClBaF,EAAQW,EAAiBC,mBAAjBD,IAAAA,EAAa,aAAIC,IAAAA,EAAc,IACpDZ,EACLa,gBAACC,SAAWF,EACTZ,EAAOe,IAAI,SAACX,EAAOf,UAClBwB,gBAACG,SACCvB,IAAKW,EAAMX,KAAOJ,EAClBiB,KAAMF,EAAME,KACZW,MAAOb,EAAMa,MACbC,OAAQd,EAAMc,OACdC,OAAQ,SAAAC,UACNhB,EAAMe,OACJf,EAAMe,YAAYC,KAAUT,GAAYP,MAAOA,KAE/CS,gBAACT,EAAMiB,eAAcD,EAAWT,GAAYP,MAAOA,WAM3D"}

View File

@@ -0,0 +1,35 @@
"use strict";
var printWarning = function() {};
if (process.env.NODE_ENV !== "production") {
printWarning = function(format, subs) {
var index = 0;
var message =
"Warning: " +
(subs.length > 0
? format.replace(/%s/g, function() {
return subs[index++];
})
: format);
if (typeof console !== "undefined") {
console.error(message);
}
try {
// --- Welcome to debugging React Router ---
// This error was thrown as a convenience so that you can use the
// stack trace to find the callsite that triggered this warning.
throw new Error(message);
} catch (e) {}
};
}
module.exports = function(member) {
printWarning(
'Please use `require("react-router-config").%s` instead of `require("react-router-config/%s")`. ' +
"Support for the latter will be removed in the next major release.",
[member, member]
);
};