@depup/vitest__pretty-format 4.1.0-depup.0 → 4.1.1-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 CHANGED
@@ -13,8 +13,8 @@ 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.0 |
17
- | Processed | 2026-03-17 |
16
+ | Original | [@vitest/pretty-format](https://www.npmjs.com/package/@vitest/pretty-format) @ 4.1.1 |
17
+ | Processed | 2026-03-23 |
18
18
  | Smoke test | passed |
19
19
  | Deps updated | 1 |
20
20
 
package/changes.json CHANGED
@@ -5,6 +5,6 @@
5
5
  "to": "^3.1.0"
6
6
  }
7
7
  },
8
- "timestamp": "2026-03-17T16:34:30.952Z",
8
+ "timestamp": "2026-03-23T16:24:46.816Z",
9
9
  "totalUpdated": 1
10
10
  }
package/dist/index.d.ts CHANGED
@@ -53,6 +53,7 @@ interface PrettyFormatOptions {
53
53
  indent?: number;
54
54
  maxDepth?: number;
55
55
  maxWidth?: number;
56
+ maxOutputLength?: number;
56
57
  min?: boolean;
57
58
  printBasicPrototype?: boolean;
58
59
  printFunctionName?: boolean;
@@ -77,6 +78,8 @@ interface Config {
77
78
  printShadowRoot: boolean;
78
79
  spacingInner: string;
79
80
  spacingOuter: string;
81
+ maxOutputLength: number;
82
+ outputLength: number;
80
83
  }
81
84
  type Printer = (val: unknown, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string;
82
85
  type Test = (arg0: any) => boolean;
package/dist/index.js CHANGED
@@ -921,15 +921,27 @@ 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
- return printPlugin(plugin, val, config, indentation, depth, refs);
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
- const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString);
929
- if (basicResult !== null) {
930
- return basicResult;
936
+ // Check string length budget:
937
+ // accumulate output length and if exceeded,
938
+ // force no further recursion by patching maxDepth.
939
+ // Inspired by Node's util.inspect bail out approach.
940
+ config.outputLength += result.length;
941
+ if (config.outputLength > config.maxOutputLength) {
942
+ config.maxDepth = 0;
931
943
  }
932
- return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
944
+ return result;
933
945
  }
934
946
  const DEFAULT_THEME = {
935
947
  comment: "gray",
@@ -947,6 +959,7 @@ const DEFAULT_OPTIONS = {
947
959
  highlight: false,
948
960
  indent: 2,
949
961
  maxDepth: Number.POSITIVE_INFINITY,
962
+ maxOutputLength: 1e6,
950
963
  maxWidth: Number.POSITIVE_INFINITY,
951
964
  min: false,
952
965
  plugins: [],
@@ -1011,7 +1024,9 @@ function getConfig(options) {
1011
1024
  printFunctionName: getPrintFunctionName(options),
1012
1025
  printShadowRoot: options?.printShadowRoot ?? true,
1013
1026
  spacingInner: options?.min ? " " : "\n",
1014
- spacingOuter: options?.min ? "" : "\n"
1027
+ spacingOuter: options?.min ? "" : "\n",
1028
+ maxOutputLength: options?.maxOutputLength ?? DEFAULT_OPTIONS.maxOutputLength,
1029
+ outputLength: 0
1015
1030
  };
1016
1031
  }
1017
1032
  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.0-depup.0",
5
- "description": "[DepUp] Fork of pretty-format with support for ESM",
4
+ "version": "4.1.1-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",
@@ -62,8 +64,8 @@
62
64
  },
63
65
  "depsUpdated": 1,
64
66
  "originalPackage": "@vitest/pretty-format",
65
- "originalVersion": "4.1.0",
66
- "processedAt": "2026-03-17T16:34:32.736Z",
67
+ "originalVersion": "4.1.1",
68
+ "processedAt": "2026-03-23T16:24:48.280Z",
67
69
  "smokeTest": "passed"
68
70
  }
69
71
  }