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.js
CHANGED
|
@@ -1,13 +1,1544 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
|
|
29
|
+
// ../../node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/cjs/react-is.production.min.js
|
|
30
|
+
var require_react_is_production_min = __commonJS({
|
|
31
|
+
"../../node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/cjs/react-is.production.min.js"(exports$1) {
|
|
32
|
+
var b = /* @__PURE__ */ Symbol.for("react.element");
|
|
33
|
+
var c = /* @__PURE__ */ Symbol.for("react.portal");
|
|
34
|
+
var d = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
35
|
+
var e = /* @__PURE__ */ Symbol.for("react.strict_mode");
|
|
36
|
+
var f = /* @__PURE__ */ Symbol.for("react.profiler");
|
|
37
|
+
var g = /* @__PURE__ */ Symbol.for("react.provider");
|
|
38
|
+
var h = /* @__PURE__ */ Symbol.for("react.context");
|
|
39
|
+
var k = /* @__PURE__ */ Symbol.for("react.server_context");
|
|
40
|
+
var l = /* @__PURE__ */ Symbol.for("react.forward_ref");
|
|
41
|
+
var m = /* @__PURE__ */ Symbol.for("react.suspense");
|
|
42
|
+
var n = /* @__PURE__ */ Symbol.for("react.suspense_list");
|
|
43
|
+
var p = /* @__PURE__ */ Symbol.for("react.memo");
|
|
44
|
+
var q = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
45
|
+
var t = /* @__PURE__ */ Symbol.for("react.offscreen");
|
|
46
|
+
var u;
|
|
47
|
+
u = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
48
|
+
function v(a) {
|
|
49
|
+
if ("object" === typeof a && null !== a) {
|
|
50
|
+
var r = a.$$typeof;
|
|
51
|
+
switch (r) {
|
|
52
|
+
case b:
|
|
53
|
+
switch (a = a.type, a) {
|
|
54
|
+
case d:
|
|
55
|
+
case f:
|
|
56
|
+
case e:
|
|
57
|
+
case m:
|
|
58
|
+
case n:
|
|
59
|
+
return a;
|
|
60
|
+
default:
|
|
61
|
+
switch (a = a && a.$$typeof, a) {
|
|
62
|
+
case k:
|
|
63
|
+
case h:
|
|
64
|
+
case l:
|
|
65
|
+
case q:
|
|
66
|
+
case p:
|
|
67
|
+
case g:
|
|
68
|
+
return a;
|
|
69
|
+
default:
|
|
70
|
+
return r;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
case c:
|
|
74
|
+
return r;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports$1.ContextConsumer = h;
|
|
79
|
+
exports$1.ContextProvider = g;
|
|
80
|
+
exports$1.Element = b;
|
|
81
|
+
exports$1.ForwardRef = l;
|
|
82
|
+
exports$1.Fragment = d;
|
|
83
|
+
exports$1.Lazy = q;
|
|
84
|
+
exports$1.Memo = p;
|
|
85
|
+
exports$1.Portal = c;
|
|
86
|
+
exports$1.Profiler = f;
|
|
87
|
+
exports$1.StrictMode = e;
|
|
88
|
+
exports$1.Suspense = m;
|
|
89
|
+
exports$1.SuspenseList = n;
|
|
90
|
+
exports$1.isAsyncMode = function() {
|
|
91
|
+
return false;
|
|
92
|
+
};
|
|
93
|
+
exports$1.isConcurrentMode = function() {
|
|
94
|
+
return false;
|
|
95
|
+
};
|
|
96
|
+
exports$1.isContextConsumer = function(a) {
|
|
97
|
+
return v(a) === h;
|
|
98
|
+
};
|
|
99
|
+
exports$1.isContextProvider = function(a) {
|
|
100
|
+
return v(a) === g;
|
|
101
|
+
};
|
|
102
|
+
exports$1.isElement = function(a) {
|
|
103
|
+
return "object" === typeof a && null !== a && a.$$typeof === b;
|
|
104
|
+
};
|
|
105
|
+
exports$1.isForwardRef = function(a) {
|
|
106
|
+
return v(a) === l;
|
|
107
|
+
};
|
|
108
|
+
exports$1.isFragment = function(a) {
|
|
109
|
+
return v(a) === d;
|
|
110
|
+
};
|
|
111
|
+
exports$1.isLazy = function(a) {
|
|
112
|
+
return v(a) === q;
|
|
113
|
+
};
|
|
114
|
+
exports$1.isMemo = function(a) {
|
|
115
|
+
return v(a) === p;
|
|
116
|
+
};
|
|
117
|
+
exports$1.isPortal = function(a) {
|
|
118
|
+
return v(a) === c;
|
|
119
|
+
};
|
|
120
|
+
exports$1.isProfiler = function(a) {
|
|
121
|
+
return v(a) === f;
|
|
122
|
+
};
|
|
123
|
+
exports$1.isStrictMode = function(a) {
|
|
124
|
+
return v(a) === e;
|
|
125
|
+
};
|
|
126
|
+
exports$1.isSuspense = function(a) {
|
|
127
|
+
return v(a) === m;
|
|
128
|
+
};
|
|
129
|
+
exports$1.isSuspenseList = function(a) {
|
|
130
|
+
return v(a) === n;
|
|
131
|
+
};
|
|
132
|
+
exports$1.isValidElementType = function(a) {
|
|
133
|
+
return "string" === typeof a || "function" === typeof a || a === d || a === f || a === e || a === m || a === n || a === t || "object" === typeof a && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || void 0 !== a.getModuleId) ? true : false;
|
|
134
|
+
};
|
|
135
|
+
exports$1.typeOf = v;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// ../../node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/cjs/react-is.development.js
|
|
140
|
+
var require_react_is_development = __commonJS({
|
|
141
|
+
"../../node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/cjs/react-is.development.js"(exports$1) {
|
|
142
|
+
if (process.env.NODE_ENV !== "production") {
|
|
143
|
+
(function() {
|
|
144
|
+
var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element");
|
|
145
|
+
var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal");
|
|
146
|
+
var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
147
|
+
var REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode");
|
|
148
|
+
var REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler");
|
|
149
|
+
var REACT_PROVIDER_TYPE = /* @__PURE__ */ Symbol.for("react.provider");
|
|
150
|
+
var REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context");
|
|
151
|
+
var REACT_SERVER_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.server_context");
|
|
152
|
+
var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
|
|
153
|
+
var REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
|
|
154
|
+
var REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list");
|
|
155
|
+
var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
|
|
156
|
+
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
157
|
+
var REACT_OFFSCREEN_TYPE = /* @__PURE__ */ Symbol.for("react.offscreen");
|
|
158
|
+
var enableScopeAPI = false;
|
|
159
|
+
var enableCacheElement = false;
|
|
160
|
+
var enableTransitionTracing = false;
|
|
161
|
+
var enableLegacyHidden = false;
|
|
162
|
+
var enableDebugTracing = false;
|
|
163
|
+
var REACT_MODULE_REFERENCE;
|
|
164
|
+
{
|
|
165
|
+
REACT_MODULE_REFERENCE = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
166
|
+
}
|
|
167
|
+
function isValidElementType(type) {
|
|
168
|
+
if (typeof type === "string" || typeof type === "function") {
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
if (typeof type === "object" && type !== null) {
|
|
175
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
176
|
+
// types supported by any Flight configuration anywhere since
|
|
177
|
+
// we don't know which Flight build this will end up being used
|
|
178
|
+
// with.
|
|
179
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
function typeOf(object) {
|
|
186
|
+
if (typeof object === "object" && object !== null) {
|
|
187
|
+
var $$typeof = object.$$typeof;
|
|
188
|
+
switch ($$typeof) {
|
|
189
|
+
case REACT_ELEMENT_TYPE:
|
|
190
|
+
var type = object.type;
|
|
191
|
+
switch (type) {
|
|
192
|
+
case REACT_FRAGMENT_TYPE:
|
|
193
|
+
case REACT_PROFILER_TYPE:
|
|
194
|
+
case REACT_STRICT_MODE_TYPE:
|
|
195
|
+
case REACT_SUSPENSE_TYPE:
|
|
196
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
197
|
+
return type;
|
|
198
|
+
default:
|
|
199
|
+
var $$typeofType = type && type.$$typeof;
|
|
200
|
+
switch ($$typeofType) {
|
|
201
|
+
case REACT_SERVER_CONTEXT_TYPE:
|
|
202
|
+
case REACT_CONTEXT_TYPE:
|
|
203
|
+
case REACT_FORWARD_REF_TYPE:
|
|
204
|
+
case REACT_LAZY_TYPE:
|
|
205
|
+
case REACT_MEMO_TYPE:
|
|
206
|
+
case REACT_PROVIDER_TYPE:
|
|
207
|
+
return $$typeofType;
|
|
208
|
+
default:
|
|
209
|
+
return $$typeof;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
case REACT_PORTAL_TYPE:
|
|
213
|
+
return $$typeof;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return void 0;
|
|
217
|
+
}
|
|
218
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
219
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
220
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
221
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
222
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
223
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
224
|
+
var Memo = REACT_MEMO_TYPE;
|
|
225
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
226
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
227
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
228
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
229
|
+
var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
230
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
231
|
+
var hasWarnedAboutDeprecatedIsConcurrentMode = false;
|
|
232
|
+
function isAsyncMode(object) {
|
|
233
|
+
{
|
|
234
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
235
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
236
|
+
console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.");
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
function isConcurrentMode(object) {
|
|
242
|
+
{
|
|
243
|
+
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
|
|
244
|
+
hasWarnedAboutDeprecatedIsConcurrentMode = true;
|
|
245
|
+
console["warn"]("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.");
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
function isContextConsumer(object) {
|
|
251
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
252
|
+
}
|
|
253
|
+
function isContextProvider(object) {
|
|
254
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
255
|
+
}
|
|
256
|
+
function isElement(object) {
|
|
257
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
258
|
+
}
|
|
259
|
+
function isForwardRef(object) {
|
|
260
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
261
|
+
}
|
|
262
|
+
function isFragment(object) {
|
|
263
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
264
|
+
}
|
|
265
|
+
function isLazy(object) {
|
|
266
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
267
|
+
}
|
|
268
|
+
function isMemo(object) {
|
|
269
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
270
|
+
}
|
|
271
|
+
function isPortal(object) {
|
|
272
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
273
|
+
}
|
|
274
|
+
function isProfiler(object) {
|
|
275
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
276
|
+
}
|
|
277
|
+
function isStrictMode(object) {
|
|
278
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
279
|
+
}
|
|
280
|
+
function isSuspense(object) {
|
|
281
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
282
|
+
}
|
|
283
|
+
function isSuspenseList(object) {
|
|
284
|
+
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
285
|
+
}
|
|
286
|
+
exports$1.ContextConsumer = ContextConsumer;
|
|
287
|
+
exports$1.ContextProvider = ContextProvider;
|
|
288
|
+
exports$1.Element = Element;
|
|
289
|
+
exports$1.ForwardRef = ForwardRef;
|
|
290
|
+
exports$1.Fragment = Fragment;
|
|
291
|
+
exports$1.Lazy = Lazy;
|
|
292
|
+
exports$1.Memo = Memo;
|
|
293
|
+
exports$1.Portal = Portal;
|
|
294
|
+
exports$1.Profiler = Profiler;
|
|
295
|
+
exports$1.StrictMode = StrictMode;
|
|
296
|
+
exports$1.Suspense = Suspense;
|
|
297
|
+
exports$1.SuspenseList = SuspenseList;
|
|
298
|
+
exports$1.isAsyncMode = isAsyncMode;
|
|
299
|
+
exports$1.isConcurrentMode = isConcurrentMode;
|
|
300
|
+
exports$1.isContextConsumer = isContextConsumer;
|
|
301
|
+
exports$1.isContextProvider = isContextProvider;
|
|
302
|
+
exports$1.isElement = isElement;
|
|
303
|
+
exports$1.isForwardRef = isForwardRef;
|
|
304
|
+
exports$1.isFragment = isFragment;
|
|
305
|
+
exports$1.isLazy = isLazy;
|
|
306
|
+
exports$1.isMemo = isMemo;
|
|
307
|
+
exports$1.isPortal = isPortal;
|
|
308
|
+
exports$1.isProfiler = isProfiler;
|
|
309
|
+
exports$1.isStrictMode = isStrictMode;
|
|
310
|
+
exports$1.isSuspense = isSuspense;
|
|
311
|
+
exports$1.isSuspenseList = isSuspenseList;
|
|
312
|
+
exports$1.isValidElementType = isValidElementType;
|
|
313
|
+
exports$1.typeOf = typeOf;
|
|
314
|
+
})();
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
// ../../node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/index.js
|
|
320
|
+
var require_react_is = __commonJS({
|
|
321
|
+
"../../node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/index.js"(exports$1, module) {
|
|
322
|
+
if (process.env.NODE_ENV === "production") {
|
|
323
|
+
module.exports = require_react_is_production_min();
|
|
324
|
+
} else {
|
|
325
|
+
module.exports = require_react_is_development();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
// ../../node_modules/.pnpm/ansi-styles@5.2.0/node_modules/ansi-styles/index.js
|
|
331
|
+
var require_ansi_styles = __commonJS({
|
|
332
|
+
"../../node_modules/.pnpm/ansi-styles@5.2.0/node_modules/ansi-styles/index.js"(exports$1, module) {
|
|
333
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
334
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
335
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
336
|
+
function assembleStyles() {
|
|
337
|
+
const codes = /* @__PURE__ */ new Map();
|
|
338
|
+
const styles = {
|
|
339
|
+
modifier: {
|
|
340
|
+
reset: [0, 0],
|
|
341
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
342
|
+
bold: [1, 22],
|
|
343
|
+
dim: [2, 22],
|
|
344
|
+
italic: [3, 23],
|
|
345
|
+
underline: [4, 24],
|
|
346
|
+
overline: [53, 55],
|
|
347
|
+
inverse: [7, 27],
|
|
348
|
+
hidden: [8, 28],
|
|
349
|
+
strikethrough: [9, 29]
|
|
350
|
+
},
|
|
351
|
+
color: {
|
|
352
|
+
black: [30, 39],
|
|
353
|
+
red: [31, 39],
|
|
354
|
+
green: [32, 39],
|
|
355
|
+
yellow: [33, 39],
|
|
356
|
+
blue: [34, 39],
|
|
357
|
+
magenta: [35, 39],
|
|
358
|
+
cyan: [36, 39],
|
|
359
|
+
white: [37, 39],
|
|
360
|
+
// Bright color
|
|
361
|
+
blackBright: [90, 39],
|
|
362
|
+
redBright: [91, 39],
|
|
363
|
+
greenBright: [92, 39],
|
|
364
|
+
yellowBright: [93, 39],
|
|
365
|
+
blueBright: [94, 39],
|
|
366
|
+
magentaBright: [95, 39],
|
|
367
|
+
cyanBright: [96, 39],
|
|
368
|
+
whiteBright: [97, 39]
|
|
369
|
+
},
|
|
370
|
+
bgColor: {
|
|
371
|
+
bgBlack: [40, 49],
|
|
372
|
+
bgRed: [41, 49],
|
|
373
|
+
bgGreen: [42, 49],
|
|
374
|
+
bgYellow: [43, 49],
|
|
375
|
+
bgBlue: [44, 49],
|
|
376
|
+
bgMagenta: [45, 49],
|
|
377
|
+
bgCyan: [46, 49],
|
|
378
|
+
bgWhite: [47, 49],
|
|
379
|
+
// Bright color
|
|
380
|
+
bgBlackBright: [100, 49],
|
|
381
|
+
bgRedBright: [101, 49],
|
|
382
|
+
bgGreenBright: [102, 49],
|
|
383
|
+
bgYellowBright: [103, 49],
|
|
384
|
+
bgBlueBright: [104, 49],
|
|
385
|
+
bgMagentaBright: [105, 49],
|
|
386
|
+
bgCyanBright: [106, 49],
|
|
387
|
+
bgWhiteBright: [107, 49]
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
styles.color.gray = styles.color.blackBright;
|
|
391
|
+
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
|
392
|
+
styles.color.grey = styles.color.blackBright;
|
|
393
|
+
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
|
394
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
395
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
396
|
+
styles[styleName] = {
|
|
397
|
+
open: `\x1B[${style[0]}m`,
|
|
398
|
+
close: `\x1B[${style[1]}m`
|
|
399
|
+
};
|
|
400
|
+
group[styleName] = styles[styleName];
|
|
401
|
+
codes.set(style[0], style[1]);
|
|
402
|
+
}
|
|
403
|
+
Object.defineProperty(styles, groupName, {
|
|
404
|
+
value: group,
|
|
405
|
+
enumerable: false
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
Object.defineProperty(styles, "codes", {
|
|
409
|
+
value: codes,
|
|
410
|
+
enumerable: false
|
|
411
|
+
});
|
|
412
|
+
styles.color.close = "\x1B[39m";
|
|
413
|
+
styles.bgColor.close = "\x1B[49m";
|
|
414
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
415
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
416
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
417
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
418
|
+
Object.defineProperties(styles, {
|
|
419
|
+
rgbToAnsi256: {
|
|
420
|
+
value: (red, green, blue) => {
|
|
421
|
+
if (red === green && green === blue) {
|
|
422
|
+
if (red < 8) {
|
|
423
|
+
return 16;
|
|
424
|
+
}
|
|
425
|
+
if (red > 248) {
|
|
426
|
+
return 231;
|
|
427
|
+
}
|
|
428
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
429
|
+
}
|
|
430
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
431
|
+
},
|
|
432
|
+
enumerable: false
|
|
433
|
+
},
|
|
434
|
+
hexToRgb: {
|
|
435
|
+
value: (hex) => {
|
|
436
|
+
const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16));
|
|
437
|
+
if (!matches) {
|
|
438
|
+
return [0, 0, 0];
|
|
439
|
+
}
|
|
440
|
+
let { colorString } = matches.groups;
|
|
441
|
+
if (colorString.length === 3) {
|
|
442
|
+
colorString = colorString.split("").map((character) => character + character).join("");
|
|
443
|
+
}
|
|
444
|
+
const integer = Number.parseInt(colorString, 16);
|
|
445
|
+
return [
|
|
446
|
+
integer >> 16 & 255,
|
|
447
|
+
integer >> 8 & 255,
|
|
448
|
+
integer & 255
|
|
449
|
+
];
|
|
450
|
+
},
|
|
451
|
+
enumerable: false
|
|
452
|
+
},
|
|
453
|
+
hexToAnsi256: {
|
|
454
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
455
|
+
enumerable: false
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
return styles;
|
|
459
|
+
}
|
|
460
|
+
Object.defineProperty(module, "exports", {
|
|
461
|
+
enumerable: true,
|
|
462
|
+
get: assembleStyles
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
// ../../node_modules/.pnpm/pretty-format@30.2.0/node_modules/pretty-format/build/index.js
|
|
468
|
+
var require_build = __commonJS({
|
|
469
|
+
"../../node_modules/.pnpm/pretty-format@30.2.0/node_modules/pretty-format/build/index.js"(exports$1, module) {
|
|
470
|
+
(() => {
|
|
471
|
+
var __webpack_modules__ = {
|
|
472
|
+
/***/
|
|
473
|
+
"./src/collections.ts": (
|
|
474
|
+
/***/
|
|
475
|
+
((__unused_webpack_module, exports2) => {
|
|
476
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
477
|
+
value: true
|
|
478
|
+
});
|
|
479
|
+
exports2.printIteratorEntries = printIteratorEntries;
|
|
480
|
+
exports2.printIteratorValues = printIteratorValues;
|
|
481
|
+
exports2.printListItems = printListItems;
|
|
482
|
+
exports2.printObjectProperties = printObjectProperties;
|
|
483
|
+
const getKeysOfEnumerableProperties = (object, compareKeys) => {
|
|
484
|
+
const rawKeys = Object.keys(object);
|
|
485
|
+
const keys = compareKeys === null ? rawKeys : rawKeys.sort(compareKeys);
|
|
486
|
+
if (Object.getOwnPropertySymbols) {
|
|
487
|
+
for (const symbol of Object.getOwnPropertySymbols(object)) {
|
|
488
|
+
if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
|
|
489
|
+
keys.push(symbol);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return keys;
|
|
494
|
+
};
|
|
495
|
+
function printIteratorEntries(iterator, config, indentation, depth, refs, printer, separator = ": ") {
|
|
496
|
+
let result = "";
|
|
497
|
+
let width = 0;
|
|
498
|
+
let current = iterator.next();
|
|
499
|
+
if (!current.done) {
|
|
500
|
+
result += config.spacingOuter;
|
|
501
|
+
const indentationNext = indentation + config.indent;
|
|
502
|
+
while (!current.done) {
|
|
503
|
+
result += indentationNext;
|
|
504
|
+
if (width++ === config.maxWidth) {
|
|
505
|
+
result += "\u2026";
|
|
506
|
+
break;
|
|
507
|
+
}
|
|
508
|
+
const name = printer(current.value[0], config, indentationNext, depth, refs);
|
|
509
|
+
const value = printer(current.value[1], config, indentationNext, depth, refs);
|
|
510
|
+
result += name + separator + value;
|
|
511
|
+
current = iterator.next();
|
|
512
|
+
if (!current.done) {
|
|
513
|
+
result += `,${config.spacingInner}`;
|
|
514
|
+
} else if (!config.min) {
|
|
515
|
+
result += ",";
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
result += config.spacingOuter + indentation;
|
|
519
|
+
}
|
|
520
|
+
return result;
|
|
521
|
+
}
|
|
522
|
+
function printIteratorValues(iterator, config, indentation, depth, refs, printer) {
|
|
523
|
+
let result = "";
|
|
524
|
+
let width = 0;
|
|
525
|
+
let current = iterator.next();
|
|
526
|
+
if (!current.done) {
|
|
527
|
+
result += config.spacingOuter;
|
|
528
|
+
const indentationNext = indentation + config.indent;
|
|
529
|
+
while (!current.done) {
|
|
530
|
+
result += indentationNext;
|
|
531
|
+
if (width++ === config.maxWidth) {
|
|
532
|
+
result += "\u2026";
|
|
533
|
+
break;
|
|
534
|
+
}
|
|
535
|
+
result += printer(current.value, config, indentationNext, depth, refs);
|
|
536
|
+
current = iterator.next();
|
|
537
|
+
if (!current.done) {
|
|
538
|
+
result += `,${config.spacingInner}`;
|
|
539
|
+
} else if (!config.min) {
|
|
540
|
+
result += ",";
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
result += config.spacingOuter + indentation;
|
|
544
|
+
}
|
|
545
|
+
return result;
|
|
546
|
+
}
|
|
547
|
+
function printListItems(list, config, indentation, depth, refs, printer) {
|
|
548
|
+
let result = "";
|
|
549
|
+
list = list instanceof ArrayBuffer ? new DataView(list) : list;
|
|
550
|
+
const isDataView = (l) => l instanceof DataView;
|
|
551
|
+
const length = isDataView(list) ? list.byteLength : list.length;
|
|
552
|
+
if (length > 0) {
|
|
553
|
+
result += config.spacingOuter;
|
|
554
|
+
const indentationNext = indentation + config.indent;
|
|
555
|
+
for (let i = 0; i < length; i++) {
|
|
556
|
+
result += indentationNext;
|
|
557
|
+
if (i === config.maxWidth) {
|
|
558
|
+
result += "\u2026";
|
|
559
|
+
break;
|
|
560
|
+
}
|
|
561
|
+
if (isDataView(list) || i in list) {
|
|
562
|
+
result += printer(isDataView(list) ? list.getInt8(i) : list[i], config, indentationNext, depth, refs);
|
|
563
|
+
}
|
|
564
|
+
if (i < length - 1) {
|
|
565
|
+
result += `,${config.spacingInner}`;
|
|
566
|
+
} else if (!config.min) {
|
|
567
|
+
result += ",";
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
result += config.spacingOuter + indentation;
|
|
571
|
+
}
|
|
572
|
+
return result;
|
|
573
|
+
}
|
|
574
|
+
function printObjectProperties(val, config, indentation, depth, refs, printer) {
|
|
575
|
+
let result = "";
|
|
576
|
+
const keys = getKeysOfEnumerableProperties(val, config.compareKeys);
|
|
577
|
+
if (keys.length > 0) {
|
|
578
|
+
result += config.spacingOuter;
|
|
579
|
+
const indentationNext = indentation + config.indent;
|
|
580
|
+
for (let i = 0; i < keys.length; i++) {
|
|
581
|
+
const key = keys[i];
|
|
582
|
+
const name = printer(key, config, indentationNext, depth, refs);
|
|
583
|
+
const value = printer(val[key], config, indentationNext, depth, refs);
|
|
584
|
+
result += `${indentationNext + name}: ${value}`;
|
|
585
|
+
if (i < keys.length - 1) {
|
|
586
|
+
result += `,${config.spacingInner}`;
|
|
587
|
+
} else if (!config.min) {
|
|
588
|
+
result += ",";
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
result += config.spacingOuter + indentation;
|
|
592
|
+
}
|
|
593
|
+
return result;
|
|
594
|
+
}
|
|
595
|
+
})
|
|
596
|
+
),
|
|
597
|
+
/***/
|
|
598
|
+
"./src/plugins/AsymmetricMatcher.ts": (
|
|
599
|
+
/***/
|
|
600
|
+
((__unused_webpack_module, exports2, __webpack_require__2) => {
|
|
601
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
602
|
+
value: true
|
|
603
|
+
});
|
|
604
|
+
exports2.test = exports2.serialize = exports2["default"] = void 0;
|
|
605
|
+
var _collections = __webpack_require__2("./src/collections.ts");
|
|
606
|
+
var Symbol2 = globalThis["jest-symbol-do-not-touch"] || globalThis.Symbol;
|
|
607
|
+
const asymmetricMatcher = typeof Symbol2 === "function" && Symbol2.for ? Symbol2.for("jest.asymmetricMatcher") : 1267621;
|
|
608
|
+
const SPACE = " ";
|
|
609
|
+
const serialize = (val, config, indentation, depth, refs, printer) => {
|
|
610
|
+
const stringedValue = val.toString();
|
|
611
|
+
if (stringedValue === "ArrayContaining" || stringedValue === "ArrayNotContaining") {
|
|
612
|
+
if (++depth > config.maxDepth) {
|
|
613
|
+
return `[${stringedValue}]`;
|
|
614
|
+
}
|
|
615
|
+
return `${stringedValue + SPACE}[${(0, _collections.printListItems)(val.sample, config, indentation, depth, refs, printer)}]`;
|
|
616
|
+
}
|
|
617
|
+
if (stringedValue === "ObjectContaining" || stringedValue === "ObjectNotContaining") {
|
|
618
|
+
if (++depth > config.maxDepth) {
|
|
619
|
+
return `[${stringedValue}]`;
|
|
620
|
+
}
|
|
621
|
+
return `${stringedValue + SPACE}{${(0, _collections.printObjectProperties)(val.sample, config, indentation, depth, refs, printer)}}`;
|
|
622
|
+
}
|
|
623
|
+
if (stringedValue === "StringMatching" || stringedValue === "StringNotMatching") {
|
|
624
|
+
return stringedValue + SPACE + printer(val.sample, config, indentation, depth, refs);
|
|
625
|
+
}
|
|
626
|
+
if (stringedValue === "StringContaining" || stringedValue === "StringNotContaining") {
|
|
627
|
+
return stringedValue + SPACE + printer(val.sample, config, indentation, depth, refs);
|
|
628
|
+
}
|
|
629
|
+
if (stringedValue === "ArrayOf" || stringedValue === "NotArrayOf") {
|
|
630
|
+
if (++depth > config.maxDepth) {
|
|
631
|
+
return `[${stringedValue}]`;
|
|
632
|
+
}
|
|
633
|
+
return `${stringedValue + SPACE}${printer(val.sample, config, indentation, depth, refs)}`;
|
|
634
|
+
}
|
|
635
|
+
if (typeof val.toAsymmetricMatcher !== "function") {
|
|
636
|
+
throw new TypeError(`Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()`);
|
|
637
|
+
}
|
|
638
|
+
return val.toAsymmetricMatcher();
|
|
639
|
+
};
|
|
640
|
+
exports2.serialize = serialize;
|
|
641
|
+
const test = (val) => val && val.$$typeof === asymmetricMatcher;
|
|
642
|
+
exports2.test = test;
|
|
643
|
+
const plugin = {
|
|
644
|
+
serialize,
|
|
645
|
+
test
|
|
646
|
+
};
|
|
647
|
+
exports2["default"] = plugin;
|
|
648
|
+
})
|
|
649
|
+
),
|
|
650
|
+
/***/
|
|
651
|
+
"./src/plugins/DOMCollection.ts": (
|
|
652
|
+
/***/
|
|
653
|
+
((__unused_webpack_module, exports2, __webpack_require__2) => {
|
|
654
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
655
|
+
value: true
|
|
656
|
+
});
|
|
657
|
+
exports2.test = exports2.serialize = exports2["default"] = void 0;
|
|
658
|
+
var _collections = __webpack_require__2("./src/collections.ts");
|
|
659
|
+
const SPACE = " ";
|
|
660
|
+
const OBJECT_NAMES = /* @__PURE__ */ new Set(["DOMStringMap", "NamedNodeMap"]);
|
|
661
|
+
const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/;
|
|
662
|
+
const testName = (name) => OBJECT_NAMES.has(name) || ARRAY_REGEXP.test(name);
|
|
663
|
+
const test = (val) => val && val.constructor && !!val.constructor.name && testName(val.constructor.name);
|
|
664
|
+
exports2.test = test;
|
|
665
|
+
const isNamedNodeMap = (collection) => collection.constructor.name === "NamedNodeMap";
|
|
666
|
+
const serialize = (collection, config, indentation, depth, refs, printer) => {
|
|
667
|
+
const name = collection.constructor.name;
|
|
668
|
+
if (++depth > config.maxDepth) {
|
|
669
|
+
return `[${name}]`;
|
|
670
|
+
}
|
|
671
|
+
return (config.min ? "" : name + SPACE) + (OBJECT_NAMES.has(name) ? `{${(0, _collections.printObjectProperties)(isNamedNodeMap(collection) ? [...collection].reduce((props, attribute) => {
|
|
672
|
+
props[attribute.name] = attribute.value;
|
|
673
|
+
return props;
|
|
674
|
+
}, {}) : {
|
|
675
|
+
...collection
|
|
676
|
+
}, config, indentation, depth, refs, printer)}}` : `[${(0, _collections.printListItems)([...collection], config, indentation, depth, refs, printer)}]`);
|
|
677
|
+
};
|
|
678
|
+
exports2.serialize = serialize;
|
|
679
|
+
const plugin = {
|
|
680
|
+
serialize,
|
|
681
|
+
test
|
|
682
|
+
};
|
|
683
|
+
exports2["default"] = plugin;
|
|
684
|
+
})
|
|
685
|
+
),
|
|
686
|
+
/***/
|
|
687
|
+
"./src/plugins/DOMElement.ts": (
|
|
688
|
+
/***/
|
|
689
|
+
((__unused_webpack_module, exports2, __webpack_require__2) => {
|
|
690
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
691
|
+
value: true
|
|
692
|
+
});
|
|
693
|
+
exports2.test = exports2.serialize = exports2["default"] = void 0;
|
|
694
|
+
var _markup = __webpack_require__2("./src/plugins/lib/markup.ts");
|
|
695
|
+
const ELEMENT_NODE = 1;
|
|
696
|
+
const TEXT_NODE = 3;
|
|
697
|
+
const COMMENT_NODE = 8;
|
|
698
|
+
const FRAGMENT_NODE = 11;
|
|
699
|
+
const ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
|
|
700
|
+
const testHasAttribute = (val) => {
|
|
701
|
+
try {
|
|
702
|
+
return typeof val.hasAttribute === "function" && val.hasAttribute("is");
|
|
703
|
+
} catch {
|
|
704
|
+
return false;
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
const isCustomElement = (val) => {
|
|
708
|
+
const tagName = val?.tagName;
|
|
709
|
+
return typeof tagName === "string" && tagName.includes("-") || testHasAttribute(val);
|
|
710
|
+
};
|
|
711
|
+
const testNode = (val) => {
|
|
712
|
+
const constructorName = val.constructor.name;
|
|
713
|
+
const {
|
|
714
|
+
nodeType
|
|
715
|
+
} = val;
|
|
716
|
+
return nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement(val)) || nodeType === TEXT_NODE && constructorName === "Text" || nodeType === COMMENT_NODE && constructorName === "Comment" || nodeType === FRAGMENT_NODE && constructorName === "DocumentFragment";
|
|
717
|
+
};
|
|
718
|
+
const test = (val) => (val?.constructor?.name || isCustomElement(val)) && testNode(val);
|
|
719
|
+
exports2.test = test;
|
|
720
|
+
function nodeIsText(node) {
|
|
721
|
+
return node.nodeType === TEXT_NODE;
|
|
722
|
+
}
|
|
723
|
+
function nodeIsComment(node) {
|
|
724
|
+
return node.nodeType === COMMENT_NODE;
|
|
725
|
+
}
|
|
726
|
+
function nodeIsFragment(node) {
|
|
727
|
+
return node.nodeType === FRAGMENT_NODE;
|
|
728
|
+
}
|
|
729
|
+
const serialize = (node, config, indentation, depth, refs, printer) => {
|
|
730
|
+
if (nodeIsText(node)) {
|
|
731
|
+
return (0, _markup.printText)(node.data, config);
|
|
732
|
+
}
|
|
733
|
+
if (nodeIsComment(node)) {
|
|
734
|
+
return (0, _markup.printComment)(node.data, config);
|
|
735
|
+
}
|
|
736
|
+
const type = nodeIsFragment(node) ? "DocumentFragment" : node.tagName.toLowerCase();
|
|
737
|
+
if (++depth > config.maxDepth) {
|
|
738
|
+
return (0, _markup.printElementAsLeaf)(type, config);
|
|
739
|
+
}
|
|
740
|
+
return (0, _markup.printElement)(type, (0, _markup.printProps)(nodeIsFragment(node) ? [] : Array.from(node.attributes, (attr) => attr.name).sort(), nodeIsFragment(node) ? {} : [...node.attributes].reduce((props, attribute) => {
|
|
741
|
+
props[attribute.name] = attribute.value;
|
|
742
|
+
return props;
|
|
743
|
+
}, {}), config, indentation + config.indent, depth, refs, printer), (0, _markup.printChildren)(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
|
|
744
|
+
};
|
|
745
|
+
exports2.serialize = serialize;
|
|
746
|
+
const plugin = {
|
|
747
|
+
serialize,
|
|
748
|
+
test
|
|
749
|
+
};
|
|
750
|
+
exports2["default"] = plugin;
|
|
751
|
+
})
|
|
752
|
+
),
|
|
753
|
+
/***/
|
|
754
|
+
"./src/plugins/Immutable.ts": (
|
|
755
|
+
/***/
|
|
756
|
+
((__unused_webpack_module, exports2, __webpack_require__2) => {
|
|
757
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
758
|
+
value: true
|
|
759
|
+
});
|
|
760
|
+
exports2.test = exports2.serialize = exports2["default"] = void 0;
|
|
761
|
+
var _collections = __webpack_require__2("./src/collections.ts");
|
|
762
|
+
const IS_ITERABLE_SENTINEL = "@@__IMMUTABLE_ITERABLE__@@";
|
|
763
|
+
const IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@";
|
|
764
|
+
const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
|
|
765
|
+
const IS_MAP_SENTINEL = "@@__IMMUTABLE_MAP__@@";
|
|
766
|
+
const IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@";
|
|
767
|
+
const IS_RECORD_SENTINEL = "@@__IMMUTABLE_RECORD__@@";
|
|
768
|
+
const IS_SEQ_SENTINEL = "@@__IMMUTABLE_SEQ__@@";
|
|
769
|
+
const IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@";
|
|
770
|
+
const IS_STACK_SENTINEL = "@@__IMMUTABLE_STACK__@@";
|
|
771
|
+
const getImmutableName = (name) => `Immutable.${name}`;
|
|
772
|
+
const printAsLeaf = (name) => `[${name}]`;
|
|
773
|
+
const SPACE = " ";
|
|
774
|
+
const LAZY = "\u2026";
|
|
775
|
+
const printImmutableEntries = (val, config, indentation, depth, refs, printer, type) => ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}{${(0, _collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer)}}`;
|
|
776
|
+
function getRecordEntries(val) {
|
|
777
|
+
let i = 0;
|
|
778
|
+
return {
|
|
779
|
+
next() {
|
|
780
|
+
if (i < val._keys.length) {
|
|
781
|
+
const key = val._keys[i++];
|
|
782
|
+
return {
|
|
783
|
+
done: false,
|
|
784
|
+
value: [key, val.get(key)]
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
return {
|
|
788
|
+
done: true,
|
|
789
|
+
value: void 0
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
const printImmutableRecord = (val, config, indentation, depth, refs, printer) => {
|
|
795
|
+
const name = getImmutableName(val._name || "Record");
|
|
796
|
+
return ++depth > config.maxDepth ? printAsLeaf(name) : `${name + SPACE}{${(0, _collections.printIteratorEntries)(getRecordEntries(val), config, indentation, depth, refs, printer)}}`;
|
|
797
|
+
};
|
|
798
|
+
const printImmutableSeq = (val, config, indentation, depth, refs, printer) => {
|
|
799
|
+
const name = getImmutableName("Seq");
|
|
800
|
+
if (++depth > config.maxDepth) {
|
|
801
|
+
return printAsLeaf(name);
|
|
802
|
+
}
|
|
803
|
+
if (val[IS_KEYED_SENTINEL]) {
|
|
804
|
+
return `${name + SPACE}{${// from Immutable collection of entries or from ECMAScript object
|
|
805
|
+
val._iter || val._object ? (0, _collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer) : LAZY}}`;
|
|
806
|
+
}
|
|
807
|
+
return `${name + SPACE}[${val._iter || // from Immutable collection of values
|
|
808
|
+
val._array || // from ECMAScript array
|
|
809
|
+
val._collection || // from ECMAScript collection in immutable v4
|
|
810
|
+
val._iterable ? (0, _collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer) : LAZY}]`;
|
|
811
|
+
};
|
|
812
|
+
const printImmutableValues = (val, config, indentation, depth, refs, printer, type) => ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}[${(0, _collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer)}]`;
|
|
813
|
+
const serialize = (val, config, indentation, depth, refs, printer) => {
|
|
814
|
+
if (val[IS_MAP_SENTINEL]) {
|
|
815
|
+
return printImmutableEntries(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? "OrderedMap" : "Map");
|
|
816
|
+
}
|
|
817
|
+
if (val[IS_LIST_SENTINEL]) {
|
|
818
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer, "List");
|
|
819
|
+
}
|
|
820
|
+
if (val[IS_SET_SENTINEL]) {
|
|
821
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? "OrderedSet" : "Set");
|
|
822
|
+
}
|
|
823
|
+
if (val[IS_STACK_SENTINEL]) {
|
|
824
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer, "Stack");
|
|
825
|
+
}
|
|
826
|
+
if (val[IS_SEQ_SENTINEL]) {
|
|
827
|
+
return printImmutableSeq(val, config, indentation, depth, refs, printer);
|
|
828
|
+
}
|
|
829
|
+
return printImmutableRecord(val, config, indentation, depth, refs, printer);
|
|
830
|
+
};
|
|
831
|
+
exports2.serialize = serialize;
|
|
832
|
+
const test = (val) => val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
|
|
833
|
+
exports2.test = test;
|
|
834
|
+
const plugin = {
|
|
835
|
+
serialize,
|
|
836
|
+
test
|
|
837
|
+
};
|
|
838
|
+
exports2["default"] = plugin;
|
|
839
|
+
})
|
|
840
|
+
),
|
|
841
|
+
/***/
|
|
842
|
+
"./src/plugins/ReactElement.ts": (
|
|
843
|
+
/***/
|
|
844
|
+
((__unused_webpack_module, exports2, __webpack_require__2) => {
|
|
845
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
846
|
+
value: true
|
|
847
|
+
});
|
|
848
|
+
exports2.test = exports2.serialize = exports2["default"] = void 0;
|
|
849
|
+
var ReactIs = _interopRequireWildcard(require_react_is());
|
|
850
|
+
var _markup = __webpack_require__2("./src/plugins/lib/markup.ts");
|
|
851
|
+
function _interopRequireWildcard(e, t) {
|
|
852
|
+
if ("function" == typeof WeakMap) var r = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap();
|
|
853
|
+
return (_interopRequireWildcard = function(e2, t2) {
|
|
854
|
+
if (!t2 && e2 && e2.__esModule) return e2;
|
|
855
|
+
var o, i, f = { __proto__: null, default: e2 };
|
|
856
|
+
if (null === e2 || "object" != typeof e2 && "function" != typeof e2) return f;
|
|
857
|
+
if (o = t2 ? n : r) {
|
|
858
|
+
if (o.has(e2)) return o.get(e2);
|
|
859
|
+
o.set(e2, f);
|
|
860
|
+
}
|
|
861
|
+
for (const t3 in e2) "default" !== t3 && {}.hasOwnProperty.call(e2, t3) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e2, t3)) && (i.get || i.set) ? o(f, t3, i) : f[t3] = e2[t3]);
|
|
862
|
+
return f;
|
|
863
|
+
})(e, t);
|
|
864
|
+
}
|
|
865
|
+
const getChildren = (arg, children = []) => {
|
|
866
|
+
if (Array.isArray(arg)) {
|
|
867
|
+
for (const item of arg) {
|
|
868
|
+
getChildren(item, children);
|
|
869
|
+
}
|
|
870
|
+
} else if (arg != null && arg !== false && arg !== "") {
|
|
871
|
+
children.push(arg);
|
|
872
|
+
}
|
|
873
|
+
return children;
|
|
874
|
+
};
|
|
875
|
+
const getType = (element) => {
|
|
876
|
+
const type = element.type;
|
|
877
|
+
if (typeof type === "string") {
|
|
878
|
+
return type;
|
|
879
|
+
}
|
|
880
|
+
if (typeof type === "function") {
|
|
881
|
+
return type.displayName || type.name || "Unknown";
|
|
882
|
+
}
|
|
883
|
+
if (ReactIs.isFragment(element)) {
|
|
884
|
+
return "React.Fragment";
|
|
885
|
+
}
|
|
886
|
+
if (ReactIs.isSuspense(element)) {
|
|
887
|
+
return "React.Suspense";
|
|
888
|
+
}
|
|
889
|
+
if (typeof type === "object" && type !== null) {
|
|
890
|
+
if (ReactIs.isContextProvider(element)) {
|
|
891
|
+
return "Context.Provider";
|
|
892
|
+
}
|
|
893
|
+
if (ReactIs.isContextConsumer(element)) {
|
|
894
|
+
return "Context.Consumer";
|
|
895
|
+
}
|
|
896
|
+
if (ReactIs.isForwardRef(element)) {
|
|
897
|
+
if (type.displayName) {
|
|
898
|
+
return type.displayName;
|
|
899
|
+
}
|
|
900
|
+
const functionName = type.render.displayName || type.render.name || "";
|
|
901
|
+
return functionName === "" ? "ForwardRef" : `ForwardRef(${functionName})`;
|
|
902
|
+
}
|
|
903
|
+
if (ReactIs.isMemo(element)) {
|
|
904
|
+
const functionName = type.displayName || type.type.displayName || type.type.name || "";
|
|
905
|
+
return functionName === "" ? "Memo" : `Memo(${functionName})`;
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
return "UNDEFINED";
|
|
909
|
+
};
|
|
910
|
+
const getPropKeys = (element) => {
|
|
911
|
+
const {
|
|
912
|
+
props
|
|
913
|
+
} = element;
|
|
914
|
+
return Object.keys(props).filter((key) => key !== "children" && props[key] !== void 0).sort();
|
|
915
|
+
};
|
|
916
|
+
const serialize = (element, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? (0, _markup.printElementAsLeaf)(getType(element), config) : (0, _markup.printElement)(getType(element), (0, _markup.printProps)(getPropKeys(element), element.props, config, indentation + config.indent, depth, refs, printer), (0, _markup.printChildren)(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
|
|
917
|
+
exports2.serialize = serialize;
|
|
918
|
+
const test = (val) => val != null && ReactIs.isElement(val);
|
|
919
|
+
exports2.test = test;
|
|
920
|
+
const plugin = {
|
|
921
|
+
serialize,
|
|
922
|
+
test
|
|
923
|
+
};
|
|
924
|
+
exports2["default"] = plugin;
|
|
925
|
+
})
|
|
926
|
+
),
|
|
927
|
+
/***/
|
|
928
|
+
"./src/plugins/ReactTestComponent.ts": (
|
|
929
|
+
/***/
|
|
930
|
+
((__unused_webpack_module, exports2, __webpack_require__2) => {
|
|
931
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
932
|
+
value: true
|
|
933
|
+
});
|
|
934
|
+
exports2.test = exports2.serialize = exports2["default"] = void 0;
|
|
935
|
+
var _markup = __webpack_require__2("./src/plugins/lib/markup.ts");
|
|
936
|
+
var Symbol2 = globalThis["jest-symbol-do-not-touch"] || globalThis.Symbol;
|
|
937
|
+
const testSymbol = typeof Symbol2 === "function" && Symbol2.for ? Symbol2.for("react.test.json") : 245830487;
|
|
938
|
+
const getPropKeys = (object) => {
|
|
939
|
+
const {
|
|
940
|
+
props
|
|
941
|
+
} = object;
|
|
942
|
+
return props ? Object.keys(props).filter((key) => props[key] !== void 0).sort() : [];
|
|
943
|
+
};
|
|
944
|
+
const serialize = (object, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? (0, _markup.printElementAsLeaf)(object.type, config) : (0, _markup.printElement)(object.type, object.props ? (0, _markup.printProps)(getPropKeys(object), object.props, config, indentation + config.indent, depth, refs, printer) : "", object.children ? (0, _markup.printChildren)(object.children, config, indentation + config.indent, depth, refs, printer) : "", config, indentation);
|
|
945
|
+
exports2.serialize = serialize;
|
|
946
|
+
const test = (val) => val && val.$$typeof === testSymbol;
|
|
947
|
+
exports2.test = test;
|
|
948
|
+
const plugin = {
|
|
949
|
+
serialize,
|
|
950
|
+
test
|
|
951
|
+
};
|
|
952
|
+
exports2["default"] = plugin;
|
|
953
|
+
})
|
|
954
|
+
),
|
|
955
|
+
/***/
|
|
956
|
+
"./src/plugins/lib/escapeHTML.ts": (
|
|
957
|
+
/***/
|
|
958
|
+
((__unused_webpack_module, exports2) => {
|
|
959
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
960
|
+
value: true
|
|
961
|
+
});
|
|
962
|
+
exports2["default"] = escapeHTML;
|
|
963
|
+
function escapeHTML(str) {
|
|
964
|
+
return str.replaceAll("<", "<").replaceAll(">", ">");
|
|
965
|
+
}
|
|
966
|
+
})
|
|
967
|
+
),
|
|
968
|
+
/***/
|
|
969
|
+
"./src/plugins/lib/markup.ts": (
|
|
970
|
+
/***/
|
|
971
|
+
((__unused_webpack_module, exports2, __webpack_require__2) => {
|
|
972
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
973
|
+
value: true
|
|
974
|
+
});
|
|
975
|
+
exports2.printText = exports2.printProps = exports2.printElementAsLeaf = exports2.printElement = exports2.printComment = exports2.printChildren = void 0;
|
|
976
|
+
var _escapeHTML = _interopRequireDefault(__webpack_require__2("./src/plugins/lib/escapeHTML.ts"));
|
|
977
|
+
function _interopRequireDefault(e) {
|
|
978
|
+
return e && e.__esModule ? e : { default: e };
|
|
979
|
+
}
|
|
980
|
+
const printProps = (keys, props, config, indentation, depth, refs, printer) => {
|
|
981
|
+
const indentationNext = indentation + config.indent;
|
|
982
|
+
const colors = config.colors;
|
|
983
|
+
return keys.map((key) => {
|
|
984
|
+
const value = props[key];
|
|
985
|
+
let printed = printer(value, config, indentationNext, depth, refs);
|
|
986
|
+
if (typeof value !== "string") {
|
|
987
|
+
if (printed.includes("\n")) {
|
|
988
|
+
printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
|
|
989
|
+
}
|
|
990
|
+
printed = `{${printed}}`;
|
|
991
|
+
}
|
|
992
|
+
return `${config.spacingInner + indentation + colors.prop.open + key + colors.prop.close}=${colors.value.open}${printed}${colors.value.close}`;
|
|
993
|
+
}).join("");
|
|
994
|
+
};
|
|
995
|
+
exports2.printProps = printProps;
|
|
996
|
+
const printChildren = (children, config, indentation, depth, refs, printer) => children.map((child) => config.spacingOuter + indentation + (typeof child === "string" ? printText(child, config) : printer(child, config, indentation, depth, refs))).join("");
|
|
997
|
+
exports2.printChildren = printChildren;
|
|
998
|
+
const printText = (text, config) => {
|
|
999
|
+
const contentColor = config.colors.content;
|
|
1000
|
+
return contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close;
|
|
1001
|
+
};
|
|
1002
|
+
exports2.printText = printText;
|
|
1003
|
+
const printComment = (comment, config) => {
|
|
1004
|
+
const commentColor = config.colors.comment;
|
|
1005
|
+
return `${commentColor.open}<!--${(0, _escapeHTML.default)(comment)}-->${commentColor.close}`;
|
|
1006
|
+
};
|
|
1007
|
+
exports2.printComment = printComment;
|
|
1008
|
+
const printElement = (type, printedProps, printedChildren, config, indentation) => {
|
|
1009
|
+
const tagColor = config.colors.tag;
|
|
1010
|
+
return `${tagColor.open}<${type}${printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open}${printedChildren ? `>${tagColor.close}${printedChildren}${config.spacingOuter}${indentation}${tagColor.open}</${type}` : `${printedProps && !config.min ? "" : " "}/`}>${tagColor.close}`;
|
|
1011
|
+
};
|
|
1012
|
+
exports2.printElement = printElement;
|
|
1013
|
+
const printElementAsLeaf = (type, config) => {
|
|
1014
|
+
const tagColor = config.colors.tag;
|
|
1015
|
+
return `${tagColor.open}<${type}${tagColor.close} \u2026${tagColor.open} />${tagColor.close}`;
|
|
1016
|
+
};
|
|
1017
|
+
exports2.printElementAsLeaf = printElementAsLeaf;
|
|
1018
|
+
})
|
|
1019
|
+
)
|
|
1020
|
+
/******/
|
|
1021
|
+
};
|
|
1022
|
+
var __webpack_module_cache__ = {};
|
|
1023
|
+
function __webpack_require__(moduleId) {
|
|
1024
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
1025
|
+
if (cachedModule !== void 0) {
|
|
1026
|
+
return cachedModule.exports;
|
|
1027
|
+
}
|
|
1028
|
+
var module2 = __webpack_module_cache__[moduleId] = {
|
|
1029
|
+
/******/
|
|
1030
|
+
// no module.id needed
|
|
1031
|
+
/******/
|
|
1032
|
+
// no module.loaded needed
|
|
1033
|
+
/******/
|
|
1034
|
+
exports: {}
|
|
1035
|
+
/******/
|
|
1036
|
+
};
|
|
1037
|
+
__webpack_modules__[moduleId](module2, module2.exports, __webpack_require__);
|
|
1038
|
+
return module2.exports;
|
|
1039
|
+
}
|
|
1040
|
+
var __webpack_exports__ = {};
|
|
1041
|
+
(() => {
|
|
1042
|
+
var exports2 = __webpack_exports__;
|
|
1043
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
1044
|
+
value: true
|
|
1045
|
+
});
|
|
1046
|
+
exports2["default"] = exports2.DEFAULT_OPTIONS = void 0;
|
|
1047
|
+
exports2.format = format2;
|
|
1048
|
+
exports2.plugins = void 0;
|
|
1049
|
+
var _ansiStyles = _interopRequireDefault(require_ansi_styles());
|
|
1050
|
+
var _collections = __webpack_require__("./src/collections.ts");
|
|
1051
|
+
var _AsymmetricMatcher = _interopRequireDefault(__webpack_require__("./src/plugins/AsymmetricMatcher.ts"));
|
|
1052
|
+
var _DOMCollection = _interopRequireDefault(__webpack_require__("./src/plugins/DOMCollection.ts"));
|
|
1053
|
+
var _DOMElement = _interopRequireDefault(__webpack_require__("./src/plugins/DOMElement.ts"));
|
|
1054
|
+
var _Immutable = _interopRequireDefault(__webpack_require__("./src/plugins/Immutable.ts"));
|
|
1055
|
+
var _ReactElement = _interopRequireDefault(__webpack_require__("./src/plugins/ReactElement.ts"));
|
|
1056
|
+
var _ReactTestComponent = _interopRequireDefault(__webpack_require__("./src/plugins/ReactTestComponent.ts"));
|
|
1057
|
+
function _interopRequireDefault(e) {
|
|
1058
|
+
return e && e.__esModule ? e : { default: e };
|
|
1059
|
+
}
|
|
1060
|
+
const src_toString = Object.prototype.toString;
|
|
1061
|
+
const toISOString = Date.prototype.toISOString;
|
|
1062
|
+
const errorToString = Error.prototype.toString;
|
|
1063
|
+
const regExpToString = RegExp.prototype.toString;
|
|
1064
|
+
const getConstructorName = (val) => typeof val.constructor === "function" && val.constructor.name || "Object";
|
|
1065
|
+
const isWindow = (val) => (
|
|
1066
|
+
// eslint-disable-next-line unicorn/prefer-global-this
|
|
1067
|
+
typeof window !== "undefined" && val === window
|
|
1068
|
+
);
|
|
1069
|
+
const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
|
|
1070
|
+
const NEWLINE_REGEXP = /\n/gi;
|
|
1071
|
+
class PrettyFormatPluginError extends Error {
|
|
1072
|
+
constructor(message, stack) {
|
|
1073
|
+
super(message);
|
|
1074
|
+
this.stack = stack;
|
|
1075
|
+
this.name = this.constructor.name;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
function isToStringedArrayType(toStringed) {
|
|
1079
|
+
return toStringed === "[object Array]" || toStringed === "[object ArrayBuffer]" || toStringed === "[object DataView]" || toStringed === "[object Float32Array]" || toStringed === "[object Float64Array]" || toStringed === "[object Int8Array]" || toStringed === "[object Int16Array]" || toStringed === "[object Int32Array]" || toStringed === "[object Uint8Array]" || toStringed === "[object Uint8ClampedArray]" || toStringed === "[object Uint16Array]" || toStringed === "[object Uint32Array]";
|
|
1080
|
+
}
|
|
1081
|
+
function printNumber(val) {
|
|
1082
|
+
return Object.is(val, -0) ? "-0" : String(val);
|
|
1083
|
+
}
|
|
1084
|
+
function printBigInt(val) {
|
|
1085
|
+
return String(`${val}n`);
|
|
1086
|
+
}
|
|
1087
|
+
function printFunction(val, printFunctionName) {
|
|
1088
|
+
if (!printFunctionName) {
|
|
1089
|
+
return "[Function]";
|
|
1090
|
+
}
|
|
1091
|
+
return `[Function ${val.name || "anonymous"}]`;
|
|
1092
|
+
}
|
|
1093
|
+
function printSymbol(val) {
|
|
1094
|
+
return String(val).replace(SYMBOL_REGEXP, "Symbol($1)");
|
|
1095
|
+
}
|
|
1096
|
+
function printError(val) {
|
|
1097
|
+
return `[${errorToString.call(val)}]`;
|
|
1098
|
+
}
|
|
1099
|
+
function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
|
|
1100
|
+
if (val === true || val === false) {
|
|
1101
|
+
return `${val}`;
|
|
1102
|
+
}
|
|
1103
|
+
if (val === void 0) {
|
|
1104
|
+
return "undefined";
|
|
1105
|
+
}
|
|
1106
|
+
if (val === null) {
|
|
1107
|
+
return "null";
|
|
1108
|
+
}
|
|
1109
|
+
const typeOf = typeof val;
|
|
1110
|
+
if (typeOf === "number") {
|
|
1111
|
+
return printNumber(val);
|
|
1112
|
+
}
|
|
1113
|
+
if (typeOf === "bigint") {
|
|
1114
|
+
return printBigInt(val);
|
|
1115
|
+
}
|
|
1116
|
+
if (typeOf === "string") {
|
|
1117
|
+
if (escapeString) {
|
|
1118
|
+
return `"${val.replaceAll(/"|\\/g, "\\$&")}"`;
|
|
1119
|
+
}
|
|
1120
|
+
return `"${val}"`;
|
|
1121
|
+
}
|
|
1122
|
+
if (typeOf === "function") {
|
|
1123
|
+
return printFunction(val, printFunctionName);
|
|
1124
|
+
}
|
|
1125
|
+
if (typeOf === "symbol") {
|
|
1126
|
+
return printSymbol(val);
|
|
1127
|
+
}
|
|
1128
|
+
const toStringed = src_toString.call(val);
|
|
1129
|
+
if (toStringed === "[object Promise]") {
|
|
1130
|
+
return "Promise {}";
|
|
1131
|
+
}
|
|
1132
|
+
if (toStringed === "[object WeakMap]") {
|
|
1133
|
+
return "WeakMap {}";
|
|
1134
|
+
}
|
|
1135
|
+
if (toStringed === "[object WeakSet]") {
|
|
1136
|
+
return "WeakSet {}";
|
|
1137
|
+
}
|
|
1138
|
+
if (toStringed === "[object Function]" || toStringed === "[object GeneratorFunction]") {
|
|
1139
|
+
return printFunction(val, printFunctionName);
|
|
1140
|
+
}
|
|
1141
|
+
if (toStringed === "[object Symbol]") {
|
|
1142
|
+
return printSymbol(val);
|
|
1143
|
+
}
|
|
1144
|
+
if (toStringed === "[object Date]") {
|
|
1145
|
+
return Number.isNaN(+val) ? "Date { NaN }" : toISOString.call(val);
|
|
1146
|
+
}
|
|
1147
|
+
if (toStringed === "[object Error]") {
|
|
1148
|
+
return printError(val);
|
|
1149
|
+
}
|
|
1150
|
+
if (toStringed === "[object RegExp]") {
|
|
1151
|
+
if (escapeRegex) {
|
|
1152
|
+
return regExpToString.call(val).replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&");
|
|
1153
|
+
}
|
|
1154
|
+
return regExpToString.call(val);
|
|
1155
|
+
}
|
|
1156
|
+
if (val instanceof Error) {
|
|
1157
|
+
return printError(val);
|
|
1158
|
+
}
|
|
1159
|
+
return null;
|
|
1160
|
+
}
|
|
1161
|
+
function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
1162
|
+
if (refs.includes(val)) {
|
|
1163
|
+
return "[Circular]";
|
|
1164
|
+
}
|
|
1165
|
+
refs = [...refs];
|
|
1166
|
+
refs.push(val);
|
|
1167
|
+
const hitMaxDepth = ++depth > config.maxDepth;
|
|
1168
|
+
const min = config.min;
|
|
1169
|
+
if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === "function" && !hasCalledToJSON) {
|
|
1170
|
+
return printer(val.toJSON(), config, indentation, depth, refs, true);
|
|
1171
|
+
}
|
|
1172
|
+
const toStringed = src_toString.call(val);
|
|
1173
|
+
if (toStringed === "[object Arguments]") {
|
|
1174
|
+
return hitMaxDepth ? "[Arguments]" : `${min ? "" : "Arguments "}[${(0, _collections.printListItems)(val, config, indentation, depth, refs, printer)}]`;
|
|
1175
|
+
}
|
|
1176
|
+
if (isToStringedArrayType(toStringed)) {
|
|
1177
|
+
return hitMaxDepth ? `[${val.constructor.name}]` : `${min ? "" : !config.printBasicPrototype && val.constructor.name === "Array" ? "" : `${val.constructor.name} `}[${(0, _collections.printListItems)(val, config, indentation, depth, refs, printer)}]`;
|
|
1178
|
+
}
|
|
1179
|
+
if (toStringed === "[object Map]") {
|
|
1180
|
+
return hitMaxDepth ? "[Map]" : `Map {${(0, _collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer, " => ")}}`;
|
|
1181
|
+
}
|
|
1182
|
+
if (toStringed === "[object Set]") {
|
|
1183
|
+
return hitMaxDepth ? "[Set]" : `Set {${(0, _collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer)}}`;
|
|
1184
|
+
}
|
|
1185
|
+
return hitMaxDepth || isWindow(val) ? `[${getConstructorName(val)}]` : `${min ? "" : !config.printBasicPrototype && getConstructorName(val) === "Object" ? "" : `${getConstructorName(val)} `}{${(0, _collections.printObjectProperties)(val, config, indentation, depth, refs, printer)}}`;
|
|
1186
|
+
}
|
|
1187
|
+
function isNewPlugin(plugin) {
|
|
1188
|
+
return plugin.serialize != null;
|
|
1189
|
+
}
|
|
1190
|
+
function printPlugin(plugin, val, config, indentation, depth, refs) {
|
|
1191
|
+
let printed;
|
|
1192
|
+
try {
|
|
1193
|
+
printed = isNewPlugin(plugin) ? plugin.serialize(val, config, indentation, depth, refs, printer) : plugin.print(val, (valChild) => printer(valChild, config, indentation, depth, refs), (str) => {
|
|
1194
|
+
const indentationNext = indentation + config.indent;
|
|
1195
|
+
return indentationNext + str.replaceAll(NEWLINE_REGEXP, `
|
|
1196
|
+
${indentationNext}`);
|
|
1197
|
+
}, {
|
|
1198
|
+
edgeSpacing: config.spacingOuter,
|
|
1199
|
+
min: config.min,
|
|
1200
|
+
spacing: config.spacingInner
|
|
1201
|
+
}, config.colors);
|
|
1202
|
+
} catch (error) {
|
|
1203
|
+
throw new PrettyFormatPluginError(error.message, error.stack);
|
|
1204
|
+
}
|
|
1205
|
+
if (typeof printed !== "string") {
|
|
1206
|
+
throw new TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`);
|
|
1207
|
+
}
|
|
1208
|
+
return printed;
|
|
1209
|
+
}
|
|
1210
|
+
function findPlugin(plugins3, val) {
|
|
1211
|
+
for (const plugin of plugins3) {
|
|
1212
|
+
try {
|
|
1213
|
+
if (plugin.test(val)) {
|
|
1214
|
+
return plugin;
|
|
1215
|
+
}
|
|
1216
|
+
} catch (error) {
|
|
1217
|
+
throw new PrettyFormatPluginError(error.message, error.stack);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
return null;
|
|
1221
|
+
}
|
|
1222
|
+
function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
1223
|
+
const plugin = findPlugin(config.plugins, val);
|
|
1224
|
+
if (plugin !== null) {
|
|
1225
|
+
return printPlugin(plugin, val, config, indentation, depth, refs);
|
|
1226
|
+
}
|
|
1227
|
+
const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString);
|
|
1228
|
+
if (basicResult !== null) {
|
|
1229
|
+
return basicResult;
|
|
1230
|
+
}
|
|
1231
|
+
return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
|
|
1232
|
+
}
|
|
1233
|
+
const DEFAULT_THEME = {
|
|
1234
|
+
comment: "gray",
|
|
1235
|
+
content: "reset",
|
|
1236
|
+
prop: "yellow",
|
|
1237
|
+
tag: "cyan",
|
|
1238
|
+
value: "green"
|
|
1239
|
+
};
|
|
1240
|
+
const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
|
|
1241
|
+
const toOptionsSubtype = (options) => options;
|
|
1242
|
+
const DEFAULT_OPTIONS2 = exports2.DEFAULT_OPTIONS = toOptionsSubtype({
|
|
1243
|
+
callToJSON: true,
|
|
1244
|
+
compareKeys: void 0,
|
|
1245
|
+
escapeRegex: false,
|
|
1246
|
+
escapeString: true,
|
|
1247
|
+
highlight: false,
|
|
1248
|
+
indent: 2,
|
|
1249
|
+
maxDepth: Number.POSITIVE_INFINITY,
|
|
1250
|
+
maxWidth: Number.POSITIVE_INFINITY,
|
|
1251
|
+
min: false,
|
|
1252
|
+
plugins: [],
|
|
1253
|
+
printBasicPrototype: true,
|
|
1254
|
+
printFunctionName: true,
|
|
1255
|
+
theme: DEFAULT_THEME
|
|
1256
|
+
});
|
|
1257
|
+
function validateOptions(options) {
|
|
1258
|
+
for (const key of Object.keys(options)) {
|
|
1259
|
+
if (!Object.prototype.hasOwnProperty.call(DEFAULT_OPTIONS2, key)) {
|
|
1260
|
+
throw new Error(`pretty-format: Unknown option "${key}".`);
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
if (options.min && options.indent !== void 0 && options.indent !== 0) {
|
|
1264
|
+
throw new Error('pretty-format: Options "min" and "indent" cannot be used together.');
|
|
1265
|
+
}
|
|
1266
|
+
if (options.theme !== void 0) {
|
|
1267
|
+
if (options.theme === null) {
|
|
1268
|
+
throw new Error('pretty-format: Option "theme" must not be null.');
|
|
1269
|
+
}
|
|
1270
|
+
if (typeof options.theme !== "object") {
|
|
1271
|
+
throw new TypeError(`pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".`);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
const getColorsHighlight = (options) => DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
1276
|
+
const value = options.theme && options.theme[key] !== void 0 ? options.theme[key] : DEFAULT_THEME[key];
|
|
1277
|
+
const color = value && _ansiStyles.default[value];
|
|
1278
|
+
if (color && typeof color.close === "string" && typeof color.open === "string") {
|
|
1279
|
+
colors[key] = color;
|
|
1280
|
+
} else {
|
|
1281
|
+
throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`);
|
|
1282
|
+
}
|
|
1283
|
+
return colors;
|
|
1284
|
+
}, /* @__PURE__ */ Object.create(null));
|
|
1285
|
+
const getColorsEmpty = () => DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
1286
|
+
colors[key] = {
|
|
1287
|
+
close: "",
|
|
1288
|
+
open: ""
|
|
1289
|
+
};
|
|
1290
|
+
return colors;
|
|
1291
|
+
}, /* @__PURE__ */ Object.create(null));
|
|
1292
|
+
const getPrintFunctionName = (options) => options?.printFunctionName ?? DEFAULT_OPTIONS2.printFunctionName;
|
|
1293
|
+
const getEscapeRegex = (options) => options?.escapeRegex ?? DEFAULT_OPTIONS2.escapeRegex;
|
|
1294
|
+
const getEscapeString = (options) => options?.escapeString ?? DEFAULT_OPTIONS2.escapeString;
|
|
1295
|
+
const getConfig = (options) => ({
|
|
1296
|
+
callToJSON: options?.callToJSON ?? DEFAULT_OPTIONS2.callToJSON,
|
|
1297
|
+
colors: options?.highlight ? getColorsHighlight(options) : getColorsEmpty(),
|
|
1298
|
+
compareKeys: typeof options?.compareKeys === "function" || options?.compareKeys === null ? options.compareKeys : DEFAULT_OPTIONS2.compareKeys,
|
|
1299
|
+
escapeRegex: getEscapeRegex(options),
|
|
1300
|
+
escapeString: getEscapeString(options),
|
|
1301
|
+
indent: options?.min ? "" : createIndent(options?.indent ?? DEFAULT_OPTIONS2.indent),
|
|
1302
|
+
maxDepth: options?.maxDepth ?? DEFAULT_OPTIONS2.maxDepth,
|
|
1303
|
+
maxWidth: options?.maxWidth ?? DEFAULT_OPTIONS2.maxWidth,
|
|
1304
|
+
min: options?.min ?? DEFAULT_OPTIONS2.min,
|
|
1305
|
+
plugins: options?.plugins ?? DEFAULT_OPTIONS2.plugins,
|
|
1306
|
+
printBasicPrototype: options?.printBasicPrototype ?? true,
|
|
1307
|
+
printFunctionName: getPrintFunctionName(options),
|
|
1308
|
+
spacingInner: options?.min ? " " : "\n",
|
|
1309
|
+
spacingOuter: options?.min ? "" : "\n"
|
|
1310
|
+
});
|
|
1311
|
+
function createIndent(indent) {
|
|
1312
|
+
return Array.from({
|
|
1313
|
+
length: indent + 1
|
|
1314
|
+
}).join(" ");
|
|
1315
|
+
}
|
|
1316
|
+
function format2(val, options) {
|
|
1317
|
+
if (options) {
|
|
1318
|
+
validateOptions(options);
|
|
1319
|
+
if (options.plugins) {
|
|
1320
|
+
const plugin = findPlugin(options.plugins, val);
|
|
1321
|
+
if (plugin !== null) {
|
|
1322
|
+
return printPlugin(plugin, val, getConfig(options), "", 0, []);
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
const basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options), getEscapeString(options));
|
|
1327
|
+
if (basicResult !== null) {
|
|
1328
|
+
return basicResult;
|
|
1329
|
+
}
|
|
1330
|
+
return printComplexValue(val, getConfig(options), "", 0, []);
|
|
1331
|
+
}
|
|
1332
|
+
exports2.plugins = {
|
|
1333
|
+
AsymmetricMatcher: _AsymmetricMatcher.default,
|
|
1334
|
+
DOMCollection: _DOMCollection.default,
|
|
1335
|
+
DOMElement: _DOMElement.default,
|
|
1336
|
+
Immutable: _Immutable.default,
|
|
1337
|
+
ReactElement: _ReactElement.default,
|
|
1338
|
+
ReactTestComponent: _ReactTestComponent.default
|
|
1339
|
+
};
|
|
1340
|
+
exports2["default"] = format2;
|
|
1341
|
+
})();
|
|
1342
|
+
module.exports = __webpack_exports__;
|
|
1343
|
+
})();
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
4
1346
|
|
|
5
1347
|
// src/utils/validates.ts
|
|
6
1348
|
function isBase64(link) {
|
|
7
1349
|
if (!link || typeof link !== "string") return false;
|
|
1350
|
+
if (link.length < 18) return false;
|
|
8
1351
|
return link.startsWith("data:image/") && link.includes(";base64");
|
|
9
1352
|
}
|
|
1353
|
+
|
|
1354
|
+
// ../../node_modules/.pnpm/pretty-format@30.2.0/node_modules/pretty-format/build/index.mjs
|
|
1355
|
+
var import_index = __toESM(require_build());
|
|
1356
|
+
import_index.default.DEFAULT_OPTIONS;
|
|
1357
|
+
var format = import_index.default.format;
|
|
1358
|
+
import_index.default.plugins;
|
|
1359
|
+
import_index.default.default;
|
|
1360
|
+
|
|
1361
|
+
// src/formatter.ts
|
|
1362
|
+
var EXCLUDED_ERROR_PROPS = /* @__PURE__ */ new Set(["name", "message", "stack", "cause"]);
|
|
10
1363
|
var Formatter = class {
|
|
1364
|
+
/**
|
|
1365
|
+
* Check if a field should be filtered based on configured rules
|
|
1366
|
+
*/
|
|
1367
|
+
static shouldFilterField(key, value, path, filterFields) {
|
|
1368
|
+
if (!filterFields || filterFields.length === 0) {
|
|
1369
|
+
return false;
|
|
1370
|
+
}
|
|
1371
|
+
for (const filter of filterFields) {
|
|
1372
|
+
if (typeof filter === "string" && key === filter) {
|
|
1373
|
+
return true;
|
|
1374
|
+
}
|
|
1375
|
+
if (filter instanceof RegExp && filter.test(key)) {
|
|
1376
|
+
return true;
|
|
1377
|
+
}
|
|
1378
|
+
if (typeof filter === "function") {
|
|
1379
|
+
const shouldShow = filter(key, value, path);
|
|
1380
|
+
if (shouldShow === false) {
|
|
1381
|
+
return true;
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
return false;
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
* Check if a field should be included based on pick/omit rules
|
|
1389
|
+
*/
|
|
1390
|
+
static shouldIncludeField(key, value, path, options) {
|
|
1391
|
+
if (options?.pick && options.pick.length > 0) {
|
|
1392
|
+
const pathWithoutIndices = path.filter((p) => !p.startsWith("["));
|
|
1393
|
+
const fullPath = [...pathWithoutIndices, key].join(".");
|
|
1394
|
+
const isInPickList = options.pick.some((pickPath) => {
|
|
1395
|
+
if (pickPath.endsWith(".*")) {
|
|
1396
|
+
const prefix = pickPath.slice(0, -2);
|
|
1397
|
+
return fullPath.startsWith(prefix + ".") || fullPath === prefix;
|
|
1398
|
+
}
|
|
1399
|
+
if (!pickPath.includes(".") && key === pickPath) {
|
|
1400
|
+
return true;
|
|
1401
|
+
}
|
|
1402
|
+
if (fullPath === pickPath) {
|
|
1403
|
+
return true;
|
|
1404
|
+
}
|
|
1405
|
+
if (pickPath.startsWith(fullPath + ".")) {
|
|
1406
|
+
return true;
|
|
1407
|
+
}
|
|
1408
|
+
if (fullPath.startsWith(pickPath + ".")) {
|
|
1409
|
+
return true;
|
|
1410
|
+
}
|
|
1411
|
+
return false;
|
|
1412
|
+
});
|
|
1413
|
+
if (!isInPickList) {
|
|
1414
|
+
return { include: false, filtered: false };
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
if (options?.omit && options.omit.length > 0) {
|
|
1418
|
+
const shouldOmit = this.shouldFilterField(key, value, path, options.omit);
|
|
1419
|
+
if (shouldOmit) {
|
|
1420
|
+
return { include: true, filtered: true };
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
return { include: true, filtered: false };
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* Get the replacement value for a filtered field
|
|
1427
|
+
*/
|
|
1428
|
+
static getFilteredValue(value, mode = "redact", replacement = "***REDACTED***") {
|
|
1429
|
+
switch (mode) {
|
|
1430
|
+
case "redact":
|
|
1431
|
+
return replacement;
|
|
1432
|
+
case "type":
|
|
1433
|
+
if (value === null) return "[null]";
|
|
1434
|
+
if (value === void 0) return "[undefined]";
|
|
1435
|
+
if (Array.isArray(value)) return `[Array(${value.length})]`;
|
|
1436
|
+
return `[${typeof value}]`;
|
|
1437
|
+
case "length":
|
|
1438
|
+
if (typeof value === "string") return `[${value.length} chars]`;
|
|
1439
|
+
if (Array.isArray(value)) return `[${value.length} items]`;
|
|
1440
|
+
if (typeof value === "object" && value !== null) {
|
|
1441
|
+
return `[${Object.keys(value).length} keys]`;
|
|
1442
|
+
}
|
|
1443
|
+
return `[${typeof value}]`;
|
|
1444
|
+
case "hide":
|
|
1445
|
+
return void 0;
|
|
1446
|
+
// Will be removed by caller
|
|
1447
|
+
default:
|
|
1448
|
+
return replacement;
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* Sanitize sensitive data from stack traces
|
|
1453
|
+
*/
|
|
1454
|
+
static sanitizeStackTrace(stack, customPatterns) {
|
|
1455
|
+
const combinedDefaultPattern = /([?&])(token|key|secret|password|auth|api[_-]?key|access[_-]?token|client[_-]?secret)=[^&\s)#]*|\/\/[^/]*:[^@]*@|(bearer\s+)[a-zA-Z0-9\-._~+/]+=*/gi;
|
|
1456
|
+
let sanitized = stack.replace(combinedDefaultPattern, (match, urlParam, _tokenKey, bearer) => {
|
|
1457
|
+
if (urlParam) {
|
|
1458
|
+
return `${urlParam}***REDACTED***`;
|
|
1459
|
+
}
|
|
1460
|
+
if (bearer) {
|
|
1461
|
+
return `${bearer}***REDACTED***`;
|
|
1462
|
+
}
|
|
1463
|
+
return "***REDACTED***";
|
|
1464
|
+
});
|
|
1465
|
+
if (customPatterns && customPatterns.length > 0) {
|
|
1466
|
+
for (const pattern of customPatterns) {
|
|
1467
|
+
sanitized = sanitized.replace(pattern, (match, p1) => {
|
|
1468
|
+
if (p1) {
|
|
1469
|
+
return `${p1}***REDACTED***`;
|
|
1470
|
+
}
|
|
1471
|
+
return "***REDACTED***";
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
return sanitized;
|
|
1476
|
+
}
|
|
1477
|
+
/**
|
|
1478
|
+
* Serialize Error objects with all relevant properties (name, message, stack, cause)
|
|
1479
|
+
*/
|
|
1480
|
+
static serializeError(error, config, currentDepth = 0) {
|
|
1481
|
+
const maxCauseDepth = config?.maxCauseDepth ?? 10;
|
|
1482
|
+
if (currentDepth > maxCauseDepth) {
|
|
1483
|
+
return "[Max Cause Depth Reached]";
|
|
1484
|
+
}
|
|
1485
|
+
const includeStack = config?.includeStack ?? true;
|
|
1486
|
+
const includeCause = config?.includeCause ?? true;
|
|
1487
|
+
const stackFrameLimit = config?.stackFrameLimit;
|
|
1488
|
+
const sanitizeStack = config?.sanitizeStack ?? false;
|
|
1489
|
+
const serialized = {
|
|
1490
|
+
name: error.name,
|
|
1491
|
+
message: error.message
|
|
1492
|
+
};
|
|
1493
|
+
if ("code" in error) {
|
|
1494
|
+
const errorWithCode = error;
|
|
1495
|
+
if (typeof errorWithCode.code === "number") {
|
|
1496
|
+
serialized.code = errorWithCode.code;
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
if (includeStack && error.stack) {
|
|
1500
|
+
let stack = error.stack;
|
|
1501
|
+
if (sanitizeStack) {
|
|
1502
|
+
stack = this.sanitizeStackTrace(stack, config?.sanitizePatterns);
|
|
1503
|
+
}
|
|
1504
|
+
if (stackFrameLimit !== void 0 && stackFrameLimit > 0) {
|
|
1505
|
+
const lines = stack.split("\n");
|
|
1506
|
+
if (lines.length > stackFrameLimit) {
|
|
1507
|
+
stack = lines.slice(0, stackFrameLimit).join("\n") + "\n... (truncated)";
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
serialized.stack = stack;
|
|
1511
|
+
}
|
|
1512
|
+
if (includeCause && error.cause !== void 0) {
|
|
1513
|
+
if (error.cause instanceof Error) {
|
|
1514
|
+
const serializedCause = this.serializeError(error.cause, config, currentDepth + 1);
|
|
1515
|
+
serialized.cause = typeof serializedCause === "string" ? { name: "Error", message: serializedCause } : serializedCause;
|
|
1516
|
+
} else {
|
|
1517
|
+
serialized.cause = error.cause;
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
for (const key in error) {
|
|
1521
|
+
if (Object.prototype.hasOwnProperty.call(error, key)) {
|
|
1522
|
+
if (!EXCLUDED_ERROR_PROPS.has(key)) {
|
|
1523
|
+
const errorWithCustomProps = error;
|
|
1524
|
+
serialized[key] = errorWithCustomProps[key];
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
if (error.name === "AggregateError" && "errors" in error) {
|
|
1529
|
+
const aggregateError = error;
|
|
1530
|
+
if (Array.isArray(aggregateError.errors)) {
|
|
1531
|
+
serialized.errors = aggregateError.errors.map((e) => {
|
|
1532
|
+
if (e instanceof Error) {
|
|
1533
|
+
const serializedErr = this.serializeError(e, config, currentDepth + 1);
|
|
1534
|
+
return typeof serializedErr === "string" ? { name: "Error", message: serializedErr } : serializedErr;
|
|
1535
|
+
}
|
|
1536
|
+
return e;
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
return serialized;
|
|
1541
|
+
}
|
|
11
1542
|
/**
|
|
12
1543
|
* Format base64 string for logging
|
|
13
1544
|
*/
|
|
@@ -33,17 +1564,14 @@ var Formatter = class {
|
|
|
33
1564
|
/**
|
|
34
1565
|
* Helper to serialize Blob and File objects for logging
|
|
35
1566
|
*/
|
|
36
|
-
static serializeSpecialObjects(obj, maxDepth = 10, currentDepth = 0) {
|
|
1567
|
+
static serializeSpecialObjects(obj, maxDepth = 10, currentDepth = 0, filterOptions, currentPath = []) {
|
|
37
1568
|
if (currentDepth > maxDepth) return "[Max Depth Reached]";
|
|
1569
|
+
if (obj instanceof Error) {
|
|
1570
|
+
return this.serializeError(obj, filterOptions?.errorConfig, 0);
|
|
1571
|
+
}
|
|
38
1572
|
if (typeof obj === "string" && isBase64(obj)) {
|
|
39
1573
|
return this.formatBase64String(obj);
|
|
40
1574
|
}
|
|
41
|
-
if (obj instanceof Blob) {
|
|
42
|
-
return {
|
|
43
|
-
size: obj.size,
|
|
44
|
-
type: obj.type
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
1575
|
if (obj instanceof File) {
|
|
48
1576
|
return {
|
|
49
1577
|
name: obj.name,
|
|
@@ -52,14 +1580,69 @@ var Formatter = class {
|
|
|
52
1580
|
lastModified: obj.lastModified
|
|
53
1581
|
};
|
|
54
1582
|
}
|
|
1583
|
+
if (obj instanceof Blob) {
|
|
1584
|
+
return {
|
|
1585
|
+
size: obj.size,
|
|
1586
|
+
type: obj.type
|
|
1587
|
+
};
|
|
1588
|
+
}
|
|
55
1589
|
if (Array.isArray(obj)) {
|
|
56
|
-
return obj.map(
|
|
1590
|
+
return obj.map(
|
|
1591
|
+
(item, index) => this.serializeSpecialObjects(
|
|
1592
|
+
item,
|
|
1593
|
+
maxDepth,
|
|
1594
|
+
currentDepth + 1,
|
|
1595
|
+
filterOptions,
|
|
1596
|
+
[...currentPath, `[${index}]`]
|
|
1597
|
+
)
|
|
1598
|
+
);
|
|
57
1599
|
}
|
|
58
1600
|
if (obj !== null && typeof obj === "object") {
|
|
59
1601
|
const serialized = {};
|
|
60
1602
|
for (const key in obj) {
|
|
61
1603
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
62
|
-
|
|
1604
|
+
const value = obj[key];
|
|
1605
|
+
const newPath = [...currentPath, key];
|
|
1606
|
+
const { include, filtered } = this.shouldIncludeField(
|
|
1607
|
+
key,
|
|
1608
|
+
value,
|
|
1609
|
+
currentPath,
|
|
1610
|
+
filterOptions
|
|
1611
|
+
);
|
|
1612
|
+
if (!include) {
|
|
1613
|
+
continue;
|
|
1614
|
+
}
|
|
1615
|
+
let isGloballyFiltered = false;
|
|
1616
|
+
if (filterOptions?.filterFields && filterOptions.filterFields.length > 0) {
|
|
1617
|
+
isGloballyFiltered = this.shouldFilterField(key, value, currentPath, filterOptions.filterFields);
|
|
1618
|
+
}
|
|
1619
|
+
if (isGloballyFiltered) {
|
|
1620
|
+
const filteredValue = this.getFilteredValue(
|
|
1621
|
+
value,
|
|
1622
|
+
filterOptions?.globalFilterMode,
|
|
1623
|
+
filterOptions?.globalFilterReplacement
|
|
1624
|
+
);
|
|
1625
|
+
if (filteredValue !== void 0) {
|
|
1626
|
+
serialized[key] = filteredValue;
|
|
1627
|
+
}
|
|
1628
|
+
} else if (filtered) {
|
|
1629
|
+
const filteredValue = this.getFilteredValue(
|
|
1630
|
+
value,
|
|
1631
|
+
filterOptions?.filterMode,
|
|
1632
|
+
filterOptions?.filterReplacement
|
|
1633
|
+
);
|
|
1634
|
+
if (filteredValue !== void 0) {
|
|
1635
|
+
serialized[key] = filteredValue;
|
|
1636
|
+
}
|
|
1637
|
+
} else {
|
|
1638
|
+
serialized[key] = this.serializeSpecialObjects(
|
|
1639
|
+
value,
|
|
1640
|
+
maxDepth,
|
|
1641
|
+
currentDepth + 1,
|
|
1642
|
+
filterOptions,
|
|
1643
|
+
newPath
|
|
1644
|
+
);
|
|
1645
|
+
}
|
|
63
1646
|
}
|
|
64
1647
|
}
|
|
65
1648
|
return serialized;
|
|
@@ -78,10 +1661,23 @@ var Formatter = class {
|
|
|
78
1661
|
const isArray = Array.isArray(arg);
|
|
79
1662
|
if (isObject || isArray) {
|
|
80
1663
|
const maxDepth = options?.maxDepth ?? 5;
|
|
81
|
-
const serialized = this.serializeSpecialObjects(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
1664
|
+
const serialized = this.serializeSpecialObjects(
|
|
1665
|
+
arg,
|
|
1666
|
+
maxDepth,
|
|
1667
|
+
0,
|
|
1668
|
+
{
|
|
1669
|
+
pick: options?.pick,
|
|
1670
|
+
omit: options?.omit,
|
|
1671
|
+
filterFields: options?.filterFields,
|
|
1672
|
+
filterMode: options?.filterMode,
|
|
1673
|
+
filterReplacement: options?.filterReplacement,
|
|
1674
|
+
globalFilterMode: options?.globalFilterMode,
|
|
1675
|
+
globalFilterReplacement: options?.globalFilterReplacement,
|
|
1676
|
+
errorConfig: options?.errorConfig
|
|
1677
|
+
}
|
|
1678
|
+
);
|
|
1679
|
+
const formatted = format(serialized, {
|
|
1680
|
+
indent: 2,
|
|
85
1681
|
maxDepth,
|
|
86
1682
|
// Remove Object and Array labels
|
|
87
1683
|
printFunctionName: false,
|
|
@@ -110,6 +1706,10 @@ var LOG_COLORS = {
|
|
|
110
1706
|
none: "#fff"
|
|
111
1707
|
};
|
|
112
1708
|
var DEFAULT_NAMESPACE = "app";
|
|
1709
|
+
var DEFAULT_DEDUP_CONFIG = {
|
|
1710
|
+
enabled: false,
|
|
1711
|
+
flushInterval: 100
|
|
1712
|
+
};
|
|
113
1713
|
|
|
114
1714
|
// src/styler.ts
|
|
115
1715
|
function getColorForLevel(level) {
|
|
@@ -148,56 +1748,41 @@ var styler_default = Styler;
|
|
|
148
1748
|
// src/namespace-matcher.ts
|
|
149
1749
|
var NamespaceMatcher = class {
|
|
150
1750
|
constructor() {
|
|
151
|
-
this.
|
|
1751
|
+
this.cachedPositivePatterns = [];
|
|
1752
|
+
this.cachedNegativePatterns = [];
|
|
152
1753
|
this.cachedConfig = void 0;
|
|
153
1754
|
}
|
|
154
1755
|
matches(namespace, namespaces) {
|
|
155
1756
|
const ns = this.normalize(namespace);
|
|
156
1757
|
if (this.cachedConfig !== namespaces) {
|
|
157
|
-
this.
|
|
1758
|
+
this.parseAndCachePatterns(namespaces);
|
|
158
1759
|
this.cachedConfig = namespaces;
|
|
159
1760
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
negativePatterns.push(pattern.slice(1));
|
|
167
|
-
} else {
|
|
168
|
-
positivePatterns.push(pattern);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
const matches = positivePatterns.some((pattern) => {
|
|
172
|
-
if (pattern === "*") return true;
|
|
173
|
-
const normalizedPattern = this.normalize(pattern);
|
|
174
|
-
if (pattern.includes("*")) {
|
|
175
|
-
const regex = new RegExp("^" + normalizedPattern.replace(/\*/g, ".*") + "$");
|
|
176
|
-
if (regex.test(ns)) return true;
|
|
177
|
-
const basePattern = normalizedPattern.split(":")[0];
|
|
178
|
-
if (ns === basePattern && normalizedPattern.startsWith(basePattern + ":")) {
|
|
1761
|
+
if (!this.cachedPositivePatterns.length) return true;
|
|
1762
|
+
const matches = this.cachedPositivePatterns.some((entry) => {
|
|
1763
|
+
if (entry.pattern === "*") return true;
|
|
1764
|
+
if (entry.regex) {
|
|
1765
|
+
if (entry.regex.test(ns)) return true;
|
|
1766
|
+
if (entry.basePattern && ns === entry.basePattern) {
|
|
179
1767
|
return true;
|
|
180
1768
|
}
|
|
181
1769
|
return false;
|
|
182
1770
|
}
|
|
183
|
-
return ns ===
|
|
1771
|
+
return ns === entry.pattern;
|
|
184
1772
|
});
|
|
185
1773
|
if (!matches) return false;
|
|
186
|
-
for (const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
const regex = new RegExp("^" + neg.replace(/\*/g, ".*") + "$");
|
|
190
|
-
if (regex.test(ns)) {
|
|
1774
|
+
for (const entry of this.cachedNegativePatterns) {
|
|
1775
|
+
if (entry.regex) {
|
|
1776
|
+
if (entry.regex.test(ns)) {
|
|
191
1777
|
return false;
|
|
192
1778
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (ns === negPrefix || ns.startsWith(negPrefix + ":")) {
|
|
1779
|
+
if (entry.prefix) {
|
|
1780
|
+
if (ns === entry.prefix || ns.startsWith(entry.prefix + ":")) {
|
|
196
1781
|
return false;
|
|
197
1782
|
}
|
|
198
1783
|
}
|
|
199
1784
|
} else {
|
|
200
|
-
if (ns.startsWith(
|
|
1785
|
+
if (ns.startsWith(entry.pattern)) {
|
|
201
1786
|
return false;
|
|
202
1787
|
}
|
|
203
1788
|
}
|
|
@@ -208,25 +1793,118 @@ var NamespaceMatcher = class {
|
|
|
208
1793
|
if (!value) return "";
|
|
209
1794
|
return value.replace(/:+$/, "");
|
|
210
1795
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
1796
|
+
parseAndCachePatterns(namespaces) {
|
|
1797
|
+
this.cachedPositivePatterns = [];
|
|
1798
|
+
this.cachedNegativePatterns = [];
|
|
1799
|
+
if (!namespaces) return;
|
|
1800
|
+
const patterns = namespaces.split(",").map((s) => this.normalize(s.trim()));
|
|
1801
|
+
for (const pattern of patterns) {
|
|
1802
|
+
if (pattern.startsWith("-")) {
|
|
1803
|
+
const negPattern = pattern.slice(1);
|
|
1804
|
+
const normalized = this.normalize(negPattern);
|
|
1805
|
+
if (normalized.includes("*")) {
|
|
1806
|
+
const escaped = normalized.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
1807
|
+
const regex = new RegExp("^" + escaped + "$");
|
|
1808
|
+
const prefix = this.normalize(normalized.replace(/\*.*$/, ""));
|
|
1809
|
+
this.cachedNegativePatterns.push({
|
|
1810
|
+
pattern: normalized,
|
|
1811
|
+
regex,
|
|
1812
|
+
prefix: prefix || void 0
|
|
1813
|
+
});
|
|
1814
|
+
} else {
|
|
1815
|
+
this.cachedNegativePatterns.push({
|
|
1816
|
+
pattern: normalized
|
|
1817
|
+
});
|
|
1818
|
+
}
|
|
1819
|
+
} else {
|
|
1820
|
+
const normalized = this.normalize(pattern);
|
|
1821
|
+
if (normalized.includes("*")) {
|
|
1822
|
+
const escaped = normalized.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
1823
|
+
const regex = new RegExp("^" + escaped + "$");
|
|
1824
|
+
const basePattern = normalized.split(":")[0];
|
|
1825
|
+
this.cachedPositivePatterns.push({
|
|
1826
|
+
pattern: normalized,
|
|
1827
|
+
regex,
|
|
1828
|
+
basePattern: normalized.startsWith(basePattern + ":") ? basePattern : void 0
|
|
1829
|
+
});
|
|
1830
|
+
} else {
|
|
1831
|
+
this.cachedPositivePatterns.push({
|
|
1832
|
+
pattern: normalized
|
|
1833
|
+
});
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
214
1837
|
}
|
|
215
1838
|
};
|
|
216
1839
|
var namespaceMatcher = new NamespaceMatcher();
|
|
217
1840
|
var namespace_matcher_default = namespaceMatcher;
|
|
218
1841
|
|
|
1842
|
+
// src/dedup-hasher.ts
|
|
1843
|
+
var DedupHasher = class {
|
|
1844
|
+
/**
|
|
1845
|
+
* Default hash function - simple string concatenation
|
|
1846
|
+
* For better performance, we use a simple approach rather than crypto hashing
|
|
1847
|
+
*/
|
|
1848
|
+
static generateKey(level, message, args) {
|
|
1849
|
+
const argsString = this.serializeArgs(args);
|
|
1850
|
+
return `${level}:${message}:${argsString}`;
|
|
1851
|
+
}
|
|
1852
|
+
/**
|
|
1853
|
+
* Serialize arguments to a consistent string representation
|
|
1854
|
+
*/
|
|
1855
|
+
static serializeArgs(args) {
|
|
1856
|
+
if (args.length === 0) return "";
|
|
1857
|
+
try {
|
|
1858
|
+
return JSON.stringify(args, (key, value) => {
|
|
1859
|
+
if (typeof value === "function") {
|
|
1860
|
+
return "[Function]";
|
|
1861
|
+
}
|
|
1862
|
+
if (typeof value === "symbol") {
|
|
1863
|
+
return value.toString();
|
|
1864
|
+
}
|
|
1865
|
+
if (value === void 0) {
|
|
1866
|
+
return "[undefined]";
|
|
1867
|
+
}
|
|
1868
|
+
return value;
|
|
1869
|
+
});
|
|
1870
|
+
} catch (error) {
|
|
1871
|
+
return String(args);
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
};
|
|
1875
|
+
var dedup_hasher_default = DedupHasher;
|
|
1876
|
+
|
|
219
1877
|
// src/logger.ts
|
|
220
1878
|
var globalConfig = {};
|
|
1879
|
+
var LEVEL_PRIORITIES = {
|
|
1880
|
+
debug: 0,
|
|
1881
|
+
info: 1,
|
|
1882
|
+
warn: 2,
|
|
1883
|
+
error: 3,
|
|
1884
|
+
none: 4
|
|
1885
|
+
};
|
|
221
1886
|
function configure(options) {
|
|
222
1887
|
globalConfig = { ...globalConfig, ...options };
|
|
223
1888
|
}
|
|
224
1889
|
var Logger = class {
|
|
225
1890
|
constructor(options = {}) {
|
|
226
1891
|
this._level = "debug";
|
|
1892
|
+
this._dedupBuffer = /* @__PURE__ */ new Map();
|
|
1893
|
+
// Temporary filter options that reset after each log
|
|
1894
|
+
this._tempFilterOptions = {};
|
|
1895
|
+
// Custom context for conditional logging
|
|
1896
|
+
this._context = {};
|
|
1897
|
+
// Temporary conditions that reset after each log
|
|
1898
|
+
this._tempConditions = [];
|
|
227
1899
|
this._namespace = options.namespace ?? DEFAULT_NAMESPACE;
|
|
228
1900
|
this._level = options.level ?? globalConfig.level ?? "debug";
|
|
229
1901
|
this._maxDepth = options.maxDepth ?? globalConfig.maxDepth ?? 10;
|
|
1902
|
+
this._context = options.context ?? {};
|
|
1903
|
+
this._dedupConfig = {
|
|
1904
|
+
...DEFAULT_DEDUP_CONFIG,
|
|
1905
|
+
...globalConfig.dedup || {},
|
|
1906
|
+
...options.dedup || {}
|
|
1907
|
+
};
|
|
230
1908
|
}
|
|
231
1909
|
debug(message, ...args) {
|
|
232
1910
|
this.log("debug", message, ...args);
|
|
@@ -244,24 +1922,156 @@ var Logger = class {
|
|
|
244
1922
|
this.log("error", message, ...args);
|
|
245
1923
|
return this;
|
|
246
1924
|
}
|
|
1925
|
+
/**
|
|
1926
|
+
* Assert that a condition is truthy. Logs an error if the condition is falsy.
|
|
1927
|
+
* Similar to console.assert() but integrates with plslog's features.
|
|
1928
|
+
* Uses JavaScript truthiness - falsy values: false, 0, '', null, undefined, NaN
|
|
1929
|
+
*
|
|
1930
|
+
* @param condition - The condition to assert (uses JavaScript truthiness)
|
|
1931
|
+
* @param message - Error message to log if assertion fails
|
|
1932
|
+
* @param args - Additional arguments to log
|
|
1933
|
+
* @returns this for chaining
|
|
1934
|
+
*
|
|
1935
|
+
* @example
|
|
1936
|
+
* logger.assert(user !== null, 'User should not be null', user);
|
|
1937
|
+
* logger.assert(count > 0, 'Count must be positive', { count });
|
|
1938
|
+
* logger.assert(data, 'Data is required'); // Checks if data is truthy
|
|
1939
|
+
*/
|
|
1940
|
+
assert(condition, message, ...args) {
|
|
1941
|
+
if (!condition) {
|
|
1942
|
+
this.log("error", message, ...args);
|
|
1943
|
+
} else {
|
|
1944
|
+
this._tempConditions = [];
|
|
1945
|
+
this._tempFilterOptions = {};
|
|
1946
|
+
}
|
|
1947
|
+
return this;
|
|
1948
|
+
}
|
|
247
1949
|
setLevel(level) {
|
|
248
1950
|
this._level = level;
|
|
249
1951
|
}
|
|
1952
|
+
/**
|
|
1953
|
+
* Set the namespace for this logger instance
|
|
1954
|
+
* Returns this for method chaining
|
|
1955
|
+
*
|
|
1956
|
+
* @param namespace - The namespace string (e.g., 'service:api', 'component')
|
|
1957
|
+
* @returns this for chaining
|
|
1958
|
+
*
|
|
1959
|
+
* @example
|
|
1960
|
+
* const log = logger().namespace('service:api');
|
|
1961
|
+
* log.debug('Message'); // Logs with namespace 'service:api'
|
|
1962
|
+
*
|
|
1963
|
+
* // Can also be called after instantiation
|
|
1964
|
+
* const log2 = logger();
|
|
1965
|
+
* log2.namespace('component').debug('Message');
|
|
1966
|
+
*/
|
|
1967
|
+
namespace(namespace) {
|
|
1968
|
+
this._namespace = namespace;
|
|
1969
|
+
return this;
|
|
1970
|
+
}
|
|
250
1971
|
maxDepth(maxDepth) {
|
|
251
1972
|
this._maxDepth = maxDepth;
|
|
252
1973
|
return this;
|
|
253
1974
|
}
|
|
1975
|
+
/**
|
|
1976
|
+
* Pick only specific fields to log (whitelist approach)
|
|
1977
|
+
* Supports dot notation for nested fields: 'user.name', 'user.email'
|
|
1978
|
+
* Supports wildcards: 'user.*' matches all fields under user
|
|
1979
|
+
*/
|
|
1980
|
+
pick(fields) {
|
|
1981
|
+
this._tempFilterOptions.pick = fields;
|
|
1982
|
+
return this;
|
|
1983
|
+
}
|
|
1984
|
+
/**
|
|
1985
|
+
* Omit specific fields from logging (blacklist approach)
|
|
1986
|
+
* Supports strings, regex patterns, and predicate functions
|
|
1987
|
+
*/
|
|
1988
|
+
omit(fields) {
|
|
1989
|
+
this._tempFilterOptions.omit = fields;
|
|
1990
|
+
return this;
|
|
1991
|
+
}
|
|
1992
|
+
/**
|
|
1993
|
+
* Set filter mode for per-log filtering
|
|
1994
|
+
* - 'redact': Replace with custom string (default: '***REDACTED***')
|
|
1995
|
+
* - 'hide': Remove field completely
|
|
1996
|
+
* - 'type': Show type info like '[string]', '[Array(3)]'
|
|
1997
|
+
* - 'length': Show length info like '[8 chars]', '[3 items]'
|
|
1998
|
+
*/
|
|
1999
|
+
filterMode(mode, replacement) {
|
|
2000
|
+
this._tempFilterOptions.filterMode = mode;
|
|
2001
|
+
if (replacement !== void 0) {
|
|
2002
|
+
this._tempFilterOptions.filterReplacement = replacement;
|
|
2003
|
+
}
|
|
2004
|
+
return this;
|
|
2005
|
+
}
|
|
2006
|
+
once(enabled = true) {
|
|
2007
|
+
this._dedupConfig.enabled = enabled;
|
|
2008
|
+
return this;
|
|
2009
|
+
}
|
|
2010
|
+
flushDedup() {
|
|
2011
|
+
const keys = Array.from(this._dedupBuffer.keys());
|
|
2012
|
+
keys.forEach((key) => this.flushDedupEntry(key));
|
|
2013
|
+
return this;
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Execute log only if condition is true
|
|
2017
|
+
* Supports boolean values or predicate functions
|
|
2018
|
+
* Multiple when() calls are AND-ed together
|
|
2019
|
+
*
|
|
2020
|
+
* @example
|
|
2021
|
+
* // Boolean condition
|
|
2022
|
+
* logger.when(isDev).debug('Dev only');
|
|
2023
|
+
*
|
|
2024
|
+
* // Predicate with context
|
|
2025
|
+
* logger.when(ctx => ctx.namespace === 'auth').debug('Auth log');
|
|
2026
|
+
*
|
|
2027
|
+
* // Chaining (both must be true)
|
|
2028
|
+
* logger
|
|
2029
|
+
* .when(ctx => ctx.level === 'debug')
|
|
2030
|
+
* .when(isDevMode)
|
|
2031
|
+
* .debug('Conditional');
|
|
2032
|
+
*/
|
|
2033
|
+
when(condition) {
|
|
2034
|
+
this._tempConditions.push(condition);
|
|
2035
|
+
return this;
|
|
2036
|
+
}
|
|
2037
|
+
/**
|
|
2038
|
+
* Execute log only if condition is false (inverse of when)
|
|
2039
|
+
* Supports boolean values or predicate functions
|
|
2040
|
+
*
|
|
2041
|
+
* @example
|
|
2042
|
+
* // Boolean condition
|
|
2043
|
+
* logger.unless(isProd).debug('Not in production');
|
|
2044
|
+
*
|
|
2045
|
+
* // Predicate with context
|
|
2046
|
+
* logger.unless(ctx => ctx.level === 'error').info('Non-error log');
|
|
2047
|
+
*/
|
|
2048
|
+
unless(condition) {
|
|
2049
|
+
if (typeof condition === "function") {
|
|
2050
|
+
this._tempConditions.push((ctx) => !condition(ctx));
|
|
2051
|
+
} else {
|
|
2052
|
+
this._tempConditions.push(!condition);
|
|
2053
|
+
}
|
|
2054
|
+
return this;
|
|
2055
|
+
}
|
|
254
2056
|
getLevelPriority(level) {
|
|
255
|
-
|
|
256
|
-
debug: 0,
|
|
257
|
-
info: 1,
|
|
258
|
-
warn: 2,
|
|
259
|
-
error: 3,
|
|
260
|
-
none: 4
|
|
261
|
-
};
|
|
262
|
-
return priorities[level];
|
|
2057
|
+
return LEVEL_PRIORITIES[level];
|
|
263
2058
|
}
|
|
264
2059
|
log(level, message, ...args) {
|
|
2060
|
+
if (this._tempConditions.length > 0) {
|
|
2061
|
+
const ctx = {
|
|
2062
|
+
namespace: this._namespace,
|
|
2063
|
+
level,
|
|
2064
|
+
...this._context
|
|
2065
|
+
};
|
|
2066
|
+
const conditionsMet = this._tempConditions.every(
|
|
2067
|
+
(condition) => typeof condition === "function" ? condition(ctx) : condition
|
|
2068
|
+
);
|
|
2069
|
+
this._tempConditions = [];
|
|
2070
|
+
if (!conditionsMet) {
|
|
2071
|
+
this._tempFilterOptions = {};
|
|
2072
|
+
return;
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
265
2075
|
if (!namespace_matcher_default.matches(this._namespace, globalConfig.namespaces)) {
|
|
266
2076
|
return;
|
|
267
2077
|
}
|
|
@@ -272,8 +2082,80 @@ var Logger = class {
|
|
|
272
2082
|
} else if (this.getLevelPriority(this._level) > this.getLevelPriority(level)) {
|
|
273
2083
|
return;
|
|
274
2084
|
}
|
|
2085
|
+
const filterOptions = this._tempFilterOptions;
|
|
2086
|
+
this._tempFilterOptions = {};
|
|
2087
|
+
if (this._dedupConfig.enabled) {
|
|
2088
|
+
this.logWithDedup(level, message, filterOptions, ...args);
|
|
2089
|
+
} else {
|
|
2090
|
+
this.logImmediate(level, message, filterOptions, ...args);
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
logWithDedup(level, message, filterOptions, ...args) {
|
|
2094
|
+
const key = dedup_hasher_default.generateKey(level, message, args);
|
|
2095
|
+
const existing = this._dedupBuffer.get(key);
|
|
2096
|
+
const now = Date.now();
|
|
2097
|
+
if (existing) {
|
|
2098
|
+
existing.count++;
|
|
2099
|
+
existing.lastTimestamp = now;
|
|
2100
|
+
existing.args = args;
|
|
2101
|
+
existing.filterOptions = filterOptions;
|
|
2102
|
+
if (existing.flushTimeoutId !== void 0) {
|
|
2103
|
+
clearTimeout(existing.flushTimeoutId);
|
|
2104
|
+
}
|
|
2105
|
+
existing.flushTimeoutId = setTimeout(() => {
|
|
2106
|
+
this.flushDedupEntry(key);
|
|
2107
|
+
}, this._dedupConfig.flushInterval);
|
|
2108
|
+
} else {
|
|
2109
|
+
const entry = {
|
|
2110
|
+
key,
|
|
2111
|
+
level,
|
|
2112
|
+
message,
|
|
2113
|
+
args,
|
|
2114
|
+
count: 1,
|
|
2115
|
+
firstTimestamp: now,
|
|
2116
|
+
lastTimestamp: now,
|
|
2117
|
+
filterOptions
|
|
2118
|
+
};
|
|
2119
|
+
this._dedupBuffer.set(key, entry);
|
|
2120
|
+
entry.flushTimeoutId = setTimeout(() => {
|
|
2121
|
+
this.flushDedupEntry(key);
|
|
2122
|
+
}, this._dedupConfig.flushInterval);
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
flushDedupEntry(key) {
|
|
2126
|
+
const entry = this._dedupBuffer.get(key);
|
|
2127
|
+
if (!entry) return;
|
|
2128
|
+
let displayMessage = entry.message;
|
|
2129
|
+
if (entry.count > 1) {
|
|
2130
|
+
const firstTime = this.formatTimestamp(entry.firstTimestamp);
|
|
2131
|
+
const lastTime = this.formatTimestamp(entry.lastTimestamp);
|
|
2132
|
+
displayMessage = `${entry.message} (x${entry.count}, ${firstTime} \u2192 ${lastTime})`;
|
|
2133
|
+
}
|
|
2134
|
+
this.logImmediate(entry.level, displayMessage, entry.filterOptions || {}, ...entry.args);
|
|
2135
|
+
this._dedupBuffer.delete(key);
|
|
2136
|
+
}
|
|
2137
|
+
formatTimestamp(timestamp) {
|
|
2138
|
+
const date = new Date(timestamp);
|
|
2139
|
+
const hours = String(date.getHours()).padStart(2, "0");
|
|
2140
|
+
const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
2141
|
+
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
2142
|
+
const milliseconds = String(date.getMilliseconds()).padStart(3, "0");
|
|
2143
|
+
return `${hours}:${minutes}:${seconds}.${milliseconds}`;
|
|
2144
|
+
}
|
|
2145
|
+
logImmediate(level, message, filterOptions, ...args) {
|
|
275
2146
|
const formattedObject = Formatter.formatObj(args, {
|
|
276
|
-
maxDepth: this._maxDepth
|
|
2147
|
+
maxDepth: this._maxDepth,
|
|
2148
|
+
// Global filter fields (always applied for security)
|
|
2149
|
+
filterFields: globalConfig.filterFields,
|
|
2150
|
+
globalFilterMode: globalConfig.filterMode,
|
|
2151
|
+
globalFilterReplacement: globalConfig.filterReplacement,
|
|
2152
|
+
// Per-log pick/omit (contextual filtering)
|
|
2153
|
+
pick: filterOptions.pick,
|
|
2154
|
+
omit: filterOptions.omit,
|
|
2155
|
+
filterMode: filterOptions.filterMode,
|
|
2156
|
+
filterReplacement: filterOptions.filterReplacement,
|
|
2157
|
+
// Error serialization config
|
|
2158
|
+
errorConfig: globalConfig.errorSerialization
|
|
277
2159
|
});
|
|
278
2160
|
const formattedMessage = formattedObject ? `${message} ${formattedObject}` : message;
|
|
279
2161
|
const { logMessage, logStyles } = styler_default.style({
|
|
@@ -301,10 +2183,45 @@ var Logger = class {
|
|
|
301
2183
|
}
|
|
302
2184
|
};
|
|
303
2185
|
var plslog = ((options = {}) => {
|
|
304
|
-
|
|
2186
|
+
const normalizedOptions = typeof options === "string" ? { namespace: options } : options;
|
|
2187
|
+
return new Logger(normalizedOptions);
|
|
305
2188
|
});
|
|
306
2189
|
plslog.configure = configure;
|
|
307
2190
|
var logger_default = plslog;
|
|
2191
|
+
/*! Bundled license information:
|
|
2192
|
+
|
|
2193
|
+
react-is/cjs/react-is.production.min.js:
|
|
2194
|
+
(**
|
|
2195
|
+
* @license React
|
|
2196
|
+
* react-is.production.min.js
|
|
2197
|
+
*
|
|
2198
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2199
|
+
*
|
|
2200
|
+
* This source code is licensed under the MIT license found in the
|
|
2201
|
+
* LICENSE file in the root directory of this source tree.
|
|
2202
|
+
*)
|
|
2203
|
+
|
|
2204
|
+
react-is/cjs/react-is.development.js:
|
|
2205
|
+
(**
|
|
2206
|
+
* @license React
|
|
2207
|
+
* react-is.development.js
|
|
2208
|
+
*
|
|
2209
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2210
|
+
*
|
|
2211
|
+
* This source code is licensed under the MIT license found in the
|
|
2212
|
+
* LICENSE file in the root directory of this source tree.
|
|
2213
|
+
*)
|
|
2214
|
+
|
|
2215
|
+
pretty-format/build/index.js:
|
|
2216
|
+
(*!
|
|
2217
|
+
* /**
|
|
2218
|
+
* * Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2219
|
+
* *
|
|
2220
|
+
* * This source code is licensed under the MIT license found in the
|
|
2221
|
+
* * LICENSE file in the root directory of this source tree.
|
|
2222
|
+
* * /
|
|
2223
|
+
*)
|
|
2224
|
+
*/
|
|
308
2225
|
|
|
309
2226
|
module.exports = logger_default;
|
|
310
2227
|
//# sourceMappingURL=index.js.map
|