mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-05-08 06:00:02 +00:00
nhj
more
This commit is contained in:
21
unified-ai-platform/node_modules/@jest/console/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/console/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and 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.
|
||||
197
unified-ai-platform/node_modules/@jest/console/build/BufferedConsole.js
generated
vendored
Normal file
197
unified-ai-platform/node_modules/@jest/console/build/BufferedConsole.js
generated
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
function _assert() {
|
||||
const data = require('assert');
|
||||
_assert = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _console() {
|
||||
const data = require('console');
|
||||
_console = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _util() {
|
||||
const data = require('util');
|
||||
_util = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
class BufferedConsole extends _console().Console {
|
||||
_buffer = [];
|
||||
_counters = {};
|
||||
_timers = {};
|
||||
_groupDepth = 0;
|
||||
Console = _console().Console;
|
||||
constructor() {
|
||||
super({
|
||||
write: message => {
|
||||
BufferedConsole.write(this._buffer, 'log', message, null);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
static write(buffer, type, message, level) {
|
||||
const stackLevel = level != null ? level : 2;
|
||||
const rawStack = new (_jestUtil().ErrorWithStack)(
|
||||
undefined,
|
||||
BufferedConsole.write
|
||||
).stack;
|
||||
(0, _jestUtil().invariant)(rawStack != null, 'always have a stack trace');
|
||||
const origin = rawStack
|
||||
.split('\n')
|
||||
.slice(stackLevel)
|
||||
.filter(Boolean)
|
||||
.join('\n');
|
||||
buffer.push({
|
||||
message,
|
||||
origin,
|
||||
type
|
||||
});
|
||||
return buffer;
|
||||
}
|
||||
_log(type, message) {
|
||||
BufferedConsole.write(
|
||||
this._buffer,
|
||||
type,
|
||||
' '.repeat(this._groupDepth) + message,
|
||||
3
|
||||
);
|
||||
}
|
||||
assert(value, message) {
|
||||
try {
|
||||
(0, _assert().strict)(value, message);
|
||||
} catch (error) {
|
||||
if (!(error instanceof _assert().AssertionError)) {
|
||||
throw error;
|
||||
}
|
||||
// https://github.com/jestjs/jest/pull/13422#issuecomment-1273396392
|
||||
this._log('assert', error.toString().replace(/:\n\n.*\n/gs, ''));
|
||||
}
|
||||
}
|
||||
count(label = 'default') {
|
||||
if (!this._counters[label]) {
|
||||
this._counters[label] = 0;
|
||||
}
|
||||
this._log(
|
||||
'count',
|
||||
(0, _util().format)(`${label}: ${++this._counters[label]}`)
|
||||
);
|
||||
}
|
||||
countReset(label = 'default') {
|
||||
this._counters[label] = 0;
|
||||
}
|
||||
debug(firstArg, ...rest) {
|
||||
this._log('debug', (0, _util().format)(firstArg, ...rest));
|
||||
}
|
||||
dir(firstArg, options = {}) {
|
||||
const representation = (0, _util().inspect)(firstArg, options);
|
||||
this._log('dir', (0, _util().formatWithOptions)(options, representation));
|
||||
}
|
||||
dirxml(firstArg, ...rest) {
|
||||
this._log('dirxml', (0, _util().format)(firstArg, ...rest));
|
||||
}
|
||||
error(firstArg, ...rest) {
|
||||
this._log('error', (0, _util().format)(firstArg, ...rest));
|
||||
}
|
||||
group(title, ...rest) {
|
||||
this._groupDepth++;
|
||||
if (title != null || rest.length > 0) {
|
||||
this._log(
|
||||
'group',
|
||||
_chalk().default.bold((0, _util().format)(title, ...rest))
|
||||
);
|
||||
}
|
||||
}
|
||||
groupCollapsed(title, ...rest) {
|
||||
this._groupDepth++;
|
||||
if (title != null || rest.length > 0) {
|
||||
this._log(
|
||||
'groupCollapsed',
|
||||
_chalk().default.bold((0, _util().format)(title, ...rest))
|
||||
);
|
||||
}
|
||||
}
|
||||
groupEnd() {
|
||||
if (this._groupDepth > 0) {
|
||||
this._groupDepth--;
|
||||
}
|
||||
}
|
||||
info(firstArg, ...rest) {
|
||||
this._log('info', (0, _util().format)(firstArg, ...rest));
|
||||
}
|
||||
log(firstArg, ...rest) {
|
||||
this._log('log', (0, _util().format)(firstArg, ...rest));
|
||||
}
|
||||
time(label = 'default') {
|
||||
if (this._timers[label] != null) {
|
||||
return;
|
||||
}
|
||||
this._timers[label] = new Date();
|
||||
}
|
||||
timeEnd(label = 'default') {
|
||||
const startTime = this._timers[label];
|
||||
if (startTime != null) {
|
||||
const endTime = new Date();
|
||||
const time = endTime.getTime() - startTime.getTime();
|
||||
this._log(
|
||||
'time',
|
||||
(0, _util().format)(`${label}: ${(0, _jestUtil().formatTime)(time)}`)
|
||||
);
|
||||
delete this._timers[label];
|
||||
}
|
||||
}
|
||||
timeLog(label = 'default', ...data) {
|
||||
const startTime = this._timers[label];
|
||||
if (startTime != null) {
|
||||
const endTime = new Date();
|
||||
const time = endTime.getTime() - startTime.getTime();
|
||||
this._log(
|
||||
'time',
|
||||
(0, _util().format)(
|
||||
`${label}: ${(0, _jestUtil().formatTime)(time)}`,
|
||||
...data
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
warn(firstArg, ...rest) {
|
||||
this._log('warn', (0, _util().format)(firstArg, ...rest));
|
||||
}
|
||||
getBuffer() {
|
||||
return this._buffer.length ? this._buffer : undefined;
|
||||
}
|
||||
}
|
||||
exports.default = BufferedConsole;
|
||||
182
unified-ai-platform/node_modules/@jest/console/build/CustomConsole.js
generated
vendored
Normal file
182
unified-ai-platform/node_modules/@jest/console/build/CustomConsole.js
generated
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
function _assert() {
|
||||
const data = require('assert');
|
||||
_assert = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _console() {
|
||||
const data = require('console');
|
||||
_console = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _util() {
|
||||
const data = require('util');
|
||||
_util = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
class CustomConsole extends _console().Console {
|
||||
_stdout;
|
||||
_stderr;
|
||||
_formatBuffer;
|
||||
_counters = {};
|
||||
_timers = {};
|
||||
_groupDepth = 0;
|
||||
Console = _console().Console;
|
||||
constructor(stdout, stderr, formatBuffer = (_type, message) => message) {
|
||||
super(stdout, stderr);
|
||||
this._stdout = stdout;
|
||||
this._stderr = stderr;
|
||||
this._formatBuffer = formatBuffer;
|
||||
}
|
||||
_log(type, message) {
|
||||
(0, _jestUtil().clearLine)(this._stdout);
|
||||
super.log(
|
||||
this._formatBuffer(type, ' '.repeat(this._groupDepth) + message)
|
||||
);
|
||||
}
|
||||
_logError(type, message) {
|
||||
(0, _jestUtil().clearLine)(this._stderr);
|
||||
super.error(
|
||||
this._formatBuffer(type, ' '.repeat(this._groupDepth) + message)
|
||||
);
|
||||
}
|
||||
assert(value, message) {
|
||||
try {
|
||||
(0, _assert().strict)(value, message);
|
||||
} catch (error) {
|
||||
if (!(error instanceof _assert().AssertionError)) {
|
||||
throw error;
|
||||
}
|
||||
// https://github.com/jestjs/jest/pull/13422#issuecomment-1273396392
|
||||
this._logError('assert', error.toString().replace(/:\n\n.*\n/gs, ''));
|
||||
}
|
||||
}
|
||||
count(label = 'default') {
|
||||
if (!this._counters[label]) {
|
||||
this._counters[label] = 0;
|
||||
}
|
||||
this._log(
|
||||
'count',
|
||||
(0, _util().format)(`${label}: ${++this._counters[label]}`)
|
||||
);
|
||||
}
|
||||
countReset(label = 'default') {
|
||||
this._counters[label] = 0;
|
||||
}
|
||||
debug(firstArg, ...args) {
|
||||
this._log('debug', (0, _util().format)(firstArg, ...args));
|
||||
}
|
||||
dir(firstArg, options = {}) {
|
||||
const representation = (0, _util().inspect)(firstArg, options);
|
||||
this._log('dir', (0, _util().formatWithOptions)(options, representation));
|
||||
}
|
||||
dirxml(firstArg, ...args) {
|
||||
this._log('dirxml', (0, _util().format)(firstArg, ...args));
|
||||
}
|
||||
error(firstArg, ...args) {
|
||||
this._logError('error', (0, _util().format)(firstArg, ...args));
|
||||
}
|
||||
group(title, ...args) {
|
||||
this._groupDepth++;
|
||||
if (title != null || args.length > 0) {
|
||||
this._log(
|
||||
'group',
|
||||
_chalk().default.bold((0, _util().format)(title, ...args))
|
||||
);
|
||||
}
|
||||
}
|
||||
groupCollapsed(title, ...args) {
|
||||
this._groupDepth++;
|
||||
if (title != null || args.length > 0) {
|
||||
this._log(
|
||||
'groupCollapsed',
|
||||
_chalk().default.bold((0, _util().format)(title, ...args))
|
||||
);
|
||||
}
|
||||
}
|
||||
groupEnd() {
|
||||
if (this._groupDepth > 0) {
|
||||
this._groupDepth--;
|
||||
}
|
||||
}
|
||||
info(firstArg, ...args) {
|
||||
this._log('info', (0, _util().format)(firstArg, ...args));
|
||||
}
|
||||
log(firstArg, ...args) {
|
||||
this._log('log', (0, _util().format)(firstArg, ...args));
|
||||
}
|
||||
time(label = 'default') {
|
||||
if (this._timers[label] != null) {
|
||||
return;
|
||||
}
|
||||
this._timers[label] = new Date();
|
||||
}
|
||||
timeEnd(label = 'default') {
|
||||
const startTime = this._timers[label];
|
||||
if (startTime != null) {
|
||||
const endTime = new Date().getTime();
|
||||
const time = endTime - startTime.getTime();
|
||||
this._log(
|
||||
'time',
|
||||
(0, _util().format)(`${label}: ${(0, _jestUtil().formatTime)(time)}`)
|
||||
);
|
||||
delete this._timers[label];
|
||||
}
|
||||
}
|
||||
timeLog(label = 'default', ...data) {
|
||||
const startTime = this._timers[label];
|
||||
if (startTime != null) {
|
||||
const endTime = new Date();
|
||||
const time = endTime.getTime() - startTime.getTime();
|
||||
this._log(
|
||||
'time',
|
||||
(0, _util().format)(
|
||||
`${label}: ${(0, _jestUtil().formatTime)(time)}`,
|
||||
...data
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
warn(firstArg, ...args) {
|
||||
this._logError('warn', (0, _util().format)(firstArg, ...args));
|
||||
}
|
||||
getBuffer() {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
exports.default = CustomConsole;
|
||||
0
unified-ai-platform/node_modules/@jest/console/build/getConsoleOutput.js
generated
vendored
Normal file
0
unified-ai-platform/node_modules/@jest/console/build/getConsoleOutput.js
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/core/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/core/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and 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.
|
||||
266
unified-ai-platform/node_modules/@jest/core/build/collectHandles.js
generated
vendored
Normal file
266
unified-ai-platform/node_modules/@jest/core/build/collectHandles.js
generated
vendored
Normal file
@@ -0,0 +1,266 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = collectHandles;
|
||||
exports.formatHandleErrors = formatHandleErrors;
|
||||
function asyncHooks() {
|
||||
const data = _interopRequireWildcard(require('async_hooks'));
|
||||
asyncHooks = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _util() {
|
||||
const data = require('util');
|
||||
_util = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function v8() {
|
||||
const data = _interopRequireWildcard(require('v8'));
|
||||
v8 = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function vm() {
|
||||
const data = _interopRequireWildcard(require('vm'));
|
||||
vm = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _stripAnsi() {
|
||||
const data = _interopRequireDefault(require('strip-ansi'));
|
||||
_stripAnsi = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestMessageUtil() {
|
||||
const data = require('jest-message-util');
|
||||
_jestMessageUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
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) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* 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 */
|
||||
|
||||
function stackIsFromUser(stack) {
|
||||
// Either the test file, or something required by it
|
||||
if (stack.includes('Runtime.requireModule')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// jest-jasmine it or describe call
|
||||
if (stack.includes('asyncJestTest') || stack.includes('asyncJestLifecycle')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// An async function call from within circus
|
||||
if (stack.includes('callAsyncCircusFn')) {
|
||||
// jest-circus it or describe call
|
||||
return (
|
||||
stack.includes('_callCircusTest') || stack.includes('_callCircusHook')
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const alwaysActive = () => true;
|
||||
|
||||
// @ts-expect-error: doesn't exist in v12 typings
|
||||
const hasWeakRef = typeof WeakRef === 'function';
|
||||
const asyncSleep = (0, _util().promisify)(setTimeout);
|
||||
let gcFunc = globalThis.gc;
|
||||
function runGC() {
|
||||
if (!gcFunc) {
|
||||
v8().setFlagsFromString('--expose-gc');
|
||||
gcFunc = vm().runInNewContext('gc');
|
||||
v8().setFlagsFromString('--no-expose-gc');
|
||||
if (!gcFunc) {
|
||||
throw new Error(
|
||||
'Cannot find `global.gc` function. Please run node with `--expose-gc` and report this issue in jest repo.'
|
||||
);
|
||||
}
|
||||
}
|
||||
gcFunc();
|
||||
}
|
||||
|
||||
// Inspired by https://github.com/mafintosh/why-is-node-running/blob/master/index.js
|
||||
// Extracted as we want to format the result ourselves
|
||||
function collectHandles() {
|
||||
const activeHandles = new Map();
|
||||
const hook = asyncHooks().createHook({
|
||||
destroy(asyncId) {
|
||||
activeHandles.delete(asyncId);
|
||||
},
|
||||
init: function initHook(asyncId, type, triggerAsyncId, resource) {
|
||||
// Skip resources that should not generally prevent the process from
|
||||
// exiting, not last a meaningfully long time, or otherwise shouldn't be
|
||||
// tracked.
|
||||
if (
|
||||
type === 'PROMISE' ||
|
||||
type === 'TIMERWRAP' ||
|
||||
type === 'ELDHISTOGRAM' ||
|
||||
type === 'PerformanceObserver' ||
|
||||
type === 'RANDOMBYTESREQUEST' ||
|
||||
type === 'DNSCHANNEL' ||
|
||||
type === 'ZLIB' ||
|
||||
type === 'SIGNREQUEST'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const error = new (_jestUtil().ErrorWithStack)(type, initHook, 100);
|
||||
let fromUser = stackIsFromUser(error.stack || '');
|
||||
|
||||
// If the async resource was not directly created by user code, but was
|
||||
// triggered by another async resource from user code, track it and use
|
||||
// the original triggering resource's stack.
|
||||
if (!fromUser) {
|
||||
const triggeringHandle = activeHandles.get(triggerAsyncId);
|
||||
if (triggeringHandle) {
|
||||
fromUser = true;
|
||||
error.stack = triggeringHandle.error.stack;
|
||||
}
|
||||
}
|
||||
if (fromUser) {
|
||||
let isActive;
|
||||
|
||||
// Handle that supports hasRef
|
||||
if ('hasRef' in resource) {
|
||||
if (hasWeakRef) {
|
||||
// @ts-expect-error: doesn't exist in v12 typings
|
||||
const ref = new WeakRef(resource);
|
||||
isActive = () => {
|
||||
return ref.deref()?.hasRef() ?? false;
|
||||
};
|
||||
} else {
|
||||
isActive = resource.hasRef.bind(resource);
|
||||
}
|
||||
} else {
|
||||
// Handle that doesn't support hasRef
|
||||
isActive = alwaysActive;
|
||||
}
|
||||
activeHandles.set(asyncId, {
|
||||
error,
|
||||
isActive
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
hook.enable();
|
||||
return async () => {
|
||||
// Wait briefly for any async resources that have been queued for
|
||||
// destruction to actually be destroyed.
|
||||
// For example, Node.js TCP Servers are not destroyed until *after* their
|
||||
// `close` callback runs. If someone finishes a test from the `close`
|
||||
// callback, we will not yet have seen the resource be destroyed here.
|
||||
await asyncSleep(100);
|
||||
if (activeHandles.size > 0) {
|
||||
// For some special objects such as `TLSWRAP`.
|
||||
// Ref: https://github.com/jestjs/jest/issues/11665
|
||||
runGC();
|
||||
await asyncSleep(0);
|
||||
}
|
||||
hook.disable();
|
||||
|
||||
// Get errors for every async resource still referenced at this moment
|
||||
const result = Array.from(activeHandles.values())
|
||||
.filter(({isActive}) => isActive())
|
||||
.map(({error}) => error);
|
||||
activeHandles.clear();
|
||||
return result;
|
||||
};
|
||||
}
|
||||
function formatHandleErrors(errors, config) {
|
||||
const stacks = new Set();
|
||||
return (
|
||||
errors
|
||||
.map(err =>
|
||||
(0, _jestMessageUtil().formatExecError)(
|
||||
err,
|
||||
config,
|
||||
{
|
||||
noStackTrace: false
|
||||
},
|
||||
undefined,
|
||||
true
|
||||
)
|
||||
)
|
||||
// E.g. timeouts might give multiple traces to the same line of code
|
||||
// This hairy filtering tries to remove entries with duplicate stack traces
|
||||
.filter(handle => {
|
||||
const ansiFree = (0, _stripAnsi().default)(handle);
|
||||
const match = ansiFree.match(/\s+at(.*)/);
|
||||
if (!match || match.length < 2) {
|
||||
return true;
|
||||
}
|
||||
const stack = ansiFree.substr(ansiFree.indexOf(match[1])).trim();
|
||||
if (stacks.has(stack)) {
|
||||
return false;
|
||||
}
|
||||
stacks.add(stack);
|
||||
return true;
|
||||
})
|
||||
);
|
||||
}
|
||||
52
unified-ai-platform/node_modules/@jest/core/build/lib/activeFiltersMessage.js
generated
vendored
Normal file
52
unified-ai-platform/node_modules/@jest/core/build/lib/activeFiltersMessage.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
'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 _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const activeFilters = globalConfig => {
|
||||
const {testNamePattern, testPathPattern} = globalConfig;
|
||||
if (testNamePattern || testPathPattern) {
|
||||
const filters = [
|
||||
testPathPattern
|
||||
? _chalk().default.dim('filename ') +
|
||||
_chalk().default.yellow(`/${testPathPattern}/`)
|
||||
: null,
|
||||
testNamePattern
|
||||
? _chalk().default.dim('test name ') +
|
||||
_chalk().default.yellow(`/${testNamePattern}/`)
|
||||
: null
|
||||
]
|
||||
.filter(_jestUtil().isNonNullable)
|
||||
.join(', ');
|
||||
const messages = `\n${_chalk().default.bold('Active Filters: ')}${filters}`;
|
||||
return messages;
|
||||
}
|
||||
return '';
|
||||
};
|
||||
var _default = activeFilters;
|
||||
exports.default = _default;
|
||||
21
unified-ai-platform/node_modules/@jest/environment/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/environment/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and 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.
|
||||
332
unified-ai-platform/node_modules/@jest/environment/build/index.d.ts
generated
vendored
Normal file
332
unified-ai-platform/node_modules/@jest/environment/build/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,332 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
|
||||
import type {Circus} from '@jest/types';
|
||||
import type {Config} from '@jest/types';
|
||||
import type {Context} from 'vm';
|
||||
import type {Global} from '@jest/types';
|
||||
import type {LegacyFakeTimers} from '@jest/fake-timers';
|
||||
import type {Mocked} from 'jest-mock';
|
||||
import type {ModernFakeTimers} from '@jest/fake-timers';
|
||||
import type {ModuleMocker} from 'jest-mock';
|
||||
|
||||
export declare type EnvironmentContext = {
|
||||
console: Console;
|
||||
docblockPragmas: Record<string, string | Array<string>>;
|
||||
testPath: string;
|
||||
};
|
||||
|
||||
export declare interface Jest {
|
||||
/**
|
||||
* Advances all timers by `msToRun` milliseconds. All pending "macro-tasks"
|
||||
* that have been queued via `setTimeout()` or `setInterval()`, and would be
|
||||
* executed within this time frame will be executed.
|
||||
*/
|
||||
advanceTimersByTime(msToRun: number): void;
|
||||
/**
|
||||
* Advances all timers by `msToRun` milliseconds, firing callbacks if necessary.
|
||||
*
|
||||
* @remarks
|
||||
* Not available when using legacy fake timers implementation.
|
||||
*/
|
||||
advanceTimersByTimeAsync(msToRun: number): Promise<void>;
|
||||
/**
|
||||
* Advances all timers by the needed milliseconds so that only the next
|
||||
* timeouts/intervals will run. Optionally, you can provide steps, so it will
|
||||
* run steps amount of next timeouts/intervals.
|
||||
*/
|
||||
advanceTimersToNextTimer(steps?: number): void;
|
||||
/**
|
||||
* Advances the clock to the the moment of the first scheduled timer, firing it.
|
||||
* Optionally, you can provide steps, so it will run steps amount of
|
||||
* next timeouts/intervals.
|
||||
*
|
||||
* @remarks
|
||||
* Not available when using legacy fake timers implementation.
|
||||
*/
|
||||
advanceTimersToNextTimerAsync(steps?: number): Promise<void>;
|
||||
/**
|
||||
* Disables automatic mocking in the module loader.
|
||||
*/
|
||||
autoMockOff(): Jest;
|
||||
/**
|
||||
* Enables automatic mocking in the module loader.
|
||||
*/
|
||||
autoMockOn(): Jest;
|
||||
/**
|
||||
* Clears the `mock.calls`, `mock.instances`, `mock.contexts` and `mock.results` properties of
|
||||
* all mocks. Equivalent to calling `.mockClear()` on every mocked function.
|
||||
*/
|
||||
clearAllMocks(): Jest;
|
||||
/**
|
||||
* Removes any pending timers from the timer system. If any timers have been
|
||||
* scheduled, they will be cleared and will never have the opportunity to
|
||||
* execute in the future.
|
||||
*/
|
||||
clearAllTimers(): void;
|
||||
/**
|
||||
* Given the name of a module, use the automatic mocking system to generate a
|
||||
* mocked version of the module for you.
|
||||
*
|
||||
* This is useful when you want to create a manual mock that extends the
|
||||
* automatic mock's behavior.
|
||||
*/
|
||||
createMockFromModule<T = unknown>(moduleName: string): Mocked<T>;
|
||||
/**
|
||||
* Indicates that the module system should never return a mocked version of
|
||||
* the specified module and its dependencies.
|
||||
*/
|
||||
deepUnmock(moduleName: string): Jest;
|
||||
/**
|
||||
* Disables automatic mocking in the module loader.
|
||||
*
|
||||
* After this method is called, all `require()`s will return the real
|
||||
* versions of each module (rather than a mocked version).
|
||||
*/
|
||||
disableAutomock(): Jest;
|
||||
/**
|
||||
* When using `babel-jest`, calls to `jest.mock()` will automatically be hoisted
|
||||
* to the top of the code block. Use this method if you want to explicitly
|
||||
* avoid this behavior.
|
||||
*/
|
||||
doMock<T = unknown>(
|
||||
moduleName: string,
|
||||
moduleFactory?: () => T,
|
||||
options?: {
|
||||
virtual?: boolean;
|
||||
},
|
||||
): Jest;
|
||||
/**
|
||||
* When using `babel-jest`, calls to `jest.unmock()` will automatically be hoisted
|
||||
* to the top of the code block. Use this method if you want to explicitly
|
||||
* avoid this behavior.
|
||||
*/
|
||||
dontMock(moduleName: string): Jest;
|
||||
/**
|
||||
* Enables automatic mocking in the module loader.
|
||||
*/
|
||||
enableAutomock(): Jest;
|
||||
/**
|
||||
* Creates a mock function. Optionally takes a mock implementation.
|
||||
*/
|
||||
fn: ModuleMocker['fn'];
|
||||
/**
|
||||
* Given the name of a module, use the automatic mocking system to generate a
|
||||
* mocked version of the module for you.
|
||||
*
|
||||
* This is useful when you want to create a manual mock that extends the
|
||||
* automatic mock's behavior.
|
||||
*
|
||||
* @deprecated Use `jest.createMockFromModule()` instead
|
||||
*/
|
||||
genMockFromModule<T = unknown>(moduleName: string): Mocked<T>;
|
||||
/**
|
||||
* When mocking time, `Date.now()` will also be mocked. If you for some reason
|
||||
* need access to the real current time, you can invoke this function.
|
||||
*
|
||||
* @remarks
|
||||
* Not available when using legacy fake timers implementation.
|
||||
*/
|
||||
getRealSystemTime(): number;
|
||||
/**
|
||||
* Retrieves the seed value. It will be randomly generated for each test run
|
||||
* or can be manually set via the `--seed` CLI argument.
|
||||
*/
|
||||
getSeed(): number;
|
||||
/**
|
||||
* Returns the number of fake timers still left to run.
|
||||
*/
|
||||
getTimerCount(): number;
|
||||
/**
|
||||
* Returns `true` if test environment has been torn down.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* if (jest.isEnvironmentTornDown()) {
|
||||
* // The Jest environment has been torn down, so stop doing work
|
||||
* return;
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
isEnvironmentTornDown(): boolean;
|
||||
/**
|
||||
* Determines if the given function is a mocked function.
|
||||
*/
|
||||
isMockFunction: ModuleMocker['isMockFunction'];
|
||||
/**
|
||||
* `jest.isolateModules()` goes a step further than `jest.resetModules()` and
|
||||
* creates a sandbox registry for the modules that are loaded inside the callback
|
||||
* function. This is useful to isolate specific modules for every test so that
|
||||
* local module state doesn't conflict between tests.
|
||||
*/
|
||||
isolateModules(fn: () => void): Jest;
|
||||
/**
|
||||
* `jest.isolateModulesAsync()` is the equivalent of `jest.isolateModules()`, but for
|
||||
* async functions to be wrapped. The caller is expected to `await` the completion of
|
||||
* `isolateModulesAsync`.
|
||||
*/
|
||||
isolateModulesAsync(fn: () => Promise<void>): Promise<void>;
|
||||
/**
|
||||
* Mocks a module with an auto-mocked version when it is being required.
|
||||
*/
|
||||
mock<T = unknown>(
|
||||
moduleName: string,
|
||||
moduleFactory?: () => T,
|
||||
options?: {
|
||||
virtual?: boolean;
|
||||
},
|
||||
): Jest;
|
||||
/**
|
||||
* Mocks a module with the provided module factory when it is being imported.
|
||||
*/
|
||||
unstable_mockModule<T = unknown>(
|
||||
moduleName: string,
|
||||
moduleFactory: () => T | Promise<T>,
|
||||
options?: {
|
||||
virtual?: boolean;
|
||||
},
|
||||
): Jest;
|
||||
/**
|
||||
* Wraps types of the `source` object and its deep members with type definitions
|
||||
* of Jest mock function. Pass `{shallow: true}` option to disable the deeply
|
||||
* mocked behavior.
|
||||
*/
|
||||
mocked: ModuleMocker['mocked'];
|
||||
/**
|
||||
* Returns the current time in ms of the fake timer clock.
|
||||
*/
|
||||
now(): number;
|
||||
/**
|
||||
* Replaces property on an object with another value.
|
||||
*
|
||||
* @remarks
|
||||
* For mocking functions or 'get' or 'set' accessors, use `jest.spyOn()` instead.
|
||||
*/
|
||||
replaceProperty: ModuleMocker['replaceProperty'];
|
||||
/**
|
||||
* Returns the actual module instead of a mock, bypassing all checks on
|
||||
* whether the module should receive a mock implementation or not.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* jest.mock('../myModule', () => {
|
||||
* // Require the original module to not be mocked...
|
||||
* const originalModule = jest.requireActual('../myModule');
|
||||
*
|
||||
* return {
|
||||
* __esModule: true, // Use it when dealing with esModules
|
||||
* ...originalModule,
|
||||
* getRandom: jest.fn().mockReturnValue(10),
|
||||
* };
|
||||
* });
|
||||
*
|
||||
* const getRandom = require('../myModule').getRandom;
|
||||
*
|
||||
* getRandom(); // Always returns 10
|
||||
* ```
|
||||
*/
|
||||
requireActual<T = unknown>(moduleName: string): T;
|
||||
/**
|
||||
* Returns a mock module instead of the actual module, bypassing all checks
|
||||
* on whether the module should be required normally or not.
|
||||
*/
|
||||
requireMock<T = unknown>(moduleName: string): T;
|
||||
/**
|
||||
* Resets the state of all mocks. Equivalent to calling `.mockReset()` on
|
||||
* every mocked function.
|
||||
*/
|
||||
resetAllMocks(): Jest;
|
||||
/**
|
||||
* Resets the module registry - the cache of all required modules. This is
|
||||
* useful to isolate modules where local state might conflict between tests.
|
||||
*/
|
||||
resetModules(): Jest;
|
||||
/**
|
||||
* Restores all mocks and replaced properties back to their original value.
|
||||
* Equivalent to calling `.mockRestore()` on every mocked function
|
||||
* and `.restore()` on every replaced property.
|
||||
*
|
||||
* Beware that `jest.restoreAllMocks()` only works when the mock was created
|
||||
* with `jest.spyOn()`; other mocks will require you to manually restore them.
|
||||
*/
|
||||
restoreAllMocks(): Jest;
|
||||
/**
|
||||
* Runs failed tests n-times until they pass or until the max number of
|
||||
* retries is exhausted.
|
||||
*
|
||||
* If `logErrorsBeforeRetry` is enabled, Jest will log the error(s) that caused
|
||||
* the test to fail to the console, providing visibility on why a retry occurred.
|
||||
* retries is exhausted.
|
||||
*
|
||||
* @remarks
|
||||
* Only available with `jest-circus` runner.
|
||||
*/
|
||||
retryTimes(
|
||||
numRetries: number,
|
||||
options?: {
|
||||
logErrorsBeforeRetry?: boolean;
|
||||
},
|
||||
): Jest;
|
||||
/**
|
||||
* Exhausts tasks queued by `setImmediate()`.
|
||||
*
|
||||
* @remarks
|
||||
* Only available when using legacy fake timers implementation.
|
||||
*/
|
||||
runAllImmediates(): void;
|
||||
/**
|
||||
* Exhausts the micro-task queue (usually interfaced in node via
|
||||
* `process.nextTick()`).
|
||||
*/
|
||||
runAllTicks(): void;
|
||||
/**
|
||||
* Exhausts the macro-task queue (i.e., all tasks queued by `setTimeout()`
|
||||
* and `setInterval()`).
|
||||
*/
|
||||
runAllTimers(): void;
|
||||
/**
|
||||
* Exhausts the macro-task queue (i.e., all tasks queued by `setTimeout()`
|
||||
* and `setInterval()`).
|
||||
*
|
||||
* @remarks
|
||||
* If new timers are added while it is executing they will be run as well.
|
||||
* @remarks
|
||||
* Not available when using legacy fake timers implementation.
|
||||
*/
|
||||
runAllTimersAsync(): Promise<void>;
|
||||
/**
|
||||
* Executes only the macro-tasks that are currently pending (i.e., only the
|
||||
* tasks that have been queued by `setTimeout()` or `setInterval()` up to this
|
||||
* point). If any of the currently pending macro-tasks schedule new
|
||||
* macro-tasks, those new tasks will not be executed by this call.
|
||||
*/
|
||||
runOnlyPendingTimers(): void;
|
||||
/**
|
||||
* Executes only the macro-tasks that are currently pending (i.e., only the
|
||||
* tasks that have been queued by `setTimeout()` or `setInterval()` up to this
|
||||
* point). If any of the currently pending macro-tasks schedule new
|
||||
* macro-tasks, those new tasks will not be executed by this call.
|
||||
*
|
||||
* @remarks
|
||||
* Not available when using legacy fake timers implementation.
|
||||
*/
|
||||
runOnlyPendingTimersAsync(): Promise<void>;
|
||||
/**
|
||||
* Explicitly supplies the mock object that the module system should return
|
||||
* for the specified module.
|
||||
*
|
||||
* @remarks
|
||||
* It is recommended to use `jest.mock()` instead. The `jest.mock()` API's second
|
||||
* argument is a module factory instead of the expected exported module object.
|
||||
*/
|
||||
setMock(moduleName: string, moduleExports: unknown): Jest;
|
||||
/**
|
||||
* Set the current system time used by fake timers. Simulates a user changing
|
||||
* the system clock while your program is running. It affects the current time,
|
||||
* but it does not in itself cause e.g. timers to fire; they will fire exactly
|
||||
* as they woul
|
||||
1
unified-ai-platform/node_modules/@jest/environment/build/index.js
generated
vendored
Normal file
1
unified-ai-platform/node_modules/@jest/environment/build/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
'use strict';
|
||||
32
unified-ai-platform/node_modules/@jest/environment/package.json
generated
vendored
Normal file
32
unified-ai-platform/node_modules/@jest/environment/package.json
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "@jest/environment",
|
||||
"version": "29.7.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-environment"
|
||||
},
|
||||
"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/fake-timers": "^29.7.0",
|
||||
"@jest/types": "^29.6.3",
|
||||
"@types/node": "*",
|
||||
"jest-mock": "^29.7.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
|
||||
}
|
||||
21
unified-ai-platform/node_modules/@jest/expect-utils/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/expect-utils/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and 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.
|
||||
66
unified-ai-platform/node_modules/@jest/expect-utils/build/immutableUtils.js
generated
vendored
Normal file
66
unified-ai-platform/node_modules/@jest/expect-utils/build/immutableUtils.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.isImmutableList = isImmutableList;
|
||||
exports.isImmutableOrderedKeyed = isImmutableOrderedKeyed;
|
||||
exports.isImmutableOrderedSet = isImmutableOrderedSet;
|
||||
exports.isImmutableRecord = isImmutableRecord;
|
||||
exports.isImmutableUnorderedKeyed = isImmutableUnorderedKeyed;
|
||||
exports.isImmutableUnorderedSet = isImmutableUnorderedSet;
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
// SENTINEL constants are from https://github.com/immutable-js/immutable-js/tree/main/src/predicates
|
||||
const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
|
||||
const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
|
||||
const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
|
||||
const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
|
||||
const IS_RECORD_SYMBOL = '@@__IMMUTABLE_RECORD__@@';
|
||||
function isObjectLiteral(source) {
|
||||
return source != null && typeof source === 'object' && !Array.isArray(source);
|
||||
}
|
||||
function isImmutableUnorderedKeyed(source) {
|
||||
return Boolean(
|
||||
source &&
|
||||
isObjectLiteral(source) &&
|
||||
source[IS_KEYED_SENTINEL] &&
|
||||
!source[IS_ORDERED_SENTINEL]
|
||||
);
|
||||
}
|
||||
function isImmutableUnorderedSet(source) {
|
||||
return Boolean(
|
||||
source &&
|
||||
isObjectLiteral(source) &&
|
||||
source[IS_SET_SENTINEL] &&
|
||||
!source[IS_ORDERED_SENTINEL]
|
||||
);
|
||||
}
|
||||
function isImmutableList(source) {
|
||||
return Boolean(source && isObjectLiteral(source) && source[IS_LIST_SENTINEL]);
|
||||
}
|
||||
function isImmutableOrderedKeyed(source) {
|
||||
return Boolean(
|
||||
source &&
|
||||
isObjectLiteral(source) &&
|
||||
source[IS_KEYED_SENTINEL] &&
|
||||
source[IS_ORDERED_SENTINEL]
|
||||
);
|
||||
}
|
||||
function isImmutableOrderedSet(source) {
|
||||
return Boolean(
|
||||
source &&
|
||||
isObjectLiteral(source) &&
|
||||
source[IS_SET_SENTINEL] &&
|
||||
source[IS_ORDERED_SENTINEL]
|
||||
);
|
||||
}
|
||||
function isImmutableRecord(source) {
|
||||
return Boolean(source && isObjectLiteral(source) && source[IS_RECORD_SYMBOL]);
|
||||
}
|
||||
34
unified-ai-platform/node_modules/@jest/expect-utils/build/index.js
generated
vendored
Normal file
34
unified-ai-platform/node_modules/@jest/expect-utils/build/index.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
var _exportNames = {
|
||||
equals: true,
|
||||
isA: true
|
||||
};
|
||||
Object.defineProperty(exports, 'equals', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _jasmineUtils.equals;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'isA', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _jasmineUtils.isA;
|
||||
}
|
||||
});
|
||||
var _jasmineUtils = require('./jasmineUtils');
|
||||
var _utils = require('./utils');
|
||||
Object.keys(_utils).forEach(function (key) {
|
||||
if (key === 'default' || key === '__esModule') return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
if (key in exports && exports[key] === _utils[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
0
unified-ai-platform/node_modules/@jest/expect-utils/build/jasmineUtils.js
generated
vendored
Normal file
0
unified-ai-platform/node_modules/@jest/expect-utils/build/jasmineUtils.js
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/expect/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/expect/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and 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.
|
||||
40
unified-ai-platform/node_modules/@jest/expect/build/index.js
generated
vendored
Normal file
40
unified-ai-platform/node_modules/@jest/expect/build/index.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.jestExpect = void 0;
|
||||
function _expect() {
|
||||
const data = require('expect');
|
||||
_expect = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestSnapshot() {
|
||||
const data = require('jest-snapshot');
|
||||
_jestSnapshot = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
function createJestExpect() {
|
||||
_expect().expect.extend({
|
||||
toMatchInlineSnapshot: _jestSnapshot().toMatchInlineSnapshot,
|
||||
toMatchSnapshot: _jestSnapshot().toMatchSnapshot,
|
||||
toThrowErrorMatchingInlineSnapshot:
|
||||
_jestSnapshot().toThrowErrorMatchingInlineSnapshot,
|
||||
toThrowErrorMatchingSnapshot: _jestSnapshot().toThrowErrorMatchingSnapshot
|
||||
});
|
||||
_expect().expect.addSnapshotSerializer = _jestSnapshot().addSerializer;
|
||||
return _expect().expect;
|
||||
}
|
||||
const jestExpect = createJestExpect();
|
||||
exports.jestExpect = jestExpect;
|
||||
1
unified-ai-platform/node_modules/@jest/expect/build/types.js
generated
vendored
Normal file
1
unified-ai-platform/node_modules/@jest/expect/build/types.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
'use strict';
|
||||
34
unified-ai-platform/node_modules/@jest/expect/package.json
generated
vendored
Normal file
34
unified-ai-platform/node_modules/@jest/expect/package.json
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "@jest/expect",
|
||||
"version": "29.7.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-expect"
|
||||
},
|
||||
"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": {
|
||||
"expect": "^29.7.0",
|
||||
"jest-snapshot": "^29.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsd/typescript": "^5.0.4",
|
||||
"tsd-lite": "^0.7.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
|
||||
}
|
||||
21
unified-ai-platform/node_modules/@jest/fake-timers/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/fake-timers/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and 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.
|
||||
22
unified-ai-platform/node_modules/@jest/fake-timers/build/index.js
generated
vendored
Normal file
22
unified-ai-platform/node_modules/@jest/fake-timers/build/index.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, 'LegacyFakeTimers', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _legacyFakeTimers.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'ModernFakeTimers', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _modernFakeTimers.default;
|
||||
}
|
||||
});
|
||||
var _legacyFakeTimers = _interopRequireDefault(require('./legacyFakeTimers'));
|
||||
var _modernFakeTimers = _interopRequireDefault(require('./modernFakeTimers'));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
545
unified-ai-platform/node_modules/@jest/fake-timers/build/legacyFakeTimers.js
generated
vendored
Normal file
545
unified-ai-platform/node_modules/@jest/fake-timers/build/legacyFakeTimers.js
generated
vendored
Normal file
@@ -0,0 +1,545 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
function _util() {
|
||||
const data = require('util');
|
||||
_util = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestMessageUtil() {
|
||||
const data = require('jest-message-util');
|
||||
_jestMessageUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* 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/prefer-spread-eventually */
|
||||
|
||||
const MS_IN_A_YEAR = 31536000000;
|
||||
class FakeTimers {
|
||||
_cancelledTicks;
|
||||
_config;
|
||||
_disposed;
|
||||
_fakeTimerAPIs;
|
||||
_fakingTime = false;
|
||||
_global;
|
||||
_immediates;
|
||||
_maxLoops;
|
||||
_moduleMocker;
|
||||
_now;
|
||||
_ticks;
|
||||
_timerAPIs;
|
||||
_timers;
|
||||
_uuidCounter;
|
||||
_timerConfig;
|
||||
constructor({global, moduleMocker, timerConfig, config, maxLoops}) {
|
||||
this._global = global;
|
||||
this._timerConfig = timerConfig;
|
||||
this._config = config;
|
||||
this._maxLoops = maxLoops || 100000;
|
||||
this._uuidCounter = 1;
|
||||
this._moduleMocker = moduleMocker;
|
||||
|
||||
// Store original timer APIs for future reference
|
||||
this._timerAPIs = {
|
||||
cancelAnimationFrame: global.cancelAnimationFrame,
|
||||
clearImmediate: global.clearImmediate,
|
||||
clearInterval: global.clearInterval,
|
||||
clearTimeout: global.clearTimeout,
|
||||
nextTick: global.process && global.process.nextTick,
|
||||
requestAnimationFrame: global.requestAnimationFrame,
|
||||
setImmediate: global.setImmediate,
|
||||
setInterval: global.setInterval,
|
||||
setTimeout: global.setTimeout
|
||||
};
|
||||
this._disposed = false;
|
||||
this.reset();
|
||||
}
|
||||
clearAllTimers() {
|
||||
this._immediates = [];
|
||||
this._timers.clear();
|
||||
}
|
||||
dispose() {
|
||||
this._disposed = true;
|
||||
this.clearAllTimers();
|
||||
}
|
||||
reset() {
|
||||
this._cancelledTicks = {};
|
||||
this._now = 0;
|
||||
this._ticks = [];
|
||||
this._immediates = [];
|
||||
this._timers = new Map();
|
||||
}
|
||||
now() {
|
||||
if (this._fakingTime) {
|
||||
return this._now;
|
||||
}
|
||||
return Date.now();
|
||||
}
|
||||
runAllTicks() {
|
||||
this._checkFakeTimers();
|
||||
// Only run a generous number of ticks and then bail.
|
||||
// This is just to help avoid recursive loops
|
||||
let i;
|
||||
for (i = 0; i < this._maxLoops; i++) {
|
||||
const tick = this._ticks.shift();
|
||||
if (tick === undefined) {
|
||||
break;
|
||||
}
|
||||
if (
|
||||
!Object.prototype.hasOwnProperty.call(this._cancelledTicks, tick.uuid)
|
||||
) {
|
||||
// Callback may throw, so update the map prior calling.
|
||||
this._cancelledTicks[tick.uuid] = true;
|
||||
tick.callback();
|
||||
}
|
||||
}
|
||||
if (i === this._maxLoops) {
|
||||
throw new Error(
|
||||
`Ran ${this._maxLoops} ticks, and there are still more! ` +
|
||||
"Assuming we've hit an infinite recursion and bailing out..."
|
||||
);
|
||||
}
|
||||
}
|
||||
runAllImmediates() {
|
||||
this._checkFakeTimers();
|
||||
// Only run a generous number of immediates and then bail.
|
||||
let i;
|
||||
for (i = 0; i < this._maxLoops; i++) {
|
||||
const immediate = this._immediates.shift();
|
||||
if (immediate === undefined) {
|
||||
break;
|
||||
}
|
||||
this._runImmediate(immediate);
|
||||
}
|
||||
if (i === this._maxLoops) {
|
||||
throw new Error(
|
||||
`Ran ${this._maxLoops} immediates, and there are still more! Assuming ` +
|
||||
"we've hit an infinite recursion and bailing out..."
|
||||
);
|
||||
}
|
||||
}
|
||||
_runImmediate(immediate) {
|
||||
try {
|
||||
immediate.callback();
|
||||
} finally {
|
||||
this._fakeClearImmediate(immediate.uuid);
|
||||
}
|
||||
}
|
||||
runAllTimers() {
|
||||
this._checkFakeTimers();
|
||||
this.runAllTicks();
|
||||
this.runAllImmediates();
|
||||
|
||||
// Only run a generous number of timers and then bail.
|
||||
// This is just to help avoid recursive loops
|
||||
let i;
|
||||
for (i = 0; i < this._maxLoops; i++) {
|
||||
const nextTimerHandleAndExpiry = this._getNextTimerHandleAndExpiry();
|
||||
|
||||
// If there are no more timer handles, stop!
|
||||
if (nextTimerHandleAndExpiry === null) {
|
||||
break;
|
||||
}
|
||||
const [nextTimerHandle, expiry] = nextTimerHandleAndExpiry;
|
||||
this._now = expiry;
|
||||
this._runTimerHandle(nextTimerHandle);
|
||||
|
||||
// Some of the immediate calls could be enqueued
|
||||
// during the previous handling of the timers, we should
|
||||
// run them as well.
|
||||
if (this._immediates.length) {
|
||||
this.runAllImmediates();
|
||||
}
|
||||
if (this._ticks.length) {
|
||||
this.runAllTicks();
|
||||
}
|
||||
}
|
||||
if (i === this._maxLoops) {
|
||||
throw new Error(
|
||||
`Ran ${this._maxLoops} timers, and there are still more! ` +
|
||||
"Assuming we've hit an infinite recursion and bailing out..."
|
||||
);
|
||||
}
|
||||
}
|
||||
runOnlyPendingTimers() {
|
||||
// We need to hold the current shape of `this._timers` because existing
|
||||
// timers can add new ones to the map and hence would run more than necessary.
|
||||
// See https://github.com/jestjs/jest/pull/4608 for details
|
||||
const timerEntries = Array.from(this._timers.entries());
|
||||
this._checkFakeTimers();
|
||||
this._immediates.forEach(this._runImmediate, this);
|
||||
timerEntries
|
||||
.sort(([, left], [, right]) => left.expiry - right.expiry)
|
||||
.forEach(([timerHandle, timer]) => {
|
||||
this._now = timer.expiry;
|
||||
this._runTimerHandle(timerHandle);
|
||||
});
|
||||
}
|
||||
advanceTimersToNextTimer(steps = 1) {
|
||||
if (steps < 1) {
|
||||
return;
|
||||
}
|
||||
const nextExpiry = Array.from(this._timers.values()).reduce(
|
||||
(minExpiry, timer) => {
|
||||
if (minExpiry === null || timer.expiry < minExpiry) return timer.expiry;
|
||||
return minExpiry;
|
||||
},
|
||||
null
|
||||
);
|
||||
if (nextExpiry !== null) {
|
||||
this.advanceTimersByTime(nextExpiry - this._now);
|
||||
this.advanceTimersToNextTimer(steps - 1);
|
||||
}
|
||||
}
|
||||
advanceTimersByTime(msToRun) {
|
||||
this._checkFakeTimers();
|
||||
// Only run a generous number of timers and then bail.
|
||||
// This is just to help avoid recursive loops
|
||||
let i;
|
||||
for (i = 0; i < this._maxLoops; i++) {
|
||||
const timerHandleAndExpiry = this._getNextTimerHandleAndExpiry();
|
||||
|
||||
// If there are no more timer handles, stop!
|
||||
if (timerHandleAndExpiry === null) {
|
||||
break;
|
||||
}
|
||||
const [timerHandle, nextTimerExpiry] = timerHandleAndExpiry;
|
||||
if (this._now + msToRun < nextTimerExpiry) {
|
||||
// There are no timers between now and the target we're running to
|
||||
break;
|
||||
} else {
|
||||
msToRun -= nextTimerExpiry - this._now;
|
||||
this._now = nextTimerExpiry;
|
||||
this._runTimerHandle(timerHandle);
|
||||
}
|
||||
}
|
||||
|
||||
// Advance the clock by whatever time we still have left to run
|
||||
this._now += msToRun;
|
||||
if (i === this._maxLoops) {
|
||||
throw new Error(
|
||||
`Ran ${this._maxLoops} timers, and there are still more! ` +
|
||||
"Assuming we've hit an infinite recursion and bailing out..."
|
||||
);
|
||||
}
|
||||
}
|
||||
runWithRealTimers(cb) {
|
||||
const prevClearImmediate = this._global.clearImmediate;
|
||||
const prevClearInterval = this._global.clearInterval;
|
||||
const prevClearTimeout = this._global.clearTimeout;
|
||||
const prevNextTick = this._global.process.nextTick;
|
||||
const prevSetImmediate = this._global.setImmediate;
|
||||
const prevSetInterval = this._global.setInterval;
|
||||
const prevSetTimeout = this._global.setTimeout;
|
||||
this.useRealTimers();
|
||||
let cbErr = null;
|
||||
let errThrown = false;
|
||||
try {
|
||||
cb();
|
||||
} catch (e) {
|
||||
errThrown = true;
|
||||
cbErr = e;
|
||||
}
|
||||
this._global.clearImmediate = prevClearImmediate;
|
||||
this._global.clearInterval = prevClearInterval;
|
||||
this._global.clearTimeout = prevClearTimeout;
|
||||
this._global.process.nextTick = prevNextTick;
|
||||
this._global.setImmediate = prevSetImmediate;
|
||||
this._global.setInterval = prevSetInterval;
|
||||
this._global.setTimeout = prevSetTimeout;
|
||||
if (errThrown) {
|
||||
throw cbErr;
|
||||
}
|
||||
}
|
||||
useRealTimers() {
|
||||
const global = this._global;
|
||||
if (typeof global.cancelAnimationFrame === 'function') {
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'cancelAnimationFrame',
|
||||
this._timerAPIs.cancelAnimationFrame
|
||||
);
|
||||
}
|
||||
if (typeof global.clearImmediate === 'function') {
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'clearImmediate',
|
||||
this._timerAPIs.clearImmediate
|
||||
);
|
||||
}
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'clearInterval',
|
||||
this._timerAPIs.clearInterval
|
||||
);
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'clearTimeout',
|
||||
this._timerAPIs.clearTimeout
|
||||
);
|
||||
if (typeof global.requestAnimationFrame === 'function') {
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'requestAnimationFrame',
|
||||
this._timerAPIs.requestAnimationFrame
|
||||
);
|
||||
}
|
||||
if (typeof global.setImmediate === 'function') {
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'setImmediate',
|
||||
this._timerAPIs.setImmediate
|
||||
);
|
||||
}
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'setInterval',
|
||||
this._timerAPIs.setInterval
|
||||
);
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'setTimeout',
|
||||
this._timerAPIs.setTimeout
|
||||
);
|
||||
global.process.nextTick = this._timerAPIs.nextTick;
|
||||
this._fakingTime = false;
|
||||
}
|
||||
useFakeTimers() {
|
||||
this._createMocks();
|
||||
const global = this._global;
|
||||
if (typeof global.cancelAnimationFrame === 'function') {
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'cancelAnimationFrame',
|
||||
this._fakeTimerAPIs.cancelAnimationFrame
|
||||
);
|
||||
}
|
||||
if (typeof global.clearImmediate === 'function') {
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'clearImmediate',
|
||||
this._fakeTimerAPIs.clearImmediate
|
||||
);
|
||||
}
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'clearInterval',
|
||||
this._fakeTimerAPIs.clearInterval
|
||||
);
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'clearTimeout',
|
||||
this._fakeTimerAPIs.clearTimeout
|
||||
);
|
||||
if (typeof global.requestAnimationFrame === 'function') {
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'requestAnimationFrame',
|
||||
this._fakeTimerAPIs.requestAnimationFrame
|
||||
);
|
||||
}
|
||||
if (typeof global.setImmediate === 'function') {
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'setImmediate',
|
||||
this._fakeTimerAPIs.setImmediate
|
||||
);
|
||||
}
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'setInterval',
|
||||
this._fakeTimerAPIs.setInterval
|
||||
);
|
||||
(0, _jestUtil().setGlobal)(
|
||||
global,
|
||||
'setTimeout',
|
||||
this._fakeTimerAPIs.setTimeout
|
||||
);
|
||||
global.process.nextTick = this._fakeTimerAPIs.nextTick;
|
||||
this._fakingTime = true;
|
||||
}
|
||||
getTimerCount() {
|
||||
this._checkFakeTimers();
|
||||
return this._timers.size + this._immediates.length + this._ticks.length;
|
||||
}
|
||||
_checkFakeTimers() {
|
||||
if (!this._fakingTime) {
|
||||
this._global.console.warn(
|
||||
'A function to advance timers was called but the timers APIs are not mocked ' +
|
||||
'with fake timers. Call `jest.useFakeTimers({legacyFakeTimers: true})` ' +
|
||||
'in this test file or enable fake timers for all tests by setting ' +
|
||||
"{'enableGlobally': true, 'legacyFakeTimers': true} in " +
|
||||
`Jest configuration file.\nStack Trace:\n${(0,
|
||||
_jestMessageUtil().formatStackTrace)(
|
||||
new Error().stack,
|
||||
this._config,
|
||||
{
|
||||
noStackTrace: false
|
||||
}
|
||||
)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
_createMocks() {
|
||||
const fn = implementation => this._moduleMocker.fn(implementation);
|
||||
const promisifiableFakeSetTimeout = fn(this._fakeSetTimeout.bind(this));
|
||||
// @ts-expect-error: no index
|
||||
promisifiableFakeSetTimeout[_util().promisify.custom] = (delay, arg) =>
|
||||
new Promise(resolve => promisifiableFakeSetTimeout(resolve, delay, arg));
|
||||
this._fakeTimerAPIs = {
|
||||
cancelAnimationFrame: fn(this._fakeClearTimer.bind(this)),
|
||||
clearImmediate: fn(this._fakeClearImmediate.bind(this)),
|
||||
clearInterval: fn(this._fakeClearTimer.bind(this)),
|
||||
clearTimeout: fn(this._fakeClearTimer.bind(this)),
|
||||
nextTick: fn(this._fakeNextTick.bind(this)),
|
||||
requestAnimationFrame: fn(this._fakeRequestAnimationFrame.bind(this)),
|
||||
setImmediate: fn(this._fakeSetImmediate.bind(this)),
|
||||
setInterval: fn(this._fakeSetInterval.bind(this)),
|
||||
setTimeout: promisifiableFakeSetTimeout
|
||||
};
|
||||
}
|
||||
_fakeClearTimer(timerRef) {
|
||||
const uuid = this._timerConfig.refToId(timerRef);
|
||||
if (uuid) {
|
||||
this._timers.delete(String(uuid));
|
||||
}
|
||||
}
|
||||
_fakeClearImmediate(uuid) {
|
||||
this._immediates = this._immediates.filter(
|
||||
immediate => immediate.uuid !== uuid
|
||||
);
|
||||
}
|
||||
_fakeNextTick(callback, ...args) {
|
||||
if (this._disposed) {
|
||||
return;
|
||||
}
|
||||
const uuid = String(this._uuidCounter++);
|
||||
this._ticks.push({
|
||||
callback: () => callback.apply(null, args),
|
||||
uuid
|
||||
});
|
||||
const cancelledTicks = this._cancelledTicks;
|
||||
this._timerAPIs.nextTick(() => {
|
||||
if (!Object.prototype.hasOwnProperty.call(cancelledTicks, uuid)) {
|
||||
// Callback may throw, so update the map prior calling.
|
||||
cancelledTicks[uuid] = true;
|
||||
callback.apply(null, args);
|
||||
}
|
||||
});
|
||||
}
|
||||
_fakeRequestAnimationFrame(callback) {
|
||||
return this._fakeSetTimeout(() => {
|
||||
// TODO: Use performance.now() once it's mocked
|
||||
callback(this._now);
|
||||
}, 1000 / 60);
|
||||
}
|
||||
_fakeSetImmediate(callback, ...args) {
|
||||
if (this._disposed) {
|
||||
return null;
|
||||
}
|
||||
const uuid = String(this._uuidCounter++);
|
||||
this._immediates.push({
|
||||
callback: () => callback.apply(null, args),
|
||||
uuid
|
||||
});
|
||||
this._timerAPIs.setImmediate(() => {
|
||||
if (!this._disposed) {
|
||||
if (this._immediates.find(x => x.uuid === uuid)) {
|
||||
try {
|
||||
callback.apply(null, args);
|
||||
} finally {
|
||||
this._fakeClearImmediate(uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return uuid;
|
||||
}
|
||||
_fakeSetInterval(callback, intervalDelay, ...args) {
|
||||
if (this._disposed) {
|
||||
return null;
|
||||
}
|
||||
if (intervalDelay == null) {
|
||||
intervalDelay = 0;
|
||||
}
|
||||
const uuid = this._uuidCounter++;
|
||||
this._timers.set(String(uuid), {
|
||||
callback: () => callback.apply(null, args),
|
||||
expiry: this._now + intervalDelay,
|
||||
interval: intervalDelay,
|
||||
type: 'interval'
|
||||
});
|
||||
return this._timerConfig.idToRef(uuid);
|
||||
}
|
||||
_fakeSetTimeout(callback, delay, ...args) {
|
||||
if (this._disposed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-bitwise
|
||||
delay = Number(delay) | 0;
|
||||
const uuid = this._uuidCounter++;
|
||||
this._timers.set(String(uuid), {
|
||||
callback: () => callback.apply(null, args),
|
||||
expiry: this._now + delay,
|
||||
interval: undefined,
|
||||
type: 'timeout'
|
||||
});
|
||||
return this._timerConfig.idToRef(uuid);
|
||||
}
|
||||
_getNextTimerHandleAndExpiry() {
|
||||
let nextTimerHandle = null;
|
||||
let soonestTime = MS_IN_A_YEAR;
|
||||
this._timers.forEach((timer, uuid) => {
|
||||
if (timer.expiry < soonestTime) {
|
||||
soonestTime = timer.expiry;
|
||||
nextTimerHandle = uuid;
|
||||
}
|
||||
});
|
||||
if (nextTimerHandle === null) {
|
||||
return null;
|
||||
}
|
||||
return [nextTimerHandle, soonestTime];
|
||||
}
|
||||
_runTimerHandle(timerHandle) {
|
||||
const timer = this._timers.get(timerHandle);
|
||||
if (!timer) {
|
||||
// Timer has been cleared - we'll hit this when a timer is cleared within
|
||||
// another timer in runOnlyPendingTimers
|
||||
return;
|
||||
}
|
||||
switch (timer.type) {
|
||||
case 'timeout':
|
||||
this._timers.delete(timerHandle);
|
||||
timer.callback();
|
||||
break;
|
||||
case 'interval':
|
||||
timer.expiry = this._now + (timer.interval || 0);
|
||||
timer.callback();
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unexpected timer type: ${timer.type}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.default = FakeTimers;
|
||||
0
unified-ai-platform/node_modules/@jest/fake-timers/build/modernFakeTimers.js
generated
vendored
Normal file
0
unified-ai-platform/node_modules/@jest/fake-timers/build/modernFakeTimers.js
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/globals/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/globals/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and 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.
|
||||
71
unified-ai-platform/node_modules/@jest/globals/build/index.d.ts
generated
vendored
Normal file
71
unified-ai-platform/node_modules/@jest/globals/build/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import type { Jest } from '@jest/environment';
|
||||
import type { JestExpect } from '@jest/expect';
|
||||
import type { Global } from '@jest/types';
|
||||
import type { ClassLike, FunctionLike, Mock as JestMock, Mocked as JestMocked, MockedClass as JestMockedClass, MockedFunction as JestMockedFunction, MockedObject as JestMockedObject, Replaced as JestReplaced, Spied as JestSpied, SpiedClass as JestSpiedClass, SpiedFunction as JestSpiedFunction, SpiedGetter as JestSpiedGetter, SpiedSetter as JestSpiedSetter, UnknownFunction } from 'jest-mock';
|
||||
export declare const expect: JestExpect;
|
||||
export declare const it: Global.GlobalAdditions['it'];
|
||||
export declare const test: Global.GlobalAdditions['test'];
|
||||
export declare const fit: Global.GlobalAdditions['fit'];
|
||||
export declare const xit: Global.GlobalAdditions['xit'];
|
||||
export declare const xtest: Global.GlobalAdditions['xtest'];
|
||||
export declare const describe: Global.GlobalAdditions['describe'];
|
||||
export declare const xdescribe: Global.GlobalAdditions['xdescribe'];
|
||||
export declare const fdescribe: Global.GlobalAdditions['fdescribe'];
|
||||
export declare const beforeAll: Global.GlobalAdditions['beforeAll'];
|
||||
export declare const beforeEach: Global.GlobalAdditions['beforeEach'];
|
||||
export declare const afterEach: Global.GlobalAdditions['afterEach'];
|
||||
export declare const afterAll: Global.GlobalAdditions['afterAll'];
|
||||
declare const jest: Jest;
|
||||
declare namespace jest {
|
||||
/**
|
||||
* Constructs the type of a mock function, e.g. the return type of `jest.fn()`.
|
||||
*/
|
||||
type Mock<T extends FunctionLike = UnknownFunction> = JestMock<T>;
|
||||
/**
|
||||
* Wraps a class, function or object type with Jest mock type definitions.
|
||||
*/
|
||||
type Mocked<T extends object> = JestMocked<T>;
|
||||
/**
|
||||
* Wraps a class type with Jest mock type definitions.
|
||||
*/
|
||||
type MockedClass<T extends ClassLike> = JestMockedClass<T>;
|
||||
/**
|
||||
* Wraps a function type with Jest mock type definitions.
|
||||
*/
|
||||
type MockedFunction<T extends FunctionLike> = JestMockedFunction<T>;
|
||||
/**
|
||||
* Wraps an object type with Jest mock type definitions.
|
||||
*/
|
||||
type MockedObject<T extends object> = JestMockedObject<T>;
|
||||
/**
|
||||
* Constructs the type of a replaced property.
|
||||
*/
|
||||
type Replaced<T> = JestReplaced<T>;
|
||||
/**
|
||||
* Constructs the type of a spied class or function.
|
||||
*/
|
||||
type Spied<T extends ClassLike | FunctionLike> = JestSpied<T>;
|
||||
/**
|
||||
* Constructs the type of a spied class.
|
||||
*/
|
||||
type SpiedClass<T extends ClassLike> = JestSpiedClass<T>;
|
||||
/**
|
||||
* Constructs the type of a spied function.
|
||||
*/
|
||||
type SpiedFunction<T extends FunctionLike> = JestSpiedFunction<T>;
|
||||
/**
|
||||
* Constructs the type of a spied getter.
|
||||
*/
|
||||
type SpiedGetter<T> = JestSpiedGetter<T>;
|
||||
/**
|
||||
* Constructs the type of a spied setter.
|
||||
*/
|
||||
type SpiedSetter<T> = JestSpiedSetter<T>;
|
||||
}
|
||||
export { jest };
|
||||
14
unified-ai-platform/node_modules/@jest/globals/build/index.js
generated
vendored
Normal file
14
unified-ai-platform/node_modules/@jest/globals/build/index.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
|
||||
throw new Error(
|
||||
'Do not import `@jest/globals` outside of the Jest test environment'
|
||||
);
|
||||
32
unified-ai-platform/node_modules/@jest/globals/package.json
generated
vendored
Normal file
32
unified-ai-platform/node_modules/@jest/globals/package.json
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "@jest/globals",
|
||||
"version": "29.7.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-globals"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
},
|
||||
"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/environment": "^29.7.0",
|
||||
"@jest/expect": "^29.7.0",
|
||||
"@jest/types": "^29.6.3",
|
||||
"jest-mock": "^29.7.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
|
||||
}
|
||||
21
unified-ai-platform/node_modules/@jest/reporters/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/reporters/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and 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.
|
||||
48
unified-ai-platform/node_modules/@jest/reporters/build/BaseReporter.js
generated
vendored
Normal file
48
unified-ai-platform/node_modules/@jest/reporters/build/BaseReporter.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const {remove: preRunMessageRemove} = _jestUtil().preRunMessage;
|
||||
class BaseReporter {
|
||||
_error;
|
||||
log(message) {
|
||||
process.stderr.write(`${message}\n`);
|
||||
}
|
||||
onRunStart(_results, _options) {
|
||||
preRunMessageRemove(process.stderr);
|
||||
}
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
onTestCaseResult(_test, _testCaseResult) {}
|
||||
onTestResult(_test, _testResult, _results) {}
|
||||
onTestStart(_test) {}
|
||||
onRunComplete(_testContexts, _aggregatedResults) {}
|
||||
/* eslint-enable */
|
||||
|
||||
_setError(error) {
|
||||
this._error = error;
|
||||
}
|
||||
|
||||
// Return an error that occurred during reporting. This error will
|
||||
// define whether the test run was successful or failed.
|
||||
getLastError() {
|
||||
return this._error;
|
||||
}
|
||||
}
|
||||
exports.default = BaseReporter;
|
||||
561
unified-ai-platform/node_modules/@jest/reporters/build/CoverageReporter.js
generated
vendored
Normal file
561
unified-ai-platform/node_modules/@jest/reporters/build/CoverageReporter.js
generated
vendored
Normal file
@@ -0,0 +1,561 @@
|
||||
'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 _v8Coverage() {
|
||||
const data = require('@bcoe/v8-coverage');
|
||||
_v8Coverage = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _glob() {
|
||||
const data = _interopRequireDefault(require('glob'));
|
||||
_glob = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function fs() {
|
||||
const data = _interopRequireWildcard(require('graceful-fs'));
|
||||
fs = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _istanbulLibCoverage() {
|
||||
const data = _interopRequireDefault(require('istanbul-lib-coverage'));
|
||||
_istanbulLibCoverage = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _istanbulLibReport() {
|
||||
const data = _interopRequireDefault(require('istanbul-lib-report'));
|
||||
_istanbulLibReport = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _istanbulLibSourceMaps() {
|
||||
const data = _interopRequireDefault(require('istanbul-lib-source-maps'));
|
||||
_istanbulLibSourceMaps = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _istanbulReports() {
|
||||
const data = _interopRequireDefault(require('istanbul-reports'));
|
||||
_istanbulReports = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _v8ToIstanbul() {
|
||||
const data = _interopRequireDefault(require('v8-to-istanbul'));
|
||||
_v8ToIstanbul = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestWorker() {
|
||||
const data = require('jest-worker');
|
||||
_jestWorker = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _BaseReporter = _interopRequireDefault(require('./BaseReporter'));
|
||||
var _getWatermarks = _interopRequireDefault(require('./getWatermarks'));
|
||||
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) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const FAIL_COLOR = _chalk().default.bold.red;
|
||||
const RUNNING_TEST_COLOR = _chalk().default.bold.dim;
|
||||
class CoverageReporter extends _BaseReporter.default {
|
||||
_context;
|
||||
_coverageMap;
|
||||
_globalConfig;
|
||||
_sourceMapStore;
|
||||
_v8CoverageResults;
|
||||
static filename = __filename;
|
||||
constructor(globalConfig, context) {
|
||||
super();
|
||||
this._context = context;
|
||||
this._coverageMap = _istanbulLibCoverage().default.createCoverageMap({});
|
||||
this._globalConfig = globalConfig;
|
||||
this._sourceMapStore =
|
||||
_istanbulLibSourceMaps().default.createSourceMapStore();
|
||||
this._v8CoverageResults = [];
|
||||
}
|
||||
onTestResult(_test, testResult) {
|
||||
if (testResult.v8Coverage) {
|
||||
this._v8CoverageResults.push(testResult.v8Coverage);
|
||||
return;
|
||||
}
|
||||
if (testResult.coverage) {
|
||||
this._coverageMap.merge(testResult.coverage);
|
||||
}
|
||||
}
|
||||
async onRunComplete(testContexts, aggregatedResults) {
|
||||
await this._addUntestedFiles(testContexts);
|
||||
const {map, reportContext} = await this._getCoverageResult();
|
||||
try {
|
||||
const coverageReporters = this._globalConfig.coverageReporters || [];
|
||||
if (!this._globalConfig.useStderr && coverageReporters.length < 1) {
|
||||
coverageReporters.push('text-summary');
|
||||
}
|
||||
coverageReporters.forEach(reporter => {
|
||||
let additionalOptions = {};
|
||||
if (Array.isArray(reporter)) {
|
||||
[reporter, additionalOptions] = reporter;
|
||||
}
|
||||
_istanbulReports()
|
||||
.default.create(reporter, {
|
||||
maxCols: process.stdout.columns || Infinity,
|
||||
...additionalOptions
|
||||
})
|
||||
.execute(reportContext);
|
||||
});
|
||||
aggregatedResults.coverageMap = map;
|
||||
} catch (e) {
|
||||
console.error(
|
||||
_chalk().default.red(`
|
||||
Failed to write coverage reports:
|
||||
ERROR: ${e.toString()}
|
||||
STACK: ${e.stack}
|
||||
`)
|
||||
);
|
||||
}
|
||||
this._checkThreshold(map);
|
||||
}
|
||||
async _addUntestedFiles(testContexts) {
|
||||
const files = [];
|
||||
testContexts.forEach(context => {
|
||||
const config = context.config;
|
||||
if (
|
||||
this._globalConfig.collectCoverageFrom &&
|
||||
this._globalConfig.collectCoverageFrom.length
|
||||
) {
|
||||
context.hasteFS
|
||||
.matchFilesWithGlob(
|
||||
this._globalConfig.collectCoverageFrom,
|
||||
config.rootDir
|
||||
)
|
||||
.forEach(filePath =>
|
||||
files.push({
|
||||
config,
|
||||
path: filePath
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
if (!files.length) {
|
||||
return;
|
||||
}
|
||||
if (_jestUtil().isInteractive) {
|
||||
process.stderr.write(
|
||||
RUNNING_TEST_COLOR('Running coverage on untested files...')
|
||||
);
|
||||
}
|
||||
let worker;
|
||||
if (this._globalConfig.maxWorkers <= 1) {
|
||||
worker = require('./CoverageWorker');
|
||||
} else {
|
||||
worker = new (_jestWorker().Worker)(require.resolve('./CoverageWorker'), {
|
||||
enableWorkerThreads: this._globalConfig.workerThreads,
|
||||
exposedMethods: ['worker'],
|
||||
forkOptions: {
|
||||
serialization: 'json'
|
||||
},
|
||||
maxRetries: 2,
|
||||
numWorkers: this._globalConfig.maxWorkers
|
||||
});
|
||||
}
|
||||
const instrumentation = files.map(async fileObj => {
|
||||
const filename = fileObj.path;
|
||||
const config = fileObj.config;
|
||||
const hasCoverageData = this._v8CoverageResults.some(v8Res =>
|
||||
v8Res.some(innerRes => innerRes.result.url === filename)
|
||||
);
|
||||
if (
|
||||
!hasCoverageData &&
|
||||
!this._coverageMap.data[filename] &&
|
||||
'worker' in worker
|
||||
) {
|
||||
try {
|
||||
const result = await worker.worker({
|
||||
config,
|
||||
context: {
|
||||
changedFiles:
|
||||
this._context.changedFiles &&
|
||||
Array.from(this._context.changedFiles),
|
||||
sourcesRelatedToTestsInChangedFiles:
|
||||
this._context.sourcesRelatedToTestsInChangedFiles &&
|
||||
Array.from(this._context.sourcesRelatedToTestsInChangedFiles)
|
||||
},
|
||||
globalConfig: this._globalConfig,
|
||||
path: filename
|
||||
});
|
||||
if (result) {
|
||||
if (result.kind === 'V8Coverage') {
|
||||
this._v8CoverageResults.push([
|
||||
{
|
||||
codeTransformResult: undefined,
|
||||
result: result.result
|
||||
}
|
||||
]);
|
||||
} else {
|
||||
this._coverageMap.addFileCoverage(result.coverage);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(
|
||||
_chalk().default.red(
|
||||
[
|
||||
`Failed to collect coverage from ${filename}`,
|
||||
`ERROR: ${error.message}`,
|
||||
`STACK: ${error.stack}`
|
||||
].join('\n')
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
try {
|
||||
await Promise.all(instrumentation);
|
||||
} catch {
|
||||
// Do nothing; errors were reported earlier to the console.
|
||||
}
|
||||
if (_jestUtil().isInteractive) {
|
||||
(0, _jestUtil().clearLine)(process.stderr);
|
||||
}
|
||||
if (worker && 'end' in worker && typeof worker.end === 'function') {
|
||||
await worker.end();
|
||||
}
|
||||
}
|
||||
_checkThreshold(map) {
|
||||
const {coverageThreshold} = this._globalConfig;
|
||||
if (coverageThreshold) {
|
||||
function check(name, thresholds, actuals) {
|
||||
return ['statements', 'branches', 'lines', 'functions'].reduce(
|
||||
(errors, key) => {
|
||||
const actual = actuals[key].pct;
|
||||
const actualUncovered = actuals[key].total - actuals[key].covered;
|
||||
const threshold = thresholds[key];
|
||||
if (threshold !== undefined) {
|
||||
if (threshold < 0) {
|
||||
if (threshold * -1 < actualUncovered) {
|
||||
errors.push(
|
||||
`Jest: Uncovered count for ${key} (${actualUncovered}) ` +
|
||||
`exceeds ${name} threshold (${-1 * threshold})`
|
||||
);
|
||||
}
|
||||
} else if (actual < threshold) {
|
||||
errors.push(
|
||||
`Jest: "${name}" coverage threshold for ${key} (${threshold}%) not met: ${actual}%`
|
||||
);
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
},
|
||||
[]
|
||||
);
|
||||
}
|
||||
const THRESHOLD_GROUP_TYPES = {
|
||||
GLOB: 'glob',
|
||||
GLOBAL: 'global',
|
||||
PATH: 'path'
|
||||
};
|
||||
const coveredFiles = map.files();
|
||||
const thresholdGroups = Object.keys(coverageThreshold);
|
||||
const groupTypeByThresholdGroup = {};
|
||||
const filesByGlob = {};
|
||||
const coveredFilesSortedIntoThresholdGroup = coveredFiles.reduce(
|
||||
(files, file) => {
|
||||
const pathOrGlobMatches = thresholdGroups.reduce(
|
||||
(agg, thresholdGroup) => {
|
||||
// Preserve trailing slash, but not required if root dir
|
||||
// See https://github.com/jestjs/jest/issues/12703
|
||||
const resolvedThresholdGroup = path().resolve(thresholdGroup);
|
||||
const suffix =
|
||||
(thresholdGroup.endsWith(path().sep) ||
|
||||
(process.platform === 'win32' &&
|
||||
thresholdGroup.endsWith('/'))) &&
|
||||
!resolvedThresholdGroup.endsWith(path().sep)
|
||||
? path().sep
|
||||
: '';
|
||||
const absoluteThresholdGroup = `${resolvedThresholdGroup}${suffix}`;
|
||||
|
||||
// The threshold group might be a path:
|
||||
|
||||
if (file.indexOf(absoluteThresholdGroup) === 0) {
|
||||
groupTypeByThresholdGroup[thresholdGroup] =
|
||||
THRESHOLD_GROUP_TYPES.PATH;
|
||||
return agg.concat([[file, thresholdGroup]]);
|
||||
}
|
||||
|
||||
// If the threshold group is not a path it might be a glob:
|
||||
|
||||
// Note: glob.sync is slow. By memoizing the files matching each glob
|
||||
// (rather than recalculating it for each covered file) we save a tonne
|
||||
// of execution time.
|
||||
if (filesByGlob[absoluteThresholdGroup] === undefined) {
|
||||
filesByGlob[absoluteThresholdGroup] = _glob()
|
||||
.default.sync(absoluteThresholdGroup)
|
||||
.map(filePath => path().resolve(filePath));
|
||||
}
|
||||
if (filesByGlob[absoluteThresholdGroup].indexOf(file) > -1) {
|
||||
groupTypeByThresholdGroup[thresholdGroup] =
|
||||
THRESHOLD_GROUP_TYPES.GLOB;
|
||||
return agg.concat([[file, thresholdGroup]]);
|
||||
}
|
||||
return agg;
|
||||
},
|
||||
[]
|
||||
);
|
||||
if (pathOrGlobMatches.length > 0) {
|
||||
return files.concat(pathOrGlobMatches);
|
||||
}
|
||||
|
||||
// Neither a glob or a path? Toss it in global if there's a global threshold:
|
||||
if (thresholdGroups.indexOf(THRESHOLD_GROUP_TYPES.GLOBAL) > -1) {
|
||||
groupTypeByThresholdGroup[THRESHOLD_GROUP_TYPES.GLOBAL] =
|
||||
THRESHOLD_GROUP_TYPES.GLOBAL;
|
||||
return files.concat([[file, THRESHOLD_GROUP_TYPES.GLOBAL]]);
|
||||
}
|
||||
|
||||
// A covered file that doesn't have a threshold:
|
||||
return files.concat([[file, undefined]]);
|
||||
},
|
||||
[]
|
||||
);
|
||||
const getFilesInThresholdGroup = thresholdGroup =>
|
||||
coveredFilesSortedIntoThresholdGroup
|
||||
.filter(fileAndGroup => fileAndGroup[1] === thresholdGroup)
|
||||
.map(fileAndGroup => fileAndGroup[0]);
|
||||
function combineCoverage(filePaths) {
|
||||
return filePaths
|
||||
.map(filePath => map.fileCoverageFor(filePath))
|
||||
.reduce((combinedCoverage, nextFileCoverage) => {
|
||||
if (combinedCoverage === undefined || combinedCoverage === null) {
|
||||
return nextFileCoverage.toSummary();
|
||||
}
|
||||
return combinedCoverage.merge(nextFileCoverage.toSummary());
|
||||
}, undefined);
|
||||
}
|
||||
let errors = [];
|
||||
thresholdGroups.forEach(thresholdGroup => {
|
||||
switch (groupTypeByThresholdGroup[thresholdGroup]) {
|
||||
case THRESHOLD_GROUP_TYPES.GLOBAL: {
|
||||
const coverage = combineCoverage(
|
||||
getFilesInThresholdGroup(THRESHOLD_GROUP_TYPES.GLOBAL)
|
||||
);
|
||||
if (coverage) {
|
||||
errors = errors.concat(
|
||||
check(
|
||||
thresholdGroup,
|
||||
coverageThreshold[thresholdGroup],
|
||||
coverage
|
||||
)
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case THRESHOLD_GROUP_TYPES.PATH: {
|
||||
const coverage = combineCoverage(
|
||||
getFilesInThresholdGroup(thresholdGroup)
|
||||
);
|
||||
if (coverage) {
|
||||
errors = errors.concat(
|
||||
check(
|
||||
thresholdGroup,
|
||||
coverageThreshold[thresholdGroup],
|
||||
coverage
|
||||
)
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case THRESHOLD_GROUP_TYPES.GLOB:
|
||||
getFilesInThresholdGroup(thresholdGroup).forEach(
|
||||
fileMatchingGlob => {
|
||||
errors = errors.concat(
|
||||
check(
|
||||
fileMatchingGlob,
|
||||
coverageThreshold[thresholdGroup],
|
||||
map.fileCoverageFor(fileMatchingGlob).toSummary()
|
||||
)
|
||||
);
|
||||
}
|
||||
);
|
||||
break;
|
||||
default:
|
||||
// If the file specified by path is not found, error is returned.
|
||||
if (thresholdGroup !== THRESHOLD_GROUP_TYPES.GLOBAL) {
|
||||
errors = errors.concat(
|
||||
`Jest: Coverage data for ${thresholdGroup} was not found.`
|
||||
);
|
||||
}
|
||||
// Sometimes all files in the coverage data are matched by
|
||||
// PATH and GLOB threshold groups in which case, don't error when
|
||||
// the global threshold group doesn't match any files.
|
||||
}
|
||||
});
|
||||
|
||||
errors = errors.filter(
|
||||
err => err !== undefined && err !== null && err.length > 0
|
||||
);
|
||||
if (errors.length > 0) {
|
||||
this.log(`${FAIL_COLOR(errors.join('\n'))}`);
|
||||
this._setError(new Error(errors.join('\n')));
|
||||
}
|
||||
}
|
||||
}
|
||||
async _getCoverageResult() {
|
||||
if (this._globalConfig.coverageProvider === 'v8') {
|
||||
const mergedCoverages = (0, _v8Coverage().mergeProcessCovs)(
|
||||
this._v8CoverageResults.map(cov => ({
|
||||
result: cov.map(r => r.result)
|
||||
}))
|
||||
);
|
||||
const fileTransforms = new Map();
|
||||
this._v8CoverageResults.forEach(res =>
|
||||
res.forEach(r => {
|
||||
if (r.codeTransformResult && !fileTransforms.has(r.result.url)) {
|
||||
fileTransforms.set(r.result.url, r.codeTransformResult);
|
||||
}
|
||||
})
|
||||
);
|
||||
const transformedCoverage = await Promise.all(
|
||||
mergedCoverages.result.map(async res => {
|
||||
const fileTransform = fileTransforms.get(res.url);
|
||||
let sourcemapContent = undefined;
|
||||
if (
|
||||
fileTransform?.sourceMapPath &&
|
||||
fs().existsSync(fileTransform.sourceMapPath)
|
||||
) {
|
||||
sourcemapContent = JSON.parse(
|
||||
fs().readFileSync(fileTransform.sourceMapPath, 'utf8')
|
||||
);
|
||||
}
|
||||
const converter = (0, _v8ToIstanbul().default)(
|
||||
res.url,
|
||||
fileTransform?.wrapperLength ?? 0,
|
||||
fileTransform && sourcemapContent
|
||||
? {
|
||||
originalSource: fileTransform.originalCode,
|
||||
source: fileTransform.code,
|
||||
sourceMap: {
|
||||
sourcemap: {
|
||||
file: res.url,
|
||||
...sourcemapContent
|
||||
}
|
||||
}
|
||||
}
|
||||
: {
|
||||
source: fs().readFileSync(res.url, 'utf8')
|
||||
}
|
||||
);
|
||||
await converter.load();
|
||||
converter.applyCoverage(res.functions);
|
||||
const istanbulData = converter.toIstanbul();
|
||||
return istanbulData;
|
||||
})
|
||||
);
|
||||
const map = _istanbulLibCoverage().default.createCoverageMap({});
|
||||
transformedCoverage.forEach(res => map.merge(res));
|
||||
const reportContext = _istanbulLibReport().default.createContext({
|
||||
coverageMap: map,
|
||||
dir: this._globalConfig.coverageDirectory,
|
||||
watermarks: (0, _getWatermarks.default)(this._globalConfig)
|
||||
});
|
||||
return {
|
||||
map,
|
||||
reportContext
|
||||
};
|
||||
}
|
||||
const map = await this._sourceMapStore.transformCoverage(this._coverageMap);
|
||||
const reportContext = _istanbulLibReport().default.createContext({
|
||||
coverageMap: map,
|
||||
dir: this._globalConfig.coverageDirectory,
|
||||
sourceFinder: this._sourceMapStore.sourceFinder,
|
||||
watermarks: (0, _getWatermarks.default)(this._globalConfig)
|
||||
});
|
||||
return {
|
||||
map,
|
||||
reportContext
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.default = CoverageReporter;
|
||||
21
unified-ai-platform/node_modules/@jest/reporters/node_modules/brace-expansion/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/reporters/node_modules/brace-expansion/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||
129
unified-ai-platform/node_modules/@jest/reporters/node_modules/brace-expansion/README.md
generated
vendored
Normal file
129
unified-ai-platform/node_modules/@jest/reporters/node_modules/brace-expansion/README.md
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
# brace-expansion
|
||||
|
||||
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
|
||||
as known from sh/bash, in JavaScript.
|
||||
|
||||
[](http://travis-ci.org/juliangruber/brace-expansion)
|
||||
[](https://www.npmjs.org/package/brace-expansion)
|
||||
[](https://greenkeeper.io/)
|
||||
|
||||
[](https://ci.testling.com/juliangruber/brace-expansion)
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
|
||||
expand('file-{a,b,c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('-v{,,}')
|
||||
// => ['-v', '-v', '-v']
|
||||
|
||||
expand('file{0..2}.jpg')
|
||||
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
|
||||
|
||||
expand('file-{a..c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('file{2..0}.jpg')
|
||||
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
|
||||
|
||||
expand('file{0..4..2}.jpg')
|
||||
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
|
||||
|
||||
expand('file-{a..e..2}.jpg')
|
||||
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
|
||||
|
||||
expand('file{00..10..5}.jpg')
|
||||
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
|
||||
|
||||
expand('{{A..C},{a..c}}')
|
||||
// => ['A', 'B', 'C', 'a', 'b', 'c']
|
||||
|
||||
expand('ppp{,config,oe{,conf}}')
|
||||
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
```
|
||||
|
||||
### var expanded = expand(str)
|
||||
|
||||
Return an array of all possible and valid expansions of `str`. If none are
|
||||
found, `[str]` is returned.
|
||||
|
||||
Valid expansions are:
|
||||
|
||||
```js
|
||||
/^(.*,)+(.+)?$/
|
||||
// {a,b,...}
|
||||
```
|
||||
|
||||
A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
A numeric sequence from `x` to `y` inclusive, with optional increment.
|
||||
If `x` or `y` start with a leading `0`, all the numbers will be padded
|
||||
to have equal length. Negative numbers and backwards iteration work too.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
An alphabetic sequence from `x` to `y` inclusive, with optional increment.
|
||||
`x` and `y` must be exactly one character, and if given, `incr` must be a
|
||||
number.
|
||||
|
||||
For compatibility reasons, the string `${` is not eligible for brace expansion.
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```bash
|
||||
npm install brace-expansion
|
||||
```
|
||||
|
||||
## Contributors
|
||||
|
||||
- [Julian Gruber](https://github.com/juliangruber)
|
||||
- [Isaac Z. Schlueter](https://github.com/isaacs)
|
||||
|
||||
## Sponsors
|
||||
|
||||
This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
|
||||
|
||||
Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||
201
unified-ai-platform/node_modules/@jest/reporters/node_modules/brace-expansion/index.js
generated
vendored
Normal file
201
unified-ai-platform/node_modules/@jest/reporters/node_modules/brace-expansion/index.js
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
var concatMap = require('concat-map');
|
||||
var balanced = require('balanced-match');
|
||||
|
||||
module.exports = expandTop;
|
||||
|
||||
var escSlash = '\0SLASH'+Math.random()+'\0';
|
||||
var escOpen = '\0OPEN'+Math.random()+'\0';
|
||||
var escClose = '\0CLOSE'+Math.random()+'\0';
|
||||
var escComma = '\0COMMA'+Math.random()+'\0';
|
||||
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
||||
|
||||
function numeric(str) {
|
||||
return parseInt(str, 10) == str
|
||||
? parseInt(str, 10)
|
||||
: str.charCodeAt(0);
|
||||
}
|
||||
|
||||
function escapeBraces(str) {
|
||||
return str.split('\\\\').join(escSlash)
|
||||
.split('\\{').join(escOpen)
|
||||
.split('\\}').join(escClose)
|
||||
.split('\\,').join(escComma)
|
||||
.split('\\.').join(escPeriod);
|
||||
}
|
||||
|
||||
function unescapeBraces(str) {
|
||||
return str.split(escSlash).join('\\')
|
||||
.split(escOpen).join('{')
|
||||
.split(escClose).join('}')
|
||||
.split(escComma).join(',')
|
||||
.split(escPeriod).join('.');
|
||||
}
|
||||
|
||||
|
||||
// Basically just str.split(","), but handling cases
|
||||
// where we have nested braced sections, which should be
|
||||
// treated as individual members, like {a,{b,c},d}
|
||||
function parseCommaParts(str) {
|
||||
if (!str)
|
||||
return [''];
|
||||
|
||||
var parts = [];
|
||||
var m = balanced('{', '}', str);
|
||||
|
||||
if (!m)
|
||||
return str.split(',');
|
||||
|
||||
var pre = m.pre;
|
||||
var body = m.body;
|
||||
var post = m.post;
|
||||
var p = pre.split(',');
|
||||
|
||||
p[p.length-1] += '{' + body + '}';
|
||||
var postParts = parseCommaParts(post);
|
||||
if (post.length) {
|
||||
p[p.length-1] += postParts.shift();
|
||||
p.push.apply(p, postParts);
|
||||
}
|
||||
|
||||
parts.push.apply(parts, p);
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
function expandTop(str) {
|
||||
if (!str)
|
||||
return [];
|
||||
|
||||
// I don't know why Bash 4.3 does this, but it does.
|
||||
// Anything starting with {} will have the first two bytes preserved
|
||||
// but *only* at the top level, so {},a}b will not expand to anything,
|
||||
// but a{},b}c will be expanded to [a}c,abc].
|
||||
// One could argue that this is a bug in Bash, but since the goal of
|
||||
// this module is to match Bash's rules, we escape a leading {}
|
||||
if (str.substr(0, 2) === '{}') {
|
||||
str = '\\{\\}' + str.substr(2);
|
||||
}
|
||||
|
||||
return expand(escapeBraces(str), true).map(unescapeBraces);
|
||||
}
|
||||
|
||||
function identity(e) {
|
||||
return e;
|
||||
}
|
||||
|
||||
function embrace(str) {
|
||||
return '{' + str + '}';
|
||||
}
|
||||
function isPadded(el) {
|
||||
return /^-?0\d/.test(el);
|
||||
}
|
||||
|
||||
function lte(i, y) {
|
||||
return i <= y;
|
||||
}
|
||||
function gte(i, y) {
|
||||
return i >= y;
|
||||
}
|
||||
|
||||
function expand(str, isTop) {
|
||||
var expansions = [];
|
||||
|
||||
var m = balanced('{', '}', str);
|
||||
if (!m || /\$$/.test(m.pre)) return [str];
|
||||
|
||||
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isSequence = isNumericSequence || isAlphaSequence;
|
||||
var isOptions = m.body.indexOf(',') >= 0;
|
||||
if (!isSequence && !isOptions) {
|
||||
// {a},b}
|
||||
if (m.post.match(/,(?!,).*\}/)) {
|
||||
str = m.pre + '{' + m.body + escClose + m.post;
|
||||
return expand(str);
|
||||
}
|
||||
return [str];
|
||||
}
|
||||
|
||||
var n;
|
||||
if (isSequence) {
|
||||
n = m.body.split(/\.\./);
|
||||
} else {
|
||||
n = parseCommaParts(m.body);
|
||||
if (n.length === 1) {
|
||||
// x{{a,b}}y ==> x{a}y x{b}y
|
||||
n = expand(n[0], false).map(embrace);
|
||||
if (n.length === 1) {
|
||||
var post = m.post.length
|
||||
? expand(m.post, false)
|
||||
: [''];
|
||||
return post.map(function(p) {
|
||||
return m.pre + n[0] + p;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// at this point, n is the parts, and we know it's not a comma set
|
||||
// with a single entry.
|
||||
|
||||
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
||||
var pre = m.pre;
|
||||
var post = m.post.length
|
||||
? expand(m.post, false)
|
||||
: [''];
|
||||
|
||||
var N;
|
||||
|
||||
if (isSequence) {
|
||||
var x = numeric(n[0]);
|
||||
var y = numeric(n[1]);
|
||||
var width = Math.max(n[0].length, n[1].length)
|
||||
var incr = n.length == 3
|
||||
? Math.abs(numeric(n[2]))
|
||||
: 1;
|
||||
var test = lte;
|
||||
var reverse = y < x;
|
||||
if (reverse) {
|
||||
incr *= -1;
|
||||
test = gte;
|
||||
}
|
||||
var pad = n.some(isPadded);
|
||||
|
||||
N = [];
|
||||
|
||||
for (var i = x; test(i, y); i += incr) {
|
||||
var c;
|
||||
if (isAlphaSequence) {
|
||||
c = String.fromCharCode(i);
|
||||
if (c === '\\')
|
||||
c = '';
|
||||
} else {
|
||||
c = String(i);
|
||||
if (pad) {
|
||||
var need = width - c.length;
|
||||
if (need > 0) {
|
||||
var z = new Array(need + 1).join('0');
|
||||
if (i < 0)
|
||||
c = '-' + z + c.slice(1);
|
||||
else
|
||||
c = z + c;
|
||||
}
|
||||
}
|
||||
}
|
||||
N.push(c);
|
||||
}
|
||||
} else {
|
||||
N = concatMap(n, function(el) { return expand(el, false) });
|
||||
}
|
||||
|
||||
for (var j = 0; j < N.length; j++) {
|
||||
for (var k = 0; k < post.length; k++) {
|
||||
var expansion = pre + N[j] + post[k];
|
||||
if (!isTop || isSequence || expansion)
|
||||
expansions.push(expansion);
|
||||
}
|
||||
}
|
||||
|
||||
return expansions;
|
||||
}
|
||||
|
||||
50
unified-ai-platform/node_modules/@jest/reporters/node_modules/brace-expansion/package.json
generated
vendored
Normal file
50
unified-ai-platform/node_modules/@jest/reporters/node_modules/brace-expansion/package.json
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "brace-expansion",
|
||||
"description": "Brace expansion as known from sh/bash",
|
||||
"version": "1.1.12",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/brace-expansion.git"
|
||||
},
|
||||
"homepage": "https://github.com/juliangruber/brace-expansion",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tape test/*.js",
|
||||
"gentest": "bash test/generate.sh",
|
||||
"bench": "matcha test/perf/bench.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"matcha": "^0.7.0",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"firefox/20..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/25..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
},
|
||||
"publishConfig": {
|
||||
"tag": "1.x"
|
||||
}
|
||||
}
|
||||
21
unified-ai-platform/node_modules/@jest/reporters/node_modules/glob/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/reporters/node_modules/glob/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
## Glob Logo
|
||||
|
||||
Glob's logo created by Tanya Brassie <http://tanyabrassie.com/>, licensed
|
||||
under a Creative Commons Attribution-ShareAlike 4.0 International License
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
238
unified-ai-platform/node_modules/@jest/reporters/node_modules/glob/common.js
generated
vendored
Normal file
238
unified-ai-platform/node_modules/@jest/reporters/node_modules/glob/common.js
generated
vendored
Normal file
@@ -0,0 +1,238 @@
|
||||
exports.setopts = setopts
|
||||
exports.ownProp = ownProp
|
||||
exports.makeAbs = makeAbs
|
||||
exports.finish = finish
|
||||
exports.mark = mark
|
||||
exports.isIgnored = isIgnored
|
||||
exports.childrenIgnored = childrenIgnored
|
||||
|
||||
function ownProp (obj, field) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, field)
|
||||
}
|
||||
|
||||
var fs = require("fs")
|
||||
var path = require("path")
|
||||
var minimatch = require("minimatch")
|
||||
var isAbsolute = require("path-is-absolute")
|
||||
var Minimatch = minimatch.Minimatch
|
||||
|
||||
function alphasort (a, b) {
|
||||
return a.localeCompare(b, 'en')
|
||||
}
|
||||
|
||||
function setupIgnores (self, options) {
|
||||
self.ignore = options.ignore || []
|
||||
|
||||
if (!Array.isArray(self.ignore))
|
||||
self.ignore = [self.ignore]
|
||||
|
||||
if (self.ignore.length) {
|
||||
self.ignore = self.ignore.map(ignoreMap)
|
||||
}
|
||||
}
|
||||
|
||||
// ignore patterns are always in dot:true mode.
|
||||
function ignoreMap (pattern) {
|
||||
var gmatcher = null
|
||||
if (pattern.slice(-3) === '/**') {
|
||||
var gpattern = pattern.replace(/(\/\*\*)+$/, '')
|
||||
gmatcher = new Minimatch(gpattern, { dot: true })
|
||||
}
|
||||
|
||||
return {
|
||||
matcher: new Minimatch(pattern, { dot: true }),
|
||||
gmatcher: gmatcher
|
||||
}
|
||||
}
|
||||
|
||||
function setopts (self, pattern, options) {
|
||||
if (!options)
|
||||
options = {}
|
||||
|
||||
// base-matching: just use globstar for that.
|
||||
if (options.matchBase && -1 === pattern.indexOf("/")) {
|
||||
if (options.noglobstar) {
|
||||
throw new Error("base matching requires globstar")
|
||||
}
|
||||
pattern = "**/" + pattern
|
||||
}
|
||||
|
||||
self.silent = !!options.silent
|
||||
self.pattern = pattern
|
||||
self.strict = options.strict !== false
|
||||
self.realpath = !!options.realpath
|
||||
self.realpathCache = options.realpathCache || Object.create(null)
|
||||
self.follow = !!options.follow
|
||||
self.dot = !!options.dot
|
||||
self.mark = !!options.mark
|
||||
self.nodir = !!options.nodir
|
||||
if (self.nodir)
|
||||
self.mark = true
|
||||
self.sync = !!options.sync
|
||||
self.nounique = !!options.nounique
|
||||
self.nonull = !!options.nonull
|
||||
self.nosort = !!options.nosort
|
||||
self.nocase = !!options.nocase
|
||||
self.stat = !!options.stat
|
||||
self.noprocess = !!options.noprocess
|
||||
self.absolute = !!options.absolute
|
||||
self.fs = options.fs || fs
|
||||
|
||||
self.maxLength = options.maxLength || Infinity
|
||||
self.cache = options.cache || Object.create(null)
|
||||
self.statCache = options.statCache || Object.create(null)
|
||||
self.symlinks = options.symlinks || Object.create(null)
|
||||
|
||||
setupIgnores(self, options)
|
||||
|
||||
self.changedCwd = false
|
||||
var cwd = process.cwd()
|
||||
if (!ownProp(options, "cwd"))
|
||||
self.cwd = cwd
|
||||
else {
|
||||
self.cwd = path.resolve(options.cwd)
|
||||
self.changedCwd = self.cwd !== cwd
|
||||
}
|
||||
|
||||
self.root = options.root || path.resolve(self.cwd, "/")
|
||||
self.root = path.resolve(self.root)
|
||||
if (process.platform === "win32")
|
||||
self.root = self.root.replace(/\\/g, "/")
|
||||
|
||||
// TODO: is an absolute `cwd` supposed to be resolved against `root`?
|
||||
// e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
|
||||
self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
|
||||
if (process.platform === "win32")
|
||||
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
|
||||
self.nomount = !!options.nomount
|
||||
|
||||
// disable comments and negation in Minimatch.
|
||||
// Note that they are not supported in Glob itself anyway.
|
||||
options.nonegate = true
|
||||
options.nocomment = true
|
||||
// always treat \ in patterns as escapes, not path separators
|
||||
options.allowWindowsEscape = false
|
||||
|
||||
self.minimatch = new Minimatch(pattern, options)
|
||||
self.options = self.minimatch.options
|
||||
}
|
||||
|
||||
function finish (self) {
|
||||
var nou = self.nounique
|
||||
var all = nou ? [] : Object.create(null)
|
||||
|
||||
for (var i = 0, l = self.matches.length; i < l; i ++) {
|
||||
var matches = self.matches[i]
|
||||
if (!matches || Object.keys(matches).length === 0) {
|
||||
if (self.nonull) {
|
||||
// do like the shell, and spit out the literal glob
|
||||
var literal = self.minimatch.globSet[i]
|
||||
if (nou)
|
||||
all.push(literal)
|
||||
else
|
||||
all[literal] = true
|
||||
}
|
||||
} else {
|
||||
// had matches
|
||||
var m = Object.keys(matches)
|
||||
if (nou)
|
||||
all.push.apply(all, m)
|
||||
else
|
||||
m.forEach(function (m) {
|
||||
all[m] = true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (!nou)
|
||||
all = Object.keys(all)
|
||||
|
||||
if (!self.nosort)
|
||||
all = all.sort(alphasort)
|
||||
|
||||
// at *some* point we statted all of these
|
||||
if (self.mark) {
|
||||
for (var i = 0; i < all.length; i++) {
|
||||
all[i] = self._mark(all[i])
|
||||
}
|
||||
if (self.nodir) {
|
||||
all = all.filter(function (e) {
|
||||
var notDir = !(/\/$/.test(e))
|
||||
var c = self.cache[e] || self.cache[makeAbs(self, e)]
|
||||
if (notDir && c)
|
||||
notDir = c !== 'DIR' && !Array.isArray(c)
|
||||
return notDir
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (self.ignore.length)
|
||||
all = all.filter(function(m) {
|
||||
return !isIgnored(self, m)
|
||||
})
|
||||
|
||||
self.found = all
|
||||
}
|
||||
|
||||
function mark (self, p) {
|
||||
var abs = makeAbs(self, p)
|
||||
var c = self.cache[abs]
|
||||
var m = p
|
||||
if (c) {
|
||||
var isDir = c === 'DIR' || Array.isArray(c)
|
||||
var slash = p.slice(-1) === '/'
|
||||
|
||||
if (isDir && !slash)
|
||||
m += '/'
|
||||
else if (!isDir && slash)
|
||||
m = m.slice(0, -1)
|
||||
|
||||
if (m !== p) {
|
||||
var mabs = makeAbs(self, m)
|
||||
self.statCache[mabs] = self.statCache[abs]
|
||||
self.cache[mabs] = self.cache[abs]
|
||||
}
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
// lotta situps...
|
||||
function makeAbs (self, f) {
|
||||
var abs = f
|
||||
if (f.charAt(0) === '/') {
|
||||
abs = path.join(self.root, f)
|
||||
} else if (isAbsolute(f) || f === '') {
|
||||
abs = f
|
||||
} else if (self.changedCwd) {
|
||||
abs = path.resolve(self.cwd, f)
|
||||
} else {
|
||||
abs = path.resolve(f)
|
||||
}
|
||||
|
||||
if (process.platform === 'win32')
|
||||
abs = abs.replace(/\\/g, '/')
|
||||
|
||||
return abs
|
||||
}
|
||||
|
||||
|
||||
// Return true, if pattern ends with globstar '**', for the accompanying parent directory.
|
||||
// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
|
||||
function isIgnored (self, path) {
|
||||
if (!self.ignore.length)
|
||||
return false
|
||||
|
||||
return self.ignore.some(function(item) {
|
||||
return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
|
||||
})
|
||||
}
|
||||
|
||||
function childrenIgnored (self, path) {
|
||||
if (!self.ignore.length)
|
||||
return false
|
||||
|
||||
return self.ignore.some(function(item) {
|
||||
return !!(item.gmatcher && item.gmatcher.match(path))
|
||||
})
|
||||
}
|
||||
790
unified-ai-platform/node_modules/@jest/reporters/node_modules/glob/glob.js
generated
vendored
Normal file
790
unified-ai-platform/node_modules/@jest/reporters/node_modules/glob/glob.js
generated
vendored
Normal file
@@ -0,0 +1,790 @@
|
||||
// Approach:
|
||||
//
|
||||
// 1. Get the minimatch set
|
||||
// 2. For each pattern in the set, PROCESS(pattern, false)
|
||||
// 3. Store matches per-set, then uniq them
|
||||
//
|
||||
// PROCESS(pattern, inGlobStar)
|
||||
// Get the first [n] items from pattern that are all strings
|
||||
// Join these together. This is PREFIX.
|
||||
// If there is no more remaining, then stat(PREFIX) and
|
||||
// add to matches if it succeeds. END.
|
||||
//
|
||||
// If inGlobStar and PREFIX is symlink and points to dir
|
||||
// set ENTRIES = []
|
||||
// else readdir(PREFIX) as ENTRIES
|
||||
// If fail, END
|
||||
//
|
||||
// with ENTRIES
|
||||
// If pattern[n] is GLOBSTAR
|
||||
// // handle the case where the globstar match is empty
|
||||
// // by pruning it out, and testing the resulting pattern
|
||||
// PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
|
||||
// // handle other cases.
|
||||
// for ENTRY in ENTRIES (not dotfiles)
|
||||
// // attach globstar + tail onto the entry
|
||||
// // Mark that this entry is a globstar match
|
||||
// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
|
||||
//
|
||||
// else // not globstar
|
||||
// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
|
||||
// Test ENTRY against pattern[n]
|
||||
// If fails, continue
|
||||
// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
|
||||
//
|
||||
// Caveat:
|
||||
// Cache all stats and readdirs results to minimize syscall. Since all
|
||||
// we ever care about is existence and directory-ness, we can just keep
|
||||
// `true` for files, and [children,...] for directories, or `false` for
|
||||
// things that don't exist.
|
||||
|
||||
module.exports = glob
|
||||
|
||||
var rp = require('fs.realpath')
|
||||
var minimatch = require('minimatch')
|
||||
var Minimatch = minimatch.Minimatch
|
||||
var inherits = require('inherits')
|
||||
var EE = require('events').EventEmitter
|
||||
var path = require('path')
|
||||
var assert = require('assert')
|
||||
var isAbsolute = require('path-is-absolute')
|
||||
var globSync = require('./sync.js')
|
||||
var common = require('./common.js')
|
||||
var setopts = common.setopts
|
||||
var ownProp = common.ownProp
|
||||
var inflight = require('inflight')
|
||||
var util = require('util')
|
||||
var childrenIgnored = common.childrenIgnored
|
||||
var isIgnored = common.isIgnored
|
||||
|
||||
var once = require('once')
|
||||
|
||||
function glob (pattern, options, cb) {
|
||||
if (typeof options === 'function') cb = options, options = {}
|
||||
if (!options) options = {}
|
||||
|
||||
if (options.sync) {
|
||||
if (cb)
|
||||
throw new TypeError('callback provided to sync glob')
|
||||
return globSync(pattern, options)
|
||||
}
|
||||
|
||||
return new Glob(pattern, options, cb)
|
||||
}
|
||||
|
||||
glob.sync = globSync
|
||||
var GlobSync = glob.GlobSync = globSync.GlobSync
|
||||
|
||||
// old api surface
|
||||
glob.glob = glob
|
||||
|
||||
function extend (origin, add) {
|
||||
if (add === null || typeof add !== 'object') {
|
||||
return origin
|
||||
}
|
||||
|
||||
var keys = Object.keys(add)
|
||||
var i = keys.length
|
||||
while (i--) {
|
||||
origin[keys[i]] = add[keys[i]]
|
||||
}
|
||||
return origin
|
||||
}
|
||||
|
||||
glob.hasMagic = function (pattern, options_) {
|
||||
var options = extend({}, options_)
|
||||
options.noprocess = true
|
||||
|
||||
var g = new Glob(pattern, options)
|
||||
var set = g.minimatch.set
|
||||
|
||||
if (!pattern)
|
||||
return false
|
||||
|
||||
if (set.length > 1)
|
||||
return true
|
||||
|
||||
for (var j = 0; j < set[0].length; j++) {
|
||||
if (typeof set[0][j] !== 'string')
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
glob.Glob = Glob
|
||||
inherits(Glob, EE)
|
||||
function Glob (pattern, options, cb) {
|
||||
if (typeof options === 'function') {
|
||||
cb = options
|
||||
options = null
|
||||
}
|
||||
|
||||
if (options && options.sync) {
|
||||
if (cb)
|
||||
throw new TypeError('callback provided to sync glob')
|
||||
return new GlobSync(pattern, options)
|
||||
}
|
||||
|
||||
if (!(this instanceof Glob))
|
||||
return new Glob(pattern, options, cb)
|
||||
|
||||
setopts(this, pattern, options)
|
||||
this._didRealPath = false
|
||||
|
||||
// process each pattern in the minimatch set
|
||||
var n = this.minimatch.set.length
|
||||
|
||||
// The matches are stored as {<filename>: true,...} so that
|
||||
// duplicates are automagically pruned.
|
||||
// Later, we do an Object.keys() on these.
|
||||
// Keep them as a list so we can fill in when nonull is set.
|
||||
this.matches = new Array(n)
|
||||
|
||||
if (typeof cb === 'function') {
|
||||
cb = once(cb)
|
||||
this.on('error', cb)
|
||||
this.on('end', function (matches) {
|
||||
cb(null, matches)
|
||||
})
|
||||
}
|
||||
|
||||
var self = this
|
||||
this._processing = 0
|
||||
|
||||
this._emitQueue = []
|
||||
this._processQueue = []
|
||||
this.paused = false
|
||||
|
||||
if (this.noprocess)
|
||||
return this
|
||||
|
||||
if (n === 0)
|
||||
return done()
|
||||
|
||||
var sync = true
|
||||
for (var i = 0; i < n; i ++) {
|
||||
this._process(this.minimatch.set[i], i, false, done)
|
||||
}
|
||||
sync = false
|
||||
|
||||
function done () {
|
||||
--self._processing
|
||||
if (self._processing <= 0) {
|
||||
if (sync) {
|
||||
process.nextTick(function () {
|
||||
self._finish()
|
||||
})
|
||||
} else {
|
||||
self._finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._finish = function () {
|
||||
assert(this instanceof Glob)
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
if (this.realpath && !this._didRealpath)
|
||||
return this._realpath()
|
||||
|
||||
common.finish(this)
|
||||
this.emit('end', this.found)
|
||||
}
|
||||
|
||||
Glob.prototype._realpath = function () {
|
||||
if (this._didRealpath)
|
||||
return
|
||||
|
||||
this._didRealpath = true
|
||||
|
||||
var n = this.matches.length
|
||||
if (n === 0)
|
||||
return this._finish()
|
||||
|
||||
var self = this
|
||||
for (var i = 0; i < this.matches.length; i++)
|
||||
this._realpathSet(i, next)
|
||||
|
||||
function next () {
|
||||
if (--n === 0)
|
||||
self._finish()
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._realpathSet = function (index, cb) {
|
||||
var matchset = this.matches[index]
|
||||
if (!matchset)
|
||||
return cb()
|
||||
|
||||
var found = Object.keys(matchset)
|
||||
var self = this
|
||||
var n = found.length
|
||||
|
||||
if (n === 0)
|
||||
return cb()
|
||||
|
||||
var set = this.matches[index] = Object.create(null)
|
||||
found.forEach(function (p, i) {
|
||||
// If there's a problem with the stat, then it means that
|
||||
// one or more of the links in the realpath couldn't be
|
||||
// resolved. just return the abs value in that case.
|
||||
p = self._makeAbs(p)
|
||||
rp.realpath(p, self.realpathCache, function (er, real) {
|
||||
if (!er)
|
||||
set[real] = true
|
||||
else if (er.syscall === 'stat')
|
||||
set[p] = true
|
||||
else
|
||||
self.emit('error', er) // srsly wtf right here
|
||||
|
||||
if (--n === 0) {
|
||||
self.matches[index] = set
|
||||
cb()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Glob.prototype._mark = function (p) {
|
||||
return common.mark(this, p)
|
||||
}
|
||||
|
||||
Glob.prototype._makeAbs = function (f) {
|
||||
return common.makeAbs(this, f)
|
||||
}
|
||||
|
||||
Glob.prototype.abort = function () {
|
||||
this.aborted = true
|
||||
this.emit('abort')
|
||||
}
|
||||
|
||||
Glob.prototype.pause = function () {
|
||||
if (!this.paused) {
|
||||
this.paused = true
|
||||
this.emit('pause')
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype.resume = function () {
|
||||
if (this.paused) {
|
||||
this.emit('resume')
|
||||
this.paused = false
|
||||
if (this._emitQueue.length) {
|
||||
var eq = this._emitQueue.slice(0)
|
||||
this._emitQueue.length = 0
|
||||
for (var i = 0; i < eq.length; i ++) {
|
||||
var e = eq[i]
|
||||
this._emitMatch(e[0], e[1])
|
||||
}
|
||||
}
|
||||
if (this._processQueue.length) {
|
||||
var pq = this._processQueue.slice(0)
|
||||
this._processQueue.length = 0
|
||||
for (var i = 0; i < pq.length; i ++) {
|
||||
var p = pq[i]
|
||||
this._processing--
|
||||
this._process(p[0], p[1], p[2], p[3])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
|
||||
assert(this instanceof Glob)
|
||||
assert(typeof cb === 'function')
|
||||
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
this._processing++
|
||||
if (this.paused) {
|
||||
this._processQueue.push([pattern, index, inGlobStar, cb])
|
||||
return
|
||||
}
|
||||
|
||||
//console.error('PROCESS %d', this._processing, pattern)
|
||||
|
||||
// Get the first [n] parts of pattern that are all strings.
|
||||
var n = 0
|
||||
while (typeof pattern[n] === 'string') {
|
||||
n ++
|
||||
}
|
||||
// now n is the index of the first one that is *not* a string.
|
||||
|
||||
// see if there's anything else
|
||||
var prefix
|
||||
switch (n) {
|
||||
// if not, then this is rather simple
|
||||
case pattern.length:
|
||||
this._processSimple(pattern.join('/'), index, cb)
|
||||
return
|
||||
|
||||
case 0:
|
||||
// pattern *starts* with some non-trivial item.
|
||||
// going to readdir(cwd), but not include the prefix in matches.
|
||||
prefix = null
|
||||
break
|
||||
|
||||
default:
|
||||
// pattern has some string bits in the front.
|
||||
// whatever it starts with, whether that's 'absolute' like /foo/bar,
|
||||
// or 'relative' like '../baz'
|
||||
prefix = pattern.slice(0, n).join('/')
|
||||
break
|
||||
}
|
||||
|
||||
var remain = pattern.slice(n)
|
||||
|
||||
// get the list of entries.
|
||||
var read
|
||||
if (prefix === null)
|
||||
read = '.'
|
||||
else if (isAbsolute(prefix) ||
|
||||
isAbsolute(pattern.map(function (p) {
|
||||
return typeof p === 'string' ? p : '[*]'
|
||||
}).join('/'))) {
|
||||
if (!prefix || !isAbsolute(prefix))
|
||||
prefix = '/' + prefix
|
||||
read = prefix
|
||||
} else
|
||||
read = prefix
|
||||
|
||||
var abs = this._makeAbs(read)
|
||||
|
||||
//if ignored, skip _processing
|
||||
if (childrenIgnored(this, read))
|
||||
return cb()
|
||||
|
||||
var isGlobStar = remain[0] === minimatch.GLOBSTAR
|
||||
if (isGlobStar)
|
||||
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb)
|
||||
else
|
||||
this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb)
|
||||
}
|
||||
|
||||
Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
|
||||
var self = this
|
||||
this._readdir(abs, inGlobStar, function (er, entries) {
|
||||
return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
|
||||
})
|
||||
}
|
||||
|
||||
Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
||||
|
||||
// if the abs isn't a dir, then nothing can match!
|
||||
if (!entries)
|
||||
return cb()
|
||||
|
||||
// It will only match dot entries if it starts with a dot, or if
|
||||
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
|
||||
var pn = remain[0]
|
||||
var negate = !!this.minimatch.negate
|
||||
var rawGlob = pn._glob
|
||||
var dotOk = this.dot || rawGlob.charAt(0) === '.'
|
||||
|
||||
var matchedEntries = []
|
||||
for (var i = 0; i < entries.length; i++) {
|
||||
var e = entries[i]
|
||||
if (e.charAt(0) !== '.' || dotOk) {
|
||||
var m
|
||||
if (negate && !prefix) {
|
||||
m = !e.match(pn)
|
||||
} else {
|
||||
m = e.match(pn)
|
||||
}
|
||||
if (m)
|
||||
matchedEntries.push(e)
|
||||
}
|
||||
}
|
||||
|
||||
//console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
|
||||
|
||||
var len = matchedEntries.length
|
||||
// If there are no matched entries, then nothing matches.
|
||||
if (len === 0)
|
||||
return cb()
|
||||
|
||||
// if this is the last remaining pattern bit, then no need for
|
||||
// an additional stat *unless* the user has specified mark or
|
||||
// stat explicitly. We know they exist, since readdir returned
|
||||
// them.
|
||||
|
||||
if (remain.length === 1 && !this.mark && !this.stat) {
|
||||
if (!this.matches[index])
|
||||
this.matches[index] = Object.create(null)
|
||||
|
||||
for (var i = 0; i < len; i ++) {
|
||||
var e = matchedEntries[i]
|
||||
if (prefix) {
|
||||
if (prefix !== '/')
|
||||
e = prefix + '/' + e
|
||||
else
|
||||
e = prefix + e
|
||||
}
|
||||
|
||||
if (e.charAt(0) === '/' && !this.nomount) {
|
||||
e = path.join(this.root, e)
|
||||
}
|
||||
this._emitMatch(index, e)
|
||||
}
|
||||
// This was the last one, and no stats were needed
|
||||
return cb()
|
||||
}
|
||||
|
||||
// now test all matched entries as stand-ins for that part
|
||||
// of the pattern.
|
||||
remain.shift()
|
||||
for (var i = 0; i < len; i ++) {
|
||||
var e = matchedEntries[i]
|
||||
var newPattern
|
||||
if (prefix) {
|
||||
if (prefix !== '/')
|
||||
e = prefix + '/' + e
|
||||
else
|
||||
e = prefix + e
|
||||
}
|
||||
this._process([e].concat(remain), index, inGlobStar, cb)
|
||||
}
|
||||
cb()
|
||||
}
|
||||
|
||||
Glob.prototype._emitMatch = function (index, e) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
if (isIgnored(this, e))
|
||||
return
|
||||
|
||||
if (this.paused) {
|
||||
this._emitQueue.push([index, e])
|
||||
return
|
||||
}
|
||||
|
||||
var abs = isAbsolute(e) ? e : this._makeAbs(e)
|
||||
|
||||
if (this.mark)
|
||||
e = this._mark(e)
|
||||
|
||||
if (this.absolute)
|
||||
e = abs
|
||||
|
||||
if (this.matches[index][e])
|
||||
return
|
||||
|
||||
if (this.nodir) {
|
||||
var c = this.cache[abs]
|
||||
if (c === 'DIR' || Array.isArray(c))
|
||||
return
|
||||
}
|
||||
|
||||
this.matches[index][e] = true
|
||||
|
||||
var st = this.statCache[abs]
|
||||
if (st)
|
||||
this.emit('stat', e, st)
|
||||
|
||||
this.emit('match', e)
|
||||
}
|
||||
|
||||
Glob.prototype._readdirInGlobStar = function (abs, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
// follow all symlinked directories forever
|
||||
// just proceed as if this is a non-globstar situation
|
||||
if (this.follow)
|
||||
return this._readdir(abs, false, cb)
|
||||
|
||||
var lstatkey = 'lstat\0' + abs
|
||||
var self = this
|
||||
var lstatcb = inflight(lstatkey, lstatcb_)
|
||||
|
||||
if (lstatcb)
|
||||
self.fs.lstat(abs, lstatcb)
|
||||
|
||||
function lstatcb_ (er, lstat) {
|
||||
if (er && er.code === 'ENOENT')
|
||||
return cb()
|
||||
|
||||
var isSym = lstat && lstat.isSymbolicLink()
|
||||
self.symlinks[abs] = isSym
|
||||
|
||||
// If it's not a symlink or a dir, then it's definitely a regular file.
|
||||
// don't bother doing a readdir in that case.
|
||||
if (!isSym && lstat && !lstat.isDirectory()) {
|
||||
self.cache[abs] = 'FILE'
|
||||
cb()
|
||||
} else
|
||||
self._readdir(abs, false, cb)
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._readdir = function (abs, inGlobStar, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb)
|
||||
if (!cb)
|
||||
return
|
||||
|
||||
//console.error('RD %j %j', +inGlobStar, abs)
|
||||
if (inGlobStar && !ownProp(this.symlinks, abs))
|
||||
return this._readdirInGlobStar(abs, cb)
|
||||
|
||||
if (ownProp(this.cache, abs)) {
|
||||
var c = this.cache[abs]
|
||||
if (!c || c === 'FILE')
|
||||
return cb()
|
||||
|
||||
if (Array.isArray(c))
|
||||
return cb(null, c)
|
||||
}
|
||||
|
||||
var self = this
|
||||
self.fs.readdir(abs, readdirCb(this, abs, cb))
|
||||
}
|
||||
|
||||
function readdirCb (self, abs, cb) {
|
||||
return function (er, entries) {
|
||||
if (er)
|
||||
self._readdirError(abs, er, cb)
|
||||
else
|
||||
self._readdirEntries(abs, entries, cb)
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._readdirEntries = function (abs, entries, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
// if we haven't asked to stat everything, then just
|
||||
// assume that everything in there exists, so we can avoid
|
||||
// having to stat it a second time.
|
||||
if (!this.mark && !this.stat) {
|
||||
for (var i = 0; i < entries.length; i ++) {
|
||||
var e = entries[i]
|
||||
if (abs === '/')
|
||||
e = abs + e
|
||||
else
|
||||
e = abs + '/' + e
|
||||
this.cache[e] = true
|
||||
}
|
||||
}
|
||||
|
||||
this.cache[abs] = entries
|
||||
return cb(null, entries)
|
||||
}
|
||||
|
||||
Glob.prototype._readdirError = function (f, er, cb) {
|
||||
if (this.aborted)
|
||||
return
|
||||
|
||||
// handle errors, and cache the information
|
||||
switch (er.code) {
|
||||
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
|
||||
case 'ENOTDIR': // totally normal. means it *does* exist.
|
||||
var abs = this._makeAbs(f)
|
||||
this.cache[abs] = 'FILE'
|
||||
if (abs === this.cwdAbs) {
|
||||
var error = new Error(er.code + ' invalid cwd ' + this.cwd)
|
||||
error.path = this.cwd
|
||||
error.code = er.code
|
||||
this.emit('error', error)
|
||||
this.abort()
|
||||
}
|
||||
break
|
||||
|
||||
case 'ENOENT': // not terribly unusual
|
||||
case 'ELOOP':
|
||||
case 'ENAMETOOLONG':
|
||||
case 'UNKNOWN':
|
||||
this.cache[this._makeAbs(f)] = false
|
||||
break
|
||||
|
||||
default: // some unusual error. Treat as failure.
|
||||
this.cache[this._makeAbs(f)] = false
|
||||
if (this.strict) {
|
||||
this.emit('error', er)
|
||||
// If the error is handled, then we abort
|
||||
// if not, we threw out of here
|
||||
this.abort()
|
||||
}
|
||||
if (!this.silent)
|
||||
console.error('glob error', er)
|
||||
break
|
||||
}
|
||||
|
||||
return cb()
|
||||
}
|
||||
|
||||
Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
|
||||
var self = this
|
||||
this._readdir(abs, inGlobStar, function (er, entries) {
|
||||
self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
||||
//console.error('pgs2', prefix, remain[0], entries)
|
||||
|
||||
// no entries means not a dir, so it can never have matches
|
||||
// foo.txt/** doesn't match foo.txt
|
||||
if (!entries)
|
||||
return cb()
|
||||
|
||||
// test without the globstar, and with every child both below
|
||||
// and replacing the globstar.
|
||||
var remainWithoutGlobStar = remain.slice(1)
|
||||
var gspref = prefix ? [ prefix ] : []
|
||||
var noGlobStar = gspref.concat(remainWithoutGlobStar)
|
||||
|
||||
// the noGlobStar pattern exits the inGlobStar state
|
||||
this._process(noGlobStar, index, false, cb)
|
||||
|
||||
var isSym = this.symlinks[abs]
|
||||
var len = entries.length
|
||||
|
||||
// If it's a symlink, and we're in a globstar, then stop
|
||||
if (isSym && inGlobStar)
|
||||
return cb()
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
var e = entries[i]
|
||||
if (e.charAt(0) === '.' && !this.dot)
|
||||
continue
|
||||
|
||||
// these two cases enter the inGlobStar state
|
||||
var instead = gspref.concat(entries[i], remainWithoutGlobStar)
|
||||
this._process(instead, index, true, cb)
|
||||
|
||||
var below = gspref.concat(entries[i], remain)
|
||||
this._process(below, index, true, cb)
|
||||
}
|
||||
|
||||
cb()
|
||||
}
|
||||
|
||||
Glob.prototype._processSimple = function (prefix, index, cb) {
|
||||
// XXX review this. Shouldn't it be doing the mounting etc
|
||||
// before doing stat? kinda weird?
|
||||
var self = this
|
||||
this._stat(prefix, function (er, exists) {
|
||||
self._processSimple2(prefix, index, er, exists, cb)
|
||||
})
|
||||
}
|
||||
Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
|
||||
|
||||
//console.error('ps2', prefix, exists)
|
||||
|
||||
if (!this.matches[index])
|
||||
this.matches[index] = Object.create(null)
|
||||
|
||||
// If it doesn't exist, then just mark the lack of results
|
||||
if (!exists)
|
||||
return cb()
|
||||
|
||||
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
||||
var trail = /[\/\\]$/.test(prefix)
|
||||
if (prefix.charAt(0) === '/') {
|
||||
prefix = path.join(this.root, prefix)
|
||||
} else {
|
||||
prefix = path.resolve(this.root, prefix)
|
||||
if (trail)
|
||||
prefix += '/'
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === 'win32')
|
||||
prefix = prefix.replace(/\\/g, '/')
|
||||
|
||||
// Mark this as a match
|
||||
this._emitMatch(index, prefix)
|
||||
cb()
|
||||
}
|
||||
|
||||
// Returns either 'DIR', 'FILE', or false
|
||||
Glob.prototype._stat = function (f, cb) {
|
||||
var abs = this._makeAbs(f)
|
||||
var needDir = f.slice(-1) === '/'
|
||||
|
||||
if (f.length > this.maxLength)
|
||||
return cb()
|
||||
|
||||
if (!this.stat && ownProp(this.cache, abs)) {
|
||||
var c = this.cache[abs]
|
||||
|
||||
if (Array.isArray(c))
|
||||
c = 'DIR'
|
||||
|
||||
// It exists, but maybe not how we need it
|
||||
if (!needDir || c === 'DIR')
|
||||
return cb(null, c)
|
||||
|
||||
if (needDir && c === 'FILE')
|
||||
return cb()
|
||||
|
||||
// otherwise we have to stat, because maybe c=true
|
||||
// if we know it exists, but not what it is.
|
||||
}
|
||||
|
||||
var exists
|
||||
var stat = this.statCache[abs]
|
||||
if (stat !== undefined) {
|
||||
if (stat === false)
|
||||
return cb(null, stat)
|
||||
else {
|
||||
var type = stat.isDirectory() ? 'DIR' : 'FILE'
|
||||
if (needDir && type === 'FILE')
|
||||
return cb()
|
||||
else
|
||||
return cb(null, type, stat)
|
||||
}
|
||||
}
|
||||
|
||||
var self = this
|
||||
var statcb = inflight('stat\0' + abs, lstatcb_)
|
||||
if (statcb)
|
||||
self.fs.lstat(abs, statcb)
|
||||
|
||||
function lstatcb_ (er, lstat) {
|
||||
if (lstat && lstat.isSymbolicLink()) {
|
||||
// If it's a symlink, then treat it as the target, unless
|
||||
// the target does not exist, then treat it as a file.
|
||||
return self.fs.stat(abs, function (er, stat) {
|
||||
if (er)
|
||||
self._stat2(f, abs, null, lstat, cb)
|
||||
else
|
||||
self._stat2(f, abs, er, stat, cb)
|
||||
})
|
||||
} else {
|
||||
self._stat2(f, abs, er, lstat, cb)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
|
||||
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
|
||||
this.statCache[abs] = false
|
||||
return cb()
|
||||
}
|
||||
|
||||
var needDir = f.slice(-1) === '/'
|
||||
this.statCache[abs] = stat
|
||||
|
||||
if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
|
||||
return cb(null, false, stat)
|
||||
|
||||
var c = true
|
||||
if (stat)
|
||||
c = stat.isDirectory() ? 'DIR' : 'FILE'
|
||||
this.cache[abs] = this.cache[abs] || c
|
||||
|
||||
if (needDir && c === 'FILE')
|
||||
return cb()
|
||||
|
||||
return cb(null, c, stat)
|
||||
}
|
||||
0
unified-ai-platform/node_modules/@jest/reporters/node_modules/glob/sync.js
generated
vendored
Normal file
0
unified-ai-platform/node_modules/@jest/reporters/node_modules/glob/sync.js
generated
vendored
Normal file
15
unified-ai-platform/node_modules/@jest/reporters/node_modules/minimatch/LICENSE
generated
vendored
Normal file
15
unified-ai-platform/node_modules/@jest/reporters/node_modules/minimatch/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
0
unified-ai-platform/node_modules/@jest/reporters/node_modules/minimatch/README.md
generated
vendored
Normal file
0
unified-ai-platform/node_modules/@jest/reporters/node_modules/minimatch/README.md
generated
vendored
Normal file
947
unified-ai-platform/node_modules/@jest/reporters/node_modules/minimatch/minimatch.js
generated
vendored
Normal file
947
unified-ai-platform/node_modules/@jest/reporters/node_modules/minimatch/minimatch.js
generated
vendored
Normal file
@@ -0,0 +1,947 @@
|
||||
module.exports = minimatch
|
||||
minimatch.Minimatch = Minimatch
|
||||
|
||||
var path = (function () { try { return require('path') } catch (e) {}}()) || {
|
||||
sep: '/'
|
||||
}
|
||||
minimatch.sep = path.sep
|
||||
|
||||
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
|
||||
var expand = require('brace-expansion')
|
||||
|
||||
var plTypes = {
|
||||
'!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
|
||||
'?': { open: '(?:', close: ')?' },
|
||||
'+': { open: '(?:', close: ')+' },
|
||||
'*': { open: '(?:', close: ')*' },
|
||||
'@': { open: '(?:', close: ')' }
|
||||
}
|
||||
|
||||
// any single thing other than /
|
||||
// don't need to escape / when using new RegExp()
|
||||
var qmark = '[^/]'
|
||||
|
||||
// * => any number of characters
|
||||
var star = qmark + '*?'
|
||||
|
||||
// ** when dots are allowed. Anything goes, except .. and .
|
||||
// not (^ or / followed by one or two dots followed by $ or /),
|
||||
// followed by anything, any number of times.
|
||||
var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
|
||||
|
||||
// not a ^ or / followed by a dot,
|
||||
// followed by anything, any number of times.
|
||||
var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
|
||||
|
||||
// characters that need to be escaped in RegExp.
|
||||
var reSpecials = charSet('().*{}+?[]^$\\!')
|
||||
|
||||
// "abc" -> { a:true, b:true, c:true }
|
||||
function charSet (s) {
|
||||
return s.split('').reduce(function (set, c) {
|
||||
set[c] = true
|
||||
return set
|
||||
}, {})
|
||||
}
|
||||
|
||||
// normalizes slashes.
|
||||
var slashSplit = /\/+/
|
||||
|
||||
minimatch.filter = filter
|
||||
function filter (pattern, options) {
|
||||
options = options || {}
|
||||
return function (p, i, list) {
|
||||
return minimatch(p, pattern, options)
|
||||
}
|
||||
}
|
||||
|
||||
function ext (a, b) {
|
||||
b = b || {}
|
||||
var t = {}
|
||||
Object.keys(a).forEach(function (k) {
|
||||
t[k] = a[k]
|
||||
})
|
||||
Object.keys(b).forEach(function (k) {
|
||||
t[k] = b[k]
|
||||
})
|
||||
return t
|
||||
}
|
||||
|
||||
minimatch.defaults = function (def) {
|
||||
if (!def || typeof def !== 'object' || !Object.keys(def).length) {
|
||||
return minimatch
|
||||
}
|
||||
|
||||
var orig = minimatch
|
||||
|
||||
var m = function minimatch (p, pattern, options) {
|
||||
return orig(p, pattern, ext(def, options))
|
||||
}
|
||||
|
||||
m.Minimatch = function Minimatch (pattern, options) {
|
||||
return new orig.Minimatch(pattern, ext(def, options))
|
||||
}
|
||||
m.Minimatch.defaults = function defaults (options) {
|
||||
return orig.defaults(ext(def, options)).Minimatch
|
||||
}
|
||||
|
||||
m.filter = function filter (pattern, options) {
|
||||
return orig.filter(pattern, ext(def, options))
|
||||
}
|
||||
|
||||
m.defaults = function defaults (options) {
|
||||
return orig.defaults(ext(def, options))
|
||||
}
|
||||
|
||||
m.makeRe = function makeRe (pattern, options) {
|
||||
return orig.makeRe(pattern, ext(def, options))
|
||||
}
|
||||
|
||||
m.braceExpand = function braceExpand (pattern, options) {
|
||||
return orig.braceExpand(pattern, ext(def, options))
|
||||
}
|
||||
|
||||
m.match = function (list, pattern, options) {
|
||||
return orig.match(list, pattern, ext(def, options))
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
Minimatch.defaults = function (def) {
|
||||
return minimatch.defaults(def).Minimatch
|
||||
}
|
||||
|
||||
function minimatch (p, pattern, options) {
|
||||
assertValidPattern(pattern)
|
||||
|
||||
if (!options) options = {}
|
||||
|
||||
// shortcut: comments match nothing.
|
||||
if (!options.nocomment && pattern.charAt(0) === '#') {
|
||||
return false
|
||||
}
|
||||
|
||||
return new Minimatch(pattern, options).match(p)
|
||||
}
|
||||
|
||||
function Minimatch (pattern, options) {
|
||||
if (!(this instanceof Minimatch)) {
|
||||
return new Minimatch(pattern, options)
|
||||
}
|
||||
|
||||
assertValidPattern(pattern)
|
||||
|
||||
if (!options) options = {}
|
||||
|
||||
pattern = pattern.trim()
|
||||
|
||||
// windows support: need to use /, not \
|
||||
if (!options.allowWindowsEscape && path.sep !== '/') {
|
||||
pattern = pattern.split(path.sep).join('/')
|
||||
}
|
||||
|
||||
this.options = options
|
||||
this.set = []
|
||||
this.pattern = pattern
|
||||
this.regexp = null
|
||||
this.negate = false
|
||||
this.comment = false
|
||||
this.empty = false
|
||||
this.partial = !!options.partial
|
||||
|
||||
// make the set of regexps etc.
|
||||
this.make()
|
||||
}
|
||||
|
||||
Minimatch.prototype.debug = function () {}
|
||||
|
||||
Minimatch.prototype.make = make
|
||||
function make () {
|
||||
var pattern = this.pattern
|
||||
var options = this.options
|
||||
|
||||
// empty patterns and comments match nothing.
|
||||
if (!options.nocomment && pattern.charAt(0) === '#') {
|
||||
this.comment = true
|
||||
return
|
||||
}
|
||||
if (!pattern) {
|
||||
this.empty = true
|
||||
return
|
||||
}
|
||||
|
||||
// step 1: figure out negation, etc.
|
||||
this.parseNegate()
|
||||
|
||||
// step 2: expand braces
|
||||
var set = this.globSet = this.braceExpand()
|
||||
|
||||
if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) }
|
||||
|
||||
this.debug(this.pattern, set)
|
||||
|
||||
// step 3: now we have a set, so turn each one into a series of path-portion
|
||||
// matching patterns.
|
||||
// These will be regexps, except in the case of "**", which is
|
||||
// set to the GLOBSTAR object for globstar behavior,
|
||||
// and will not contain any / characters
|
||||
set = this.globParts = set.map(function (s) {
|
||||
return s.split(slashSplit)
|
||||
})
|
||||
|
||||
this.debug(this.pattern, set)
|
||||
|
||||
// glob --> regexps
|
||||
set = set.map(function (s, si, set) {
|
||||
return s.map(this.parse, this)
|
||||
}, this)
|
||||
|
||||
this.debug(this.pattern, set)
|
||||
|
||||
// filter out everything that didn't compile properly.
|
||||
set = set.filter(function (s) {
|
||||
return s.indexOf(false) === -1
|
||||
})
|
||||
|
||||
this.debug(this.pattern, set)
|
||||
|
||||
this.set = set
|
||||
}
|
||||
|
||||
Minimatch.prototype.parseNegate = parseNegate
|
||||
function parseNegate () {
|
||||
var pattern = this.pattern
|
||||
var negate = false
|
||||
var options = this.options
|
||||
var negateOffset = 0
|
||||
|
||||
if (options.nonegate) return
|
||||
|
||||
for (var i = 0, l = pattern.length
|
||||
; i < l && pattern.charAt(i) === '!'
|
||||
; i++) {
|
||||
negate = !negate
|
||||
negateOffset++
|
||||
}
|
||||
|
||||
if (negateOffset) this.pattern = pattern.substr(negateOffset)
|
||||
this.negate = negate
|
||||
}
|
||||
|
||||
// Brace expansion:
|
||||
// a{b,c}d -> abd acd
|
||||
// a{b,}c -> abc ac
|
||||
// a{0..3}d -> a0d a1d a2d a3d
|
||||
// a{b,c{d,e}f}g -> abg acdfg acefg
|
||||
// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
|
||||
//
|
||||
// Invalid sets are not expanded.
|
||||
// a{2..}b -> a{2..}b
|
||||
// a{b}c -> a{b}c
|
||||
minimatch.braceExpand = function (pattern, options) {
|
||||
return braceExpand(pattern, options)
|
||||
}
|
||||
|
||||
Minimatch.prototype.braceExpand = braceExpand
|
||||
|
||||
function braceExpand (pattern, options) {
|
||||
if (!options) {
|
||||
if (this instanceof Minimatch) {
|
||||
options = this.options
|
||||
} else {
|
||||
options = {}
|
||||
}
|
||||
}
|
||||
|
||||
pattern = typeof pattern === 'undefined'
|
||||
? this.pattern : pattern
|
||||
|
||||
assertValidPattern(pattern)
|
||||
|
||||
// Thanks to Yeting Li <https://github.com/yetingli> for
|
||||
// improving this regexp to avoid a ReDOS vulnerability.
|
||||
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
||||
// shortcut. no need to expand.
|
||||
return [pattern]
|
||||
}
|
||||
|
||||
return expand(pattern)
|
||||
}
|
||||
|
||||
var MAX_PATTERN_LENGTH = 1024 * 64
|
||||
var assertValidPattern = function (pattern) {
|
||||
if (typeof pattern !== 'string') {
|
||||
throw new TypeError('invalid pattern')
|
||||
}
|
||||
|
||||
if (pattern.length > MAX_PATTERN_LENGTH) {
|
||||
throw new TypeError('pattern is too long')
|
||||
}
|
||||
}
|
||||
|
||||
// parse a component of the expanded set.
|
||||
// At this point, no pattern may contain "/" in it
|
||||
// so we're going to return a 2d array, where each entry is the full
|
||||
// pattern, split on '/', and then turned into a regular expression.
|
||||
// A regexp is made at the end which joins each array with an
|
||||
// escaped /, and another full one which joins each regexp with |.
|
||||
//
|
||||
// Following the lead of Bash 4.1, note that "**" only has special meaning
|
||||
// when it is the *only* thing in a path portion. Otherwise, any series
|
||||
// of * is equivalent to a single *. Globstar behavior is enabled by
|
||||
// default, and can be disabled by setting options.noglobstar.
|
||||
Minimatch.prototype.parse = parse
|
||||
var SUBPARSE = {}
|
||||
function parse (pattern, isSub) {
|
||||
assertValidPattern(pattern)
|
||||
|
||||
var options = this.options
|
||||
|
||||
// shortcuts
|
||||
if (pattern === '**') {
|
||||
if (!options.noglobstar)
|
||||
return GLOBSTAR
|
||||
else
|
||||
pattern = '*'
|
||||
}
|
||||
if (pattern === '') return ''
|
||||
|
||||
var re = ''
|
||||
var hasMagic = !!options.nocase
|
||||
var escaping = false
|
||||
// ? => one single character
|
||||
var patternListStack = []
|
||||
var negativeLists = []
|
||||
var stateChar
|
||||
var inClass = false
|
||||
var reClassStart = -1
|
||||
var classStart = -1
|
||||
// . and .. never match anything that doesn't start with .,
|
||||
// even when options.dot is set.
|
||||
var patternStart = pattern.charAt(0) === '.' ? '' // anything
|
||||
// not (start or / followed by . or .. followed by / or end)
|
||||
: options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
|
||||
: '(?!\\.)'
|
||||
var self = this
|
||||
|
||||
function clearStateChar () {
|
||||
if (stateChar) {
|
||||
// we had some state-tracking character
|
||||
// that wasn't consumed by this pass.
|
||||
switch (stateChar) {
|
||||
case '*':
|
||||
re += star
|
||||
hasMagic = true
|
||||
break
|
||||
case '?':
|
||||
re += qmark
|
||||
hasMagic = true
|
||||
break
|
||||
default:
|
||||
re += '\\' + stateChar
|
||||
break
|
||||
}
|
||||
self.debug('clearStateChar %j %j', stateChar, re)
|
||||
stateChar = false
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0, len = pattern.length, c
|
||||
; (i < len) && (c = pattern.charAt(i))
|
||||
; i++) {
|
||||
this.debug('%s\t%s %s %j', pattern, i, re, c)
|
||||
|
||||
// skip over any that are escaped.
|
||||
if (escaping && reSpecials[c]) {
|
||||
re += '\\' + c
|
||||
escaping = false
|
||||
continue
|
||||
}
|
||||
|
||||
switch (c) {
|
||||
/* istanbul ignore next */
|
||||
case '/': {
|
||||
// completely not allowed, even escaped.
|
||||
// Should already be path-split by now.
|
||||
return false
|
||||
}
|
||||
|
||||
case '\\':
|
||||
clearStateChar()
|
||||
escaping = true
|
||||
continue
|
||||
|
||||
// the various stateChar values
|
||||
// for the "extglob" stuff.
|
||||
case '?':
|
||||
case '*':
|
||||
case '+':
|
||||
case '@':
|
||||
case '!':
|
||||
this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
|
||||
|
||||
// all of those are literals inside a class, except that
|
||||
// the glob [!a] means [^a] in regexp
|
||||
if (inClass) {
|
||||
this.debug(' in class')
|
||||
if (c === '!' && i === classStart + 1) c = '^'
|
||||
re += c
|
||||
continue
|
||||
}
|
||||
|
||||
// if we already have a stateChar, then it means
|
||||
// that there was something like ** or +? in there.
|
||||
// Handle the stateChar, then proceed with this one.
|
||||
self.debug('call clearStateChar %j', stateChar)
|
||||
clearStateChar()
|
||||
stateChar = c
|
||||
// if extglob is disabled, then +(asdf|foo) isn't a thing.
|
||||
// just clear the statechar *now*, rather than even diving into
|
||||
// the patternList stuff.
|
||||
if (options.noext) clearStateChar()
|
||||
continue
|
||||
|
||||
case '(':
|
||||
if (inClass) {
|
||||
re += '('
|
||||
continue
|
||||
}
|
||||
|
||||
if (!stateChar) {
|
||||
re += '\\('
|
||||
continue
|
||||
}
|
||||
|
||||
patternListStack.push({
|
||||
type: stateChar,
|
||||
start: i - 1,
|
||||
reStart: re.length,
|
||||
open: plTypes[stateChar].open,
|
||||
close: plTypes[stateChar].close
|
||||
})
|
||||
// negation is (?:(?!js)[^/]*)
|
||||
re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
|
||||
this.debug('plType %j %j', stateChar, re)
|
||||
stateChar = false
|
||||
continue
|
||||
|
||||
case ')':
|
||||
if (inClass || !patternListStack.length) {
|
||||
re += '\\)'
|
||||
continue
|
||||
}
|
||||
|
||||
clearStateChar()
|
||||
hasMagic = true
|
||||
var pl = patternListStack.pop()
|
||||
// negation is (?:(?!js)[^/]*)
|
||||
// The others are (?:<pattern>)<type>
|
||||
re += pl.close
|
||||
if (pl.type === '!') {
|
||||
negativeLists.push(pl)
|
||||
}
|
||||
pl.reEnd = re.length
|
||||
continue
|
||||
|
||||
case '|':
|
||||
if (inClass || !patternListStack.length || escaping) {
|
||||
re += '\\|'
|
||||
escaping = false
|
||||
continue
|
||||
}
|
||||
|
||||
clearStateChar()
|
||||
re += '|'
|
||||
continue
|
||||
|
||||
// these are mostly the same in regexp and glob
|
||||
case '[':
|
||||
// swallow any state-tracking char before the [
|
||||
clearStateChar()
|
||||
|
||||
if (inClass) {
|
||||
re += '\\' + c
|
||||
continue
|
||||
}
|
||||
|
||||
inClass = true
|
||||
classStart = i
|
||||
reClassStart = re.length
|
||||
re += c
|
||||
continue
|
||||
|
||||
case ']':
|
||||
// a right bracket shall lose its special
|
||||
// meaning and represent itself in
|
||||
// a bracket expression if it occurs
|
||||
// first in the list. -- POSIX.2 2.8.3.2
|
||||
if (i === classStart + 1 || !inClass) {
|
||||
re += '\\' + c
|
||||
escaping = false
|
||||
continue
|
||||
}
|
||||
|
||||
// handle the case where we left a class open.
|
||||
// "[z-a]" is valid, equivalent to "\[z-a\]"
|
||||
// split where the last [ was, make sure we don't have
|
||||
// an invalid re. if so, re-walk the contents of the
|
||||
// would-be class to re-translate any characters that
|
||||
// were passed through as-is
|
||||
// TODO: It would probably be faster to determine this
|
||||
// without a try/catch and a new RegExp, but it's tricky
|
||||
// to do safely. For now, this is safe and works.
|
||||
var cs = pattern.substring(classStart + 1, i)
|
||||
try {
|
||||
RegExp('[' + cs + ']')
|
||||
} catch (er) {
|
||||
// not a valid class!
|
||||
var sp = this.parse(cs, SUBPARSE)
|
||||
re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
|
||||
hasMagic = hasMagic || sp[1]
|
||||
inClass = false
|
||||
continue
|
||||
}
|
||||
|
||||
// finish up the class.
|
||||
hasMagic = true
|
||||
inClass = false
|
||||
re += c
|
||||
continue
|
||||
|
||||
default:
|
||||
// swallow any state char that wasn't consumed
|
||||
clearStateChar()
|
||||
|
||||
if (escaping) {
|
||||
// no need
|
||||
escaping = false
|
||||
} else if (reSpecials[c]
|
||||
&& !(c === '^' && inClass)) {
|
||||
re += '\\'
|
||||
}
|
||||
|
||||
re += c
|
||||
|
||||
} // switch
|
||||
} // for
|
||||
|
||||
// handle the case where we left a class open.
|
||||
// "[abc" is valid, equivalent to "\[abc"
|
||||
if (inClass) {
|
||||
// split where the last [ was, and escape it
|
||||
// this is a huge pita. We now have to re-walk
|
||||
// the contents of the would-be class to re-translate
|
||||
// any characters that were passed through as-is
|
||||
cs = pattern.substr(classStart + 1)
|
||||
sp = this.parse(cs, SUBPARSE)
|
||||
re = re.substr(0, reClassStart) + '\\[' + sp[0]
|
||||
hasMagic = hasMagic || sp[1]
|
||||
}
|
||||
|
||||
// handle the case where we had a +( thing at the *end*
|
||||
// of the pattern.
|
||||
// each pattern list stack adds 3 chars, and we need to go through
|
||||
// and escape any | chars that were passed through as-is for the regexp.
|
||||
// Go through and escape them, taking care not to double-escape any
|
||||
// | chars that were already escaped.
|
||||
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
||||
var tail = re.slice(pl.reStart + pl.open.length)
|
||||
this.debug('setting tail', re, pl)
|
||||
// maybe some even number of \, then maybe 1 \, followed by a |
|
||||
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
|
||||
if (!$2) {
|
||||
// the | isn't already escaped, so escape it.
|
||||
$2 = '\\'
|
||||
}
|
||||
|
||||
// need to escape all those slashes *again*, without escaping the
|
||||
// one that we need for escaping the | character. As it works out,
|
||||
// escaping an even number of slashes can be done by simply repeating
|
||||
// it exactly after itself. That's why this trick works.
|
||||
//
|
||||
// I am sorry that you have to see this.
|
||||
return $1 + $1 + $2 + '|'
|
||||
})
|
||||
|
||||
this.debug('tail=%j\n %s', tail, tail, pl, re)
|
||||
var t = pl.type === '*' ? star
|
||||
: pl.type === '?' ? qmark
|
||||
: '\\' + pl.type
|
||||
|
||||
hasMagic = true
|
||||
re = re.slice(0, pl.reStart) + t + '\\(' + tail
|
||||
}
|
||||
|
||||
// handle trailing things that only matter at the very end.
|
||||
clearStateChar()
|
||||
if (escaping) {
|
||||
// trailing \\
|
||||
re += '\\\\'
|
||||
}
|
||||
|
||||
// only need to apply the nodot start if the re starts with
|
||||
// something that could conceivably capture a dot
|
||||
var addPatternStart = false
|
||||
switch (re.charAt(0)) {
|
||||
case '[': case '.': case '(': addPatternStart = true
|
||||
}
|
||||
|
||||
// Hack to work around lack of negative lookbehind in JS
|
||||
// A pattern like: *.!(x).!(y|z) needs to ensure that a name
|
||||
// like 'a.xyz.yz' doesn't match. So, the first negative
|
||||
// lookahead, has to look ALL the way ahead, to the end of
|
||||
// the pattern.
|
||||
for (var n = negativeLists.length - 1; n > -1; n--) {
|
||||
var nl = negativeLists[n]
|
||||
|
||||
var nlBefore = re.slice(0, nl.reStart)
|
||||
var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
|
||||
var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
|
||||
var nlAfter = re.slice(nl.reEnd)
|
||||
|
||||
nlLast += nlAfter
|
||||
|
||||
// Handle nested stuff like *(*.js|!(*.json)), where open parens
|
||||
// mean that we should *not* include the ) in the bit that is considered
|
||||
// "after" the negated section.
|
||||
var openParensBefore = nlBefore.split('(').length - 1
|
||||
var cleanAfter = nlAfter
|
||||
for (i = 0; i < openParensBefore; i++) {
|
||||
cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
|
||||
}
|
||||
nlAfter = cleanAfter
|
||||
|
||||
var dollar = ''
|
||||
if (nlAfter === '' && isSub !== SUBPARSE) {
|
||||
dollar = '$'
|
||||
}
|
||||
var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
|
||||
re = newRe
|
||||
}
|
||||
|
||||
// if the re is not "" at this point, then we need to make sure
|
||||
// it doesn't match against an empty path part.
|
||||
// Otherwise a/* will match a/, which it should not.
|
||||
if (re !== '' && hasMagic) {
|
||||
re = '(?=.)' + re
|
||||
}
|
||||
|
||||
if (addPatternStart) {
|
||||
re = patternStart + re
|
||||
}
|
||||
|
||||
// parsing just a piece of a larger pattern.
|
||||
if (isSub === SUBPARSE) {
|
||||
return [re, hasMagic]
|
||||
}
|
||||
|
||||
// skip the regexp for non-magical patterns
|
||||
// unescape anything in it, though, so that it'll be
|
||||
// an exact match against a file etc.
|
||||
if (!hasMagic) {
|
||||
return globUnescape(pattern)
|
||||
}
|
||||
|
||||
var flags = options.nocase ? 'i' : ''
|
||||
try {
|
||||
var regExp = new RegExp('^' + re + '$', flags)
|
||||
} catch (er) /* istanbul ignore next - should be impossible */ {
|
||||
// If it was an invalid regular expression, then it can't match
|
||||
// anything. This trick looks for a character after the end of
|
||||
// the string, which is of course impossible, except in multi-line
|
||||
// mode, but it's not a /m regex.
|
||||
return new RegExp('$.')
|
||||
}
|
||||
|
||||
regExp._glob = pattern
|
||||
regExp._src = re
|
||||
|
||||
return regExp
|
||||
}
|
||||
|
||||
minimatch.makeRe = function (pattern, options) {
|
||||
return new Minimatch(pattern, options || {}).makeRe()
|
||||
}
|
||||
|
||||
Minimatch.prototype.makeRe = makeRe
|
||||
function makeRe () {
|
||||
if (this.regexp || this.regexp === false) return this.regexp
|
||||
|
||||
// at this point, this.set is a 2d array of partial
|
||||
// pattern strings, or "**".
|
||||
//
|
||||
// It's better to use .match(). This function shouldn't
|
||||
// be used, really, but it's pretty convenient sometimes,
|
||||
// when you just want to work with a regex.
|
||||
var set = this.set
|
||||
|
||||
if (!set.length) {
|
||||
this.regexp = false
|
||||
return this.regexp
|
||||
}
|
||||
var options = this.options
|
||||
|
||||
var twoStar = options.noglobstar ? star
|
||||
: options.dot ? twoStarDot
|
||||
: twoStarNoDot
|
||||
var flags = options.nocase ? 'i' : ''
|
||||
|
||||
var re = set.map(function (pattern) {
|
||||
return pattern.map(function (p) {
|
||||
return (p === GLOBSTAR) ? twoStar
|
||||
: (typeof p === 'string') ? regExpEscape(p)
|
||||
: p._src
|
||||
}).join('\\\/')
|
||||
}).join('|')
|
||||
|
||||
// must match entire pattern
|
||||
// ending in a * or ** will make it less strict.
|
||||
re = '^(?:' + re + ')$'
|
||||
|
||||
// can match anything, as long as it's not this.
|
||||
if (this.negate) re = '^(?!' + re + ').*$'
|
||||
|
||||
try {
|
||||
this.regexp = new RegExp(re, flags)
|
||||
} catch (ex) /* istanbul ignore next - should be impossible */ {
|
||||
this.regexp = false
|
||||
}
|
||||
return this.regexp
|
||||
}
|
||||
|
||||
minimatch.match = function (list, pattern, options) {
|
||||
options = options || {}
|
||||
var mm = new Minimatch(pattern, options)
|
||||
list = list.filter(function (f) {
|
||||
return mm.match(f)
|
||||
})
|
||||
if (mm.options.nonull && !list.length) {
|
||||
list.push(pattern)
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
Minimatch.prototype.match = function match (f, partial) {
|
||||
if (typeof partial === 'undefined') partial = this.partial
|
||||
this.debug('match', f, this.pattern)
|
||||
// short-circuit in the case of busted things.
|
||||
// comments, etc.
|
||||
if (this.comment) return false
|
||||
if (this.empty) return f === ''
|
||||
|
||||
if (f === '/' && partial) return true
|
||||
|
||||
var options = this.options
|
||||
|
||||
// windows: need to use /, not \
|
||||
if (path.sep !== '/') {
|
||||
f = f.split(path.sep).join('/')
|
||||
}
|
||||
|
||||
// treat the test path as a set of pathparts.
|
||||
f = f.split(slashSplit)
|
||||
this.debug(this.pattern, 'split', f)
|
||||
|
||||
// just ONE of the pattern sets in this.set needs to match
|
||||
// in order for it to be valid. If negating, then just one
|
||||
// match means that we have failed.
|
||||
// Either way, return on the first hit.
|
||||
|
||||
var set = this.set
|
||||
this.debug(this.pattern, 'set', set)
|
||||
|
||||
// Find the basename of the path by looking for the last non-empty segment
|
||||
var filename
|
||||
var i
|
||||
for (i = f.length - 1; i >= 0; i--) {
|
||||
filename = f[i]
|
||||
if (filename) break
|
||||
}
|
||||
|
||||
for (i = 0; i < set.length; i++) {
|
||||
var pattern = set[i]
|
||||
var file = f
|
||||
if (options.matchBase && pattern.length === 1) {
|
||||
file = [filename]
|
||||
}
|
||||
var hit = this.matchOne(file, pattern, partial)
|
||||
if (hit) {
|
||||
if (options.flipNegate) return true
|
||||
return !this.negate
|
||||
}
|
||||
}
|
||||
|
||||
// didn't get any hits. this is success if it's a negative
|
||||
// pattern, failure otherwise.
|
||||
if (options.flipNegate) return false
|
||||
return this.negate
|
||||
}
|
||||
|
||||
// set partial to true to test if, for example,
|
||||
// "/a/b" matches the start of "/*/b/*/d"
|
||||
// Partial means, if you run out of file before you run
|
||||
// out of pattern, then that's fine, as long as all
|
||||
// the parts match.
|
||||
Minimatch.prototype.matchOne = function (file, pattern, partial) {
|
||||
var options = this.options
|
||||
|
||||
this.debug('matchOne',
|
||||
{ 'this': this, file: file, pattern: pattern })
|
||||
|
||||
this.debug('matchOne', file.length, pattern.length)
|
||||
|
||||
for (var fi = 0,
|
||||
pi = 0,
|
||||
fl = file.length,
|
||||
pl = pattern.length
|
||||
; (fi < fl) && (pi < pl)
|
||||
; fi++, pi++) {
|
||||
this.debug('matchOne loop')
|
||||
var p = pattern[pi]
|
||||
var f = file[fi]
|
||||
|
||||
this.debug(pattern, p, f)
|
||||
|
||||
// should be impossible.
|
||||
// some invalid regexp stuff in the set.
|
||||
/* istanbul ignore if */
|
||||
if (p === false) return false
|
||||
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug('GLOBSTAR', [pattern, p, f])
|
||||
|
||||
// "**"
|
||||
// a/**/b/**/c would match the following:
|
||||
// a/b/x/y/z/c
|
||||
// a/x/y/z/b/c
|
||||
// a/b/x/b/x/c
|
||||
// a/b/c
|
||||
// To do this, take the rest of the pattern after
|
||||
// the **, and see if it would match the file remainder.
|
||||
// If so, return success.
|
||||
// If not, the ** "swallows" a segment, and try again.
|
||||
// This is recursively awful.
|
||||
//
|
||||
// a/**/b/**/c matching a/b/x/y/z/c
|
||||
// - a matches a
|
||||
// - doublestar
|
||||
// - matchOne(b/x/y/z/c, b/**/c)
|
||||
// - b matches b
|
||||
// - doublestar
|
||||
// - matchOne(x/y/z/c, c) -> no
|
||||
// - matchOne(y/z/c, c) -> no
|
||||
// - matchOne(z/c, c) -> no
|
||||
// - matchOne(c, c) yes, hit
|
||||
var fr = fi
|
||||
var pr = pi + 1
|
||||
if (pr === pl) {
|
||||
this.debug('** at the end')
|
||||
// a ** at the end will just swallow the rest.
|
||||
// We have found a match.
|
||||
// however, it will not swallow /.x, unless
|
||||
// options.dot is set.
|
||||
// . and .. are *never* matched by **, for explosively
|
||||
// exponential reasons.
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === '.' || file[fi] === '..' ||
|
||||
(!options.dot && file[fi].charAt(0) === '.')) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// ok, let's see if we can swallow whatever we can.
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr]
|
||||
|
||||
this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
|
||||
|
||||
// XXX remove this slice. Just pass the start index.
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug('globstar found match!', fr, fl, swallowee)
|
||||
// found a match.
|
||||
return true
|
||||
} else {
|
||||
// can't swallow "." or ".." ever.
|
||||
// can only swallow ".foo" when explicitly asked.
|
||||
if (swallowee === '.' || swallowee === '..' ||
|
||||
(!options.dot && swallowee.charAt(0) === '.')) {
|
||||
this.debug('dot detected!', file, fr, pattern, pr)
|
||||
break
|
||||
}
|
||||
|
||||
// ** swallows a segment, and continue.
|
||||
this.debug('globstar swallow a segment, and continue')
|
||||
fr++
|
||||
}
|
||||
}
|
||||
|
||||
// no match was found.
|
||||
// However, in partial mode, we can't say this is necessarily over.
|
||||
// If there's more *pattern* left, then
|
||||
/* istanbul ignore if */
|
||||
if (partial) {
|
||||
// ran out of file
|
||||
this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
|
||||
if (fr === fl) return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// something other than **
|
||||
// non-magic patterns just have to match exactly
|
||||
// patterns with magic have been turned into regexps.
|
||||
var hit
|
||||
if (typeof p === 'string') {
|
||||
hit = f === p
|
||||
this.debug('string match', p, f, hit)
|
||||
} else {
|
||||
hit = f.match(p)
|
||||
this.debug('pattern match', p, f, hit)
|
||||
}
|
||||
|
||||
if (!hit) return false
|
||||
}
|
||||
|
||||
// Note: ending in / means that we'll get a final ""
|
||||
// at the end of the pattern. This can only match a
|
||||
// corresponding "" at the end of the file.
|
||||
// If the file ends in /, then it can only match a
|
||||
// a pattern that ends in /, unless the pattern just
|
||||
// doesn't have any more for it. But, a/b/ should *not*
|
||||
// match "a/b/*", even though "" matches against the
|
||||
// [^/]*? pattern, except in partial mode, where it might
|
||||
// simply not be reached yet.
|
||||
// However, a/b/ should still satisfy a/*
|
||||
|
||||
// now either we fell off the end of the pattern, or we're done.
|
||||
if (fi === fl && pi === pl) {
|
||||
// ran out of pattern and filename at the same time.
|
||||
// an exact hit!
|
||||
return true
|
||||
} else if (fi === fl) {
|
||||
// ran out of file, but still had pattern left.
|
||||
// this is ok if we're doing the match as part of
|
||||
// a glob fs traversal.
|
||||
return partial
|
||||
} else /* istanbul ignore else */ if (pi === pl) {
|
||||
// ran out of pattern, still have file left.
|
||||
// this is only acceptable if we're on the very last
|
||||
// empty segment of a file with a trailing slash.
|
||||
// a/* should match a/b/
|
||||
return (fi === fl - 1) && (file[fi] === '')
|
||||
}
|
||||
|
||||
// should be unreachable.
|
||||
/* istanbul ignore next */
|
||||
throw new Error('wtf?')
|
||||
}
|
||||
|
||||
// replace stuff like \* with *
|
||||
function globUnescape (s) {
|
||||
return s.replace(/\\(.)/g, '$1')
|
||||
}
|
||||
|
||||
function regExpEscape (s) {
|
||||
return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
|
||||
}
|
||||
33
unified-ai-platform/node_modules/@jest/reporters/node_modules/minimatch/package.json
generated
vendored
Normal file
33
unified-ai-platform/node_modules/@jest/reporters/node_modules/minimatch/package.json
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
|
||||
"name": "minimatch",
|
||||
"description": "a glob matcher in javascript",
|
||||
"version": "3.1.2",
|
||||
"publishConfig": {
|
||||
"tag": "v3-legacy"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/minimatch.git"
|
||||
},
|
||||
"main": "minimatch.js",
|
||||
"scripts": {
|
||||
"test": "tap",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"postpublish": "git push origin --all; git push origin --tags"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap": "^15.1.6"
|
||||
},
|
||||
"license": "ISC",
|
||||
"files": [
|
||||
"minimatch.js"
|
||||
]
|
||||
}
|
||||
21
unified-ai-platform/node_modules/@jest/schemas/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/schemas/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and 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.
|
||||
3
unified-ai-platform/node_modules/@jest/schemas/README.md
generated
vendored
Normal file
3
unified-ai-platform/node_modules/@jest/schemas/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# `@jest/schemas`
|
||||
|
||||
Experimental and currently incomplete module for JSON schemas for [Jest's](https://jestjs.io/) configuration.
|
||||
60
unified-ai-platform/node_modules/@jest/schemas/build/index.js
generated
vendored
Normal file
60
unified-ai-platform/node_modules/@jest/schemas/build/index.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.SnapshotFormat = void 0;
|
||||
function _typebox() {
|
||||
const data = require('@sinclair/typebox');
|
||||
_typebox = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const RawSnapshotFormat = _typebox().Type.Partial(
|
||||
_typebox().Type.Object({
|
||||
callToJSON: _typebox().Type.Readonly(_typebox().Type.Boolean()),
|
||||
compareKeys: _typebox().Type.Readonly(_typebox().Type.Null()),
|
||||
escapeRegex: _typebox().Type.Readonly(_typebox().Type.Boolean()),
|
||||
escapeString: _typebox().Type.Readonly(_typebox().Type.Boolean()),
|
||||
highlight: _typebox().Type.Readonly(_typebox().Type.Boolean()),
|
||||
indent: _typebox().Type.Readonly(
|
||||
_typebox().Type.Number({
|
||||
minimum: 0
|
||||
})
|
||||
),
|
||||
maxDepth: _typebox().Type.Readonly(
|
||||
_typebox().Type.Number({
|
||||
minimum: 0
|
||||
})
|
||||
),
|
||||
maxWidth: _typebox().Type.Readonly(
|
||||
_typebox().Type.Number({
|
||||
minimum: 0
|
||||
})
|
||||
),
|
||||
min: _typebox().Type.Readonly(_typebox().Type.Boolean()),
|
||||
printBasicPrototype: _typebox().Type.Readonly(_typebox().Type.Boolean()),
|
||||
printFunctionName: _typebox().Type.Readonly(_typebox().Type.Boolean()),
|
||||
theme: _typebox().Type.Readonly(
|
||||
_typebox().Type.Partial(
|
||||
_typebox().Type.Object({
|
||||
comment: _typebox().Type.Readonly(_typebox().Type.String()),
|
||||
content: _typebox().Type.Readonly(_typebox().Type.String()),
|
||||
prop: _typebox().Type.Readonly(_typebox().Type.String()),
|
||||
tag: _typebox().Type.Readonly(_typebox().Type.String()),
|
||||
value: _typebox().Type.Readonly(_typebox().Type.String())
|
||||
})
|
||||
)
|
||||
)
|
||||
})
|
||||
);
|
||||
const SnapshotFormat = _typebox().Type.Strict(RawSnapshotFormat);
|
||||
exports.SnapshotFormat = SnapshotFormat;
|
||||
29
unified-ai-platform/node_modules/@jest/schemas/package.json
generated
vendored
Normal file
29
unified-ai-platform/node_modules/@jest/schemas/package.json
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "@jest/schemas",
|
||||
"version": "29.6.3",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-schemas"
|
||||
},
|
||||
"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": {
|
||||
"@sinclair/typebox": "^0.27.8"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "fb7d95c8af6e0d65a8b65348433d8a0ea0725b5b"
|
||||
}
|
||||
21
unified-ai-platform/node_modules/@jest/source-map/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/source-map/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and 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.
|
||||
85
unified-ai-platform/node_modules/@jest/source-map/build/getCallsite.js
generated
vendored
Normal file
85
unified-ai-platform/node_modules/@jest/source-map/build/getCallsite.js
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = getCallsite;
|
||||
function _traceMapping() {
|
||||
const data = require('@jridgewell/trace-mapping');
|
||||
_traceMapping = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _callsites() {
|
||||
const data = _interopRequireDefault(require('callsites'));
|
||||
_callsites = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _gracefulFs() {
|
||||
const data = require('graceful-fs');
|
||||
_gracefulFs = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* 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/rexxars/sourcemap-decorate-callsites/blob/5b9735a156964973a75dc62fd2c7f0c1975458e8/lib/index.js#L113-L158
|
||||
const addSourceMapConsumer = (callsite, tracer) => {
|
||||
const getLineNumber = callsite.getLineNumber.bind(callsite);
|
||||
const getColumnNumber = callsite.getColumnNumber.bind(callsite);
|
||||
let position = null;
|
||||
function getPosition() {
|
||||
if (!position) {
|
||||
position = (0, _traceMapping().originalPositionFor)(tracer, {
|
||||
column: getColumnNumber() ?? -1,
|
||||
line: getLineNumber() ?? -1
|
||||
});
|
||||
}
|
||||
return position;
|
||||
}
|
||||
Object.defineProperties(callsite, {
|
||||
getColumnNumber: {
|
||||
value() {
|
||||
const value = getPosition().column;
|
||||
return value == null || value === 0 ? getColumnNumber() : value;
|
||||
},
|
||||
writable: false
|
||||
},
|
||||
getLineNumber: {
|
||||
value() {
|
||||
const value = getPosition().line;
|
||||
return value == null || value === 0 ? getLineNumber() : value;
|
||||
},
|
||||
writable: false
|
||||
}
|
||||
});
|
||||
};
|
||||
function getCallsite(level, sourceMaps) {
|
||||
const levelAfterThisCall = level + 1;
|
||||
const stack = (0, _callsites().default)()[levelAfterThisCall];
|
||||
const sourceMapFileName = sourceMaps?.get(stack.getFileName() ?? '');
|
||||
if (sourceMapFileName != null && sourceMapFileName !== '') {
|
||||
try {
|
||||
const sourceMap = (0, _gracefulFs().readFileSync)(
|
||||
sourceMapFileName,
|
||||
'utf8'
|
||||
);
|
||||
addSourceMapConsumer(stack, new (_traceMapping().TraceMap)(sourceMap));
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
15
unified-ai-platform/node_modules/@jest/source-map/build/index.js
generated
vendored
Normal file
15
unified-ai-platform/node_modules/@jest/source-map/build/index.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, 'getCallsite', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _getCallsite.default;
|
||||
}
|
||||
});
|
||||
var _getCallsite = _interopRequireDefault(require('./getCallsite'));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
1
unified-ai-platform/node_modules/@jest/source-map/build/types.js
generated
vendored
Normal file
1
unified-ai-platform/node_modules/@jest/source-map/build/types.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
'use strict';
|
||||
21
unified-ai-platform/node_modules/@jest/test-result/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/test-result/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and 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.
|
||||
69
unified-ai-platform/node_modules/@jest/test-result/build/formatTestResults.js
generated
vendored
Normal file
69
unified-ai-platform/node_modules/@jest/test-result/build/formatTestResults.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = formatTestResults;
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const formatTestResult = (testResult, codeCoverageFormatter, reporter) => {
|
||||
if (testResult.testExecError) {
|
||||
const now = Date.now();
|
||||
return {
|
||||
assertionResults: testResult.testResults,
|
||||
coverage: {},
|
||||
endTime: now,
|
||||
message: testResult.failureMessage ?? testResult.testExecError.message,
|
||||
name: testResult.testFilePath,
|
||||
startTime: now,
|
||||
status: 'failed',
|
||||
summary: ''
|
||||
};
|
||||
}
|
||||
if (testResult.skipped) {
|
||||
const now = Date.now();
|
||||
return {
|
||||
assertionResults: testResult.testResults,
|
||||
coverage: {},
|
||||
endTime: now,
|
||||
message: testResult.failureMessage ?? '',
|
||||
name: testResult.testFilePath,
|
||||
startTime: now,
|
||||
status: 'skipped',
|
||||
summary: ''
|
||||
};
|
||||
}
|
||||
const allTestsExecuted = testResult.numPendingTests === 0;
|
||||
const allTestsPassed = testResult.numFailingTests === 0;
|
||||
return {
|
||||
assertionResults: testResult.testResults,
|
||||
coverage:
|
||||
codeCoverageFormatter != null
|
||||
? codeCoverageFormatter(testResult.coverage, reporter)
|
||||
: testResult.coverage,
|
||||
endTime: testResult.perfStats.end,
|
||||
message: testResult.failureMessage ?? '',
|
||||
name: testResult.testFilePath,
|
||||
startTime: testResult.perfStats.start,
|
||||
status: allTestsPassed
|
||||
? allTestsExecuted
|
||||
? 'passed'
|
||||
: 'focused'
|
||||
: 'failed',
|
||||
summary: ''
|
||||
};
|
||||
};
|
||||
function formatTestResults(results, codeCoverageFormatter, reporter) {
|
||||
const testResults = results.testResults.map(testResult =>
|
||||
formatTestResult(testResult, codeCoverageFormatter, reporter)
|
||||
);
|
||||
return {
|
||||
...results,
|
||||
testResults
|
||||
};
|
||||
}
|
||||
175
unified-ai-platform/node_modules/@jest/test-result/build/helpers.js
generated
vendored
Normal file
175
unified-ai-platform/node_modules/@jest/test-result/build/helpers.js
generated
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.makeEmptyAggregatedTestResult =
|
||||
exports.createEmptyTestResult =
|
||||
exports.buildFailureTestResult =
|
||||
exports.addResult =
|
||||
void 0;
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const makeEmptyAggregatedTestResult = () => ({
|
||||
numFailedTestSuites: 0,
|
||||
numFailedTests: 0,
|
||||
numPassedTestSuites: 0,
|
||||
numPassedTests: 0,
|
||||
numPendingTestSuites: 0,
|
||||
numPendingTests: 0,
|
||||
numRuntimeErrorTestSuites: 0,
|
||||
numTodoTests: 0,
|
||||
numTotalTestSuites: 0,
|
||||
numTotalTests: 0,
|
||||
openHandles: [],
|
||||
snapshot: {
|
||||
added: 0,
|
||||
didUpdate: false,
|
||||
// is set only after the full run
|
||||
failure: false,
|
||||
filesAdded: 0,
|
||||
// combines individual test results + removed files after the full run
|
||||
filesRemoved: 0,
|
||||
filesRemovedList: [],
|
||||
filesUnmatched: 0,
|
||||
filesUpdated: 0,
|
||||
matched: 0,
|
||||
total: 0,
|
||||
unchecked: 0,
|
||||
uncheckedKeysByFile: [],
|
||||
unmatched: 0,
|
||||
updated: 0
|
||||
},
|
||||
startTime: 0,
|
||||
success: true,
|
||||
testResults: [],
|
||||
wasInterrupted: false
|
||||
});
|
||||
exports.makeEmptyAggregatedTestResult = makeEmptyAggregatedTestResult;
|
||||
const buildFailureTestResult = (testPath, err) => ({
|
||||
console: undefined,
|
||||
displayName: undefined,
|
||||
failureMessage: null,
|
||||
leaks: false,
|
||||
numFailingTests: 0,
|
||||
numPassingTests: 0,
|
||||
numPendingTests: 0,
|
||||
numTodoTests: 0,
|
||||
openHandles: [],
|
||||
perfStats: {
|
||||
end: 0,
|
||||
runtime: 0,
|
||||
slow: false,
|
||||
start: 0
|
||||
},
|
||||
skipped: false,
|
||||
snapshot: {
|
||||
added: 0,
|
||||
fileDeleted: false,
|
||||
matched: 0,
|
||||
unchecked: 0,
|
||||
uncheckedKeys: [],
|
||||
unmatched: 0,
|
||||
updated: 0
|
||||
},
|
||||
testExecError: err,
|
||||
testFilePath: testPath,
|
||||
testResults: []
|
||||
});
|
||||
|
||||
// Add individual test result to an aggregated test result
|
||||
exports.buildFailureTestResult = buildFailureTestResult;
|
||||
const addResult = (aggregatedResults, testResult) => {
|
||||
// `todos` are new as of Jest 24, and not all runners return it.
|
||||
// Set it to `0` to avoid `NaN`
|
||||
if (!testResult.numTodoTests) {
|
||||
testResult.numTodoTests = 0;
|
||||
}
|
||||
aggregatedResults.testResults.push(testResult);
|
||||
aggregatedResults.numTotalTests +=
|
||||
testResult.numPassingTests +
|
||||
testResult.numFailingTests +
|
||||
testResult.numPendingTests +
|
||||
testResult.numTodoTests;
|
||||
aggregatedResults.numFailedTests += testResult.numFailingTests;
|
||||
aggregatedResults.numPassedTests += testResult.numPassingTests;
|
||||
aggregatedResults.numPendingTests += testResult.numPendingTests;
|
||||
aggregatedResults.numTodoTests += testResult.numTodoTests;
|
||||
if (testResult.testExecError) {
|
||||
aggregatedResults.numRuntimeErrorTestSuites++;
|
||||
}
|
||||
if (testResult.skipped) {
|
||||
aggregatedResults.numPendingTestSuites++;
|
||||
} else if (testResult.numFailingTests > 0 || testResult.testExecError) {
|
||||
aggregatedResults.numFailedTestSuites++;
|
||||
} else {
|
||||
aggregatedResults.numPassedTestSuites++;
|
||||
}
|
||||
|
||||
// Snapshot data
|
||||
if (testResult.snapshot.added) {
|
||||
aggregatedResults.snapshot.filesAdded++;
|
||||
}
|
||||
if (testResult.snapshot.fileDeleted) {
|
||||
aggregatedResults.snapshot.filesRemoved++;
|
||||
}
|
||||
if (testResult.snapshot.unmatched) {
|
||||
aggregatedResults.snapshot.filesUnmatched++;
|
||||
}
|
||||
if (testResult.snapshot.updated) {
|
||||
aggregatedResults.snapshot.filesUpdated++;
|
||||
}
|
||||
aggregatedResults.snapshot.added += testResult.snapshot.added;
|
||||
aggregatedResults.snapshot.matched += testResult.snapshot.matched;
|
||||
aggregatedResults.snapshot.unchecked += testResult.snapshot.unchecked;
|
||||
if (
|
||||
testResult.snapshot.uncheckedKeys != null &&
|
||||
testResult.snapshot.uncheckedKeys.length > 0
|
||||
) {
|
||||
aggregatedResults.snapshot.uncheckedKeysByFile.push({
|
||||
filePath: testResult.testFilePath,
|
||||
keys: testResult.snapshot.uncheckedKeys
|
||||
});
|
||||
}
|
||||
aggregatedResults.snapshot.unmatched += testResult.snapshot.unmatched;
|
||||
aggregatedResults.snapshot.updated += testResult.snapshot.updated;
|
||||
aggregatedResults.snapshot.total +=
|
||||
testResult.snapshot.added +
|
||||
testResult.snapshot.matched +
|
||||
testResult.snapshot.unmatched +
|
||||
testResult.snapshot.updated;
|
||||
};
|
||||
exports.addResult = addResult;
|
||||
const createEmptyTestResult = () => ({
|
||||
leaks: false,
|
||||
// That's legacy code, just adding it as needed for typing
|
||||
numFailingTests: 0,
|
||||
numPassingTests: 0,
|
||||
numPendingTests: 0,
|
||||
numTodoTests: 0,
|
||||
openHandles: [],
|
||||
perfStats: {
|
||||
end: 0,
|
||||
runtime: 0,
|
||||
slow: false,
|
||||
start: 0
|
||||
},
|
||||
skipped: false,
|
||||
snapshot: {
|
||||
added: 0,
|
||||
fileDeleted: false,
|
||||
matched: 0,
|
||||
unchecked: 0,
|
||||
uncheckedKeys: [],
|
||||
unmatched: 0,
|
||||
updated: 0
|
||||
},
|
||||
testFilePath: '',
|
||||
testResults: []
|
||||
});
|
||||
exports.createEmptyTestResult = createEmptyTestResult;
|
||||
0
unified-ai-platform/node_modules/@jest/test-result/build/index.js
generated
vendored
Normal file
0
unified-ai-platform/node_modules/@jest/test-result/build/index.js
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/test-sequencer/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/test-sequencer/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and 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.
|
||||
83
unified-ai-platform/node_modules/@jest/test-sequencer/build/index.d.ts
generated
vendored
Normal file
83
unified-ai-platform/node_modules/@jest/test-sequencer/build/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import type {AggregatedResult} from '@jest/test-result';
|
||||
import type {Test} from '@jest/test-result';
|
||||
import type {TestContext} from '@jest/test-result';
|
||||
|
||||
declare type Cache_2 = {
|
||||
[key: string]:
|
||||
| [testStatus: typeof FAIL | typeof SUCCESS, testDuration: number]
|
||||
| undefined;
|
||||
};
|
||||
|
||||
declare const FAIL = 0;
|
||||
|
||||
export declare type ShardOptions = {
|
||||
shardIndex: number;
|
||||
shardCount: number;
|
||||
};
|
||||
|
||||
declare const SUCCESS = 1;
|
||||
|
||||
/**
|
||||
* The TestSequencer will ultimately decide which tests should run first.
|
||||
* It is responsible for storing and reading from a local cache
|
||||
* map that stores context information for a given test, such as how long it
|
||||
* took to run during the last run and if it has failed or not.
|
||||
* Such information is used on:
|
||||
* TestSequencer.sort(tests: Array<Test>)
|
||||
* to sort the order of the provided tests.
|
||||
*
|
||||
* After the results are collected,
|
||||
* TestSequencer.cacheResults(tests: Array<Test>, results: AggregatedResult)
|
||||
* is called to store/update this information on the cache map.
|
||||
*/
|
||||
declare class TestSequencer {
|
||||
private readonly _cache;
|
||||
_getCachePath(testContext: TestContext): string;
|
||||
_getCache(test: Test): Cache_2;
|
||||
private _shardPosition;
|
||||
/**
|
||||
* Select tests for shard requested via --shard=shardIndex/shardCount
|
||||
* Sharding is applied before sorting
|
||||
*
|
||||
* @param tests All tests
|
||||
* @param options shardIndex and shardIndex to select
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* class CustomSequencer extends Sequencer {
|
||||
* shard(tests, { shardIndex, shardCount }) {
|
||||
* const shardSize = Math.ceil(tests.length / options.shardCount);
|
||||
* const shardStart = shardSize * (options.shardIndex - 1);
|
||||
* const shardEnd = shardSize * options.shardIndex;
|
||||
* return [...tests]
|
||||
* .sort((a, b) => (a.path > b.path ? 1 : -1))
|
||||
* .slice(shardStart, shardEnd);
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
shard(
|
||||
tests: Array<Test>,
|
||||
options: ShardOptions,
|
||||
): Array<Test> | Promise<Array<Test>>;
|
||||
/**
|
||||
* Sort test to determine order of execution
|
||||
* Sorting is applied after sharding
|
||||
* @param tests
|
||||
*
|
||||
* ```typescript
|
||||
* class CustomSequencer extends Sequencer {
|
||||
* sort(tests) {
|
||||
* const copyTests = Array.from(tests);
|
||||
* return [...tests].sort((a, b) => (a.path > b.path ? 1 : -1));
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
sort(tests: Array<Test>): Array<Test> | Promise<Array
|
||||
287
unified-ai-platform/node_modules/@jest/test-sequencer/build/index.js
generated
vendored
Normal file
287
unified-ai-platform/node_modules/@jest/test-sequencer/build/index.js
generated
vendored
Normal file
@@ -0,0 +1,287 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
function crypto() {
|
||||
const data = _interopRequireWildcard(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 _slash() {
|
||||
const data = _interopRequireDefault(require('slash'));
|
||||
_slash = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _jestHasteMap() {
|
||||
const data = _interopRequireDefault(require('jest-haste-map'));
|
||||
_jestHasteMap = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
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) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const FAIL = 0;
|
||||
const SUCCESS = 1;
|
||||
/**
|
||||
* The TestSequencer will ultimately decide which tests should run first.
|
||||
* It is responsible for storing and reading from a local cache
|
||||
* map that stores context information for a given test, such as how long it
|
||||
* took to run during the last run and if it has failed or not.
|
||||
* Such information is used on:
|
||||
* TestSequencer.sort(tests: Array<Test>)
|
||||
* to sort the order of the provided tests.
|
||||
*
|
||||
* After the results are collected,
|
||||
* TestSequencer.cacheResults(tests: Array<Test>, results: AggregatedResult)
|
||||
* is called to store/update this information on the cache map.
|
||||
*/
|
||||
class TestSequencer {
|
||||
_cache = new Map();
|
||||
_getCachePath(testContext) {
|
||||
const {config} = testContext;
|
||||
const HasteMapClass = _jestHasteMap().default.getStatic(config);
|
||||
return HasteMapClass.getCacheFilePath(
|
||||
config.cacheDirectory,
|
||||
`perf-cache-${config.id}`
|
||||
);
|
||||
}
|
||||
_getCache(test) {
|
||||
const {context} = test;
|
||||
if (!this._cache.has(context) && context.config.cache) {
|
||||
const cachePath = this._getCachePath(context);
|
||||
if (fs().existsSync(cachePath)) {
|
||||
try {
|
||||
this._cache.set(
|
||||
context,
|
||||
JSON.parse(fs().readFileSync(cachePath, 'utf8'))
|
||||
);
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
let cache = this._cache.get(context);
|
||||
if (!cache) {
|
||||
cache = {};
|
||||
this._cache.set(context, cache);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
_shardPosition(options) {
|
||||
const shardRest = options.suiteLength % options.shardCount;
|
||||
const ratio = options.suiteLength / options.shardCount;
|
||||
return new Array(options.shardIndex)
|
||||
.fill(true)
|
||||
.reduce((acc, _, shardIndex) => {
|
||||
const dangles = shardIndex < shardRest;
|
||||
const shardSize = dangles ? Math.ceil(ratio) : Math.floor(ratio);
|
||||
return acc + shardSize;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select tests for shard requested via --shard=shardIndex/shardCount
|
||||
* Sharding is applied before sorting
|
||||
*
|
||||
* @param tests All tests
|
||||
* @param options shardIndex and shardIndex to select
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* class CustomSequencer extends Sequencer {
|
||||
* shard(tests, { shardIndex, shardCount }) {
|
||||
* const shardSize = Math.ceil(tests.length / options.shardCount);
|
||||
* const shardStart = shardSize * (options.shardIndex - 1);
|
||||
* const shardEnd = shardSize * options.shardIndex;
|
||||
* return [...tests]
|
||||
* .sort((a, b) => (a.path > b.path ? 1 : -1))
|
||||
* .slice(shardStart, shardEnd);
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
shard(tests, options) {
|
||||
const shardStart = this._shardPosition({
|
||||
shardCount: options.shardCount,
|
||||
shardIndex: options.shardIndex - 1,
|
||||
suiteLength: tests.length
|
||||
});
|
||||
const shardEnd = this._shardPosition({
|
||||
shardCount: options.shardCount,
|
||||
shardIndex: options.shardIndex,
|
||||
suiteLength: tests.length
|
||||
});
|
||||
return tests
|
||||
.map(test => {
|
||||
const relativeTestPath = path().posix.relative(
|
||||
(0, _slash().default)(test.context.config.rootDir),
|
||||
(0, _slash().default)(test.path)
|
||||
);
|
||||
return {
|
||||
hash: crypto()
|
||||
.createHash('sha1')
|
||||
.update(relativeTestPath)
|
||||
.digest('hex'),
|
||||
test
|
||||
};
|
||||
})
|
||||
.sort((a, b) => (a.hash < b.hash ? -1 : a.hash > b.hash ? 1 : 0))
|
||||
.slice(shardStart, shardEnd)
|
||||
.map(result => result.test);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort test to determine order of execution
|
||||
* Sorting is applied after sharding
|
||||
* @param tests
|
||||
*
|
||||
* ```typescript
|
||||
* class CustomSequencer extends Sequencer {
|
||||
* sort(tests) {
|
||||
* const copyTests = Array.from(tests);
|
||||
* return [...tests].sort((a, b) => (a.path > b.path ? 1 : -1));
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
sort(tests) {
|
||||
/**
|
||||
* Sorting tests is very important because it has a great impact on the
|
||||
* user-perceived responsiveness and speed of the test run.
|
||||
*
|
||||
* If such information is on cache, tests are sorted based on:
|
||||
* -> Has it failed during the last run ?
|
||||
* Since it's important to provide the most expected feedback as quickly
|
||||
* as possible.
|
||||
* -> How long it took to run ?
|
||||
* Because running long tests first is an effort to minimize worker idle
|
||||
* time at the end of a long test run.
|
||||
* And if that information is not available they are sorted based on file size
|
||||
* since big test files usually take longer to complete.
|
||||
*
|
||||
* Note that a possible improvement would be to analyse other information
|
||||
* from the file other than its size.
|
||||
*
|
||||
*/
|
||||
const stats = {};
|
||||
const fileSize = ({path, context: {hasteFS}}) =>
|
||||
stats[path] || (stats[path] = hasteFS.getSize(path) ?? 0);
|
||||
tests.forEach(test => {
|
||||
test.duration = this.time(test);
|
||||
});
|
||||
return tests.sort((testA, testB) => {
|
||||
const failedA = this.hasFailed(testA);
|
||||
const failedB = this.hasFailed(testB);
|
||||
const hasTimeA = testA.duration != null;
|
||||
if (failedA !== failedB) {
|
||||
return failedA ? -1 : 1;
|
||||
} else if (hasTimeA != (testB.duration != null)) {
|
||||
// If only one of two tests has timing information, run it last
|
||||
return hasTimeA ? 1 : -1;
|
||||
} else if (testA.duration != null && testB.duration != null) {
|
||||
return testA.duration < testB.duration ? 1 : -1;
|
||||
} else {
|
||||
return fileSize(testA) < fileSize(testB) ? 1 : -1;
|
||||
}
|
||||
});
|
||||
}
|
||||
allFailedTests(tests) {
|
||||
return this.sort(tests.filter(test => this.hasFailed(test)));
|
||||
}
|
||||
cacheResults(tests, results) {
|
||||
const map = Object.create(null);
|
||||
tests.forEach(test => (map[test.path] = test));
|
||||
results.testResults.forEach(testResult => {
|
||||
const test = map[testResult.testFilePath];
|
||||
if (test != null && !testResult.skipped) {
|
||||
const cache = this._getCache(test);
|
||||
const perf = testResult.perfStats;
|
||||
const testRuntime =
|
||||
perf.runtime ?? test.duration ?? perf.end - perf.start;
|
||||
cache[testResult.testFilePath] = [
|
||||
testResult.numFailingTests > 0 ? FAIL : SUCCESS,
|
||||
testRuntime || 0
|
||||
];
|
||||
}
|
||||
});
|
||||
this._cache.forEach((cache, context) =>
|
||||
fs().writeFileSync(this._getCachePath(context), JSON.stringify(cache))
|
||||
);
|
||||
}
|
||||
hasFailed(test) {
|
||||
const cache = this._getCache(test);
|
||||
return cache[test.path]?.[0] === FAIL;
|
||||
}
|
||||
time(test) {
|
||||
const cache = this._getCache(test);
|
||||
return cache[test.path]?.[1];
|
||||
}
|
||||
}
|
||||
exports.default = TestSequencer;
|
||||
36
unified-ai-platform/node_modules/@jest/test-sequencer/package.json
generated
vendored
Normal file
36
unified-ai-platform/node_modules/@jest/test-sequencer/package.json
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "@jest/test-sequencer",
|
||||
"version": "29.7.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-test-sequencer"
|
||||
},
|
||||
"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/test-result": "^29.7.0",
|
||||
"graceful-fs": "^4.2.9",
|
||||
"jest-haste-map": "^29.7.0",
|
||||
"slash": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/test-utils": "^29.7.0",
|
||||
"@types/graceful-fs": "^4.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
|
||||
}
|
||||
21
unified-ai-platform/node_modules/@jest/transform/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/transform/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and 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.
|
||||
76
unified-ai-platform/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js
generated
vendored
Normal file
76
unified-ai-platform/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = handlePotentialSyntaxError;
|
||||
exports.enhanceUnexpectedTokenMessage = enhanceUnexpectedTokenMessage;
|
||||
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) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const DOT = ' \u2022 ';
|
||||
function handlePotentialSyntaxError(e) {
|
||||
if (e.codeFrame != null) {
|
||||
e.stack = `${e.message}\n${e.codeFrame}`;
|
||||
}
|
||||
if (
|
||||
// `instanceof` might come from the wrong context
|
||||
e.name === 'SyntaxError' &&
|
||||
!e.message.includes(' expected')
|
||||
) {
|
||||
throw enhanceUnexpectedTokenMessage(e);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
function enhanceUnexpectedTokenMessage(e) {
|
||||
e.stack = `${_chalk().default.bold.red(
|
||||
'Jest encountered an unexpected token'
|
||||
)}
|
||||
|
||||
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
|
||||
|
||||
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
|
||||
|
||||
By default "node_modules" folder is ignored by transformers.
|
||||
|
||||
Here's what you can do:
|
||||
${DOT}If you are trying to use ECMAScript Modules, see ${_chalk().default.underline(
|
||||
'https://jestjs.io/docs/ecmascript-modules'
|
||||
)} for how to enable it.
|
||||
${DOT}If you are trying to use TypeScript, see ${_chalk().default.underline(
|
||||
'https://jestjs.io/docs/getting-started#using-typescript'
|
||||
)}
|
||||
${DOT}To have some of your "node_modules" files transformed, you can specify a custom ${_chalk().default.bold(
|
||||
'"transformIgnorePatterns"'
|
||||
)} in your config.
|
||||
${DOT}If you need a custom transformation specify a ${_chalk().default.bold(
|
||||
'"transform"'
|
||||
)} option in your config.
|
||||
${DOT}If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the ${_chalk().default.bold(
|
||||
'"moduleNameMapper"'
|
||||
)} config option.
|
||||
|
||||
You'll find more details and examples of these config options in the docs:
|
||||
${_chalk().default.cyan('https://jestjs.io/docs/configuration')}
|
||||
For information about custom transformations, see:
|
||||
${_chalk().default.cyan('https://jestjs.io/docs/code-transformation')}
|
||||
|
||||
${_chalk().default.bold.red('Details:')}
|
||||
|
||||
${e.stack ?? ''}`.trimRight();
|
||||
return e;
|
||||
}
|
||||
37
unified-ai-platform/node_modules/@jest/transform/build/index.js
generated
vendored
Normal file
37
unified-ai-platform/node_modules/@jest/transform/build/index.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, 'createScriptTransformer', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _ScriptTransformer.createScriptTransformer;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'createTranspilingRequire', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _ScriptTransformer.createTranspilingRequire;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'handlePotentialSyntaxError', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _enhanceUnexpectedTokenMessage.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'shouldInstrument', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _shouldInstrument.default;
|
||||
}
|
||||
});
|
||||
var _ScriptTransformer = require('./ScriptTransformer');
|
||||
var _shouldInstrument = _interopRequireDefault(require('./shouldInstrument'));
|
||||
var _enhanceUnexpectedTokenMessage = _interopRequireDefault(
|
||||
require('./enhanceUnexpectedTokenMessage')
|
||||
);
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
0
unified-ai-platform/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.js
generated
vendored
Normal file
0
unified-ai-platform/node_modules/@jest/transform/build/runtimeErrorsAndWarnings.js
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/types/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/@jest/types/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and 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.
|
||||
1
unified-ai-platform/node_modules/@jest/types/build/Circus.js
generated
vendored
Normal file
1
unified-ai-platform/node_modules/@jest/types/build/Circus.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
'use strict';
|
||||
1
unified-ai-platform/node_modules/@jest/types/build/Config.js
generated
vendored
Normal file
1
unified-ai-platform/node_modules/@jest/types/build/Config.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
'use strict';
|
||||
0
unified-ai-platform/node_modules/@jest/types/build/Global.js
generated
vendored
Normal file
0
unified-ai-platform/node_modules/@jest/types/build/Global.js
generated
vendored
Normal file
Reference in New Issue
Block a user