This commit is contained in:
2024-02-07 01:33:07 -05:00
commit c1af19d441
4088 changed files with 1260170 additions and 0 deletions

26
node_modules/import-lazy/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,26 @@
/**
Import a module lazily.
@example
```
// Pass in `require` or a custom import function
import importLazy = require('import-lazy');
const _ = importLazy(require)('lodash');
// Instead of referring to its exported properties directly…
_.isNumber(2);
// …it's cached on consecutive calls
_.isNumber('unicorn');
// Works out of the box for functions and regular properties
const stuff = importLazy(require)('./math-lib');
console.log(stuff.sum(1, 2)); // => 3
console.log(stuff.PHI); // => 1.618033
```
*/
declare function importLazy<T = unknown>(
importFn: (moduleId: string) => T
): (moduleId: string) => T;
export = importLazy;

27
node_modules/import-lazy/index.js generated vendored Normal file
View File

@ -0,0 +1,27 @@
'use strict';
const lazy = (importedModule, importFn, moduleId) =>
importedModule === undefined ? importFn(moduleId) : importedModule;
module.exports = importFn => {
return moduleId => {
let importedModule;
const handler = {
get: (target, property) => {
importedModule = lazy(importedModule, importFn, moduleId);
return Reflect.get(importedModule, property);
},
apply: (target, thisArgument, argumentsList) => {
importedModule = lazy(importedModule, importFn, moduleId);
return Reflect.apply(importedModule, thisArgument, argumentsList);
},
construct: (target, argumentsList) => {
importedModule = lazy(importedModule, importFn, moduleId);
return Reflect.construct(importedModule, argumentsList);
}
};
// eslint-disable-next-line prefer-arrow-callback
return new Proxy(function () {}, handler);
};
};

9
node_modules/import-lazy/license generated vendored Normal file
View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.

40
node_modules/import-lazy/package.json generated vendored Normal file
View File

@ -0,0 +1,40 @@
{
"name": "import-lazy",
"version": "4.0.0",
"description": "Import a module lazily",
"license": "MIT",
"repository": "sindresorhus/import-lazy",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"import",
"require",
"load",
"module",
"modules",
"lazy",
"lazily",
"defer",
"deferred",
"proxy",
"proxies"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}

57
node_modules/import-lazy/readme.md generated vendored Normal file
View File

@ -0,0 +1,57 @@
# import-lazy [![Build Status](https://travis-ci.org/sindresorhus/import-lazy.svg?branch=master)](https://travis-ci.org/sindresorhus/import-lazy)
> Import a module lazily
## Install
```
$ npm install import-lazy
```
## Usage
```js
// Pass in `require` or a custom import function
const importLazy = require('import-lazy')(require);
const _ = importLazy('lodash');
// Instead of referring to its exported properties directly…
_.isNumber(2);
// …it's cached on consecutive calls
_.isNumber('unicorn');
// Works out of the box for functions and regular properties
const stuff = importLazy('./math-lib');
console.log(stuff.sum(1, 2)); // => 3
console.log(stuff.PHI); // => 1.618033
```
### Warning: Destructuring will cause it to fetch eagerly
While you may be tempted to do leverage destructuring, like this:
```js
const {isNumber, isString} = importLazy('lodash');
```
Note that this will cause immediate property access, negating the lazy loading, and is equivalent to:
```js
import {isNumber, isString} from 'lodash';
```
## Related
- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module from a given path
- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path
- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point
- [lazy-value](https://github.com/sindresorhus/lazy-value) - Create a lazily evaluated value
- [define-lazy-prop](https://github.com/sindresorhus/define-lazy-prop) - Define a lazily evaluated property on an object
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)