fdsfd
This commit is contained in:
parent
628618df89
commit
e031240dff
3749 changed files with 1120848 additions and 1 deletions
41
node_modules/import-from/index.d.ts
generated
vendored
Normal file
41
node_modules/import-from/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
declare const importFrom: {
|
||||
/**
|
||||
Import a module like with [`require()`](https://nodejs.org/api/modules.html#modules_require_id) but from a given path.
|
||||
|
||||
@param fromDirectory - Directory to import from.
|
||||
@param moduleId - What you would use in `require()`.
|
||||
@throws Like `require()`, throws when the module can't be found.
|
||||
|
||||
@example
|
||||
```
|
||||
import importFrom = require('import-from');
|
||||
|
||||
try {
|
||||
const bar = importFrom('foo', './bar');
|
||||
// Do something with `bar`
|
||||
} catch (error) {
|
||||
// `error` is thrown when `./bar` can't be found
|
||||
}
|
||||
```
|
||||
*/
|
||||
(fromDirectory: string, moduleId: string): unknown;
|
||||
|
||||
/**
|
||||
Import a module like with [`require()`](https://nodejs.org/api/modules.html#modules_require_id) but from a given path.
|
||||
|
||||
@param fromDirectory - Directory to import from.
|
||||
@param moduleId - What you would use in `require()`.
|
||||
@returns `undefined` instead of throwing when the module can't be found.
|
||||
|
||||
@example
|
||||
```
|
||||
import importFrom = require('import-from');
|
||||
|
||||
const bar = importFrom.silent('foo', './bar');
|
||||
// Do something with `bar`, may be `undefined` when `./bar` can't be found
|
||||
```
|
||||
*/
|
||||
silent(fromDirectory: string, moduleId: string): unknown;
|
||||
};
|
||||
|
||||
export = importFrom;
|
10
node_modules/import-from/index.js
generated
vendored
Normal file
10
node_modules/import-from/index.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
'use strict';
|
||||
const resolveFrom = require('resolve-from');
|
||||
|
||||
module.exports = (fromDirectory, moduleId) => require(resolveFrom(fromDirectory, moduleId));
|
||||
|
||||
module.exports.silent = (fromDirectory, moduleId) => {
|
||||
try {
|
||||
return require(resolveFrom(fromDirectory, moduleId));
|
||||
} catch (_) {}
|
||||
};
|
9
node_modules/import-from/license
generated
vendored
Normal file
9
node_modules/import-from/license
generated
vendored
Normal 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.
|
75
node_modules/import-from/package.json
generated
vendored
Normal file
75
node_modules/import-from/package.json
generated
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"import-from@3.0.0",
|
||||
"/d"
|
||||
]
|
||||
],
|
||||
"_from": "import-from@3.0.0",
|
||||
"_id": "import-from@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-CiuXOFFSzkU5x/CR0+z7T91Iht4CXgfCxVOFRhh2Zyhg5wOpWvvDLQUsWl+gcN+QscYBjez8hDCt85O7RLDttQ==",
|
||||
"_location": "/import-from",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "import-from@3.0.0",
|
||||
"name": "import-from",
|
||||
"escapedName": "import-from",
|
||||
"rawSpec": "3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/import-cwd"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/import-from/-/import-from-3.0.0.tgz",
|
||||
"_spec": "3.0.0",
|
||||
"_where": "/d",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/import-from/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"resolve-from": "^5.0.0"
|
||||
},
|
||||
"description": "Import a module like with `require()` but from a given path",
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/import-from#readme",
|
||||
"keywords": [
|
||||
"require",
|
||||
"resolve",
|
||||
"path",
|
||||
"module",
|
||||
"from",
|
||||
"like",
|
||||
"import",
|
||||
"path"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "import-from",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/import-from.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"version": "3.0.0"
|
||||
}
|
71
node_modules/import-from/readme.md
generated
vendored
Normal file
71
node_modules/import-from/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
# import-from [](https://travis-ci.org/sindresorhus/import-from)
|
||||
|
||||
> Import a module like with [`require()`](https://nodejs.org/api/modules.html#modules_require_id) but from a given path
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install import-from
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const importFrom = require('import-from');
|
||||
|
||||
// There is a file at `./foo/bar.js`
|
||||
|
||||
importFrom('foo', './bar');
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### importFrom(fromDirectory, moduleId)
|
||||
|
||||
Like `require()`, throws when the module can't be found.
|
||||
|
||||
### importFrom.silent(fromDirectory, moduleId)
|
||||
|
||||
Returns `undefined` instead of throwing when the module can't be found.
|
||||
|
||||
#### fromDirectory
|
||||
|
||||
Type: `string`
|
||||
|
||||
Directory to import from.
|
||||
|
||||
#### moduleId
|
||||
|
||||
Type: `string`
|
||||
|
||||
What you would use in `require()`.
|
||||
|
||||
|
||||
## Tip
|
||||
|
||||
Create a partial using a bound function if you want to import from the same `fromDir` multiple times:
|
||||
|
||||
```js
|
||||
const importFromFoo = importFrom.bind(null, 'foo');
|
||||
|
||||
importFromFoo('./bar');
|
||||
importFromFoo('./baz');
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory
|
||||
- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module from a given path
|
||||
- [resolve-cwd](https://github.com/sindresorhus/resolve-cwd) - Resolve the path of a module from the current working directory
|
||||
- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point
|
||||
- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import modules lazily
|
||||
- [import-global](https://github.com/sindresorhus/import-global) - Import a globally installed module
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
Loading…
Add table
Add a link
Reference in a new issue