yeet
This commit is contained in:
21
node_modules/jest-config/LICENSE
generated
vendored
Normal file
21
node_modules/jest-config/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.
|
9
node_modules/jest-config/build/Defaults.d.ts
generated
vendored
Normal file
9
node_modules/jest-config/build/Defaults.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 type { Config } from '@jest/types';
|
||||
declare const defaultOptions: Config.DefaultOptions;
|
||||
export default defaultOptions;
|
94
node_modules/jest-config/build/Defaults.js
generated
vendored
Normal file
94
node_modules/jest-config/build/Defaults.js
generated
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _jestRegexUtil() {
|
||||
const data = require('jest-regex-util');
|
||||
|
||||
_jestRegexUtil = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _constants = require('./constants');
|
||||
|
||||
var _getCacheDirectory = _interopRequireDefault(require('./getCacheDirectory'));
|
||||
|
||||
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 NODE_MODULES_REGEXP = (0, _jestRegexUtil().replacePathSepForRegex)(
|
||||
_constants.NODE_MODULES
|
||||
);
|
||||
const defaultOptions = {
|
||||
automock: false,
|
||||
bail: 0,
|
||||
browser: false,
|
||||
cache: true,
|
||||
cacheDirectory: (0, _getCacheDirectory.default)(),
|
||||
changedFilesWithAncestor: false,
|
||||
clearMocks: false,
|
||||
collectCoverage: false,
|
||||
coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
|
||||
coverageProvider: 'babel',
|
||||
coverageReporters: ['json', 'text', 'lcov', 'clover'],
|
||||
errorOnDeprecated: false,
|
||||
expand: false,
|
||||
forceCoverageMatch: [],
|
||||
globals: {},
|
||||
haste: {
|
||||
computeSha1: false,
|
||||
providesModuleNodeModules: [],
|
||||
throwOnModuleCollision: false
|
||||
},
|
||||
maxConcurrency: 5,
|
||||
maxWorkers: '50%',
|
||||
moduleDirectories: ['node_modules'],
|
||||
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node'],
|
||||
moduleNameMapper: {},
|
||||
modulePathIgnorePatterns: [],
|
||||
noStackTrace: false,
|
||||
notify: false,
|
||||
notifyMode: 'failure-change',
|
||||
prettierPath: 'prettier',
|
||||
resetMocks: false,
|
||||
resetModules: false,
|
||||
restoreMocks: false,
|
||||
roots: ['<rootDir>'],
|
||||
runTestsByPath: false,
|
||||
runner: 'jest-runner',
|
||||
setupFiles: [],
|
||||
setupFilesAfterEnv: [],
|
||||
skipFilter: false,
|
||||
snapshotSerializers: [],
|
||||
testEnvironment: 'jest-environment-jsdom',
|
||||
testEnvironmentOptions: {},
|
||||
testFailureExitCode: 1,
|
||||
testLocationInResults: false,
|
||||
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)'],
|
||||
testPathIgnorePatterns: [NODE_MODULES_REGEXP],
|
||||
testRegex: [],
|
||||
testRunner: 'jasmine2',
|
||||
testSequencer: '@jest/test-sequencer',
|
||||
testURL: 'http://localhost',
|
||||
timers: 'real',
|
||||
transformIgnorePatterns: [NODE_MODULES_REGEXP],
|
||||
useStderr: false,
|
||||
watch: false,
|
||||
watchPathIgnorePatterns: [],
|
||||
watchman: true
|
||||
};
|
||||
var _default = defaultOptions;
|
||||
exports.default = _default;
|
8
node_modules/jest-config/build/Deprecated.d.ts
generated
vendored
Normal file
8
node_modules/jest-config/build/Deprecated.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* 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 const _default: Record<string, Function>;
|
||||
export default _default;
|
98
node_modules/jest-config/build/Deprecated.js
generated
vendored
Normal file
98
node_modules/jest-config/build/Deprecated.js
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _prettyFormat() {
|
||||
const data = _interopRequireDefault(require('pretty-format'));
|
||||
|
||||
_prettyFormat = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
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 format = value =>
|
||||
(0, _prettyFormat().default)(value, {
|
||||
min: true
|
||||
});
|
||||
|
||||
var _default = {
|
||||
mapCoverage: () => ` Option ${_chalk().default.bold(
|
||||
'"mapCoverage"'
|
||||
)} has been removed, as it's no longer necessary.
|
||||
|
||||
Please update your configuration.`,
|
||||
preprocessorIgnorePatterns: options => ` Option ${_chalk().default.bold(
|
||||
'"preprocessorIgnorePatterns"'
|
||||
)} was replaced by ${_chalk().default.bold(
|
||||
'"transformIgnorePatterns"'
|
||||
)}, which support multiple preprocessors.
|
||||
|
||||
Jest now treats your current configuration as:
|
||||
{
|
||||
${_chalk().default.bold(
|
||||
'"transformIgnorePatterns"'
|
||||
)}: ${_chalk().default.bold(format(options.preprocessorIgnorePatterns))}
|
||||
}
|
||||
|
||||
Please update your configuration.`,
|
||||
scriptPreprocessor: options => ` Option ${_chalk().default.bold(
|
||||
'"scriptPreprocessor"'
|
||||
)} was replaced by ${_chalk().default.bold(
|
||||
'"transform"'
|
||||
)}, which support multiple preprocessors.
|
||||
|
||||
Jest now treats your current configuration as:
|
||||
{
|
||||
${_chalk().default.bold('"transform"')}: ${_chalk().default.bold(
|
||||
`{".*": ${format(options.scriptPreprocessor)}}`
|
||||
)}
|
||||
}
|
||||
|
||||
Please update your configuration.`,
|
||||
setupTestFrameworkScriptFile: _options => ` Option ${_chalk().default.bold(
|
||||
'"setupTestFrameworkScriptFile"'
|
||||
)} was replaced by configuration ${_chalk().default.bold(
|
||||
'"setupFilesAfterEnv"'
|
||||
)}, which supports multiple paths.
|
||||
|
||||
Please update your configuration.`,
|
||||
testPathDirs: options => ` Option ${_chalk().default.bold(
|
||||
'"testPathDirs"'
|
||||
)} was replaced by ${_chalk().default.bold('"roots"')}.
|
||||
|
||||
Jest now treats your current configuration as:
|
||||
{
|
||||
${_chalk().default.bold('"roots"')}: ${_chalk().default.bold(
|
||||
format(options.testPathDirs)
|
||||
)}
|
||||
}
|
||||
|
||||
Please update your configuration.
|
||||
`
|
||||
};
|
||||
exports.default = _default;
|
11
node_modules/jest-config/build/Descriptions.d.ts
generated
vendored
Normal file
11
node_modules/jest-config/build/Descriptions.d.ts
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* 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 type { Config } from '@jest/types';
|
||||
declare const descriptions: {
|
||||
[key in keyof Config.InitialOptions]: string;
|
||||
};
|
||||
export default descriptions;
|
102
node_modules/jest-config/build/Descriptions.js
generated
vendored
Normal file
102
node_modules/jest-config/build/Descriptions.js
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
'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 descriptions = {
|
||||
automock: 'All imported modules in your tests should be mocked automatically',
|
||||
bail: 'Stop running tests after `n` failures',
|
||||
browser: 'Respect "browser" field in package.json when resolving modules',
|
||||
cacheDirectory:
|
||||
'The directory where Jest should store its cached dependency information',
|
||||
clearMocks: 'Automatically clear mock calls and instances between every test',
|
||||
collectCoverage:
|
||||
'Indicates whether the coverage information should be collected while executing the test',
|
||||
collectCoverageFrom:
|
||||
'An array of glob patterns indicating a set of files for which coverage information should be collected',
|
||||
coverageDirectory:
|
||||
'The directory where Jest should output its coverage files',
|
||||
coveragePathIgnorePatterns:
|
||||
'An array of regexp pattern strings used to skip coverage collection',
|
||||
coverageReporters:
|
||||
'A list of reporter names that Jest uses when writing coverage reports',
|
||||
coverageThreshold:
|
||||
'An object that configures minimum threshold enforcement for coverage results',
|
||||
dependencyExtractor: 'A path to a custom dependency extractor',
|
||||
errorOnDeprecated:
|
||||
'Make calling deprecated APIs throw helpful error messages',
|
||||
forceCoverageMatch:
|
||||
'Force coverage collection from ignored files using an array of glob patterns',
|
||||
globalSetup:
|
||||
'A path to a module which exports an async function that is triggered once before all test suites',
|
||||
globalTeardown:
|
||||
'A path to a module which exports an async function that is triggered once after all test suites',
|
||||
globals:
|
||||
'A set of global variables that need to be available in all test environments',
|
||||
maxWorkers:
|
||||
'The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.',
|
||||
moduleDirectories:
|
||||
"An array of directory names to be searched recursively up from the requiring module's location",
|
||||
moduleFileExtensions: 'An array of file extensions your modules use',
|
||||
moduleNameMapper:
|
||||
'A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module',
|
||||
modulePathIgnorePatterns:
|
||||
"An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader",
|
||||
notify: 'Activates notifications for test results',
|
||||
notifyMode:
|
||||
'An enum that specifies notification mode. Requires { notify: true }',
|
||||
preset: "A preset that is used as a base for Jest's configuration",
|
||||
projects: 'Run tests from one or more projects',
|
||||
reporters: 'Use this configuration option to add custom reporters to Jest',
|
||||
resetMocks: 'Automatically reset mock state between every test',
|
||||
resetModules: 'Reset the module registry before running each individual test',
|
||||
resolver: 'A path to a custom resolver',
|
||||
restoreMocks: 'Automatically restore mock state between every test',
|
||||
rootDir:
|
||||
'The root directory that Jest should scan for tests and modules within',
|
||||
roots:
|
||||
'A list of paths to directories that Jest should use to search for files in',
|
||||
runner:
|
||||
"Allows you to use a custom runner instead of Jest's default test runner",
|
||||
setupFiles:
|
||||
'The paths to modules that run some code to configure or set up the testing environment before each test',
|
||||
setupFilesAfterEnv:
|
||||
'A list of paths to modules that run some code to configure or set up the testing framework before each test',
|
||||
snapshotSerializers:
|
||||
'A list of paths to snapshot serializer modules Jest should use for snapshot testing',
|
||||
testEnvironment: 'The test environment that will be used for testing',
|
||||
testEnvironmentOptions: 'Options that will be passed to the testEnvironment',
|
||||
testLocationInResults: 'Adds a location field to test results',
|
||||
testMatch: 'The glob patterns Jest uses to detect test files',
|
||||
testPathIgnorePatterns:
|
||||
'An array of regexp pattern strings that are matched against all test paths, matched tests are skipped',
|
||||
testRegex:
|
||||
'The regexp pattern or array of patterns that Jest uses to detect test files',
|
||||
testResultsProcessor:
|
||||
'This option allows the use of a custom results processor',
|
||||
testRunner: 'This option allows use of a custom test runner',
|
||||
testURL:
|
||||
'This option sets the URL for the jsdom environment. It is reflected in properties such as location.href',
|
||||
timers:
|
||||
'Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"',
|
||||
transform: 'A map from regular expressions to paths to transformers',
|
||||
transformIgnorePatterns:
|
||||
'An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation',
|
||||
unmockedModulePathPatterns:
|
||||
'An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them',
|
||||
verbose:
|
||||
'Indicates whether each individual test should be reported during the run',
|
||||
watchPathIgnorePatterns:
|
||||
'An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode',
|
||||
watchman: 'Whether to use watchman for file crawling'
|
||||
};
|
||||
var _default = descriptions;
|
||||
exports.default = _default;
|
19
node_modules/jest-config/build/ReporterValidationErrors.d.ts
generated
vendored
Normal file
19
node_modules/jest-config/build/ReporterValidationErrors.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.
|
||||
*/
|
||||
import type { Config } from '@jest/types';
|
||||
import { ValidationError } from 'jest-validate';
|
||||
/**
|
||||
* Reporter Validation Error is thrown if the given arguments
|
||||
* within the reporter are not valid.
|
||||
*
|
||||
* This is a highly specific reporter error and in the future will be
|
||||
* merged with jest-validate. Till then, we can make use of it. It works
|
||||
* and that's what counts most at this time.
|
||||
*/
|
||||
export declare function createReporterError(reporterIndex: number, reporterValue: Array<Config.ReporterConfig> | string): ValidationError;
|
||||
export declare function createArrayReporterError(arrayReporter: Config.ReporterConfig, reporterIndex: number, valueIndex: number, value: string | Record<string, unknown>, expectedType: string, valueName: string): ValidationError;
|
||||
export declare function validateReporters(reporterConfig: Array<Config.ReporterConfig | string>): boolean;
|
138
node_modules/jest-config/build/ReporterValidationErrors.js
generated
vendored
Normal file
138
node_modules/jest-config/build/ReporterValidationErrors.js
generated
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.createReporterError = createReporterError;
|
||||
exports.createArrayReporterError = createArrayReporterError;
|
||||
exports.validateReporters = validateReporters;
|
||||
|
||||
function _jestValidate() {
|
||||
const data = require('jest-validate');
|
||||
|
||||
_jestValidate = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestGetType() {
|
||||
const data = _interopRequireDefault(require('jest-get-type'));
|
||||
|
||||
_jestGetType = function () {
|
||||
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 validReporterTypes = ['array', 'string'];
|
||||
const ERROR = `${_utils.BULLET}Reporter Validation Error`;
|
||||
/**
|
||||
* Reporter Validation Error is thrown if the given arguments
|
||||
* within the reporter are not valid.
|
||||
*
|
||||
* This is a highly specific reporter error and in the future will be
|
||||
* merged with jest-validate. Till then, we can make use of it. It works
|
||||
* and that's what counts most at this time.
|
||||
*/
|
||||
|
||||
function createReporterError(reporterIndex, reporterValue) {
|
||||
const errorMessage =
|
||||
` Reporter at index ${reporterIndex} must be of type:\n` +
|
||||
` ${_chalk().default.bold.green(validReporterTypes.join(' or '))}\n` +
|
||||
` but instead received:\n` +
|
||||
` ${_chalk().default.bold.red(
|
||||
(0, _jestGetType().default)(reporterValue)
|
||||
)}`;
|
||||
return new (_jestValidate().ValidationError)(
|
||||
ERROR,
|
||||
errorMessage,
|
||||
_utils.DOCUMENTATION_NOTE
|
||||
);
|
||||
}
|
||||
|
||||
function createArrayReporterError(
|
||||
arrayReporter,
|
||||
reporterIndex,
|
||||
valueIndex,
|
||||
value,
|
||||
expectedType,
|
||||
valueName
|
||||
) {
|
||||
const errorMessage =
|
||||
` Unexpected value for ${valueName} ` +
|
||||
`at index ${valueIndex} of reporter at index ${reporterIndex}\n` +
|
||||
' Expected:\n' +
|
||||
` ${_chalk().default.bold.red(expectedType)}\n` +
|
||||
' Got:\n' +
|
||||
` ${_chalk().default.bold.green((0, _jestGetType().default)(value))}\n` +
|
||||
` Reporter configuration:\n` +
|
||||
` ${_chalk().default.bold.green(
|
||||
JSON.stringify(arrayReporter, null, 2).split('\n').join('\n ')
|
||||
)}`;
|
||||
return new (_jestValidate().ValidationError)(
|
||||
ERROR,
|
||||
errorMessage,
|
||||
_utils.DOCUMENTATION_NOTE
|
||||
);
|
||||
}
|
||||
|
||||
function validateReporters(reporterConfig) {
|
||||
return reporterConfig.every((reporter, index) => {
|
||||
if (Array.isArray(reporter)) {
|
||||
validateArrayReporter(reporter, index);
|
||||
} else if (typeof reporter !== 'string') {
|
||||
throw createReporterError(index, reporter);
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
function validateArrayReporter(arrayReporter, reporterIndex) {
|
||||
const [path, options] = arrayReporter;
|
||||
|
||||
if (typeof path !== 'string') {
|
||||
throw createArrayReporterError(
|
||||
arrayReporter,
|
||||
reporterIndex,
|
||||
0,
|
||||
path,
|
||||
'string',
|
||||
'Path'
|
||||
);
|
||||
} else if (typeof options !== 'object') {
|
||||
throw createArrayReporterError(
|
||||
arrayReporter,
|
||||
reporterIndex,
|
||||
1,
|
||||
options,
|
||||
'object',
|
||||
'Reporter Configuration'
|
||||
);
|
||||
}
|
||||
}
|
9
node_modules/jest-config/build/ValidConfig.d.ts
generated
vendored
Normal file
9
node_modules/jest-config/build/ValidConfig.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 type { Config } from '@jest/types';
|
||||
declare const initialOptions: Config.InitialOptions;
|
||||
export default initialOptions;
|
179
node_modules/jest-config/build/ValidConfig.js
generated
vendored
Normal file
179
node_modules/jest-config/build/ValidConfig.js
generated
vendored
Normal file
@ -0,0 +1,179 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _jestRegexUtil() {
|
||||
const data = require('jest-regex-util');
|
||||
|
||||
_jestRegexUtil = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestValidate() {
|
||||
const data = require('jest-validate');
|
||||
|
||||
_jestValidate = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _constants = require('./constants');
|
||||
|
||||
/**
|
||||
* 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 NODE_MODULES_REGEXP = (0, _jestRegexUtil().replacePathSepForRegex)(
|
||||
_constants.NODE_MODULES
|
||||
);
|
||||
const initialOptions = {
|
||||
automock: false,
|
||||
bail: (0, _jestValidate().multipleValidOptions)(false, 0),
|
||||
browser: false,
|
||||
cache: true,
|
||||
cacheDirectory: '/tmp/user/jest',
|
||||
changedFilesWithAncestor: false,
|
||||
changedSince: 'master',
|
||||
clearMocks: false,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src', '!public'],
|
||||
collectCoverageOnlyFrom: {
|
||||
'<rootDir>/this-directory-is-covered/Covered.js': true
|
||||
},
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
|
||||
coverageProvider: 'v8',
|
||||
coverageReporters: ['json', 'text', 'lcov', 'clover'],
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
branches: 50,
|
||||
functions: 100,
|
||||
lines: 100,
|
||||
statements: 100
|
||||
}
|
||||
},
|
||||
dependencyExtractor: '<rootDir>/dependencyExtractor.js',
|
||||
displayName: (0, _jestValidate().multipleValidOptions)('test-config', {
|
||||
color: 'blue',
|
||||
name: 'test-config'
|
||||
}),
|
||||
errorOnDeprecated: false,
|
||||
expand: false,
|
||||
extraGlobals: [],
|
||||
filter: '<rootDir>/filter.js',
|
||||
forceCoverageMatch: ['**/*.t.js'],
|
||||
forceExit: false,
|
||||
globalSetup: 'setup.js',
|
||||
globalTeardown: 'teardown.js',
|
||||
globals: {
|
||||
__DEV__: true
|
||||
},
|
||||
haste: {
|
||||
computeSha1: true,
|
||||
defaultPlatform: 'ios',
|
||||
hasteImplModulePath: '<rootDir>/haste_impl.js',
|
||||
platforms: ['ios', 'android'],
|
||||
providesModuleNodeModules: ['react', 'react-native'],
|
||||
throwOnModuleCollision: false
|
||||
},
|
||||
json: false,
|
||||
lastCommit: false,
|
||||
logHeapUsage: true,
|
||||
maxConcurrency: 5,
|
||||
maxWorkers: '50%',
|
||||
moduleDirectories: ['node_modules'],
|
||||
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node'],
|
||||
moduleLoader: '<rootDir>',
|
||||
moduleNameMapper: {
|
||||
'^React$': '<rootDir>/node_modules/react'
|
||||
},
|
||||
modulePathIgnorePatterns: ['<rootDir>/build/'],
|
||||
modulePaths: ['/shared/vendor/modules'],
|
||||
name: 'string',
|
||||
noStackTrace: false,
|
||||
notify: false,
|
||||
notifyMode: 'failure-change',
|
||||
onlyChanged: false,
|
||||
preset: 'react-native',
|
||||
prettierPath: '<rootDir>/node_modules/prettier',
|
||||
projects: ['project-a', 'project-b/'],
|
||||
reporters: [
|
||||
'default',
|
||||
'custom-reporter-1',
|
||||
[
|
||||
'custom-reporter-2',
|
||||
{
|
||||
configValue: true
|
||||
}
|
||||
]
|
||||
],
|
||||
resetMocks: false,
|
||||
resetModules: false,
|
||||
resolver: '<rootDir>/resolver.js',
|
||||
restoreMocks: false,
|
||||
rootDir: '/',
|
||||
roots: ['<rootDir>'],
|
||||
runTestsByPath: false,
|
||||
runner: 'jest-runner',
|
||||
setupFiles: ['<rootDir>/setup.js'],
|
||||
setupFilesAfterEnv: ['<rootDir>/testSetupFile.js'],
|
||||
silent: true,
|
||||
skipFilter: false,
|
||||
skipNodeResolution: false,
|
||||
snapshotResolver: '<rootDir>/snapshotResolver.js',
|
||||
snapshotSerializers: ['my-serializer-module'],
|
||||
testEnvironment: 'jest-environment-jsdom',
|
||||
testEnvironmentOptions: {
|
||||
userAgent: 'Agent/007'
|
||||
},
|
||||
testFailureExitCode: 1,
|
||||
testLocationInResults: false,
|
||||
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
|
||||
testNamePattern: 'test signature',
|
||||
testPathIgnorePatterns: [NODE_MODULES_REGEXP],
|
||||
testRegex: (0,
|
||||
_jestValidate()
|
||||
.multipleValidOptions)('(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$', [
|
||||
'/__tests__/\\.test\\.[jt]sx?$',
|
||||
'/__tests__/\\.spec\\.[jt]sx?$'
|
||||
]),
|
||||
testResultsProcessor: 'processor-node-module',
|
||||
testRunner: 'jasmine2',
|
||||
testSequencer: '@jest/test-sequencer',
|
||||
testTimeout: 5000,
|
||||
testURL: 'http://localhost',
|
||||
timers: 'real',
|
||||
transform: {
|
||||
'^.+\\.js$': '<rootDir>/preprocessor.js'
|
||||
},
|
||||
transformIgnorePatterns: [NODE_MODULES_REGEXP],
|
||||
unmockedModulePathPatterns: ['mock'],
|
||||
updateSnapshot: true,
|
||||
useStderr: false,
|
||||
verbose: false,
|
||||
watch: false,
|
||||
watchPathIgnorePatterns: ['<rootDir>/e2e/'],
|
||||
watchPlugins: [
|
||||
'path/to/yourWatchPlugin',
|
||||
[
|
||||
'jest-watch-typeahead/filename',
|
||||
{
|
||||
key: 'k',
|
||||
prompt: 'do something with my custom prompt'
|
||||
}
|
||||
]
|
||||
],
|
||||
watchman: true
|
||||
};
|
||||
var _default = initialOptions;
|
||||
exports.default = _default;
|
7
node_modules/jest-config/build/color.d.ts
generated
vendored
Normal file
7
node_modules/jest-config/build/color.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 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 getDisplayNameColor: (seed?: string | undefined) => "hex" | "bold" | "reset" | "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright" | "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough" | "visible" | "Instance" | "level" | "keyword" | "rgb" | "hsl" | "hsv" | "hwb" | "ansi" | "ansi256" | "bgHex" | "bgKeyword" | "bgRgb" | "bgHsl" | "bgHsv" | "bgHwb" | "bgAnsi" | "bgAnsi256" | "supportsColor" | "Level" | "Color" | "ForegroundColor" | "BackgroundColor" | "Modifiers" | "stderr";
|
51
node_modules/jest-config/build/color.js
generated
vendored
Normal file
51
node_modules/jest-config/build/color.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.getDisplayNameColor = void 0;
|
||||
|
||||
function _crypto() {
|
||||
const data = require('crypto');
|
||||
|
||||
_crypto = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
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 colors = ['red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'];
|
||||
|
||||
const getDisplayNameColor = seed => {
|
||||
if (seed === undefined) {
|
||||
return 'white';
|
||||
}
|
||||
|
||||
const hash = (0, _crypto().createHash)('sha256');
|
||||
hash.update(seed);
|
||||
const num = hash.digest().readUInt32LE(0);
|
||||
return colors[num % colors.length];
|
||||
};
|
||||
|
||||
exports.getDisplayNameColor = getDisplayNameColor;
|
16
node_modules/jest-config/build/constants.d.ts
generated
vendored
Normal file
16
node_modules/jest-config/build/constants.d.ts
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* 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 NODE_MODULES: string;
|
||||
export declare const DEFAULT_JS_PATTERN = "^.+\\.[jt]sx?$";
|
||||
export declare const DEFAULT_REPORTER_LABEL = "default";
|
||||
export declare const PACKAGE_JSON = "package.json";
|
||||
export declare const JEST_CONFIG_BASE_NAME = "jest.config";
|
||||
export declare const JEST_CONFIG_EXT_CJS = ".cjs";
|
||||
export declare const JEST_CONFIG_EXT_MJS = ".mjs";
|
||||
export declare const JEST_CONFIG_EXT_JS = ".js";
|
||||
export declare const JEST_CONFIG_EXT_JSON = ".json";
|
||||
export declare const JEST_CONFIG_EXT_ORDER: readonly string[];
|
90
node_modules/jest-config/build/constants.js
generated
vendored
Normal file
90
node_modules/jest-config/build/constants.js
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.JEST_CONFIG_EXT_ORDER = exports.JEST_CONFIG_EXT_JSON = exports.JEST_CONFIG_EXT_JS = exports.JEST_CONFIG_EXT_MJS = exports.JEST_CONFIG_EXT_CJS = exports.JEST_CONFIG_BASE_NAME = exports.PACKAGE_JSON = exports.DEFAULT_REPORTER_LABEL = exports.DEFAULT_JS_PATTERN = exports.NODE_MODULES = void 0;
|
||||
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 NODE_MODULES = path().sep + 'node_modules' + path().sep;
|
||||
exports.NODE_MODULES = NODE_MODULES;
|
||||
const DEFAULT_JS_PATTERN = '^.+\\.[jt]sx?$';
|
||||
exports.DEFAULT_JS_PATTERN = DEFAULT_JS_PATTERN;
|
||||
const DEFAULT_REPORTER_LABEL = 'default';
|
||||
exports.DEFAULT_REPORTER_LABEL = DEFAULT_REPORTER_LABEL;
|
||||
const PACKAGE_JSON = 'package.json';
|
||||
exports.PACKAGE_JSON = PACKAGE_JSON;
|
||||
const JEST_CONFIG_BASE_NAME = 'jest.config';
|
||||
exports.JEST_CONFIG_BASE_NAME = JEST_CONFIG_BASE_NAME;
|
||||
const JEST_CONFIG_EXT_CJS = '.cjs';
|
||||
exports.JEST_CONFIG_EXT_CJS = JEST_CONFIG_EXT_CJS;
|
||||
const JEST_CONFIG_EXT_MJS = '.mjs';
|
||||
exports.JEST_CONFIG_EXT_MJS = JEST_CONFIG_EXT_MJS;
|
||||
const JEST_CONFIG_EXT_JS = '.js';
|
||||
exports.JEST_CONFIG_EXT_JS = JEST_CONFIG_EXT_JS;
|
||||
const JEST_CONFIG_EXT_JSON = '.json';
|
||||
exports.JEST_CONFIG_EXT_JSON = JEST_CONFIG_EXT_JSON;
|
||||
const JEST_CONFIG_EXT_ORDER = Object.freeze([
|
||||
JEST_CONFIG_EXT_JS,
|
||||
JEST_CONFIG_EXT_MJS,
|
||||
JEST_CONFIG_EXT_CJS,
|
||||
JEST_CONFIG_EXT_JSON
|
||||
]);
|
||||
exports.JEST_CONFIG_EXT_ORDER = JEST_CONFIG_EXT_ORDER;
|
8
node_modules/jest-config/build/getCacheDirectory.d.ts
generated
vendored
Normal file
8
node_modules/jest-config/build/getCacheDirectory.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* 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 const getCacheDirectory: () => string;
|
||||
export default getCacheDirectory;
|
104
node_modules/jest-config/build/getCacheDirectory.js
generated
vendored
Normal file
104
node_modules/jest-config/build/getCacheDirectory.js
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _os() {
|
||||
const data = require('os');
|
||||
|
||||
_os = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _realpathNative() {
|
||||
const data = require('realpath-native');
|
||||
|
||||
_realpathNative = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 getCacheDirectory = () => {
|
||||
const {getuid} = process;
|
||||
const tmpdirPath = path().join(
|
||||
(0, _realpathNative().sync)((0, _os().tmpdir)()),
|
||||
'jest'
|
||||
);
|
||||
|
||||
if (getuid == null) {
|
||||
return tmpdirPath;
|
||||
} else {
|
||||
// On some platforms tmpdir() is `/tmp`, causing conflicts between different
|
||||
// users and permission issues. Adding an additional subdivision by UID can
|
||||
// help.
|
||||
return `${tmpdirPath}_${getuid.call(process).toString(36)}`;
|
||||
}
|
||||
};
|
||||
|
||||
var _default = getCacheDirectory;
|
||||
exports.default = _default;
|
8
node_modules/jest-config/build/getMaxWorkers.d.ts
generated
vendored
Normal file
8
node_modules/jest-config/build/getMaxWorkers.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* 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 type { Config } from '@jest/types';
|
||||
export default function getMaxWorkers(argv: Partial<Pick<Config.Argv, 'maxWorkers' | 'runInBand' | 'watch' | 'watchAll'>>, defaultOptions?: Partial<Pick<Config.Argv, 'maxWorkers'>>): number;
|
57
node_modules/jest-config/build/getMaxWorkers.js
generated
vendored
Normal file
57
node_modules/jest-config/build/getMaxWorkers.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = getMaxWorkers;
|
||||
|
||||
function _os() {
|
||||
const data = require('os');
|
||||
|
||||
_os = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
function getMaxWorkers(argv, defaultOptions) {
|
||||
if (argv.runInBand) {
|
||||
return 1;
|
||||
} else if (argv.maxWorkers) {
|
||||
return parseWorkers(argv.maxWorkers);
|
||||
} else if (defaultOptions && defaultOptions.maxWorkers) {
|
||||
return parseWorkers(defaultOptions.maxWorkers);
|
||||
} else {
|
||||
// In watch mode, Jest should be unobtrusive and not use all available CPUs.
|
||||
const numCpus = (0, _os().cpus)() ? (0, _os().cpus)().length : 1;
|
||||
const isWatchModeEnabled = argv.watch || argv.watchAll;
|
||||
return Math.max(
|
||||
isWatchModeEnabled ? Math.floor(numCpus / 2) : numCpus - 1,
|
||||
1
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const parseWorkers = maxWorkers => {
|
||||
const parsed = parseInt(maxWorkers.toString(), 10);
|
||||
|
||||
if (
|
||||
typeof maxWorkers === 'string' &&
|
||||
maxWorkers.trim().endsWith('%') &&
|
||||
parsed > 0 &&
|
||||
parsed <= 100
|
||||
) {
|
||||
const numCpus = (0, _os().cpus)().length;
|
||||
const workers = Math.floor((parsed / 100) * numCpus);
|
||||
return workers >= 1 ? workers : 1;
|
||||
}
|
||||
|
||||
return parsed > 0 ? parsed : 1;
|
||||
};
|
10
node_modules/jest-config/build/importEsm.d.ts
generated
vendored
Normal file
10
node_modules/jest-config/build/importEsm.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.
|
||||
*/
|
||||
declare const _default: (specifier: string) => Promise<{
|
||||
default: unknown;
|
||||
}>;
|
||||
export default _default;
|
30
node_modules/jest-config/build/importEsm.js
generated
vendored
Normal file
30
node_modules/jest-config/build/importEsm.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _url() {
|
||||
const data = require('url');
|
||||
|
||||
_url = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
// this is in a separate file so that node 8 don't explode with a syntax error.
|
||||
// Remove this file when we drop support for Node 8
|
||||
var _default = (
|
||||
specifier // node `import()` supports URL, but TypeScript doesn't know that
|
||||
) => import((0, _url().pathToFileURL)(specifier).href);
|
||||
|
||||
exports.default = _default;
|
27
node_modules/jest-config/build/index.d.ts
generated
vendored
Normal file
27
node_modules/jest-config/build/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 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 type { Config } from '@jest/types';
|
||||
export { getTestEnvironment, isJSONString } from './utils';
|
||||
export { default as normalize } from './normalize';
|
||||
export { default as deprecationEntries } from './Deprecated';
|
||||
export { replaceRootDirInPath } from './utils';
|
||||
export { default as defaults } from './Defaults';
|
||||
export { default as descriptions } from './Descriptions';
|
||||
import * as constants from './constants';
|
||||
export { constants };
|
||||
declare type ReadConfig = {
|
||||
configPath: Config.Path | null | undefined;
|
||||
globalConfig: Config.GlobalConfig;
|
||||
hasDeprecationWarnings: boolean;
|
||||
projectConfig: Config.ProjectConfig;
|
||||
};
|
||||
export declare function readConfig(argv: Config.Argv, packageRootOrConfig: Config.Path | Config.InitialOptions, skipArgvConfigOption?: boolean, parentConfigPath?: Config.Path | null, projectIndex?: number): Promise<ReadConfig>;
|
||||
export declare function readConfigs(argv: Config.Argv, projectPaths: Array<Config.Path>): Promise<{
|
||||
globalConfig: Config.GlobalConfig;
|
||||
configs: Array<Config.ProjectConfig>;
|
||||
hasDeprecationWarnings: boolean;
|
||||
}>;
|
474
node_modules/jest-config/build/index.js
generated
vendored
Normal file
474
node_modules/jest-config/build/index.js
generated
vendored
Normal file
@ -0,0 +1,474 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.readConfig = readConfig;
|
||||
exports.readConfigs = readConfigs;
|
||||
Object.defineProperty(exports, 'getTestEnvironment', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.getTestEnvironment;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'isJSONString', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.isJSONString;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'replaceRootDirInPath', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.replaceRootDirInPath;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'normalize', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _normalize.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'deprecationEntries', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _Deprecated.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'defaults', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _Defaults.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'descriptions', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _Descriptions.default;
|
||||
}
|
||||
});
|
||||
exports.constants = void 0;
|
||||
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function fs() {
|
||||
const data = _interopRequireWildcard(require('graceful-fs'));
|
||||
|
||||
fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _realpathNative() {
|
||||
const data = require('realpath-native');
|
||||
|
||||
_realpathNative = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
var _normalize = _interopRequireDefault(require('./normalize'));
|
||||
|
||||
var _resolveConfigPath = _interopRequireDefault(require('./resolveConfigPath'));
|
||||
|
||||
var _readConfigFileAndSetRootDir = _interopRequireDefault(
|
||||
require('./readConfigFileAndSetRootDir')
|
||||
);
|
||||
|
||||
var _Deprecated = _interopRequireDefault(require('./Deprecated'));
|
||||
|
||||
var _Defaults = _interopRequireDefault(require('./Defaults'));
|
||||
|
||||
var _Descriptions = _interopRequireDefault(require('./Descriptions'));
|
||||
|
||||
var constants = _interopRequireWildcard(require('./constants'));
|
||||
|
||||
exports.constants = constants;
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
async function readConfig(
|
||||
argv,
|
||||
packageRootOrConfig, // Whether it needs to look into `--config` arg passed to CLI.
|
||||
// It only used to read initial config. If the initial config contains
|
||||
// `project` property, we don't want to read `--config` value and rather
|
||||
// read individual configs for every project.
|
||||
skipArgvConfigOption,
|
||||
parentConfigPath,
|
||||
projectIndex = Infinity
|
||||
) {
|
||||
let rawOptions;
|
||||
let configPath = null;
|
||||
|
||||
if (typeof packageRootOrConfig !== 'string') {
|
||||
if (parentConfigPath) {
|
||||
const parentConfigDirname = path().dirname(parentConfigPath);
|
||||
rawOptions = packageRootOrConfig;
|
||||
rawOptions.rootDir = rawOptions.rootDir
|
||||
? (0, _utils.replaceRootDirInPath)(
|
||||
parentConfigDirname,
|
||||
rawOptions.rootDir
|
||||
)
|
||||
: parentConfigDirname;
|
||||
} else {
|
||||
throw new Error(
|
||||
'Jest: Cannot use configuration as an object without a file path.'
|
||||
);
|
||||
}
|
||||
} else if ((0, _utils.isJSONString)(argv.config)) {
|
||||
// A JSON string was passed to `--config` argument and we can parse it
|
||||
// and use as is.
|
||||
let config;
|
||||
|
||||
try {
|
||||
config = JSON.parse(argv.config);
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
'There was an error while parsing the `--config` argument as a JSON string.'
|
||||
);
|
||||
} // NOTE: we might need to resolve this dir to an absolute path in the future
|
||||
|
||||
config.rootDir = config.rootDir || packageRootOrConfig;
|
||||
rawOptions = config; // A string passed to `--config`, which is either a direct path to the config
|
||||
// or a path to directory containing `package.json` or `jest.config.js`
|
||||
} else if (!skipArgvConfigOption && typeof argv.config == 'string') {
|
||||
configPath = (0, _resolveConfigPath.default)(argv.config, process.cwd());
|
||||
rawOptions = await (0, _readConfigFileAndSetRootDir.default)(configPath);
|
||||
} else {
|
||||
// Otherwise just try to find config in the current rootDir.
|
||||
configPath = (0, _resolveConfigPath.default)(
|
||||
packageRootOrConfig,
|
||||
process.cwd()
|
||||
);
|
||||
rawOptions = await (0, _readConfigFileAndSetRootDir.default)(configPath);
|
||||
}
|
||||
|
||||
const {options, hasDeprecationWarnings} = (0, _normalize.default)(
|
||||
rawOptions,
|
||||
argv,
|
||||
configPath,
|
||||
projectIndex
|
||||
);
|
||||
const {globalConfig, projectConfig} = groupOptions(options);
|
||||
return {
|
||||
configPath,
|
||||
globalConfig,
|
||||
hasDeprecationWarnings,
|
||||
projectConfig
|
||||
};
|
||||
}
|
||||
|
||||
const groupOptions = options => ({
|
||||
globalConfig: Object.freeze({
|
||||
bail: options.bail,
|
||||
changedFilesWithAncestor: options.changedFilesWithAncestor,
|
||||
changedSince: options.changedSince,
|
||||
collectCoverage: options.collectCoverage,
|
||||
collectCoverageFrom: options.collectCoverageFrom,
|
||||
collectCoverageOnlyFrom: options.collectCoverageOnlyFrom,
|
||||
coverageDirectory: options.coverageDirectory,
|
||||
coverageProvider: options.coverageProvider,
|
||||
coverageReporters: options.coverageReporters,
|
||||
coverageThreshold: options.coverageThreshold,
|
||||
detectLeaks: options.detectLeaks,
|
||||
detectOpenHandles: options.detectOpenHandles,
|
||||
enabledTestsMap: options.enabledTestsMap,
|
||||
errorOnDeprecated: options.errorOnDeprecated,
|
||||
expand: options.expand,
|
||||
filter: options.filter,
|
||||
findRelatedTests: options.findRelatedTests,
|
||||
forceExit: options.forceExit,
|
||||
globalSetup: options.globalSetup,
|
||||
globalTeardown: options.globalTeardown,
|
||||
json: options.json,
|
||||
lastCommit: options.lastCommit,
|
||||
listTests: options.listTests,
|
||||
logHeapUsage: options.logHeapUsage,
|
||||
maxConcurrency: options.maxConcurrency,
|
||||
maxWorkers: options.maxWorkers,
|
||||
noSCM: undefined,
|
||||
noStackTrace: options.noStackTrace,
|
||||
nonFlagArgs: options.nonFlagArgs,
|
||||
notify: options.notify,
|
||||
notifyMode: options.notifyMode,
|
||||
onlyChanged: options.onlyChanged,
|
||||
onlyFailures: options.onlyFailures,
|
||||
outputFile: options.outputFile,
|
||||
passWithNoTests: options.passWithNoTests,
|
||||
projects: options.projects,
|
||||
replname: options.replname,
|
||||
reporters: options.reporters,
|
||||
rootDir: options.rootDir,
|
||||
runTestsByPath: options.runTestsByPath,
|
||||
silent: options.silent,
|
||||
skipFilter: options.skipFilter,
|
||||
testFailureExitCode: options.testFailureExitCode,
|
||||
testNamePattern: options.testNamePattern,
|
||||
testPathPattern: options.testPathPattern,
|
||||
testResultsProcessor: options.testResultsProcessor,
|
||||
testSequencer: options.testSequencer,
|
||||
testTimeout: options.testTimeout,
|
||||
updateSnapshot: options.updateSnapshot,
|
||||
useStderr: options.useStderr,
|
||||
verbose: options.verbose,
|
||||
watch: options.watch,
|
||||
watchAll: options.watchAll,
|
||||
watchPlugins: options.watchPlugins,
|
||||
watchman: options.watchman
|
||||
}),
|
||||
projectConfig: Object.freeze({
|
||||
automock: options.automock,
|
||||
browser: options.browser,
|
||||
cache: options.cache,
|
||||
cacheDirectory: options.cacheDirectory,
|
||||
clearMocks: options.clearMocks,
|
||||
coveragePathIgnorePatterns: options.coveragePathIgnorePatterns,
|
||||
cwd: options.cwd,
|
||||
dependencyExtractor: options.dependencyExtractor,
|
||||
detectLeaks: options.detectLeaks,
|
||||
detectOpenHandles: options.detectOpenHandles,
|
||||
displayName: options.displayName,
|
||||
errorOnDeprecated: options.errorOnDeprecated,
|
||||
extraGlobals: options.extraGlobals,
|
||||
filter: options.filter,
|
||||
forceCoverageMatch: options.forceCoverageMatch,
|
||||
globalSetup: options.globalSetup,
|
||||
globalTeardown: options.globalTeardown,
|
||||
globals: options.globals,
|
||||
haste: options.haste,
|
||||
moduleDirectories: options.moduleDirectories,
|
||||
moduleFileExtensions: options.moduleFileExtensions,
|
||||
moduleLoader: options.moduleLoader,
|
||||
moduleNameMapper: options.moduleNameMapper,
|
||||
modulePathIgnorePatterns: options.modulePathIgnorePatterns,
|
||||
modulePaths: options.modulePaths,
|
||||
name: options.name,
|
||||
prettierPath: options.prettierPath,
|
||||
resetMocks: options.resetMocks,
|
||||
resetModules: options.resetModules,
|
||||
resolver: options.resolver,
|
||||
restoreMocks: options.restoreMocks,
|
||||
rootDir: options.rootDir,
|
||||
roots: options.roots,
|
||||
runner: options.runner,
|
||||
setupFiles: options.setupFiles,
|
||||
setupFilesAfterEnv: options.setupFilesAfterEnv,
|
||||
skipFilter: options.skipFilter,
|
||||
skipNodeResolution: options.skipNodeResolution,
|
||||
snapshotResolver: options.snapshotResolver,
|
||||
snapshotSerializers: options.snapshotSerializers,
|
||||
testEnvironment: options.testEnvironment,
|
||||
testEnvironmentOptions: options.testEnvironmentOptions,
|
||||
testLocationInResults: options.testLocationInResults,
|
||||
testMatch: options.testMatch,
|
||||
testPathIgnorePatterns: options.testPathIgnorePatterns,
|
||||
testRegex: options.testRegex,
|
||||
testRunner: options.testRunner,
|
||||
testURL: options.testURL,
|
||||
timers: options.timers,
|
||||
transform: options.transform,
|
||||
transformIgnorePatterns: options.transformIgnorePatterns,
|
||||
unmockedModulePathPatterns: options.unmockedModulePathPatterns,
|
||||
watchPathIgnorePatterns: options.watchPathIgnorePatterns
|
||||
})
|
||||
});
|
||||
|
||||
const ensureNoDuplicateConfigs = (parsedConfigs, projects) => {
|
||||
if (projects.length <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
const configPathMap = new Map();
|
||||
|
||||
for (const config of parsedConfigs) {
|
||||
const {configPath} = config;
|
||||
|
||||
if (configPathMap.has(configPath)) {
|
||||
const message = `Whoops! Two projects resolved to the same config path: ${_chalk().default.bold(
|
||||
String(configPath)
|
||||
)}:
|
||||
|
||||
Project 1: ${_chalk().default.bold(
|
||||
projects[parsedConfigs.findIndex(x => x === config)]
|
||||
)}
|
||||
Project 2: ${_chalk().default.bold(
|
||||
projects[parsedConfigs.findIndex(x => x === configPathMap.get(configPath))]
|
||||
)}
|
||||
|
||||
This usually means that your ${_chalk().default.bold(
|
||||
'"projects"'
|
||||
)} config includes a directory that doesn't have any configuration recognizable by Jest. Please fix it.
|
||||
`;
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
if (configPath !== null) {
|
||||
configPathMap.set(configPath, config);
|
||||
}
|
||||
}
|
||||
}; // Possible scenarios:
|
||||
// 1. jest --config config.json
|
||||
// 2. jest --projects p1 p2
|
||||
// 3. jest --projects p1 p2 --config config.json
|
||||
// 4. jest --projects p1
|
||||
// 5. jest
|
||||
//
|
||||
// If no projects are specified, process.cwd() will be used as the default
|
||||
// (and only) project.
|
||||
|
||||
async function readConfigs(argv, projectPaths) {
|
||||
let globalConfig;
|
||||
let hasDeprecationWarnings;
|
||||
let configs = [];
|
||||
let projects = projectPaths;
|
||||
let configPath;
|
||||
|
||||
if (projectPaths.length === 1) {
|
||||
const parsedConfig = await readConfig(argv, projects[0]);
|
||||
configPath = parsedConfig.configPath;
|
||||
hasDeprecationWarnings = parsedConfig.hasDeprecationWarnings;
|
||||
globalConfig = parsedConfig.globalConfig;
|
||||
configs = [parsedConfig.projectConfig];
|
||||
|
||||
if (globalConfig.projects && globalConfig.projects.length) {
|
||||
// Even though we had one project in CLI args, there might be more
|
||||
// projects defined in the config.
|
||||
// In other words, if this was a single project,
|
||||
// and its config has `projects` settings, use that value instead.
|
||||
projects = globalConfig.projects;
|
||||
}
|
||||
}
|
||||
|
||||
if (projects.length > 0) {
|
||||
const projectIsCwd =
|
||||
process.platform === 'win32'
|
||||
? projects[0] === (0, _realpathNative().sync)(process.cwd())
|
||||
: projects[0] === process.cwd();
|
||||
const parsedConfigs = await Promise.all(
|
||||
projects
|
||||
.filter(root => {
|
||||
// Ignore globbed files that cannot be `require`d.
|
||||
if (
|
||||
typeof root === 'string' &&
|
||||
fs().existsSync(root) &&
|
||||
!fs().lstatSync(root).isDirectory() &&
|
||||
!constants.JEST_CONFIG_EXT_ORDER.some(ext => root.endsWith(ext))
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
})
|
||||
.map((root, projectIndex) => {
|
||||
const projectIsTheOnlyProject =
|
||||
projectIndex === 0 && projects.length === 1;
|
||||
const skipArgvConfigOption = !(
|
||||
projectIsTheOnlyProject && projectIsCwd
|
||||
);
|
||||
return readConfig(
|
||||
argv,
|
||||
root,
|
||||
skipArgvConfigOption,
|
||||
configPath,
|
||||
projectIndex
|
||||
);
|
||||
})
|
||||
);
|
||||
ensureNoDuplicateConfigs(parsedConfigs, projects);
|
||||
configs = parsedConfigs.map(({projectConfig}) => projectConfig);
|
||||
|
||||
if (!hasDeprecationWarnings) {
|
||||
hasDeprecationWarnings = parsedConfigs.some(
|
||||
({hasDeprecationWarnings}) => !!hasDeprecationWarnings
|
||||
);
|
||||
} // If no config was passed initially, use the one from the first project
|
||||
|
||||
if (!globalConfig) {
|
||||
globalConfig = parsedConfigs[0].globalConfig;
|
||||
}
|
||||
}
|
||||
|
||||
if (!globalConfig || !configs.length) {
|
||||
throw new Error('jest: No configuration found for any project.');
|
||||
}
|
||||
|
||||
return {
|
||||
configs,
|
||||
globalConfig,
|
||||
hasDeprecationWarnings: !!hasDeprecationWarnings
|
||||
};
|
||||
}
|
13
node_modules/jest-config/build/normalize.d.ts
generated
vendored
Normal file
13
node_modules/jest-config/build/normalize.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 type { Config } from '@jest/types';
|
||||
declare type AllOptions = Config.ProjectConfig & Config.GlobalConfig;
|
||||
export default function normalize(initialOptions: Config.InitialOptions, argv: Config.Argv, configPath?: Config.Path | null, projectIndex?: number): {
|
||||
hasDeprecationWarnings: boolean;
|
||||
options: AllOptions;
|
||||
};
|
||||
export {};
|
1260
node_modules/jest-config/build/normalize.js
generated
vendored
Normal file
1260
node_modules/jest-config/build/normalize.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8
node_modules/jest-config/build/readConfigFileAndSetRootDir.d.ts
generated
vendored
Normal file
8
node_modules/jest-config/build/readConfigFileAndSetRootDir.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* 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 type { Config } from '@jest/types';
|
||||
export default function readConfigFileAndSetRootDir(configPath: Config.Path): Promise<Config.InitialOptions>;
|
157
node_modules/jest-config/build/readConfigFileAndSetRootDir.js
generated
vendored
Normal file
157
node_modules/jest-config/build/readConfigFileAndSetRootDir.js
generated
vendored
Normal file
@ -0,0 +1,157 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = readConfigFileAndSetRootDir;
|
||||
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function fs() {
|
||||
const data = _interopRequireWildcard(require('graceful-fs'));
|
||||
|
||||
fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _jsonlint = _interopRequireDefault(require('./vendor/jsonlint'));
|
||||
|
||||
var _constants = require('./constants');
|
||||
|
||||
function _importEsm() {
|
||||
const data = _interopRequireDefault(require('./importEsm'));
|
||||
|
||||
_importEsm = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
// @ts-ignore: vendored
|
||||
// Read the configuration and set its `rootDir`
|
||||
// 1. If it's a `package.json` file, we look into its "jest" property
|
||||
// 2. For any other file, we just require it. If we receive an 'ERR_REQUIRE_ESM'
|
||||
// from node, perform a dynamic import instead.
|
||||
async function readConfigFileAndSetRootDir(configPath) {
|
||||
const isJSON = configPath.endsWith(_constants.JEST_CONFIG_EXT_JSON);
|
||||
let configObject;
|
||||
|
||||
try {
|
||||
configObject = require(configPath);
|
||||
} catch (error) {
|
||||
if (error.code === 'ERR_REQUIRE_ESM') {
|
||||
try {
|
||||
const importedConfig = await (0, _importEsm().default)(configPath);
|
||||
|
||||
if (!importedConfig.default) {
|
||||
throw new Error(
|
||||
`Jest: Failed to load mjs config file ${configPath} - did you use a default export?`
|
||||
);
|
||||
}
|
||||
|
||||
configObject = importedConfig.default;
|
||||
} catch (innerError) {
|
||||
if (innerError.message === 'Not supported') {
|
||||
throw new Error(
|
||||
`Jest: Your version of Node does not support dynamic import - please enable it or use a .cjs file extension for file ${configPath}`
|
||||
);
|
||||
}
|
||||
|
||||
throw innerError;
|
||||
}
|
||||
} else if (isJSON) {
|
||||
throw new Error(
|
||||
`Jest: Failed to parse config file ${configPath}\n` +
|
||||
` ${_jsonlint.default.errors(fs().readFileSync(configPath, 'utf8'))}`
|
||||
);
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
if (configPath.endsWith(_constants.PACKAGE_JSON)) {
|
||||
// Event if there's no "jest" property in package.json we will still use
|
||||
// an empty object.
|
||||
configObject = configObject.jest || {};
|
||||
}
|
||||
|
||||
if (configObject.rootDir) {
|
||||
// We don't touch it if it has an absolute path specified
|
||||
if (!path().isAbsolute(configObject.rootDir)) {
|
||||
// otherwise, we'll resolve it relative to the file's __dirname
|
||||
configObject.rootDir = path().resolve(
|
||||
path().dirname(configPath),
|
||||
configObject.rootDir
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// If rootDir is not there, we'll set it to this file's __dirname
|
||||
configObject.rootDir = path().dirname(configPath);
|
||||
}
|
||||
|
||||
return configObject;
|
||||
}
|
8
node_modules/jest-config/build/resolveConfigPath.d.ts
generated
vendored
Normal file
8
node_modules/jest-config/build/resolveConfigPath.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* 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 const _default: (pathToResolve: string, cwd: string) => string;
|
||||
export default _default;
|
153
node_modules/jest-config/build/resolveConfigPath.js
generated
vendored
Normal file
153
node_modules/jest-config/build/resolveConfigPath.js
generated
vendored
Normal file
@ -0,0 +1,153 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function fs() {
|
||||
const data = _interopRequireWildcard(require('graceful-fs'));
|
||||
|
||||
fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _constants = require('./constants');
|
||||
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 isFile = filePath =>
|
||||
fs().existsSync(filePath) && !fs().lstatSync(filePath).isDirectory();
|
||||
|
||||
const getConfigFilename = ext => _constants.JEST_CONFIG_BASE_NAME + ext;
|
||||
|
||||
var _default = (pathToResolve, cwd) => {
|
||||
if (!path().isAbsolute(cwd)) {
|
||||
throw new Error(`"cwd" must be an absolute path. cwd: ${cwd}`);
|
||||
}
|
||||
|
||||
const absolutePath = path().isAbsolute(pathToResolve)
|
||||
? pathToResolve
|
||||
: path().resolve(cwd, pathToResolve);
|
||||
|
||||
if (isFile(absolutePath)) {
|
||||
return absolutePath;
|
||||
} // This is a guard against passing non existing path as a project/config,
|
||||
// that will otherwise result in a very confusing situation.
|
||||
// e.g.
|
||||
// With a directory structure like this:
|
||||
// my_project/
|
||||
// packcage.json
|
||||
//
|
||||
// Passing a `my_project/some_directory_that_doesnt_exist` as a project
|
||||
// name will resolve into a (possibly empty) `my_project/package.json` and
|
||||
// try to run all tests it finds under `my_project` directory.
|
||||
|
||||
if (!fs().existsSync(absolutePath)) {
|
||||
throw new Error(
|
||||
`Can't find a root directory while resolving a config file path.\n` +
|
||||
`Provided path to resolve: ${pathToResolve}\n` +
|
||||
`cwd: ${cwd}`
|
||||
);
|
||||
}
|
||||
|
||||
return resolveConfigPathByTraversing(absolutePath, pathToResolve, cwd);
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
|
||||
const resolveConfigPathByTraversing = (pathToResolve, initialPath, cwd) => {
|
||||
const jestConfig = _constants.JEST_CONFIG_EXT_ORDER.map(ext =>
|
||||
path().resolve(pathToResolve, getConfigFilename(ext))
|
||||
).find(isFile);
|
||||
|
||||
if (jestConfig) {
|
||||
return jestConfig;
|
||||
}
|
||||
|
||||
const packageJson = path().resolve(pathToResolve, _constants.PACKAGE_JSON);
|
||||
|
||||
if (isFile(packageJson)) {
|
||||
return packageJson;
|
||||
} // This is the system root.
|
||||
// We tried everything, config is nowhere to be found ¯\_(ツ)_/¯
|
||||
|
||||
if (pathToResolve === path().dirname(pathToResolve)) {
|
||||
throw new Error(makeResolutionErrorMessage(initialPath, cwd));
|
||||
} // go up a level and try it again
|
||||
|
||||
return resolveConfigPathByTraversing(
|
||||
path().dirname(pathToResolve),
|
||||
initialPath,
|
||||
cwd
|
||||
);
|
||||
};
|
||||
|
||||
const makeResolutionErrorMessage = (initialPath, cwd) =>
|
||||
'Could not find a config file based on provided values:\n' +
|
||||
`path: "${initialPath}"\n` +
|
||||
`cwd: "${cwd}"\n` +
|
||||
'Config paths must be specified by either a direct path to a config\n' +
|
||||
'file, or a path to a directory. If directory is given, Jest will try to\n' +
|
||||
`traverse directory tree up, until it finds one of those files in exact order: ${_constants.JEST_CONFIG_EXT_ORDER.map(
|
||||
ext => `"${getConfigFilename(ext)}"`
|
||||
).join(' or ')}.`;
|
8
node_modules/jest-config/build/setFromArgv.d.ts
generated
vendored
Normal file
8
node_modules/jest-config/build/setFromArgv.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* 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 type { Config } from '@jest/types';
|
||||
export default function setFromArgv(options: Config.InitialOptions, argv: Config.Argv): Config.InitialOptions;
|
67
node_modules/jest-config/build/setFromArgv.js
generated
vendored
Normal file
67
node_modules/jest-config/build/setFromArgv.js
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = setFromArgv;
|
||||
|
||||
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 specialArgs = ['_', '$0', 'h', 'help', 'config'];
|
||||
|
||||
function setFromArgv(options, argv) {
|
||||
const argvToOptions = Object.keys(argv)
|
||||
.filter(key => argv[key] !== undefined && specialArgs.indexOf(key) === -1)
|
||||
.reduce((options, key) => {
|
||||
switch (key) {
|
||||
case 'coverage':
|
||||
options.collectCoverage = argv[key];
|
||||
break;
|
||||
|
||||
case 'json':
|
||||
options.useStderr = argv[key];
|
||||
break;
|
||||
|
||||
case 'watchAll':
|
||||
options.watch = false;
|
||||
options.watchAll = argv[key];
|
||||
break;
|
||||
|
||||
case 'env':
|
||||
options.testEnvironment = argv[key];
|
||||
break;
|
||||
|
||||
case 'config':
|
||||
break;
|
||||
|
||||
case 'coverageThreshold':
|
||||
case 'globals':
|
||||
case 'moduleNameMapper':
|
||||
case 'transform':
|
||||
case 'haste':
|
||||
const str = argv[key];
|
||||
|
||||
if ((0, _utils.isJSONString)(str)) {
|
||||
options[key] = JSON.parse(str);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
options[key] = argv[key];
|
||||
}
|
||||
|
||||
return options;
|
||||
}, {});
|
||||
return {
|
||||
...options,
|
||||
...((0, _utils.isJSONString)(argv.config) ? JSON.parse(argv.config) : null),
|
||||
...argvToOptions
|
||||
};
|
||||
}
|
9
node_modules/jest-config/build/ts3.4/Defaults.d.ts
generated
vendored
Normal file
9
node_modules/jest-config/build/ts3.4/Defaults.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 { Config } from '@jest/types';
|
||||
declare const defaultOptions: Config.DefaultOptions;
|
||||
export default defaultOptions;
|
8
node_modules/jest-config/build/ts3.4/Deprecated.d.ts
generated
vendored
Normal file
8
node_modules/jest-config/build/ts3.4/Deprecated.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* 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 const _default: Record<string, Function>;
|
||||
export default _default;
|
11
node_modules/jest-config/build/ts3.4/Descriptions.d.ts
generated
vendored
Normal file
11
node_modules/jest-config/build/ts3.4/Descriptions.d.ts
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* 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';
|
||||
declare const descriptions: {
|
||||
[key in keyof Config.InitialOptions]: string;
|
||||
};
|
||||
export default descriptions;
|
19
node_modules/jest-config/build/ts3.4/ReporterValidationErrors.d.ts
generated
vendored
Normal file
19
node_modules/jest-config/build/ts3.4/ReporterValidationErrors.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.
|
||||
*/
|
||||
import { Config } from '@jest/types';
|
||||
import { ValidationError } from 'jest-validate';
|
||||
/**
|
||||
* Reporter Validation Error is thrown if the given arguments
|
||||
* within the reporter are not valid.
|
||||
*
|
||||
* This is a highly specific reporter error and in the future will be
|
||||
* merged with jest-validate. Till then, we can make use of it. It works
|
||||
* and that's what counts most at this time.
|
||||
*/
|
||||
export declare function createReporterError(reporterIndex: number, reporterValue: Array<Config.ReporterConfig> | string): ValidationError;
|
||||
export declare function createArrayReporterError(arrayReporter: Config.ReporterConfig, reporterIndex: number, valueIndex: number, value: string | Record<string, unknown>, expectedType: string, valueName: string): ValidationError;
|
||||
export declare function validateReporters(reporterConfig: Array<Config.ReporterConfig | string>): boolean;
|
9
node_modules/jest-config/build/ts3.4/ValidConfig.d.ts
generated
vendored
Normal file
9
node_modules/jest-config/build/ts3.4/ValidConfig.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 { Config } from '@jest/types';
|
||||
declare const initialOptions: Config.InitialOptions;
|
||||
export default initialOptions;
|
7
node_modules/jest-config/build/ts3.4/color.d.ts
generated
vendored
Normal file
7
node_modules/jest-config/build/ts3.4/color.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 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 getDisplayNameColor: (seed?: string | undefined) => "hex" | "bold" | "reset" | "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright" | "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough" | "visible" | "Instance" | "level" | "keyword" | "rgb" | "hsl" | "hsv" | "hwb" | "ansi" | "ansi256" | "bgHex" | "bgKeyword" | "bgRgb" | "bgHsl" | "bgHsv" | "bgHwb" | "bgAnsi" | "bgAnsi256" | "supportsColor" | "Level" | "Color" | "ForegroundColor" | "BackgroundColor" | "Modifiers" | "stderr";
|
16
node_modules/jest-config/build/ts3.4/constants.d.ts
generated
vendored
Normal file
16
node_modules/jest-config/build/ts3.4/constants.d.ts
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* 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 NODE_MODULES: string;
|
||||
export declare const DEFAULT_JS_PATTERN = "^.+\\.[jt]sx?$";
|
||||
export declare const DEFAULT_REPORTER_LABEL = "default";
|
||||
export declare const PACKAGE_JSON = "package.json";
|
||||
export declare const JEST_CONFIG_BASE_NAME = "jest.config";
|
||||
export declare const JEST_CONFIG_EXT_CJS = ".cjs";
|
||||
export declare const JEST_CONFIG_EXT_MJS = ".mjs";
|
||||
export declare const JEST_CONFIG_EXT_JS = ".js";
|
||||
export declare const JEST_CONFIG_EXT_JSON = ".json";
|
||||
export declare const JEST_CONFIG_EXT_ORDER: readonly string[];
|
8
node_modules/jest-config/build/ts3.4/getCacheDirectory.d.ts
generated
vendored
Normal file
8
node_modules/jest-config/build/ts3.4/getCacheDirectory.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* 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 const getCacheDirectory: () => string;
|
||||
export default getCacheDirectory;
|
8
node_modules/jest-config/build/ts3.4/getMaxWorkers.d.ts
generated
vendored
Normal file
8
node_modules/jest-config/build/ts3.4/getMaxWorkers.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* 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';
|
||||
export default function getMaxWorkers(argv: Partial<Pick<Config.Argv, 'maxWorkers' | 'runInBand' | 'watch' | 'watchAll'>>, defaultOptions?: Partial<Pick<Config.Argv, 'maxWorkers'>>): number;
|
10
node_modules/jest-config/build/ts3.4/importEsm.d.ts
generated
vendored
Normal file
10
node_modules/jest-config/build/ts3.4/importEsm.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.
|
||||
*/
|
||||
declare const _default: (specifier: string) => Promise<{
|
||||
default: unknown;
|
||||
}>;
|
||||
export default _default;
|
27
node_modules/jest-config/build/ts3.4/index.d.ts
generated
vendored
Normal file
27
node_modules/jest-config/build/ts3.4/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 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';
|
||||
export { getTestEnvironment, isJSONString } from './utils';
|
||||
export { default as normalize } from './normalize';
|
||||
export { default as deprecationEntries } from './Deprecated';
|
||||
export { replaceRootDirInPath } from './utils';
|
||||
export { default as defaults } from './Defaults';
|
||||
export { default as descriptions } from './Descriptions';
|
||||
import * as constants from './constants';
|
||||
export { constants };
|
||||
declare type ReadConfig = {
|
||||
configPath: Config.Path | null | undefined;
|
||||
globalConfig: Config.GlobalConfig;
|
||||
hasDeprecationWarnings: boolean;
|
||||
projectConfig: Config.ProjectConfig;
|
||||
};
|
||||
export declare function readConfig(argv: Config.Argv, packageRootOrConfig: Config.Path | Config.InitialOptions, skipArgvConfigOption?: boolean, parentConfigPath?: Config.Path | null, projectIndex?: number): Promise<ReadConfig>;
|
||||
export declare function readConfigs(argv: Config.Argv, projectPaths: Array<Config.Path>): Promise<{
|
||||
globalConfig: Config.GlobalConfig;
|
||||
configs: Array<Config.ProjectConfig>;
|
||||
hasDeprecationWarnings: boolean;
|
||||
}>;
|
13
node_modules/jest-config/build/ts3.4/normalize.d.ts
generated
vendored
Normal file
13
node_modules/jest-config/build/ts3.4/normalize.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 { Config } from '@jest/types';
|
||||
declare type AllOptions = Config.ProjectConfig & Config.GlobalConfig;
|
||||
export default function normalize(initialOptions: Config.InitialOptions, argv: Config.Argv, configPath?: Config.Path | null, projectIndex?: number): {
|
||||
hasDeprecationWarnings: boolean;
|
||||
options: AllOptions;
|
||||
};
|
||||
export {};
|
8
node_modules/jest-config/build/ts3.4/readConfigFileAndSetRootDir.d.ts
generated
vendored
Normal file
8
node_modules/jest-config/build/ts3.4/readConfigFileAndSetRootDir.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* 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';
|
||||
export default function readConfigFileAndSetRootDir(configPath: Config.Path): Promise<Config.InitialOptions>;
|
8
node_modules/jest-config/build/ts3.4/resolveConfigPath.d.ts
generated
vendored
Normal file
8
node_modules/jest-config/build/ts3.4/resolveConfigPath.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* 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 const _default: (pathToResolve: string, cwd: string) => string;
|
||||
export default _default;
|
8
node_modules/jest-config/build/ts3.4/setFromArgv.d.ts
generated
vendored
Normal file
8
node_modules/jest-config/build/ts3.4/setFromArgv.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* 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';
|
||||
export default function setFromArgv(options: Config.InitialOptions, argv: Config.Argv): Config.InitialOptions;
|
74
node_modules/jest-config/build/ts3.4/utils.d.ts
generated
vendored
Normal file
74
node_modules/jest-config/build/ts3.4/utils.d.ts
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
/**
|
||||
* 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';
|
||||
declare type ResolveOptions = {
|
||||
rootDir: Config.Path;
|
||||
key: string;
|
||||
filePath: Config.Path;
|
||||
optional?: boolean;
|
||||
};
|
||||
export declare const BULLET: string;
|
||||
export declare const DOCUMENTATION_NOTE: string;
|
||||
export declare const resolve: (resolver: string | null | undefined, { key, filePath, rootDir, optional }: ResolveOptions) => string;
|
||||
export declare const escapeGlobCharacters: (path: string) => string;
|
||||
export declare const replaceRootDirInPath: (rootDir: string, filePath: string) => string;
|
||||
declare type OrArray<T> = T | Array<T>;
|
||||
declare type ReplaceRootDirConfigObj = Record<string, Config.Path>;
|
||||
declare type ReplaceRootDirConfigValues = OrArray<ReplaceRootDirConfigObj> | OrArray<RegExp> | OrArray<Config.Path>;
|
||||
export declare const _replaceRootDirTags: <T extends ReplaceRootDirConfigValues>(rootDir: string, config: T) => T;
|
||||
export declare const resolveWithPrefix: (resolver: string | null | undefined, { filePath, humanOptionName, optionName, prefix, rootDir, }: {
|
||||
filePath: string;
|
||||
humanOptionName: string;
|
||||
optionName: string;
|
||||
prefix: string;
|
||||
rootDir: string;
|
||||
}) => string;
|
||||
/**
|
||||
* Finds the test environment to use:
|
||||
*
|
||||
* 1. looks for jest-environment-<name> relative to project.
|
||||
* 1. looks for jest-environment-<name> relative to Jest.
|
||||
* 1. looks for <name> relative to project.
|
||||
* 1. looks for <name> relative to Jest.
|
||||
*/
|
||||
export declare const getTestEnvironment: ({ rootDir, testEnvironment: filePath, }: {
|
||||
rootDir: string;
|
||||
testEnvironment: string;
|
||||
}) => string;
|
||||
/**
|
||||
* Finds the watch plugins to use:
|
||||
*
|
||||
* 1. looks for jest-watch-<name> relative to project.
|
||||
* 1. looks for jest-watch-<name> relative to Jest.
|
||||
* 1. looks for <name> relative to project.
|
||||
* 1. looks for <name> relative to Jest.
|
||||
*/
|
||||
export declare const getWatchPlugin: (resolver: string | null | undefined, { filePath, rootDir }: {
|
||||
filePath: string;
|
||||
rootDir: string;
|
||||
}) => string;
|
||||
/**
|
||||
* Finds the runner to use:
|
||||
*
|
||||
* 1. looks for jest-runner-<name> relative to project.
|
||||
* 1. looks for jest-runner-<name> relative to Jest.
|
||||
* 1. looks for <name> relative to project.
|
||||
* 1. looks for <name> relative to Jest.
|
||||
*/
|
||||
export declare const getRunner: (resolver: string | null | undefined, { filePath, rootDir }: {
|
||||
filePath: string;
|
||||
rootDir: string;
|
||||
}) => string;
|
||||
declare type JSONString = string & {
|
||||
readonly $$type: never;
|
||||
};
|
||||
export declare const isJSONString: (text?: string | JSONString | undefined) => text is JSONString;
|
||||
export declare const getSequencer: (resolver: string | null | undefined, { filePath, rootDir }: {
|
||||
filePath: string;
|
||||
rootDir: string;
|
||||
}) => string;
|
||||
export {};
|
7
node_modules/jest-config/build/ts3.4/validatePattern.d.ts
generated
vendored
Normal file
7
node_modules/jest-config/build/ts3.4/validatePattern.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 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 default function validatePattern(pattern?: string): boolean;
|
74
node_modules/jest-config/build/utils.d.ts
generated
vendored
Normal file
74
node_modules/jest-config/build/utils.d.ts
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
/**
|
||||
* 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 type { Config } from '@jest/types';
|
||||
declare type ResolveOptions = {
|
||||
rootDir: Config.Path;
|
||||
key: string;
|
||||
filePath: Config.Path;
|
||||
optional?: boolean;
|
||||
};
|
||||
export declare const BULLET: string;
|
||||
export declare const DOCUMENTATION_NOTE: string;
|
||||
export declare const resolve: (resolver: string | null | undefined, { key, filePath, rootDir, optional }: ResolveOptions) => string;
|
||||
export declare const escapeGlobCharacters: (path: string) => string;
|
||||
export declare const replaceRootDirInPath: (rootDir: string, filePath: string) => string;
|
||||
declare type OrArray<T> = T | Array<T>;
|
||||
declare type ReplaceRootDirConfigObj = Record<string, Config.Path>;
|
||||
declare type ReplaceRootDirConfigValues = OrArray<ReplaceRootDirConfigObj> | OrArray<RegExp> | OrArray<Config.Path>;
|
||||
export declare const _replaceRootDirTags: <T extends ReplaceRootDirConfigValues>(rootDir: string, config: T) => T;
|
||||
export declare const resolveWithPrefix: (resolver: string | null | undefined, { filePath, humanOptionName, optionName, prefix, rootDir, }: {
|
||||
filePath: string;
|
||||
humanOptionName: string;
|
||||
optionName: string;
|
||||
prefix: string;
|
||||
rootDir: string;
|
||||
}) => string;
|
||||
/**
|
||||
* Finds the test environment to use:
|
||||
*
|
||||
* 1. looks for jest-environment-<name> relative to project.
|
||||
* 1. looks for jest-environment-<name> relative to Jest.
|
||||
* 1. looks for <name> relative to project.
|
||||
* 1. looks for <name> relative to Jest.
|
||||
*/
|
||||
export declare const getTestEnvironment: ({ rootDir, testEnvironment: filePath, }: {
|
||||
rootDir: string;
|
||||
testEnvironment: string;
|
||||
}) => string;
|
||||
/**
|
||||
* Finds the watch plugins to use:
|
||||
*
|
||||
* 1. looks for jest-watch-<name> relative to project.
|
||||
* 1. looks for jest-watch-<name> relative to Jest.
|
||||
* 1. looks for <name> relative to project.
|
||||
* 1. looks for <name> relative to Jest.
|
||||
*/
|
||||
export declare const getWatchPlugin: (resolver: string | null | undefined, { filePath, rootDir }: {
|
||||
filePath: string;
|
||||
rootDir: string;
|
||||
}) => string;
|
||||
/**
|
||||
* Finds the runner to use:
|
||||
*
|
||||
* 1. looks for jest-runner-<name> relative to project.
|
||||
* 1. looks for jest-runner-<name> relative to Jest.
|
||||
* 1. looks for <name> relative to project.
|
||||
* 1. looks for <name> relative to Jest.
|
||||
*/
|
||||
export declare const getRunner: (resolver: string | null | undefined, { filePath, rootDir }: {
|
||||
filePath: string;
|
||||
rootDir: string;
|
||||
}) => string;
|
||||
declare type JSONString = string & {
|
||||
readonly $$type: never;
|
||||
};
|
||||
export declare const isJSONString: (text?: string | JSONString | undefined) => text is JSONString;
|
||||
export declare const getSequencer: (resolver: string | null | undefined, { filePath, rootDir }: {
|
||||
filePath: string;
|
||||
rootDir: string;
|
||||
}) => string;
|
||||
export {};
|
313
node_modules/jest-config/build/utils.js
generated
vendored
Normal file
313
node_modules/jest-config/build/utils.js
generated
vendored
Normal file
@ -0,0 +1,313 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.getSequencer = exports.isJSONString = exports.getRunner = exports.getWatchPlugin = exports.getTestEnvironment = exports.resolveWithPrefix = exports._replaceRootDirTags = exports.replaceRootDirInPath = exports.escapeGlobCharacters = exports.resolve = exports.DOCUMENTATION_NOTE = exports.BULLET = void 0;
|
||||
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestValidate() {
|
||||
const data = require('jest-validate');
|
||||
|
||||
_jestValidate = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestResolve() {
|
||||
const data = _interopRequireDefault(require('jest-resolve'));
|
||||
|
||||
_jestResolve = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ');
|
||||
|
||||
exports.BULLET = BULLET;
|
||||
const DOCUMENTATION_NOTE = ` ${_chalk().default.bold(
|
||||
'Configuration Documentation:'
|
||||
)}
|
||||
https://jestjs.io/docs/configuration.html
|
||||
`;
|
||||
exports.DOCUMENTATION_NOTE = DOCUMENTATION_NOTE;
|
||||
|
||||
const createValidationError = message =>
|
||||
new (_jestValidate().ValidationError)(
|
||||
`${BULLET}Validation Error`,
|
||||
message,
|
||||
DOCUMENTATION_NOTE
|
||||
);
|
||||
|
||||
const resolve = (resolver, {key, filePath, rootDir, optional}) => {
|
||||
const module = _jestResolve().default.findNodeModule(
|
||||
replaceRootDirInPath(rootDir, filePath),
|
||||
{
|
||||
basedir: rootDir,
|
||||
resolver: resolver || undefined
|
||||
}
|
||||
);
|
||||
|
||||
if (!module && !optional) {
|
||||
throw createValidationError(` Module ${_chalk().default.bold(
|
||||
filePath
|
||||
)} in the ${_chalk().default.bold(key)} option was not found.
|
||||
${_chalk().default.bold('<rootDir>')} is: ${rootDir}`);
|
||||
} /// can cast as string since nulls will be thrown
|
||||
|
||||
return module;
|
||||
};
|
||||
|
||||
exports.resolve = resolve;
|
||||
|
||||
const escapeGlobCharacters = path => path.replace(/([()*{}\[\]!?\\])/g, '\\$1');
|
||||
|
||||
exports.escapeGlobCharacters = escapeGlobCharacters;
|
||||
|
||||
const replaceRootDirInPath = (rootDir, filePath) => {
|
||||
if (!/^<rootDir>/.test(filePath)) {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
return path().resolve(
|
||||
rootDir,
|
||||
path().normalize('./' + filePath.substr('<rootDir>'.length))
|
||||
);
|
||||
};
|
||||
|
||||
exports.replaceRootDirInPath = replaceRootDirInPath;
|
||||
|
||||
const _replaceRootDirInObject = (rootDir, config) => {
|
||||
const newConfig = {};
|
||||
|
||||
for (const configKey in config) {
|
||||
newConfig[configKey] =
|
||||
configKey === 'rootDir'
|
||||
? config[configKey]
|
||||
: _replaceRootDirTags(rootDir, config[configKey]);
|
||||
}
|
||||
|
||||
return newConfig;
|
||||
};
|
||||
|
||||
const _replaceRootDirTags = (rootDir, config) => {
|
||||
if (config == null) {
|
||||
return config;
|
||||
}
|
||||
|
||||
switch (typeof config) {
|
||||
case 'object':
|
||||
if (Array.isArray(config)) {
|
||||
/// can be string[] or {}[]
|
||||
return config.map(item => _replaceRootDirTags(rootDir, item));
|
||||
}
|
||||
|
||||
if (config instanceof RegExp) {
|
||||
return config;
|
||||
}
|
||||
|
||||
return _replaceRootDirInObject(rootDir, config);
|
||||
|
||||
case 'string':
|
||||
return replaceRootDirInPath(rootDir, config);
|
||||
}
|
||||
|
||||
return config;
|
||||
};
|
||||
|
||||
exports._replaceRootDirTags = _replaceRootDirTags;
|
||||
|
||||
const resolveWithPrefix = (
|
||||
resolver,
|
||||
{filePath, humanOptionName, optionName, prefix, rootDir}
|
||||
) => {
|
||||
const fileName = replaceRootDirInPath(rootDir, filePath);
|
||||
|
||||
let module = _jestResolve().default.findNodeModule(`${prefix}${fileName}`, {
|
||||
basedir: rootDir,
|
||||
resolver: resolver || undefined
|
||||
});
|
||||
|
||||
if (module) {
|
||||
return module;
|
||||
}
|
||||
|
||||
try {
|
||||
return require.resolve(`${prefix}${fileName}`);
|
||||
} catch (e) {}
|
||||
|
||||
module = _jestResolve().default.findNodeModule(fileName, {
|
||||
basedir: rootDir,
|
||||
resolver: resolver || undefined
|
||||
});
|
||||
|
||||
if (module) {
|
||||
return module;
|
||||
}
|
||||
|
||||
try {
|
||||
return require.resolve(fileName);
|
||||
} catch (e) {}
|
||||
|
||||
throw createValidationError(
|
||||
` ${humanOptionName} ${_chalk().default.bold(
|
||||
fileName
|
||||
)} cannot be found. Make sure the ${_chalk().default.bold(
|
||||
optionName
|
||||
)} configuration option points to an existing node module.`
|
||||
);
|
||||
};
|
||||
/**
|
||||
* Finds the test environment to use:
|
||||
*
|
||||
* 1. looks for jest-environment-<name> relative to project.
|
||||
* 1. looks for jest-environment-<name> relative to Jest.
|
||||
* 1. looks for <name> relative to project.
|
||||
* 1. looks for <name> relative to Jest.
|
||||
*/
|
||||
|
||||
exports.resolveWithPrefix = resolveWithPrefix;
|
||||
|
||||
const getTestEnvironment = ({rootDir, testEnvironment: filePath}) =>
|
||||
resolveWithPrefix(undefined, {
|
||||
filePath,
|
||||
humanOptionName: 'Test environment',
|
||||
optionName: 'testEnvironment',
|
||||
prefix: 'jest-environment-',
|
||||
rootDir
|
||||
});
|
||||
/**
|
||||
* Finds the watch plugins to use:
|
||||
*
|
||||
* 1. looks for jest-watch-<name> relative to project.
|
||||
* 1. looks for jest-watch-<name> relative to Jest.
|
||||
* 1. looks for <name> relative to project.
|
||||
* 1. looks for <name> relative to Jest.
|
||||
*/
|
||||
|
||||
exports.getTestEnvironment = getTestEnvironment;
|
||||
|
||||
const getWatchPlugin = (resolver, {filePath, rootDir}) =>
|
||||
resolveWithPrefix(resolver, {
|
||||
filePath,
|
||||
humanOptionName: 'Watch plugin',
|
||||
optionName: 'watchPlugins',
|
||||
prefix: 'jest-watch-',
|
||||
rootDir
|
||||
});
|
||||
/**
|
||||
* Finds the runner to use:
|
||||
*
|
||||
* 1. looks for jest-runner-<name> relative to project.
|
||||
* 1. looks for jest-runner-<name> relative to Jest.
|
||||
* 1. looks for <name> relative to project.
|
||||
* 1. looks for <name> relative to Jest.
|
||||
*/
|
||||
|
||||
exports.getWatchPlugin = getWatchPlugin;
|
||||
|
||||
const getRunner = (resolver, {filePath, rootDir}) =>
|
||||
resolveWithPrefix(resolver, {
|
||||
filePath,
|
||||
humanOptionName: 'Jest Runner',
|
||||
optionName: 'runner',
|
||||
prefix: 'jest-runner-',
|
||||
rootDir
|
||||
});
|
||||
|
||||
exports.getRunner = getRunner;
|
||||
|
||||
// newtype
|
||||
const isJSONString = text =>
|
||||
text != null &&
|
||||
typeof text === 'string' &&
|
||||
text.startsWith('{') &&
|
||||
text.endsWith('}');
|
||||
|
||||
exports.isJSONString = isJSONString;
|
||||
|
||||
const getSequencer = (resolver, {filePath, rootDir}) =>
|
||||
resolveWithPrefix(resolver, {
|
||||
filePath,
|
||||
humanOptionName: 'Jest Sequencer',
|
||||
optionName: 'testSequencer',
|
||||
prefix: 'jest-sequencer-',
|
||||
rootDir
|
||||
});
|
||||
|
||||
exports.getSequencer = getSequencer;
|
7
node_modules/jest-config/build/validatePattern.d.ts
generated
vendored
Normal file
7
node_modules/jest-config/build/validatePattern.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 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 default function validatePattern(pattern?: string): boolean;
|
25
node_modules/jest-config/build/validatePattern.js
generated
vendored
Normal file
25
node_modules/jest-config/build/validatePattern.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = validatePattern;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
function validatePattern(pattern) {
|
||||
if (pattern) {
|
||||
try {
|
||||
// eslint-disable-next-line no-new
|
||||
new RegExp(pattern, 'i');
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
917
node_modules/jest-config/build/vendor/jsonlint.js
generated
vendored
Normal file
917
node_modules/jest-config/build/vendor/jsonlint.js
generated
vendored
Normal file
@ -0,0 +1,917 @@
|
||||
'use strict';
|
||||
|
||||
// From: https://github.com/zaach/jsonlint
|
||||
// Vendored in Jest to avoid jsonlint's transitive dependencies.
|
||||
|
||||
/* eslint-disable */
|
||||
var jsonlint = (function () {
|
||||
var parser = {
|
||||
trace: function trace() {},
|
||||
yy: {},
|
||||
symbols_: {
|
||||
error: 2,
|
||||
JSONString: 3,
|
||||
STRING: 4,
|
||||
JSONNumber: 5,
|
||||
NUMBER: 6,
|
||||
JSONNullLiteral: 7,
|
||||
NULL: 8,
|
||||
JSONBooleanLiteral: 9,
|
||||
TRUE: 10,
|
||||
FALSE: 11,
|
||||
JSONText: 12,
|
||||
JSONValue: 13,
|
||||
EOF: 14,
|
||||
JSONObject: 15,
|
||||
JSONArray: 16,
|
||||
'{': 17,
|
||||
'}': 18,
|
||||
JSONMemberList: 19,
|
||||
JSONMember: 20,
|
||||
':': 21,
|
||||
',': 22,
|
||||
'[': 23,
|
||||
']': 24,
|
||||
JSONElementList: 25,
|
||||
$accept: 0,
|
||||
$end: 1
|
||||
},
|
||||
terminals_: {
|
||||
2: 'error',
|
||||
4: 'STRING',
|
||||
6: 'NUMBER',
|
||||
8: 'NULL',
|
||||
10: 'TRUE',
|
||||
11: 'FALSE',
|
||||
14: 'EOF',
|
||||
17: '{',
|
||||
18: '}',
|
||||
21: ':',
|
||||
22: ',',
|
||||
23: '[',
|
||||
24: ']'
|
||||
},
|
||||
productions_: [
|
||||
0,
|
||||
[3, 1],
|
||||
[5, 1],
|
||||
[7, 1],
|
||||
[9, 1],
|
||||
[9, 1],
|
||||
[12, 2],
|
||||
[13, 1],
|
||||
[13, 1],
|
||||
[13, 1],
|
||||
[13, 1],
|
||||
[13, 1],
|
||||
[13, 1],
|
||||
[15, 2],
|
||||
[15, 3],
|
||||
[20, 3],
|
||||
[19, 1],
|
||||
[19, 3],
|
||||
[16, 2],
|
||||
[16, 3],
|
||||
[25, 1],
|
||||
[25, 3]
|
||||
],
|
||||
performAction: function anonymous(
|
||||
yytext,
|
||||
yyleng,
|
||||
yylineno,
|
||||
yy,
|
||||
yystate,
|
||||
$$,
|
||||
_$
|
||||
) {
|
||||
var $0 = $$.length - 1;
|
||||
|
||||
switch (yystate) {
|
||||
case 1:
|
||||
// replace escaped characters with actual character
|
||||
this.$ = yytext
|
||||
.replace(/\\(\\|")/g, '$' + '1')
|
||||
.replace(/\\n/g, '\n')
|
||||
.replace(/\\r/g, '\r')
|
||||
.replace(/\\t/g, '\t')
|
||||
.replace(/\\v/g, '\v')
|
||||
.replace(/\\f/g, '\f')
|
||||
.replace(/\\b/g, '\b');
|
||||
break;
|
||||
|
||||
case 2:
|
||||
this.$ = Number(yytext);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
this.$ = null;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
this.$ = true;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
this.$ = false;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
return (this.$ = $$[$0 - 1]);
|
||||
break;
|
||||
|
||||
case 13:
|
||||
this.$ = {};
|
||||
break;
|
||||
|
||||
case 14:
|
||||
this.$ = $$[$0 - 1];
|
||||
break;
|
||||
|
||||
case 15:
|
||||
this.$ = [$$[$0 - 2], $$[$0]];
|
||||
break;
|
||||
|
||||
case 16:
|
||||
this.$ = {};
|
||||
this.$[$$[$0][0]] = $$[$0][1];
|
||||
break;
|
||||
|
||||
case 17:
|
||||
this.$ = $$[$0 - 2];
|
||||
$$[$0 - 2][$$[$0][0]] = $$[$0][1];
|
||||
break;
|
||||
|
||||
case 18:
|
||||
this.$ = [];
|
||||
break;
|
||||
|
||||
case 19:
|
||||
this.$ = $$[$0 - 1];
|
||||
break;
|
||||
|
||||
case 20:
|
||||
this.$ = [$$[$0]];
|
||||
break;
|
||||
|
||||
case 21:
|
||||
this.$ = $$[$0 - 2];
|
||||
$$[$0 - 2].push($$[$0]);
|
||||
break;
|
||||
}
|
||||
},
|
||||
table: [
|
||||
{
|
||||
3: 5,
|
||||
4: [1, 12],
|
||||
5: 6,
|
||||
6: [1, 13],
|
||||
7: 3,
|
||||
8: [1, 9],
|
||||
9: 4,
|
||||
10: [1, 10],
|
||||
11: [1, 11],
|
||||
12: 1,
|
||||
13: 2,
|
||||
15: 7,
|
||||
16: 8,
|
||||
17: [1, 14],
|
||||
23: [1, 15]
|
||||
},
|
||||
{
|
||||
1: [3]
|
||||
},
|
||||
{
|
||||
14: [1, 16]
|
||||
},
|
||||
{
|
||||
14: [2, 7],
|
||||
18: [2, 7],
|
||||
22: [2, 7],
|
||||
24: [2, 7]
|
||||
},
|
||||
{
|
||||
14: [2, 8],
|
||||
18: [2, 8],
|
||||
22: [2, 8],
|
||||
24: [2, 8]
|
||||
},
|
||||
{
|
||||
14: [2, 9],
|
||||
18: [2, 9],
|
||||
22: [2, 9],
|
||||
24: [2, 9]
|
||||
},
|
||||
{
|
||||
14: [2, 10],
|
||||
18: [2, 10],
|
||||
22: [2, 10],
|
||||
24: [2, 10]
|
||||
},
|
||||
{
|
||||
14: [2, 11],
|
||||
18: [2, 11],
|
||||
22: [2, 11],
|
||||
24: [2, 11]
|
||||
},
|
||||
{
|
||||
14: [2, 12],
|
||||
18: [2, 12],
|
||||
22: [2, 12],
|
||||
24: [2, 12]
|
||||
},
|
||||
{
|
||||
14: [2, 3],
|
||||
18: [2, 3],
|
||||
22: [2, 3],
|
||||
24: [2, 3]
|
||||
},
|
||||
{
|
||||
14: [2, 4],
|
||||
18: [2, 4],
|
||||
22: [2, 4],
|
||||
24: [2, 4]
|
||||
},
|
||||
{
|
||||
14: [2, 5],
|
||||
18: [2, 5],
|
||||
22: [2, 5],
|
||||
24: [2, 5]
|
||||
},
|
||||
{
|
||||
14: [2, 1],
|
||||
18: [2, 1],
|
||||
21: [2, 1],
|
||||
22: [2, 1],
|
||||
24: [2, 1]
|
||||
},
|
||||
{
|
||||
14: [2, 2],
|
||||
18: [2, 2],
|
||||
22: [2, 2],
|
||||
24: [2, 2]
|
||||
},
|
||||
{
|
||||
3: 20,
|
||||
4: [1, 12],
|
||||
18: [1, 17],
|
||||
19: 18,
|
||||
20: 19
|
||||
},
|
||||
{
|
||||
3: 5,
|
||||
4: [1, 12],
|
||||
5: 6,
|
||||
6: [1, 13],
|
||||
7: 3,
|
||||
8: [1, 9],
|
||||
9: 4,
|
||||
10: [1, 10],
|
||||
11: [1, 11],
|
||||
13: 23,
|
||||
15: 7,
|
||||
16: 8,
|
||||
17: [1, 14],
|
||||
23: [1, 15],
|
||||
24: [1, 21],
|
||||
25: 22
|
||||
},
|
||||
{
|
||||
1: [2, 6]
|
||||
},
|
||||
{
|
||||
14: [2, 13],
|
||||
18: [2, 13],
|
||||
22: [2, 13],
|
||||
24: [2, 13]
|
||||
},
|
||||
{
|
||||
18: [1, 24],
|
||||
22: [1, 25]
|
||||
},
|
||||
{
|
||||
18: [2, 16],
|
||||
22: [2, 16]
|
||||
},
|
||||
{
|
||||
21: [1, 26]
|
||||
},
|
||||
{
|
||||
14: [2, 18],
|
||||
18: [2, 18],
|
||||
22: [2, 18],
|
||||
24: [2, 18]
|
||||
},
|
||||
{
|
||||
22: [1, 28],
|
||||
24: [1, 27]
|
||||
},
|
||||
{
|
||||
22: [2, 20],
|
||||
24: [2, 20]
|
||||
},
|
||||
{
|
||||
14: [2, 14],
|
||||
18: [2, 14],
|
||||
22: [2, 14],
|
||||
24: [2, 14]
|
||||
},
|
||||
{
|
||||
3: 20,
|
||||
4: [1, 12],
|
||||
20: 29
|
||||
},
|
||||
{
|
||||
3: 5,
|
||||
4: [1, 12],
|
||||
5: 6,
|
||||
6: [1, 13],
|
||||
7: 3,
|
||||
8: [1, 9],
|
||||
9: 4,
|
||||
10: [1, 10],
|
||||
11: [1, 11],
|
||||
13: 30,
|
||||
15: 7,
|
||||
16: 8,
|
||||
17: [1, 14],
|
||||
23: [1, 15]
|
||||
},
|
||||
{
|
||||
14: [2, 19],
|
||||
18: [2, 19],
|
||||
22: [2, 19],
|
||||
24: [2, 19]
|
||||
},
|
||||
{
|
||||
3: 5,
|
||||
4: [1, 12],
|
||||
5: 6,
|
||||
6: [1, 13],
|
||||
7: 3,
|
||||
8: [1, 9],
|
||||
9: 4,
|
||||
10: [1, 10],
|
||||
11: [1, 11],
|
||||
13: 31,
|
||||
15: 7,
|
||||
16: 8,
|
||||
17: [1, 14],
|
||||
23: [1, 15]
|
||||
},
|
||||
{
|
||||
18: [2, 17],
|
||||
22: [2, 17]
|
||||
},
|
||||
{
|
||||
18: [2, 15],
|
||||
22: [2, 15]
|
||||
},
|
||||
{
|
||||
22: [2, 21],
|
||||
24: [2, 21]
|
||||
}
|
||||
],
|
||||
defaultActions: {
|
||||
16: [2, 6]
|
||||
},
|
||||
parseError: function parseError(str, hash) {
|
||||
throw new Error(str);
|
||||
},
|
||||
parse: function parse(input) {
|
||||
var self = this,
|
||||
stack = [0],
|
||||
vstack = [null],
|
||||
// semantic value stack
|
||||
lstack = [],
|
||||
// location stack
|
||||
table = this.table,
|
||||
yytext = '',
|
||||
yylineno = 0,
|
||||
yyleng = 0,
|
||||
recovering = 0,
|
||||
TERROR = 2,
|
||||
EOF = 1; //this.reductionCount = this.shiftCount = 0;
|
||||
|
||||
this.lexer.setInput(input);
|
||||
this.lexer.yy = this.yy;
|
||||
this.yy.lexer = this.lexer;
|
||||
if (typeof this.lexer.yylloc == 'undefined') this.lexer.yylloc = {};
|
||||
var yyloc = this.lexer.yylloc;
|
||||
lstack.push(yyloc);
|
||||
if (typeof this.yy.parseError === 'function')
|
||||
this.parseError = this.yy.parseError;
|
||||
|
||||
function popStack(n) {
|
||||
stack.length = stack.length - 2 * n;
|
||||
vstack.length = vstack.length - n;
|
||||
lstack.length = lstack.length - n;
|
||||
}
|
||||
|
||||
function lex() {
|
||||
var token;
|
||||
token = self.lexer.lex() || 1; // $end = 1
|
||||
// if token isn't its numeric value, convert
|
||||
|
||||
if (typeof token !== 'number') {
|
||||
token = self.symbols_[token] || token;
|
||||
}
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
var symbol,
|
||||
preErrorSymbol,
|
||||
state,
|
||||
action,
|
||||
a,
|
||||
r,
|
||||
yyval = {},
|
||||
p,
|
||||
len,
|
||||
newState,
|
||||
expected;
|
||||
|
||||
while (true) {
|
||||
// retrieve state number from top of stack
|
||||
state = stack[stack.length - 1]; // use default actions if available
|
||||
|
||||
if (this.defaultActions[state]) {
|
||||
action = this.defaultActions[state];
|
||||
} else {
|
||||
if (symbol == null) symbol = lex(); // read action for current state and first input
|
||||
|
||||
action = table[state] && table[state][symbol];
|
||||
} // handle parse error
|
||||
|
||||
_handle_error: if (
|
||||
typeof action === 'undefined' ||
|
||||
!action.length ||
|
||||
!action[0]
|
||||
) {
|
||||
if (!recovering) {
|
||||
// Report error
|
||||
expected = [];
|
||||
|
||||
for (p in table[state])
|
||||
if (this.terminals_[p] && p > 2) {
|
||||
expected.push("'" + this.terminals_[p] + "'");
|
||||
}
|
||||
|
||||
var errStr = '';
|
||||
|
||||
if (this.lexer.showPosition) {
|
||||
errStr =
|
||||
'Parse error on line ' +
|
||||
(yylineno + 1) +
|
||||
':\n' +
|
||||
this.lexer.showPosition() +
|
||||
'\nExpecting ' +
|
||||
expected.join(', ') +
|
||||
", got '" +
|
||||
this.terminals_[symbol] +
|
||||
"'";
|
||||
} else {
|
||||
errStr =
|
||||
'Parse error on line ' +
|
||||
(yylineno + 1) +
|
||||
': Unexpected ' +
|
||||
(symbol == 1
|
||||
? /*EOF*/
|
||||
'end of input'
|
||||
: "'" + (this.terminals_[symbol] || symbol) + "'");
|
||||
}
|
||||
|
||||
this.parseError(errStr, {
|
||||
text: this.lexer.match,
|
||||
token: this.terminals_[symbol] || symbol,
|
||||
line: this.lexer.yylineno,
|
||||
loc: yyloc,
|
||||
expected: expected
|
||||
});
|
||||
} // just recovered from another error
|
||||
|
||||
if (recovering == 3) {
|
||||
if (symbol == EOF) {
|
||||
throw new Error(errStr || 'Parsing halted.');
|
||||
} // discard current lookahead and grab another
|
||||
|
||||
yyleng = this.lexer.yyleng;
|
||||
yytext = this.lexer.yytext;
|
||||
yylineno = this.lexer.yylineno;
|
||||
yyloc = this.lexer.yylloc;
|
||||
symbol = lex();
|
||||
} // try to recover from error
|
||||
|
||||
while (1) {
|
||||
// check for error recovery rule in this state
|
||||
if (TERROR.toString() in table[state]) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (state == 0) {
|
||||
throw new Error(errStr || 'Parsing halted.');
|
||||
}
|
||||
|
||||
popStack(1);
|
||||
state = stack[stack.length - 1];
|
||||
}
|
||||
|
||||
preErrorSymbol = symbol; // save the lookahead token
|
||||
|
||||
symbol = TERROR; // insert generic error symbol as new lookahead
|
||||
|
||||
state = stack[stack.length - 1];
|
||||
action = table[state] && table[state][TERROR];
|
||||
recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
|
||||
} // this shouldn't happen, unless resolve defaults are off
|
||||
|
||||
if (action[0] instanceof Array && action.length > 1) {
|
||||
throw new Error(
|
||||
'Parse Error: multiple actions possible at state: ' +
|
||||
state +
|
||||
', token: ' +
|
||||
symbol
|
||||
);
|
||||
}
|
||||
|
||||
switch (action[0]) {
|
||||
case 1:
|
||||
// shift
|
||||
//this.shiftCount++;
|
||||
stack.push(symbol);
|
||||
vstack.push(this.lexer.yytext);
|
||||
lstack.push(this.lexer.yylloc);
|
||||
stack.push(action[1]); // push state
|
||||
|
||||
symbol = null;
|
||||
|
||||
if (!preErrorSymbol) {
|
||||
// normal execution/no error
|
||||
yyleng = this.lexer.yyleng;
|
||||
yytext = this.lexer.yytext;
|
||||
yylineno = this.lexer.yylineno;
|
||||
yyloc = this.lexer.yylloc;
|
||||
if (recovering > 0) recovering--;
|
||||
} else {
|
||||
// error just occurred, resume old lookahead f/ before error
|
||||
symbol = preErrorSymbol;
|
||||
preErrorSymbol = null;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// reduce
|
||||
//this.reductionCount++;
|
||||
len = this.productions_[action[1]][1]; // perform semantic action
|
||||
|
||||
yyval.$ = vstack[vstack.length - len]; // default to $$ = $1
|
||||
// default location, uses first token for firsts, last for lasts
|
||||
|
||||
yyval._$ = {
|
||||
first_line: lstack[lstack.length - (len || 1)].first_line,
|
||||
last_line: lstack[lstack.length - 1].last_line,
|
||||
first_column: lstack[lstack.length - (len || 1)].first_column,
|
||||
last_column: lstack[lstack.length - 1].last_column
|
||||
};
|
||||
r = this.performAction.call(
|
||||
yyval,
|
||||
yytext,
|
||||
yyleng,
|
||||
yylineno,
|
||||
this.yy,
|
||||
action[1],
|
||||
vstack,
|
||||
lstack
|
||||
);
|
||||
|
||||
if (typeof r !== 'undefined') {
|
||||
return r;
|
||||
} // pop off stack
|
||||
|
||||
if (len) {
|
||||
stack = stack.slice(0, -1 * len * 2);
|
||||
vstack = vstack.slice(0, -1 * len);
|
||||
lstack = lstack.slice(0, -1 * len);
|
||||
}
|
||||
|
||||
stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
|
||||
|
||||
vstack.push(yyval.$);
|
||||
lstack.push(yyval._$); // goto new state = table[STATE][NONTERMINAL]
|
||||
|
||||
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
||||
stack.push(newState);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// accept
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
/* Jison generated lexer */
|
||||
|
||||
var lexer = (function () {
|
||||
var lexer = {
|
||||
EOF: 1,
|
||||
parseError: function parseError(str, hash) {
|
||||
if (this.yy.parseError) {
|
||||
this.yy.parseError(str, hash);
|
||||
} else {
|
||||
throw new Error(str);
|
||||
}
|
||||
},
|
||||
setInput: function (input) {
|
||||
this._input = input;
|
||||
this._more = this._less = this.done = false;
|
||||
this.yylineno = this.yyleng = 0;
|
||||
this.yytext = this.matched = this.match = '';
|
||||
this.conditionStack = ['INITIAL'];
|
||||
this.yylloc = {
|
||||
first_line: 1,
|
||||
first_column: 0,
|
||||
last_line: 1,
|
||||
last_column: 0
|
||||
};
|
||||
return this;
|
||||
},
|
||||
input: function () {
|
||||
var ch = this._input[0];
|
||||
this.yytext += ch;
|
||||
this.yyleng++;
|
||||
this.match += ch;
|
||||
this.matched += ch;
|
||||
var lines = ch.match(/\n/);
|
||||
if (lines) this.yylineno++;
|
||||
this._input = this._input.slice(1);
|
||||
return ch;
|
||||
},
|
||||
unput: function (ch) {
|
||||
this._input = ch + this._input;
|
||||
return this;
|
||||
},
|
||||
more: function () {
|
||||
this._more = true;
|
||||
return this;
|
||||
},
|
||||
less: function (n) {
|
||||
this._input = this.match.slice(n) + this._input;
|
||||
},
|
||||
pastInput: function () {
|
||||
var past = this.matched.substr(
|
||||
0,
|
||||
this.matched.length - this.match.length
|
||||
);
|
||||
return (
|
||||
(past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, '')
|
||||
);
|
||||
},
|
||||
upcomingInput: function () {
|
||||
var next = this.match;
|
||||
|
||||
if (next.length < 20) {
|
||||
next += this._input.substr(0, 20 - next.length);
|
||||
}
|
||||
|
||||
return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(
|
||||
/\n/g,
|
||||
''
|
||||
);
|
||||
},
|
||||
showPosition: function () {
|
||||
var pre = this.pastInput();
|
||||
var c = new Array(pre.length + 1).join('-');
|
||||
return pre + this.upcomingInput() + '\n' + c + '^';
|
||||
},
|
||||
next: function () {
|
||||
if (this.done) {
|
||||
return this.EOF;
|
||||
}
|
||||
|
||||
if (!this._input) this.done = true;
|
||||
var token, match, tempMatch, index, col, lines;
|
||||
|
||||
if (!this._more) {
|
||||
this.yytext = '';
|
||||
this.match = '';
|
||||
}
|
||||
|
||||
var rules = this._currentRules();
|
||||
|
||||
for (var i = 0; i < rules.length; i++) {
|
||||
tempMatch = this._input.match(this.rules[rules[i]]);
|
||||
|
||||
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
||||
match = tempMatch;
|
||||
index = i;
|
||||
if (!this.options.flex) break;
|
||||
}
|
||||
}
|
||||
|
||||
if (match) {
|
||||
lines = match[0].match(/\n.*/g);
|
||||
if (lines) this.yylineno += lines.length;
|
||||
this.yylloc = {
|
||||
first_line: this.yylloc.last_line,
|
||||
last_line: this.yylineno + 1,
|
||||
first_column: this.yylloc.last_column,
|
||||
last_column: lines
|
||||
? lines[lines.length - 1].length - 1
|
||||
: this.yylloc.last_column + match[0].length
|
||||
};
|
||||
this.yytext += match[0];
|
||||
this.match += match[0];
|
||||
this.yyleng = this.yytext.length;
|
||||
this._more = false;
|
||||
this._input = this._input.slice(match[0].length);
|
||||
this.matched += match[0];
|
||||
token = this.performAction.call(
|
||||
this,
|
||||
this.yy,
|
||||
this,
|
||||
rules[index],
|
||||
this.conditionStack[this.conditionStack.length - 1]
|
||||
);
|
||||
if (this.done && this._input) this.done = false;
|
||||
if (token) return token;
|
||||
else return;
|
||||
}
|
||||
|
||||
if (this._input === '') {
|
||||
return this.EOF;
|
||||
} else {
|
||||
this.parseError(
|
||||
'Lexical error on line ' +
|
||||
(this.yylineno + 1) +
|
||||
'. Unrecognized text.\n' +
|
||||
this.showPosition(),
|
||||
{
|
||||
text: '',
|
||||
token: null,
|
||||
line: this.yylineno
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
lex: function lex() {
|
||||
var r = this.next();
|
||||
|
||||
if (typeof r !== 'undefined') {
|
||||
return r;
|
||||
} else {
|
||||
return this.lex();
|
||||
}
|
||||
},
|
||||
begin: function begin(condition) {
|
||||
this.conditionStack.push(condition);
|
||||
},
|
||||
popState: function popState() {
|
||||
return this.conditionStack.pop();
|
||||
},
|
||||
_currentRules: function _currentRules() {
|
||||
return this.conditions[
|
||||
this.conditionStack[this.conditionStack.length - 1]
|
||||
].rules;
|
||||
},
|
||||
topState: function () {
|
||||
return this.conditionStack[this.conditionStack.length - 2];
|
||||
},
|
||||
pushState: function begin(condition) {
|
||||
this.begin(condition);
|
||||
}
|
||||
};
|
||||
lexer.options = {};
|
||||
|
||||
lexer.performAction = function anonymous(
|
||||
yy,
|
||||
yy_,
|
||||
$avoiding_name_collisions,
|
||||
YY_START
|
||||
) {
|
||||
var YYSTATE = YY_START;
|
||||
|
||||
switch ($avoiding_name_collisions) {
|
||||
case 0:
|
||||
/* skip whitespace */
|
||||
break;
|
||||
|
||||
case 1:
|
||||
return 6;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2);
|
||||
return 4;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
return 17;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
return 18;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
return 23;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
return 24;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
return 22;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
return 21;
|
||||
break;
|
||||
|
||||
case 9:
|
||||
return 10;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
return 11;
|
||||
break;
|
||||
|
||||
case 11:
|
||||
return 8;
|
||||
break;
|
||||
|
||||
case 12:
|
||||
return 14;
|
||||
break;
|
||||
|
||||
case 13:
|
||||
return 'INVALID';
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
lexer.rules = [
|
||||
/^(?:\s+)/,
|
||||
/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,
|
||||
/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,
|
||||
/^(?:\{)/,
|
||||
/^(?:\})/,
|
||||
/^(?:\[)/,
|
||||
/^(?:\])/,
|
||||
/^(?:,)/,
|
||||
/^(?::)/,
|
||||
/^(?:true\b)/,
|
||||
/^(?:false\b)/,
|
||||
/^(?:null\b)/,
|
||||
/^(?:$)/,
|
||||
/^(?:.)/
|
||||
];
|
||||
lexer.conditions = {
|
||||
INITIAL: {
|
||||
rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
|
||||
inclusive: true
|
||||
}
|
||||
};
|
||||
return lexer;
|
||||
})();
|
||||
|
||||
parser.lexer = lexer;
|
||||
return parser;
|
||||
})();
|
||||
|
||||
exports.parser = jsonlint;
|
||||
|
||||
exports.errors = function (input) {
|
||||
try {
|
||||
this.parse(input);
|
||||
} catch (e) {
|
||||
return e.stack;
|
||||
}
|
||||
};
|
||||
|
||||
exports.parse = function () {
|
||||
return jsonlint.parse.apply(jsonlint, arguments);
|
||||
};
|
||||
|
||||
exports.main = function commonjsMain(args) {
|
||||
if (!args[1]) throw new Error('Usage: ' + args[0] + ' FILE');
|
||||
|
||||
if (typeof process !== 'undefined') {
|
||||
var source = require('fs').readFileSync(
|
||||
require('path').join(process.cwd(), args[1]),
|
||||
'utf8'
|
||||
);
|
||||
} else {
|
||||
var cwd = require('file').path(require('file').cwd());
|
||||
|
||||
var source = cwd.join(args[1]).read({
|
||||
charset: 'utf-8'
|
||||
});
|
||||
}
|
||||
|
||||
return exports.parser.parse(source);
|
||||
};
|
345
node_modules/jest-config/node_modules/ansi-styles/index.d.ts
generated
vendored
Normal file
345
node_modules/jest-config/node_modules/ansi-styles/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,345 @@
|
||||
declare type CSSColor =
|
||||
| 'aliceblue'
|
||||
| 'antiquewhite'
|
||||
| 'aqua'
|
||||
| 'aquamarine'
|
||||
| 'azure'
|
||||
| 'beige'
|
||||
| 'bisque'
|
||||
| 'black'
|
||||
| 'blanchedalmond'
|
||||
| 'blue'
|
||||
| 'blueviolet'
|
||||
| 'brown'
|
||||
| 'burlywood'
|
||||
| 'cadetblue'
|
||||
| 'chartreuse'
|
||||
| 'chocolate'
|
||||
| 'coral'
|
||||
| 'cornflowerblue'
|
||||
| 'cornsilk'
|
||||
| 'crimson'
|
||||
| 'cyan'
|
||||
| 'darkblue'
|
||||
| 'darkcyan'
|
||||
| 'darkgoldenrod'
|
||||
| 'darkgray'
|
||||
| 'darkgreen'
|
||||
| 'darkgrey'
|
||||
| 'darkkhaki'
|
||||
| 'darkmagenta'
|
||||
| 'darkolivegreen'
|
||||
| 'darkorange'
|
||||
| 'darkorchid'
|
||||
| 'darkred'
|
||||
| 'darksalmon'
|
||||
| 'darkseagreen'
|
||||
| 'darkslateblue'
|
||||
| 'darkslategray'
|
||||
| 'darkslategrey'
|
||||
| 'darkturquoise'
|
||||
| 'darkviolet'
|
||||
| 'deeppink'
|
||||
| 'deepskyblue'
|
||||
| 'dimgray'
|
||||
| 'dimgrey'
|
||||
| 'dodgerblue'
|
||||
| 'firebrick'
|
||||
| 'floralwhite'
|
||||
| 'forestgreen'
|
||||
| 'fuchsia'
|
||||
| 'gainsboro'
|
||||
| 'ghostwhite'
|
||||
| 'gold'
|
||||
| 'goldenrod'
|
||||
| 'gray'
|
||||
| 'green'
|
||||
| 'greenyellow'
|
||||
| 'grey'
|
||||
| 'honeydew'
|
||||
| 'hotpink'
|
||||
| 'indianred'
|
||||
| 'indigo'
|
||||
| 'ivory'
|
||||
| 'khaki'
|
||||
| 'lavender'
|
||||
| 'lavenderblush'
|
||||
| 'lawngreen'
|
||||
| 'lemonchiffon'
|
||||
| 'lightblue'
|
||||
| 'lightcoral'
|
||||
| 'lightcyan'
|
||||
| 'lightgoldenrodyellow'
|
||||
| 'lightgray'
|
||||
| 'lightgreen'
|
||||
| 'lightgrey'
|
||||
| 'lightpink'
|
||||
| 'lightsalmon'
|
||||
| 'lightseagreen'
|
||||
| 'lightskyblue'
|
||||
| 'lightslategray'
|
||||
| 'lightslategrey'
|
||||
| 'lightsteelblue'
|
||||
| 'lightyellow'
|
||||
| 'lime'
|
||||
| 'limegreen'
|
||||
| 'linen'
|
||||
| 'magenta'
|
||||
| 'maroon'
|
||||
| 'mediumaquamarine'
|
||||
| 'mediumblue'
|
||||
| 'mediumorchid'
|
||||
| 'mediumpurple'
|
||||
| 'mediumseagreen'
|
||||
| 'mediumslateblue'
|
||||
| 'mediumspringgreen'
|
||||
| 'mediumturquoise'
|
||||
| 'mediumvioletred'
|
||||
| 'midnightblue'
|
||||
| 'mintcream'
|
||||
| 'mistyrose'
|
||||
| 'moccasin'
|
||||
| 'navajowhite'
|
||||
| 'navy'
|
||||
| 'oldlace'
|
||||
| 'olive'
|
||||
| 'olivedrab'
|
||||
| 'orange'
|
||||
| 'orangered'
|
||||
| 'orchid'
|
||||
| 'palegoldenrod'
|
||||
| 'palegreen'
|
||||
| 'paleturquoise'
|
||||
| 'palevioletred'
|
||||
| 'papayawhip'
|
||||
| 'peachpuff'
|
||||
| 'peru'
|
||||
| 'pink'
|
||||
| 'plum'
|
||||
| 'powderblue'
|
||||
| 'purple'
|
||||
| 'rebeccapurple'
|
||||
| 'red'
|
||||
| 'rosybrown'
|
||||
| 'royalblue'
|
||||
| 'saddlebrown'
|
||||
| 'salmon'
|
||||
| 'sandybrown'
|
||||
| 'seagreen'
|
||||
| 'seashell'
|
||||
| 'sienna'
|
||||
| 'silver'
|
||||
| 'skyblue'
|
||||
| 'slateblue'
|
||||
| 'slategray'
|
||||
| 'slategrey'
|
||||
| 'snow'
|
||||
| 'springgreen'
|
||||
| 'steelblue'
|
||||
| 'tan'
|
||||
| 'teal'
|
||||
| 'thistle'
|
||||
| 'tomato'
|
||||
| 'turquoise'
|
||||
| 'violet'
|
||||
| 'wheat'
|
||||
| 'white'
|
||||
| 'whitesmoke'
|
||||
| 'yellow'
|
||||
| 'yellowgreen';
|
||||
|
||||
declare namespace ansiStyles {
|
||||
interface ColorConvert {
|
||||
/**
|
||||
The RGB color space.
|
||||
|
||||
@param red - (`0`-`255`)
|
||||
@param green - (`0`-`255`)
|
||||
@param blue - (`0`-`255`)
|
||||
*/
|
||||
rgb(red: number, green: number, blue: number): string;
|
||||
|
||||
/**
|
||||
The RGB HEX color space.
|
||||
|
||||
@param hex - A hexadecimal string containing RGB data.
|
||||
*/
|
||||
hex(hex: string): string;
|
||||
|
||||
/**
|
||||
@param keyword - A CSS color name.
|
||||
*/
|
||||
keyword(keyword: CSSColor): string;
|
||||
|
||||
/**
|
||||
The HSL color space.
|
||||
|
||||
@param hue - (`0`-`360`)
|
||||
@param saturation - (`0`-`100`)
|
||||
@param lightness - (`0`-`100`)
|
||||
*/
|
||||
hsl(hue: number, saturation: number, lightness: number): string;
|
||||
|
||||
/**
|
||||
The HSV color space.
|
||||
|
||||
@param hue - (`0`-`360`)
|
||||
@param saturation - (`0`-`100`)
|
||||
@param value - (`0`-`100`)
|
||||
*/
|
||||
hsv(hue: number, saturation: number, value: number): string;
|
||||
|
||||
/**
|
||||
The HSV color space.
|
||||
|
||||
@param hue - (`0`-`360`)
|
||||
@param whiteness - (`0`-`100`)
|
||||
@param blackness - (`0`-`100`)
|
||||
*/
|
||||
hwb(hue: number, whiteness: number, blackness: number): string;
|
||||
|
||||
/**
|
||||
Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color.
|
||||
*/
|
||||
ansi(ansi: number): string;
|
||||
|
||||
/**
|
||||
Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
||||
*/
|
||||
ansi256(ansi: number): string;
|
||||
}
|
||||
|
||||
interface CSPair {
|
||||
/**
|
||||
The ANSI terminal control sequence for starting this style.
|
||||
*/
|
||||
readonly open: string;
|
||||
|
||||
/**
|
||||
The ANSI terminal control sequence for ending this style.
|
||||
*/
|
||||
readonly close: string;
|
||||
}
|
||||
|
||||
interface ColorBase {
|
||||
readonly ansi: ColorConvert;
|
||||
readonly ansi256: ColorConvert;
|
||||
readonly ansi16m: ColorConvert;
|
||||
|
||||
/**
|
||||
The ANSI terminal control sequence for ending this color.
|
||||
*/
|
||||
readonly close: string;
|
||||
}
|
||||
|
||||
interface Modifier {
|
||||
/**
|
||||
Resets the current color chain.
|
||||
*/
|
||||
readonly reset: CSPair;
|
||||
|
||||
/**
|
||||
Make text bold.
|
||||
*/
|
||||
readonly bold: CSPair;
|
||||
|
||||
/**
|
||||
Emitting only a small amount of light.
|
||||
*/
|
||||
readonly dim: CSPair;
|
||||
|
||||
/**
|
||||
Make text italic. (Not widely supported)
|
||||
*/
|
||||
readonly italic: CSPair;
|
||||
|
||||
/**
|
||||
Make text underline. (Not widely supported)
|
||||
*/
|
||||
readonly underline: CSPair;
|
||||
|
||||
/**
|
||||
Inverse background and foreground colors.
|
||||
*/
|
||||
readonly inverse: CSPair;
|
||||
|
||||
/**
|
||||
Prints the text, but makes it invisible.
|
||||
*/
|
||||
readonly hidden: CSPair;
|
||||
|
||||
/**
|
||||
Puts a horizontal line through the center of the text. (Not widely supported)
|
||||
*/
|
||||
readonly strikethrough: CSPair;
|
||||
}
|
||||
|
||||
interface ForegroundColor {
|
||||
readonly black: CSPair;
|
||||
readonly red: CSPair;
|
||||
readonly green: CSPair;
|
||||
readonly yellow: CSPair;
|
||||
readonly blue: CSPair;
|
||||
readonly cyan: CSPair;
|
||||
readonly magenta: CSPair;
|
||||
readonly white: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly gray: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly grey: CSPair;
|
||||
|
||||
readonly blackBright: CSPair;
|
||||
readonly redBright: CSPair;
|
||||
readonly greenBright: CSPair;
|
||||
readonly yellowBright: CSPair;
|
||||
readonly blueBright: CSPair;
|
||||
readonly cyanBright: CSPair;
|
||||
readonly magentaBright: CSPair;
|
||||
readonly whiteBright: CSPair;
|
||||
}
|
||||
|
||||
interface BackgroundColor {
|
||||
readonly bgBlack: CSPair;
|
||||
readonly bgRed: CSPair;
|
||||
readonly bgGreen: CSPair;
|
||||
readonly bgYellow: CSPair;
|
||||
readonly bgBlue: CSPair;
|
||||
readonly bgCyan: CSPair;
|
||||
readonly bgMagenta: CSPair;
|
||||
readonly bgWhite: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGray: CSPair;
|
||||
|
||||
/**
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGrey: CSPair;
|
||||
|
||||
readonly bgBlackBright: CSPair;
|
||||
readonly bgRedBright: CSPair;
|
||||
readonly bgGreenBright: CSPair;
|
||||
readonly bgYellowBright: CSPair;
|
||||
readonly bgBlueBright: CSPair;
|
||||
readonly bgCyanBright: CSPair;
|
||||
readonly bgMagentaBright: CSPair;
|
||||
readonly bgWhiteBright: CSPair;
|
||||
}
|
||||
}
|
||||
|
||||
declare const ansiStyles: {
|
||||
readonly modifier: ansiStyles.Modifier;
|
||||
readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase;
|
||||
readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase;
|
||||
readonly codes: ReadonlyMap<number, number>;
|
||||
} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier;
|
||||
|
||||
export = ansiStyles;
|
163
node_modules/jest-config/node_modules/ansi-styles/index.js
generated
vendored
Normal file
163
node_modules/jest-config/node_modules/ansi-styles/index.js
generated
vendored
Normal file
@ -0,0 +1,163 @@
|
||||
'use strict';
|
||||
|
||||
const wrapAnsi16 = (fn, offset) => (...args) => {
|
||||
const code = fn(...args);
|
||||
return `\u001B[${code + offset}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi256 = (fn, offset) => (...args) => {
|
||||
const code = fn(...args);
|
||||
return `\u001B[${38 + offset};5;${code}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi16m = (fn, offset) => (...args) => {
|
||||
const rgb = fn(...args);
|
||||
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
||||
};
|
||||
|
||||
const ansi2ansi = n => n;
|
||||
const rgb2rgb = (r, g, b) => [r, g, b];
|
||||
|
||||
const setLazyProperty = (object, property, get) => {
|
||||
Object.defineProperty(object, property, {
|
||||
get: () => {
|
||||
const value = get();
|
||||
|
||||
Object.defineProperty(object, property, {
|
||||
value,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
return value;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
};
|
||||
|
||||
/** @type {typeof import('color-convert')} */
|
||||
let colorConvert;
|
||||
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
||||
if (colorConvert === undefined) {
|
||||
colorConvert = require('color-convert');
|
||||
}
|
||||
|
||||
const offset = isBackground ? 10 : 0;
|
||||
const styles = {};
|
||||
|
||||
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
||||
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
|
||||
if (sourceSpace === targetSpace) {
|
||||
styles[name] = wrap(identity, offset);
|
||||
} else if (typeof suite === 'object') {
|
||||
styles[name] = wrap(suite[targetSpace], offset);
|
||||
}
|
||||
}
|
||||
|
||||
return styles;
|
||||
};
|
||||
|
||||
function assembleStyles() {
|
||||
const codes = new Map();
|
||||
const styles = {
|
||||
modifier: {
|
||||
reset: [0, 0],
|
||||
// 21 isn't widely supported and 22 does the same thing
|
||||
bold: [1, 22],
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29]
|
||||
},
|
||||
color: {
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
|
||||
// Bright color
|
||||
blackBright: [90, 39],
|
||||
redBright: [91, 39],
|
||||
greenBright: [92, 39],
|
||||
yellowBright: [93, 39],
|
||||
blueBright: [94, 39],
|
||||
magentaBright: [95, 39],
|
||||
cyanBright: [96, 39],
|
||||
whiteBright: [97, 39]
|
||||
},
|
||||
bgColor: {
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49],
|
||||
|
||||
// Bright color
|
||||
bgBlackBright: [100, 49],
|
||||
bgRedBright: [101, 49],
|
||||
bgGreenBright: [102, 49],
|
||||
bgYellowBright: [103, 49],
|
||||
bgBlueBright: [104, 49],
|
||||
bgMagentaBright: [105, 49],
|
||||
bgCyanBright: [106, 49],
|
||||
bgWhiteBright: [107, 49]
|
||||
}
|
||||
};
|
||||
|
||||
// Alias bright black as gray (and grey)
|
||||
styles.color.gray = styles.color.blackBright;
|
||||
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
||||
styles.color.grey = styles.color.blackBright;
|
||||
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
||||
|
||||
for (const [groupName, group] of Object.entries(styles)) {
|
||||
for (const [styleName, style] of Object.entries(group)) {
|
||||
styles[styleName] = {
|
||||
open: `\u001B[${style[0]}m`,
|
||||
close: `\u001B[${style[1]}m`
|
||||
};
|
||||
|
||||
group[styleName] = styles[styleName];
|
||||
|
||||
codes.set(style[0], style[1]);
|
||||
}
|
||||
|
||||
Object.defineProperty(styles, groupName, {
|
||||
value: group,
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
|
||||
Object.defineProperty(styles, 'codes', {
|
||||
value: codes,
|
||||
enumerable: false
|
||||
});
|
||||
|
||||
styles.color.close = '\u001B[39m';
|
||||
styles.bgColor.close = '\u001B[49m';
|
||||
|
||||
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
|
||||
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
|
||||
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
|
||||
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
|
||||
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
|
||||
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
|
||||
|
||||
return styles;
|
||||
}
|
||||
|
||||
// Make the export immutable
|
||||
Object.defineProperty(module, 'exports', {
|
||||
enumerable: true,
|
||||
get: assembleStyles
|
||||
});
|
9
node_modules/jest-config/node_modules/ansi-styles/license
generated
vendored
Normal file
9
node_modules/jest-config/node_modules/ansi-styles/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.
|
56
node_modules/jest-config/node_modules/ansi-styles/package.json
generated
vendored
Normal file
56
node_modules/jest-config/node_modules/ansi-styles/package.json
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "ansi-styles",
|
||||
"version": "4.3.0",
|
||||
"description": "ANSI escape codes for styling strings in the terminal",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/ansi-styles",
|
||||
"funding": "https://github.com/chalk/ansi-styles?sponsor=1",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd",
|
||||
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/color-convert": "^1.9.0",
|
||||
"ava": "^2.3.0",
|
||||
"svg-term-cli": "^2.1.1",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.25.3"
|
||||
}
|
||||
}
|
152
node_modules/jest-config/node_modules/ansi-styles/readme.md
generated
vendored
Normal file
152
node_modules/jest-config/node_modules/ansi-styles/readme.md
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
||||
# ansi-styles [](https://travis-ci.org/chalk/ansi-styles)
|
||||
|
||||
> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
||||
|
||||
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
||||
|
||||
<img src="screenshot.svg" width="900">
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install ansi-styles
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const style = require('ansi-styles');
|
||||
|
||||
console.log(`${style.green.open}Hello world!${style.green.close}`);
|
||||
|
||||
|
||||
// Color conversion between 16/256/truecolor
|
||||
// NOTE: If conversion goes to 16 colors or 256 colors, the original color
|
||||
// may be degraded to fit that color palette. This means terminals
|
||||
// that do not support 16 million colors will best-match the
|
||||
// original color.
|
||||
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
|
||||
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
|
||||
console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Each style has an `open` and `close` property.
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(Not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(Not widely supported)*
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `blackBright` (alias: `gray`, `grey`)
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
## Advanced usage
|
||||
|
||||
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
|
||||
|
||||
- `style.modifier`
|
||||
- `style.color`
|
||||
- `style.bgColor`
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(style.color.green.open);
|
||||
```
|
||||
|
||||
Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(style.codes.get(36));
|
||||
//=> 39
|
||||
```
|
||||
|
||||
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
|
||||
|
||||
`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
|
||||
|
||||
The following color spaces from `color-convert` are supported:
|
||||
|
||||
- `rgb`
|
||||
- `hex`
|
||||
- `keyword`
|
||||
- `hsl`
|
||||
- `hsv`
|
||||
- `hwb`
|
||||
- `ansi`
|
||||
- `ansi256`
|
||||
|
||||
To use these, call the associated conversion function with the intended output, for example:
|
||||
|
||||
```js
|
||||
style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
|
||||
style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
|
||||
|
||||
style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||
style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||
|
||||
style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
|
||||
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
## For enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
21
node_modules/jest-config/node_modules/babel-jest/LICENSE
generated
vendored
Normal file
21
node_modules/jest-config/node_modules/babel-jest/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.
|
25
node_modules/jest-config/node_modules/babel-jest/README.md
generated
vendored
Normal file
25
node_modules/jest-config/node_modules/babel-jest/README.md
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# babel-jest
|
||||
|
||||
[Babel](https://github.com/babel/babel) [jest](https://github.com/facebook/jest) plugin
|
||||
|
||||
## Usage
|
||||
|
||||
If you are already using `jest-cli`, add `babel-jest` and it will automatically compile JavaScript code using Babel.
|
||||
|
||||
```bash
|
||||
yarn add --dev babel-jest @babel/core
|
||||
```
|
||||
|
||||
If you would like to write your own preprocessor, uninstall and delete babel-jest and set the [config.transform](https://jestjs.io/docs/configuration#transform-object-string-string) option to your preprocessor.
|
||||
|
||||
## Setup
|
||||
|
||||
_Note: this step is only required if you are using `babel-jest` with additional code preprocessors._
|
||||
|
||||
To explicitly define `babel-jest` as a transformer for your JavaScript code, map _.js_ files to the `babel-jest` module. Typescript files are also supported.
|
||||
|
||||
```json
|
||||
"transform": {
|
||||
"^.+\\.[t|j]sx?$": "babel-jest"
|
||||
},
|
||||
```
|
15
node_modules/jest-config/node_modules/babel-jest/build/index.d.ts
generated
vendored
Normal file
15
node_modules/jest-config/node_modules/babel-jest/build/index.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 type { Transformer } from '@jest/transform';
|
||||
import { TransformOptions } from '@babel/core';
|
||||
interface BabelJestTransformer extends Transformer {
|
||||
canInstrument: true;
|
||||
}
|
||||
declare const transformer: BabelJestTransformer & {
|
||||
createTransformer: (options?: TransformOptions) => BabelJestTransformer;
|
||||
};
|
||||
export = transformer;
|
273
node_modules/jest-config/node_modules/babel-jest/build/index.js
generated
vendored
Normal file
273
node_modules/jest-config/node_modules/babel-jest/build/index.js
generated
vendored
Normal file
@ -0,0 +1,273 @@
|
||||
'use strict';
|
||||
|
||||
function _crypto() {
|
||||
const data = require('crypto');
|
||||
|
||||
_crypto = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function fs() {
|
||||
const data = _interopRequireWildcard(require('graceful-fs'));
|
||||
|
||||
fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _core() {
|
||||
const data = require('@babel/core');
|
||||
|
||||
_core = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _loadBabelConfig = require('./loadBabelConfig');
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _slash() {
|
||||
const data = _interopRequireDefault(require('slash'));
|
||||
|
||||
_slash = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== 'function') return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||
return {default: obj};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 THIS_FILE = fs().readFileSync(__filename);
|
||||
|
||||
const jestPresetPath = require.resolve('babel-preset-jest');
|
||||
|
||||
const babelIstanbulPlugin = require.resolve('babel-plugin-istanbul'); // Narrow down the types
|
||||
|
||||
const createTransformer = (inputOptions = {}) => {
|
||||
var _inputOptions$plugins, _inputOptions$presets;
|
||||
|
||||
const options = {
|
||||
...inputOptions,
|
||||
caller: {
|
||||
name: 'babel-jest',
|
||||
supportsDynamicImport: false,
|
||||
supportsStaticESM: false,
|
||||
...inputOptions.caller
|
||||
},
|
||||
compact: false,
|
||||
plugins:
|
||||
(_inputOptions$plugins = inputOptions.plugins) !== null &&
|
||||
_inputOptions$plugins !== void 0
|
||||
? _inputOptions$plugins
|
||||
: [],
|
||||
presets: ((_inputOptions$presets = inputOptions.presets) !== null &&
|
||||
_inputOptions$presets !== void 0
|
||||
? _inputOptions$presets
|
||||
: []
|
||||
).concat(jestPresetPath),
|
||||
sourceMaps: 'both'
|
||||
};
|
||||
|
||||
function loadBabelConfig(cwd, filename, transformOptions) {
|
||||
var _transformOptions$sup, _transformOptions$sup2;
|
||||
|
||||
// `cwd` first to allow incoming options to override it
|
||||
const babelConfig = (0, _loadBabelConfig.loadPartialConfig)({
|
||||
cwd,
|
||||
...options,
|
||||
caller: {
|
||||
...options.caller,
|
||||
supportsDynamicImport:
|
||||
(_transformOptions$sup =
|
||||
transformOptions === null || transformOptions === void 0
|
||||
? void 0
|
||||
: transformOptions.supportsDynamicImport) !== null &&
|
||||
_transformOptions$sup !== void 0
|
||||
? _transformOptions$sup
|
||||
: options.caller.supportsDynamicImport,
|
||||
supportsStaticESM:
|
||||
(_transformOptions$sup2 =
|
||||
transformOptions === null || transformOptions === void 0
|
||||
? void 0
|
||||
: transformOptions.supportsStaticESM) !== null &&
|
||||
_transformOptions$sup2 !== void 0
|
||||
? _transformOptions$sup2
|
||||
: options.caller.supportsStaticESM
|
||||
},
|
||||
filename
|
||||
});
|
||||
|
||||
if (!babelConfig) {
|
||||
throw new Error(
|
||||
`babel-jest: Babel ignores ${_chalk().default.bold(
|
||||
(0, _slash().default)(path().relative(cwd, filename))
|
||||
)} - make sure to include the file in Jest's ${_chalk().default.bold(
|
||||
'transformIgnorePatterns'
|
||||
)} as well.`
|
||||
);
|
||||
}
|
||||
|
||||
return babelConfig;
|
||||
}
|
||||
|
||||
return {
|
||||
canInstrument: true,
|
||||
|
||||
getCacheKey(fileData, filename, configString, cacheKeyOptions) {
|
||||
const {config, instrument, rootDir} = cacheKeyOptions;
|
||||
const babelOptions = loadBabelConfig(
|
||||
config.cwd,
|
||||
filename,
|
||||
cacheKeyOptions
|
||||
);
|
||||
const configPath = [
|
||||
babelOptions.config || '',
|
||||
babelOptions.babelrc || ''
|
||||
];
|
||||
return (0, _crypto().createHash)('md5')
|
||||
.update(THIS_FILE)
|
||||
.update('\0', 'utf8')
|
||||
.update(JSON.stringify(babelOptions.options))
|
||||
.update('\0', 'utf8')
|
||||
.update(fileData)
|
||||
.update('\0', 'utf8')
|
||||
.update(path().relative(rootDir, filename))
|
||||
.update('\0', 'utf8')
|
||||
.update(configString)
|
||||
.update('\0', 'utf8')
|
||||
.update(configPath.join(''))
|
||||
.update('\0', 'utf8')
|
||||
.update(instrument ? 'instrument' : '')
|
||||
.update('\0', 'utf8')
|
||||
.update(process.env.NODE_ENV || '')
|
||||
.update('\0', 'utf8')
|
||||
.update(process.env.BABEL_ENV || '')
|
||||
.digest('hex');
|
||||
},
|
||||
|
||||
process(src, filename, config, transformOptions) {
|
||||
const babelOptions = {
|
||||
...loadBabelConfig(config.cwd, filename, transformOptions).options
|
||||
};
|
||||
|
||||
if (
|
||||
transformOptions === null || transformOptions === void 0
|
||||
? void 0
|
||||
: transformOptions.instrument
|
||||
) {
|
||||
babelOptions.auxiliaryCommentBefore = ' istanbul ignore next '; // Copied from jest-runtime transform.js
|
||||
|
||||
babelOptions.plugins = (babelOptions.plugins || []).concat([
|
||||
[
|
||||
babelIstanbulPlugin,
|
||||
{
|
||||
// files outside `cwd` will not be instrumented
|
||||
cwd: config.rootDir,
|
||||
exclude: []
|
||||
}
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
const transformResult = (0, _core().transformSync)(src, babelOptions);
|
||||
|
||||
if (transformResult) {
|
||||
const {code, map} = transformResult;
|
||||
|
||||
if (typeof code === 'string') {
|
||||
return {
|
||||
code,
|
||||
map
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return src;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const transformer = {
|
||||
...createTransformer(),
|
||||
// Assigned here so only the exported transformer has `createTransformer`,
|
||||
// instead of all created transformers by the function
|
||||
createTransformer
|
||||
};
|
||||
module.exports = transformer;
|
7
node_modules/jest-config/node_modules/babel-jest/build/loadBabelConfig.d.ts
generated
vendored
Normal file
7
node_modules/jest-config/node_modules/babel-jest/build/loadBabelConfig.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 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 { loadPartialConfig } from '@babel/core';
|
21
node_modules/jest-config/node_modules/babel-jest/build/loadBabelConfig.js
generated
vendored
Normal file
21
node_modules/jest-config/node_modules/babel-jest/build/loadBabelConfig.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, 'loadPartialConfig', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _core().loadPartialConfig;
|
||||
}
|
||||
});
|
||||
|
||||
function _core() {
|
||||
const data = require('@babel/core');
|
||||
|
||||
_core = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
15
node_modules/jest-config/node_modules/babel-jest/build/ts3.4/index.d.ts
generated
vendored
Normal file
15
node_modules/jest-config/node_modules/babel-jest/build/ts3.4/index.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 { Transformer } from '@jest/transform';
|
||||
import { TransformOptions } from '@babel/core';
|
||||
interface BabelJestTransformer extends Transformer {
|
||||
canInstrument: true;
|
||||
}
|
||||
declare const transformer: BabelJestTransformer & {
|
||||
createTransformer: (options?: TransformOptions) => BabelJestTransformer;
|
||||
};
|
||||
export = transformer;
|
7
node_modules/jest-config/node_modules/babel-jest/build/ts3.4/loadBabelConfig.d.ts
generated
vendored
Normal file
7
node_modules/jest-config/node_modules/babel-jest/build/ts3.4/loadBabelConfig.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 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 { loadPartialConfig } from '@babel/core';
|
44
node_modules/jest-config/node_modules/babel-jest/package.json
generated
vendored
Normal file
44
node_modules/jest-config/node_modules/babel-jest/package.json
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "babel-jest",
|
||||
"description": "Jest plugin to use babel for transformation.",
|
||||
"version": "25.5.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/jest.git",
|
||||
"directory": "packages/babel-jest"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
"typesVersions": {
|
||||
"<3.8": {
|
||||
"build/*": [
|
||||
"build/ts3.4/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/transform": "^25.5.1",
|
||||
"@jest/types": "^25.5.0",
|
||||
"@types/babel__core": "^7.1.7",
|
||||
"babel-plugin-istanbul": "^6.0.0",
|
||||
"babel-preset-jest": "^25.5.0",
|
||||
"chalk": "^3.0.0",
|
||||
"graceful-fs": "^4.2.4",
|
||||
"slash": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.0",
|
||||
"@types/graceful-fs": "^4.1.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.3"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "c5f2fd756331895b8177a19304feb49657687e22"
|
||||
}
|
411
node_modules/jest-config/node_modules/chalk/index.d.ts
generated
vendored
Normal file
411
node_modules/jest-config/node_modules/chalk/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,411 @@
|
||||
declare const enum LevelEnum {
|
||||
/**
|
||||
All colors disabled.
|
||||
*/
|
||||
None = 0,
|
||||
|
||||
/**
|
||||
Basic 16 colors support.
|
||||
*/
|
||||
Basic = 1,
|
||||
|
||||
/**
|
||||
ANSI 256 colors support.
|
||||
*/
|
||||
Ansi256 = 2,
|
||||
|
||||
/**
|
||||
Truecolor 16 million colors support.
|
||||
*/
|
||||
TrueColor = 3
|
||||
}
|
||||
|
||||
/**
|
||||
Basic foreground colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type ForegroundColor =
|
||||
| 'black'
|
||||
| 'red'
|
||||
| 'green'
|
||||
| 'yellow'
|
||||
| 'blue'
|
||||
| 'magenta'
|
||||
| 'cyan'
|
||||
| 'white'
|
||||
| 'gray'
|
||||
| 'grey'
|
||||
| 'blackBright'
|
||||
| 'redBright'
|
||||
| 'greenBright'
|
||||
| 'yellowBright'
|
||||
| 'blueBright'
|
||||
| 'magentaBright'
|
||||
| 'cyanBright'
|
||||
| 'whiteBright';
|
||||
|
||||
/**
|
||||
Basic background colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type BackgroundColor =
|
||||
| 'bgBlack'
|
||||
| 'bgRed'
|
||||
| 'bgGreen'
|
||||
| 'bgYellow'
|
||||
| 'bgBlue'
|
||||
| 'bgMagenta'
|
||||
| 'bgCyan'
|
||||
| 'bgWhite'
|
||||
| 'bgGray'
|
||||
| 'bgGrey'
|
||||
| 'bgBlackBright'
|
||||
| 'bgRedBright'
|
||||
| 'bgGreenBright'
|
||||
| 'bgYellowBright'
|
||||
| 'bgBlueBright'
|
||||
| 'bgMagentaBright'
|
||||
| 'bgCyanBright'
|
||||
| 'bgWhiteBright';
|
||||
|
||||
/**
|
||||
Basic colors.
|
||||
|
||||
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
||||
*/
|
||||
declare type Color = ForegroundColor | BackgroundColor;
|
||||
|
||||
declare type Modifiers =
|
||||
| 'reset'
|
||||
| 'bold'
|
||||
| 'dim'
|
||||
| 'italic'
|
||||
| 'underline'
|
||||
| 'inverse'
|
||||
| 'hidden'
|
||||
| 'strikethrough'
|
||||
| 'visible';
|
||||
|
||||
declare namespace chalk {
|
||||
type Level = LevelEnum;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
Specify the color support for Chalk.
|
||||
By default, color support is automatically detected based on the environment.
|
||||
*/
|
||||
level?: Level;
|
||||
}
|
||||
|
||||
interface Instance {
|
||||
/**
|
||||
Return a new Chalk instance.
|
||||
*/
|
||||
new (options?: Options): Chalk;
|
||||
}
|
||||
|
||||
/**
|
||||
Detect whether the terminal supports color.
|
||||
*/
|
||||
interface ColorSupport {
|
||||
/**
|
||||
The color level used by Chalk.
|
||||
*/
|
||||
level: Level;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports basic 16 colors.
|
||||
*/
|
||||
hasBasic: boolean;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports ANSI 256 colors.
|
||||
*/
|
||||
has256: boolean;
|
||||
|
||||
/**
|
||||
Return whether Chalk supports Truecolor 16 million colors.
|
||||
*/
|
||||
has16m: boolean;
|
||||
}
|
||||
|
||||
interface ChalkFunction {
|
||||
/**
|
||||
Use a template string.
|
||||
|
||||
@remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341))
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
log(chalk`
|
||||
CPU: {red ${cpu.totalPercent}%}
|
||||
RAM: {green ${ram.used / ram.total * 100}%}
|
||||
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||
`);
|
||||
```
|
||||
*/
|
||||
(text: TemplateStringsArray, ...placeholders: unknown[]): string;
|
||||
|
||||
(...text: unknown[]): string;
|
||||
}
|
||||
|
||||
interface Chalk extends ChalkFunction {
|
||||
/**
|
||||
Return a new Chalk instance.
|
||||
*/
|
||||
Instance: Instance;
|
||||
|
||||
/**
|
||||
The color support for Chalk.
|
||||
By default, color support is automatically detected based on the environment.
|
||||
*/
|
||||
level: Level;
|
||||
|
||||
/**
|
||||
Use HEX value to set text color.
|
||||
|
||||
@param color - Hexadecimal value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.hex('#DEADED');
|
||||
```
|
||||
*/
|
||||
hex(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use keyword color value to set text color.
|
||||
|
||||
@param color - Keyword value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.keyword('orange');
|
||||
```
|
||||
*/
|
||||
keyword(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use RGB values to set text color.
|
||||
*/
|
||||
rgb(red: number, green: number, blue: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSL values to set text color.
|
||||
*/
|
||||
hsl(hue: number, saturation: number, lightness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSV values to set text color.
|
||||
*/
|
||||
hsv(hue: number, saturation: number, value: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HWB values to set text color.
|
||||
*/
|
||||
hwb(hue: number, whiteness: number, blackness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color.
|
||||
|
||||
30 <= code && code < 38 || 90 <= code && code < 98
|
||||
For example, 31 for red, 91 for redBright.
|
||||
*/
|
||||
ansi(code: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
||||
*/
|
||||
ansi256(index: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HEX value to set background color.
|
||||
|
||||
@param color - Hexadecimal value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.bgHex('#DEADED');
|
||||
```
|
||||
*/
|
||||
bgHex(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use keyword color value to set background color.
|
||||
|
||||
@param color - Keyword value representing the desired color.
|
||||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
chalk.bgKeyword('orange');
|
||||
```
|
||||
*/
|
||||
bgKeyword(color: string): Chalk;
|
||||
|
||||
/**
|
||||
Use RGB values to set background color.
|
||||
*/
|
||||
bgRgb(red: number, green: number, blue: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSL values to set background color.
|
||||
*/
|
||||
bgHsl(hue: number, saturation: number, lightness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HSV values to set background color.
|
||||
*/
|
||||
bgHsv(hue: number, saturation: number, value: number): Chalk;
|
||||
|
||||
/**
|
||||
Use HWB values to set background color.
|
||||
*/
|
||||
bgHwb(hue: number, whiteness: number, blackness: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color.
|
||||
|
||||
30 <= code && code < 38 || 90 <= code && code < 98
|
||||
For example, 31 for red, 91 for redBright.
|
||||
Use the foreground code, not the background code (for example, not 41, nor 101).
|
||||
*/
|
||||
bgAnsi(code: number): Chalk;
|
||||
|
||||
/**
|
||||
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
|
||||
*/
|
||||
bgAnsi256(index: number): Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Resets the current color chain.
|
||||
*/
|
||||
readonly reset: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text bold.
|
||||
*/
|
||||
readonly bold: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Emitting only a small amount of light.
|
||||
*/
|
||||
readonly dim: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text italic. (Not widely supported)
|
||||
*/
|
||||
readonly italic: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Make text underline. (Not widely supported)
|
||||
*/
|
||||
readonly underline: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Inverse background and foreground colors.
|
||||
*/
|
||||
readonly inverse: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Prints the text, but makes it invisible.
|
||||
*/
|
||||
readonly hidden: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Puts a horizontal line through the center of the text. (Not widely supported)
|
||||
*/
|
||||
readonly strikethrough: Chalk;
|
||||
|
||||
/**
|
||||
Modifier: Prints the text only when Chalk has a color support level > 0.
|
||||
Can be useful for things that are purely cosmetic.
|
||||
*/
|
||||
readonly visible: Chalk;
|
||||
|
||||
readonly black: Chalk;
|
||||
readonly red: Chalk;
|
||||
readonly green: Chalk;
|
||||
readonly yellow: Chalk;
|
||||
readonly blue: Chalk;
|
||||
readonly magenta: Chalk;
|
||||
readonly cyan: Chalk;
|
||||
readonly white: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly gray: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `blackBright`.
|
||||
*/
|
||||
readonly grey: Chalk;
|
||||
|
||||
readonly blackBright: Chalk;
|
||||
readonly redBright: Chalk;
|
||||
readonly greenBright: Chalk;
|
||||
readonly yellowBright: Chalk;
|
||||
readonly blueBright: Chalk;
|
||||
readonly magentaBright: Chalk;
|
||||
readonly cyanBright: Chalk;
|
||||
readonly whiteBright: Chalk;
|
||||
|
||||
readonly bgBlack: Chalk;
|
||||
readonly bgRed: Chalk;
|
||||
readonly bgGreen: Chalk;
|
||||
readonly bgYellow: Chalk;
|
||||
readonly bgBlue: Chalk;
|
||||
readonly bgMagenta: Chalk;
|
||||
readonly bgCyan: Chalk;
|
||||
readonly bgWhite: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGray: Chalk;
|
||||
|
||||
/*
|
||||
Alias for `bgBlackBright`.
|
||||
*/
|
||||
readonly bgGrey: Chalk;
|
||||
|
||||
readonly bgBlackBright: Chalk;
|
||||
readonly bgRedBright: Chalk;
|
||||
readonly bgGreenBright: Chalk;
|
||||
readonly bgYellowBright: Chalk;
|
||||
readonly bgBlueBright: Chalk;
|
||||
readonly bgMagentaBright: Chalk;
|
||||
readonly bgCyanBright: Chalk;
|
||||
readonly bgWhiteBright: Chalk;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Main Chalk object that allows to chain styles together.
|
||||
Call the last one as a method with a string argument.
|
||||
Order doesn't matter, and later styles take precedent in case of a conflict.
|
||||
This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||
*/
|
||||
declare const chalk: chalk.Chalk & chalk.ChalkFunction & {
|
||||
supportsColor: chalk.ColorSupport | false;
|
||||
Level: typeof LevelEnum;
|
||||
Color: Color;
|
||||
ForegroundColor: ForegroundColor;
|
||||
BackgroundColor: BackgroundColor;
|
||||
Modifiers: Modifiers;
|
||||
stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false};
|
||||
};
|
||||
|
||||
export = chalk;
|
9
node_modules/jest-config/node_modules/chalk/license
generated
vendored
Normal file
9
node_modules/jest-config/node_modules/chalk/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.
|
63
node_modules/jest-config/node_modules/chalk/package.json
generated
vendored
Normal file
63
node_modules/jest-config/node_modules/chalk/package.json
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "chalk",
|
||||
"version": "3.0.0",
|
||||
"description": "Terminal string styling done right",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/chalk",
|
||||
"main": "source",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava && tsd",
|
||||
"bench": "matcha benchmark.js"
|
||||
},
|
||||
"files": [
|
||||
"source",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"str",
|
||||
"ansi",
|
||||
"style",
|
||||
"styles",
|
||||
"tty",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"coveralls": "^3.0.7",
|
||||
"execa": "^3.2.0",
|
||||
"import-fresh": "^3.1.0",
|
||||
"matcha": "^0.7.0",
|
||||
"nyc": "^14.1.1",
|
||||
"resolve-from": "^5.0.0",
|
||||
"tsd": "^0.7.4",
|
||||
"xo": "^0.25.3"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"unicorn/prefer-string-slice": "off",
|
||||
"unicorn/prefer-includes": "off"
|
||||
}
|
||||
}
|
||||
}
|
304
node_modules/jest-config/node_modules/chalk/readme.md
generated
vendored
Normal file
304
node_modules/jest-config/node_modules/chalk/readme.md
generated
vendored
Normal file
@ -0,0 +1,304 @@
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img width="320" src="media/logo.svg" alt="Chalk">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
> Terminal string styling done right
|
||||
|
||||
[](https://travis-ci.org/chalk/chalk) [](https://coveralls.io/github/chalk/chalk?branch=master) [](https://www.npmjs.com/package/chalk?activeTab=dependents) [](https://www.npmjs.com/package/chalk) [](https://www.youtube.com/watch?v=9auOCbH5Ns4) [](https://github.com/xojs/xo) 
|
||||
|
||||
<img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
|
||||
|
||||
|
||||
## Highlights
|
||||
|
||||
- Expressive API
|
||||
- Highly performant
|
||||
- Ability to nest styles
|
||||
- [256/Truecolor color support](#256-and-truecolor-color-support)
|
||||
- Auto-detects color support
|
||||
- Doesn't extend `String.prototype`
|
||||
- Clean and focused
|
||||
- Actively maintained
|
||||
- [Used by ~46,000 packages](https://www.npmjs.com/browse/depended/chalk) as of October 1, 2019
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```console
|
||||
$ npm install chalk
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
console.log(chalk.blue('Hello world!'));
|
||||
```
|
||||
|
||||
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
const log = console.log;
|
||||
|
||||
// Combine styled and normal strings
|
||||
log(chalk.blue('Hello') + ' World' + chalk.red('!'));
|
||||
|
||||
// Compose multiple styles using the chainable API
|
||||
log(chalk.blue.bgRed.bold('Hello world!'));
|
||||
|
||||
// Pass in multiple arguments
|
||||
log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
|
||||
|
||||
// Nest styles
|
||||
log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
|
||||
|
||||
// Nest styles of the same type even (color, underline, background)
|
||||
log(chalk.green(
|
||||
'I am a green line ' +
|
||||
chalk.blue.underline.bold('with a blue substring') +
|
||||
' that becomes green again!'
|
||||
));
|
||||
|
||||
// ES2015 template literal
|
||||
log(`
|
||||
CPU: ${chalk.red('90%')}
|
||||
RAM: ${chalk.green('40%')}
|
||||
DISK: ${chalk.yellow('70%')}
|
||||
`);
|
||||
|
||||
// ES2015 tagged template literal
|
||||
log(chalk`
|
||||
CPU: {red ${cpu.totalPercent}%}
|
||||
RAM: {green ${ram.used / ram.total * 100}%}
|
||||
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||
`);
|
||||
|
||||
// Use RGB colors in terminal emulators that support it.
|
||||
log(chalk.keyword('orange')('Yay for orange colored text!'));
|
||||
log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
|
||||
log(chalk.hex('#DEADED').bold('Bold gray!'));
|
||||
```
|
||||
|
||||
Easily define your own themes:
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const error = chalk.bold.red;
|
||||
const warning = chalk.keyword('orange');
|
||||
|
||||
console.log(error('Error!'));
|
||||
console.log(warning('Warning!'));
|
||||
```
|
||||
|
||||
Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
|
||||
|
||||
```js
|
||||
const name = 'Sindre';
|
||||
console.log(chalk.green('Hello %s'), name);
|
||||
//=> 'Hello Sindre'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### chalk.`<style>[.<style>...](string, [string...])`
|
||||
|
||||
Example: `chalk.red.bold.underline('Hello', 'world');`
|
||||
|
||||
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||
|
||||
Multiple arguments will be separated by space.
|
||||
|
||||
### chalk.level
|
||||
|
||||
Specifies the level of color support.
|
||||
|
||||
Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
|
||||
|
||||
If you need to change this in a reusable module, create a new instance:
|
||||
|
||||
```js
|
||||
const ctx = new chalk.Instance({level: 0});
|
||||
```
|
||||
|
||||
| Level | Description |
|
||||
| :---: | :--- |
|
||||
| `0` | All colors disabled |
|
||||
| `1` | Basic color support (16 colors) |
|
||||
| `2` | 256 color support |
|
||||
| `3` | Truecolor support (16 million colors) |
|
||||
|
||||
### chalk.supportsColor
|
||||
|
||||
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
|
||||
|
||||
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
||||
|
||||
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
|
||||
|
||||
### chalk.stderr and chalk.stderr.supportsColor
|
||||
|
||||
`chalk.stderr` contains a separate instance configured with color support detected for `stderr` stream instead of `stdout`. Override rules from `chalk.supportsColor` apply to this too. `chalk.stderr.supportsColor` is exposed for convenience.
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset` - Resets the current color chain.
|
||||
- `bold` - Make text bold.
|
||||
- `dim` - Emitting only a small amount of light.
|
||||
- `italic` - Make text italic. *(Not widely supported)*
|
||||
- `underline` - Make text underline. *(Not widely supported)*
|
||||
- `inverse`- Inverse background and foreground colors.
|
||||
- `hidden` - Prints the text, but makes it invisible.
|
||||
- `strikethrough` - Puts a horizontal line through the center of the text. *(Not widely supported)*
|
||||
- `visible`- Prints the text only when Chalk has a color level > 0. Can be useful for things that are purely cosmetic.
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `blackBright` (alias: `gray`, `grey`)
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
|
||||
## Tagged template literal
|
||||
|
||||
Chalk can be used as a [tagged template literal](http://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const miles = 18;
|
||||
const calculateFeet = miles => miles * 5280;
|
||||
|
||||
console.log(chalk`
|
||||
There are {bold 5280 feet} in a mile.
|
||||
In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
|
||||
`);
|
||||
```
|
||||
|
||||
Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
|
||||
|
||||
Template styles are chained exactly like normal Chalk styles. The following two statements are equivalent:
|
||||
|
||||
```js
|
||||
console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
|
||||
console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
|
||||
```
|
||||
|
||||
Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
|
||||
|
||||
All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
|
||||
|
||||
|
||||
## 256 and Truecolor color support
|
||||
|
||||
Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
|
||||
|
||||
Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
|
||||
|
||||
Examples:
|
||||
|
||||
- `chalk.hex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.keyword('orange')('Some orange text')`
|
||||
- `chalk.rgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
|
||||
|
||||
- `chalk.bgHex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.bgKeyword('orange')('Some orange text')`
|
||||
- `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
The following color models can be used:
|
||||
|
||||
- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
|
||||
- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
|
||||
- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
|
||||
- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
|
||||
- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
|
||||
- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
|
||||
- [`ansi`](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) - Example: `chalk.ansi(31).bgAnsi(93)('red on yellowBright')`
|
||||
- [`ansi256`](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) - Example: `chalk.bgAnsi256(194)('Honeydew, more or less')`
|
||||
|
||||
|
||||
## Windows
|
||||
|
||||
If you're on Windows, do yourself a favor and use [Windows Terminal](https://github.com/microsoft/terminal) instead of `cmd.exe`.
|
||||
|
||||
|
||||
## Origin story
|
||||
|
||||
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
|
||||
|
||||
|
||||
## chalk for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of chalk and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-chalk?utm_source=npm-chalk&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
|
||||
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
|
||||
- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
|
||||
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
|
||||
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
|
||||
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
||||
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
||||
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
|
||||
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
|
||||
- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
|
||||
- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
|
||||
- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
|
||||
- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
|
||||
- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
233
node_modules/jest-config/node_modules/chalk/source/index.js
generated
vendored
Normal file
233
node_modules/jest-config/node_modules/chalk/source/index.js
generated
vendored
Normal file
@ -0,0 +1,233 @@
|
||||
'use strict';
|
||||
const ansiStyles = require('ansi-styles');
|
||||
const {stdout: stdoutColor, stderr: stderrColor} = require('supports-color');
|
||||
const {
|
||||
stringReplaceAll,
|
||||
stringEncaseCRLFWithFirstIndex
|
||||
} = require('./util');
|
||||
|
||||
// `supportsColor.level` → `ansiStyles.color[name]` mapping
|
||||
const levelMapping = [
|
||||
'ansi',
|
||||
'ansi',
|
||||
'ansi256',
|
||||
'ansi16m'
|
||||
];
|
||||
|
||||
const styles = Object.create(null);
|
||||
|
||||
const applyOptions = (object, options = {}) => {
|
||||
if (options.level > 3 || options.level < 0) {
|
||||
throw new Error('The `level` option should be an integer from 0 to 3');
|
||||
}
|
||||
|
||||
// Detect level if not set manually
|
||||
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
||||
object.level = options.level === undefined ? colorLevel : options.level;
|
||||
};
|
||||
|
||||
class ChalkClass {
|
||||
constructor(options) {
|
||||
return chalkFactory(options);
|
||||
}
|
||||
}
|
||||
|
||||
const chalkFactory = options => {
|
||||
const chalk = {};
|
||||
applyOptions(chalk, options);
|
||||
|
||||
chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
|
||||
|
||||
Object.setPrototypeOf(chalk, Chalk.prototype);
|
||||
Object.setPrototypeOf(chalk.template, chalk);
|
||||
|
||||
chalk.template.constructor = () => {
|
||||
throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
|
||||
};
|
||||
|
||||
chalk.template.Instance = ChalkClass;
|
||||
|
||||
return chalk.template;
|
||||
};
|
||||
|
||||
function Chalk(options) {
|
||||
return chalkFactory(options);
|
||||
}
|
||||
|
||||
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
||||
styles[styleName] = {
|
||||
get() {
|
||||
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
||||
Object.defineProperty(this, styleName, {value: builder});
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
styles.visible = {
|
||||
get() {
|
||||
const builder = createBuilder(this, this._styler, true);
|
||||
Object.defineProperty(this, 'visible', {value: builder});
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
|
||||
const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
|
||||
|
||||
for (const model of usedModels) {
|
||||
styles[model] = {
|
||||
get() {
|
||||
const {level} = this;
|
||||
return function (...arguments_) {
|
||||
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
||||
return createBuilder(this, styler, this._isEmpty);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
for (const model of usedModels) {
|
||||
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
||||
styles[bgModel] = {
|
||||
get() {
|
||||
const {level} = this;
|
||||
return function (...arguments_) {
|
||||
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
||||
return createBuilder(this, styler, this._isEmpty);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const proto = Object.defineProperties(() => {}, {
|
||||
...styles,
|
||||
level: {
|
||||
enumerable: true,
|
||||
get() {
|
||||
return this._generator.level;
|
||||
},
|
||||
set(level) {
|
||||
this._generator.level = level;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const createStyler = (open, close, parent) => {
|
||||
let openAll;
|
||||
let closeAll;
|
||||
if (parent === undefined) {
|
||||
openAll = open;
|
||||
closeAll = close;
|
||||
} else {
|
||||
openAll = parent.openAll + open;
|
||||
closeAll = close + parent.closeAll;
|
||||
}
|
||||
|
||||
return {
|
||||
open,
|
||||
close,
|
||||
openAll,
|
||||
closeAll,
|
||||
parent
|
||||
};
|
||||
};
|
||||
|
||||
const createBuilder = (self, _styler, _isEmpty) => {
|
||||
const builder = (...arguments_) => {
|
||||
// Single argument is hot path, implicit coercion is faster than anything
|
||||
// eslint-disable-next-line no-implicit-coercion
|
||||
return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
|
||||
};
|
||||
|
||||
// `__proto__` is used because we must return a function, but there is
|
||||
// no way to create a function with a different prototype
|
||||
builder.__proto__ = proto; // eslint-disable-line no-proto
|
||||
|
||||
builder._generator = self;
|
||||
builder._styler = _styler;
|
||||
builder._isEmpty = _isEmpty;
|
||||
|
||||
return builder;
|
||||
};
|
||||
|
||||
const applyStyle = (self, string) => {
|
||||
if (self.level <= 0 || !string) {
|
||||
return self._isEmpty ? '' : string;
|
||||
}
|
||||
|
||||
let styler = self._styler;
|
||||
|
||||
if (styler === undefined) {
|
||||
return string;
|
||||
}
|
||||
|
||||
const {openAll, closeAll} = styler;
|
||||
if (string.indexOf('\u001B') !== -1) {
|
||||
while (styler !== undefined) {
|
||||
// Replace any instances already present with a re-opening code
|
||||
// otherwise only the part of the string until said closing code
|
||||
// will be colored, and the rest will simply be 'plain'.
|
||||
string = stringReplaceAll(string, styler.close, styler.open);
|
||||
|
||||
styler = styler.parent;
|
||||
}
|
||||
}
|
||||
|
||||
// We can move both next actions out of loop, because remaining actions in loop won't have
|
||||
// any/visible effect on parts we add here. Close the styling before a linebreak and reopen
|
||||
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
|
||||
const lfIndex = string.indexOf('\n');
|
||||
if (lfIndex !== -1) {
|
||||
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
||||
}
|
||||
|
||||
return openAll + string + closeAll;
|
||||
};
|
||||
|
||||
let template;
|
||||
const chalkTag = (chalk, ...strings) => {
|
||||
const [firstString] = strings;
|
||||
|
||||
if (!Array.isArray(firstString)) {
|
||||
// If chalk() was called by itself or with a string,
|
||||
// return the string itself as a string.
|
||||
return strings.join(' ');
|
||||
}
|
||||
|
||||
const arguments_ = strings.slice(1);
|
||||
const parts = [firstString.raw[0]];
|
||||
|
||||
for (let i = 1; i < firstString.length; i++) {
|
||||
parts.push(
|
||||
String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
|
||||
String(firstString.raw[i])
|
||||
);
|
||||
}
|
||||
|
||||
if (template === undefined) {
|
||||
template = require('./templates');
|
||||
}
|
||||
|
||||
return template(chalk, parts.join(''));
|
||||
};
|
||||
|
||||
Object.defineProperties(Chalk.prototype, styles);
|
||||
|
||||
const chalk = Chalk(); // eslint-disable-line new-cap
|
||||
chalk.supportsColor = stdoutColor;
|
||||
chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap
|
||||
chalk.stderr.supportsColor = stderrColor;
|
||||
|
||||
// For TypeScript
|
||||
chalk.Level = {
|
||||
None: 0,
|
||||
Basic: 1,
|
||||
Ansi256: 2,
|
||||
TrueColor: 3,
|
||||
0: 'None',
|
||||
1: 'Basic',
|
||||
2: 'Ansi256',
|
||||
3: 'TrueColor'
|
||||
};
|
||||
|
||||
module.exports = chalk;
|
134
node_modules/jest-config/node_modules/chalk/source/templates.js
generated
vendored
Normal file
134
node_modules/jest-config/node_modules/chalk/source/templates.js
generated
vendored
Normal file
@ -0,0 +1,134 @@
|
||||
'use strict';
|
||||
const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
||||
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
||||
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
||||
const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi;
|
||||
|
||||
const ESCAPES = new Map([
|
||||
['n', '\n'],
|
||||
['r', '\r'],
|
||||
['t', '\t'],
|
||||
['b', '\b'],
|
||||
['f', '\f'],
|
||||
['v', '\v'],
|
||||
['0', '\0'],
|
||||
['\\', '\\'],
|
||||
['e', '\u001B'],
|
||||
['a', '\u0007']
|
||||
]);
|
||||
|
||||
function unescape(c) {
|
||||
const u = c[0] === 'u';
|
||||
const bracket = c[1] === '{';
|
||||
|
||||
if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
|
||||
return String.fromCharCode(parseInt(c.slice(1), 16));
|
||||
}
|
||||
|
||||
if (u && bracket) {
|
||||
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
|
||||
}
|
||||
|
||||
return ESCAPES.get(c) || c;
|
||||
}
|
||||
|
||||
function parseArguments(name, arguments_) {
|
||||
const results = [];
|
||||
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
||||
let matches;
|
||||
|
||||
for (const chunk of chunks) {
|
||||
const number = Number(chunk);
|
||||
if (!Number.isNaN(number)) {
|
||||
results.push(number);
|
||||
} else if ((matches = chunk.match(STRING_REGEX))) {
|
||||
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
||||
} else {
|
||||
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function parseStyle(style) {
|
||||
STYLE_REGEX.lastIndex = 0;
|
||||
|
||||
const results = [];
|
||||
let matches;
|
||||
|
||||
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
||||
const name = matches[1];
|
||||
|
||||
if (matches[2]) {
|
||||
const args = parseArguments(name, matches[2]);
|
||||
results.push([name].concat(args));
|
||||
} else {
|
||||
results.push([name]);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function buildStyle(chalk, styles) {
|
||||
const enabled = {};
|
||||
|
||||
for (const layer of styles) {
|
||||
for (const style of layer.styles) {
|
||||
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
||||
}
|
||||
}
|
||||
|
||||
let current = chalk;
|
||||
for (const [styleName, styles] of Object.entries(enabled)) {
|
||||
if (!Array.isArray(styles)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(styleName in current)) {
|
||||
throw new Error(`Unknown Chalk style: ${styleName}`);
|
||||
}
|
||||
|
||||
current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
module.exports = (chalk, temporary) => {
|
||||
const styles = [];
|
||||
const chunks = [];
|
||||
let chunk = [];
|
||||
|
||||
// eslint-disable-next-line max-params
|
||||
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
||||
if (escapeCharacter) {
|
||||
chunk.push(unescape(escapeCharacter));
|
||||
} else if (style) {
|
||||
const string = chunk.join('');
|
||||
chunk = [];
|
||||
chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
|
||||
styles.push({inverse, styles: parseStyle(style)});
|
||||
} else if (close) {
|
||||
if (styles.length === 0) {
|
||||
throw new Error('Found extraneous } in Chalk template literal');
|
||||
}
|
||||
|
||||
chunks.push(buildStyle(chalk, styles)(chunk.join('')));
|
||||
chunk = [];
|
||||
styles.pop();
|
||||
} else {
|
||||
chunk.push(character);
|
||||
}
|
||||
});
|
||||
|
||||
chunks.push(chunk.join(''));
|
||||
|
||||
if (styles.length > 0) {
|
||||
const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
|
||||
return chunks.join('');
|
||||
};
|
39
node_modules/jest-config/node_modules/chalk/source/util.js
generated
vendored
Normal file
39
node_modules/jest-config/node_modules/chalk/source/util.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
const stringReplaceAll = (string, substring, replacer) => {
|
||||
let index = string.indexOf(substring);
|
||||
if (index === -1) {
|
||||
return string;
|
||||
}
|
||||
|
||||
const substringLength = substring.length;
|
||||
let endIndex = 0;
|
||||
let returnValue = '';
|
||||
do {
|
||||
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
||||
endIndex = index + substringLength;
|
||||
index = string.indexOf(substring, endIndex);
|
||||
} while (index !== -1);
|
||||
|
||||
returnValue += string.substr(endIndex);
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
|
||||
let endIndex = 0;
|
||||
let returnValue = '';
|
||||
do {
|
||||
const gotCR = string[index - 1] === '\r';
|
||||
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
|
||||
endIndex = index + 1;
|
||||
index = string.indexOf('\n', endIndex);
|
||||
} while (index !== -1);
|
||||
|
||||
returnValue += string.substr(endIndex);
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
stringReplaceAll,
|
||||
stringEncaseCRLFWithFirstIndex
|
||||
};
|
54
node_modules/jest-config/node_modules/color-convert/CHANGELOG.md
generated
vendored
Normal file
54
node_modules/jest-config/node_modules/color-convert/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
# 1.0.0 - 2016-01-07
|
||||
|
||||
- Removed: unused speed test
|
||||
- Added: Automatic routing between previously unsupported conversions
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Removed: `convert()` class
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Changed: all functions to lookup dictionary
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Changed: `ansi` to `ansi256`
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Fixed: argument grouping for functions requiring only one argument
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
|
||||
# 0.6.0 - 2015-07-23
|
||||
|
||||
- Added: methods to handle
|
||||
[ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors:
|
||||
- rgb2ansi16
|
||||
- rgb2ansi
|
||||
- hsl2ansi16
|
||||
- hsl2ansi
|
||||
- hsv2ansi16
|
||||
- hsv2ansi
|
||||
- hwb2ansi16
|
||||
- hwb2ansi
|
||||
- cmyk2ansi16
|
||||
- cmyk2ansi
|
||||
- keyword2ansi16
|
||||
- keyword2ansi
|
||||
- ansi162rgb
|
||||
- ansi162hsl
|
||||
- ansi162hsv
|
||||
- ansi162hwb
|
||||
- ansi162cmyk
|
||||
- ansi162keyword
|
||||
- ansi2rgb
|
||||
- ansi2hsl
|
||||
- ansi2hsv
|
||||
- ansi2hwb
|
||||
- ansi2cmyk
|
||||
- ansi2keyword
|
||||
([#18](https://github.com/harthur/color-convert/pull/18))
|
||||
|
||||
# 0.5.3 - 2015-06-02
|
||||
|
||||
- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]`
|
||||
([#15](https://github.com/harthur/color-convert/issues/15))
|
||||
|
||||
---
|
||||
|
||||
Check out commit logs for older releases
|
21
node_modules/jest-config/node_modules/color-convert/LICENSE
generated
vendored
Normal file
21
node_modules/jest-config/node_modules/color-convert/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.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.
|
||||
|
68
node_modules/jest-config/node_modules/color-convert/README.md
generated
vendored
Normal file
68
node_modules/jest-config/node_modules/color-convert/README.md
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
# color-convert
|
||||
|
||||
[](https://travis-ci.org/Qix-/color-convert)
|
||||
|
||||
Color-convert is a color conversion library for JavaScript and node.
|
||||
It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest):
|
||||
|
||||
```js
|
||||
var convert = require('color-convert');
|
||||
|
||||
convert.rgb.hsl(140, 200, 100); // [96, 48, 59]
|
||||
convert.keyword.rgb('blue'); // [0, 0, 255]
|
||||
|
||||
var rgbChannels = convert.rgb.channels; // 3
|
||||
var cmykChannels = convert.cmyk.channels; // 4
|
||||
var ansiChannels = convert.ansi16.channels; // 1
|
||||
```
|
||||
|
||||
# Install
|
||||
|
||||
```console
|
||||
$ npm install color-convert
|
||||
```
|
||||
|
||||
# API
|
||||
|
||||
Simply get the property of the _from_ and _to_ conversion that you're looking for.
|
||||
|
||||
All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function.
|
||||
|
||||
All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha).
|
||||
|
||||
```js
|
||||
var convert = require('color-convert');
|
||||
|
||||
// Hex to LAB
|
||||
convert.hex.lab('DEADBF'); // [ 76, 21, -2 ]
|
||||
convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ]
|
||||
|
||||
// RGB to CMYK
|
||||
convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ]
|
||||
convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ]
|
||||
```
|
||||
|
||||
### Arrays
|
||||
All functions that accept multiple arguments also support passing an array.
|
||||
|
||||
Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.)
|
||||
|
||||
```js
|
||||
var convert = require('color-convert');
|
||||
|
||||
convert.rgb.hex(123, 45, 67); // '7B2D43'
|
||||
convert.rgb.hex([123, 45, 67]); // '7B2D43'
|
||||
```
|
||||
|
||||
## Routing
|
||||
|
||||
Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex).
|
||||
|
||||
Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js).
|
||||
|
||||
# Contribute
|
||||
|
||||
If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request.
|
||||
|
||||
# License
|
||||
Copyright © 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE).
|
839
node_modules/jest-config/node_modules/color-convert/conversions.js
generated
vendored
Normal file
839
node_modules/jest-config/node_modules/color-convert/conversions.js
generated
vendored
Normal file
@ -0,0 +1,839 @@
|
||||
/* MIT license */
|
||||
/* eslint-disable no-mixed-operators */
|
||||
const cssKeywords = require('color-name');
|
||||
|
||||
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
||||
// values that give correct `typeof` results).
|
||||
// do not use box values types (i.e. Number(), String(), etc.)
|
||||
|
||||
const reverseKeywords = {};
|
||||
for (const key of Object.keys(cssKeywords)) {
|
||||
reverseKeywords[cssKeywords[key]] = key;
|
||||
}
|
||||
|
||||
const convert = {
|
||||
rgb: {channels: 3, labels: 'rgb'},
|
||||
hsl: {channels: 3, labels: 'hsl'},
|
||||
hsv: {channels: 3, labels: 'hsv'},
|
||||
hwb: {channels: 3, labels: 'hwb'},
|
||||
cmyk: {channels: 4, labels: 'cmyk'},
|
||||
xyz: {channels: 3, labels: 'xyz'},
|
||||
lab: {channels: 3, labels: 'lab'},
|
||||
lch: {channels: 3, labels: 'lch'},
|
||||
hex: {channels: 1, labels: ['hex']},
|
||||
keyword: {channels: 1, labels: ['keyword']},
|
||||
ansi16: {channels: 1, labels: ['ansi16']},
|
||||
ansi256: {channels: 1, labels: ['ansi256']},
|
||||
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
||||
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
||||
gray: {channels: 1, labels: ['gray']}
|
||||
};
|
||||
|
||||
module.exports = convert;
|
||||
|
||||
// Hide .channels and .labels properties
|
||||
for (const model of Object.keys(convert)) {
|
||||
if (!('channels' in convert[model])) {
|
||||
throw new Error('missing channels property: ' + model);
|
||||
}
|
||||
|
||||
if (!('labels' in convert[model])) {
|
||||
throw new Error('missing channel labels property: ' + model);
|
||||
}
|
||||
|
||||
if (convert[model].labels.length !== convert[model].channels) {
|
||||
throw new Error('channel and label counts mismatch: ' + model);
|
||||
}
|
||||
|
||||
const {channels, labels} = convert[model];
|
||||
delete convert[model].channels;
|
||||
delete convert[model].labels;
|
||||
Object.defineProperty(convert[model], 'channels', {value: channels});
|
||||
Object.defineProperty(convert[model], 'labels', {value: labels});
|
||||
}
|
||||
|
||||
convert.rgb.hsl = function (rgb) {
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
const min = Math.min(r, g, b);
|
||||
const max = Math.max(r, g, b);
|
||||
const delta = max - min;
|
||||
let h;
|
||||
let s;
|
||||
|
||||
if (max === min) {
|
||||
h = 0;
|
||||
} else if (r === max) {
|
||||
h = (g - b) / delta;
|
||||
} else if (g === max) {
|
||||
h = 2 + (b - r) / delta;
|
||||
} else if (b === max) {
|
||||
h = 4 + (r - g) / delta;
|
||||
}
|
||||
|
||||
h = Math.min(h * 60, 360);
|
||||
|
||||
if (h < 0) {
|
||||
h += 360;
|
||||
}
|
||||
|
||||
const l = (min + max) / 2;
|
||||
|
||||
if (max === min) {
|
||||
s = 0;
|
||||
} else if (l <= 0.5) {
|
||||
s = delta / (max + min);
|
||||
} else {
|
||||
s = delta / (2 - max - min);
|
||||
}
|
||||
|
||||
return [h, s * 100, l * 100];
|
||||
};
|
||||
|
||||
convert.rgb.hsv = function (rgb) {
|
||||
let rdif;
|
||||
let gdif;
|
||||
let bdif;
|
||||
let h;
|
||||
let s;
|
||||
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
const v = Math.max(r, g, b);
|
||||
const diff = v - Math.min(r, g, b);
|
||||
const diffc = function (c) {
|
||||
return (v - c) / 6 / diff + 1 / 2;
|
||||
};
|
||||
|
||||
if (diff === 0) {
|
||||
h = 0;
|
||||
s = 0;
|
||||
} else {
|
||||
s = diff / v;
|
||||
rdif = diffc(r);
|
||||
gdif = diffc(g);
|
||||
bdif = diffc(b);
|
||||
|
||||
if (r === v) {
|
||||
h = bdif - gdif;
|
||||
} else if (g === v) {
|
||||
h = (1 / 3) + rdif - bdif;
|
||||
} else if (b === v) {
|
||||
h = (2 / 3) + gdif - rdif;
|
||||
}
|
||||
|
||||
if (h < 0) {
|
||||
h += 1;
|
||||
} else if (h > 1) {
|
||||
h -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
h * 360,
|
||||
s * 100,
|
||||
v * 100
|
||||
];
|
||||
};
|
||||
|
||||
convert.rgb.hwb = function (rgb) {
|
||||
const r = rgb[0];
|
||||
const g = rgb[1];
|
||||
let b = rgb[2];
|
||||
const h = convert.rgb.hsl(rgb)[0];
|
||||
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
||||
|
||||
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
||||
|
||||
return [h, w * 100, b * 100];
|
||||
};
|
||||
|
||||
convert.rgb.cmyk = function (rgb) {
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
|
||||
const k = Math.min(1 - r, 1 - g, 1 - b);
|
||||
const c = (1 - r - k) / (1 - k) || 0;
|
||||
const m = (1 - g - k) / (1 - k) || 0;
|
||||
const y = (1 - b - k) / (1 - k) || 0;
|
||||
|
||||
return [c * 100, m * 100, y * 100, k * 100];
|
||||
};
|
||||
|
||||
function comparativeDistance(x, y) {
|
||||
/*
|
||||
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
||||
*/
|
||||
return (
|
||||
((x[0] - y[0]) ** 2) +
|
||||
((x[1] - y[1]) ** 2) +
|
||||
((x[2] - y[2]) ** 2)
|
||||
);
|
||||
}
|
||||
|
||||
convert.rgb.keyword = function (rgb) {
|
||||
const reversed = reverseKeywords[rgb];
|
||||
if (reversed) {
|
||||
return reversed;
|
||||
}
|
||||
|
||||
let currentClosestDistance = Infinity;
|
||||
let currentClosestKeyword;
|
||||
|
||||
for (const keyword of Object.keys(cssKeywords)) {
|
||||
const value = cssKeywords[keyword];
|
||||
|
||||
// Compute comparative distance
|
||||
const distance = comparativeDistance(rgb, value);
|
||||
|
||||
// Check if its less, if so set as closest
|
||||
if (distance < currentClosestDistance) {
|
||||
currentClosestDistance = distance;
|
||||
currentClosestKeyword = keyword;
|
||||
}
|
||||
}
|
||||
|
||||
return currentClosestKeyword;
|
||||
};
|
||||
|
||||
convert.keyword.rgb = function (keyword) {
|
||||
return cssKeywords[keyword];
|
||||
};
|
||||
|
||||
convert.rgb.xyz = function (rgb) {
|
||||
let r = rgb[0] / 255;
|
||||
let g = rgb[1] / 255;
|
||||
let b = rgb[2] / 255;
|
||||
|
||||
// Assume sRGB
|
||||
r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
|
||||
g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
|
||||
b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
|
||||
|
||||
const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
||||
const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
||||
const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
||||
|
||||
return [x * 100, y * 100, z * 100];
|
||||
};
|
||||
|
||||
convert.rgb.lab = function (rgb) {
|
||||
const xyz = convert.rgb.xyz(rgb);
|
||||
let x = xyz[0];
|
||||
let y = xyz[1];
|
||||
let z = xyz[2];
|
||||
|
||||
x /= 95.047;
|
||||
y /= 100;
|
||||
z /= 108.883;
|
||||
|
||||
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
||||
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
||||
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
||||
|
||||
const l = (116 * y) - 16;
|
||||
const a = 500 * (x - y);
|
||||
const b = 200 * (y - z);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.hsl.rgb = function (hsl) {
|
||||
const h = hsl[0] / 360;
|
||||
const s = hsl[1] / 100;
|
||||
const l = hsl[2] / 100;
|
||||
let t2;
|
||||
let t3;
|
||||
let val;
|
||||
|
||||
if (s === 0) {
|
||||
val = l * 255;
|
||||
return [val, val, val];
|
||||
}
|
||||
|
||||
if (l < 0.5) {
|
||||
t2 = l * (1 + s);
|
||||
} else {
|
||||
t2 = l + s - l * s;
|
||||
}
|
||||
|
||||
const t1 = 2 * l - t2;
|
||||
|
||||
const rgb = [0, 0, 0];
|
||||
for (let i = 0; i < 3; i++) {
|
||||
t3 = h + 1 / 3 * -(i - 1);
|
||||
if (t3 < 0) {
|
||||
t3++;
|
||||
}
|
||||
|
||||
if (t3 > 1) {
|
||||
t3--;
|
||||
}
|
||||
|
||||
if (6 * t3 < 1) {
|
||||
val = t1 + (t2 - t1) * 6 * t3;
|
||||
} else if (2 * t3 < 1) {
|
||||
val = t2;
|
||||
} else if (3 * t3 < 2) {
|
||||
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
||||
} else {
|
||||
val = t1;
|
||||
}
|
||||
|
||||
rgb[i] = val * 255;
|
||||
}
|
||||
|
||||
return rgb;
|
||||
};
|
||||
|
||||
convert.hsl.hsv = function (hsl) {
|
||||
const h = hsl[0];
|
||||
let s = hsl[1] / 100;
|
||||
let l = hsl[2] / 100;
|
||||
let smin = s;
|
||||
const lmin = Math.max(l, 0.01);
|
||||
|
||||
l *= 2;
|
||||
s *= (l <= 1) ? l : 2 - l;
|
||||
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
||||
const v = (l + s) / 2;
|
||||
const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
||||
|
||||
return [h, sv * 100, v * 100];
|
||||
};
|
||||
|
||||
convert.hsv.rgb = function (hsv) {
|
||||
const h = hsv[0] / 60;
|
||||
const s = hsv[1] / 100;
|
||||
let v = hsv[2] / 100;
|
||||
const hi = Math.floor(h) % 6;
|
||||
|
||||
const f = h - Math.floor(h);
|
||||
const p = 255 * v * (1 - s);
|
||||
const q = 255 * v * (1 - (s * f));
|
||||
const t = 255 * v * (1 - (s * (1 - f)));
|
||||
v *= 255;
|
||||
|
||||
switch (hi) {
|
||||
case 0:
|
||||
return [v, t, p];
|
||||
case 1:
|
||||
return [q, v, p];
|
||||
case 2:
|
||||
return [p, v, t];
|
||||
case 3:
|
||||
return [p, q, v];
|
||||
case 4:
|
||||
return [t, p, v];
|
||||
case 5:
|
||||
return [v, p, q];
|
||||
}
|
||||
};
|
||||
|
||||
convert.hsv.hsl = function (hsv) {
|
||||
const h = hsv[0];
|
||||
const s = hsv[1] / 100;
|
||||
const v = hsv[2] / 100;
|
||||
const vmin = Math.max(v, 0.01);
|
||||
let sl;
|
||||
let l;
|
||||
|
||||
l = (2 - s) * v;
|
||||
const lmin = (2 - s) * vmin;
|
||||
sl = s * vmin;
|
||||
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
||||
sl = sl || 0;
|
||||
l /= 2;
|
||||
|
||||
return [h, sl * 100, l * 100];
|
||||
};
|
||||
|
||||
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
||||
convert.hwb.rgb = function (hwb) {
|
||||
const h = hwb[0] / 360;
|
||||
let wh = hwb[1] / 100;
|
||||
let bl = hwb[2] / 100;
|
||||
const ratio = wh + bl;
|
||||
let f;
|
||||
|
||||
// Wh + bl cant be > 1
|
||||
if (ratio > 1) {
|
||||
wh /= ratio;
|
||||
bl /= ratio;
|
||||
}
|
||||
|
||||
const i = Math.floor(6 * h);
|
||||
const v = 1 - bl;
|
||||
f = 6 * h - i;
|
||||
|
||||
if ((i & 0x01) !== 0) {
|
||||
f = 1 - f;
|
||||
}
|
||||
|
||||
const n = wh + f * (v - wh); // Linear interpolation
|
||||
|
||||
let r;
|
||||
let g;
|
||||
let b;
|
||||
/* eslint-disable max-statements-per-line,no-multi-spaces */
|
||||
switch (i) {
|
||||
default:
|
||||
case 6:
|
||||
case 0: r = v; g = n; b = wh; break;
|
||||
case 1: r = n; g = v; b = wh; break;
|
||||
case 2: r = wh; g = v; b = n; break;
|
||||
case 3: r = wh; g = n; b = v; break;
|
||||
case 4: r = n; g = wh; b = v; break;
|
||||
case 5: r = v; g = wh; b = n; break;
|
||||
}
|
||||
/* eslint-enable max-statements-per-line,no-multi-spaces */
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.cmyk.rgb = function (cmyk) {
|
||||
const c = cmyk[0] / 100;
|
||||
const m = cmyk[1] / 100;
|
||||
const y = cmyk[2] / 100;
|
||||
const k = cmyk[3] / 100;
|
||||
|
||||
const r = 1 - Math.min(1, c * (1 - k) + k);
|
||||
const g = 1 - Math.min(1, m * (1 - k) + k);
|
||||
const b = 1 - Math.min(1, y * (1 - k) + k);
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.xyz.rgb = function (xyz) {
|
||||
const x = xyz[0] / 100;
|
||||
const y = xyz[1] / 100;
|
||||
const z = xyz[2] / 100;
|
||||
let r;
|
||||
let g;
|
||||
let b;
|
||||
|
||||
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
||||
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
||||
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
|
||||
|
||||
// Assume sRGB
|
||||
r = r > 0.0031308
|
||||
? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
|
||||
: r * 12.92;
|
||||
|
||||
g = g > 0.0031308
|
||||
? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
|
||||
: g * 12.92;
|
||||
|
||||
b = b > 0.0031308
|
||||
? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
|
||||
: b * 12.92;
|
||||
|
||||
r = Math.min(Math.max(0, r), 1);
|
||||
g = Math.min(Math.max(0, g), 1);
|
||||
b = Math.min(Math.max(0, b), 1);
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.xyz.lab = function (xyz) {
|
||||
let x = xyz[0];
|
||||
let y = xyz[1];
|
||||
let z = xyz[2];
|
||||
|
||||
x /= 95.047;
|
||||
y /= 100;
|
||||
z /= 108.883;
|
||||
|
||||
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
||||
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
||||
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
||||
|
||||
const l = (116 * y) - 16;
|
||||
const a = 500 * (x - y);
|
||||
const b = 200 * (y - z);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.lab.xyz = function (lab) {
|
||||
const l = lab[0];
|
||||
const a = lab[1];
|
||||
const b = lab[2];
|
||||
let x;
|
||||
let y;
|
||||
let z;
|
||||
|
||||
y = (l + 16) / 116;
|
||||
x = a / 500 + y;
|
||||
z = y - b / 200;
|
||||
|
||||
const y2 = y ** 3;
|
||||
const x2 = x ** 3;
|
||||
const z2 = z ** 3;
|
||||
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
||||
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
||||
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
||||
|
||||
x *= 95.047;
|
||||
y *= 100;
|
||||
z *= 108.883;
|
||||
|
||||
return [x, y, z];
|
||||
};
|
||||
|
||||
convert.lab.lch = function (lab) {
|
||||
const l = lab[0];
|
||||
const a = lab[1];
|
||||
const b = lab[2];
|
||||
let h;
|
||||
|
||||
const hr = Math.atan2(b, a);
|
||||
h = hr * 360 / 2 / Math.PI;
|
||||
|
||||
if (h < 0) {
|
||||
h += 360;
|
||||
}
|
||||
|
||||
const c = Math.sqrt(a * a + b * b);
|
||||
|
||||
return [l, c, h];
|
||||
};
|
||||
|
||||
convert.lch.lab = function (lch) {
|
||||
const l = lch[0];
|
||||
const c = lch[1];
|
||||
const h = lch[2];
|
||||
|
||||
const hr = h / 360 * 2 * Math.PI;
|
||||
const a = c * Math.cos(hr);
|
||||
const b = c * Math.sin(hr);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.rgb.ansi16 = function (args, saturation = null) {
|
||||
const [r, g, b] = args;
|
||||
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
|
||||
|
||||
value = Math.round(value / 50);
|
||||
|
||||
if (value === 0) {
|
||||
return 30;
|
||||
}
|
||||
|
||||
let ansi = 30
|
||||
+ ((Math.round(b / 255) << 2)
|
||||
| (Math.round(g / 255) << 1)
|
||||
| Math.round(r / 255));
|
||||
|
||||
if (value === 2) {
|
||||
ansi += 60;
|
||||
}
|
||||
|
||||
return ansi;
|
||||
};
|
||||
|
||||
convert.hsv.ansi16 = function (args) {
|
||||
// Optimization here; we already know the value and don't need to get
|
||||
// it converted for us.
|
||||
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
||||
};
|
||||
|
||||
convert.rgb.ansi256 = function (args) {
|
||||
const r = args[0];
|
||||
const g = args[1];
|
||||
const b = args[2];
|
||||
|
||||
// We use the extended greyscale palette here, with the exception of
|
||||
// black and white. normal palette only has 4 greyscale shades.
|
||||
if (r === g && g === b) {
|
||||
if (r < 8) {
|
||||
return 16;
|
||||
}
|
||||
|
||||
if (r > 248) {
|
||||
return 231;
|
||||
}
|
||||
|
||||
return Math.round(((r - 8) / 247) * 24) + 232;
|
||||
}
|
||||
|
||||
const ansi = 16
|
||||
+ (36 * Math.round(r / 255 * 5))
|
||||
+ (6 * Math.round(g / 255 * 5))
|
||||
+ Math.round(b / 255 * 5);
|
||||
|
||||
return ansi;
|
||||
};
|
||||
|
||||
convert.ansi16.rgb = function (args) {
|
||||
let color = args % 10;
|
||||
|
||||
// Handle greyscale
|
||||
if (color === 0 || color === 7) {
|
||||
if (args > 50) {
|
||||
color += 3.5;
|
||||
}
|
||||
|
||||
color = color / 10.5 * 255;
|
||||
|
||||
return [color, color, color];
|
||||
}
|
||||
|
||||
const mult = (~~(args > 50) + 1) * 0.5;
|
||||
const r = ((color & 1) * mult) * 255;
|
||||
const g = (((color >> 1) & 1) * mult) * 255;
|
||||
const b = (((color >> 2) & 1) * mult) * 255;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.ansi256.rgb = function (args) {
|
||||
// Handle greyscale
|
||||
if (args >= 232) {
|
||||
const c = (args - 232) * 10 + 8;
|
||||
return [c, c, c];
|
||||
}
|
||||
|
||||
args -= 16;
|
||||
|
||||
let rem;
|
||||
const r = Math.floor(args / 36) / 5 * 255;
|
||||
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
||||
const b = (rem % 6) / 5 * 255;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.rgb.hex = function (args) {
|
||||
const integer = ((Math.round(args[0]) & 0xFF) << 16)
|
||||
+ ((Math.round(args[1]) & 0xFF) << 8)
|
||||
+ (Math.round(args[2]) & 0xFF);
|
||||
|
||||
const string = integer.toString(16).toUpperCase();
|
||||
return '000000'.substring(string.length) + string;
|
||||
};
|
||||
|
||||
convert.hex.rgb = function (args) {
|
||||
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
||||
if (!match) {
|
||||
return [0, 0, 0];
|
||||
}
|
||||
|
||||
let colorString = match[0];
|
||||
|
||||
if (match[0].length === 3) {
|
||||
colorString = colorString.split('').map(char => {
|
||||
return char + char;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
const integer = parseInt(colorString, 16);
|
||||
const r = (integer >> 16) & 0xFF;
|
||||
const g = (integer >> 8) & 0xFF;
|
||||
const b = integer & 0xFF;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.rgb.hcg = function (rgb) {
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
const max = Math.max(Math.max(r, g), b);
|
||||
const min = Math.min(Math.min(r, g), b);
|
||||
const chroma = (max - min);
|
||||
let grayscale;
|
||||
let hue;
|
||||
|
||||
if (chroma < 1) {
|
||||
grayscale = min / (1 - chroma);
|
||||
} else {
|
||||
grayscale = 0;
|
||||
}
|
||||
|
||||
if (chroma <= 0) {
|
||||
hue = 0;
|
||||
} else
|
||||
if (max === r) {
|
||||
hue = ((g - b) / chroma) % 6;
|
||||
} else
|
||||
if (max === g) {
|
||||
hue = 2 + (b - r) / chroma;
|
||||
} else {
|
||||
hue = 4 + (r - g) / chroma;
|
||||
}
|
||||
|
||||
hue /= 6;
|
||||
hue %= 1;
|
||||
|
||||
return [hue * 360, chroma * 100, grayscale * 100];
|
||||
};
|
||||
|
||||
convert.hsl.hcg = function (hsl) {
|
||||
const s = hsl[1] / 100;
|
||||
const l = hsl[2] / 100;
|
||||
|
||||
const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
|
||||
|
||||
let f = 0;
|
||||
if (c < 1.0) {
|
||||
f = (l - 0.5 * c) / (1.0 - c);
|
||||
}
|
||||
|
||||
return [hsl[0], c * 100, f * 100];
|
||||
};
|
||||
|
||||
convert.hsv.hcg = function (hsv) {
|
||||
const s = hsv[1] / 100;
|
||||
const v = hsv[2] / 100;
|
||||
|
||||
const c = s * v;
|
||||
let f = 0;
|
||||
|
||||
if (c < 1.0) {
|
||||
f = (v - c) / (1 - c);
|
||||
}
|
||||
|
||||
return [hsv[0], c * 100, f * 100];
|
||||
};
|
||||
|
||||
convert.hcg.rgb = function (hcg) {
|
||||
const h = hcg[0] / 360;
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
|
||||
if (c === 0.0) {
|
||||
return [g * 255, g * 255, g * 255];
|
||||
}
|
||||
|
||||
const pure = [0, 0, 0];
|
||||
const hi = (h % 1) * 6;
|
||||
const v = hi % 1;
|
||||
const w = 1 - v;
|
||||
let mg = 0;
|
||||
|
||||
/* eslint-disable max-statements-per-line */
|
||||
switch (Math.floor(hi)) {
|
||||
case 0:
|
||||
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
||||
case 1:
|
||||
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
||||
case 2:
|
||||
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
||||
case 3:
|
||||
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
||||
case 4:
|
||||
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
||||
default:
|
||||
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
||||
}
|
||||
/* eslint-enable max-statements-per-line */
|
||||
|
||||
mg = (1.0 - c) * g;
|
||||
|
||||
return [
|
||||
(c * pure[0] + mg) * 255,
|
||||
(c * pure[1] + mg) * 255,
|
||||
(c * pure[2] + mg) * 255
|
||||
];
|
||||
};
|
||||
|
||||
convert.hcg.hsv = function (hcg) {
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
|
||||
const v = c + g * (1.0 - c);
|
||||
let f = 0;
|
||||
|
||||
if (v > 0.0) {
|
||||
f = c / v;
|
||||
}
|
||||
|
||||
return [hcg[0], f * 100, v * 100];
|
||||
};
|
||||
|
||||
convert.hcg.hsl = function (hcg) {
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
|
||||
const l = g * (1.0 - c) + 0.5 * c;
|
||||
let s = 0;
|
||||
|
||||
if (l > 0.0 && l < 0.5) {
|
||||
s = c / (2 * l);
|
||||
} else
|
||||
if (l >= 0.5 && l < 1.0) {
|
||||
s = c / (2 * (1 - l));
|
||||
}
|
||||
|
||||
return [hcg[0], s * 100, l * 100];
|
||||
};
|
||||
|
||||
convert.hcg.hwb = function (hcg) {
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
const v = c + g * (1.0 - c);
|
||||
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
||||
};
|
||||
|
||||
convert.hwb.hcg = function (hwb) {
|
||||
const w = hwb[1] / 100;
|
||||
const b = hwb[2] / 100;
|
||||
const v = 1 - b;
|
||||
const c = v - w;
|
||||
let g = 0;
|
||||
|
||||
if (c < 1) {
|
||||
g = (v - c) / (1 - c);
|
||||
}
|
||||
|
||||
return [hwb[0], c * 100, g * 100];
|
||||
};
|
||||
|
||||
convert.apple.rgb = function (apple) {
|
||||
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
|
||||
};
|
||||
|
||||
convert.rgb.apple = function (rgb) {
|
||||
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
|
||||
};
|
||||
|
||||
convert.gray.rgb = function (args) {
|
||||
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
||||
};
|
||||
|
||||
convert.gray.hsl = function (args) {
|
||||
return [0, 0, args[0]];
|
||||
};
|
||||
|
||||
convert.gray.hsv = convert.gray.hsl;
|
||||
|
||||
convert.gray.hwb = function (gray) {
|
||||
return [0, 100, gray[0]];
|
||||
};
|
||||
|
||||
convert.gray.cmyk = function (gray) {
|
||||
return [0, 0, 0, gray[0]];
|
||||
};
|
||||
|
||||
convert.gray.lab = function (gray) {
|
||||
return [gray[0], 0, 0];
|
||||
};
|
||||
|
||||
convert.gray.hex = function (gray) {
|
||||
const val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
||||
const integer = (val << 16) + (val << 8) + val;
|
||||
|
||||
const string = integer.toString(16).toUpperCase();
|
||||
return '000000'.substring(string.length) + string;
|
||||
};
|
||||
|
||||
convert.rgb.gray = function (rgb) {
|
||||
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
||||
return [val / 255 * 100];
|
||||
};
|
81
node_modules/jest-config/node_modules/color-convert/index.js
generated
vendored
Normal file
81
node_modules/jest-config/node_modules/color-convert/index.js
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
const conversions = require('./conversions');
|
||||
const route = require('./route');
|
||||
|
||||
const convert = {};
|
||||
|
||||
const models = Object.keys(conversions);
|
||||
|
||||
function wrapRaw(fn) {
|
||||
const wrappedFn = function (...args) {
|
||||
const arg0 = args[0];
|
||||
if (arg0 === undefined || arg0 === null) {
|
||||
return arg0;
|
||||
}
|
||||
|
||||
if (arg0.length > 1) {
|
||||
args = arg0;
|
||||
}
|
||||
|
||||
return fn(args);
|
||||
};
|
||||
|
||||
// Preserve .conversion property if there is one
|
||||
if ('conversion' in fn) {
|
||||
wrappedFn.conversion = fn.conversion;
|
||||
}
|
||||
|
||||
return wrappedFn;
|
||||
}
|
||||
|
||||
function wrapRounded(fn) {
|
||||
const wrappedFn = function (...args) {
|
||||
const arg0 = args[0];
|
||||
|
||||
if (arg0 === undefined || arg0 === null) {
|
||||
return arg0;
|
||||
}
|
||||
|
||||
if (arg0.length > 1) {
|
||||
args = arg0;
|
||||
}
|
||||
|
||||
const result = fn(args);
|
||||
|
||||
// We're assuming the result is an array here.
|
||||
// see notice in conversions.js; don't use box types
|
||||
// in conversion functions.
|
||||
if (typeof result === 'object') {
|
||||
for (let len = result.length, i = 0; i < len; i++) {
|
||||
result[i] = Math.round(result[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
// Preserve .conversion property if there is one
|
||||
if ('conversion' in fn) {
|
||||
wrappedFn.conversion = fn.conversion;
|
||||
}
|
||||
|
||||
return wrappedFn;
|
||||
}
|
||||
|
||||
models.forEach(fromModel => {
|
||||
convert[fromModel] = {};
|
||||
|
||||
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
|
||||
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
|
||||
|
||||
const routes = route(fromModel);
|
||||
const routeModels = Object.keys(routes);
|
||||
|
||||
routeModels.forEach(toModel => {
|
||||
const fn = routes[toModel];
|
||||
|
||||
convert[fromModel][toModel] = wrapRounded(fn);
|
||||
convert[fromModel][toModel].raw = wrapRaw(fn);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = convert;
|
48
node_modules/jest-config/node_modules/color-convert/package.json
generated
vendored
Normal file
48
node_modules/jest-config/node_modules/color-convert/package.json
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "color-convert",
|
||||
"description": "Plain color conversion functions",
|
||||
"version": "2.0.1",
|
||||
"author": "Heather Arthur <fayearthur@gmail.com>",
|
||||
"license": "MIT",
|
||||
"repository": "Qix-/color-convert",
|
||||
"scripts": {
|
||||
"pretest": "xo",
|
||||
"test": "node test/basic.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
},
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"convert",
|
||||
"converter",
|
||||
"conversion",
|
||||
"rgb",
|
||||
"hsl",
|
||||
"hsv",
|
||||
"hwb",
|
||||
"cmyk",
|
||||
"ansi",
|
||||
"ansi16"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"conversions.js",
|
||||
"route.js"
|
||||
],
|
||||
"xo": {
|
||||
"rules": {
|
||||
"default-case": 0,
|
||||
"no-inline-comments": 0,
|
||||
"operator-linebreak": 0
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"chalk": "^2.4.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
}
|
||||
}
|
97
node_modules/jest-config/node_modules/color-convert/route.js
generated
vendored
Normal file
97
node_modules/jest-config/node_modules/color-convert/route.js
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
const conversions = require('./conversions');
|
||||
|
||||
/*
|
||||
This function routes a model to all other models.
|
||||
|
||||
all functions that are routed have a property `.conversion` attached
|
||||
to the returned synthetic function. This property is an array
|
||||
of strings, each with the steps in between the 'from' and 'to'
|
||||
color models (inclusive).
|
||||
|
||||
conversions that are not possible simply are not included.
|
||||
*/
|
||||
|
||||
function buildGraph() {
|
||||
const graph = {};
|
||||
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
|
||||
const models = Object.keys(conversions);
|
||||
|
||||
for (let len = models.length, i = 0; i < len; i++) {
|
||||
graph[models[i]] = {
|
||||
// http://jsperf.com/1-vs-infinity
|
||||
// micro-opt, but this is simple.
|
||||
distance: -1,
|
||||
parent: null
|
||||
};
|
||||
}
|
||||
|
||||
return graph;
|
||||
}
|
||||
|
||||
// https://en.wikipedia.org/wiki/Breadth-first_search
|
||||
function deriveBFS(fromModel) {
|
||||
const graph = buildGraph();
|
||||
const queue = [fromModel]; // Unshift -> queue -> pop
|
||||
|
||||
graph[fromModel].distance = 0;
|
||||
|
||||
while (queue.length) {
|
||||
const current = queue.pop();
|
||||
const adjacents = Object.keys(conversions[current]);
|
||||
|
||||
for (let len = adjacents.length, i = 0; i < len; i++) {
|
||||
const adjacent = adjacents[i];
|
||||
const node = graph[adjacent];
|
||||
|
||||
if (node.distance === -1) {
|
||||
node.distance = graph[current].distance + 1;
|
||||
node.parent = current;
|
||||
queue.unshift(adjacent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return graph;
|
||||
}
|
||||
|
||||
function link(from, to) {
|
||||
return function (args) {
|
||||
return to(from(args));
|
||||
};
|
||||
}
|
||||
|
||||
function wrapConversion(toModel, graph) {
|
||||
const path = [graph[toModel].parent, toModel];
|
||||
let fn = conversions[graph[toModel].parent][toModel];
|
||||
|
||||
let cur = graph[toModel].parent;
|
||||
while (graph[cur].parent) {
|
||||
path.unshift(graph[cur].parent);
|
||||
fn = link(conversions[graph[cur].parent][cur], fn);
|
||||
cur = graph[cur].parent;
|
||||
}
|
||||
|
||||
fn.conversion = path;
|
||||
return fn;
|
||||
}
|
||||
|
||||
module.exports = function (fromModel) {
|
||||
const graph = deriveBFS(fromModel);
|
||||
const conversion = {};
|
||||
|
||||
const models = Object.keys(graph);
|
||||
for (let len = models.length, i = 0; i < len; i++) {
|
||||
const toModel = models[i];
|
||||
const node = graph[toModel];
|
||||
|
||||
if (node.parent === null) {
|
||||
// No possible conversion, or this node is the source model.
|
||||
continue;
|
||||
}
|
||||
|
||||
conversion[toModel] = wrapConversion(toModel, graph);
|
||||
}
|
||||
|
||||
return conversion;
|
||||
};
|
||||
|
8
node_modules/jest-config/node_modules/color-name/LICENSE
generated
vendored
Normal file
8
node_modules/jest-config/node_modules/color-name/LICENSE
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2015 Dmitry Ivanov
|
||||
|
||||
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.
|
11
node_modules/jest-config/node_modules/color-name/README.md
generated
vendored
Normal file
11
node_modules/jest-config/node_modules/color-name/README.md
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors.
|
||||
|
||||
[](https://nodei.co/npm/color-name/)
|
||||
|
||||
|
||||
```js
|
||||
var colors = require('color-name');
|
||||
colors.red //[255,0,0]
|
||||
```
|
||||
|
||||
<a href="LICENSE"><img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" width="120"/></a>
|
152
node_modules/jest-config/node_modules/color-name/index.js
generated
vendored
Normal file
152
node_modules/jest-config/node_modules/color-name/index.js
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
"aliceblue": [240, 248, 255],
|
||||
"antiquewhite": [250, 235, 215],
|
||||
"aqua": [0, 255, 255],
|
||||
"aquamarine": [127, 255, 212],
|
||||
"azure": [240, 255, 255],
|
||||
"beige": [245, 245, 220],
|
||||
"bisque": [255, 228, 196],
|
||||
"black": [0, 0, 0],
|
||||
"blanchedalmond": [255, 235, 205],
|
||||
"blue": [0, 0, 255],
|
||||
"blueviolet": [138, 43, 226],
|
||||
"brown": [165, 42, 42],
|
||||
"burlywood": [222, 184, 135],
|
||||
"cadetblue": [95, 158, 160],
|
||||
"chartreuse": [127, 255, 0],
|
||||
"chocolate": [210, 105, 30],
|
||||
"coral": [255, 127, 80],
|
||||
"cornflowerblue": [100, 149, 237],
|
||||
"cornsilk": [255, 248, 220],
|
||||
"crimson": [220, 20, 60],
|
||||
"cyan": [0, 255, 255],
|
||||
"darkblue": [0, 0, 139],
|
||||
"darkcyan": [0, 139, 139],
|
||||
"darkgoldenrod": [184, 134, 11],
|
||||
"darkgray": [169, 169, 169],
|
||||
"darkgreen": [0, 100, 0],
|
||||
"darkgrey": [169, 169, 169],
|
||||
"darkkhaki": [189, 183, 107],
|
||||
"darkmagenta": [139, 0, 139],
|
||||
"darkolivegreen": [85, 107, 47],
|
||||
"darkorange": [255, 140, 0],
|
||||
"darkorchid": [153, 50, 204],
|
||||
"darkred": [139, 0, 0],
|
||||
"darksalmon": [233, 150, 122],
|
||||
"darkseagreen": [143, 188, 143],
|
||||
"darkslateblue": [72, 61, 139],
|
||||
"darkslategray": [47, 79, 79],
|
||||
"darkslategrey": [47, 79, 79],
|
||||
"darkturquoise": [0, 206, 209],
|
||||
"darkviolet": [148, 0, 211],
|
||||
"deeppink": [255, 20, 147],
|
||||
"deepskyblue": [0, 191, 255],
|
||||
"dimgray": [105, 105, 105],
|
||||
"dimgrey": [105, 105, 105],
|
||||
"dodgerblue": [30, 144, 255],
|
||||
"firebrick": [178, 34, 34],
|
||||
"floralwhite": [255, 250, 240],
|
||||
"forestgreen": [34, 139, 34],
|
||||
"fuchsia": [255, 0, 255],
|
||||
"gainsboro": [220, 220, 220],
|
||||
"ghostwhite": [248, 248, 255],
|
||||
"gold": [255, 215, 0],
|
||||
"goldenrod": [218, 165, 32],
|
||||
"gray": [128, 128, 128],
|
||||
"green": [0, 128, 0],
|
||||
"greenyellow": [173, 255, 47],
|
||||
"grey": [128, 128, 128],
|
||||
"honeydew": [240, 255, 240],
|
||||
"hotpink": [255, 105, 180],
|
||||
"indianred": [205, 92, 92],
|
||||
"indigo": [75, 0, 130],
|
||||
"ivory": [255, 255, 240],
|
||||
"khaki": [240, 230, 140],
|
||||
"lavender": [230, 230, 250],
|
||||
"lavenderblush": [255, 240, 245],
|
||||
"lawngreen": [124, 252, 0],
|
||||
"lemonchiffon": [255, 250, 205],
|
||||
"lightblue": [173, 216, 230],
|
||||
"lightcoral": [240, 128, 128],
|
||||
"lightcyan": [224, 255, 255],
|
||||
"lightgoldenrodyellow": [250, 250, 210],
|
||||
"lightgray": [211, 211, 211],
|
||||
"lightgreen": [144, 238, 144],
|
||||
"lightgrey": [211, 211, 211],
|
||||
"lightpink": [255, 182, 193],
|
||||
"lightsalmon": [255, 160, 122],
|
||||
"lightseagreen": [32, 178, 170],
|
||||
"lightskyblue": [135, 206, 250],
|
||||
"lightslategray": [119, 136, 153],
|
||||
"lightslategrey": [119, 136, 153],
|
||||
"lightsteelblue": [176, 196, 222],
|
||||
"lightyellow": [255, 255, 224],
|
||||
"lime": [0, 255, 0],
|
||||
"limegreen": [50, 205, 50],
|
||||
"linen": [250, 240, 230],
|
||||
"magenta": [255, 0, 255],
|
||||
"maroon": [128, 0, 0],
|
||||
"mediumaquamarine": [102, 205, 170],
|
||||
"mediumblue": [0, 0, 205],
|
||||
"mediumorchid": [186, 85, 211],
|
||||
"mediumpurple": [147, 112, 219],
|
||||
"mediumseagreen": [60, 179, 113],
|
||||
"mediumslateblue": [123, 104, 238],
|
||||
"mediumspringgreen": [0, 250, 154],
|
||||
"mediumturquoise": [72, 209, 204],
|
||||
"mediumvioletred": [199, 21, 133],
|
||||
"midnightblue": [25, 25, 112],
|
||||
"mintcream": [245, 255, 250],
|
||||
"mistyrose": [255, 228, 225],
|
||||
"moccasin": [255, 228, 181],
|
||||
"navajowhite": [255, 222, 173],
|
||||
"navy": [0, 0, 128],
|
||||
"oldlace": [253, 245, 230],
|
||||
"olive": [128, 128, 0],
|
||||
"olivedrab": [107, 142, 35],
|
||||
"orange": [255, 165, 0],
|
||||
"orangered": [255, 69, 0],
|
||||
"orchid": [218, 112, 214],
|
||||
"palegoldenrod": [238, 232, 170],
|
||||
"palegreen": [152, 251, 152],
|
||||
"paleturquoise": [175, 238, 238],
|
||||
"palevioletred": [219, 112, 147],
|
||||
"papayawhip": [255, 239, 213],
|
||||
"peachpuff": [255, 218, 185],
|
||||
"peru": [205, 133, 63],
|
||||
"pink": [255, 192, 203],
|
||||
"plum": [221, 160, 221],
|
||||
"powderblue": [176, 224, 230],
|
||||
"purple": [128, 0, 128],
|
||||
"rebeccapurple": [102, 51, 153],
|
||||
"red": [255, 0, 0],
|
||||
"rosybrown": [188, 143, 143],
|
||||
"royalblue": [65, 105, 225],
|
||||
"saddlebrown": [139, 69, 19],
|
||||
"salmon": [250, 128, 114],
|
||||
"sandybrown": [244, 164, 96],
|
||||
"seagreen": [46, 139, 87],
|
||||
"seashell": [255, 245, 238],
|
||||
"sienna": [160, 82, 45],
|
||||
"silver": [192, 192, 192],
|
||||
"skyblue": [135, 206, 235],
|
||||
"slateblue": [106, 90, 205],
|
||||
"slategray": [112, 128, 144],
|
||||
"slategrey": [112, 128, 144],
|
||||
"snow": [255, 250, 250],
|
||||
"springgreen": [0, 255, 127],
|
||||
"steelblue": [70, 130, 180],
|
||||
"tan": [210, 180, 140],
|
||||
"teal": [0, 128, 128],
|
||||
"thistle": [216, 191, 216],
|
||||
"tomato": [255, 99, 71],
|
||||
"turquoise": [64, 224, 208],
|
||||
"violet": [238, 130, 238],
|
||||
"wheat": [245, 222, 179],
|
||||
"white": [255, 255, 255],
|
||||
"whitesmoke": [245, 245, 245],
|
||||
"yellow": [255, 255, 0],
|
||||
"yellowgreen": [154, 205, 50]
|
||||
};
|
28
node_modules/jest-config/node_modules/color-name/package.json
generated
vendored
Normal file
28
node_modules/jest-config/node_modules/color-name/package.json
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "color-name",
|
||||
"version": "1.1.4",
|
||||
"description": "A list of color names and its values",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:colorjs/color-name.git"
|
||||
},
|
||||
"keywords": [
|
||||
"color-name",
|
||||
"color",
|
||||
"color-keyword",
|
||||
"keyword"
|
||||
],
|
||||
"author": "DY <dfcreative@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/colorjs/color-name/issues"
|
||||
},
|
||||
"homepage": "https://github.com/colorjs/color-name"
|
||||
}
|
39
node_modules/jest-config/node_modules/has-flag/index.d.ts
generated
vendored
Normal file
39
node_modules/jest-config/node_modules/has-flag/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag.
|
||||
|
||||
@param flag - CLI flag to look for. The `--` prefix is optional.
|
||||
@param argv - CLI arguments. Default: `process.argv`.
|
||||
@returns Whether the flag exists.
|
||||
|
||||
@example
|
||||
```
|
||||
// $ ts-node foo.ts -f --unicorn --foo=bar -- --rainbow
|
||||
|
||||
// foo.ts
|
||||
import hasFlag = require('has-flag');
|
||||
|
||||
hasFlag('unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('--unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('f');
|
||||
//=> true
|
||||
|
||||
hasFlag('-f');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo=bar');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo');
|
||||
//=> false
|
||||
|
||||
hasFlag('rainbow');
|
||||
//=> false
|
||||
```
|
||||
*/
|
||||
declare function hasFlag(flag: string, argv?: string[]): boolean;
|
||||
|
||||
export = hasFlag;
|
8
node_modules/jest-config/node_modules/has-flag/index.js
generated
vendored
Normal file
8
node_modules/jest-config/node_modules/has-flag/index.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = (flag, argv = process.argv) => {
|
||||
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
||||
const position = argv.indexOf(prefix + flag);
|
||||
const terminatorPosition = argv.indexOf('--');
|
||||
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
||||
};
|
9
node_modules/jest-config/node_modules/has-flag/license
generated
vendored
Normal file
9
node_modules/jest-config/node_modules/has-flag/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.
|
46
node_modules/jest-config/node_modules/has-flag/package.json
generated
vendored
Normal file
46
node_modules/jest-config/node_modules/has-flag/package.json
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "has-flag",
|
||||
"version": "4.0.0",
|
||||
"description": "Check if argv has a specific flag",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/has-flag",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"has",
|
||||
"check",
|
||||
"detect",
|
||||
"contains",
|
||||
"find",
|
||||
"flag",
|
||||
"cli",
|
||||
"command-line",
|
||||
"argv",
|
||||
"process",
|
||||
"arg",
|
||||
"args",
|
||||
"argument",
|
||||
"arguments",
|
||||
"getopt",
|
||||
"minimist",
|
||||
"optimist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
89
node_modules/jest-config/node_modules/has-flag/readme.md
generated
vendored
Normal file
89
node_modules/jest-config/node_modules/has-flag/readme.md
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
# has-flag [](https://travis-ci.org/sindresorhus/has-flag)
|
||||
|
||||
> Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag
|
||||
|
||||
Correctly stops looking after an `--` argument terminator.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-has-flag?utm_source=npm-has-flag&utm_medium=referral&utm_campaign=readme">Get professional support for this package 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 has-flag
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// foo.js
|
||||
const hasFlag = require('has-flag');
|
||||
|
||||
hasFlag('unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('--unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('f');
|
||||
//=> true
|
||||
|
||||
hasFlag('-f');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo=bar');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo');
|
||||
//=> false
|
||||
|
||||
hasFlag('rainbow');
|
||||
//=> false
|
||||
```
|
||||
|
||||
```
|
||||
$ node foo.js -f --unicorn --foo=bar -- --rainbow
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### hasFlag(flag, [argv])
|
||||
|
||||
Returns a boolean for whether the flag exists.
|
||||
|
||||
#### flag
|
||||
|
||||
Type: `string`
|
||||
|
||||
CLI flag to look for. The `--` prefix is optional.
|
||||
|
||||
#### argv
|
||||
|
||||
Type: `string[]`<br>
|
||||
Default: `process.argv`
|
||||
|
||||
CLI arguments.
|
||||
|
||||
|
||||
## Security
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
21
node_modules/jest-config/node_modules/pretty-format/LICENSE
generated
vendored
Normal file
21
node_modules/jest-config/node_modules/pretty-format/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.
|
456
node_modules/jest-config/node_modules/pretty-format/README.md
generated
vendored
Executable file
456
node_modules/jest-config/node_modules/pretty-format/README.md
generated
vendored
Executable file
@ -0,0 +1,456 @@
|
||||
# pretty-format
|
||||
|
||||
Stringify any JavaScript value.
|
||||
|
||||
- Serialize built-in JavaScript types.
|
||||
- Serialize application-specific data types with built-in or user-defined plugins.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ yarn add pretty-format
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const prettyFormat = require('pretty-format'); // CommonJS
|
||||
```
|
||||
|
||||
```js
|
||||
import prettyFormat from 'pretty-format'; // ES2015 modules
|
||||
```
|
||||
|
||||
```js
|
||||
const val = {object: {}};
|
||||
val.circularReference = val;
|
||||
val[Symbol('foo')] = 'foo';
|
||||
val.map = new Map([['prop', 'value']]);
|
||||
val.array = [-0, Infinity, NaN];
|
||||
|
||||
console.log(prettyFormat(val));
|
||||
/*
|
||||
Object {
|
||||
"array": Array [
|
||||
-0,
|
||||
Infinity,
|
||||
NaN,
|
||||
],
|
||||
"circularReference": [Circular],
|
||||
"map": Map {
|
||||
"prop" => "value",
|
||||
},
|
||||
"object": Object {},
|
||||
Symbol(foo): "foo",
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
## Usage with options
|
||||
|
||||
```js
|
||||
function onClick() {}
|
||||
|
||||
console.log(prettyFormat(onClick));
|
||||
/*
|
||||
[Function onClick]
|
||||
*/
|
||||
|
||||
const options = {
|
||||
printFunctionName: false,
|
||||
};
|
||||
console.log(prettyFormat(onClick, options));
|
||||
/*
|
||||
[Function]
|
||||
*/
|
||||
```
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
| key | type | default | description |
|
||||
| :------------------ | :-------- | :--------- | :------------------------------------------------------ |
|
||||
| `callToJSON` | `boolean` | `true` | call `toJSON` method (if it exists) on objects |
|
||||
| `escapeRegex` | `boolean` | `false` | escape special characters in regular expressions |
|
||||
| `escapeString` | `boolean` | `true` | escape special characters in strings |
|
||||
| `highlight` | `boolean` | `false` | highlight syntax with colors in terminal (some plugins) |
|
||||
| `indent` | `number` | `2` | spaces in each level of indentation |
|
||||
| `maxDepth` | `number` | `Infinity` | levels to print in arrays, objects, elements, and so on |
|
||||
| `min` | `boolean` | `false` | minimize added space: no indentation nor line breaks |
|
||||
| `plugins` | `array` | `[]` | plugins to serialize application-specific data types |
|
||||
| `printFunctionName` | `boolean` | `true` | include or omit the name of a function |
|
||||
| `theme` | `object` | | colors to highlight syntax in terminal |
|
||||
|
||||
Property values of `theme` are from [ansi-styles colors](https://github.com/chalk/ansi-styles#colors)
|
||||
|
||||
```js
|
||||
const DEFAULT_THEME = {
|
||||
comment: 'gray',
|
||||
content: 'reset',
|
||||
prop: 'yellow',
|
||||
tag: 'cyan',
|
||||
value: 'green',
|
||||
};
|
||||
```
|
||||
|
||||
## Usage with plugins
|
||||
|
||||
The `pretty-format` package provides some built-in plugins, including:
|
||||
|
||||
- `ReactElement` for elements from `react`
|
||||
- `ReactTestComponent` for test objects from `react-test-renderer`
|
||||
|
||||
```js
|
||||
// CommonJS
|
||||
const prettyFormat = require('pretty-format');
|
||||
const ReactElement = prettyFormat.plugins.ReactElement;
|
||||
const ReactTestComponent = prettyFormat.plugins.ReactTestComponent;
|
||||
|
||||
const React = require('react');
|
||||
const renderer = require('react-test-renderer');
|
||||
```
|
||||
|
||||
```js
|
||||
// ES2015 modules and destructuring assignment
|
||||
import prettyFormat from 'pretty-format';
|
||||
const {ReactElement, ReactTestComponent} = prettyFormat.plugins;
|
||||
|
||||
import React from 'react';
|
||||
import renderer from 'react-test-renderer';
|
||||
```
|
||||
|
||||
```js
|
||||
const onClick = () => {};
|
||||
const element = React.createElement('button', {onClick}, 'Hello World');
|
||||
|
||||
const formatted1 = prettyFormat(element, {
|
||||
plugins: [ReactElement],
|
||||
printFunctionName: false,
|
||||
});
|
||||
const formatted2 = prettyFormat(renderer.create(element).toJSON(), {
|
||||
plugins: [ReactTestComponent],
|
||||
printFunctionName: false,
|
||||
});
|
||||
/*
|
||||
<button
|
||||
onClick=[Function]
|
||||
>
|
||||
Hello World
|
||||
</button>
|
||||
*/
|
||||
```
|
||||
|
||||
## Usage in Jest
|
||||
|
||||
For snapshot tests, Jest uses `pretty-format` with options that include some of its built-in plugins. For this purpose, plugins are also known as **snapshot serializers**.
|
||||
|
||||
To serialize application-specific data types, you can add modules to `devDependencies` of a project, and then:
|
||||
|
||||
In an **individual** test file, you can add a module as follows. It precedes any modules from Jest configuration.
|
||||
|
||||
```js
|
||||
import serializer from 'my-serializer-module';
|
||||
expect.addSnapshotSerializer(serializer);
|
||||
|
||||
// tests which have `expect(value).toMatchSnapshot()` assertions
|
||||
```
|
||||
|
||||
For **all** test files, you can specify modules in Jest configuration. They precede built-in plugins for React, HTML, and Immutable.js data types. For example, in a `package.json` file:
|
||||
|
||||
```json
|
||||
{
|
||||
"jest": {
|
||||
"snapshotSerializers": ["my-serializer-module"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Writing plugins
|
||||
|
||||
A plugin is a JavaScript object.
|
||||
|
||||
If `options` has a `plugins` array: for the first plugin whose `test(val)` method returns a truthy value, then `prettyFormat(val, options)` returns the result from either:
|
||||
|
||||
- `serialize(val, …)` method of the **improved** interface (available in **version 21** or later)
|
||||
- `print(val, …)` method of the **original** interface (if plugin does not have `serialize` method)
|
||||
|
||||
### test
|
||||
|
||||
Write `test` so it can receive `val` argument of any type. To serialize **objects** which have certain properties, then a guarded expression like `val != null && …` or more concise `val && …` prevents the following errors:
|
||||
|
||||
- `TypeError: Cannot read property 'whatever' of null`
|
||||
- `TypeError: Cannot read property 'whatever' of undefined`
|
||||
|
||||
For example, `test` method of built-in `ReactElement` plugin:
|
||||
|
||||
```js
|
||||
const elementSymbol = Symbol.for('react.element');
|
||||
const test = val => val && val.$$typeof === elementSymbol;
|
||||
```
|
||||
|
||||
Pay attention to efficiency in `test` because `pretty-format` calls it often.
|
||||
|
||||
### serialize
|
||||
|
||||
The **improved** interface is available in **version 21** or later.
|
||||
|
||||
Write `serialize` to return a string, given the arguments:
|
||||
|
||||
- `val` which “passed the test”
|
||||
- unchanging `config` object: derived from `options`
|
||||
- current `indentation` string: concatenate to `indent` from `config`
|
||||
- current `depth` number: compare to `maxDepth` from `config`
|
||||
- current `refs` array: find circular references in objects
|
||||
- `printer` callback function: serialize children
|
||||
|
||||
### config
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
| key | type | description |
|
||||
| :------------------ | :-------- | :------------------------------------------------------ |
|
||||
| `callToJSON` | `boolean` | call `toJSON` method (if it exists) on objects |
|
||||
| `colors` | `Object` | escape codes for colors to highlight syntax |
|
||||
| `escapeRegex` | `boolean` | escape special characters in regular expressions |
|
||||
| `escapeString` | `boolean` | escape special characters in strings |
|
||||
| `indent` | `string` | spaces in each level of indentation |
|
||||
| `maxDepth` | `number` | levels to print in arrays, objects, elements, and so on |
|
||||
| `min` | `boolean` | minimize added space: no indentation nor line breaks |
|
||||
| `plugins` | `array` | plugins to serialize application-specific data types |
|
||||
| `printFunctionName` | `boolean` | include or omit the name of a function |
|
||||
| `spacingInner` | `strong` | spacing to separate items in a list |
|
||||
| `spacingOuter` | `strong` | spacing to enclose a list of items |
|
||||
|
||||
Each property of `colors` in `config` corresponds to a property of `theme` in `options`:
|
||||
|
||||
- the key is the same (for example, `tag`)
|
||||
- the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`)
|
||||
|
||||
Some properties in `config` are derived from `min` in `options`:
|
||||
|
||||
- `spacingInner` and `spacingOuter` are **newline** if `min` is `false`
|
||||
- `spacingInner` is **space** and `spacingOuter` is **empty string** if `min` is `true`
|
||||
|
||||
### Example of serialize and test
|
||||
|
||||
This plugin is a pattern you can apply to serialize composite data types. Side note: `pretty-format` does not need a plugin to serialize arrays.
|
||||
|
||||
```js
|
||||
// We reused more code when we factored out a function for child items
|
||||
// that is independent of depth, name, and enclosing punctuation (see below).
|
||||
const SEPARATOR = ',';
|
||||
function serializeItems(items, config, indentation, depth, refs, printer) {
|
||||
if (items.length === 0) {
|
||||
return '';
|
||||
}
|
||||
const indentationItems = indentation + config.indent;
|
||||
return (
|
||||
config.spacingOuter +
|
||||
items
|
||||
.map(
|
||||
item =>
|
||||
indentationItems +
|
||||
printer(item, config, indentationItems, depth, refs), // callback
|
||||
)
|
||||
.join(SEPARATOR + config.spacingInner) +
|
||||
(config.min ? '' : SEPARATOR) + // following the last item
|
||||
config.spacingOuter +
|
||||
indentation
|
||||
);
|
||||
}
|
||||
|
||||
const plugin = {
|
||||
test(val) {
|
||||
return Array.isArray(val);
|
||||
},
|
||||
serialize(array, config, indentation, depth, refs, printer) {
|
||||
const name = array.constructor.name;
|
||||
return ++depth > config.maxDepth
|
||||
? '[' + name + ']'
|
||||
: (config.min ? '' : name + ' ') +
|
||||
'[' +
|
||||
serializeItems(array, config, indentation, depth, refs, printer) +
|
||||
']';
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
```js
|
||||
const val = {
|
||||
filter: 'completed',
|
||||
items: [
|
||||
{
|
||||
text: 'Write test',
|
||||
completed: true,
|
||||
},
|
||||
{
|
||||
text: 'Write serialize',
|
||||
completed: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
```js
|
||||
console.log(
|
||||
prettyFormat(val, {
|
||||
plugins: [plugin],
|
||||
}),
|
||||
);
|
||||
/*
|
||||
Object {
|
||||
"filter": "completed",
|
||||
"items": Array [
|
||||
Object {
|
||||
"completed": true,
|
||||
"text": "Write test",
|
||||
},
|
||||
Object {
|
||||
"completed": true,
|
||||
"text": "Write serialize",
|
||||
},
|
||||
],
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
```js
|
||||
console.log(
|
||||
prettyFormat(val, {
|
||||
indent: 4,
|
||||
plugins: [plugin],
|
||||
}),
|
||||
);
|
||||
/*
|
||||
Object {
|
||||
"filter": "completed",
|
||||
"items": Array [
|
||||
Object {
|
||||
"completed": true,
|
||||
"text": "Write test",
|
||||
},
|
||||
Object {
|
||||
"completed": true,
|
||||
"text": "Write serialize",
|
||||
},
|
||||
],
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
```js
|
||||
console.log(
|
||||
prettyFormat(val, {
|
||||
maxDepth: 1,
|
||||
plugins: [plugin],
|
||||
}),
|
||||
);
|
||||
/*
|
||||
Object {
|
||||
"filter": "completed",
|
||||
"items": [Array],
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
```js
|
||||
console.log(
|
||||
prettyFormat(val, {
|
||||
min: true,
|
||||
plugins: [plugin],
|
||||
}),
|
||||
);
|
||||
/*
|
||||
{"filter": "completed", "items": [{"completed": true, "text": "Write test"}, {"completed": true, "text": "Write serialize"}]}
|
||||
*/
|
||||
```
|
||||
|
||||
### print
|
||||
|
||||
The **original** interface is adequate for plugins:
|
||||
|
||||
- that **do not** depend on options other than `highlight` or `min`
|
||||
- that **do not** depend on `depth` or `refs` in recursive traversal, and
|
||||
- if values either
|
||||
- do **not** require indentation, or
|
||||
- do **not** occur as children of JavaScript data structures (for example, array)
|
||||
|
||||
Write `print` to return a string, given the arguments:
|
||||
|
||||
- `val` which “passed the test”
|
||||
- current `printer(valChild)` callback function: serialize children
|
||||
- current `indenter(lines)` callback function: indent lines at the next level
|
||||
- unchanging `config` object: derived from `options`
|
||||
- unchanging `colors` object: derived from `options`
|
||||
|
||||
The 3 properties of `config` are `min` in `options` and:
|
||||
|
||||
- `spacing` and `edgeSpacing` are **newline** if `min` is `false`
|
||||
- `spacing` is **space** and `edgeSpacing` is **empty string** if `min` is `true`
|
||||
|
||||
Each property of `colors` corresponds to a property of `theme` in `options`:
|
||||
|
||||
- the key is the same (for example, `tag`)
|
||||
- the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`)
|
||||
|
||||
### Example of print and test
|
||||
|
||||
This plugin prints functions with the **number of named arguments** excluding rest argument.
|
||||
|
||||
```js
|
||||
const plugin = {
|
||||
print(val) {
|
||||
return `[Function ${val.name || 'anonymous'} ${val.length}]`;
|
||||
},
|
||||
test(val) {
|
||||
return typeof val === 'function';
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
```js
|
||||
const val = {
|
||||
onClick(event) {},
|
||||
render() {},
|
||||
};
|
||||
|
||||
prettyFormat(val, {
|
||||
plugins: [plugin],
|
||||
});
|
||||
/*
|
||||
Object {
|
||||
"onClick": [Function onClick 1],
|
||||
"render": [Function render 0],
|
||||
}
|
||||
*/
|
||||
|
||||
prettyFormat(val);
|
||||
/*
|
||||
Object {
|
||||
"onClick": [Function onClick],
|
||||
"render": [Function render],
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
This plugin **ignores** the `printFunctionName` option. That limitation of the original `print` interface is a reason to use the improved `serialize` interface, described above.
|
||||
|
||||
```js
|
||||
prettyFormat(val, {
|
||||
plugins: [pluginOld],
|
||||
printFunctionName: false,
|
||||
});
|
||||
/*
|
||||
Object {
|
||||
"onClick": [Function onClick 1],
|
||||
"render": [Function render 0],
|
||||
}
|
||||
*/
|
||||
|
||||
prettyFormat(val, {
|
||||
printFunctionName: false,
|
||||
});
|
||||
/*
|
||||
Object {
|
||||
"onClick": [Function],
|
||||
"render": [Function],
|
||||
}
|
||||
*/
|
||||
```
|
3252
node_modules/jest-config/node_modules/pretty-format/build-es5/index.js
generated
vendored
Normal file
3252
node_modules/jest-config/node_modules/pretty-format/build-es5/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/jest-config/node_modules/pretty-format/build-es5/index.js.map
generated
vendored
Normal file
1
node_modules/jest-config/node_modules/pretty-format/build-es5/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
32
node_modules/jest-config/node_modules/pretty-format/build/collections.d.ts
generated
vendored
Normal file
32
node_modules/jest-config/node_modules/pretty-format/build/collections.d.ts
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 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 type { Config, Printer, Refs } from './types';
|
||||
/**
|
||||
* Return entries (for example, of a map)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, braces)
|
||||
*/
|
||||
export declare function printIteratorEntries(iterator: Iterator<[unknown, unknown]>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer, separator?: string): string;
|
||||
/**
|
||||
* Return values (for example, of a set)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (braces or brackets)
|
||||
*/
|
||||
export declare function printIteratorValues(iterator: Iterator<unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string;
|
||||
/**
|
||||
* Return items (for example, of an array)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, brackets)
|
||||
**/
|
||||
export declare function printListItems(list: ArrayLike<unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string;
|
||||
/**
|
||||
* Return properties of an object
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, braces)
|
||||
*/
|
||||
export declare function printObjectProperties(val: Record<string, unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string;
|
185
node_modules/jest-config/node_modules/pretty-format/build/collections.js
generated
vendored
Normal file
185
node_modules/jest-config/node_modules/pretty-format/build/collections.js
generated
vendored
Normal file
@ -0,0 +1,185 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.printIteratorEntries = printIteratorEntries;
|
||||
exports.printIteratorValues = printIteratorValues;
|
||||
exports.printListItems = printListItems;
|
||||
exports.printObjectProperties = printObjectProperties;
|
||||
|
||||
/**
|
||||
* 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 getKeysOfEnumerableProperties = object => {
|
||||
const keys = Object.keys(object).sort();
|
||||
|
||||
if (Object.getOwnPropertySymbols) {
|
||||
Object.getOwnPropertySymbols(object).forEach(symbol => {
|
||||
if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
|
||||
keys.push(symbol);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return keys;
|
||||
};
|
||||
/**
|
||||
* Return entries (for example, of a map)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, braces)
|
||||
*/
|
||||
|
||||
function printIteratorEntries(
|
||||
iterator,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer, // Too bad, so sad that separator for ECMAScript Map has been ' => '
|
||||
// What a distracting diff if you change a data structure to/from
|
||||
// ECMAScript Object or Immutable.Map/OrderedMap which use the default.
|
||||
separator = ': '
|
||||
) {
|
||||
let result = '';
|
||||
let current = iterator.next();
|
||||
|
||||
if (!current.done) {
|
||||
result += config.spacingOuter;
|
||||
const indentationNext = indentation + config.indent;
|
||||
|
||||
while (!current.done) {
|
||||
const name = printer(
|
||||
current.value[0],
|
||||
config,
|
||||
indentationNext,
|
||||
depth,
|
||||
refs
|
||||
);
|
||||
const value = printer(
|
||||
current.value[1],
|
||||
config,
|
||||
indentationNext,
|
||||
depth,
|
||||
refs
|
||||
);
|
||||
result += indentationNext + name + separator + value;
|
||||
current = iterator.next();
|
||||
|
||||
if (!current.done) {
|
||||
result += ',' + config.spacingInner;
|
||||
} else if (!config.min) {
|
||||
result += ',';
|
||||
}
|
||||
}
|
||||
|
||||
result += config.spacingOuter + indentation;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Return values (for example, of a set)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (braces or brackets)
|
||||
*/
|
||||
|
||||
function printIteratorValues(
|
||||
iterator,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) {
|
||||
let result = '';
|
||||
let current = iterator.next();
|
||||
|
||||
if (!current.done) {
|
||||
result += config.spacingOuter;
|
||||
const indentationNext = indentation + config.indent;
|
||||
|
||||
while (!current.done) {
|
||||
result +=
|
||||
indentationNext +
|
||||
printer(current.value, config, indentationNext, depth, refs);
|
||||
current = iterator.next();
|
||||
|
||||
if (!current.done) {
|
||||
result += ',' + config.spacingInner;
|
||||
} else if (!config.min) {
|
||||
result += ',';
|
||||
}
|
||||
}
|
||||
|
||||
result += config.spacingOuter + indentation;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Return items (for example, of an array)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, brackets)
|
||||
**/
|
||||
|
||||
function printListItems(list, config, indentation, depth, refs, printer) {
|
||||
let result = '';
|
||||
|
||||
if (list.length) {
|
||||
result += config.spacingOuter;
|
||||
const indentationNext = indentation + config.indent;
|
||||
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
result +=
|
||||
indentationNext +
|
||||
printer(list[i], config, indentationNext, depth, refs);
|
||||
|
||||
if (i < list.length - 1) {
|
||||
result += ',' + config.spacingInner;
|
||||
} else if (!config.min) {
|
||||
result += ',';
|
||||
}
|
||||
}
|
||||
|
||||
result += config.spacingOuter + indentation;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Return properties of an object
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, braces)
|
||||
*/
|
||||
|
||||
function printObjectProperties(val, config, indentation, depth, refs, printer) {
|
||||
let result = '';
|
||||
const keys = getKeysOfEnumerableProperties(val);
|
||||
|
||||
if (keys.length) {
|
||||
result += config.spacingOuter;
|
||||
const indentationNext = indentation + config.indent;
|
||||
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
const name = printer(key, config, indentationNext, depth, refs);
|
||||
const value = printer(val[key], config, indentationNext, depth, refs);
|
||||
result += indentationNext + name + ': ' + value;
|
||||
|
||||
if (i < keys.length - 1) {
|
||||
result += ',' + config.spacingInner;
|
||||
} else if (!config.min) {
|
||||
result += ',';
|
||||
}
|
||||
}
|
||||
|
||||
result += config.spacingOuter + indentation;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
37
node_modules/jest-config/node_modules/pretty-format/build/index.d.ts
generated
vendored
Normal file
37
node_modules/jest-config/node_modules/pretty-format/build/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 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 type * as PrettyFormat from './types';
|
||||
/**
|
||||
* Returns a presentation string of your `val` object
|
||||
* @param val any potential JavaScript object
|
||||
* @param options Custom settings
|
||||
*/
|
||||
declare function prettyFormat(val: unknown, options?: PrettyFormat.OptionsReceived): string;
|
||||
declare namespace prettyFormat {
|
||||
var plugins: {
|
||||
AsymmetricMatcher: PrettyFormat.NewPlugin;
|
||||
ConvertAnsi: PrettyFormat.NewPlugin;
|
||||
DOMCollection: PrettyFormat.NewPlugin;
|
||||
DOMElement: PrettyFormat.NewPlugin;
|
||||
Immutable: PrettyFormat.NewPlugin;
|
||||
ReactElement: PrettyFormat.NewPlugin;
|
||||
ReactTestComponent: PrettyFormat.NewPlugin;
|
||||
};
|
||||
}
|
||||
declare namespace prettyFormat {
|
||||
type Colors = PrettyFormat.Colors;
|
||||
type Config = PrettyFormat.Config;
|
||||
type Options = PrettyFormat.Options;
|
||||
type OptionsReceived = PrettyFormat.OptionsReceived;
|
||||
type OldPlugin = PrettyFormat.OldPlugin;
|
||||
type NewPlugin = PrettyFormat.NewPlugin;
|
||||
type Plugin = PrettyFormat.Plugin;
|
||||
type Plugins = PrettyFormat.Plugins;
|
||||
type Refs = PrettyFormat.Refs;
|
||||
type Theme = PrettyFormat.Theme;
|
||||
}
|
||||
export = prettyFormat;
|
559
node_modules/jest-config/node_modules/pretty-format/build/index.js
generated
vendored
Normal file
559
node_modules/jest-config/node_modules/pretty-format/build/index.js
generated
vendored
Normal file
@ -0,0 +1,559 @@
|
||||
'use strict';
|
||||
|
||||
var _ansiStyles = _interopRequireDefault(require('ansi-styles'));
|
||||
|
||||
var _collections = require('./collections');
|
||||
|
||||
var _AsymmetricMatcher = _interopRequireDefault(
|
||||
require('./plugins/AsymmetricMatcher')
|
||||
);
|
||||
|
||||
var _ConvertAnsi = _interopRequireDefault(require('./plugins/ConvertAnsi'));
|
||||
|
||||
var _DOMCollection = _interopRequireDefault(require('./plugins/DOMCollection'));
|
||||
|
||||
var _DOMElement = _interopRequireDefault(require('./plugins/DOMElement'));
|
||||
|
||||
var _Immutable = _interopRequireDefault(require('./plugins/Immutable'));
|
||||
|
||||
var _ReactElement = _interopRequireDefault(require('./plugins/ReactElement'));
|
||||
|
||||
var _ReactTestComponent = _interopRequireDefault(
|
||||
require('./plugins/ReactTestComponent')
|
||||
);
|
||||
|
||||
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 toString = Object.prototype.toString;
|
||||
const toISOString = Date.prototype.toISOString;
|
||||
const errorToString = Error.prototype.toString;
|
||||
const regExpToString = RegExp.prototype.toString;
|
||||
/**
|
||||
* Explicitly comparing typeof constructor to function avoids undefined as name
|
||||
* when mock identity-obj-proxy returns the key as the value for any key.
|
||||
*/
|
||||
|
||||
const getConstructorName = val =>
|
||||
(typeof val.constructor === 'function' && val.constructor.name) || 'Object';
|
||||
/* global window */
|
||||
|
||||
/** Is val is equal to global window object? Works even if it does not exist :) */
|
||||
|
||||
const isWindow = val => typeof window !== 'undefined' && val === window;
|
||||
|
||||
const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
|
||||
const NEWLINE_REGEXP = /\n/gi;
|
||||
|
||||
class PrettyFormatPluginError extends Error {
|
||||
constructor(message, stack) {
|
||||
super(message);
|
||||
this.stack = stack;
|
||||
this.name = this.constructor.name;
|
||||
}
|
||||
}
|
||||
|
||||
function isToStringedArrayType(toStringed) {
|
||||
return (
|
||||
toStringed === '[object Array]' ||
|
||||
toStringed === '[object ArrayBuffer]' ||
|
||||
toStringed === '[object DataView]' ||
|
||||
toStringed === '[object Float32Array]' ||
|
||||
toStringed === '[object Float64Array]' ||
|
||||
toStringed === '[object Int8Array]' ||
|
||||
toStringed === '[object Int16Array]' ||
|
||||
toStringed === '[object Int32Array]' ||
|
||||
toStringed === '[object Uint8Array]' ||
|
||||
toStringed === '[object Uint8ClampedArray]' ||
|
||||
toStringed === '[object Uint16Array]' ||
|
||||
toStringed === '[object Uint32Array]'
|
||||
);
|
||||
}
|
||||
|
||||
function printNumber(val) {
|
||||
return Object.is(val, -0) ? '-0' : String(val);
|
||||
}
|
||||
|
||||
function printBigInt(val) {
|
||||
return String(`${val}n`);
|
||||
}
|
||||
|
||||
function printFunction(val, printFunctionName) {
|
||||
if (!printFunctionName) {
|
||||
return '[Function]';
|
||||
}
|
||||
|
||||
return '[Function ' + (val.name || 'anonymous') + ']';
|
||||
}
|
||||
|
||||
function printSymbol(val) {
|
||||
return String(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
|
||||
}
|
||||
|
||||
function printError(val) {
|
||||
return '[' + errorToString.call(val) + ']';
|
||||
}
|
||||
/**
|
||||
* The first port of call for printing an object, handles most of the
|
||||
* data-types in JS.
|
||||
*/
|
||||
|
||||
function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
|
||||
if (val === true || val === false) {
|
||||
return '' + val;
|
||||
}
|
||||
|
||||
if (val === undefined) {
|
||||
return 'undefined';
|
||||
}
|
||||
|
||||
if (val === null) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
const typeOf = typeof val;
|
||||
|
||||
if (typeOf === 'number') {
|
||||
return printNumber(val);
|
||||
}
|
||||
|
||||
if (typeOf === 'bigint') {
|
||||
return printBigInt(val);
|
||||
}
|
||||
|
||||
if (typeOf === 'string') {
|
||||
if (escapeString) {
|
||||
return '"' + val.replace(/"|\\/g, '\\$&') + '"';
|
||||
}
|
||||
|
||||
return '"' + val + '"';
|
||||
}
|
||||
|
||||
if (typeOf === 'function') {
|
||||
return printFunction(val, printFunctionName);
|
||||
}
|
||||
|
||||
if (typeOf === 'symbol') {
|
||||
return printSymbol(val);
|
||||
}
|
||||
|
||||
const toStringed = toString.call(val);
|
||||
|
||||
if (toStringed === '[object WeakMap]') {
|
||||
return 'WeakMap {}';
|
||||
}
|
||||
|
||||
if (toStringed === '[object WeakSet]') {
|
||||
return 'WeakSet {}';
|
||||
}
|
||||
|
||||
if (
|
||||
toStringed === '[object Function]' ||
|
||||
toStringed === '[object GeneratorFunction]'
|
||||
) {
|
||||
return printFunction(val, printFunctionName);
|
||||
}
|
||||
|
||||
if (toStringed === '[object Symbol]') {
|
||||
return printSymbol(val);
|
||||
}
|
||||
|
||||
if (toStringed === '[object Date]') {
|
||||
return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val);
|
||||
}
|
||||
|
||||
if (toStringed === '[object Error]') {
|
||||
return printError(val);
|
||||
}
|
||||
|
||||
if (toStringed === '[object RegExp]') {
|
||||
if (escapeRegex) {
|
||||
// https://github.com/benjamingr/RegExp.escape/blob/master/polyfill.js
|
||||
return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||
}
|
||||
|
||||
return regExpToString.call(val);
|
||||
}
|
||||
|
||||
if (val instanceof Error) {
|
||||
return printError(val);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Handles more complex objects ( such as objects with circular references.
|
||||
* maps and sets etc )
|
||||
*/
|
||||
|
||||
function printComplexValue(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
hasCalledToJSON
|
||||
) {
|
||||
if (refs.indexOf(val) !== -1) {
|
||||
return '[Circular]';
|
||||
}
|
||||
|
||||
refs = refs.slice();
|
||||
refs.push(val);
|
||||
const hitMaxDepth = ++depth > config.maxDepth;
|
||||
const min = config.min;
|
||||
|
||||
if (
|
||||
config.callToJSON &&
|
||||
!hitMaxDepth &&
|
||||
val.toJSON &&
|
||||
typeof val.toJSON === 'function' &&
|
||||
!hasCalledToJSON
|
||||
) {
|
||||
return printer(val.toJSON(), config, indentation, depth, refs, true);
|
||||
}
|
||||
|
||||
const toStringed = toString.call(val);
|
||||
|
||||
if (toStringed === '[object Arguments]') {
|
||||
return hitMaxDepth
|
||||
? '[Arguments]'
|
||||
: (min ? '' : 'Arguments ') +
|
||||
'[' +
|
||||
(0, _collections.printListItems)(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
']';
|
||||
}
|
||||
|
||||
if (isToStringedArrayType(toStringed)) {
|
||||
return hitMaxDepth
|
||||
? '[' + val.constructor.name + ']'
|
||||
: (min ? '' : val.constructor.name + ' ') +
|
||||
'[' +
|
||||
(0, _collections.printListItems)(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
']';
|
||||
}
|
||||
|
||||
if (toStringed === '[object Map]') {
|
||||
return hitMaxDepth
|
||||
? '[Map]'
|
||||
: 'Map {' +
|
||||
(0, _collections.printIteratorEntries)(
|
||||
val.entries(),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer,
|
||||
' => '
|
||||
) +
|
||||
'}';
|
||||
}
|
||||
|
||||
if (toStringed === '[object Set]') {
|
||||
return hitMaxDepth
|
||||
? '[Set]'
|
||||
: 'Set {' +
|
||||
(0, _collections.printIteratorValues)(
|
||||
val.values(),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
'}';
|
||||
} // Avoid failure to serialize global window object in jsdom test environment.
|
||||
// For example, not even relevant if window is prop of React element.
|
||||
|
||||
return hitMaxDepth || isWindow(val)
|
||||
? '[' + getConstructorName(val) + ']'
|
||||
: (min ? '' : getConstructorName(val) + ' ') +
|
||||
'{' +
|
||||
(0, _collections.printObjectProperties)(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
'}';
|
||||
}
|
||||
|
||||
function isNewPlugin(plugin) {
|
||||
return plugin.serialize != null;
|
||||
}
|
||||
|
||||
function printPlugin(plugin, val, config, indentation, depth, refs) {
|
||||
let printed;
|
||||
|
||||
try {
|
||||
printed = isNewPlugin(plugin)
|
||||
? plugin.serialize(val, config, indentation, depth, refs, printer)
|
||||
: plugin.print(
|
||||
val,
|
||||
valChild => printer(valChild, config, indentation, depth, refs),
|
||||
str => {
|
||||
const indentationNext = indentation + config.indent;
|
||||
return (
|
||||
indentationNext +
|
||||
str.replace(NEWLINE_REGEXP, '\n' + indentationNext)
|
||||
);
|
||||
},
|
||||
{
|
||||
edgeSpacing: config.spacingOuter,
|
||||
min: config.min,
|
||||
spacing: config.spacingInner
|
||||
},
|
||||
config.colors
|
||||
);
|
||||
} catch (error) {
|
||||
throw new PrettyFormatPluginError(error.message, error.stack);
|
||||
}
|
||||
|
||||
if (typeof printed !== 'string') {
|
||||
throw new Error(
|
||||
`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`
|
||||
);
|
||||
}
|
||||
|
||||
return printed;
|
||||
}
|
||||
|
||||
function findPlugin(plugins, val) {
|
||||
for (let p = 0; p < plugins.length; p++) {
|
||||
try {
|
||||
if (plugins[p].test(val)) {
|
||||
return plugins[p];
|
||||
}
|
||||
} catch (error) {
|
||||
throw new PrettyFormatPluginError(error.message, error.stack);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
|
||||
const plugin = findPlugin(config.plugins, val);
|
||||
|
||||
if (plugin !== null) {
|
||||
return printPlugin(plugin, val, config, indentation, depth, refs);
|
||||
}
|
||||
|
||||
const basicResult = printBasicValue(
|
||||
val,
|
||||
config.printFunctionName,
|
||||
config.escapeRegex,
|
||||
config.escapeString
|
||||
);
|
||||
|
||||
if (basicResult !== null) {
|
||||
return basicResult;
|
||||
}
|
||||
|
||||
return printComplexValue(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
hasCalledToJSON
|
||||
);
|
||||
}
|
||||
|
||||
const DEFAULT_THEME = {
|
||||
comment: 'gray',
|
||||
content: 'reset',
|
||||
prop: 'yellow',
|
||||
tag: 'cyan',
|
||||
value: 'green'
|
||||
};
|
||||
const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
|
||||
const DEFAULT_OPTIONS = {
|
||||
callToJSON: true,
|
||||
escapeRegex: false,
|
||||
escapeString: true,
|
||||
highlight: false,
|
||||
indent: 2,
|
||||
maxDepth: Infinity,
|
||||
min: false,
|
||||
plugins: [],
|
||||
printFunctionName: true,
|
||||
theme: DEFAULT_THEME
|
||||
};
|
||||
|
||||
function validateOptions(options) {
|
||||
Object.keys(options).forEach(key => {
|
||||
if (!DEFAULT_OPTIONS.hasOwnProperty(key)) {
|
||||
throw new Error(`pretty-format: Unknown option "${key}".`);
|
||||
}
|
||||
});
|
||||
|
||||
if (options.min && options.indent !== undefined && options.indent !== 0) {
|
||||
throw new Error(
|
||||
'pretty-format: Options "min" and "indent" cannot be used together.'
|
||||
);
|
||||
}
|
||||
|
||||
if (options.theme !== undefined) {
|
||||
if (options.theme === null) {
|
||||
throw new Error(`pretty-format: Option "theme" must not be null.`);
|
||||
}
|
||||
|
||||
if (typeof options.theme !== 'object') {
|
||||
throw new Error(
|
||||
`pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getColorsHighlight = options =>
|
||||
DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
||||
const value =
|
||||
options.theme && options.theme[key] !== undefined
|
||||
? options.theme[key]
|
||||
: DEFAULT_THEME[key];
|
||||
const color = value && _ansiStyles.default[value];
|
||||
|
||||
if (
|
||||
color &&
|
||||
typeof color.close === 'string' &&
|
||||
typeof color.open === 'string'
|
||||
) {
|
||||
colors[key] = color;
|
||||
} else {
|
||||
throw new Error(
|
||||
`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`
|
||||
);
|
||||
}
|
||||
|
||||
return colors;
|
||||
}, Object.create(null));
|
||||
|
||||
const getColorsEmpty = () =>
|
||||
DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
||||
colors[key] = {
|
||||
close: '',
|
||||
open: ''
|
||||
};
|
||||
return colors;
|
||||
}, Object.create(null));
|
||||
|
||||
const getPrintFunctionName = options =>
|
||||
options && options.printFunctionName !== undefined
|
||||
? options.printFunctionName
|
||||
: DEFAULT_OPTIONS.printFunctionName;
|
||||
|
||||
const getEscapeRegex = options =>
|
||||
options && options.escapeRegex !== undefined
|
||||
? options.escapeRegex
|
||||
: DEFAULT_OPTIONS.escapeRegex;
|
||||
|
||||
const getEscapeString = options =>
|
||||
options && options.escapeString !== undefined
|
||||
? options.escapeString
|
||||
: DEFAULT_OPTIONS.escapeString;
|
||||
|
||||
const getConfig = options => ({
|
||||
callToJSON:
|
||||
options && options.callToJSON !== undefined
|
||||
? options.callToJSON
|
||||
: DEFAULT_OPTIONS.callToJSON,
|
||||
colors:
|
||||
options && options.highlight
|
||||
? getColorsHighlight(options)
|
||||
: getColorsEmpty(),
|
||||
escapeRegex: getEscapeRegex(options),
|
||||
escapeString: getEscapeString(options),
|
||||
indent:
|
||||
options && options.min
|
||||
? ''
|
||||
: createIndent(
|
||||
options && options.indent !== undefined
|
||||
? options.indent
|
||||
: DEFAULT_OPTIONS.indent
|
||||
),
|
||||
maxDepth:
|
||||
options && options.maxDepth !== undefined
|
||||
? options.maxDepth
|
||||
: DEFAULT_OPTIONS.maxDepth,
|
||||
min: options && options.min !== undefined ? options.min : DEFAULT_OPTIONS.min,
|
||||
plugins:
|
||||
options && options.plugins !== undefined
|
||||
? options.plugins
|
||||
: DEFAULT_OPTIONS.plugins,
|
||||
printFunctionName: getPrintFunctionName(options),
|
||||
spacingInner: options && options.min ? ' ' : '\n',
|
||||
spacingOuter: options && options.min ? '' : '\n'
|
||||
});
|
||||
|
||||
function createIndent(indent) {
|
||||
return new Array(indent + 1).join(' ');
|
||||
}
|
||||
/**
|
||||
* Returns a presentation string of your `val` object
|
||||
* @param val any potential JavaScript object
|
||||
* @param options Custom settings
|
||||
*/
|
||||
|
||||
function prettyFormat(val, options) {
|
||||
if (options) {
|
||||
validateOptions(options);
|
||||
|
||||
if (options.plugins) {
|
||||
const plugin = findPlugin(options.plugins, val);
|
||||
|
||||
if (plugin !== null) {
|
||||
return printPlugin(plugin, val, getConfig(options), '', 0, []);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const basicResult = printBasicValue(
|
||||
val,
|
||||
getPrintFunctionName(options),
|
||||
getEscapeRegex(options),
|
||||
getEscapeString(options)
|
||||
);
|
||||
|
||||
if (basicResult !== null) {
|
||||
return basicResult;
|
||||
}
|
||||
|
||||
return printComplexValue(val, getConfig(options), '', 0, []);
|
||||
}
|
||||
|
||||
prettyFormat.plugins = {
|
||||
AsymmetricMatcher: _AsymmetricMatcher.default,
|
||||
ConvertAnsi: _ConvertAnsi.default,
|
||||
DOMCollection: _DOMCollection.default,
|
||||
DOMElement: _DOMElement.default,
|
||||
Immutable: _Immutable.default,
|
||||
ReactElement: _ReactElement.default,
|
||||
ReactTestComponent: _ReactTestComponent.default
|
||||
}; // eslint-disable-next-line no-redeclare
|
||||
|
||||
module.exports = prettyFormat;
|
11
node_modules/jest-config/node_modules/pretty-format/build/plugins/AsymmetricMatcher.d.ts
generated
vendored
Normal file
11
node_modules/jest-config/node_modules/pretty-format/build/plugins/AsymmetricMatcher.d.ts
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* 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 type { NewPlugin } from '../types';
|
||||
export declare const serialize: NewPlugin['serialize'];
|
||||
export declare const test: NewPlugin['test'];
|
||||
declare const plugin: NewPlugin;
|
||||
export default plugin;
|
103
node_modules/jest-config/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js
generated
vendored
Normal file
103
node_modules/jest-config/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js
generated
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.test = exports.serialize = void 0;
|
||||
|
||||
var _collections = require('../collections');
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
const asymmetricMatcher =
|
||||
typeof Symbol === 'function' && Symbol.for
|
||||
? Symbol.for('jest.asymmetricMatcher')
|
||||
: 0x1357a5;
|
||||
const SPACE = ' ';
|
||||
|
||||
const serialize = (val, config, indentation, depth, refs, printer) => {
|
||||
const stringedValue = val.toString();
|
||||
|
||||
if (
|
||||
stringedValue === 'ArrayContaining' ||
|
||||
stringedValue === 'ArrayNotContaining'
|
||||
) {
|
||||
if (++depth > config.maxDepth) {
|
||||
return '[' + stringedValue + ']';
|
||||
}
|
||||
|
||||
return (
|
||||
stringedValue +
|
||||
SPACE +
|
||||
'[' +
|
||||
(0, _collections.printListItems)(
|
||||
val.sample,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
']'
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
stringedValue === 'ObjectContaining' ||
|
||||
stringedValue === 'ObjectNotContaining'
|
||||
) {
|
||||
if (++depth > config.maxDepth) {
|
||||
return '[' + stringedValue + ']';
|
||||
}
|
||||
|
||||
return (
|
||||
stringedValue +
|
||||
SPACE +
|
||||
'{' +
|
||||
(0, _collections.printObjectProperties)(
|
||||
val.sample,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
'}'
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
stringedValue === 'StringMatching' ||
|
||||
stringedValue === 'StringNotMatching'
|
||||
) {
|
||||
return (
|
||||
stringedValue +
|
||||
SPACE +
|
||||
printer(val.sample, config, indentation, depth, refs)
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
stringedValue === 'StringContaining' ||
|
||||
stringedValue === 'StringNotContaining'
|
||||
) {
|
||||
return (
|
||||
stringedValue +
|
||||
SPACE +
|
||||
printer(val.sample, config, indentation, depth, refs)
|
||||
);
|
||||
}
|
||||
|
||||
return val.toAsymmetricMatcher();
|
||||
};
|
||||
|
||||
exports.serialize = serialize;
|
||||
|
||||
const test = val => val && val.$$typeof === asymmetricMatcher;
|
||||
|
||||
exports.test = test;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user