This commit is contained in:
2020-08-20 11:44:32 +02:00
parent 4715fc1814
commit 6aceefeb2f
2891 changed files with 11239 additions and 347539 deletions

54
node_modules/resolve-from/index.js generated vendored
View File

@@ -1,23 +1,47 @@
'use strict';
var path = require('path');
var Module = require('module');
const path = require('path');
const Module = require('module');
const fs = require('fs');
module.exports = function (fromDir, moduleId) {
if (typeof fromDir !== 'string' || typeof moduleId !== 'string') {
throw new TypeError('Expected `fromDir` and `moduleId` to be a string');
const resolveFrom = (fromDirectory, moduleId, silent) => {
if (typeof fromDirectory !== 'string') {
throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``);
}
fromDir = path.resolve(fromDir);
var fromFile = path.join(fromDir, 'noop.js');
if (typeof moduleId !== 'string') {
throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
}
try {
return Module._resolveFilename(moduleId, {
id: fromFile,
filename: fromFile,
paths: Module._nodeModulePaths(fromDir)
});
} catch (err) {
return null;
fromDirectory = fs.realpathSync(fromDirectory);
} catch (error) {
if (error.code === 'ENOENT') {
fromDirectory = path.resolve(fromDirectory);
} else if (silent) {
return;
} else {
throw error;
}
}
const fromFile = path.join(fromDirectory, 'noop.js');
const resolveFileName = () => Module._resolveFilename(moduleId, {
id: fromFile,
filename: fromFile,
paths: Module._nodeModulePaths(fromDirectory)
});
if (silent) {
try {
return resolveFileName();
} catch (error) {
return;
}
}
return resolveFileName();
};
module.exports = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId);
module.exports.silent = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId, true);

20
node_modules/resolve-from/license generated vendored
View File

@@ -1,21 +1,9 @@
The MIT License (MIT)
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:
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 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.
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.

View File

@@ -1,66 +1,36 @@
{
"_from": "resolve-from@^2.0.0",
"_id": "resolve-from@2.0.0",
"_inBundle": false,
"_integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=",
"_location": "/resolve-from",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "resolve-from@^2.0.0",
"name": "resolve-from",
"escapedName": "resolve-from",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/require_optional"
],
"_resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz",
"_shasum": "9480ab20e94ffa1d9e80a804c7ea147611966b57",
"_spec": "resolve-from@^2.0.0",
"_where": "D:\\WORK\\Menui\\menui_backend\\node_modules\\require_optional",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/resolve-from/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Resolve the path of a module like require.resolve() but from a given path",
"devDependencies": {
"ava": "*",
"xo": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/resolve-from#readme",
"keywords": [
"require",
"resolve",
"path",
"module",
"from",
"like",
"path"
],
"license": "MIT",
"name": "resolve-from",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/resolve-from.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "2.0.0"
"name": "resolve-from",
"version": "5.0.0",
"description": "Resolve the path of a module like `require.resolve()` but from a given path",
"license": "MIT",
"repository": "sindresorhus/resolve-from",
"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": [
"require",
"resolve",
"path",
"module",
"from",
"like",
"import"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}

32
node_modules/resolve-from/readme.md generated vendored
View File

@@ -1,14 +1,12 @@
# resolve-from [![Build Status](https://travis-ci.org/sindresorhus/resolve-from.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-from)
> Resolve the path of a module like [`require.resolve()`](http://nodejs.org/api/globals.html#globals_require_resolve) but from a given path
Unlike `require.resolve()` it returns `null` instead of throwing when the module can't be found.
> Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path
## Install
```
$ npm install --save resolve-from
$ npm install resolve-from
```
@@ -17,7 +15,7 @@ $ npm install --save resolve-from
```js
const resolveFrom = require('resolve-from');
// there's a file at `./foo/bar.js`
// There is a file at `./foo/bar.js`
resolveFrom('foo', './bar');
//=> '/Users/sindresorhus/dev/test/foo/bar.js'
@@ -26,9 +24,15 @@ resolveFrom('foo', './bar');
## API
### resolveFrom(fromDir, moduleId)
### resolveFrom(fromDirectory, moduleId)
#### fromDir
Like `require()`, throws when the module can't be found.
### resolveFrom.silent(fromDirectory, moduleId)
Returns `undefined` instead of throwing when the module can't be found.
#### fromDirectory
Type: `string`
@@ -43,7 +47,7 @@ What you would use in `require()`.
## Tip
Create a partial using a bound function if you want to require from the same `fromDir` multiple times:
Create a partial using a bound function if you want to resolve from the same `fromDirectory` multiple times:
```js
const resolveFromFoo = resolveFrom.bind(null, 'foo');
@@ -53,6 +57,16 @@ resolveFromFoo('./baz');
```
## Related
- [resolve-cwd](https://github.com/sindresorhus/resolve-cwd) - Resolve the path of a module from the current working directory
- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path
- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import 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 a module lazily
- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)