0.2.0 - Mid migration

This commit is contained in:
Daniel Mason 2022-04-25 14:47:15 +12:00
parent 139e6a915e
commit 7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions

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
web/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
web/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
web/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
};

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,63 @@
declare namespace camelcase {
interface Options {
/**
Uppercase the first character: `foo-bar` `FooBar`.
@default false
*/
readonly pascalCase?: boolean;
}
}
declare const camelcase: {
/**
Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` `fooBar`.
@param input - String to convert to camel case.
@example
```
import camelCase = require('camelcase');
camelCase('foo-bar');
//=> 'fooBar'
camelCase('foo_bar');
//=> 'fooBar'
camelCase('Foo-Bar');
//=> 'fooBar'
camelCase('Foo-Bar', {pascalCase: true});
//=> 'FooBar'
camelCase('--foo.bar', {pascalCase: false});
//=> 'fooBar'
camelCase('foo bar');
//=> 'fooBar'
console.log(process.argv[3]);
//=> '--foo-bar'
camelCase(process.argv[3]);
//=> 'fooBar'
camelCase(['foo', 'bar']);
//=> 'fooBar'
camelCase(['__foo__', '--bar'], {pascalCase: true});
//=> 'FooBar'
```
*/
(input: string | ReadonlyArray<string>, options?: camelcase.Options): string;
// TODO: Remove this for the next major release, refactor the whole definition to:
// declare function camelcase(
// input: string | ReadonlyArray<string>,
// options?: camelcase.Options
// ): string;
// export = camelcase;
default: typeof camelcase;
};
export = camelcase;

View file

@ -0,0 +1,76 @@
'use strict';
const preserveCamelCase = string => {
let isLastCharLower = false;
let isLastCharUpper = false;
let isLastLastCharUpper = false;
for (let i = 0; i < string.length; i++) {
const character = string[i];
if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) {
string = string.slice(0, i) + '-' + string.slice(i);
isLastCharLower = false;
isLastLastCharUpper = isLastCharUpper;
isLastCharUpper = true;
i++;
} else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) {
string = string.slice(0, i - 1) + '-' + string.slice(i - 1);
isLastLastCharUpper = isLastCharUpper;
isLastCharUpper = false;
isLastCharLower = true;
} else {
isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character;
isLastLastCharUpper = isLastCharUpper;
isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character;
}
}
return string;
};
const camelCase = (input, options) => {
if (!(typeof input === 'string' || Array.isArray(input))) {
throw new TypeError('Expected the input to be `string | string[]`');
}
options = Object.assign({
pascalCase: false
}, options);
const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x;
if (Array.isArray(input)) {
input = input.map(x => x.trim())
.filter(x => x.length)
.join('-');
} else {
input = input.trim();
}
if (input.length === 0) {
return '';
}
if (input.length === 1) {
return options.pascalCase ? input.toUpperCase() : input.toLowerCase();
}
const hasUpperCase = input !== input.toLowerCase();
if (hasUpperCase) {
input = preserveCamelCase(input);
}
input = input
.replace(/^[_.\- ]+/, '')
.toLowerCase()
.replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase())
.replace(/\d+(\w|$)/g, m => m.toUpperCase());
return postProcess(input);
};
module.exports = camelCase;
// TODO: Remove this for the next major release
module.exports.default = camelCase;

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,43 @@
{
"name": "camelcase",
"version": "5.3.1",
"description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`",
"license": "MIT",
"repository": "sindresorhus/camelcase",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"camelcase",
"camel-case",
"camel",
"case",
"dash",
"hyphen",
"dot",
"underscore",
"separator",
"string",
"text",
"convert",
"pascalcase",
"pascal-case"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.1",
"xo": "^0.24.0"
}
}

View file

@ -0,0 +1,99 @@
# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase)
> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar``fooBar`
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-camelcase?utm_source=npm-camelcase&utm_medium=referral&utm_campaign=readme">Get professional support for 'camelcase' with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
---
## Install
```
$ npm install camelcase
```
## Usage
```js
const camelCase = require('camelcase');
camelCase('foo-bar');
//=> 'fooBar'
camelCase('foo_bar');
//=> 'fooBar'
camelCase('Foo-Bar');
//=> 'fooBar'
camelCase('Foo-Bar', {pascalCase: true});
//=> 'FooBar'
camelCase('--foo.bar', {pascalCase: false});
//=> 'fooBar'
camelCase('foo bar');
//=> 'fooBar'
console.log(process.argv[3]);
//=> '--foo-bar'
camelCase(process.argv[3]);
//=> 'fooBar'
camelCase(['foo', 'bar']);
//=> 'fooBar'
camelCase(['__foo__', '--bar'], {pascalCase: true});
//=> 'FooBar'
```
## API
### camelCase(input, [options])
#### input
Type: `string` `string[]`
String to convert to camel case.
#### options
Type: `Object`
##### pascalCase
Type: `boolean`<br>
Default: `false`
Uppercase the first character: `foo-bar``FooBar`
## Security
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
## Related
- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string
- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

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
}
}
}