plslog 1.1.0 → 1.2.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 +336 -0
- package/dist/index.d.mts +37 -1
- package/dist/index.d.ts +37 -1
- package/dist/index.js +1585 -120
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1585 -120
- package/dist/index.mjs.map +1 -1
- package/package.json +21 -18
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,1358 @@
|
|
|
1
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
!mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
// ../../node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/cjs/react-is.production.min.js
|
|
28
|
+
var require_react_is_production_min = __commonJS({
|
|
29
|
+
"../../node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/cjs/react-is.production.min.js"(exports$1) {
|
|
30
|
+
var b = /* @__PURE__ */ Symbol.for("react.element");
|
|
31
|
+
var c = /* @__PURE__ */ Symbol.for("react.portal");
|
|
32
|
+
var d = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
33
|
+
var e = /* @__PURE__ */ Symbol.for("react.strict_mode");
|
|
34
|
+
var f = /* @__PURE__ */ Symbol.for("react.profiler");
|
|
35
|
+
var g = /* @__PURE__ */ Symbol.for("react.provider");
|
|
36
|
+
var h = /* @__PURE__ */ Symbol.for("react.context");
|
|
37
|
+
var k = /* @__PURE__ */ Symbol.for("react.server_context");
|
|
38
|
+
var l = /* @__PURE__ */ Symbol.for("react.forward_ref");
|
|
39
|
+
var m = /* @__PURE__ */ Symbol.for("react.suspense");
|
|
40
|
+
var n = /* @__PURE__ */ Symbol.for("react.suspense_list");
|
|
41
|
+
var p = /* @__PURE__ */ Symbol.for("react.memo");
|
|
42
|
+
var q = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
43
|
+
var t = /* @__PURE__ */ Symbol.for("react.offscreen");
|
|
44
|
+
var u;
|
|
45
|
+
u = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
46
|
+
function v(a) {
|
|
47
|
+
if ("object" === typeof a && null !== a) {
|
|
48
|
+
var r = a.$$typeof;
|
|
49
|
+
switch (r) {
|
|
50
|
+
case b:
|
|
51
|
+
switch (a = a.type, a) {
|
|
52
|
+
case d:
|
|
53
|
+
case f:
|
|
54
|
+
case e:
|
|
55
|
+
case m:
|
|
56
|
+
case n:
|
|
57
|
+
return a;
|
|
58
|
+
default:
|
|
59
|
+
switch (a = a && a.$$typeof, a) {
|
|
60
|
+
case k:
|
|
61
|
+
case h:
|
|
62
|
+
case l:
|
|
63
|
+
case q:
|
|
64
|
+
case p:
|
|
65
|
+
case g:
|
|
66
|
+
return a;
|
|
67
|
+
default:
|
|
68
|
+
return r;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
case c:
|
|
72
|
+
return r;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports$1.ContextConsumer = h;
|
|
77
|
+
exports$1.ContextProvider = g;
|
|
78
|
+
exports$1.Element = b;
|
|
79
|
+
exports$1.ForwardRef = l;
|
|
80
|
+
exports$1.Fragment = d;
|
|
81
|
+
exports$1.Lazy = q;
|
|
82
|
+
exports$1.Memo = p;
|
|
83
|
+
exports$1.Portal = c;
|
|
84
|
+
exports$1.Profiler = f;
|
|
85
|
+
exports$1.StrictMode = e;
|
|
86
|
+
exports$1.Suspense = m;
|
|
87
|
+
exports$1.SuspenseList = n;
|
|
88
|
+
exports$1.isAsyncMode = function() {
|
|
89
|
+
return false;
|
|
90
|
+
};
|
|
91
|
+
exports$1.isConcurrentMode = function() {
|
|
92
|
+
return false;
|
|
93
|
+
};
|
|
94
|
+
exports$1.isContextConsumer = function(a) {
|
|
95
|
+
return v(a) === h;
|
|
96
|
+
};
|
|
97
|
+
exports$1.isContextProvider = function(a) {
|
|
98
|
+
return v(a) === g;
|
|
99
|
+
};
|
|
100
|
+
exports$1.isElement = function(a) {
|
|
101
|
+
return "object" === typeof a && null !== a && a.$$typeof === b;
|
|
102
|
+
};
|
|
103
|
+
exports$1.isForwardRef = function(a) {
|
|
104
|
+
return v(a) === l;
|
|
105
|
+
};
|
|
106
|
+
exports$1.isFragment = function(a) {
|
|
107
|
+
return v(a) === d;
|
|
108
|
+
};
|
|
109
|
+
exports$1.isLazy = function(a) {
|
|
110
|
+
return v(a) === q;
|
|
111
|
+
};
|
|
112
|
+
exports$1.isMemo = function(a) {
|
|
113
|
+
return v(a) === p;
|
|
114
|
+
};
|
|
115
|
+
exports$1.isPortal = function(a) {
|
|
116
|
+
return v(a) === c;
|
|
117
|
+
};
|
|
118
|
+
exports$1.isProfiler = function(a) {
|
|
119
|
+
return v(a) === f;
|
|
120
|
+
};
|
|
121
|
+
exports$1.isStrictMode = function(a) {
|
|
122
|
+
return v(a) === e;
|
|
123
|
+
};
|
|
124
|
+
exports$1.isSuspense = function(a) {
|
|
125
|
+
return v(a) === m;
|
|
126
|
+
};
|
|
127
|
+
exports$1.isSuspenseList = function(a) {
|
|
128
|
+
return v(a) === n;
|
|
129
|
+
};
|
|
130
|
+
exports$1.isValidElementType = function(a) {
|
|
131
|
+
return "string" === typeof a || "function" === typeof a || a === d || a === f || a === e || a === m || a === n || a === t || "object" === typeof a && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || void 0 !== a.getModuleId) ? true : false;
|
|
132
|
+
};
|
|
133
|
+
exports$1.typeOf = v;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// ../../node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/cjs/react-is.development.js
|
|
138
|
+
var require_react_is_development = __commonJS({
|
|
139
|
+
"../../node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/cjs/react-is.development.js"(exports$1) {
|
|
140
|
+
if (process.env.NODE_ENV !== "production") {
|
|
141
|
+
(function() {
|
|
142
|
+
var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element");
|
|
143
|
+
var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal");
|
|
144
|
+
var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
145
|
+
var REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode");
|
|
146
|
+
var REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler");
|
|
147
|
+
var REACT_PROVIDER_TYPE = /* @__PURE__ */ Symbol.for("react.provider");
|
|
148
|
+
var REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context");
|
|
149
|
+
var REACT_SERVER_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.server_context");
|
|
150
|
+
var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
|
|
151
|
+
var REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
|
|
152
|
+
var REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list");
|
|
153
|
+
var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
|
|
154
|
+
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
155
|
+
var REACT_OFFSCREEN_TYPE = /* @__PURE__ */ Symbol.for("react.offscreen");
|
|
156
|
+
var enableScopeAPI = false;
|
|
157
|
+
var enableCacheElement = false;
|
|
158
|
+
var enableTransitionTracing = false;
|
|
159
|
+
var enableLegacyHidden = false;
|
|
160
|
+
var enableDebugTracing = false;
|
|
161
|
+
var REACT_MODULE_REFERENCE;
|
|
162
|
+
{
|
|
163
|
+
REACT_MODULE_REFERENCE = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
164
|
+
}
|
|
165
|
+
function isValidElementType(type) {
|
|
166
|
+
if (typeof type === "string" || typeof type === "function") {
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
if (typeof type === "object" && type !== null) {
|
|
173
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
174
|
+
// types supported by any Flight configuration anywhere since
|
|
175
|
+
// we don't know which Flight build this will end up being used
|
|
176
|
+
// with.
|
|
177
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
function typeOf(object) {
|
|
184
|
+
if (typeof object === "object" && object !== null) {
|
|
185
|
+
var $$typeof = object.$$typeof;
|
|
186
|
+
switch ($$typeof) {
|
|
187
|
+
case REACT_ELEMENT_TYPE:
|
|
188
|
+
var type = object.type;
|
|
189
|
+
switch (type) {
|
|
190
|
+
case REACT_FRAGMENT_TYPE:
|
|
191
|
+
case REACT_PROFILER_TYPE:
|
|
192
|
+
case REACT_STRICT_MODE_TYPE:
|
|
193
|
+
case REACT_SUSPENSE_TYPE:
|
|
194
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
195
|
+
return type;
|
|
196
|
+
default:
|
|
197
|
+
var $$typeofType = type && type.$$typeof;
|
|
198
|
+
switch ($$typeofType) {
|
|
199
|
+
case REACT_SERVER_CONTEXT_TYPE:
|
|
200
|
+
case REACT_CONTEXT_TYPE:
|
|
201
|
+
case REACT_FORWARD_REF_TYPE:
|
|
202
|
+
case REACT_LAZY_TYPE:
|
|
203
|
+
case REACT_MEMO_TYPE:
|
|
204
|
+
case REACT_PROVIDER_TYPE:
|
|
205
|
+
return $$typeofType;
|
|
206
|
+
default:
|
|
207
|
+
return $$typeof;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
case REACT_PORTAL_TYPE:
|
|
211
|
+
return $$typeof;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return void 0;
|
|
215
|
+
}
|
|
216
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
217
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
218
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
219
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
220
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
221
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
222
|
+
var Memo = REACT_MEMO_TYPE;
|
|
223
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
224
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
225
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
226
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
227
|
+
var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
228
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
229
|
+
var hasWarnedAboutDeprecatedIsConcurrentMode = false;
|
|
230
|
+
function isAsyncMode(object) {
|
|
231
|
+
{
|
|
232
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
233
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
234
|
+
console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.");
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
function isConcurrentMode(object) {
|
|
240
|
+
{
|
|
241
|
+
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
|
|
242
|
+
hasWarnedAboutDeprecatedIsConcurrentMode = true;
|
|
243
|
+
console["warn"]("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.");
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
function isContextConsumer(object) {
|
|
249
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
250
|
+
}
|
|
251
|
+
function isContextProvider(object) {
|
|
252
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
253
|
+
}
|
|
254
|
+
function isElement(object) {
|
|
255
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
256
|
+
}
|
|
257
|
+
function isForwardRef(object) {
|
|
258
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
259
|
+
}
|
|
260
|
+
function isFragment(object) {
|
|
261
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
262
|
+
}
|
|
263
|
+
function isLazy(object) {
|
|
264
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
265
|
+
}
|
|
266
|
+
function isMemo(object) {
|
|
267
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
268
|
+
}
|
|
269
|
+
function isPortal(object) {
|
|
270
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
271
|
+
}
|
|
272
|
+
function isProfiler(object) {
|
|
273
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
274
|
+
}
|
|
275
|
+
function isStrictMode(object) {
|
|
276
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
277
|
+
}
|
|
278
|
+
function isSuspense(object) {
|
|
279
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
280
|
+
}
|
|
281
|
+
function isSuspenseList(object) {
|
|
282
|
+
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
283
|
+
}
|
|
284
|
+
exports$1.ContextConsumer = ContextConsumer;
|
|
285
|
+
exports$1.ContextProvider = ContextProvider;
|
|
286
|
+
exports$1.Element = Element;
|
|
287
|
+
exports$1.ForwardRef = ForwardRef;
|
|
288
|
+
exports$1.Fragment = Fragment;
|
|
289
|
+
exports$1.Lazy = Lazy;
|
|
290
|
+
exports$1.Memo = Memo;
|
|
291
|
+
exports$1.Portal = Portal;
|
|
292
|
+
exports$1.Profiler = Profiler;
|
|
293
|
+
exports$1.StrictMode = StrictMode;
|
|
294
|
+
exports$1.Suspense = Suspense;
|
|
295
|
+
exports$1.SuspenseList = SuspenseList;
|
|
296
|
+
exports$1.isAsyncMode = isAsyncMode;
|
|
297
|
+
exports$1.isConcurrentMode = isConcurrentMode;
|
|
298
|
+
exports$1.isContextConsumer = isContextConsumer;
|
|
299
|
+
exports$1.isContextProvider = isContextProvider;
|
|
300
|
+
exports$1.isElement = isElement;
|
|
301
|
+
exports$1.isForwardRef = isForwardRef;
|
|
302
|
+
exports$1.isFragment = isFragment;
|
|
303
|
+
exports$1.isLazy = isLazy;
|
|
304
|
+
exports$1.isMemo = isMemo;
|
|
305
|
+
exports$1.isPortal = isPortal;
|
|
306
|
+
exports$1.isProfiler = isProfiler;
|
|
307
|
+
exports$1.isStrictMode = isStrictMode;
|
|
308
|
+
exports$1.isSuspense = isSuspense;
|
|
309
|
+
exports$1.isSuspenseList = isSuspenseList;
|
|
310
|
+
exports$1.isValidElementType = isValidElementType;
|
|
311
|
+
exports$1.typeOf = typeOf;
|
|
312
|
+
})();
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
// ../../node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/index.js
|
|
318
|
+
var require_react_is = __commonJS({
|
|
319
|
+
"../../node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/index.js"(exports$1, module) {
|
|
320
|
+
if (process.env.NODE_ENV === "production") {
|
|
321
|
+
module.exports = require_react_is_production_min();
|
|
322
|
+
} else {
|
|
323
|
+
module.exports = require_react_is_development();
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
// ../../node_modules/.pnpm/ansi-styles@5.2.0/node_modules/ansi-styles/index.js
|
|
329
|
+
var require_ansi_styles = __commonJS({
|
|
330
|
+
"../../node_modules/.pnpm/ansi-styles@5.2.0/node_modules/ansi-styles/index.js"(exports$1, module) {
|
|
331
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
332
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
333
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
334
|
+
function assembleStyles() {
|
|
335
|
+
const codes = /* @__PURE__ */ new Map();
|
|
336
|
+
const styles = {
|
|
337
|
+
modifier: {
|
|
338
|
+
reset: [0, 0],
|
|
339
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
340
|
+
bold: [1, 22],
|
|
341
|
+
dim: [2, 22],
|
|
342
|
+
italic: [3, 23],
|
|
343
|
+
underline: [4, 24],
|
|
344
|
+
overline: [53, 55],
|
|
345
|
+
inverse: [7, 27],
|
|
346
|
+
hidden: [8, 28],
|
|
347
|
+
strikethrough: [9, 29]
|
|
348
|
+
},
|
|
349
|
+
color: {
|
|
350
|
+
black: [30, 39],
|
|
351
|
+
red: [31, 39],
|
|
352
|
+
green: [32, 39],
|
|
353
|
+
yellow: [33, 39],
|
|
354
|
+
blue: [34, 39],
|
|
355
|
+
magenta: [35, 39],
|
|
356
|
+
cyan: [36, 39],
|
|
357
|
+
white: [37, 39],
|
|
358
|
+
// Bright color
|
|
359
|
+
blackBright: [90, 39],
|
|
360
|
+
redBright: [91, 39],
|
|
361
|
+
greenBright: [92, 39],
|
|
362
|
+
yellowBright: [93, 39],
|
|
363
|
+
blueBright: [94, 39],
|
|
364
|
+
magentaBright: [95, 39],
|
|
365
|
+
cyanBright: [96, 39],
|
|
366
|
+
whiteBright: [97, 39]
|
|
367
|
+
},
|
|
368
|
+
bgColor: {
|
|
369
|
+
bgBlack: [40, 49],
|
|
370
|
+
bgRed: [41, 49],
|
|
371
|
+
bgGreen: [42, 49],
|
|
372
|
+
bgYellow: [43, 49],
|
|
373
|
+
bgBlue: [44, 49],
|
|
374
|
+
bgMagenta: [45, 49],
|
|
375
|
+
bgCyan: [46, 49],
|
|
376
|
+
bgWhite: [47, 49],
|
|
377
|
+
// Bright color
|
|
378
|
+
bgBlackBright: [100, 49],
|
|
379
|
+
bgRedBright: [101, 49],
|
|
380
|
+
bgGreenBright: [102, 49],
|
|
381
|
+
bgYellowBright: [103, 49],
|
|
382
|
+
bgBlueBright: [104, 49],
|
|
383
|
+
bgMagentaBright: [105, 49],
|
|
384
|
+
bgCyanBright: [106, 49],
|
|
385
|
+
bgWhiteBright: [107, 49]
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
styles.color.gray = styles.color.blackBright;
|
|
389
|
+
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
|
390
|
+
styles.color.grey = styles.color.blackBright;
|
|
391
|
+
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
|
392
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
393
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
394
|
+
styles[styleName] = {
|
|
395
|
+
open: `\x1B[${style[0]}m`,
|
|
396
|
+
close: `\x1B[${style[1]}m`
|
|
397
|
+
};
|
|
398
|
+
group[styleName] = styles[styleName];
|
|
399
|
+
codes.set(style[0], style[1]);
|
|
400
|
+
}
|
|
401
|
+
Object.defineProperty(styles, groupName, {
|
|
402
|
+
value: group,
|
|
403
|
+
enumerable: false
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
Object.defineProperty(styles, "codes", {
|
|
407
|
+
value: codes,
|
|
408
|
+
enumerable: false
|
|
409
|
+
});
|
|
410
|
+
styles.color.close = "\x1B[39m";
|
|
411
|
+
styles.bgColor.close = "\x1B[49m";
|
|
412
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
413
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
414
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
415
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
416
|
+
Object.defineProperties(styles, {
|
|
417
|
+
rgbToAnsi256: {
|
|
418
|
+
value: (red, green, blue) => {
|
|
419
|
+
if (red === green && green === blue) {
|
|
420
|
+
if (red < 8) {
|
|
421
|
+
return 16;
|
|
422
|
+
}
|
|
423
|
+
if (red > 248) {
|
|
424
|
+
return 231;
|
|
425
|
+
}
|
|
426
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
427
|
+
}
|
|
428
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
429
|
+
},
|
|
430
|
+
enumerable: false
|
|
431
|
+
},
|
|
432
|
+
hexToRgb: {
|
|
433
|
+
value: (hex) => {
|
|
434
|
+
const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16));
|
|
435
|
+
if (!matches) {
|
|
436
|
+
return [0, 0, 0];
|
|
437
|
+
}
|
|
438
|
+
let { colorString } = matches.groups;
|
|
439
|
+
if (colorString.length === 3) {
|
|
440
|
+
colorString = colorString.split("").map((character) => character + character).join("");
|
|
441
|
+
}
|
|
442
|
+
const integer = Number.parseInt(colorString, 16);
|
|
443
|
+
return [
|
|
444
|
+
integer >> 16 & 255,
|
|
445
|
+
integer >> 8 & 255,
|
|
446
|
+
integer & 255
|
|
447
|
+
];
|
|
448
|
+
},
|
|
449
|
+
enumerable: false
|
|
450
|
+
},
|
|
451
|
+
hexToAnsi256: {
|
|
452
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
453
|
+
enumerable: false
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
return styles;
|
|
457
|
+
}
|
|
458
|
+
Object.defineProperty(module, "exports", {
|
|
459
|
+
enumerable: true,
|
|
460
|
+
get: assembleStyles
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
// ../../node_modules/.pnpm/pretty-format@30.2.0/node_modules/pretty-format/build/index.js
|
|
466
|
+
var require_build = __commonJS({
|
|
467
|
+
"../../node_modules/.pnpm/pretty-format@30.2.0/node_modules/pretty-format/build/index.js"(exports$1, module) {
|
|
468
|
+
(() => {
|
|
469
|
+
var __webpack_modules__ = {
|
|
470
|
+
/***/
|
|
471
|
+
"./src/collections.ts": (
|
|
472
|
+
/***/
|
|
473
|
+
((__unused_webpack_module, exports2) => {
|
|
474
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
475
|
+
value: true
|
|
476
|
+
});
|
|
477
|
+
exports2.printIteratorEntries = printIteratorEntries;
|
|
478
|
+
exports2.printIteratorValues = printIteratorValues;
|
|
479
|
+
exports2.printListItems = printListItems;
|
|
480
|
+
exports2.printObjectProperties = printObjectProperties;
|
|
481
|
+
const getKeysOfEnumerableProperties = (object, compareKeys) => {
|
|
482
|
+
const rawKeys = Object.keys(object);
|
|
483
|
+
const keys = compareKeys === null ? rawKeys : rawKeys.sort(compareKeys);
|
|
484
|
+
if (Object.getOwnPropertySymbols) {
|
|
485
|
+
for (const symbol of Object.getOwnPropertySymbols(object)) {
|
|
486
|
+
if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
|
|
487
|
+
keys.push(symbol);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return keys;
|
|
492
|
+
};
|
|
493
|
+
function printIteratorEntries(iterator, config, indentation, depth, refs, printer, separator = ": ") {
|
|
494
|
+
let result = "";
|
|
495
|
+
let width = 0;
|
|
496
|
+
let current = iterator.next();
|
|
497
|
+
if (!current.done) {
|
|
498
|
+
result += config.spacingOuter;
|
|
499
|
+
const indentationNext = indentation + config.indent;
|
|
500
|
+
while (!current.done) {
|
|
501
|
+
result += indentationNext;
|
|
502
|
+
if (width++ === config.maxWidth) {
|
|
503
|
+
result += "\u2026";
|
|
504
|
+
break;
|
|
505
|
+
}
|
|
506
|
+
const name = printer(current.value[0], config, indentationNext, depth, refs);
|
|
507
|
+
const value = printer(current.value[1], config, indentationNext, depth, refs);
|
|
508
|
+
result += name + separator + value;
|
|
509
|
+
current = iterator.next();
|
|
510
|
+
if (!current.done) {
|
|
511
|
+
result += `,${config.spacingInner}`;
|
|
512
|
+
} else if (!config.min) {
|
|
513
|
+
result += ",";
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
result += config.spacingOuter + indentation;
|
|
517
|
+
}
|
|
518
|
+
return result;
|
|
519
|
+
}
|
|
520
|
+
function printIteratorValues(iterator, config, indentation, depth, refs, printer) {
|
|
521
|
+
let result = "";
|
|
522
|
+
let width = 0;
|
|
523
|
+
let current = iterator.next();
|
|
524
|
+
if (!current.done) {
|
|
525
|
+
result += config.spacingOuter;
|
|
526
|
+
const indentationNext = indentation + config.indent;
|
|
527
|
+
while (!current.done) {
|
|
528
|
+
result += indentationNext;
|
|
529
|
+
if (width++ === config.maxWidth) {
|
|
530
|
+
result += "\u2026";
|
|
531
|
+
break;
|
|
532
|
+
}
|
|
533
|
+
result += printer(current.value, config, indentationNext, depth, refs);
|
|
534
|
+
current = iterator.next();
|
|
535
|
+
if (!current.done) {
|
|
536
|
+
result += `,${config.spacingInner}`;
|
|
537
|
+
} else if (!config.min) {
|
|
538
|
+
result += ",";
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
result += config.spacingOuter + indentation;
|
|
542
|
+
}
|
|
543
|
+
return result;
|
|
544
|
+
}
|
|
545
|
+
function printListItems(list, config, indentation, depth, refs, printer) {
|
|
546
|
+
let result = "";
|
|
547
|
+
list = list instanceof ArrayBuffer ? new DataView(list) : list;
|
|
548
|
+
const isDataView = (l) => l instanceof DataView;
|
|
549
|
+
const length = isDataView(list) ? list.byteLength : list.length;
|
|
550
|
+
if (length > 0) {
|
|
551
|
+
result += config.spacingOuter;
|
|
552
|
+
const indentationNext = indentation + config.indent;
|
|
553
|
+
for (let i = 0; i < length; i++) {
|
|
554
|
+
result += indentationNext;
|
|
555
|
+
if (i === config.maxWidth) {
|
|
556
|
+
result += "\u2026";
|
|
557
|
+
break;
|
|
558
|
+
}
|
|
559
|
+
if (isDataView(list) || i in list) {
|
|
560
|
+
result += printer(isDataView(list) ? list.getInt8(i) : list[i], config, indentationNext, depth, refs);
|
|
561
|
+
}
|
|
562
|
+
if (i < length - 1) {
|
|
563
|
+
result += `,${config.spacingInner}`;
|
|
564
|
+
} else if (!config.min) {
|
|
565
|
+
result += ",";
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
result += config.spacingOuter + indentation;
|
|
569
|
+
}
|
|
570
|
+
return result;
|
|
571
|
+
}
|
|
572
|
+
function printObjectProperties(val, config, indentation, depth, refs, printer) {
|
|
573
|
+
let result = "";
|
|
574
|
+
const keys = getKeysOfEnumerableProperties(val, config.compareKeys);
|
|
575
|
+
if (keys.length > 0) {
|
|
576
|
+
result += config.spacingOuter;
|
|
577
|
+
const indentationNext = indentation + config.indent;
|
|
578
|
+
for (let i = 0; i < keys.length; i++) {
|
|
579
|
+
const key = keys[i];
|
|
580
|
+
const name = printer(key, config, indentationNext, depth, refs);
|
|
581
|
+
const value = printer(val[key], config, indentationNext, depth, refs);
|
|
582
|
+
result += `${indentationNext + name}: ${value}`;
|
|
583
|
+
if (i < keys.length - 1) {
|
|
584
|
+
result += `,${config.spacingInner}`;
|
|
585
|
+
} else if (!config.min) {
|
|
586
|
+
result += ",";
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
result += config.spacingOuter + indentation;
|
|
590
|
+
}
|
|
591
|
+
return result;
|
|
592
|
+
}
|
|
593
|
+
})
|
|
594
|
+
),
|
|
595
|
+
/***/
|
|
596
|
+
"./src/plugins/AsymmetricMatcher.ts": (
|
|
597
|
+
/***/
|
|
598
|
+
((__unused_webpack_module, exports2, __webpack_require__2) => {
|
|
599
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
600
|
+
value: true
|
|
601
|
+
});
|
|
602
|
+
exports2.test = exports2.serialize = exports2["default"] = void 0;
|
|
603
|
+
var _collections = __webpack_require__2("./src/collections.ts");
|
|
604
|
+
var Symbol2 = globalThis["jest-symbol-do-not-touch"] || globalThis.Symbol;
|
|
605
|
+
const asymmetricMatcher = typeof Symbol2 === "function" && Symbol2.for ? Symbol2.for("jest.asymmetricMatcher") : 1267621;
|
|
606
|
+
const SPACE = " ";
|
|
607
|
+
const serialize = (val, config, indentation, depth, refs, printer) => {
|
|
608
|
+
const stringedValue = val.toString();
|
|
609
|
+
if (stringedValue === "ArrayContaining" || stringedValue === "ArrayNotContaining") {
|
|
610
|
+
if (++depth > config.maxDepth) {
|
|
611
|
+
return `[${stringedValue}]`;
|
|
612
|
+
}
|
|
613
|
+
return `${stringedValue + SPACE}[${(0, _collections.printListItems)(val.sample, config, indentation, depth, refs, printer)}]`;
|
|
614
|
+
}
|
|
615
|
+
if (stringedValue === "ObjectContaining" || stringedValue === "ObjectNotContaining") {
|
|
616
|
+
if (++depth > config.maxDepth) {
|
|
617
|
+
return `[${stringedValue}]`;
|
|
618
|
+
}
|
|
619
|
+
return `${stringedValue + SPACE}{${(0, _collections.printObjectProperties)(val.sample, config, indentation, depth, refs, printer)}}`;
|
|
620
|
+
}
|
|
621
|
+
if (stringedValue === "StringMatching" || stringedValue === "StringNotMatching") {
|
|
622
|
+
return stringedValue + SPACE + printer(val.sample, config, indentation, depth, refs);
|
|
623
|
+
}
|
|
624
|
+
if (stringedValue === "StringContaining" || stringedValue === "StringNotContaining") {
|
|
625
|
+
return stringedValue + SPACE + printer(val.sample, config, indentation, depth, refs);
|
|
626
|
+
}
|
|
627
|
+
if (stringedValue === "ArrayOf" || stringedValue === "NotArrayOf") {
|
|
628
|
+
if (++depth > config.maxDepth) {
|
|
629
|
+
return `[${stringedValue}]`;
|
|
630
|
+
}
|
|
631
|
+
return `${stringedValue + SPACE}${printer(val.sample, config, indentation, depth, refs)}`;
|
|
632
|
+
}
|
|
633
|
+
if (typeof val.toAsymmetricMatcher !== "function") {
|
|
634
|
+
throw new TypeError(`Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()`);
|
|
635
|
+
}
|
|
636
|
+
return val.toAsymmetricMatcher();
|
|
637
|
+
};
|
|
638
|
+
exports2.serialize = serialize;
|
|
639
|
+
const test = (val) => val && val.$$typeof === asymmetricMatcher;
|
|
640
|
+
exports2.test = test;
|
|
641
|
+
const plugin = {
|
|
642
|
+
serialize,
|
|
643
|
+
test
|
|
644
|
+
};
|
|
645
|
+
exports2["default"] = plugin;
|
|
646
|
+
})
|
|
647
|
+
),
|
|
648
|
+
/***/
|
|
649
|
+
"./src/plugins/DOMCollection.ts": (
|
|
650
|
+
/***/
|
|
651
|
+
((__unused_webpack_module, exports2, __webpack_require__2) => {
|
|
652
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
653
|
+
value: true
|
|
654
|
+
});
|
|
655
|
+
exports2.test = exports2.serialize = exports2["default"] = void 0;
|
|
656
|
+
var _collections = __webpack_require__2("./src/collections.ts");
|
|
657
|
+
const SPACE = " ";
|
|
658
|
+
const OBJECT_NAMES = /* @__PURE__ */ new Set(["DOMStringMap", "NamedNodeMap"]);
|
|
659
|
+
const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/;
|
|
660
|
+
const testName = (name) => OBJECT_NAMES.has(name) || ARRAY_REGEXP.test(name);
|
|
661
|
+
const test = (val) => val && val.constructor && !!val.constructor.name && testName(val.constructor.name);
|
|
662
|
+
exports2.test = test;
|
|
663
|
+
const isNamedNodeMap = (collection) => collection.constructor.name === "NamedNodeMap";
|
|
664
|
+
const serialize = (collection, config, indentation, depth, refs, printer) => {
|
|
665
|
+
const name = collection.constructor.name;
|
|
666
|
+
if (++depth > config.maxDepth) {
|
|
667
|
+
return `[${name}]`;
|
|
668
|
+
}
|
|
669
|
+
return (config.min ? "" : name + SPACE) + (OBJECT_NAMES.has(name) ? `{${(0, _collections.printObjectProperties)(isNamedNodeMap(collection) ? [...collection].reduce((props, attribute) => {
|
|
670
|
+
props[attribute.name] = attribute.value;
|
|
671
|
+
return props;
|
|
672
|
+
}, {}) : {
|
|
673
|
+
...collection
|
|
674
|
+
}, config, indentation, depth, refs, printer)}}` : `[${(0, _collections.printListItems)([...collection], config, indentation, depth, refs, printer)}]`);
|
|
675
|
+
};
|
|
676
|
+
exports2.serialize = serialize;
|
|
677
|
+
const plugin = {
|
|
678
|
+
serialize,
|
|
679
|
+
test
|
|
680
|
+
};
|
|
681
|
+
exports2["default"] = plugin;
|
|
682
|
+
})
|
|
683
|
+
),
|
|
684
|
+
/***/
|
|
685
|
+
"./src/plugins/DOMElement.ts": (
|
|
686
|
+
/***/
|
|
687
|
+
((__unused_webpack_module, exports2, __webpack_require__2) => {
|
|
688
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
689
|
+
value: true
|
|
690
|
+
});
|
|
691
|
+
exports2.test = exports2.serialize = exports2["default"] = void 0;
|
|
692
|
+
var _markup = __webpack_require__2("./src/plugins/lib/markup.ts");
|
|
693
|
+
const ELEMENT_NODE = 1;
|
|
694
|
+
const TEXT_NODE = 3;
|
|
695
|
+
const COMMENT_NODE = 8;
|
|
696
|
+
const FRAGMENT_NODE = 11;
|
|
697
|
+
const ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
|
|
698
|
+
const testHasAttribute = (val) => {
|
|
699
|
+
try {
|
|
700
|
+
return typeof val.hasAttribute === "function" && val.hasAttribute("is");
|
|
701
|
+
} catch {
|
|
702
|
+
return false;
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
const isCustomElement = (val) => {
|
|
706
|
+
const tagName = val?.tagName;
|
|
707
|
+
return typeof tagName === "string" && tagName.includes("-") || testHasAttribute(val);
|
|
708
|
+
};
|
|
709
|
+
const testNode = (val) => {
|
|
710
|
+
const constructorName = val.constructor.name;
|
|
711
|
+
const {
|
|
712
|
+
nodeType
|
|
713
|
+
} = val;
|
|
714
|
+
return nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement(val)) || nodeType === TEXT_NODE && constructorName === "Text" || nodeType === COMMENT_NODE && constructorName === "Comment" || nodeType === FRAGMENT_NODE && constructorName === "DocumentFragment";
|
|
715
|
+
};
|
|
716
|
+
const test = (val) => (val?.constructor?.name || isCustomElement(val)) && testNode(val);
|
|
717
|
+
exports2.test = test;
|
|
718
|
+
function nodeIsText(node) {
|
|
719
|
+
return node.nodeType === TEXT_NODE;
|
|
720
|
+
}
|
|
721
|
+
function nodeIsComment(node) {
|
|
722
|
+
return node.nodeType === COMMENT_NODE;
|
|
723
|
+
}
|
|
724
|
+
function nodeIsFragment(node) {
|
|
725
|
+
return node.nodeType === FRAGMENT_NODE;
|
|
726
|
+
}
|
|
727
|
+
const serialize = (node, config, indentation, depth, refs, printer) => {
|
|
728
|
+
if (nodeIsText(node)) {
|
|
729
|
+
return (0, _markup.printText)(node.data, config);
|
|
730
|
+
}
|
|
731
|
+
if (nodeIsComment(node)) {
|
|
732
|
+
return (0, _markup.printComment)(node.data, config);
|
|
733
|
+
}
|
|
734
|
+
const type = nodeIsFragment(node) ? "DocumentFragment" : node.tagName.toLowerCase();
|
|
735
|
+
if (++depth > config.maxDepth) {
|
|
736
|
+
return (0, _markup.printElementAsLeaf)(type, config);
|
|
737
|
+
}
|
|
738
|
+
return (0, _markup.printElement)(type, (0, _markup.printProps)(nodeIsFragment(node) ? [] : Array.from(node.attributes, (attr) => attr.name).sort(), nodeIsFragment(node) ? {} : [...node.attributes].reduce((props, attribute) => {
|
|
739
|
+
props[attribute.name] = attribute.value;
|
|
740
|
+
return props;
|
|
741
|
+
}, {}), config, indentation + config.indent, depth, refs, printer), (0, _markup.printChildren)(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
|
|
742
|
+
};
|
|
743
|
+
exports2.serialize = serialize;
|
|
744
|
+
const plugin = {
|
|
745
|
+
serialize,
|
|
746
|
+
test
|
|
747
|
+
};
|
|
748
|
+
exports2["default"] = plugin;
|
|
749
|
+
})
|
|
750
|
+
),
|
|
751
|
+
/***/
|
|
752
|
+
"./src/plugins/Immutable.ts": (
|
|
753
|
+
/***/
|
|
754
|
+
((__unused_webpack_module, exports2, __webpack_require__2) => {
|
|
755
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
756
|
+
value: true
|
|
757
|
+
});
|
|
758
|
+
exports2.test = exports2.serialize = exports2["default"] = void 0;
|
|
759
|
+
var _collections = __webpack_require__2("./src/collections.ts");
|
|
760
|
+
const IS_ITERABLE_SENTINEL = "@@__IMMUTABLE_ITERABLE__@@";
|
|
761
|
+
const IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@";
|
|
762
|
+
const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
|
|
763
|
+
const IS_MAP_SENTINEL = "@@__IMMUTABLE_MAP__@@";
|
|
764
|
+
const IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@";
|
|
765
|
+
const IS_RECORD_SENTINEL = "@@__IMMUTABLE_RECORD__@@";
|
|
766
|
+
const IS_SEQ_SENTINEL = "@@__IMMUTABLE_SEQ__@@";
|
|
767
|
+
const IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@";
|
|
768
|
+
const IS_STACK_SENTINEL = "@@__IMMUTABLE_STACK__@@";
|
|
769
|
+
const getImmutableName = (name) => `Immutable.${name}`;
|
|
770
|
+
const printAsLeaf = (name) => `[${name}]`;
|
|
771
|
+
const SPACE = " ";
|
|
772
|
+
const LAZY = "\u2026";
|
|
773
|
+
const printImmutableEntries = (val, config, indentation, depth, refs, printer, type) => ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}{${(0, _collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer)}}`;
|
|
774
|
+
function getRecordEntries(val) {
|
|
775
|
+
let i = 0;
|
|
776
|
+
return {
|
|
777
|
+
next() {
|
|
778
|
+
if (i < val._keys.length) {
|
|
779
|
+
const key = val._keys[i++];
|
|
780
|
+
return {
|
|
781
|
+
done: false,
|
|
782
|
+
value: [key, val.get(key)]
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
return {
|
|
786
|
+
done: true,
|
|
787
|
+
value: void 0
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
const printImmutableRecord = (val, config, indentation, depth, refs, printer) => {
|
|
793
|
+
const name = getImmutableName(val._name || "Record");
|
|
794
|
+
return ++depth > config.maxDepth ? printAsLeaf(name) : `${name + SPACE}{${(0, _collections.printIteratorEntries)(getRecordEntries(val), config, indentation, depth, refs, printer)}}`;
|
|
795
|
+
};
|
|
796
|
+
const printImmutableSeq = (val, config, indentation, depth, refs, printer) => {
|
|
797
|
+
const name = getImmutableName("Seq");
|
|
798
|
+
if (++depth > config.maxDepth) {
|
|
799
|
+
return printAsLeaf(name);
|
|
800
|
+
}
|
|
801
|
+
if (val[IS_KEYED_SENTINEL]) {
|
|
802
|
+
return `${name + SPACE}{${// from Immutable collection of entries or from ECMAScript object
|
|
803
|
+
val._iter || val._object ? (0, _collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer) : LAZY}}`;
|
|
804
|
+
}
|
|
805
|
+
return `${name + SPACE}[${val._iter || // from Immutable collection of values
|
|
806
|
+
val._array || // from ECMAScript array
|
|
807
|
+
val._collection || // from ECMAScript collection in immutable v4
|
|
808
|
+
val._iterable ? (0, _collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer) : LAZY}]`;
|
|
809
|
+
};
|
|
810
|
+
const printImmutableValues = (val, config, indentation, depth, refs, printer, type) => ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}[${(0, _collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer)}]`;
|
|
811
|
+
const serialize = (val, config, indentation, depth, refs, printer) => {
|
|
812
|
+
if (val[IS_MAP_SENTINEL]) {
|
|
813
|
+
return printImmutableEntries(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? "OrderedMap" : "Map");
|
|
814
|
+
}
|
|
815
|
+
if (val[IS_LIST_SENTINEL]) {
|
|
816
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer, "List");
|
|
817
|
+
}
|
|
818
|
+
if (val[IS_SET_SENTINEL]) {
|
|
819
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? "OrderedSet" : "Set");
|
|
820
|
+
}
|
|
821
|
+
if (val[IS_STACK_SENTINEL]) {
|
|
822
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer, "Stack");
|
|
823
|
+
}
|
|
824
|
+
if (val[IS_SEQ_SENTINEL]) {
|
|
825
|
+
return printImmutableSeq(val, config, indentation, depth, refs, printer);
|
|
826
|
+
}
|
|
827
|
+
return printImmutableRecord(val, config, indentation, depth, refs, printer);
|
|
828
|
+
};
|
|
829
|
+
exports2.serialize = serialize;
|
|
830
|
+
const test = (val) => val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
|
|
831
|
+
exports2.test = test;
|
|
832
|
+
const plugin = {
|
|
833
|
+
serialize,
|
|
834
|
+
test
|
|
835
|
+
};
|
|
836
|
+
exports2["default"] = plugin;
|
|
837
|
+
})
|
|
838
|
+
),
|
|
839
|
+
/***/
|
|
840
|
+
"./src/plugins/ReactElement.ts": (
|
|
841
|
+
/***/
|
|
842
|
+
((__unused_webpack_module, exports2, __webpack_require__2) => {
|
|
843
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
844
|
+
value: true
|
|
845
|
+
});
|
|
846
|
+
exports2.test = exports2.serialize = exports2["default"] = void 0;
|
|
847
|
+
var ReactIs = _interopRequireWildcard(require_react_is());
|
|
848
|
+
var _markup = __webpack_require__2("./src/plugins/lib/markup.ts");
|
|
849
|
+
function _interopRequireWildcard(e, t) {
|
|
850
|
+
if ("function" == typeof WeakMap) var r = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap();
|
|
851
|
+
return (_interopRequireWildcard = function(e2, t2) {
|
|
852
|
+
if (!t2 && e2 && e2.__esModule) return e2;
|
|
853
|
+
var o, i, f = { __proto__: null, default: e2 };
|
|
854
|
+
if (null === e2 || "object" != typeof e2 && "function" != typeof e2) return f;
|
|
855
|
+
if (o = t2 ? n : r) {
|
|
856
|
+
if (o.has(e2)) return o.get(e2);
|
|
857
|
+
o.set(e2, f);
|
|
858
|
+
}
|
|
859
|
+
for (const t3 in e2) "default" !== t3 && {}.hasOwnProperty.call(e2, t3) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e2, t3)) && (i.get || i.set) ? o(f, t3, i) : f[t3] = e2[t3]);
|
|
860
|
+
return f;
|
|
861
|
+
})(e, t);
|
|
862
|
+
}
|
|
863
|
+
const getChildren = (arg, children = []) => {
|
|
864
|
+
if (Array.isArray(arg)) {
|
|
865
|
+
for (const item of arg) {
|
|
866
|
+
getChildren(item, children);
|
|
867
|
+
}
|
|
868
|
+
} else if (arg != null && arg !== false && arg !== "") {
|
|
869
|
+
children.push(arg);
|
|
870
|
+
}
|
|
871
|
+
return children;
|
|
872
|
+
};
|
|
873
|
+
const getType = (element) => {
|
|
874
|
+
const type = element.type;
|
|
875
|
+
if (typeof type === "string") {
|
|
876
|
+
return type;
|
|
877
|
+
}
|
|
878
|
+
if (typeof type === "function") {
|
|
879
|
+
return type.displayName || type.name || "Unknown";
|
|
880
|
+
}
|
|
881
|
+
if (ReactIs.isFragment(element)) {
|
|
882
|
+
return "React.Fragment";
|
|
883
|
+
}
|
|
884
|
+
if (ReactIs.isSuspense(element)) {
|
|
885
|
+
return "React.Suspense";
|
|
886
|
+
}
|
|
887
|
+
if (typeof type === "object" && type !== null) {
|
|
888
|
+
if (ReactIs.isContextProvider(element)) {
|
|
889
|
+
return "Context.Provider";
|
|
890
|
+
}
|
|
891
|
+
if (ReactIs.isContextConsumer(element)) {
|
|
892
|
+
return "Context.Consumer";
|
|
893
|
+
}
|
|
894
|
+
if (ReactIs.isForwardRef(element)) {
|
|
895
|
+
if (type.displayName) {
|
|
896
|
+
return type.displayName;
|
|
897
|
+
}
|
|
898
|
+
const functionName = type.render.displayName || type.render.name || "";
|
|
899
|
+
return functionName === "" ? "ForwardRef" : `ForwardRef(${functionName})`;
|
|
900
|
+
}
|
|
901
|
+
if (ReactIs.isMemo(element)) {
|
|
902
|
+
const functionName = type.displayName || type.type.displayName || type.type.name || "";
|
|
903
|
+
return functionName === "" ? "Memo" : `Memo(${functionName})`;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
return "UNDEFINED";
|
|
907
|
+
};
|
|
908
|
+
const getPropKeys = (element) => {
|
|
909
|
+
const {
|
|
910
|
+
props
|
|
911
|
+
} = element;
|
|
912
|
+
return Object.keys(props).filter((key) => key !== "children" && props[key] !== void 0).sort();
|
|
913
|
+
};
|
|
914
|
+
const serialize = (element, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? (0, _markup.printElementAsLeaf)(getType(element), config) : (0, _markup.printElement)(getType(element), (0, _markup.printProps)(getPropKeys(element), element.props, config, indentation + config.indent, depth, refs, printer), (0, _markup.printChildren)(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
|
|
915
|
+
exports2.serialize = serialize;
|
|
916
|
+
const test = (val) => val != null && ReactIs.isElement(val);
|
|
917
|
+
exports2.test = test;
|
|
918
|
+
const plugin = {
|
|
919
|
+
serialize,
|
|
920
|
+
test
|
|
921
|
+
};
|
|
922
|
+
exports2["default"] = plugin;
|
|
923
|
+
})
|
|
924
|
+
),
|
|
925
|
+
/***/
|
|
926
|
+
"./src/plugins/ReactTestComponent.ts": (
|
|
927
|
+
/***/
|
|
928
|
+
((__unused_webpack_module, exports2, __webpack_require__2) => {
|
|
929
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
930
|
+
value: true
|
|
931
|
+
});
|
|
932
|
+
exports2.test = exports2.serialize = exports2["default"] = void 0;
|
|
933
|
+
var _markup = __webpack_require__2("./src/plugins/lib/markup.ts");
|
|
934
|
+
var Symbol2 = globalThis["jest-symbol-do-not-touch"] || globalThis.Symbol;
|
|
935
|
+
const testSymbol = typeof Symbol2 === "function" && Symbol2.for ? Symbol2.for("react.test.json") : 245830487;
|
|
936
|
+
const getPropKeys = (object) => {
|
|
937
|
+
const {
|
|
938
|
+
props
|
|
939
|
+
} = object;
|
|
940
|
+
return props ? Object.keys(props).filter((key) => props[key] !== void 0).sort() : [];
|
|
941
|
+
};
|
|
942
|
+
const serialize = (object, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? (0, _markup.printElementAsLeaf)(object.type, config) : (0, _markup.printElement)(object.type, object.props ? (0, _markup.printProps)(getPropKeys(object), object.props, config, indentation + config.indent, depth, refs, printer) : "", object.children ? (0, _markup.printChildren)(object.children, config, indentation + config.indent, depth, refs, printer) : "", config, indentation);
|
|
943
|
+
exports2.serialize = serialize;
|
|
944
|
+
const test = (val) => val && val.$$typeof === testSymbol;
|
|
945
|
+
exports2.test = test;
|
|
946
|
+
const plugin = {
|
|
947
|
+
serialize,
|
|
948
|
+
test
|
|
949
|
+
};
|
|
950
|
+
exports2["default"] = plugin;
|
|
951
|
+
})
|
|
952
|
+
),
|
|
953
|
+
/***/
|
|
954
|
+
"./src/plugins/lib/escapeHTML.ts": (
|
|
955
|
+
/***/
|
|
956
|
+
((__unused_webpack_module, exports2) => {
|
|
957
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
958
|
+
value: true
|
|
959
|
+
});
|
|
960
|
+
exports2["default"] = escapeHTML;
|
|
961
|
+
function escapeHTML(str) {
|
|
962
|
+
return str.replaceAll("<", "<").replaceAll(">", ">");
|
|
963
|
+
}
|
|
964
|
+
})
|
|
965
|
+
),
|
|
966
|
+
/***/
|
|
967
|
+
"./src/plugins/lib/markup.ts": (
|
|
968
|
+
/***/
|
|
969
|
+
((__unused_webpack_module, exports2, __webpack_require__2) => {
|
|
970
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
971
|
+
value: true
|
|
972
|
+
});
|
|
973
|
+
exports2.printText = exports2.printProps = exports2.printElementAsLeaf = exports2.printElement = exports2.printComment = exports2.printChildren = void 0;
|
|
974
|
+
var _escapeHTML = _interopRequireDefault(__webpack_require__2("./src/plugins/lib/escapeHTML.ts"));
|
|
975
|
+
function _interopRequireDefault(e) {
|
|
976
|
+
return e && e.__esModule ? e : { default: e };
|
|
977
|
+
}
|
|
978
|
+
const printProps = (keys, props, config, indentation, depth, refs, printer) => {
|
|
979
|
+
const indentationNext = indentation + config.indent;
|
|
980
|
+
const colors = config.colors;
|
|
981
|
+
return keys.map((key) => {
|
|
982
|
+
const value = props[key];
|
|
983
|
+
let printed = printer(value, config, indentationNext, depth, refs);
|
|
984
|
+
if (typeof value !== "string") {
|
|
985
|
+
if (printed.includes("\n")) {
|
|
986
|
+
printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
|
|
987
|
+
}
|
|
988
|
+
printed = `{${printed}}`;
|
|
989
|
+
}
|
|
990
|
+
return `${config.spacingInner + indentation + colors.prop.open + key + colors.prop.close}=${colors.value.open}${printed}${colors.value.close}`;
|
|
991
|
+
}).join("");
|
|
992
|
+
};
|
|
993
|
+
exports2.printProps = printProps;
|
|
994
|
+
const printChildren = (children, config, indentation, depth, refs, printer) => children.map((child) => config.spacingOuter + indentation + (typeof child === "string" ? printText(child, config) : printer(child, config, indentation, depth, refs))).join("");
|
|
995
|
+
exports2.printChildren = printChildren;
|
|
996
|
+
const printText = (text, config) => {
|
|
997
|
+
const contentColor = config.colors.content;
|
|
998
|
+
return contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close;
|
|
999
|
+
};
|
|
1000
|
+
exports2.printText = printText;
|
|
1001
|
+
const printComment = (comment, config) => {
|
|
1002
|
+
const commentColor = config.colors.comment;
|
|
1003
|
+
return `${commentColor.open}<!--${(0, _escapeHTML.default)(comment)}-->${commentColor.close}`;
|
|
1004
|
+
};
|
|
1005
|
+
exports2.printComment = printComment;
|
|
1006
|
+
const printElement = (type, printedProps, printedChildren, config, indentation) => {
|
|
1007
|
+
const tagColor = config.colors.tag;
|
|
1008
|
+
return `${tagColor.open}<${type}${printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open}${printedChildren ? `>${tagColor.close}${printedChildren}${config.spacingOuter}${indentation}${tagColor.open}</${type}` : `${printedProps && !config.min ? "" : " "}/`}>${tagColor.close}`;
|
|
1009
|
+
};
|
|
1010
|
+
exports2.printElement = printElement;
|
|
1011
|
+
const printElementAsLeaf = (type, config) => {
|
|
1012
|
+
const tagColor = config.colors.tag;
|
|
1013
|
+
return `${tagColor.open}<${type}${tagColor.close} \u2026${tagColor.open} />${tagColor.close}`;
|
|
1014
|
+
};
|
|
1015
|
+
exports2.printElementAsLeaf = printElementAsLeaf;
|
|
1016
|
+
})
|
|
1017
|
+
)
|
|
1018
|
+
/******/
|
|
1019
|
+
};
|
|
1020
|
+
var __webpack_module_cache__ = {};
|
|
1021
|
+
function __webpack_require__(moduleId) {
|
|
1022
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
1023
|
+
if (cachedModule !== void 0) {
|
|
1024
|
+
return cachedModule.exports;
|
|
1025
|
+
}
|
|
1026
|
+
var module2 = __webpack_module_cache__[moduleId] = {
|
|
1027
|
+
/******/
|
|
1028
|
+
// no module.id needed
|
|
1029
|
+
/******/
|
|
1030
|
+
// no module.loaded needed
|
|
1031
|
+
/******/
|
|
1032
|
+
exports: {}
|
|
1033
|
+
/******/
|
|
1034
|
+
};
|
|
1035
|
+
__webpack_modules__[moduleId](module2, module2.exports, __webpack_require__);
|
|
1036
|
+
return module2.exports;
|
|
1037
|
+
}
|
|
1038
|
+
var __webpack_exports__ = {};
|
|
1039
|
+
(() => {
|
|
1040
|
+
var exports2 = __webpack_exports__;
|
|
1041
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
1042
|
+
value: true
|
|
1043
|
+
});
|
|
1044
|
+
exports2["default"] = exports2.DEFAULT_OPTIONS = void 0;
|
|
1045
|
+
exports2.format = format;
|
|
1046
|
+
exports2.plugins = void 0;
|
|
1047
|
+
var _ansiStyles = _interopRequireDefault(require_ansi_styles());
|
|
1048
|
+
var _collections = __webpack_require__("./src/collections.ts");
|
|
1049
|
+
var _AsymmetricMatcher = _interopRequireDefault(__webpack_require__("./src/plugins/AsymmetricMatcher.ts"));
|
|
1050
|
+
var _DOMCollection = _interopRequireDefault(__webpack_require__("./src/plugins/DOMCollection.ts"));
|
|
1051
|
+
var _DOMElement = _interopRequireDefault(__webpack_require__("./src/plugins/DOMElement.ts"));
|
|
1052
|
+
var _Immutable = _interopRequireDefault(__webpack_require__("./src/plugins/Immutable.ts"));
|
|
1053
|
+
var _ReactElement = _interopRequireDefault(__webpack_require__("./src/plugins/ReactElement.ts"));
|
|
1054
|
+
var _ReactTestComponent = _interopRequireDefault(__webpack_require__("./src/plugins/ReactTestComponent.ts"));
|
|
1055
|
+
function _interopRequireDefault(e) {
|
|
1056
|
+
return e && e.__esModule ? e : { default: e };
|
|
1057
|
+
}
|
|
1058
|
+
const src_toString = Object.prototype.toString;
|
|
1059
|
+
const toISOString = Date.prototype.toISOString;
|
|
1060
|
+
const errorToString = Error.prototype.toString;
|
|
1061
|
+
const regExpToString = RegExp.prototype.toString;
|
|
1062
|
+
const getConstructorName = (val) => typeof val.constructor === "function" && val.constructor.name || "Object";
|
|
1063
|
+
const isWindow = (val) => (
|
|
1064
|
+
// eslint-disable-next-line unicorn/prefer-global-this
|
|
1065
|
+
typeof window !== "undefined" && val === window
|
|
1066
|
+
);
|
|
1067
|
+
const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
|
|
1068
|
+
const NEWLINE_REGEXP = /\n/gi;
|
|
1069
|
+
class PrettyFormatPluginError extends Error {
|
|
1070
|
+
constructor(message, stack) {
|
|
1071
|
+
super(message);
|
|
1072
|
+
this.stack = stack;
|
|
1073
|
+
this.name = this.constructor.name;
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
function isToStringedArrayType(toStringed) {
|
|
1077
|
+
return toStringed === "[object Array]" || toStringed === "[object ArrayBuffer]" || toStringed === "[object DataView]" || toStringed === "[object Float32Array]" || toStringed === "[object Float64Array]" || toStringed === "[object Int8Array]" || toStringed === "[object Int16Array]" || toStringed === "[object Int32Array]" || toStringed === "[object Uint8Array]" || toStringed === "[object Uint8ClampedArray]" || toStringed === "[object Uint16Array]" || toStringed === "[object Uint32Array]";
|
|
1078
|
+
}
|
|
1079
|
+
function printNumber(val) {
|
|
1080
|
+
return Object.is(val, -0) ? "-0" : String(val);
|
|
1081
|
+
}
|
|
1082
|
+
function printBigInt(val) {
|
|
1083
|
+
return String(`${val}n`);
|
|
1084
|
+
}
|
|
1085
|
+
function printFunction(val, printFunctionName) {
|
|
1086
|
+
if (!printFunctionName) {
|
|
1087
|
+
return "[Function]";
|
|
1088
|
+
}
|
|
1089
|
+
return `[Function ${val.name || "anonymous"}]`;
|
|
1090
|
+
}
|
|
1091
|
+
function printSymbol(val) {
|
|
1092
|
+
return String(val).replace(SYMBOL_REGEXP, "Symbol($1)");
|
|
1093
|
+
}
|
|
1094
|
+
function printError(val) {
|
|
1095
|
+
return `[${errorToString.call(val)}]`;
|
|
1096
|
+
}
|
|
1097
|
+
function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
|
|
1098
|
+
if (val === true || val === false) {
|
|
1099
|
+
return `${val}`;
|
|
1100
|
+
}
|
|
1101
|
+
if (val === void 0) {
|
|
1102
|
+
return "undefined";
|
|
1103
|
+
}
|
|
1104
|
+
if (val === null) {
|
|
1105
|
+
return "null";
|
|
1106
|
+
}
|
|
1107
|
+
const typeOf = typeof val;
|
|
1108
|
+
if (typeOf === "number") {
|
|
1109
|
+
return printNumber(val);
|
|
1110
|
+
}
|
|
1111
|
+
if (typeOf === "bigint") {
|
|
1112
|
+
return printBigInt(val);
|
|
1113
|
+
}
|
|
1114
|
+
if (typeOf === "string") {
|
|
1115
|
+
if (escapeString) {
|
|
1116
|
+
return `"${val.replaceAll(/"|\\/g, "\\$&")}"`;
|
|
1117
|
+
}
|
|
1118
|
+
return `"${val}"`;
|
|
1119
|
+
}
|
|
1120
|
+
if (typeOf === "function") {
|
|
1121
|
+
return printFunction(val, printFunctionName);
|
|
1122
|
+
}
|
|
1123
|
+
if (typeOf === "symbol") {
|
|
1124
|
+
return printSymbol(val);
|
|
1125
|
+
}
|
|
1126
|
+
const toStringed = src_toString.call(val);
|
|
1127
|
+
if (toStringed === "[object Promise]") {
|
|
1128
|
+
return "Promise {}";
|
|
1129
|
+
}
|
|
1130
|
+
if (toStringed === "[object WeakMap]") {
|
|
1131
|
+
return "WeakMap {}";
|
|
1132
|
+
}
|
|
1133
|
+
if (toStringed === "[object WeakSet]") {
|
|
1134
|
+
return "WeakSet {}";
|
|
1135
|
+
}
|
|
1136
|
+
if (toStringed === "[object Function]" || toStringed === "[object GeneratorFunction]") {
|
|
1137
|
+
return printFunction(val, printFunctionName);
|
|
1138
|
+
}
|
|
1139
|
+
if (toStringed === "[object Symbol]") {
|
|
1140
|
+
return printSymbol(val);
|
|
1141
|
+
}
|
|
1142
|
+
if (toStringed === "[object Date]") {
|
|
1143
|
+
return Number.isNaN(+val) ? "Date { NaN }" : toISOString.call(val);
|
|
1144
|
+
}
|
|
1145
|
+
if (toStringed === "[object Error]") {
|
|
1146
|
+
return printError(val);
|
|
1147
|
+
}
|
|
1148
|
+
if (toStringed === "[object RegExp]") {
|
|
1149
|
+
if (escapeRegex) {
|
|
1150
|
+
return regExpToString.call(val).replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&");
|
|
1151
|
+
}
|
|
1152
|
+
return regExpToString.call(val);
|
|
1153
|
+
}
|
|
1154
|
+
if (val instanceof Error) {
|
|
1155
|
+
return printError(val);
|
|
1156
|
+
}
|
|
1157
|
+
return null;
|
|
1158
|
+
}
|
|
1159
|
+
function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
1160
|
+
if (refs.includes(val)) {
|
|
1161
|
+
return "[Circular]";
|
|
1162
|
+
}
|
|
1163
|
+
refs = [...refs];
|
|
1164
|
+
refs.push(val);
|
|
1165
|
+
const hitMaxDepth = ++depth > config.maxDepth;
|
|
1166
|
+
const min = config.min;
|
|
1167
|
+
if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === "function" && !hasCalledToJSON) {
|
|
1168
|
+
return printer(val.toJSON(), config, indentation, depth, refs, true);
|
|
1169
|
+
}
|
|
1170
|
+
const toStringed = src_toString.call(val);
|
|
1171
|
+
if (toStringed === "[object Arguments]") {
|
|
1172
|
+
return hitMaxDepth ? "[Arguments]" : `${min ? "" : "Arguments "}[${(0, _collections.printListItems)(val, config, indentation, depth, refs, printer)}]`;
|
|
1173
|
+
}
|
|
1174
|
+
if (isToStringedArrayType(toStringed)) {
|
|
1175
|
+
return hitMaxDepth ? `[${val.constructor.name}]` : `${min ? "" : !config.printBasicPrototype && val.constructor.name === "Array" ? "" : `${val.constructor.name} `}[${(0, _collections.printListItems)(val, config, indentation, depth, refs, printer)}]`;
|
|
1176
|
+
}
|
|
1177
|
+
if (toStringed === "[object Map]") {
|
|
1178
|
+
return hitMaxDepth ? "[Map]" : `Map {${(0, _collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer, " => ")}}`;
|
|
1179
|
+
}
|
|
1180
|
+
if (toStringed === "[object Set]") {
|
|
1181
|
+
return hitMaxDepth ? "[Set]" : `Set {${(0, _collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer)}}`;
|
|
1182
|
+
}
|
|
1183
|
+
return hitMaxDepth || isWindow(val) ? `[${getConstructorName(val)}]` : `${min ? "" : !config.printBasicPrototype && getConstructorName(val) === "Object" ? "" : `${getConstructorName(val)} `}{${(0, _collections.printObjectProperties)(val, config, indentation, depth, refs, printer)}}`;
|
|
1184
|
+
}
|
|
1185
|
+
function isNewPlugin(plugin) {
|
|
1186
|
+
return plugin.serialize != null;
|
|
1187
|
+
}
|
|
1188
|
+
function printPlugin(plugin, val, config, indentation, depth, refs) {
|
|
1189
|
+
let printed;
|
|
1190
|
+
try {
|
|
1191
|
+
printed = isNewPlugin(plugin) ? plugin.serialize(val, config, indentation, depth, refs, printer) : plugin.print(val, (valChild) => printer(valChild, config, indentation, depth, refs), (str) => {
|
|
1192
|
+
const indentationNext = indentation + config.indent;
|
|
1193
|
+
return indentationNext + str.replaceAll(NEWLINE_REGEXP, `
|
|
1194
|
+
${indentationNext}`);
|
|
1195
|
+
}, {
|
|
1196
|
+
edgeSpacing: config.spacingOuter,
|
|
1197
|
+
min: config.min,
|
|
1198
|
+
spacing: config.spacingInner
|
|
1199
|
+
}, config.colors);
|
|
1200
|
+
} catch (error) {
|
|
1201
|
+
throw new PrettyFormatPluginError(error.message, error.stack);
|
|
1202
|
+
}
|
|
1203
|
+
if (typeof printed !== "string") {
|
|
1204
|
+
throw new TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`);
|
|
1205
|
+
}
|
|
1206
|
+
return printed;
|
|
1207
|
+
}
|
|
1208
|
+
function findPlugin(plugins2, val) {
|
|
1209
|
+
for (const plugin of plugins2) {
|
|
1210
|
+
try {
|
|
1211
|
+
if (plugin.test(val)) {
|
|
1212
|
+
return plugin;
|
|
1213
|
+
}
|
|
1214
|
+
} catch (error) {
|
|
1215
|
+
throw new PrettyFormatPluginError(error.message, error.stack);
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
return null;
|
|
1219
|
+
}
|
|
1220
|
+
function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
1221
|
+
const plugin = findPlugin(config.plugins, val);
|
|
1222
|
+
if (plugin !== null) {
|
|
1223
|
+
return printPlugin(plugin, val, config, indentation, depth, refs);
|
|
1224
|
+
}
|
|
1225
|
+
const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString);
|
|
1226
|
+
if (basicResult !== null) {
|
|
1227
|
+
return basicResult;
|
|
1228
|
+
}
|
|
1229
|
+
return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
|
|
1230
|
+
}
|
|
1231
|
+
const DEFAULT_THEME = {
|
|
1232
|
+
comment: "gray",
|
|
1233
|
+
content: "reset",
|
|
1234
|
+
prop: "yellow",
|
|
1235
|
+
tag: "cyan",
|
|
1236
|
+
value: "green"
|
|
1237
|
+
};
|
|
1238
|
+
const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
|
|
1239
|
+
const toOptionsSubtype = (options) => options;
|
|
1240
|
+
const DEFAULT_OPTIONS = exports2.DEFAULT_OPTIONS = toOptionsSubtype({
|
|
1241
|
+
callToJSON: true,
|
|
1242
|
+
compareKeys: void 0,
|
|
1243
|
+
escapeRegex: false,
|
|
1244
|
+
escapeString: true,
|
|
1245
|
+
highlight: false,
|
|
1246
|
+
indent: 2,
|
|
1247
|
+
maxDepth: Number.POSITIVE_INFINITY,
|
|
1248
|
+
maxWidth: Number.POSITIVE_INFINITY,
|
|
1249
|
+
min: false,
|
|
1250
|
+
plugins: [],
|
|
1251
|
+
printBasicPrototype: true,
|
|
1252
|
+
printFunctionName: true,
|
|
1253
|
+
theme: DEFAULT_THEME
|
|
1254
|
+
});
|
|
1255
|
+
function validateOptions(options) {
|
|
1256
|
+
for (const key of Object.keys(options)) {
|
|
1257
|
+
if (!Object.prototype.hasOwnProperty.call(DEFAULT_OPTIONS, key)) {
|
|
1258
|
+
throw new Error(`pretty-format: Unknown option "${key}".`);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
if (options.min && options.indent !== void 0 && options.indent !== 0) {
|
|
1262
|
+
throw new Error('pretty-format: Options "min" and "indent" cannot be used together.');
|
|
1263
|
+
}
|
|
1264
|
+
if (options.theme !== void 0) {
|
|
1265
|
+
if (options.theme === null) {
|
|
1266
|
+
throw new Error('pretty-format: Option "theme" must not be null.');
|
|
1267
|
+
}
|
|
1268
|
+
if (typeof options.theme !== "object") {
|
|
1269
|
+
throw new TypeError(`pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".`);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
const getColorsHighlight = (options) => DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
1274
|
+
const value = options.theme && options.theme[key] !== void 0 ? options.theme[key] : DEFAULT_THEME[key];
|
|
1275
|
+
const color = value && _ansiStyles.default[value];
|
|
1276
|
+
if (color && typeof color.close === "string" && typeof color.open === "string") {
|
|
1277
|
+
colors[key] = color;
|
|
1278
|
+
} else {
|
|
1279
|
+
throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`);
|
|
1280
|
+
}
|
|
1281
|
+
return colors;
|
|
1282
|
+
}, /* @__PURE__ */ Object.create(null));
|
|
1283
|
+
const getColorsEmpty = () => DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
1284
|
+
colors[key] = {
|
|
1285
|
+
close: "",
|
|
1286
|
+
open: ""
|
|
1287
|
+
};
|
|
1288
|
+
return colors;
|
|
1289
|
+
}, /* @__PURE__ */ Object.create(null));
|
|
1290
|
+
const getPrintFunctionName = (options) => options?.printFunctionName ?? DEFAULT_OPTIONS.printFunctionName;
|
|
1291
|
+
const getEscapeRegex = (options) => options?.escapeRegex ?? DEFAULT_OPTIONS.escapeRegex;
|
|
1292
|
+
const getEscapeString = (options) => options?.escapeString ?? DEFAULT_OPTIONS.escapeString;
|
|
1293
|
+
const getConfig = (options) => ({
|
|
1294
|
+
callToJSON: options?.callToJSON ?? DEFAULT_OPTIONS.callToJSON,
|
|
1295
|
+
colors: options?.highlight ? getColorsHighlight(options) : getColorsEmpty(),
|
|
1296
|
+
compareKeys: typeof options?.compareKeys === "function" || options?.compareKeys === null ? options.compareKeys : DEFAULT_OPTIONS.compareKeys,
|
|
1297
|
+
escapeRegex: getEscapeRegex(options),
|
|
1298
|
+
escapeString: getEscapeString(options),
|
|
1299
|
+
indent: options?.min ? "" : createIndent(options?.indent ?? DEFAULT_OPTIONS.indent),
|
|
1300
|
+
maxDepth: options?.maxDepth ?? DEFAULT_OPTIONS.maxDepth,
|
|
1301
|
+
maxWidth: options?.maxWidth ?? DEFAULT_OPTIONS.maxWidth,
|
|
1302
|
+
min: options?.min ?? DEFAULT_OPTIONS.min,
|
|
1303
|
+
plugins: options?.plugins ?? DEFAULT_OPTIONS.plugins,
|
|
1304
|
+
printBasicPrototype: options?.printBasicPrototype ?? true,
|
|
1305
|
+
printFunctionName: getPrintFunctionName(options),
|
|
1306
|
+
spacingInner: options?.min ? " " : "\n",
|
|
1307
|
+
spacingOuter: options?.min ? "" : "\n"
|
|
1308
|
+
});
|
|
1309
|
+
function createIndent(indent) {
|
|
1310
|
+
return Array.from({
|
|
1311
|
+
length: indent + 1
|
|
1312
|
+
}).join(" ");
|
|
1313
|
+
}
|
|
1314
|
+
function format(val, options) {
|
|
1315
|
+
if (options) {
|
|
1316
|
+
validateOptions(options);
|
|
1317
|
+
if (options.plugins) {
|
|
1318
|
+
const plugin = findPlugin(options.plugins, val);
|
|
1319
|
+
if (plugin !== null) {
|
|
1320
|
+
return printPlugin(plugin, val, getConfig(options), "", 0, []);
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
const basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options), getEscapeString(options));
|
|
1325
|
+
if (basicResult !== null) {
|
|
1326
|
+
return basicResult;
|
|
1327
|
+
}
|
|
1328
|
+
return printComplexValue(val, getConfig(options), "", 0, []);
|
|
1329
|
+
}
|
|
1330
|
+
exports2.plugins = {
|
|
1331
|
+
AsymmetricMatcher: _AsymmetricMatcher.default,
|
|
1332
|
+
DOMCollection: _DOMCollection.default,
|
|
1333
|
+
DOMElement: _DOMElement.default,
|
|
1334
|
+
Immutable: _Immutable.default,
|
|
1335
|
+
ReactElement: _ReactElement.default,
|
|
1336
|
+
ReactTestComponent: _ReactTestComponent.default
|
|
1337
|
+
};
|
|
1338
|
+
exports2["default"] = format;
|
|
1339
|
+
})();
|
|
1340
|
+
module.exports = __webpack_exports__;
|
|
1341
|
+
})();
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
2
1344
|
|
|
3
1345
|
// src/utils/validates.ts
|
|
4
1346
|
function isBase64(link) {
|
|
5
1347
|
if (!link || typeof link !== "string") return false;
|
|
1348
|
+
if (link.length < 18) return false;
|
|
6
1349
|
return link.startsWith("data:image/") && link.includes(";base64");
|
|
7
1350
|
}
|
|
1351
|
+
|
|
1352
|
+
// src/formatter.ts
|
|
1353
|
+
var import_pretty_format = __toESM(require_build());
|
|
1354
|
+
var prettyFormat = typeof import_pretty_format.default === "function" ? import_pretty_format.default : import_pretty_format.default.format;
|
|
1355
|
+
var EXCLUDED_ERROR_PROPS = /* @__PURE__ */ new Set(["name", "message", "stack", "cause"]);
|
|
8
1356
|
var Formatter = class {
|
|
9
1357
|
/**
|
|
10
1358
|
* Check if a field should be filtered based on configured rules
|
|
@@ -97,23 +1445,26 @@ var Formatter = class {
|
|
|
97
1445
|
* Sanitize sensitive data from stack traces
|
|
98
1446
|
*/
|
|
99
1447
|
static sanitizeStackTrace(stack, customPatterns) {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
allPatterns.forEach((pattern) => {
|
|
110
|
-
sanitized = sanitized.replace(pattern, (match, p1) => {
|
|
111
|
-
if (p1) {
|
|
112
|
-
return `${p1}***REDACTED***`;
|
|
113
|
-
}
|
|
114
|
-
return "***REDACTED***";
|
|
115
|
-
});
|
|
1448
|
+
const combinedDefaultPattern = /([?&])(token|key|secret|password|auth|api[_-]?key|access[_-]?token|client[_-]?secret)=[^&\s)#]*|\/\/[^/]*:[^@]*@|(bearer\s+)[a-zA-Z0-9\-._~+/]+=*/gi;
|
|
1449
|
+
let sanitized = stack.replace(combinedDefaultPattern, (match, urlParam, _tokenKey, bearer) => {
|
|
1450
|
+
if (urlParam) {
|
|
1451
|
+
return `${urlParam}***REDACTED***`;
|
|
1452
|
+
}
|
|
1453
|
+
if (bearer) {
|
|
1454
|
+
return `${bearer}***REDACTED***`;
|
|
1455
|
+
}
|
|
1456
|
+
return "***REDACTED***";
|
|
116
1457
|
});
|
|
1458
|
+
if (customPatterns && customPatterns.length > 0) {
|
|
1459
|
+
for (const pattern of customPatterns) {
|
|
1460
|
+
sanitized = sanitized.replace(pattern, (match, p1) => {
|
|
1461
|
+
if (p1) {
|
|
1462
|
+
return `${p1}***REDACTED***`;
|
|
1463
|
+
}
|
|
1464
|
+
return "***REDACTED***";
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
117
1468
|
return sanitized;
|
|
118
1469
|
}
|
|
119
1470
|
/**
|
|
@@ -154,14 +1505,14 @@ var Formatter = class {
|
|
|
154
1505
|
if (includeCause && error.cause !== void 0) {
|
|
155
1506
|
if (error.cause instanceof Error) {
|
|
156
1507
|
const serializedCause = this.serializeError(error.cause, config, currentDepth + 1);
|
|
157
|
-
serialized.cause = typeof serializedCause === "string" ? serializedCause : serializedCause;
|
|
1508
|
+
serialized.cause = typeof serializedCause === "string" ? { name: "Error", message: serializedCause } : serializedCause;
|
|
158
1509
|
} else {
|
|
159
1510
|
serialized.cause = error.cause;
|
|
160
1511
|
}
|
|
161
1512
|
}
|
|
162
1513
|
for (const key in error) {
|
|
163
1514
|
if (Object.prototype.hasOwnProperty.call(error, key)) {
|
|
164
|
-
if (!
|
|
1515
|
+
if (!EXCLUDED_ERROR_PROPS.has(key)) {
|
|
165
1516
|
const errorWithCustomProps = error;
|
|
166
1517
|
serialized[key] = errorWithCustomProps[key];
|
|
167
1518
|
}
|
|
@@ -211,14 +1562,15 @@ var Formatter = class {
|
|
|
211
1562
|
if (obj instanceof Error) {
|
|
212
1563
|
return this.serializeError(obj, filterOptions?.errorConfig, 0);
|
|
213
1564
|
}
|
|
214
|
-
if (typeof obj === "string"
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
1565
|
+
if (typeof obj === "string") {
|
|
1566
|
+
if (isBase64(obj)) {
|
|
1567
|
+
return this.formatBase64String(obj);
|
|
1568
|
+
}
|
|
1569
|
+
const stringLimit = filterOptions?.truncate?.string;
|
|
1570
|
+
if (stringLimit !== void 0 && obj.length > stringLimit) {
|
|
1571
|
+
return `${obj.slice(0, stringLimit)}... [${obj.length} chars]`;
|
|
1572
|
+
}
|
|
1573
|
+
return obj;
|
|
222
1574
|
}
|
|
223
1575
|
if (obj instanceof File) {
|
|
224
1576
|
return {
|
|
@@ -228,8 +1580,17 @@ var Formatter = class {
|
|
|
228
1580
|
lastModified: obj.lastModified
|
|
229
1581
|
};
|
|
230
1582
|
}
|
|
1583
|
+
if (obj instanceof Blob) {
|
|
1584
|
+
return {
|
|
1585
|
+
size: obj.size,
|
|
1586
|
+
type: obj.type
|
|
1587
|
+
};
|
|
1588
|
+
}
|
|
231
1589
|
if (Array.isArray(obj)) {
|
|
232
|
-
|
|
1590
|
+
const arrayLimit = filterOptions?.truncate?.array;
|
|
1591
|
+
const sourceItems = arrayLimit !== void 0 && obj.length > arrayLimit ? obj.slice(0, arrayLimit) : obj;
|
|
1592
|
+
const remainder = obj.length - sourceItems.length;
|
|
1593
|
+
const result = sourceItems.map(
|
|
233
1594
|
(item, index) => this.serializeSpecialObjects(
|
|
234
1595
|
item,
|
|
235
1596
|
maxDepth,
|
|
@@ -238,55 +1599,64 @@ var Formatter = class {
|
|
|
238
1599
|
[...currentPath, `[${index}]`]
|
|
239
1600
|
)
|
|
240
1601
|
);
|
|
1602
|
+
if (remainder > 0) {
|
|
1603
|
+
result.push(`... +${remainder} more`);
|
|
1604
|
+
}
|
|
1605
|
+
return result;
|
|
241
1606
|
}
|
|
242
1607
|
if (obj !== null && typeof obj === "object") {
|
|
243
1608
|
const serialized = {};
|
|
1609
|
+
const fieldLimit = filterOptions?.truncate?.fields;
|
|
1610
|
+
const includableEntries = [];
|
|
244
1611
|
for (const key in obj) {
|
|
245
1612
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
246
1613
|
const value = obj[key];
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
key,
|
|
1614
|
+
const { include, filtered } = this.shouldIncludeField(key, value, currentPath, filterOptions);
|
|
1615
|
+
if (include) {
|
|
1616
|
+
includableEntries.push({ key, value, filtered });
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
const visibleCount = fieldLimit !== void 0 ? Math.min(fieldLimit, includableEntries.length) : includableEntries.length;
|
|
1621
|
+
const remainder = includableEntries.length - visibleCount;
|
|
1622
|
+
for (let i = 0; i < visibleCount; i++) {
|
|
1623
|
+
const { key, value, filtered } = includableEntries[i];
|
|
1624
|
+
const newPath = [...currentPath, key];
|
|
1625
|
+
let isGloballyFiltered = false;
|
|
1626
|
+
if (filterOptions?.filterFields && filterOptions.filterFields.length > 0) {
|
|
1627
|
+
isGloballyFiltered = this.shouldFilterField(key, value, currentPath, filterOptions.filterFields);
|
|
1628
|
+
}
|
|
1629
|
+
if (isGloballyFiltered) {
|
|
1630
|
+
const filteredValue = this.getFilteredValue(
|
|
250
1631
|
value,
|
|
251
|
-
|
|
252
|
-
filterOptions
|
|
1632
|
+
filterOptions?.globalFilterMode,
|
|
1633
|
+
filterOptions?.globalFilterReplacement
|
|
253
1634
|
);
|
|
254
|
-
if (
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
let isGloballyFiltered = false;
|
|
258
|
-
if (filterOptions?.filterFields && filterOptions.filterFields.length > 0) {
|
|
259
|
-
isGloballyFiltered = this.shouldFilterField(key, value, currentPath, filterOptions.filterFields);
|
|
260
|
-
}
|
|
261
|
-
if (isGloballyFiltered) {
|
|
262
|
-
const filteredValue = this.getFilteredValue(
|
|
263
|
-
value,
|
|
264
|
-
filterOptions?.globalFilterMode,
|
|
265
|
-
filterOptions?.globalFilterReplacement
|
|
266
|
-
);
|
|
267
|
-
if (filteredValue !== void 0) {
|
|
268
|
-
serialized[key] = filteredValue;
|
|
269
|
-
}
|
|
270
|
-
} else if (filtered) {
|
|
271
|
-
const filteredValue = this.getFilteredValue(
|
|
272
|
-
value,
|
|
273
|
-
filterOptions?.filterMode,
|
|
274
|
-
filterOptions?.filterReplacement
|
|
275
|
-
);
|
|
276
|
-
if (filteredValue !== void 0) {
|
|
277
|
-
serialized[key] = filteredValue;
|
|
278
|
-
}
|
|
279
|
-
} else {
|
|
280
|
-
serialized[key] = this.serializeSpecialObjects(
|
|
281
|
-
value,
|
|
282
|
-
maxDepth,
|
|
283
|
-
currentDepth + 1,
|
|
284
|
-
filterOptions,
|
|
285
|
-
newPath
|
|
286
|
-
);
|
|
1635
|
+
if (filteredValue !== void 0) {
|
|
1636
|
+
serialized[key] = filteredValue;
|
|
287
1637
|
}
|
|
1638
|
+
} else if (filtered) {
|
|
1639
|
+
const filteredValue = this.getFilteredValue(
|
|
1640
|
+
value,
|
|
1641
|
+
filterOptions?.filterMode,
|
|
1642
|
+
filterOptions?.filterReplacement
|
|
1643
|
+
);
|
|
1644
|
+
if (filteredValue !== void 0) {
|
|
1645
|
+
serialized[key] = filteredValue;
|
|
1646
|
+
}
|
|
1647
|
+
} else {
|
|
1648
|
+
serialized[key] = this.serializeSpecialObjects(
|
|
1649
|
+
value,
|
|
1650
|
+
maxDepth,
|
|
1651
|
+
currentDepth + 1,
|
|
1652
|
+
filterOptions,
|
|
1653
|
+
newPath
|
|
1654
|
+
);
|
|
288
1655
|
}
|
|
289
1656
|
}
|
|
1657
|
+
if (remainder > 0) {
|
|
1658
|
+
serialized["..."] = `+${remainder} more fields`;
|
|
1659
|
+
}
|
|
290
1660
|
return serialized;
|
|
291
1661
|
}
|
|
292
1662
|
return obj;
|
|
@@ -315,15 +1685,16 @@ var Formatter = class {
|
|
|
315
1685
|
filterReplacement: options?.filterReplacement,
|
|
316
1686
|
globalFilterMode: options?.globalFilterMode,
|
|
317
1687
|
globalFilterReplacement: options?.globalFilterReplacement,
|
|
318
|
-
errorConfig: options?.errorConfig
|
|
1688
|
+
errorConfig: options?.errorConfig,
|
|
1689
|
+
truncate: options?.truncate
|
|
319
1690
|
}
|
|
320
1691
|
);
|
|
321
|
-
const formatted =
|
|
1692
|
+
const formatted = prettyFormat(serialized, {
|
|
322
1693
|
indent: 2,
|
|
323
1694
|
maxDepth,
|
|
324
|
-
// Remove Object and Array labels
|
|
325
1695
|
printFunctionName: false,
|
|
326
|
-
printBasicPrototype: false
|
|
1696
|
+
printBasicPrototype: false,
|
|
1697
|
+
compareKeys: null
|
|
327
1698
|
});
|
|
328
1699
|
const cleaned = formatted.replace(/^Object\s*/, "").replace(/^Array\s*/, "").replace(/\nObject\s*/g, "\n").replace(/\nArray\s*/g, "\n");
|
|
329
1700
|
return "\n" + cleaned;
|
|
@@ -390,56 +1761,41 @@ var styler_default = Styler;
|
|
|
390
1761
|
// src/namespace-matcher.ts
|
|
391
1762
|
var NamespaceMatcher = class {
|
|
392
1763
|
constructor() {
|
|
393
|
-
this.
|
|
1764
|
+
this.cachedPositivePatterns = [];
|
|
1765
|
+
this.cachedNegativePatterns = [];
|
|
394
1766
|
this.cachedConfig = void 0;
|
|
395
1767
|
}
|
|
396
1768
|
matches(namespace, namespaces) {
|
|
397
1769
|
const ns = this.normalize(namespace);
|
|
398
1770
|
if (this.cachedConfig !== namespaces) {
|
|
399
|
-
this.
|
|
1771
|
+
this.parseAndCachePatterns(namespaces);
|
|
400
1772
|
this.cachedConfig = namespaces;
|
|
401
1773
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
negativePatterns.push(pattern.slice(1));
|
|
409
|
-
} else {
|
|
410
|
-
positivePatterns.push(pattern);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
const matches = positivePatterns.some((pattern) => {
|
|
414
|
-
if (pattern === "*") return true;
|
|
415
|
-
const normalizedPattern = this.normalize(pattern);
|
|
416
|
-
if (pattern.includes("*")) {
|
|
417
|
-
const regex = new RegExp("^" + normalizedPattern.replace(/\*/g, ".*") + "$");
|
|
418
|
-
if (regex.test(ns)) return true;
|
|
419
|
-
const basePattern = normalizedPattern.split(":")[0];
|
|
420
|
-
if (ns === basePattern && normalizedPattern.startsWith(basePattern + ":")) {
|
|
1774
|
+
if (!this.cachedPositivePatterns.length) return true;
|
|
1775
|
+
const matches = this.cachedPositivePatterns.some((entry) => {
|
|
1776
|
+
if (entry.pattern === "*") return true;
|
|
1777
|
+
if (entry.regex) {
|
|
1778
|
+
if (entry.regex.test(ns)) return true;
|
|
1779
|
+
if (entry.basePattern && ns === entry.basePattern) {
|
|
421
1780
|
return true;
|
|
422
1781
|
}
|
|
423
1782
|
return false;
|
|
424
1783
|
}
|
|
425
|
-
return ns ===
|
|
1784
|
+
return ns === entry.pattern;
|
|
426
1785
|
});
|
|
427
1786
|
if (!matches) return false;
|
|
428
|
-
for (const
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
const regex = new RegExp("^" + neg.replace(/\*/g, ".*") + "$");
|
|
432
|
-
if (regex.test(ns)) {
|
|
1787
|
+
for (const entry of this.cachedNegativePatterns) {
|
|
1788
|
+
if (entry.regex) {
|
|
1789
|
+
if (entry.regex.test(ns)) {
|
|
433
1790
|
return false;
|
|
434
1791
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
if (ns === negPrefix || ns.startsWith(negPrefix + ":")) {
|
|
1792
|
+
if (entry.prefix) {
|
|
1793
|
+
if (ns === entry.prefix || ns.startsWith(entry.prefix + ":")) {
|
|
438
1794
|
return false;
|
|
439
1795
|
}
|
|
440
1796
|
}
|
|
441
1797
|
} else {
|
|
442
|
-
if (ns.startsWith(
|
|
1798
|
+
if (ns.startsWith(entry.pattern)) {
|
|
443
1799
|
return false;
|
|
444
1800
|
}
|
|
445
1801
|
}
|
|
@@ -450,9 +1806,47 @@ var NamespaceMatcher = class {
|
|
|
450
1806
|
if (!value) return "";
|
|
451
1807
|
return value.replace(/:+$/, "");
|
|
452
1808
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
1809
|
+
parseAndCachePatterns(namespaces) {
|
|
1810
|
+
this.cachedPositivePatterns = [];
|
|
1811
|
+
this.cachedNegativePatterns = [];
|
|
1812
|
+
if (!namespaces) return;
|
|
1813
|
+
const patterns = namespaces.split(",").map((s) => this.normalize(s.trim()));
|
|
1814
|
+
for (const pattern of patterns) {
|
|
1815
|
+
if (pattern.startsWith("-")) {
|
|
1816
|
+
const negPattern = pattern.slice(1);
|
|
1817
|
+
const normalized = this.normalize(negPattern);
|
|
1818
|
+
if (normalized.includes("*")) {
|
|
1819
|
+
const escaped = normalized.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
1820
|
+
const regex = new RegExp("^" + escaped + "$");
|
|
1821
|
+
const prefix = this.normalize(normalized.replace(/\*.*$/, ""));
|
|
1822
|
+
this.cachedNegativePatterns.push({
|
|
1823
|
+
pattern: normalized,
|
|
1824
|
+
regex,
|
|
1825
|
+
prefix: prefix || void 0
|
|
1826
|
+
});
|
|
1827
|
+
} else {
|
|
1828
|
+
this.cachedNegativePatterns.push({
|
|
1829
|
+
pattern: normalized
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
} else {
|
|
1833
|
+
const normalized = this.normalize(pattern);
|
|
1834
|
+
if (normalized.includes("*")) {
|
|
1835
|
+
const escaped = normalized.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
1836
|
+
const regex = new RegExp("^" + escaped + "$");
|
|
1837
|
+
const basePattern = normalized.split(":")[0];
|
|
1838
|
+
this.cachedPositivePatterns.push({
|
|
1839
|
+
pattern: normalized,
|
|
1840
|
+
regex,
|
|
1841
|
+
basePattern: normalized.startsWith(basePattern + ":") ? basePattern : void 0
|
|
1842
|
+
});
|
|
1843
|
+
} else {
|
|
1844
|
+
this.cachedPositivePatterns.push({
|
|
1845
|
+
pattern: normalized
|
|
1846
|
+
});
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
456
1850
|
}
|
|
457
1851
|
};
|
|
458
1852
|
var namespaceMatcher = new NamespaceMatcher();
|
|
@@ -495,6 +1889,13 @@ var dedup_hasher_default = DedupHasher;
|
|
|
495
1889
|
|
|
496
1890
|
// src/logger.ts
|
|
497
1891
|
var globalConfig = {};
|
|
1892
|
+
var LEVEL_PRIORITIES = {
|
|
1893
|
+
debug: 0,
|
|
1894
|
+
info: 1,
|
|
1895
|
+
warn: 2,
|
|
1896
|
+
error: 3,
|
|
1897
|
+
none: 4
|
|
1898
|
+
};
|
|
498
1899
|
function configure(options) {
|
|
499
1900
|
globalConfig = { ...globalConfig, ...options };
|
|
500
1901
|
}
|
|
@@ -511,6 +1912,7 @@ var Logger = class {
|
|
|
511
1912
|
this._namespace = options.namespace ?? DEFAULT_NAMESPACE;
|
|
512
1913
|
this._level = options.level ?? globalConfig.level ?? "debug";
|
|
513
1914
|
this._maxDepth = options.maxDepth ?? globalConfig.maxDepth ?? 10;
|
|
1915
|
+
this._truncateConfig = options.truncate;
|
|
514
1916
|
this._context = options.context ?? {};
|
|
515
1917
|
this._dedupConfig = {
|
|
516
1918
|
...DEFAULT_DEDUP_CONFIG,
|
|
@@ -552,6 +1954,9 @@ var Logger = class {
|
|
|
552
1954
|
assert(condition, message, ...args) {
|
|
553
1955
|
if (!condition) {
|
|
554
1956
|
this.log("error", message, ...args);
|
|
1957
|
+
} else {
|
|
1958
|
+
this._tempConditions = [];
|
|
1959
|
+
this._tempFilterOptions = {};
|
|
555
1960
|
}
|
|
556
1961
|
return this;
|
|
557
1962
|
}
|
|
@@ -581,6 +1986,24 @@ var Logger = class {
|
|
|
581
1986
|
this._maxDepth = maxDepth;
|
|
582
1987
|
return this;
|
|
583
1988
|
}
|
|
1989
|
+
/**
|
|
1990
|
+
* Truncate large objects/arrays/strings before logging.
|
|
1991
|
+
* Accepts a number (shorthand for fields limit) or a config object.
|
|
1992
|
+
*
|
|
1993
|
+
* @param config - Max field count (number) or { fields, string, array } limits
|
|
1994
|
+
* @returns this for chaining
|
|
1995
|
+
*
|
|
1996
|
+
* @example
|
|
1997
|
+
* // Limit to 5 fields per object
|
|
1998
|
+
* logger.truncate(5).debug('User', user);
|
|
1999
|
+
*
|
|
2000
|
+
* // Fine-grained control
|
|
2001
|
+
* logger.truncate({ fields: 5, string: 80, array: 3 }).debug('Order', order);
|
|
2002
|
+
*/
|
|
2003
|
+
truncate(config) {
|
|
2004
|
+
this._tempFilterOptions.truncate = typeof config === "number" ? { fields: config } : config;
|
|
2005
|
+
return this;
|
|
2006
|
+
}
|
|
584
2007
|
/**
|
|
585
2008
|
* Pick only specific fields to log (whitelist approach)
|
|
586
2009
|
* Supports dot notation for nested fields: 'user.name', 'user.email'
|
|
@@ -663,14 +2086,7 @@ var Logger = class {
|
|
|
663
2086
|
return this;
|
|
664
2087
|
}
|
|
665
2088
|
getLevelPriority(level) {
|
|
666
|
-
|
|
667
|
-
debug: 0,
|
|
668
|
-
info: 1,
|
|
669
|
-
warn: 2,
|
|
670
|
-
error: 3,
|
|
671
|
-
none: 4
|
|
672
|
-
};
|
|
673
|
-
return priorities[level];
|
|
2089
|
+
return LEVEL_PRIORITIES[level];
|
|
674
2090
|
}
|
|
675
2091
|
log(level, message, ...args) {
|
|
676
2092
|
if (this._tempConditions.length > 0) {
|
|
@@ -698,15 +2114,16 @@ var Logger = class {
|
|
|
698
2114
|
} else if (this.getLevelPriority(this._level) > this.getLevelPriority(level)) {
|
|
699
2115
|
return;
|
|
700
2116
|
}
|
|
701
|
-
const filterOptions =
|
|
2117
|
+
const filterOptions = this._tempFilterOptions;
|
|
702
2118
|
this._tempFilterOptions = {};
|
|
2119
|
+
const timestamp = Date.now();
|
|
703
2120
|
if (this._dedupConfig.enabled) {
|
|
704
|
-
this.logWithDedup(level, message, filterOptions, ...args);
|
|
2121
|
+
this.logWithDedup(level, message, filterOptions, timestamp, ...args);
|
|
705
2122
|
} else {
|
|
706
|
-
this.logImmediate(level, message, filterOptions, ...args);
|
|
2123
|
+
this.logImmediate(level, message, filterOptions, timestamp, ...args);
|
|
707
2124
|
}
|
|
708
2125
|
}
|
|
709
|
-
logWithDedup(level, message, filterOptions, ...args) {
|
|
2126
|
+
logWithDedup(level, message, filterOptions, timestamp, ...args) {
|
|
710
2127
|
const key = dedup_hasher_default.generateKey(level, message, args);
|
|
711
2128
|
const existing = this._dedupBuffer.get(key);
|
|
712
2129
|
const now = Date.now();
|
|
@@ -728,7 +2145,7 @@ var Logger = class {
|
|
|
728
2145
|
message,
|
|
729
2146
|
args,
|
|
730
2147
|
count: 1,
|
|
731
|
-
firstTimestamp:
|
|
2148
|
+
firstTimestamp: timestamp,
|
|
732
2149
|
lastTimestamp: now,
|
|
733
2150
|
filterOptions
|
|
734
2151
|
};
|
|
@@ -747,7 +2164,7 @@ var Logger = class {
|
|
|
747
2164
|
const lastTime = this.formatTimestamp(entry.lastTimestamp);
|
|
748
2165
|
displayMessage = `${entry.message} (x${entry.count}, ${firstTime} \u2192 ${lastTime})`;
|
|
749
2166
|
}
|
|
750
|
-
this.logImmediate(entry.level, displayMessage, entry.filterOptions || {}, ...entry.args);
|
|
2167
|
+
this.logImmediate(entry.level, displayMessage, entry.filterOptions || {}, entry.firstTimestamp, ...entry.args);
|
|
751
2168
|
this._dedupBuffer.delete(key);
|
|
752
2169
|
}
|
|
753
2170
|
formatTimestamp(timestamp) {
|
|
@@ -758,7 +2175,19 @@ var Logger = class {
|
|
|
758
2175
|
const milliseconds = String(date.getMilliseconds()).padStart(3, "0");
|
|
759
2176
|
return `${hours}:${minutes}:${seconds}.${milliseconds}`;
|
|
760
2177
|
}
|
|
761
|
-
logImmediate(level, message, filterOptions, ...args) {
|
|
2178
|
+
logImmediate(level, message, filterOptions, timestamp, ...args) {
|
|
2179
|
+
const transports = globalConfig.transports;
|
|
2180
|
+
if (transports && transports.length > 0) {
|
|
2181
|
+
const entry = { namespace: this._namespace, level, message, args, timestamp };
|
|
2182
|
+
for (const transport of transports) {
|
|
2183
|
+
if (!transport.levels || transport.levels.includes(level)) {
|
|
2184
|
+
try {
|
|
2185
|
+
transport.write(entry);
|
|
2186
|
+
} catch {
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
762
2191
|
const formattedObject = Formatter.formatObj(args, {
|
|
763
2192
|
maxDepth: this._maxDepth,
|
|
764
2193
|
// Global filter fields (always applied for security)
|
|
@@ -771,7 +2200,9 @@ var Logger = class {
|
|
|
771
2200
|
filterMode: filterOptions.filterMode,
|
|
772
2201
|
filterReplacement: filterOptions.filterReplacement,
|
|
773
2202
|
// Error serialization config
|
|
774
|
-
errorConfig: globalConfig.errorSerialization
|
|
2203
|
+
errorConfig: globalConfig.errorSerialization,
|
|
2204
|
+
// Truncation: per-log > instance > global
|
|
2205
|
+
truncate: filterOptions.truncate ?? this._truncateConfig ?? globalConfig.truncate
|
|
775
2206
|
});
|
|
776
2207
|
const formattedMessage = formattedObject ? `${message} ${formattedObject}` : message;
|
|
777
2208
|
const { logMessage, logStyles } = styler_default.style({
|
|
@@ -804,6 +2235,40 @@ var plslog = ((options = {}) => {
|
|
|
804
2235
|
});
|
|
805
2236
|
plslog.configure = configure;
|
|
806
2237
|
var logger_default = plslog;
|
|
2238
|
+
/*! Bundled license information:
|
|
2239
|
+
|
|
2240
|
+
react-is/cjs/react-is.production.min.js:
|
|
2241
|
+
(**
|
|
2242
|
+
* @license React
|
|
2243
|
+
* react-is.production.min.js
|
|
2244
|
+
*
|
|
2245
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2246
|
+
*
|
|
2247
|
+
* This source code is licensed under the MIT license found in the
|
|
2248
|
+
* LICENSE file in the root directory of this source tree.
|
|
2249
|
+
*)
|
|
2250
|
+
|
|
2251
|
+
react-is/cjs/react-is.development.js:
|
|
2252
|
+
(**
|
|
2253
|
+
* @license React
|
|
2254
|
+
* react-is.development.js
|
|
2255
|
+
*
|
|
2256
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2257
|
+
*
|
|
2258
|
+
* This source code is licensed under the MIT license found in the
|
|
2259
|
+
* LICENSE file in the root directory of this source tree.
|
|
2260
|
+
*)
|
|
2261
|
+
|
|
2262
|
+
pretty-format/build/index.js:
|
|
2263
|
+
(*!
|
|
2264
|
+
* /**
|
|
2265
|
+
* * Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2266
|
+
* *
|
|
2267
|
+
* * This source code is licensed under the MIT license found in the
|
|
2268
|
+
* * LICENSE file in the root directory of this source tree.
|
|
2269
|
+
* * /
|
|
2270
|
+
*)
|
|
2271
|
+
*/
|
|
807
2272
|
|
|
808
2273
|
export { logger_default as default };
|
|
809
2274
|
//# sourceMappingURL=index.mjs.map
|