plslog 1.0.0 → 1.1.1
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/dist/index.d.mts +147 -2
- package/dist/index.d.ts +147 -2
- package/dist/index.js +1975 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1974 -57
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -18
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,1542 @@
|
|
|
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
|
+
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
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 = format2;
|
|
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(plugins3, val) {
|
|
1209
|
+
for (const plugin of plugins3) {
|
|
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_OPTIONS2 = 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_OPTIONS2, 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_OPTIONS2.printFunctionName;
|
|
1291
|
+
const getEscapeRegex = (options) => options?.escapeRegex ?? DEFAULT_OPTIONS2.escapeRegex;
|
|
1292
|
+
const getEscapeString = (options) => options?.escapeString ?? DEFAULT_OPTIONS2.escapeString;
|
|
1293
|
+
const getConfig = (options) => ({
|
|
1294
|
+
callToJSON: options?.callToJSON ?? DEFAULT_OPTIONS2.callToJSON,
|
|
1295
|
+
colors: options?.highlight ? getColorsHighlight(options) : getColorsEmpty(),
|
|
1296
|
+
compareKeys: typeof options?.compareKeys === "function" || options?.compareKeys === null ? options.compareKeys : DEFAULT_OPTIONS2.compareKeys,
|
|
1297
|
+
escapeRegex: getEscapeRegex(options),
|
|
1298
|
+
escapeString: getEscapeString(options),
|
|
1299
|
+
indent: options?.min ? "" : createIndent(options?.indent ?? DEFAULT_OPTIONS2.indent),
|
|
1300
|
+
maxDepth: options?.maxDepth ?? DEFAULT_OPTIONS2.maxDepth,
|
|
1301
|
+
maxWidth: options?.maxWidth ?? DEFAULT_OPTIONS2.maxWidth,
|
|
1302
|
+
min: options?.min ?? DEFAULT_OPTIONS2.min,
|
|
1303
|
+
plugins: options?.plugins ?? DEFAULT_OPTIONS2.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 format2(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"] = format2;
|
|
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
|
+
// ../../node_modules/.pnpm/pretty-format@30.2.0/node_modules/pretty-format/build/index.mjs
|
|
1353
|
+
var import_index = __toESM(require_build());
|
|
1354
|
+
import_index.default.DEFAULT_OPTIONS;
|
|
1355
|
+
var format = import_index.default.format;
|
|
1356
|
+
import_index.default.plugins;
|
|
1357
|
+
import_index.default.default;
|
|
1358
|
+
|
|
1359
|
+
// src/formatter.ts
|
|
1360
|
+
var EXCLUDED_ERROR_PROPS = /* @__PURE__ */ new Set(["name", "message", "stack", "cause"]);
|
|
8
1361
|
var Formatter = class {
|
|
1362
|
+
/**
|
|
1363
|
+
* Check if a field should be filtered based on configured rules
|
|
1364
|
+
*/
|
|
1365
|
+
static shouldFilterField(key, value, path, filterFields) {
|
|
1366
|
+
if (!filterFields || filterFields.length === 0) {
|
|
1367
|
+
return false;
|
|
1368
|
+
}
|
|
1369
|
+
for (const filter of filterFields) {
|
|
1370
|
+
if (typeof filter === "string" && key === filter) {
|
|
1371
|
+
return true;
|
|
1372
|
+
}
|
|
1373
|
+
if (filter instanceof RegExp && filter.test(key)) {
|
|
1374
|
+
return true;
|
|
1375
|
+
}
|
|
1376
|
+
if (typeof filter === "function") {
|
|
1377
|
+
const shouldShow = filter(key, value, path);
|
|
1378
|
+
if (shouldShow === false) {
|
|
1379
|
+
return true;
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
return false;
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Check if a field should be included based on pick/omit rules
|
|
1387
|
+
*/
|
|
1388
|
+
static shouldIncludeField(key, value, path, options) {
|
|
1389
|
+
if (options?.pick && options.pick.length > 0) {
|
|
1390
|
+
const pathWithoutIndices = path.filter((p) => !p.startsWith("["));
|
|
1391
|
+
const fullPath = [...pathWithoutIndices, key].join(".");
|
|
1392
|
+
const isInPickList = options.pick.some((pickPath) => {
|
|
1393
|
+
if (pickPath.endsWith(".*")) {
|
|
1394
|
+
const prefix = pickPath.slice(0, -2);
|
|
1395
|
+
return fullPath.startsWith(prefix + ".") || fullPath === prefix;
|
|
1396
|
+
}
|
|
1397
|
+
if (!pickPath.includes(".") && key === pickPath) {
|
|
1398
|
+
return true;
|
|
1399
|
+
}
|
|
1400
|
+
if (fullPath === pickPath) {
|
|
1401
|
+
return true;
|
|
1402
|
+
}
|
|
1403
|
+
if (pickPath.startsWith(fullPath + ".")) {
|
|
1404
|
+
return true;
|
|
1405
|
+
}
|
|
1406
|
+
if (fullPath.startsWith(pickPath + ".")) {
|
|
1407
|
+
return true;
|
|
1408
|
+
}
|
|
1409
|
+
return false;
|
|
1410
|
+
});
|
|
1411
|
+
if (!isInPickList) {
|
|
1412
|
+
return { include: false, filtered: false };
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
if (options?.omit && options.omit.length > 0) {
|
|
1416
|
+
const shouldOmit = this.shouldFilterField(key, value, path, options.omit);
|
|
1417
|
+
if (shouldOmit) {
|
|
1418
|
+
return { include: true, filtered: true };
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
return { include: true, filtered: false };
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* Get the replacement value for a filtered field
|
|
1425
|
+
*/
|
|
1426
|
+
static getFilteredValue(value, mode = "redact", replacement = "***REDACTED***") {
|
|
1427
|
+
switch (mode) {
|
|
1428
|
+
case "redact":
|
|
1429
|
+
return replacement;
|
|
1430
|
+
case "type":
|
|
1431
|
+
if (value === null) return "[null]";
|
|
1432
|
+
if (value === void 0) return "[undefined]";
|
|
1433
|
+
if (Array.isArray(value)) return `[Array(${value.length})]`;
|
|
1434
|
+
return `[${typeof value}]`;
|
|
1435
|
+
case "length":
|
|
1436
|
+
if (typeof value === "string") return `[${value.length} chars]`;
|
|
1437
|
+
if (Array.isArray(value)) return `[${value.length} items]`;
|
|
1438
|
+
if (typeof value === "object" && value !== null) {
|
|
1439
|
+
return `[${Object.keys(value).length} keys]`;
|
|
1440
|
+
}
|
|
1441
|
+
return `[${typeof value}]`;
|
|
1442
|
+
case "hide":
|
|
1443
|
+
return void 0;
|
|
1444
|
+
// Will be removed by caller
|
|
1445
|
+
default:
|
|
1446
|
+
return replacement;
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Sanitize sensitive data from stack traces
|
|
1451
|
+
*/
|
|
1452
|
+
static sanitizeStackTrace(stack, customPatterns) {
|
|
1453
|
+
const combinedDefaultPattern = /([?&])(token|key|secret|password|auth|api[_-]?key|access[_-]?token|client[_-]?secret)=[^&\s)#]*|\/\/[^/]*:[^@]*@|(bearer\s+)[a-zA-Z0-9\-._~+/]+=*/gi;
|
|
1454
|
+
let sanitized = stack.replace(combinedDefaultPattern, (match, urlParam, _tokenKey, bearer) => {
|
|
1455
|
+
if (urlParam) {
|
|
1456
|
+
return `${urlParam}***REDACTED***`;
|
|
1457
|
+
}
|
|
1458
|
+
if (bearer) {
|
|
1459
|
+
return `${bearer}***REDACTED***`;
|
|
1460
|
+
}
|
|
1461
|
+
return "***REDACTED***";
|
|
1462
|
+
});
|
|
1463
|
+
if (customPatterns && customPatterns.length > 0) {
|
|
1464
|
+
for (const pattern of customPatterns) {
|
|
1465
|
+
sanitized = sanitized.replace(pattern, (match, p1) => {
|
|
1466
|
+
if (p1) {
|
|
1467
|
+
return `${p1}***REDACTED***`;
|
|
1468
|
+
}
|
|
1469
|
+
return "***REDACTED***";
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
return sanitized;
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Serialize Error objects with all relevant properties (name, message, stack, cause)
|
|
1477
|
+
*/
|
|
1478
|
+
static serializeError(error, config, currentDepth = 0) {
|
|
1479
|
+
const maxCauseDepth = config?.maxCauseDepth ?? 10;
|
|
1480
|
+
if (currentDepth > maxCauseDepth) {
|
|
1481
|
+
return "[Max Cause Depth Reached]";
|
|
1482
|
+
}
|
|
1483
|
+
const includeStack = config?.includeStack ?? true;
|
|
1484
|
+
const includeCause = config?.includeCause ?? true;
|
|
1485
|
+
const stackFrameLimit = config?.stackFrameLimit;
|
|
1486
|
+
const sanitizeStack = config?.sanitizeStack ?? false;
|
|
1487
|
+
const serialized = {
|
|
1488
|
+
name: error.name,
|
|
1489
|
+
message: error.message
|
|
1490
|
+
};
|
|
1491
|
+
if ("code" in error) {
|
|
1492
|
+
const errorWithCode = error;
|
|
1493
|
+
if (typeof errorWithCode.code === "number") {
|
|
1494
|
+
serialized.code = errorWithCode.code;
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
if (includeStack && error.stack) {
|
|
1498
|
+
let stack = error.stack;
|
|
1499
|
+
if (sanitizeStack) {
|
|
1500
|
+
stack = this.sanitizeStackTrace(stack, config?.sanitizePatterns);
|
|
1501
|
+
}
|
|
1502
|
+
if (stackFrameLimit !== void 0 && stackFrameLimit > 0) {
|
|
1503
|
+
const lines = stack.split("\n");
|
|
1504
|
+
if (lines.length > stackFrameLimit) {
|
|
1505
|
+
stack = lines.slice(0, stackFrameLimit).join("\n") + "\n... (truncated)";
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
serialized.stack = stack;
|
|
1509
|
+
}
|
|
1510
|
+
if (includeCause && error.cause !== void 0) {
|
|
1511
|
+
if (error.cause instanceof Error) {
|
|
1512
|
+
const serializedCause = this.serializeError(error.cause, config, currentDepth + 1);
|
|
1513
|
+
serialized.cause = typeof serializedCause === "string" ? { name: "Error", message: serializedCause } : serializedCause;
|
|
1514
|
+
} else {
|
|
1515
|
+
serialized.cause = error.cause;
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
for (const key in error) {
|
|
1519
|
+
if (Object.prototype.hasOwnProperty.call(error, key)) {
|
|
1520
|
+
if (!EXCLUDED_ERROR_PROPS.has(key)) {
|
|
1521
|
+
const errorWithCustomProps = error;
|
|
1522
|
+
serialized[key] = errorWithCustomProps[key];
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
if (error.name === "AggregateError" && "errors" in error) {
|
|
1527
|
+
const aggregateError = error;
|
|
1528
|
+
if (Array.isArray(aggregateError.errors)) {
|
|
1529
|
+
serialized.errors = aggregateError.errors.map((e) => {
|
|
1530
|
+
if (e instanceof Error) {
|
|
1531
|
+
const serializedErr = this.serializeError(e, config, currentDepth + 1);
|
|
1532
|
+
return typeof serializedErr === "string" ? { name: "Error", message: serializedErr } : serializedErr;
|
|
1533
|
+
}
|
|
1534
|
+
return e;
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
return serialized;
|
|
1539
|
+
}
|
|
9
1540
|
/**
|
|
10
1541
|
* Format base64 string for logging
|
|
11
1542
|
*/
|
|
@@ -31,17 +1562,14 @@ var Formatter = class {
|
|
|
31
1562
|
/**
|
|
32
1563
|
* Helper to serialize Blob and File objects for logging
|
|
33
1564
|
*/
|
|
34
|
-
static serializeSpecialObjects(obj, maxDepth = 10, currentDepth = 0) {
|
|
1565
|
+
static serializeSpecialObjects(obj, maxDepth = 10, currentDepth = 0, filterOptions, currentPath = []) {
|
|
35
1566
|
if (currentDepth > maxDepth) return "[Max Depth Reached]";
|
|
1567
|
+
if (obj instanceof Error) {
|
|
1568
|
+
return this.serializeError(obj, filterOptions?.errorConfig, 0);
|
|
1569
|
+
}
|
|
36
1570
|
if (typeof obj === "string" && isBase64(obj)) {
|
|
37
1571
|
return this.formatBase64String(obj);
|
|
38
1572
|
}
|
|
39
|
-
if (obj instanceof Blob) {
|
|
40
|
-
return {
|
|
41
|
-
size: obj.size,
|
|
42
|
-
type: obj.type
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
1573
|
if (obj instanceof File) {
|
|
46
1574
|
return {
|
|
47
1575
|
name: obj.name,
|
|
@@ -50,14 +1578,69 @@ var Formatter = class {
|
|
|
50
1578
|
lastModified: obj.lastModified
|
|
51
1579
|
};
|
|
52
1580
|
}
|
|
1581
|
+
if (obj instanceof Blob) {
|
|
1582
|
+
return {
|
|
1583
|
+
size: obj.size,
|
|
1584
|
+
type: obj.type
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
53
1587
|
if (Array.isArray(obj)) {
|
|
54
|
-
return obj.map(
|
|
1588
|
+
return obj.map(
|
|
1589
|
+
(item, index) => this.serializeSpecialObjects(
|
|
1590
|
+
item,
|
|
1591
|
+
maxDepth,
|
|
1592
|
+
currentDepth + 1,
|
|
1593
|
+
filterOptions,
|
|
1594
|
+
[...currentPath, `[${index}]`]
|
|
1595
|
+
)
|
|
1596
|
+
);
|
|
55
1597
|
}
|
|
56
1598
|
if (obj !== null && typeof obj === "object") {
|
|
57
1599
|
const serialized = {};
|
|
58
1600
|
for (const key in obj) {
|
|
59
1601
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
60
|
-
|
|
1602
|
+
const value = obj[key];
|
|
1603
|
+
const newPath = [...currentPath, key];
|
|
1604
|
+
const { include, filtered } = this.shouldIncludeField(
|
|
1605
|
+
key,
|
|
1606
|
+
value,
|
|
1607
|
+
currentPath,
|
|
1608
|
+
filterOptions
|
|
1609
|
+
);
|
|
1610
|
+
if (!include) {
|
|
1611
|
+
continue;
|
|
1612
|
+
}
|
|
1613
|
+
let isGloballyFiltered = false;
|
|
1614
|
+
if (filterOptions?.filterFields && filterOptions.filterFields.length > 0) {
|
|
1615
|
+
isGloballyFiltered = this.shouldFilterField(key, value, currentPath, filterOptions.filterFields);
|
|
1616
|
+
}
|
|
1617
|
+
if (isGloballyFiltered) {
|
|
1618
|
+
const filteredValue = this.getFilteredValue(
|
|
1619
|
+
value,
|
|
1620
|
+
filterOptions?.globalFilterMode,
|
|
1621
|
+
filterOptions?.globalFilterReplacement
|
|
1622
|
+
);
|
|
1623
|
+
if (filteredValue !== void 0) {
|
|
1624
|
+
serialized[key] = filteredValue;
|
|
1625
|
+
}
|
|
1626
|
+
} else if (filtered) {
|
|
1627
|
+
const filteredValue = this.getFilteredValue(
|
|
1628
|
+
value,
|
|
1629
|
+
filterOptions?.filterMode,
|
|
1630
|
+
filterOptions?.filterReplacement
|
|
1631
|
+
);
|
|
1632
|
+
if (filteredValue !== void 0) {
|
|
1633
|
+
serialized[key] = filteredValue;
|
|
1634
|
+
}
|
|
1635
|
+
} else {
|
|
1636
|
+
serialized[key] = this.serializeSpecialObjects(
|
|
1637
|
+
value,
|
|
1638
|
+
maxDepth,
|
|
1639
|
+
currentDepth + 1,
|
|
1640
|
+
filterOptions,
|
|
1641
|
+
newPath
|
|
1642
|
+
);
|
|
1643
|
+
}
|
|
61
1644
|
}
|
|
62
1645
|
}
|
|
63
1646
|
return serialized;
|
|
@@ -76,10 +1659,23 @@ var Formatter = class {
|
|
|
76
1659
|
const isArray = Array.isArray(arg);
|
|
77
1660
|
if (isObject || isArray) {
|
|
78
1661
|
const maxDepth = options?.maxDepth ?? 5;
|
|
79
|
-
const serialized = this.serializeSpecialObjects(
|
|
1662
|
+
const serialized = this.serializeSpecialObjects(
|
|
1663
|
+
arg,
|
|
1664
|
+
maxDepth,
|
|
1665
|
+
0,
|
|
1666
|
+
{
|
|
1667
|
+
pick: options?.pick,
|
|
1668
|
+
omit: options?.omit,
|
|
1669
|
+
filterFields: options?.filterFields,
|
|
1670
|
+
filterMode: options?.filterMode,
|
|
1671
|
+
filterReplacement: options?.filterReplacement,
|
|
1672
|
+
globalFilterMode: options?.globalFilterMode,
|
|
1673
|
+
globalFilterReplacement: options?.globalFilterReplacement,
|
|
1674
|
+
errorConfig: options?.errorConfig
|
|
1675
|
+
}
|
|
1676
|
+
);
|
|
80
1677
|
const formatted = format(serialized, {
|
|
81
|
-
|
|
82
|
-
indent: options?.indent ?? 2,
|
|
1678
|
+
indent: 2,
|
|
83
1679
|
maxDepth,
|
|
84
1680
|
// Remove Object and Array labels
|
|
85
1681
|
printFunctionName: false,
|
|
@@ -108,6 +1704,10 @@ var LOG_COLORS = {
|
|
|
108
1704
|
none: "#fff"
|
|
109
1705
|
};
|
|
110
1706
|
var DEFAULT_NAMESPACE = "app";
|
|
1707
|
+
var DEFAULT_DEDUP_CONFIG = {
|
|
1708
|
+
enabled: false,
|
|
1709
|
+
flushInterval: 100
|
|
1710
|
+
};
|
|
111
1711
|
|
|
112
1712
|
// src/styler.ts
|
|
113
1713
|
function getColorForLevel(level) {
|
|
@@ -146,56 +1746,41 @@ var styler_default = Styler;
|
|
|
146
1746
|
// src/namespace-matcher.ts
|
|
147
1747
|
var NamespaceMatcher = class {
|
|
148
1748
|
constructor() {
|
|
149
|
-
this.
|
|
1749
|
+
this.cachedPositivePatterns = [];
|
|
1750
|
+
this.cachedNegativePatterns = [];
|
|
150
1751
|
this.cachedConfig = void 0;
|
|
151
1752
|
}
|
|
152
1753
|
matches(namespace, namespaces) {
|
|
153
1754
|
const ns = this.normalize(namespace);
|
|
154
1755
|
if (this.cachedConfig !== namespaces) {
|
|
155
|
-
this.
|
|
1756
|
+
this.parseAndCachePatterns(namespaces);
|
|
156
1757
|
this.cachedConfig = namespaces;
|
|
157
1758
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
negativePatterns.push(pattern.slice(1));
|
|
165
|
-
} else {
|
|
166
|
-
positivePatterns.push(pattern);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
const matches = positivePatterns.some((pattern) => {
|
|
170
|
-
if (pattern === "*") return true;
|
|
171
|
-
const normalizedPattern = this.normalize(pattern);
|
|
172
|
-
if (pattern.includes("*")) {
|
|
173
|
-
const regex = new RegExp("^" + normalizedPattern.replace(/\*/g, ".*") + "$");
|
|
174
|
-
if (regex.test(ns)) return true;
|
|
175
|
-
const basePattern = normalizedPattern.split(":")[0];
|
|
176
|
-
if (ns === basePattern && normalizedPattern.startsWith(basePattern + ":")) {
|
|
1759
|
+
if (!this.cachedPositivePatterns.length) return true;
|
|
1760
|
+
const matches = this.cachedPositivePatterns.some((entry) => {
|
|
1761
|
+
if (entry.pattern === "*") return true;
|
|
1762
|
+
if (entry.regex) {
|
|
1763
|
+
if (entry.regex.test(ns)) return true;
|
|
1764
|
+
if (entry.basePattern && ns === entry.basePattern) {
|
|
177
1765
|
return true;
|
|
178
1766
|
}
|
|
179
1767
|
return false;
|
|
180
1768
|
}
|
|
181
|
-
return ns ===
|
|
1769
|
+
return ns === entry.pattern;
|
|
182
1770
|
});
|
|
183
1771
|
if (!matches) return false;
|
|
184
|
-
for (const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
const regex = new RegExp("^" + neg.replace(/\*/g, ".*") + "$");
|
|
188
|
-
if (regex.test(ns)) {
|
|
1772
|
+
for (const entry of this.cachedNegativePatterns) {
|
|
1773
|
+
if (entry.regex) {
|
|
1774
|
+
if (entry.regex.test(ns)) {
|
|
189
1775
|
return false;
|
|
190
1776
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
if (ns === negPrefix || ns.startsWith(negPrefix + ":")) {
|
|
1777
|
+
if (entry.prefix) {
|
|
1778
|
+
if (ns === entry.prefix || ns.startsWith(entry.prefix + ":")) {
|
|
194
1779
|
return false;
|
|
195
1780
|
}
|
|
196
1781
|
}
|
|
197
1782
|
} else {
|
|
198
|
-
if (ns.startsWith(
|
|
1783
|
+
if (ns.startsWith(entry.pattern)) {
|
|
199
1784
|
return false;
|
|
200
1785
|
}
|
|
201
1786
|
}
|
|
@@ -206,25 +1791,118 @@ var NamespaceMatcher = class {
|
|
|
206
1791
|
if (!value) return "";
|
|
207
1792
|
return value.replace(/:+$/, "");
|
|
208
1793
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
1794
|
+
parseAndCachePatterns(namespaces) {
|
|
1795
|
+
this.cachedPositivePatterns = [];
|
|
1796
|
+
this.cachedNegativePatterns = [];
|
|
1797
|
+
if (!namespaces) return;
|
|
1798
|
+
const patterns = namespaces.split(",").map((s) => this.normalize(s.trim()));
|
|
1799
|
+
for (const pattern of patterns) {
|
|
1800
|
+
if (pattern.startsWith("-")) {
|
|
1801
|
+
const negPattern = pattern.slice(1);
|
|
1802
|
+
const normalized = this.normalize(negPattern);
|
|
1803
|
+
if (normalized.includes("*")) {
|
|
1804
|
+
const escaped = normalized.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
1805
|
+
const regex = new RegExp("^" + escaped + "$");
|
|
1806
|
+
const prefix = this.normalize(normalized.replace(/\*.*$/, ""));
|
|
1807
|
+
this.cachedNegativePatterns.push({
|
|
1808
|
+
pattern: normalized,
|
|
1809
|
+
regex,
|
|
1810
|
+
prefix: prefix || void 0
|
|
1811
|
+
});
|
|
1812
|
+
} else {
|
|
1813
|
+
this.cachedNegativePatterns.push({
|
|
1814
|
+
pattern: normalized
|
|
1815
|
+
});
|
|
1816
|
+
}
|
|
1817
|
+
} else {
|
|
1818
|
+
const normalized = this.normalize(pattern);
|
|
1819
|
+
if (normalized.includes("*")) {
|
|
1820
|
+
const escaped = normalized.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
1821
|
+
const regex = new RegExp("^" + escaped + "$");
|
|
1822
|
+
const basePattern = normalized.split(":")[0];
|
|
1823
|
+
this.cachedPositivePatterns.push({
|
|
1824
|
+
pattern: normalized,
|
|
1825
|
+
regex,
|
|
1826
|
+
basePattern: normalized.startsWith(basePattern + ":") ? basePattern : void 0
|
|
1827
|
+
});
|
|
1828
|
+
} else {
|
|
1829
|
+
this.cachedPositivePatterns.push({
|
|
1830
|
+
pattern: normalized
|
|
1831
|
+
});
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
212
1835
|
}
|
|
213
1836
|
};
|
|
214
1837
|
var namespaceMatcher = new NamespaceMatcher();
|
|
215
1838
|
var namespace_matcher_default = namespaceMatcher;
|
|
216
1839
|
|
|
1840
|
+
// src/dedup-hasher.ts
|
|
1841
|
+
var DedupHasher = class {
|
|
1842
|
+
/**
|
|
1843
|
+
* Default hash function - simple string concatenation
|
|
1844
|
+
* For better performance, we use a simple approach rather than crypto hashing
|
|
1845
|
+
*/
|
|
1846
|
+
static generateKey(level, message, args) {
|
|
1847
|
+
const argsString = this.serializeArgs(args);
|
|
1848
|
+
return `${level}:${message}:${argsString}`;
|
|
1849
|
+
}
|
|
1850
|
+
/**
|
|
1851
|
+
* Serialize arguments to a consistent string representation
|
|
1852
|
+
*/
|
|
1853
|
+
static serializeArgs(args) {
|
|
1854
|
+
if (args.length === 0) return "";
|
|
1855
|
+
try {
|
|
1856
|
+
return JSON.stringify(args, (key, value) => {
|
|
1857
|
+
if (typeof value === "function") {
|
|
1858
|
+
return "[Function]";
|
|
1859
|
+
}
|
|
1860
|
+
if (typeof value === "symbol") {
|
|
1861
|
+
return value.toString();
|
|
1862
|
+
}
|
|
1863
|
+
if (value === void 0) {
|
|
1864
|
+
return "[undefined]";
|
|
1865
|
+
}
|
|
1866
|
+
return value;
|
|
1867
|
+
});
|
|
1868
|
+
} catch (error) {
|
|
1869
|
+
return String(args);
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
};
|
|
1873
|
+
var dedup_hasher_default = DedupHasher;
|
|
1874
|
+
|
|
217
1875
|
// src/logger.ts
|
|
218
1876
|
var globalConfig = {};
|
|
1877
|
+
var LEVEL_PRIORITIES = {
|
|
1878
|
+
debug: 0,
|
|
1879
|
+
info: 1,
|
|
1880
|
+
warn: 2,
|
|
1881
|
+
error: 3,
|
|
1882
|
+
none: 4
|
|
1883
|
+
};
|
|
219
1884
|
function configure(options) {
|
|
220
1885
|
globalConfig = { ...globalConfig, ...options };
|
|
221
1886
|
}
|
|
222
1887
|
var Logger = class {
|
|
223
1888
|
constructor(options = {}) {
|
|
224
1889
|
this._level = "debug";
|
|
1890
|
+
this._dedupBuffer = /* @__PURE__ */ new Map();
|
|
1891
|
+
// Temporary filter options that reset after each log
|
|
1892
|
+
this._tempFilterOptions = {};
|
|
1893
|
+
// Custom context for conditional logging
|
|
1894
|
+
this._context = {};
|
|
1895
|
+
// Temporary conditions that reset after each log
|
|
1896
|
+
this._tempConditions = [];
|
|
225
1897
|
this._namespace = options.namespace ?? DEFAULT_NAMESPACE;
|
|
226
1898
|
this._level = options.level ?? globalConfig.level ?? "debug";
|
|
227
1899
|
this._maxDepth = options.maxDepth ?? globalConfig.maxDepth ?? 10;
|
|
1900
|
+
this._context = options.context ?? {};
|
|
1901
|
+
this._dedupConfig = {
|
|
1902
|
+
...DEFAULT_DEDUP_CONFIG,
|
|
1903
|
+
...globalConfig.dedup || {},
|
|
1904
|
+
...options.dedup || {}
|
|
1905
|
+
};
|
|
228
1906
|
}
|
|
229
1907
|
debug(message, ...args) {
|
|
230
1908
|
this.log("debug", message, ...args);
|
|
@@ -242,24 +1920,156 @@ var Logger = class {
|
|
|
242
1920
|
this.log("error", message, ...args);
|
|
243
1921
|
return this;
|
|
244
1922
|
}
|
|
1923
|
+
/**
|
|
1924
|
+
* Assert that a condition is truthy. Logs an error if the condition is falsy.
|
|
1925
|
+
* Similar to console.assert() but integrates with plslog's features.
|
|
1926
|
+
* Uses JavaScript truthiness - falsy values: false, 0, '', null, undefined, NaN
|
|
1927
|
+
*
|
|
1928
|
+
* @param condition - The condition to assert (uses JavaScript truthiness)
|
|
1929
|
+
* @param message - Error message to log if assertion fails
|
|
1930
|
+
* @param args - Additional arguments to log
|
|
1931
|
+
* @returns this for chaining
|
|
1932
|
+
*
|
|
1933
|
+
* @example
|
|
1934
|
+
* logger.assert(user !== null, 'User should not be null', user);
|
|
1935
|
+
* logger.assert(count > 0, 'Count must be positive', { count });
|
|
1936
|
+
* logger.assert(data, 'Data is required'); // Checks if data is truthy
|
|
1937
|
+
*/
|
|
1938
|
+
assert(condition, message, ...args) {
|
|
1939
|
+
if (!condition) {
|
|
1940
|
+
this.log("error", message, ...args);
|
|
1941
|
+
} else {
|
|
1942
|
+
this._tempConditions = [];
|
|
1943
|
+
this._tempFilterOptions = {};
|
|
1944
|
+
}
|
|
1945
|
+
return this;
|
|
1946
|
+
}
|
|
245
1947
|
setLevel(level) {
|
|
246
1948
|
this._level = level;
|
|
247
1949
|
}
|
|
1950
|
+
/**
|
|
1951
|
+
* Set the namespace for this logger instance
|
|
1952
|
+
* Returns this for method chaining
|
|
1953
|
+
*
|
|
1954
|
+
* @param namespace - The namespace string (e.g., 'service:api', 'component')
|
|
1955
|
+
* @returns this for chaining
|
|
1956
|
+
*
|
|
1957
|
+
* @example
|
|
1958
|
+
* const log = logger().namespace('service:api');
|
|
1959
|
+
* log.debug('Message'); // Logs with namespace 'service:api'
|
|
1960
|
+
*
|
|
1961
|
+
* // Can also be called after instantiation
|
|
1962
|
+
* const log2 = logger();
|
|
1963
|
+
* log2.namespace('component').debug('Message');
|
|
1964
|
+
*/
|
|
1965
|
+
namespace(namespace) {
|
|
1966
|
+
this._namespace = namespace;
|
|
1967
|
+
return this;
|
|
1968
|
+
}
|
|
248
1969
|
maxDepth(maxDepth) {
|
|
249
1970
|
this._maxDepth = maxDepth;
|
|
250
1971
|
return this;
|
|
251
1972
|
}
|
|
1973
|
+
/**
|
|
1974
|
+
* Pick only specific fields to log (whitelist approach)
|
|
1975
|
+
* Supports dot notation for nested fields: 'user.name', 'user.email'
|
|
1976
|
+
* Supports wildcards: 'user.*' matches all fields under user
|
|
1977
|
+
*/
|
|
1978
|
+
pick(fields) {
|
|
1979
|
+
this._tempFilterOptions.pick = fields;
|
|
1980
|
+
return this;
|
|
1981
|
+
}
|
|
1982
|
+
/**
|
|
1983
|
+
* Omit specific fields from logging (blacklist approach)
|
|
1984
|
+
* Supports strings, regex patterns, and predicate functions
|
|
1985
|
+
*/
|
|
1986
|
+
omit(fields) {
|
|
1987
|
+
this._tempFilterOptions.omit = fields;
|
|
1988
|
+
return this;
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* Set filter mode for per-log filtering
|
|
1992
|
+
* - 'redact': Replace with custom string (default: '***REDACTED***')
|
|
1993
|
+
* - 'hide': Remove field completely
|
|
1994
|
+
* - 'type': Show type info like '[string]', '[Array(3)]'
|
|
1995
|
+
* - 'length': Show length info like '[8 chars]', '[3 items]'
|
|
1996
|
+
*/
|
|
1997
|
+
filterMode(mode, replacement) {
|
|
1998
|
+
this._tempFilterOptions.filterMode = mode;
|
|
1999
|
+
if (replacement !== void 0) {
|
|
2000
|
+
this._tempFilterOptions.filterReplacement = replacement;
|
|
2001
|
+
}
|
|
2002
|
+
return this;
|
|
2003
|
+
}
|
|
2004
|
+
once(enabled = true) {
|
|
2005
|
+
this._dedupConfig.enabled = enabled;
|
|
2006
|
+
return this;
|
|
2007
|
+
}
|
|
2008
|
+
flushDedup() {
|
|
2009
|
+
const keys = Array.from(this._dedupBuffer.keys());
|
|
2010
|
+
keys.forEach((key) => this.flushDedupEntry(key));
|
|
2011
|
+
return this;
|
|
2012
|
+
}
|
|
2013
|
+
/**
|
|
2014
|
+
* Execute log only if condition is true
|
|
2015
|
+
* Supports boolean values or predicate functions
|
|
2016
|
+
* Multiple when() calls are AND-ed together
|
|
2017
|
+
*
|
|
2018
|
+
* @example
|
|
2019
|
+
* // Boolean condition
|
|
2020
|
+
* logger.when(isDev).debug('Dev only');
|
|
2021
|
+
*
|
|
2022
|
+
* // Predicate with context
|
|
2023
|
+
* logger.when(ctx => ctx.namespace === 'auth').debug('Auth log');
|
|
2024
|
+
*
|
|
2025
|
+
* // Chaining (both must be true)
|
|
2026
|
+
* logger
|
|
2027
|
+
* .when(ctx => ctx.level === 'debug')
|
|
2028
|
+
* .when(isDevMode)
|
|
2029
|
+
* .debug('Conditional');
|
|
2030
|
+
*/
|
|
2031
|
+
when(condition) {
|
|
2032
|
+
this._tempConditions.push(condition);
|
|
2033
|
+
return this;
|
|
2034
|
+
}
|
|
2035
|
+
/**
|
|
2036
|
+
* Execute log only if condition is false (inverse of when)
|
|
2037
|
+
* Supports boolean values or predicate functions
|
|
2038
|
+
*
|
|
2039
|
+
* @example
|
|
2040
|
+
* // Boolean condition
|
|
2041
|
+
* logger.unless(isProd).debug('Not in production');
|
|
2042
|
+
*
|
|
2043
|
+
* // Predicate with context
|
|
2044
|
+
* logger.unless(ctx => ctx.level === 'error').info('Non-error log');
|
|
2045
|
+
*/
|
|
2046
|
+
unless(condition) {
|
|
2047
|
+
if (typeof condition === "function") {
|
|
2048
|
+
this._tempConditions.push((ctx) => !condition(ctx));
|
|
2049
|
+
} else {
|
|
2050
|
+
this._tempConditions.push(!condition);
|
|
2051
|
+
}
|
|
2052
|
+
return this;
|
|
2053
|
+
}
|
|
252
2054
|
getLevelPriority(level) {
|
|
253
|
-
|
|
254
|
-
debug: 0,
|
|
255
|
-
info: 1,
|
|
256
|
-
warn: 2,
|
|
257
|
-
error: 3,
|
|
258
|
-
none: 4
|
|
259
|
-
};
|
|
260
|
-
return priorities[level];
|
|
2055
|
+
return LEVEL_PRIORITIES[level];
|
|
261
2056
|
}
|
|
262
2057
|
log(level, message, ...args) {
|
|
2058
|
+
if (this._tempConditions.length > 0) {
|
|
2059
|
+
const ctx = {
|
|
2060
|
+
namespace: this._namespace,
|
|
2061
|
+
level,
|
|
2062
|
+
...this._context
|
|
2063
|
+
};
|
|
2064
|
+
const conditionsMet = this._tempConditions.every(
|
|
2065
|
+
(condition) => typeof condition === "function" ? condition(ctx) : condition
|
|
2066
|
+
);
|
|
2067
|
+
this._tempConditions = [];
|
|
2068
|
+
if (!conditionsMet) {
|
|
2069
|
+
this._tempFilterOptions = {};
|
|
2070
|
+
return;
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
263
2073
|
if (!namespace_matcher_default.matches(this._namespace, globalConfig.namespaces)) {
|
|
264
2074
|
return;
|
|
265
2075
|
}
|
|
@@ -270,8 +2080,80 @@ var Logger = class {
|
|
|
270
2080
|
} else if (this.getLevelPriority(this._level) > this.getLevelPriority(level)) {
|
|
271
2081
|
return;
|
|
272
2082
|
}
|
|
2083
|
+
const filterOptions = this._tempFilterOptions;
|
|
2084
|
+
this._tempFilterOptions = {};
|
|
2085
|
+
if (this._dedupConfig.enabled) {
|
|
2086
|
+
this.logWithDedup(level, message, filterOptions, ...args);
|
|
2087
|
+
} else {
|
|
2088
|
+
this.logImmediate(level, message, filterOptions, ...args);
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
logWithDedup(level, message, filterOptions, ...args) {
|
|
2092
|
+
const key = dedup_hasher_default.generateKey(level, message, args);
|
|
2093
|
+
const existing = this._dedupBuffer.get(key);
|
|
2094
|
+
const now = Date.now();
|
|
2095
|
+
if (existing) {
|
|
2096
|
+
existing.count++;
|
|
2097
|
+
existing.lastTimestamp = now;
|
|
2098
|
+
existing.args = args;
|
|
2099
|
+
existing.filterOptions = filterOptions;
|
|
2100
|
+
if (existing.flushTimeoutId !== void 0) {
|
|
2101
|
+
clearTimeout(existing.flushTimeoutId);
|
|
2102
|
+
}
|
|
2103
|
+
existing.flushTimeoutId = setTimeout(() => {
|
|
2104
|
+
this.flushDedupEntry(key);
|
|
2105
|
+
}, this._dedupConfig.flushInterval);
|
|
2106
|
+
} else {
|
|
2107
|
+
const entry = {
|
|
2108
|
+
key,
|
|
2109
|
+
level,
|
|
2110
|
+
message,
|
|
2111
|
+
args,
|
|
2112
|
+
count: 1,
|
|
2113
|
+
firstTimestamp: now,
|
|
2114
|
+
lastTimestamp: now,
|
|
2115
|
+
filterOptions
|
|
2116
|
+
};
|
|
2117
|
+
this._dedupBuffer.set(key, entry);
|
|
2118
|
+
entry.flushTimeoutId = setTimeout(() => {
|
|
2119
|
+
this.flushDedupEntry(key);
|
|
2120
|
+
}, this._dedupConfig.flushInterval);
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
flushDedupEntry(key) {
|
|
2124
|
+
const entry = this._dedupBuffer.get(key);
|
|
2125
|
+
if (!entry) return;
|
|
2126
|
+
let displayMessage = entry.message;
|
|
2127
|
+
if (entry.count > 1) {
|
|
2128
|
+
const firstTime = this.formatTimestamp(entry.firstTimestamp);
|
|
2129
|
+
const lastTime = this.formatTimestamp(entry.lastTimestamp);
|
|
2130
|
+
displayMessage = `${entry.message} (x${entry.count}, ${firstTime} \u2192 ${lastTime})`;
|
|
2131
|
+
}
|
|
2132
|
+
this.logImmediate(entry.level, displayMessage, entry.filterOptions || {}, ...entry.args);
|
|
2133
|
+
this._dedupBuffer.delete(key);
|
|
2134
|
+
}
|
|
2135
|
+
formatTimestamp(timestamp) {
|
|
2136
|
+
const date = new Date(timestamp);
|
|
2137
|
+
const hours = String(date.getHours()).padStart(2, "0");
|
|
2138
|
+
const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
2139
|
+
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
2140
|
+
const milliseconds = String(date.getMilliseconds()).padStart(3, "0");
|
|
2141
|
+
return `${hours}:${minutes}:${seconds}.${milliseconds}`;
|
|
2142
|
+
}
|
|
2143
|
+
logImmediate(level, message, filterOptions, ...args) {
|
|
273
2144
|
const formattedObject = Formatter.formatObj(args, {
|
|
274
|
-
maxDepth: this._maxDepth
|
|
2145
|
+
maxDepth: this._maxDepth,
|
|
2146
|
+
// Global filter fields (always applied for security)
|
|
2147
|
+
filterFields: globalConfig.filterFields,
|
|
2148
|
+
globalFilterMode: globalConfig.filterMode,
|
|
2149
|
+
globalFilterReplacement: globalConfig.filterReplacement,
|
|
2150
|
+
// Per-log pick/omit (contextual filtering)
|
|
2151
|
+
pick: filterOptions.pick,
|
|
2152
|
+
omit: filterOptions.omit,
|
|
2153
|
+
filterMode: filterOptions.filterMode,
|
|
2154
|
+
filterReplacement: filterOptions.filterReplacement,
|
|
2155
|
+
// Error serialization config
|
|
2156
|
+
errorConfig: globalConfig.errorSerialization
|
|
275
2157
|
});
|
|
276
2158
|
const formattedMessage = formattedObject ? `${message} ${formattedObject}` : message;
|
|
277
2159
|
const { logMessage, logStyles } = styler_default.style({
|
|
@@ -299,10 +2181,45 @@ var Logger = class {
|
|
|
299
2181
|
}
|
|
300
2182
|
};
|
|
301
2183
|
var plslog = ((options = {}) => {
|
|
302
|
-
|
|
2184
|
+
const normalizedOptions = typeof options === "string" ? { namespace: options } : options;
|
|
2185
|
+
return new Logger(normalizedOptions);
|
|
303
2186
|
});
|
|
304
2187
|
plslog.configure = configure;
|
|
305
2188
|
var logger_default = plslog;
|
|
2189
|
+
/*! Bundled license information:
|
|
2190
|
+
|
|
2191
|
+
react-is/cjs/react-is.production.min.js:
|
|
2192
|
+
(**
|
|
2193
|
+
* @license React
|
|
2194
|
+
* react-is.production.min.js
|
|
2195
|
+
*
|
|
2196
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2197
|
+
*
|
|
2198
|
+
* This source code is licensed under the MIT license found in the
|
|
2199
|
+
* LICENSE file in the root directory of this source tree.
|
|
2200
|
+
*)
|
|
2201
|
+
|
|
2202
|
+
react-is/cjs/react-is.development.js:
|
|
2203
|
+
(**
|
|
2204
|
+
* @license React
|
|
2205
|
+
* react-is.development.js
|
|
2206
|
+
*
|
|
2207
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2208
|
+
*
|
|
2209
|
+
* This source code is licensed under the MIT license found in the
|
|
2210
|
+
* LICENSE file in the root directory of this source tree.
|
|
2211
|
+
*)
|
|
2212
|
+
|
|
2213
|
+
pretty-format/build/index.js:
|
|
2214
|
+
(*!
|
|
2215
|
+
* /**
|
|
2216
|
+
* * Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2217
|
+
* *
|
|
2218
|
+
* * This source code is licensed under the MIT license found in the
|
|
2219
|
+
* * LICENSE file in the root directory of this source tree.
|
|
2220
|
+
* * /
|
|
2221
|
+
*)
|
|
2222
|
+
*/
|
|
306
2223
|
|
|
307
2224
|
export { logger_default as default };
|
|
308
2225
|
//# sourceMappingURL=index.mjs.map
|