@polka-codes/cli 0.3.3 → 0.3.5

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.
@@ -0,0 +1,4250 @@
1
+ // @bun
2
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
3
+ var __require = import.meta.require;
4
+
5
+ // node_modules/pino-std-serializers/lib/err-helpers.js
6
+ var require_err_helpers = __commonJS((exports, module) => {
7
+ var isErrorLike = (err) => {
8
+ return err && typeof err.message === "string";
9
+ };
10
+ var getErrorCause = (err) => {
11
+ if (!err)
12
+ return;
13
+ const cause = err.cause;
14
+ if (typeof cause === "function") {
15
+ const causeResult = err.cause();
16
+ return isErrorLike(causeResult) ? causeResult : undefined;
17
+ } else {
18
+ return isErrorLike(cause) ? cause : undefined;
19
+ }
20
+ };
21
+ var _stackWithCauses = (err, seen) => {
22
+ if (!isErrorLike(err))
23
+ return "";
24
+ const stack = err.stack || "";
25
+ if (seen.has(err)) {
26
+ return stack + `
27
+ causes have become circular...`;
28
+ }
29
+ const cause = getErrorCause(err);
30
+ if (cause) {
31
+ seen.add(err);
32
+ return stack + `
33
+ caused by: ` + _stackWithCauses(cause, seen);
34
+ } else {
35
+ return stack;
36
+ }
37
+ };
38
+ var stackWithCauses = (err) => _stackWithCauses(err, new Set);
39
+ var _messageWithCauses = (err, seen, skip) => {
40
+ if (!isErrorLike(err))
41
+ return "";
42
+ const message = skip ? "" : err.message || "";
43
+ if (seen.has(err)) {
44
+ return message + ": ...";
45
+ }
46
+ const cause = getErrorCause(err);
47
+ if (cause) {
48
+ seen.add(err);
49
+ const skipIfVErrorStyleCause = typeof err.cause === "function";
50
+ return message + (skipIfVErrorStyleCause ? "" : ": ") + _messageWithCauses(cause, seen, skipIfVErrorStyleCause);
51
+ } else {
52
+ return message;
53
+ }
54
+ };
55
+ var messageWithCauses = (err) => _messageWithCauses(err, new Set);
56
+ module.exports = {
57
+ isErrorLike,
58
+ getErrorCause,
59
+ stackWithCauses,
60
+ messageWithCauses
61
+ };
62
+ });
63
+
64
+ // node_modules/pino-std-serializers/lib/err-proto.js
65
+ var require_err_proto = __commonJS((exports, module) => {
66
+ var seen = Symbol("circular-ref-tag");
67
+ var rawSymbol = Symbol("pino-raw-err-ref");
68
+ var pinoErrProto = Object.create({}, {
69
+ type: {
70
+ enumerable: true,
71
+ writable: true,
72
+ value: undefined
73
+ },
74
+ message: {
75
+ enumerable: true,
76
+ writable: true,
77
+ value: undefined
78
+ },
79
+ stack: {
80
+ enumerable: true,
81
+ writable: true,
82
+ value: undefined
83
+ },
84
+ aggregateErrors: {
85
+ enumerable: true,
86
+ writable: true,
87
+ value: undefined
88
+ },
89
+ raw: {
90
+ enumerable: false,
91
+ get: function() {
92
+ return this[rawSymbol];
93
+ },
94
+ set: function(val) {
95
+ this[rawSymbol] = val;
96
+ }
97
+ }
98
+ });
99
+ Object.defineProperty(pinoErrProto, rawSymbol, {
100
+ writable: true,
101
+ value: {}
102
+ });
103
+ module.exports = {
104
+ pinoErrProto,
105
+ pinoErrorSymbols: {
106
+ seen,
107
+ rawSymbol
108
+ }
109
+ };
110
+ });
111
+
112
+ // node_modules/pino-std-serializers/lib/err.js
113
+ var require_err = __commonJS((exports, module) => {
114
+ module.exports = errSerializer;
115
+ var { messageWithCauses, stackWithCauses, isErrorLike } = require_err_helpers();
116
+ var { pinoErrProto, pinoErrorSymbols } = require_err_proto();
117
+ var { seen } = pinoErrorSymbols;
118
+ var { toString } = Object.prototype;
119
+ function errSerializer(err) {
120
+ if (!isErrorLike(err)) {
121
+ return err;
122
+ }
123
+ err[seen] = undefined;
124
+ const _err = Object.create(pinoErrProto);
125
+ _err.type = toString.call(err.constructor) === "[object Function]" ? err.constructor.name : err.name;
126
+ _err.message = messageWithCauses(err);
127
+ _err.stack = stackWithCauses(err);
128
+ if (Array.isArray(err.errors)) {
129
+ _err.aggregateErrors = err.errors.map((err2) => errSerializer(err2));
130
+ }
131
+ for (const key in err) {
132
+ if (_err[key] === undefined) {
133
+ const val = err[key];
134
+ if (isErrorLike(val)) {
135
+ if (key !== "cause" && !Object.prototype.hasOwnProperty.call(val, seen)) {
136
+ _err[key] = errSerializer(val);
137
+ }
138
+ } else {
139
+ _err[key] = val;
140
+ }
141
+ }
142
+ }
143
+ delete err[seen];
144
+ _err.raw = err;
145
+ return _err;
146
+ }
147
+ });
148
+
149
+ // node_modules/pino-std-serializers/lib/err-with-cause.js
150
+ var require_err_with_cause = __commonJS((exports, module) => {
151
+ module.exports = errWithCauseSerializer;
152
+ var { isErrorLike } = require_err_helpers();
153
+ var { pinoErrProto, pinoErrorSymbols } = require_err_proto();
154
+ var { seen } = pinoErrorSymbols;
155
+ var { toString } = Object.prototype;
156
+ function errWithCauseSerializer(err) {
157
+ if (!isErrorLike(err)) {
158
+ return err;
159
+ }
160
+ err[seen] = undefined;
161
+ const _err = Object.create(pinoErrProto);
162
+ _err.type = toString.call(err.constructor) === "[object Function]" ? err.constructor.name : err.name;
163
+ _err.message = err.message;
164
+ _err.stack = err.stack;
165
+ if (Array.isArray(err.errors)) {
166
+ _err.aggregateErrors = err.errors.map((err2) => errWithCauseSerializer(err2));
167
+ }
168
+ if (isErrorLike(err.cause) && !Object.prototype.hasOwnProperty.call(err.cause, seen)) {
169
+ _err.cause = errWithCauseSerializer(err.cause);
170
+ }
171
+ for (const key in err) {
172
+ if (_err[key] === undefined) {
173
+ const val = err[key];
174
+ if (isErrorLike(val)) {
175
+ if (!Object.prototype.hasOwnProperty.call(val, seen)) {
176
+ _err[key] = errWithCauseSerializer(val);
177
+ }
178
+ } else {
179
+ _err[key] = val;
180
+ }
181
+ }
182
+ }
183
+ delete err[seen];
184
+ _err.raw = err;
185
+ return _err;
186
+ }
187
+ });
188
+
189
+ // node_modules/pino-std-serializers/lib/req.js
190
+ var require_req = __commonJS((exports, module) => {
191
+ module.exports = {
192
+ mapHttpRequest,
193
+ reqSerializer
194
+ };
195
+ var rawSymbol = Symbol("pino-raw-req-ref");
196
+ var pinoReqProto = Object.create({}, {
197
+ id: {
198
+ enumerable: true,
199
+ writable: true,
200
+ value: ""
201
+ },
202
+ method: {
203
+ enumerable: true,
204
+ writable: true,
205
+ value: ""
206
+ },
207
+ url: {
208
+ enumerable: true,
209
+ writable: true,
210
+ value: ""
211
+ },
212
+ query: {
213
+ enumerable: true,
214
+ writable: true,
215
+ value: ""
216
+ },
217
+ params: {
218
+ enumerable: true,
219
+ writable: true,
220
+ value: ""
221
+ },
222
+ headers: {
223
+ enumerable: true,
224
+ writable: true,
225
+ value: {}
226
+ },
227
+ remoteAddress: {
228
+ enumerable: true,
229
+ writable: true,
230
+ value: ""
231
+ },
232
+ remotePort: {
233
+ enumerable: true,
234
+ writable: true,
235
+ value: ""
236
+ },
237
+ raw: {
238
+ enumerable: false,
239
+ get: function() {
240
+ return this[rawSymbol];
241
+ },
242
+ set: function(val) {
243
+ this[rawSymbol] = val;
244
+ }
245
+ }
246
+ });
247
+ Object.defineProperty(pinoReqProto, rawSymbol, {
248
+ writable: true,
249
+ value: {}
250
+ });
251
+ function reqSerializer(req) {
252
+ const connection = req.info || req.socket;
253
+ const _req = Object.create(pinoReqProto);
254
+ _req.id = typeof req.id === "function" ? req.id() : req.id || (req.info ? req.info.id : undefined);
255
+ _req.method = req.method;
256
+ if (req.originalUrl) {
257
+ _req.url = req.originalUrl;
258
+ } else {
259
+ const path = req.path;
260
+ _req.url = typeof path === "string" ? path : req.url ? req.url.path || req.url : undefined;
261
+ }
262
+ if (req.query) {
263
+ _req.query = req.query;
264
+ }
265
+ if (req.params) {
266
+ _req.params = req.params;
267
+ }
268
+ _req.headers = req.headers;
269
+ _req.remoteAddress = connection && connection.remoteAddress;
270
+ _req.remotePort = connection && connection.remotePort;
271
+ _req.raw = req.raw || req;
272
+ return _req;
273
+ }
274
+ function mapHttpRequest(req) {
275
+ return {
276
+ req: reqSerializer(req)
277
+ };
278
+ }
279
+ });
280
+
281
+ // node_modules/pino-std-serializers/lib/res.js
282
+ var require_res = __commonJS((exports, module) => {
283
+ module.exports = {
284
+ mapHttpResponse,
285
+ resSerializer
286
+ };
287
+ var rawSymbol = Symbol("pino-raw-res-ref");
288
+ var pinoResProto = Object.create({}, {
289
+ statusCode: {
290
+ enumerable: true,
291
+ writable: true,
292
+ value: 0
293
+ },
294
+ headers: {
295
+ enumerable: true,
296
+ writable: true,
297
+ value: ""
298
+ },
299
+ raw: {
300
+ enumerable: false,
301
+ get: function() {
302
+ return this[rawSymbol];
303
+ },
304
+ set: function(val) {
305
+ this[rawSymbol] = val;
306
+ }
307
+ }
308
+ });
309
+ Object.defineProperty(pinoResProto, rawSymbol, {
310
+ writable: true,
311
+ value: {}
312
+ });
313
+ function resSerializer(res) {
314
+ const _res = Object.create(pinoResProto);
315
+ _res.statusCode = res.headersSent ? res.statusCode : null;
316
+ _res.headers = res.getHeaders ? res.getHeaders() : res._headers;
317
+ _res.raw = res;
318
+ return _res;
319
+ }
320
+ function mapHttpResponse(res) {
321
+ return {
322
+ res: resSerializer(res)
323
+ };
324
+ }
325
+ });
326
+
327
+ // node_modules/pino-std-serializers/index.js
328
+ var require_pino_std_serializers = __commonJS((exports, module) => {
329
+ var errSerializer = require_err();
330
+ var errWithCauseSerializer = require_err_with_cause();
331
+ var reqSerializers = require_req();
332
+ var resSerializers = require_res();
333
+ module.exports = {
334
+ err: errSerializer,
335
+ errWithCause: errWithCauseSerializer,
336
+ mapHttpRequest: reqSerializers.mapHttpRequest,
337
+ mapHttpResponse: resSerializers.mapHttpResponse,
338
+ req: reqSerializers.reqSerializer,
339
+ res: resSerializers.resSerializer,
340
+ wrapErrorSerializer: function wrapErrorSerializer(customSerializer) {
341
+ if (customSerializer === errSerializer)
342
+ return customSerializer;
343
+ return function wrapErrSerializer(err) {
344
+ return customSerializer(errSerializer(err));
345
+ };
346
+ },
347
+ wrapRequestSerializer: function wrapRequestSerializer(customSerializer) {
348
+ if (customSerializer === reqSerializers.reqSerializer)
349
+ return customSerializer;
350
+ return function wrappedReqSerializer(req) {
351
+ return customSerializer(reqSerializers.reqSerializer(req));
352
+ };
353
+ },
354
+ wrapResponseSerializer: function wrapResponseSerializer(customSerializer) {
355
+ if (customSerializer === resSerializers.resSerializer)
356
+ return customSerializer;
357
+ return function wrappedResSerializer(res) {
358
+ return customSerializer(resSerializers.resSerializer(res));
359
+ };
360
+ }
361
+ };
362
+ });
363
+
364
+ // node_modules/pino/lib/caller.js
365
+ var require_caller = __commonJS((exports, module) => {
366
+ function noOpPrepareStackTrace(_, stack) {
367
+ return stack;
368
+ }
369
+ module.exports = function getCallers() {
370
+ const originalPrepare = Error.prepareStackTrace;
371
+ Error.prepareStackTrace = noOpPrepareStackTrace;
372
+ const stack = new Error().stack;
373
+ Error.prepareStackTrace = originalPrepare;
374
+ if (!Array.isArray(stack)) {
375
+ return;
376
+ }
377
+ const entries = stack.slice(2);
378
+ const fileNames = [];
379
+ for (const entry of entries) {
380
+ if (!entry) {
381
+ continue;
382
+ }
383
+ fileNames.push(entry.getFileName());
384
+ }
385
+ return fileNames;
386
+ };
387
+ });
388
+
389
+ // node_modules/fast-redact/lib/validator.js
390
+ var require_validator = __commonJS((exports, module) => {
391
+ module.exports = validator;
392
+ function validator(opts = {}) {
393
+ const {
394
+ ERR_PATHS_MUST_BE_STRINGS = () => "fast-redact - Paths must be (non-empty) strings",
395
+ ERR_INVALID_PATH = (s) => `fast-redact \u2013 Invalid path (${s})`
396
+ } = opts;
397
+ return function validate({ paths }) {
398
+ paths.forEach((s) => {
399
+ if (typeof s !== "string") {
400
+ throw Error(ERR_PATHS_MUST_BE_STRINGS());
401
+ }
402
+ try {
403
+ if (/\u3007/.test(s))
404
+ throw Error();
405
+ const expr = (s[0] === "[" ? "" : ".") + s.replace(/^\*/, "\u3007").replace(/\.\*/g, ".\u3007").replace(/\[\*\]/g, "[\u3007]");
406
+ if (/\n|\r|;/.test(expr))
407
+ throw Error();
408
+ if (/\/\*/.test(expr))
409
+ throw Error();
410
+ Function(`
411
+ 'use strict'
412
+ const o = new Proxy({}, { get: () => o, set: () => { throw Error() } });
413
+ const \u3007 = null;
414
+ o${expr}
415
+ if ([o${expr}].length !== 1) throw Error()`)();
416
+ } catch (e) {
417
+ throw Error(ERR_INVALID_PATH(s));
418
+ }
419
+ });
420
+ };
421
+ }
422
+ });
423
+
424
+ // node_modules/fast-redact/lib/rx.js
425
+ var require_rx = __commonJS((exports, module) => {
426
+ module.exports = /[^.[\]]+|\[((?:.)*?)\]/g;
427
+ });
428
+
429
+ // node_modules/fast-redact/lib/parse.js
430
+ var require_parse = __commonJS((exports, module) => {
431
+ var rx = require_rx();
432
+ module.exports = parse;
433
+ function parse({ paths }) {
434
+ const wildcards = [];
435
+ var wcLen = 0;
436
+ const secret = paths.reduce(function(o, strPath, ix) {
437
+ var path = strPath.match(rx).map((p) => p.replace(/'|"|`/g, ""));
438
+ const leadingBracket = strPath[0] === "[";
439
+ path = path.map((p) => {
440
+ if (p[0] === "[")
441
+ return p.substr(1, p.length - 2);
442
+ else
443
+ return p;
444
+ });
445
+ const star = path.indexOf("*");
446
+ if (star > -1) {
447
+ const before = path.slice(0, star);
448
+ const beforeStr = before.join(".");
449
+ const after = path.slice(star + 1, path.length);
450
+ const nested = after.length > 0;
451
+ wcLen++;
452
+ wildcards.push({
453
+ before,
454
+ beforeStr,
455
+ after,
456
+ nested
457
+ });
458
+ } else {
459
+ o[strPath] = {
460
+ path,
461
+ val: undefined,
462
+ precensored: false,
463
+ circle: "",
464
+ escPath: JSON.stringify(strPath),
465
+ leadingBracket
466
+ };
467
+ }
468
+ return o;
469
+ }, {});
470
+ return { wildcards, wcLen, secret };
471
+ }
472
+ });
473
+
474
+ // node_modules/fast-redact/lib/redactor.js
475
+ var require_redactor = __commonJS((exports, module) => {
476
+ var rx = require_rx();
477
+ module.exports = redactor;
478
+ function redactor({ secret, serialize, wcLen, strict, isCensorFct, censorFctTakesPath }, state) {
479
+ const redact = Function("o", `
480
+ if (typeof o !== 'object' || o == null) {
481
+ ${strictImpl(strict, serialize)}
482
+ }
483
+ const { censor, secret } = this
484
+ const originalSecret = {}
485
+ const secretKeys = Object.keys(secret)
486
+ for (var i = 0; i < secretKeys.length; i++) {
487
+ originalSecret[secretKeys[i]] = secret[secretKeys[i]]
488
+ }
489
+
490
+ ${redactTmpl(secret, isCensorFct, censorFctTakesPath)}
491
+ this.compileRestore()
492
+ ${dynamicRedactTmpl(wcLen > 0, isCensorFct, censorFctTakesPath)}
493
+ this.secret = originalSecret
494
+ ${resultTmpl(serialize)}
495
+ `).bind(state);
496
+ redact.state = state;
497
+ if (serialize === false) {
498
+ redact.restore = (o) => state.restore(o);
499
+ }
500
+ return redact;
501
+ }
502
+ function redactTmpl(secret, isCensorFct, censorFctTakesPath) {
503
+ return Object.keys(secret).map((path) => {
504
+ const { escPath, leadingBracket, path: arrPath } = secret[path];
505
+ const skip = leadingBracket ? 1 : 0;
506
+ const delim = leadingBracket ? "" : ".";
507
+ const hops = [];
508
+ var match;
509
+ while ((match = rx.exec(path)) !== null) {
510
+ const [, ix] = match;
511
+ const { index, input } = match;
512
+ if (index > skip)
513
+ hops.push(input.substring(0, index - (ix ? 0 : 1)));
514
+ }
515
+ var existence = hops.map((p) => `o${delim}${p}`).join(" && ");
516
+ if (existence.length === 0)
517
+ existence += `o${delim}${path} != null`;
518
+ else
519
+ existence += ` && o${delim}${path} != null`;
520
+ const circularDetection = `
521
+ switch (true) {
522
+ ${hops.reverse().map((p) => `
523
+ case o${delim}${p} === censor:
524
+ secret[${escPath}].circle = ${JSON.stringify(p)}
525
+ break
526
+ `).join(`
527
+ `)}
528
+ }
529
+ `;
530
+ const censorArgs = censorFctTakesPath ? `val, ${JSON.stringify(arrPath)}` : `val`;
531
+ return `
532
+ if (${existence}) {
533
+ const val = o${delim}${path}
534
+ if (val === censor) {
535
+ secret[${escPath}].precensored = true
536
+ } else {
537
+ secret[${escPath}].val = val
538
+ o${delim}${path} = ${isCensorFct ? `censor(${censorArgs})` : "censor"}
539
+ ${circularDetection}
540
+ }
541
+ }
542
+ `;
543
+ }).join(`
544
+ `);
545
+ }
546
+ function dynamicRedactTmpl(hasWildcards, isCensorFct, censorFctTakesPath) {
547
+ return hasWildcards === true ? `
548
+ {
549
+ const { wildcards, wcLen, groupRedact, nestedRedact } = this
550
+ for (var i = 0; i < wcLen; i++) {
551
+ const { before, beforeStr, after, nested } = wildcards[i]
552
+ if (nested === true) {
553
+ secret[beforeStr] = secret[beforeStr] || []
554
+ nestedRedact(secret[beforeStr], o, before, after, censor, ${isCensorFct}, ${censorFctTakesPath})
555
+ } else secret[beforeStr] = groupRedact(o, before, censor, ${isCensorFct}, ${censorFctTakesPath})
556
+ }
557
+ }
558
+ ` : "";
559
+ }
560
+ function resultTmpl(serialize) {
561
+ return serialize === false ? `return o` : `
562
+ var s = this.serialize(o)
563
+ this.restore(o)
564
+ return s
565
+ `;
566
+ }
567
+ function strictImpl(strict, serialize) {
568
+ return strict === true ? `throw Error('fast-redact: primitives cannot be redacted')` : serialize === false ? `return o` : `return this.serialize(o)`;
569
+ }
570
+ });
571
+
572
+ // node_modules/fast-redact/lib/modifiers.js
573
+ var require_modifiers = __commonJS((exports, module) => {
574
+ module.exports = {
575
+ groupRedact,
576
+ groupRestore,
577
+ nestedRedact,
578
+ nestedRestore
579
+ };
580
+ function groupRestore({ keys, values, target }) {
581
+ if (target == null || typeof target === "string")
582
+ return;
583
+ const length = keys.length;
584
+ for (var i = 0;i < length; i++) {
585
+ const k = keys[i];
586
+ target[k] = values[i];
587
+ }
588
+ }
589
+ function groupRedact(o, path, censor, isCensorFct, censorFctTakesPath) {
590
+ const target = get(o, path);
591
+ if (target == null || typeof target === "string")
592
+ return { keys: null, values: null, target, flat: true };
593
+ const keys = Object.keys(target);
594
+ const keysLength = keys.length;
595
+ const pathLength = path.length;
596
+ const pathWithKey = censorFctTakesPath ? [...path] : undefined;
597
+ const values = new Array(keysLength);
598
+ for (var i = 0;i < keysLength; i++) {
599
+ const key = keys[i];
600
+ values[i] = target[key];
601
+ if (censorFctTakesPath) {
602
+ pathWithKey[pathLength] = key;
603
+ target[key] = censor(target[key], pathWithKey);
604
+ } else if (isCensorFct) {
605
+ target[key] = censor(target[key]);
606
+ } else {
607
+ target[key] = censor;
608
+ }
609
+ }
610
+ return { keys, values, target, flat: true };
611
+ }
612
+ function nestedRestore(instructions) {
613
+ for (let i = 0;i < instructions.length; i++) {
614
+ const { target, path, value } = instructions[i];
615
+ let current = target;
616
+ for (let i2 = path.length - 1;i2 > 0; i2--) {
617
+ current = current[path[i2]];
618
+ }
619
+ current[path[0]] = value;
620
+ }
621
+ }
622
+ function nestedRedact(store, o, path, ns, censor, isCensorFct, censorFctTakesPath) {
623
+ const target = get(o, path);
624
+ if (target == null)
625
+ return;
626
+ const keys = Object.keys(target);
627
+ const keysLength = keys.length;
628
+ for (var i = 0;i < keysLength; i++) {
629
+ const key = keys[i];
630
+ specialSet(store, target, key, path, ns, censor, isCensorFct, censorFctTakesPath);
631
+ }
632
+ return store;
633
+ }
634
+ function has(obj, prop) {
635
+ return obj !== undefined && obj !== null ? "hasOwn" in Object ? Object.hasOwn(obj, prop) : Object.prototype.hasOwnProperty.call(obj, prop) : false;
636
+ }
637
+ function specialSet(store, o, k, path, afterPath, censor, isCensorFct, censorFctTakesPath) {
638
+ const afterPathLen = afterPath.length;
639
+ const lastPathIndex = afterPathLen - 1;
640
+ const originalKey = k;
641
+ var i = -1;
642
+ var n;
643
+ var nv;
644
+ var ov;
645
+ var oov = null;
646
+ var wc = null;
647
+ var kIsWc;
648
+ var wcov;
649
+ var consecutive = false;
650
+ var level = 0;
651
+ var depth = 0;
652
+ var redactPathCurrent = tree();
653
+ ov = n = o[k];
654
+ if (typeof n !== "object")
655
+ return;
656
+ while (n != null && ++i < afterPathLen) {
657
+ depth += 1;
658
+ k = afterPath[i];
659
+ oov = ov;
660
+ if (k !== "*" && !wc && !(typeof n === "object" && (k in n))) {
661
+ break;
662
+ }
663
+ if (k === "*") {
664
+ if (wc === "*") {
665
+ consecutive = true;
666
+ }
667
+ wc = k;
668
+ if (i !== lastPathIndex) {
669
+ continue;
670
+ }
671
+ }
672
+ if (wc) {
673
+ const wcKeys = Object.keys(n);
674
+ for (var j = 0;j < wcKeys.length; j++) {
675
+ const wck = wcKeys[j];
676
+ wcov = n[wck];
677
+ kIsWc = k === "*";
678
+ if (consecutive) {
679
+ redactPathCurrent = node(redactPathCurrent, wck, depth);
680
+ level = i;
681
+ ov = iterateNthLevel(wcov, level - 1, k, path, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, o[originalKey], depth + 1);
682
+ } else {
683
+ if (kIsWc || typeof wcov === "object" && wcov !== null && k in wcov) {
684
+ if (kIsWc) {
685
+ ov = wcov;
686
+ } else {
687
+ ov = wcov[k];
688
+ }
689
+ nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path, originalKey, ...afterPath]) : censor(ov) : censor;
690
+ if (kIsWc) {
691
+ const rv = restoreInstr(node(redactPathCurrent, wck, depth), ov, o[originalKey]);
692
+ store.push(rv);
693
+ n[wck] = nv;
694
+ } else {
695
+ if (wcov[k] === nv) {
696
+ } else if (nv === undefined && censor !== undefined || has(wcov, k) && nv === ov) {
697
+ redactPathCurrent = node(redactPathCurrent, wck, depth);
698
+ } else {
699
+ redactPathCurrent = node(redactPathCurrent, wck, depth);
700
+ const rv = restoreInstr(node(redactPathCurrent, k, depth + 1), ov, o[originalKey]);
701
+ store.push(rv);
702
+ wcov[k] = nv;
703
+ }
704
+ }
705
+ }
706
+ }
707
+ }
708
+ wc = null;
709
+ } else {
710
+ ov = n[k];
711
+ redactPathCurrent = node(redactPathCurrent, k, depth);
712
+ nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path, originalKey, ...afterPath]) : censor(ov) : censor;
713
+ if (has(n, k) && nv === ov || nv === undefined && censor !== undefined) {
714
+ } else {
715
+ const rv = restoreInstr(redactPathCurrent, ov, o[originalKey]);
716
+ store.push(rv);
717
+ n[k] = nv;
718
+ }
719
+ n = n[k];
720
+ }
721
+ if (typeof n !== "object")
722
+ break;
723
+ if (ov === oov || typeof ov === "undefined") {
724
+ }
725
+ }
726
+ }
727
+ function get(o, p) {
728
+ var i = -1;
729
+ var l = p.length;
730
+ var n = o;
731
+ while (n != null && ++i < l) {
732
+ n = n[p[i]];
733
+ }
734
+ return n;
735
+ }
736
+ function iterateNthLevel(wcov, level, k, path, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, parent, depth) {
737
+ if (level === 0) {
738
+ if (kIsWc || typeof wcov === "object" && wcov !== null && k in wcov) {
739
+ if (kIsWc) {
740
+ ov = wcov;
741
+ } else {
742
+ ov = wcov[k];
743
+ }
744
+ nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path, originalKey, ...afterPath]) : censor(ov) : censor;
745
+ if (kIsWc) {
746
+ const rv = restoreInstr(redactPathCurrent, ov, parent);
747
+ store.push(rv);
748
+ n[wck] = nv;
749
+ } else {
750
+ if (wcov[k] === nv) {
751
+ } else if (nv === undefined && censor !== undefined || has(wcov, k) && nv === ov) {
752
+ } else {
753
+ const rv = restoreInstr(node(redactPathCurrent, k, depth + 1), ov, parent);
754
+ store.push(rv);
755
+ wcov[k] = nv;
756
+ }
757
+ }
758
+ }
759
+ }
760
+ for (const key in wcov) {
761
+ if (typeof wcov[key] === "object") {
762
+ redactPathCurrent = node(redactPathCurrent, key, depth);
763
+ iterateNthLevel(wcov[key], level - 1, k, path, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, parent, depth + 1);
764
+ }
765
+ }
766
+ }
767
+ function tree() {
768
+ return { parent: null, key: null, children: [], depth: 0 };
769
+ }
770
+ function node(parent, key, depth) {
771
+ if (parent.depth === depth) {
772
+ return node(parent.parent, key, depth);
773
+ }
774
+ var child = {
775
+ parent,
776
+ key,
777
+ depth,
778
+ children: []
779
+ };
780
+ parent.children.push(child);
781
+ return child;
782
+ }
783
+ function restoreInstr(node2, value, target) {
784
+ let current = node2;
785
+ const path = [];
786
+ do {
787
+ path.push(current.key);
788
+ current = current.parent;
789
+ } while (current.parent != null);
790
+ return { path, value, target };
791
+ }
792
+ });
793
+
794
+ // node_modules/fast-redact/lib/restorer.js
795
+ var require_restorer = __commonJS((exports, module) => {
796
+ var { groupRestore, nestedRestore } = require_modifiers();
797
+ module.exports = restorer;
798
+ function restorer() {
799
+ return function compileRestore() {
800
+ if (this.restore) {
801
+ this.restore.state.secret = this.secret;
802
+ return;
803
+ }
804
+ const { secret, wcLen } = this;
805
+ const paths = Object.keys(secret);
806
+ const resetters = resetTmpl(secret, paths);
807
+ const hasWildcards = wcLen > 0;
808
+ const state = hasWildcards ? { secret, groupRestore, nestedRestore } : { secret };
809
+ this.restore = Function("o", restoreTmpl(resetters, paths, hasWildcards)).bind(state);
810
+ this.restore.state = state;
811
+ };
812
+ }
813
+ function resetTmpl(secret, paths) {
814
+ return paths.map((path) => {
815
+ const { circle, escPath, leadingBracket } = secret[path];
816
+ const delim = leadingBracket ? "" : ".";
817
+ const reset = circle ? `o.${circle} = secret[${escPath}].val` : `o${delim}${path} = secret[${escPath}].val`;
818
+ const clear = `secret[${escPath}].val = undefined`;
819
+ return `
820
+ if (secret[${escPath}].val !== undefined) {
821
+ try { ${reset} } catch (e) {}
822
+ ${clear}
823
+ }
824
+ `;
825
+ }).join("");
826
+ }
827
+ function restoreTmpl(resetters, paths, hasWildcards) {
828
+ const dynamicReset = hasWildcards === true ? `
829
+ const keys = Object.keys(secret)
830
+ const len = keys.length
831
+ for (var i = len - 1; i >= ${paths.length}; i--) {
832
+ const k = keys[i]
833
+ const o = secret[k]
834
+ if (o) {
835
+ if (o.flat === true) this.groupRestore(o)
836
+ else this.nestedRestore(o)
837
+ secret[k] = null
838
+ }
839
+ }
840
+ ` : "";
841
+ return `
842
+ const secret = this.secret
843
+ ${dynamicReset}
844
+ ${resetters}
845
+ return o
846
+ `;
847
+ }
848
+ });
849
+
850
+ // node_modules/fast-redact/lib/state.js
851
+ var require_state = __commonJS((exports, module) => {
852
+ module.exports = state;
853
+ function state(o) {
854
+ const {
855
+ secret,
856
+ censor,
857
+ compileRestore,
858
+ serialize,
859
+ groupRedact,
860
+ nestedRedact,
861
+ wildcards,
862
+ wcLen
863
+ } = o;
864
+ const builder = [{ secret, censor, compileRestore }];
865
+ if (serialize !== false)
866
+ builder.push({ serialize });
867
+ if (wcLen > 0)
868
+ builder.push({ groupRedact, nestedRedact, wildcards, wcLen });
869
+ return Object.assign(...builder);
870
+ }
871
+ });
872
+
873
+ // node_modules/fast-redact/index.js
874
+ var require_fast_redact = __commonJS((exports, module) => {
875
+ var validator = require_validator();
876
+ var parse = require_parse();
877
+ var redactor = require_redactor();
878
+ var restorer = require_restorer();
879
+ var { groupRedact, nestedRedact } = require_modifiers();
880
+ var state = require_state();
881
+ var rx = require_rx();
882
+ var validate = validator();
883
+ var noop = (o) => o;
884
+ noop.restore = noop;
885
+ var DEFAULT_CENSOR = "[REDACTED]";
886
+ fastRedact.rx = rx;
887
+ fastRedact.validator = validator;
888
+ module.exports = fastRedact;
889
+ function fastRedact(opts = {}) {
890
+ const paths = Array.from(new Set(opts.paths || []));
891
+ const serialize = "serialize" in opts ? opts.serialize === false ? opts.serialize : typeof opts.serialize === "function" ? opts.serialize : JSON.stringify : JSON.stringify;
892
+ const remove = opts.remove;
893
+ if (remove === true && serialize !== JSON.stringify) {
894
+ throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify");
895
+ }
896
+ const censor = remove === true ? undefined : ("censor" in opts) ? opts.censor : DEFAULT_CENSOR;
897
+ const isCensorFct = typeof censor === "function";
898
+ const censorFctTakesPath = isCensorFct && censor.length > 1;
899
+ if (paths.length === 0)
900
+ return serialize || noop;
901
+ validate({ paths, serialize, censor });
902
+ const { wildcards, wcLen, secret } = parse({ paths, censor });
903
+ const compileRestore = restorer();
904
+ const strict = "strict" in opts ? opts.strict : true;
905
+ return redactor({ secret, wcLen, serialize, strict, isCensorFct, censorFctTakesPath }, state({
906
+ secret,
907
+ censor,
908
+ compileRestore,
909
+ serialize,
910
+ groupRedact,
911
+ nestedRedact,
912
+ wildcards,
913
+ wcLen
914
+ }));
915
+ }
916
+ });
917
+
918
+ // node_modules/pino/lib/symbols.js
919
+ var require_symbols = __commonJS((exports, module) => {
920
+ var setLevelSym = Symbol("pino.setLevel");
921
+ var getLevelSym = Symbol("pino.getLevel");
922
+ var levelValSym = Symbol("pino.levelVal");
923
+ var levelCompSym = Symbol("pino.levelComp");
924
+ var useLevelLabelsSym = Symbol("pino.useLevelLabels");
925
+ var useOnlyCustomLevelsSym = Symbol("pino.useOnlyCustomLevels");
926
+ var mixinSym = Symbol("pino.mixin");
927
+ var lsCacheSym = Symbol("pino.lsCache");
928
+ var chindingsSym = Symbol("pino.chindings");
929
+ var asJsonSym = Symbol("pino.asJson");
930
+ var writeSym = Symbol("pino.write");
931
+ var redactFmtSym = Symbol("pino.redactFmt");
932
+ var timeSym = Symbol("pino.time");
933
+ var timeSliceIndexSym = Symbol("pino.timeSliceIndex");
934
+ var streamSym = Symbol("pino.stream");
935
+ var stringifySym = Symbol("pino.stringify");
936
+ var stringifySafeSym = Symbol("pino.stringifySafe");
937
+ var stringifiersSym = Symbol("pino.stringifiers");
938
+ var endSym = Symbol("pino.end");
939
+ var formatOptsSym = Symbol("pino.formatOpts");
940
+ var messageKeySym = Symbol("pino.messageKey");
941
+ var errorKeySym = Symbol("pino.errorKey");
942
+ var nestedKeySym = Symbol("pino.nestedKey");
943
+ var nestedKeyStrSym = Symbol("pino.nestedKeyStr");
944
+ var mixinMergeStrategySym = Symbol("pino.mixinMergeStrategy");
945
+ var msgPrefixSym = Symbol("pino.msgPrefix");
946
+ var wildcardFirstSym = Symbol("pino.wildcardFirst");
947
+ var serializersSym = Symbol.for("pino.serializers");
948
+ var formattersSym = Symbol.for("pino.formatters");
949
+ var hooksSym = Symbol.for("pino.hooks");
950
+ var needsMetadataGsym = Symbol.for("pino.metadata");
951
+ module.exports = {
952
+ setLevelSym,
953
+ getLevelSym,
954
+ levelValSym,
955
+ levelCompSym,
956
+ useLevelLabelsSym,
957
+ mixinSym,
958
+ lsCacheSym,
959
+ chindingsSym,
960
+ asJsonSym,
961
+ writeSym,
962
+ serializersSym,
963
+ redactFmtSym,
964
+ timeSym,
965
+ timeSliceIndexSym,
966
+ streamSym,
967
+ stringifySym,
968
+ stringifySafeSym,
969
+ stringifiersSym,
970
+ endSym,
971
+ formatOptsSym,
972
+ messageKeySym,
973
+ errorKeySym,
974
+ nestedKeySym,
975
+ wildcardFirstSym,
976
+ needsMetadataGsym,
977
+ useOnlyCustomLevelsSym,
978
+ formattersSym,
979
+ hooksSym,
980
+ nestedKeyStrSym,
981
+ mixinMergeStrategySym,
982
+ msgPrefixSym
983
+ };
984
+ });
985
+
986
+ // node_modules/pino/lib/redaction.js
987
+ var require_redaction = __commonJS((exports, module) => {
988
+ var fastRedact = require_fast_redact();
989
+ var { redactFmtSym, wildcardFirstSym } = require_symbols();
990
+ var { rx, validator } = fastRedact;
991
+ var validate = validator({
992
+ ERR_PATHS_MUST_BE_STRINGS: () => "pino \u2013 redacted paths must be strings",
993
+ ERR_INVALID_PATH: (s) => `pino \u2013 redact paths array contains an invalid path (${s})`
994
+ });
995
+ var CENSOR = "[Redacted]";
996
+ var strict = false;
997
+ function redaction(opts, serialize) {
998
+ const { paths, censor } = handle(opts);
999
+ const shape = paths.reduce((o, str) => {
1000
+ rx.lastIndex = 0;
1001
+ const first = rx.exec(str);
1002
+ const next = rx.exec(str);
1003
+ let ns = first[1] !== undefined ? first[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, "$1") : first[0];
1004
+ if (ns === "*") {
1005
+ ns = wildcardFirstSym;
1006
+ }
1007
+ if (next === null) {
1008
+ o[ns] = null;
1009
+ return o;
1010
+ }
1011
+ if (o[ns] === null) {
1012
+ return o;
1013
+ }
1014
+ const { index } = next;
1015
+ const nextPath = `${str.substr(index, str.length - 1)}`;
1016
+ o[ns] = o[ns] || [];
1017
+ if (ns !== wildcardFirstSym && o[ns].length === 0) {
1018
+ o[ns].push(...o[wildcardFirstSym] || []);
1019
+ }
1020
+ if (ns === wildcardFirstSym) {
1021
+ Object.keys(o).forEach(function(k) {
1022
+ if (o[k]) {
1023
+ o[k].push(nextPath);
1024
+ }
1025
+ });
1026
+ }
1027
+ o[ns].push(nextPath);
1028
+ return o;
1029
+ }, {});
1030
+ const result = {
1031
+ [redactFmtSym]: fastRedact({ paths, censor, serialize, strict })
1032
+ };
1033
+ const topCensor = (...args) => {
1034
+ return typeof censor === "function" ? serialize(censor(...args)) : serialize(censor);
1035
+ };
1036
+ return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k) => {
1037
+ if (shape[k] === null) {
1038
+ o[k] = (value) => topCensor(value, [k]);
1039
+ } else {
1040
+ const wrappedCensor = typeof censor === "function" ? (value, path) => {
1041
+ return censor(value, [k, ...path]);
1042
+ } : censor;
1043
+ o[k] = fastRedact({
1044
+ paths: shape[k],
1045
+ censor: wrappedCensor,
1046
+ serialize,
1047
+ strict
1048
+ });
1049
+ }
1050
+ return o;
1051
+ }, result);
1052
+ }
1053
+ function handle(opts) {
1054
+ if (Array.isArray(opts)) {
1055
+ opts = { paths: opts, censor: CENSOR };
1056
+ validate(opts);
1057
+ return opts;
1058
+ }
1059
+ let { paths, censor = CENSOR, remove } = opts;
1060
+ if (Array.isArray(paths) === false) {
1061
+ throw Error("pino \u2013 redact must contain an array of strings");
1062
+ }
1063
+ if (remove === true)
1064
+ censor = undefined;
1065
+ validate({ paths, censor });
1066
+ return { paths, censor };
1067
+ }
1068
+ module.exports = redaction;
1069
+ });
1070
+
1071
+ // node_modules/pino/lib/time.js
1072
+ var require_time = __commonJS((exports, module) => {
1073
+ var nullTime = () => "";
1074
+ var epochTime = () => `,"time":${Date.now()}`;
1075
+ var unixTime = () => `,"time":${Math.round(Date.now() / 1000)}`;
1076
+ var isoTime = () => `,"time":"${new Date(Date.now()).toISOString()}"`;
1077
+ module.exports = { nullTime, epochTime, unixTime, isoTime };
1078
+ });
1079
+
1080
+ // node_modules/quick-format-unescaped/index.js
1081
+ var require_quick_format_unescaped = __commonJS((exports, module) => {
1082
+ function tryStringify(o) {
1083
+ try {
1084
+ return JSON.stringify(o);
1085
+ } catch (e) {
1086
+ return '"[Circular]"';
1087
+ }
1088
+ }
1089
+ module.exports = format;
1090
+ function format(f, args, opts) {
1091
+ var ss = opts && opts.stringify || tryStringify;
1092
+ var offset = 1;
1093
+ if (typeof f === "object" && f !== null) {
1094
+ var len = args.length + offset;
1095
+ if (len === 1)
1096
+ return f;
1097
+ var objects = new Array(len);
1098
+ objects[0] = ss(f);
1099
+ for (var index = 1;index < len; index++) {
1100
+ objects[index] = ss(args[index]);
1101
+ }
1102
+ return objects.join(" ");
1103
+ }
1104
+ if (typeof f !== "string") {
1105
+ return f;
1106
+ }
1107
+ var argLen = args.length;
1108
+ if (argLen === 0)
1109
+ return f;
1110
+ var str = "";
1111
+ var a = 1 - offset;
1112
+ var lastPos = -1;
1113
+ var flen = f && f.length || 0;
1114
+ for (var i = 0;i < flen; ) {
1115
+ if (f.charCodeAt(i) === 37 && i + 1 < flen) {
1116
+ lastPos = lastPos > -1 ? lastPos : 0;
1117
+ switch (f.charCodeAt(i + 1)) {
1118
+ case 100:
1119
+ case 102:
1120
+ if (a >= argLen)
1121
+ break;
1122
+ if (args[a] == null)
1123
+ break;
1124
+ if (lastPos < i)
1125
+ str += f.slice(lastPos, i);
1126
+ str += Number(args[a]);
1127
+ lastPos = i + 2;
1128
+ i++;
1129
+ break;
1130
+ case 105:
1131
+ if (a >= argLen)
1132
+ break;
1133
+ if (args[a] == null)
1134
+ break;
1135
+ if (lastPos < i)
1136
+ str += f.slice(lastPos, i);
1137
+ str += Math.floor(Number(args[a]));
1138
+ lastPos = i + 2;
1139
+ i++;
1140
+ break;
1141
+ case 79:
1142
+ case 111:
1143
+ case 106:
1144
+ if (a >= argLen)
1145
+ break;
1146
+ if (args[a] === undefined)
1147
+ break;
1148
+ if (lastPos < i)
1149
+ str += f.slice(lastPos, i);
1150
+ var type = typeof args[a];
1151
+ if (type === "string") {
1152
+ str += "'" + args[a] + "'";
1153
+ lastPos = i + 2;
1154
+ i++;
1155
+ break;
1156
+ }
1157
+ if (type === "function") {
1158
+ str += args[a].name || "<anonymous>";
1159
+ lastPos = i + 2;
1160
+ i++;
1161
+ break;
1162
+ }
1163
+ str += ss(args[a]);
1164
+ lastPos = i + 2;
1165
+ i++;
1166
+ break;
1167
+ case 115:
1168
+ if (a >= argLen)
1169
+ break;
1170
+ if (lastPos < i)
1171
+ str += f.slice(lastPos, i);
1172
+ str += String(args[a]);
1173
+ lastPos = i + 2;
1174
+ i++;
1175
+ break;
1176
+ case 37:
1177
+ if (lastPos < i)
1178
+ str += f.slice(lastPos, i);
1179
+ str += "%";
1180
+ lastPos = i + 2;
1181
+ i++;
1182
+ a--;
1183
+ break;
1184
+ }
1185
+ ++a;
1186
+ }
1187
+ ++i;
1188
+ }
1189
+ if (lastPos === -1)
1190
+ return f;
1191
+ else if (lastPos < flen) {
1192
+ str += f.slice(lastPos);
1193
+ }
1194
+ return str;
1195
+ }
1196
+ });
1197
+
1198
+ // node_modules/atomic-sleep/index.js
1199
+ var require_atomic_sleep = __commonJS((exports, module) => {
1200
+ if (typeof SharedArrayBuffer !== "undefined" && typeof Atomics !== "undefined") {
1201
+ let sleep = function(ms) {
1202
+ const valid = ms > 0 && ms < Infinity;
1203
+ if (valid === false) {
1204
+ if (typeof ms !== "number" && typeof ms !== "bigint") {
1205
+ throw TypeError("sleep: ms must be a number");
1206
+ }
1207
+ throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");
1208
+ }
1209
+ Atomics.wait(nil, 0, 0, Number(ms));
1210
+ };
1211
+ const nil = new Int32Array(new SharedArrayBuffer(4));
1212
+ module.exports = sleep;
1213
+ } else {
1214
+ let sleep = function(ms) {
1215
+ const valid = ms > 0 && ms < Infinity;
1216
+ if (valid === false) {
1217
+ if (typeof ms !== "number" && typeof ms !== "bigint") {
1218
+ throw TypeError("sleep: ms must be a number");
1219
+ }
1220
+ throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");
1221
+ }
1222
+ const target = Date.now() + Number(ms);
1223
+ while (target > Date.now()) {
1224
+ }
1225
+ };
1226
+ module.exports = sleep;
1227
+ }
1228
+ });
1229
+
1230
+ // node_modules/sonic-boom/index.js
1231
+ var require_sonic_boom = __commonJS((exports, module) => {
1232
+ var fs = __require("fs");
1233
+ var EventEmitter = __require("events");
1234
+ var inherits = __require("util").inherits;
1235
+ var path = __require("path");
1236
+ var sleep = require_atomic_sleep();
1237
+ var assert = __require("assert");
1238
+ var BUSY_WRITE_TIMEOUT = 100;
1239
+ var kEmptyBuffer = Buffer.allocUnsafe(0);
1240
+ var MAX_WRITE = 16 * 1024;
1241
+ var kContentModeBuffer = "buffer";
1242
+ var kContentModeUtf8 = "utf8";
1243
+ var [major, minor] = (process.versions.node || "0.0").split(".").map(Number);
1244
+ var kCopyBuffer = major >= 22 && minor >= 7;
1245
+ function openFile(file, sonic) {
1246
+ sonic._opening = true;
1247
+ sonic._writing = true;
1248
+ sonic._asyncDrainScheduled = false;
1249
+ function fileOpened(err, fd) {
1250
+ if (err) {
1251
+ sonic._reopening = false;
1252
+ sonic._writing = false;
1253
+ sonic._opening = false;
1254
+ if (sonic.sync) {
1255
+ process.nextTick(() => {
1256
+ if (sonic.listenerCount("error") > 0) {
1257
+ sonic.emit("error", err);
1258
+ }
1259
+ });
1260
+ } else {
1261
+ sonic.emit("error", err);
1262
+ }
1263
+ return;
1264
+ }
1265
+ const reopening = sonic._reopening;
1266
+ sonic.fd = fd;
1267
+ sonic.file = file;
1268
+ sonic._reopening = false;
1269
+ sonic._opening = false;
1270
+ sonic._writing = false;
1271
+ if (sonic.sync) {
1272
+ process.nextTick(() => sonic.emit("ready"));
1273
+ } else {
1274
+ sonic.emit("ready");
1275
+ }
1276
+ if (sonic.destroyed) {
1277
+ return;
1278
+ }
1279
+ if (!sonic._writing && sonic._len > sonic.minLength || sonic._flushPending) {
1280
+ sonic._actualWrite();
1281
+ } else if (reopening) {
1282
+ process.nextTick(() => sonic.emit("drain"));
1283
+ }
1284
+ }
1285
+ const flags = sonic.append ? "a" : "w";
1286
+ const mode = sonic.mode;
1287
+ if (sonic.sync) {
1288
+ try {
1289
+ if (sonic.mkdir)
1290
+ fs.mkdirSync(path.dirname(file), { recursive: true });
1291
+ const fd = fs.openSync(file, flags, mode);
1292
+ fileOpened(null, fd);
1293
+ } catch (err) {
1294
+ fileOpened(err);
1295
+ throw err;
1296
+ }
1297
+ } else if (sonic.mkdir) {
1298
+ fs.mkdir(path.dirname(file), { recursive: true }, (err) => {
1299
+ if (err)
1300
+ return fileOpened(err);
1301
+ fs.open(file, flags, mode, fileOpened);
1302
+ });
1303
+ } else {
1304
+ fs.open(file, flags, mode, fileOpened);
1305
+ }
1306
+ }
1307
+ function SonicBoom(opts) {
1308
+ if (!(this instanceof SonicBoom)) {
1309
+ return new SonicBoom(opts);
1310
+ }
1311
+ let { fd, dest, minLength, maxLength, maxWrite, periodicFlush, sync, append = true, mkdir, retryEAGAIN, fsync, contentMode, mode } = opts || {};
1312
+ fd = fd || dest;
1313
+ this._len = 0;
1314
+ this.fd = -1;
1315
+ this._bufs = [];
1316
+ this._lens = [];
1317
+ this._writing = false;
1318
+ this._ending = false;
1319
+ this._reopening = false;
1320
+ this._asyncDrainScheduled = false;
1321
+ this._flushPending = false;
1322
+ this._hwm = Math.max(minLength || 0, 16387);
1323
+ this.file = null;
1324
+ this.destroyed = false;
1325
+ this.minLength = minLength || 0;
1326
+ this.maxLength = maxLength || 0;
1327
+ this.maxWrite = maxWrite || MAX_WRITE;
1328
+ this._periodicFlush = periodicFlush || 0;
1329
+ this._periodicFlushTimer = undefined;
1330
+ this.sync = sync || false;
1331
+ this.writable = true;
1332
+ this._fsync = fsync || false;
1333
+ this.append = append || false;
1334
+ this.mode = mode;
1335
+ this.retryEAGAIN = retryEAGAIN || (() => true);
1336
+ this.mkdir = mkdir || false;
1337
+ let fsWriteSync;
1338
+ let fsWrite;
1339
+ if (contentMode === kContentModeBuffer) {
1340
+ this._writingBuf = kEmptyBuffer;
1341
+ this.write = writeBuffer;
1342
+ this.flush = flushBuffer;
1343
+ this.flushSync = flushBufferSync;
1344
+ this._actualWrite = actualWriteBuffer;
1345
+ fsWriteSync = () => fs.writeSync(this.fd, this._writingBuf);
1346
+ fsWrite = () => fs.write(this.fd, this._writingBuf, this.release);
1347
+ } else if (contentMode === undefined || contentMode === kContentModeUtf8) {
1348
+ this._writingBuf = "";
1349
+ this.write = write;
1350
+ this.flush = flush;
1351
+ this.flushSync = flushSync;
1352
+ this._actualWrite = actualWrite;
1353
+ fsWriteSync = () => fs.writeSync(this.fd, this._writingBuf, "utf8");
1354
+ fsWrite = () => fs.write(this.fd, this._writingBuf, "utf8", this.release);
1355
+ } else {
1356
+ throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
1357
+ }
1358
+ if (typeof fd === "number") {
1359
+ this.fd = fd;
1360
+ process.nextTick(() => this.emit("ready"));
1361
+ } else if (typeof fd === "string") {
1362
+ openFile(fd, this);
1363
+ } else {
1364
+ throw new Error("SonicBoom supports only file descriptors and files");
1365
+ }
1366
+ if (this.minLength >= this.maxWrite) {
1367
+ throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);
1368
+ }
1369
+ this.release = (err, n) => {
1370
+ if (err) {
1371
+ if ((err.code === "EAGAIN" || err.code === "EBUSY") && this.retryEAGAIN(err, this._writingBuf.length, this._len - this._writingBuf.length)) {
1372
+ if (this.sync) {
1373
+ try {
1374
+ sleep(BUSY_WRITE_TIMEOUT);
1375
+ this.release(undefined, 0);
1376
+ } catch (err2) {
1377
+ this.release(err2);
1378
+ }
1379
+ } else {
1380
+ setTimeout(fsWrite, BUSY_WRITE_TIMEOUT);
1381
+ }
1382
+ } else {
1383
+ this._writing = false;
1384
+ this.emit("error", err);
1385
+ }
1386
+ return;
1387
+ }
1388
+ this.emit("write", n);
1389
+ const releasedBufObj = releaseWritingBuf(this._writingBuf, this._len, n);
1390
+ this._len = releasedBufObj.len;
1391
+ this._writingBuf = releasedBufObj.writingBuf;
1392
+ if (this._writingBuf.length) {
1393
+ if (!this.sync) {
1394
+ fsWrite();
1395
+ return;
1396
+ }
1397
+ try {
1398
+ do {
1399
+ const n2 = fsWriteSync();
1400
+ const releasedBufObj2 = releaseWritingBuf(this._writingBuf, this._len, n2);
1401
+ this._len = releasedBufObj2.len;
1402
+ this._writingBuf = releasedBufObj2.writingBuf;
1403
+ } while (this._writingBuf.length);
1404
+ } catch (err2) {
1405
+ this.release(err2);
1406
+ return;
1407
+ }
1408
+ }
1409
+ if (this._fsync) {
1410
+ fs.fsyncSync(this.fd);
1411
+ }
1412
+ const len = this._len;
1413
+ if (this._reopening) {
1414
+ this._writing = false;
1415
+ this._reopening = false;
1416
+ this.reopen();
1417
+ } else if (len > this.minLength) {
1418
+ this._actualWrite();
1419
+ } else if (this._ending) {
1420
+ if (len > 0) {
1421
+ this._actualWrite();
1422
+ } else {
1423
+ this._writing = false;
1424
+ actualClose(this);
1425
+ }
1426
+ } else {
1427
+ this._writing = false;
1428
+ if (this.sync) {
1429
+ if (!this._asyncDrainScheduled) {
1430
+ this._asyncDrainScheduled = true;
1431
+ process.nextTick(emitDrain, this);
1432
+ }
1433
+ } else {
1434
+ this.emit("drain");
1435
+ }
1436
+ }
1437
+ };
1438
+ this.on("newListener", function(name) {
1439
+ if (name === "drain") {
1440
+ this._asyncDrainScheduled = false;
1441
+ }
1442
+ });
1443
+ if (this._periodicFlush !== 0) {
1444
+ this._periodicFlushTimer = setInterval(() => this.flush(null), this._periodicFlush);
1445
+ this._periodicFlushTimer.unref();
1446
+ }
1447
+ }
1448
+ function releaseWritingBuf(writingBuf, len, n) {
1449
+ if (typeof writingBuf === "string" && Buffer.byteLength(writingBuf) !== n) {
1450
+ n = Buffer.from(writingBuf).subarray(0, n).toString().length;
1451
+ }
1452
+ len = Math.max(len - n, 0);
1453
+ writingBuf = writingBuf.slice(n);
1454
+ return { writingBuf, len };
1455
+ }
1456
+ function emitDrain(sonic) {
1457
+ const hasListeners = sonic.listenerCount("drain") > 0;
1458
+ if (!hasListeners)
1459
+ return;
1460
+ sonic._asyncDrainScheduled = false;
1461
+ sonic.emit("drain");
1462
+ }
1463
+ inherits(SonicBoom, EventEmitter);
1464
+ function mergeBuf(bufs, len) {
1465
+ if (bufs.length === 0) {
1466
+ return kEmptyBuffer;
1467
+ }
1468
+ if (bufs.length === 1) {
1469
+ return bufs[0];
1470
+ }
1471
+ return Buffer.concat(bufs, len);
1472
+ }
1473
+ function write(data) {
1474
+ if (this.destroyed) {
1475
+ throw new Error("SonicBoom destroyed");
1476
+ }
1477
+ const len = this._len + data.length;
1478
+ const bufs = this._bufs;
1479
+ if (this.maxLength && len > this.maxLength) {
1480
+ this.emit("drop", data);
1481
+ return this._len < this._hwm;
1482
+ }
1483
+ if (bufs.length === 0 || bufs[bufs.length - 1].length + data.length > this.maxWrite) {
1484
+ bufs.push("" + data);
1485
+ } else {
1486
+ bufs[bufs.length - 1] += data;
1487
+ }
1488
+ this._len = len;
1489
+ if (!this._writing && this._len >= this.minLength) {
1490
+ this._actualWrite();
1491
+ }
1492
+ return this._len < this._hwm;
1493
+ }
1494
+ function writeBuffer(data) {
1495
+ if (this.destroyed) {
1496
+ throw new Error("SonicBoom destroyed");
1497
+ }
1498
+ const len = this._len + data.length;
1499
+ const bufs = this._bufs;
1500
+ const lens = this._lens;
1501
+ if (this.maxLength && len > this.maxLength) {
1502
+ this.emit("drop", data);
1503
+ return this._len < this._hwm;
1504
+ }
1505
+ if (bufs.length === 0 || lens[lens.length - 1] + data.length > this.maxWrite) {
1506
+ bufs.push([data]);
1507
+ lens.push(data.length);
1508
+ } else {
1509
+ bufs[bufs.length - 1].push(data);
1510
+ lens[lens.length - 1] += data.length;
1511
+ }
1512
+ this._len = len;
1513
+ if (!this._writing && this._len >= this.minLength) {
1514
+ this._actualWrite();
1515
+ }
1516
+ return this._len < this._hwm;
1517
+ }
1518
+ function callFlushCallbackOnDrain(cb) {
1519
+ this._flushPending = true;
1520
+ const onDrain = () => {
1521
+ if (!this._fsync) {
1522
+ try {
1523
+ fs.fsync(this.fd, (err) => {
1524
+ this._flushPending = false;
1525
+ cb(err);
1526
+ });
1527
+ } catch (err) {
1528
+ cb(err);
1529
+ }
1530
+ } else {
1531
+ this._flushPending = false;
1532
+ cb();
1533
+ }
1534
+ this.off("error", onError);
1535
+ };
1536
+ const onError = (err) => {
1537
+ this._flushPending = false;
1538
+ cb(err);
1539
+ this.off("drain", onDrain);
1540
+ };
1541
+ this.once("drain", onDrain);
1542
+ this.once("error", onError);
1543
+ }
1544
+ function flush(cb) {
1545
+ if (cb != null && typeof cb !== "function") {
1546
+ throw new Error("flush cb must be a function");
1547
+ }
1548
+ if (this.destroyed) {
1549
+ const error = new Error("SonicBoom destroyed");
1550
+ if (cb) {
1551
+ cb(error);
1552
+ return;
1553
+ }
1554
+ throw error;
1555
+ }
1556
+ if (this.minLength <= 0) {
1557
+ cb?.();
1558
+ return;
1559
+ }
1560
+ if (cb) {
1561
+ callFlushCallbackOnDrain.call(this, cb);
1562
+ }
1563
+ if (this._writing) {
1564
+ return;
1565
+ }
1566
+ if (this._bufs.length === 0) {
1567
+ this._bufs.push("");
1568
+ }
1569
+ this._actualWrite();
1570
+ }
1571
+ function flushBuffer(cb) {
1572
+ if (cb != null && typeof cb !== "function") {
1573
+ throw new Error("flush cb must be a function");
1574
+ }
1575
+ if (this.destroyed) {
1576
+ const error = new Error("SonicBoom destroyed");
1577
+ if (cb) {
1578
+ cb(error);
1579
+ return;
1580
+ }
1581
+ throw error;
1582
+ }
1583
+ if (this.minLength <= 0) {
1584
+ cb?.();
1585
+ return;
1586
+ }
1587
+ if (cb) {
1588
+ callFlushCallbackOnDrain.call(this, cb);
1589
+ }
1590
+ if (this._writing) {
1591
+ return;
1592
+ }
1593
+ if (this._bufs.length === 0) {
1594
+ this._bufs.push([]);
1595
+ this._lens.push(0);
1596
+ }
1597
+ this._actualWrite();
1598
+ }
1599
+ SonicBoom.prototype.reopen = function(file) {
1600
+ if (this.destroyed) {
1601
+ throw new Error("SonicBoom destroyed");
1602
+ }
1603
+ if (this._opening) {
1604
+ this.once("ready", () => {
1605
+ this.reopen(file);
1606
+ });
1607
+ return;
1608
+ }
1609
+ if (this._ending) {
1610
+ return;
1611
+ }
1612
+ if (!this.file) {
1613
+ throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");
1614
+ }
1615
+ if (file) {
1616
+ this.file = file;
1617
+ }
1618
+ this._reopening = true;
1619
+ if (this._writing) {
1620
+ return;
1621
+ }
1622
+ const fd = this.fd;
1623
+ this.once("ready", () => {
1624
+ if (fd !== this.fd) {
1625
+ fs.close(fd, (err) => {
1626
+ if (err) {
1627
+ return this.emit("error", err);
1628
+ }
1629
+ });
1630
+ }
1631
+ });
1632
+ openFile(this.file, this);
1633
+ };
1634
+ SonicBoom.prototype.end = function() {
1635
+ if (this.destroyed) {
1636
+ throw new Error("SonicBoom destroyed");
1637
+ }
1638
+ if (this._opening) {
1639
+ this.once("ready", () => {
1640
+ this.end();
1641
+ });
1642
+ return;
1643
+ }
1644
+ if (this._ending) {
1645
+ return;
1646
+ }
1647
+ this._ending = true;
1648
+ if (this._writing) {
1649
+ return;
1650
+ }
1651
+ if (this._len > 0 && this.fd >= 0) {
1652
+ this._actualWrite();
1653
+ } else {
1654
+ actualClose(this);
1655
+ }
1656
+ };
1657
+ function flushSync() {
1658
+ if (this.destroyed) {
1659
+ throw new Error("SonicBoom destroyed");
1660
+ }
1661
+ if (this.fd < 0) {
1662
+ throw new Error("sonic boom is not ready yet");
1663
+ }
1664
+ if (!this._writing && this._writingBuf.length > 0) {
1665
+ this._bufs.unshift(this._writingBuf);
1666
+ this._writingBuf = "";
1667
+ }
1668
+ let buf = "";
1669
+ while (this._bufs.length || buf) {
1670
+ if (buf.length <= 0) {
1671
+ buf = this._bufs[0];
1672
+ }
1673
+ try {
1674
+ const n = fs.writeSync(this.fd, buf, "utf8");
1675
+ const releasedBufObj = releaseWritingBuf(buf, this._len, n);
1676
+ buf = releasedBufObj.writingBuf;
1677
+ this._len = releasedBufObj.len;
1678
+ if (buf.length <= 0) {
1679
+ this._bufs.shift();
1680
+ }
1681
+ } catch (err) {
1682
+ const shouldRetry = err.code === "EAGAIN" || err.code === "EBUSY";
1683
+ if (shouldRetry && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) {
1684
+ throw err;
1685
+ }
1686
+ sleep(BUSY_WRITE_TIMEOUT);
1687
+ }
1688
+ }
1689
+ try {
1690
+ fs.fsyncSync(this.fd);
1691
+ } catch {
1692
+ }
1693
+ }
1694
+ function flushBufferSync() {
1695
+ if (this.destroyed) {
1696
+ throw new Error("SonicBoom destroyed");
1697
+ }
1698
+ if (this.fd < 0) {
1699
+ throw new Error("sonic boom is not ready yet");
1700
+ }
1701
+ if (!this._writing && this._writingBuf.length > 0) {
1702
+ this._bufs.unshift([this._writingBuf]);
1703
+ this._writingBuf = kEmptyBuffer;
1704
+ }
1705
+ let buf = kEmptyBuffer;
1706
+ while (this._bufs.length || buf.length) {
1707
+ if (buf.length <= 0) {
1708
+ buf = mergeBuf(this._bufs[0], this._lens[0]);
1709
+ }
1710
+ try {
1711
+ const n = fs.writeSync(this.fd, buf);
1712
+ buf = buf.subarray(n);
1713
+ this._len = Math.max(this._len - n, 0);
1714
+ if (buf.length <= 0) {
1715
+ this._bufs.shift();
1716
+ this._lens.shift();
1717
+ }
1718
+ } catch (err) {
1719
+ const shouldRetry = err.code === "EAGAIN" || err.code === "EBUSY";
1720
+ if (shouldRetry && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) {
1721
+ throw err;
1722
+ }
1723
+ sleep(BUSY_WRITE_TIMEOUT);
1724
+ }
1725
+ }
1726
+ }
1727
+ SonicBoom.prototype.destroy = function() {
1728
+ if (this.destroyed) {
1729
+ return;
1730
+ }
1731
+ actualClose(this);
1732
+ };
1733
+ function actualWrite() {
1734
+ const release = this.release;
1735
+ this._writing = true;
1736
+ this._writingBuf = this._writingBuf || this._bufs.shift() || "";
1737
+ if (this.sync) {
1738
+ try {
1739
+ const written = fs.writeSync(this.fd, this._writingBuf, "utf8");
1740
+ release(null, written);
1741
+ } catch (err) {
1742
+ release(err);
1743
+ }
1744
+ } else {
1745
+ fs.write(this.fd, this._writingBuf, "utf8", release);
1746
+ }
1747
+ }
1748
+ function actualWriteBuffer() {
1749
+ const release = this.release;
1750
+ this._writing = true;
1751
+ this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
1752
+ if (this.sync) {
1753
+ try {
1754
+ const written = fs.writeSync(this.fd, this._writingBuf);
1755
+ release(null, written);
1756
+ } catch (err) {
1757
+ release(err);
1758
+ }
1759
+ } else {
1760
+ if (kCopyBuffer) {
1761
+ this._writingBuf = Buffer.from(this._writingBuf);
1762
+ }
1763
+ fs.write(this.fd, this._writingBuf, release);
1764
+ }
1765
+ }
1766
+ function actualClose(sonic) {
1767
+ if (sonic.fd === -1) {
1768
+ sonic.once("ready", actualClose.bind(null, sonic));
1769
+ return;
1770
+ }
1771
+ if (sonic._periodicFlushTimer !== undefined) {
1772
+ clearInterval(sonic._periodicFlushTimer);
1773
+ }
1774
+ sonic.destroyed = true;
1775
+ sonic._bufs = [];
1776
+ sonic._lens = [];
1777
+ assert(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
1778
+ try {
1779
+ fs.fsync(sonic.fd, closeWrapped);
1780
+ } catch {
1781
+ }
1782
+ function closeWrapped() {
1783
+ if (sonic.fd !== 1 && sonic.fd !== 2) {
1784
+ fs.close(sonic.fd, done);
1785
+ } else {
1786
+ done();
1787
+ }
1788
+ }
1789
+ function done(err) {
1790
+ if (err) {
1791
+ sonic.emit("error", err);
1792
+ return;
1793
+ }
1794
+ if (sonic._ending && !sonic._writing) {
1795
+ sonic.emit("finish");
1796
+ }
1797
+ sonic.emit("close");
1798
+ }
1799
+ }
1800
+ SonicBoom.SonicBoom = SonicBoom;
1801
+ SonicBoom.default = SonicBoom;
1802
+ module.exports = SonicBoom;
1803
+ });
1804
+
1805
+ // node_modules/on-exit-leak-free/index.js
1806
+ var require_on_exit_leak_free = __commonJS((exports, module) => {
1807
+ var refs = {
1808
+ exit: [],
1809
+ beforeExit: []
1810
+ };
1811
+ var functions = {
1812
+ exit: onExit,
1813
+ beforeExit: onBeforeExit
1814
+ };
1815
+ var registry;
1816
+ function ensureRegistry() {
1817
+ if (registry === undefined) {
1818
+ registry = new FinalizationRegistry(clear);
1819
+ }
1820
+ }
1821
+ function install(event) {
1822
+ if (refs[event].length > 0) {
1823
+ return;
1824
+ }
1825
+ process.on(event, functions[event]);
1826
+ }
1827
+ function uninstall(event) {
1828
+ if (refs[event].length > 0) {
1829
+ return;
1830
+ }
1831
+ process.removeListener(event, functions[event]);
1832
+ if (refs.exit.length === 0 && refs.beforeExit.length === 0) {
1833
+ registry = undefined;
1834
+ }
1835
+ }
1836
+ function onExit() {
1837
+ callRefs("exit");
1838
+ }
1839
+ function onBeforeExit() {
1840
+ callRefs("beforeExit");
1841
+ }
1842
+ function callRefs(event) {
1843
+ for (const ref of refs[event]) {
1844
+ const obj = ref.deref();
1845
+ const fn = ref.fn;
1846
+ if (obj !== undefined) {
1847
+ fn(obj, event);
1848
+ }
1849
+ }
1850
+ refs[event] = [];
1851
+ }
1852
+ function clear(ref) {
1853
+ for (const event of ["exit", "beforeExit"]) {
1854
+ const index = refs[event].indexOf(ref);
1855
+ refs[event].splice(index, index + 1);
1856
+ uninstall(event);
1857
+ }
1858
+ }
1859
+ function _register(event, obj, fn) {
1860
+ if (obj === undefined) {
1861
+ throw new Error("the object can't be undefined");
1862
+ }
1863
+ install(event);
1864
+ const ref = new WeakRef(obj);
1865
+ ref.fn = fn;
1866
+ ensureRegistry();
1867
+ registry.register(obj, ref);
1868
+ refs[event].push(ref);
1869
+ }
1870
+ function register(obj, fn) {
1871
+ _register("exit", obj, fn);
1872
+ }
1873
+ function registerBeforeExit(obj, fn) {
1874
+ _register("beforeExit", obj, fn);
1875
+ }
1876
+ function unregister(obj) {
1877
+ if (registry === undefined) {
1878
+ return;
1879
+ }
1880
+ registry.unregister(obj);
1881
+ for (const event of ["exit", "beforeExit"]) {
1882
+ refs[event] = refs[event].filter((ref) => {
1883
+ const _obj = ref.deref();
1884
+ return _obj && _obj !== obj;
1885
+ });
1886
+ uninstall(event);
1887
+ }
1888
+ }
1889
+ module.exports = {
1890
+ register,
1891
+ registerBeforeExit,
1892
+ unregister
1893
+ };
1894
+ });
1895
+
1896
+ // node_modules/thread-stream/package.json
1897
+ var require_package = __commonJS((exports, module) => {
1898
+ module.exports = {
1899
+ name: "thread-stream",
1900
+ version: "3.1.0",
1901
+ description: "A streaming way to send data to a Node.js Worker Thread",
1902
+ main: "index.js",
1903
+ types: "index.d.ts",
1904
+ dependencies: {
1905
+ "real-require": "^0.2.0"
1906
+ },
1907
+ devDependencies: {
1908
+ "@types/node": "^20.1.0",
1909
+ "@types/tap": "^15.0.0",
1910
+ "@yao-pkg/pkg": "^5.11.5",
1911
+ desm: "^1.3.0",
1912
+ fastbench: "^1.0.1",
1913
+ husky: "^9.0.6",
1914
+ "pino-elasticsearch": "^8.0.0",
1915
+ "sonic-boom": "^4.0.1",
1916
+ standard: "^17.0.0",
1917
+ tap: "^16.2.0",
1918
+ "ts-node": "^10.8.0",
1919
+ typescript: "^5.3.2",
1920
+ "why-is-node-running": "^2.2.2"
1921
+ },
1922
+ scripts: {
1923
+ build: "tsc --noEmit",
1924
+ test: 'standard && npm run build && npm run transpile && tap "test/**/*.test.*js" && tap --ts test/*.test.*ts',
1925
+ "test:ci": "standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts",
1926
+ "test:ci:js": 'tap --no-check-coverage --timeout=120 --coverage-report=lcovonly "test/**/*.test.*js"',
1927
+ "test:ci:ts": 'tap --ts --no-check-coverage --coverage-report=lcovonly "test/**/*.test.*ts"',
1928
+ "test:yarn": 'npm run transpile && tap "test/**/*.test.js" --no-check-coverage',
1929
+ transpile: "sh ./test/ts/transpile.sh",
1930
+ prepare: "husky install"
1931
+ },
1932
+ standard: {
1933
+ ignore: [
1934
+ "test/ts/**/*",
1935
+ "test/syntax-error.mjs"
1936
+ ]
1937
+ },
1938
+ repository: {
1939
+ type: "git",
1940
+ url: "git+https://github.com/mcollina/thread-stream.git"
1941
+ },
1942
+ keywords: [
1943
+ "worker",
1944
+ "thread",
1945
+ "threads",
1946
+ "stream"
1947
+ ],
1948
+ author: "Matteo Collina <hello@matteocollina.com>",
1949
+ license: "MIT",
1950
+ bugs: {
1951
+ url: "https://github.com/mcollina/thread-stream/issues"
1952
+ },
1953
+ homepage: "https://github.com/mcollina/thread-stream#readme"
1954
+ };
1955
+ });
1956
+
1957
+ // node_modules/thread-stream/lib/wait.js
1958
+ var require_wait = __commonJS((exports, module) => {
1959
+ var MAX_TIMEOUT = 1000;
1960
+ function wait(state, index, expected, timeout, done) {
1961
+ const max = Date.now() + timeout;
1962
+ let current = Atomics.load(state, index);
1963
+ if (current === expected) {
1964
+ done(null, "ok");
1965
+ return;
1966
+ }
1967
+ let prior = current;
1968
+ const check = (backoff) => {
1969
+ if (Date.now() > max) {
1970
+ done(null, "timed-out");
1971
+ } else {
1972
+ setTimeout(() => {
1973
+ prior = current;
1974
+ current = Atomics.load(state, index);
1975
+ if (current === prior) {
1976
+ check(backoff >= MAX_TIMEOUT ? MAX_TIMEOUT : backoff * 2);
1977
+ } else {
1978
+ if (current === expected)
1979
+ done(null, "ok");
1980
+ else
1981
+ done(null, "not-equal");
1982
+ }
1983
+ }, backoff);
1984
+ }
1985
+ };
1986
+ check(1);
1987
+ }
1988
+ function waitDiff(state, index, expected, timeout, done) {
1989
+ const max = Date.now() + timeout;
1990
+ let current = Atomics.load(state, index);
1991
+ if (current !== expected) {
1992
+ done(null, "ok");
1993
+ return;
1994
+ }
1995
+ const check = (backoff) => {
1996
+ if (Date.now() > max) {
1997
+ done(null, "timed-out");
1998
+ } else {
1999
+ setTimeout(() => {
2000
+ current = Atomics.load(state, index);
2001
+ if (current !== expected) {
2002
+ done(null, "ok");
2003
+ } else {
2004
+ check(backoff >= MAX_TIMEOUT ? MAX_TIMEOUT : backoff * 2);
2005
+ }
2006
+ }, backoff);
2007
+ }
2008
+ };
2009
+ check(1);
2010
+ }
2011
+ module.exports = { wait, waitDiff };
2012
+ });
2013
+
2014
+ // node_modules/thread-stream/lib/indexes.js
2015
+ var require_indexes = __commonJS((exports, module) => {
2016
+ var WRITE_INDEX = 4;
2017
+ var READ_INDEX = 8;
2018
+ module.exports = {
2019
+ WRITE_INDEX,
2020
+ READ_INDEX
2021
+ };
2022
+ });
2023
+
2024
+ // node_modules/thread-stream/index.js
2025
+ var require_thread_stream = __commonJS((exports, module) => {
2026
+ var __dirname = "/Users/xiliangchen/projects/polka-codes/node_modules/thread-stream";
2027
+ var { version } = require_package();
2028
+ var { EventEmitter } = __require("events");
2029
+ var { Worker } = __require("worker_threads");
2030
+ var { join } = __require("path");
2031
+ var { pathToFileURL } = __require("url");
2032
+ var { wait } = require_wait();
2033
+ var {
2034
+ WRITE_INDEX,
2035
+ READ_INDEX
2036
+ } = require_indexes();
2037
+ var buffer = __require("buffer");
2038
+ var assert = __require("assert");
2039
+ var kImpl = Symbol("kImpl");
2040
+ var MAX_STRING = buffer.constants.MAX_STRING_LENGTH;
2041
+
2042
+ class FakeWeakRef {
2043
+ constructor(value) {
2044
+ this._value = value;
2045
+ }
2046
+ deref() {
2047
+ return this._value;
2048
+ }
2049
+ }
2050
+
2051
+ class FakeFinalizationRegistry {
2052
+ register() {
2053
+ }
2054
+ unregister() {
2055
+ }
2056
+ }
2057
+ var FinalizationRegistry2 = process.env.NODE_V8_COVERAGE ? FakeFinalizationRegistry : global.FinalizationRegistry || FakeFinalizationRegistry;
2058
+ var WeakRef2 = process.env.NODE_V8_COVERAGE ? FakeWeakRef : global.WeakRef || FakeWeakRef;
2059
+ var registry = new FinalizationRegistry2((worker) => {
2060
+ if (worker.exited) {
2061
+ return;
2062
+ }
2063
+ worker.terminate();
2064
+ });
2065
+ function createWorker(stream, opts) {
2066
+ const { filename, workerData } = opts;
2067
+ const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
2068
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join(__dirname, "lib", "worker.js");
2069
+ const worker = new Worker(toExecute, {
2070
+ ...opts.workerOpts,
2071
+ trackUnmanagedFds: false,
2072
+ workerData: {
2073
+ filename: filename.indexOf("file://") === 0 ? filename : pathToFileURL(filename).href,
2074
+ dataBuf: stream[kImpl].dataBuf,
2075
+ stateBuf: stream[kImpl].stateBuf,
2076
+ workerData: {
2077
+ $context: {
2078
+ threadStreamVersion: version
2079
+ },
2080
+ ...workerData
2081
+ }
2082
+ }
2083
+ });
2084
+ worker.stream = new FakeWeakRef(stream);
2085
+ worker.on("message", onWorkerMessage);
2086
+ worker.on("exit", onWorkerExit);
2087
+ registry.register(stream, worker);
2088
+ return worker;
2089
+ }
2090
+ function drain(stream) {
2091
+ assert(!stream[kImpl].sync);
2092
+ if (stream[kImpl].needDrain) {
2093
+ stream[kImpl].needDrain = false;
2094
+ stream.emit("drain");
2095
+ }
2096
+ }
2097
+ function nextFlush(stream) {
2098
+ const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
2099
+ let leftover = stream[kImpl].data.length - writeIndex;
2100
+ if (leftover > 0) {
2101
+ if (stream[kImpl].buf.length === 0) {
2102
+ stream[kImpl].flushing = false;
2103
+ if (stream[kImpl].ending) {
2104
+ end(stream);
2105
+ } else if (stream[kImpl].needDrain) {
2106
+ process.nextTick(drain, stream);
2107
+ }
2108
+ return;
2109
+ }
2110
+ let toWrite = stream[kImpl].buf.slice(0, leftover);
2111
+ let toWriteBytes = Buffer.byteLength(toWrite);
2112
+ if (toWriteBytes <= leftover) {
2113
+ stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
2114
+ write(stream, toWrite, nextFlush.bind(null, stream));
2115
+ } else {
2116
+ stream.flush(() => {
2117
+ if (stream.destroyed) {
2118
+ return;
2119
+ }
2120
+ Atomics.store(stream[kImpl].state, READ_INDEX, 0);
2121
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
2122
+ while (toWriteBytes > stream[kImpl].data.length) {
2123
+ leftover = leftover / 2;
2124
+ toWrite = stream[kImpl].buf.slice(0, leftover);
2125
+ toWriteBytes = Buffer.byteLength(toWrite);
2126
+ }
2127
+ stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
2128
+ write(stream, toWrite, nextFlush.bind(null, stream));
2129
+ });
2130
+ }
2131
+ } else if (leftover === 0) {
2132
+ if (writeIndex === 0 && stream[kImpl].buf.length === 0) {
2133
+ return;
2134
+ }
2135
+ stream.flush(() => {
2136
+ Atomics.store(stream[kImpl].state, READ_INDEX, 0);
2137
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
2138
+ nextFlush(stream);
2139
+ });
2140
+ } else {
2141
+ destroy(stream, new Error("overwritten"));
2142
+ }
2143
+ }
2144
+ function onWorkerMessage(msg) {
2145
+ const stream = this.stream.deref();
2146
+ if (stream === undefined) {
2147
+ this.exited = true;
2148
+ this.terminate();
2149
+ return;
2150
+ }
2151
+ switch (msg.code) {
2152
+ case "READY":
2153
+ this.stream = new WeakRef2(stream);
2154
+ stream.flush(() => {
2155
+ stream[kImpl].ready = true;
2156
+ stream.emit("ready");
2157
+ });
2158
+ break;
2159
+ case "ERROR":
2160
+ destroy(stream, msg.err);
2161
+ break;
2162
+ case "EVENT":
2163
+ if (Array.isArray(msg.args)) {
2164
+ stream.emit(msg.name, ...msg.args);
2165
+ } else {
2166
+ stream.emit(msg.name, msg.args);
2167
+ }
2168
+ break;
2169
+ case "WARNING":
2170
+ process.emitWarning(msg.err);
2171
+ break;
2172
+ default:
2173
+ destroy(stream, new Error("this should not happen: " + msg.code));
2174
+ }
2175
+ }
2176
+ function onWorkerExit(code) {
2177
+ const stream = this.stream.deref();
2178
+ if (stream === undefined) {
2179
+ return;
2180
+ }
2181
+ registry.unregister(stream);
2182
+ stream.worker.exited = true;
2183
+ stream.worker.off("exit", onWorkerExit);
2184
+ destroy(stream, code !== 0 ? new Error("the worker thread exited") : null);
2185
+ }
2186
+
2187
+ class ThreadStream extends EventEmitter {
2188
+ constructor(opts = {}) {
2189
+ super();
2190
+ if (opts.bufferSize < 4) {
2191
+ throw new Error("bufferSize must at least fit a 4-byte utf-8 char");
2192
+ }
2193
+ this[kImpl] = {};
2194
+ this[kImpl].stateBuf = new SharedArrayBuffer(128);
2195
+ this[kImpl].state = new Int32Array(this[kImpl].stateBuf);
2196
+ this[kImpl].dataBuf = new SharedArrayBuffer(opts.bufferSize || 4 * 1024 * 1024);
2197
+ this[kImpl].data = Buffer.from(this[kImpl].dataBuf);
2198
+ this[kImpl].sync = opts.sync || false;
2199
+ this[kImpl].ending = false;
2200
+ this[kImpl].ended = false;
2201
+ this[kImpl].needDrain = false;
2202
+ this[kImpl].destroyed = false;
2203
+ this[kImpl].flushing = false;
2204
+ this[kImpl].ready = false;
2205
+ this[kImpl].finished = false;
2206
+ this[kImpl].errored = null;
2207
+ this[kImpl].closed = false;
2208
+ this[kImpl].buf = "";
2209
+ this.worker = createWorker(this, opts);
2210
+ this.on("message", (message, transferList) => {
2211
+ this.worker.postMessage(message, transferList);
2212
+ });
2213
+ }
2214
+ write(data) {
2215
+ if (this[kImpl].destroyed) {
2216
+ error(this, new Error("the worker has exited"));
2217
+ return false;
2218
+ }
2219
+ if (this[kImpl].ending) {
2220
+ error(this, new Error("the worker is ending"));
2221
+ return false;
2222
+ }
2223
+ if (this[kImpl].flushing && this[kImpl].buf.length + data.length >= MAX_STRING) {
2224
+ try {
2225
+ writeSync(this);
2226
+ this[kImpl].flushing = true;
2227
+ } catch (err) {
2228
+ destroy(this, err);
2229
+ return false;
2230
+ }
2231
+ }
2232
+ this[kImpl].buf += data;
2233
+ if (this[kImpl].sync) {
2234
+ try {
2235
+ writeSync(this);
2236
+ return true;
2237
+ } catch (err) {
2238
+ destroy(this, err);
2239
+ return false;
2240
+ }
2241
+ }
2242
+ if (!this[kImpl].flushing) {
2243
+ this[kImpl].flushing = true;
2244
+ setImmediate(nextFlush, this);
2245
+ }
2246
+ this[kImpl].needDrain = this[kImpl].data.length - this[kImpl].buf.length - Atomics.load(this[kImpl].state, WRITE_INDEX) <= 0;
2247
+ return !this[kImpl].needDrain;
2248
+ }
2249
+ end() {
2250
+ if (this[kImpl].destroyed) {
2251
+ return;
2252
+ }
2253
+ this[kImpl].ending = true;
2254
+ end(this);
2255
+ }
2256
+ flush(cb) {
2257
+ if (this[kImpl].destroyed) {
2258
+ if (typeof cb === "function") {
2259
+ process.nextTick(cb, new Error("the worker has exited"));
2260
+ }
2261
+ return;
2262
+ }
2263
+ const writeIndex = Atomics.load(this[kImpl].state, WRITE_INDEX);
2264
+ wait(this[kImpl].state, READ_INDEX, writeIndex, Infinity, (err, res) => {
2265
+ if (err) {
2266
+ destroy(this, err);
2267
+ process.nextTick(cb, err);
2268
+ return;
2269
+ }
2270
+ if (res === "not-equal") {
2271
+ this.flush(cb);
2272
+ return;
2273
+ }
2274
+ process.nextTick(cb);
2275
+ });
2276
+ }
2277
+ flushSync() {
2278
+ if (this[kImpl].destroyed) {
2279
+ return;
2280
+ }
2281
+ writeSync(this);
2282
+ flushSync(this);
2283
+ }
2284
+ unref() {
2285
+ this.worker.unref();
2286
+ }
2287
+ ref() {
2288
+ this.worker.ref();
2289
+ }
2290
+ get ready() {
2291
+ return this[kImpl].ready;
2292
+ }
2293
+ get destroyed() {
2294
+ return this[kImpl].destroyed;
2295
+ }
2296
+ get closed() {
2297
+ return this[kImpl].closed;
2298
+ }
2299
+ get writable() {
2300
+ return !this[kImpl].destroyed && !this[kImpl].ending;
2301
+ }
2302
+ get writableEnded() {
2303
+ return this[kImpl].ending;
2304
+ }
2305
+ get writableFinished() {
2306
+ return this[kImpl].finished;
2307
+ }
2308
+ get writableNeedDrain() {
2309
+ return this[kImpl].needDrain;
2310
+ }
2311
+ get writableObjectMode() {
2312
+ return false;
2313
+ }
2314
+ get writableErrored() {
2315
+ return this[kImpl].errored;
2316
+ }
2317
+ }
2318
+ function error(stream, err) {
2319
+ setImmediate(() => {
2320
+ stream.emit("error", err);
2321
+ });
2322
+ }
2323
+ function destroy(stream, err) {
2324
+ if (stream[kImpl].destroyed) {
2325
+ return;
2326
+ }
2327
+ stream[kImpl].destroyed = true;
2328
+ if (err) {
2329
+ stream[kImpl].errored = err;
2330
+ error(stream, err);
2331
+ }
2332
+ if (!stream.worker.exited) {
2333
+ stream.worker.terminate().catch(() => {
2334
+ }).then(() => {
2335
+ stream[kImpl].closed = true;
2336
+ stream.emit("close");
2337
+ });
2338
+ } else {
2339
+ setImmediate(() => {
2340
+ stream[kImpl].closed = true;
2341
+ stream.emit("close");
2342
+ });
2343
+ }
2344
+ }
2345
+ function write(stream, data, cb) {
2346
+ const current = Atomics.load(stream[kImpl].state, WRITE_INDEX);
2347
+ const length = Buffer.byteLength(data);
2348
+ stream[kImpl].data.write(data, current);
2349
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, current + length);
2350
+ Atomics.notify(stream[kImpl].state, WRITE_INDEX);
2351
+ cb();
2352
+ return true;
2353
+ }
2354
+ function end(stream) {
2355
+ if (stream[kImpl].ended || !stream[kImpl].ending || stream[kImpl].flushing) {
2356
+ return;
2357
+ }
2358
+ stream[kImpl].ended = true;
2359
+ try {
2360
+ stream.flushSync();
2361
+ let readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
2362
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, -1);
2363
+ Atomics.notify(stream[kImpl].state, WRITE_INDEX);
2364
+ let spins = 0;
2365
+ while (readIndex !== -1) {
2366
+ Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1000);
2367
+ readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
2368
+ if (readIndex === -2) {
2369
+ destroy(stream, new Error("end() failed"));
2370
+ return;
2371
+ }
2372
+ if (++spins === 10) {
2373
+ destroy(stream, new Error("end() took too long (10s)"));
2374
+ return;
2375
+ }
2376
+ }
2377
+ process.nextTick(() => {
2378
+ stream[kImpl].finished = true;
2379
+ stream.emit("finish");
2380
+ });
2381
+ } catch (err) {
2382
+ destroy(stream, err);
2383
+ }
2384
+ }
2385
+ function writeSync(stream) {
2386
+ const cb = () => {
2387
+ if (stream[kImpl].ending) {
2388
+ end(stream);
2389
+ } else if (stream[kImpl].needDrain) {
2390
+ process.nextTick(drain, stream);
2391
+ }
2392
+ };
2393
+ stream[kImpl].flushing = false;
2394
+ while (stream[kImpl].buf.length !== 0) {
2395
+ const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
2396
+ let leftover = stream[kImpl].data.length - writeIndex;
2397
+ if (leftover === 0) {
2398
+ flushSync(stream);
2399
+ Atomics.store(stream[kImpl].state, READ_INDEX, 0);
2400
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
2401
+ continue;
2402
+ } else if (leftover < 0) {
2403
+ throw new Error("overwritten");
2404
+ }
2405
+ let toWrite = stream[kImpl].buf.slice(0, leftover);
2406
+ let toWriteBytes = Buffer.byteLength(toWrite);
2407
+ if (toWriteBytes <= leftover) {
2408
+ stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
2409
+ write(stream, toWrite, cb);
2410
+ } else {
2411
+ flushSync(stream);
2412
+ Atomics.store(stream[kImpl].state, READ_INDEX, 0);
2413
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
2414
+ while (toWriteBytes > stream[kImpl].buf.length) {
2415
+ leftover = leftover / 2;
2416
+ toWrite = stream[kImpl].buf.slice(0, leftover);
2417
+ toWriteBytes = Buffer.byteLength(toWrite);
2418
+ }
2419
+ stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
2420
+ write(stream, toWrite, cb);
2421
+ }
2422
+ }
2423
+ }
2424
+ function flushSync(stream) {
2425
+ if (stream[kImpl].flushing) {
2426
+ throw new Error("unable to flush while flushing");
2427
+ }
2428
+ const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
2429
+ let spins = 0;
2430
+ while (true) {
2431
+ const readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
2432
+ if (readIndex === -2) {
2433
+ throw Error("_flushSync failed");
2434
+ }
2435
+ if (readIndex !== writeIndex) {
2436
+ Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1000);
2437
+ } else {
2438
+ break;
2439
+ }
2440
+ if (++spins === 10) {
2441
+ throw new Error("_flushSync took too long (10s)");
2442
+ }
2443
+ }
2444
+ }
2445
+ module.exports = ThreadStream;
2446
+ });
2447
+
2448
+ // node_modules/pino/lib/transport.js
2449
+ var require_transport = __commonJS((exports, module) => {
2450
+ var __dirname = "/Users/xiliangchen/projects/polka-codes/node_modules/pino/lib";
2451
+ var { createRequire } = __require("module");
2452
+ var getCallers = require_caller();
2453
+ var { join, isAbsolute, sep } = __require("path");
2454
+ var sleep = require_atomic_sleep();
2455
+ var onExit = require_on_exit_leak_free();
2456
+ var ThreadStream = require_thread_stream();
2457
+ function setupOnExit(stream) {
2458
+ onExit.register(stream, autoEnd);
2459
+ onExit.registerBeforeExit(stream, flush);
2460
+ stream.on("close", function() {
2461
+ onExit.unregister(stream);
2462
+ });
2463
+ }
2464
+ function buildStream(filename, workerData, workerOpts, sync) {
2465
+ const stream = new ThreadStream({
2466
+ filename,
2467
+ workerData,
2468
+ workerOpts,
2469
+ sync
2470
+ });
2471
+ stream.on("ready", onReady);
2472
+ stream.on("close", function() {
2473
+ process.removeListener("exit", onExit2);
2474
+ });
2475
+ process.on("exit", onExit2);
2476
+ function onReady() {
2477
+ process.removeListener("exit", onExit2);
2478
+ stream.unref();
2479
+ if (workerOpts.autoEnd !== false) {
2480
+ setupOnExit(stream);
2481
+ }
2482
+ }
2483
+ function onExit2() {
2484
+ if (stream.closed) {
2485
+ return;
2486
+ }
2487
+ stream.flushSync();
2488
+ sleep(100);
2489
+ stream.end();
2490
+ }
2491
+ return stream;
2492
+ }
2493
+ function autoEnd(stream) {
2494
+ stream.ref();
2495
+ stream.flushSync();
2496
+ stream.end();
2497
+ stream.once("close", function() {
2498
+ stream.unref();
2499
+ });
2500
+ }
2501
+ function flush(stream) {
2502
+ stream.flushSync();
2503
+ }
2504
+ function transport(fullOptions) {
2505
+ const { pipeline, targets, levels, dedupe, worker = {}, caller = getCallers(), sync = false } = fullOptions;
2506
+ const options = {
2507
+ ...fullOptions.options
2508
+ };
2509
+ const callers = typeof caller === "string" ? [caller] : caller;
2510
+ const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
2511
+ let target = fullOptions.target;
2512
+ if (target && targets) {
2513
+ throw new Error("only one of target or targets can be specified");
2514
+ }
2515
+ if (targets) {
2516
+ target = bundlerOverrides["pino-worker"] || join(__dirname, "worker.js");
2517
+ options.targets = targets.filter((dest) => dest.target).map((dest) => {
2518
+ return {
2519
+ ...dest,
2520
+ target: fixTarget(dest.target)
2521
+ };
2522
+ });
2523
+ options.pipelines = targets.filter((dest) => dest.pipeline).map((dest) => {
2524
+ return dest.pipeline.map((t) => {
2525
+ return {
2526
+ ...t,
2527
+ level: dest.level,
2528
+ target: fixTarget(t.target)
2529
+ };
2530
+ });
2531
+ });
2532
+ } else if (pipeline) {
2533
+ target = bundlerOverrides["pino-worker"] || join(__dirname, "worker.js");
2534
+ options.pipelines = [pipeline.map((dest) => {
2535
+ return {
2536
+ ...dest,
2537
+ target: fixTarget(dest.target)
2538
+ };
2539
+ })];
2540
+ }
2541
+ if (levels) {
2542
+ options.levels = levels;
2543
+ }
2544
+ if (dedupe) {
2545
+ options.dedupe = dedupe;
2546
+ }
2547
+ options.pinoWillSendConfig = true;
2548
+ return buildStream(fixTarget(target), options, worker, sync);
2549
+ function fixTarget(origin) {
2550
+ origin = bundlerOverrides[origin] || origin;
2551
+ if (isAbsolute(origin) || origin.indexOf("file://") === 0) {
2552
+ return origin;
2553
+ }
2554
+ if (origin === "pino/file") {
2555
+ return join(__dirname, "..", "file.js");
2556
+ }
2557
+ let fixTarget2;
2558
+ for (const filePath of callers) {
2559
+ try {
2560
+ const context = filePath === "node:repl" ? process.cwd() + sep : filePath;
2561
+ fixTarget2 = createRequire(context).resolve(origin);
2562
+ break;
2563
+ } catch (err) {
2564
+ continue;
2565
+ }
2566
+ }
2567
+ if (!fixTarget2) {
2568
+ throw new Error(`unable to determine transport target for "${origin}"`);
2569
+ }
2570
+ return fixTarget2;
2571
+ }
2572
+ }
2573
+ module.exports = transport;
2574
+ });
2575
+
2576
+ // node_modules/pino/lib/tools.js
2577
+ var require_tools = __commonJS((exports, module) => {
2578
+ var format = require_quick_format_unescaped();
2579
+ var { mapHttpRequest, mapHttpResponse } = require_pino_std_serializers();
2580
+ var SonicBoom = require_sonic_boom();
2581
+ var onExit = require_on_exit_leak_free();
2582
+ var {
2583
+ lsCacheSym,
2584
+ chindingsSym,
2585
+ writeSym,
2586
+ serializersSym,
2587
+ formatOptsSym,
2588
+ endSym,
2589
+ stringifiersSym,
2590
+ stringifySym,
2591
+ stringifySafeSym,
2592
+ wildcardFirstSym,
2593
+ nestedKeySym,
2594
+ formattersSym,
2595
+ messageKeySym,
2596
+ errorKeySym,
2597
+ nestedKeyStrSym,
2598
+ msgPrefixSym
2599
+ } = require_symbols();
2600
+ var { isMainThread } = __require("worker_threads");
2601
+ var transport = require_transport();
2602
+ function noop() {
2603
+ }
2604
+ function genLog(level, hook) {
2605
+ if (!hook)
2606
+ return LOG;
2607
+ return function hookWrappedLog(...args) {
2608
+ hook.call(this, args, LOG, level);
2609
+ };
2610
+ function LOG(o, ...n) {
2611
+ if (typeof o === "object") {
2612
+ let msg = o;
2613
+ if (o !== null) {
2614
+ if (o.method && o.headers && o.socket) {
2615
+ o = mapHttpRequest(o);
2616
+ } else if (typeof o.setHeader === "function") {
2617
+ o = mapHttpResponse(o);
2618
+ }
2619
+ }
2620
+ let formatParams;
2621
+ if (msg === null && n.length === 0) {
2622
+ formatParams = [null];
2623
+ } else {
2624
+ msg = n.shift();
2625
+ formatParams = n;
2626
+ }
2627
+ if (typeof this[msgPrefixSym] === "string" && msg !== undefined && msg !== null) {
2628
+ msg = this[msgPrefixSym] + msg;
2629
+ }
2630
+ this[writeSym](o, format(msg, formatParams, this[formatOptsSym]), level);
2631
+ } else {
2632
+ let msg = o === undefined ? n.shift() : o;
2633
+ if (typeof this[msgPrefixSym] === "string" && msg !== undefined && msg !== null) {
2634
+ msg = this[msgPrefixSym] + msg;
2635
+ }
2636
+ this[writeSym](null, format(msg, n, this[formatOptsSym]), level);
2637
+ }
2638
+ }
2639
+ }
2640
+ function asString(str) {
2641
+ let result = "";
2642
+ let last = 0;
2643
+ let found = false;
2644
+ let point = 255;
2645
+ const l = str.length;
2646
+ if (l > 100) {
2647
+ return JSON.stringify(str);
2648
+ }
2649
+ for (var i = 0;i < l && point >= 32; i++) {
2650
+ point = str.charCodeAt(i);
2651
+ if (point === 34 || point === 92) {
2652
+ result += str.slice(last, i) + "\\";
2653
+ last = i;
2654
+ found = true;
2655
+ }
2656
+ }
2657
+ if (!found) {
2658
+ result = str;
2659
+ } else {
2660
+ result += str.slice(last);
2661
+ }
2662
+ return point < 32 ? JSON.stringify(str) : '"' + result + '"';
2663
+ }
2664
+ function asJson(obj, msg, num, time) {
2665
+ const stringify2 = this[stringifySym];
2666
+ const stringifySafe = this[stringifySafeSym];
2667
+ const stringifiers = this[stringifiersSym];
2668
+ const end = this[endSym];
2669
+ const chindings = this[chindingsSym];
2670
+ const serializers = this[serializersSym];
2671
+ const formatters = this[formattersSym];
2672
+ const messageKey = this[messageKeySym];
2673
+ const errorKey = this[errorKeySym];
2674
+ let data = this[lsCacheSym][num] + time;
2675
+ data = data + chindings;
2676
+ let value;
2677
+ if (formatters.log) {
2678
+ obj = formatters.log(obj);
2679
+ }
2680
+ const wildcardStringifier = stringifiers[wildcardFirstSym];
2681
+ let propStr = "";
2682
+ for (const key in obj) {
2683
+ value = obj[key];
2684
+ if (Object.prototype.hasOwnProperty.call(obj, key) && value !== undefined) {
2685
+ if (serializers[key]) {
2686
+ value = serializers[key](value);
2687
+ } else if (key === errorKey && serializers.err) {
2688
+ value = serializers.err(value);
2689
+ }
2690
+ const stringifier = stringifiers[key] || wildcardStringifier;
2691
+ switch (typeof value) {
2692
+ case "undefined":
2693
+ case "function":
2694
+ continue;
2695
+ case "number":
2696
+ if (Number.isFinite(value) === false) {
2697
+ value = null;
2698
+ }
2699
+ case "boolean":
2700
+ if (stringifier)
2701
+ value = stringifier(value);
2702
+ break;
2703
+ case "string":
2704
+ value = (stringifier || asString)(value);
2705
+ break;
2706
+ default:
2707
+ value = (stringifier || stringify2)(value, stringifySafe);
2708
+ }
2709
+ if (value === undefined)
2710
+ continue;
2711
+ const strKey = asString(key);
2712
+ propStr += "," + strKey + ":" + value;
2713
+ }
2714
+ }
2715
+ let msgStr = "";
2716
+ if (msg !== undefined) {
2717
+ value = serializers[messageKey] ? serializers[messageKey](msg) : msg;
2718
+ const stringifier = stringifiers[messageKey] || wildcardStringifier;
2719
+ switch (typeof value) {
2720
+ case "function":
2721
+ break;
2722
+ case "number":
2723
+ if (Number.isFinite(value) === false) {
2724
+ value = null;
2725
+ }
2726
+ case "boolean":
2727
+ if (stringifier)
2728
+ value = stringifier(value);
2729
+ msgStr = ',"' + messageKey + '":' + value;
2730
+ break;
2731
+ case "string":
2732
+ value = (stringifier || asString)(value);
2733
+ msgStr = ',"' + messageKey + '":' + value;
2734
+ break;
2735
+ default:
2736
+ value = (stringifier || stringify2)(value, stringifySafe);
2737
+ msgStr = ',"' + messageKey + '":' + value;
2738
+ }
2739
+ }
2740
+ if (this[nestedKeySym] && propStr) {
2741
+ return data + this[nestedKeyStrSym] + propStr.slice(1) + "}" + msgStr + end;
2742
+ } else {
2743
+ return data + propStr + msgStr + end;
2744
+ }
2745
+ }
2746
+ function asChindings(instance, bindings) {
2747
+ let value;
2748
+ let data = instance[chindingsSym];
2749
+ const stringify2 = instance[stringifySym];
2750
+ const stringifySafe = instance[stringifySafeSym];
2751
+ const stringifiers = instance[stringifiersSym];
2752
+ const wildcardStringifier = stringifiers[wildcardFirstSym];
2753
+ const serializers = instance[serializersSym];
2754
+ const formatter = instance[formattersSym].bindings;
2755
+ bindings = formatter(bindings);
2756
+ for (const key in bindings) {
2757
+ value = bindings[key];
2758
+ const valid = key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels" && bindings.hasOwnProperty(key) && value !== undefined;
2759
+ if (valid === true) {
2760
+ value = serializers[key] ? serializers[key](value) : value;
2761
+ value = (stringifiers[key] || wildcardStringifier || stringify2)(value, stringifySafe);
2762
+ if (value === undefined)
2763
+ continue;
2764
+ data += ',"' + key + '":' + value;
2765
+ }
2766
+ }
2767
+ return data;
2768
+ }
2769
+ function hasBeenTampered(stream) {
2770
+ return stream.write !== stream.constructor.prototype.write;
2771
+ }
2772
+ var hasNodeCodeCoverage = process.env.NODE_V8_COVERAGE || process.env.V8_COVERAGE;
2773
+ function buildSafeSonicBoom(opts) {
2774
+ const stream = new SonicBoom(opts);
2775
+ stream.on("error", filterBrokenPipe);
2776
+ if (!hasNodeCodeCoverage && !opts.sync && isMainThread) {
2777
+ onExit.register(stream, autoEnd);
2778
+ stream.on("close", function() {
2779
+ onExit.unregister(stream);
2780
+ });
2781
+ }
2782
+ return stream;
2783
+ function filterBrokenPipe(err) {
2784
+ if (err.code === "EPIPE") {
2785
+ stream.write = noop;
2786
+ stream.end = noop;
2787
+ stream.flushSync = noop;
2788
+ stream.destroy = noop;
2789
+ return;
2790
+ }
2791
+ stream.removeListener("error", filterBrokenPipe);
2792
+ stream.emit("error", err);
2793
+ }
2794
+ }
2795
+ function autoEnd(stream, eventName) {
2796
+ if (stream.destroyed) {
2797
+ return;
2798
+ }
2799
+ if (eventName === "beforeExit") {
2800
+ stream.flush();
2801
+ stream.on("drain", function() {
2802
+ stream.end();
2803
+ });
2804
+ } else {
2805
+ stream.flushSync();
2806
+ }
2807
+ }
2808
+ function createArgsNormalizer(defaultOptions) {
2809
+ return function normalizeArgs(instance, caller, opts = {}, stream) {
2810
+ if (typeof opts === "string") {
2811
+ stream = buildSafeSonicBoom({ dest: opts });
2812
+ opts = {};
2813
+ } else if (typeof stream === "string") {
2814
+ if (opts && opts.transport) {
2815
+ throw Error("only one of option.transport or stream can be specified");
2816
+ }
2817
+ stream = buildSafeSonicBoom({ dest: stream });
2818
+ } else if (opts instanceof SonicBoom || opts.writable || opts._writableState) {
2819
+ stream = opts;
2820
+ opts = {};
2821
+ } else if (opts.transport) {
2822
+ if (opts.transport instanceof SonicBoom || opts.transport.writable || opts.transport._writableState) {
2823
+ throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");
2824
+ }
2825
+ if (opts.transport.targets && opts.transport.targets.length && opts.formatters && typeof opts.formatters.level === "function") {
2826
+ throw Error("option.transport.targets do not allow custom level formatters");
2827
+ }
2828
+ let customLevels;
2829
+ if (opts.customLevels) {
2830
+ customLevels = opts.useOnlyCustomLevels ? opts.customLevels : Object.assign({}, opts.levels, opts.customLevels);
2831
+ }
2832
+ stream = transport({ caller, ...opts.transport, levels: customLevels });
2833
+ }
2834
+ opts = Object.assign({}, defaultOptions, opts);
2835
+ opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers);
2836
+ opts.formatters = Object.assign({}, defaultOptions.formatters, opts.formatters);
2837
+ if (opts.prettyPrint) {
2838
+ throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");
2839
+ }
2840
+ const { enabled, onChild } = opts;
2841
+ if (enabled === false)
2842
+ opts.level = "silent";
2843
+ if (!onChild)
2844
+ opts.onChild = noop;
2845
+ if (!stream) {
2846
+ if (!hasBeenTampered(process.stdout)) {
2847
+ stream = buildSafeSonicBoom({ fd: process.stdout.fd || 1 });
2848
+ } else {
2849
+ stream = process.stdout;
2850
+ }
2851
+ }
2852
+ return { opts, stream };
2853
+ };
2854
+ }
2855
+ function stringify(obj, stringifySafeFn) {
2856
+ try {
2857
+ return JSON.stringify(obj);
2858
+ } catch (_) {
2859
+ try {
2860
+ const stringify2 = stringifySafeFn || this[stringifySafeSym];
2861
+ return stringify2(obj);
2862
+ } catch (_2) {
2863
+ return '"[unable to serialize, circular reference is too complex to analyze]"';
2864
+ }
2865
+ }
2866
+ }
2867
+ function buildFormatters(level, bindings, log) {
2868
+ return {
2869
+ level,
2870
+ bindings,
2871
+ log
2872
+ };
2873
+ }
2874
+ function normalizeDestFileDescriptor(destination) {
2875
+ const fd = Number(destination);
2876
+ if (typeof destination === "string" && Number.isFinite(fd)) {
2877
+ return fd;
2878
+ }
2879
+ if (destination === undefined) {
2880
+ return 1;
2881
+ }
2882
+ return destination;
2883
+ }
2884
+ module.exports = {
2885
+ noop,
2886
+ buildSafeSonicBoom,
2887
+ asChindings,
2888
+ asJson,
2889
+ genLog,
2890
+ createArgsNormalizer,
2891
+ stringify,
2892
+ buildFormatters,
2893
+ normalizeDestFileDescriptor
2894
+ };
2895
+ });
2896
+
2897
+ // node_modules/pino/lib/constants.js
2898
+ var require_constants = __commonJS((exports, module) => {
2899
+ var DEFAULT_LEVELS = {
2900
+ trace: 10,
2901
+ debug: 20,
2902
+ info: 30,
2903
+ warn: 40,
2904
+ error: 50,
2905
+ fatal: 60
2906
+ };
2907
+ var SORTING_ORDER = {
2908
+ ASC: "ASC",
2909
+ DESC: "DESC"
2910
+ };
2911
+ module.exports = {
2912
+ DEFAULT_LEVELS,
2913
+ SORTING_ORDER
2914
+ };
2915
+ });
2916
+
2917
+ // node_modules/pino/lib/levels.js
2918
+ var require_levels = __commonJS((exports, module) => {
2919
+ var {
2920
+ lsCacheSym,
2921
+ levelValSym,
2922
+ useOnlyCustomLevelsSym,
2923
+ streamSym,
2924
+ formattersSym,
2925
+ hooksSym,
2926
+ levelCompSym
2927
+ } = require_symbols();
2928
+ var { noop, genLog } = require_tools();
2929
+ var { DEFAULT_LEVELS, SORTING_ORDER } = require_constants();
2930
+ var levelMethods = {
2931
+ fatal: (hook) => {
2932
+ const logFatal = genLog(DEFAULT_LEVELS.fatal, hook);
2933
+ return function(...args) {
2934
+ const stream = this[streamSym];
2935
+ logFatal.call(this, ...args);
2936
+ if (typeof stream.flushSync === "function") {
2937
+ try {
2938
+ stream.flushSync();
2939
+ } catch (e) {
2940
+ }
2941
+ }
2942
+ };
2943
+ },
2944
+ error: (hook) => genLog(DEFAULT_LEVELS.error, hook),
2945
+ warn: (hook) => genLog(DEFAULT_LEVELS.warn, hook),
2946
+ info: (hook) => genLog(DEFAULT_LEVELS.info, hook),
2947
+ debug: (hook) => genLog(DEFAULT_LEVELS.debug, hook),
2948
+ trace: (hook) => genLog(DEFAULT_LEVELS.trace, hook)
2949
+ };
2950
+ var nums = Object.keys(DEFAULT_LEVELS).reduce((o, k) => {
2951
+ o[DEFAULT_LEVELS[k]] = k;
2952
+ return o;
2953
+ }, {});
2954
+ var initialLsCache = Object.keys(nums).reduce((o, k) => {
2955
+ o[k] = '{"level":' + Number(k);
2956
+ return o;
2957
+ }, {});
2958
+ function genLsCache(instance) {
2959
+ const formatter = instance[formattersSym].level;
2960
+ const { labels } = instance.levels;
2961
+ const cache = {};
2962
+ for (const label in labels) {
2963
+ const level = formatter(labels[label], Number(label));
2964
+ cache[label] = JSON.stringify(level).slice(0, -1);
2965
+ }
2966
+ instance[lsCacheSym] = cache;
2967
+ return instance;
2968
+ }
2969
+ function isStandardLevel(level, useOnlyCustomLevels) {
2970
+ if (useOnlyCustomLevels) {
2971
+ return false;
2972
+ }
2973
+ switch (level) {
2974
+ case "fatal":
2975
+ case "error":
2976
+ case "warn":
2977
+ case "info":
2978
+ case "debug":
2979
+ case "trace":
2980
+ return true;
2981
+ default:
2982
+ return false;
2983
+ }
2984
+ }
2985
+ function setLevel(level) {
2986
+ const { labels, values } = this.levels;
2987
+ if (typeof level === "number") {
2988
+ if (labels[level] === undefined)
2989
+ throw Error("unknown level value" + level);
2990
+ level = labels[level];
2991
+ }
2992
+ if (values[level] === undefined)
2993
+ throw Error("unknown level " + level);
2994
+ const preLevelVal = this[levelValSym];
2995
+ const levelVal = this[levelValSym] = values[level];
2996
+ const useOnlyCustomLevelsVal = this[useOnlyCustomLevelsSym];
2997
+ const levelComparison = this[levelCompSym];
2998
+ const hook = this[hooksSym].logMethod;
2999
+ for (const key in values) {
3000
+ if (levelComparison(values[key], levelVal) === false) {
3001
+ this[key] = noop;
3002
+ continue;
3003
+ }
3004
+ this[key] = isStandardLevel(key, useOnlyCustomLevelsVal) ? levelMethods[key](hook) : genLog(values[key], hook);
3005
+ }
3006
+ this.emit("level-change", level, levelVal, labels[preLevelVal], preLevelVal, this);
3007
+ }
3008
+ function getLevel(level) {
3009
+ const { levels, levelVal } = this;
3010
+ return levels && levels.labels ? levels.labels[levelVal] : "";
3011
+ }
3012
+ function isLevelEnabled(logLevel) {
3013
+ const { values } = this.levels;
3014
+ const logLevelVal = values[logLevel];
3015
+ return logLevelVal !== undefined && this[levelCompSym](logLevelVal, this[levelValSym]);
3016
+ }
3017
+ function compareLevel(direction, current, expected) {
3018
+ if (direction === SORTING_ORDER.DESC) {
3019
+ return current <= expected;
3020
+ }
3021
+ return current >= expected;
3022
+ }
3023
+ function genLevelComparison(levelComparison) {
3024
+ if (typeof levelComparison === "string") {
3025
+ return compareLevel.bind(null, levelComparison);
3026
+ }
3027
+ return levelComparison;
3028
+ }
3029
+ function mappings(customLevels = null, useOnlyCustomLevels = false) {
3030
+ const customNums = customLevels ? Object.keys(customLevels).reduce((o, k) => {
3031
+ o[customLevels[k]] = k;
3032
+ return o;
3033
+ }, {}) : null;
3034
+ const labels = Object.assign(Object.create(Object.prototype, { Infinity: { value: "silent" } }), useOnlyCustomLevels ? null : nums, customNums);
3035
+ const values = Object.assign(Object.create(Object.prototype, { silent: { value: Infinity } }), useOnlyCustomLevels ? null : DEFAULT_LEVELS, customLevels);
3036
+ return { labels, values };
3037
+ }
3038
+ function assertDefaultLevelFound(defaultLevel, customLevels, useOnlyCustomLevels) {
3039
+ if (typeof defaultLevel === "number") {
3040
+ const values = [].concat(Object.keys(customLevels || {}).map((key) => customLevels[key]), useOnlyCustomLevels ? [] : Object.keys(nums).map((level) => +level), Infinity);
3041
+ if (!values.includes(defaultLevel)) {
3042
+ throw Error(`default level:${defaultLevel} must be included in custom levels`);
3043
+ }
3044
+ return;
3045
+ }
3046
+ const labels = Object.assign(Object.create(Object.prototype, { silent: { value: Infinity } }), useOnlyCustomLevels ? null : DEFAULT_LEVELS, customLevels);
3047
+ if (!(defaultLevel in labels)) {
3048
+ throw Error(`default level:${defaultLevel} must be included in custom levels`);
3049
+ }
3050
+ }
3051
+ function assertNoLevelCollisions(levels, customLevels) {
3052
+ const { labels, values } = levels;
3053
+ for (const k in customLevels) {
3054
+ if (k in values) {
3055
+ throw Error("levels cannot be overridden");
3056
+ }
3057
+ if (customLevels[k] in labels) {
3058
+ throw Error("pre-existing level values cannot be used for new levels");
3059
+ }
3060
+ }
3061
+ }
3062
+ function assertLevelComparison(levelComparison) {
3063
+ if (typeof levelComparison === "function") {
3064
+ return;
3065
+ }
3066
+ if (typeof levelComparison === "string" && Object.values(SORTING_ORDER).includes(levelComparison)) {
3067
+ return;
3068
+ }
3069
+ throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type');
3070
+ }
3071
+ module.exports = {
3072
+ initialLsCache,
3073
+ genLsCache,
3074
+ levelMethods,
3075
+ getLevel,
3076
+ setLevel,
3077
+ isLevelEnabled,
3078
+ mappings,
3079
+ assertNoLevelCollisions,
3080
+ assertDefaultLevelFound,
3081
+ genLevelComparison,
3082
+ assertLevelComparison
3083
+ };
3084
+ });
3085
+
3086
+ // node_modules/pino/lib/meta.js
3087
+ var require_meta = __commonJS((exports, module) => {
3088
+ module.exports = { version: "9.6.0" };
3089
+ });
3090
+
3091
+ // node_modules/pino/lib/proto.js
3092
+ var require_proto = __commonJS((exports, module) => {
3093
+ var { EventEmitter } = __require("events");
3094
+ var {
3095
+ lsCacheSym,
3096
+ levelValSym,
3097
+ setLevelSym,
3098
+ getLevelSym,
3099
+ chindingsSym,
3100
+ parsedChindingsSym,
3101
+ mixinSym,
3102
+ asJsonSym,
3103
+ writeSym,
3104
+ mixinMergeStrategySym,
3105
+ timeSym,
3106
+ timeSliceIndexSym,
3107
+ streamSym,
3108
+ serializersSym,
3109
+ formattersSym,
3110
+ errorKeySym,
3111
+ messageKeySym,
3112
+ useOnlyCustomLevelsSym,
3113
+ needsMetadataGsym,
3114
+ redactFmtSym,
3115
+ stringifySym,
3116
+ formatOptsSym,
3117
+ stringifiersSym,
3118
+ msgPrefixSym,
3119
+ hooksSym
3120
+ } = require_symbols();
3121
+ var {
3122
+ getLevel,
3123
+ setLevel,
3124
+ isLevelEnabled,
3125
+ mappings,
3126
+ initialLsCache,
3127
+ genLsCache,
3128
+ assertNoLevelCollisions
3129
+ } = require_levels();
3130
+ var {
3131
+ asChindings,
3132
+ asJson,
3133
+ buildFormatters,
3134
+ stringify
3135
+ } = require_tools();
3136
+ var {
3137
+ version
3138
+ } = require_meta();
3139
+ var redaction = require_redaction();
3140
+ var constructor = class Pino {
3141
+ };
3142
+ var prototype = {
3143
+ constructor,
3144
+ child,
3145
+ bindings,
3146
+ setBindings,
3147
+ flush,
3148
+ isLevelEnabled,
3149
+ version,
3150
+ get level() {
3151
+ return this[getLevelSym]();
3152
+ },
3153
+ set level(lvl) {
3154
+ this[setLevelSym](lvl);
3155
+ },
3156
+ get levelVal() {
3157
+ return this[levelValSym];
3158
+ },
3159
+ set levelVal(n) {
3160
+ throw Error("levelVal is read-only");
3161
+ },
3162
+ [lsCacheSym]: initialLsCache,
3163
+ [writeSym]: write,
3164
+ [asJsonSym]: asJson,
3165
+ [getLevelSym]: getLevel,
3166
+ [setLevelSym]: setLevel
3167
+ };
3168
+ Object.setPrototypeOf(prototype, EventEmitter.prototype);
3169
+ module.exports = function() {
3170
+ return Object.create(prototype);
3171
+ };
3172
+ var resetChildingsFormatter = (bindings2) => bindings2;
3173
+ function child(bindings2, options) {
3174
+ if (!bindings2) {
3175
+ throw Error("missing bindings for child Pino");
3176
+ }
3177
+ options = options || {};
3178
+ const serializers = this[serializersSym];
3179
+ const formatters = this[formattersSym];
3180
+ const instance = Object.create(this);
3181
+ if (options.hasOwnProperty("serializers") === true) {
3182
+ instance[serializersSym] = Object.create(null);
3183
+ for (const k in serializers) {
3184
+ instance[serializersSym][k] = serializers[k];
3185
+ }
3186
+ const parentSymbols = Object.getOwnPropertySymbols(serializers);
3187
+ for (var i = 0;i < parentSymbols.length; i++) {
3188
+ const ks = parentSymbols[i];
3189
+ instance[serializersSym][ks] = serializers[ks];
3190
+ }
3191
+ for (const bk in options.serializers) {
3192
+ instance[serializersSym][bk] = options.serializers[bk];
3193
+ }
3194
+ const bindingsSymbols = Object.getOwnPropertySymbols(options.serializers);
3195
+ for (var bi = 0;bi < bindingsSymbols.length; bi++) {
3196
+ const bks = bindingsSymbols[bi];
3197
+ instance[serializersSym][bks] = options.serializers[bks];
3198
+ }
3199
+ } else
3200
+ instance[serializersSym] = serializers;
3201
+ if (options.hasOwnProperty("formatters")) {
3202
+ const { level, bindings: chindings, log } = options.formatters;
3203
+ instance[formattersSym] = buildFormatters(level || formatters.level, chindings || resetChildingsFormatter, log || formatters.log);
3204
+ } else {
3205
+ instance[formattersSym] = buildFormatters(formatters.level, resetChildingsFormatter, formatters.log);
3206
+ }
3207
+ if (options.hasOwnProperty("customLevels") === true) {
3208
+ assertNoLevelCollisions(this.levels, options.customLevels);
3209
+ instance.levels = mappings(options.customLevels, instance[useOnlyCustomLevelsSym]);
3210
+ genLsCache(instance);
3211
+ }
3212
+ if (typeof options.redact === "object" && options.redact !== null || Array.isArray(options.redact)) {
3213
+ instance.redact = options.redact;
3214
+ const stringifiers = redaction(instance.redact, stringify);
3215
+ const formatOpts = { stringify: stringifiers[redactFmtSym] };
3216
+ instance[stringifySym] = stringify;
3217
+ instance[stringifiersSym] = stringifiers;
3218
+ instance[formatOptsSym] = formatOpts;
3219
+ }
3220
+ if (typeof options.msgPrefix === "string") {
3221
+ instance[msgPrefixSym] = (this[msgPrefixSym] || "") + options.msgPrefix;
3222
+ }
3223
+ instance[chindingsSym] = asChindings(instance, bindings2);
3224
+ const childLevel = options.level || this.level;
3225
+ instance[setLevelSym](childLevel);
3226
+ this.onChild(instance);
3227
+ return instance;
3228
+ }
3229
+ function bindings() {
3230
+ const chindings = this[chindingsSym];
3231
+ const chindingsJson = `{${chindings.substr(1)}}`;
3232
+ const bindingsFromJson = JSON.parse(chindingsJson);
3233
+ delete bindingsFromJson.pid;
3234
+ delete bindingsFromJson.hostname;
3235
+ return bindingsFromJson;
3236
+ }
3237
+ function setBindings(newBindings) {
3238
+ const chindings = asChindings(this, newBindings);
3239
+ this[chindingsSym] = chindings;
3240
+ delete this[parsedChindingsSym];
3241
+ }
3242
+ function defaultMixinMergeStrategy(mergeObject, mixinObject) {
3243
+ return Object.assign(mixinObject, mergeObject);
3244
+ }
3245
+ function write(_obj, msg, num) {
3246
+ const t = this[timeSym]();
3247
+ const mixin = this[mixinSym];
3248
+ const errorKey = this[errorKeySym];
3249
+ const messageKey = this[messageKeySym];
3250
+ const mixinMergeStrategy = this[mixinMergeStrategySym] || defaultMixinMergeStrategy;
3251
+ let obj;
3252
+ const streamWriteHook = this[hooksSym].streamWrite;
3253
+ if (_obj === undefined || _obj === null) {
3254
+ obj = {};
3255
+ } else if (_obj instanceof Error) {
3256
+ obj = { [errorKey]: _obj };
3257
+ if (msg === undefined) {
3258
+ msg = _obj.message;
3259
+ }
3260
+ } else {
3261
+ obj = _obj;
3262
+ if (msg === undefined && _obj[messageKey] === undefined && _obj[errorKey]) {
3263
+ msg = _obj[errorKey].message;
3264
+ }
3265
+ }
3266
+ if (mixin) {
3267
+ obj = mixinMergeStrategy(obj, mixin(obj, num, this));
3268
+ }
3269
+ const s = this[asJsonSym](obj, msg, num, t);
3270
+ const stream = this[streamSym];
3271
+ if (stream[needsMetadataGsym] === true) {
3272
+ stream.lastLevel = num;
3273
+ stream.lastObj = obj;
3274
+ stream.lastMsg = msg;
3275
+ stream.lastTime = t.slice(this[timeSliceIndexSym]);
3276
+ stream.lastLogger = this;
3277
+ }
3278
+ stream.write(streamWriteHook ? streamWriteHook(s) : s);
3279
+ }
3280
+ function noop() {
3281
+ }
3282
+ function flush(cb) {
3283
+ if (cb != null && typeof cb !== "function") {
3284
+ throw Error("callback must be a function");
3285
+ }
3286
+ const stream = this[streamSym];
3287
+ if (typeof stream.flush === "function") {
3288
+ stream.flush(cb || noop);
3289
+ } else if (cb)
3290
+ cb();
3291
+ }
3292
+ });
3293
+
3294
+ // node_modules/safe-stable-stringify/index.js
3295
+ var require_safe_stable_stringify = __commonJS((exports, module) => {
3296
+ var { hasOwnProperty } = Object.prototype;
3297
+ var stringify = configure();
3298
+ stringify.configure = configure;
3299
+ stringify.stringify = stringify;
3300
+ stringify.default = stringify;
3301
+ exports.stringify = stringify;
3302
+ exports.configure = configure;
3303
+ module.exports = stringify;
3304
+ var strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;
3305
+ function strEscape(str) {
3306
+ if (str.length < 5000 && !strEscapeSequencesRegExp.test(str)) {
3307
+ return `"${str}"`;
3308
+ }
3309
+ return JSON.stringify(str);
3310
+ }
3311
+ function sort(array, comparator) {
3312
+ if (array.length > 200 || comparator) {
3313
+ return array.sort(comparator);
3314
+ }
3315
+ for (let i = 1;i < array.length; i++) {
3316
+ const currentValue = array[i];
3317
+ let position = i;
3318
+ while (position !== 0 && array[position - 1] > currentValue) {
3319
+ array[position] = array[position - 1];
3320
+ position--;
3321
+ }
3322
+ array[position] = currentValue;
3323
+ }
3324
+ return array;
3325
+ }
3326
+ var typedArrayPrototypeGetSymbolToStringTag = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)), Symbol.toStringTag).get;
3327
+ function isTypedArrayWithEntries(value) {
3328
+ return typedArrayPrototypeGetSymbolToStringTag.call(value) !== undefined && value.length !== 0;
3329
+ }
3330
+ function stringifyTypedArray(array, separator, maximumBreadth) {
3331
+ if (array.length < maximumBreadth) {
3332
+ maximumBreadth = array.length;
3333
+ }
3334
+ const whitespace = separator === "," ? "" : " ";
3335
+ let res = `"0":${whitespace}${array[0]}`;
3336
+ for (let i = 1;i < maximumBreadth; i++) {
3337
+ res += `${separator}"${i}":${whitespace}${array[i]}`;
3338
+ }
3339
+ return res;
3340
+ }
3341
+ function getCircularValueOption(options) {
3342
+ if (hasOwnProperty.call(options, "circularValue")) {
3343
+ const circularValue = options.circularValue;
3344
+ if (typeof circularValue === "string") {
3345
+ return `"${circularValue}"`;
3346
+ }
3347
+ if (circularValue == null) {
3348
+ return circularValue;
3349
+ }
3350
+ if (circularValue === Error || circularValue === TypeError) {
3351
+ return {
3352
+ toString() {
3353
+ throw new TypeError("Converting circular structure to JSON");
3354
+ }
3355
+ };
3356
+ }
3357
+ throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined');
3358
+ }
3359
+ return '"[Circular]"';
3360
+ }
3361
+ function getDeterministicOption(options) {
3362
+ let value;
3363
+ if (hasOwnProperty.call(options, "deterministic")) {
3364
+ value = options.deterministic;
3365
+ if (typeof value !== "boolean" && typeof value !== "function") {
3366
+ throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');
3367
+ }
3368
+ }
3369
+ return value === undefined ? true : value;
3370
+ }
3371
+ function getBooleanOption(options, key) {
3372
+ let value;
3373
+ if (hasOwnProperty.call(options, key)) {
3374
+ value = options[key];
3375
+ if (typeof value !== "boolean") {
3376
+ throw new TypeError(`The "${key}" argument must be of type boolean`);
3377
+ }
3378
+ }
3379
+ return value === undefined ? true : value;
3380
+ }
3381
+ function getPositiveIntegerOption(options, key) {
3382
+ let value;
3383
+ if (hasOwnProperty.call(options, key)) {
3384
+ value = options[key];
3385
+ if (typeof value !== "number") {
3386
+ throw new TypeError(`The "${key}" argument must be of type number`);
3387
+ }
3388
+ if (!Number.isInteger(value)) {
3389
+ throw new TypeError(`The "${key}" argument must be an integer`);
3390
+ }
3391
+ if (value < 1) {
3392
+ throw new RangeError(`The "${key}" argument must be >= 1`);
3393
+ }
3394
+ }
3395
+ return value === undefined ? Infinity : value;
3396
+ }
3397
+ function getItemCount(number) {
3398
+ if (number === 1) {
3399
+ return "1 item";
3400
+ }
3401
+ return `${number} items`;
3402
+ }
3403
+ function getUniqueReplacerSet(replacerArray) {
3404
+ const replacerSet = new Set;
3405
+ for (const value of replacerArray) {
3406
+ if (typeof value === "string" || typeof value === "number") {
3407
+ replacerSet.add(String(value));
3408
+ }
3409
+ }
3410
+ return replacerSet;
3411
+ }
3412
+ function getStrictOption(options) {
3413
+ if (hasOwnProperty.call(options, "strict")) {
3414
+ const value = options.strict;
3415
+ if (typeof value !== "boolean") {
3416
+ throw new TypeError('The "strict" argument must be of type boolean');
3417
+ }
3418
+ if (value) {
3419
+ return (value2) => {
3420
+ let message = `Object can not safely be stringified. Received type ${typeof value2}`;
3421
+ if (typeof value2 !== "function")
3422
+ message += ` (${value2.toString()})`;
3423
+ throw new Error(message);
3424
+ };
3425
+ }
3426
+ }
3427
+ }
3428
+ function configure(options) {
3429
+ options = { ...options };
3430
+ const fail = getStrictOption(options);
3431
+ if (fail) {
3432
+ if (options.bigint === undefined) {
3433
+ options.bigint = false;
3434
+ }
3435
+ if (!("circularValue" in options)) {
3436
+ options.circularValue = Error;
3437
+ }
3438
+ }
3439
+ const circularValue = getCircularValueOption(options);
3440
+ const bigint = getBooleanOption(options, "bigint");
3441
+ const deterministic = getDeterministicOption(options);
3442
+ const comparator = typeof deterministic === "function" ? deterministic : undefined;
3443
+ const maximumDepth = getPositiveIntegerOption(options, "maximumDepth");
3444
+ const maximumBreadth = getPositiveIntegerOption(options, "maximumBreadth");
3445
+ function stringifyFnReplacer(key, parent, stack, replacer, spacer, indentation) {
3446
+ let value = parent[key];
3447
+ if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
3448
+ value = value.toJSON(key);
3449
+ }
3450
+ value = replacer.call(parent, key, value);
3451
+ switch (typeof value) {
3452
+ case "string":
3453
+ return strEscape(value);
3454
+ case "object": {
3455
+ if (value === null) {
3456
+ return "null";
3457
+ }
3458
+ if (stack.indexOf(value) !== -1) {
3459
+ return circularValue;
3460
+ }
3461
+ let res = "";
3462
+ let join = ",";
3463
+ const originalIndentation = indentation;
3464
+ if (Array.isArray(value)) {
3465
+ if (value.length === 0) {
3466
+ return "[]";
3467
+ }
3468
+ if (maximumDepth < stack.length + 1) {
3469
+ return '"[Array]"';
3470
+ }
3471
+ stack.push(value);
3472
+ if (spacer !== "") {
3473
+ indentation += spacer;
3474
+ res += `
3475
+ ${indentation}`;
3476
+ join = `,
3477
+ ${indentation}`;
3478
+ }
3479
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
3480
+ let i = 0;
3481
+ for (;i < maximumValuesToStringify - 1; i++) {
3482
+ const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
3483
+ res += tmp2 !== undefined ? tmp2 : "null";
3484
+ res += join;
3485
+ }
3486
+ const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
3487
+ res += tmp !== undefined ? tmp : "null";
3488
+ if (value.length - 1 > maximumBreadth) {
3489
+ const removedKeys = value.length - maximumBreadth - 1;
3490
+ res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
3491
+ }
3492
+ if (spacer !== "") {
3493
+ res += `
3494
+ ${originalIndentation}`;
3495
+ }
3496
+ stack.pop();
3497
+ return `[${res}]`;
3498
+ }
3499
+ let keys = Object.keys(value);
3500
+ const keyLength = keys.length;
3501
+ if (keyLength === 0) {
3502
+ return "{}";
3503
+ }
3504
+ if (maximumDepth < stack.length + 1) {
3505
+ return '"[Object]"';
3506
+ }
3507
+ let whitespace = "";
3508
+ let separator = "";
3509
+ if (spacer !== "") {
3510
+ indentation += spacer;
3511
+ join = `,
3512
+ ${indentation}`;
3513
+ whitespace = " ";
3514
+ }
3515
+ const maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
3516
+ if (deterministic && !isTypedArrayWithEntries(value)) {
3517
+ keys = sort(keys, comparator);
3518
+ }
3519
+ stack.push(value);
3520
+ for (let i = 0;i < maximumPropertiesToStringify; i++) {
3521
+ const key2 = keys[i];
3522
+ const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
3523
+ if (tmp !== undefined) {
3524
+ res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
3525
+ separator = join;
3526
+ }
3527
+ }
3528
+ if (keyLength > maximumBreadth) {
3529
+ const removedKeys = keyLength - maximumBreadth;
3530
+ res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
3531
+ separator = join;
3532
+ }
3533
+ if (spacer !== "" && separator.length > 1) {
3534
+ res = `
3535
+ ${indentation}${res}
3536
+ ${originalIndentation}`;
3537
+ }
3538
+ stack.pop();
3539
+ return `{${res}}`;
3540
+ }
3541
+ case "number":
3542
+ return isFinite(value) ? String(value) : fail ? fail(value) : "null";
3543
+ case "boolean":
3544
+ return value === true ? "true" : "false";
3545
+ case "undefined":
3546
+ return;
3547
+ case "bigint":
3548
+ if (bigint) {
3549
+ return String(value);
3550
+ }
3551
+ default:
3552
+ return fail ? fail(value) : undefined;
3553
+ }
3554
+ }
3555
+ function stringifyArrayReplacer(key, value, stack, replacer, spacer, indentation) {
3556
+ if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
3557
+ value = value.toJSON(key);
3558
+ }
3559
+ switch (typeof value) {
3560
+ case "string":
3561
+ return strEscape(value);
3562
+ case "object": {
3563
+ if (value === null) {
3564
+ return "null";
3565
+ }
3566
+ if (stack.indexOf(value) !== -1) {
3567
+ return circularValue;
3568
+ }
3569
+ const originalIndentation = indentation;
3570
+ let res = "";
3571
+ let join = ",";
3572
+ if (Array.isArray(value)) {
3573
+ if (value.length === 0) {
3574
+ return "[]";
3575
+ }
3576
+ if (maximumDepth < stack.length + 1) {
3577
+ return '"[Array]"';
3578
+ }
3579
+ stack.push(value);
3580
+ if (spacer !== "") {
3581
+ indentation += spacer;
3582
+ res += `
3583
+ ${indentation}`;
3584
+ join = `,
3585
+ ${indentation}`;
3586
+ }
3587
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
3588
+ let i = 0;
3589
+ for (;i < maximumValuesToStringify - 1; i++) {
3590
+ const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
3591
+ res += tmp2 !== undefined ? tmp2 : "null";
3592
+ res += join;
3593
+ }
3594
+ const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
3595
+ res += tmp !== undefined ? tmp : "null";
3596
+ if (value.length - 1 > maximumBreadth) {
3597
+ const removedKeys = value.length - maximumBreadth - 1;
3598
+ res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
3599
+ }
3600
+ if (spacer !== "") {
3601
+ res += `
3602
+ ${originalIndentation}`;
3603
+ }
3604
+ stack.pop();
3605
+ return `[${res}]`;
3606
+ }
3607
+ stack.push(value);
3608
+ let whitespace = "";
3609
+ if (spacer !== "") {
3610
+ indentation += spacer;
3611
+ join = `,
3612
+ ${indentation}`;
3613
+ whitespace = " ";
3614
+ }
3615
+ let separator = "";
3616
+ for (const key2 of replacer) {
3617
+ const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
3618
+ if (tmp !== undefined) {
3619
+ res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
3620
+ separator = join;
3621
+ }
3622
+ }
3623
+ if (spacer !== "" && separator.length > 1) {
3624
+ res = `
3625
+ ${indentation}${res}
3626
+ ${originalIndentation}`;
3627
+ }
3628
+ stack.pop();
3629
+ return `{${res}}`;
3630
+ }
3631
+ case "number":
3632
+ return isFinite(value) ? String(value) : fail ? fail(value) : "null";
3633
+ case "boolean":
3634
+ return value === true ? "true" : "false";
3635
+ case "undefined":
3636
+ return;
3637
+ case "bigint":
3638
+ if (bigint) {
3639
+ return String(value);
3640
+ }
3641
+ default:
3642
+ return fail ? fail(value) : undefined;
3643
+ }
3644
+ }
3645
+ function stringifyIndent(key, value, stack, spacer, indentation) {
3646
+ switch (typeof value) {
3647
+ case "string":
3648
+ return strEscape(value);
3649
+ case "object": {
3650
+ if (value === null) {
3651
+ return "null";
3652
+ }
3653
+ if (typeof value.toJSON === "function") {
3654
+ value = value.toJSON(key);
3655
+ if (typeof value !== "object") {
3656
+ return stringifyIndent(key, value, stack, spacer, indentation);
3657
+ }
3658
+ if (value === null) {
3659
+ return "null";
3660
+ }
3661
+ }
3662
+ if (stack.indexOf(value) !== -1) {
3663
+ return circularValue;
3664
+ }
3665
+ const originalIndentation = indentation;
3666
+ if (Array.isArray(value)) {
3667
+ if (value.length === 0) {
3668
+ return "[]";
3669
+ }
3670
+ if (maximumDepth < stack.length + 1) {
3671
+ return '"[Array]"';
3672
+ }
3673
+ stack.push(value);
3674
+ indentation += spacer;
3675
+ let res2 = `
3676
+ ${indentation}`;
3677
+ const join2 = `,
3678
+ ${indentation}`;
3679
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
3680
+ let i = 0;
3681
+ for (;i < maximumValuesToStringify - 1; i++) {
3682
+ const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
3683
+ res2 += tmp2 !== undefined ? tmp2 : "null";
3684
+ res2 += join2;
3685
+ }
3686
+ const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
3687
+ res2 += tmp !== undefined ? tmp : "null";
3688
+ if (value.length - 1 > maximumBreadth) {
3689
+ const removedKeys = value.length - maximumBreadth - 1;
3690
+ res2 += `${join2}"... ${getItemCount(removedKeys)} not stringified"`;
3691
+ }
3692
+ res2 += `
3693
+ ${originalIndentation}`;
3694
+ stack.pop();
3695
+ return `[${res2}]`;
3696
+ }
3697
+ let keys = Object.keys(value);
3698
+ const keyLength = keys.length;
3699
+ if (keyLength === 0) {
3700
+ return "{}";
3701
+ }
3702
+ if (maximumDepth < stack.length + 1) {
3703
+ return '"[Object]"';
3704
+ }
3705
+ indentation += spacer;
3706
+ const join = `,
3707
+ ${indentation}`;
3708
+ let res = "";
3709
+ let separator = "";
3710
+ let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
3711
+ if (isTypedArrayWithEntries(value)) {
3712
+ res += stringifyTypedArray(value, join, maximumBreadth);
3713
+ keys = keys.slice(value.length);
3714
+ maximumPropertiesToStringify -= value.length;
3715
+ separator = join;
3716
+ }
3717
+ if (deterministic) {
3718
+ keys = sort(keys, comparator);
3719
+ }
3720
+ stack.push(value);
3721
+ for (let i = 0;i < maximumPropertiesToStringify; i++) {
3722
+ const key2 = keys[i];
3723
+ const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
3724
+ if (tmp !== undefined) {
3725
+ res += `${separator}${strEscape(key2)}: ${tmp}`;
3726
+ separator = join;
3727
+ }
3728
+ }
3729
+ if (keyLength > maximumBreadth) {
3730
+ const removedKeys = keyLength - maximumBreadth;
3731
+ res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
3732
+ separator = join;
3733
+ }
3734
+ if (separator !== "") {
3735
+ res = `
3736
+ ${indentation}${res}
3737
+ ${originalIndentation}`;
3738
+ }
3739
+ stack.pop();
3740
+ return `{${res}}`;
3741
+ }
3742
+ case "number":
3743
+ return isFinite(value) ? String(value) : fail ? fail(value) : "null";
3744
+ case "boolean":
3745
+ return value === true ? "true" : "false";
3746
+ case "undefined":
3747
+ return;
3748
+ case "bigint":
3749
+ if (bigint) {
3750
+ return String(value);
3751
+ }
3752
+ default:
3753
+ return fail ? fail(value) : undefined;
3754
+ }
3755
+ }
3756
+ function stringifySimple(key, value, stack) {
3757
+ switch (typeof value) {
3758
+ case "string":
3759
+ return strEscape(value);
3760
+ case "object": {
3761
+ if (value === null) {
3762
+ return "null";
3763
+ }
3764
+ if (typeof value.toJSON === "function") {
3765
+ value = value.toJSON(key);
3766
+ if (typeof value !== "object") {
3767
+ return stringifySimple(key, value, stack);
3768
+ }
3769
+ if (value === null) {
3770
+ return "null";
3771
+ }
3772
+ }
3773
+ if (stack.indexOf(value) !== -1) {
3774
+ return circularValue;
3775
+ }
3776
+ let res = "";
3777
+ const hasLength = value.length !== undefined;
3778
+ if (hasLength && Array.isArray(value)) {
3779
+ if (value.length === 0) {
3780
+ return "[]";
3781
+ }
3782
+ if (maximumDepth < stack.length + 1) {
3783
+ return '"[Array]"';
3784
+ }
3785
+ stack.push(value);
3786
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
3787
+ let i = 0;
3788
+ for (;i < maximumValuesToStringify - 1; i++) {
3789
+ const tmp2 = stringifySimple(String(i), value[i], stack);
3790
+ res += tmp2 !== undefined ? tmp2 : "null";
3791
+ res += ",";
3792
+ }
3793
+ const tmp = stringifySimple(String(i), value[i], stack);
3794
+ res += tmp !== undefined ? tmp : "null";
3795
+ if (value.length - 1 > maximumBreadth) {
3796
+ const removedKeys = value.length - maximumBreadth - 1;
3797
+ res += `,"... ${getItemCount(removedKeys)} not stringified"`;
3798
+ }
3799
+ stack.pop();
3800
+ return `[${res}]`;
3801
+ }
3802
+ let keys = Object.keys(value);
3803
+ const keyLength = keys.length;
3804
+ if (keyLength === 0) {
3805
+ return "{}";
3806
+ }
3807
+ if (maximumDepth < stack.length + 1) {
3808
+ return '"[Object]"';
3809
+ }
3810
+ let separator = "";
3811
+ let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
3812
+ if (hasLength && isTypedArrayWithEntries(value)) {
3813
+ res += stringifyTypedArray(value, ",", maximumBreadth);
3814
+ keys = keys.slice(value.length);
3815
+ maximumPropertiesToStringify -= value.length;
3816
+ separator = ",";
3817
+ }
3818
+ if (deterministic) {
3819
+ keys = sort(keys, comparator);
3820
+ }
3821
+ stack.push(value);
3822
+ for (let i = 0;i < maximumPropertiesToStringify; i++) {
3823
+ const key2 = keys[i];
3824
+ const tmp = stringifySimple(key2, value[key2], stack);
3825
+ if (tmp !== undefined) {
3826
+ res += `${separator}${strEscape(key2)}:${tmp}`;
3827
+ separator = ",";
3828
+ }
3829
+ }
3830
+ if (keyLength > maximumBreadth) {
3831
+ const removedKeys = keyLength - maximumBreadth;
3832
+ res += `${separator}"...":"${getItemCount(removedKeys)} not stringified"`;
3833
+ }
3834
+ stack.pop();
3835
+ return `{${res}}`;
3836
+ }
3837
+ case "number":
3838
+ return isFinite(value) ? String(value) : fail ? fail(value) : "null";
3839
+ case "boolean":
3840
+ return value === true ? "true" : "false";
3841
+ case "undefined":
3842
+ return;
3843
+ case "bigint":
3844
+ if (bigint) {
3845
+ return String(value);
3846
+ }
3847
+ default:
3848
+ return fail ? fail(value) : undefined;
3849
+ }
3850
+ }
3851
+ function stringify2(value, replacer, space) {
3852
+ if (arguments.length > 1) {
3853
+ let spacer = "";
3854
+ if (typeof space === "number") {
3855
+ spacer = " ".repeat(Math.min(space, 10));
3856
+ } else if (typeof space === "string") {
3857
+ spacer = space.slice(0, 10);
3858
+ }
3859
+ if (replacer != null) {
3860
+ if (typeof replacer === "function") {
3861
+ return stringifyFnReplacer("", { "": value }, [], replacer, spacer, "");
3862
+ }
3863
+ if (Array.isArray(replacer)) {
3864
+ return stringifyArrayReplacer("", value, [], getUniqueReplacerSet(replacer), spacer, "");
3865
+ }
3866
+ }
3867
+ if (spacer.length !== 0) {
3868
+ return stringifyIndent("", value, [], spacer, "");
3869
+ }
3870
+ }
3871
+ return stringifySimple("", value, []);
3872
+ }
3873
+ return stringify2;
3874
+ }
3875
+ });
3876
+
3877
+ // node_modules/pino/lib/multistream.js
3878
+ var require_multistream = __commonJS((exports, module) => {
3879
+ var metadata = Symbol.for("pino.metadata");
3880
+ var { DEFAULT_LEVELS } = require_constants();
3881
+ var DEFAULT_INFO_LEVEL = DEFAULT_LEVELS.info;
3882
+ function multistream(streamsArray, opts) {
3883
+ let counter = 0;
3884
+ streamsArray = streamsArray || [];
3885
+ opts = opts || { dedupe: false };
3886
+ const streamLevels = Object.create(DEFAULT_LEVELS);
3887
+ streamLevels.silent = Infinity;
3888
+ if (opts.levels && typeof opts.levels === "object") {
3889
+ Object.keys(opts.levels).forEach((i) => {
3890
+ streamLevels[i] = opts.levels[i];
3891
+ });
3892
+ }
3893
+ const res = {
3894
+ write,
3895
+ add,
3896
+ emit,
3897
+ flushSync,
3898
+ end,
3899
+ minLevel: 0,
3900
+ streams: [],
3901
+ clone,
3902
+ [metadata]: true,
3903
+ streamLevels
3904
+ };
3905
+ if (Array.isArray(streamsArray)) {
3906
+ streamsArray.forEach(add, res);
3907
+ } else {
3908
+ add.call(res, streamsArray);
3909
+ }
3910
+ streamsArray = null;
3911
+ return res;
3912
+ function write(data) {
3913
+ let dest;
3914
+ const level = this.lastLevel;
3915
+ const { streams } = this;
3916
+ let recordedLevel = 0;
3917
+ let stream;
3918
+ for (let i = initLoopVar(streams.length, opts.dedupe);checkLoopVar(i, streams.length, opts.dedupe); i = adjustLoopVar(i, opts.dedupe)) {
3919
+ dest = streams[i];
3920
+ if (dest.level <= level) {
3921
+ if (recordedLevel !== 0 && recordedLevel !== dest.level) {
3922
+ break;
3923
+ }
3924
+ stream = dest.stream;
3925
+ if (stream[metadata]) {
3926
+ const { lastTime, lastMsg, lastObj, lastLogger } = this;
3927
+ stream.lastLevel = level;
3928
+ stream.lastTime = lastTime;
3929
+ stream.lastMsg = lastMsg;
3930
+ stream.lastObj = lastObj;
3931
+ stream.lastLogger = lastLogger;
3932
+ }
3933
+ stream.write(data);
3934
+ if (opts.dedupe) {
3935
+ recordedLevel = dest.level;
3936
+ }
3937
+ } else if (!opts.dedupe) {
3938
+ break;
3939
+ }
3940
+ }
3941
+ }
3942
+ function emit(...args) {
3943
+ for (const { stream } of this.streams) {
3944
+ if (typeof stream.emit === "function") {
3945
+ stream.emit(...args);
3946
+ }
3947
+ }
3948
+ }
3949
+ function flushSync() {
3950
+ for (const { stream } of this.streams) {
3951
+ if (typeof stream.flushSync === "function") {
3952
+ stream.flushSync();
3953
+ }
3954
+ }
3955
+ }
3956
+ function add(dest) {
3957
+ if (!dest) {
3958
+ return res;
3959
+ }
3960
+ const isStream = typeof dest.write === "function" || dest.stream;
3961
+ const stream_ = dest.write ? dest : dest.stream;
3962
+ if (!isStream) {
3963
+ throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");
3964
+ }
3965
+ const { streams, streamLevels: streamLevels2 } = this;
3966
+ let level;
3967
+ if (typeof dest.levelVal === "number") {
3968
+ level = dest.levelVal;
3969
+ } else if (typeof dest.level === "string") {
3970
+ level = streamLevels2[dest.level];
3971
+ } else if (typeof dest.level === "number") {
3972
+ level = dest.level;
3973
+ } else {
3974
+ level = DEFAULT_INFO_LEVEL;
3975
+ }
3976
+ const dest_ = {
3977
+ stream: stream_,
3978
+ level,
3979
+ levelVal: undefined,
3980
+ id: counter++
3981
+ };
3982
+ streams.unshift(dest_);
3983
+ streams.sort(compareByLevel);
3984
+ this.minLevel = streams[0].level;
3985
+ return res;
3986
+ }
3987
+ function end() {
3988
+ for (const { stream } of this.streams) {
3989
+ if (typeof stream.flushSync === "function") {
3990
+ stream.flushSync();
3991
+ }
3992
+ stream.end();
3993
+ }
3994
+ }
3995
+ function clone(level) {
3996
+ const streams = new Array(this.streams.length);
3997
+ for (let i = 0;i < streams.length; i++) {
3998
+ streams[i] = {
3999
+ level,
4000
+ stream: this.streams[i].stream
4001
+ };
4002
+ }
4003
+ return {
4004
+ write,
4005
+ add,
4006
+ minLevel: level,
4007
+ streams,
4008
+ clone,
4009
+ emit,
4010
+ flushSync,
4011
+ [metadata]: true
4012
+ };
4013
+ }
4014
+ }
4015
+ function compareByLevel(a, b) {
4016
+ return a.level - b.level;
4017
+ }
4018
+ function initLoopVar(length, dedupe) {
4019
+ return dedupe ? length - 1 : 0;
4020
+ }
4021
+ function adjustLoopVar(i, dedupe) {
4022
+ return dedupe ? i - 1 : i + 1;
4023
+ }
4024
+ function checkLoopVar(i, length, dedupe) {
4025
+ return dedupe ? i >= 0 : i < length;
4026
+ }
4027
+ module.exports = multistream;
4028
+ });
4029
+
4030
+ // node_modules/pino/pino.js
4031
+ var require_pino = __commonJS((exports, module) => {
4032
+ var os = __require("os");
4033
+ var stdSerializers = require_pino_std_serializers();
4034
+ var caller = require_caller();
4035
+ var redaction = require_redaction();
4036
+ var time = require_time();
4037
+ var proto = require_proto();
4038
+ var symbols = require_symbols();
4039
+ var { configure } = require_safe_stable_stringify();
4040
+ var { assertDefaultLevelFound, mappings, genLsCache, genLevelComparison, assertLevelComparison } = require_levels();
4041
+ var { DEFAULT_LEVELS, SORTING_ORDER } = require_constants();
4042
+ var {
4043
+ createArgsNormalizer,
4044
+ asChindings,
4045
+ buildSafeSonicBoom,
4046
+ buildFormatters,
4047
+ stringify,
4048
+ normalizeDestFileDescriptor,
4049
+ noop
4050
+ } = require_tools();
4051
+ var { version } = require_meta();
4052
+ var {
4053
+ chindingsSym,
4054
+ redactFmtSym,
4055
+ serializersSym,
4056
+ timeSym,
4057
+ timeSliceIndexSym,
4058
+ streamSym,
4059
+ stringifySym,
4060
+ stringifySafeSym,
4061
+ stringifiersSym,
4062
+ setLevelSym,
4063
+ endSym,
4064
+ formatOptsSym,
4065
+ messageKeySym,
4066
+ errorKeySym,
4067
+ nestedKeySym,
4068
+ mixinSym,
4069
+ levelCompSym,
4070
+ useOnlyCustomLevelsSym,
4071
+ formattersSym,
4072
+ hooksSym,
4073
+ nestedKeyStrSym,
4074
+ mixinMergeStrategySym,
4075
+ msgPrefixSym
4076
+ } = symbols;
4077
+ var { epochTime, nullTime } = time;
4078
+ var { pid } = process;
4079
+ var hostname = os.hostname();
4080
+ var defaultErrorSerializer = stdSerializers.err;
4081
+ var defaultOptions = {
4082
+ level: "info",
4083
+ levelComparison: SORTING_ORDER.ASC,
4084
+ levels: DEFAULT_LEVELS,
4085
+ messageKey: "msg",
4086
+ errorKey: "err",
4087
+ nestedKey: null,
4088
+ enabled: true,
4089
+ base: { pid, hostname },
4090
+ serializers: Object.assign(Object.create(null), {
4091
+ err: defaultErrorSerializer
4092
+ }),
4093
+ formatters: Object.assign(Object.create(null), {
4094
+ bindings(bindings) {
4095
+ return bindings;
4096
+ },
4097
+ level(label, number) {
4098
+ return { level: number };
4099
+ }
4100
+ }),
4101
+ hooks: {
4102
+ logMethod: undefined,
4103
+ streamWrite: undefined
4104
+ },
4105
+ timestamp: epochTime,
4106
+ name: undefined,
4107
+ redact: null,
4108
+ customLevels: null,
4109
+ useOnlyCustomLevels: false,
4110
+ depthLimit: 5,
4111
+ edgeLimit: 100
4112
+ };
4113
+ var normalize = createArgsNormalizer(defaultOptions);
4114
+ var serializers = Object.assign(Object.create(null), stdSerializers);
4115
+ function pino(...args) {
4116
+ const instance = {};
4117
+ const { opts, stream } = normalize(instance, caller(), ...args);
4118
+ if (opts.level && typeof opts.level === "string" && DEFAULT_LEVELS[opts.level.toLowerCase()] !== undefined)
4119
+ opts.level = opts.level.toLowerCase();
4120
+ const {
4121
+ redact,
4122
+ crlf,
4123
+ serializers: serializers2,
4124
+ timestamp,
4125
+ messageKey,
4126
+ errorKey,
4127
+ nestedKey,
4128
+ base,
4129
+ name,
4130
+ level,
4131
+ customLevels,
4132
+ levelComparison,
4133
+ mixin,
4134
+ mixinMergeStrategy,
4135
+ useOnlyCustomLevels,
4136
+ formatters,
4137
+ hooks,
4138
+ depthLimit,
4139
+ edgeLimit,
4140
+ onChild,
4141
+ msgPrefix
4142
+ } = opts;
4143
+ const stringifySafe = configure({
4144
+ maximumDepth: depthLimit,
4145
+ maximumBreadth: edgeLimit
4146
+ });
4147
+ const allFormatters = buildFormatters(formatters.level, formatters.bindings, formatters.log);
4148
+ const stringifyFn = stringify.bind({
4149
+ [stringifySafeSym]: stringifySafe
4150
+ });
4151
+ const stringifiers = redact ? redaction(redact, stringifyFn) : {};
4152
+ const formatOpts = redact ? { stringify: stringifiers[redactFmtSym] } : { stringify: stringifyFn };
4153
+ const end = "}" + (crlf ? `\r
4154
+ ` : `
4155
+ `);
4156
+ const coreChindings = asChindings.bind(null, {
4157
+ [chindingsSym]: "",
4158
+ [serializersSym]: serializers2,
4159
+ [stringifiersSym]: stringifiers,
4160
+ [stringifySym]: stringify,
4161
+ [stringifySafeSym]: stringifySafe,
4162
+ [formattersSym]: allFormatters
4163
+ });
4164
+ let chindings = "";
4165
+ if (base !== null) {
4166
+ if (name === undefined) {
4167
+ chindings = coreChindings(base);
4168
+ } else {
4169
+ chindings = coreChindings(Object.assign({}, base, { name }));
4170
+ }
4171
+ }
4172
+ const time2 = timestamp instanceof Function ? timestamp : timestamp ? epochTime : nullTime;
4173
+ const timeSliceIndex = time2().indexOf(":") + 1;
4174
+ if (useOnlyCustomLevels && !customLevels)
4175
+ throw Error("customLevels is required if useOnlyCustomLevels is set true");
4176
+ if (mixin && typeof mixin !== "function")
4177
+ throw Error(`Unknown mixin type "${typeof mixin}" - expected "function"`);
4178
+ if (msgPrefix && typeof msgPrefix !== "string")
4179
+ throw Error(`Unknown msgPrefix type "${typeof msgPrefix}" - expected "string"`);
4180
+ assertDefaultLevelFound(level, customLevels, useOnlyCustomLevels);
4181
+ const levels = mappings(customLevels, useOnlyCustomLevels);
4182
+ if (typeof stream.emit === "function") {
4183
+ stream.emit("message", { code: "PINO_CONFIG", config: { levels, messageKey, errorKey } });
4184
+ }
4185
+ assertLevelComparison(levelComparison);
4186
+ const levelCompFunc = genLevelComparison(levelComparison);
4187
+ Object.assign(instance, {
4188
+ levels,
4189
+ [levelCompSym]: levelCompFunc,
4190
+ [useOnlyCustomLevelsSym]: useOnlyCustomLevels,
4191
+ [streamSym]: stream,
4192
+ [timeSym]: time2,
4193
+ [timeSliceIndexSym]: timeSliceIndex,
4194
+ [stringifySym]: stringify,
4195
+ [stringifySafeSym]: stringifySafe,
4196
+ [stringifiersSym]: stringifiers,
4197
+ [endSym]: end,
4198
+ [formatOptsSym]: formatOpts,
4199
+ [messageKeySym]: messageKey,
4200
+ [errorKeySym]: errorKey,
4201
+ [nestedKeySym]: nestedKey,
4202
+ [nestedKeyStrSym]: nestedKey ? `,${JSON.stringify(nestedKey)}:{` : "",
4203
+ [serializersSym]: serializers2,
4204
+ [mixinSym]: mixin,
4205
+ [mixinMergeStrategySym]: mixinMergeStrategy,
4206
+ [chindingsSym]: chindings,
4207
+ [formattersSym]: allFormatters,
4208
+ [hooksSym]: hooks,
4209
+ silent: noop,
4210
+ onChild,
4211
+ [msgPrefixSym]: msgPrefix
4212
+ });
4213
+ Object.setPrototypeOf(instance, proto());
4214
+ genLsCache(instance);
4215
+ instance[setLevelSym](level);
4216
+ return instance;
4217
+ }
4218
+ module.exports = pino;
4219
+ module.exports.destination = (dest = process.stdout.fd) => {
4220
+ if (typeof dest === "object") {
4221
+ dest.dest = normalizeDestFileDescriptor(dest.dest || process.stdout.fd);
4222
+ return buildSafeSonicBoom(dest);
4223
+ } else {
4224
+ return buildSafeSonicBoom({ dest: normalizeDestFileDescriptor(dest), minLength: 0 });
4225
+ }
4226
+ };
4227
+ module.exports.transport = require_transport();
4228
+ module.exports.multistream = require_multistream();
4229
+ module.exports.levels = mappings();
4230
+ module.exports.stdSerializers = serializers;
4231
+ module.exports.stdTimeFunctions = Object.assign({}, time);
4232
+ module.exports.symbols = symbols;
4233
+ module.exports.version = version;
4234
+ module.exports.default = pino;
4235
+ module.exports.pino = pino;
4236
+ });
4237
+
4238
+ // node_modules/pino/file.js
4239
+ var require_file = __commonJS((exports, module) => {
4240
+ var pino = require_pino();
4241
+ var { once } = __require("events");
4242
+ module.exports = async function(opts = {}) {
4243
+ const destOpts = Object.assign({}, opts, { dest: opts.destination || 1, sync: false });
4244
+ delete destOpts.destination;
4245
+ const destination = pino.destination(destOpts);
4246
+ await once(destination, "ready");
4247
+ return destination;
4248
+ };
4249
+ });
4250
+ export default require_file();