@depup/vitest__pretty-format 4.1.0-depup.0 → 4.1.2-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -9
- package/changes.json +3 -8
- package/dist/index.d.ts +9 -0
- package/dist/index.js +24 -6
- package/package.json +11 -14
package/README.md
CHANGED
|
@@ -13,16 +13,10 @@ npm install @depup/vitest__pretty-format
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [@vitest/pretty-format](https://www.npmjs.com/package/@vitest/pretty-format) @ 4.1.
|
|
17
|
-
| Processed | 2026-03-
|
|
16
|
+
| Original | [@vitest/pretty-format](https://www.npmjs.com/package/@vitest/pretty-format) @ 4.1.2 |
|
|
17
|
+
| Processed | 2026-03-26 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
|
-
| Deps updated |
|
|
20
|
-
|
|
21
|
-
## Dependency Changes
|
|
22
|
-
|
|
23
|
-
| Dependency | From | To |
|
|
24
|
-
|------------|------|-----|
|
|
25
|
-
| tinyrainbow | ^3.0.3 | ^3.1.0 |
|
|
19
|
+
| Deps updated | 0 |
|
|
26
20
|
|
|
27
21
|
---
|
|
28
22
|
|
package/changes.json
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -53,6 +53,14 @@ interface PrettyFormatOptions {
|
|
|
53
53
|
indent?: number;
|
|
54
54
|
maxDepth?: number;
|
|
55
55
|
maxWidth?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Approximate per-depth-level budget for output length.
|
|
58
|
+
* When the accumulated output at any single depth level exceeds this value,
|
|
59
|
+
* further nesting is collapsed. This is a heuristic safety valve, not a hard
|
|
60
|
+
* limit — total output can reach up to roughly `maxDepth × maxOutputLength`.
|
|
61
|
+
* @default 1_000_000
|
|
62
|
+
*/
|
|
63
|
+
maxOutputLength?: number;
|
|
56
64
|
min?: boolean;
|
|
57
65
|
printBasicPrototype?: boolean;
|
|
58
66
|
printFunctionName?: boolean;
|
|
@@ -77,6 +85,7 @@ interface Config {
|
|
|
77
85
|
printShadowRoot: boolean;
|
|
78
86
|
spacingInner: string;
|
|
79
87
|
spacingOuter: string;
|
|
88
|
+
maxOutputLength: number;
|
|
80
89
|
}
|
|
81
90
|
type Printer = (val: unknown, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string;
|
|
82
91
|
type Test = (arg0: any) => boolean;
|
package/dist/index.js
CHANGED
|
@@ -921,15 +921,30 @@ function findPlugin(plugins, val) {
|
|
|
921
921
|
return null;
|
|
922
922
|
}
|
|
923
923
|
function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
924
|
+
let result;
|
|
924
925
|
const plugin = findPlugin(config.plugins, val);
|
|
925
926
|
if (plugin !== null) {
|
|
926
|
-
|
|
927
|
+
result = printPlugin(plugin, val, config, indentation, depth, refs);
|
|
928
|
+
} else {
|
|
929
|
+
const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString);
|
|
930
|
+
if (basicResult !== null) {
|
|
931
|
+
result = basicResult;
|
|
932
|
+
} else {
|
|
933
|
+
result = printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
|
|
934
|
+
}
|
|
927
935
|
}
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
936
|
+
// Per-depth output budget (inspired by Node's util.inspect).
|
|
937
|
+
// Each depth level tracks output independently, so nested results
|
|
938
|
+
// don't inflate a single counter (which would undercount by ~Nx for
|
|
939
|
+
// N levels of nesting). Nodes at the same depth produce disjoint spans
|
|
940
|
+
// in the output string, so each bucket accurately reflects output at
|
|
941
|
+
// that level. Total output is bounded by maxDepth × maxOutputLength.
|
|
942
|
+
config._outputLengthPerDepth[depth] ??= 0;
|
|
943
|
+
config._outputLengthPerDepth[depth] += result.length;
|
|
944
|
+
if (config._outputLengthPerDepth[depth] > config.maxOutputLength) {
|
|
945
|
+
config.maxDepth = 0;
|
|
931
946
|
}
|
|
932
|
-
return
|
|
947
|
+
return result;
|
|
933
948
|
}
|
|
934
949
|
const DEFAULT_THEME = {
|
|
935
950
|
comment: "gray",
|
|
@@ -947,6 +962,7 @@ const DEFAULT_OPTIONS = {
|
|
|
947
962
|
highlight: false,
|
|
948
963
|
indent: 2,
|
|
949
964
|
maxDepth: Number.POSITIVE_INFINITY,
|
|
965
|
+
maxOutputLength: 1e6,
|
|
950
966
|
maxWidth: Number.POSITIVE_INFINITY,
|
|
951
967
|
min: false,
|
|
952
968
|
plugins: [],
|
|
@@ -1011,7 +1027,9 @@ function getConfig(options) {
|
|
|
1011
1027
|
printFunctionName: getPrintFunctionName(options),
|
|
1012
1028
|
printShadowRoot: options?.printShadowRoot ?? true,
|
|
1013
1029
|
spacingInner: options?.min ? " " : "\n",
|
|
1014
|
-
spacingOuter: options?.min ? "" : "\n"
|
|
1030
|
+
spacingOuter: options?.min ? "" : "\n",
|
|
1031
|
+
maxOutputLength: options?.maxOutputLength ?? DEFAULT_OPTIONS.maxOutputLength,
|
|
1032
|
+
_outputLengthPerDepth: []
|
|
1015
1033
|
};
|
|
1016
1034
|
}
|
|
1017
1035
|
function createIndent(indent) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/vitest__pretty-format",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.1.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "4.1.2-depup.0",
|
|
5
|
+
"description": "Fork of pretty-format with support for ESM (with updated dependencies)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
8
8
|
"homepage": "https://github.com/vitest-dev/vitest/tree/main/packages/pretty-format",
|
|
@@ -15,10 +15,12 @@
|
|
|
15
15
|
"url": "https://github.com/vitest-dev/vitest/issues"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [
|
|
18
|
-
"depup",
|
|
19
|
-
"dependency-bumped",
|
|
20
|
-
"updated-deps",
|
|
21
18
|
"@vitest/pretty-format",
|
|
19
|
+
"depup",
|
|
20
|
+
"updated-dependencies",
|
|
21
|
+
"security",
|
|
22
|
+
"latest",
|
|
23
|
+
"patched",
|
|
22
24
|
"vitest",
|
|
23
25
|
"test",
|
|
24
26
|
"pretty",
|
|
@@ -54,16 +56,11 @@
|
|
|
54
56
|
"dev": "rollup -c --watch"
|
|
55
57
|
},
|
|
56
58
|
"depup": {
|
|
57
|
-
"changes": {
|
|
58
|
-
|
|
59
|
-
"from": "^3.0.3",
|
|
60
|
-
"to": "^3.1.0"
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
"depsUpdated": 1,
|
|
59
|
+
"changes": {},
|
|
60
|
+
"depsUpdated": 0,
|
|
64
61
|
"originalPackage": "@vitest/pretty-format",
|
|
65
|
-
"originalVersion": "4.1.
|
|
66
|
-
"processedAt": "2026-03-
|
|
62
|
+
"originalVersion": "4.1.2",
|
|
63
|
+
"processedAt": "2026-03-26T16:31:46.070Z",
|
|
67
64
|
"smokeTest": "passed"
|
|
68
65
|
}
|
|
69
66
|
}
|