@rstest/core
Version:
The Rsbuild-based test tool.
1,126 lines (1,125 loc) • 319 kB
JavaScript
/*! For license information please see 7913.js.LICENSE.txt */
import 'module';
/*#__PURE__*/ import.meta.url;
import { __webpack_require__ } from "./rslib-runtime.js";
import "./5693.js";
import { createRequire } from "./4881.js";
__webpack_require__.add({
"../../node_modules/.pnpm/@jest+diff-sequences@30.0.1/node_modules/@jest/diff-sequences/build/index.js" (module) {
/*!
* /**
* * 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.
* * /
*/ (()=>{
"use strict";
var __nested_rspack_exports__ = {};
(()=>{
var exports = __nested_rspack_exports__;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = diffSequence;
const pkg = '@jest/diff-sequences';
const NOT_YET_SET = 0;
const countCommonItemsF = (aIndex, aEnd, bIndex, bEnd, isCommon)=>{
let nCommon = 0;
while(aIndex < aEnd && bIndex < bEnd && isCommon(aIndex, bIndex)){
aIndex += 1;
bIndex += 1;
nCommon += 1;
}
return nCommon;
};
const countCommonItemsR = (aStart, aIndex, bStart, bIndex, isCommon)=>{
let nCommon = 0;
while(aStart <= aIndex && bStart <= bIndex && isCommon(aIndex, bIndex)){
aIndex -= 1;
bIndex -= 1;
nCommon += 1;
}
return nCommon;
};
const extendPathsF = (d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF)=>{
let iF = 0;
let kF = -d;
let aFirst = aIndexesF[iF];
let aIndexPrev1 = aFirst;
aIndexesF[iF] += countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon);
const nF = Math.min(d, iMaxF);
for(iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2){
if (iF !== d && aIndexPrev1 < aIndexesF[iF]) aFirst = aIndexesF[iF];
else {
aFirst = aIndexPrev1 + 1;
if (aEnd <= aFirst) return iF - 1;
}
aIndexPrev1 = aIndexesF[iF];
aIndexesF[iF] = aFirst + countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon);
}
return iMaxF;
};
const extendPathsR = (d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR)=>{
let iR = 0;
let kR = d;
let aFirst = aIndexesR[iR];
let aIndexPrev1 = aFirst;
aIndexesR[iR] -= countCommonItemsR(aStart, aFirst - 1, bStart, bR + aFirst - kR - 1, isCommon);
const nR = Math.min(d, iMaxR);
for(iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2){
if (iR !== d && aIndexesR[iR] < aIndexPrev1) aFirst = aIndexesR[iR];
else {
aFirst = aIndexPrev1 - 1;
if (aFirst < aStart) return iR - 1;
}
aIndexPrev1 = aIndexesR[iR];
aIndexesR[iR] = aFirst - countCommonItemsR(aStart, aFirst - 1, bStart, bR + aFirst - kR - 1, isCommon);
}
return iMaxR;
};
const extendOverlappablePathsF = (d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division)=>{
const bF = bStart - aStart;
const aLength = aEnd - aStart;
const bLength = bEnd - bStart;
const baDeltaLength = bLength - aLength;
const kMinOverlapF = -baDeltaLength - (d - 1);
const kMaxOverlapF = -baDeltaLength + (d - 1);
let aIndexPrev1 = NOT_YET_SET;
const nF = Math.min(d, iMaxF);
for(let iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2){
const insert = 0 === iF || iF !== d && aIndexPrev1 < aIndexesF[iF];
const aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1;
const aFirst = insert ? aLastPrev : aLastPrev + 1;
const bFirst = bF + aFirst - kF;
const nCommonF = countCommonItemsF(aFirst + 1, aEnd, bFirst + 1, bEnd, isCommon);
const aLast = aFirst + nCommonF;
aIndexPrev1 = aIndexesF[iF];
aIndexesF[iF] = aLast;
if (kMinOverlapF <= kF && kF <= kMaxOverlapF) {
const iR = (d - 1 - (kF + baDeltaLength)) / 2;
if (iR <= iMaxR && aIndexesR[iR] - 1 <= aLast) {
const bLastPrev = bF + aLastPrev - (insert ? kF + 1 : kF - 1);
const nCommonR = countCommonItemsR(aStart, aLastPrev, bStart, bLastPrev, isCommon);
const aIndexPrevFirst = aLastPrev - nCommonR;
const bIndexPrevFirst = bLastPrev - nCommonR;
const aEndPreceding = aIndexPrevFirst + 1;
const bEndPreceding = bIndexPrevFirst + 1;
division.nChangePreceding = d - 1;
if (d - 1 === aEndPreceding + bEndPreceding - aStart - bStart) {
division.aEndPreceding = aStart;
division.bEndPreceding = bStart;
} else {
division.aEndPreceding = aEndPreceding;
division.bEndPreceding = bEndPreceding;
}
division.nCommonPreceding = nCommonR;
if (0 !== nCommonR) {
division.aCommonPreceding = aEndPreceding;
division.bCommonPreceding = bEndPreceding;
}
division.nCommonFollowing = nCommonF;
if (0 !== nCommonF) {
division.aCommonFollowing = aFirst + 1;
division.bCommonFollowing = bFirst + 1;
}
const aStartFollowing = aLast + 1;
const bStartFollowing = bFirst + nCommonF + 1;
division.nChangeFollowing = d - 1;
if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
division.aStartFollowing = aEnd;
division.bStartFollowing = bEnd;
} else {
division.aStartFollowing = aStartFollowing;
division.bStartFollowing = bStartFollowing;
}
return true;
}
}
}
return false;
};
const extendOverlappablePathsR = (d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division)=>{
const bR = bEnd - aEnd;
const aLength = aEnd - aStart;
const bLength = bEnd - bStart;
const baDeltaLength = bLength - aLength;
const kMinOverlapR = baDeltaLength - d;
const kMaxOverlapR = baDeltaLength + d;
let aIndexPrev1 = NOT_YET_SET;
const nR = Math.min(d, iMaxR);
for(let iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2){
const insert = 0 === iR || iR !== d && aIndexesR[iR] < aIndexPrev1;
const aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1;
const aFirst = insert ? aLastPrev : aLastPrev - 1;
const bFirst = bR + aFirst - kR;
const nCommonR = countCommonItemsR(aStart, aFirst - 1, bStart, bFirst - 1, isCommon);
const aLast = aFirst - nCommonR;
aIndexPrev1 = aIndexesR[iR];
aIndexesR[iR] = aLast;
if (kMinOverlapR <= kR && kR <= kMaxOverlapR) {
const iF = (d + (kR - baDeltaLength)) / 2;
if (iF <= iMaxF && aLast - 1 <= aIndexesF[iF]) {
const bLast = bFirst - nCommonR;
division.nChangePreceding = d;
if (d === aLast + bLast - aStart - bStart) {
division.aEndPreceding = aStart;
division.bEndPreceding = bStart;
} else {
division.aEndPreceding = aLast;
division.bEndPreceding = bLast;
}
division.nCommonPreceding = nCommonR;
if (0 !== nCommonR) {
division.aCommonPreceding = aLast;
division.bCommonPreceding = bLast;
}
division.nChangeFollowing = d - 1;
if (1 === d) {
division.nCommonFollowing = 0;
division.aStartFollowing = aEnd;
division.bStartFollowing = bEnd;
} else {
const bLastPrev = bR + aLastPrev - (insert ? kR - 1 : kR + 1);
const nCommonF = countCommonItemsF(aLastPrev, aEnd, bLastPrev, bEnd, isCommon);
division.nCommonFollowing = nCommonF;
if (0 !== nCommonF) {
division.aCommonFollowing = aLastPrev;
division.bCommonFollowing = bLastPrev;
}
const aStartFollowing = aLastPrev + nCommonF;
const bStartFollowing = bLastPrev + nCommonF;
if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
division.aStartFollowing = aEnd;
division.bStartFollowing = bEnd;
} else {
division.aStartFollowing = aStartFollowing;
division.bStartFollowing = bStartFollowing;
}
}
return true;
}
}
}
return false;
};
const divide = (nChange, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, aIndexesR, division)=>{
const bF = bStart - aStart;
const bR = bEnd - aEnd;
const aLength = aEnd - aStart;
const bLength = bEnd - bStart;
const baDeltaLength = bLength - aLength;
let iMaxF = aLength;
let iMaxR = aLength;
aIndexesF[0] = aStart - 1;
aIndexesR[0] = aEnd;
if (baDeltaLength % 2 === 0) {
const dMin = (nChange || baDeltaLength) / 2;
const dMax = (aLength + bLength) / 2;
for(let d = 1; d <= dMax; d += 1){
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
if (d < dMin) iMaxR = extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
else if (extendOverlappablePathsR(d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division)) return;
}
} else {
const dMin = ((nChange || baDeltaLength) + 1) / 2;
const dMax = (aLength + bLength + 1) / 2;
let d = 1;
iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
for(d += 1; d <= dMax; d += 1){
iMaxR = extendPathsR(d - 1, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
if (d < dMin) iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
else if (extendOverlappablePathsF(d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division)) return;
}
}
throw new Error(`${pkg}: no overlap aStart=${aStart} aEnd=${aEnd} bStart=${bStart} bEnd=${bEnd}`);
};
const findSubsequences = (nChange, aStart, aEnd, bStart, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division)=>{
if (bEnd - bStart < aEnd - aStart) {
transposed = !transposed;
if (transposed && 1 === callbacks.length) {
const { foundSubsequence, isCommon } = callbacks[0];
callbacks[1] = {
foundSubsequence: (nCommon, bCommon, aCommon)=>{
foundSubsequence(nCommon, aCommon, bCommon);
},
isCommon: (bIndex, aIndex)=>isCommon(aIndex, bIndex)
};
}
const tStart = aStart;
const tEnd = aEnd;
aStart = bStart;
aEnd = bEnd;
bStart = tStart;
bEnd = tEnd;
}
const { foundSubsequence, isCommon } = callbacks[transposed ? 1 : 0];
divide(nChange, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, aIndexesR, division);
const { nChangePreceding, aEndPreceding, bEndPreceding, nCommonPreceding, aCommonPreceding, bCommonPreceding, nCommonFollowing, aCommonFollowing, bCommonFollowing, nChangeFollowing, aStartFollowing, bStartFollowing } = division;
if (aStart < aEndPreceding && bStart < bEndPreceding) findSubsequences(nChangePreceding, aStart, aEndPreceding, bStart, bEndPreceding, transposed, callbacks, aIndexesF, aIndexesR, division);
if (0 !== nCommonPreceding) foundSubsequence(nCommonPreceding, aCommonPreceding, bCommonPreceding);
if (0 !== nCommonFollowing) foundSubsequence(nCommonFollowing, aCommonFollowing, bCommonFollowing);
if (aStartFollowing < aEnd && bStartFollowing < bEnd) findSubsequences(nChangeFollowing, aStartFollowing, aEnd, bStartFollowing, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division);
};
const validateLength = (name, arg)=>{
if ('number' != typeof arg) throw new TypeError(`${pkg}: ${name} typeof ${typeof arg} is not a number`);
if (!Number.isSafeInteger(arg)) throw new RangeError(`${pkg}: ${name} value ${arg} is not a safe integer`);
if (arg < 0) throw new RangeError(`${pkg}: ${name} value ${arg} is a negative integer`);
};
const validateCallback = (name, arg)=>{
const type = typeof arg;
if ('function' !== type) throw new TypeError(`${pkg}: ${name} typeof ${type} is not a function`);
};
function diffSequence(aLength, bLength, isCommon, foundSubsequence) {
validateLength('aLength', aLength);
validateLength('bLength', bLength);
validateCallback('isCommon', isCommon);
validateCallback('foundSubsequence', foundSubsequence);
const nCommonF = countCommonItemsF(0, aLength, 0, bLength, isCommon);
if (0 !== nCommonF) foundSubsequence(nCommonF, 0, 0);
if (aLength !== nCommonF || bLength !== nCommonF) {
const aStart = nCommonF;
const bStart = nCommonF;
const nCommonR = countCommonItemsR(aStart, aLength - 1, bStart, bLength - 1, isCommon);
const aEnd = aLength - nCommonR;
const bEnd = bLength - nCommonR;
const nCommonFR = nCommonF + nCommonR;
if (aLength !== nCommonFR && bLength !== nCommonFR) {
const nChange = 0;
const transposed = false;
const callbacks = [
{
foundSubsequence,
isCommon
}
];
const aIndexesF = [
NOT_YET_SET
];
const aIndexesR = [
NOT_YET_SET
];
const division = {
aCommonFollowing: NOT_YET_SET,
aCommonPreceding: NOT_YET_SET,
aEndPreceding: NOT_YET_SET,
aStartFollowing: NOT_YET_SET,
bCommonFollowing: NOT_YET_SET,
bCommonPreceding: NOT_YET_SET,
bEndPreceding: NOT_YET_SET,
bStartFollowing: NOT_YET_SET,
nChangeFollowing: NOT_YET_SET,
nChangePreceding: NOT_YET_SET,
nCommonFollowing: NOT_YET_SET,
nCommonPreceding: NOT_YET_SET
};
findSubsequences(nChange, aStart, aEnd, bStart, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division);
}
if (0 !== nCommonR) foundSubsequence(nCommonR, aEnd, bEnd);
}
}
})();
module.exports = __nested_rspack_exports__;
})();
},
"../../node_modules/.pnpm/@jest+get-type@30.1.0/node_modules/@jest/get-type/build/index.js" (module) {
/*!
* /**
* * 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.
* * /
*/ (()=>{
"use strict";
var __nested_rspack_exports__ = {};
(()=>{
var exports = __nested_rspack_exports__;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getType = getType;
exports.isPrimitive = void 0;
function getType(value) {
if (void 0 === value) return 'undefined';
if (null === value) return 'null';
if (Array.isArray(value)) return 'array';
if ('boolean' == typeof value) return 'boolean';
if ('function' == typeof value) return 'function';
else if ('number' == typeof value) return 'number';
else if ('string' == typeof value) return 'string';
else if ('bigint' == typeof value) return 'bigint';
else if ('object' == typeof value) {
if (value.constructor === RegExp) return 'regexp';
if (value.constructor === Map) return 'map';
if (value.constructor === Set) return 'set';
else if (value.constructor === Date) return 'date';
return 'object';
} else if ('symbol' == typeof value) return 'symbol';
throw new Error(`value of unknown type: ${value}`);
}
const isPrimitive = (value)=>Object(value) !== value;
exports.isPrimitive = isPrimitive;
})();
module.exports = __nested_rspack_exports__;
})();
},
"../../node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js" (module, __unused_rspack_exports, __webpack_require__) {
module = __webpack_require__.nmd(module);
const wrapAnsi16 = (fn, offset)=>(...args)=>{
const code = fn(...args);
return `\u001B[${code + offset}m`;
};
const wrapAnsi256 = (fn, offset)=>(...args)=>{
const code = fn(...args);
return `\u001B[${38 + offset};5;${code}m`;
};
const wrapAnsi16m = (fn, offset)=>(...args)=>{
const rgb = fn(...args);
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
};
const ansi2ansi = (n)=>n;
const rgb2rgb = (r, g, b)=>[
r,
g,
b
];
const setLazyProperty = (object, property, get)=>{
Object.defineProperty(object, property, {
get: ()=>{
const value = get();
Object.defineProperty(object, property, {
value,
enumerable: true,
configurable: true
});
return value;
},
enumerable: true,
configurable: true
});
};
let colorConvert;
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground)=>{
if (void 0 === colorConvert) colorConvert = __webpack_require__("../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js");
const offset = isBackground ? 10 : 0;
const styles = {};
for (const [sourceSpace, suite] of Object.entries(colorConvert)){
const name = 'ansi16' === sourceSpace ? 'ansi' : sourceSpace;
if (sourceSpace === targetSpace) styles[name] = wrap(identity, offset);
else if ('object' == typeof suite) styles[name] = wrap(suite[targetSpace], offset);
}
return styles;
};
function assembleStyles() {
const codes = new Map();
const styles = {
modifier: {
reset: [
0,
0
],
bold: [
1,
22
],
dim: [
2,
22
],
italic: [
3,
23
],
underline: [
4,
24
],
inverse: [
7,
27
],
hidden: [
8,
28
],
strikethrough: [
9,
29
]
},
color: {
black: [
30,
39
],
red: [
31,
39
],
green: [
32,
39
],
yellow: [
33,
39
],
blue: [
34,
39
],
magenta: [
35,
39
],
cyan: [
36,
39
],
white: [
37,
39
],
blackBright: [
90,
39
],
redBright: [
91,
39
],
greenBright: [
92,
39
],
yellowBright: [
93,
39
],
blueBright: [
94,
39
],
magentaBright: [
95,
39
],
cyanBright: [
96,
39
],
whiteBright: [
97,
39
]
},
bgColor: {
bgBlack: [
40,
49
],
bgRed: [
41,
49
],
bgGreen: [
42,
49
],
bgYellow: [
43,
49
],
bgBlue: [
44,
49
],
bgMagenta: [
45,
49
],
bgCyan: [
46,
49
],
bgWhite: [
47,
49
],
bgBlackBright: [
100,
49
],
bgRedBright: [
101,
49
],
bgGreenBright: [
102,
49
],
bgYellowBright: [
103,
49
],
bgBlueBright: [
104,
49
],
bgMagentaBright: [
105,
49
],
bgCyanBright: [
106,
49
],
bgWhiteBright: [
107,
49
]
}
};
styles.color.gray = styles.color.blackBright;
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
styles.color.grey = styles.color.blackBright;
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
for (const [groupName, group] of Object.entries(styles)){
for (const [styleName, style] of Object.entries(group)){
styles[styleName] = {
open: `\u001B[${style[0]}m`,
close: `\u001B[${style[1]}m`
};
group[styleName] = styles[styleName];
codes.set(style[0], style[1]);
}
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
}
Object.defineProperty(styles, 'codes', {
value: codes,
enumerable: false
});
styles.color.close = '\u001B[39m';
styles.bgColor.close = '\u001B[49m';
setLazyProperty(styles.color, 'ansi', ()=>makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
setLazyProperty(styles.color, 'ansi256', ()=>makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
setLazyProperty(styles.color, 'ansi16m', ()=>makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
setLazyProperty(styles.bgColor, 'ansi', ()=>makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
setLazyProperty(styles.bgColor, 'ansi256', ()=>makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
setLazyProperty(styles.bgColor, 'ansi16m', ()=>makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
return styles;
}
Object.defineProperty(module, 'exports', {
enumerable: true,
get: assembleStyles
});
},
"../../node_modules/.pnpm/ansi-styles@5.2.0/node_modules/ansi-styles/index.js" (module, exports, __webpack_require__) {
__webpack_require__.r(exports);
module = __webpack_require__.nmd(module);
const ANSI_BACKGROUND_OFFSET = 10;
const wrapAnsi256 = (offset = 0)=>(code)=>`\u001B[${38 + offset};5;${code}m`;
const wrapAnsi16m = (offset = 0)=>(red, green, blue)=>`\u001B[${38 + offset};2;${red};${green};${blue}m`;
function assembleStyles() {
const codes = new Map();
const styles = {
modifier: {
reset: [
0,
0
],
bold: [
1,
22
],
dim: [
2,
22
],
italic: [
3,
23
],
underline: [
4,
24
],
overline: [
53,
55
],
inverse: [
7,
27
],
hidden: [
8,
28
],
strikethrough: [
9,
29
]
},
color: {
black: [
30,
39
],
red: [
31,
39
],
green: [
32,
39
],
yellow: [
33,
39
],
blue: [
34,
39
],
magenta: [
35,
39
],
cyan: [
36,
39
],
white: [
37,
39
],
blackBright: [
90,
39
],
redBright: [
91,
39
],
greenBright: [
92,
39
],
yellowBright: [
93,
39
],
blueBright: [
94,
39
],
magentaBright: [
95,
39
],
cyanBright: [
96,
39
],
whiteBright: [
97,
39
]
},
bgColor: {
bgBlack: [
40,
49
],
bgRed: [
41,
49
],
bgGreen: [
42,
49
],
bgYellow: [
43,
49
],
bgBlue: [
44,
49
],
bgMagenta: [
45,
49
],
bgCyan: [
46,
49
],
bgWhite: [
47,
49
],
bgBlackBright: [
100,
49
],
bgRedBright: [
101,
49
],
bgGreenBright: [
102,
49
],
bgYellowBright: [
103,
49
],
bgBlueBright: [
104,
49
],
bgMagentaBright: [
105,
49
],
bgCyanBright: [
106,
49
],
bgWhiteBright: [
107,
49
]
}
};
styles.color.gray = styles.color.blackBright;
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
styles.color.grey = styles.color.blackBright;
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
for (const [groupName, group] of Object.entries(styles)){
for (const [styleName, style] of Object.entries(group)){
styles[styleName] = {
open: `\u001B[${style[0]}m`,
close: `\u001B[${style[1]}m`
};
group[styleName] = styles[styleName];
codes.set(style[0], style[1]);
}
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
}
Object.defineProperty(styles, 'codes', {
value: codes,
enumerable: false
});
styles.color.close = '\u001B[39m';
styles.bgColor.close = '\u001B[49m';
styles.color.ansi256 = wrapAnsi256();
styles.color.ansi16m = wrapAnsi16m();
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
Object.defineProperties(styles, {
rgbToAnsi256: {
value: (red, green, blue)=>{
if (red === green && green === blue) {
if (red < 8) return 16;
if (red > 248) return 231;
return Math.round((red - 8) / 247 * 24) + 232;
}
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
},
enumerable: false
},
hexToRgb: {
value: (hex)=>{
const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16));
if (!matches) return [
0,
0,
0
];
let { colorString } = matches.groups;
if (3 === colorString.length) colorString = colorString.split('').map((character)=>character + character).join('');
const integer = Number.parseInt(colorString, 16);
return [
integer >> 16 & 0xFF,
integer >> 8 & 0xFF,
0xFF & integer
];
},
enumerable: false
},
hexToAnsi256: {
value: (hex)=>styles.rgbToAnsi256(...styles.hexToRgb(hex)),
enumerable: false
}
});
return styles;
}
Object.defineProperty(module, 'exports', {
enumerable: true,
get: assembleStyles
});
},
"../../node_modules/.pnpm/buffer-from@1.1.2/node_modules/buffer-from/index.js" (module) {
var toString = Object.prototype.toString;
var isModern = "u" > typeof Buffer && 'function' == typeof Buffer.alloc && 'function' == typeof Buffer.allocUnsafe && 'function' == typeof Buffer.from;
function isArrayBuffer(input) {
return 'ArrayBuffer' === toString.call(input).slice(8, -1);
}
function fromArrayBuffer(obj, byteOffset, length) {
byteOffset >>>= 0;
var maxLength = obj.byteLength - byteOffset;
if (maxLength < 0) throw new RangeError("'offset' is out of bounds");
if (void 0 === length) length = maxLength;
else {
length >>>= 0;
if (length > maxLength) throw new RangeError("'length' is out of bounds");
}
return isModern ? Buffer.from(obj.slice(byteOffset, byteOffset + length)) : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length)));
}
function fromString(string, encoding) {
if ('string' != typeof encoding || '' === encoding) encoding = 'utf8';
if (!Buffer.isEncoding(encoding)) throw new TypeError('"encoding" must be a valid string encoding');
return isModern ? Buffer.from(string, encoding) : new Buffer(string, encoding);
}
function bufferFrom(value, encodingOrOffset, length) {
if ('number' == typeof value) throw new TypeError('"value" argument must not be a number');
if (isArrayBuffer(value)) return fromArrayBuffer(value, encodingOrOffset, length);
if ('string' == typeof value) return fromString(value, encodingOrOffset);
return isModern ? Buffer.from(value) : new Buffer(value);
}
module.exports = bufferFrom;
},
"../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js" (module, __unused_rspack_exports, __webpack_require__) {
const ansiStyles = __webpack_require__("../../node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js");
const { stdout: stdoutColor, stderr: stderrColor } = __webpack_require__("../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js");
const { stringReplaceAll, stringEncaseCRLFWithFirstIndex } = __webpack_require__("../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js");
const { isArray } = Array;
const levelMapping = [
'ansi',
'ansi',
'ansi256',
'ansi16m'
];
const styles = Object.create(null);
const applyOptions = (object, options = {})=>{
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) throw new Error('The `level` option should be an integer from 0 to 3');
const colorLevel = stdoutColor ? stdoutColor.level : 0;
object.level = void 0 === options.level ? colorLevel : options.level;
};
class ChalkClass {
constructor(options){
return chalkFactory(options);
}
}
const chalkFactory = (options)=>{
const chalk = {};
applyOptions(chalk, options);
chalk.template = (...arguments_)=>chalkTag(chalk.template, ...arguments_);
Object.setPrototypeOf(chalk, Chalk.prototype);
Object.setPrototypeOf(chalk.template, chalk);
chalk.template.constructor = ()=>{
throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
};
chalk.template.Instance = ChalkClass;
return chalk.template;
};
function Chalk(options) {
return chalkFactory(options);
}
for (const [styleName, style] of Object.entries(ansiStyles))styles[styleName] = {
get () {
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
Object.defineProperty(this, styleName, {
value: builder
});
return builder;
}
};
styles.visible = {
get () {
const builder = createBuilder(this, this._styler, true);
Object.defineProperty(this, 'visible', {
value: builder
});
return builder;
}
};
const usedModels = [
'rgb',
'hex',
'keyword',
'hsl',
'hsv',
'hwb',
'ansi',
'ansi256'
];
for (const model of usedModels)styles[model] = {
get () {
const { level } = this;
return function(...arguments_) {
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
return createBuilder(this, styler, this._isEmpty);
};
}
};
for (const model of usedModels){
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
styles[bgModel] = {
get () {
const { level } = this;
return function(...arguments_) {
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
return createBuilder(this, styler, this._isEmpty);
};
}
};
}
const proto = Object.defineProperties(()=>{}, {
...styles,
level: {
enumerable: true,
get () {
return this._generator.level;
},
set (level) {
this._generator.level = level;
}
}
});
const createStyler = (open, close, parent)=>{
let openAll;
let closeAll;
if (void 0 === parent) {
openAll = open;
closeAll = close;
} else {
openAll = parent.openAll + open;
closeAll = close + parent.closeAll;
}
return {
open,
close,
openAll,
closeAll,
parent
};
};
const createBuilder = (self, _styler, _isEmpty)=>{
const builder = (...arguments_)=>{
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) return applyStyle(builder, chalkTag(builder, ...arguments_));
return applyStyle(builder, 1 === arguments_.length ? '' + arguments_[0] : arguments_.join(' '));
};
Object.setPrototypeOf(builder, proto);
builder._generator = self;
builder._styler = _styler;
builder._isEmpty = _isEmpty;
return builder;
};
const applyStyle = (self, string)=>{
if (self.level <= 0 || !string) return self._isEmpty ? '' : string;
let styler = self._styler;
if (void 0 === styler) return string;
const { openAll, closeAll } = styler;
if (-1 !== string.indexOf('\u001B')) while(void 0 !== styler){
string = stringReplaceAll(string, styler.close, styler.open);
styler = styler.parent;
}
const lfIndex = string.indexOf('\n');
if (-1 !== lfIndex) string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
return openAll + string + closeAll;
};
let template;
const chalkTag = (chalk, ...strings)=>{
const [firstString] = strings;
if (!isArray(firstString) || !isArray(firstString.raw)) return strings.join(' ');
const arguments_ = strings.slice(1);
const parts = [
firstString.raw[0]
];
for(let i = 1; i < firstString.length; i++)parts.push(String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), String(firstString.raw[i]));
if (void 0 === template) template = __webpack_require__("../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js");
return template(chalk, parts.join(''));
};
Object.defineProperties(Chalk.prototype, styles);
const chalk = Chalk();
chalk.supportsColor = stdoutColor;
chalk.stderr = Chalk({
level: stderrColor ? stderrColor.level : 0
});
chalk.stderr.supportsColor = stderrColor;
module.exports = chalk;
},
"../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js" (module) {
const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
const ESCAPES = new Map([
[
'n',
'\n'
],
[
'r',
'\r'
],
[
't',
'\t'
],
[
'b',
'\b'
],
[
'f',
'\f'
],
[
'v',
'\v'
],
[
'0',
'\0'
],
[
'\\',
'\\'
],
[
'e',
'\u001B'
],
[
'a',
'\u0007'
]
]);
function unescape(c) {
const u = 'u' === c[0];
const bracket = '{' === c[1];
if (u && !bracket && 5 === c.length || 'x' === c[0] && 3 === c.length) return String.fromCharCode(parseInt(c.slice(1), 16));
if (u && bracket) return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
return ESCAPES.get(c) || c;
}
function parseArguments(name, arguments_) {
const results = [];
const chunks = arguments_.trim().split(/\s*,\s*/g);
let matches;
for (const chunk of chunks){
const number = Number(chunk);
if (Number.isNaN(number)) if (matches = chunk.match(STRING_REGEX)) results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character)=>escape ? unescape(escape) : character));
else throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
else results.push(number);