WIP - add extractor, generate snippet_data
This commit is contained in:
21
node_modules/jest-validate/LICENSE
generated
vendored
Normal file
21
node_modules/jest-validate/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Facebook, Inc. and its affiliates.
|
||||
|
||||
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.
|
||||
193
node_modules/jest-validate/README.md
generated
vendored
Normal file
193
node_modules/jest-validate/README.md
generated
vendored
Normal file
@ -0,0 +1,193 @@
|
||||
# jest-validate
|
||||
|
||||
Generic configuration validation tool that helps you with warnings, errors and deprecation messages as well as showing users examples of correct configuration.
|
||||
|
||||
```bash
|
||||
npm install --save jest-validate
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import {validate} from 'jest-validate';
|
||||
|
||||
validate((config: Object), (options: ValidationOptions)); // => {hasDeprecationWarnings: boolean, isValid: boolean}
|
||||
```
|
||||
|
||||
Where `ValidationOptions` are:
|
||||
|
||||
```js
|
||||
type ValidationOptions = {
|
||||
blacklist?: Array<string>,
|
||||
comment?: string,
|
||||
condition?: (option: any, validOption: any) => boolean,
|
||||
deprecate?: (
|
||||
config: Object,
|
||||
option: string,
|
||||
deprecatedOptions: Object,
|
||||
options: ValidationOptions,
|
||||
) => true,
|
||||
deprecatedConfig?: {[key: string]: Function},
|
||||
error?: (
|
||||
option: string,
|
||||
received: any,
|
||||
defaultValue: any,
|
||||
options: ValidationOptions,
|
||||
) => void,
|
||||
exampleConfig: Object,
|
||||
recursive?: boolean,
|
||||
title?: Title,
|
||||
unknown?: (
|
||||
config: Object,
|
||||
exampleConfig: Object,
|
||||
option: string,
|
||||
options: ValidationOptions,
|
||||
) => void,
|
||||
};
|
||||
|
||||
type Title = {|
|
||||
deprecation?: string,
|
||||
error?: string,
|
||||
warning?: string,
|
||||
|};
|
||||
```
|
||||
|
||||
`exampleConfig` is the only option required.
|
||||
|
||||
## API
|
||||
|
||||
By default `jest-validate` will print generic warning and error messages. You can however customize this behavior by providing `options: ValidationOptions` object as a second argument:
|
||||
|
||||
Almost anything can be overwritten to suite your needs.
|
||||
|
||||
### Options
|
||||
|
||||
- `recursiveBlacklist` – optional array of string keyPaths that should be excluded from deep (recursive) validation.
|
||||
- `comment` – optional string to be rendered below error/warning message.
|
||||
- `condition` – an optional function with validation condition.
|
||||
- `deprecate`, `error`, `unknown` – optional functions responsible for displaying warning and error messages.
|
||||
- `deprecatedConfig` – optional object with deprecated config keys.
|
||||
- `exampleConfig` – the only **required** option with configuration against which you'd like to test.
|
||||
- `recursive` - optional boolean determining whether recursively compare `exampleConfig` to `config` (default: `true`).
|
||||
- `title` – optional object of titles for errors and messages.
|
||||
|
||||
You will find examples of `condition`, `deprecate`, `error`, `unknown`, and `deprecatedConfig` inside source of this repository, named respectively.
|
||||
|
||||
## exampleConfig syntax
|
||||
|
||||
`exampleConfig` should be an object with key/value pairs that contain an example of a valid value for each key. A configuration value is considered valid when:
|
||||
|
||||
- it matches the JavaScript type of the example value, e.g. `string`, `number`, `array`, `boolean`, `function`, or `object`
|
||||
- it is `null` or `undefined`
|
||||
- it matches the Javascript type of any of arguments passed to `MultipleValidOptions(...)`
|
||||
|
||||
The last condition is a special syntax that allows validating where more than one type is permissible; see example below. It's acceptable to have multiple values of the same type in the example, so you can also use this syntax to provide more than one example. When a validation failure occurs, the error message will show all other values in the array as examples.
|
||||
|
||||
## Examples
|
||||
|
||||
Minimal example:
|
||||
|
||||
```js
|
||||
validate(config, {exampleConfig});
|
||||
```
|
||||
|
||||
Example with slight modifications:
|
||||
|
||||
```js
|
||||
validate(config, {
|
||||
comment: ' Documentation: http://custom-docs.com',
|
||||
deprecatedConfig,
|
||||
exampleConfig,
|
||||
title: {
|
||||
deprecation: 'Custom Deprecation',
|
||||
// leaving 'error' and 'warning' as default
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
This will output:
|
||||
|
||||
#### Warning:
|
||||
|
||||
```bash
|
||||
● Validation Warning:
|
||||
|
||||
Unknown option transformx with value "<rootDir>/node_modules/babel-jest" was found.
|
||||
This is either a typing error or a user mistake. Fixing it will remove this message.
|
||||
|
||||
Documentation: http://custom-docs.com
|
||||
```
|
||||
|
||||
#### Error:
|
||||
|
||||
```bash
|
||||
● Validation Error:
|
||||
|
||||
Option transform must be of type:
|
||||
object
|
||||
but instead received:
|
||||
string
|
||||
|
||||
Example:
|
||||
{
|
||||
"transform": {
|
||||
"^.+\\.js$": "<rootDir>/preprocessor.js"
|
||||
}
|
||||
}
|
||||
|
||||
Documentation: http://custom-docs.com
|
||||
```
|
||||
|
||||
## Example validating multiple types
|
||||
|
||||
```js
|
||||
import {multipleValidOptions} from 'jest-validate';
|
||||
|
||||
validate(config, {
|
||||
// `bar` will accept either a string or a number
|
||||
bar: multipleValidOptions('string is ok', 2),
|
||||
});
|
||||
```
|
||||
|
||||
#### Error:
|
||||
|
||||
```bash
|
||||
● Validation Error:
|
||||
|
||||
Option foo must be of type:
|
||||
string or number
|
||||
but instead received:
|
||||
array
|
||||
|
||||
Example:
|
||||
{
|
||||
"bar": "string is ok"
|
||||
}
|
||||
|
||||
or
|
||||
|
||||
{
|
||||
"bar": 2
|
||||
}
|
||||
|
||||
Documentation: http://custom-docs.com
|
||||
```
|
||||
|
||||
#### Deprecation
|
||||
|
||||
Based on `deprecatedConfig` object with proper deprecation messages. Note custom title:
|
||||
|
||||
```bash
|
||||
Custom Deprecation:
|
||||
|
||||
Option scriptPreprocessor was replaced by transform, which support multiple preprocessors.
|
||||
|
||||
Jest now treats your current configuration as:
|
||||
{
|
||||
"transform": {".*": "xxx"}
|
||||
}
|
||||
|
||||
Please update your configuration.
|
||||
|
||||
Documentation: http://custom-docs.com
|
||||
```
|
||||
10
node_modules/jest-validate/build/condition.d.ts
generated
vendored
Normal file
10
node_modules/jest-validate/build/condition.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
export declare function getValues(validOption: any): any[];
|
||||
export declare function validationCondition(option: any, validOption: any): boolean;
|
||||
export declare function multipleValidOptions<T extends Array<any>>(...args: T): T[number];
|
||||
//# sourceMappingURL=condition.d.ts.map
|
||||
1
node_modules/jest-validate/build/condition.d.ts.map
generated
vendored
Normal file
1
node_modules/jest-validate/build/condition.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"condition.d.ts","sourceRoot":"","sources":["../src/condition.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,wBAAgB,SAAS,CAAC,WAAW,EAAE,GAAG,SASzC;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,GAAG,OAAO,CAE1E;AAED,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,EACvD,GAAG,IAAI,EAAE,CAAC,GACT,CAAC,CAAC,MAAM,CAAC,CAKX"}
|
||||
48
node_modules/jest-validate/build/condition.js
generated
vendored
Normal file
48
node_modules/jest-validate/build/condition.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.getValues = getValues;
|
||||
exports.validationCondition = validationCondition;
|
||||
exports.multipleValidOptions = multipleValidOptions;
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
const toString = Object.prototype.toString;
|
||||
const MULTIPLE_VALID_OPTIONS_SYMBOL = Symbol('JEST_MULTIPLE_VALID_OPTIONS');
|
||||
|
||||
function validationConditionSingle(option, validOption) {
|
||||
return (
|
||||
option === null ||
|
||||
option === undefined ||
|
||||
(typeof option === 'function' && typeof validOption === 'function') ||
|
||||
toString.call(option) === toString.call(validOption)
|
||||
);
|
||||
}
|
||||
|
||||
function getValues(validOption) {
|
||||
if (
|
||||
Array.isArray(validOption) && // @ts-ignore
|
||||
validOption[MULTIPLE_VALID_OPTIONS_SYMBOL]
|
||||
) {
|
||||
return validOption;
|
||||
}
|
||||
|
||||
return [validOption];
|
||||
}
|
||||
|
||||
function validationCondition(option, validOption) {
|
||||
return getValues(validOption).some(e => validationConditionSingle(option, e));
|
||||
}
|
||||
|
||||
function multipleValidOptions(...args) {
|
||||
const options = [...args]; // @ts-ignore
|
||||
|
||||
options[MULTIPLE_VALID_OPTIONS_SYMBOL] = true;
|
||||
return options;
|
||||
}
|
||||
10
node_modules/jest-validate/build/defaultConfig.d.ts
generated
vendored
Normal file
10
node_modules/jest-validate/build/defaultConfig.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { ValidationOptions } from './types';
|
||||
declare const validationOptions: ValidationOptions;
|
||||
export default validationOptions;
|
||||
//# sourceMappingURL=defaultConfig.d.ts.map
|
||||
1
node_modules/jest-validate/build/defaultConfig.d.ts.map
generated
vendored
Normal file
1
node_modules/jest-validate/build/defaultConfig.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"defaultConfig.d.ts","sourceRoot":"","sources":["../src/defaultConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAQ1C,QAAA,MAAM,iBAAiB,EAAE,iBAgBxB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
||||
42
node_modules/jest-validate/build/defaultConfig.js
generated
vendored
Normal file
42
node_modules/jest-validate/build/defaultConfig.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _deprecated = require('./deprecated');
|
||||
|
||||
var _warnings = require('./warnings');
|
||||
|
||||
var _errors = require('./errors');
|
||||
|
||||
var _condition = require('./condition');
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
const validationOptions = {
|
||||
comment: '',
|
||||
condition: _condition.validationCondition,
|
||||
deprecate: _deprecated.deprecationWarning,
|
||||
deprecatedConfig: {},
|
||||
error: _errors.errorMessage,
|
||||
exampleConfig: {},
|
||||
recursive: true,
|
||||
// Allow NPM-sanctioned comments in package.json. Use a "//" key.
|
||||
recursiveBlacklist: ['//'],
|
||||
title: {
|
||||
deprecation: _utils.DEPRECATION,
|
||||
error: _utils.ERROR,
|
||||
warning: _utils.WARNING
|
||||
},
|
||||
unknown: _warnings.unknownOptionWarning
|
||||
};
|
||||
var _default = validationOptions;
|
||||
exports.default = _default;
|
||||
9
node_modules/jest-validate/build/deprecated.d.ts
generated
vendored
Normal file
9
node_modules/jest-validate/build/deprecated.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { ValidationOptions } from './types';
|
||||
export declare const deprecationWarning: (config: Record<string, any>, option: string, deprecatedOptions: Record<string, Function>, options: ValidationOptions) => boolean;
|
||||
//# sourceMappingURL=deprecated.d.ts.map
|
||||
1
node_modules/jest-validate/build/deprecated.d.ts.map
generated
vendored
Normal file
1
node_modules/jest-validate/build/deprecated.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"deprecated.d.ts","sourceRoot":"","sources":["../src/deprecated.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAoB,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAW7D,eAAO,MAAM,kBAAkB,mIAa9B,CAAC"}
|
||||
32
node_modules/jest-validate/build/deprecated.js
generated
vendored
Normal file
32
node_modules/jest-validate/build/deprecated.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.deprecationWarning = void 0;
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
const deprecationMessage = (message, options) => {
|
||||
const comment = options.comment;
|
||||
const name =
|
||||
(options.title && options.title.deprecation) || _utils.DEPRECATION;
|
||||
(0, _utils.logValidationWarning)(name, message, comment);
|
||||
};
|
||||
|
||||
const deprecationWarning = (config, option, deprecatedOptions, options) => {
|
||||
if (option in deprecatedOptions) {
|
||||
deprecationMessage(deprecatedOptions[option](config), options);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
exports.deprecationWarning = deprecationWarning;
|
||||
9
node_modules/jest-validate/build/errors.d.ts
generated
vendored
Normal file
9
node_modules/jest-validate/build/errors.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { ValidationOptions } from './types';
|
||||
export declare const errorMessage: (option: string, received: any, defaultValue: any, options: ValidationOptions, path?: string[] | undefined) => void;
|
||||
//# sourceMappingURL=errors.d.ts.map
|
||||
1
node_modules/jest-validate/build/errors.d.ts.map
generated
vendored
Normal file
1
node_modules/jest-validate/build/errors.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAE1C,eAAO,MAAM,YAAY,qHA0BxB,CAAC"}
|
||||
75
node_modules/jest-validate/build/errors.js
generated
vendored
Normal file
75
node_modules/jest-validate/build/errors.js
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.errorMessage = void 0;
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
|
||||
_chalk = function _chalk() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestGetType() {
|
||||
const data = _interopRequireDefault(require('jest-get-type'));
|
||||
|
||||
_jestGetType = function _jestGetType() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
var _condition = require('./condition');
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
const errorMessage = (option, received, defaultValue, options, path) => {
|
||||
const conditions = (0, _condition.getValues)(defaultValue);
|
||||
const validTypes = Array.from(
|
||||
new Set(conditions.map(_jestGetType().default))
|
||||
);
|
||||
const message = ` Option ${_chalk().default.bold(
|
||||
`"${path && path.length > 0 ? path.join('.') + '.' : ''}${option}"`
|
||||
)} must be of type:
|
||||
${validTypes.map(e => _chalk().default.bold.green(e)).join(' or ')}
|
||||
but instead received:
|
||||
${_chalk().default.bold.red((0, _jestGetType().default)(received))}
|
||||
|
||||
Example:
|
||||
${formatExamples(option, conditions)}`;
|
||||
const comment = options.comment;
|
||||
const name = (options.title && options.title.error) || _utils.ERROR;
|
||||
throw new _utils.ValidationError(name, message, comment);
|
||||
};
|
||||
|
||||
exports.errorMessage = errorMessage;
|
||||
|
||||
function formatExamples(option, examples) {
|
||||
return examples.map(
|
||||
e => ` {
|
||||
${_chalk().default.bold(`"${option}"`)}: ${_chalk().default.bold(
|
||||
(0, _utils.formatPrettyObject)(e)
|
||||
)}
|
||||
}`
|
||||
).join(`
|
||||
|
||||
or
|
||||
|
||||
`);
|
||||
}
|
||||
10
node_modules/jest-validate/build/exampleConfig.d.ts
generated
vendored
Normal file
10
node_modules/jest-validate/build/exampleConfig.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { ValidationOptions } from './types';
|
||||
declare const config: ValidationOptions;
|
||||
export default config;
|
||||
//# sourceMappingURL=exampleConfig.d.ts.map
|
||||
1
node_modules/jest-validate/build/exampleConfig.d.ts.map
generated
vendored
Normal file
1
node_modules/jest-validate/build/exampleConfig.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"exampleConfig.d.ts","sourceRoot":"","sources":["../src/exampleConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAE1C,QAAA,MAAM,MAAM,EAAE,iBAiBb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
||||
36
node_modules/jest-validate/build/exampleConfig.js
generated
vendored
Normal file
36
node_modules/jest-validate/build/exampleConfig.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
const config = {
|
||||
comment: ' A comment',
|
||||
condition: () => true,
|
||||
deprecate: () => false,
|
||||
deprecatedConfig: {
|
||||
key: () => {}
|
||||
},
|
||||
error: () => {},
|
||||
exampleConfig: {
|
||||
key: 'value',
|
||||
test: 'case'
|
||||
},
|
||||
recursive: true,
|
||||
recursiveBlacklist: [],
|
||||
title: {
|
||||
deprecation: 'Deprecation Warning',
|
||||
error: 'Validation Error',
|
||||
warning: 'Validation Warning'
|
||||
},
|
||||
unknown: () => {}
|
||||
};
|
||||
var _default = config;
|
||||
exports.default = _default;
|
||||
23
node_modules/jest-validate/build/index.d.ts
generated
vendored
Normal file
23
node_modules/jest-validate/build/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { ValidationError } from './utils';
|
||||
import validateCLIOptions from './validateCLIOptions';
|
||||
import { multipleValidOptions } from './condition';
|
||||
declare const _default: {
|
||||
ValidationError: typeof ValidationError;
|
||||
createDidYouMeanMessage: (unrecognized: string, allowedOptions: string[]) => string;
|
||||
format: (value: any) => string;
|
||||
logValidationWarning: (name: string, message: string, comment?: string | null | undefined) => void;
|
||||
multipleValidOptions: typeof multipleValidOptions;
|
||||
validate: (config: Record<string, any>, options: import("./types").ValidationOptions) => {
|
||||
hasDeprecationWarnings: boolean;
|
||||
isValid: boolean;
|
||||
};
|
||||
validateCLIOptions: typeof validateCLIOptions;
|
||||
};
|
||||
export = _default;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/jest-validate/build/index.d.ts.map
generated
vendored
Normal file
1
node_modules/jest-validate/build/index.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAIL,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;;;;;;;;;;;;;AAEjD,kBAQE"}
|
||||
31
node_modules/jest-validate/build/index.js
generated
vendored
Normal file
31
node_modules/jest-validate/build/index.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
var _validate = _interopRequireDefault(require('./validate'));
|
||||
|
||||
var _validateCLIOptions = _interopRequireDefault(
|
||||
require('./validateCLIOptions')
|
||||
);
|
||||
|
||||
var _condition = require('./condition');
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
module.exports = {
|
||||
ValidationError: _utils.ValidationError,
|
||||
createDidYouMeanMessage: _utils.createDidYouMeanMessage,
|
||||
format: _utils.format,
|
||||
logValidationWarning: _utils.logValidationWarning,
|
||||
multipleValidOptions: _condition.multipleValidOptions,
|
||||
validate: _validate.default,
|
||||
validateCLIOptions: _validateCLIOptions.default
|
||||
};
|
||||
26
node_modules/jest-validate/build/types.d.ts
generated
vendored
Normal file
26
node_modules/jest-validate/build/types.d.ts
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
declare type Title = {
|
||||
deprecation?: string;
|
||||
error?: string;
|
||||
warning?: string;
|
||||
};
|
||||
export declare type DeprecatedOptions = Record<string, Function>;
|
||||
export declare type ValidationOptions = {
|
||||
comment?: string;
|
||||
condition?: (option: any, validOption: any) => boolean;
|
||||
deprecate?: (config: Record<string, any>, option: string, deprecatedOptions: DeprecatedOptions, options: ValidationOptions) => boolean;
|
||||
deprecatedConfig?: DeprecatedOptions;
|
||||
error?: (option: string, received: any, defaultValue: any, options: ValidationOptions, path?: Array<string>) => void;
|
||||
exampleConfig: Record<string, any>;
|
||||
recursive?: boolean;
|
||||
recursiveBlacklist?: Array<string>;
|
||||
title?: Title;
|
||||
unknown?: (config: Record<string, any>, exampleConfig: Record<string, any>, option: string, options: ValidationOptions, path?: Array<string>) => void;
|
||||
};
|
||||
export {};
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
1
node_modules/jest-validate/build/types.d.ts.map
generated
vendored
Normal file
1
node_modules/jest-validate/build/types.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,aAAK,KAAK,GAAG;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,oBAAY,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEzD,oBAAY,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,KAAK,OAAO,CAAC;IACvD,SAAS,CAAC,EAAE,CACV,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,EAAE,iBAAiB,KACvB,OAAO,CAAC;IACb,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;IACrC,KAAK,CAAC,EAAE,CACN,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,GAAG,EACb,YAAY,EAAE,GAAG,EACjB,OAAO,EAAE,iBAAiB,EAC1B,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,KACjB,IAAI,CAAC;IACV,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,CACR,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAClC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,EAC1B,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,KACjB,IAAI,CAAC;CACX,CAAC"}
|
||||
1
node_modules/jest-validate/build/types.js
generated
vendored
Normal file
1
node_modules/jest-validate/build/types.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
'use strict';
|
||||
19
node_modules/jest-validate/build/utils.d.ts
generated
vendored
Normal file
19
node_modules/jest-validate/build/utils.d.ts
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
export declare const DEPRECATION: string;
|
||||
export declare const ERROR: string;
|
||||
export declare const WARNING: string;
|
||||
export declare const format: (value: any) => string;
|
||||
export declare const formatPrettyObject: (value: any) => string;
|
||||
export declare class ValidationError extends Error {
|
||||
name: string;
|
||||
message: string;
|
||||
constructor(name: string, message: string, comment?: string | null);
|
||||
}
|
||||
export declare const logValidationWarning: (name: string, message: string, comment?: string | null | undefined) => void;
|
||||
export declare const createDidYouMeanMessage: (unrecognized: string, allowedOptions: string[]) => string;
|
||||
//# sourceMappingURL=utils.d.ts.map
|
||||
1
node_modules/jest-validate/build/utils.d.ts.map
generated
vendored
Normal file
1
node_modules/jest-validate/build/utils.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,eAAO,MAAM,WAAW,QAAkC,CAAC;AAC3D,eAAO,MAAM,KAAK,QAA+B,CAAC;AAClD,eAAO,MAAM,OAAO,QAAiC,CAAC;AAEtD,eAAO,MAAM,MAAM,wBAGmB,CAAC;AAEvC,eAAO,MAAM,kBAAkB,wBAKR,CAAC;AAExB,qBAAa,eAAgB,SAAQ,KAAK;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;gBAEJ,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;CAOnE;AAED,eAAO,MAAM,oBAAoB,8EAOhC,CAAC;AAEF,eAAO,MAAM,uBAAuB,4DAUnC,CAAC"}
|
||||
123
node_modules/jest-validate/build/utils.js
generated
vendored
Normal file
123
node_modules/jest-validate/build/utils.js
generated
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.createDidYouMeanMessage = exports.logValidationWarning = exports.ValidationError = exports.formatPrettyObject = exports.format = exports.WARNING = exports.ERROR = exports.DEPRECATION = void 0;
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
|
||||
_chalk = function _chalk() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _prettyFormat() {
|
||||
const data = _interopRequireDefault(require('pretty-format'));
|
||||
|
||||
_prettyFormat = function _prettyFormat() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _leven() {
|
||||
const data = _interopRequireDefault(require('leven'));
|
||||
|
||||
_leven = function _leven() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
const BULLET = _chalk().default.bold('\u25cf');
|
||||
|
||||
const DEPRECATION = `${BULLET} Deprecation Warning`;
|
||||
exports.DEPRECATION = DEPRECATION;
|
||||
const ERROR = `${BULLET} Validation Error`;
|
||||
exports.ERROR = ERROR;
|
||||
const WARNING = `${BULLET} Validation Warning`;
|
||||
exports.WARNING = WARNING;
|
||||
|
||||
const format = value =>
|
||||
typeof value === 'function'
|
||||
? value.toString()
|
||||
: (0, _prettyFormat().default)(value, {
|
||||
min: true
|
||||
});
|
||||
|
||||
exports.format = format;
|
||||
|
||||
const formatPrettyObject = value =>
|
||||
typeof value === 'function'
|
||||
? value.toString()
|
||||
: JSON.stringify(value, null, 2)
|
||||
.split('\n')
|
||||
.join('\n ');
|
||||
|
||||
exports.formatPrettyObject = formatPrettyObject;
|
||||
|
||||
class ValidationError extends Error {
|
||||
constructor(name, message, comment) {
|
||||
super();
|
||||
|
||||
_defineProperty(this, 'name', void 0);
|
||||
|
||||
_defineProperty(this, 'message', void 0);
|
||||
|
||||
comment = comment ? '\n\n' + comment : '\n';
|
||||
this.name = '';
|
||||
this.message = _chalk().default.red(
|
||||
_chalk().default.bold(name) + ':\n\n' + message + comment
|
||||
);
|
||||
Error.captureStackTrace(this, () => {});
|
||||
}
|
||||
}
|
||||
|
||||
exports.ValidationError = ValidationError;
|
||||
|
||||
const logValidationWarning = (name, message, comment) => {
|
||||
comment = comment ? '\n\n' + comment : '\n';
|
||||
console.warn(
|
||||
_chalk().default.yellow(
|
||||
_chalk().default.bold(name) + ':\n\n' + message + comment
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
exports.logValidationWarning = logValidationWarning;
|
||||
|
||||
const createDidYouMeanMessage = (unrecognized, allowedOptions) => {
|
||||
const suggestion = allowedOptions.find(option => {
|
||||
const steps = (0, _leven().default)(option, unrecognized);
|
||||
return steps < 3;
|
||||
});
|
||||
return suggestion
|
||||
? `Did you mean ${_chalk().default.bold(format(suggestion))}?`
|
||||
: '';
|
||||
};
|
||||
|
||||
exports.createDidYouMeanMessage = createDidYouMeanMessage;
|
||||
13
node_modules/jest-validate/build/validate.d.ts
generated
vendored
Normal file
13
node_modules/jest-validate/build/validate.d.ts
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { ValidationOptions } from './types';
|
||||
declare const validate: (config: Record<string, any>, options: ValidationOptions) => {
|
||||
hasDeprecationWarnings: boolean;
|
||||
isValid: boolean;
|
||||
};
|
||||
export default validate;
|
||||
//# sourceMappingURL=validate.d.ts.map
|
||||
1
node_modules/jest-validate/build/validate.d.ts.map
generated
vendored
Normal file
1
node_modules/jest-validate/build/validate.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAC;AA0F1C,QAAA,MAAM,QAAQ;;;CA0Bb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
||||
154
node_modules/jest-validate/build/validate.js
generated
vendored
Normal file
154
node_modules/jest-validate/build/validate.js
generated
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _defaultConfig = _interopRequireDefault(require('./defaultConfig'));
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _objectSpread(target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === 'function') {
|
||||
ownKeys = ownKeys.concat(
|
||||
Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
})
|
||||
);
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
let hasDeprecationWarnings = false;
|
||||
|
||||
const shouldSkipValidationForPath = (path, key, blacklist) =>
|
||||
blacklist ? blacklist.includes([...path, key].join('.')) : false;
|
||||
|
||||
const _validate = (config, exampleConfig, options, path = []) => {
|
||||
if (
|
||||
typeof config !== 'object' ||
|
||||
config == null ||
|
||||
typeof exampleConfig !== 'object' ||
|
||||
exampleConfig == null
|
||||
) {
|
||||
return {
|
||||
hasDeprecationWarnings
|
||||
};
|
||||
}
|
||||
|
||||
for (const key in config) {
|
||||
if (
|
||||
options.deprecatedConfig &&
|
||||
key in options.deprecatedConfig &&
|
||||
typeof options.deprecate === 'function'
|
||||
) {
|
||||
const isDeprecatedKey = options.deprecate(
|
||||
config,
|
||||
key,
|
||||
options.deprecatedConfig,
|
||||
options
|
||||
);
|
||||
hasDeprecationWarnings = hasDeprecationWarnings || isDeprecatedKey;
|
||||
} else if (allowsMultipleTypes(key)) {
|
||||
const value = config[key];
|
||||
|
||||
if (
|
||||
typeof options.condition === 'function' &&
|
||||
typeof options.error === 'function'
|
||||
) {
|
||||
if (key === 'maxWorkers' && !isOfTypeStringOrNumber(value)) {
|
||||
throw new _utils.ValidationError(
|
||||
'Validation Error',
|
||||
`${key} has to be of type string or number`,
|
||||
`maxWorkers=50% or\nmaxWorkers=3`
|
||||
);
|
||||
}
|
||||
}
|
||||
} else if (Object.hasOwnProperty.call(exampleConfig, key)) {
|
||||
if (
|
||||
typeof options.condition === 'function' &&
|
||||
typeof options.error === 'function' &&
|
||||
!options.condition(config[key], exampleConfig[key])
|
||||
) {
|
||||
options.error(key, config[key], exampleConfig[key], options, path);
|
||||
}
|
||||
} else if (
|
||||
shouldSkipValidationForPath(path, key, options.recursiveBlacklist)
|
||||
) {
|
||||
// skip validating unknown options inside blacklisted paths
|
||||
} else {
|
||||
options.unknown &&
|
||||
options.unknown(config, exampleConfig, key, options, path);
|
||||
}
|
||||
|
||||
if (
|
||||
options.recursive &&
|
||||
!Array.isArray(exampleConfig[key]) &&
|
||||
options.recursiveBlacklist &&
|
||||
!shouldSkipValidationForPath(path, key, options.recursiveBlacklist)
|
||||
) {
|
||||
_validate(config[key], exampleConfig[key], options, [...path, key]);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
hasDeprecationWarnings
|
||||
};
|
||||
};
|
||||
|
||||
const allowsMultipleTypes = key => key === 'maxWorkers';
|
||||
|
||||
const isOfTypeStringOrNumber = value =>
|
||||
typeof value === 'number' || typeof value === 'string';
|
||||
|
||||
const validate = (config, options) => {
|
||||
hasDeprecationWarnings = false; // Preserve default blacklist entries even with user-supplied blacklist
|
||||
|
||||
const combinedBlacklist = [
|
||||
...(_defaultConfig.default.recursiveBlacklist || []),
|
||||
...(options.recursiveBlacklist || [])
|
||||
];
|
||||
const defaultedOptions = Object.assign(
|
||||
_objectSpread({}, _defaultConfig.default, options, {
|
||||
recursiveBlacklist: combinedBlacklist,
|
||||
title: options.title || _defaultConfig.default.title
|
||||
})
|
||||
);
|
||||
|
||||
const _validate2 = _validate(config, options.exampleConfig, defaultedOptions),
|
||||
hdw = _validate2.hasDeprecationWarnings;
|
||||
|
||||
return {
|
||||
hasDeprecationWarnings: hdw,
|
||||
isValid: true
|
||||
};
|
||||
};
|
||||
|
||||
var _default = validate;
|
||||
exports.default = _default;
|
||||
15
node_modules/jest-validate/build/validateCLIOptions.d.ts
generated
vendored
Normal file
15
node_modules/jest-validate/build/validateCLIOptions.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { Config } from '@jest/types';
|
||||
import { Options } from 'yargs';
|
||||
import { DeprecatedOptions } from './types';
|
||||
export declare const DOCUMENTATION_NOTE: string;
|
||||
export default function validateCLIOptions(argv: Config.Argv, options: {
|
||||
deprecationEntries: DeprecatedOptions;
|
||||
[s: string]: Options;
|
||||
}, rawArgv?: Array<string>): boolean;
|
||||
//# sourceMappingURL=validateCLIOptions.d.ts.map
|
||||
1
node_modules/jest-validate/build/validateCLIOptions.d.ts.map
generated
vendored
Normal file
1
node_modules/jest-validate/build/validateCLIOptions.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"validateCLIOptions.d.ts","sourceRoot":"","sources":["../src/validateCLIOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAInC,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAI9B,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAG1C,eAAO,MAAM,kBAAkB,QAE9B,CAAC;AA4CF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,OAAO,EAAE;IACP,kBAAkB,EAAE,iBAAiB,CAAC;IACtC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB,EACD,OAAO,GAAE,KAAK,CAAC,MAAM,CAAM,WA2C5B"}
|
||||
163
node_modules/jest-validate/build/validateCLIOptions.js
generated
vendored
Normal file
163
node_modules/jest-validate/build/validateCLIOptions.js
generated
vendored
Normal file
@ -0,0 +1,163 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = validateCLIOptions;
|
||||
exports.DOCUMENTATION_NOTE = void 0;
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
|
||||
_chalk = function _chalk() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _camelcase() {
|
||||
const data = _interopRequireDefault(require('camelcase'));
|
||||
|
||||
_camelcase = function _camelcase() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
var _deprecated = require('./deprecated');
|
||||
|
||||
var _defaultConfig = _interopRequireDefault(require('./defaultConfig'));
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _objectSpread(target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === 'function') {
|
||||
ownKeys = ownKeys.concat(
|
||||
Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
})
|
||||
);
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
const BULLET = _chalk().default.bold('\u25cf');
|
||||
|
||||
const DOCUMENTATION_NOTE = ` ${_chalk().default.bold(
|
||||
'CLI Options Documentation:'
|
||||
)}
|
||||
https://jestjs.io/docs/en/cli.html
|
||||
`;
|
||||
exports.DOCUMENTATION_NOTE = DOCUMENTATION_NOTE;
|
||||
|
||||
const createCLIValidationError = (unrecognizedOptions, allowedOptions) => {
|
||||
let title = `${BULLET} Unrecognized CLI Parameter`;
|
||||
let message;
|
||||
const comment =
|
||||
` ${_chalk().default.bold('CLI Options Documentation')}:\n` +
|
||||
` https://jestjs.io/docs/en/cli.html\n`;
|
||||
|
||||
if (unrecognizedOptions.length === 1) {
|
||||
const unrecognized = unrecognizedOptions[0];
|
||||
const didYouMeanMessage = (0, _utils.createDidYouMeanMessage)(
|
||||
unrecognized,
|
||||
Array.from(allowedOptions)
|
||||
);
|
||||
message =
|
||||
` Unrecognized option ${_chalk().default.bold(
|
||||
(0, _utils.format)(unrecognized)
|
||||
)}.` + (didYouMeanMessage ? ` ${didYouMeanMessage}` : '');
|
||||
} else {
|
||||
title += 's';
|
||||
message =
|
||||
` Following options were not recognized:\n` +
|
||||
` ${_chalk().default.bold((0, _utils.format)(unrecognizedOptions))}`;
|
||||
}
|
||||
|
||||
return new _utils.ValidationError(title, message, comment);
|
||||
};
|
||||
|
||||
const logDeprecatedOptions = (deprecatedOptions, deprecationEntries, argv) => {
|
||||
deprecatedOptions.forEach(opt => {
|
||||
(0, _deprecated.deprecationWarning)(
|
||||
argv,
|
||||
opt,
|
||||
deprecationEntries,
|
||||
_objectSpread({}, _defaultConfig.default, {
|
||||
comment: DOCUMENTATION_NOTE
|
||||
})
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
function validateCLIOptions(argv, options, rawArgv = []) {
|
||||
const yargsSpecialOptions = ['$0', '_', 'help', 'h'];
|
||||
const deprecationEntries = options.deprecationEntries || {};
|
||||
const allowedOptions = Object.keys(options).reduce(
|
||||
(acc, option) => acc.add(option).add(options[option].alias || option),
|
||||
new Set(yargsSpecialOptions)
|
||||
);
|
||||
const unrecognizedOptions = Object.keys(argv).filter(
|
||||
arg =>
|
||||
!allowedOptions.has((0, _camelcase().default)(arg)) &&
|
||||
(!rawArgv.length || rawArgv.includes(arg)),
|
||||
[]
|
||||
);
|
||||
|
||||
if (unrecognizedOptions.length) {
|
||||
throw createCLIValidationError(unrecognizedOptions, allowedOptions);
|
||||
}
|
||||
|
||||
const CLIDeprecations = Object.keys(deprecationEntries).reduce(
|
||||
(acc, entry) => {
|
||||
if (options[entry]) {
|
||||
acc[entry] = deprecationEntries[entry];
|
||||
const alias = options[entry].alias;
|
||||
|
||||
if (alias) {
|
||||
acc[alias] = deprecationEntries[entry];
|
||||
}
|
||||
}
|
||||
|
||||
return acc;
|
||||
},
|
||||
{}
|
||||
);
|
||||
const deprecations = new Set(Object.keys(CLIDeprecations));
|
||||
const deprecatedOptions = Object.keys(argv).filter(
|
||||
arg => deprecations.has(arg) && argv[arg] != null
|
||||
);
|
||||
|
||||
if (deprecatedOptions.length) {
|
||||
logDeprecatedOptions(deprecatedOptions, CLIDeprecations, argv);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
9
node_modules/jest-validate/build/warnings.d.ts
generated
vendored
Normal file
9
node_modules/jest-validate/build/warnings.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import { ValidationOptions } from './types';
|
||||
export declare const unknownOptionWarning: (config: Record<string, any>, exampleConfig: Record<string, any>, option: string, options: ValidationOptions, path?: string[] | undefined) => void;
|
||||
//# sourceMappingURL=warnings.d.ts.map
|
||||
1
node_modules/jest-validate/build/warnings.d.ts.map
generated
vendored
Normal file
1
node_modules/jest-validate/build/warnings.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"warnings.d.ts","sourceRoot":"","sources":["../src/warnings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAQ1C,eAAO,MAAM,oBAAoB,oJAsBhC,CAAC"}
|
||||
48
node_modules/jest-validate/build/warnings.js
generated
vendored
Normal file
48
node_modules/jest-validate/build/warnings.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.unknownOptionWarning = void 0;
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
|
||||
_chalk = function _chalk() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
const unknownOptionWarning = (config, exampleConfig, option, options, path) => {
|
||||
const didYouMean = (0, _utils.createDidYouMeanMessage)(
|
||||
option,
|
||||
Object.keys(exampleConfig)
|
||||
);
|
||||
const message =
|
||||
` Unknown option ${_chalk().default.bold(
|
||||
`"${path && path.length > 0 ? path.join('.') + '.' : ''}${option}"`
|
||||
)} with value ${_chalk().default.bold(
|
||||
(0, _utils.format)(config[option])
|
||||
)} was found.` +
|
||||
(didYouMean && ` ${didYouMean}`) +
|
||||
`\n This is probably a typing mistake. Fixing it will remove this message.`;
|
||||
const comment = options.comment;
|
||||
const name = (options.title && options.title.warning) || _utils.WARNING;
|
||||
(0, _utils.logValidationWarning)(name, message, comment);
|
||||
};
|
||||
|
||||
exports.unknownOptionWarning = unknownOptionWarning;
|
||||
63
node_modules/jest-validate/node_modules/camelcase/index.d.ts
generated
vendored
Normal file
63
node_modules/jest-validate/node_modules/camelcase/index.d.ts
generated
vendored
Normal 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;
|
||||
76
node_modules/jest-validate/node_modules/camelcase/index.js
generated
vendored
Normal file
76
node_modules/jest-validate/node_modules/camelcase/index.js
generated
vendored
Normal 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;
|
||||
9
node_modules/jest-validate/node_modules/camelcase/license
generated
vendored
Normal file
9
node_modules/jest-validate/node_modules/camelcase/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/jest-validate/node_modules/camelcase/package.json
generated
vendored
Normal file
75
node_modules/jest-validate/node_modules/camelcase/package.json
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
{
|
||||
"_from": "camelcase@^5.3.1",
|
||||
"_id": "camelcase@5.3.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
|
||||
"_location": "/jest-validate/camelcase",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "camelcase@^5.3.1",
|
||||
"name": "camelcase",
|
||||
"escapedName": "camelcase",
|
||||
"rawSpec": "^5.3.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.3.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jest-validate"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||
"_shasum": "e3c9b31569e106811df242f715725a1f4c494320",
|
||||
"_spec": "camelcase@^5.3.1",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/jest-validate",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/camelcase/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`",
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.1",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/camelcase#readme",
|
||||
"keywords": [
|
||||
"camelcase",
|
||||
"camel-case",
|
||||
"camel",
|
||||
"case",
|
||||
"dash",
|
||||
"hyphen",
|
||||
"dot",
|
||||
"underscore",
|
||||
"separator",
|
||||
"string",
|
||||
"text",
|
||||
"convert",
|
||||
"pascalcase",
|
||||
"pascal-case"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "camelcase",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/camelcase.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"version": "5.3.1"
|
||||
}
|
||||
99
node_modules/jest-validate/node_modules/camelcase/readme.md
generated
vendored
Normal file
99
node_modules/jest-validate/node_modules/camelcase/readme.md
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
# camelcase [](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)
|
||||
21
node_modules/jest-validate/node_modules/leven/index.d.ts
generated
vendored
Normal file
21
node_modules/jest-validate/node_modules/leven/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
declare const leven: {
|
||||
/**
|
||||
Measure the difference between two strings.
|
||||
|
||||
@example
|
||||
```
|
||||
import leven = require('leven');
|
||||
|
||||
leven('cat', 'cow');
|
||||
//=> 2
|
||||
```
|
||||
*/
|
||||
(left: string, right: string): number;
|
||||
|
||||
// TODO: Remove this for the next major release, refactor the whole definition to:
|
||||
// declare function leven(left: string, right: string): number;
|
||||
// export = leven;
|
||||
default: typeof leven;
|
||||
};
|
||||
|
||||
export = leven;
|
||||
77
node_modules/jest-validate/node_modules/leven/index.js
generated
vendored
Normal file
77
node_modules/jest-validate/node_modules/leven/index.js
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
'use strict';
|
||||
const array = [];
|
||||
const charCodeCache = [];
|
||||
|
||||
const leven = (left, right) => {
|
||||
if (left === right) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const swap = left;
|
||||
|
||||
// Swapping the strings if `a` is longer than `b` so we know which one is the
|
||||
// shortest & which one is the longest
|
||||
if (left.length > right.length) {
|
||||
left = right;
|
||||
right = swap;
|
||||
}
|
||||
|
||||
let leftLength = left.length;
|
||||
let rightLength = right.length;
|
||||
|
||||
// Performing suffix trimming:
|
||||
// We can linearly drop suffix common to both strings since they
|
||||
// don't increase distance at all
|
||||
// Note: `~-` is the bitwise way to perform a `- 1` operation
|
||||
while (leftLength > 0 && (left.charCodeAt(~-leftLength) === right.charCodeAt(~-rightLength))) {
|
||||
leftLength--;
|
||||
rightLength--;
|
||||
}
|
||||
|
||||
// Performing prefix trimming
|
||||
// We can linearly drop prefix common to both strings since they
|
||||
// don't increase distance at all
|
||||
let start = 0;
|
||||
|
||||
while (start < leftLength && (left.charCodeAt(start) === right.charCodeAt(start))) {
|
||||
start++;
|
||||
}
|
||||
|
||||
leftLength -= start;
|
||||
rightLength -= start;
|
||||
|
||||
if (leftLength === 0) {
|
||||
return rightLength;
|
||||
}
|
||||
|
||||
let bCharCode;
|
||||
let result;
|
||||
let temp;
|
||||
let temp2;
|
||||
let i = 0;
|
||||
let j = 0;
|
||||
|
||||
while (i < leftLength) {
|
||||
charCodeCache[i] = left.charCodeAt(start + i);
|
||||
array[i] = ++i;
|
||||
}
|
||||
|
||||
while (j < rightLength) {
|
||||
bCharCode = right.charCodeAt(start + j);
|
||||
temp = j++;
|
||||
result = j;
|
||||
|
||||
for (i = 0; i < leftLength; i++) {
|
||||
temp2 = bCharCode === charCodeCache[i] ? temp : temp + 1;
|
||||
temp = array[i];
|
||||
// eslint-disable-next-line no-multi-assign
|
||||
result = array[i] = temp > result ? temp2 > result ? result + 1 : temp2 : temp2 > temp ? temp + 1 : temp2;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
module.exports = leven;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = leven;
|
||||
9
node_modules/jest-validate/node_modules/leven/license
generated
vendored
Normal file
9
node_modules/jest-validate/node_modules/leven/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.
|
||||
89
node_modules/jest-validate/node_modules/leven/package.json
generated
vendored
Normal file
89
node_modules/jest-validate/node_modules/leven/package.json
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
{
|
||||
"_from": "leven@^3.1.0",
|
||||
"_id": "leven@3.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==",
|
||||
"_location": "/jest-validate/leven",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "leven@^3.1.0",
|
||||
"name": "leven",
|
||||
"escapedName": "leven",
|
||||
"rawSpec": "^3.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jest-validate"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",
|
||||
"_shasum": "77891de834064cccba82ae7842bb6b14a13ed7f2",
|
||||
"_spec": "leven@^3.1.0",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/jest-validate",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/leven/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Measure the difference between two strings using the fastest JS implementation of the Levenshtein distance algorithm",
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"fast-levenshtein": "^2.0.6",
|
||||
"ld": "^0.1.0",
|
||||
"levdist": "^2.2.9",
|
||||
"levenshtein": "^1.0.5",
|
||||
"levenshtein-component": "^0.0.1",
|
||||
"levenshtein-edit-distance": "^2.0.3",
|
||||
"matcha": "^0.7.0",
|
||||
"natural": "^0.6.3",
|
||||
"talisman": "^0.21.0",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/leven#readme",
|
||||
"keywords": [
|
||||
"leven",
|
||||
"levenshtein",
|
||||
"distance",
|
||||
"algorithm",
|
||||
"algo",
|
||||
"string",
|
||||
"difference",
|
||||
"diff",
|
||||
"fast",
|
||||
"fuzzy",
|
||||
"similar",
|
||||
"similarity",
|
||||
"compare",
|
||||
"comparison",
|
||||
"edit",
|
||||
"text",
|
||||
"match",
|
||||
"matching"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "leven",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/leven.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "matcha bench.js",
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"version": "3.1.0"
|
||||
}
|
||||
50
node_modules/jest-validate/node_modules/leven/readme.md
generated
vendored
Normal file
50
node_modules/jest-validate/node_modules/leven/readme.md
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
# leven [](https://travis-ci.org/sindresorhus/leven)
|
||||
|
||||
> Measure the difference between two strings<br>
|
||||
> One of the fastest JS implementations of the [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) algorithm
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install leven
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const leven = require('leven');
|
||||
|
||||
leven('cat', 'cow');
|
||||
//=> 2
|
||||
```
|
||||
|
||||
|
||||
## Benchmark
|
||||
|
||||
```
|
||||
$ npm run bench
|
||||
```
|
||||
|
||||
```
|
||||
165,926 op/s » leven
|
||||
164,398 op/s » talisman
|
||||
1,044 op/s » levenshtein-edit-distance
|
||||
628 op/s » fast-levenshtein
|
||||
497 op/s » levenshtein-component
|
||||
195 op/s » ld
|
||||
190 op/s » levenshtein
|
||||
168 op/s » levdist
|
||||
10 op/s » natural
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [leven-cli](https://github.com/sindresorhus/leven-cli) - CLI for this module
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
60
node_modules/jest-validate/package.json
generated
vendored
Normal file
60
node_modules/jest-validate/package.json
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
{
|
||||
"_from": "jest-validate@^24.9.0",
|
||||
"_id": "jest-validate@24.9.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ==",
|
||||
"_location": "/jest-validate",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "jest-validate@^24.9.0",
|
||||
"name": "jest-validate",
|
||||
"escapedName": "jest-validate",
|
||||
"rawSpec": "^24.9.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^24.9.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@jest/core",
|
||||
"/jest-config",
|
||||
"/jest-runtime",
|
||||
"/jest/jest-cli"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-24.9.0.tgz",
|
||||
"_shasum": "0775c55360d173cd854e40180756d4ff52def8ab",
|
||||
"_spec": "jest-validate@^24.9.0",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/jest/node_modules/jest-cli",
|
||||
"bugs": {
|
||||
"url": "https://github.com/facebook/jest/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@jest/types": "^24.9.0",
|
||||
"camelcase": "^5.3.1",
|
||||
"chalk": "^2.0.1",
|
||||
"jest-get-type": "^24.9.0",
|
||||
"leven": "^3.1.0",
|
||||
"pretty-format": "^24.9.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Generic configuration validation tool that helps you with warnings, errors and deprecation messages as well as showing users examples of correct configuration.",
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
"gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1",
|
||||
"homepage": "https://github.com/facebook/jest#readme",
|
||||
"license": "MIT",
|
||||
"main": "build/index.js",
|
||||
"name": "jest-validate",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/facebook/jest.git",
|
||||
"directory": "packages/jest-validate"
|
||||
},
|
||||
"types": "build/index.d.ts",
|
||||
"version": "24.9.0"
|
||||
}
|
||||
Reference in New Issue
Block a user