From 5d309ff52cd399a6b71968a6b9a70c8ac0b98981 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Sat, 5 Mar 2022 19:02:27 +0200 Subject: Added node_modules for the updating to work properly. --- node_modules/jest-util/LICENSE | 21 +++ node_modules/jest-util/build/ErrorWithStack.d.ts | 9 + node_modules/jest-util/build/ErrorWithStack.js | 33 ++++ node_modules/jest-util/build/clearLine.d.ts | 8 + node_modules/jest-util/build/clearLine.js | 18 ++ .../jest-util/build/convertDescriptorToString.d.ts | 7 + .../jest-util/build/convertDescriptorToString.js | 41 ++++ node_modules/jest-util/build/createDirectory.d.ts | 8 + node_modules/jest-util/build/createDirectory.js | 76 ++++++++ .../jest-util/build/createProcessObject.d.ts | 8 + .../jest-util/build/createProcessObject.js | 126 +++++++++++++ node_modules/jest-util/build/deepCyclicCopy.d.ts | 11 ++ node_modules/jest-util/build/deepCyclicCopy.js | 84 +++++++++ node_modules/jest-util/build/formatTime.d.ts | 7 + node_modules/jest-util/build/formatTime.js | 24 +++ node_modules/jest-util/build/globsToMatcher.d.ts | 27 +++ node_modules/jest-util/build/globsToMatcher.js | 108 +++++++++++ node_modules/jest-util/build/index.d.ts | 25 +++ node_modules/jest-util/build/index.js | 209 +++++++++++++++++++++ .../jest-util/build/installCommonGlobals.d.ts | 8 + .../jest-util/build/installCommonGlobals.js | 123 ++++++++++++ .../jest-util/build/interopRequireDefault.d.ts | 7 + .../jest-util/build/interopRequireDefault.js | 22 +++ node_modules/jest-util/build/isInteractive.d.ts | 8 + node_modules/jest-util/build/isInteractive.js | 27 +++ node_modules/jest-util/build/isPromise.d.ts | 8 + node_modules/jest-util/build/isPromise.js | 20 ++ node_modules/jest-util/build/pluralize.d.ts | 7 + node_modules/jest-util/build/pluralize.js | 16 ++ node_modules/jest-util/build/preRunMessage.d.ts | 9 + node_modules/jest-util/build/preRunMessage.js | 48 +++++ .../jest-util/build/replacePathSepForGlob.d.ts | 8 + .../jest-util/build/replacePathSepForGlob.js | 16 ++ .../jest-util/build/requireOrImportModule.d.ts | 8 + .../jest-util/build/requireOrImportModule.js | 91 +++++++++ node_modules/jest-util/build/setGlobal.d.ts | 7 + node_modules/jest-util/build/setGlobal.js | 17 ++ node_modules/jest-util/build/specialChars.d.ts | 14 ++ node_modules/jest-util/build/specialChars.js | 25 +++ .../jest-util/build/testPathPatternToRegExp.d.ts | 8 + .../jest-util/build/testPathPatternToRegExp.js | 19 ++ node_modules/jest-util/build/tryRealpath.d.ts | 8 + node_modules/jest-util/build/tryRealpath.js | 34 ++++ node_modules/jest-util/package.json | 39 ++++ 44 files changed, 1447 insertions(+) create mode 100644 node_modules/jest-util/LICENSE create mode 100644 node_modules/jest-util/build/ErrorWithStack.d.ts create mode 100644 node_modules/jest-util/build/ErrorWithStack.js create mode 100644 node_modules/jest-util/build/clearLine.d.ts create mode 100644 node_modules/jest-util/build/clearLine.js create mode 100644 node_modules/jest-util/build/convertDescriptorToString.d.ts create mode 100644 node_modules/jest-util/build/convertDescriptorToString.js create mode 100644 node_modules/jest-util/build/createDirectory.d.ts create mode 100644 node_modules/jest-util/build/createDirectory.js create mode 100644 node_modules/jest-util/build/createProcessObject.d.ts create mode 100644 node_modules/jest-util/build/createProcessObject.js create mode 100644 node_modules/jest-util/build/deepCyclicCopy.d.ts create mode 100644 node_modules/jest-util/build/deepCyclicCopy.js create mode 100644 node_modules/jest-util/build/formatTime.d.ts create mode 100644 node_modules/jest-util/build/formatTime.js create mode 100644 node_modules/jest-util/build/globsToMatcher.d.ts create mode 100644 node_modules/jest-util/build/globsToMatcher.js create mode 100644 node_modules/jest-util/build/index.d.ts create mode 100644 node_modules/jest-util/build/index.js create mode 100644 node_modules/jest-util/build/installCommonGlobals.d.ts create mode 100644 node_modules/jest-util/build/installCommonGlobals.js create mode 100644 node_modules/jest-util/build/interopRequireDefault.d.ts create mode 100644 node_modules/jest-util/build/interopRequireDefault.js create mode 100644 node_modules/jest-util/build/isInteractive.d.ts create mode 100644 node_modules/jest-util/build/isInteractive.js create mode 100644 node_modules/jest-util/build/isPromise.d.ts create mode 100644 node_modules/jest-util/build/isPromise.js create mode 100644 node_modules/jest-util/build/pluralize.d.ts create mode 100644 node_modules/jest-util/build/pluralize.js create mode 100644 node_modules/jest-util/build/preRunMessage.d.ts create mode 100644 node_modules/jest-util/build/preRunMessage.js create mode 100644 node_modules/jest-util/build/replacePathSepForGlob.d.ts create mode 100644 node_modules/jest-util/build/replacePathSepForGlob.js create mode 100644 node_modules/jest-util/build/requireOrImportModule.d.ts create mode 100644 node_modules/jest-util/build/requireOrImportModule.js create mode 100644 node_modules/jest-util/build/setGlobal.d.ts create mode 100644 node_modules/jest-util/build/setGlobal.js create mode 100644 node_modules/jest-util/build/specialChars.d.ts create mode 100644 node_modules/jest-util/build/specialChars.js create mode 100644 node_modules/jest-util/build/testPathPatternToRegExp.d.ts create mode 100644 node_modules/jest-util/build/testPathPatternToRegExp.js create mode 100644 node_modules/jest-util/build/tryRealpath.d.ts create mode 100644 node_modules/jest-util/build/tryRealpath.js create mode 100644 node_modules/jest-util/package.json (limited to 'node_modules/jest-util') diff --git a/node_modules/jest-util/LICENSE b/node_modules/jest-util/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/node_modules/jest-util/LICENSE @@ -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. diff --git a/node_modules/jest-util/build/ErrorWithStack.d.ts b/node_modules/jest-util/build/ErrorWithStack.d.ts new file mode 100644 index 0000000..30a8dd3 --- /dev/null +++ b/node_modules/jest-util/build/ErrorWithStack.d.ts @@ -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. + */ +export default class ErrorWithStack extends Error { + constructor(message: string | undefined, callsite: (...args: Array) => unknown, stackLimit?: number); +} diff --git a/node_modules/jest-util/build/ErrorWithStack.js b/node_modules/jest-util/build/ErrorWithStack.js new file mode 100644 index 0000000..87f6deb --- /dev/null +++ b/node_modules/jest-util/build/ErrorWithStack.js @@ -0,0 +1,33 @@ +'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. + */ +class ErrorWithStack extends Error { + constructor(message, callsite, stackLimit) { + // Ensure we have a large stack length so we get full details. + const originalStackLimit = Error.stackTraceLimit; + + if (stackLimit) { + Error.stackTraceLimit = Math.max(stackLimit, originalStackLimit || 10); + } + + super(message); + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, callsite); + } + + Error.stackTraceLimit = originalStackLimit; + } +} + +exports.default = ErrorWithStack; diff --git a/node_modules/jest-util/build/clearLine.d.ts b/node_modules/jest-util/build/clearLine.d.ts new file mode 100644 index 0000000..cf56b98 --- /dev/null +++ b/node_modules/jest-util/build/clearLine.d.ts @@ -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. + */ +/// +export default function clearLine(stream: NodeJS.WriteStream): void; diff --git a/node_modules/jest-util/build/clearLine.js b/node_modules/jest-util/build/clearLine.js new file mode 100644 index 0000000..36c258a --- /dev/null +++ b/node_modules/jest-util/build/clearLine.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = clearLine; + +/** + * 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 clearLine(stream) { + if (stream.isTTY) { + stream.write('\x1b[999D\x1b[K'); + } +} diff --git a/node_modules/jest-util/build/convertDescriptorToString.d.ts b/node_modules/jest-util/build/convertDescriptorToString.d.ts new file mode 100644 index 0000000..4d40666 --- /dev/null +++ b/node_modules/jest-util/build/convertDescriptorToString.d.ts @@ -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 convertDescriptorToString(descriptor: T): T | string; diff --git a/node_modules/jest-util/build/convertDescriptorToString.js b/node_modules/jest-util/build/convertDescriptorToString.js new file mode 100644 index 0000000..4b776af --- /dev/null +++ b/node_modules/jest-util/build/convertDescriptorToString.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = convertDescriptorToString; + +/** + * 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. + */ + +/* eslint-disable local/ban-types-eventually */ +// See: https://github.com/facebook/jest/pull/5154 +function convertDescriptorToString(descriptor) { + if ( + typeof descriptor === 'string' || + typeof descriptor === 'number' || + descriptor === undefined + ) { + return descriptor; + } + + if (typeof descriptor !== 'function') { + throw new Error('describe expects a class, function, number, or string.'); + } + + if (descriptor.name !== undefined) { + return descriptor.name; + } // Fallback for old browsers, pardon Flow + + const stringified = descriptor.toString(); + const typeDescriptorMatch = stringified.match(/class|function/); + const indexOfNameSpace = // @ts-expect-error: typeDescriptorMatch exists + typeDescriptorMatch.index + typeDescriptorMatch[0].length; + const indexOfNameAfterSpace = stringified.search(/\(|\{/); + const name = stringified.substring(indexOfNameSpace, indexOfNameAfterSpace); + return name.trim(); +} diff --git a/node_modules/jest-util/build/createDirectory.d.ts b/node_modules/jest-util/build/createDirectory.d.ts new file mode 100644 index 0000000..7e3e016 --- /dev/null +++ b/node_modules/jest-util/build/createDirectory.d.ts @@ -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 createDirectory(path: Config.Path): void; diff --git a/node_modules/jest-util/build/createDirectory.js b/node_modules/jest-util/build/createDirectory.js new file mode 100644 index 0000000..d2a28b7 --- /dev/null +++ b/node_modules/jest-util/build/createDirectory.js @@ -0,0 +1,76 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = createDirectory; + +function fs() { + const data = _interopRequireWildcard(require('graceful-fs')); + + fs = function () { + return data; + }; + + return data; +} + +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== 'function') return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function (nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} + +function _interopRequireWildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (key !== 'default' && 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. + */ +function createDirectory(path) { + try { + fs().mkdirSync(path, { + recursive: true + }); + } catch (e) { + if (e.code !== 'EEXIST') { + throw e; + } + } +} diff --git a/node_modules/jest-util/build/createProcessObject.d.ts b/node_modules/jest-util/build/createProcessObject.d.ts new file mode 100644 index 0000000..29e0db5 --- /dev/null +++ b/node_modules/jest-util/build/createProcessObject.d.ts @@ -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. + */ +/// +export default function createProcessObject(): NodeJS.Process; diff --git a/node_modules/jest-util/build/createProcessObject.js b/node_modules/jest-util/build/createProcessObject.js new file mode 100644 index 0000000..afc4894 --- /dev/null +++ b/node_modules/jest-util/build/createProcessObject.js @@ -0,0 +1,126 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = createProcessObject; + +var _deepCyclicCopy = _interopRequireDefault(require('./deepCyclicCopy')); + +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 BLACKLIST = new Set(['env', 'mainModule', '_events']); +const isWin32 = process.platform === 'win32'; +const proto = Object.getPrototypeOf(process.env); // The "process.env" object has a bunch of particularities: first, it does not +// directly extend from Object; second, it converts any assigned value to a +// string; and third, it is case-insensitive in Windows. We use a proxy here to +// mimic it (see https://nodejs.org/api/process.html#process_process_env). + +function createProcessEnv() { + const real = Object.create(proto); + const lookup = {}; + + function deletePropertyWin32(_target, key) { + for (const name in real) { + if (real.hasOwnProperty(name)) { + if (typeof key === 'string') { + if (name.toLowerCase() === key.toLowerCase()) { + delete real[name]; + delete lookup[name.toLowerCase()]; + } + } else { + if (key === name) { + delete real[name]; + delete lookup[name]; + } + } + } + } + + return true; + } + + function deleteProperty(_target, key) { + delete real[key]; + delete lookup[key]; + return true; + } + + function getProperty(_target, key) { + return real[key]; + } + + function getPropertyWin32(_target, key) { + if (typeof key === 'string') { + return lookup[key in proto ? key : key.toLowerCase()]; + } else { + return real[key]; + } + } + + const proxy = new Proxy(real, { + deleteProperty: isWin32 ? deletePropertyWin32 : deleteProperty, + get: isWin32 ? getPropertyWin32 : getProperty, + + set(_target, key, value) { + const strValue = '' + value; + + if (typeof key === 'string') { + lookup[key.toLowerCase()] = strValue; + } + + real[key] = strValue; + return true; + } + }); + return Object.assign(proxy, process.env); +} + +function createProcessObject() { + const process = require('process'); + + const newProcess = (0, _deepCyclicCopy.default)(process, { + blacklist: BLACKLIST, + keepPrototype: true + }); + + try { + // This fails on Node 12, but it's already set to 'process' + newProcess[Symbol.toStringTag] = 'process'; + } catch (e) { + // Make sure it's actually set instead of potentially ignoring errors + if (newProcess[Symbol.toStringTag] !== 'process') { + e.message = + 'Unable to set toStringTag on process. Please open up an issue at https://github.com/facebook/jest\n\n' + + e.message; + throw e; + } + } // Sequentially execute all constructors over the object. + + let proto = process; + + while ((proto = Object.getPrototypeOf(proto))) { + if (typeof proto.constructor === 'function') { + proto.constructor.call(newProcess); + } + } + + newProcess.env = createProcessEnv(); + + newProcess.send = () => true; + + Object.defineProperty(newProcess, 'domain', { + get() { + return process.domain; + } + }); + return newProcess; +} diff --git a/node_modules/jest-util/build/deepCyclicCopy.d.ts b/node_modules/jest-util/build/deepCyclicCopy.d.ts new file mode 100644 index 0000000..f8bd716 --- /dev/null +++ b/node_modules/jest-util/build/deepCyclicCopy.d.ts @@ -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. + */ +export declare type DeepCyclicCopyOptions = { + blacklist?: Set; + keepPrototype?: boolean; +}; +export default function deepCyclicCopy(value: T, options?: DeepCyclicCopyOptions, cycles?: WeakMap): T; diff --git a/node_modules/jest-util/build/deepCyclicCopy.js b/node_modules/jest-util/build/deepCyclicCopy.js new file mode 100644 index 0000000..e76e34b --- /dev/null +++ b/node_modules/jest-util/build/deepCyclicCopy.js @@ -0,0 +1,84 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = deepCyclicCopy; + +/** + * 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 EMPTY = new Set(); + +function deepCyclicCopy( + value, + options = { + blacklist: EMPTY, + keepPrototype: false + }, + cycles = new WeakMap() +) { + if (typeof value !== 'object' || value === null) { + return value; + } else if (cycles.has(value)) { + return cycles.get(value); + } else if (Array.isArray(value)) { + return deepCyclicCopyArray(value, options, cycles); + } else { + return deepCyclicCopyObject(value, options, cycles); + } +} + +function deepCyclicCopyObject(object, options, cycles) { + const newObject = options.keepPrototype + ? Object.create(Object.getPrototypeOf(object)) + : {}; + const descriptors = Object.getOwnPropertyDescriptors(object); + cycles.set(object, newObject); + Object.keys(descriptors).forEach(key => { + if (options.blacklist && options.blacklist.has(key)) { + delete descriptors[key]; + return; + } + + const descriptor = descriptors[key]; + + if (typeof descriptor.value !== 'undefined') { + descriptor.value = deepCyclicCopy( + descriptor.value, + { + blacklist: EMPTY, + keepPrototype: options.keepPrototype + }, + cycles + ); + } + + descriptor.configurable = true; + }); + return Object.defineProperties(newObject, descriptors); +} + +function deepCyclicCopyArray(array, options, cycles) { + const newArray = options.keepPrototype + ? new (Object.getPrototypeOf(array).constructor)(array.length) + : []; + const length = array.length; + cycles.set(array, newArray); + + for (let i = 0; i < length; i++) { + newArray[i] = deepCyclicCopy( + array[i], + { + blacklist: EMPTY, + keepPrototype: options.keepPrototype + }, + cycles + ); + } + + return newArray; +} diff --git a/node_modules/jest-util/build/formatTime.d.ts b/node_modules/jest-util/build/formatTime.d.ts new file mode 100644 index 0000000..fc4cd8d --- /dev/null +++ b/node_modules/jest-util/build/formatTime.d.ts @@ -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 formatTime(time: number, prefixPower?: number, padLeftLength?: number): string; diff --git a/node_modules/jest-util/build/formatTime.js b/node_modules/jest-util/build/formatTime.js new file mode 100644 index 0000000..fad4b8c --- /dev/null +++ b/node_modules/jest-util/build/formatTime.js @@ -0,0 +1,24 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = formatTime; + +/** + * 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 formatTime(time, prefixPower = -3, padLeftLength = 0) { + const prefixes = ['n', 'μ', 'm', '']; + const prefixIndex = Math.max( + 0, + Math.min( + Math.trunc(prefixPower / 3) + prefixes.length - 1, + prefixes.length - 1 + ) + ); + return `${String(time).padStart(padLeftLength)} ${prefixes[prefixIndex]}s`; +} diff --git a/node_modules/jest-util/build/globsToMatcher.d.ts b/node_modules/jest-util/build/globsToMatcher.d.ts new file mode 100644 index 0000000..021ff9e --- /dev/null +++ b/node_modules/jest-util/build/globsToMatcher.d.ts @@ -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'; +declare type Matcher = (str: Config.Path) => boolean; +/** + * Converts a list of globs into a function that matches a path against the + * globs. + * + * Every time picomatch is called, it will parse the glob strings and turn + * them into regexp instances. Instead of calling picomatch repeatedly with + * the same globs, we can use this function which will build the picomatch + * matchers ahead of time and then have an optimized path for determining + * whether an individual path matches. + * + * This function is intended to match the behavior of `micromatch()`. + * + * @example + * const isMatch = globsToMatcher(['*.js', '!*.test.js']); + * isMatch('pizza.js'); // true + * isMatch('pizza.test.js'); // false + */ +export default function globsToMatcher(globs: Array): Matcher; +export {}; diff --git a/node_modules/jest-util/build/globsToMatcher.js b/node_modules/jest-util/build/globsToMatcher.js new file mode 100644 index 0000000..b359fd5 --- /dev/null +++ b/node_modules/jest-util/build/globsToMatcher.js @@ -0,0 +1,108 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = globsToMatcher; + +function _picomatch() { + const data = _interopRequireDefault(require('picomatch')); + + _picomatch = function () { + return data; + }; + + return data; +} + +var _replacePathSepForGlob = _interopRequireDefault( + require('./replacePathSepForGlob') +); + +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 globsToMatchersMap = new Map(); +const picomatchOptions = { + dot: true +}; +/** + * Converts a list of globs into a function that matches a path against the + * globs. + * + * Every time picomatch is called, it will parse the glob strings and turn + * them into regexp instances. Instead of calling picomatch repeatedly with + * the same globs, we can use this function which will build the picomatch + * matchers ahead of time and then have an optimized path for determining + * whether an individual path matches. + * + * This function is intended to match the behavior of `micromatch()`. + * + * @example + * const isMatch = globsToMatcher(['*.js', '!*.test.js']); + * isMatch('pizza.js'); // true + * isMatch('pizza.test.js'); // false + */ + +function globsToMatcher(globs) { + if (globs.length === 0) { + // Since there were no globs given, we can simply have a fast path here and + // return with a very simple function. + return () => false; + } + + const matchers = globs.map(glob => { + if (!globsToMatchersMap.has(glob)) { + const isMatch = (0, _picomatch().default)(glob, picomatchOptions, true); + const matcher = { + isMatch, + // Matchers that are negated have different behavior than matchers that + // are not negated, so we need to store this information ahead of time. + negated: isMatch.state.negated || !!isMatch.state.negatedExtglob + }; + globsToMatchersMap.set(glob, matcher); + } + + return globsToMatchersMap.get(glob); + }); + return path => { + const replacedPath = (0, _replacePathSepForGlob.default)(path); + let kept = undefined; + let negatives = 0; + + for (let i = 0; i < matchers.length; i++) { + const {isMatch, negated} = matchers[i]; + + if (negated) { + negatives++; + } + + const matched = isMatch(replacedPath); + + if (!matched && negated) { + // The path was not matched, and the matcher is a negated matcher, so we + // want to omit the path. This means that the negative matcher is + // filtering the path out. + kept = false; + } else if (matched && !negated) { + // The path was matched, and the matcher is not a negated matcher, so we + // want to keep the path. + kept = true; + } + } // If all of the globs were negative globs, then we want to include the path + // as long as it was not explicitly not kept. Otherwise only include + // the path if it was kept. This allows sets of globs that are all negated + // to allow some paths to be matched, while sets of globs that are mixed + // negated and non-negated to cause the negated matchers to only omit paths + // and not keep them. + + return negatives === matchers.length ? kept !== false : !!kept; + }; +} diff --git a/node_modules/jest-util/build/index.d.ts b/node_modules/jest-util/build/index.d.ts new file mode 100644 index 0000000..118162e --- /dev/null +++ b/node_modules/jest-util/build/index.d.ts @@ -0,0 +1,25 @@ +/** + * 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 as clearLine } from './clearLine'; +export { default as createDirectory } from './createDirectory'; +export { default as ErrorWithStack } from './ErrorWithStack'; +export { default as installCommonGlobals } from './installCommonGlobals'; +export { default as interopRequireDefault } from './interopRequireDefault'; +export { default as isInteractive } from './isInteractive'; +export { default as isPromise } from './isPromise'; +export { default as setGlobal } from './setGlobal'; +export { default as deepCyclicCopy } from './deepCyclicCopy'; +export { default as convertDescriptorToString } from './convertDescriptorToString'; +export * as specialChars from './specialChars'; +export { default as replacePathSepForGlob } from './replacePathSepForGlob'; +export { default as testPathPatternToRegExp } from './testPathPatternToRegExp'; +export { default as globsToMatcher } from './globsToMatcher'; +export * as preRunMessage from './preRunMessage'; +export { default as pluralize } from './pluralize'; +export { default as formatTime } from './formatTime'; +export { default as tryRealpath } from './tryRealpath'; +export { default as requireOrImportModule } from './requireOrImportModule'; diff --git a/node_modules/jest-util/build/index.js b/node_modules/jest-util/build/index.js new file mode 100644 index 0000000..64b076e --- /dev/null +++ b/node_modules/jest-util/build/index.js @@ -0,0 +1,209 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +Object.defineProperty(exports, 'ErrorWithStack', { + enumerable: true, + get: function () { + return _ErrorWithStack.default; + } +}); +Object.defineProperty(exports, 'clearLine', { + enumerable: true, + get: function () { + return _clearLine.default; + } +}); +Object.defineProperty(exports, 'convertDescriptorToString', { + enumerable: true, + get: function () { + return _convertDescriptorToString.default; + } +}); +Object.defineProperty(exports, 'createDirectory', { + enumerable: true, + get: function () { + return _createDirectory.default; + } +}); +Object.defineProperty(exports, 'deepCyclicCopy', { + enumerable: true, + get: function () { + return _deepCyclicCopy.default; + } +}); +Object.defineProperty(exports, 'formatTime', { + enumerable: true, + get: function () { + return _formatTime.default; + } +}); +Object.defineProperty(exports, 'globsToMatcher', { + enumerable: true, + get: function () { + return _globsToMatcher.default; + } +}); +Object.defineProperty(exports, 'installCommonGlobals', { + enumerable: true, + get: function () { + return _installCommonGlobals.default; + } +}); +Object.defineProperty(exports, 'interopRequireDefault', { + enumerable: true, + get: function () { + return _interopRequireDefault.default; + } +}); +Object.defineProperty(exports, 'isInteractive', { + enumerable: true, + get: function () { + return _isInteractive.default; + } +}); +Object.defineProperty(exports, 'isPromise', { + enumerable: true, + get: function () { + return _isPromise.default; + } +}); +Object.defineProperty(exports, 'pluralize', { + enumerable: true, + get: function () { + return _pluralize.default; + } +}); +exports.preRunMessage = void 0; +Object.defineProperty(exports, 'replacePathSepForGlob', { + enumerable: true, + get: function () { + return _replacePathSepForGlob.default; + } +}); +Object.defineProperty(exports, 'requireOrImportModule', { + enumerable: true, + get: function () { + return _requireOrImportModule.default; + } +}); +Object.defineProperty(exports, 'setGlobal', { + enumerable: true, + get: function () { + return _setGlobal.default; + } +}); +exports.specialChars = void 0; +Object.defineProperty(exports, 'testPathPatternToRegExp', { + enumerable: true, + get: function () { + return _testPathPatternToRegExp.default; + } +}); +Object.defineProperty(exports, 'tryRealpath', { + enumerable: true, + get: function () { + return _tryRealpath.default; + } +}); + +var _clearLine = _interopRequireDefault2(require('./clearLine')); + +var _createDirectory = _interopRequireDefault2(require('./createDirectory')); + +var _ErrorWithStack = _interopRequireDefault2(require('./ErrorWithStack')); + +var _installCommonGlobals = _interopRequireDefault2( + require('./installCommonGlobals') +); + +var _interopRequireDefault = _interopRequireDefault2( + require('./interopRequireDefault') +); + +var _isInteractive = _interopRequireDefault2(require('./isInteractive')); + +var _isPromise = _interopRequireDefault2(require('./isPromise')); + +var _setGlobal = _interopRequireDefault2(require('./setGlobal')); + +var _deepCyclicCopy = _interopRequireDefault2(require('./deepCyclicCopy')); + +var _convertDescriptorToString = _interopRequireDefault2( + require('./convertDescriptorToString') +); + +var _specialChars = _interopRequireWildcard(require('./specialChars')); + +exports.specialChars = _specialChars; + +var _replacePathSepForGlob = _interopRequireDefault2( + require('./replacePathSepForGlob') +); + +var _testPathPatternToRegExp = _interopRequireDefault2( + require('./testPathPatternToRegExp') +); + +var _globsToMatcher = _interopRequireDefault2(require('./globsToMatcher')); + +var _preRunMessage = _interopRequireWildcard(require('./preRunMessage')); + +exports.preRunMessage = _preRunMessage; + +var _pluralize = _interopRequireDefault2(require('./pluralize')); + +var _formatTime = _interopRequireDefault2(require('./formatTime')); + +var _tryRealpath = _interopRequireDefault2(require('./tryRealpath')); + +var _requireOrImportModule = _interopRequireDefault2( + require('./requireOrImportModule') +); + +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== 'function') return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function (nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} + +function _interopRequireWildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (key !== 'default' && 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; +} + +function _interopRequireDefault2(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} diff --git a/node_modules/jest-util/build/installCommonGlobals.d.ts b/node_modules/jest-util/build/installCommonGlobals.d.ts new file mode 100644 index 0000000..c93689e --- /dev/null +++ b/node_modules/jest-util/build/installCommonGlobals.d.ts @@ -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 installCommonGlobals(globalObject: typeof globalThis, globals: Config.ConfigGlobals): typeof globalThis & Config.ConfigGlobals; diff --git a/node_modules/jest-util/build/installCommonGlobals.js b/node_modules/jest-util/build/installCommonGlobals.js new file mode 100644 index 0000000..509ceee --- /dev/null +++ b/node_modules/jest-util/build/installCommonGlobals.js @@ -0,0 +1,123 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = installCommonGlobals; + +function fs() { + const data = _interopRequireWildcard(require('graceful-fs')); + + fs = function () { + return data; + }; + + return data; +} + +var _createProcessObject = _interopRequireDefault( + require('./createProcessObject') +); + +var _deepCyclicCopy = _interopRequireDefault(require('./deepCyclicCopy')); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {default: obj}; +} + +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== 'function') return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function (nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} + +function _interopRequireWildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { + return {default: obj}; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = + Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (key !== 'default' && 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 DTRACE = Object.keys(global).filter(key => key.startsWith('DTRACE')); + +function installCommonGlobals(globalObject, globals) { + globalObject.process = (0, _createProcessObject.default)(); + const symbol = globalObject.Symbol; // Keep a reference to some globals that Jest needs + + Object.defineProperties(globalObject, { + [symbol.for('jest-native-promise')]: { + enumerable: false, + value: Promise, + writable: false + }, + [symbol.for('jest-native-now')]: { + enumerable: false, + value: globalObject.Date.now.bind(globalObject.Date), + writable: false + }, + [symbol.for('jest-native-read-file')]: { + enumerable: false, + value: fs().readFileSync.bind(fs()), + writable: false + }, + [symbol.for('jest-native-write-file')]: { + enumerable: false, + value: fs().writeFileSync.bind(fs()), + writable: false + }, + [symbol.for('jest-native-exists-file')]: { + enumerable: false, + value: fs().existsSync.bind(fs()), + writable: false + }, + 'jest-symbol-do-not-touch': { + enumerable: false, + value: symbol, + writable: false + } + }); // Forward some APIs. + + DTRACE.forEach(dtrace => { + // @ts-expect-error: no index + globalObject[dtrace] = function (...args) { + // @ts-expect-error: no index + return global[dtrace].apply(this, args); + }; + }); + return Object.assign(globalObject, (0, _deepCyclicCopy.default)(globals)); +} diff --git a/node_modules/jest-util/build/interopRequireDefault.d.ts b/node_modules/jest-util/build/interopRequireDefault.d.ts new file mode 100644 index 0000000..91b66e4 --- /dev/null +++ b/node_modules/jest-util/build/interopRequireDefault.d.ts @@ -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 interopRequireDefault(obj: any): any; diff --git a/node_modules/jest-util/build/interopRequireDefault.js b/node_modules/jest-util/build/interopRequireDefault.js new file mode 100644 index 0000000..69f2eba --- /dev/null +++ b/node_modules/jest-util/build/interopRequireDefault.js @@ -0,0 +1,22 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = interopRequireDefault; + +/** + * 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. + */ +// copied from https://github.com/babel/babel/blob/56044c7851d583d498f919e9546caddf8f80a72f/packages/babel-helpers/src/helpers.js#L558-L562 +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function interopRequireDefault(obj) { + return obj && obj.__esModule + ? obj + : { + default: obj + }; +} diff --git a/node_modules/jest-util/build/isInteractive.d.ts b/node_modules/jest-util/build/isInteractive.d.ts new file mode 100644 index 0000000..57ddbf0 --- /dev/null +++ b/node_modules/jest-util/build/isInteractive.d.ts @@ -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: boolean; +export default _default; diff --git a/node_modules/jest-util/build/isInteractive.js b/node_modules/jest-util/build/isInteractive.js new file mode 100644 index 0000000..bc25399 --- /dev/null +++ b/node_modules/jest-util/build/isInteractive.js @@ -0,0 +1,27 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = void 0; + +function _ciInfo() { + const data = require('ci-info'); + + _ciInfo = 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. + */ +var _default = + !!process.stdout.isTTY && process.env.TERM !== 'dumb' && !_ciInfo().isCI; + +exports.default = _default; diff --git a/node_modules/jest-util/build/isPromise.d.ts b/node_modules/jest-util/build/isPromise.d.ts new file mode 100644 index 0000000..ea8589b --- /dev/null +++ b/node_modules/jest-util/build/isPromise.d.ts @@ -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 isPromise: (candidate: unknown) => candidate is Promise; +export default isPromise; diff --git a/node_modules/jest-util/build/isPromise.js b/node_modules/jest-util/build/isPromise.js new file mode 100644 index 0000000..7158df8 --- /dev/null +++ b/node_modules/jest-util/build/isPromise.js @@ -0,0 +1,20 @@ +'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. + */ +// capture global.Promise before it may potentially be overwritten +const Promise = global.Promise; // see ES2015 spec 25.4.4.5, https://stackoverflow.com/a/38339199 + +const isPromise = candidate => Promise.resolve(candidate) === candidate; + +var _default = isPromise; +exports.default = _default; diff --git a/node_modules/jest-util/build/pluralize.d.ts b/node_modules/jest-util/build/pluralize.d.ts new file mode 100644 index 0000000..9be3057 --- /dev/null +++ b/node_modules/jest-util/build/pluralize.d.ts @@ -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 pluralize(word: string, count: number): string; diff --git a/node_modules/jest-util/build/pluralize.js b/node_modules/jest-util/build/pluralize.js new file mode 100644 index 0000000..55f533e --- /dev/null +++ b/node_modules/jest-util/build/pluralize.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = pluralize; + +/** + * 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 pluralize(word, count) { + return `${count} ${word}${count === 1 ? '' : 's'}`; +} diff --git a/node_modules/jest-util/build/preRunMessage.d.ts b/node_modules/jest-util/build/preRunMessage.d.ts new file mode 100644 index 0000000..55acad9 --- /dev/null +++ b/node_modules/jest-util/build/preRunMessage.d.ts @@ -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. + */ +/// +export declare const print: (stream: NodeJS.WriteStream) => void; +export declare const remove: (stream: NodeJS.WriteStream) => void; diff --git a/node_modules/jest-util/build/preRunMessage.js b/node_modules/jest-util/build/preRunMessage.js new file mode 100644 index 0000000..3704601 --- /dev/null +++ b/node_modules/jest-util/build/preRunMessage.js @@ -0,0 +1,48 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.remove = exports.print = void 0; + +function _chalk() { + const data = _interopRequireDefault(require('chalk')); + + _chalk = function () { + return data; + }; + + return data; +} + +var _clearLine = _interopRequireDefault(require('./clearLine')); + +var _isInteractive = _interopRequireDefault(require('./isInteractive')); + +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 print = stream => { + if (_isInteractive.default) { + stream.write( + _chalk().default.bold.dim('Determining test suites to run...') + ); + } +}; + +exports.print = print; + +const remove = stream => { + if (_isInteractive.default) { + (0, _clearLine.default)(stream); + } +}; + +exports.remove = remove; diff --git a/node_modules/jest-util/build/replacePathSepForGlob.d.ts b/node_modules/jest-util/build/replacePathSepForGlob.d.ts new file mode 100644 index 0000000..7f47d18 --- /dev/null +++ b/node_modules/jest-util/build/replacePathSepForGlob.d.ts @@ -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 replacePathSepForGlob(path: Config.Path): Config.Glob; diff --git a/node_modules/jest-util/build/replacePathSepForGlob.js b/node_modules/jest-util/build/replacePathSepForGlob.js new file mode 100644 index 0000000..b7a1d0f --- /dev/null +++ b/node_modules/jest-util/build/replacePathSepForGlob.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = replacePathSepForGlob; + +/** + * 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 replacePathSepForGlob(path) { + return path.replace(/\\(?![{}()+?.^$])/g, '/'); +} diff --git a/node_modules/jest-util/build/requireOrImportModule.d.ts b/node_modules/jest-util/build/requireOrImportModule.d.ts new file mode 100644 index 0000000..b27bd94 --- /dev/null +++ b/node_modules/jest-util/build/requireOrImportModule.d.ts @@ -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 requireOrImportModule(filePath: Config.Path, applyInteropRequireDefault?: boolean): Promise; diff --git a/node_modules/jest-util/build/requireOrImportModule.js b/node_modules/jest-util/build/requireOrImportModule.js new file mode 100644 index 0000000..14bb2a3 --- /dev/null +++ b/node_modules/jest-util/build/requireOrImportModule.js @@ -0,0 +1,91 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = requireOrImportModule; + +function _path() { + const data = require('path'); + + _path = function () { + return data; + }; + + return data; +} + +function _url() { + const data = require('url'); + + _url = function () { + return data; + }; + + return data; +} + +var _interopRequireDefault = _interopRequireDefault2( + require('./interopRequireDefault') +); + +function _interopRequireDefault2(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. + */ +async function requireOrImportModule( + filePath, + applyInteropRequireDefault = true +) { + if (!(0, _path().isAbsolute)(filePath) && filePath[0] === '.') { + throw new Error( + `Jest: requireOrImportModule path must be absolute, was "${filePath}"` + ); + } + + try { + const requiredModule = require(filePath); + + if (!applyInteropRequireDefault) { + return requiredModule; + } + + return (0, _interopRequireDefault.default)(requiredModule).default; + } catch (error) { + if (error.code === 'ERR_REQUIRE_ESM') { + try { + const moduleUrl = (0, _url().pathToFileURL)(filePath); // node `import()` supports URL, but TypeScript doesn't know that + + const importedModule = await import(moduleUrl.href); + + if (!applyInteropRequireDefault) { + return importedModule; + } + + if (!importedModule.default) { + throw new Error( + `Jest: Failed to load ESM at ${filePath} - did you use a default export?` + ); + } + + return importedModule.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 ${filePath}` + ); + } + + throw innerError; + } + } else { + throw error; + } + } +} diff --git a/node_modules/jest-util/build/setGlobal.d.ts b/node_modules/jest-util/build/setGlobal.d.ts new file mode 100644 index 0000000..94e0e76 --- /dev/null +++ b/node_modules/jest-util/build/setGlobal.d.ts @@ -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 setGlobal(globalToMutate: typeof globalThis, key: string, value: unknown): void; diff --git a/node_modules/jest-util/build/setGlobal.js b/node_modules/jest-util/build/setGlobal.js new file mode 100644 index 0000000..7fdd77e --- /dev/null +++ b/node_modules/jest-util/build/setGlobal.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = setGlobal; + +/** + * 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 setGlobal(globalToMutate, key, value) { + // @ts-expect-error: no index + globalToMutate[key] = value; +} diff --git a/node_modules/jest-util/build/specialChars.d.ts b/node_modules/jest-util/build/specialChars.d.ts new file mode 100644 index 0000000..1a50d49 --- /dev/null +++ b/node_modules/jest-util/build/specialChars.d.ts @@ -0,0 +1,14 @@ +/** + * 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 ARROW = " \u203A "; +export declare const ICONS: { + failed: string; + pending: string; + success: string; + todo: string; +}; +export declare const CLEAR: string; diff --git a/node_modules/jest-util/build/specialChars.js b/node_modules/jest-util/build/specialChars.js new file mode 100644 index 0000000..b859ebd --- /dev/null +++ b/node_modules/jest-util/build/specialChars.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.ICONS = exports.CLEAR = exports.ARROW = 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 isWindows = process.platform === 'win32'; +const ARROW = ' \u203A '; +exports.ARROW = ARROW; +const ICONS = { + failed: isWindows ? '\u00D7' : '\u2715', + pending: '\u25CB', + success: isWindows ? '\u221A' : '\u2713', + todo: '\u270E' +}; +exports.ICONS = ICONS; +const CLEAR = isWindows ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H'; +exports.CLEAR = CLEAR; diff --git a/node_modules/jest-util/build/testPathPatternToRegExp.d.ts b/node_modules/jest-util/build/testPathPatternToRegExp.d.ts new file mode 100644 index 0000000..115aadf --- /dev/null +++ b/node_modules/jest-util/build/testPathPatternToRegExp.d.ts @@ -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 testPathPatternToRegExp(testPathPattern: Config.GlobalConfig['testPathPattern']): RegExp; diff --git a/node_modules/jest-util/build/testPathPatternToRegExp.js b/node_modules/jest-util/build/testPathPatternToRegExp.js new file mode 100644 index 0000000..5d64c62 --- /dev/null +++ b/node_modules/jest-util/build/testPathPatternToRegExp.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = testPathPatternToRegExp; + +/** + * 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. + */ +// Because we serialize/deserialize globalConfig when we spawn workers, +// we can't pass regular expression. Using this shared function on both sides +// will ensure that we produce consistent regexp for testPathPattern. +function testPathPatternToRegExp(testPathPattern) { + return new RegExp(testPathPattern, 'i'); +} diff --git a/node_modules/jest-util/build/tryRealpath.d.ts b/node_modules/jest-util/build/tryRealpath.d.ts new file mode 100644 index 0000000..cccdfa0 --- /dev/null +++ b/node_modules/jest-util/build/tryRealpath.d.ts @@ -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 tryRealpath(path: Config.Path): Config.Path; diff --git a/node_modules/jest-util/build/tryRealpath.js b/node_modules/jest-util/build/tryRealpath.js new file mode 100644 index 0000000..4459338 --- /dev/null +++ b/node_modules/jest-util/build/tryRealpath.js @@ -0,0 +1,34 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +exports.default = tryRealpath; + +function _gracefulFs() { + const data = require('graceful-fs'); + + _gracefulFs = 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 tryRealpath(path) { + try { + path = _gracefulFs().realpathSync.native(path); + } catch (error) { + if (error.code !== 'ENOENT') { + throw error; + } + } + + return path; +} diff --git a/node_modules/jest-util/package.json b/node_modules/jest-util/package.json new file mode 100644 index 0000000..f1b9788 --- /dev/null +++ b/node_modules/jest-util/package.json @@ -0,0 +1,39 @@ +{ + "name": "jest-util", + "version": "27.5.1", + "repository": { + "type": "git", + "url": "https://github.com/facebook/jest.git", + "directory": "packages/jest-util" + }, + "license": "MIT", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, + "./package.json": "./package.json" + }, + "dependencies": { + "@jest/types": "^27.5.1", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "devDependencies": { + "@types/graceful-fs": "^4.1.2", + "@types/micromatch": "^4.0.1", + "@types/picomatch": "^2.2.2" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" +} -- cgit v1.2.3