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

19
node_modules/react-loadable/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2018-present Jamie Kyle <me@thejameskyle.com>
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.

1256
node_modules/react-loadable/README.md generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/react-loadable/babel.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('./lib/babel');

194
node_modules/react-loadable/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,194 @@
// Type definitions for react-loadable 5.5
// Project: https://github.com/thejameskyle/react-loadable#readme
// Definitions by: Jessica Franco <https://github.com/Jessidhia>
// Oden S. <https://github.com/odensc>
// Ian Ker-Seymer <https://github.com/ianks>
// Tomek Łaziuk <https://github.com/tlaziuk>
// Ian Mobley <https://github.com/iMobs>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.7
/// <reference types="react" />
declare namespace LoadableExport {
interface LoadingComponentProps {
isLoading: boolean;
pastDelay: boolean;
timedOut: boolean;
error: any;
retry: () => void;
}
type Options<Props, Exports extends object> = OptionsWithoutRender<Props> | OptionsWithRender<Props, Exports>;
interface CommonOptions {
/**
* React component displayed after delay until loader() succeeds. Also responsible for displaying errors.
*
* If you don't want to render anything you can pass a function that returns null
* (this is considered a valid React component).
*/
loading: React.ComponentType<LoadingComponentProps>;
/**
* Defaults to 200, in milliseconds.
*
* Only show the loading component if the loader() has taken this long to succeed or error.
*/
delay?: number | false | null | undefined;
/**
* Disabled by default.
*
* After the specified time in milliseconds passes, the component's `timedOut` prop will be set to true.
*/
timeout?: number | false | null | undefined;
/**
* Optional array of module paths that `Loadable.Capture`'s `report` function will be applied on during
* server-side rendering. This helps the server know which modules were imported/used during SSR.
* ```ts
* Loadable({
* loader: () => import('./my-component'),
* modules: ['./my-component'],
* });
* ```
*/
modules?: string[] | undefined;
/**
* An optional function which returns an array of Webpack module ids which you can get
* with require.resolveWeak. This is used by the client (inside `Loadable.preloadReady`) to
* guarantee each webpack module is preloaded before the first client render.
* ```ts
* Loadable({
* loader: () => import('./Foo'),
* webpack: () => [require.resolveWeak('./Foo')],
* });
* ```
*/
webpack?: (() => Array<string | number>) | undefined;
}
interface OptionsWithoutRender<Props> extends CommonOptions {
/**
* Function returning a promise which returns a React component displayed on success.
*
* Resulting React component receives all the props passed to the generated component.
*/
loader(): Promise<React.ComponentType<Props> | { default: React.ComponentType<Props> }>;
}
interface OptionsWithRender<Props, Exports extends object> extends CommonOptions {
/**
* Function returning a promise which returns an object to be passed to `render` on success.
*/
loader(): Promise<Exports>;
/**
* If you want to customize what gets rendered from your loader you can also pass `render`.
*
* Note: If you want to load multiple resources at once, you can also use `Loadable.Map`.
*
* ```ts
* Loadable({
* // ...
* render(loaded, props) {
* const Component = loaded.default;
* return <Component {...props} />
* }
* });
* ```
*/
render(loaded: Exports, props: Props): React.ReactNode;
// NOTE: render is not optional if the loader return type is not compatible with the type
// expected in `OptionsWithoutRender`. If you do not want to provide a render function, ensure that your
// function is returning a promise for a React.ComponentType or is the result of import()ing a module
// that has a component as its `default` export.
}
interface OptionsWithMap<Props, Exports extends { [key: string]: any }> extends CommonOptions {
/**
* An object containing functions which return promises, which resolve to an object to be passed to `render` on success.
*/
loader: {
[P in keyof Exports]: () => Promise<Exports[P]>
};
/**
* If you want to customize what gets rendered from your loader you can also pass `render`.
*
* Note: If you want to load multiple resources at once, you can also use `Loadable.Map`.
*
* ```ts
* Loadable({
* // ...
* render(loaded, props) {
* const Component = loaded.default;
* return <Component {...props} />
* }
* });
* ```
*/
render(loaded: Exports, props: Props): React.ReactNode;
}
interface LoadableComponent {
/**
* The generated component has a static method preload() for calling the loader function ahead of time.
* This is useful for scenarios where you think the user might do something next and want to load the
* next component eagerly.
*
* Note: preload() intentionally does not return a promise. You should not be depending on the timing of
* preload(). It's meant as a performance optimization, not for creating UI logic.
*/
preload(): void;
}
interface LoadableCaptureProps {
/**
* Function called for every moduleName that is rendered via React Loadable.
*/
report: (moduleName: string) => void;
}
interface Loadable {
<Props, Exports extends object>(options: Options<Props, Exports>): React.ComponentType<Props> & LoadableComponent;
Map<Props, Exports extends { [key: string]: any }>(options: OptionsWithMap<Props, Exports>): React.ComponentType<Props> & LoadableComponent;
/**
* This will call all of the LoadableComponent.preload methods recursively until they are all
* resolved. Allowing you to preload all of your dynamic modules in environments like the server.
* ```ts
* Loadable.preloadAll().then(() => {
* app.listen(3000, () => {
* console.log('Running on http://localhost:3000/');
* });
* });
* ```
*/
preloadAll(): Promise<void>;
/**
* Check for modules that are already loaded in the browser and call the matching
* `LoadableComponent.preload` methods.
* ```ts
* window.main = () => {
* Loadable.preloadReady().then(() => {
* ReactDOM.hydrate(
* <App/>,
* document.getElementById('app'),
* );
* });
* };
* ```
*/
preloadReady(): Promise<void>;
Capture: React.ComponentType<LoadableCaptureProps>;
}
}
declare const LoadableExport: LoadableExport.Loadable;
/* tslint:disable-next-line:no-declare-current-package no-single-declare-module */
declare module "react-loadable" {
export = LoadableExport;
}

65
node_modules/react-loadable/lib/babel.js generated vendored Normal file
View File

@@ -0,0 +1,65 @@
"use strict";
exports.__esModule = true;
exports.default = _default;
function _default(_ref) {
var t = _ref.types,
template = _ref.template;
return {
visitor: {
ImportDeclaration: function ImportDeclaration(path) {
var source = path.node.source.value;
if (source !== 'react-loadable') return;
var defaultSpecifier = path.get('specifiers').find(function (specifier) {
return specifier.isImportDefaultSpecifier();
});
if (!defaultSpecifier) return;
var bindingName = defaultSpecifier.node.local.name;
var binding = path.scope.getBinding(bindingName);
binding.referencePaths.forEach(function (refPath) {
var callExpression = refPath.parentPath;
if (callExpression.isMemberExpression() && callExpression.node.computed === false && callExpression.get('property').isIdentifier({
name: 'Map'
})) {
callExpression = callExpression.parentPath;
}
if (!callExpression.isCallExpression()) return;
var args = callExpression.get('arguments');
if (args.length !== 1) throw callExpression.error;
var options = args[0];
if (!options.isObjectExpression()) return;
var properties = options.get('properties');
var propertiesMap = {};
properties.forEach(function (property) {
if (property.type !== 'SpreadProperty') {
var key = property.get('key');
propertiesMap[key.node.name] = property;
}
});
if (propertiesMap.webpack) {
return;
}
var loaderMethod = propertiesMap.loader.get('value');
var dynamicImports = [];
loaderMethod.traverse({
Import: function Import(path) {
dynamicImports.push(path.parentPath);
}
});
if (!dynamicImports.length) return;
propertiesMap.loader.insertAfter(t.objectProperty(t.identifier('webpack'), t.arrowFunctionExpression([], t.arrayExpression(dynamicImports.map(function (dynamicImport) {
return t.callExpression(t.memberExpression(t.identifier('require'), t.identifier('resolveWeak')), [dynamicImport.get('arguments')[0].node]);
})))));
propertiesMap.loader.insertAfter(t.objectProperty(t.identifier('modules'), t.arrayExpression(dynamicImports.map(function (dynamicImport) {
return dynamicImport.get('arguments')[0].node;
}))));
});
}
}
};
}

356
node_modules/react-loadable/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,356 @@
"use strict";
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
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); }
var React = require("react");
var PropTypes = require("prop-types");
var ALL_INITIALIZERS = [];
var READY_INITIALIZERS = [];
function isWebpackReady(getModuleIds) {
if (typeof __webpack_modules__ !== "object") {
return false;
}
return getModuleIds().every(function (moduleId) {
return typeof moduleId !== "undefined" && typeof __webpack_modules__[moduleId] !== "undefined";
});
}
function load(loader) {
var promise = loader();
var state = {
loading: true,
loaded: null,
error: null
};
state.promise = promise.then(function (loaded) {
state.loading = false;
state.loaded = loaded;
return loaded;
}).catch(function (err) {
state.loading = false;
state.error = err;
throw err;
});
return state;
}
function loadMap(obj) {
var state = {
loading: false,
loaded: {},
error: null
};
var promises = [];
try {
Object.keys(obj).forEach(function (key) {
var result = load(obj[key]);
if (!result.loading) {
state.loaded[key] = result.loaded;
state.error = result.error;
} else {
state.loading = true;
}
promises.push(result.promise);
result.promise.then(function (res) {
state.loaded[key] = res;
}).catch(function (err) {
state.error = err;
});
});
} catch (err) {
state.error = err;
}
state.promise = Promise.all(promises).then(function (res) {
state.loading = false;
return res;
}).catch(function (err) {
state.loading = false;
throw err;
});
return state;
}
function resolve(obj) {
return obj && obj.__esModule ? obj.default : obj;
}
function render(loaded, props) {
return React.createElement(resolve(loaded), props);
}
function createLoadableComponent(loadFn, options) {
var _class, _temp;
if (!options.loading) {
throw new Error("react-loadable requires a `loading` component");
}
var opts = _extends({
loader: null,
loading: null,
delay: 200,
timeout: null,
render: render,
webpack: null,
modules: null
}, options);
var res = null;
function init() {
if (!res) {
res = loadFn(opts.loader);
}
return res.promise;
}
ALL_INITIALIZERS.push(init);
if (typeof opts.webpack === "function") {
READY_INITIALIZERS.push(function () {
if (isWebpackReady(opts.webpack)) {
return init();
}
});
}
return _temp = _class =
/*#__PURE__*/
function (_React$Component) {
_inheritsLoose(LoadableComponent, _React$Component);
function LoadableComponent(props) {
var _this;
_this = _React$Component.call(this, props) || this;
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "retry", function () {
_this.setState({
error: null,
loading: true,
timedOut: false
});
res = loadFn(opts.loader);
_this._loadModule();
});
init();
_this.state = {
error: res.error,
pastDelay: false,
timedOut: false,
loading: res.loading,
loaded: res.loaded
};
return _this;
}
LoadableComponent.preload = function preload() {
return init();
};
var _proto = LoadableComponent.prototype;
_proto.UNSAFE_componentWillMount = function UNSAFE_componentWillMount() {
this._loadModule();
};
_proto.componentDidMount = function componentDidMount() {
this._mounted = true;
};
_proto._loadModule = function _loadModule() {
var _this2 = this;
if (this.context.loadable && Array.isArray(opts.modules)) {
opts.modules.forEach(function (moduleName) {
_this2.context.loadable.report(moduleName);
});
}
if (!res.loading) {
return;
}
var setStateWithMountCheck = function setStateWithMountCheck(newState) {
if (!_this2._mounted) {
return;
}
_this2.setState(newState);
};
if (typeof opts.delay === 'number') {
if (opts.delay === 0) {
this.setState({
pastDelay: true
});
} else {
this._delay = setTimeout(function () {
setStateWithMountCheck({
pastDelay: true
});
}, opts.delay);
}
}
if (typeof opts.timeout === "number") {
this._timeout = setTimeout(function () {
setStateWithMountCheck({
timedOut: true
});
}, opts.timeout);
}
var update = function update() {
setStateWithMountCheck({
error: res.error,
loaded: res.loaded,
loading: res.loading
});
_this2._clearTimeouts();
};
res.promise.then(function () {
update();
return null;
}).catch(function (err) {
update();
return null;
});
};
_proto.componentWillUnmount = function componentWillUnmount() {
this._mounted = false;
this._clearTimeouts();
};
_proto._clearTimeouts = function _clearTimeouts() {
clearTimeout(this._delay);
clearTimeout(this._timeout);
};
_proto.render = function render() {
if (this.state.loading || this.state.error) {
return React.createElement(opts.loading, {
isLoading: this.state.loading,
pastDelay: this.state.pastDelay,
timedOut: this.state.timedOut,
error: this.state.error,
retry: this.retry
});
} else if (this.state.loaded) {
return opts.render(this.state.loaded, this.props);
} else {
return null;
}
};
return LoadableComponent;
}(React.Component), _defineProperty(_class, "contextTypes", {
loadable: PropTypes.shape({
report: PropTypes.func.isRequired
})
}), _temp;
}
function Loadable(opts) {
return createLoadableComponent(load, opts);
}
function LoadableMap(opts) {
if (typeof opts.render !== "function") {
throw new Error("LoadableMap requires a `render(loaded, props)` function");
}
return createLoadableComponent(loadMap, opts);
}
Loadable.Map = LoadableMap;
var Capture =
/*#__PURE__*/
function (_React$Component2) {
_inheritsLoose(Capture, _React$Component2);
function Capture() {
return _React$Component2.apply(this, arguments) || this;
}
var _proto2 = Capture.prototype;
_proto2.getChildContext = function getChildContext() {
return {
loadable: {
report: this.props.report
}
};
};
_proto2.render = function render() {
return React.Children.only(this.props.children);
};
return Capture;
}(React.Component);
_defineProperty(Capture, "propTypes", {
report: PropTypes.func.isRequired
});
_defineProperty(Capture, "childContextTypes", {
loadable: PropTypes.shape({
report: PropTypes.func.isRequired
}).isRequired
});
Loadable.Capture = Capture;
function flushInitializers(initializers) {
var promises = [];
while (initializers.length) {
var init = initializers.pop();
promises.push(init());
}
return Promise.all(promises).then(function () {
if (initializers.length) {
return flushInitializers(initializers);
}
});
}
Loadable.preloadAll = function () {
return new Promise(function (resolve, reject) {
flushInitializers(ALL_INITIALIZERS).then(resolve, reject);
});
};
Loadable.preloadReady = function () {
return new Promise(function (resolve, reject) {
// We always will resolve, errors should be handled within loading UIs.
flushInitializers(READY_INITIALIZERS).then(resolve, resolve);
});
};
module.exports = Loadable;

79
node_modules/react-loadable/lib/webpack.js generated vendored Normal file
View File

@@ -0,0 +1,79 @@
'use strict';
var url = require('url');
function buildManifest(compiler, compilation) {
var context = compiler.options.context;
var manifest = {};
compilation.chunks.forEach(function (chunk) {
chunk.files.forEach(function (file) {
chunk.forEachModule(function (module) {
var id = module.id;
var name = typeof module.libIdent === 'function' ? module.libIdent({
context: context
}) : null;
var publicPath = url.resolve(compilation.outputOptions.publicPath || '', file);
var currentModule = module;
if (module.constructor.name === 'ConcatenatedModule') {
currentModule = module.rootModule;
}
if (!manifest[currentModule.rawRequest]) {
manifest[currentModule.rawRequest] = [];
}
manifest[currentModule.rawRequest].push({
id: id,
name: name,
file: file,
publicPath: publicPath
});
});
});
});
return manifest;
}
var ReactLoadablePlugin =
/*#__PURE__*/
function () {
function ReactLoadablePlugin(opts) {
if (opts === void 0) {
opts = {};
}
this.filename = opts.filename;
}
var _proto = ReactLoadablePlugin.prototype;
_proto.apply = function apply(compiler) {
var _this = this;
compiler.plugin('emit', function (compilation, callback) {
var manifest = buildManifest(compiler, compilation);
var json = JSON.stringify(manifest, null, 2);
compilation.assets[_this.filename] = {
source: function source() {
return json;
},
size: function size() {
return json.length;
}
};
callback();
});
};
return ReactLoadablePlugin;
}();
function getBundles(manifest, moduleIds) {
return moduleIds.reduce(function (bundles, moduleId) {
return bundles.concat(manifest[moduleId]);
}, []);
}
exports.ReactLoadablePlugin = ReactLoadablePlugin;
exports.getBundles = getBundles;

54
node_modules/react-loadable/package.json generated vendored Normal file
View File

@@ -0,0 +1,54 @@
{
"name": "@docusaurus/react-loadable",
"publishConfig": {
"access": "public"
},
"version": "5.5.2",
"description": "A higher order component for loading components with promises",
"main": "lib/index.js",
"types": "index.d.ts",
"author": "James Kyle <me@thejameskyle.com>",
"license": "MIT",
"repository": "thejameskyle/react-loadable",
"files": [
"index.d.ts",
"babel.js",
"webpack.js",
"lib/**"
],
"scripts": {
"test": "jest --coverage",
"build": "babel src -d lib",
"start": "yarn build && webpack && babel-node example/server.js",
"prepare": "yarn build"
},
"dependencies": {
"@types/react": "*",
"prop-types": "^15.6.2"
},
"devDependencies": {
"@babel/cli": "^7.1.2",
"@babel/core": "^7.1.2",
"@babel/node": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-transform-async-to-generator": "^7.1.0",
"@babel/plugin-transform-object-assign": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"babel-loader": "^8.0.4",
"babel-plugin-dynamic-import-node": "^2.2.0",
"babel-plugin-module-resolver": "^3.1.1",
"express": "^4.16.4",
"flow-bin": "^0.83.0",
"jest": "^23.6.0",
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-test-renderer": "^16.5.2",
"webpack": "^4.20.2"
},
"peerDependencies": {
"react": "*"
}
}

1
node_modules/react-loadable/webpack.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('./lib/webpack');