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