mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-02-04 05:50:50 +00:00
nhj
more
This commit is contained in:
21
unified-ai-platform/node_modules/jest-circus/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/jest-circus/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.
|
||||
281
unified-ai-platform/node_modules/jest-circus/build/eventHandler.js
generated
vendored
Normal file
281
unified-ai-platform/node_modules/jest-circus/build/eventHandler.js
generated
vendored
Normal file
@@ -0,0 +1,281 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _jestUtil = require('jest-util');
|
||||
var _globalErrorHandlers = require('./globalErrorHandlers');
|
||||
var _types = require('./types');
|
||||
var _utils = require('./utils');
|
||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
|
||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
|
||||
var jestNow = globalThis[Symbol.for('jest-native-now')] || globalThis.Date.now;
|
||||
/**
|
||||
* 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 eventHandler = (event, state) => {
|
||||
switch (event.name) {
|
||||
case 'include_test_location_in_result': {
|
||||
state.includeTestLocationInResult = true;
|
||||
break;
|
||||
}
|
||||
case 'hook_start': {
|
||||
event.hook.seenDone = false;
|
||||
break;
|
||||
}
|
||||
case 'start_describe_definition': {
|
||||
const {blockName, mode} = event;
|
||||
const {currentDescribeBlock, currentlyRunningTest} = state;
|
||||
if (currentlyRunningTest) {
|
||||
currentlyRunningTest.errors.push(
|
||||
new Error(
|
||||
`Cannot nest a describe inside a test. Describe block "${blockName}" cannot run because it is nested within "${currentlyRunningTest.name}".`
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
const describeBlock = (0, _utils.makeDescribe)(
|
||||
blockName,
|
||||
currentDescribeBlock,
|
||||
mode
|
||||
);
|
||||
currentDescribeBlock.children.push(describeBlock);
|
||||
state.currentDescribeBlock = describeBlock;
|
||||
break;
|
||||
}
|
||||
case 'finish_describe_definition': {
|
||||
const {currentDescribeBlock} = state;
|
||||
(0, _jestUtil.invariant)(
|
||||
currentDescribeBlock,
|
||||
'currentDescribeBlock must be there'
|
||||
);
|
||||
if (!(0, _utils.describeBlockHasTests)(currentDescribeBlock)) {
|
||||
currentDescribeBlock.hooks.forEach(hook => {
|
||||
hook.asyncError.message = `Invalid: ${hook.type}() may not be used in a describe block containing no tests.`;
|
||||
state.unhandledErrors.push(hook.asyncError);
|
||||
});
|
||||
}
|
||||
|
||||
// pass mode of currentDescribeBlock to tests
|
||||
// but do not when there is already a single test with "only" mode
|
||||
const shouldPassMode = !(
|
||||
currentDescribeBlock.mode === 'only' &&
|
||||
currentDescribeBlock.children.some(
|
||||
child => child.type === 'test' && child.mode === 'only'
|
||||
)
|
||||
);
|
||||
if (shouldPassMode) {
|
||||
currentDescribeBlock.children.forEach(child => {
|
||||
if (child.type === 'test' && !child.mode) {
|
||||
child.mode = currentDescribeBlock.mode;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (
|
||||
!state.hasFocusedTests &&
|
||||
currentDescribeBlock.mode !== 'skip' &&
|
||||
currentDescribeBlock.children.some(
|
||||
child => child.type === 'test' && child.mode === 'only'
|
||||
)
|
||||
) {
|
||||
state.hasFocusedTests = true;
|
||||
}
|
||||
if (currentDescribeBlock.parent) {
|
||||
state.currentDescribeBlock = currentDescribeBlock.parent;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'add_hook': {
|
||||
const {currentDescribeBlock, currentlyRunningTest, hasStarted} = state;
|
||||
const {asyncError, fn, hookType: type, timeout} = event;
|
||||
if (currentlyRunningTest) {
|
||||
currentlyRunningTest.errors.push(
|
||||
new Error(
|
||||
`Hooks cannot be defined inside tests. Hook of type "${type}" is nested within "${currentlyRunningTest.name}".`
|
||||
)
|
||||
);
|
||||
break;
|
||||
} else if (hasStarted) {
|
||||
state.unhandledErrors.push(
|
||||
new Error(
|
||||
'Cannot add a hook after tests have started running. Hooks must be defined synchronously.'
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
const parent = currentDescribeBlock;
|
||||
currentDescribeBlock.hooks.push({
|
||||
asyncError,
|
||||
fn,
|
||||
parent,
|
||||
seenDone: false,
|
||||
timeout,
|
||||
type
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'add_test': {
|
||||
const {currentDescribeBlock, currentlyRunningTest, hasStarted} = state;
|
||||
const {
|
||||
asyncError,
|
||||
fn,
|
||||
mode,
|
||||
testName: name,
|
||||
timeout,
|
||||
concurrent,
|
||||
failing
|
||||
} = event;
|
||||
if (currentlyRunningTest) {
|
||||
currentlyRunningTest.errors.push(
|
||||
new Error(
|
||||
`Tests cannot be nested. Test "${name}" cannot run because it is nested within "${currentlyRunningTest.name}".`
|
||||
)
|
||||
);
|
||||
break;
|
||||
} else if (hasStarted) {
|
||||
state.unhandledErrors.push(
|
||||
new Error(
|
||||
'Cannot add a test after tests have started running. Tests must be defined synchronously.'
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
const test = (0, _utils.makeTest)(
|
||||
fn,
|
||||
mode,
|
||||
concurrent,
|
||||
name,
|
||||
currentDescribeBlock,
|
||||
timeout,
|
||||
asyncError,
|
||||
failing
|
||||
);
|
||||
if (currentDescribeBlock.mode !== 'skip' && test.mode === 'only') {
|
||||
state.hasFocusedTests = true;
|
||||
}
|
||||
currentDescribeBlock.children.push(test);
|
||||
currentDescribeBlock.tests.push(test);
|
||||
break;
|
||||
}
|
||||
case 'hook_failure': {
|
||||
const {test, describeBlock, error, hook} = event;
|
||||
const {asyncError, type} = hook;
|
||||
if (type === 'beforeAll') {
|
||||
(0, _jestUtil.invariant)(
|
||||
describeBlock,
|
||||
'always present for `*All` hooks'
|
||||
);
|
||||
(0, _utils.addErrorToEachTestUnderDescribe)(
|
||||
describeBlock,
|
||||
error,
|
||||
asyncError
|
||||
);
|
||||
} else if (type === 'afterAll') {
|
||||
// Attaching `afterAll` errors to each test makes execution flow
|
||||
// too complicated, so we'll consider them to be global.
|
||||
state.unhandledErrors.push([error, asyncError]);
|
||||
} else {
|
||||
(0, _jestUtil.invariant)(test, 'always present for `*Each` hooks');
|
||||
test.errors.push([error, asyncError]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'test_skip': {
|
||||
event.test.status = 'skip';
|
||||
break;
|
||||
}
|
||||
case 'test_todo': {
|
||||
event.test.status = 'todo';
|
||||
break;
|
||||
}
|
||||
case 'test_done': {
|
||||
event.test.duration = (0, _utils.getTestDuration)(event.test);
|
||||
event.test.status = 'done';
|
||||
state.currentlyRunningTest = null;
|
||||
break;
|
||||
}
|
||||
case 'test_start': {
|
||||
state.currentlyRunningTest = event.test;
|
||||
event.test.startedAt = jestNow();
|
||||
event.test.invocations += 1;
|
||||
break;
|
||||
}
|
||||
case 'test_fn_start': {
|
||||
event.test.seenDone = false;
|
||||
break;
|
||||
}
|
||||
case 'test_fn_failure': {
|
||||
const {
|
||||
error,
|
||||
test: {asyncError}
|
||||
} = event;
|
||||
event.test.errors.push([error, asyncError]);
|
||||
break;
|
||||
}
|
||||
case 'test_retry': {
|
||||
const logErrorsBeforeRetry =
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
global[_types.LOG_ERRORS_BEFORE_RETRY] || false;
|
||||
if (logErrorsBeforeRetry) {
|
||||
event.test.retryReasons.push(...event.test.errors);
|
||||
}
|
||||
event.test.errors = [];
|
||||
break;
|
||||
}
|
||||
case 'run_start': {
|
||||
state.hasStarted = true;
|
||||
/* eslint-disable no-restricted-globals */
|
||||
global[_types.TEST_TIMEOUT_SYMBOL] &&
|
||||
(state.testTimeout = global[_types.TEST_TIMEOUT_SYMBOL]);
|
||||
/* eslint-enable */
|
||||
break;
|
||||
}
|
||||
case 'run_finish': {
|
||||
break;
|
||||
}
|
||||
case 'setup': {
|
||||
// Uncaught exception handlers should be defined on the parent process
|
||||
// object. If defined on the VM's process object they just no op and let
|
||||
// the parent process crash. It might make sense to return a `dispatch`
|
||||
// function to the parent process and register handlers there instead, but
|
||||
// i'm not sure if this is works. For now i just replicated whatever
|
||||
// jasmine was doing -- dabramov
|
||||
state.parentProcess = event.parentProcess;
|
||||
(0, _jestUtil.invariant)(state.parentProcess);
|
||||
state.originalGlobalErrorHandlers = (0,
|
||||
_globalErrorHandlers.injectGlobalErrorHandlers)(state.parentProcess);
|
||||
if (event.testNamePattern) {
|
||||
state.testNamePattern = new RegExp(event.testNamePattern, 'i');
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'teardown': {
|
||||
(0, _jestUtil.invariant)(state.originalGlobalErrorHandlers);
|
||||
(0, _jestUtil.invariant)(state.parentProcess);
|
||||
(0, _globalErrorHandlers.restoreGlobalErrorHandlers)(
|
||||
state.parentProcess,
|
||||
state.originalGlobalErrorHandlers
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 'error': {
|
||||
// It's very likely for long-running async tests to throw errors. In this
|
||||
// case we want to catch them and fail the current test. At the same time
|
||||
// there's a possibility that one test sets a long timeout, that will
|
||||
// eventually throw after this test finishes but during some other test
|
||||
// execution, which will result in one test's error failing another test.
|
||||
// In any way, it should be possible to track where the error was thrown
|
||||
// from.
|
||||
state.currentlyRunningTest
|
||||
? state.currentlyRunningTest.errors.push(event.error)
|
||||
: state.unhandledErrors.push(event.error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
var _default = eventHandler;
|
||||
exports.default = _default;
|
||||
186
unified-ai-platform/node_modules/jest-circus/build/formatNodeAssertErrors.js
generated
vendored
Normal file
186
unified-ai-platform/node_modules/jest-circus/build/formatNodeAssertErrors.js
generated
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _assert = require('assert');
|
||||
var _chalk = _interopRequireDefault(require('chalk'));
|
||||
var _jestMatcherUtils = require('jest-matcher-utils');
|
||||
var _prettyFormat = require('pretty-format');
|
||||
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 assertOperatorsMap = {
|
||||
'!=': 'notEqual',
|
||||
'!==': 'notStrictEqual',
|
||||
'==': 'equal',
|
||||
'===': 'strictEqual'
|
||||
};
|
||||
const humanReadableOperators = {
|
||||
deepEqual: 'to deeply equal',
|
||||
deepStrictEqual: 'to deeply and strictly equal',
|
||||
equal: 'to be equal',
|
||||
notDeepEqual: 'not to deeply equal',
|
||||
notDeepStrictEqual: 'not to deeply and strictly equal',
|
||||
notEqual: 'to not be equal',
|
||||
notStrictEqual: 'not be strictly equal',
|
||||
strictEqual: 'to strictly be equal'
|
||||
};
|
||||
const formatNodeAssertErrors = (event, state) => {
|
||||
if (event.name === 'test_done') {
|
||||
event.test.errors = event.test.errors.map(errors => {
|
||||
let error;
|
||||
if (Array.isArray(errors)) {
|
||||
const [originalError, asyncError] = errors;
|
||||
if (originalError == null) {
|
||||
error = asyncError;
|
||||
} else if (!originalError.stack) {
|
||||
error = asyncError;
|
||||
error.message = originalError.message
|
||||
? originalError.message
|
||||
: `thrown: ${(0, _prettyFormat.format)(originalError, {
|
||||
maxDepth: 3
|
||||
})}`;
|
||||
} else {
|
||||
error = originalError;
|
||||
}
|
||||
} else {
|
||||
error = errors;
|
||||
}
|
||||
return isAssertionError(error)
|
||||
? {
|
||||
message: assertionErrorMessage(error, {
|
||||
expand: state.expand
|
||||
})
|
||||
}
|
||||
: errors;
|
||||
});
|
||||
}
|
||||
};
|
||||
const getOperatorName = (operator, stack) => {
|
||||
if (typeof operator === 'string') {
|
||||
return assertOperatorsMap[operator] || operator;
|
||||
}
|
||||
if (stack.match('.doesNotThrow')) {
|
||||
return 'doesNotThrow';
|
||||
}
|
||||
if (stack.match('.throws')) {
|
||||
return 'throws';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
const operatorMessage = operator => {
|
||||
const niceOperatorName = getOperatorName(operator, '');
|
||||
const humanReadableOperator = humanReadableOperators[niceOperatorName];
|
||||
return typeof operator === 'string'
|
||||
? `${humanReadableOperator || niceOperatorName} to:\n`
|
||||
: '';
|
||||
};
|
||||
const assertThrowingMatcherHint = operatorName =>
|
||||
operatorName
|
||||
? _chalk.default.dim('assert') +
|
||||
_chalk.default.dim(`.${operatorName}(`) +
|
||||
_chalk.default.red('function') +
|
||||
_chalk.default.dim(')')
|
||||
: '';
|
||||
const assertMatcherHint = (operator, operatorName, expected) => {
|
||||
let message = '';
|
||||
if (operator === '==' && expected === true) {
|
||||
message =
|
||||
_chalk.default.dim('assert') +
|
||||
_chalk.default.dim('(') +
|
||||
_chalk.default.red('received') +
|
||||
_chalk.default.dim(')');
|
||||
} else if (operatorName) {
|
||||
message =
|
||||
_chalk.default.dim('assert') +
|
||||
_chalk.default.dim(`.${operatorName}(`) +
|
||||
_chalk.default.red('received') +
|
||||
_chalk.default.dim(', ') +
|
||||
_chalk.default.green('expected') +
|
||||
_chalk.default.dim(')');
|
||||
}
|
||||
return message;
|
||||
};
|
||||
function assertionErrorMessage(error, options) {
|
||||
const {expected, actual, generatedMessage, message, operator, stack} = error;
|
||||
const diffString = (0, _jestMatcherUtils.diff)(expected, actual, options);
|
||||
const hasCustomMessage = !generatedMessage;
|
||||
const operatorName = getOperatorName(operator, stack);
|
||||
const trimmedStack = stack
|
||||
.replace(message, '')
|
||||
.replace(/AssertionError(.*)/g, '');
|
||||
if (operatorName === 'doesNotThrow') {
|
||||
return (
|
||||
// eslint-disable-next-line prefer-template
|
||||
buildHintString(assertThrowingMatcherHint(operatorName)) +
|
||||
_chalk.default.reset('Expected the function not to throw an error.\n') +
|
||||
_chalk.default.reset('Instead, it threw:\n') +
|
||||
` ${(0, _jestMatcherUtils.printReceived)(actual)}` +
|
||||
_chalk.default.reset(
|
||||
hasCustomMessage ? `\n\nMessage:\n ${message}` : ''
|
||||
) +
|
||||
trimmedStack
|
||||
);
|
||||
}
|
||||
if (operatorName === 'throws') {
|
||||
if (error.generatedMessage) {
|
||||
return (
|
||||
buildHintString(assertThrowingMatcherHint(operatorName)) +
|
||||
_chalk.default.reset(error.message) +
|
||||
_chalk.default.reset(
|
||||
hasCustomMessage ? `\n\nMessage:\n ${message}` : ''
|
||||
) +
|
||||
trimmedStack
|
||||
);
|
||||
}
|
||||
return (
|
||||
buildHintString(assertThrowingMatcherHint(operatorName)) +
|
||||
_chalk.default.reset('Expected the function to throw an error.\n') +
|
||||
_chalk.default.reset("But it didn't throw anything.") +
|
||||
_chalk.default.reset(
|
||||
hasCustomMessage ? `\n\nMessage:\n ${message}` : ''
|
||||
) +
|
||||
trimmedStack
|
||||
);
|
||||
}
|
||||
if (operatorName === 'fail') {
|
||||
return (
|
||||
buildHintString(assertMatcherHint(operator, operatorName, expected)) +
|
||||
_chalk.default.reset(hasCustomMessage ? `Message:\n ${message}` : '') +
|
||||
trimmedStack
|
||||
);
|
||||
}
|
||||
return (
|
||||
// eslint-disable-next-line prefer-template
|
||||
buildHintString(assertMatcherHint(operator, operatorName, expected)) +
|
||||
_chalk.default.reset(`Expected value ${operatorMessage(operator)}`) +
|
||||
` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
|
||||
_chalk.default.reset('Received:\n') +
|
||||
` ${(0, _jestMatcherUtils.printReceived)(actual)}` +
|
||||
_chalk.default.reset(hasCustomMessage ? `\n\nMessage:\n ${message}` : '') +
|
||||
(diffString ? `\n\nDifference:\n\n${diffString}` : '') +
|
||||
trimmedStack
|
||||
);
|
||||
}
|
||||
function isAssertionError(error) {
|
||||
return (
|
||||
error &&
|
||||
(error instanceof _assert.AssertionError ||
|
||||
error.name === _assert.AssertionError.name ||
|
||||
error.code === 'ERR_ASSERTION')
|
||||
);
|
||||
}
|
||||
function buildHintString(hint) {
|
||||
return hint ? `${hint}\n\n` : '';
|
||||
}
|
||||
var _default = formatNodeAssertErrors;
|
||||
exports.default = _default;
|
||||
0
unified-ai-platform/node_modules/jest-circus/build/globalErrorHandlers.js
generated
vendored
Normal file
0
unified-ai-platform/node_modules/jest-circus/build/globalErrorHandlers.js
generated
vendored
Normal file
0
unified-ai-platform/node_modules/jest-circus/node_modules/dedent/LICENSE.md
generated
vendored
Normal file
0
unified-ai-platform/node_modules/jest-circus/node_modules/dedent/LICENSE.md
generated
vendored
Normal file
73
unified-ai-platform/node_modules/jest-circus/node_modules/dedent/dist/dedent.js
generated
vendored
Normal file
73
unified-ai-platform/node_modules/jest-circus/node_modules/dedent/dist/dedent.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
const dedent = createDedent({});
|
||||
var _default = exports.default = dedent;
|
||||
function createDedent(options) {
|
||||
dedent.withOptions = newOptions => createDedent({
|
||||
...options,
|
||||
...newOptions
|
||||
});
|
||||
return dedent;
|
||||
function dedent(strings, ...values) {
|
||||
const raw = typeof strings === "string" ? [strings] : strings.raw;
|
||||
const {
|
||||
escapeSpecialCharacters = Array.isArray(strings),
|
||||
trimWhitespace = true
|
||||
} = options;
|
||||
|
||||
// first, perform interpolation
|
||||
let result = "";
|
||||
for (let i = 0; i < raw.length; i++) {
|
||||
let next = raw[i];
|
||||
if (escapeSpecialCharacters) {
|
||||
// handle escaped newlines, backticks, and interpolation characters
|
||||
next = next.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{");
|
||||
}
|
||||
result += next;
|
||||
if (i < values.length) {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
||||
result += values[i];
|
||||
}
|
||||
}
|
||||
|
||||
// now strip indentation
|
||||
const lines = result.split("\n");
|
||||
let mindent = null;
|
||||
for (const l of lines) {
|
||||
const m = l.match(/^(\s+)\S+/);
|
||||
if (m) {
|
||||
const indent = m[1].length;
|
||||
if (!mindent) {
|
||||
// this is the first indented line
|
||||
mindent = indent;
|
||||
} else {
|
||||
mindent = Math.min(mindent, indent);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mindent !== null) {
|
||||
const m = mindent; // appease TypeScript
|
||||
result = lines
|
||||
// https://github.com/typescript-eslint/typescript-eslint/issues/7140
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
|
||||
.map(l => l[0] === " " || l[0] === "\t" ? l.slice(m) : l).join("\n");
|
||||
}
|
||||
|
||||
// dedent eats leading and trailing whitespace too
|
||||
if (trimWhitespace) {
|
||||
result = result.trim();
|
||||
}
|
||||
|
||||
// handle escaped newlines at the end to ensure they don't get stripped too
|
||||
if (escapeSpecialCharacters) {
|
||||
result = result.replace(/\\n/g, "\n");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
module.exports = exports.default;
|
||||
module.exports.default = exports.default;
|
||||
32
unified-ai-platform/node_modules/jest-circus/node_modules/dedent/macro.js
generated
vendored
Normal file
32
unified-ai-platform/node_modules/jest-circus/node_modules/dedent/macro.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
const { MacroError, createMacro } = require("babel-plugin-macros");
|
||||
const dedent = require("./dist/dedent.js").default;
|
||||
|
||||
module.exports = createMacro(prevalMacros);
|
||||
|
||||
function prevalMacros({ babel, references, state }) {
|
||||
references.default.forEach((referencePath) => {
|
||||
if (referencePath.parentPath.type === "TaggedTemplateExpression") {
|
||||
asTag(referencePath.parentPath.get("quasi"), state, babel);
|
||||
} else if (referencePath.parentPath.type === "CallExpression") {
|
||||
asFunction(referencePath.parentPath.get("arguments"), state, babel);
|
||||
} else {
|
||||
throw new MacroError(
|
||||
`dedent.macro can only be used as tagged template expression or function call. You tried ${referencePath.parentPath.type}.`,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function asTag(quasiPath, _, babel) {
|
||||
const string = quasiPath.parentPath.get("quasi").evaluate().value;
|
||||
const { types: t } = babel;
|
||||
|
||||
quasiPath.parentPath.replaceWith(t.stringLiteral(dedent(string)));
|
||||
}
|
||||
|
||||
function asFunction(argumentsPaths, _, babel) {
|
||||
const string = argumentsPaths[0].evaluate().value;
|
||||
const { types: t } = babel;
|
||||
|
||||
argumentsPaths[0].parentPath.replaceWith(t.stringLiteral(dedent(string)));
|
||||
}
|
||||
119
unified-ai-platform/node_modules/jest-circus/node_modules/dedent/package.json
generated
vendored
Normal file
119
unified-ai-platform/node_modules/jest-circus/node_modules/dedent/package.json
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
{
|
||||
"name": "dedent",
|
||||
"version": "1.6.0",
|
||||
"description": "A string tag that strips indentation from multi-line strings. ⬅️",
|
||||
"keywords": [
|
||||
"dedent",
|
||||
"tag",
|
||||
"multi-line string",
|
||||
"es6"
|
||||
],
|
||||
"homepage": "https://github.com/dmnd/dedent",
|
||||
"bugs": {
|
||||
"url": "https://github.com/dmnd/dedent/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/dmnd/dedent"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Desmond Brand",
|
||||
"email": "dmnd@desmondbrand.com",
|
||||
"url": "http://desmondbrand.com"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": {
|
||||
"import": "./dist/dedent.d.mts",
|
||||
"require": "./dist/dedent.d.ts"
|
||||
},
|
||||
"import": "./dist/dedent.mjs",
|
||||
"require": "./dist/dedent.js"
|
||||
}
|
||||
},
|
||||
"main": "./dist/dedent.js",
|
||||
"module": "./dist/dedent.mjs",
|
||||
"types": "./dist/dedent.d.mts",
|
||||
"files": [
|
||||
"dist/",
|
||||
"macro.js",
|
||||
"package.json",
|
||||
"LICENSE.md",
|
||||
"README.md"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "pnpm build:legacy && pnpm build:modern && pnpm build:types",
|
||||
"build:legacy": "BABEL_ENV=legacy babel src/dedent.ts --out-file dist/dedent.js",
|
||||
"build:modern": "BABEL_ENV=modern babel src/dedent.ts --out-file dist/dedent.mjs",
|
||||
"build:types": "tsup src/dedent.ts --dts-only",
|
||||
"format": "prettier \"**/*\" --ignore-unknown",
|
||||
"lint": "eslint . .*js --max-warnings 0 --report-unused-disable-directives",
|
||||
"lint:knip": "knip",
|
||||
"lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\"",
|
||||
"lint:package-json": "npmPkgJsonLint .",
|
||||
"lint:packages": "pnpm dedupe --check",
|
||||
"lint:spelling": "cspell \"**\" \".github/**/*\"",
|
||||
"prepare": "husky install",
|
||||
"should-semantic-release": "should-semantic-release --verbose",
|
||||
"test": "jest",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*": "prettier --ignore-unknown --write"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.21.5",
|
||||
"@babel/preset-env": "^7.23.3",
|
||||
"@babel/preset-typescript": "^7.23.3",
|
||||
"@release-it/conventional-changelog": "^8.0.1",
|
||||
"@types/babel-plugin-macros": "^3.1.0",
|
||||
"@types/eslint": "^8.44.7",
|
||||
"@types/jest": "^29.5.3",
|
||||
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
||||
"@typescript-eslint/parser": "^6.10.0",
|
||||
"babel-plugin-add-module-exports": "^1.0.4",
|
||||
"babel-plugin-tester": "^11.0.4",
|
||||
"console-fail-test": "^0.2.3",
|
||||
"cspell": "^8.0.0",
|
||||
"eslint": "^8.53.0",
|
||||
"eslint-plugin-deprecation": "^2.0.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-jest": "^27.6.0",
|
||||
"eslint-plugin-jsdoc": "^46.9.0",
|
||||
"eslint-plugin-jsonc": "^2.10.0",
|
||||
"eslint-plugin-markdown": "^3.0.1",
|
||||
"eslint-plugin-n": "^16.3.1",
|
||||
"eslint-plugin-no-only-tests": "^3.1.0",
|
||||
"eslint-plugin-perfectionist": "^2.3.0",
|
||||
"eslint-plugin-regexp": "^2.1.1",
|
||||
"eslint-plugin-yml": "^1.10.0",
|
||||
"husky": "^8.0.3",
|
||||
"jest": "^29.7.0",
|
||||
"jsonc-eslint-parser": "^2.4.0",
|
||||
"knip": "^2.41.0",
|
||||
"lint-staged": "^15.1.0",
|
||||
"markdownlint": "^0.31.1",
|
||||
"markdownlint-cli": "^0.37.0",
|
||||
"npm-package-json-lint": "^7.1.0",
|
||||
"npm-package-json-lint-config-default": "^6.0.0",
|
||||
"prettier": "^3.0.3",
|
||||
"prettier-plugin-curly": "^0.1.3",
|
||||
"prettier-plugin-packagejson": "^2.4.6",
|
||||
"release-it": "^17.0.0",
|
||||
"should-semantic-release": "^0.2.1",
|
||||
"tsup": "^7.2.0",
|
||||
"typescript": "^5.2.2",
|
||||
"yaml-eslint-parser": "^1.2.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"babel-plugin-macros": "^3.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"babel-plugin-macros": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"packageManager": "pnpm@8.7.0"
|
||||
}
|
||||
Reference in New Issue
Block a user