@trading-boy/cli 1.2.6 → 1.2.8

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.
@@ -1,6 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __bundleCreateRequire } from "node:module";
3
+ import { fileURLToPath as __bundleFileURLToPath } from "node:url";
4
+ import { dirname as __bundleDirname } from "node:path";
3
5
  const require = __bundleCreateRequire(import.meta.url);
6
+ const __bundled_filename = __bundleFileURLToPath(import.meta.url);
7
+ const __bundled_dirname = __bundleDirname(__bundled_filename);
4
8
  var __create = Object.create;
5
9
  var __defProp = Object.defineProperty;
6
10
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -4243,4388 +4247,6 @@ var require_main = __commonJS({
4243
4247
  }
4244
4248
  });
4245
4249
 
4246
- // ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-helpers.js
4247
- var require_err_helpers = __commonJS({
4248
- "../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-helpers.js"(exports, module) {
4249
- "use strict";
4250
- var isErrorLike = (err) => {
4251
- return err && typeof err.message === "string";
4252
- };
4253
- var getErrorCause = (err) => {
4254
- if (!err) return;
4255
- const cause = err.cause;
4256
- if (typeof cause === "function") {
4257
- const causeResult = err.cause();
4258
- return isErrorLike(causeResult) ? causeResult : void 0;
4259
- } else {
4260
- return isErrorLike(cause) ? cause : void 0;
4261
- }
4262
- };
4263
- var _stackWithCauses = (err, seen) => {
4264
- if (!isErrorLike(err)) return "";
4265
- const stack = err.stack || "";
4266
- if (seen.has(err)) {
4267
- return stack + "\ncauses have become circular...";
4268
- }
4269
- const cause = getErrorCause(err);
4270
- if (cause) {
4271
- seen.add(err);
4272
- return stack + "\ncaused by: " + _stackWithCauses(cause, seen);
4273
- } else {
4274
- return stack;
4275
- }
4276
- };
4277
- var stackWithCauses = (err) => _stackWithCauses(err, /* @__PURE__ */ new Set());
4278
- var _messageWithCauses = (err, seen, skip) => {
4279
- if (!isErrorLike(err)) return "";
4280
- const message = skip ? "" : err.message || "";
4281
- if (seen.has(err)) {
4282
- return message + ": ...";
4283
- }
4284
- const cause = getErrorCause(err);
4285
- if (cause) {
4286
- seen.add(err);
4287
- const skipIfVErrorStyleCause = typeof err.cause === "function";
4288
- return message + (skipIfVErrorStyleCause ? "" : ": ") + _messageWithCauses(cause, seen, skipIfVErrorStyleCause);
4289
- } else {
4290
- return message;
4291
- }
4292
- };
4293
- var messageWithCauses = (err) => _messageWithCauses(err, /* @__PURE__ */ new Set());
4294
- module.exports = {
4295
- isErrorLike,
4296
- getErrorCause,
4297
- stackWithCauses,
4298
- messageWithCauses
4299
- };
4300
- }
4301
- });
4302
-
4303
- // ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-proto.js
4304
- var require_err_proto = __commonJS({
4305
- "../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-proto.js"(exports, module) {
4306
- "use strict";
4307
- var seen = /* @__PURE__ */ Symbol("circular-ref-tag");
4308
- var rawSymbol = /* @__PURE__ */ Symbol("pino-raw-err-ref");
4309
- var pinoErrProto = Object.create({}, {
4310
- type: {
4311
- enumerable: true,
4312
- writable: true,
4313
- value: void 0
4314
- },
4315
- message: {
4316
- enumerable: true,
4317
- writable: true,
4318
- value: void 0
4319
- },
4320
- stack: {
4321
- enumerable: true,
4322
- writable: true,
4323
- value: void 0
4324
- },
4325
- aggregateErrors: {
4326
- enumerable: true,
4327
- writable: true,
4328
- value: void 0
4329
- },
4330
- raw: {
4331
- enumerable: false,
4332
- get: function() {
4333
- return this[rawSymbol];
4334
- },
4335
- set: function(val) {
4336
- this[rawSymbol] = val;
4337
- }
4338
- }
4339
- });
4340
- Object.defineProperty(pinoErrProto, rawSymbol, {
4341
- writable: true,
4342
- value: {}
4343
- });
4344
- module.exports = {
4345
- pinoErrProto,
4346
- pinoErrorSymbols: {
4347
- seen,
4348
- rawSymbol
4349
- }
4350
- };
4351
- }
4352
- });
4353
-
4354
- // ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err.js
4355
- var require_err = __commonJS({
4356
- "../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err.js"(exports, module) {
4357
- "use strict";
4358
- module.exports = errSerializer;
4359
- var { messageWithCauses, stackWithCauses, isErrorLike } = require_err_helpers();
4360
- var { pinoErrProto, pinoErrorSymbols } = require_err_proto();
4361
- var { seen } = pinoErrorSymbols;
4362
- var { toString } = Object.prototype;
4363
- function errSerializer(err) {
4364
- if (!isErrorLike(err)) {
4365
- return err;
4366
- }
4367
- err[seen] = void 0;
4368
- const _err = Object.create(pinoErrProto);
4369
- _err.type = toString.call(err.constructor) === "[object Function]" ? err.constructor.name : err.name;
4370
- _err.message = messageWithCauses(err);
4371
- _err.stack = stackWithCauses(err);
4372
- if (Array.isArray(err.errors)) {
4373
- _err.aggregateErrors = err.errors.map((err2) => errSerializer(err2));
4374
- }
4375
- for (const key in err) {
4376
- if (_err[key] === void 0) {
4377
- const val = err[key];
4378
- if (isErrorLike(val)) {
4379
- if (key !== "cause" && !Object.prototype.hasOwnProperty.call(val, seen)) {
4380
- _err[key] = errSerializer(val);
4381
- }
4382
- } else {
4383
- _err[key] = val;
4384
- }
4385
- }
4386
- }
4387
- delete err[seen];
4388
- _err.raw = err;
4389
- return _err;
4390
- }
4391
- }
4392
- });
4393
-
4394
- // ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-with-cause.js
4395
- var require_err_with_cause = __commonJS({
4396
- "../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-with-cause.js"(exports, module) {
4397
- "use strict";
4398
- module.exports = errWithCauseSerializer;
4399
- var { isErrorLike } = require_err_helpers();
4400
- var { pinoErrProto, pinoErrorSymbols } = require_err_proto();
4401
- var { seen } = pinoErrorSymbols;
4402
- var { toString } = Object.prototype;
4403
- function errWithCauseSerializer(err) {
4404
- if (!isErrorLike(err)) {
4405
- return err;
4406
- }
4407
- err[seen] = void 0;
4408
- const _err = Object.create(pinoErrProto);
4409
- _err.type = toString.call(err.constructor) === "[object Function]" ? err.constructor.name : err.name;
4410
- _err.message = err.message;
4411
- _err.stack = err.stack;
4412
- if (Array.isArray(err.errors)) {
4413
- _err.aggregateErrors = err.errors.map((err2) => errWithCauseSerializer(err2));
4414
- }
4415
- if (isErrorLike(err.cause) && !Object.prototype.hasOwnProperty.call(err.cause, seen)) {
4416
- _err.cause = errWithCauseSerializer(err.cause);
4417
- }
4418
- for (const key in err) {
4419
- if (_err[key] === void 0) {
4420
- const val = err[key];
4421
- if (isErrorLike(val)) {
4422
- if (!Object.prototype.hasOwnProperty.call(val, seen)) {
4423
- _err[key] = errWithCauseSerializer(val);
4424
- }
4425
- } else {
4426
- _err[key] = val;
4427
- }
4428
- }
4429
- }
4430
- delete err[seen];
4431
- _err.raw = err;
4432
- return _err;
4433
- }
4434
- }
4435
- });
4436
-
4437
- // ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/req.js
4438
- var require_req = __commonJS({
4439
- "../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/req.js"(exports, module) {
4440
- "use strict";
4441
- module.exports = {
4442
- mapHttpRequest,
4443
- reqSerializer
4444
- };
4445
- var rawSymbol = /* @__PURE__ */ Symbol("pino-raw-req-ref");
4446
- var pinoReqProto = Object.create({}, {
4447
- id: {
4448
- enumerable: true,
4449
- writable: true,
4450
- value: ""
4451
- },
4452
- method: {
4453
- enumerable: true,
4454
- writable: true,
4455
- value: ""
4456
- },
4457
- url: {
4458
- enumerable: true,
4459
- writable: true,
4460
- value: ""
4461
- },
4462
- query: {
4463
- enumerable: true,
4464
- writable: true,
4465
- value: ""
4466
- },
4467
- params: {
4468
- enumerable: true,
4469
- writable: true,
4470
- value: ""
4471
- },
4472
- headers: {
4473
- enumerable: true,
4474
- writable: true,
4475
- value: {}
4476
- },
4477
- remoteAddress: {
4478
- enumerable: true,
4479
- writable: true,
4480
- value: ""
4481
- },
4482
- remotePort: {
4483
- enumerable: true,
4484
- writable: true,
4485
- value: ""
4486
- },
4487
- raw: {
4488
- enumerable: false,
4489
- get: function() {
4490
- return this[rawSymbol];
4491
- },
4492
- set: function(val) {
4493
- this[rawSymbol] = val;
4494
- }
4495
- }
4496
- });
4497
- Object.defineProperty(pinoReqProto, rawSymbol, {
4498
- writable: true,
4499
- value: {}
4500
- });
4501
- function reqSerializer(req) {
4502
- const connection = req.info || req.socket;
4503
- const _req = Object.create(pinoReqProto);
4504
- _req.id = typeof req.id === "function" ? req.id() : req.id || (req.info ? req.info.id : void 0);
4505
- _req.method = req.method;
4506
- if (req.originalUrl) {
4507
- _req.url = req.originalUrl;
4508
- } else {
4509
- const path4 = req.path;
4510
- _req.url = typeof path4 === "string" ? path4 : req.url ? req.url.path || req.url : void 0;
4511
- }
4512
- if (req.query) {
4513
- _req.query = req.query;
4514
- }
4515
- if (req.params) {
4516
- _req.params = req.params;
4517
- }
4518
- _req.headers = req.headers;
4519
- _req.remoteAddress = connection && connection.remoteAddress;
4520
- _req.remotePort = connection && connection.remotePort;
4521
- _req.raw = req.raw || req;
4522
- return _req;
4523
- }
4524
- function mapHttpRequest(req) {
4525
- return {
4526
- req: reqSerializer(req)
4527
- };
4528
- }
4529
- }
4530
- });
4531
-
4532
- // ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/res.js
4533
- var require_res = __commonJS({
4534
- "../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/res.js"(exports, module) {
4535
- "use strict";
4536
- module.exports = {
4537
- mapHttpResponse,
4538
- resSerializer
4539
- };
4540
- var rawSymbol = /* @__PURE__ */ Symbol("pino-raw-res-ref");
4541
- var pinoResProto = Object.create({}, {
4542
- statusCode: {
4543
- enumerable: true,
4544
- writable: true,
4545
- value: 0
4546
- },
4547
- headers: {
4548
- enumerable: true,
4549
- writable: true,
4550
- value: ""
4551
- },
4552
- raw: {
4553
- enumerable: false,
4554
- get: function() {
4555
- return this[rawSymbol];
4556
- },
4557
- set: function(val) {
4558
- this[rawSymbol] = val;
4559
- }
4560
- }
4561
- });
4562
- Object.defineProperty(pinoResProto, rawSymbol, {
4563
- writable: true,
4564
- value: {}
4565
- });
4566
- function resSerializer(res) {
4567
- const _res = Object.create(pinoResProto);
4568
- _res.statusCode = res.headersSent ? res.statusCode : null;
4569
- _res.headers = res.getHeaders ? res.getHeaders() : res._headers;
4570
- _res.raw = res;
4571
- return _res;
4572
- }
4573
- function mapHttpResponse(res) {
4574
- return {
4575
- res: resSerializer(res)
4576
- };
4577
- }
4578
- }
4579
- });
4580
-
4581
- // ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/index.js
4582
- var require_pino_std_serializers = __commonJS({
4583
- "../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/index.js"(exports, module) {
4584
- "use strict";
4585
- var errSerializer = require_err();
4586
- var errWithCauseSerializer = require_err_with_cause();
4587
- var reqSerializers = require_req();
4588
- var resSerializers = require_res();
4589
- module.exports = {
4590
- err: errSerializer,
4591
- errWithCause: errWithCauseSerializer,
4592
- mapHttpRequest: reqSerializers.mapHttpRequest,
4593
- mapHttpResponse: resSerializers.mapHttpResponse,
4594
- req: reqSerializers.reqSerializer,
4595
- res: resSerializers.resSerializer,
4596
- wrapErrorSerializer: function wrapErrorSerializer(customSerializer) {
4597
- if (customSerializer === errSerializer) return customSerializer;
4598
- return function wrapErrSerializer(err) {
4599
- return customSerializer(errSerializer(err));
4600
- };
4601
- },
4602
- wrapRequestSerializer: function wrapRequestSerializer(customSerializer) {
4603
- if (customSerializer === reqSerializers.reqSerializer) return customSerializer;
4604
- return function wrappedReqSerializer(req) {
4605
- return customSerializer(reqSerializers.reqSerializer(req));
4606
- };
4607
- },
4608
- wrapResponseSerializer: function wrapResponseSerializer(customSerializer) {
4609
- if (customSerializer === resSerializers.resSerializer) return customSerializer;
4610
- return function wrappedResSerializer(res) {
4611
- return customSerializer(resSerializers.resSerializer(res));
4612
- };
4613
- }
4614
- };
4615
- }
4616
- });
4617
-
4618
- // ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/caller.js
4619
- var require_caller = __commonJS({
4620
- "../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/caller.js"(exports, module) {
4621
- "use strict";
4622
- function noOpPrepareStackTrace(_, stack) {
4623
- return stack;
4624
- }
4625
- module.exports = function getCallers() {
4626
- const originalPrepare = Error.prepareStackTrace;
4627
- Error.prepareStackTrace = noOpPrepareStackTrace;
4628
- const stack = new Error().stack;
4629
- Error.prepareStackTrace = originalPrepare;
4630
- if (!Array.isArray(stack)) {
4631
- return void 0;
4632
- }
4633
- const entries = stack.slice(2);
4634
- const fileNames = [];
4635
- for (const entry of entries) {
4636
- if (!entry) {
4637
- continue;
4638
- }
4639
- fileNames.push(entry.getFileName());
4640
- }
4641
- return fileNames;
4642
- };
4643
- }
4644
- });
4645
-
4646
- // ../../node_modules/.pnpm/@pinojs+redact@0.4.0/node_modules/@pinojs/redact/index.js
4647
- var require_redact = __commonJS({
4648
- "../../node_modules/.pnpm/@pinojs+redact@0.4.0/node_modules/@pinojs/redact/index.js"(exports, module) {
4649
- "use strict";
4650
- function deepClone(obj) {
4651
- if (obj === null || typeof obj !== "object") {
4652
- return obj;
4653
- }
4654
- if (obj instanceof Date) {
4655
- return new Date(obj.getTime());
4656
- }
4657
- if (obj instanceof Array) {
4658
- const cloned = [];
4659
- for (let i = 0; i < obj.length; i++) {
4660
- cloned[i] = deepClone(obj[i]);
4661
- }
4662
- return cloned;
4663
- }
4664
- if (typeof obj === "object") {
4665
- const cloned = Object.create(Object.getPrototypeOf(obj));
4666
- for (const key in obj) {
4667
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
4668
- cloned[key] = deepClone(obj[key]);
4669
- }
4670
- }
4671
- return cloned;
4672
- }
4673
- return obj;
4674
- }
4675
- function parsePath(path4) {
4676
- const parts = [];
4677
- let current = "";
4678
- let inBrackets = false;
4679
- let inQuotes = false;
4680
- let quoteChar = "";
4681
- for (let i = 0; i < path4.length; i++) {
4682
- const char = path4[i];
4683
- if (!inBrackets && char === ".") {
4684
- if (current) {
4685
- parts.push(current);
4686
- current = "";
4687
- }
4688
- } else if (char === "[") {
4689
- if (current) {
4690
- parts.push(current);
4691
- current = "";
4692
- }
4693
- inBrackets = true;
4694
- } else if (char === "]" && inBrackets) {
4695
- parts.push(current);
4696
- current = "";
4697
- inBrackets = false;
4698
- inQuotes = false;
4699
- } else if ((char === '"' || char === "'") && inBrackets) {
4700
- if (!inQuotes) {
4701
- inQuotes = true;
4702
- quoteChar = char;
4703
- } else if (char === quoteChar) {
4704
- inQuotes = false;
4705
- quoteChar = "";
4706
- } else {
4707
- current += char;
4708
- }
4709
- } else {
4710
- current += char;
4711
- }
4712
- }
4713
- if (current) {
4714
- parts.push(current);
4715
- }
4716
- return parts;
4717
- }
4718
- function setValue(obj, parts, value) {
4719
- let current = obj;
4720
- for (let i = 0; i < parts.length - 1; i++) {
4721
- const key = parts[i];
4722
- if (typeof current !== "object" || current === null || !(key in current)) {
4723
- return false;
4724
- }
4725
- if (typeof current[key] !== "object" || current[key] === null) {
4726
- return false;
4727
- }
4728
- current = current[key];
4729
- }
4730
- const lastKey = parts[parts.length - 1];
4731
- if (lastKey === "*") {
4732
- if (Array.isArray(current)) {
4733
- for (let i = 0; i < current.length; i++) {
4734
- current[i] = value;
4735
- }
4736
- } else if (typeof current === "object" && current !== null) {
4737
- for (const key in current) {
4738
- if (Object.prototype.hasOwnProperty.call(current, key)) {
4739
- current[key] = value;
4740
- }
4741
- }
4742
- }
4743
- } else {
4744
- if (typeof current === "object" && current !== null && lastKey in current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
4745
- current[lastKey] = value;
4746
- }
4747
- }
4748
- return true;
4749
- }
4750
- function removeKey(obj, parts) {
4751
- let current = obj;
4752
- for (let i = 0; i < parts.length - 1; i++) {
4753
- const key = parts[i];
4754
- if (typeof current !== "object" || current === null || !(key in current)) {
4755
- return false;
4756
- }
4757
- if (typeof current[key] !== "object" || current[key] === null) {
4758
- return false;
4759
- }
4760
- current = current[key];
4761
- }
4762
- const lastKey = parts[parts.length - 1];
4763
- if (lastKey === "*") {
4764
- if (Array.isArray(current)) {
4765
- for (let i = 0; i < current.length; i++) {
4766
- current[i] = void 0;
4767
- }
4768
- } else if (typeof current === "object" && current !== null) {
4769
- for (const key in current) {
4770
- if (Object.prototype.hasOwnProperty.call(current, key)) {
4771
- delete current[key];
4772
- }
4773
- }
4774
- }
4775
- } else {
4776
- if (typeof current === "object" && current !== null && lastKey in current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
4777
- delete current[lastKey];
4778
- }
4779
- }
4780
- return true;
4781
- }
4782
- var PATH_NOT_FOUND = /* @__PURE__ */ Symbol("PATH_NOT_FOUND");
4783
- function getValueIfExists(obj, parts) {
4784
- let current = obj;
4785
- for (const part of parts) {
4786
- if (current === null || current === void 0) {
4787
- return PATH_NOT_FOUND;
4788
- }
4789
- if (typeof current !== "object" || current === null) {
4790
- return PATH_NOT_FOUND;
4791
- }
4792
- if (!(part in current)) {
4793
- return PATH_NOT_FOUND;
4794
- }
4795
- current = current[part];
4796
- }
4797
- return current;
4798
- }
4799
- function getValue(obj, parts) {
4800
- let current = obj;
4801
- for (const part of parts) {
4802
- if (current === null || current === void 0) {
4803
- return void 0;
4804
- }
4805
- if (typeof current !== "object" || current === null) {
4806
- return void 0;
4807
- }
4808
- current = current[part];
4809
- }
4810
- return current;
4811
- }
4812
- function redactPaths(obj, paths, censor, remove = false) {
4813
- for (const path4 of paths) {
4814
- const parts = parsePath(path4);
4815
- if (parts.includes("*")) {
4816
- redactWildcardPath(obj, parts, censor, path4, remove);
4817
- } else {
4818
- if (remove) {
4819
- removeKey(obj, parts);
4820
- } else {
4821
- const value = getValueIfExists(obj, parts);
4822
- if (value === PATH_NOT_FOUND) {
4823
- continue;
4824
- }
4825
- const actualCensor = typeof censor === "function" ? censor(value, parts) : censor;
4826
- setValue(obj, parts, actualCensor);
4827
- }
4828
- }
4829
- }
4830
- }
4831
- function redactWildcardPath(obj, parts, censor, originalPath, remove = false) {
4832
- const wildcardIndex = parts.indexOf("*");
4833
- if (wildcardIndex === parts.length - 1) {
4834
- const parentParts = parts.slice(0, -1);
4835
- let current = obj;
4836
- for (const part of parentParts) {
4837
- if (current === null || current === void 0) return;
4838
- if (typeof current !== "object" || current === null) return;
4839
- current = current[part];
4840
- }
4841
- if (Array.isArray(current)) {
4842
- if (remove) {
4843
- for (let i = 0; i < current.length; i++) {
4844
- current[i] = void 0;
4845
- }
4846
- } else {
4847
- for (let i = 0; i < current.length; i++) {
4848
- const indexPath = [...parentParts, i.toString()];
4849
- const actualCensor = typeof censor === "function" ? censor(current[i], indexPath) : censor;
4850
- current[i] = actualCensor;
4851
- }
4852
- }
4853
- } else if (typeof current === "object" && current !== null) {
4854
- if (remove) {
4855
- const keysToDelete = [];
4856
- for (const key in current) {
4857
- if (Object.prototype.hasOwnProperty.call(current, key)) {
4858
- keysToDelete.push(key);
4859
- }
4860
- }
4861
- for (const key of keysToDelete) {
4862
- delete current[key];
4863
- }
4864
- } else {
4865
- for (const key in current) {
4866
- const keyPath = [...parentParts, key];
4867
- const actualCensor = typeof censor === "function" ? censor(current[key], keyPath) : censor;
4868
- current[key] = actualCensor;
4869
- }
4870
- }
4871
- }
4872
- } else {
4873
- redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove);
4874
- }
4875
- }
4876
- function redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove = false) {
4877
- const beforeWildcard = parts.slice(0, wildcardIndex);
4878
- const afterWildcard = parts.slice(wildcardIndex + 1);
4879
- const pathArray = [];
4880
- function traverse(current, pathLength) {
4881
- if (pathLength === beforeWildcard.length) {
4882
- if (Array.isArray(current)) {
4883
- for (let i = 0; i < current.length; i++) {
4884
- pathArray[pathLength] = i.toString();
4885
- traverse(current[i], pathLength + 1);
4886
- }
4887
- } else if (typeof current === "object" && current !== null) {
4888
- for (const key in current) {
4889
- pathArray[pathLength] = key;
4890
- traverse(current[key], pathLength + 1);
4891
- }
4892
- }
4893
- } else if (pathLength < beforeWildcard.length) {
4894
- const nextKey = beforeWildcard[pathLength];
4895
- if (current && typeof current === "object" && current !== null && nextKey in current) {
4896
- pathArray[pathLength] = nextKey;
4897
- traverse(current[nextKey], pathLength + 1);
4898
- }
4899
- } else {
4900
- if (afterWildcard.includes("*")) {
4901
- const wrappedCensor = typeof censor === "function" ? (value, path4) => {
4902
- const fullPath = [...pathArray.slice(0, pathLength), ...path4];
4903
- return censor(value, fullPath);
4904
- } : censor;
4905
- redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
4906
- } else {
4907
- if (remove) {
4908
- removeKey(current, afterWildcard);
4909
- } else {
4910
- const actualCensor = typeof censor === "function" ? censor(getValue(current, afterWildcard), [...pathArray.slice(0, pathLength), ...afterWildcard]) : censor;
4911
- setValue(current, afterWildcard, actualCensor);
4912
- }
4913
- }
4914
- }
4915
- }
4916
- if (beforeWildcard.length === 0) {
4917
- traverse(obj, 0);
4918
- } else {
4919
- let current = obj;
4920
- for (let i = 0; i < beforeWildcard.length; i++) {
4921
- const part = beforeWildcard[i];
4922
- if (current === null || current === void 0) return;
4923
- if (typeof current !== "object" || current === null) return;
4924
- current = current[part];
4925
- pathArray[i] = part;
4926
- }
4927
- if (current !== null && current !== void 0) {
4928
- traverse(current, beforeWildcard.length);
4929
- }
4930
- }
4931
- }
4932
- function buildPathStructure(pathsToClone) {
4933
- if (pathsToClone.length === 0) {
4934
- return null;
4935
- }
4936
- const pathStructure = /* @__PURE__ */ new Map();
4937
- for (const path4 of pathsToClone) {
4938
- const parts = parsePath(path4);
4939
- let current = pathStructure;
4940
- for (let i = 0; i < parts.length; i++) {
4941
- const part = parts[i];
4942
- if (!current.has(part)) {
4943
- current.set(part, /* @__PURE__ */ new Map());
4944
- }
4945
- current = current.get(part);
4946
- }
4947
- }
4948
- return pathStructure;
4949
- }
4950
- function selectiveClone(obj, pathStructure) {
4951
- if (!pathStructure) {
4952
- return obj;
4953
- }
4954
- function cloneSelectively(source, pathMap, depth = 0) {
4955
- if (!pathMap || pathMap.size === 0) {
4956
- return source;
4957
- }
4958
- if (source === null || typeof source !== "object") {
4959
- return source;
4960
- }
4961
- if (source instanceof Date) {
4962
- return new Date(source.getTime());
4963
- }
4964
- if (Array.isArray(source)) {
4965
- const cloned2 = [];
4966
- for (let i = 0; i < source.length; i++) {
4967
- const indexStr = i.toString();
4968
- if (pathMap.has(indexStr) || pathMap.has("*")) {
4969
- cloned2[i] = cloneSelectively(source[i], pathMap.get(indexStr) || pathMap.get("*"));
4970
- } else {
4971
- cloned2[i] = source[i];
4972
- }
4973
- }
4974
- return cloned2;
4975
- }
4976
- const cloned = Object.create(Object.getPrototypeOf(source));
4977
- for (const key in source) {
4978
- if (Object.prototype.hasOwnProperty.call(source, key)) {
4979
- if (pathMap.has(key) || pathMap.has("*")) {
4980
- cloned[key] = cloneSelectively(source[key], pathMap.get(key) || pathMap.get("*"));
4981
- } else {
4982
- cloned[key] = source[key];
4983
- }
4984
- }
4985
- }
4986
- return cloned;
4987
- }
4988
- return cloneSelectively(obj, pathStructure);
4989
- }
4990
- function validatePath(path4) {
4991
- if (typeof path4 !== "string") {
4992
- throw new Error("Paths must be (non-empty) strings");
4993
- }
4994
- if (path4 === "") {
4995
- throw new Error("Invalid redaction path ()");
4996
- }
4997
- if (path4.includes("..")) {
4998
- throw new Error(`Invalid redaction path (${path4})`);
4999
- }
5000
- if (path4.includes(",")) {
5001
- throw new Error(`Invalid redaction path (${path4})`);
5002
- }
5003
- let bracketCount = 0;
5004
- let inQuotes = false;
5005
- let quoteChar = "";
5006
- for (let i = 0; i < path4.length; i++) {
5007
- const char = path4[i];
5008
- if ((char === '"' || char === "'") && bracketCount > 0) {
5009
- if (!inQuotes) {
5010
- inQuotes = true;
5011
- quoteChar = char;
5012
- } else if (char === quoteChar) {
5013
- inQuotes = false;
5014
- quoteChar = "";
5015
- }
5016
- } else if (char === "[" && !inQuotes) {
5017
- bracketCount++;
5018
- } else if (char === "]" && !inQuotes) {
5019
- bracketCount--;
5020
- if (bracketCount < 0) {
5021
- throw new Error(`Invalid redaction path (${path4})`);
5022
- }
5023
- }
5024
- }
5025
- if (bracketCount !== 0) {
5026
- throw new Error(`Invalid redaction path (${path4})`);
5027
- }
5028
- }
5029
- function validatePaths(paths) {
5030
- if (!Array.isArray(paths)) {
5031
- throw new TypeError("paths must be an array");
5032
- }
5033
- for (const path4 of paths) {
5034
- validatePath(path4);
5035
- }
5036
- }
5037
- function slowRedact(options = {}) {
5038
- const {
5039
- paths = [],
5040
- censor = "[REDACTED]",
5041
- serialize = JSON.stringify,
5042
- strict = true,
5043
- remove = false
5044
- } = options;
5045
- validatePaths(paths);
5046
- const pathStructure = buildPathStructure(paths);
5047
- return function redact(obj) {
5048
- if (strict && (obj === null || typeof obj !== "object")) {
5049
- if (obj === null || obj === void 0) {
5050
- return serialize ? serialize(obj) : obj;
5051
- }
5052
- if (typeof obj !== "object") {
5053
- return serialize ? serialize(obj) : obj;
5054
- }
5055
- }
5056
- const cloned = selectiveClone(obj, pathStructure);
5057
- const original = obj;
5058
- let actualCensor = censor;
5059
- if (typeof censor === "function") {
5060
- actualCensor = censor;
5061
- }
5062
- redactPaths(cloned, paths, actualCensor, remove);
5063
- if (serialize === false) {
5064
- cloned.restore = function() {
5065
- return deepClone(original);
5066
- };
5067
- return cloned;
5068
- }
5069
- if (typeof serialize === "function") {
5070
- return serialize(cloned);
5071
- }
5072
- return JSON.stringify(cloned);
5073
- };
5074
- }
5075
- module.exports = slowRedact;
5076
- }
5077
- });
5078
-
5079
- // ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/symbols.js
5080
- var require_symbols = __commonJS({
5081
- "../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/symbols.js"(exports, module) {
5082
- "use strict";
5083
- var setLevelSym = /* @__PURE__ */ Symbol("pino.setLevel");
5084
- var getLevelSym = /* @__PURE__ */ Symbol("pino.getLevel");
5085
- var levelValSym = /* @__PURE__ */ Symbol("pino.levelVal");
5086
- var levelCompSym = /* @__PURE__ */ Symbol("pino.levelComp");
5087
- var useLevelLabelsSym = /* @__PURE__ */ Symbol("pino.useLevelLabels");
5088
- var useOnlyCustomLevelsSym = /* @__PURE__ */ Symbol("pino.useOnlyCustomLevels");
5089
- var mixinSym = /* @__PURE__ */ Symbol("pino.mixin");
5090
- var lsCacheSym = /* @__PURE__ */ Symbol("pino.lsCache");
5091
- var chindingsSym = /* @__PURE__ */ Symbol("pino.chindings");
5092
- var asJsonSym = /* @__PURE__ */ Symbol("pino.asJson");
5093
- var writeSym = /* @__PURE__ */ Symbol("pino.write");
5094
- var redactFmtSym = /* @__PURE__ */ Symbol("pino.redactFmt");
5095
- var timeSym = /* @__PURE__ */ Symbol("pino.time");
5096
- var timeSliceIndexSym = /* @__PURE__ */ Symbol("pino.timeSliceIndex");
5097
- var streamSym = /* @__PURE__ */ Symbol("pino.stream");
5098
- var stringifySym = /* @__PURE__ */ Symbol("pino.stringify");
5099
- var stringifySafeSym = /* @__PURE__ */ Symbol("pino.stringifySafe");
5100
- var stringifiersSym = /* @__PURE__ */ Symbol("pino.stringifiers");
5101
- var endSym = /* @__PURE__ */ Symbol("pino.end");
5102
- var formatOptsSym = /* @__PURE__ */ Symbol("pino.formatOpts");
5103
- var messageKeySym = /* @__PURE__ */ Symbol("pino.messageKey");
5104
- var errorKeySym = /* @__PURE__ */ Symbol("pino.errorKey");
5105
- var nestedKeySym = /* @__PURE__ */ Symbol("pino.nestedKey");
5106
- var nestedKeyStrSym = /* @__PURE__ */ Symbol("pino.nestedKeyStr");
5107
- var mixinMergeStrategySym = /* @__PURE__ */ Symbol("pino.mixinMergeStrategy");
5108
- var msgPrefixSym = /* @__PURE__ */ Symbol("pino.msgPrefix");
5109
- var wildcardFirstSym = /* @__PURE__ */ Symbol("pino.wildcardFirst");
5110
- var serializersSym = /* @__PURE__ */ Symbol.for("pino.serializers");
5111
- var formattersSym = /* @__PURE__ */ Symbol.for("pino.formatters");
5112
- var hooksSym = /* @__PURE__ */ Symbol.for("pino.hooks");
5113
- var needsMetadataGsym = /* @__PURE__ */ Symbol.for("pino.metadata");
5114
- module.exports = {
5115
- setLevelSym,
5116
- getLevelSym,
5117
- levelValSym,
5118
- levelCompSym,
5119
- useLevelLabelsSym,
5120
- mixinSym,
5121
- lsCacheSym,
5122
- chindingsSym,
5123
- asJsonSym,
5124
- writeSym,
5125
- serializersSym,
5126
- redactFmtSym,
5127
- timeSym,
5128
- timeSliceIndexSym,
5129
- streamSym,
5130
- stringifySym,
5131
- stringifySafeSym,
5132
- stringifiersSym,
5133
- endSym,
5134
- formatOptsSym,
5135
- messageKeySym,
5136
- errorKeySym,
5137
- nestedKeySym,
5138
- wildcardFirstSym,
5139
- needsMetadataGsym,
5140
- useOnlyCustomLevelsSym,
5141
- formattersSym,
5142
- hooksSym,
5143
- nestedKeyStrSym,
5144
- mixinMergeStrategySym,
5145
- msgPrefixSym
5146
- };
5147
- }
5148
- });
5149
-
5150
- // ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/redaction.js
5151
- var require_redaction = __commonJS({
5152
- "../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/redaction.js"(exports, module) {
5153
- "use strict";
5154
- var Redact = require_redact();
5155
- var { redactFmtSym, wildcardFirstSym } = require_symbols();
5156
- var rx = /[^.[\]]+|\[([^[\]]*?)\]/g;
5157
- var CENSOR = "[Redacted]";
5158
- var strict = false;
5159
- function redaction(opts, serialize) {
5160
- const { paths, censor, remove } = handle(opts);
5161
- const shape = paths.reduce((o, str2) => {
5162
- rx.lastIndex = 0;
5163
- const first = rx.exec(str2);
5164
- const next = rx.exec(str2);
5165
- let ns = first[1] !== void 0 ? first[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, "$1") : first[0];
5166
- if (ns === "*") {
5167
- ns = wildcardFirstSym;
5168
- }
5169
- if (next === null) {
5170
- o[ns] = null;
5171
- return o;
5172
- }
5173
- if (o[ns] === null) {
5174
- return o;
5175
- }
5176
- const { index } = next;
5177
- const nextPath = `${str2.substr(index, str2.length - 1)}`;
5178
- o[ns] = o[ns] || [];
5179
- if (ns !== wildcardFirstSym && o[ns].length === 0) {
5180
- o[ns].push(...o[wildcardFirstSym] || []);
5181
- }
5182
- if (ns === wildcardFirstSym) {
5183
- Object.keys(o).forEach(function(k) {
5184
- if (o[k]) {
5185
- o[k].push(nextPath);
5186
- }
5187
- });
5188
- }
5189
- o[ns].push(nextPath);
5190
- return o;
5191
- }, {});
5192
- const result = {
5193
- [redactFmtSym]: Redact({ paths, censor, serialize, strict, remove })
5194
- };
5195
- const topCensor = (...args) => {
5196
- return typeof censor === "function" ? serialize(censor(...args)) : serialize(censor);
5197
- };
5198
- return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k) => {
5199
- if (shape[k] === null) {
5200
- o[k] = (value) => topCensor(value, [k]);
5201
- } else {
5202
- const wrappedCensor = typeof censor === "function" ? (value, path4) => {
5203
- return censor(value, [k, ...path4]);
5204
- } : censor;
5205
- o[k] = Redact({
5206
- paths: shape[k],
5207
- censor: wrappedCensor,
5208
- serialize,
5209
- strict,
5210
- remove
5211
- });
5212
- }
5213
- return o;
5214
- }, result);
5215
- }
5216
- function handle(opts) {
5217
- if (Array.isArray(opts)) {
5218
- opts = { paths: opts, censor: CENSOR };
5219
- return opts;
5220
- }
5221
- let { paths, censor = CENSOR, remove } = opts;
5222
- if (Array.isArray(paths) === false) {
5223
- throw Error("pino \u2013 redact must contain an array of strings");
5224
- }
5225
- if (remove === true) censor = void 0;
5226
- return { paths, censor, remove };
5227
- }
5228
- module.exports = redaction;
5229
- }
5230
- });
5231
-
5232
- // ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/time.js
5233
- var require_time = __commonJS({
5234
- "../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/time.js"(exports, module) {
5235
- "use strict";
5236
- var nullTime = () => "";
5237
- var epochTime = () => `,"time":${Date.now()}`;
5238
- var unixTime = () => `,"time":${Math.round(Date.now() / 1e3)}`;
5239
- var isoTime = () => `,"time":"${new Date(Date.now()).toISOString()}"`;
5240
- var NS_PER_MS = 1000000n;
5241
- var NS_PER_SEC = 1000000000n;
5242
- var startWallTimeNs = BigInt(Date.now()) * NS_PER_MS;
5243
- var startHrTime = process.hrtime.bigint();
5244
- var isoTimeNano = () => {
5245
- const elapsedNs = process.hrtime.bigint() - startHrTime;
5246
- const currentTimeNs = startWallTimeNs + elapsedNs;
5247
- const secondsSinceEpoch = currentTimeNs / NS_PER_SEC;
5248
- const nanosWithinSecond = currentTimeNs % NS_PER_SEC;
5249
- const msSinceEpoch = Number(secondsSinceEpoch * 1000n + nanosWithinSecond / 1000000n);
5250
- const date5 = new Date(msSinceEpoch);
5251
- const year = date5.getUTCFullYear();
5252
- const month = (date5.getUTCMonth() + 1).toString().padStart(2, "0");
5253
- const day = date5.getUTCDate().toString().padStart(2, "0");
5254
- const hours = date5.getUTCHours().toString().padStart(2, "0");
5255
- const minutes = date5.getUTCMinutes().toString().padStart(2, "0");
5256
- const seconds = date5.getUTCSeconds().toString().padStart(2, "0");
5257
- return `,"time":"${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${nanosWithinSecond.toString().padStart(9, "0")}Z"`;
5258
- };
5259
- module.exports = { nullTime, epochTime, unixTime, isoTime, isoTimeNano };
5260
- }
5261
- });
5262
-
5263
- // ../../node_modules/.pnpm/quick-format-unescaped@4.0.4/node_modules/quick-format-unescaped/index.js
5264
- var require_quick_format_unescaped = __commonJS({
5265
- "../../node_modules/.pnpm/quick-format-unescaped@4.0.4/node_modules/quick-format-unescaped/index.js"(exports, module) {
5266
- "use strict";
5267
- function tryStringify(o) {
5268
- try {
5269
- return JSON.stringify(o);
5270
- } catch (e) {
5271
- return '"[Circular]"';
5272
- }
5273
- }
5274
- module.exports = format2;
5275
- function format2(f, args, opts) {
5276
- var ss = opts && opts.stringify || tryStringify;
5277
- var offset = 1;
5278
- if (typeof f === "object" && f !== null) {
5279
- var len = args.length + offset;
5280
- if (len === 1) return f;
5281
- var objects = new Array(len);
5282
- objects[0] = ss(f);
5283
- for (var index = 1; index < len; index++) {
5284
- objects[index] = ss(args[index]);
5285
- }
5286
- return objects.join(" ");
5287
- }
5288
- if (typeof f !== "string") {
5289
- return f;
5290
- }
5291
- var argLen = args.length;
5292
- if (argLen === 0) return f;
5293
- var str2 = "";
5294
- var a = 1 - offset;
5295
- var lastPos = -1;
5296
- var flen = f && f.length || 0;
5297
- for (var i = 0; i < flen; ) {
5298
- if (f.charCodeAt(i) === 37 && i + 1 < flen) {
5299
- lastPos = lastPos > -1 ? lastPos : 0;
5300
- switch (f.charCodeAt(i + 1)) {
5301
- case 100:
5302
- // 'd'
5303
- case 102:
5304
- if (a >= argLen)
5305
- break;
5306
- if (args[a] == null) break;
5307
- if (lastPos < i)
5308
- str2 += f.slice(lastPos, i);
5309
- str2 += Number(args[a]);
5310
- lastPos = i + 2;
5311
- i++;
5312
- break;
5313
- case 105:
5314
- if (a >= argLen)
5315
- break;
5316
- if (args[a] == null) break;
5317
- if (lastPos < i)
5318
- str2 += f.slice(lastPos, i);
5319
- str2 += Math.floor(Number(args[a]));
5320
- lastPos = i + 2;
5321
- i++;
5322
- break;
5323
- case 79:
5324
- // 'O'
5325
- case 111:
5326
- // 'o'
5327
- case 106:
5328
- if (a >= argLen)
5329
- break;
5330
- if (args[a] === void 0) break;
5331
- if (lastPos < i)
5332
- str2 += f.slice(lastPos, i);
5333
- var type = typeof args[a];
5334
- if (type === "string") {
5335
- str2 += "'" + args[a] + "'";
5336
- lastPos = i + 2;
5337
- i++;
5338
- break;
5339
- }
5340
- if (type === "function") {
5341
- str2 += args[a].name || "<anonymous>";
5342
- lastPos = i + 2;
5343
- i++;
5344
- break;
5345
- }
5346
- str2 += ss(args[a]);
5347
- lastPos = i + 2;
5348
- i++;
5349
- break;
5350
- case 115:
5351
- if (a >= argLen)
5352
- break;
5353
- if (lastPos < i)
5354
- str2 += f.slice(lastPos, i);
5355
- str2 += String(args[a]);
5356
- lastPos = i + 2;
5357
- i++;
5358
- break;
5359
- case 37:
5360
- if (lastPos < i)
5361
- str2 += f.slice(lastPos, i);
5362
- str2 += "%";
5363
- lastPos = i + 2;
5364
- i++;
5365
- a--;
5366
- break;
5367
- }
5368
- ++a;
5369
- }
5370
- ++i;
5371
- }
5372
- if (lastPos === -1)
5373
- return f;
5374
- else if (lastPos < flen) {
5375
- str2 += f.slice(lastPos);
5376
- }
5377
- return str2;
5378
- }
5379
- }
5380
- });
5381
-
5382
- // ../../node_modules/.pnpm/atomic-sleep@1.0.0/node_modules/atomic-sleep/index.js
5383
- var require_atomic_sleep = __commonJS({
5384
- "../../node_modules/.pnpm/atomic-sleep@1.0.0/node_modules/atomic-sleep/index.js"(exports, module) {
5385
- "use strict";
5386
- if (typeof SharedArrayBuffer !== "undefined" && typeof Atomics !== "undefined") {
5387
- let sleep3 = function(ms) {
5388
- const valid = ms > 0 && ms < Infinity;
5389
- if (valid === false) {
5390
- if (typeof ms !== "number" && typeof ms !== "bigint") {
5391
- throw TypeError("sleep: ms must be a number");
5392
- }
5393
- throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");
5394
- }
5395
- Atomics.wait(nil, 0, 0, Number(ms));
5396
- };
5397
- const nil = new Int32Array(new SharedArrayBuffer(4));
5398
- module.exports = sleep3;
5399
- } else {
5400
- let sleep3 = function(ms) {
5401
- const valid = ms > 0 && ms < Infinity;
5402
- if (valid === false) {
5403
- if (typeof ms !== "number" && typeof ms !== "bigint") {
5404
- throw TypeError("sleep: ms must be a number");
5405
- }
5406
- throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");
5407
- }
5408
- const target = Date.now() + Number(ms);
5409
- while (target > Date.now()) {
5410
- }
5411
- };
5412
- module.exports = sleep3;
5413
- }
5414
- }
5415
- });
5416
-
5417
- // ../../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js
5418
- var require_sonic_boom = __commonJS({
5419
- "../../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js"(exports, module) {
5420
- "use strict";
5421
- var fs6 = __require("fs");
5422
- var EventEmitter = __require("events");
5423
- var inherits = __require("util").inherits;
5424
- var path4 = __require("path");
5425
- var sleep3 = require_atomic_sleep();
5426
- var assert2 = __require("assert");
5427
- var BUSY_WRITE_TIMEOUT = 100;
5428
- var kEmptyBuffer = Buffer.allocUnsafe(0);
5429
- var MAX_WRITE = 16 * 1024;
5430
- var kContentModeBuffer = "buffer";
5431
- var kContentModeUtf8 = "utf8";
5432
- var [major, minor] = (process.versions.node || "0.0").split(".").map(Number);
5433
- var kCopyBuffer = major >= 22 && minor >= 7;
5434
- function openFile(file2, sonic) {
5435
- sonic._opening = true;
5436
- sonic._writing = true;
5437
- sonic._asyncDrainScheduled = false;
5438
- function fileOpened(err, fd) {
5439
- if (err) {
5440
- sonic._reopening = false;
5441
- sonic._writing = false;
5442
- sonic._opening = false;
5443
- if (sonic.sync) {
5444
- process.nextTick(() => {
5445
- if (sonic.listenerCount("error") > 0) {
5446
- sonic.emit("error", err);
5447
- }
5448
- });
5449
- } else {
5450
- sonic.emit("error", err);
5451
- }
5452
- return;
5453
- }
5454
- const reopening = sonic._reopening;
5455
- sonic.fd = fd;
5456
- sonic.file = file2;
5457
- sonic._reopening = false;
5458
- sonic._opening = false;
5459
- sonic._writing = false;
5460
- if (sonic.sync) {
5461
- process.nextTick(() => sonic.emit("ready"));
5462
- } else {
5463
- sonic.emit("ready");
5464
- }
5465
- if (sonic.destroyed) {
5466
- return;
5467
- }
5468
- if (!sonic._writing && sonic._len > sonic.minLength || sonic._flushPending) {
5469
- sonic._actualWrite();
5470
- } else if (reopening) {
5471
- process.nextTick(() => sonic.emit("drain"));
5472
- }
5473
- }
5474
- const flags = sonic.append ? "a" : "w";
5475
- const mode = sonic.mode;
5476
- if (sonic.sync) {
5477
- try {
5478
- if (sonic.mkdir) fs6.mkdirSync(path4.dirname(file2), { recursive: true });
5479
- const fd = fs6.openSync(file2, flags, mode);
5480
- fileOpened(null, fd);
5481
- } catch (err) {
5482
- fileOpened(err);
5483
- throw err;
5484
- }
5485
- } else if (sonic.mkdir) {
5486
- fs6.mkdir(path4.dirname(file2), { recursive: true }, (err) => {
5487
- if (err) return fileOpened(err);
5488
- fs6.open(file2, flags, mode, fileOpened);
5489
- });
5490
- } else {
5491
- fs6.open(file2, flags, mode, fileOpened);
5492
- }
5493
- }
5494
- function SonicBoom(opts) {
5495
- if (!(this instanceof SonicBoom)) {
5496
- return new SonicBoom(opts);
5497
- }
5498
- let { fd, dest, minLength, maxLength, maxWrite, periodicFlush, sync, append = true, mkdir, retryEAGAIN, fsync, contentMode, mode } = opts || {};
5499
- fd = fd || dest;
5500
- this._len = 0;
5501
- this.fd = -1;
5502
- this._bufs = [];
5503
- this._lens = [];
5504
- this._writing = false;
5505
- this._ending = false;
5506
- this._reopening = false;
5507
- this._asyncDrainScheduled = false;
5508
- this._flushPending = false;
5509
- this._hwm = Math.max(minLength || 0, 16387);
5510
- this.file = null;
5511
- this.destroyed = false;
5512
- this.minLength = minLength || 0;
5513
- this.maxLength = maxLength || 0;
5514
- this.maxWrite = maxWrite || MAX_WRITE;
5515
- this._periodicFlush = periodicFlush || 0;
5516
- this._periodicFlushTimer = void 0;
5517
- this.sync = sync || false;
5518
- this.writable = true;
5519
- this._fsync = fsync || false;
5520
- this.append = append || false;
5521
- this.mode = mode;
5522
- this.retryEAGAIN = retryEAGAIN || (() => true);
5523
- this.mkdir = mkdir || false;
5524
- let fsWriteSync;
5525
- let fsWrite;
5526
- if (contentMode === kContentModeBuffer) {
5527
- this._writingBuf = kEmptyBuffer;
5528
- this.write = writeBuffer;
5529
- this.flush = flushBuffer;
5530
- this.flushSync = flushBufferSync;
5531
- this._actualWrite = actualWriteBuffer;
5532
- fsWriteSync = () => fs6.writeSync(this.fd, this._writingBuf);
5533
- fsWrite = () => fs6.write(this.fd, this._writingBuf, this.release);
5534
- } else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
5535
- this._writingBuf = "";
5536
- this.write = write;
5537
- this.flush = flush;
5538
- this.flushSync = flushSync;
5539
- this._actualWrite = actualWrite;
5540
- fsWriteSync = () => {
5541
- if (Buffer.isBuffer(this._writingBuf)) {
5542
- return fs6.writeSync(this.fd, this._writingBuf);
5543
- }
5544
- return fs6.writeSync(this.fd, this._writingBuf, "utf8");
5545
- };
5546
- fsWrite = () => {
5547
- if (Buffer.isBuffer(this._writingBuf)) {
5548
- return fs6.write(this.fd, this._writingBuf, this.release);
5549
- }
5550
- return fs6.write(this.fd, this._writingBuf, "utf8", this.release);
5551
- };
5552
- } else {
5553
- throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
5554
- }
5555
- if (typeof fd === "number") {
5556
- this.fd = fd;
5557
- process.nextTick(() => this.emit("ready"));
5558
- } else if (typeof fd === "string") {
5559
- openFile(fd, this);
5560
- } else {
5561
- throw new Error("SonicBoom supports only file descriptors and files");
5562
- }
5563
- if (this.minLength >= this.maxWrite) {
5564
- throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);
5565
- }
5566
- this.release = (err, n) => {
5567
- if (err) {
5568
- if ((err.code === "EAGAIN" || err.code === "EBUSY") && this.retryEAGAIN(err, this._writingBuf.length, this._len - this._writingBuf.length)) {
5569
- if (this.sync) {
5570
- try {
5571
- sleep3(BUSY_WRITE_TIMEOUT);
5572
- this.release(void 0, 0);
5573
- } catch (err2) {
5574
- this.release(err2);
5575
- }
5576
- } else {
5577
- setTimeout(fsWrite, BUSY_WRITE_TIMEOUT);
5578
- }
5579
- } else {
5580
- this._writing = false;
5581
- this.emit("error", err);
5582
- }
5583
- return;
5584
- }
5585
- this.emit("write", n);
5586
- const releasedBufObj = releaseWritingBuf(this._writingBuf, this._len, n);
5587
- this._len = releasedBufObj.len;
5588
- this._writingBuf = releasedBufObj.writingBuf;
5589
- if (this._writingBuf.length) {
5590
- if (!this.sync) {
5591
- fsWrite();
5592
- return;
5593
- }
5594
- try {
5595
- do {
5596
- const n2 = fsWriteSync();
5597
- const releasedBufObj2 = releaseWritingBuf(this._writingBuf, this._len, n2);
5598
- this._len = releasedBufObj2.len;
5599
- this._writingBuf = releasedBufObj2.writingBuf;
5600
- } while (this._writingBuf.length);
5601
- } catch (err2) {
5602
- this.release(err2);
5603
- return;
5604
- }
5605
- }
5606
- if (this._fsync) {
5607
- fs6.fsyncSync(this.fd);
5608
- }
5609
- const len = this._len;
5610
- if (this._reopening) {
5611
- this._writing = false;
5612
- this._reopening = false;
5613
- this.reopen();
5614
- } else if (len > this.minLength) {
5615
- this._actualWrite();
5616
- } else if (this._ending) {
5617
- if (len > 0) {
5618
- this._actualWrite();
5619
- } else {
5620
- this._writing = false;
5621
- actualClose(this);
5622
- }
5623
- } else {
5624
- this._writing = false;
5625
- if (this.sync) {
5626
- if (!this._asyncDrainScheduled) {
5627
- this._asyncDrainScheduled = true;
5628
- process.nextTick(emitDrain, this);
5629
- }
5630
- } else {
5631
- this.emit("drain");
5632
- }
5633
- }
5634
- };
5635
- this.on("newListener", function(name) {
5636
- if (name === "drain") {
5637
- this._asyncDrainScheduled = false;
5638
- }
5639
- });
5640
- if (this._periodicFlush !== 0) {
5641
- this._periodicFlushTimer = setInterval(() => this.flush(null), this._periodicFlush);
5642
- this._periodicFlushTimer.unref();
5643
- }
5644
- }
5645
- function releaseWritingBuf(writingBuf, len, n) {
5646
- if (typeof writingBuf === "string") {
5647
- writingBuf = Buffer.from(writingBuf);
5648
- }
5649
- len = Math.max(len - n, 0);
5650
- writingBuf = writingBuf.subarray(n);
5651
- return { writingBuf, len };
5652
- }
5653
- function emitDrain(sonic) {
5654
- const hasListeners = sonic.listenerCount("drain") > 0;
5655
- if (!hasListeners) return;
5656
- sonic._asyncDrainScheduled = false;
5657
- sonic.emit("drain");
5658
- }
5659
- inherits(SonicBoom, EventEmitter);
5660
- function mergeBuf(bufs, len) {
5661
- if (bufs.length === 0) {
5662
- return kEmptyBuffer;
5663
- }
5664
- if (bufs.length === 1) {
5665
- return bufs[0];
5666
- }
5667
- return Buffer.concat(bufs, len);
5668
- }
5669
- function write(data) {
5670
- if (this.destroyed) {
5671
- throw new Error("SonicBoom destroyed");
5672
- }
5673
- data = "" + data;
5674
- const dataLen = Buffer.byteLength(data);
5675
- const len = this._len + dataLen;
5676
- const bufs = this._bufs;
5677
- if (this.maxLength && len > this.maxLength) {
5678
- this.emit("drop", data);
5679
- return this._len < this._hwm;
5680
- }
5681
- if (bufs.length === 0 || Buffer.byteLength(bufs[bufs.length - 1]) + dataLen > this.maxWrite) {
5682
- bufs.push(data);
5683
- } else {
5684
- bufs[bufs.length - 1] += data;
5685
- }
5686
- this._len = len;
5687
- if (!this._writing && this._len >= this.minLength) {
5688
- this._actualWrite();
5689
- }
5690
- return this._len < this._hwm;
5691
- }
5692
- function writeBuffer(data) {
5693
- if (this.destroyed) {
5694
- throw new Error("SonicBoom destroyed");
5695
- }
5696
- const len = this._len + data.length;
5697
- const bufs = this._bufs;
5698
- const lens = this._lens;
5699
- if (this.maxLength && len > this.maxLength) {
5700
- this.emit("drop", data);
5701
- return this._len < this._hwm;
5702
- }
5703
- if (bufs.length === 0 || lens[lens.length - 1] + data.length > this.maxWrite) {
5704
- bufs.push([data]);
5705
- lens.push(data.length);
5706
- } else {
5707
- bufs[bufs.length - 1].push(data);
5708
- lens[lens.length - 1] += data.length;
5709
- }
5710
- this._len = len;
5711
- if (!this._writing && this._len >= this.minLength) {
5712
- this._actualWrite();
5713
- }
5714
- return this._len < this._hwm;
5715
- }
5716
- function callFlushCallbackOnDrain(cb) {
5717
- this._flushPending = true;
5718
- const onDrain = () => {
5719
- if (!this._fsync) {
5720
- try {
5721
- fs6.fsync(this.fd, (err) => {
5722
- this._flushPending = false;
5723
- cb(err);
5724
- });
5725
- } catch (err) {
5726
- cb(err);
5727
- }
5728
- } else {
5729
- this._flushPending = false;
5730
- cb();
5731
- }
5732
- this.off("error", onError);
5733
- };
5734
- const onError = (err) => {
5735
- this._flushPending = false;
5736
- cb(err);
5737
- this.off("drain", onDrain);
5738
- };
5739
- this.once("drain", onDrain);
5740
- this.once("error", onError);
5741
- }
5742
- function flush(cb) {
5743
- if (cb != null && typeof cb !== "function") {
5744
- throw new Error("flush cb must be a function");
5745
- }
5746
- if (this.destroyed) {
5747
- const error49 = new Error("SonicBoom destroyed");
5748
- if (cb) {
5749
- cb(error49);
5750
- return;
5751
- }
5752
- throw error49;
5753
- }
5754
- if (this.minLength <= 0) {
5755
- cb?.();
5756
- return;
5757
- }
5758
- if (cb) {
5759
- callFlushCallbackOnDrain.call(this, cb);
5760
- }
5761
- if (this._writing) {
5762
- return;
5763
- }
5764
- if (this._bufs.length === 0) {
5765
- this._bufs.push("");
5766
- }
5767
- this._actualWrite();
5768
- }
5769
- function flushBuffer(cb) {
5770
- if (cb != null && typeof cb !== "function") {
5771
- throw new Error("flush cb must be a function");
5772
- }
5773
- if (this.destroyed) {
5774
- const error49 = new Error("SonicBoom destroyed");
5775
- if (cb) {
5776
- cb(error49);
5777
- return;
5778
- }
5779
- throw error49;
5780
- }
5781
- if (this.minLength <= 0) {
5782
- cb?.();
5783
- return;
5784
- }
5785
- if (cb) {
5786
- callFlushCallbackOnDrain.call(this, cb);
5787
- }
5788
- if (this._writing) {
5789
- return;
5790
- }
5791
- if (this._bufs.length === 0) {
5792
- this._bufs.push([]);
5793
- this._lens.push(0);
5794
- }
5795
- this._actualWrite();
5796
- }
5797
- SonicBoom.prototype.reopen = function(file2) {
5798
- if (this.destroyed) {
5799
- throw new Error("SonicBoom destroyed");
5800
- }
5801
- if (this._opening) {
5802
- this.once("ready", () => {
5803
- this.reopen(file2);
5804
- });
5805
- return;
5806
- }
5807
- if (this._ending) {
5808
- return;
5809
- }
5810
- if (!this.file) {
5811
- throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");
5812
- }
5813
- if (file2) {
5814
- this.file = file2;
5815
- }
5816
- this._reopening = true;
5817
- if (this._writing) {
5818
- return;
5819
- }
5820
- const fd = this.fd;
5821
- this.once("ready", () => {
5822
- if (fd !== this.fd) {
5823
- fs6.close(fd, (err) => {
5824
- if (err) {
5825
- return this.emit("error", err);
5826
- }
5827
- });
5828
- }
5829
- });
5830
- openFile(this.file, this);
5831
- };
5832
- SonicBoom.prototype.end = function() {
5833
- if (this.destroyed) {
5834
- throw new Error("SonicBoom destroyed");
5835
- }
5836
- if (this._opening) {
5837
- this.once("ready", () => {
5838
- this.end();
5839
- });
5840
- return;
5841
- }
5842
- if (this._ending) {
5843
- return;
5844
- }
5845
- this._ending = true;
5846
- if (this._writing) {
5847
- return;
5848
- }
5849
- if (this._len > 0 && this.fd >= 0) {
5850
- this._actualWrite();
5851
- } else {
5852
- actualClose(this);
5853
- }
5854
- };
5855
- function flushSync() {
5856
- if (this.destroyed) {
5857
- throw new Error("SonicBoom destroyed");
5858
- }
5859
- if (this.fd < 0) {
5860
- throw new Error("sonic boom is not ready yet");
5861
- }
5862
- if (!this._writing && this._writingBuf.length > 0) {
5863
- this._bufs.unshift(this._writingBuf);
5864
- this._writingBuf = "";
5865
- }
5866
- let buf = "";
5867
- while (this._bufs.length || buf.length) {
5868
- if (buf.length <= 0) {
5869
- buf = this._bufs[0];
5870
- }
5871
- try {
5872
- const n = Buffer.isBuffer(buf) ? fs6.writeSync(this.fd, buf) : fs6.writeSync(this.fd, buf, "utf8");
5873
- const releasedBufObj = releaseWritingBuf(buf, this._len, n);
5874
- buf = releasedBufObj.writingBuf;
5875
- this._len = releasedBufObj.len;
5876
- if (buf.length <= 0) {
5877
- this._bufs.shift();
5878
- }
5879
- } catch (err) {
5880
- const shouldRetry = err.code === "EAGAIN" || err.code === "EBUSY";
5881
- if (shouldRetry && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) {
5882
- throw err;
5883
- }
5884
- sleep3(BUSY_WRITE_TIMEOUT);
5885
- }
5886
- }
5887
- try {
5888
- fs6.fsyncSync(this.fd);
5889
- } catch {
5890
- }
5891
- }
5892
- function flushBufferSync() {
5893
- if (this.destroyed) {
5894
- throw new Error("SonicBoom destroyed");
5895
- }
5896
- if (this.fd < 0) {
5897
- throw new Error("sonic boom is not ready yet");
5898
- }
5899
- if (!this._writing && this._writingBuf.length > 0) {
5900
- this._bufs.unshift([this._writingBuf]);
5901
- this._writingBuf = kEmptyBuffer;
5902
- }
5903
- let buf = kEmptyBuffer;
5904
- while (this._bufs.length || buf.length) {
5905
- if (buf.length <= 0) {
5906
- buf = mergeBuf(this._bufs[0], this._lens[0]);
5907
- }
5908
- try {
5909
- const n = fs6.writeSync(this.fd, buf);
5910
- buf = buf.subarray(n);
5911
- this._len = Math.max(this._len - n, 0);
5912
- if (buf.length <= 0) {
5913
- this._bufs.shift();
5914
- this._lens.shift();
5915
- }
5916
- } catch (err) {
5917
- const shouldRetry = err.code === "EAGAIN" || err.code === "EBUSY";
5918
- if (shouldRetry && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) {
5919
- throw err;
5920
- }
5921
- sleep3(BUSY_WRITE_TIMEOUT);
5922
- }
5923
- }
5924
- }
5925
- SonicBoom.prototype.destroy = function() {
5926
- if (this.destroyed) {
5927
- return;
5928
- }
5929
- actualClose(this);
5930
- };
5931
- function actualWrite() {
5932
- const release = this.release;
5933
- this._writing = true;
5934
- this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
5935
- if (this.sync) {
5936
- try {
5937
- const written = Buffer.isBuffer(this._writingBuf) ? fs6.writeSync(this.fd, this._writingBuf) : fs6.writeSync(this.fd, this._writingBuf, "utf8");
5938
- release(null, written);
5939
- } catch (err) {
5940
- release(err);
5941
- }
5942
- } else {
5943
- fs6.write(this.fd, this._writingBuf, release);
5944
- }
5945
- }
5946
- function actualWriteBuffer() {
5947
- const release = this.release;
5948
- this._writing = true;
5949
- this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
5950
- if (this.sync) {
5951
- try {
5952
- const written = fs6.writeSync(this.fd, this._writingBuf);
5953
- release(null, written);
5954
- } catch (err) {
5955
- release(err);
5956
- }
5957
- } else {
5958
- if (kCopyBuffer) {
5959
- this._writingBuf = Buffer.from(this._writingBuf);
5960
- }
5961
- fs6.write(this.fd, this._writingBuf, release);
5962
- }
5963
- }
5964
- function actualClose(sonic) {
5965
- if (sonic.fd === -1) {
5966
- sonic.once("ready", actualClose.bind(null, sonic));
5967
- return;
5968
- }
5969
- if (sonic._periodicFlushTimer !== void 0) {
5970
- clearInterval(sonic._periodicFlushTimer);
5971
- }
5972
- sonic.destroyed = true;
5973
- sonic._bufs = [];
5974
- sonic._lens = [];
5975
- assert2(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
5976
- try {
5977
- fs6.fsync(sonic.fd, closeWrapped);
5978
- } catch {
5979
- }
5980
- function closeWrapped() {
5981
- if (sonic.fd !== 1 && sonic.fd !== 2) {
5982
- fs6.close(sonic.fd, done);
5983
- } else {
5984
- done();
5985
- }
5986
- }
5987
- function done(err) {
5988
- if (err) {
5989
- sonic.emit("error", err);
5990
- return;
5991
- }
5992
- if (sonic._ending && !sonic._writing) {
5993
- sonic.emit("finish");
5994
- }
5995
- sonic.emit("close");
5996
- }
5997
- }
5998
- SonicBoom.SonicBoom = SonicBoom;
5999
- SonicBoom.default = SonicBoom;
6000
- module.exports = SonicBoom;
6001
- }
6002
- });
6003
-
6004
- // ../../node_modules/.pnpm/on-exit-leak-free@2.1.2/node_modules/on-exit-leak-free/index.js
6005
- var require_on_exit_leak_free = __commonJS({
6006
- "../../node_modules/.pnpm/on-exit-leak-free@2.1.2/node_modules/on-exit-leak-free/index.js"(exports, module) {
6007
- "use strict";
6008
- var refs = {
6009
- exit: [],
6010
- beforeExit: []
6011
- };
6012
- var functions = {
6013
- exit: onExit2,
6014
- beforeExit: onBeforeExit
6015
- };
6016
- var registry2;
6017
- function ensureRegistry() {
6018
- if (registry2 === void 0) {
6019
- registry2 = new FinalizationRegistry(clear);
6020
- }
6021
- }
6022
- function install(event) {
6023
- if (refs[event].length > 0) {
6024
- return;
6025
- }
6026
- process.on(event, functions[event]);
6027
- }
6028
- function uninstall(event) {
6029
- if (refs[event].length > 0) {
6030
- return;
6031
- }
6032
- process.removeListener(event, functions[event]);
6033
- if (refs.exit.length === 0 && refs.beforeExit.length === 0) {
6034
- registry2 = void 0;
6035
- }
6036
- }
6037
- function onExit2() {
6038
- callRefs("exit");
6039
- }
6040
- function onBeforeExit() {
6041
- callRefs("beforeExit");
6042
- }
6043
- function callRefs(event) {
6044
- for (const ref of refs[event]) {
6045
- const obj = ref.deref();
6046
- const fn = ref.fn;
6047
- if (obj !== void 0) {
6048
- fn(obj, event);
6049
- }
6050
- }
6051
- refs[event] = [];
6052
- }
6053
- function clear(ref) {
6054
- for (const event of ["exit", "beforeExit"]) {
6055
- const index = refs[event].indexOf(ref);
6056
- refs[event].splice(index, index + 1);
6057
- uninstall(event);
6058
- }
6059
- }
6060
- function _register(event, obj, fn) {
6061
- if (obj === void 0) {
6062
- throw new Error("the object can't be undefined");
6063
- }
6064
- install(event);
6065
- const ref = new WeakRef(obj);
6066
- ref.fn = fn;
6067
- ensureRegistry();
6068
- registry2.register(obj, ref);
6069
- refs[event].push(ref);
6070
- }
6071
- function register(obj, fn) {
6072
- _register("exit", obj, fn);
6073
- }
6074
- function registerBeforeExit(obj, fn) {
6075
- _register("beforeExit", obj, fn);
6076
- }
6077
- function unregister(obj) {
6078
- if (registry2 === void 0) {
6079
- return;
6080
- }
6081
- registry2.unregister(obj);
6082
- for (const event of ["exit", "beforeExit"]) {
6083
- refs[event] = refs[event].filter((ref) => {
6084
- const _obj = ref.deref();
6085
- return _obj && _obj !== obj;
6086
- });
6087
- uninstall(event);
6088
- }
6089
- }
6090
- module.exports = {
6091
- register,
6092
- registerBeforeExit,
6093
- unregister
6094
- };
6095
- }
6096
- });
6097
-
6098
- // ../../node_modules/.pnpm/thread-stream@4.0.0/node_modules/thread-stream/package.json
6099
- var require_package2 = __commonJS({
6100
- "../../node_modules/.pnpm/thread-stream@4.0.0/node_modules/thread-stream/package.json"(exports, module) {
6101
- module.exports = {
6102
- name: "thread-stream",
6103
- version: "4.0.0",
6104
- description: "A streaming way to send data to a Node.js Worker Thread",
6105
- main: "index.js",
6106
- types: "index.d.ts",
6107
- engines: {
6108
- node: ">=20"
6109
- },
6110
- dependencies: {
6111
- "real-require": "^0.2.0"
6112
- },
6113
- devDependencies: {
6114
- "@types/node": "^22.0.0",
6115
- "@yao-pkg/pkg": "^6.0.0",
6116
- borp: "^0.21.0",
6117
- desm: "^1.3.0",
6118
- eslint: "^9.39.1",
6119
- fastbench: "^1.0.1",
6120
- husky: "^9.0.6",
6121
- neostandard: "^0.12.2",
6122
- "pino-elasticsearch": "^8.0.0",
6123
- "sonic-boom": "^4.0.1",
6124
- "ts-node": "^10.8.0",
6125
- typescript: "~5.7.3"
6126
- },
6127
- scripts: {
6128
- build: "tsc --noEmit",
6129
- lint: "eslint",
6130
- test: "npm run lint && npm run build && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'",
6131
- "test:ci": "npm run lint && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'",
6132
- "test:yarn": "npm run transpile && borp --pattern 'test/*.test.js'",
6133
- transpile: "sh ./test/ts/transpile.sh",
6134
- prepare: "husky install"
6135
- },
6136
- repository: {
6137
- type: "git",
6138
- url: "git+https://github.com/mcollina/thread-stream.git"
6139
- },
6140
- keywords: [
6141
- "worker",
6142
- "thread",
6143
- "threads",
6144
- "stream"
6145
- ],
6146
- author: "Matteo Collina <hello@matteocollina.com>",
6147
- license: "MIT",
6148
- bugs: {
6149
- url: "https://github.com/mcollina/thread-stream/issues"
6150
- },
6151
- homepage: "https://github.com/mcollina/thread-stream#readme"
6152
- };
6153
- }
6154
- });
6155
-
6156
- // ../../node_modules/.pnpm/thread-stream@4.0.0/node_modules/thread-stream/lib/wait.js
6157
- var require_wait = __commonJS({
6158
- "../../node_modules/.pnpm/thread-stream@4.0.0/node_modules/thread-stream/lib/wait.js"(exports, module) {
6159
- "use strict";
6160
- var WAIT_MS = 1e4;
6161
- function wait(state, index, expected, timeout, done) {
6162
- const max = timeout === Infinity ? Infinity : Date.now() + timeout;
6163
- const check3 = () => {
6164
- const current = Atomics.load(state, index);
6165
- if (current === expected) {
6166
- done(null, "ok");
6167
- return;
6168
- }
6169
- if (max !== Infinity && Date.now() > max) {
6170
- done(null, "timed-out");
6171
- return;
6172
- }
6173
- const remaining = max === Infinity ? WAIT_MS : Math.min(WAIT_MS, Math.max(1, max - Date.now()));
6174
- const result = Atomics.waitAsync(state, index, current, remaining);
6175
- if (result.async) {
6176
- result.value.then(check3);
6177
- } else {
6178
- setImmediate(check3);
6179
- }
6180
- };
6181
- check3();
6182
- }
6183
- function waitDiff(state, index, expected, timeout, done) {
6184
- const max = timeout === Infinity ? Infinity : Date.now() + timeout;
6185
- const check3 = () => {
6186
- const current = Atomics.load(state, index);
6187
- if (current !== expected) {
6188
- done(null, "ok");
6189
- return;
6190
- }
6191
- if (max !== Infinity && Date.now() > max) {
6192
- done(null, "timed-out");
6193
- return;
6194
- }
6195
- const remaining = max === Infinity ? WAIT_MS : Math.min(WAIT_MS, Math.max(1, max - Date.now()));
6196
- const result = Atomics.waitAsync(state, index, expected, remaining);
6197
- if (result.async) {
6198
- result.value.then(check3);
6199
- } else {
6200
- setImmediate(check3);
6201
- }
6202
- };
6203
- check3();
6204
- }
6205
- module.exports = { wait, waitDiff };
6206
- }
6207
- });
6208
-
6209
- // ../../node_modules/.pnpm/thread-stream@4.0.0/node_modules/thread-stream/lib/indexes.js
6210
- var require_indexes = __commonJS({
6211
- "../../node_modules/.pnpm/thread-stream@4.0.0/node_modules/thread-stream/lib/indexes.js"(exports, module) {
6212
- "use strict";
6213
- var WRITE_INDEX = 4;
6214
- var READ_INDEX = 8;
6215
- module.exports = {
6216
- WRITE_INDEX,
6217
- READ_INDEX
6218
- };
6219
- }
6220
- });
6221
-
6222
- // ../../node_modules/.pnpm/thread-stream@4.0.0/node_modules/thread-stream/index.js
6223
- var require_thread_stream = __commonJS({
6224
- "../../node_modules/.pnpm/thread-stream@4.0.0/node_modules/thread-stream/index.js"(exports, module) {
6225
- "use strict";
6226
- var { version: version2 } = require_package2();
6227
- var { EventEmitter } = __require("events");
6228
- var { Worker } = __require("worker_threads");
6229
- var { join: join2 } = __require("path");
6230
- var { pathToFileURL } = __require("url");
6231
- var { wait } = require_wait();
6232
- var {
6233
- WRITE_INDEX,
6234
- READ_INDEX
6235
- } = require_indexes();
6236
- var buffer = __require("buffer");
6237
- var assert2 = __require("assert");
6238
- var kImpl = /* @__PURE__ */ Symbol("kImpl");
6239
- var MAX_STRING = buffer.constants.MAX_STRING_LENGTH;
6240
- var FakeWeakRef = class {
6241
- constructor(value) {
6242
- this._value = value;
6243
- }
6244
- deref() {
6245
- return this._value;
6246
- }
6247
- };
6248
- var FakeFinalizationRegistry = class {
6249
- register() {
6250
- }
6251
- unregister() {
6252
- }
6253
- };
6254
- var FinalizationRegistry2 = process.env.NODE_V8_COVERAGE ? FakeFinalizationRegistry : global.FinalizationRegistry || FakeFinalizationRegistry;
6255
- var WeakRef2 = process.env.NODE_V8_COVERAGE ? FakeWeakRef : global.WeakRef || FakeWeakRef;
6256
- var registry2 = new FinalizationRegistry2((worker) => {
6257
- if (worker.exited) {
6258
- return;
6259
- }
6260
- worker.terminate();
6261
- });
6262
- function createWorker(stream, opts) {
6263
- const { filename, workerData } = opts;
6264
- const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
6265
- const toExecute = bundlerOverrides["thread-stream-worker"] || join2(__dirname, "lib", "worker.js");
6266
- const worker = new Worker(toExecute, {
6267
- ...opts.workerOpts,
6268
- trackUnmanagedFds: false,
6269
- workerData: {
6270
- filename: filename.indexOf("file://") === 0 ? filename : pathToFileURL(filename).href,
6271
- dataBuf: stream[kImpl].dataBuf,
6272
- stateBuf: stream[kImpl].stateBuf,
6273
- workerData: {
6274
- $context: {
6275
- threadStreamVersion: version2
6276
- },
6277
- ...workerData
6278
- }
6279
- }
6280
- });
6281
- worker.stream = new FakeWeakRef(stream);
6282
- worker.on("message", onWorkerMessage);
6283
- worker.on("exit", onWorkerExit);
6284
- registry2.register(stream, worker);
6285
- return worker;
6286
- }
6287
- function drain(stream) {
6288
- assert2(!stream[kImpl].sync);
6289
- if (stream[kImpl].needDrain) {
6290
- stream[kImpl].needDrain = false;
6291
- stream.emit("drain");
6292
- }
6293
- }
6294
- function nextFlush(stream) {
6295
- const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
6296
- let leftover = stream[kImpl].data.length - writeIndex;
6297
- if (leftover > 0) {
6298
- if (stream[kImpl].buf.length === 0) {
6299
- stream[kImpl].flushing = false;
6300
- if (stream[kImpl].ending) {
6301
- end(stream);
6302
- } else if (stream[kImpl].needDrain) {
6303
- process.nextTick(drain, stream);
6304
- }
6305
- return;
6306
- }
6307
- let toWrite = stream[kImpl].buf.slice(0, leftover);
6308
- let toWriteBytes = Buffer.byteLength(toWrite);
6309
- if (toWriteBytes <= leftover) {
6310
- stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
6311
- write(stream, toWrite, nextFlush.bind(null, stream));
6312
- } else {
6313
- stream.flush(() => {
6314
- if (stream.destroyed) {
6315
- return;
6316
- }
6317
- Atomics.store(stream[kImpl].state, READ_INDEX, 0);
6318
- Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
6319
- Atomics.notify(stream[kImpl].state, READ_INDEX);
6320
- while (toWriteBytes > stream[kImpl].data.length) {
6321
- leftover = leftover / 2;
6322
- toWrite = stream[kImpl].buf.slice(0, leftover);
6323
- toWriteBytes = Buffer.byteLength(toWrite);
6324
- }
6325
- stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
6326
- write(stream, toWrite, nextFlush.bind(null, stream));
6327
- });
6328
- }
6329
- } else if (leftover === 0) {
6330
- if (writeIndex === 0 && stream[kImpl].buf.length === 0) {
6331
- return;
6332
- }
6333
- stream.flush(() => {
6334
- Atomics.store(stream[kImpl].state, READ_INDEX, 0);
6335
- Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
6336
- Atomics.notify(stream[kImpl].state, READ_INDEX);
6337
- nextFlush(stream);
6338
- });
6339
- } else {
6340
- destroy(stream, new Error("overwritten"));
6341
- }
6342
- }
6343
- function onWorkerMessage(msg) {
6344
- const stream = this.stream.deref();
6345
- if (stream === void 0) {
6346
- this.exited = true;
6347
- this.terminate();
6348
- return;
6349
- }
6350
- switch (msg.code) {
6351
- case "READY":
6352
- this.stream = new WeakRef2(stream);
6353
- stream.flush(() => {
6354
- stream[kImpl].ready = true;
6355
- stream.emit("ready");
6356
- });
6357
- break;
6358
- case "ERROR":
6359
- destroy(stream, msg.err);
6360
- break;
6361
- case "EVENT":
6362
- if (Array.isArray(msg.args)) {
6363
- stream.emit(msg.name, ...msg.args);
6364
- } else {
6365
- stream.emit(msg.name, msg.args);
6366
- }
6367
- break;
6368
- case "WARNING":
6369
- process.emitWarning(msg.err);
6370
- break;
6371
- default:
6372
- destroy(stream, new Error("this should not happen: " + msg.code));
6373
- }
6374
- }
6375
- function onWorkerExit(code) {
6376
- const stream = this.stream.deref();
6377
- if (stream === void 0) {
6378
- return;
6379
- }
6380
- registry2.unregister(stream);
6381
- stream.worker.exited = true;
6382
- stream.worker.off("exit", onWorkerExit);
6383
- destroy(stream, code !== 0 ? new Error("the worker thread exited") : null);
6384
- }
6385
- var ThreadStream = class extends EventEmitter {
6386
- constructor(opts = {}) {
6387
- super();
6388
- if (opts.bufferSize < 4) {
6389
- throw new Error("bufferSize must at least fit a 4-byte utf-8 char");
6390
- }
6391
- this[kImpl] = {};
6392
- this[kImpl].stateBuf = new SharedArrayBuffer(128);
6393
- this[kImpl].state = new Int32Array(this[kImpl].stateBuf);
6394
- this[kImpl].dataBuf = new SharedArrayBuffer(opts.bufferSize || 4 * 1024 * 1024);
6395
- this[kImpl].data = Buffer.from(this[kImpl].dataBuf);
6396
- this[kImpl].sync = opts.sync || false;
6397
- this[kImpl].ending = false;
6398
- this[kImpl].ended = false;
6399
- this[kImpl].needDrain = false;
6400
- this[kImpl].destroyed = false;
6401
- this[kImpl].flushing = false;
6402
- this[kImpl].ready = false;
6403
- this[kImpl].finished = false;
6404
- this[kImpl].errored = null;
6405
- this[kImpl].closed = false;
6406
- this[kImpl].buf = "";
6407
- this.worker = createWorker(this, opts);
6408
- this.on("message", (message, transferList) => {
6409
- this.worker.postMessage(message, transferList);
6410
- });
6411
- }
6412
- write(data) {
6413
- if (this[kImpl].destroyed) {
6414
- error49(this, new Error("the worker has exited"));
6415
- return false;
6416
- }
6417
- if (this[kImpl].ending) {
6418
- error49(this, new Error("the worker is ending"));
6419
- return false;
6420
- }
6421
- if (this[kImpl].flushing && this[kImpl].buf.length + data.length >= MAX_STRING) {
6422
- try {
6423
- writeSync(this);
6424
- this[kImpl].flushing = true;
6425
- } catch (err) {
6426
- destroy(this, err);
6427
- return false;
6428
- }
6429
- }
6430
- this[kImpl].buf += data;
6431
- if (this[kImpl].sync) {
6432
- try {
6433
- writeSync(this);
6434
- return true;
6435
- } catch (err) {
6436
- destroy(this, err);
6437
- return false;
6438
- }
6439
- }
6440
- if (!this[kImpl].flushing) {
6441
- this[kImpl].flushing = true;
6442
- setImmediate(nextFlush, this);
6443
- }
6444
- this[kImpl].needDrain = this[kImpl].data.length - this[kImpl].buf.length - Atomics.load(this[kImpl].state, WRITE_INDEX) <= 0;
6445
- return !this[kImpl].needDrain;
6446
- }
6447
- end() {
6448
- if (this[kImpl].destroyed) {
6449
- return;
6450
- }
6451
- this[kImpl].ending = true;
6452
- end(this);
6453
- }
6454
- flush(cb) {
6455
- if (this[kImpl].destroyed) {
6456
- if (typeof cb === "function") {
6457
- process.nextTick(cb, new Error("the worker has exited"));
6458
- }
6459
- return;
6460
- }
6461
- const writeIndex = Atomics.load(this[kImpl].state, WRITE_INDEX);
6462
- wait(this[kImpl].state, READ_INDEX, writeIndex, Infinity, (err, res) => {
6463
- if (err) {
6464
- destroy(this, err);
6465
- process.nextTick(cb, err);
6466
- return;
6467
- }
6468
- if (res === "not-equal") {
6469
- this.flush(cb);
6470
- return;
6471
- }
6472
- process.nextTick(cb);
6473
- });
6474
- }
6475
- flushSync() {
6476
- if (this[kImpl].destroyed) {
6477
- return;
6478
- }
6479
- writeSync(this);
6480
- flushSync(this);
6481
- }
6482
- unref() {
6483
- this.worker.unref();
6484
- }
6485
- ref() {
6486
- this.worker.ref();
6487
- }
6488
- get ready() {
6489
- return this[kImpl].ready;
6490
- }
6491
- get destroyed() {
6492
- return this[kImpl].destroyed;
6493
- }
6494
- get closed() {
6495
- return this[kImpl].closed;
6496
- }
6497
- get writable() {
6498
- return !this[kImpl].destroyed && !this[kImpl].ending;
6499
- }
6500
- get writableEnded() {
6501
- return this[kImpl].ending;
6502
- }
6503
- get writableFinished() {
6504
- return this[kImpl].finished;
6505
- }
6506
- get writableNeedDrain() {
6507
- return this[kImpl].needDrain;
6508
- }
6509
- get writableObjectMode() {
6510
- return false;
6511
- }
6512
- get writableErrored() {
6513
- return this[kImpl].errored;
6514
- }
6515
- };
6516
- function error49(stream, err) {
6517
- setImmediate(() => {
6518
- stream.emit("error", err);
6519
- });
6520
- }
6521
- function destroy(stream, err) {
6522
- if (stream[kImpl].destroyed) {
6523
- return;
6524
- }
6525
- stream[kImpl].destroyed = true;
6526
- if (err) {
6527
- stream[kImpl].errored = err;
6528
- error49(stream, err);
6529
- }
6530
- if (!stream.worker.exited) {
6531
- stream.worker.terminate().catch(() => {
6532
- }).then(() => {
6533
- stream[kImpl].closed = true;
6534
- stream.emit("close");
6535
- });
6536
- } else {
6537
- setImmediate(() => {
6538
- stream[kImpl].closed = true;
6539
- stream.emit("close");
6540
- });
6541
- }
6542
- }
6543
- function write(stream, data, cb) {
6544
- const current = Atomics.load(stream[kImpl].state, WRITE_INDEX);
6545
- const length = Buffer.byteLength(data);
6546
- stream[kImpl].data.write(data, current);
6547
- Atomics.store(stream[kImpl].state, WRITE_INDEX, current + length);
6548
- Atomics.notify(stream[kImpl].state, WRITE_INDEX);
6549
- cb();
6550
- return true;
6551
- }
6552
- function end(stream) {
6553
- if (stream[kImpl].ended || !stream[kImpl].ending || stream[kImpl].flushing) {
6554
- return;
6555
- }
6556
- stream[kImpl].ended = true;
6557
- try {
6558
- stream.flushSync();
6559
- let readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
6560
- Atomics.store(stream[kImpl].state, WRITE_INDEX, -1);
6561
- Atomics.notify(stream[kImpl].state, WRITE_INDEX);
6562
- let spins = 0;
6563
- while (readIndex !== -1) {
6564
- Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1e3);
6565
- readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
6566
- if (readIndex === -2) {
6567
- destroy(stream, new Error("end() failed"));
6568
- return;
6569
- }
6570
- if (++spins === 10) {
6571
- destroy(stream, new Error("end() took too long (10s)"));
6572
- return;
6573
- }
6574
- }
6575
- process.nextTick(() => {
6576
- stream[kImpl].finished = true;
6577
- stream.emit("finish");
6578
- });
6579
- } catch (err) {
6580
- destroy(stream, err);
6581
- }
6582
- }
6583
- function writeSync(stream) {
6584
- const cb = () => {
6585
- if (stream[kImpl].ending) {
6586
- end(stream);
6587
- } else if (stream[kImpl].needDrain) {
6588
- process.nextTick(drain, stream);
6589
- }
6590
- };
6591
- stream[kImpl].flushing = false;
6592
- while (stream[kImpl].buf.length !== 0) {
6593
- const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
6594
- let leftover = stream[kImpl].data.length - writeIndex;
6595
- if (leftover === 0) {
6596
- flushSync(stream);
6597
- Atomics.store(stream[kImpl].state, READ_INDEX, 0);
6598
- Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
6599
- Atomics.notify(stream[kImpl].state, READ_INDEX);
6600
- continue;
6601
- } else if (leftover < 0) {
6602
- throw new Error("overwritten");
6603
- }
6604
- let toWrite = stream[kImpl].buf.slice(0, leftover);
6605
- let toWriteBytes = Buffer.byteLength(toWrite);
6606
- if (toWriteBytes <= leftover) {
6607
- stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
6608
- write(stream, toWrite, cb);
6609
- } else {
6610
- flushSync(stream);
6611
- Atomics.store(stream[kImpl].state, READ_INDEX, 0);
6612
- Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
6613
- Atomics.notify(stream[kImpl].state, READ_INDEX);
6614
- while (toWriteBytes > stream[kImpl].buf.length) {
6615
- leftover = leftover / 2;
6616
- toWrite = stream[kImpl].buf.slice(0, leftover);
6617
- toWriteBytes = Buffer.byteLength(toWrite);
6618
- }
6619
- stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
6620
- write(stream, toWrite, cb);
6621
- }
6622
- }
6623
- }
6624
- function flushSync(stream) {
6625
- if (stream[kImpl].flushing) {
6626
- throw new Error("unable to flush while flushing");
6627
- }
6628
- const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
6629
- let spins = 0;
6630
- while (true) {
6631
- const readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
6632
- if (readIndex === -2) {
6633
- throw Error("_flushSync failed");
6634
- }
6635
- if (readIndex !== writeIndex) {
6636
- Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1e3);
6637
- } else {
6638
- break;
6639
- }
6640
- if (++spins === 10) {
6641
- throw new Error("_flushSync took too long (10s)");
6642
- }
6643
- }
6644
- }
6645
- module.exports = ThreadStream;
6646
- }
6647
- });
6648
-
6649
- // ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/transport.js
6650
- var require_transport = __commonJS({
6651
- "../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/transport.js"(exports, module) {
6652
- "use strict";
6653
- var { createRequire } = __require("module");
6654
- var { existsSync: existsSync3 } = __require("node:fs");
6655
- var getCallers = require_caller();
6656
- var { join: join2, isAbsolute, sep } = __require("node:path");
6657
- var { fileURLToPath: fileURLToPath3 } = __require("node:url");
6658
- var sleep3 = require_atomic_sleep();
6659
- var onExit2 = require_on_exit_leak_free();
6660
- var ThreadStream = require_thread_stream();
6661
- function setupOnExit(stream) {
6662
- onExit2.register(stream, autoEnd);
6663
- onExit2.registerBeforeExit(stream, flush);
6664
- stream.on("close", function() {
6665
- onExit2.unregister(stream);
6666
- });
6667
- }
6668
- function hasPreloadFlags() {
6669
- const execArgv = process.execArgv;
6670
- for (let i = 0; i < execArgv.length; i++) {
6671
- const arg = execArgv[i];
6672
- if (arg === "--import" || arg === "--require" || arg === "-r") {
6673
- return true;
6674
- }
6675
- if (arg.startsWith("--import=") || arg.startsWith("--require=") || arg.startsWith("-r=")) {
6676
- return true;
6677
- }
6678
- }
6679
- return false;
6680
- }
6681
- function sanitizeNodeOptions(nodeOptions) {
6682
- const tokens = nodeOptions.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);
6683
- if (!tokens) {
6684
- return nodeOptions;
6685
- }
6686
- const sanitized = [];
6687
- let changed = false;
6688
- for (let i = 0; i < tokens.length; i++) {
6689
- const token = tokens[i];
6690
- if (token === "--require" || token === "-r" || token === "--import") {
6691
- const next = tokens[i + 1];
6692
- if (next && shouldDropPreload(next)) {
6693
- changed = true;
6694
- i++;
6695
- continue;
6696
- }
6697
- sanitized.push(token);
6698
- if (next) {
6699
- sanitized.push(next);
6700
- i++;
6701
- }
6702
- continue;
6703
- }
6704
- if (token.startsWith("--require=") || token.startsWith("-r=") || token.startsWith("--import=")) {
6705
- const value = token.slice(token.indexOf("=") + 1);
6706
- if (shouldDropPreload(value)) {
6707
- changed = true;
6708
- continue;
6709
- }
6710
- }
6711
- sanitized.push(token);
6712
- }
6713
- return changed ? sanitized.join(" ") : nodeOptions;
6714
- }
6715
- function shouldDropPreload(value) {
6716
- const unquoted = stripQuotes(value);
6717
- if (!unquoted) {
6718
- return false;
6719
- }
6720
- let path4 = unquoted;
6721
- if (path4.startsWith("file://")) {
6722
- try {
6723
- path4 = fileURLToPath3(path4);
6724
- } catch {
6725
- return false;
6726
- }
6727
- }
6728
- return isAbsolute(path4) && !existsSync3(path4);
6729
- }
6730
- function stripQuotes(value) {
6731
- const first = value[0];
6732
- const last = value[value.length - 1];
6733
- if (first === '"' && last === '"' || first === "'" && last === "'") {
6734
- return value.slice(1, -1);
6735
- }
6736
- return value;
6737
- }
6738
- function buildStream(filename, workerData, workerOpts, sync, name) {
6739
- if (!workerOpts.execArgv && hasPreloadFlags() && __require.main === void 0) {
6740
- workerOpts = {
6741
- ...workerOpts,
6742
- execArgv: []
6743
- };
6744
- }
6745
- if (!workerOpts.env && process.env.NODE_OPTIONS) {
6746
- const nodeOptions = sanitizeNodeOptions(process.env.NODE_OPTIONS);
6747
- if (nodeOptions !== process.env.NODE_OPTIONS) {
6748
- workerOpts = {
6749
- ...workerOpts,
6750
- env: {
6751
- ...process.env,
6752
- NODE_OPTIONS: nodeOptions
6753
- }
6754
- };
6755
- }
6756
- }
6757
- workerOpts = { ...workerOpts, name };
6758
- const stream = new ThreadStream({
6759
- filename,
6760
- workerData,
6761
- workerOpts,
6762
- sync
6763
- });
6764
- stream.on("ready", onReady);
6765
- stream.on("close", function() {
6766
- process.removeListener("exit", onExit3);
6767
- });
6768
- process.on("exit", onExit3);
6769
- function onReady() {
6770
- process.removeListener("exit", onExit3);
6771
- stream.unref();
6772
- if (workerOpts.autoEnd !== false) {
6773
- setupOnExit(stream);
6774
- }
6775
- }
6776
- function onExit3() {
6777
- if (stream.closed) {
6778
- return;
6779
- }
6780
- stream.flushSync();
6781
- sleep3(100);
6782
- stream.end();
6783
- }
6784
- return stream;
6785
- }
6786
- function autoEnd(stream) {
6787
- stream.ref();
6788
- stream.flushSync();
6789
- stream.end();
6790
- stream.once("close", function() {
6791
- stream.unref();
6792
- });
6793
- }
6794
- function flush(stream) {
6795
- stream.flushSync();
6796
- }
6797
- function transport(fullOptions) {
6798
- const { pipeline, targets, levels, dedupe, worker = {}, caller = getCallers(), sync = false } = fullOptions;
6799
- const options = {
6800
- ...fullOptions.options
6801
- };
6802
- const callers = typeof caller === "string" ? [caller] : caller;
6803
- const bundlerOverrides = typeof globalThis === "object" && Object.prototype.hasOwnProperty.call(globalThis, "__bundlerPathsOverrides") && globalThis.__bundlerPathsOverrides && typeof globalThis.__bundlerPathsOverrides === "object" ? globalThis.__bundlerPathsOverrides : /* @__PURE__ */ Object.create(null);
6804
- let target = fullOptions.target;
6805
- if (target && targets) {
6806
- throw new Error("only one of target or targets can be specified");
6807
- }
6808
- if (targets) {
6809
- target = bundlerOverrides["pino-worker"] || join2(__dirname, "worker.js");
6810
- options.targets = targets.filter((dest) => dest.target).map((dest) => {
6811
- return {
6812
- ...dest,
6813
- target: fixTarget(dest.target)
6814
- };
6815
- });
6816
- options.pipelines = targets.filter((dest) => dest.pipeline).map((dest) => {
6817
- return dest.pipeline.map((t) => {
6818
- return {
6819
- ...t,
6820
- level: dest.level,
6821
- // duplicate the pipeline `level` property defined in the upper level
6822
- target: fixTarget(t.target)
6823
- };
6824
- });
6825
- });
6826
- } else if (pipeline) {
6827
- target = bundlerOverrides["pino-worker"] || join2(__dirname, "worker.js");
6828
- options.pipelines = [pipeline.map((dest) => {
6829
- return {
6830
- ...dest,
6831
- target: fixTarget(dest.target)
6832
- };
6833
- })];
6834
- }
6835
- if (levels) {
6836
- options.levels = levels;
6837
- }
6838
- if (dedupe) {
6839
- options.dedupe = dedupe;
6840
- }
6841
- options.pinoWillSendConfig = true;
6842
- const name = targets || pipeline ? "pino.transport" : target;
6843
- return buildStream(fixTarget(target), options, worker, sync, name);
6844
- function fixTarget(origin) {
6845
- origin = bundlerOverrides[origin] || origin;
6846
- if (isAbsolute(origin) || origin.indexOf("file://") === 0) {
6847
- return origin;
6848
- }
6849
- if (origin === "pino/file") {
6850
- return join2(__dirname, "..", "file.js");
6851
- }
6852
- let fixTarget2;
6853
- for (const filePath of callers) {
6854
- try {
6855
- const context = filePath === "node:repl" ? process.cwd() + sep : filePath;
6856
- fixTarget2 = createRequire(context).resolve(origin);
6857
- break;
6858
- } catch (err) {
6859
- continue;
6860
- }
6861
- }
6862
- if (!fixTarget2) {
6863
- throw new Error(`unable to determine transport target for "${origin}"`);
6864
- }
6865
- return fixTarget2;
6866
- }
6867
- }
6868
- module.exports = transport;
6869
- }
6870
- });
6871
-
6872
- // ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/tools.js
6873
- var require_tools = __commonJS({
6874
- "../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/tools.js"(exports, module) {
6875
- "use strict";
6876
- var diagChan = __require("node:diagnostics_channel");
6877
- var format2 = require_quick_format_unescaped();
6878
- var { mapHttpRequest, mapHttpResponse } = require_pino_std_serializers();
6879
- var SonicBoom = require_sonic_boom();
6880
- var onExit2 = require_on_exit_leak_free();
6881
- var {
6882
- lsCacheSym,
6883
- chindingsSym,
6884
- writeSym,
6885
- serializersSym,
6886
- formatOptsSym,
6887
- endSym,
6888
- stringifiersSym,
6889
- stringifySym,
6890
- stringifySafeSym,
6891
- wildcardFirstSym,
6892
- nestedKeySym,
6893
- formattersSym,
6894
- messageKeySym,
6895
- errorKeySym,
6896
- nestedKeyStrSym,
6897
- msgPrefixSym
6898
- } = require_symbols();
6899
- var { isMainThread } = __require("worker_threads");
6900
- var transport = require_transport();
6901
- var [nodeMajor] = process.versions.node.split(".").map((v) => Number(v));
6902
- var asJsonChan = diagChan.tracingChannel("pino_asJson");
6903
- var asString = nodeMajor >= 25 ? (str2) => JSON.stringify(str2) : _asString;
6904
- function noop2() {
6905
- }
6906
- function genLog(level, hook) {
6907
- if (!hook) return LOG;
6908
- return function hookWrappedLog(...args) {
6909
- hook.call(this, args, LOG, level);
6910
- };
6911
- function LOG(o, ...n) {
6912
- if (typeof o === "object") {
6913
- let msg = o;
6914
- if (o !== null) {
6915
- if (o.method && o.headers && o.socket) {
6916
- o = mapHttpRequest(o);
6917
- } else if (typeof o.setHeader === "function") {
6918
- o = mapHttpResponse(o);
6919
- }
6920
- }
6921
- let formatParams;
6922
- if (msg === null && n.length === 0) {
6923
- formatParams = [null];
6924
- } else {
6925
- msg = n.shift();
6926
- formatParams = n;
6927
- }
6928
- if (typeof this[msgPrefixSym] === "string" && msg !== void 0 && msg !== null) {
6929
- msg = this[msgPrefixSym] + msg;
6930
- }
6931
- this[writeSym](o, format2(msg, formatParams, this[formatOptsSym]), level);
6932
- } else {
6933
- let msg = o === void 0 ? n.shift() : o;
6934
- if (typeof this[msgPrefixSym] === "string" && msg !== void 0 && msg !== null) {
6935
- msg = this[msgPrefixSym] + msg;
6936
- }
6937
- this[writeSym](null, format2(msg, n, this[formatOptsSym]), level);
6938
- }
6939
- }
6940
- }
6941
- function _asString(str2) {
6942
- let result = "";
6943
- let last = 0;
6944
- let found = false;
6945
- let point = 255;
6946
- const l = str2.length;
6947
- if (l > 100) {
6948
- return JSON.stringify(str2);
6949
- }
6950
- for (var i = 0; i < l && point >= 32; i++) {
6951
- point = str2.charCodeAt(i);
6952
- if (point === 34 || point === 92) {
6953
- result += str2.slice(last, i) + "\\";
6954
- last = i;
6955
- found = true;
6956
- }
6957
- }
6958
- if (!found) {
6959
- result = str2;
6960
- } else {
6961
- result += str2.slice(last);
6962
- }
6963
- return point < 32 ? JSON.stringify(str2) : '"' + result + '"';
6964
- }
6965
- function asJson(obj, msg, num, time3) {
6966
- if (asJsonChan.hasSubscribers === false) {
6967
- return _asJson.call(this, obj, msg, num, time3);
6968
- }
6969
- const store = { instance: this, arguments };
6970
- return asJsonChan.traceSync(_asJson, store, this, obj, msg, num, time3);
6971
- }
6972
- function _asJson(obj, msg, num, time3) {
6973
- const stringify3 = this[stringifySym];
6974
- const stringifySafe = this[stringifySafeSym];
6975
- const stringifiers = this[stringifiersSym];
6976
- const end = this[endSym];
6977
- const chindings = this[chindingsSym];
6978
- const serializers = this[serializersSym];
6979
- const formatters2 = this[formattersSym];
6980
- const messageKey = this[messageKeySym];
6981
- const errorKey = this[errorKeySym];
6982
- let data = this[lsCacheSym][num] + time3;
6983
- data = data + chindings;
6984
- let value;
6985
- if (formatters2.log) {
6986
- obj = formatters2.log(obj);
6987
- }
6988
- const wildcardStringifier = stringifiers[wildcardFirstSym];
6989
- let propStr = "";
6990
- for (const key in obj) {
6991
- value = obj[key];
6992
- if (Object.prototype.hasOwnProperty.call(obj, key) && value !== void 0) {
6993
- if (serializers[key]) {
6994
- value = serializers[key](value);
6995
- } else if (key === errorKey && serializers.err) {
6996
- value = serializers.err(value);
6997
- }
6998
- const stringifier = stringifiers[key] || wildcardStringifier;
6999
- switch (typeof value) {
7000
- case "undefined":
7001
- case "function":
7002
- continue;
7003
- case "number":
7004
- if (Number.isFinite(value) === false) {
7005
- value = null;
7006
- }
7007
- // this case explicitly falls through to the next one
7008
- case "boolean":
7009
- if (stringifier) value = stringifier(value);
7010
- break;
7011
- case "string":
7012
- value = (stringifier || asString)(value);
7013
- break;
7014
- default:
7015
- value = (stringifier || stringify3)(value, stringifySafe);
7016
- }
7017
- if (value === void 0) continue;
7018
- const strKey = asString(key);
7019
- propStr += "," + strKey + ":" + value;
7020
- }
7021
- }
7022
- let msgStr = "";
7023
- if (msg !== void 0) {
7024
- value = serializers[messageKey] ? serializers[messageKey](msg) : msg;
7025
- const stringifier = stringifiers[messageKey] || wildcardStringifier;
7026
- switch (typeof value) {
7027
- case "function":
7028
- break;
7029
- case "number":
7030
- if (Number.isFinite(value) === false) {
7031
- value = null;
7032
- }
7033
- // this case explicitly falls through to the next one
7034
- case "boolean":
7035
- if (stringifier) value = stringifier(value);
7036
- msgStr = ',"' + messageKey + '":' + value;
7037
- break;
7038
- case "string":
7039
- value = (stringifier || asString)(value);
7040
- msgStr = ',"' + messageKey + '":' + value;
7041
- break;
7042
- default:
7043
- value = (stringifier || stringify3)(value, stringifySafe);
7044
- msgStr = ',"' + messageKey + '":' + value;
7045
- }
7046
- }
7047
- if (this[nestedKeySym] && propStr) {
7048
- return data + this[nestedKeyStrSym] + propStr.slice(1) + "}" + msgStr + end;
7049
- } else {
7050
- return data + propStr + msgStr + end;
7051
- }
7052
- }
7053
- function asChindings(instance, bindings) {
7054
- let value;
7055
- let data = instance[chindingsSym];
7056
- const stringify3 = instance[stringifySym];
7057
- const stringifySafe = instance[stringifySafeSym];
7058
- const stringifiers = instance[stringifiersSym];
7059
- const wildcardStringifier = stringifiers[wildcardFirstSym];
7060
- const serializers = instance[serializersSym];
7061
- const formatter = instance[formattersSym].bindings;
7062
- bindings = formatter(bindings);
7063
- for (const key in bindings) {
7064
- value = bindings[key];
7065
- const valid = (key.length < 5 || key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels") && bindings.hasOwnProperty(key) && value !== void 0;
7066
- if (valid === true) {
7067
- value = serializers[key] ? serializers[key](value) : value;
7068
- value = (stringifiers[key] || wildcardStringifier || stringify3)(value, stringifySafe);
7069
- if (value === void 0) continue;
7070
- data += ',"' + key + '":' + value;
7071
- }
7072
- }
7073
- return data;
7074
- }
7075
- function hasBeenTampered(stream) {
7076
- return stream.write !== stream.constructor.prototype.write;
7077
- }
7078
- function buildSafeSonicBoom(opts) {
7079
- const stream = new SonicBoom(opts);
7080
- stream.on("error", filterBrokenPipe);
7081
- if (!opts.sync && isMainThread) {
7082
- onExit2.register(stream, autoEnd);
7083
- stream.on("close", function() {
7084
- onExit2.unregister(stream);
7085
- });
7086
- }
7087
- return stream;
7088
- function filterBrokenPipe(err) {
7089
- if (err.code === "EPIPE") {
7090
- stream.write = noop2;
7091
- stream.end = noop2;
7092
- stream.flushSync = noop2;
7093
- stream.destroy = noop2;
7094
- return;
7095
- }
7096
- stream.removeListener("error", filterBrokenPipe);
7097
- stream.emit("error", err);
7098
- }
7099
- }
7100
- function autoEnd(stream, eventName) {
7101
- if (stream.destroyed) {
7102
- return;
7103
- }
7104
- if (eventName === "beforeExit") {
7105
- stream.flush();
7106
- stream.on("drain", function() {
7107
- stream.end();
7108
- });
7109
- } else {
7110
- stream.flushSync();
7111
- }
7112
- }
7113
- function createArgsNormalizer(defaultOptions) {
7114
- return function normalizeArgs(instance, caller, opts = {}, stream) {
7115
- if (typeof opts === "string") {
7116
- stream = buildSafeSonicBoom({ dest: opts });
7117
- opts = {};
7118
- } else if (typeof stream === "string") {
7119
- if (opts && opts.transport) {
7120
- throw Error("only one of option.transport or stream can be specified");
7121
- }
7122
- stream = buildSafeSonicBoom({ dest: stream });
7123
- } else if (opts instanceof SonicBoom || opts.writable || opts._writableState) {
7124
- stream = opts;
7125
- opts = {};
7126
- } else if (opts.transport) {
7127
- if (opts.transport instanceof SonicBoom || opts.transport.writable || opts.transport._writableState) {
7128
- throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");
7129
- }
7130
- if (opts.transport.targets && opts.transport.targets.length && opts.formatters && typeof opts.formatters.level === "function") {
7131
- throw Error("option.transport.targets do not allow custom level formatters");
7132
- }
7133
- let customLevels;
7134
- if (opts.customLevels) {
7135
- customLevels = opts.useOnlyCustomLevels ? opts.customLevels : Object.assign({}, opts.levels, opts.customLevels);
7136
- }
7137
- stream = transport({ caller, ...opts.transport, levels: customLevels });
7138
- }
7139
- opts = Object.assign({}, defaultOptions, opts);
7140
- opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers);
7141
- opts.formatters = Object.assign({}, defaultOptions.formatters, opts.formatters);
7142
- if (opts.prettyPrint) {
7143
- throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");
7144
- }
7145
- const { enabled, onChild } = opts;
7146
- if (enabled === false) opts.level = "silent";
7147
- if (!onChild) opts.onChild = noop2;
7148
- if (!stream) {
7149
- if (!hasBeenTampered(process.stdout)) {
7150
- stream = buildSafeSonicBoom({ fd: process.stdout.fd || 1 });
7151
- } else {
7152
- stream = process.stdout;
7153
- }
7154
- }
7155
- return { opts, stream };
7156
- };
7157
- }
7158
- function stringify2(obj, stringifySafeFn) {
7159
- try {
7160
- return JSON.stringify(obj);
7161
- } catch (_) {
7162
- try {
7163
- const stringify3 = stringifySafeFn || this[stringifySafeSym];
7164
- return stringify3(obj);
7165
- } catch (_2) {
7166
- return '"[unable to serialize, circular reference is too complex to analyze]"';
7167
- }
7168
- }
7169
- }
7170
- function buildFormatters(level, bindings, log) {
7171
- return {
7172
- level,
7173
- bindings,
7174
- log
7175
- };
7176
- }
7177
- function normalizeDestFileDescriptor(destination) {
7178
- const fd = Number(destination);
7179
- if (typeof destination === "string" && Number.isFinite(fd)) {
7180
- return fd;
7181
- }
7182
- if (destination === void 0) {
7183
- return 1;
7184
- }
7185
- return destination;
7186
- }
7187
- module.exports = {
7188
- noop: noop2,
7189
- buildSafeSonicBoom,
7190
- asChindings,
7191
- asJson,
7192
- genLog,
7193
- createArgsNormalizer,
7194
- stringify: stringify2,
7195
- buildFormatters,
7196
- normalizeDestFileDescriptor
7197
- };
7198
- }
7199
- });
7200
-
7201
- // ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/constants.js
7202
- var require_constants = __commonJS({
7203
- "../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/constants.js"(exports, module) {
7204
- var DEFAULT_LEVELS = {
7205
- trace: 10,
7206
- debug: 20,
7207
- info: 30,
7208
- warn: 40,
7209
- error: 50,
7210
- fatal: 60
7211
- };
7212
- var SORTING_ORDER = {
7213
- ASC: "ASC",
7214
- DESC: "DESC"
7215
- };
7216
- module.exports = {
7217
- DEFAULT_LEVELS,
7218
- SORTING_ORDER
7219
- };
7220
- }
7221
- });
7222
-
7223
- // ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/levels.js
7224
- var require_levels = __commonJS({
7225
- "../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/levels.js"(exports, module) {
7226
- "use strict";
7227
- var {
7228
- lsCacheSym,
7229
- levelValSym,
7230
- useOnlyCustomLevelsSym,
7231
- streamSym,
7232
- formattersSym,
7233
- hooksSym,
7234
- levelCompSym
7235
- } = require_symbols();
7236
- var { noop: noop2, genLog } = require_tools();
7237
- var { DEFAULT_LEVELS, SORTING_ORDER } = require_constants();
7238
- var levelMethods = {
7239
- fatal: (hook) => {
7240
- const logFatal = genLog(DEFAULT_LEVELS.fatal, hook);
7241
- return function(...args) {
7242
- const stream = this[streamSym];
7243
- logFatal.call(this, ...args);
7244
- if (typeof stream.flushSync === "function") {
7245
- try {
7246
- stream.flushSync();
7247
- } catch (e) {
7248
- }
7249
- }
7250
- };
7251
- },
7252
- error: (hook) => genLog(DEFAULT_LEVELS.error, hook),
7253
- warn: (hook) => genLog(DEFAULT_LEVELS.warn, hook),
7254
- info: (hook) => genLog(DEFAULT_LEVELS.info, hook),
7255
- debug: (hook) => genLog(DEFAULT_LEVELS.debug, hook),
7256
- trace: (hook) => genLog(DEFAULT_LEVELS.trace, hook)
7257
- };
7258
- var nums = Object.keys(DEFAULT_LEVELS).reduce((o, k) => {
7259
- o[DEFAULT_LEVELS[k]] = k;
7260
- return o;
7261
- }, {});
7262
- var initialLsCache = Object.keys(nums).reduce((o, k) => {
7263
- o[k] = '{"level":' + Number(k);
7264
- return o;
7265
- }, {});
7266
- function genLsCache(instance) {
7267
- const formatter = instance[formattersSym].level;
7268
- const { labels } = instance.levels;
7269
- const cache = {};
7270
- for (const label in labels) {
7271
- const level = formatter(labels[label], Number(label));
7272
- cache[label] = JSON.stringify(level).slice(0, -1);
7273
- }
7274
- instance[lsCacheSym] = cache;
7275
- return instance;
7276
- }
7277
- function isStandardLevel(level, useOnlyCustomLevels) {
7278
- if (useOnlyCustomLevels) {
7279
- return false;
7280
- }
7281
- switch (level) {
7282
- case "fatal":
7283
- case "error":
7284
- case "warn":
7285
- case "info":
7286
- case "debug":
7287
- case "trace":
7288
- return true;
7289
- default:
7290
- return false;
7291
- }
7292
- }
7293
- function setLevel(level) {
7294
- const { labels, values } = this.levels;
7295
- if (typeof level === "number") {
7296
- if (labels[level] === void 0) throw Error("unknown level value" + level);
7297
- level = labels[level];
7298
- }
7299
- if (values[level] === void 0) throw Error("unknown level " + level);
7300
- const preLevelVal = this[levelValSym];
7301
- const levelVal = this[levelValSym] = values[level];
7302
- const useOnlyCustomLevelsVal = this[useOnlyCustomLevelsSym];
7303
- const levelComparison = this[levelCompSym];
7304
- const hook = this[hooksSym].logMethod;
7305
- for (const key in values) {
7306
- if (levelComparison(values[key], levelVal) === false) {
7307
- this[key] = noop2;
7308
- continue;
7309
- }
7310
- this[key] = isStandardLevel(key, useOnlyCustomLevelsVal) ? levelMethods[key](hook) : genLog(values[key], hook);
7311
- }
7312
- this.emit(
7313
- "level-change",
7314
- level,
7315
- levelVal,
7316
- labels[preLevelVal],
7317
- preLevelVal,
7318
- this
7319
- );
7320
- }
7321
- function getLevel(level) {
7322
- const { levels, levelVal } = this;
7323
- return levels && levels.labels ? levels.labels[levelVal] : "";
7324
- }
7325
- function isLevelEnabled(logLevel) {
7326
- const { values } = this.levels;
7327
- const logLevelVal = values[logLevel];
7328
- return logLevelVal !== void 0 && this[levelCompSym](logLevelVal, this[levelValSym]);
7329
- }
7330
- function compareLevel(direction, current, expected) {
7331
- if (direction === SORTING_ORDER.DESC) {
7332
- return current <= expected;
7333
- }
7334
- return current >= expected;
7335
- }
7336
- function genLevelComparison(levelComparison) {
7337
- if (typeof levelComparison === "string") {
7338
- return compareLevel.bind(null, levelComparison);
7339
- }
7340
- return levelComparison;
7341
- }
7342
- function mappings(customLevels = null, useOnlyCustomLevels = false) {
7343
- const customNums = customLevels ? Object.keys(customLevels).reduce((o, k) => {
7344
- o[customLevels[k]] = k;
7345
- return o;
7346
- }, {}) : null;
7347
- const labels = Object.assign(
7348
- Object.create(Object.prototype, { Infinity: { value: "silent" } }),
7349
- useOnlyCustomLevels ? null : nums,
7350
- customNums
7351
- );
7352
- const values = Object.assign(
7353
- Object.create(Object.prototype, { silent: { value: Infinity } }),
7354
- useOnlyCustomLevels ? null : DEFAULT_LEVELS,
7355
- customLevels
7356
- );
7357
- return { labels, values };
7358
- }
7359
- function assertDefaultLevelFound(defaultLevel, customLevels, useOnlyCustomLevels) {
7360
- if (typeof defaultLevel === "number") {
7361
- const values = [].concat(
7362
- Object.keys(customLevels || {}).map((key) => customLevels[key]),
7363
- useOnlyCustomLevels ? [] : Object.keys(nums).map((level) => +level),
7364
- Infinity
7365
- );
7366
- if (!values.includes(defaultLevel)) {
7367
- throw Error(`default level:${defaultLevel} must be included in custom levels`);
7368
- }
7369
- return;
7370
- }
7371
- const labels = Object.assign(
7372
- Object.create(Object.prototype, { silent: { value: Infinity } }),
7373
- useOnlyCustomLevels ? null : DEFAULT_LEVELS,
7374
- customLevels
7375
- );
7376
- if (!(defaultLevel in labels)) {
7377
- throw Error(`default level:${defaultLevel} must be included in custom levels`);
7378
- }
7379
- }
7380
- function assertNoLevelCollisions(levels, customLevels) {
7381
- const { labels, values } = levels;
7382
- for (const k in customLevels) {
7383
- if (k in values) {
7384
- throw Error("levels cannot be overridden");
7385
- }
7386
- if (customLevels[k] in labels) {
7387
- throw Error("pre-existing level values cannot be used for new levels");
7388
- }
7389
- }
7390
- }
7391
- function assertLevelComparison(levelComparison) {
7392
- if (typeof levelComparison === "function") {
7393
- return;
7394
- }
7395
- if (typeof levelComparison === "string" && Object.values(SORTING_ORDER).includes(levelComparison)) {
7396
- return;
7397
- }
7398
- throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type');
7399
- }
7400
- module.exports = {
7401
- initialLsCache,
7402
- genLsCache,
7403
- levelMethods,
7404
- getLevel,
7405
- setLevel,
7406
- isLevelEnabled,
7407
- mappings,
7408
- assertNoLevelCollisions,
7409
- assertDefaultLevelFound,
7410
- genLevelComparison,
7411
- assertLevelComparison
7412
- };
7413
- }
7414
- });
7415
-
7416
- // ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/meta.js
7417
- var require_meta = __commonJS({
7418
- "../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/meta.js"(exports, module) {
7419
- "use strict";
7420
- module.exports = { version: "10.3.1" };
7421
- }
7422
- });
7423
-
7424
- // ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/proto.js
7425
- var require_proto = __commonJS({
7426
- "../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/proto.js"(exports, module) {
7427
- "use strict";
7428
- var { EventEmitter } = __require("node:events");
7429
- var {
7430
- lsCacheSym,
7431
- levelValSym,
7432
- setLevelSym,
7433
- getLevelSym,
7434
- chindingsSym,
7435
- mixinSym,
7436
- asJsonSym,
7437
- writeSym,
7438
- mixinMergeStrategySym,
7439
- timeSym,
7440
- timeSliceIndexSym,
7441
- streamSym,
7442
- serializersSym,
7443
- formattersSym,
7444
- errorKeySym,
7445
- messageKeySym,
7446
- useOnlyCustomLevelsSym,
7447
- needsMetadataGsym,
7448
- redactFmtSym,
7449
- stringifySym,
7450
- formatOptsSym,
7451
- stringifiersSym,
7452
- msgPrefixSym,
7453
- hooksSym
7454
- } = require_symbols();
7455
- var {
7456
- getLevel,
7457
- setLevel,
7458
- isLevelEnabled,
7459
- mappings,
7460
- initialLsCache,
7461
- genLsCache,
7462
- assertNoLevelCollisions
7463
- } = require_levels();
7464
- var {
7465
- asChindings,
7466
- asJson,
7467
- buildFormatters,
7468
- stringify: stringify2,
7469
- noop: noop2
7470
- } = require_tools();
7471
- var {
7472
- version: version2
7473
- } = require_meta();
7474
- var redaction = require_redaction();
7475
- var constructor = class Pino {
7476
- };
7477
- var prototype = {
7478
- constructor,
7479
- child,
7480
- bindings,
7481
- setBindings,
7482
- flush,
7483
- isLevelEnabled,
7484
- version: version2,
7485
- get level() {
7486
- return this[getLevelSym]();
7487
- },
7488
- set level(lvl) {
7489
- this[setLevelSym](lvl);
7490
- },
7491
- get levelVal() {
7492
- return this[levelValSym];
7493
- },
7494
- set levelVal(n) {
7495
- throw Error("levelVal is read-only");
7496
- },
7497
- get msgPrefix() {
7498
- return this[msgPrefixSym];
7499
- },
7500
- get [Symbol.toStringTag]() {
7501
- return "Pino";
7502
- },
7503
- [lsCacheSym]: initialLsCache,
7504
- [writeSym]: write,
7505
- [asJsonSym]: asJson,
7506
- [getLevelSym]: getLevel,
7507
- [setLevelSym]: setLevel
7508
- };
7509
- Object.setPrototypeOf(prototype, EventEmitter.prototype);
7510
- module.exports = function() {
7511
- return Object.create(prototype);
7512
- };
7513
- var resetChildingsFormatter = (bindings2) => bindings2;
7514
- function child(bindings2, options) {
7515
- if (!bindings2) {
7516
- throw Error("missing bindings for child Pino");
7517
- }
7518
- const serializers = this[serializersSym];
7519
- const formatters2 = this[formattersSym];
7520
- const instance = Object.create(this);
7521
- if (options == null) {
7522
- if (instance[formattersSym].bindings !== resetChildingsFormatter) {
7523
- instance[formattersSym] = buildFormatters(
7524
- formatters2.level,
7525
- resetChildingsFormatter,
7526
- formatters2.log
7527
- );
7528
- }
7529
- instance[chindingsSym] = asChindings(instance, bindings2);
7530
- if (this.onChild !== noop2) {
7531
- this.onChild(instance);
7532
- }
7533
- return instance;
7534
- }
7535
- if (options.hasOwnProperty("serializers") === true) {
7536
- instance[serializersSym] = /* @__PURE__ */ Object.create(null);
7537
- for (const k in serializers) {
7538
- instance[serializersSym][k] = serializers[k];
7539
- }
7540
- const parentSymbols = Object.getOwnPropertySymbols(serializers);
7541
- for (var i = 0; i < parentSymbols.length; i++) {
7542
- const ks = parentSymbols[i];
7543
- instance[serializersSym][ks] = serializers[ks];
7544
- }
7545
- for (const bk in options.serializers) {
7546
- instance[serializersSym][bk] = options.serializers[bk];
7547
- }
7548
- const bindingsSymbols = Object.getOwnPropertySymbols(options.serializers);
7549
- for (var bi = 0; bi < bindingsSymbols.length; bi++) {
7550
- const bks = bindingsSymbols[bi];
7551
- instance[serializersSym][bks] = options.serializers[bks];
7552
- }
7553
- } else instance[serializersSym] = serializers;
7554
- if (options.hasOwnProperty("formatters")) {
7555
- const { level, bindings: chindings, log } = options.formatters;
7556
- instance[formattersSym] = buildFormatters(
7557
- level || formatters2.level,
7558
- chindings || resetChildingsFormatter,
7559
- log || formatters2.log
7560
- );
7561
- } else {
7562
- instance[formattersSym] = buildFormatters(
7563
- formatters2.level,
7564
- resetChildingsFormatter,
7565
- formatters2.log
7566
- );
7567
- }
7568
- if (options.hasOwnProperty("customLevels") === true) {
7569
- assertNoLevelCollisions(this.levels, options.customLevels);
7570
- instance.levels = mappings(options.customLevels, instance[useOnlyCustomLevelsSym]);
7571
- genLsCache(instance);
7572
- }
7573
- if (typeof options.redact === "object" && options.redact !== null || Array.isArray(options.redact)) {
7574
- instance.redact = options.redact;
7575
- const stringifiers = redaction(instance.redact, stringify2);
7576
- const formatOpts = { stringify: stringifiers[redactFmtSym] };
7577
- instance[stringifySym] = stringify2;
7578
- instance[stringifiersSym] = stringifiers;
7579
- instance[formatOptsSym] = formatOpts;
7580
- }
7581
- if (typeof options.msgPrefix === "string") {
7582
- instance[msgPrefixSym] = (this[msgPrefixSym] || "") + options.msgPrefix;
7583
- }
7584
- instance[chindingsSym] = asChindings(instance, bindings2);
7585
- if (options.level !== void 0 && options.level !== this.level || options.hasOwnProperty("customLevels")) {
7586
- const childLevel = options.level || this.level;
7587
- instance[setLevelSym](childLevel);
7588
- }
7589
- this.onChild(instance);
7590
- return instance;
7591
- }
7592
- function bindings() {
7593
- const chindings = this[chindingsSym];
7594
- const chindingsJson = `{${chindings.substr(1)}}`;
7595
- const bindingsFromJson = JSON.parse(chindingsJson);
7596
- delete bindingsFromJson.pid;
7597
- delete bindingsFromJson.hostname;
7598
- return bindingsFromJson;
7599
- }
7600
- function setBindings(newBindings) {
7601
- const chindings = asChindings(this, newBindings);
7602
- this[chindingsSym] = chindings;
7603
- }
7604
- function defaultMixinMergeStrategy(mergeObject, mixinObject) {
7605
- return Object.assign(mixinObject, mergeObject);
7606
- }
7607
- function write(_obj, msg, num) {
7608
- const t = this[timeSym]();
7609
- const mixin = this[mixinSym];
7610
- const errorKey = this[errorKeySym];
7611
- const messageKey = this[messageKeySym];
7612
- const mixinMergeStrategy = this[mixinMergeStrategySym] || defaultMixinMergeStrategy;
7613
- let obj;
7614
- const streamWriteHook = this[hooksSym].streamWrite;
7615
- if (_obj === void 0 || _obj === null) {
7616
- obj = {};
7617
- } else if (_obj instanceof Error) {
7618
- obj = { [errorKey]: _obj };
7619
- if (msg === void 0) {
7620
- msg = _obj.message;
7621
- }
7622
- } else {
7623
- obj = _obj;
7624
- if (msg === void 0 && _obj[messageKey] === void 0 && _obj[errorKey]) {
7625
- msg = _obj[errorKey].message;
7626
- }
7627
- }
7628
- if (mixin) {
7629
- obj = mixinMergeStrategy(obj, mixin(obj, num, this));
7630
- }
7631
- const s = this[asJsonSym](obj, msg, num, t);
7632
- const stream = this[streamSym];
7633
- if (stream[needsMetadataGsym] === true) {
7634
- stream.lastLevel = num;
7635
- stream.lastObj = obj;
7636
- stream.lastMsg = msg;
7637
- stream.lastTime = t.slice(this[timeSliceIndexSym]);
7638
- stream.lastLogger = this;
7639
- }
7640
- stream.write(streamWriteHook ? streamWriteHook(s) : s);
7641
- }
7642
- function flush(cb) {
7643
- if (cb != null && typeof cb !== "function") {
7644
- throw Error("callback must be a function");
7645
- }
7646
- const stream = this[streamSym];
7647
- if (typeof stream.flush === "function") {
7648
- stream.flush(cb || noop2);
7649
- } else if (cb) cb();
7650
- }
7651
- }
7652
- });
7653
-
7654
- // ../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js
7655
- var require_safe_stable_stringify = __commonJS({
7656
- "../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js"(exports, module) {
7657
- "use strict";
7658
- var { hasOwnProperty } = Object.prototype;
7659
- var stringify2 = configure();
7660
- stringify2.configure = configure;
7661
- stringify2.stringify = stringify2;
7662
- stringify2.default = stringify2;
7663
- exports.stringify = stringify2;
7664
- exports.configure = configure;
7665
- module.exports = stringify2;
7666
- var strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;
7667
- function strEscape(str2) {
7668
- if (str2.length < 5e3 && !strEscapeSequencesRegExp.test(str2)) {
7669
- return `"${str2}"`;
7670
- }
7671
- return JSON.stringify(str2);
7672
- }
7673
- function sort(array2, comparator) {
7674
- if (array2.length > 200 || comparator) {
7675
- return array2.sort(comparator);
7676
- }
7677
- for (let i = 1; i < array2.length; i++) {
7678
- const currentValue = array2[i];
7679
- let position = i;
7680
- while (position !== 0 && array2[position - 1] > currentValue) {
7681
- array2[position] = array2[position - 1];
7682
- position--;
7683
- }
7684
- array2[position] = currentValue;
7685
- }
7686
- return array2;
7687
- }
7688
- var typedArrayPrototypeGetSymbolToStringTag = Object.getOwnPropertyDescriptor(
7689
- Object.getPrototypeOf(
7690
- Object.getPrototypeOf(
7691
- new Int8Array()
7692
- )
7693
- ),
7694
- Symbol.toStringTag
7695
- ).get;
7696
- function isTypedArrayWithEntries(value) {
7697
- return typedArrayPrototypeGetSymbolToStringTag.call(value) !== void 0 && value.length !== 0;
7698
- }
7699
- function stringifyTypedArray(array2, separator, maximumBreadth) {
7700
- if (array2.length < maximumBreadth) {
7701
- maximumBreadth = array2.length;
7702
- }
7703
- const whitespace = separator === "," ? "" : " ";
7704
- let res = `"0":${whitespace}${array2[0]}`;
7705
- for (let i = 1; i < maximumBreadth; i++) {
7706
- res += `${separator}"${i}":${whitespace}${array2[i]}`;
7707
- }
7708
- return res;
7709
- }
7710
- function getCircularValueOption(options) {
7711
- if (hasOwnProperty.call(options, "circularValue")) {
7712
- const circularValue = options.circularValue;
7713
- if (typeof circularValue === "string") {
7714
- return `"${circularValue}"`;
7715
- }
7716
- if (circularValue == null) {
7717
- return circularValue;
7718
- }
7719
- if (circularValue === Error || circularValue === TypeError) {
7720
- return {
7721
- toString() {
7722
- throw new TypeError("Converting circular structure to JSON");
7723
- }
7724
- };
7725
- }
7726
- throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined');
7727
- }
7728
- return '"[Circular]"';
7729
- }
7730
- function getDeterministicOption(options) {
7731
- let value;
7732
- if (hasOwnProperty.call(options, "deterministic")) {
7733
- value = options.deterministic;
7734
- if (typeof value !== "boolean" && typeof value !== "function") {
7735
- throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');
7736
- }
7737
- }
7738
- return value === void 0 ? true : value;
7739
- }
7740
- function getBooleanOption(options, key) {
7741
- let value;
7742
- if (hasOwnProperty.call(options, key)) {
7743
- value = options[key];
7744
- if (typeof value !== "boolean") {
7745
- throw new TypeError(`The "${key}" argument must be of type boolean`);
7746
- }
7747
- }
7748
- return value === void 0 ? true : value;
7749
- }
7750
- function getPositiveIntegerOption(options, key) {
7751
- let value;
7752
- if (hasOwnProperty.call(options, key)) {
7753
- value = options[key];
7754
- if (typeof value !== "number") {
7755
- throw new TypeError(`The "${key}" argument must be of type number`);
7756
- }
7757
- if (!Number.isInteger(value)) {
7758
- throw new TypeError(`The "${key}" argument must be an integer`);
7759
- }
7760
- if (value < 1) {
7761
- throw new RangeError(`The "${key}" argument must be >= 1`);
7762
- }
7763
- }
7764
- return value === void 0 ? Infinity : value;
7765
- }
7766
- function getItemCount(number4) {
7767
- if (number4 === 1) {
7768
- return "1 item";
7769
- }
7770
- return `${number4} items`;
7771
- }
7772
- function getUniqueReplacerSet(replacerArray) {
7773
- const replacerSet = /* @__PURE__ */ new Set();
7774
- for (const value of replacerArray) {
7775
- if (typeof value === "string" || typeof value === "number") {
7776
- replacerSet.add(String(value));
7777
- }
7778
- }
7779
- return replacerSet;
7780
- }
7781
- function getStrictOption(options) {
7782
- if (hasOwnProperty.call(options, "strict")) {
7783
- const value = options.strict;
7784
- if (typeof value !== "boolean") {
7785
- throw new TypeError('The "strict" argument must be of type boolean');
7786
- }
7787
- if (value) {
7788
- return (value2) => {
7789
- let message = `Object can not safely be stringified. Received type ${typeof value2}`;
7790
- if (typeof value2 !== "function") message += ` (${value2.toString()})`;
7791
- throw new Error(message);
7792
- };
7793
- }
7794
- }
7795
- }
7796
- function configure(options) {
7797
- options = { ...options };
7798
- const fail = getStrictOption(options);
7799
- if (fail) {
7800
- if (options.bigint === void 0) {
7801
- options.bigint = false;
7802
- }
7803
- if (!("circularValue" in options)) {
7804
- options.circularValue = Error;
7805
- }
7806
- }
7807
- const circularValue = getCircularValueOption(options);
7808
- const bigint4 = getBooleanOption(options, "bigint");
7809
- const deterministic = getDeterministicOption(options);
7810
- const comparator = typeof deterministic === "function" ? deterministic : void 0;
7811
- const maximumDepth = getPositiveIntegerOption(options, "maximumDepth");
7812
- const maximumBreadth = getPositiveIntegerOption(options, "maximumBreadth");
7813
- function stringifyFnReplacer(key, parent, stack, replacer, spacer, indentation) {
7814
- let value = parent[key];
7815
- if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
7816
- value = value.toJSON(key);
7817
- }
7818
- value = replacer.call(parent, key, value);
7819
- switch (typeof value) {
7820
- case "string":
7821
- return strEscape(value);
7822
- case "object": {
7823
- if (value === null) {
7824
- return "null";
7825
- }
7826
- if (stack.indexOf(value) !== -1) {
7827
- return circularValue;
7828
- }
7829
- let res = "";
7830
- let join2 = ",";
7831
- const originalIndentation = indentation;
7832
- if (Array.isArray(value)) {
7833
- if (value.length === 0) {
7834
- return "[]";
7835
- }
7836
- if (maximumDepth < stack.length + 1) {
7837
- return '"[Array]"';
7838
- }
7839
- stack.push(value);
7840
- if (spacer !== "") {
7841
- indentation += spacer;
7842
- res += `
7843
- ${indentation}`;
7844
- join2 = `,
7845
- ${indentation}`;
7846
- }
7847
- const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
7848
- let i = 0;
7849
- for (; i < maximumValuesToStringify - 1; i++) {
7850
- const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
7851
- res += tmp2 !== void 0 ? tmp2 : "null";
7852
- res += join2;
7853
- }
7854
- const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
7855
- res += tmp !== void 0 ? tmp : "null";
7856
- if (value.length - 1 > maximumBreadth) {
7857
- const removedKeys = value.length - maximumBreadth - 1;
7858
- res += `${join2}"... ${getItemCount(removedKeys)} not stringified"`;
7859
- }
7860
- if (spacer !== "") {
7861
- res += `
7862
- ${originalIndentation}`;
7863
- }
7864
- stack.pop();
7865
- return `[${res}]`;
7866
- }
7867
- let keys = Object.keys(value);
7868
- const keyLength = keys.length;
7869
- if (keyLength === 0) {
7870
- return "{}";
7871
- }
7872
- if (maximumDepth < stack.length + 1) {
7873
- return '"[Object]"';
7874
- }
7875
- let whitespace = "";
7876
- let separator = "";
7877
- if (spacer !== "") {
7878
- indentation += spacer;
7879
- join2 = `,
7880
- ${indentation}`;
7881
- whitespace = " ";
7882
- }
7883
- const maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
7884
- if (deterministic && !isTypedArrayWithEntries(value)) {
7885
- keys = sort(keys, comparator);
7886
- }
7887
- stack.push(value);
7888
- for (let i = 0; i < maximumPropertiesToStringify; i++) {
7889
- const key2 = keys[i];
7890
- const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
7891
- if (tmp !== void 0) {
7892
- res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
7893
- separator = join2;
7894
- }
7895
- }
7896
- if (keyLength > maximumBreadth) {
7897
- const removedKeys = keyLength - maximumBreadth;
7898
- res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
7899
- separator = join2;
7900
- }
7901
- if (spacer !== "" && separator.length > 1) {
7902
- res = `
7903
- ${indentation}${res}
7904
- ${originalIndentation}`;
7905
- }
7906
- stack.pop();
7907
- return `{${res}}`;
7908
- }
7909
- case "number":
7910
- return isFinite(value) ? String(value) : fail ? fail(value) : "null";
7911
- case "boolean":
7912
- return value === true ? "true" : "false";
7913
- case "undefined":
7914
- return void 0;
7915
- case "bigint":
7916
- if (bigint4) {
7917
- return String(value);
7918
- }
7919
- // fallthrough
7920
- default:
7921
- return fail ? fail(value) : void 0;
7922
- }
7923
- }
7924
- function stringifyArrayReplacer(key, value, stack, replacer, spacer, indentation) {
7925
- if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
7926
- value = value.toJSON(key);
7927
- }
7928
- switch (typeof value) {
7929
- case "string":
7930
- return strEscape(value);
7931
- case "object": {
7932
- if (value === null) {
7933
- return "null";
7934
- }
7935
- if (stack.indexOf(value) !== -1) {
7936
- return circularValue;
7937
- }
7938
- const originalIndentation = indentation;
7939
- let res = "";
7940
- let join2 = ",";
7941
- if (Array.isArray(value)) {
7942
- if (value.length === 0) {
7943
- return "[]";
7944
- }
7945
- if (maximumDepth < stack.length + 1) {
7946
- return '"[Array]"';
7947
- }
7948
- stack.push(value);
7949
- if (spacer !== "") {
7950
- indentation += spacer;
7951
- res += `
7952
- ${indentation}`;
7953
- join2 = `,
7954
- ${indentation}`;
7955
- }
7956
- const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
7957
- let i = 0;
7958
- for (; i < maximumValuesToStringify - 1; i++) {
7959
- const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
7960
- res += tmp2 !== void 0 ? tmp2 : "null";
7961
- res += join2;
7962
- }
7963
- const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
7964
- res += tmp !== void 0 ? tmp : "null";
7965
- if (value.length - 1 > maximumBreadth) {
7966
- const removedKeys = value.length - maximumBreadth - 1;
7967
- res += `${join2}"... ${getItemCount(removedKeys)} not stringified"`;
7968
- }
7969
- if (spacer !== "") {
7970
- res += `
7971
- ${originalIndentation}`;
7972
- }
7973
- stack.pop();
7974
- return `[${res}]`;
7975
- }
7976
- stack.push(value);
7977
- let whitespace = "";
7978
- if (spacer !== "") {
7979
- indentation += spacer;
7980
- join2 = `,
7981
- ${indentation}`;
7982
- whitespace = " ";
7983
- }
7984
- let separator = "";
7985
- for (const key2 of replacer) {
7986
- const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
7987
- if (tmp !== void 0) {
7988
- res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
7989
- separator = join2;
7990
- }
7991
- }
7992
- if (spacer !== "" && separator.length > 1) {
7993
- res = `
7994
- ${indentation}${res}
7995
- ${originalIndentation}`;
7996
- }
7997
- stack.pop();
7998
- return `{${res}}`;
7999
- }
8000
- case "number":
8001
- return isFinite(value) ? String(value) : fail ? fail(value) : "null";
8002
- case "boolean":
8003
- return value === true ? "true" : "false";
8004
- case "undefined":
8005
- return void 0;
8006
- case "bigint":
8007
- if (bigint4) {
8008
- return String(value);
8009
- }
8010
- // fallthrough
8011
- default:
8012
- return fail ? fail(value) : void 0;
8013
- }
8014
- }
8015
- function stringifyIndent(key, value, stack, spacer, indentation) {
8016
- switch (typeof value) {
8017
- case "string":
8018
- return strEscape(value);
8019
- case "object": {
8020
- if (value === null) {
8021
- return "null";
8022
- }
8023
- if (typeof value.toJSON === "function") {
8024
- value = value.toJSON(key);
8025
- if (typeof value !== "object") {
8026
- return stringifyIndent(key, value, stack, spacer, indentation);
8027
- }
8028
- if (value === null) {
8029
- return "null";
8030
- }
8031
- }
8032
- if (stack.indexOf(value) !== -1) {
8033
- return circularValue;
8034
- }
8035
- const originalIndentation = indentation;
8036
- if (Array.isArray(value)) {
8037
- if (value.length === 0) {
8038
- return "[]";
8039
- }
8040
- if (maximumDepth < stack.length + 1) {
8041
- return '"[Array]"';
8042
- }
8043
- stack.push(value);
8044
- indentation += spacer;
8045
- let res2 = `
8046
- ${indentation}`;
8047
- const join3 = `,
8048
- ${indentation}`;
8049
- const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
8050
- let i = 0;
8051
- for (; i < maximumValuesToStringify - 1; i++) {
8052
- const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
8053
- res2 += tmp2 !== void 0 ? tmp2 : "null";
8054
- res2 += join3;
8055
- }
8056
- const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
8057
- res2 += tmp !== void 0 ? tmp : "null";
8058
- if (value.length - 1 > maximumBreadth) {
8059
- const removedKeys = value.length - maximumBreadth - 1;
8060
- res2 += `${join3}"... ${getItemCount(removedKeys)} not stringified"`;
8061
- }
8062
- res2 += `
8063
- ${originalIndentation}`;
8064
- stack.pop();
8065
- return `[${res2}]`;
8066
- }
8067
- let keys = Object.keys(value);
8068
- const keyLength = keys.length;
8069
- if (keyLength === 0) {
8070
- return "{}";
8071
- }
8072
- if (maximumDepth < stack.length + 1) {
8073
- return '"[Object]"';
8074
- }
8075
- indentation += spacer;
8076
- const join2 = `,
8077
- ${indentation}`;
8078
- let res = "";
8079
- let separator = "";
8080
- let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
8081
- if (isTypedArrayWithEntries(value)) {
8082
- res += stringifyTypedArray(value, join2, maximumBreadth);
8083
- keys = keys.slice(value.length);
8084
- maximumPropertiesToStringify -= value.length;
8085
- separator = join2;
8086
- }
8087
- if (deterministic) {
8088
- keys = sort(keys, comparator);
8089
- }
8090
- stack.push(value);
8091
- for (let i = 0; i < maximumPropertiesToStringify; i++) {
8092
- const key2 = keys[i];
8093
- const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
8094
- if (tmp !== void 0) {
8095
- res += `${separator}${strEscape(key2)}: ${tmp}`;
8096
- separator = join2;
8097
- }
8098
- }
8099
- if (keyLength > maximumBreadth) {
8100
- const removedKeys = keyLength - maximumBreadth;
8101
- res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
8102
- separator = join2;
8103
- }
8104
- if (separator !== "") {
8105
- res = `
8106
- ${indentation}${res}
8107
- ${originalIndentation}`;
8108
- }
8109
- stack.pop();
8110
- return `{${res}}`;
8111
- }
8112
- case "number":
8113
- return isFinite(value) ? String(value) : fail ? fail(value) : "null";
8114
- case "boolean":
8115
- return value === true ? "true" : "false";
8116
- case "undefined":
8117
- return void 0;
8118
- case "bigint":
8119
- if (bigint4) {
8120
- return String(value);
8121
- }
8122
- // fallthrough
8123
- default:
8124
- return fail ? fail(value) : void 0;
8125
- }
8126
- }
8127
- function stringifySimple(key, value, stack) {
8128
- switch (typeof value) {
8129
- case "string":
8130
- return strEscape(value);
8131
- case "object": {
8132
- if (value === null) {
8133
- return "null";
8134
- }
8135
- if (typeof value.toJSON === "function") {
8136
- value = value.toJSON(key);
8137
- if (typeof value !== "object") {
8138
- return stringifySimple(key, value, stack);
8139
- }
8140
- if (value === null) {
8141
- return "null";
8142
- }
8143
- }
8144
- if (stack.indexOf(value) !== -1) {
8145
- return circularValue;
8146
- }
8147
- let res = "";
8148
- const hasLength = value.length !== void 0;
8149
- if (hasLength && Array.isArray(value)) {
8150
- if (value.length === 0) {
8151
- return "[]";
8152
- }
8153
- if (maximumDepth < stack.length + 1) {
8154
- return '"[Array]"';
8155
- }
8156
- stack.push(value);
8157
- const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
8158
- let i = 0;
8159
- for (; i < maximumValuesToStringify - 1; i++) {
8160
- const tmp2 = stringifySimple(String(i), value[i], stack);
8161
- res += tmp2 !== void 0 ? tmp2 : "null";
8162
- res += ",";
8163
- }
8164
- const tmp = stringifySimple(String(i), value[i], stack);
8165
- res += tmp !== void 0 ? tmp : "null";
8166
- if (value.length - 1 > maximumBreadth) {
8167
- const removedKeys = value.length - maximumBreadth - 1;
8168
- res += `,"... ${getItemCount(removedKeys)} not stringified"`;
8169
- }
8170
- stack.pop();
8171
- return `[${res}]`;
8172
- }
8173
- let keys = Object.keys(value);
8174
- const keyLength = keys.length;
8175
- if (keyLength === 0) {
8176
- return "{}";
8177
- }
8178
- if (maximumDepth < stack.length + 1) {
8179
- return '"[Object]"';
8180
- }
8181
- let separator = "";
8182
- let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
8183
- if (hasLength && isTypedArrayWithEntries(value)) {
8184
- res += stringifyTypedArray(value, ",", maximumBreadth);
8185
- keys = keys.slice(value.length);
8186
- maximumPropertiesToStringify -= value.length;
8187
- separator = ",";
8188
- }
8189
- if (deterministic) {
8190
- keys = sort(keys, comparator);
8191
- }
8192
- stack.push(value);
8193
- for (let i = 0; i < maximumPropertiesToStringify; i++) {
8194
- const key2 = keys[i];
8195
- const tmp = stringifySimple(key2, value[key2], stack);
8196
- if (tmp !== void 0) {
8197
- res += `${separator}${strEscape(key2)}:${tmp}`;
8198
- separator = ",";
8199
- }
8200
- }
8201
- if (keyLength > maximumBreadth) {
8202
- const removedKeys = keyLength - maximumBreadth;
8203
- res += `${separator}"...":"${getItemCount(removedKeys)} not stringified"`;
8204
- }
8205
- stack.pop();
8206
- return `{${res}}`;
8207
- }
8208
- case "number":
8209
- return isFinite(value) ? String(value) : fail ? fail(value) : "null";
8210
- case "boolean":
8211
- return value === true ? "true" : "false";
8212
- case "undefined":
8213
- return void 0;
8214
- case "bigint":
8215
- if (bigint4) {
8216
- return String(value);
8217
- }
8218
- // fallthrough
8219
- default:
8220
- return fail ? fail(value) : void 0;
8221
- }
8222
- }
8223
- function stringify3(value, replacer, space) {
8224
- if (arguments.length > 1) {
8225
- let spacer = "";
8226
- if (typeof space === "number") {
8227
- spacer = " ".repeat(Math.min(space, 10));
8228
- } else if (typeof space === "string") {
8229
- spacer = space.slice(0, 10);
8230
- }
8231
- if (replacer != null) {
8232
- if (typeof replacer === "function") {
8233
- return stringifyFnReplacer("", { "": value }, [], replacer, spacer, "");
8234
- }
8235
- if (Array.isArray(replacer)) {
8236
- return stringifyArrayReplacer("", value, [], getUniqueReplacerSet(replacer), spacer, "");
8237
- }
8238
- }
8239
- if (spacer.length !== 0) {
8240
- return stringifyIndent("", value, [], spacer, "");
8241
- }
8242
- }
8243
- return stringifySimple("", value, []);
8244
- }
8245
- return stringify3;
8246
- }
8247
- }
8248
- });
8249
-
8250
- // ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/multistream.js
8251
- var require_multistream = __commonJS({
8252
- "../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/multistream.js"(exports, module) {
8253
- "use strict";
8254
- var metadata = /* @__PURE__ */ Symbol.for("pino.metadata");
8255
- var { DEFAULT_LEVELS } = require_constants();
8256
- var DEFAULT_INFO_LEVEL = DEFAULT_LEVELS.info;
8257
- function multistream(streamsArray, opts) {
8258
- streamsArray = streamsArray || [];
8259
- opts = opts || { dedupe: false };
8260
- const streamLevels = Object.create(DEFAULT_LEVELS);
8261
- streamLevels.silent = Infinity;
8262
- if (opts.levels && typeof opts.levels === "object") {
8263
- Object.keys(opts.levels).forEach((i) => {
8264
- streamLevels[i] = opts.levels[i];
8265
- });
8266
- }
8267
- const res = {
8268
- write,
8269
- add,
8270
- remove,
8271
- emit,
8272
- flushSync,
8273
- end,
8274
- minLevel: 0,
8275
- lastId: 0,
8276
- streams: [],
8277
- clone: clone2,
8278
- [metadata]: true,
8279
- streamLevels
8280
- };
8281
- if (Array.isArray(streamsArray)) {
8282
- streamsArray.forEach(add, res);
8283
- } else {
8284
- add.call(res, streamsArray);
8285
- }
8286
- streamsArray = null;
8287
- return res;
8288
- function write(data) {
8289
- let dest;
8290
- const level = this.lastLevel;
8291
- const { streams } = this;
8292
- let recordedLevel = 0;
8293
- let stream;
8294
- for (let i = initLoopVar(streams.length, opts.dedupe); checkLoopVar(i, streams.length, opts.dedupe); i = adjustLoopVar(i, opts.dedupe)) {
8295
- dest = streams[i];
8296
- if (dest.level <= level) {
8297
- if (recordedLevel !== 0 && recordedLevel !== dest.level) {
8298
- break;
8299
- }
8300
- stream = dest.stream;
8301
- if (stream[metadata]) {
8302
- const { lastTime, lastMsg, lastObj, lastLogger } = this;
8303
- stream.lastLevel = level;
8304
- stream.lastTime = lastTime;
8305
- stream.lastMsg = lastMsg;
8306
- stream.lastObj = lastObj;
8307
- stream.lastLogger = lastLogger;
8308
- }
8309
- stream.write(data);
8310
- if (opts.dedupe) {
8311
- recordedLevel = dest.level;
8312
- }
8313
- } else if (!opts.dedupe) {
8314
- break;
8315
- }
8316
- }
8317
- }
8318
- function emit(...args) {
8319
- for (const { stream } of this.streams) {
8320
- if (typeof stream.emit === "function") {
8321
- stream.emit(...args);
8322
- }
8323
- }
8324
- }
8325
- function flushSync() {
8326
- for (const { stream } of this.streams) {
8327
- if (typeof stream.flushSync === "function") {
8328
- stream.flushSync();
8329
- }
8330
- }
8331
- }
8332
- function add(dest) {
8333
- if (!dest) {
8334
- return res;
8335
- }
8336
- const isStream = typeof dest.write === "function" || dest.stream;
8337
- const stream_ = dest.write ? dest : dest.stream;
8338
- if (!isStream) {
8339
- throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");
8340
- }
8341
- const { streams, streamLevels: streamLevels2 } = this;
8342
- let level;
8343
- if (typeof dest.levelVal === "number") {
8344
- level = dest.levelVal;
8345
- } else if (typeof dest.level === "string") {
8346
- level = streamLevels2[dest.level];
8347
- } else if (typeof dest.level === "number") {
8348
- level = dest.level;
8349
- } else {
8350
- level = DEFAULT_INFO_LEVEL;
8351
- }
8352
- const dest_ = {
8353
- stream: stream_,
8354
- level,
8355
- levelVal: void 0,
8356
- id: ++res.lastId
8357
- };
8358
- streams.unshift(dest_);
8359
- streams.sort(compareByLevel);
8360
- this.minLevel = streams[0].level;
8361
- return res;
8362
- }
8363
- function remove(id) {
8364
- const { streams } = this;
8365
- const index = streams.findIndex((s) => s.id === id);
8366
- if (index >= 0) {
8367
- streams.splice(index, 1);
8368
- streams.sort(compareByLevel);
8369
- this.minLevel = streams.length > 0 ? streams[0].level : -1;
8370
- }
8371
- return res;
8372
- }
8373
- function end() {
8374
- for (const { stream } of this.streams) {
8375
- if (typeof stream.flushSync === "function") {
8376
- stream.flushSync();
8377
- }
8378
- stream.end();
8379
- }
8380
- }
8381
- function clone2(level) {
8382
- const streams = new Array(this.streams.length);
8383
- for (let i = 0; i < streams.length; i++) {
8384
- streams[i] = {
8385
- level,
8386
- stream: this.streams[i].stream
8387
- };
8388
- }
8389
- return {
8390
- write,
8391
- add,
8392
- remove,
8393
- minLevel: level,
8394
- streams,
8395
- clone: clone2,
8396
- emit,
8397
- flushSync,
8398
- [metadata]: true
8399
- };
8400
- }
8401
- }
8402
- function compareByLevel(a, b) {
8403
- return a.level - b.level;
8404
- }
8405
- function initLoopVar(length, dedupe) {
8406
- return dedupe ? length - 1 : 0;
8407
- }
8408
- function adjustLoopVar(i, dedupe) {
8409
- return dedupe ? i - 1 : i + 1;
8410
- }
8411
- function checkLoopVar(i, length, dedupe) {
8412
- return dedupe ? i >= 0 : i < length;
8413
- }
8414
- module.exports = multistream;
8415
- }
8416
- });
8417
-
8418
- // ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/pino.js
8419
- var require_pino = __commonJS({
8420
- "../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/pino.js"(exports, module) {
8421
- "use strict";
8422
- var os4 = __require("node:os");
8423
- var stdSerializers = require_pino_std_serializers();
8424
- var caller = require_caller();
8425
- var redaction = require_redaction();
8426
- var time3 = require_time();
8427
- var proto2 = require_proto();
8428
- var symbols = require_symbols();
8429
- var { configure } = require_safe_stable_stringify();
8430
- var { assertDefaultLevelFound, mappings, genLsCache, genLevelComparison, assertLevelComparison } = require_levels();
8431
- var { DEFAULT_LEVELS, SORTING_ORDER } = require_constants();
8432
- var {
8433
- createArgsNormalizer,
8434
- asChindings,
8435
- buildSafeSonicBoom,
8436
- buildFormatters,
8437
- stringify: stringify2,
8438
- normalizeDestFileDescriptor,
8439
- noop: noop2
8440
- } = require_tools();
8441
- var { version: version2 } = require_meta();
8442
- var {
8443
- chindingsSym,
8444
- redactFmtSym,
8445
- serializersSym,
8446
- timeSym,
8447
- timeSliceIndexSym,
8448
- streamSym,
8449
- stringifySym,
8450
- stringifySafeSym,
8451
- stringifiersSym,
8452
- setLevelSym,
8453
- endSym,
8454
- formatOptsSym,
8455
- messageKeySym,
8456
- errorKeySym,
8457
- nestedKeySym,
8458
- mixinSym,
8459
- levelCompSym,
8460
- useOnlyCustomLevelsSym,
8461
- formattersSym,
8462
- hooksSym,
8463
- nestedKeyStrSym,
8464
- mixinMergeStrategySym,
8465
- msgPrefixSym
8466
- } = symbols;
8467
- var { epochTime, nullTime } = time3;
8468
- var { pid } = process;
8469
- var hostname3 = os4.hostname();
8470
- var defaultErrorSerializer = stdSerializers.err;
8471
- var defaultOptions = {
8472
- level: "info",
8473
- levelComparison: SORTING_ORDER.ASC,
8474
- levels: DEFAULT_LEVELS,
8475
- messageKey: "msg",
8476
- errorKey: "err",
8477
- nestedKey: null,
8478
- enabled: true,
8479
- base: { pid, hostname: hostname3 },
8480
- serializers: Object.assign(/* @__PURE__ */ Object.create(null), {
8481
- err: defaultErrorSerializer
8482
- }),
8483
- formatters: Object.assign(/* @__PURE__ */ Object.create(null), {
8484
- bindings(bindings) {
8485
- return bindings;
8486
- },
8487
- level(label, number4) {
8488
- return { level: number4 };
8489
- }
8490
- }),
8491
- hooks: {
8492
- logMethod: void 0,
8493
- streamWrite: void 0
8494
- },
8495
- timestamp: epochTime,
8496
- name: void 0,
8497
- redact: null,
8498
- customLevels: null,
8499
- useOnlyCustomLevels: false,
8500
- depthLimit: 5,
8501
- edgeLimit: 100
8502
- };
8503
- var normalize = createArgsNormalizer(defaultOptions);
8504
- var serializers = Object.assign(/* @__PURE__ */ Object.create(null), stdSerializers);
8505
- function pino2(...args) {
8506
- const instance = {};
8507
- const { opts, stream } = normalize(instance, caller(), ...args);
8508
- if (opts.level && typeof opts.level === "string" && DEFAULT_LEVELS[opts.level.toLowerCase()] !== void 0) opts.level = opts.level.toLowerCase();
8509
- const {
8510
- redact,
8511
- crlf,
8512
- serializers: serializers2,
8513
- timestamp,
8514
- messageKey,
8515
- errorKey,
8516
- nestedKey,
8517
- base,
8518
- name,
8519
- level,
8520
- customLevels,
8521
- levelComparison,
8522
- mixin,
8523
- mixinMergeStrategy,
8524
- useOnlyCustomLevels,
8525
- formatters: formatters2,
8526
- hooks,
8527
- depthLimit,
8528
- edgeLimit,
8529
- onChild,
8530
- msgPrefix
8531
- } = opts;
8532
- const stringifySafe = configure({
8533
- maximumDepth: depthLimit,
8534
- maximumBreadth: edgeLimit
8535
- });
8536
- const allFormatters = buildFormatters(
8537
- formatters2.level,
8538
- formatters2.bindings,
8539
- formatters2.log
8540
- );
8541
- const stringifyFn = stringify2.bind({
8542
- [stringifySafeSym]: stringifySafe
8543
- });
8544
- const stringifiers = redact ? redaction(redact, stringifyFn) : {};
8545
- const formatOpts = redact ? { stringify: stringifiers[redactFmtSym] } : { stringify: stringifyFn };
8546
- const end = "}" + (crlf ? "\r\n" : "\n");
8547
- const coreChindings = asChindings.bind(null, {
8548
- [chindingsSym]: "",
8549
- [serializersSym]: serializers2,
8550
- [stringifiersSym]: stringifiers,
8551
- [stringifySym]: stringify2,
8552
- [stringifySafeSym]: stringifySafe,
8553
- [formattersSym]: allFormatters
8554
- });
8555
- let chindings = "";
8556
- if (base !== null) {
8557
- if (name === void 0) {
8558
- chindings = coreChindings(base);
8559
- } else {
8560
- chindings = coreChindings(Object.assign({}, base, { name }));
8561
- }
8562
- }
8563
- const time4 = timestamp instanceof Function ? timestamp : timestamp ? epochTime : nullTime;
8564
- const timeSliceIndex = time4().indexOf(":") + 1;
8565
- if (useOnlyCustomLevels && !customLevels) throw Error("customLevels is required if useOnlyCustomLevels is set true");
8566
- if (mixin && typeof mixin !== "function") throw Error(`Unknown mixin type "${typeof mixin}" - expected "function"`);
8567
- if (msgPrefix && typeof msgPrefix !== "string") throw Error(`Unknown msgPrefix type "${typeof msgPrefix}" - expected "string"`);
8568
- assertDefaultLevelFound(level, customLevels, useOnlyCustomLevels);
8569
- const levels = mappings(customLevels, useOnlyCustomLevels);
8570
- if (typeof stream.emit === "function") {
8571
- stream.emit("message", { code: "PINO_CONFIG", config: { levels, messageKey, errorKey } });
8572
- }
8573
- assertLevelComparison(levelComparison);
8574
- const levelCompFunc = genLevelComparison(levelComparison);
8575
- Object.assign(instance, {
8576
- levels,
8577
- [levelCompSym]: levelCompFunc,
8578
- [useOnlyCustomLevelsSym]: useOnlyCustomLevels,
8579
- [streamSym]: stream,
8580
- [timeSym]: time4,
8581
- [timeSliceIndexSym]: timeSliceIndex,
8582
- [stringifySym]: stringify2,
8583
- [stringifySafeSym]: stringifySafe,
8584
- [stringifiersSym]: stringifiers,
8585
- [endSym]: end,
8586
- [formatOptsSym]: formatOpts,
8587
- [messageKeySym]: messageKey,
8588
- [errorKeySym]: errorKey,
8589
- [nestedKeySym]: nestedKey,
8590
- // protect against injection
8591
- [nestedKeyStrSym]: nestedKey ? `,${JSON.stringify(nestedKey)}:{` : "",
8592
- [serializersSym]: serializers2,
8593
- [mixinSym]: mixin,
8594
- [mixinMergeStrategySym]: mixinMergeStrategy,
8595
- [chindingsSym]: chindings,
8596
- [formattersSym]: allFormatters,
8597
- [hooksSym]: hooks,
8598
- silent: noop2,
8599
- onChild,
8600
- [msgPrefixSym]: msgPrefix
8601
- });
8602
- Object.setPrototypeOf(instance, proto2());
8603
- genLsCache(instance);
8604
- instance[setLevelSym](level);
8605
- return instance;
8606
- }
8607
- module.exports = pino2;
8608
- module.exports.destination = (dest = process.stdout.fd) => {
8609
- if (typeof dest === "object") {
8610
- dest.dest = normalizeDestFileDescriptor(dest.dest || process.stdout.fd);
8611
- return buildSafeSonicBoom(dest);
8612
- } else {
8613
- return buildSafeSonicBoom({ dest: normalizeDestFileDescriptor(dest), minLength: 0 });
8614
- }
8615
- };
8616
- module.exports.transport = require_transport();
8617
- module.exports.multistream = require_multistream();
8618
- module.exports.levels = mappings();
8619
- module.exports.stdSerializers = serializers;
8620
- module.exports.stdTimeFunctions = Object.assign({}, time3);
8621
- module.exports.symbols = symbols;
8622
- module.exports.version = version2;
8623
- module.exports.default = pino2;
8624
- module.exports.pino = pino2;
8625
- }
8626
- });
8627
-
8628
4250
  // ../../node_modules/.pnpm/mimic-function@5.0.1/node_modules/mimic-function/index.js
8629
4251
  function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
8630
4252
  const { name } = to;
@@ -8743,13 +4365,13 @@ var init_signals = __esm({
8743
4365
  });
8744
4366
 
8745
4367
  // ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
8746
- var processOk, kExitEmitter, global2, ObjectDefineProperty, Emitter, SignalExitBase, signalExitWrap, SignalExitFallback, SignalExit, process4, onExit, load, unload;
4368
+ var processOk, kExitEmitter, global, ObjectDefineProperty, Emitter, SignalExitBase, signalExitWrap, SignalExitFallback, SignalExit, process4, onExit, load, unload;
8747
4369
  var init_mjs = __esm({
8748
4370
  "../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js"() {
8749
4371
  init_signals();
8750
4372
  processOk = (process17) => !!process17 && typeof process17 === "object" && typeof process17.removeListener === "function" && typeof process17.emit === "function" && typeof process17.reallyExit === "function" && typeof process17.listeners === "function" && typeof process17.kill === "function" && typeof process17.pid === "number" && typeof process17.on === "function";
8751
4373
  kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
8752
- global2 = globalThis;
4374
+ global = globalThis;
8753
4375
  ObjectDefineProperty = Object.defineProperty.bind(Object);
8754
4376
  Emitter = class {
8755
4377
  emitted = {
@@ -8763,10 +4385,10 @@ var init_mjs = __esm({
8763
4385
  count = 0;
8764
4386
  id = Math.random();
8765
4387
  constructor() {
8766
- if (global2[kExitEmitter]) {
8767
- return global2[kExitEmitter];
4388
+ if (global[kExitEmitter]) {
4389
+ return global[kExitEmitter];
8768
4390
  }
8769
- ObjectDefineProperty(global2, kExitEmitter, {
4391
+ ObjectDefineProperty(global, kExitEmitter, {
8770
4392
  value: this,
8771
4393
  writable: false,
8772
4394
  enumerable: false,
@@ -25412,7 +21034,7 @@ function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
25412
21034
  }
25413
21035
  return detectArchBinary(platformBinary);
25414
21036
  }
25415
- var execFile5, __dirname2, localXdgOpenPath, platform, arch, pTryEach, baseOpen, open, openApp, apps, open_default;
21037
+ var execFile5, __dirname, localXdgOpenPath, platform, arch, pTryEach, baseOpen, open, openApp, apps, open_default;
25416
21038
  var init_open = __esm({
25417
21039
  "../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js"() {
25418
21040
  init_wsl_utils();
@@ -25420,8 +21042,8 @@ var init_open = __esm({
25420
21042
  init_default_browser();
25421
21043
  init_is_inside_container();
25422
21044
  execFile5 = promisify5(childProcess.execFile);
25423
- __dirname2 = path3.dirname(fileURLToPath(import.meta.url));
25424
- localXdgOpenPath = path3.join(__dirname2, "xdg-open");
21045
+ __dirname = path3.dirname(fileURLToPath(import.meta.url));
21046
+ localXdgOpenPath = path3.join(__dirname, "xdg-open");
25425
21047
  ({ platform, arch } = process16);
25426
21048
  pTryEach = async (array2, mapper) => {
25427
21049
  let latestError;
@@ -25543,7 +21165,7 @@ var init_open = __esm({
25543
21165
  if (app) {
25544
21166
  command = app;
25545
21167
  } else {
25546
- const isBundled = !__dirname2 || __dirname2 === "/";
21168
+ const isBundled = !__dirname || __dirname === "/";
25547
21169
  let exeLocalXdgOpen = false;
25548
21170
  try {
25549
21171
  await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
@@ -39862,7 +35484,7 @@ ${messages}`);
39862
35484
  }
39863
35485
 
39864
35486
  // ../core/dist/logging/logger.js
39865
- var import_pino = __toESM(require_pino(), 1);
35487
+ import pino from "pino";
39866
35488
  var isDev = process.env.NODE_ENV !== "production";
39867
35489
  var isCli = process.env.TRADING_BOY_CLI === "1";
39868
35490
  var SENSITIVE_FIELDS = [
@@ -39882,9 +35504,14 @@ var MAX_REDACT_DEPTH = 5;
39882
35504
  function buildRedactPaths(fields, maxDepth) {
39883
35505
  const paths = [];
39884
35506
  for (const field of fields) {
35507
+ const needsBracket = /[^a-zA-Z0-9_$]/.test(field);
39885
35508
  for (let depth = 0; depth <= maxDepth; depth++) {
39886
- const prefix = "*.".repeat(depth);
39887
- paths.push(`${prefix}${field}`);
35509
+ const prefix = depth > 0 ? "*.".repeat(depth).slice(0, -1) : "";
35510
+ if (needsBracket) {
35511
+ paths.push(`${prefix}["${field}"]`);
35512
+ } else {
35513
+ paths.push(depth > 0 ? `${prefix}.${field}` : field);
35514
+ }
39888
35515
  }
39889
35516
  }
39890
35517
  return paths;
@@ -39893,27 +35520,27 @@ var REDACT_PATHS = buildRedactPaths(SENSITIVE_FIELDS, MAX_REDACT_DEPTH);
39893
35520
  var _baseLogger = null;
39894
35521
  function getBaseLogger() {
39895
35522
  if (!_baseLogger) {
39896
- _baseLogger = (0, import_pino.default)({
35523
+ const opts = {
39897
35524
  name: "trading-boy",
39898
35525
  level: process.env.LOG_LEVEL ?? "info",
39899
35526
  redact: {
39900
35527
  paths: REDACT_PATHS,
39901
35528
  censor: "[REDACTED]"
39902
- },
39903
- ...isDev ? {
35529
+ }
35530
+ };
35531
+ if (isCli) {
35532
+ _baseLogger = pino(opts, process.stderr);
35533
+ } else if (isDev) {
35534
+ _baseLogger = pino({
35535
+ ...opts,
39904
35536
  transport: {
39905
35537
  target: "pino-pretty",
39906
35538
  options: { destination: 2 }
39907
35539
  }
39908
- } : isCli ? {
39909
- // In CLI production mode, write JSON logs to stderr so stdout
39910
- // stays clean for command output and piping.
39911
- transport: {
39912
- target: "pino/file",
39913
- options: { destination: 2 }
39914
- }
39915
- } : {}
39916
- });
35540
+ });
35541
+ } else {
35542
+ _baseLogger = pino(opts);
35543
+ }
39917
35544
  }
39918
35545
  return _baseLogger;
39919
35546
  }
@@ -50744,9 +46371,9 @@ function registerSubscribeCommand(program2) {
50744
46371
  plan = await select({
50745
46372
  message: "Choose your plan",
50746
46373
  choices: [
50747
- { name: "Starter \u2014 $20/mo (core context + journal)", value: "starter" },
50748
- { name: "Pro \u2014 $40/mo (+ coaching + thesis extraction)", value: "pro" },
50749
- { name: "Edge \u2014 $75/mo (+ edge analysis + full analytics)", value: "edge" }
46374
+ { name: "Starter \u2014 Free (core context + journal)", value: "starter" },
46375
+ { name: "Pro \u2014 $29/mo (+ coaching + thesis extraction)", value: "pro" },
46376
+ { name: "Edge \u2014 $99/mo (+ edge analysis + full analytics)", value: "edge" }
50750
46377
  ]
50751
46378
  });
50752
46379
  }
@@ -50756,6 +46383,14 @@ function registerSubscribeCommand(program2) {
50756
46383
  process.exitCode = 1;
50757
46384
  return;
50758
46385
  }
46386
+ const planLabels = { starter: "Starter (Free)", pro: "Pro ($29/mo)", edge: "Edge ($99/mo)" };
46387
+ if (plan === "starter") {
46388
+ console.log("");
46389
+ console.log(` ${source_default.bold("Plan:")} ${planLabels[plan]}`);
46390
+ console.log("");
46391
+ await handleFreeRegistration(email3);
46392
+ return;
46393
+ }
50759
46394
  if (!pay) {
50760
46395
  pay = await select({
50761
46396
  message: "How would you like to pay?",
@@ -50771,7 +46406,6 @@ function registerSubscribeCommand(program2) {
50771
46406
  process.exitCode = 1;
50772
46407
  return;
50773
46408
  }
50774
- const planLabels = { starter: "Starter ($20/mo)", pro: "Pro ($40/mo)", edge: "Edge ($75/mo)" };
50775
46409
  console.log("");
50776
46410
  console.log(` ${source_default.bold("Plan:")} ${planLabels[plan] ?? plan}`);
50777
46411
  console.log(` ${source_default.bold("Pay:")} ${pay === "crypto" ? "USDC on Solana" : "Stripe"}`);
@@ -50793,6 +46427,37 @@ function registerSubscribeCommand(program2) {
50793
46427
  }
50794
46428
  });
50795
46429
  }
46430
+ async function handleFreeRegistration(email3) {
46431
+ console.log(source_default.white(" Creating your free account..."));
46432
+ let result;
46433
+ try {
46434
+ const response = await fetch(`${getApiBase()}/api/v1/auth/register`, {
46435
+ method: "POST",
46436
+ headers: { "Content-Type": "application/json" },
46437
+ body: JSON.stringify({ email: email3 })
46438
+ });
46439
+ if (!response.ok) {
46440
+ const body = await response.text();
46441
+ throw new Error(`Registration failed (${response.status}): ${body}`);
46442
+ }
46443
+ result = await response.json();
46444
+ } catch (err) {
46445
+ const message = err instanceof Error ? err.message : String(err);
46446
+ console.error(source_default.red(` Failed to register: ${message}`));
46447
+ const hint = formatConnectionError2(message);
46448
+ if (hint)
46449
+ console.error(hint);
46450
+ process.exitCode = 1;
46451
+ return;
46452
+ }
46453
+ await storeAndDisplayKey({
46454
+ success: true,
46455
+ apiKey: result.apiKey,
46456
+ keyPrefix: result.keyPrefix,
46457
+ email: result.email,
46458
+ plan: result.plan
46459
+ });
46460
+ }
50796
46461
  async function handleStripeCheckout(email3, plan) {
50797
46462
  let checkout;
50798
46463
  try {
@@ -52325,8 +47990,8 @@ if (!process.stdout.isTTY) {
52325
47990
  process.env.NO_COLOR = "1";
52326
47991
  }
52327
47992
  function getVersion() {
52328
- const __dirname3 = dirname(fileURLToPath2(import.meta.url));
52329
- const pkgPath = resolve2(__dirname3, "..", "package.json");
47993
+ const __dirname2 = dirname(fileURLToPath2(import.meta.url));
47994
+ const pkgPath = resolve2(__dirname2, "..", "package.json");
52330
47995
  const pkg = JSON.parse(readFileSync5(pkgPath, "utf-8"));
52331
47996
  return pkg.version;
52332
47997
  }