all these changes

This commit is contained in:
Jake Kasper
2026-04-09 13:19:47 -05:00
parent e83a51a051
commit 65315f36d1
39102 changed files with 7932979 additions and 567 deletions

22
frontend/node_modules/@jest/diff-sequences/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
Copyright Contributors to the Jest project.
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.

404
frontend/node_modules/@jest/diff-sequences/README.md generated vendored Normal file
View File

@@ -0,0 +1,404 @@
# diff-sequences
Compare items in two sequences to find a **longest common subsequence**.
The items not in common are the items to delete or insert in a **shortest edit script**.
To maximize flexibility and minimize memory, you write **callback** functions as configuration:
**Input** function `isCommon(aIndex, bIndex)` compares items at indexes in the sequences and returns a truthy/falsey value. This package might call your function more than once for some pairs of indexes.
- Because your function encapsulates **comparison**, this package can compare items according to `===` operator, `Object.is` method, or other criterion.
- Because your function encapsulates **sequences**, this package can find differences in arrays, strings, or other data.
**Output** function `foundSubsequence(nCommon, aCommon, bCommon)` receives the number of adjacent items and starting indexes of each common subsequence. If sequences do not have common items, then this package does not call your function.
If N is the sum of lengths of sequences and L is length of a longest common subsequence, then D = N 2L is the number of **differences** in the corresponding shortest edit script.
[_An O(ND) Difference Algorithm and Its Variations_](http://xmailserver.org/diff2.pdf) by Eugene W. Myers is fast when sequences have **few** differences.
This package implements the **linear space** variation with optimizations so it is fast even when sequences have **many** differences.
## Usage
To add this package as a dependency of a project, do either of the following:
- `npm install diff-sequences`
- `yarn add diff-sequences`
To use `diff` as the name of the default export from this package, do either of the following:
- `var diff = require('@jest/diff-sequences').default; // CommonJS modules`
- `import diff from '@jest/diff-sequences'; // ECMAScript modules`
Call `diff` with the **lengths** of sequences and your **callback** functions:
```js
const a = ['a', 'b', 'c', 'a', 'b', 'b', 'a'];
const b = ['c', 'b', 'a', 'b', 'a', 'c'];
function isCommon(aIndex, bIndex) {
return a[aIndex] === b[bIndex];
}
function foundSubsequence(nCommon, aCommon, bCommon) {
// see examples
}
diff(a.length, b.length, isCommon, foundSubsequence);
```
## Example of longest common subsequence
Some sequences (for example, `a` and `b` in the example of usage) have more than one longest common subsequence.
This package finds the following common items:
| comparisons of common items | values | output arguments |
| :------------------------------- | :--------- | --------------------------: |
| `a[2] === b[0]` | `'c'` | `foundSubsequence(1, 2, 0)` |
| `a[4] === b[1]` | `'b'` | `foundSubsequence(1, 4, 1)` |
| `a[5] === b[3] && a[6] === b[4]` | `'b', 'a'` | `foundSubsequence(2, 5, 3)` |
The “edit graph” analogy in the Myers paper shows the following common items:
| comparisons of common items | values |
| :------------------------------- | :--------- |
| `a[2] === b[0]` | `'c'` |
| `a[3] === b[2] && a[4] === b[3]` | `'a', 'b'` |
| `a[6] === b[4]` | `'a'` |
Various packages which implement the Myers algorithm will **always agree** on the **length** of a longest common subsequence, but might **sometimes disagree** on which **items** are in it.
## Example of callback functions to count common items
```js
// Return length of longest common subsequence according to === operator.
function countCommonItems(a, b) {
let n = 0;
function isCommon(aIndex, bIndex) {
return a[aIndex] === b[bIndex];
}
function foundSubsequence(nCommon) {
n += nCommon;
}
diff(a.length, b.length, isCommon, foundSubsequence);
return n;
}
const commonLength = countCommonItems(
['a', 'b', 'c', 'a', 'b', 'b', 'a'],
['c', 'b', 'a', 'b', 'a', 'c'],
);
```
| category of items | expression | value |
| :----------------- | ------------------------: | ----: |
| in common | `commonLength` | `4` |
| to delete from `a` | `a.length - commonLength` | `3` |
| to insert from `b` | `b.length - commonLength` | `2` |
If the length difference `b.length - a.length` is:
- negative: its absolute value is the minimum number of items to **delete** from `a`
- positive: it is the minimum number of items to **insert** from `b`
- zero: there is an **equal** number of items to delete from `a` and insert from `b`
- non-zero: there is an equal number of **additional** items to delete from `a` and insert from `b`
In this example, `6 - 7` is:
- negative: `1` is the minimum number of items to **delete** from `a`
- non-zero: `2` is the number of **additional** items to delete from `a` and insert from `b`
## Example of callback functions to find common items
```js
// Return array of items in longest common subsequence according to Object.is method.
const findCommonItems = (a, b) => {
const array = [];
diff(
a.length,
b.length,
(aIndex, bIndex) => Object.is(a[aIndex], b[bIndex]),
(nCommon, aCommon) => {
for (; nCommon !== 0; nCommon -= 1, aCommon += 1) {
array.push(a[aCommon]);
}
},
);
return array;
};
const commonItems = findCommonItems(
['a', 'b', 'c', 'a', 'b', 'b', 'a'],
['c', 'b', 'a', 'b', 'a', 'c'],
);
```
| `i` | `commonItems[i]` | `aIndex` |
| --: | :--------------- | -------: |
| `0` | `'c'` | `2` |
| `1` | `'b'` | `4` |
| `2` | `'b'` | `5` |
| `3` | `'a'` | `6` |
## Example of callback functions to diff index intervals
Instead of slicing array-like objects, you can adjust indexes in your callback functions.
```js
// Diff index intervals that are half open [start, end) like array slice method.
const diffIndexIntervals = (a, aStart, aEnd, b, bStart, bEnd) => {
// Validate: 0 <= aStart and aStart <= aEnd and aEnd <= a.length
// Validate: 0 <= bStart and bStart <= bEnd and bEnd <= b.length
diff(
aEnd - aStart,
bEnd - bStart,
(aIndex, bIndex) => Object.is(a[aStart + aIndex], b[bStart + bIndex]),
(nCommon, aCommon, bCommon) => {
// aStart + aCommon, bStart + bCommon
},
);
// After the last common subsequence, do any remaining work.
};
```
## Example of callback functions to emulate diff command
Linux or Unix has a `diff` command to compare files line by line. Its output is a **shortest edit script**:
- **c**hange adjacent lines from the first file to lines from the second file
- **d**elete lines from the first file
- **a**ppend or insert lines from the second file
```js
// Given zero-based half-open range [start, end) of array indexes,
// return one-based closed range [start + 1, end] as string.
const getRange = (start, end) =>
start + 1 === end ? `${start + 1}` : `${start + 1},${end}`;
// Given index intervals of lines to delete or insert, or both, or neither,
// push formatted diff lines onto array.
const pushDelIns = (aLines, aIndex, aEnd, bLines, bIndex, bEnd, array) => {
const deleteLines = aIndex !== aEnd;
const insertLines = bIndex !== bEnd;
const changeLines = deleteLines && insertLines;
if (changeLines) {
array.push(`${getRange(aIndex, aEnd)}c${getRange(bIndex, bEnd)}`);
} else if (deleteLines) {
array.push(`${getRange(aIndex, aEnd)}d${String(bIndex)}`);
} else if (insertLines) {
array.push(`${String(aIndex)}a${getRange(bIndex, bEnd)}`);
} else {
return;
}
for (; aIndex !== aEnd; aIndex += 1) {
array.push(`< ${aLines[aIndex]}`); // delete is less than
}
if (changeLines) {
array.push('---');
}
for (; bIndex !== bEnd; bIndex += 1) {
array.push(`> ${bLines[bIndex]}`); // insert is greater than
}
};
// Given content of two files, return emulated output of diff utility.
const findShortestEditScript = (a, b) => {
const aLines = a.split('\n');
const bLines = b.split('\n');
const aLength = aLines.length;
const bLength = bLines.length;
const isCommon = (aIndex, bIndex) => aLines[aIndex] === bLines[bIndex];
let aIndex = 0;
let bIndex = 0;
const array = [];
const foundSubsequence = (nCommon, aCommon, bCommon) => {
pushDelIns(aLines, aIndex, aCommon, bLines, bIndex, bCommon, array);
aIndex = aCommon + nCommon; // number of lines compared in a
bIndex = bCommon + nCommon; // number of lines compared in b
};
diff(aLength, bLength, isCommon, foundSubsequence);
// After the last common subsequence, push remaining change lines.
pushDelIns(aLines, aIndex, aLength, bLines, bIndex, bLength, array);
return array.length === 0 ? '' : `${array.join('\n')}\n`;
};
```
## Example of callback functions to format diff lines
Here is simplified code to format **changed and unchanged lines** in expected and received values after a test fails in Jest:
```js
// Format diff with minus or plus for change lines and space for common lines.
const formatDiffLines = (a, b) => {
// Jest depends on pretty-format package to serialize objects as strings.
// Unindented for comparison to avoid distracting differences:
const aLinesUn = format(a, {indent: 0 /*, other options*/}).split('\n');
const bLinesUn = format(b, {indent: 0 /*, other options*/}).split('\n');
// Indented to display changed and unchanged lines:
const aLinesIn = format(a, {indent: 2 /*, other options*/}).split('\n');
const bLinesIn = format(b, {indent: 2 /*, other options*/}).split('\n');
const aLength = aLinesIn.length; // Validate: aLinesUn.length === aLength
const bLength = bLinesIn.length; // Validate: bLinesUn.length === bLength
const isCommon = (aIndex, bIndex) => aLinesUn[aIndex] === bLinesUn[bIndex];
// Only because the GitHub Flavored Markdown doc collapses adjacent spaces,
// this example code and the following table represent spaces as middle dots.
let aIndex = 0;
let bIndex = 0;
const array = [];
const foundSubsequence = (nCommon, aCommon, bCommon) => {
for (; aIndex !== aCommon; aIndex += 1) {
array.push(`${aLinesIn[aIndex]}`); // delete is minus
}
for (; bIndex !== bCommon; bIndex += 1) {
array.push(`${bLinesIn[bIndex]}`); // insert is plus
}
for (; nCommon !== 0; nCommon -= 1, aIndex += 1, bIndex += 1) {
// For common lines, received indentation seems more intuitive.
array.push(`··${bLinesIn[bIndex]}`); // common is space
}
};
diff(aLength, bLength, isCommon, foundSubsequence);
// After the last common subsequence, push remaining change lines.
for (; aIndex !== aLength; aIndex += 1) {
array.push(`${aLinesIn[aIndex]}`);
}
for (; bIndex !== bLength; bIndex += 1) {
array.push(`${bLinesIn[bIndex]}`);
}
return array;
};
const expected = {
searching: '',
sorting: {
ascending: true,
fieldKey: 'what',
},
};
const received = {
searching: '',
sorting: [
{
descending: false,
fieldKey: 'what',
},
],
};
const diffLines = formatDiffLines(expected, received);
```
If N is the sum of lengths of sequences and L is length of a longest common subsequence, then N L is length of an array of diff lines. In this example, N is 7 + 9, L is 5, and N L is 11.
| `i` | `diffLines[i]` | `aIndex` | `bIndex` |
| ---: | :--------------------------------- | -------: | -------: |
| `0` | `'··Object {'` | `0` | `0` |
| `1` | `'····"searching": "",'` | `1` | `1` |
| `2` | `'-···"sorting": Object {'` | `2` | |
| `3` | `'-·····"ascending": true,'` | `3` | |
| `4` | `'+·····"sorting": Array ['` | | `2` |
| `5` | `'+·······Object {'` | | `3` |
| `6` | `'+·········"descending": false,'` | | `4` |
| `7` | `'··········"fieldKey": "what",'` | `4` | `5` |
| `8` | `'········},'` | `5` | `6` |
| `9` | `'+·····],'` | | `7` |
| `10` | `'··}'` | `6` | `8` |
## Example of callback functions to find diff items
Here is simplified code to find changed and unchanged substrings **within adjacent changed lines** in expected and received values after a test fails in Jest:
```js
// Return diff items for strings (compatible with diff-match-patch package).
const findDiffItems = (a, b) => {
const isCommon = (aIndex, bIndex) => a[aIndex] === b[bIndex];
let aIndex = 0;
let bIndex = 0;
const array = [];
const foundSubsequence = (nCommon, aCommon, bCommon) => {
if (aIndex !== aCommon) {
array.push([-1, a.slice(aIndex, aCommon)]); // delete is -1
}
if (bIndex !== bCommon) {
array.push([1, b.slice(bIndex, bCommon)]); // insert is 1
}
aIndex = aCommon + nCommon; // number of characters compared in a
bIndex = bCommon + nCommon; // number of characters compared in b
array.push([0, a.slice(aCommon, aIndex)]); // common is 0
};
diff(a.length, b.length, isCommon, foundSubsequence);
// After the last common subsequence, push remaining change items.
if (aIndex !== a.length) {
array.push([-1, a.slice(aIndex)]);
}
if (bIndex !== b.length) {
array.push([1, b.slice(bIndex)]);
}
return array;
};
const expectedDeleted = ['"sorting": Object {', '"ascending": true,'].join(
'\n',
);
const receivedInserted = [
'"sorting": Array [',
'Object {',
'"descending": false,',
].join('\n');
const diffItems = findDiffItems(expectedDeleted, receivedInserted);
```
| `i` | `diffItems[i][0]` | `diffItems[i][1]` |
| --: | ----------------: | :---------------- |
| `0` | `0` | `'"sorting": '` |
| `1` | `1` | `'Array [\n'` |
| `2` | `0` | `'Object {\n"'` |
| `3` | `-1` | `'a'` |
| `4` | `1` | `'de'` |
| `5` | `0` | `'scending": '` |
| `6` | `-1` | `'tru'` |
| `7` | `1` | `'fals'` |
| `8` | `0` | `'e,'` |
The length difference `b.length - a.length` is equal to the sum of `diffItems[i][0]` values times `diffItems[i][1]` lengths. In this example, the difference `48 - 38` is equal to the sum `10`.
| category of diff item | `[0]` | `[1]` lengths | subtotal |
| :-------------------- | ----: | -----------------: | -------: |
| in common | `0` | `11 + 10 + 11 + 2` | `0` |
| to delete from `a` | `1` | `1 + 3` | `-4` |
| to insert from `b` | `1` | `8 + 2 + 4` | `14` |
Instead of formatting the changed substrings with escape codes for colors in the `foundSubsequence` function to save memory, this example spends memory to **gain flexibility** before formatting, so a separate heuristic algorithm might modify the generic array of diff items to show changes more clearly:
| `i` | `diffItems[i][0]` | `diffItems[i][1]` |
| --: | ----------------: | :---------------- |
| `6` | `-1` | `'true'` |
| `7` | `1` | `'false'` |
| `8` | `0` | `','` |
For expected and received strings of serialized data, the result of finding changed **lines**, and then finding changed **substrings** within adjacent changed lines (as in the preceding two examples) sometimes displays the changes in a more intuitive way than the result of finding changed substrings, and then splitting them into changed and unchanged lines.

View File

@@ -0,0 +1,39 @@
/**
* 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.
*/
export declare type Callbacks = {
foundSubsequence: FoundSubsequence;
isCommon: IsCommon;
};
declare function diffSequence(
aLength: number,
bLength: number,
isCommon: IsCommon,
foundSubsequence: FoundSubsequence,
): void;
export default diffSequence;
declare type FoundSubsequence = (
nCommon: number, // caller can assume: 0 < nCommon
aCommon: number, // caller can assume: 0 <= aCommon && aCommon < aLength
bCommon: number,
) => void;
/**
* 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.
*
*/
declare type IsCommon = (
aIndex: number, // caller can assume: 0 <= aIndex && aIndex < aLength
bIndex: number,
) => boolean;
export {};

View File

@@ -0,0 +1,637 @@
/*!
* /**
* * 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.
* * /
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
(() => {
var exports = __webpack_exports__;
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = diffSequence;
/**
* 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.
*
*/
// This diff-sequences package implements the linear space variation in
// An O(ND) Difference Algorithm and Its Variations by Eugene W. Myers
// Relationship in notation between Myers paper and this package:
// A is a
// N is aLength, aEnd - aStart, and so on
// x is aIndex, aFirst, aLast, and so on
// B is b
// M is bLength, bEnd - bStart, and so on
// y is bIndex, bFirst, bLast, and so on
// Δ = N - M is negative of baDeltaLength = bLength - aLength
// D is d
// k is kF
// k + Δ is kF = kR - baDeltaLength
// V is aIndexesF or aIndexesR (see comment below about Indexes type)
// index intervals [1, N] and [1, M] are [0, aLength) and [0, bLength)
// starting point in forward direction (0, 0) is (-1, -1)
// starting point in reverse direction (N + 1, M + 1) is (aLength, bLength)
// The “edit graph” for sequences a and b corresponds to items:
// in a on the horizontal axis
// in b on the vertical axis
//
// Given a-coordinate of a point in a diagonal, you can compute b-coordinate.
//
// Forward diagonals kF:
// zero diagonal intersects top left corner
// positive diagonals intersect top edge
// negative diagonals intersect left edge
//
// Reverse diagonals kR:
// zero diagonal intersects bottom right corner
// positive diagonals intersect right edge
// negative diagonals intersect bottom edge
// The graph contains a directed acyclic graph of edges:
// horizontal: delete an item from a
// vertical: insert an item from b
// diagonal: common item in a and b
//
// The algorithm solves dual problems in the graph analogy:
// Find longest common subsequence: path with maximum number of diagonal edges
// Find shortest edit script: path with minimum number of non-diagonal edges
// Input callback function compares items at indexes in the sequences.
// Output callback function receives the number of adjacent items
// and starting indexes of each common subsequence.
// Either original functions or wrapped to swap indexes if graph is transposed.
// Indexes in sequence a of last point of forward or reverse paths in graph.
// Myers algorithm indexes by diagonal k which for negative is bad deopt in V8.
// This package indexes by iF and iR which are greater than or equal to zero.
// and also updates the index arrays in place to cut memory in half.
// kF = 2 * iF - d
// kR = d - 2 * iR
// Division of index intervals in sequences a and b at the middle change.
// Invariant: intervals do not have common items at the start or end.
const pkg = '@jest/diff-sequences'; // for error messages
const NOT_YET_SET = 0; // small int instead of undefined to avoid deopt in V8
// Return the number of common items that follow in forward direction.
// The length of what Myers paper calls a “snake” in a forward path.
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;
};
// Return the number of common items that precede in reverse direction.
// The length of what Myers paper calls a “snake” in a reverse path.
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;
};
// A simple function to extend forward paths from (d - 1) to d changes
// when forward and reverse paths cannot yet overlap.
const extendPathsF = (d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF // return the value because optimization might decrease it
) => {
// Unroll the first iteration.
let iF = 0;
let kF = -d; // kF = 2 * iF - d
let aFirst = aIndexesF[iF]; // in first iteration always insert
let aIndexPrev1 = aFirst; // prev value of [iF - 1] in next iteration
aIndexesF[iF] += countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon);
// Optimization: skip diagonals in which paths cannot ever overlap.
const nF = Math.min(d, iMaxF);
// The diagonals kF are odd when d is odd and even when d is even.
for (iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2) {
// To get first point of path segment, move one change in forward direction
// from last point of previous path segment in an adjacent diagonal.
// In last possible iteration when iF === d and kF === d always delete.
if (iF !== d && aIndexPrev1 < aIndexesF[iF]) {
aFirst = aIndexesF[iF]; // vertical to insert from b
} else {
aFirst = aIndexPrev1 + 1; // horizontal to delete from a
if (aEnd <= aFirst) {
// Optimization: delete moved past right of graph.
return iF - 1;
}
}
// To get last point of path segment, move along diagonal of common items.
aIndexPrev1 = aIndexesF[iF];
aIndexesF[iF] = aFirst + countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon);
}
return iMaxF;
};
// A simple function to extend reverse paths from (d - 1) to d changes
// when reverse and forward paths cannot yet overlap.
const extendPathsR = (d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR // return the value because optimization might decrease it
) => {
// Unroll the first iteration.
let iR = 0;
let kR = d; // kR = d - 2 * iR
let aFirst = aIndexesR[iR]; // in first iteration always insert
let aIndexPrev1 = aFirst; // prev value of [iR - 1] in next iteration
aIndexesR[iR] -= countCommonItemsR(aStart, aFirst - 1, bStart, bR + aFirst - kR - 1, isCommon);
// Optimization: skip diagonals in which paths cannot ever overlap.
const nR = Math.min(d, iMaxR);
// The diagonals kR are odd when d is odd and even when d is even.
for (iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2) {
// To get first point of path segment, move one change in reverse direction
// from last point of previous path segment in an adjacent diagonal.
// In last possible iteration when iR === d and kR === -d always delete.
if (iR !== d && aIndexesR[iR] < aIndexPrev1) {
aFirst = aIndexesR[iR]; // vertical to insert from b
} else {
aFirst = aIndexPrev1 - 1; // horizontal to delete from a
if (aFirst < aStart) {
// Optimization: delete moved past left of graph.
return iR - 1;
}
}
// To get last point of path segment, move along diagonal of common items.
aIndexPrev1 = aIndexesR[iR];
aIndexesR[iR] = aFirst - countCommonItemsR(aStart, aFirst - 1, bStart, bR + aFirst - kR - 1, isCommon);
}
return iMaxR;
};
// A complete function to extend forward paths from (d - 1) to d changes.
// Return true if a path overlaps reverse path of (d - 1) changes in its diagonal.
const extendOverlappablePathsF = (d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division // update prop values if return true
) => {
const bF = bStart - aStart; // bIndex = bF + aIndex - kF
const aLength = aEnd - aStart;
const bLength = bEnd - bStart;
const baDeltaLength = bLength - aLength; // kF = kR - baDeltaLength
// Range of diagonals in which forward and reverse paths might overlap.
const kMinOverlapF = -baDeltaLength - (d - 1); // -(d - 1) <= kR
const kMaxOverlapF = -baDeltaLength + (d - 1); // kR <= (d - 1)
let aIndexPrev1 = NOT_YET_SET; // prev value of [iF - 1] in next iteration
// Optimization: skip diagonals in which paths cannot ever overlap.
const nF = Math.min(d, iMaxF);
// The diagonals kF = 2 * iF - d are odd when d is odd and even when d is even.
for (let iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2) {
// To get first point of path segment, move one change in forward direction
// from last point of previous path segment in an adjacent diagonal.
// In first iteration when iF === 0 and kF === -d always insert.
// In last possible iteration when iF === d and kF === d always delete.
const insert = iF === 0 || iF !== d && aIndexPrev1 < aIndexesF[iF];
const aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1;
const aFirst = insert ? aLastPrev // vertical to insert from b
: aLastPrev + 1; // horizontal to delete from a
// To get last point of path segment, move along diagonal of common items.
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) {
// Solve for iR of reverse path with (d - 1) changes in diagonal kF:
// kR = kF + baDeltaLength
// kR = (d - 1) - 2 * iR
const iR = (d - 1 - (kF + baDeltaLength)) / 2;
// If this forward path overlaps the reverse path in this diagonal,
// then this is the middle change of the index intervals.
if (iR <= iMaxR && aIndexesR[iR] - 1 <= aLast) {
// Unlike the Myers algorithm which finds only the middle “snake”
// this package can find two common subsequences per division.
// Last point of previous path segment is on an adjacent diagonal.
const bLastPrev = bF + aLastPrev - (insert ? kF + 1 : kF - 1);
// Because of invariant that intervals preceding the middle change
// cannot have common items at the end,
// move in reverse direction along a diagonal of common items.
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) {
// Optimization: number of preceding changes in forward direction
// is equal to number of items in preceding interval,
// therefore it cannot contain any common items.
division.aEndPreceding = aStart;
division.bEndPreceding = bStart;
} else {
division.aEndPreceding = aEndPreceding;
division.bEndPreceding = bEndPreceding;
}
division.nCommonPreceding = nCommonR;
if (nCommonR !== 0) {
division.aCommonPreceding = aEndPreceding;
division.bCommonPreceding = bEndPreceding;
}
division.nCommonFollowing = nCommonF;
if (nCommonF !== 0) {
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) {
// Optimization: number of changes in reverse direction
// is equal to number of items in following interval,
// therefore it cannot contain any common items.
division.aStartFollowing = aEnd;
division.bStartFollowing = bEnd;
} else {
division.aStartFollowing = aStartFollowing;
division.bStartFollowing = bStartFollowing;
}
return true;
}
}
}
return false;
};
// A complete function to extend reverse paths from (d - 1) to d changes.
// Return true if a path overlaps forward path of d changes in its diagonal.
const extendOverlappablePathsR = (d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division // update prop values if return true
) => {
const bR = bEnd - aEnd; // bIndex = bR + aIndex - kR
const aLength = aEnd - aStart;
const bLength = bEnd - bStart;
const baDeltaLength = bLength - aLength; // kR = kF + baDeltaLength
// Range of diagonals in which forward and reverse paths might overlap.
const kMinOverlapR = baDeltaLength - d; // -d <= kF
const kMaxOverlapR = baDeltaLength + d; // kF <= d
let aIndexPrev1 = NOT_YET_SET; // prev value of [iR - 1] in next iteration
// Optimization: skip diagonals in which paths cannot ever overlap.
const nR = Math.min(d, iMaxR);
// The diagonals kR = d - 2 * iR are odd when d is odd and even when d is even.
for (let iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2) {
// To get first point of path segment, move one change in reverse direction
// from last point of previous path segment in an adjacent diagonal.
// In first iteration when iR === 0 and kR === d always insert.
// In last possible iteration when iR === d and kR === -d always delete.
const insert = iR === 0 || iR !== d && aIndexesR[iR] < aIndexPrev1;
const aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1;
const aFirst = insert ? aLastPrev // vertical to insert from b
: aLastPrev - 1; // horizontal to delete from a
// To get last point of path segment, move along diagonal of common items.
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) {
// Solve for iF of forward path with d changes in diagonal kR:
// kF = kR - baDeltaLength
// kF = 2 * iF - d
const iF = (d + (kR - baDeltaLength)) / 2;
// If this reverse path overlaps the forward path in this diagonal,
// then this is a middle change of the index intervals.
if (iF <= iMaxF && aLast - 1 <= aIndexesF[iF]) {
const bLast = bFirst - nCommonR;
division.nChangePreceding = d;
if (d === aLast + bLast - aStart - bStart) {
// Optimization: number of changes in reverse direction
// is equal to number of items in preceding interval,
// therefore it cannot contain any common items.
division.aEndPreceding = aStart;
division.bEndPreceding = bStart;
} else {
division.aEndPreceding = aLast;
division.bEndPreceding = bLast;
}
division.nCommonPreceding = nCommonR;
if (nCommonR !== 0) {
// The last point of reverse path segment is start of common subsequence.
division.aCommonPreceding = aLast;
division.bCommonPreceding = bLast;
}
division.nChangeFollowing = d - 1;
if (d === 1) {
// There is no previous path segment.
division.nCommonFollowing = 0;
division.aStartFollowing = aEnd;
division.bStartFollowing = bEnd;
} else {
// Unlike the Myers algorithm which finds only the middle “snake”
// this package can find two common subsequences per division.
// Last point of previous path segment is on an adjacent diagonal.
const bLastPrev = bR + aLastPrev - (insert ? kR - 1 : kR + 1);
// Because of invariant that intervals following the middle change
// cannot have common items at the start,
// move in forward direction along a diagonal of common items.
const nCommonF = countCommonItemsF(aLastPrev, aEnd, bLastPrev, bEnd, isCommon);
division.nCommonFollowing = nCommonF;
if (nCommonF !== 0) {
// The last point of reverse path segment is start of common subsequence.
division.aCommonFollowing = aLastPrev;
division.bCommonFollowing = bLastPrev;
}
const aStartFollowing = aLastPrev + nCommonF; // aFirstPrev
const bStartFollowing = bLastPrev + nCommonF; // bFirstPrev
if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
// Optimization: number of changes in forward direction
// is equal to number of items in following interval,
// therefore it cannot contain any common items.
division.aStartFollowing = aEnd;
division.bStartFollowing = bEnd;
} else {
division.aStartFollowing = aStartFollowing;
division.bStartFollowing = bStartFollowing;
}
}
return true;
}
}
}
return false;
};
// Given index intervals and input function to compare items at indexes,
// divide at the middle change.
//
// DO NOT CALL if start === end, because interval cannot contain common items
// and because this function will throw the “no overlap” error.
const divide = (nChange, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, aIndexesR, division // output
) => {
const bF = bStart - aStart; // bIndex = bF + aIndex - kF
const bR = bEnd - aEnd; // bIndex = bR + aIndex - kR
const aLength = aEnd - aStart;
const bLength = bEnd - bStart;
// Because graph has square or portrait orientation,
// length difference is minimum number of items to insert from b.
// Corresponding forward and reverse diagonals in graph
// depend on length difference of the sequences:
// kF = kR - baDeltaLength
// kR = kF + baDeltaLength
const baDeltaLength = bLength - aLength;
// Optimization: max diagonal in graph intersects corner of shorter side.
let iMaxF = aLength;
let iMaxR = aLength;
// Initialize no changes yet in forward or reverse direction:
aIndexesF[0] = aStart - 1; // at open start of interval, outside closed start
aIndexesR[0] = aEnd; // at open end of interval
if (baDeltaLength % 2 === 0) {
// The number of changes in paths is 2 * d if length difference is even.
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 (
// If a reverse path overlaps a forward path in the same diagonal,
// return a division of the index intervals at the middle change.
extendOverlappablePathsR(d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division)) {
return;
}
}
} else {
// The number of changes in paths is 2 * d - 1 if length difference is odd.
const dMin = ((nChange || baDeltaLength) + 1) / 2;
const dMax = (aLength + bLength + 1) / 2;
// Unroll first half iteration so loop extends the relevant pairs of paths.
// Because of invariant that intervals have no common items at start or end,
// and limitation not to call divide with empty intervals,
// therefore it cannot be called if a forward path with one change
// would overlap a reverse path with no changes, even if dMin === 1.
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 (
// If a forward path overlaps a reverse path in the same diagonal,
// return a division of the index intervals at the middle change.
extendOverlappablePathsF(d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division)) {
return;
}
}
}
/* istanbul ignore next */
throw new Error(`${pkg}: no overlap aStart=${aStart} aEnd=${aEnd} bStart=${bStart} bEnd=${bEnd}`);
};
// Given index intervals and input function to compare items at indexes,
// return by output function the number of adjacent items and starting indexes
// of each common subsequence. Divide and conquer with only linear space.
//
// The index intervals are half open [start, end) like array slice method.
// DO NOT CALL if start === end, because interval cannot contain common items
// and because divide function will throw the “no overlap” error.
const findSubsequences = (nChange, aStart, aEnd, bStart, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division // temporary memory, not input nor output
) => {
if (bEnd - bStart < aEnd - aStart) {
// Transpose graph so it has portrait instead of landscape orientation.
// Always compare shorter to longer sequence for consistency and optimization.
transposed = !transposed;
if (transposed && callbacks.length === 1) {
// Lazily wrap callback functions to swap args if graph is transposed.
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 the index intervals at the middle change.
divide(nChange, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, aIndexesR, division);
const {
nChangePreceding,
aEndPreceding,
bEndPreceding,
nCommonPreceding,
aCommonPreceding,
bCommonPreceding,
nCommonFollowing,
aCommonFollowing,
bCommonFollowing,
nChangeFollowing,
aStartFollowing,
bStartFollowing
} = division;
// Unless either index interval is empty, they might contain common items.
if (aStart < aEndPreceding && bStart < bEndPreceding) {
// Recursely find and return common subsequences preceding the division.
findSubsequences(nChangePreceding, aStart, aEndPreceding, bStart, bEndPreceding, transposed, callbacks, aIndexesF, aIndexesR, division);
}
// Return common subsequences that are adjacent to the middle change.
if (nCommonPreceding !== 0) {
foundSubsequence(nCommonPreceding, aCommonPreceding, bCommonPreceding);
}
if (nCommonFollowing !== 0) {
foundSubsequence(nCommonFollowing, aCommonFollowing, bCommonFollowing);
}
// Unless either index interval is empty, they might contain common items.
if (aStartFollowing < aEnd && bStartFollowing < bEnd) {
// Recursely find and return common subsequences following the division.
findSubsequences(nChangeFollowing, aStartFollowing, aEnd, bStartFollowing, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division);
}
};
const validateLength = (name, arg) => {
if (typeof arg !== 'number') {
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 (type !== 'function') {
throw new TypeError(`${pkg}: ${name} typeof ${type} is not a function`);
}
};
// Compare items in two sequences to find a longest common subsequence.
// Given lengths of sequences and input function to compare items at indexes,
// return by output function the number of adjacent items and starting indexes
// of each common subsequence.
function diffSequence(aLength, bLength, isCommon, foundSubsequence) {
validateLength('aLength', aLength);
validateLength('bLength', bLength);
validateCallback('isCommon', isCommon);
validateCallback('foundSubsequence', foundSubsequence);
// Count common items from the start in the forward direction.
const nCommonF = countCommonItemsF(0, aLength, 0, bLength, isCommon);
if (nCommonF !== 0) {
foundSubsequence(nCommonF, 0, 0);
}
// Unless both sequences consist of common items only,
// find common items in the half-trimmed index intervals.
if (aLength !== nCommonF || bLength !== nCommonF) {
// Invariant: intervals do not have common items at the start.
// The start of an index interval is closed like array slice method.
const aStart = nCommonF;
const bStart = nCommonF;
// Count common items from the end in the reverse direction.
const nCommonR = countCommonItemsR(aStart, aLength - 1, bStart, bLength - 1, isCommon);
// Invariant: intervals do not have common items at the end.
// The end of an index interval is open like array slice method.
const aEnd = aLength - nCommonR;
const bEnd = bLength - nCommonR;
// Unless one sequence consists of common items only,
// therefore the other trimmed index interval consists of changes only,
// find common items in the trimmed index intervals.
const nCommonFR = nCommonF + nCommonR;
if (aLength !== nCommonFR && bLength !== nCommonFR) {
const nChange = 0; // number of change items is not yet known
const transposed = false; // call the original unwrapped functions
const callbacks = [{
foundSubsequence,
isCommon
}];
// Indexes in sequence a of last points in furthest reaching paths
// from outside the start at top left in the forward direction:
const aIndexesF = [NOT_YET_SET];
// from the end at bottom right in the reverse direction:
const aIndexesR = [NOT_YET_SET];
// Initialize one object as output of all calls to divide function.
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
};
// Find and return common subsequences in the trimmed index intervals.
findSubsequences(nChange, aStart, aEnd, bStart, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division);
}
if (nCommonR !== 0) {
foundSubsequence(nCommonR, aEnd, bEnd);
}
}
}
})();
module.exports = __webpack_exports__;
/******/ })()
;

View File

@@ -0,0 +1,3 @@
import cjsModule from './index.js';
export default cjsModule.default;

View File

@@ -0,0 +1,41 @@
{
"name": "@jest/diff-sequences",
"version": "30.3.0",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
"directory": "packages/diff-sequences"
},
"license": "MIT",
"description": "Compare items in two sequences to find a longest common subsequence",
"keywords": [
"fast",
"linear",
"space",
"callback",
"diff"
],
"engines": {
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
},
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
},
"devDependencies": {
"@fast-check/jest": "^2.1.1",
"benchmark": "^2.1.4",
"diff": "^8.0.3"
},
"publishConfig": {
"access": "public"
},
"gitHead": "efb59c2e81083f8dc941f20d6d20a3af2dc8d068"
}

22
frontend/node_modules/@jest/expect-utils/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
Copyright Contributors to the Jest project.
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.

5
frontend/node_modules/@jest/expect-utils/README.md generated vendored Normal file
View File

@@ -0,0 +1,5 @@
# `@jest/expect-utils`
This module exports some utils for the `expect` function used in [Jest](https://jestjs.io/).
You probably don't want to use this package directly. E.g. if you're writing [custom matcher](https://jestjs.io/docs/expect#expectextendmatchers), you should use the injected [`this.equals`](https://jestjs.io/docs/expect#thisequalsa-b).

View File

@@ -0,0 +1,95 @@
/**
* 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.
*/
export declare const arrayBufferEquality: (
a: unknown,
b: unknown,
) => boolean | undefined;
export declare function emptyObject(obj: unknown): boolean;
export declare const equals: EqualsFunction;
export declare type EqualsFunction = (
a: unknown,
b: unknown,
customTesters?: Array<Tester>,
strictCheck?: boolean,
) => boolean;
export declare const getObjectKeys: (object: object) => Array<string | symbol>;
export declare const getObjectSubset: (
object: any,
subset: any,
customTesters?: Array<Tester>,
seenReferences?: WeakMap<object, boolean>,
) => any;
declare type GetPath = {
hasEndProp?: boolean;
endPropIsDefined?: boolean;
lastTraversedObject: unknown;
traversedPath: Array<string>;
value?: unknown;
};
export declare const getPath: (
object: Record<string, any>,
propertyPath: string | Array<string>,
) => GetPath;
export declare function isA<T>(typeName: string, value: unknown): value is T;
export declare const isError: (value: unknown) => value is Error;
export declare const isOneline: (
expected: unknown,
received: unknown,
) => boolean;
export declare const iterableEquality: (
a: any,
b: any,
customTesters?: Array<Tester>,
aStack?: Array<any>,
bStack?: Array<any>,
) => boolean | undefined;
export declare const partition: <T>(
items: Array<T>,
predicate: (arg: T) => boolean,
) => [Array<T>, Array<T>];
export declare const pathAsArray: (propertyPath: string) => Array<any>;
export declare const sparseArrayEquality: (
a: unknown,
b: unknown,
customTesters?: Array<Tester>,
) => boolean | undefined;
export declare const subsetEquality: (
object: unknown,
subset: unknown,
customTesters?: Array<Tester>,
) => boolean | undefined;
export declare type Tester = (
this: TesterContext,
a: any,
b: any,
customTesters: Array<Tester>,
) => boolean | undefined;
export declare interface TesterContext {
equals: EqualsFunction;
}
export declare const typeEquality: (a: any, b: any) => boolean | undefined;
export {};

710
frontend/node_modules/@jest/expect-utils/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,710 @@
/*!
* /**
* * 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.
* * /
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/immutableUtils.ts"
(__unused_webpack_module, exports) {
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]);
}
/***/ },
/***/ "./src/index.ts"
(__unused_webpack_module, exports, __webpack_require__) {
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 = __webpack_require__("./src/jasmineUtils.ts");
var _utils = __webpack_require__("./src/utils.ts");
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];
}
});
});
/***/ },
/***/ "./src/jasmineUtils.ts"
(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.equals = void 0;
exports.isA = isA;
/*
Copyright (c) 2008-2016 Pivotal Labs
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.
*/
// Extracted out of jasmine 2.5.2
const equals = (a, b, customTesters, strictCheck) => {
customTesters = customTesters || [];
return eq(a, b, [], [], customTesters, strictCheck);
};
exports.equals = equals;
function isAsymmetric(obj) {
return !!obj && isA('Function', obj.asymmetricMatch);
}
function asymmetricMatch(a, b) {
const asymmetricA = isAsymmetric(a);
const asymmetricB = isAsymmetric(b);
if (asymmetricA && asymmetricB) {
return undefined;
}
if (asymmetricA) {
return a.asymmetricMatch(b);
}
if (asymmetricB) {
return b.asymmetricMatch(a);
}
}
// Equality function lovingly adapted from isEqual in
// [Underscore](http://underscorejs.org)
function eq(a, b, aStack, bStack, customTesters, strictCheck) {
let result = true;
const asymmetricResult = asymmetricMatch(a, b);
if (asymmetricResult !== undefined) {
return asymmetricResult;
}
const testerContext = {
equals
};
for (const item of customTesters) {
const customTesterResult = item.call(testerContext, a, b, customTesters);
if (customTesterResult !== undefined) {
return customTesterResult;
}
}
if (a instanceof Error && b instanceof Error) {
return a.message === b.message;
}
if (Object.is(a, b)) {
return true;
}
// A strict comparison is necessary because `null == undefined`.
if (a === null || b === null) {
return false;
}
const className = Object.prototype.toString.call(a);
if (className !== Object.prototype.toString.call(b)) {
return false;
}
switch (className) {
case '[object Boolean]':
case '[object String]':
case '[object Number]':
if (typeof a !== typeof b) {
// One is a primitive, one a `new Primitive()`
return false;
} else if (typeof a !== 'object' && typeof b !== 'object') {
// both are proper primitives
return false;
} else {
// both are `new Primitive()`s
return Object.is(a.valueOf(), b.valueOf());
}
case '[object Date]':
// Coerce dates to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return +a === +b;
// RegExps are compared by their source patterns and flags.
case '[object RegExp]':
return a.source === b.source && a.flags === b.flags;
// URLs are compared by their href property which contains the entire url string.
case '[object URL]':
return a.href === b.href;
}
if (typeof a !== 'object' || typeof b !== 'object') {
return false;
}
// Use DOM3 method isEqualNode (IE>=9)
if (isDomNode(a) && isDomNode(b)) {
return a.isEqualNode(b);
}
// Used to detect circular references.
let length = aStack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
// circular references at same depth are equal
// circular reference is not equal to non-circular one
if (aStack[length] === a) {
return bStack[length] === b;
} else if (bStack[length] === b) {
return false;
}
}
// Add the first object to the stack of traversed objects.
aStack.push(a);
bStack.push(b);
// Recursively compare objects and arrays.
// Compare array lengths to determine if a deep comparison is necessary.
if (strictCheck && className === '[object Array]' && a.length !== b.length) {
return false;
}
// Deep compare objects.
const aKeys = keys(a, hasKey);
let key;
const bKeys = keys(b, hasKey);
// Add keys corresponding to asymmetric matchers if they miss in non strict check mode
if (!strictCheck) {
for (let index = 0; index !== bKeys.length; ++index) {
key = bKeys[index];
if ((isAsymmetric(b[key]) || b[key] === undefined) && !hasKey(a, key)) {
aKeys.push(key);
}
}
for (let index = 0; index !== aKeys.length; ++index) {
key = aKeys[index];
if ((isAsymmetric(a[key]) || a[key] === undefined) && !hasKey(b, key)) {
bKeys.push(key);
}
}
}
// Ensure that both objects contain the same number of properties before comparing deep equality.
let size = aKeys.length;
if (bKeys.length !== size) {
return false;
}
while (size--) {
key = aKeys[size];
// Deep compare each member
if (strictCheck) result = hasKey(b, key) && eq(a[key], b[key], aStack, bStack, customTesters, strictCheck);else result = (hasKey(b, key) || isAsymmetric(a[key]) || a[key] === undefined) && eq(a[key], b[key], aStack, bStack, customTesters, strictCheck);
if (!result) {
return false;
}
}
// Remove the first object from the stack of traversed objects.
aStack.pop();
bStack.pop();
return result;
}
function keys(obj, hasKey) {
const keys = [];
for (const key in obj) {
if (hasKey(obj, key)) {
keys.push(key);
}
}
return [...keys, ...Object.getOwnPropertySymbols(obj).filter(symbol => Object.getOwnPropertyDescriptor(obj, symbol).enumerable)];
}
function hasKey(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
function isA(typeName, value) {
return Object.prototype.toString.apply(value) === `[object ${typeName}]`;
}
function isDomNode(obj) {
return obj !== null && typeof obj === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string' && typeof obj.isEqualNode === 'function';
}
/***/ },
/***/ "./src/utils.ts"
(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.arrayBufferEquality = void 0;
exports.emptyObject = emptyObject;
exports.typeEquality = exports.subsetEquality = exports.sparseArrayEquality = exports.pathAsArray = exports.partition = exports.iterableEquality = exports.isOneline = exports.isError = exports.getPath = exports.getObjectSubset = exports.getObjectKeys = void 0;
var _getType = require("@jest/get-type");
var _immutableUtils = __webpack_require__("./src/immutableUtils.ts");
var _jasmineUtils = __webpack_require__("./src/jasmineUtils.ts");
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
/**
* 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.
*
*/
/**
* Checks if `hasOwnProperty(object, key)` up the prototype chain, stopping at `Object.prototype`.
*/
const hasPropertyInObject = (object, key) => {
const shouldTerminate = !object || typeof object !== 'object' || object === Object.prototype;
if (shouldTerminate) {
return false;
}
return Object.prototype.hasOwnProperty.call(object, key) || hasPropertyInObject(Object.getPrototypeOf(object), key);
};
// Retrieves an object's keys for evaluation by getObjectSubset. This evaluates
// the prototype chain for string keys but not for non-enumerable symbols.
// (Otherwise, it could find values such as a Set or Map's Symbol.toStringTag,
// with unexpected results.)
const getObjectKeys = object => {
return [...Object.keys(object), ...Object.getOwnPropertySymbols(object).filter(s => Object.getOwnPropertyDescriptor(object, s)?.enumerable)];
};
exports.getObjectKeys = getObjectKeys;
const getPath = (object, propertyPath) => {
if (!Array.isArray(propertyPath)) {
propertyPath = pathAsArray(propertyPath);
}
if (propertyPath.length > 0) {
const lastProp = propertyPath.length === 1;
const prop = propertyPath[0];
const newObject = object[prop];
if (!lastProp && (newObject === null || newObject === undefined)) {
// This is not the last prop in the chain. If we keep recursing it will
// hit a `can't access property X of undefined | null`. At this point we
// know that the chain has broken and we can return right away.
return {
hasEndProp: false,
lastTraversedObject: object,
traversedPath: []
};
}
const result = getPath(newObject, propertyPath.slice(1));
if (result.lastTraversedObject === null) {
result.lastTraversedObject = object;
}
result.traversedPath.unshift(prop);
if (lastProp) {
// Does object have the property with an undefined value?
// Although primitive values support bracket notation (above)
// they would throw TypeError for in operator (below).
result.endPropIsDefined = !(0, _getType.isPrimitive)(object) && prop in object;
result.hasEndProp = newObject !== undefined || result.endPropIsDefined;
if (!result.hasEndProp) {
result.traversedPath.shift();
}
}
return result;
}
return {
lastTraversedObject: null,
traversedPath: [],
value: object
};
};
// Strip properties from object that are not present in the subset. Useful for
// printing the diff for toMatchObject() without adding unrelated noise.
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
exports.getPath = getPath;
const getObjectSubset = (object, subset, customTesters = [], seenReferences = new WeakMap()) => {
/* eslint-enable @typescript-eslint/explicit-module-boundary-types */
if (Array.isArray(object)) {
if (Array.isArray(subset) && subset.length === object.length) {
// The map method returns correct subclass of subset.
return subset.map((sub, i) => getObjectSubset(object[i], sub, customTesters));
}
} else if (object instanceof Date) {
return object;
} else if (isObject(object) && isObject(subset)) {
if ((0, _jasmineUtils.equals)(object, subset, [...customTesters, iterableEquality, subsetEquality])) {
// Avoid unnecessary copy which might return Object instead of subclass.
return subset;
}
const trimmed = {};
seenReferences.set(object, trimmed);
for (const key of getObjectKeys(object)) {
if (!hasPropertyInObject(subset, key)) {
continue;
}
trimmed[key] = seenReferences.has(object[key]) ? seenReferences.get(object[key]) : getObjectSubset(object[key], subset[key], customTesters, seenReferences);
}
if (getObjectKeys(trimmed).length > 0) {
return trimmed;
}
}
return object;
};
exports.getObjectSubset = getObjectSubset;
const IteratorSymbol = Symbol.iterator;
const hasIterator = object => !!(object != null && object[IteratorSymbol]);
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
const iterableEquality = (a, b, customTesters = [], /* eslint-enable @typescript-eslint/explicit-module-boundary-types */
aStack = [], bStack = []) => {
if (typeof a !== 'object' || typeof b !== 'object' || Array.isArray(a) || Array.isArray(b) || ArrayBuffer.isView(a) || ArrayBuffer.isView(b) || !hasIterator(a) || !hasIterator(b)) {
return undefined;
}
if (a.constructor !== b.constructor) {
return false;
}
let length = aStack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
// circular references at same depth are equal
// circular reference is not equal to non-circular one
if (aStack[length] === a) {
return bStack[length] === b;
}
}
aStack.push(a);
bStack.push(b);
const iterableEqualityWithStack = (a, b) => iterableEquality(a, b, [...filteredCustomTesters], [...aStack], [...bStack]);
// Replace any instance of iterableEquality with the new
// iterableEqualityWithStack so we can do circular detection
const filteredCustomTesters = [...customTesters.filter(t => t !== iterableEquality), iterableEqualityWithStack];
if (a.size !== undefined) {
if (a.size !== b.size) {
return false;
} else if ((0, _jasmineUtils.isA)('Set', a) || (0, _immutableUtils.isImmutableUnorderedSet)(a)) {
let allFound = true;
for (const aValue of a) {
if (!b.has(aValue)) {
let has = false;
for (const bValue of b) {
const isEqual = (0, _jasmineUtils.equals)(aValue, bValue, filteredCustomTesters);
if (isEqual === true) {
has = true;
}
}
if (has === false) {
allFound = false;
break;
}
}
}
// Remove the first value from the stack of traversed values.
aStack.pop();
bStack.pop();
return allFound;
} else if ((0, _jasmineUtils.isA)('Map', a) || (0, _immutableUtils.isImmutableUnorderedKeyed)(a)) {
let allFound = true;
for (const aEntry of a) {
if (!b.has(aEntry[0]) || !(0, _jasmineUtils.equals)(aEntry[1], b.get(aEntry[0]), filteredCustomTesters)) {
let has = false;
for (const bEntry of b) {
const matchedKey = (0, _jasmineUtils.equals)(aEntry[0], bEntry[0], filteredCustomTesters);
let matchedValue = false;
if (matchedKey === true) {
matchedValue = (0, _jasmineUtils.equals)(aEntry[1], bEntry[1], filteredCustomTesters);
}
if (matchedValue === true) {
has = true;
}
}
if (has === false) {
allFound = false;
break;
}
}
}
// Remove the first value from the stack of traversed values.
aStack.pop();
bStack.pop();
return allFound;
}
}
const bIterator = b[IteratorSymbol]();
for (const aValue of a) {
const nextB = bIterator.next();
if (nextB.done || !(0, _jasmineUtils.equals)(aValue, nextB.value, filteredCustomTesters)) {
return false;
}
}
if (!bIterator.next().done) {
return false;
}
if (!(0, _immutableUtils.isImmutableList)(a) && !(0, _immutableUtils.isImmutableOrderedKeyed)(a) && !(0, _immutableUtils.isImmutableOrderedSet)(a) && !(0, _immutableUtils.isImmutableRecord)(a)) {
const aEntries = entries(a);
const bEntries = entries(b);
if (!(0, _jasmineUtils.equals)(aEntries, bEntries)) {
return false;
}
}
// Remove the first value from the stack of traversed values.
aStack.pop();
bStack.pop();
return true;
};
exports.iterableEquality = iterableEquality;
const entries = obj => {
if (!isObject(obj)) return [];
const symbolProperties = Object.getOwnPropertySymbols(obj).filter(key => key !== Symbol.iterator).map(key => [key, obj[key]]);
return [...symbolProperties, ...Object.entries(obj)];
};
const isObject = a => a !== null && typeof a === 'object';
const isObjectWithKeys = a => isObject(a) && !(a instanceof Error) && !Array.isArray(a) && !(a instanceof Date) && !(a instanceof Set) && !(a instanceof Map);
const subsetEquality = (object, subset, customTesters = []) => {
const filteredCustomTesters = customTesters.filter(t => t !== subsetEquality);
// subsetEquality needs to keep track of the references
// it has already visited to avoid infinite loops in case
// there are circular references in the subset passed to it.
const subsetEqualityWithContext = (seenReferences = new WeakMap()) => (object, subset) => {
if (!isObjectWithKeys(subset)) {
return undefined;
}
if (seenReferences.has(subset)) return undefined;
seenReferences.set(subset, true);
const matchResult = getObjectKeys(subset).every(key => {
if (isObjectWithKeys(subset[key])) {
if (seenReferences.has(subset[key])) {
return (0, _jasmineUtils.equals)(object[key], subset[key], filteredCustomTesters);
}
}
const result = object != null && hasPropertyInObject(object, key) && (0, _jasmineUtils.equals)(object[key], subset[key], [...filteredCustomTesters, subsetEqualityWithContext(seenReferences)]);
// The main goal of using seenReference is to avoid circular node on tree.
// It will only happen within a parent and its child, not a node and nodes next to it (same level)
// We should keep the reference for a parent and its child only
// Thus we should delete the reference immediately so that it doesn't interfere
// other nodes within the same level on tree.
seenReferences.delete(subset[key]);
return result;
});
seenReferences.delete(subset);
return matchResult;
};
return subsetEqualityWithContext()(object, subset);
};
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
exports.subsetEquality = subsetEquality;
const typeEquality = (a, b) => {
if (a == null || b == null || a.constructor === b.constructor ||
// Since Jest globals are different from Node globals,
// constructors are different even between arrays when comparing properties of mock objects.
// Both of them should be able to compare correctly when they are array-to-array.
// https://github.com/jestjs/jest/issues/2549
Array.isArray(a) && Array.isArray(b)) {
return undefined;
}
return false;
};
exports.typeEquality = typeEquality;
const arrayBufferEquality = (a, b) => {
let dataViewA = a;
let dataViewB = b;
if (isArrayBuffer(a) && isArrayBuffer(b)) {
dataViewA = new DataView(a);
dataViewB = new DataView(b);
} else if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
dataViewA = new DataView(a.buffer, a.byteOffset, a.byteLength);
dataViewB = new DataView(b.buffer, b.byteOffset, b.byteLength);
}
if (!(dataViewA instanceof DataView && dataViewB instanceof DataView)) {
return undefined;
}
// Buffers are not equal when they do not have the same byte length
if (dataViewA.byteLength !== dataViewB.byteLength) {
return false;
}
// Check if every byte value is equal to each other
for (let i = 0; i < dataViewA.byteLength; i++) {
if (dataViewA.getUint8(i) !== dataViewB.getUint8(i)) {
return false;
}
}
return true;
};
exports.arrayBufferEquality = arrayBufferEquality;
function isArrayBuffer(obj) {
return Object.prototype.toString.call(obj) === '[object ArrayBuffer]';
}
const sparseArrayEquality = (a, b, customTesters = []) => {
if (!Array.isArray(a) || !Array.isArray(b)) {
return undefined;
}
// A sparse array [, , 1] will have keys ["2"] whereas [undefined, undefined, 1] will have keys ["0", "1", "2"]
const aKeys = Object.keys(a);
const bKeys = Object.keys(b);
return (0, _jasmineUtils.equals)(a, b, customTesters.filter(t => t !== sparseArrayEquality), true) && (0, _jasmineUtils.equals)(aKeys, bKeys);
};
exports.sparseArrayEquality = sparseArrayEquality;
const partition = (items, predicate) => {
const result = [[], []];
for (const item of items) result[predicate(item) ? 0 : 1].push(item);
return result;
};
exports.partition = partition;
const pathAsArray = propertyPath => {
const properties = [];
if (propertyPath === '') {
properties.push('');
return properties;
}
// will match everything that's not a dot or a bracket, and "" for consecutive dots.
const pattern = new RegExp('[^.[\\]]+|(?=(?:\\.)(?:\\.|$))', 'g');
// Because the regex won't match a dot in the beginning of the path, if present.
if (propertyPath[0] === '.') {
properties.push('');
}
propertyPath.replaceAll(pattern, match => {
properties.push(match);
return match;
});
return properties;
};
// Copied from https://github.com/graingert/angular.js/blob/a43574052e9775cbc1d7dd8a086752c979b0f020/src/Angular.js#L685-L693
exports.pathAsArray = pathAsArray;
const isError = value => {
switch (Object.prototype.toString.call(value)) {
case '[object Error]':
case '[object Exception]':
case '[object DOMException]':
return true;
default:
return value instanceof Error;
}
};
exports.isError = isError;
function emptyObject(obj) {
return obj && typeof obj === 'object' ? Object.keys(obj).length === 0 : false;
}
const MULTILINE_REGEXP = /[\n\r]/;
const isOneline = (expected, received) => typeof expected === 'string' && typeof received === 'string' && (!MULTILINE_REGEXP.test(expected) || !MULTILINE_REGEXP.test(received));
exports.isOneline = isOneline;
/***/ }
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module is referenced by other modules so it can't be inlined
/******/ var __webpack_exports__ = __webpack_require__("./src/index.ts");
/******/ module.exports = __webpack_exports__;
/******/
/******/ })()
;

View File

@@ -0,0 +1,17 @@
import cjsModule from './index.js';
export const equals = cjsModule.equals;
export const isA = cjsModule.isA;
export const arrayBufferEquality = cjsModule.arrayBufferEquality;
export const emptyObject = cjsModule.emptyObject;
export const getObjectKeys = cjsModule.getObjectKeys;
export const getObjectSubset = cjsModule.getObjectSubset;
export const getPath = cjsModule.getPath;
export const isError = cjsModule.isError;
export const isOneline = cjsModule.isOneline;
export const iterableEquality = cjsModule.iterableEquality;
export const partition = cjsModule.partition;
export const pathAsArray = cjsModule.pathAsArray;
export const sparseArrayEquality = cjsModule.sparseArrayEquality;
export const subsetEquality = cjsModule.subsetEquality;
export const typeEquality = cjsModule.typeEquality;

35
frontend/node_modules/@jest/expect-utils/package.json generated vendored Normal file
View File

@@ -0,0 +1,35 @@
{
"name": "@jest/expect-utils",
"version": "30.3.0",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
"directory": "packages/expect-utils"
},
"license": "MIT",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
},
"dependencies": {
"@jest/get-type": "30.1.0"
},
"devDependencies": {
"immutable": "^5.1.2",
"jest-matcher-utils": "30.3.0"
},
"engines": {
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "efb59c2e81083f8dc941f20d6d20a3af2dc8d068"
}

22
frontend/node_modules/@jest/get-type/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
Copyright Contributors to the Jest project.
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.

12
frontend/node_modules/@jest/get-type/build/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
//#region src/index.d.ts
/**
* 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.
*/
type ValueType = 'array' | 'bigint' | 'boolean' | 'function' | 'null' | 'number' | 'object' | 'regexp' | 'map' | 'set' | 'date' | 'string' | 'symbol' | 'undefined';
declare function getType(value: unknown): ValueType;
declare const isPrimitive: (value: unknown) => boolean;
//#endregion
export { getType, isPrimitive };

30
frontend/node_modules/@jest/get-type/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,30 @@
/**
* 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.
*/
export declare function getType(value: unknown): ValueType;
export declare const isPrimitive: (
value: unknown,
) => value is null | undefined | string | number | boolean | symbol | bigint;
declare type ValueType =
| 'array'
| 'bigint'
| 'boolean'
| 'function'
| 'null'
| 'number'
| 'object'
| 'regexp'
| 'map'
| 'set'
| 'date'
| 'string'
| 'symbol'
| 'undefined';
export {};

70
frontend/node_modules/@jest/get-type/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,70 @@
/*!
* /**
* * 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.
* * /
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
(() => {
var exports = __webpack_exports__;
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.getType = getType;
exports.isPrimitive = 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.
*/
// get the type of a value with handling the edge cases like `typeof []`
// and `typeof null`
function getType(value) {
if (value === undefined) {
return 'undefined';
} else if (value === null) {
return 'null';
} else if (Array.isArray(value)) {
return 'array';
} else if (typeof value === 'boolean') {
return 'boolean';
} else if (typeof value === 'function') {
return 'function';
} else if (typeof value === 'number') {
return 'number';
} else if (typeof value === 'string') {
return 'string';
} else if (typeof value === 'bigint') {
return 'bigint';
} else if (typeof value === 'object') {
if (value.constructor === RegExp) {
return 'regexp';
} else if (value.constructor === Map) {
return 'map';
} else if (value.constructor === Set) {
return 'set';
} else if (value.constructor === Date) {
return 'date';
}
return 'object';
} else if (typeof value === 'symbol') {
return 'symbol';
}
throw new Error(`value of unknown type: ${value}`);
}
const isPrimitive = value => Object(value) !== value;
exports.isPrimitive = isPrimitive;
})();
module.exports = __webpack_exports__;
/******/ })()
;

4
frontend/node_modules/@jest/get-type/build/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import cjsModule from './index.js';
export const getType = cjsModule.getType;
export const isPrimitive = cjsModule.isPrimitive;

29
frontend/node_modules/@jest/get-type/package.json generated vendored Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "@jest/get-type",
"description": "A utility function to get the type of a value",
"version": "30.1.0",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
"directory": "packages/jest-get-type"
},
"engines": {
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
},
"license": "MIT",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
},
"publishConfig": {
"access": "public"
},
"gitHead": "4d5f41d0885c1d9630c81b4fd47f74ab0615e18f"
}

22
frontend/node_modules/@jest/pattern/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
Copyright Contributors to the Jest project.
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
frontend/node_modules/@jest/pattern/README.md generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# @jest/pattern
`@jest/pattern` is a helper library for the jest library that implements the logic for parsing and matching patterns.

View File

@@ -0,0 +1,5 @@
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "/Users/cpojer/Dropbox/Projects/jest/packages/jest-pattern/build/index.d.ts",
"projectFolder": "/Users/cpojer/Dropbox/Projects/jest/packages/jest-pattern"
}

65
frontend/node_modules/@jest/pattern/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,65 @@
/**
* 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.
*/
export declare class TestPathPatterns {
readonly patterns: Array<string>;
constructor(patterns: Array<string>);
/**
* Return true if there are any patterns.
*/
isSet(): boolean;
/**
* Return true if the patterns are valid.
*/
isValid(): boolean;
/**
* Return a human-friendly version of the pattern regex.
*/
toPretty(): string;
/**
* Return a TestPathPatternsExecutor that can execute the patterns.
*/
toExecutor(
options: TestPathPatternsExecutorOptions,
): TestPathPatternsExecutor;
/** For jest serializers */
toJSON(): any;
}
export declare class TestPathPatternsExecutor {
readonly patterns: TestPathPatterns;
private readonly options;
constructor(
patterns: TestPathPatterns,
options: TestPathPatternsExecutorOptions,
);
private toRegex;
/**
* Return true if there are any patterns.
*/
isSet(): boolean;
/**
* Return true if the patterns are valid.
*/
isValid(): boolean;
/**
* Return true if the given ABSOLUTE path matches the patterns.
*
* Throws an error if the patterns form an invalid regex (see `validate`).
*/
isMatch(absPath: string): boolean;
/**
* Return a human-friendly version of the pattern regex.
*/
toPretty(): string;
}
export declare type TestPathPatternsExecutorOptions = {
rootDir: string;
};
export {};

214
frontend/node_modules/@jest/pattern/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,214 @@
/*!
* /**
* * 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.
* * /
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/TestPathPatterns.ts":
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.TestPathPatternsExecutor = exports.TestPathPatterns = void 0;
function path() {
const data = _interopRequireWildcard(require("path"));
path = function () {
return data;
};
return data;
}
function _jestRegexUtil() {
const data = require("jest-regex-util");
_jestRegexUtil = function () {
return data;
};
return data;
}
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
/**
* 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 TestPathPatterns {
constructor(patterns) {
this.patterns = patterns;
}
/**
* Return true if there are any patterns.
*/
isSet() {
return this.patterns.length > 0;
}
/**
* Return true if the patterns are valid.
*/
isValid() {
return this.toExecutor({
// isValid() doesn't require rootDir to be accurate, so just
// specify a dummy rootDir here
rootDir: '/'
}).isValid();
}
/**
* Return a human-friendly version of the pattern regex.
*/
toPretty() {
return this.patterns.join('|');
}
/**
* Return a TestPathPatternsExecutor that can execute the patterns.
*/
toExecutor(options) {
return new TestPathPatternsExecutor(this, options);
}
/** For jest serializers */
toJSON() {
return {
patterns: this.patterns,
type: 'TestPathPatterns'
};
}
}
exports.TestPathPatterns = TestPathPatterns;
class TestPathPatternsExecutor {
constructor(patterns, options) {
this.patterns = patterns;
this.options = options;
}
toRegex(s) {
return new RegExp(s, 'i');
}
/**
* Return true if there are any patterns.
*/
isSet() {
return this.patterns.isSet();
}
/**
* Return true if the patterns are valid.
*/
isValid() {
try {
for (const p of this.patterns.patterns) {
this.toRegex(p);
}
return true;
} catch {
return false;
}
}
/**
* Return true if the given ABSOLUTE path matches the patterns.
*
* Throws an error if the patterns form an invalid regex (see `validate`).
*/
isMatch(absPath) {
const relPath = path().relative(this.options.rootDir || '/', absPath);
if (this.patterns.patterns.length === 0) {
return true;
}
for (const p of this.patterns.patterns) {
const pathToTest = path().isAbsolute(p) ? absPath : relPath;
// special case: ./foo.spec.js (and .\foo.spec.js on Windows) should
// match /^foo.spec.js/ after stripping root dir
let regexStr = p.replace(/^\.\//, '^');
if (path().sep === '\\') {
regexStr = regexStr.replace(/^\.\\/, '^');
}
regexStr = (0, _jestRegexUtil().replacePathSepForRegex)(regexStr);
if (this.toRegex(regexStr).test(pathToTest)) {
return true;
}
if (this.toRegex(regexStr).test(absPath)) {
return true;
}
}
return false;
}
/**
* Return a human-friendly version of the pattern regex.
*/
toPretty() {
return this.patterns.toPretty();
}
}
exports.TestPathPatternsExecutor = TestPathPatternsExecutor;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
(() => {
var exports = __webpack_exports__;
Object.defineProperty(exports, "__esModule", ({
value: true
}));
Object.defineProperty(exports, "TestPathPatterns", ({
enumerable: true,
get: function () {
return _TestPathPatterns.TestPathPatterns;
}
}));
Object.defineProperty(exports, "TestPathPatternsExecutor", ({
enumerable: true,
get: function () {
return _TestPathPatterns.TestPathPatternsExecutor;
}
}));
var _TestPathPatterns = __webpack_require__("./src/TestPathPatterns.ts");
})();
module.exports = __webpack_exports__;
/******/ })()
;

4
frontend/node_modules/@jest/pattern/build/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import cjsModule from './index.js';
export const TestPathPatterns = cjsModule.TestPathPatterns;
export const TestPathPatternsExecutor = cjsModule.TestPathPatternsExecutor;

32
frontend/node_modules/@jest/pattern/package.json generated vendored Normal file
View File

@@ -0,0 +1,32 @@
{
"name": "@jest/pattern",
"version": "30.0.1",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
"directory": "packages/jest-pattern"
},
"license": "MIT",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
},
"dependencies": {
"@types/node": "*",
"jest-regex-util": "30.0.1"
},
"engines": {
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "5ce865b4060189fe74cd486544816c079194a0f7"
}

View File

@@ -0,0 +1,132 @@
/**
* 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 * as path from 'path';
import {replacePathSepForRegex} from 'jest-regex-util';
export class TestPathPatterns {
constructor(readonly patterns: Array<string>) {}
/**
* Return true if there are any patterns.
*/
isSet(): boolean {
return this.patterns.length > 0;
}
/**
* Return true if the patterns are valid.
*/
isValid(): boolean {
return this.toExecutor({
// isValid() doesn't require rootDir to be accurate, so just
// specify a dummy rootDir here
rootDir: '/',
}).isValid();
}
/**
* Return a human-friendly version of the pattern regex.
*/
toPretty(): string {
return this.patterns.join('|');
}
/**
* Return a TestPathPatternsExecutor that can execute the patterns.
*/
toExecutor(
options: TestPathPatternsExecutorOptions,
): TestPathPatternsExecutor {
return new TestPathPatternsExecutor(this, options);
}
/** For jest serializers */
toJSON(): any {
return {
patterns: this.patterns,
type: 'TestPathPatterns',
};
}
}
export type TestPathPatternsExecutorOptions = {
rootDir: string;
};
export class TestPathPatternsExecutor {
constructor(
readonly patterns: TestPathPatterns,
private readonly options: TestPathPatternsExecutorOptions,
) {}
private toRegex(s: string): RegExp {
return new RegExp(s, 'i');
}
/**
* Return true if there are any patterns.
*/
isSet(): boolean {
return this.patterns.isSet();
}
/**
* Return true if the patterns are valid.
*/
isValid(): boolean {
try {
for (const p of this.patterns.patterns) {
this.toRegex(p);
}
return true;
} catch {
return false;
}
}
/**
* Return true if the given ABSOLUTE path matches the patterns.
*
* Throws an error if the patterns form an invalid regex (see `validate`).
*/
isMatch(absPath: string): boolean {
const relPath = path.relative(this.options.rootDir || '/', absPath);
if (this.patterns.patterns.length === 0) {
return true;
}
for (const p of this.patterns.patterns) {
const pathToTest = path.isAbsolute(p) ? absPath : relPath;
// special case: ./foo.spec.js (and .\foo.spec.js on Windows) should
// match /^foo.spec.js/ after stripping root dir
let regexStr = p.replace(/^\.\//, '^');
if (path.sep === '\\') {
regexStr = regexStr.replace(/^\.\\/, '^');
}
regexStr = replacePathSepForRegex(regexStr);
if (this.toRegex(regexStr).test(pathToTest)) {
return true;
}
if (this.toRegex(regexStr).test(absPath)) {
return true;
}
}
return false;
}
/**
* Return a human-friendly version of the pattern regex.
*/
toPretty(): string {
return this.patterns.toPretty();
}
}

View File

@@ -0,0 +1,259 @@
/**
* 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 * as path from 'path';
import {
TestPathPatterns,
TestPathPatternsExecutor,
type TestPathPatternsExecutorOptions,
} from '../TestPathPatterns';
const mockSep: jest.Mock<() => string> = jest.fn();
const mockIsAbsolute: jest.Mock<(p: string) => boolean> = jest.fn();
const mockRelative: jest.Mock<(from: string, to: string) => string> = jest.fn();
jest.mock('path', () => {
const actualPath = jest.requireActual('path');
return {
...actualPath,
isAbsolute(p) {
return mockIsAbsolute(p) || actualPath.isAbsolute(p);
},
relative(from, to) {
return mockRelative(from, to) || actualPath.relative(from, to);
},
get sep() {
return mockSep() || actualPath.sep;
},
} as typeof path;
});
const forcePosix = () => {
mockSep.mockReturnValue(path.posix.sep);
mockIsAbsolute.mockImplementation(path.posix.isAbsolute);
mockRelative.mockImplementation(path.posix.relative);
};
const forceWindows = () => {
mockSep.mockReturnValue(path.win32.sep);
mockIsAbsolute.mockImplementation(path.win32.isAbsolute);
mockRelative.mockImplementation(path.win32.relative);
};
beforeEach(() => {
jest.resetAllMocks();
forcePosix();
});
const config = {rootDir: ''};
interface TestPathPatternsLike {
isSet(): boolean;
isValid(): boolean;
toPretty(): string;
}
const testPathPatternsLikeTests = (
makePatterns: (
patterns: Array<string>,
options: TestPathPatternsExecutorOptions,
) => TestPathPatternsLike,
) => {
describe('isSet', () => {
it('returns false if no patterns specified', () => {
const testPathPatterns = makePatterns([], config);
expect(testPathPatterns.isSet()).toBe(false);
});
it('returns true if patterns specified', () => {
const testPathPatterns = makePatterns(['a'], config);
expect(testPathPatterns.isSet()).toBe(true);
});
});
describe('isValid', () => {
it('succeeds for empty patterns', () => {
const testPathPatterns = makePatterns([], config);
expect(testPathPatterns.isValid()).toBe(true);
});
it('succeeds for valid patterns', () => {
const testPathPatterns = makePatterns(['abc+', 'z.*'], config);
expect(testPathPatterns.isValid()).toBe(true);
});
it('fails for at least one invalid pattern', () => {
const testPathPatterns = makePatterns(['abc+', '(', 'z.*'], config);
expect(testPathPatterns.isValid()).toBe(false);
});
});
describe('toPretty', () => {
it('renders a human-readable string', () => {
const testPathPatterns = makePatterns(['a/b', 'c/d'], config);
expect(testPathPatterns.toPretty()).toMatchSnapshot();
});
});
};
describe('TestPathPatterns', () => {
testPathPatternsLikeTests(
(patterns: Array<string>, _: TestPathPatternsExecutorOptions) =>
new TestPathPatterns(patterns),
);
});
describe('TestPathPatternsExecutor', () => {
const makeExecutor = (
patterns: Array<string>,
options: TestPathPatternsExecutorOptions,
) => new TestPathPatternsExecutor(new TestPathPatterns(patterns), options);
testPathPatternsLikeTests(makeExecutor);
describe('isMatch', () => {
it('returns true with no patterns', () => {
const testPathPatterns = makeExecutor([], config);
expect(testPathPatterns.isMatch('/a/b')).toBe(true);
});
it('returns true for same path', () => {
const testPathPatterns = makeExecutor(['/a/b'], config);
expect(testPathPatterns.isMatch('/a/b')).toBe(true);
});
it('returns true for same path with case insensitive', () => {
const testPathPatternsUpper = makeExecutor(['/A/B'], config);
expect(testPathPatternsUpper.isMatch('/a/b')).toBe(true);
expect(testPathPatternsUpper.isMatch('/A/B')).toBe(true);
const testPathPatternsLower = makeExecutor(['/a/b'], config);
expect(testPathPatternsLower.isMatch('/A/B')).toBe(true);
expect(testPathPatternsLower.isMatch('/a/b')).toBe(true);
});
it('returns true for contained path', () => {
const testPathPatterns = makeExecutor(['b/c'], config);
expect(testPathPatterns.isMatch('/a/b/c/d')).toBe(true);
});
it('returns true for explicit relative path', () => {
const testPathPatterns = makeExecutor(['./b/c'], {
rootDir: '/a',
});
expect(testPathPatterns.isMatch('/a/b/c')).toBe(true);
});
it('returns true for explicit relative path for Windows with ./', () => {
forceWindows();
const testPathPatterns = makeExecutor(['./b/c'], {
rootDir: 'C:\\a',
});
expect(testPathPatterns.isMatch('C:\\a\\b\\c')).toBe(true);
});
it('returns true for explicit relative path for Windows with .\\', () => {
forceWindows();
const testPathPatterns = makeExecutor(['.\\b\\c'], {
rootDir: 'C:\\a',
});
expect(testPathPatterns.isMatch('C:\\a\\b\\c')).toBe(true);
});
it('returns true for partial file match', () => {
const testPathPatterns = makeExecutor(['aaa'], config);
expect(testPathPatterns.isMatch('/foo/..aaa..')).toBe(true);
expect(testPathPatterns.isMatch('/foo/..aaa')).toBe(true);
expect(testPathPatterns.isMatch('/foo/aaa..')).toBe(true);
});
it('returns true for path suffix', () => {
const testPathPatterns = makeExecutor(['c/d'], config);
expect(testPathPatterns.isMatch('/a/b/c/d')).toBe(true);
});
it('returns true if regex matches', () => {
const testPathPatterns = makeExecutor(['ab*c?'], config);
expect(testPathPatterns.isMatch('/foo/a')).toBe(true);
expect(testPathPatterns.isMatch('/foo/ab')).toBe(true);
expect(testPathPatterns.isMatch('/foo/abb')).toBe(true);
expect(testPathPatterns.isMatch('/foo/ac')).toBe(true);
expect(testPathPatterns.isMatch('/foo/abc')).toBe(true);
expect(testPathPatterns.isMatch('/foo/abbc')).toBe(true);
expect(testPathPatterns.isMatch('/foo/bc')).toBe(false);
});
it('returns true only if matches relative path', () => {
const rootDir = '/home/myuser/';
const testPathPatterns = makeExecutor(['home'], {
rootDir,
});
expect(
testPathPatterns.isMatch(
path.relative(rootDir, '/home/myuser/LoginPage.js'),
),
).toBe(false);
expect(
testPathPatterns.isMatch(
path.relative(rootDir, '/home/myuser/HomePage.js'),
),
).toBe(true);
});
it('matches absolute paths regardless of rootDir', () => {
forcePosix();
const testPathPatterns = makeExecutor(['/a/b'], {
rootDir: '/foo/bar',
});
expect(testPathPatterns.isMatch('/a/b')).toBe(true);
});
it('matches absolute paths for Windows', () => {
forceWindows();
const testPathPatterns = makeExecutor(['C:\\a\\b'], {
rootDir: 'C:\\foo\\bar',
});
expect(testPathPatterns.isMatch('C:\\a\\b')).toBe(true);
});
it('returns true if match any paths', () => {
const testPathPatterns = makeExecutor(['a/b', 'c/d'], config);
expect(testPathPatterns.isMatch('/foo/a/b')).toBe(true);
expect(testPathPatterns.isMatch('/foo/c/d')).toBe(true);
expect(testPathPatterns.isMatch('/foo/a')).toBe(false);
expect(testPathPatterns.isMatch('/foo/b/c')).toBe(false);
});
it('does not normalize Windows paths on POSIX', () => {
forcePosix();
const testPathPatterns = makeExecutor(['a\\z', 'a\\\\z'], config);
expect(testPathPatterns.isMatch('/foo/a/z')).toBe(false);
});
it('normalizes paths for Windows', () => {
forceWindows();
const testPathPatterns = makeExecutor(['a/b'], config);
expect(testPathPatterns.isMatch('C:\\foo\\a\\b')).toBe(true);
});
it('matches absolute path with absPath', () => {
const pattern = '^/home/app/';
const rootDir = '/home/app';
const absolutePath = '/home/app/packages/';
const testPathPatterns = makeExecutor([pattern], {
rootDir,
});
const relativePath = path.relative(rootDir, absolutePath);
expect(testPathPatterns.isMatch(relativePath)).toBe(false);
expect(testPathPatterns.isMatch(absolutePath)).toBe(true);
});
});
});

View File

@@ -0,0 +1,5 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`TestPathPatterns toPretty renders a human-readable string 1`] = `"a/b|c/d"`;
exports[`TestPathPatternsExecutor toPretty renders a human-readable string 1`] = `"a/b|c/d"`;

12
frontend/node_modules/@jest/pattern/src/index.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/**
* 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.
*/
export {
TestPathPatterns,
TestPathPatternsExecutor,
type TestPathPatternsExecutorOptions,
} from './TestPathPatterns';

10
frontend/node_modules/@jest/pattern/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build"
},
"include": ["./src/**/*"],
"exclude": ["./**/__tests__/**/*"],
"references": [{"path": "../jest-regex-util"}]
}

22
frontend/node_modules/@jest/schemas/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
Copyright Contributors to the Jest project.
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
frontend/node_modules/@jest/schemas/README.md generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# `@jest/schemas`
Experimental and currently incomplete module for JSON schemas for [Jest's](https://jestjs.io/) configuration.

202
frontend/node_modules/@jest/schemas/build/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,202 @@
import * as _sinclair_typebox0 from "@sinclair/typebox";
import { Static } from "@sinclair/typebox";
//#region src/index.d.ts
declare const SnapshotFormat: _sinclair_typebox0.TObject<{
callToJSON: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
compareKeys: _sinclair_typebox0.TOptional<_sinclair_typebox0.TNull>;
escapeRegex: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
escapeString: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
highlight: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
indent: _sinclair_typebox0.TOptional<_sinclair_typebox0.TInteger>;
maxDepth: _sinclair_typebox0.TOptional<_sinclair_typebox0.TInteger>;
maxWidth: _sinclair_typebox0.TOptional<_sinclair_typebox0.TInteger>;
min: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
printBasicPrototype: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
printFunctionName: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
theme: _sinclair_typebox0.TOptional<_sinclair_typebox0.TObject<{
comment: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
content: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
prop: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
tag: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
value: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
}>>;
}>;
type SnapshotFormat = Static<typeof SnapshotFormat>;
declare const InitialOptions: _sinclair_typebox0.TObject<{
automock: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
bail: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TBoolean, _sinclair_typebox0.TNumber]>>;
cache: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
cacheDirectory: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
ci: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
clearMocks: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
changedFilesWithAncestor: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
changedSince: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
collectCoverage: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
collectCoverageFrom: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
coverageDirectory: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
coveragePathIgnorePatterns: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
coverageProvider: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TLiteral<"babel">, _sinclair_typebox0.TLiteral<"v8">]>>;
coverageReporters: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TUnion<[_sinclair_typebox0.TLiteral<"clover">, _sinclair_typebox0.TLiteral<"cobertura">, _sinclair_typebox0.TLiteral<"html-spa">, _sinclair_typebox0.TLiteral<"html">, _sinclair_typebox0.TLiteral<"json">, _sinclair_typebox0.TLiteral<"json-summary">, _sinclair_typebox0.TLiteral<"lcov">, _sinclair_typebox0.TLiteral<"lcovonly">, _sinclair_typebox0.TLiteral<"none">, _sinclair_typebox0.TLiteral<"teamcity">, _sinclair_typebox0.TLiteral<"text">, _sinclair_typebox0.TLiteral<"text-lcov">, _sinclair_typebox0.TLiteral<"text-summary">]>, _sinclair_typebox0.TTuple<[_sinclair_typebox0.TUnion<[_sinclair_typebox0.TLiteral<"clover">, _sinclair_typebox0.TLiteral<"cobertura">, _sinclair_typebox0.TLiteral<"html-spa">, _sinclair_typebox0.TLiteral<"html">, _sinclair_typebox0.TLiteral<"json">, _sinclair_typebox0.TLiteral<"json-summary">, _sinclair_typebox0.TLiteral<"lcov">, _sinclair_typebox0.TLiteral<"lcovonly">, _sinclair_typebox0.TLiteral<"none">, _sinclair_typebox0.TLiteral<"teamcity">, _sinclair_typebox0.TLiteral<"text">, _sinclair_typebox0.TLiteral<"text-lcov">, _sinclair_typebox0.TLiteral<"text-summary">]>, _sinclair_typebox0.TRecord<_sinclair_typebox0.TString, _sinclair_typebox0.TUnknown>]>]>>>;
coverageThreshold: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnsafe<{
[path: string]: {
branches?: number | undefined;
functions?: number | undefined;
lines?: number | undefined;
statements?: number | undefined;
};
global: Static<_sinclair_typebox0.TObject<{
branches: _sinclair_typebox0.TOptional<_sinclair_typebox0.TNumber>;
functions: _sinclair_typebox0.TOptional<_sinclair_typebox0.TNumber>;
lines: _sinclair_typebox0.TOptional<_sinclair_typebox0.TNumber>;
statements: _sinclair_typebox0.TOptional<_sinclair_typebox0.TNumber>;
}>>;
}>>;
dependencyExtractor: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
detectLeaks: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
detectOpenHandles: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
displayName: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TObject<{
name: _sinclair_typebox0.TString;
color: _sinclair_typebox0.TUnion<[_sinclair_typebox0.TLiteral<"black">, _sinclair_typebox0.TLiteral<"red">, _sinclair_typebox0.TLiteral<"green">, _sinclair_typebox0.TLiteral<"yellow">, _sinclair_typebox0.TLiteral<"blue">, _sinclair_typebox0.TLiteral<"magenta">, _sinclair_typebox0.TLiteral<"cyan">, _sinclair_typebox0.TLiteral<"white">, _sinclair_typebox0.TLiteral<"gray">, _sinclair_typebox0.TLiteral<"grey">, _sinclair_typebox0.TLiteral<"blackBright">, _sinclair_typebox0.TLiteral<"redBright">, _sinclair_typebox0.TLiteral<"greenBright">, _sinclair_typebox0.TLiteral<"yellowBright">, _sinclair_typebox0.TLiteral<"blueBright">, _sinclair_typebox0.TLiteral<"magentaBright">, _sinclair_typebox0.TLiteral<"cyanBright">, _sinclair_typebox0.TLiteral<"whiteBright">]>;
}>]>>;
expand: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
extensionsToTreatAsEsm: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
fakeTimers: _sinclair_typebox0.TOptional<_sinclair_typebox0.TIntersect<[_sinclair_typebox0.TObject<{
enableGlobally: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
}>, _sinclair_typebox0.TUnion<[_sinclair_typebox0.TObject<{
advanceTimers: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TBoolean, _sinclair_typebox0.TNumber]>>;
doNotFake: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TLiteral<"Date">, _sinclair_typebox0.TLiteral<"hrtime">, _sinclair_typebox0.TLiteral<"nextTick">, _sinclair_typebox0.TLiteral<"performance">, _sinclair_typebox0.TLiteral<"queueMicrotask">, _sinclair_typebox0.TLiteral<"requestAnimationFrame">, _sinclair_typebox0.TLiteral<"cancelAnimationFrame">, _sinclair_typebox0.TLiteral<"requestIdleCallback">, _sinclair_typebox0.TLiteral<"cancelIdleCallback">, _sinclair_typebox0.TLiteral<"setImmediate">, _sinclair_typebox0.TLiteral<"clearImmediate">, _sinclair_typebox0.TLiteral<"setInterval">, _sinclair_typebox0.TLiteral<"clearInterval">, _sinclair_typebox0.TLiteral<"setTimeout">, _sinclair_typebox0.TLiteral<"clearTimeout">]>>>;
now: _sinclair_typebox0.TOptional<_sinclair_typebox0.TInteger>;
timerLimit: _sinclair_typebox0.TOptional<_sinclair_typebox0.TNumber>;
legacyFakeTimers: _sinclair_typebox0.TOptional<_sinclair_typebox0.TLiteral<false>>;
}>, _sinclair_typebox0.TObject<{
legacyFakeTimers: _sinclair_typebox0.TOptional<_sinclair_typebox0.TLiteral<true>>;
}>]>]>>;
filter: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
findRelatedTests: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
forceCoverageMatch: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
forceExit: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
json: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
globals: _sinclair_typebox0.TOptional<_sinclair_typebox0.TRecord<_sinclair_typebox0.TString, _sinclair_typebox0.TUnknown>>;
globalSetup: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TNull]>>;
globalTeardown: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TNull]>>;
haste: _sinclair_typebox0.TOptional<_sinclair_typebox0.TObject<{
computeSha1: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
defaultPlatform: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TNull]>>;
forceNodeFilesystemAPI: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
enableSymlinks: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
hasteImplModulePath: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
platforms: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
throwOnModuleCollision: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
hasteMapModulePath: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
retainAllFiles: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
}>>;
id: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
injectGlobals: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
reporters: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TTuple<[_sinclair_typebox0.TString, _sinclair_typebox0.TRecord<_sinclair_typebox0.TString, _sinclair_typebox0.TUnknown>]>]>>>;
logHeapUsage: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
lastCommit: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
listTests: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
maxConcurrency: _sinclair_typebox0.TOptional<_sinclair_typebox0.TInteger>;
maxWorkers: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TInteger]>>;
moduleDirectories: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
moduleFileExtensions: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
moduleNameMapper: _sinclair_typebox0.TOptional<_sinclair_typebox0.TRecord<_sinclair_typebox0.TString, _sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TArray<_sinclair_typebox0.TString>]>>>;
modulePathIgnorePatterns: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
modulePaths: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
noStackTrace: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
notify: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
notifyMode: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
onlyChanged: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
onlyFailures: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
openHandlesTimeout: _sinclair_typebox0.TOptional<_sinclair_typebox0.TNumber>;
outputFile: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
passWithNoTests: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
preset: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TNull]>>;
prettierPath: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TNull]>>;
projects: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TRecord<_sinclair_typebox0.TString, _sinclair_typebox0.TUnknown>]>>>;
randomize: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
replname: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TNull]>>;
resetMocks: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
resetModules: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
resolver: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TNull]>>;
restoreMocks: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
rootDir: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
roots: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
runner: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
runTestsByPath: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
runtime: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
sandboxInjectedGlobals: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
setupFiles: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
setupFilesAfterEnv: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
showSeed: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
silent: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
skipFilter: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
skipNodeResolution: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
slowTestThreshold: _sinclair_typebox0.TOptional<_sinclair_typebox0.TNumber>;
snapshotResolver: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
snapshotSerializers: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
snapshotFormat: _sinclair_typebox0.TOptional<_sinclair_typebox0.TObject<{
callToJSON: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
compareKeys: _sinclair_typebox0.TOptional<_sinclair_typebox0.TNull>;
escapeRegex: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
escapeString: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
highlight: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
indent: _sinclair_typebox0.TOptional<_sinclair_typebox0.TInteger>;
maxDepth: _sinclair_typebox0.TOptional<_sinclair_typebox0.TInteger>;
maxWidth: _sinclair_typebox0.TOptional<_sinclair_typebox0.TInteger>;
min: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
printBasicPrototype: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
printFunctionName: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
theme: _sinclair_typebox0.TOptional<_sinclair_typebox0.TObject<{
comment: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
content: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
prop: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
tag: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
value: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
}>>;
}>>;
errorOnDeprecated: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
testEnvironment: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
testEnvironmentOptions: _sinclair_typebox0.TOptional<_sinclair_typebox0.TRecord<_sinclair_typebox0.TString, _sinclair_typebox0.TUnknown>>;
testFailureExitCode: _sinclair_typebox0.TOptional<_sinclair_typebox0.TInteger>;
testLocationInResults: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
testMatch: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
testNamePattern: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
testPathIgnorePatterns: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
testRegex: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TArray<_sinclair_typebox0.TString>]>>;
testResultsProcessor: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
testRunner: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
testSequencer: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
testTimeout: _sinclair_typebox0.TOptional<_sinclair_typebox0.TNumber>;
transform: _sinclair_typebox0.TOptional<_sinclair_typebox0.TRecord<_sinclair_typebox0.TString, _sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TTuple<[_sinclair_typebox0.TString, _sinclair_typebox0.TUnknown]>]>>>;
transformIgnorePatterns: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
watchPathIgnorePatterns: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
unmockedModulePathPatterns: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
updateSnapshot: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
useStderr: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
verbose: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
waitForUnhandledRejections: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
watch: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
watchAll: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
watchman: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
watchPlugins: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TTuple<[_sinclair_typebox0.TString, _sinclair_typebox0.TUnknown]>]>>>;
workerIdleMemoryLimit: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TNumber, _sinclair_typebox0.TString]>>;
workerThreads: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
}>;
type InitialOptions = Static<typeof InitialOptions>;
declare const FakeTimers: _sinclair_typebox0.TIntersect<[_sinclair_typebox0.TObject<{
enableGlobally: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
}>, _sinclair_typebox0.TUnion<[_sinclair_typebox0.TObject<{
advanceTimers: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TBoolean, _sinclair_typebox0.TNumber]>>;
doNotFake: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TLiteral<"Date">, _sinclair_typebox0.TLiteral<"hrtime">, _sinclair_typebox0.TLiteral<"nextTick">, _sinclair_typebox0.TLiteral<"performance">, _sinclair_typebox0.TLiteral<"queueMicrotask">, _sinclair_typebox0.TLiteral<"requestAnimationFrame">, _sinclair_typebox0.TLiteral<"cancelAnimationFrame">, _sinclair_typebox0.TLiteral<"requestIdleCallback">, _sinclair_typebox0.TLiteral<"cancelIdleCallback">, _sinclair_typebox0.TLiteral<"setImmediate">, _sinclair_typebox0.TLiteral<"clearImmediate">, _sinclair_typebox0.TLiteral<"setInterval">, _sinclair_typebox0.TLiteral<"clearInterval">, _sinclair_typebox0.TLiteral<"setTimeout">, _sinclair_typebox0.TLiteral<"clearTimeout">]>>>;
now: _sinclair_typebox0.TOptional<_sinclair_typebox0.TInteger>;
timerLimit: _sinclair_typebox0.TOptional<_sinclair_typebox0.TNumber>;
legacyFakeTimers: _sinclair_typebox0.TOptional<_sinclair_typebox0.TLiteral<false>>;
}>, _sinclair_typebox0.TObject<{
legacyFakeTimers: _sinclair_typebox0.TOptional<_sinclair_typebox0.TLiteral<true>>;
}>]>]>;
type FakeTimers = Static<typeof FakeTimers>;
//#endregion
export { FakeTimers, InitialOptions, SnapshotFormat };

388
frontend/node_modules/@jest/schemas/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,388 @@
/**
* 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 {
Static,
TArray,
TBoolean,
TInteger,
TIntersect,
TLiteral,
TNull,
TNumber,
TObject,
TOptional,
TRecord,
TString,
TTuple,
TUnion,
TUnknown,
TUnsafe,
} from '@sinclair/typebox';
export declare const FakeTimers: TIntersect<
[
TObject<{
enableGlobally: TOptional<TBoolean>;
}>,
TUnion<
[
TObject<{
advanceTimers: TOptional<TUnion<[TBoolean, TNumber]>>;
doNotFake: TOptional<
TArray<
TUnion<
[
TLiteral<'Date'>,
TLiteral<'hrtime'>,
TLiteral<'nextTick'>,
TLiteral<'performance'>,
TLiteral<'queueMicrotask'>,
TLiteral<'requestAnimationFrame'>,
TLiteral<'cancelAnimationFrame'>,
TLiteral<'requestIdleCallback'>,
TLiteral<'cancelIdleCallback'>,
TLiteral<'setImmediate'>,
TLiteral<'clearImmediate'>,
TLiteral<'setInterval'>,
TLiteral<'clearInterval'>,
TLiteral<'setTimeout'>,
TLiteral<'clearTimeout'>,
]
>
>
>;
now: TOptional<TInteger>;
timerLimit: TOptional<TNumber>;
legacyFakeTimers: TOptional<TLiteral<false>>;
}>,
TObject<{
legacyFakeTimers: TOptional<TLiteral<true>>;
}>,
]
>,
]
>;
export declare type FakeTimers = Static<typeof FakeTimers>;
export declare const InitialOptions: TObject<{
automock: TOptional<TBoolean>;
bail: TOptional<TUnion<[TBoolean, TNumber]>>;
cache: TOptional<TBoolean>;
cacheDirectory: TOptional<TString>;
ci: TOptional<TBoolean>;
clearMocks: TOptional<TBoolean>;
changedFilesWithAncestor: TOptional<TBoolean>;
changedSince: TOptional<TString>;
collectCoverage: TOptional<TBoolean>;
collectCoverageFrom: TOptional<TArray<TString>>;
coverageDirectory: TOptional<TString>;
coveragePathIgnorePatterns: TOptional<TArray<TString>>;
coverageProvider: TOptional<TUnion<[TLiteral<'babel'>, TLiteral<'v8'>]>>;
coverageReporters: TOptional<
TArray<
TUnion<
[
TUnion<
[
TLiteral<'clover'>,
TLiteral<'cobertura'>,
TLiteral<'html-spa'>,
TLiteral<'html'>,
TLiteral<'json'>,
TLiteral<'json-summary'>,
TLiteral<'lcov'>,
TLiteral<'lcovonly'>,
TLiteral<'none'>,
TLiteral<'teamcity'>,
TLiteral<'text'>,
TLiteral<'text-lcov'>,
TLiteral<'text-summary'>,
]
>,
TTuple<
[
TUnion<
[
TLiteral<'clover'>,
TLiteral<'cobertura'>,
TLiteral<'html-spa'>,
TLiteral<'html'>,
TLiteral<'json'>,
TLiteral<'json-summary'>,
TLiteral<'lcov'>,
TLiteral<'lcovonly'>,
TLiteral<'none'>,
TLiteral<'teamcity'>,
TLiteral<'text'>,
TLiteral<'text-lcov'>,
TLiteral<'text-summary'>,
]
>,
TRecord<TString, TUnknown>,
]
>,
]
>
>
>;
coverageThreshold: TOptional<
TUnsafe<{
[path: string]: {
branches?: number | undefined;
functions?: number | undefined;
lines?: number | undefined;
statements?: number | undefined;
};
global: Static<
TObject<{
branches: TOptional<TNumber>;
functions: TOptional<TNumber>;
lines: TOptional<TNumber>;
statements: TOptional<TNumber>;
}>
>;
}>
>;
dependencyExtractor: TOptional<TString>;
detectLeaks: TOptional<TBoolean>;
detectOpenHandles: TOptional<TBoolean>;
displayName: TOptional<
TUnion<
[
TString,
TObject<{
name: TString;
color: TUnion<
[
TLiteral<'black'>,
TLiteral<'red'>,
TLiteral<'green'>,
TLiteral<'yellow'>,
TLiteral<'blue'>,
TLiteral<'magenta'>,
TLiteral<'cyan'>,
TLiteral<'white'>,
TLiteral<'gray'>,
TLiteral<'grey'>,
TLiteral<'blackBright'>,
TLiteral<'redBright'>,
TLiteral<'greenBright'>,
TLiteral<'yellowBright'>,
TLiteral<'blueBright'>,
TLiteral<'magentaBright'>,
TLiteral<'cyanBright'>,
TLiteral<'whiteBright'>,
]
>;
}>,
]
>
>;
expand: TOptional<TBoolean>;
extensionsToTreatAsEsm: TOptional<TArray<TString>>;
fakeTimers: TOptional<
TIntersect<
[
TObject<{
enableGlobally: TOptional<TBoolean>;
}>,
TUnion<
[
TObject<{
advanceTimers: TOptional<TUnion<[TBoolean, TNumber]>>;
doNotFake: TOptional<
TArray<
TUnion<
[
TLiteral<'Date'>,
TLiteral<'hrtime'>,
TLiteral<'nextTick'>,
TLiteral<'performance'>,
TLiteral<'queueMicrotask'>,
TLiteral<'requestAnimationFrame'>,
TLiteral<'cancelAnimationFrame'>,
TLiteral<'requestIdleCallback'>,
TLiteral<'cancelIdleCallback'>,
TLiteral<'setImmediate'>,
TLiteral<'clearImmediate'>,
TLiteral<'setInterval'>,
TLiteral<'clearInterval'>,
TLiteral<'setTimeout'>,
TLiteral<'clearTimeout'>,
]
>
>
>;
now: TOptional<TInteger>;
timerLimit: TOptional<TNumber>;
legacyFakeTimers: TOptional<TLiteral<false>>;
}>,
TObject<{
legacyFakeTimers: TOptional<TLiteral<true>>;
}>,
]
>,
]
>
>;
filter: TOptional<TString>;
findRelatedTests: TOptional<TBoolean>;
forceCoverageMatch: TOptional<TArray<TString>>;
forceExit: TOptional<TBoolean>;
json: TOptional<TBoolean>;
globals: TOptional<TRecord<TString, TUnknown>>;
globalSetup: TOptional<TUnion<[TString, TNull]>>;
globalTeardown: TOptional<TUnion<[TString, TNull]>>;
haste: TOptional<
TObject<{
computeSha1: TOptional<TBoolean>;
defaultPlatform: TOptional<TUnion<[TString, TNull]>>;
forceNodeFilesystemAPI: TOptional<TBoolean>;
enableSymlinks: TOptional<TBoolean>;
hasteImplModulePath: TOptional<TString>;
platforms: TOptional<TArray<TString>>;
throwOnModuleCollision: TOptional<TBoolean>;
hasteMapModulePath: TOptional<TString>;
retainAllFiles: TOptional<TBoolean>;
}>
>;
id: TOptional<TString>;
injectGlobals: TOptional<TBoolean>;
reporters: TOptional<
TArray<TUnion<[TString, TTuple<[TString, TRecord<TString, TUnknown>]>]>>
>;
logHeapUsage: TOptional<TBoolean>;
lastCommit: TOptional<TBoolean>;
listTests: TOptional<TBoolean>;
maxConcurrency: TOptional<TInteger>;
maxWorkers: TOptional<TUnion<[TString, TInteger]>>;
moduleDirectories: TOptional<TArray<TString>>;
moduleFileExtensions: TOptional<TArray<TString>>;
moduleNameMapper: TOptional<
TRecord<TString, TUnion<[TString, TArray<TString>]>>
>;
modulePathIgnorePatterns: TOptional<TArray<TString>>;
modulePaths: TOptional<TArray<TString>>;
noStackTrace: TOptional<TBoolean>;
notify: TOptional<TBoolean>;
notifyMode: TOptional<TString>;
onlyChanged: TOptional<TBoolean>;
onlyFailures: TOptional<TBoolean>;
openHandlesTimeout: TOptional<TNumber>;
outputFile: TOptional<TString>;
passWithNoTests: TOptional<TBoolean>;
preset: TOptional<TUnion<[TString, TNull]>>;
prettierPath: TOptional<TUnion<[TString, TNull]>>;
projects: TOptional<TArray<TUnion<[TString, TRecord<TString, TUnknown>]>>>;
randomize: TOptional<TBoolean>;
replname: TOptional<TUnion<[TString, TNull]>>;
resetMocks: TOptional<TBoolean>;
resetModules: TOptional<TBoolean>;
resolver: TOptional<TUnion<[TString, TNull]>>;
restoreMocks: TOptional<TBoolean>;
rootDir: TOptional<TString>;
roots: TOptional<TArray<TString>>;
runner: TOptional<TString>;
runTestsByPath: TOptional<TBoolean>;
runtime: TOptional<TString>;
sandboxInjectedGlobals: TOptional<TArray<TString>>;
setupFiles: TOptional<TArray<TString>>;
setupFilesAfterEnv: TOptional<TArray<TString>>;
showSeed: TOptional<TBoolean>;
silent: TOptional<TBoolean>;
skipFilter: TOptional<TBoolean>;
skipNodeResolution: TOptional<TBoolean>;
slowTestThreshold: TOptional<TNumber>;
snapshotResolver: TOptional<TString>;
snapshotSerializers: TOptional<TArray<TString>>;
snapshotFormat: TOptional<
TObject<{
callToJSON: TOptional<TBoolean>;
compareKeys: TOptional<TNull>;
escapeRegex: TOptional<TBoolean>;
escapeString: TOptional<TBoolean>;
highlight: TOptional<TBoolean>;
indent: TOptional<TInteger>;
maxDepth: TOptional<TInteger>;
maxWidth: TOptional<TInteger>;
min: TOptional<TBoolean>;
printBasicPrototype: TOptional<TBoolean>;
printFunctionName: TOptional<TBoolean>;
theme: TOptional<
TObject<{
comment: TOptional<TString>;
content: TOptional<TString>;
prop: TOptional<TString>;
tag: TOptional<TString>;
value: TOptional<TString>;
}>
>;
}>
>;
errorOnDeprecated: TOptional<TBoolean>;
testEnvironment: TOptional<TString>;
testEnvironmentOptions: TOptional<TRecord<TString, TUnknown>>;
testFailureExitCode: TOptional<TInteger>;
testLocationInResults: TOptional<TBoolean>;
testMatch: TOptional<TUnion<[TString, TArray<TString>]>>;
testNamePattern: TOptional<TString>;
testPathIgnorePatterns: TOptional<TArray<TString>>;
testRegex: TOptional<TUnion<[TString, TArray<TString>]>>;
testResultsProcessor: TOptional<TString>;
testRunner: TOptional<TString>;
testSequencer: TOptional<TString>;
testTimeout: TOptional<TNumber>;
transform: TOptional<
TRecord<TString, TUnion<[TString, TTuple<[TString, TUnknown]>]>>
>;
transformIgnorePatterns: TOptional<TArray<TString>>;
watchPathIgnorePatterns: TOptional<TArray<TString>>;
unmockedModulePathPatterns: TOptional<TArray<TString>>;
updateSnapshot: TOptional<TBoolean>;
useStderr: TOptional<TBoolean>;
verbose: TOptional<TBoolean>;
waitForUnhandledRejections: TOptional<TBoolean>;
watch: TOptional<TBoolean>;
watchAll: TOptional<TBoolean>;
watchman: TOptional<TBoolean>;
watchPlugins: TOptional<
TArray<TUnion<[TString, TTuple<[TString, TUnknown]>]>>
>;
workerIdleMemoryLimit: TOptional<TUnion<[TNumber, TString]>>;
workerThreads: TOptional<TBoolean>;
}>;
export declare type InitialOptions = Static<typeof InitialOptions>;
export declare const SnapshotFormat: TObject<{
callToJSON: TOptional<TBoolean>;
compareKeys: TOptional<TNull>;
escapeRegex: TOptional<TBoolean>;
escapeString: TOptional<TBoolean>;
highlight: TOptional<TBoolean>;
indent: TOptional<TInteger>;
maxDepth: TOptional<TInteger>;
maxWidth: TOptional<TInteger>;
min: TOptional<TBoolean>;
printBasicPrototype: TOptional<TBoolean>;
printFunctionName: TOptional<TBoolean>;
theme: TOptional<
TObject<{
comment: TOptional<TString>;
content: TOptional<TString>;
prop: TOptional<TString>;
tag: TOptional<TString>;
value: TOptional<TString>;
}>
>;
}>;
export declare type SnapshotFormat = Static<typeof SnapshotFormat>;
export {};

332
frontend/node_modules/@jest/schemas/build/index.js generated vendored Normal file
View 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.
* * /
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/raw-types.ts":
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.SnapshotFormat = exports.InitialOptions = exports.FakeTimers = exports.CoverageReporterNames = exports.ChalkForegroundColors = 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.
*/
/* eslint-disable sort-keys */
const SnapshotFormat = exports.SnapshotFormat = _typebox().Type.Partial(_typebox().Type.Object({
callToJSON: _typebox().Type.Boolean(),
compareKeys: _typebox().Type.Null(),
escapeRegex: _typebox().Type.Boolean(),
escapeString: _typebox().Type.Boolean(),
highlight: _typebox().Type.Boolean(),
indent: _typebox().Type.Integer({
minimum: 0
}),
maxDepth: _typebox().Type.Integer({
minimum: 0
}),
maxWidth: _typebox().Type.Integer({
minimum: 0
}),
min: _typebox().Type.Boolean(),
printBasicPrototype: _typebox().Type.Boolean(),
printFunctionName: _typebox().Type.Boolean(),
theme: _typebox().Type.Partial(_typebox().Type.Object({
comment: _typebox().Type.String(),
content: _typebox().Type.String(),
prop: _typebox().Type.String(),
tag: _typebox().Type.String(),
value: _typebox().Type.String()
}))
}));
const CoverageProvider = _typebox().Type.Union([_typebox().Type.Literal('babel'), _typebox().Type.Literal('v8')]);
const CoverageThresholdValue = _typebox().Type.Partial(_typebox().Type.Object({
branches: _typebox().Type.Number({
minimum: 0,
maximum: 100
}),
functions: _typebox().Type.Number({
minimum: 0,
maximum: 100
}),
lines: _typebox().Type.Number({
minimum: 0,
maximum: 100
}),
statements: _typebox().Type.Number({
minimum: 0,
maximum: 100
})
}));
const CoverageThresholdBase = _typebox().Type.Object({
global: CoverageThresholdValue
}, {
additionalProperties: CoverageThresholdValue
});
const CoverageThreshold = _typebox().Type.Unsafe(CoverageThresholdBase);
// TODO: add type test that these are all the colors available in chalk.ForegroundColor
const ChalkForegroundColors = exports.ChalkForegroundColors = _typebox().Type.Union([_typebox().Type.Literal('black'), _typebox().Type.Literal('red'), _typebox().Type.Literal('green'), _typebox().Type.Literal('yellow'), _typebox().Type.Literal('blue'), _typebox().Type.Literal('magenta'), _typebox().Type.Literal('cyan'), _typebox().Type.Literal('white'), _typebox().Type.Literal('gray'), _typebox().Type.Literal('grey'), _typebox().Type.Literal('blackBright'), _typebox().Type.Literal('redBright'), _typebox().Type.Literal('greenBright'), _typebox().Type.Literal('yellowBright'), _typebox().Type.Literal('blueBright'), _typebox().Type.Literal('magentaBright'), _typebox().Type.Literal('cyanBright'), _typebox().Type.Literal('whiteBright')]);
const DisplayName = _typebox().Type.Object({
name: _typebox().Type.String(),
color: ChalkForegroundColors
});
// TODO: verify these are the names of istanbulReport.ReportOptions
const CoverageReporterNames = exports.CoverageReporterNames = _typebox().Type.Union([_typebox().Type.Literal('clover'), _typebox().Type.Literal('cobertura'), _typebox().Type.Literal('html-spa'), _typebox().Type.Literal('html'), _typebox().Type.Literal('json'), _typebox().Type.Literal('json-summary'), _typebox().Type.Literal('lcov'), _typebox().Type.Literal('lcovonly'), _typebox().Type.Literal('none'), _typebox().Type.Literal('teamcity'), _typebox().Type.Literal('text'), _typebox().Type.Literal('text-lcov'), _typebox().Type.Literal('text-summary')]);
const CoverageReporters = _typebox().Type.Array(_typebox().Type.Union([CoverageReporterNames, _typebox().Type.Tuple([CoverageReporterNames, _typebox().Type.Record(_typebox().Type.String(), _typebox().Type.Unknown())])]));
const GlobalFakeTimersConfig = _typebox().Type.Partial(_typebox().Type.Object({
enableGlobally: _typebox().Type.Boolean({
description: 'Whether fake timers should be enabled globally for all test files.',
default: false
})
}));
const FakeableAPI = _typebox().Type.Union([_typebox().Type.Literal('Date'), _typebox().Type.Literal('hrtime'), _typebox().Type.Literal('nextTick'), _typebox().Type.Literal('performance'), _typebox().Type.Literal('queueMicrotask'), _typebox().Type.Literal('requestAnimationFrame'), _typebox().Type.Literal('cancelAnimationFrame'), _typebox().Type.Literal('requestIdleCallback'), _typebox().Type.Literal('cancelIdleCallback'), _typebox().Type.Literal('setImmediate'), _typebox().Type.Literal('clearImmediate'), _typebox().Type.Literal('setInterval'), _typebox().Type.Literal('clearInterval'), _typebox().Type.Literal('setTimeout'), _typebox().Type.Literal('clearTimeout')]);
const FakeTimersConfig = _typebox().Type.Partial(_typebox().Type.Object({
advanceTimers: _typebox().Type.Union([_typebox().Type.Boolean(), _typebox().Type.Number({
minimum: 0
})], {
description: 'If set to `true` all timers will be advanced automatically by 20 milliseconds every 20 milliseconds. A custom ' + 'time delta may be provided by passing a number.',
default: false
}),
doNotFake: _typebox().Type.Array(FakeableAPI, {
description: 'List of names of APIs (e.g. `Date`, `nextTick()`, `setImmediate()`, `setTimeout()`) that should not be faked.' + '\n\nThe default is `[]`, meaning all APIs are faked.',
default: []
}),
now: _typebox().Type.Integer({
minimum: 0,
description: 'Sets current system time to be used by fake timers.\n\nThe default is `Date.now()`.'
}),
timerLimit: _typebox().Type.Number({
description: 'The maximum number of recursive timers that will be run when calling `jest.runAllTimers()`.',
default: 100_000,
minimum: 0
}),
legacyFakeTimers: _typebox().Type.Literal(false, {
description: 'Use the old fake timers implementation instead of one backed by `@sinonjs/fake-timers`.',
default: false
})
}));
const LegacyFakeTimersConfig = _typebox().Type.Partial(_typebox().Type.Object({
legacyFakeTimers: _typebox().Type.Literal(true, {
description: 'Use the old fake timers implementation instead of one backed by `@sinonjs/fake-timers`.',
default: true
})
}));
const FakeTimers = exports.FakeTimers = _typebox().Type.Intersect([GlobalFakeTimersConfig, _typebox().Type.Union([FakeTimersConfig, LegacyFakeTimersConfig])]);
const HasteConfig = _typebox().Type.Partial(_typebox().Type.Object({
computeSha1: _typebox().Type.Boolean({
description: 'Whether to hash files using SHA-1.'
}),
defaultPlatform: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Null()], {
description: 'The platform to use as the default, e.g. `ios`.'
}),
forceNodeFilesystemAPI: _typebox().Type.Boolean({
description: "Whether to force the use of Node's `fs` API when reading files rather than shelling out to `find`."
}),
enableSymlinks: _typebox().Type.Boolean({
description: 'Whether to follow symlinks when crawling for files.' + '\n\tThis options cannot be used in projects which use watchman.' + '\n\tProjects with `watchman` set to true will error if this option is set to true.'
}),
hasteImplModulePath: _typebox().Type.String({
description: 'Path to a custom implementation of Haste.'
}),
platforms: _typebox().Type.Array(_typebox().Type.String(), {
description: "All platforms to target, e.g ['ios', 'android']."
}),
throwOnModuleCollision: _typebox().Type.Boolean({
description: 'Whether to throw an error on module collision.'
}),
hasteMapModulePath: _typebox().Type.String({
description: 'Custom HasteMap module'
}),
retainAllFiles: _typebox().Type.Boolean({
description: 'Whether to retain all files, allowing e.g. search for tests in `node_modules`.'
})
}));
const InitialOptions = exports.InitialOptions = _typebox().Type.Partial(_typebox().Type.Object({
automock: _typebox().Type.Boolean(),
bail: _typebox().Type.Union([_typebox().Type.Boolean(), _typebox().Type.Number()]),
cache: _typebox().Type.Boolean(),
cacheDirectory: _typebox().Type.String(),
ci: _typebox().Type.Boolean(),
clearMocks: _typebox().Type.Boolean(),
changedFilesWithAncestor: _typebox().Type.Boolean(),
changedSince: _typebox().Type.String(),
collectCoverage: _typebox().Type.Boolean(),
collectCoverageFrom: _typebox().Type.Array(_typebox().Type.String()),
coverageDirectory: _typebox().Type.String(),
coveragePathIgnorePatterns: _typebox().Type.Array(_typebox().Type.String()),
coverageProvider: CoverageProvider,
coverageReporters: CoverageReporters,
coverageThreshold: CoverageThreshold,
dependencyExtractor: _typebox().Type.String(),
detectLeaks: _typebox().Type.Boolean(),
detectOpenHandles: _typebox().Type.Boolean(),
displayName: _typebox().Type.Union([_typebox().Type.String(), DisplayName]),
expand: _typebox().Type.Boolean(),
extensionsToTreatAsEsm: _typebox().Type.Array(_typebox().Type.String()),
fakeTimers: FakeTimers,
filter: _typebox().Type.String(),
findRelatedTests: _typebox().Type.Boolean(),
forceCoverageMatch: _typebox().Type.Array(_typebox().Type.String()),
forceExit: _typebox().Type.Boolean(),
json: _typebox().Type.Boolean(),
globals: _typebox().Type.Record(_typebox().Type.String(), _typebox().Type.Unknown()),
globalSetup: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Null()]),
globalTeardown: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Null()]),
haste: HasteConfig,
id: _typebox().Type.String(),
injectGlobals: _typebox().Type.Boolean(),
reporters: _typebox().Type.Array(_typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Tuple([_typebox().Type.String(), _typebox().Type.Record(_typebox().Type.String(), _typebox().Type.Unknown())])])),
logHeapUsage: _typebox().Type.Boolean(),
lastCommit: _typebox().Type.Boolean(),
listTests: _typebox().Type.Boolean(),
maxConcurrency: _typebox().Type.Integer(),
maxWorkers: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Integer()]),
moduleDirectories: _typebox().Type.Array(_typebox().Type.String()),
moduleFileExtensions: _typebox().Type.Array(_typebox().Type.String()),
moduleNameMapper: _typebox().Type.Record(_typebox().Type.String(), _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Array(_typebox().Type.String())])),
modulePathIgnorePatterns: _typebox().Type.Array(_typebox().Type.String()),
modulePaths: _typebox().Type.Array(_typebox().Type.String()),
noStackTrace: _typebox().Type.Boolean(),
notify: _typebox().Type.Boolean(),
notifyMode: _typebox().Type.String(),
onlyChanged: _typebox().Type.Boolean(),
onlyFailures: _typebox().Type.Boolean(),
openHandlesTimeout: _typebox().Type.Number(),
outputFile: _typebox().Type.String(),
passWithNoTests: _typebox().Type.Boolean(),
preset: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Null()]),
prettierPath: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Null()]),
projects: _typebox().Type.Array(_typebox().Type.Union([_typebox().Type.String(),
// TODO: Make sure to type these correctly
_typebox().Type.Record(_typebox().Type.String(), _typebox().Type.Unknown())])),
randomize: _typebox().Type.Boolean(),
replname: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Null()]),
resetMocks: _typebox().Type.Boolean(),
resetModules: _typebox().Type.Boolean(),
resolver: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Null()]),
restoreMocks: _typebox().Type.Boolean(),
rootDir: _typebox().Type.String(),
roots: _typebox().Type.Array(_typebox().Type.String()),
runner: _typebox().Type.String(),
runTestsByPath: _typebox().Type.Boolean(),
runtime: _typebox().Type.String(),
sandboxInjectedGlobals: _typebox().Type.Array(_typebox().Type.String()),
setupFiles: _typebox().Type.Array(_typebox().Type.String()),
setupFilesAfterEnv: _typebox().Type.Array(_typebox().Type.String()),
showSeed: _typebox().Type.Boolean(),
silent: _typebox().Type.Boolean(),
skipFilter: _typebox().Type.Boolean(),
skipNodeResolution: _typebox().Type.Boolean(),
slowTestThreshold: _typebox().Type.Number(),
snapshotResolver: _typebox().Type.String(),
snapshotSerializers: _typebox().Type.Array(_typebox().Type.String()),
snapshotFormat: SnapshotFormat,
errorOnDeprecated: _typebox().Type.Boolean(),
testEnvironment: _typebox().Type.String(),
testEnvironmentOptions: _typebox().Type.Record(_typebox().Type.String(), _typebox().Type.Unknown()),
testFailureExitCode: _typebox().Type.Integer(),
testLocationInResults: _typebox().Type.Boolean(),
testMatch: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Array(_typebox().Type.String())]),
testNamePattern: _typebox().Type.String(),
testPathIgnorePatterns: _typebox().Type.Array(_typebox().Type.String()),
testRegex: _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Array(_typebox().Type.String())]),
testResultsProcessor: _typebox().Type.String(),
testRunner: _typebox().Type.String(),
testSequencer: _typebox().Type.String(),
testTimeout: _typebox().Type.Number(),
transform: _typebox().Type.Record(_typebox().Type.String(), _typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Tuple([_typebox().Type.String(), _typebox().Type.Unknown()])])),
transformIgnorePatterns: _typebox().Type.Array(_typebox().Type.String()),
watchPathIgnorePatterns: _typebox().Type.Array(_typebox().Type.String()),
unmockedModulePathPatterns: _typebox().Type.Array(_typebox().Type.String()),
updateSnapshot: _typebox().Type.Boolean(),
useStderr: _typebox().Type.Boolean(),
verbose: _typebox().Type.Boolean(),
waitForUnhandledRejections: _typebox().Type.Boolean(),
watch: _typebox().Type.Boolean(),
watchAll: _typebox().Type.Boolean(),
watchman: _typebox().Type.Boolean(),
watchPlugins: _typebox().Type.Array(_typebox().Type.Union([_typebox().Type.String(), _typebox().Type.Tuple([_typebox().Type.String(), _typebox().Type.Unknown()])])),
workerIdleMemoryLimit: _typebox().Type.Union([_typebox().Type.Number(), _typebox().Type.String()]),
workerThreads: _typebox().Type.Boolean()
}));
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
(() => {
var exports = __webpack_exports__;
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.SnapshotFormat = exports.InitialOptions = exports.FakeTimers = void 0;
var types = _interopRequireWildcard(__webpack_require__("./src/raw-types.ts"));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
/**
* 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 SnapshotFormat = exports.SnapshotFormat = types.SnapshotFormat;
const InitialOptions = exports.InitialOptions = types.InitialOptions;
const FakeTimers = exports.FakeTimers = types.FakeTimers;
})();
module.exports = __webpack_exports__;
/******/ })()
;

5
frontend/node_modules/@jest/schemas/build/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import cjsModule from './index.js';
export const FakeTimers = cjsModule.FakeTimers;
export const InitialOptions = cjsModule.InitialOptions;
export const SnapshotFormat = cjsModule.SnapshotFormat;

31
frontend/node_modules/@jest/schemas/package.json generated vendored Normal file
View File

@@ -0,0 +1,31 @@
{
"name": "@jest/schemas",
"version": "30.0.5",
"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",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
},
"dependencies": {
"@sinclair/typebox": "^0.34.0"
},
"engines": {
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "22236cf58b66039f81893537c90dee290bab427f"
}

22
frontend/node_modules/@jest/types/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
Copyright Contributors to the Jest project.
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.

30
frontend/node_modules/@jest/types/README.md generated vendored Normal file
View File

@@ -0,0 +1,30 @@
# @jest/types
This package contains shared types of Jest's packages.
If you are looking for types of [Jest globals](https://jestjs.io/docs/api), you can import them from `@jest/globals` package:
```ts
import {describe, expect, it} from '@jest/globals';
describe('my tests', () => {
it('works', () => {
expect(1).toBe(1);
});
});
```
If you prefer to omit imports, a similar result can be achieved installing the [@types/jest](https://npmjs.com/package/@types/jest) package. Note that this is a third party library maintained at [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest) and may not cover the latest Jest features.
Another use-case for `@types/jest` is a typed Jest config as those types are not provided by Jest out of the box:
```ts
// jest.config.ts
import type {Config} from '@jest/types';
const config: Config.InitialOptions = {
// some typed config
};
export default config;
```

1147
frontend/node_modules/@jest/types/build/index.d.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

15
frontend/node_modules/@jest/types/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
/*!
* /**
* * 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.
* * /
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
var __webpack_exports__ = {};
module.exports = __webpack_exports__;
/******/ })()
;

View File

@@ -0,0 +1,415 @@
/**
Basic foreground colors.
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
*/
declare type ForegroundColor =
| 'black'
| 'red'
| 'green'
| 'yellow'
| 'blue'
| 'magenta'
| 'cyan'
| 'white'
| 'gray'
| 'grey'
| 'blackBright'
| 'redBright'
| 'greenBright'
| 'yellowBright'
| 'blueBright'
| 'magentaBright'
| 'cyanBright'
| 'whiteBright';
/**
Basic background colors.
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
*/
declare type BackgroundColor =
| 'bgBlack'
| 'bgRed'
| 'bgGreen'
| 'bgYellow'
| 'bgBlue'
| 'bgMagenta'
| 'bgCyan'
| 'bgWhite'
| 'bgGray'
| 'bgGrey'
| 'bgBlackBright'
| 'bgRedBright'
| 'bgGreenBright'
| 'bgYellowBright'
| 'bgBlueBright'
| 'bgMagentaBright'
| 'bgCyanBright'
| 'bgWhiteBright';
/**
Basic colors.
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
*/
declare type Color = ForegroundColor | BackgroundColor;
declare type Modifiers =
| 'reset'
| 'bold'
| 'dim'
| 'italic'
| 'underline'
| 'inverse'
| 'hidden'
| 'strikethrough'
| 'visible';
declare namespace chalk {
/**
Levels:
- `0` - All colors disabled.
- `1` - Basic 16 colors support.
- `2` - ANSI 256 colors support.
- `3` - Truecolor 16 million colors support.
*/
type Level = 0 | 1 | 2 | 3;
interface Options {
/**
Specify the color support for Chalk.
By default, color support is automatically detected based on the environment.
Levels:
- `0` - All colors disabled.
- `1` - Basic 16 colors support.
- `2` - ANSI 256 colors support.
- `3` - Truecolor 16 million colors support.
*/
level?: Level;
}
/**
Return a new Chalk instance.
*/
type Instance = new (options?: Options) => Chalk;
/**
Detect whether the terminal supports color.
*/
interface ColorSupport {
/**
The color level used by Chalk.
*/
level: Level;
/**
Return whether Chalk supports basic 16 colors.
*/
hasBasic: boolean;
/**
Return whether Chalk supports ANSI 256 colors.
*/
has256: boolean;
/**
Return whether Chalk supports Truecolor 16 million colors.
*/
has16m: boolean;
}
interface ChalkFunction {
/**
Use a template string.
@remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341))
@example
```
import chalk = require('chalk');
log(chalk`
CPU: {red ${cpu.totalPercent}%}
RAM: {green ${ram.used / ram.total * 100}%}
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
`);
```
@example
```
import chalk = require('chalk');
log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`)
```
*/
(text: TemplateStringsArray, ...placeholders: unknown[]): string;
(...text: unknown[]): string;
}
interface Chalk extends ChalkFunction {
/**
Return a new Chalk instance.
*/
Instance: Instance;
/**
The color support for Chalk.
By default, color support is automatically detected based on the environment.
Levels:
- `0` - All colors disabled.
- `1` - Basic 16 colors support.
- `2` - ANSI 256 colors support.
- `3` - Truecolor 16 million colors support.
*/
level: Level;
/**
Use HEX value to set text color.
@param color - Hexadecimal value representing the desired color.
@example
```
import chalk = require('chalk');
chalk.hex('#DEADED');
```
*/
hex(color: string): Chalk;
/**
Use keyword color value to set text color.
@param color - Keyword value representing the desired color.
@example
```
import chalk = require('chalk');
chalk.keyword('orange');
```
*/
keyword(color: string): Chalk;
/**
Use RGB values to set text color.
*/
rgb(red: number, green: number, blue: number): Chalk;
/**
Use HSL values to set text color.
*/
hsl(hue: number, saturation: number, lightness: number): Chalk;
/**
Use HSV values to set text color.
*/
hsv(hue: number, saturation: number, value: number): Chalk;
/**
Use HWB values to set text color.
*/
hwb(hue: number, whiteness: number, blackness: number): Chalk;
/**
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color.
30 <= code && code < 38 || 90 <= code && code < 98
For example, 31 for red, 91 for redBright.
*/
ansi(code: number): Chalk;
/**
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
*/
ansi256(index: number): Chalk;
/**
Use HEX value to set background color.
@param color - Hexadecimal value representing the desired color.
@example
```
import chalk = require('chalk');
chalk.bgHex('#DEADED');
```
*/
bgHex(color: string): Chalk;
/**
Use keyword color value to set background color.
@param color - Keyword value representing the desired color.
@example
```
import chalk = require('chalk');
chalk.bgKeyword('orange');
```
*/
bgKeyword(color: string): Chalk;
/**
Use RGB values to set background color.
*/
bgRgb(red: number, green: number, blue: number): Chalk;
/**
Use HSL values to set background color.
*/
bgHsl(hue: number, saturation: number, lightness: number): Chalk;
/**
Use HSV values to set background color.
*/
bgHsv(hue: number, saturation: number, value: number): Chalk;
/**
Use HWB values to set background color.
*/
bgHwb(hue: number, whiteness: number, blackness: number): Chalk;
/**
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color.
30 <= code && code < 38 || 90 <= code && code < 98
For example, 31 for red, 91 for redBright.
Use the foreground code, not the background code (for example, not 41, nor 101).
*/
bgAnsi(code: number): Chalk;
/**
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
*/
bgAnsi256(index: number): Chalk;
/**
Modifier: Resets the current color chain.
*/
readonly reset: Chalk;
/**
Modifier: Make text bold.
*/
readonly bold: Chalk;
/**
Modifier: Emitting only a small amount of light.
*/
readonly dim: Chalk;
/**
Modifier: Make text italic. (Not widely supported)
*/
readonly italic: Chalk;
/**
Modifier: Make text underline. (Not widely supported)
*/
readonly underline: Chalk;
/**
Modifier: Inverse background and foreground colors.
*/
readonly inverse: Chalk;
/**
Modifier: Prints the text, but makes it invisible.
*/
readonly hidden: Chalk;
/**
Modifier: Puts a horizontal line through the center of the text. (Not widely supported)
*/
readonly strikethrough: Chalk;
/**
Modifier: Prints the text only when Chalk has a color support level > 0.
Can be useful for things that are purely cosmetic.
*/
readonly visible: Chalk;
readonly black: Chalk;
readonly red: Chalk;
readonly green: Chalk;
readonly yellow: Chalk;
readonly blue: Chalk;
readonly magenta: Chalk;
readonly cyan: Chalk;
readonly white: Chalk;
/*
Alias for `blackBright`.
*/
readonly gray: Chalk;
/*
Alias for `blackBright`.
*/
readonly grey: Chalk;
readonly blackBright: Chalk;
readonly redBright: Chalk;
readonly greenBright: Chalk;
readonly yellowBright: Chalk;
readonly blueBright: Chalk;
readonly magentaBright: Chalk;
readonly cyanBright: Chalk;
readonly whiteBright: Chalk;
readonly bgBlack: Chalk;
readonly bgRed: Chalk;
readonly bgGreen: Chalk;
readonly bgYellow: Chalk;
readonly bgBlue: Chalk;
readonly bgMagenta: Chalk;
readonly bgCyan: Chalk;
readonly bgWhite: Chalk;
/*
Alias for `bgBlackBright`.
*/
readonly bgGray: Chalk;
/*
Alias for `bgBlackBright`.
*/
readonly bgGrey: Chalk;
readonly bgBlackBright: Chalk;
readonly bgRedBright: Chalk;
readonly bgGreenBright: Chalk;
readonly bgYellowBright: Chalk;
readonly bgBlueBright: Chalk;
readonly bgMagentaBright: Chalk;
readonly bgCyanBright: Chalk;
readonly bgWhiteBright: Chalk;
}
}
/**
Main Chalk object that allows to chain styles together.
Call the last one as a method with a string argument.
Order doesn't matter, and later styles take precedent in case of a conflict.
This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
*/
declare const chalk: chalk.Chalk & chalk.ChalkFunction & {
supportsColor: chalk.ColorSupport | false;
Level: chalk.Level;
Color: Color;
ForegroundColor: ForegroundColor;
BackgroundColor: BackgroundColor;
Modifiers: Modifiers;
stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false};
};
export = chalk;

View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,68 @@
{
"name": "chalk",
"version": "4.1.2",
"description": "Terminal string styling done right",
"license": "MIT",
"repository": "chalk/chalk",
"funding": "https://github.com/chalk/chalk?sponsor=1",
"main": "source",
"engines": {
"node": ">=10"
},
"scripts": {
"test": "xo && nyc ava && tsd",
"bench": "matcha benchmark.js"
},
"files": [
"source",
"index.d.ts"
],
"keywords": [
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"str",
"ansi",
"style",
"styles",
"tty",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"devDependencies": {
"ava": "^2.4.0",
"coveralls": "^3.0.7",
"execa": "^4.0.0",
"import-fresh": "^3.1.0",
"matcha": "^0.7.0",
"nyc": "^15.0.0",
"resolve-from": "^5.0.0",
"tsd": "^0.7.4",
"xo": "^0.28.2"
},
"xo": {
"rules": {
"unicorn/prefer-string-slice": "off",
"unicorn/prefer-includes": "off",
"@typescript-eslint/member-ordering": "off",
"no-redeclare": "off",
"unicorn/string-content": "off",
"unicorn/better-regex": "off"
}
}
}

View File

@@ -0,0 +1,341 @@
<h1 align="center">
<br>
<br>
<img width="320" src="media/logo.svg" alt="Chalk">
<br>
<br>
<br>
</h1>
> Terminal string styling done right
[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript-ready](https://img.shields.io/npm/types/chalk.svg) [![run on repl.it](https://repl.it/badge/github/chalk/chalk)](https://repl.it/github/chalk/chalk)
<img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
<br>
---
<div align="center">
<p>
<p>
<sup>
Sindre Sorhus' open source work is supported by the community on <a href="https://github.com/sponsors/sindresorhus">GitHub Sponsors</a> and <a href="https://stakes.social/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15">Dev</a>
</sup>
</p>
<sup>Special thanks to:</sup>
<br>
<br>
<a href="https://standardresume.co/tech">
<img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="160"/>
</a>
<br>
<br>
<a href="https://retool.com/?utm_campaign=sindresorhus">
<img src="https://sindresorhus.com/assets/thanks/retool-logo.svg" width="230"/>
</a>
<br>
<br>
<a href="https://doppler.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=chalk&utm_source=github">
<div>
<img src="https://dashboard.doppler.com/imgs/logo-long.svg" width="240" alt="Doppler">
</div>
<b>All your environment variables, in one place</b>
<div>
<span>Stop struggling with scattered API keys, hacking together home-brewed tools,</span>
<br>
<span>and avoiding access controls. Keep your team and servers in sync with Doppler.</span>
</div>
</a>
<br>
<a href="https://uibakery.io/?utm_source=chalk&utm_medium=sponsor&utm_campaign=github">
<div>
<img src="https://sindresorhus.com/assets/thanks/uibakery-logo.jpg" width="270" alt="UI Bakery">
</div>
</a>
</p>
</div>
---
<br>
## Highlights
- Expressive API
- Highly performant
- Ability to nest styles
- [256/Truecolor color support](#256-and-truecolor-color-support)
- Auto-detects color support
- Doesn't extend `String.prototype`
- Clean and focused
- Actively maintained
- [Used by ~50,000 packages](https://www.npmjs.com/browse/depended/chalk) as of January 1, 2020
## Install
```console
$ npm install chalk
```
## Usage
```js
const chalk = require('chalk');
console.log(chalk.blue('Hello world!'));
```
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
```js
const chalk = require('chalk');
const log = console.log;
// Combine styled and normal strings
log(chalk.blue('Hello') + ' World' + chalk.red('!'));
// Compose multiple styles using the chainable API
log(chalk.blue.bgRed.bold('Hello world!'));
// Pass in multiple arguments
log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
// Nest styles
log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
// Nest styles of the same type even (color, underline, background)
log(chalk.green(
'I am a green line ' +
chalk.blue.underline.bold('with a blue substring') +
' that becomes green again!'
));
// ES2015 template literal
log(`
CPU: ${chalk.red('90%')}
RAM: ${chalk.green('40%')}
DISK: ${chalk.yellow('70%')}
`);
// ES2015 tagged template literal
log(chalk`
CPU: {red ${cpu.totalPercent}%}
RAM: {green ${ram.used / ram.total * 100}%}
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
`);
// Use RGB colors in terminal emulators that support it.
log(chalk.keyword('orange')('Yay for orange colored text!'));
log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
log(chalk.hex('#DEADED').bold('Bold gray!'));
```
Easily define your own themes:
```js
const chalk = require('chalk');
const error = chalk.bold.red;
const warning = chalk.keyword('orange');
console.log(error('Error!'));
console.log(warning('Warning!'));
```
Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
```js
const name = 'Sindre';
console.log(chalk.green('Hello %s'), name);
//=> 'Hello Sindre'
```
## API
### chalk.`<style>[.<style>...](string, [string...])`
Example: `chalk.red.bold.underline('Hello', 'world');`
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
Multiple arguments will be separated by space.
### chalk.level
Specifies the level of color support.
Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
If you need to change this in a reusable module, create a new instance:
```js
const ctx = new chalk.Instance({level: 0});
```
| Level | Description |
| :---: | :--- |
| `0` | All colors disabled |
| `1` | Basic color support (16 colors) |
| `2` | 256 color support |
| `3` | Truecolor support (16 million colors) |
### chalk.supportsColor
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
### chalk.stderr and chalk.stderr.supportsColor
`chalk.stderr` contains a separate instance configured with color support detected for `stderr` stream instead of `stdout`. Override rules from `chalk.supportsColor` apply to this too. `chalk.stderr.supportsColor` is exposed for convenience.
## Styles
### Modifiers
- `reset` - Resets the current color chain.
- `bold` - Make text bold.
- `dim` - Emitting only a small amount of light.
- `italic` - Make text italic. *(Not widely supported)*
- `underline` - Make text underline. *(Not widely supported)*
- `inverse`- Inverse background and foreground colors.
- `hidden` - Prints the text, but makes it invisible.
- `strikethrough` - Puts a horizontal line through the center of the text. *(Not widely supported)*
- `visible`- Prints the text only when Chalk has a color level > 0. Can be useful for things that are purely cosmetic.
### Colors
- `black`
- `red`
- `green`
- `yellow`
- `blue`
- `magenta`
- `cyan`
- `white`
- `blackBright` (alias: `gray`, `grey`)
- `redBright`
- `greenBright`
- `yellowBright`
- `blueBright`
- `magentaBright`
- `cyanBright`
- `whiteBright`
### Background colors
- `bgBlack`
- `bgRed`
- `bgGreen`
- `bgYellow`
- `bgBlue`
- `bgMagenta`
- `bgCyan`
- `bgWhite`
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
- `bgRedBright`
- `bgGreenBright`
- `bgYellowBright`
- `bgBlueBright`
- `bgMagentaBright`
- `bgCyanBright`
- `bgWhiteBright`
## Tagged template literal
Chalk can be used as a [tagged template literal](https://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
```js
const chalk = require('chalk');
const miles = 18;
const calculateFeet = miles => miles * 5280;
console.log(chalk`
There are {bold 5280 feet} in a mile.
In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
`);
```
Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
Template styles are chained exactly like normal Chalk styles. The following three statements are equivalent:
```js
console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
console.log(chalk.bold.rgb(10, 100, 200)`Hello!`);
console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
```
Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
## 256 and Truecolor color support
Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
Examples:
- `chalk.hex('#DEADED').underline('Hello, world!')`
- `chalk.keyword('orange')('Some orange text')`
- `chalk.rgb(15, 100, 204).inverse('Hello!')`
Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
- `chalk.bgHex('#DEADED').underline('Hello, world!')`
- `chalk.bgKeyword('orange')('Some orange text')`
- `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
The following color models can be used:
- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
- [`ansi`](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) - Example: `chalk.ansi(31).bgAnsi(93)('red on yellowBright')`
- [`ansi256`](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) - Example: `chalk.bgAnsi256(194)('Honeydew, more or less')`
## Windows
If you're on Windows, do yourself a favor and use [Windows Terminal](https://github.com/microsoft/terminal) instead of `cmd.exe`.
## Origin story
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
## chalk for enterprise
Available as part of the Tidelift Subscription.
The maintainers of chalk and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-chalk?utm_source=npm-chalk&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
## Related
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal
## Maintainers
- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)

View File

@@ -0,0 +1,229 @@
'use strict';
const ansiStyles = require('ansi-styles');
const {stdout: stdoutColor, stderr: stderrColor} = require('supports-color');
const {
stringReplaceAll,
stringEncaseCRLFWithFirstIndex
} = require('./util');
const {isArray} = Array;
// `supportsColor.level` → `ansiStyles.color[name]` mapping
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');
}
// Detect level if not set manually
const colorLevel = stdoutColor ? stdoutColor.level : 0;
object.level = options.level === undefined ? colorLevel : options.level;
};
class ChalkClass {
constructor(options) {
// eslint-disable-next-line no-constructor-return
return chalkFactory(options);
}
}
const chalkFactory = options => {
const chalk = {};
applyOptions(chalk, options);
chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
Object.setPrototypeOf(chalk, Chalk.prototype);
Object.setPrototypeOf(chalk.template, chalk);
chalk.template.constructor = () => {
throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
};
chalk.template.Instance = ChalkClass;
return chalk.template;
};
function Chalk(options) {
return chalkFactory(options);
}
for (const [styleName, style] of Object.entries(ansiStyles)) {
styles[styleName] = {
get() {
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
Object.defineProperty(this, styleName, {value: builder});
return builder;
}
};
}
styles.visible = {
get() {
const builder = createBuilder(this, this._styler, true);
Object.defineProperty(this, 'visible', {value: builder});
return builder;
}
};
const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
for (const model of usedModels) {
styles[model] = {
get() {
const {level} = this;
return function (...arguments_) {
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
return createBuilder(this, styler, this._isEmpty);
};
}
};
}
for (const model of usedModels) {
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
styles[bgModel] = {
get() {
const {level} = this;
return function (...arguments_) {
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
return createBuilder(this, styler, this._isEmpty);
};
}
};
}
const proto = Object.defineProperties(() => {}, {
...styles,
level: {
enumerable: true,
get() {
return this._generator.level;
},
set(level) {
this._generator.level = level;
}
}
});
const createStyler = (open, close, parent) => {
let openAll;
let closeAll;
if (parent === undefined) {
openAll = open;
closeAll = close;
} else {
openAll = parent.openAll + open;
closeAll = close + parent.closeAll;
}
return {
open,
close,
openAll,
closeAll,
parent
};
};
const createBuilder = (self, _styler, _isEmpty) => {
const builder = (...arguments_) => {
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
// Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
return applyStyle(builder, chalkTag(builder, ...arguments_));
}
// Single argument is hot path, implicit coercion is faster than anything
// eslint-disable-next-line no-implicit-coercion
return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
};
// We alter the prototype because we must return a function, but there is
// no way to create a function with a different prototype
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 (styler === undefined) {
return string;
}
const {openAll, closeAll} = styler;
if (string.indexOf('\u001B') !== -1) {
while (styler !== undefined) {
// Replace any instances already present with a re-opening code
// otherwise only the part of the string until said closing code
// will be colored, and the rest will simply be 'plain'.
string = stringReplaceAll(string, styler.close, styler.open);
styler = styler.parent;
}
}
// We can move both next actions out of loop, because remaining actions in loop won't have
// any/visible effect on parts we add here. Close the styling before a linebreak and reopen
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
const lfIndex = string.indexOf('\n');
if (lfIndex !== -1) {
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
}
return openAll + string + closeAll;
};
let template;
const chalkTag = (chalk, ...strings) => {
const [firstString] = strings;
if (!isArray(firstString) || !isArray(firstString.raw)) {
// If chalk() was called by itself or with a string,
// return the string itself as a string.
return strings.join(' ');
}
const arguments_ = strings.slice(1);
const parts = [firstString.raw[0]];
for (let i = 1; i < firstString.length; i++) {
parts.push(
String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
String(firstString.raw[i])
);
}
if (template === undefined) {
template = require('./templates');
}
return template(chalk, parts.join(''));
};
Object.defineProperties(Chalk.prototype, styles);
const chalk = Chalk(); // eslint-disable-line new-cap
chalk.supportsColor = stdoutColor;
chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap
chalk.stderr.supportsColor = stderrColor;
module.exports = chalk;

View File

@@ -0,0 +1,134 @@
'use strict';
const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
const ESCAPES = new Map([
['n', '\n'],
['r', '\r'],
['t', '\t'],
['b', '\b'],
['f', '\f'],
['v', '\v'],
['0', '\0'],
['\\', '\\'],
['e', '\u001B'],
['a', '\u0007']
]);
function unescape(c) {
const u = c[0] === 'u';
const bracket = c[1] === '{';
if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
return String.fromCharCode(parseInt(c.slice(1), 16));
}
if (u && bracket) {
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
}
return ESCAPES.get(c) || c;
}
function parseArguments(name, arguments_) {
const results = [];
const chunks = arguments_.trim().split(/\s*,\s*/g);
let matches;
for (const chunk of chunks) {
const number = Number(chunk);
if (!Number.isNaN(number)) {
results.push(number);
} else if ((matches = chunk.match(STRING_REGEX))) {
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
} else {
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
}
}
return results;
}
function parseStyle(style) {
STYLE_REGEX.lastIndex = 0;
const results = [];
let matches;
while ((matches = STYLE_REGEX.exec(style)) !== null) {
const name = matches[1];
if (matches[2]) {
const args = parseArguments(name, matches[2]);
results.push([name].concat(args));
} else {
results.push([name]);
}
}
return results;
}
function buildStyle(chalk, styles) {
const enabled = {};
for (const layer of styles) {
for (const style of layer.styles) {
enabled[style[0]] = layer.inverse ? null : style.slice(1);
}
}
let current = chalk;
for (const [styleName, styles] of Object.entries(enabled)) {
if (!Array.isArray(styles)) {
continue;
}
if (!(styleName in current)) {
throw new Error(`Unknown Chalk style: ${styleName}`);
}
current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
}
return current;
}
module.exports = (chalk, temporary) => {
const styles = [];
const chunks = [];
let chunk = [];
// eslint-disable-next-line max-params
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
if (escapeCharacter) {
chunk.push(unescape(escapeCharacter));
} else if (style) {
const string = chunk.join('');
chunk = [];
chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
styles.push({inverse, styles: parseStyle(style)});
} else if (close) {
if (styles.length === 0) {
throw new Error('Found extraneous } in Chalk template literal');
}
chunks.push(buildStyle(chalk, styles)(chunk.join('')));
chunk = [];
styles.pop();
} else {
chunk.push(character);
}
});
chunks.push(chunk.join(''));
if (styles.length > 0) {
const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
throw new Error(errMessage);
}
return chunks.join('');
};

View File

@@ -0,0 +1,39 @@
'use strict';
const stringReplaceAll = (string, substring, replacer) => {
let index = string.indexOf(substring);
if (index === -1) {
return string;
}
const substringLength = substring.length;
let endIndex = 0;
let returnValue = '';
do {
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
endIndex = index + substringLength;
index = string.indexOf(substring, endIndex);
} while (index !== -1);
returnValue += string.substr(endIndex);
return returnValue;
};
const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
let endIndex = 0;
let returnValue = '';
do {
const gotCR = string[index - 1] === '\r';
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
endIndex = index + 1;
index = string.indexOf('\n', endIndex);
} while (index !== -1);
returnValue += string.substr(endIndex);
return returnValue;
};
module.exports = {
stringReplaceAll,
stringEncaseCRLFWithFirstIndex
};

35
frontend/node_modules/@jest/types/package.json generated vendored Normal file
View File

@@ -0,0 +1,35 @@
{
"name": "@jest/types",
"version": "30.3.0",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
"directory": "packages/jest-types"
},
"engines": {
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.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/pattern": "30.0.1",
"@jest/schemas": "30.0.5",
"@types/istanbul-lib-coverage": "^2.0.6",
"@types/istanbul-reports": "^3.0.4",
"@types/node": "*",
"@types/yargs": "^17.0.33",
"chalk": "^4.1.2"
},
"publishConfig": {
"access": "public"
},
"gitHead": "efb59c2e81083f8dc941f20d6d20a3af2dc8d068"
}