This commit is contained in:
lalBi94
2023-03-05 13:23:23 +01:00
commit 7bc56c09b5
14034 changed files with 1834369 additions and 0 deletions

41
node_modules/@istanbuljs/load-nyc-config/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,41 @@
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [1.1.0](https://github.com/istanbuljs/load-nyc-config/compare/v1.0.0...v1.1.0) (2020-05-20)
### Features
* Create `isLoading` function ([#15](https://github.com/istanbuljs/load-nyc-config/issues/15)) ([0e58b51](https://github.com/istanbuljs/load-nyc-config/commit/0e58b516f663af7ed710ba27f2090fc28bc3fdb1))
* Support loading ES module config from `.js` files ([#14](https://github.com/istanbuljs/load-nyc-config/issues/14)) ([b1ea369](https://github.com/istanbuljs/load-nyc-config/commit/b1ea369f1e5162133b7057c5e3fefb8085671ab3))
## [1.0.0](https://github.com/istanbuljs/load-nyc-config/compare/v1.0.0-alpha.2...v1.0.0) (2019-12-20)
### Features
* Version bump only ([#11](https://github.com/istanbuljs/load-nyc-config/issues/11)) ([8c3f1be](https://github.com/istanbuljs/load-nyc-config/commit/8c3f1be8d4d30161088a79878c02210db4c2fbfb))
## [1.0.0-alpha.2](https://github.com/istanbuljs/load-nyc-config/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2019-11-24)
### Bug Fixes
* Remove support for loading .js config under `type: 'module'` ([#10](https://github.com/istanbuljs/load-nyc-config/issues/10)) ([420fe87](https://github.com/istanbuljs/load-nyc-config/commit/420fe87da7dde3e9d98ef07f0a8a03d2b4d1dcb1))
* Resolve cwd per config that sets it ([#9](https://github.com/istanbuljs/load-nyc-config/issues/9)) ([649efdc](https://github.com/istanbuljs/load-nyc-config/commit/649efdcda405c476764eebcf15af5da542fb21e1))
## [1.0.0-alpha.1](https://github.com/istanbuljs/load-nyc-config/compare/v1.0.0-alpha.0...v1.0.0-alpha.1) (2019-10-08)
### Bug Fixes
* Add `cwd` to returned config object ([#8](https://github.com/istanbuljs/load-nyc-config/issues/8)) ([cb5184a](https://github.com/istanbuljs/load-nyc-config/commit/cb5184a))
## 1.0.0-alpha.0 (2019-10-06)
### Features
* Add support for loading config from ESM modules ([#7](https://github.com/istanbuljs/load-nyc-config/issues/7)) ([bc5ea3e](https://github.com/istanbuljs/load-nyc-config/commit/bc5ea3e)), closes [#6](https://github.com/istanbuljs/load-nyc-config/issues/6)
* Initial implementation ([ff90134](https://github.com/istanbuljs/load-nyc-config/commit/ff90134))

16
node_modules/@istanbuljs/load-nyc-config/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,16 @@
ISC License
Copyright (c) 2019, Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice
appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

64
node_modules/@istanbuljs/load-nyc-config/README.md generated vendored Normal file
View File

@@ -0,0 +1,64 @@
# @istanbuljs/load-nyc-config
The utility function which NYC uses to load configuration.
This can be used by outside programs to calculate the configuration.
Command-line arguments are not considered by this function.
```js
const {loadNycConfig} = require('@istanbuljs/load-nyc-config');
(async () {
console.log(await loadNycConfig());
})();
```
## loadNycConfig([options])
### options.cwd
Type: `string`
Default: `cwd` from parent nyc process or `process.cwd()`
### options.nycrcPath
Type: `string`
Default: `undefined`
Name of the file containing nyc configuration.
This can be a relative or absolute path.
Relative paths can exist at `options.cwd` or any parent directory.
If an nycrc is specified but cannot be found an exception is thrown.
If no nycrc option is provided the default priority of config files are:
* .nycrc
* .nycrc.json
* .nycrc.yml
* .nycrc.yaml
* nyc.config.js
* nyc.config.cjs
* nyc.config.mjs
## Configuration merging
Configuration is first loaded from `package.json` if found, this serves as the package
defaults. These options can be overridden by an nycrc if found. Arrays are not merged,
so if `package.json` sets `"require": ["@babel/register"]` and `.nycrc` sets `"require": ["esm"]`
the effective require setting will only include `"esm"`.
## isLoading
```js
const {isLoading} = require('@istanbuljs/load-nyc-config');
console.log(isLoading());
```
In some cases source transformation hooks can get installed before the configuration is
loaded. This allows hooks to ignore source loads that occur during configuration load.
## `@istanbuljs/load-nyc-config` for enterprise
Available as part of the Tidelift Subscription.
The maintainers of `@istanbuljs/load-nyc-config` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-istanbuljs-load-nyc-config?utm_source=npm-istanbuljs-load-nyc-config&utm_medium=referral&utm_campaign=enterprise)

166
node_modules/@istanbuljs/load-nyc-config/index.js generated vendored Normal file
View File

@@ -0,0 +1,166 @@
'use strict';
const fs = require('fs');
const path = require('path');
const {promisify} = require('util');
const camelcase = require('camelcase');
const findUp = require('find-up');
const resolveFrom = require('resolve-from');
const getPackageType = require('get-package-type');
const readFile = promisify(fs.readFile);
let loadActive = false;
function isLoading() {
return loadActive;
}
const standardConfigFiles = [
'.nycrc',
'.nycrc.json',
'.nycrc.yml',
'.nycrc.yaml',
'nyc.config.js',
'nyc.config.cjs',
'nyc.config.mjs'
];
function camelcasedConfig(config) {
const results = {};
for (const [field, value] of Object.entries(config)) {
results[camelcase(field)] = value;
}
return results;
}
async function findPackage(options) {
const cwd = options.cwd || process.env.NYC_CWD || process.cwd();
const pkgPath = await findUp('package.json', {cwd});
if (pkgPath) {
const pkgConfig = JSON.parse(await readFile(pkgPath, 'utf8')).nyc || {};
if ('cwd' in pkgConfig) {
pkgConfig.cwd = path.resolve(path.dirname(pkgPath), pkgConfig.cwd);
}
return {
cwd: path.dirname(pkgPath),
pkgConfig
};
}
return {
cwd,
pkgConfig: {}
};
}
async function actualLoad(configFile) {
if (!configFile) {
return {};
}
const configExt = path.extname(configFile).toLowerCase();
switch (configExt) {
case '.js':
/* istanbul ignore next: coverage for 13.2.0+ is shown in load-esm.js */
if (await getPackageType(configFile) === 'module') {
return require('./load-esm')(configFile);
}
/* fallthrough */
case '.cjs':
return require(configFile);
/* istanbul ignore next: coverage for 13.2.0+ is shown in load-esm.js */
case '.mjs':
return require('./load-esm')(configFile);
case '.yml':
case '.yaml':
return require('js-yaml').load(await readFile(configFile, 'utf8'));
default:
return JSON.parse(await readFile(configFile, 'utf8'));
}
}
async function loadFile(configFile) {
/* This lets @istanbuljs/esm-loader-hook avoid circular initialization when loading
* configuration. This should generally only happen when the loader hook is active
* on the main nyc process. */
loadActive = true;
try {
return await actualLoad(configFile);
} finally {
loadActive = false;
}
}
async function applyExtends(config, filename, loopCheck = new Set()) {
config = camelcasedConfig(config);
if ('extends' in config) {
const extConfigs = [].concat(config.extends);
if (extConfigs.some(e => typeof e !== 'string')) {
throw new TypeError(`${filename} contains an invalid 'extends' option`);
}
delete config.extends;
const filePath = path.dirname(filename);
for (const extConfig of extConfigs) {
const configFile = resolveFrom.silent(filePath, extConfig) ||
resolveFrom.silent(filePath, './' + extConfig);
if (!configFile) {
throw new Error(`Could not resolve configuration file ${extConfig} from ${path.dirname(filename)}.`);
}
if (loopCheck.has(configFile)) {
throw new Error(`Circular extended configurations: '${configFile}'.`);
}
loopCheck.add(configFile);
// eslint-disable-next-line no-await-in-loop
const configLoaded = await loadFile(configFile);
if ('cwd' in configLoaded) {
configLoaded.cwd = path.resolve(path.dirname(configFile), configLoaded.cwd);
}
Object.assign(
config,
// eslint-disable-next-line no-await-in-loop
await applyExtends(configLoaded, configFile, loopCheck)
);
}
}
return config;
}
async function loadNycConfig(options = {}) {
const {cwd, pkgConfig} = await findPackage(options);
const configFiles = [].concat(options.nycrcPath || standardConfigFiles);
const configFile = await findUp(configFiles, {cwd});
if (options.nycrcPath && !configFile) {
throw new Error(`Requested configuration file ${options.nycrcPath} not found`);
}
const config = {
cwd,
...(await applyExtends(pkgConfig, path.join(cwd, 'package.json'))),
...(await applyExtends(await loadFile(configFile), configFile))
};
const arrayFields = ['require', 'extension', 'exclude', 'include'];
for (const arrayField of arrayFields) {
if (config[arrayField]) {
config[arrayField] = [].concat(config[arrayField]);
}
}
return config;
}
module.exports = {
loadNycConfig,
isLoading
};

12
node_modules/@istanbuljs/load-nyc-config/load-esm.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
'use strict';
const {pathToFileURL} = require('url');
module.exports = async filename => {
const mod = await import(pathToFileURL(filename));
if ('default' in mod === false) {
throw new Error(`${filename} has no default export`);
}
return mod.default;
};

View File

@@ -0,0 +1,31 @@
declare const resolveFrom: {
/**
Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path.
@param fromDirectory - Directory to resolve from.
@param moduleId - What you would use in `require()`.
@returns Resolved module path. Throws when the module can't be found.
@example
```
import resolveFrom = require('resolve-from');
// There is a file at `./foo/bar.js`
resolveFrom('foo', './bar');
//=> '/Users/sindresorhus/dev/test/foo/bar.js'
```
*/
(fromDirectory: string, moduleId: string): string;
/**
Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path.
@param fromDirectory - Directory to resolve from.
@param moduleId - What you would use in `require()`.
@returns Resolved module path or `undefined` when the module can't be found.
*/
silent(fromDirectory: string, moduleId: string): string | undefined;
};
export = resolveFrom;

View File

@@ -0,0 +1,47 @@
'use strict';
const path = require('path');
const Module = require('module');
const fs = require('fs');
const resolveFrom = (fromDirectory, moduleId, silent) => {
if (typeof fromDirectory !== 'string') {
throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``);
}
if (typeof moduleId !== 'string') {
throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
}
try {
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);

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.

View File

@@ -0,0 +1,36 @@
{
"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"
}
}

View File

@@ -0,0 +1,72 @@
# 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()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path
## Install
```
$ npm install resolve-from
```
## Usage
```js
const resolveFrom = require('resolve-from');
// There is a file at `./foo/bar.js`
resolveFrom('foo', './bar');
//=> '/Users/sindresorhus/dev/test/foo/bar.js'
```
## API
### resolveFrom(fromDirectory, moduleId)
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`
Directory to resolve from.
#### moduleId
Type: `string`
What you would use in `require()`.
## Tip
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');
resolveFromFoo('./bar');
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](https://sindresorhus.com)

49
node_modules/@istanbuljs/load-nyc-config/package.json generated vendored Normal file
View File

@@ -0,0 +1,49 @@
{
"name": "@istanbuljs/load-nyc-config",
"version": "1.1.0",
"description": "Utility function to load nyc configuration",
"main": "index.js",
"scripts": {
"pretest": "xo",
"test": "tap",
"snap": "npm test -- --snapshot",
"release": "standard-version"
},
"engines": {
"node": ">=8"
},
"license": "ISC",
"repository": {
"type": "git",
"url": "git+https://github.com/istanbuljs/load-nyc-config.git"
},
"bugs": {
"url": "https://github.com/istanbuljs/load-nyc-config/issues"
},
"homepage": "https://github.com/istanbuljs/load-nyc-config#readme",
"dependencies": {
"camelcase": "^5.3.1",
"find-up": "^4.1.0",
"get-package-type": "^0.1.0",
"js-yaml": "^3.13.1",
"resolve-from": "^5.0.0"
},
"devDependencies": {
"semver": "^6.3.0",
"standard-version": "^7.0.0",
"tap": "^14.10.5",
"xo": "^0.25.3"
},
"xo": {
"ignores": [
"test/fixtures/extends/invalid.*"
],
"rules": {
"require-atomic-updates": 0,
"capitalized-comments": 0,
"unicorn/import-index": 0,
"import/extensions": 0,
"import/no-useless-path-segments": 0
}
}
}