Updating NPM dependencies

This commit is contained in:
Drew Heavner
2020-11-11 13:30:52 +00:00
committed by GitHub
parent 7a6fb66c63
commit bd487ef324
9068 changed files with 1400893 additions and 587661 deletions

View File

@@ -4,7 +4,6 @@
* 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
export declare function getValues<T = unknown>(validOption: T): Array<T>;
export declare function validationCondition(option: unknown, validOption: unknown): boolean;
export declare function multipleValidOptions<T extends Array<unknown>>(...args: T): T[number];

View File

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

View File

@@ -27,7 +27,7 @@ function validationConditionSingle(option, validOption) {
function getValues(validOption) {
if (
Array.isArray(validOption) && // @ts-ignore
Array.isArray(validOption) && // @ts-expect-error
validOption[MULTIPLE_VALID_OPTIONS_SYMBOL]
) {
return validOption;
@@ -41,7 +41,7 @@ function validationCondition(option, validOption) {
}
function multipleValidOptions(...args) {
const options = [...args]; // @ts-ignore
const options = [...args]; // @ts-expect-error
options[MULTIPLE_VALID_OPTIONS_SYMBOL] = true;
return options;

View File

@@ -4,7 +4,6 @@
* 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';
import type { ValidationOptions } from './types';
declare const validationOptions: ValidationOptions;
export default validationOptions;
//# sourceMappingURL=defaultConfig.d.ts.map

View File

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

View File

@@ -5,16 +5,16 @@ Object.defineProperty(exports, '__esModule', {
});
exports.default = void 0;
var _deprecated = require('./deprecated');
var _condition = require('./condition');
var _warnings = require('./warnings');
var _deprecated = require('./deprecated');
var _errors = require('./errors');
var _condition = require('./condition');
var _utils = require('./utils');
var _warnings = require('./warnings');
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
@@ -30,7 +30,7 @@ const validationOptions = {
exampleConfig: {},
recursive: true,
// Allow NPM-sanctioned comments in package.json. Use a "//" key.
recursiveBlacklist: ['//'],
recursiveDenylist: ['//'],
title: {
deprecation: _utils.DEPRECATION,
error: _utils.ERROR,

View File

@@ -4,6 +4,5 @@
* 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
import type { DeprecatedOptions, ValidationOptions } from './types';
export declare const deprecationWarning: (config: Record<string, unknown>, option: string, deprecatedOptions: DeprecatedOptions, options: ValidationOptions) => boolean;

View File

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

View File

@@ -4,6 +4,5 @@
* 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
import type { ValidationOptions } from './types';
export declare const errorMessage: (option: string, received: unknown, defaultValue: unknown, options: ValidationOptions, path?: string[] | undefined) => void;

View File

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

View File

@@ -8,7 +8,7 @@ exports.errorMessage = void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
_chalk = function () {
return data;
};
@@ -18,17 +18,17 @@ function _chalk() {
function _jestGetType() {
const data = _interopRequireDefault(require('jest-get-type'));
_jestGetType = function _jestGetType() {
_jestGetType = function () {
return data;
};
return data;
}
var _utils = require('./utils');
var _condition = require('./condition');
var _utils = require('./utils');
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}

View File

@@ -4,7 +4,6 @@
* 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';
import type { ValidationOptions } from './types';
declare const config: ValidationOptions;
export default config;
//# sourceMappingURL=exampleConfig.d.ts.map

View File

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

View File

@@ -16,7 +16,7 @@ const config = {
condition: () => true,
deprecate: () => false,
deprecatedConfig: {
key: () => {}
key: () => 'Deprecation message'
},
error: () => {},
exampleConfig: {
@@ -24,7 +24,7 @@ const config = {
test: 'case'
},
recursive: true,
recursiveBlacklist: [],
recursiveDenylist: [],
title: {
deprecation: 'Deprecation Warning',
error: 'Validation Error',

View File

@@ -4,20 +4,8 @@
* 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
export { ValidationError, createDidYouMeanMessage, format, logValidationWarning, } from './utils';
export type { DeprecatedOptions } from './types';
export { default as validate } from './validate';
export { default as validateCLIOptions } from './validateCLIOptions';
export { multipleValidOptions } from './condition';

View File

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

View File

@@ -1,5 +1,51 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
Object.defineProperty(exports, 'ValidationError', {
enumerable: true,
get: function () {
return _utils.ValidationError;
}
});
Object.defineProperty(exports, 'createDidYouMeanMessage', {
enumerable: true,
get: function () {
return _utils.createDidYouMeanMessage;
}
});
Object.defineProperty(exports, 'format', {
enumerable: true,
get: function () {
return _utils.format;
}
});
Object.defineProperty(exports, 'logValidationWarning', {
enumerable: true,
get: function () {
return _utils.logValidationWarning;
}
});
Object.defineProperty(exports, 'validate', {
enumerable: true,
get: function () {
return _validate.default;
}
});
Object.defineProperty(exports, 'validateCLIOptions', {
enumerable: true,
get: function () {
return _validateCLIOptions.default;
}
});
Object.defineProperty(exports, 'multipleValidOptions', {
enumerable: true,
get: function () {
return _condition.multipleValidOptions;
}
});
var _utils = require('./utils');
var _validate = _interopRequireDefault(require('./validate'));
@@ -13,19 +59,3 @@ 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
};

View File

@@ -9,18 +9,19 @@ declare type Title = {
error?: string;
warning?: string;
};
export declare type DeprecatedOptions = Record<string, Function>;
export declare type DeprecatedOptionFunc = (arg: Record<string, unknown>) => string;
export declare type DeprecatedOptions = Record<string, DeprecatedOptionFunc>;
export declare type ValidationOptions = {
comment?: string;
condition?: (option: any, validOption: any) => boolean;
deprecate?: (config: Record<string, any>, option: string, deprecatedOptions: DeprecatedOptions, options: ValidationOptions) => boolean;
condition?: (option: unknown, validOption: unknown) => boolean;
deprecate?: (config: Record<string, unknown>, 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>;
error?: (option: string, received: unknown, defaultValue: unknown, options: ValidationOptions, path?: Array<string>) => void;
exampleConfig: Record<string, unknown>;
recursive?: boolean;
recursiveBlacklist?: Array<string>;
recursiveDenylist?: Array<string>;
title?: Title;
unknown?: (config: Record<string, any>, exampleConfig: Record<string, any>, option: string, options: ValidationOptions, path?: Array<string>) => void;
unknown?: (config: Record<string, unknown>, exampleConfig: Record<string, unknown>, option: string, options: ValidationOptions, path?: Array<string>) => void;
};
export {};
//# sourceMappingURL=types.d.ts.map

View File

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

View File

@@ -7,13 +7,12 @@
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 const format: (value: unknown) => string;
export declare const formatPrettyObject: (value: unknown) => 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
export declare const createDidYouMeanMessage: (unrecognized: string, allowedOptions: Array<string>) => string;

View File

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

View File

@@ -8,17 +8,7 @@ exports.createDidYouMeanMessage = exports.logValidationWarning = exports.Validat
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() {
_chalk = function () {
return data;
};
@@ -28,7 +18,17 @@ function _prettyFormat() {
function _leven() {
const data = _interopRequireDefault(require('leven'));
_leven = function _leven() {
_leven = function () {
return data;
};
return data;
}
function _prettyFormat() {
const data = _interopRequireDefault(require('pretty-format'));
_prettyFormat = function () {
return data;
};
@@ -74,9 +74,7 @@ exports.format = format;
const formatPrettyObject = value =>
typeof value === 'function'
? value.toString()
: JSON.stringify(value, null, 2)
.split('\n')
.join('\n ');
: JSON.stringify(value, null, 2).split('\n').join('\n ');
exports.formatPrettyObject = formatPrettyObject;

View File

@@ -4,10 +4,10 @@
* 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) => {
import type { ValidationOptions } from './types';
declare let hasDeprecationWarnings: boolean;
declare const validate: (config: Record<string, unknown>, options: ValidationOptions) => {
hasDeprecationWarnings: boolean;
isValid: boolean;
};
export default validate;
//# sourceMappingURL=validate.d.ts.map

View File

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

View File

@@ -13,42 +13,16 @@ 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;
}
/**
* 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.
*/
let hasDeprecationWarnings = false;
const shouldSkipValidationForPath = (path, key, blacklist) =>
blacklist ? blacklist.includes([...path, key].join('.')) : false;
const shouldSkipValidationForPath = (path, key, denylist) =>
denylist ? denylist.includes([...path, key].join('.')) : false;
const _validate = (config, exampleConfig, options, path = []) => {
if (
@@ -99,7 +73,11 @@ const _validate = (config, exampleConfig, options, path = []) => {
options.error(key, config[key], exampleConfig[key], options, path);
}
} else if (
shouldSkipValidationForPath(path, key, options.recursiveBlacklist)
shouldSkipValidationForPath(
path,
key,
options.recursiveDenylist || options.recursiveBlacklist
)
) {
// skip validating unknown options inside blacklisted paths
} else {
@@ -110,8 +88,12 @@ const _validate = (config, exampleConfig, options, path = []) => {
if (
options.recursive &&
!Array.isArray(exampleConfig[key]) &&
options.recursiveBlacklist &&
!shouldSkipValidationForPath(path, key, options.recursiveBlacklist)
(options.recursiveDenylist || options.recursiveBlacklist) &&
!shouldSkipValidationForPath(
path,
key,
options.recursiveDenylist || options.recursiveBlacklist
)
) {
_validate(config[key], exampleConfig[key], options, [...path, key]);
}
@@ -128,21 +110,24 @@ const isOfTypeStringOrNumber = value =>
typeof value === 'number' || typeof value === 'string';
const validate = (config, options) => {
hasDeprecationWarnings = false; // Preserve default blacklist entries even with user-supplied blacklist
hasDeprecationWarnings = false; // Preserve default denylist entries even with user-supplied denylist
const combinedBlacklist = [
...(_defaultConfig.default.recursiveBlacklist || []),
...(options.recursiveBlacklist || [])
const combinedDenylist = [
...(_defaultConfig.default.recursiveDenylist || []),
...(options.recursiveDenylist || options.recursiveBlacklist || [])
];
const defaultedOptions = Object.assign(
_objectSpread({}, _defaultConfig.default, options, {
recursiveBlacklist: combinedBlacklist,
title: options.title || _defaultConfig.default.title
})
);
const defaultedOptions = Object.assign({
..._defaultConfig.default,
...options,
recursiveDenylist: combinedDenylist,
title: options.title || _defaultConfig.default.title
});
const _validate2 = _validate(config, options.exampleConfig, defaultedOptions),
hdw = _validate2.hasDeprecationWarnings;
const {hasDeprecationWarnings: hdw} = _validate(
config,
options.exampleConfig,
defaultedOptions
);
return {
hasDeprecationWarnings: hdw,

View File

@@ -4,12 +4,11 @@
* 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';
import type { Options } from 'yargs';
import type { Config } from '@jest/types';
import type { 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

View File

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

View File

@@ -6,68 +6,42 @@ Object.defineProperty(exports, '__esModule', {
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() {
_camelcase = function () {
return data;
};
return data;
}
var _utils = require('./utils');
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
var _defaultConfig = _interopRequireDefault(require('./defaultConfig'));
var _deprecated = require('./deprecated');
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;
}
/**
* 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 BULLET = _chalk().default.bold('\u25cf');
const DOCUMENTATION_NOTE = ` ${_chalk().default.bold(
@@ -86,10 +60,13 @@ const createCLIValidationError = (unrecognizedOptions, allowedOptions) => {
if (unrecognizedOptions.length === 1) {
const unrecognized = unrecognizedOptions[0];
const didYouMeanMessage = (0, _utils.createDidYouMeanMessage)(
unrecognized,
Array.from(allowedOptions)
);
const didYouMeanMessage =
unrecognized.length > 1
? (0, _utils.createDidYouMeanMessage)(
unrecognized,
Array.from(allowedOptions)
)
: '';
message =
` Unrecognized option ${_chalk().default.bold(
(0, _utils.format)(unrecognized)
@@ -106,14 +83,10 @@ const createCLIValidationError = (unrecognizedOptions, allowedOptions) => {
const logDeprecatedOptions = (deprecatedOptions, deprecationEntries, argv) => {
deprecatedOptions.forEach(opt => {
(0, _deprecated.deprecationWarning)(
argv,
opt,
deprecationEntries,
_objectSpread({}, _defaultConfig.default, {
comment: DOCUMENTATION_NOTE
})
);
(0, _deprecated.deprecationWarning)(argv, opt, deprecationEntries, {
..._defaultConfig.default,
comment: DOCUMENTATION_NOTE
});
});
};
@@ -127,6 +100,7 @@ function validateCLIOptions(argv, options, rawArgv = []) {
const unrecognizedOptions = Object.keys(argv).filter(
arg =>
!allowedOptions.has((0, _camelcase().default)(arg)) &&
!allowedOptions.has(arg) &&
(!rawArgv.length || rawArgv.includes(arg)),
[]
);

View File

@@ -4,6 +4,5 @@
* 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
import type { ValidationOptions } from './types';
export declare const unknownOptionWarning: (config: Record<string, unknown>, exampleConfig: Record<string, unknown>, option: string, options: ValidationOptions, path?: string[] | undefined) => void;

View File

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

View File

@@ -8,7 +8,7 @@ exports.unknownOptionWarning = void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function _chalk() {
_chalk = function () {
return data;
};