rolldown 1.0.0-beta.8-commit.852c603 → 1.0.0-beta.8-commit.a720367

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.
Files changed (33) hide show
  1. package/dist/cli.cjs +6 -6
  2. package/dist/cli.mjs +2 -2
  3. package/dist/experimental-index.cjs +2 -2
  4. package/dist/experimental-index.d.cts +2 -2
  5. package/dist/experimental-index.d.mts +2 -2
  6. package/dist/experimental-index.mjs +2 -2
  7. package/dist/filter-index.cjs +12 -0
  8. package/dist/{filter-expression-index.d.cts → filter-index.d.cts} +3 -3
  9. package/dist/{filter-expression-index.d.mts → filter-index.d.mts} +3 -3
  10. package/dist/filter-index.mjs +4 -0
  11. package/dist/index.cjs +3 -4
  12. package/dist/index.d.cts +3 -3
  13. package/dist/index.d.mts +3 -3
  14. package/dist/index.mjs +3 -3
  15. package/dist/parallel-plugin-worker.cjs +2 -2
  16. package/dist/parallel-plugin-worker.mjs +2 -2
  17. package/dist/parallel-plugin.d.cts +2 -2
  18. package/dist/parallel-plugin.d.mts +2 -2
  19. package/dist/parse-ast-index.d.cts +1 -1
  20. package/dist/parse-ast-index.d.mts +1 -1
  21. package/dist/shared/{binding.d-BaNmLM9c.d.mts → binding.d-BqY7GV3f.d.cts} +3 -0
  22. package/dist/shared/{binding.d-y7dWnUxd.d.cts → binding.d-DE0X2d5U.d.mts} +3 -0
  23. package/dist/shared/filter-index-DblXSw9s.cjs +255 -0
  24. package/dist/shared/filter-index-hnEzlqRW.mjs +174 -0
  25. package/dist/shared/{input-options.d-CN-JV5dt.d.mts → input-options.d-B9XQg_yc.d.mts} +23 -25
  26. package/dist/shared/{input-options.d-BHwth6VM.d.cts → input-options.d-BP-ZTUFR.d.cts} +23 -25
  27. package/dist/shared/{src-CaxK4-gB.mjs → src-B7fgzJrI.mjs} +1753 -510
  28. package/dist/shared/{src-B4f_CmD8.cjs → src-N-rxJtKK.cjs} +1754 -517
  29. package/package.json +21 -21
  30. package/dist/filter-expression-index.cjs +0 -11
  31. package/dist/filter-expression-index.mjs +0 -4
  32. package/dist/shared/filter-expression-index-BKmgnKlV.mjs +0 -69
  33. package/dist/shared/filter-expression-index-CRtoeipP.cjs +0 -119
@@ -1,25 +1,23 @@
1
1
  "use strict";
2
2
  const require_chunk = require('./chunk-qZFfknuJ.cjs');
3
3
  const require_parse_ast_index = require('./parse-ast-index-Bbz37LOL.cjs');
4
- const require_filter_expression_index = require('./filter-expression-index-CRtoeipP.cjs');
4
+ const require_filter_index = require('./filter-index-DblXSw9s.cjs');
5
5
  const node_path = require_chunk.__toESM(require("node:path"));
6
- const __valibot_to_json_schema = require_chunk.__toESM(require("@valibot/to-json-schema"));
7
6
  const ansis = require_chunk.__toESM(require("ansis"));
8
- const valibot = require_chunk.__toESM(require("valibot"));
9
7
  const node_os = require_chunk.__toESM(require("node:os"));
10
8
  const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
11
9
 
12
10
  //#region package.json
13
- var version = "1.0.0-beta.8-commit.852c603";
14
- var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
11
+ var version = "1.0.0-beta.8-commit.a720367";
12
+ var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
15
13
 
16
14
  //#endregion
17
15
  //#region src/builtin-plugin/utils.ts
18
16
  function makeBuiltinPluginCallable(plugin) {
19
17
  let callablePlugin = new require_parse_ast_index.import_binding.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
20
18
  const wrappedPlugin = plugin;
21
- for (const key in callablePlugin) wrappedPlugin[key] = function(...args) {
22
- return callablePlugin[key](...args);
19
+ for (const key in callablePlugin) wrappedPlugin[key] = function(...args$1) {
20
+ return callablePlugin[key](...args$1);
23
21
  };
24
22
  return wrappedPlugin;
25
23
  }
@@ -97,30 +95,6 @@ function isolatedDeclarationPlugin(config) {
97
95
  return new BuiltinPlugin("builtin:isolated-declaration", config);
98
96
  }
99
97
 
100
- //#endregion
101
- //#region src/utils/misc.ts
102
- function arraify(value) {
103
- return Array.isArray(value) ? value : [value];
104
- }
105
- function isNullish(value) {
106
- return value === null || value === void 0;
107
- }
108
- function isPromiseLike(value) {
109
- return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
110
- }
111
- function unimplemented(info) {
112
- if (info) throw new Error(`unimplemented: ${info}`);
113
- throw new Error("unimplemented");
114
- }
115
- function unreachable(info) {
116
- if (info) throw new Error(`unreachable: ${info}`);
117
- throw new Error("unreachable");
118
- }
119
- function unsupported(info) {
120
- throw new Error(`UNSUPPORTED: ${info}`);
121
- }
122
- function noop(..._args) {}
123
-
124
98
  //#endregion
125
99
  //#region src/log/logging.ts
126
100
  const LOG_LEVEL_SILENT = "silent";
@@ -139,7 +113,7 @@ const logLevelPriority = {
139
113
  //#region src/log/log-handler.ts
140
114
  const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
141
115
  function getLogHandler(level, code$1, logger, pluginName, logLevel) {
142
- if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
116
+ if (logLevelPriority[level] < logLevelPriority[logLevel]) return require_filter_index.noop;
143
117
  return (log, pos) => {
144
118
  if (pos != null) logger(LOG_LEVEL_WARN, require_parse_ast_index.logInvalidLogPosition(pluginName));
145
119
  log = normalizeLog(log);
@@ -242,7 +216,7 @@ function normalizeHook(hook) {
242
216
  meta: { order }
243
217
  };
244
218
  }
245
- unreachable("Invalid hook type");
219
+ require_filter_index.unreachable("Invalid hook type");
246
220
  }
247
221
 
248
222
  //#endregion
@@ -316,11 +290,11 @@ const DEFINED_HOOK_NAMES = {
316
290
 
317
291
  //#endregion
318
292
  //#region src/utils/async-flatten.ts
319
- async function asyncFlatten(array) {
293
+ async function asyncFlatten(array$1) {
320
294
  do
321
- array = (await Promise.all(array)).flat(Infinity);
322
- while (array.some((v) => v?.then));
323
- return array;
295
+ array$1 = (await Promise.all(array$1)).flat(Infinity);
296
+ while (array$1.some((v) => v?.then));
297
+ return array$1;
324
298
  }
325
299
 
326
300
  //#endregion
@@ -435,201 +409,1509 @@ function getSortedPlugins(hookName, plugins) {
435
409
  ];
436
410
  }
437
411
 
412
+ //#endregion
413
+ //#region ../../node_modules/.pnpm/valibot@1.0.0_typescript@5.8.3/node_modules/valibot/dist/index.js
414
+ var store;
415
+ /* @__NO_SIDE_EFFECTS__ */
416
+ function getGlobalConfig(config2) {
417
+ return {
418
+ lang: config2?.lang ?? store?.lang,
419
+ message: config2?.message,
420
+ abortEarly: config2?.abortEarly ?? store?.abortEarly,
421
+ abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
422
+ };
423
+ }
424
+ var store2;
425
+ /* @__NO_SIDE_EFFECTS__ */
426
+ function getGlobalMessage(lang) {
427
+ return store2?.get(lang);
428
+ }
429
+ var store3;
430
+ /* @__NO_SIDE_EFFECTS__ */
431
+ function getSchemaMessage(lang) {
432
+ return store3?.get(lang);
433
+ }
434
+ var store4;
435
+ /* @__NO_SIDE_EFFECTS__ */
436
+ function getSpecificMessage(reference, lang) {
437
+ return store4?.get(reference)?.get(lang);
438
+ }
439
+ /* @__NO_SIDE_EFFECTS__ */
440
+ function _stringify(input) {
441
+ const type = typeof input;
442
+ if (type === "string") return `"${input}"`;
443
+ if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
444
+ if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
445
+ return type;
446
+ }
447
+ function _addIssue(context, label, dataset, config2, other) {
448
+ const input = other && "input" in other ? other.input : dataset.value;
449
+ const expected = other?.expected ?? context.expects ?? null;
450
+ const received = other?.received ?? /* @__PURE__ */ _stringify(input);
451
+ const issue = {
452
+ kind: context.kind,
453
+ type: context.type,
454
+ input,
455
+ expected,
456
+ received,
457
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
458
+ requirement: context.requirement,
459
+ path: other?.path,
460
+ issues: other?.issues,
461
+ lang: config2.lang,
462
+ abortEarly: config2.abortEarly,
463
+ abortPipeEarly: config2.abortPipeEarly
464
+ };
465
+ const isSchema = context.kind === "schema";
466
+ const message = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
467
+ if (message !== void 0) issue.message = typeof message === "function" ? message(issue) : message;
468
+ if (isSchema) dataset.typed = false;
469
+ if (dataset.issues) dataset.issues.push(issue);
470
+ else dataset.issues = [issue];
471
+ }
472
+ /* @__NO_SIDE_EFFECTS__ */
473
+ function _getStandardProps(context) {
474
+ return {
475
+ version: 1,
476
+ vendor: "valibot",
477
+ validate(value2) {
478
+ return context["~run"]({ value: value2 }, /* @__PURE__ */ getGlobalConfig());
479
+ }
480
+ };
481
+ }
482
+ /* @__NO_SIDE_EFFECTS__ */
483
+ function _isValidObjectKey(object2, key) {
484
+ return Object.hasOwn(object2, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
485
+ }
486
+ /* @__NO_SIDE_EFFECTS__ */
487
+ function _joinExpects(values2, separator) {
488
+ const list = [...new Set(values2)];
489
+ if (list.length > 1) return `(${list.join(` ${separator} `)})`;
490
+ return list[0] ?? "never";
491
+ }
492
+ var ValiError = class extends Error {
493
+ /**
494
+ * Creates a Valibot error with useful information.
495
+ *
496
+ * @param issues The error issues.
497
+ */
498
+ constructor(issues) {
499
+ super(issues[0].message);
500
+ this.name = "ValiError";
501
+ this.issues = issues;
502
+ }
503
+ };
504
+ /* @__NO_SIDE_EFFECTS__ */
505
+ function args(schema) {
506
+ return {
507
+ kind: "transformation",
508
+ type: "args",
509
+ reference: args,
510
+ async: false,
511
+ schema,
512
+ "~run"(dataset, config2) {
513
+ const func = dataset.value;
514
+ dataset.value = (...args_) => {
515
+ const argsDataset = this.schema["~run"]({ value: args_ }, config2);
516
+ if (argsDataset.issues) throw new ValiError(argsDataset.issues);
517
+ return func(...argsDataset.value);
518
+ };
519
+ return dataset;
520
+ }
521
+ };
522
+ }
523
+ /* @__NO_SIDE_EFFECTS__ */
524
+ function awaitAsync() {
525
+ return {
526
+ kind: "transformation",
527
+ type: "await",
528
+ reference: awaitAsync,
529
+ async: true,
530
+ async "~run"(dataset) {
531
+ dataset.value = await dataset.value;
532
+ return dataset;
533
+ }
534
+ };
535
+ }
536
+ /* @__NO_SIDE_EFFECTS__ */
537
+ function description(description_) {
538
+ return {
539
+ kind: "metadata",
540
+ type: "description",
541
+ reference: description,
542
+ description: description_
543
+ };
544
+ }
545
+ /* @__NO_SIDE_EFFECTS__ */
546
+ function returns(schema) {
547
+ return {
548
+ kind: "transformation",
549
+ type: "returns",
550
+ reference: returns,
551
+ async: false,
552
+ schema,
553
+ "~run"(dataset, config2) {
554
+ const func = dataset.value;
555
+ dataset.value = (...args_) => {
556
+ const returnsDataset = this.schema["~run"]({ value: func(...args_) }, config2);
557
+ if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
558
+ return returnsDataset.value;
559
+ };
560
+ return dataset;
561
+ }
562
+ };
563
+ }
564
+ /* @__NO_SIDE_EFFECTS__ */
565
+ function returnsAsync(schema) {
566
+ return {
567
+ kind: "transformation",
568
+ type: "returns",
569
+ reference: returnsAsync,
570
+ async: false,
571
+ schema,
572
+ "~run"(dataset, config2) {
573
+ const func = dataset.value;
574
+ dataset.value = async (...args_) => {
575
+ const returnsDataset = await this.schema["~run"]({ value: await func(...args_) }, config2);
576
+ if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
577
+ return returnsDataset.value;
578
+ };
579
+ return dataset;
580
+ }
581
+ };
582
+ }
583
+ /* @__NO_SIDE_EFFECTS__ */
584
+ function getFallback(schema, dataset, config2) {
585
+ return typeof schema.fallback === "function" ? schema.fallback(dataset, config2) : schema.fallback;
586
+ }
587
+ /* @__NO_SIDE_EFFECTS__ */
588
+ function getDefault(schema, dataset, config2) {
589
+ return typeof schema.default === "function" ? schema.default(dataset, config2) : schema.default;
590
+ }
591
+ /* @__NO_SIDE_EFFECTS__ */
592
+ function any() {
593
+ return {
594
+ kind: "schema",
595
+ type: "any",
596
+ reference: any,
597
+ expects: "any",
598
+ async: false,
599
+ get "~standard"() {
600
+ return /* @__PURE__ */ _getStandardProps(this);
601
+ },
602
+ "~run"(dataset) {
603
+ dataset.typed = true;
604
+ return dataset;
605
+ }
606
+ };
607
+ }
608
+ /* @__NO_SIDE_EFFECTS__ */
609
+ function array(item, message) {
610
+ return {
611
+ kind: "schema",
612
+ type: "array",
613
+ reference: array,
614
+ expects: "Array",
615
+ async: false,
616
+ item,
617
+ message,
618
+ get "~standard"() {
619
+ return /* @__PURE__ */ _getStandardProps(this);
620
+ },
621
+ "~run"(dataset, config2) {
622
+ const input = dataset.value;
623
+ if (Array.isArray(input)) {
624
+ dataset.typed = true;
625
+ dataset.value = [];
626
+ for (let key = 0; key < input.length; key++) {
627
+ const value2 = input[key];
628
+ const itemDataset = this.item["~run"]({ value: value2 }, config2);
629
+ if (itemDataset.issues) {
630
+ const pathItem = {
631
+ type: "array",
632
+ origin: "value",
633
+ input,
634
+ key,
635
+ value: value2
636
+ };
637
+ for (const issue of itemDataset.issues) {
638
+ if (issue.path) issue.path.unshift(pathItem);
639
+ else issue.path = [pathItem];
640
+ dataset.issues?.push(issue);
641
+ }
642
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
643
+ if (config2.abortEarly) {
644
+ dataset.typed = false;
645
+ break;
646
+ }
647
+ }
648
+ if (!itemDataset.typed) dataset.typed = false;
649
+ dataset.value.push(itemDataset.value);
650
+ }
651
+ } else _addIssue(this, "type", dataset, config2);
652
+ return dataset;
653
+ }
654
+ };
655
+ }
656
+ /* @__NO_SIDE_EFFECTS__ */
657
+ function boolean(message) {
658
+ return {
659
+ kind: "schema",
660
+ type: "boolean",
661
+ reference: boolean,
662
+ expects: "boolean",
663
+ async: false,
664
+ message,
665
+ get "~standard"() {
666
+ return /* @__PURE__ */ _getStandardProps(this);
667
+ },
668
+ "~run"(dataset, config2) {
669
+ if (typeof dataset.value === "boolean") dataset.typed = true;
670
+ else _addIssue(this, "type", dataset, config2);
671
+ return dataset;
672
+ }
673
+ };
674
+ }
675
+ /* @__NO_SIDE_EFFECTS__ */
676
+ function custom(check2, message) {
677
+ return {
678
+ kind: "schema",
679
+ type: "custom",
680
+ reference: custom,
681
+ expects: "unknown",
682
+ async: false,
683
+ check: check2,
684
+ message,
685
+ get "~standard"() {
686
+ return /* @__PURE__ */ _getStandardProps(this);
687
+ },
688
+ "~run"(dataset, config2) {
689
+ if (this.check(dataset.value)) dataset.typed = true;
690
+ else _addIssue(this, "type", dataset, config2);
691
+ return dataset;
692
+ }
693
+ };
694
+ }
695
+ /* @__NO_SIDE_EFFECTS__ */
696
+ function enum_(enum__, message) {
697
+ const options = [];
698
+ for (const key in enum__) if (`${+key}` !== key || typeof enum__[key] !== "string" || !Object.is(enum__[enum__[key]], +key)) options.push(enum__[key]);
699
+ return {
700
+ kind: "schema",
701
+ type: "enum",
702
+ reference: enum_,
703
+ expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
704
+ async: false,
705
+ enum: enum__,
706
+ options,
707
+ message,
708
+ get "~standard"() {
709
+ return /* @__PURE__ */ _getStandardProps(this);
710
+ },
711
+ "~run"(dataset, config2) {
712
+ if (this.options.includes(dataset.value)) dataset.typed = true;
713
+ else _addIssue(this, "type", dataset, config2);
714
+ return dataset;
715
+ }
716
+ };
717
+ }
718
+ /* @__NO_SIDE_EFFECTS__ */
719
+ function function_(message) {
720
+ return {
721
+ kind: "schema",
722
+ type: "function",
723
+ reference: function_,
724
+ expects: "Function",
725
+ async: false,
726
+ message,
727
+ get "~standard"() {
728
+ return /* @__PURE__ */ _getStandardProps(this);
729
+ },
730
+ "~run"(dataset, config2) {
731
+ if (typeof dataset.value === "function") dataset.typed = true;
732
+ else _addIssue(this, "type", dataset, config2);
733
+ return dataset;
734
+ }
735
+ };
736
+ }
737
+ /* @__NO_SIDE_EFFECTS__ */
738
+ function instance(class_, message) {
739
+ return {
740
+ kind: "schema",
741
+ type: "instance",
742
+ reference: instance,
743
+ expects: class_.name,
744
+ async: false,
745
+ class: class_,
746
+ message,
747
+ get "~standard"() {
748
+ return /* @__PURE__ */ _getStandardProps(this);
749
+ },
750
+ "~run"(dataset, config2) {
751
+ if (dataset.value instanceof this.class) dataset.typed = true;
752
+ else _addIssue(this, "type", dataset, config2);
753
+ return dataset;
754
+ }
755
+ };
756
+ }
757
+ /* @__NO_SIDE_EFFECTS__ */
758
+ function literal(literal_, message) {
759
+ return {
760
+ kind: "schema",
761
+ type: "literal",
762
+ reference: literal,
763
+ expects: /* @__PURE__ */ _stringify(literal_),
764
+ async: false,
765
+ literal: literal_,
766
+ message,
767
+ get "~standard"() {
768
+ return /* @__PURE__ */ _getStandardProps(this);
769
+ },
770
+ "~run"(dataset, config2) {
771
+ if (dataset.value === this.literal) dataset.typed = true;
772
+ else _addIssue(this, "type", dataset, config2);
773
+ return dataset;
774
+ }
775
+ };
776
+ }
777
+ /* @__NO_SIDE_EFFECTS__ */
778
+ function looseObject(entries, message) {
779
+ return {
780
+ kind: "schema",
781
+ type: "loose_object",
782
+ reference: looseObject,
783
+ expects: "Object",
784
+ async: false,
785
+ entries,
786
+ message,
787
+ get "~standard"() {
788
+ return /* @__PURE__ */ _getStandardProps(this);
789
+ },
790
+ "~run"(dataset, config2) {
791
+ const input = dataset.value;
792
+ if (input && typeof input === "object") {
793
+ dataset.typed = true;
794
+ dataset.value = {};
795
+ for (const key in this.entries) {
796
+ const valueSchema = this.entries[key];
797
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
798
+ const value2 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
799
+ const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
800
+ if (valueDataset.issues) {
801
+ const pathItem = {
802
+ type: "object",
803
+ origin: "value",
804
+ input,
805
+ key,
806
+ value: value2
807
+ };
808
+ for (const issue of valueDataset.issues) {
809
+ if (issue.path) issue.path.unshift(pathItem);
810
+ else issue.path = [pathItem];
811
+ dataset.issues?.push(issue);
812
+ }
813
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
814
+ if (config2.abortEarly) {
815
+ dataset.typed = false;
816
+ break;
817
+ }
818
+ }
819
+ if (!valueDataset.typed) dataset.typed = false;
820
+ dataset.value[key] = valueDataset.value;
821
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
822
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
823
+ _addIssue(this, "key", dataset, config2, {
824
+ input: void 0,
825
+ expected: `"${key}"`,
826
+ path: [{
827
+ type: "object",
828
+ origin: "key",
829
+ input,
830
+ key,
831
+ value: input[key]
832
+ }]
833
+ });
834
+ if (config2.abortEarly) break;
835
+ }
836
+ }
837
+ if (!dataset.issues || !config2.abortEarly) {
838
+ for (const key in input) if (/* @__PURE__ */ _isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
839
+ }
840
+ } else _addIssue(this, "type", dataset, config2);
841
+ return dataset;
842
+ }
843
+ };
844
+ }
845
+ /* @__NO_SIDE_EFFECTS__ */
846
+ function never(message) {
847
+ return {
848
+ kind: "schema",
849
+ type: "never",
850
+ reference: never,
851
+ expects: "never",
852
+ async: false,
853
+ message,
854
+ get "~standard"() {
855
+ return /* @__PURE__ */ _getStandardProps(this);
856
+ },
857
+ "~run"(dataset, config2) {
858
+ _addIssue(this, "type", dataset, config2);
859
+ return dataset;
860
+ }
861
+ };
862
+ }
863
+ /* @__NO_SIDE_EFFECTS__ */
864
+ function nullish(wrapped, default_) {
865
+ return {
866
+ kind: "schema",
867
+ type: "nullish",
868
+ reference: nullish,
869
+ expects: `(${wrapped.expects} | null | undefined)`,
870
+ async: false,
871
+ wrapped,
872
+ default: default_,
873
+ get "~standard"() {
874
+ return /* @__PURE__ */ _getStandardProps(this);
875
+ },
876
+ "~run"(dataset, config2) {
877
+ if (dataset.value === null || dataset.value === void 0) {
878
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
879
+ if (dataset.value === null || dataset.value === void 0) {
880
+ dataset.typed = true;
881
+ return dataset;
882
+ }
883
+ }
884
+ return this.wrapped["~run"](dataset, config2);
885
+ }
886
+ };
887
+ }
888
+ /* @__NO_SIDE_EFFECTS__ */
889
+ function number(message) {
890
+ return {
891
+ kind: "schema",
892
+ type: "number",
893
+ reference: number,
894
+ expects: "number",
895
+ async: false,
896
+ message,
897
+ get "~standard"() {
898
+ return /* @__PURE__ */ _getStandardProps(this);
899
+ },
900
+ "~run"(dataset, config2) {
901
+ if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
902
+ else _addIssue(this, "type", dataset, config2);
903
+ return dataset;
904
+ }
905
+ };
906
+ }
907
+ /* @__NO_SIDE_EFFECTS__ */
908
+ function object(entries, message) {
909
+ return {
910
+ kind: "schema",
911
+ type: "object",
912
+ reference: object,
913
+ expects: "Object",
914
+ async: false,
915
+ entries,
916
+ message,
917
+ get "~standard"() {
918
+ return /* @__PURE__ */ _getStandardProps(this);
919
+ },
920
+ "~run"(dataset, config2) {
921
+ const input = dataset.value;
922
+ if (input && typeof input === "object") {
923
+ dataset.typed = true;
924
+ dataset.value = {};
925
+ for (const key in this.entries) {
926
+ const valueSchema = this.entries[key];
927
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
928
+ const value2 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
929
+ const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
930
+ if (valueDataset.issues) {
931
+ const pathItem = {
932
+ type: "object",
933
+ origin: "value",
934
+ input,
935
+ key,
936
+ value: value2
937
+ };
938
+ for (const issue of valueDataset.issues) {
939
+ if (issue.path) issue.path.unshift(pathItem);
940
+ else issue.path = [pathItem];
941
+ dataset.issues?.push(issue);
942
+ }
943
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
944
+ if (config2.abortEarly) {
945
+ dataset.typed = false;
946
+ break;
947
+ }
948
+ }
949
+ if (!valueDataset.typed) dataset.typed = false;
950
+ dataset.value[key] = valueDataset.value;
951
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
952
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
953
+ _addIssue(this, "key", dataset, config2, {
954
+ input: void 0,
955
+ expected: `"${key}"`,
956
+ path: [{
957
+ type: "object",
958
+ origin: "key",
959
+ input,
960
+ key,
961
+ value: input[key]
962
+ }]
963
+ });
964
+ if (config2.abortEarly) break;
965
+ }
966
+ }
967
+ } else _addIssue(this, "type", dataset, config2);
968
+ return dataset;
969
+ }
970
+ };
971
+ }
972
+ /* @__NO_SIDE_EFFECTS__ */
973
+ function optional(wrapped, default_) {
974
+ return {
975
+ kind: "schema",
976
+ type: "optional",
977
+ reference: optional,
978
+ expects: `(${wrapped.expects} | undefined)`,
979
+ async: false,
980
+ wrapped,
981
+ default: default_,
982
+ get "~standard"() {
983
+ return /* @__PURE__ */ _getStandardProps(this);
984
+ },
985
+ "~run"(dataset, config2) {
986
+ if (dataset.value === void 0) {
987
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
988
+ if (dataset.value === void 0) {
989
+ dataset.typed = true;
990
+ return dataset;
991
+ }
992
+ }
993
+ return this.wrapped["~run"](dataset, config2);
994
+ }
995
+ };
996
+ }
997
+ /* @__NO_SIDE_EFFECTS__ */
998
+ function picklist(options, message) {
999
+ return {
1000
+ kind: "schema",
1001
+ type: "picklist",
1002
+ reference: picklist,
1003
+ expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
1004
+ async: false,
1005
+ options,
1006
+ message,
1007
+ get "~standard"() {
1008
+ return /* @__PURE__ */ _getStandardProps(this);
1009
+ },
1010
+ "~run"(dataset, config2) {
1011
+ if (this.options.includes(dataset.value)) dataset.typed = true;
1012
+ else _addIssue(this, "type", dataset, config2);
1013
+ return dataset;
1014
+ }
1015
+ };
1016
+ }
1017
+ /* @__NO_SIDE_EFFECTS__ */
1018
+ function promise(message) {
1019
+ return {
1020
+ kind: "schema",
1021
+ type: "promise",
1022
+ reference: promise,
1023
+ expects: "Promise",
1024
+ async: false,
1025
+ message,
1026
+ get "~standard"() {
1027
+ return /* @__PURE__ */ _getStandardProps(this);
1028
+ },
1029
+ "~run"(dataset, config2) {
1030
+ if (dataset.value instanceof Promise) dataset.typed = true;
1031
+ else _addIssue(this, "type", dataset, config2);
1032
+ return dataset;
1033
+ }
1034
+ };
1035
+ }
1036
+ /* @__NO_SIDE_EFFECTS__ */
1037
+ function record(key, value2, message) {
1038
+ return {
1039
+ kind: "schema",
1040
+ type: "record",
1041
+ reference: record,
1042
+ expects: "Object",
1043
+ async: false,
1044
+ key,
1045
+ value: value2,
1046
+ message,
1047
+ get "~standard"() {
1048
+ return /* @__PURE__ */ _getStandardProps(this);
1049
+ },
1050
+ "~run"(dataset, config2) {
1051
+ const input = dataset.value;
1052
+ if (input && typeof input === "object") {
1053
+ dataset.typed = true;
1054
+ dataset.value = {};
1055
+ for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
1056
+ const entryValue = input[entryKey];
1057
+ const keyDataset = this.key["~run"]({ value: entryKey }, config2);
1058
+ if (keyDataset.issues) {
1059
+ const pathItem = {
1060
+ type: "object",
1061
+ origin: "key",
1062
+ input,
1063
+ key: entryKey,
1064
+ value: entryValue
1065
+ };
1066
+ for (const issue of keyDataset.issues) {
1067
+ issue.path = [pathItem];
1068
+ dataset.issues?.push(issue);
1069
+ }
1070
+ if (!dataset.issues) dataset.issues = keyDataset.issues;
1071
+ if (config2.abortEarly) {
1072
+ dataset.typed = false;
1073
+ break;
1074
+ }
1075
+ }
1076
+ const valueDataset = this.value["~run"]({ value: entryValue }, config2);
1077
+ if (valueDataset.issues) {
1078
+ const pathItem = {
1079
+ type: "object",
1080
+ origin: "value",
1081
+ input,
1082
+ key: entryKey,
1083
+ value: entryValue
1084
+ };
1085
+ for (const issue of valueDataset.issues) {
1086
+ if (issue.path) issue.path.unshift(pathItem);
1087
+ else issue.path = [pathItem];
1088
+ dataset.issues?.push(issue);
1089
+ }
1090
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1091
+ if (config2.abortEarly) {
1092
+ dataset.typed = false;
1093
+ break;
1094
+ }
1095
+ }
1096
+ if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
1097
+ if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
1098
+ }
1099
+ } else _addIssue(this, "type", dataset, config2);
1100
+ return dataset;
1101
+ }
1102
+ };
1103
+ }
1104
+ /* @__NO_SIDE_EFFECTS__ */
1105
+ function strictObject(entries, message) {
1106
+ return {
1107
+ kind: "schema",
1108
+ type: "strict_object",
1109
+ reference: strictObject,
1110
+ expects: "Object",
1111
+ async: false,
1112
+ entries,
1113
+ message,
1114
+ get "~standard"() {
1115
+ return /* @__PURE__ */ _getStandardProps(this);
1116
+ },
1117
+ "~run"(dataset, config2) {
1118
+ const input = dataset.value;
1119
+ if (input && typeof input === "object") {
1120
+ dataset.typed = true;
1121
+ dataset.value = {};
1122
+ for (const key in this.entries) {
1123
+ const valueSchema = this.entries[key];
1124
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
1125
+ const value2 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
1126
+ const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
1127
+ if (valueDataset.issues) {
1128
+ const pathItem = {
1129
+ type: "object",
1130
+ origin: "value",
1131
+ input,
1132
+ key,
1133
+ value: value2
1134
+ };
1135
+ for (const issue of valueDataset.issues) {
1136
+ if (issue.path) issue.path.unshift(pathItem);
1137
+ else issue.path = [pathItem];
1138
+ dataset.issues?.push(issue);
1139
+ }
1140
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1141
+ if (config2.abortEarly) {
1142
+ dataset.typed = false;
1143
+ break;
1144
+ }
1145
+ }
1146
+ if (!valueDataset.typed) dataset.typed = false;
1147
+ dataset.value[key] = valueDataset.value;
1148
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
1149
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
1150
+ _addIssue(this, "key", dataset, config2, {
1151
+ input: void 0,
1152
+ expected: `"${key}"`,
1153
+ path: [{
1154
+ type: "object",
1155
+ origin: "key",
1156
+ input,
1157
+ key,
1158
+ value: input[key]
1159
+ }]
1160
+ });
1161
+ if (config2.abortEarly) break;
1162
+ }
1163
+ }
1164
+ if (!dataset.issues || !config2.abortEarly) {
1165
+ for (const key in input) if (!(key in this.entries)) {
1166
+ _addIssue(this, "key", dataset, config2, {
1167
+ input: key,
1168
+ expected: "never",
1169
+ path: [{
1170
+ type: "object",
1171
+ origin: "key",
1172
+ input,
1173
+ key,
1174
+ value: input[key]
1175
+ }]
1176
+ });
1177
+ break;
1178
+ }
1179
+ }
1180
+ } else _addIssue(this, "type", dataset, config2);
1181
+ return dataset;
1182
+ }
1183
+ };
1184
+ }
1185
+ /* @__NO_SIDE_EFFECTS__ */
1186
+ function string(message) {
1187
+ return {
1188
+ kind: "schema",
1189
+ type: "string",
1190
+ reference: string,
1191
+ expects: "string",
1192
+ async: false,
1193
+ message,
1194
+ get "~standard"() {
1195
+ return /* @__PURE__ */ _getStandardProps(this);
1196
+ },
1197
+ "~run"(dataset, config2) {
1198
+ if (typeof dataset.value === "string") dataset.typed = true;
1199
+ else _addIssue(this, "type", dataset, config2);
1200
+ return dataset;
1201
+ }
1202
+ };
1203
+ }
1204
+ /* @__NO_SIDE_EFFECTS__ */
1205
+ function tuple(items, message) {
1206
+ return {
1207
+ kind: "schema",
1208
+ type: "tuple",
1209
+ reference: tuple,
1210
+ expects: "Array",
1211
+ async: false,
1212
+ items,
1213
+ message,
1214
+ get "~standard"() {
1215
+ return /* @__PURE__ */ _getStandardProps(this);
1216
+ },
1217
+ "~run"(dataset, config2) {
1218
+ const input = dataset.value;
1219
+ if (Array.isArray(input)) {
1220
+ dataset.typed = true;
1221
+ dataset.value = [];
1222
+ for (let key = 0; key < this.items.length; key++) {
1223
+ const value2 = input[key];
1224
+ const itemDataset = this.items[key]["~run"]({ value: value2 }, config2);
1225
+ if (itemDataset.issues) {
1226
+ const pathItem = {
1227
+ type: "array",
1228
+ origin: "value",
1229
+ input,
1230
+ key,
1231
+ value: value2
1232
+ };
1233
+ for (const issue of itemDataset.issues) {
1234
+ if (issue.path) issue.path.unshift(pathItem);
1235
+ else issue.path = [pathItem];
1236
+ dataset.issues?.push(issue);
1237
+ }
1238
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
1239
+ if (config2.abortEarly) {
1240
+ dataset.typed = false;
1241
+ break;
1242
+ }
1243
+ }
1244
+ if (!itemDataset.typed) dataset.typed = false;
1245
+ dataset.value.push(itemDataset.value);
1246
+ }
1247
+ } else _addIssue(this, "type", dataset, config2);
1248
+ return dataset;
1249
+ }
1250
+ };
1251
+ }
1252
+ /* @__NO_SIDE_EFFECTS__ */
1253
+ function _subIssues(datasets) {
1254
+ let issues;
1255
+ if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
1256
+ else issues = dataset.issues;
1257
+ return issues;
1258
+ }
1259
+ /* @__NO_SIDE_EFFECTS__ */
1260
+ function union(options, message) {
1261
+ return {
1262
+ kind: "schema",
1263
+ type: "union",
1264
+ reference: union,
1265
+ expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
1266
+ async: false,
1267
+ options,
1268
+ message,
1269
+ get "~standard"() {
1270
+ return /* @__PURE__ */ _getStandardProps(this);
1271
+ },
1272
+ "~run"(dataset, config2) {
1273
+ let validDataset;
1274
+ let typedDatasets;
1275
+ let untypedDatasets;
1276
+ for (const schema of this.options) {
1277
+ const optionDataset = schema["~run"]({ value: dataset.value }, config2);
1278
+ if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
1279
+ else typedDatasets = [optionDataset];
1280
+ else {
1281
+ validDataset = optionDataset;
1282
+ break;
1283
+ }
1284
+ else if (untypedDatasets) untypedDatasets.push(optionDataset);
1285
+ else untypedDatasets = [optionDataset];
1286
+ }
1287
+ if (validDataset) return validDataset;
1288
+ if (typedDatasets) {
1289
+ if (typedDatasets.length === 1) return typedDatasets[0];
1290
+ _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
1291
+ dataset.typed = true;
1292
+ } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
1293
+ else _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
1294
+ return dataset;
1295
+ }
1296
+ };
1297
+ }
1298
+ /* @__NO_SIDE_EFFECTS__ */
1299
+ function unionAsync(options, message) {
1300
+ return {
1301
+ kind: "schema",
1302
+ type: "union",
1303
+ reference: unionAsync,
1304
+ expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
1305
+ async: true,
1306
+ options,
1307
+ message,
1308
+ get "~standard"() {
1309
+ return /* @__PURE__ */ _getStandardProps(this);
1310
+ },
1311
+ async "~run"(dataset, config2) {
1312
+ let validDataset;
1313
+ let typedDatasets;
1314
+ let untypedDatasets;
1315
+ for (const schema of this.options) {
1316
+ const optionDataset = await schema["~run"]({ value: dataset.value }, config2);
1317
+ if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
1318
+ else typedDatasets = [optionDataset];
1319
+ else {
1320
+ validDataset = optionDataset;
1321
+ break;
1322
+ }
1323
+ else if (untypedDatasets) untypedDatasets.push(optionDataset);
1324
+ else untypedDatasets = [optionDataset];
1325
+ }
1326
+ if (validDataset) return validDataset;
1327
+ if (typedDatasets) {
1328
+ if (typedDatasets.length === 1) return typedDatasets[0];
1329
+ _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
1330
+ dataset.typed = true;
1331
+ } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
1332
+ else _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
1333
+ return dataset;
1334
+ }
1335
+ };
1336
+ }
1337
+ /* @__NO_SIDE_EFFECTS__ */
1338
+ function keyof(schema, message) {
1339
+ return /* @__PURE__ */ picklist(Object.keys(schema.entries), message);
1340
+ }
1341
+ /* @__NO_SIDE_EFFECTS__ */
1342
+ function omit(schema, keys) {
1343
+ const entries = { ...schema.entries };
1344
+ for (const key of keys) delete entries[key];
1345
+ return {
1346
+ ...schema,
1347
+ entries,
1348
+ get "~standard"() {
1349
+ return /* @__PURE__ */ _getStandardProps(this);
1350
+ }
1351
+ };
1352
+ }
1353
+ /* @__NO_SIDE_EFFECTS__ */
1354
+ function pipe(...pipe2) {
1355
+ return {
1356
+ ...pipe2[0],
1357
+ pipe: pipe2,
1358
+ get "~standard"() {
1359
+ return /* @__PURE__ */ _getStandardProps(this);
1360
+ },
1361
+ "~run"(dataset, config2) {
1362
+ for (const item of pipe2) if (item.kind !== "metadata") {
1363
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
1364
+ dataset.typed = false;
1365
+ break;
1366
+ }
1367
+ if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) dataset = item["~run"](dataset, config2);
1368
+ }
1369
+ return dataset;
1370
+ }
1371
+ };
1372
+ }
1373
+ /* @__NO_SIDE_EFFECTS__ */
1374
+ function pipeAsync(...pipe2) {
1375
+ return {
1376
+ ...pipe2[0],
1377
+ pipe: pipe2,
1378
+ async: true,
1379
+ get "~standard"() {
1380
+ return /* @__PURE__ */ _getStandardProps(this);
1381
+ },
1382
+ async "~run"(dataset, config2) {
1383
+ for (const item of pipe2) if (item.kind !== "metadata") {
1384
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
1385
+ dataset.typed = false;
1386
+ break;
1387
+ }
1388
+ if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) dataset = await item["~run"](dataset, config2);
1389
+ }
1390
+ return dataset;
1391
+ }
1392
+ };
1393
+ }
1394
+ /* @__NO_SIDE_EFFECTS__ */
1395
+ function safeParse(schema, input, config2) {
1396
+ const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
1397
+ return {
1398
+ typed: dataset.typed,
1399
+ success: !dataset.issues,
1400
+ output: dataset.value,
1401
+ issues: dataset.issues
1402
+ };
1403
+ }
1404
+
1405
+ //#endregion
1406
+ //#region ../../node_modules/.pnpm/@valibot+to-json-schema@1.0.0_valibot@1.0.0_typescript@5.8.3_/node_modules/@valibot/to-json-schema/dist/index.js
1407
+ function handleError(message, config) {
1408
+ switch (config?.errorMode) {
1409
+ case "ignore": break;
1410
+ case "warn": {
1411
+ console.warn(message);
1412
+ break;
1413
+ }
1414
+ default: throw new Error(message);
1415
+ }
1416
+ }
1417
+ function convertAction(jsonSchema, valibotAction, config) {
1418
+ switch (valibotAction.type) {
1419
+ case "base64": {
1420
+ jsonSchema.contentEncoding = "base64";
1421
+ break;
1422
+ }
1423
+ case "bic":
1424
+ case "cuid2":
1425
+ case "decimal":
1426
+ case "digits":
1427
+ case "emoji":
1428
+ case "hexadecimal":
1429
+ case "hex_color":
1430
+ case "nanoid":
1431
+ case "octal":
1432
+ case "ulid": {
1433
+ jsonSchema.pattern = valibotAction.requirement.source;
1434
+ break;
1435
+ }
1436
+ case "description": {
1437
+ jsonSchema.description = valibotAction.description;
1438
+ break;
1439
+ }
1440
+ case "email": {
1441
+ jsonSchema.format = "email";
1442
+ break;
1443
+ }
1444
+ case "empty": {
1445
+ if (jsonSchema.type === "array") jsonSchema.maxItems = 0;
1446
+ else {
1447
+ if (jsonSchema.type !== "string") handleError(`The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`, config);
1448
+ jsonSchema.maxLength = 0;
1449
+ }
1450
+ break;
1451
+ }
1452
+ case "integer": {
1453
+ jsonSchema.type = "integer";
1454
+ break;
1455
+ }
1456
+ case "ipv4": {
1457
+ jsonSchema.format = "ipv4";
1458
+ break;
1459
+ }
1460
+ case "ipv6": {
1461
+ jsonSchema.format = "ipv6";
1462
+ break;
1463
+ }
1464
+ case "iso_date": {
1465
+ jsonSchema.format = "date";
1466
+ break;
1467
+ }
1468
+ case "iso_date_time":
1469
+ case "iso_timestamp": {
1470
+ jsonSchema.format = "date-time";
1471
+ break;
1472
+ }
1473
+ case "iso_time": {
1474
+ jsonSchema.format = "time";
1475
+ break;
1476
+ }
1477
+ case "length": {
1478
+ if (jsonSchema.type === "array") {
1479
+ jsonSchema.minItems = valibotAction.requirement;
1480
+ jsonSchema.maxItems = valibotAction.requirement;
1481
+ } else {
1482
+ if (jsonSchema.type !== "string") handleError(`The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`, config);
1483
+ jsonSchema.minLength = valibotAction.requirement;
1484
+ jsonSchema.maxLength = valibotAction.requirement;
1485
+ }
1486
+ break;
1487
+ }
1488
+ case "max_length": {
1489
+ if (jsonSchema.type === "array") jsonSchema.maxItems = valibotAction.requirement;
1490
+ else {
1491
+ if (jsonSchema.type !== "string") handleError(`The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`, config);
1492
+ jsonSchema.maxLength = valibotAction.requirement;
1493
+ }
1494
+ break;
1495
+ }
1496
+ case "max_value": {
1497
+ if (jsonSchema.type !== "number") handleError(`The "max_value" action is not supported on type "${jsonSchema.type}".`, config);
1498
+ jsonSchema.maximum = valibotAction.requirement;
1499
+ break;
1500
+ }
1501
+ case "min_length": {
1502
+ if (jsonSchema.type === "array") jsonSchema.minItems = valibotAction.requirement;
1503
+ else {
1504
+ if (jsonSchema.type !== "string") handleError(`The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`, config);
1505
+ jsonSchema.minLength = valibotAction.requirement;
1506
+ }
1507
+ break;
1508
+ }
1509
+ case "min_value": {
1510
+ if (jsonSchema.type !== "number") handleError(`The "min_value" action is not supported on type "${jsonSchema.type}".`, config);
1511
+ jsonSchema.minimum = valibotAction.requirement;
1512
+ break;
1513
+ }
1514
+ case "multiple_of": {
1515
+ jsonSchema.multipleOf = valibotAction.requirement;
1516
+ break;
1517
+ }
1518
+ case "non_empty": {
1519
+ if (jsonSchema.type === "array") jsonSchema.minItems = 1;
1520
+ else {
1521
+ if (jsonSchema.type !== "string") handleError(`The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`, config);
1522
+ jsonSchema.minLength = 1;
1523
+ }
1524
+ break;
1525
+ }
1526
+ case "regex": {
1527
+ if (valibotAction.requirement.flags) handleError("RegExp flags are not supported by JSON Schema.", config);
1528
+ jsonSchema.pattern = valibotAction.requirement.source;
1529
+ break;
1530
+ }
1531
+ case "title": {
1532
+ jsonSchema.title = valibotAction.title;
1533
+ break;
1534
+ }
1535
+ case "url": {
1536
+ jsonSchema.format = "uri";
1537
+ break;
1538
+ }
1539
+ case "uuid": {
1540
+ jsonSchema.format = "uuid";
1541
+ break;
1542
+ }
1543
+ case "value": {
1544
+ jsonSchema.const = valibotAction.requirement;
1545
+ break;
1546
+ }
1547
+ default: handleError(
1548
+ // @ts-expect-error
1549
+ `The "${valibotAction.type}" action cannot be converted to JSON Schema.`,
1550
+ config
1551
+ );
1552
+ }
1553
+ return jsonSchema;
1554
+ }
1555
+ var refCount = 0;
1556
+ function convertSchema(jsonSchema, valibotSchema, config, context) {
1557
+ const referenceId = context.referenceMap.get(valibotSchema);
1558
+ if (referenceId && referenceId in context.definitions) {
1559
+ jsonSchema.$ref = `#/$defs/${referenceId}`;
1560
+ return jsonSchema;
1561
+ }
1562
+ if ("pipe" in valibotSchema) {
1563
+ for (let index = 0; index < valibotSchema.pipe.length; index++) {
1564
+ const valibotPipeItem = valibotSchema.pipe[index];
1565
+ if (valibotPipeItem.kind === "schema") {
1566
+ if (index > 0) handleError("A \"pipe\" with multiple schemas cannot be converted to JSON Schema.", config);
1567
+ const tempJsonSchema = convertSchema({}, valibotPipeItem, config, context);
1568
+ if (tempJsonSchema.$ref) {
1569
+ const referenceId2 = tempJsonSchema.$ref.split("/")[2];
1570
+ Object.assign(jsonSchema, context.definitions[referenceId2]);
1571
+ } else Object.assign(jsonSchema, tempJsonSchema);
1572
+ } else jsonSchema = convertAction(jsonSchema, valibotPipeItem, config);
1573
+ }
1574
+ return jsonSchema;
1575
+ }
1576
+ switch (valibotSchema.type) {
1577
+ case "boolean": {
1578
+ jsonSchema.type = "boolean";
1579
+ break;
1580
+ }
1581
+ case "null": {
1582
+ jsonSchema.type = "null";
1583
+ break;
1584
+ }
1585
+ case "number": {
1586
+ jsonSchema.type = "number";
1587
+ break;
1588
+ }
1589
+ case "string": {
1590
+ jsonSchema.type = "string";
1591
+ break;
1592
+ }
1593
+ case "array": {
1594
+ jsonSchema.type = "array";
1595
+ jsonSchema.items = convertSchema({}, valibotSchema.item, config, context);
1596
+ break;
1597
+ }
1598
+ case "tuple":
1599
+ case "tuple_with_rest":
1600
+ case "loose_tuple":
1601
+ case "strict_tuple": {
1602
+ jsonSchema.type = "array";
1603
+ jsonSchema.items = [];
1604
+ for (const item of valibotSchema.items) jsonSchema.items.push(convertSchema({}, item, config, context));
1605
+ if (valibotSchema.type === "tuple_with_rest") jsonSchema.additionalItems = convertSchema({}, valibotSchema.rest, config, context);
1606
+ else jsonSchema.additionalItems = valibotSchema.type === "loose_tuple";
1607
+ break;
1608
+ }
1609
+ case "object":
1610
+ case "object_with_rest":
1611
+ case "loose_object":
1612
+ case "strict_object": {
1613
+ jsonSchema.type = "object";
1614
+ jsonSchema.properties = {};
1615
+ jsonSchema.required = [];
1616
+ for (const key in valibotSchema.entries) {
1617
+ const entry = valibotSchema.entries[key];
1618
+ jsonSchema.properties[key] = convertSchema({}, entry, config, context);
1619
+ if (entry.type !== "nullish" && entry.type !== "optional") jsonSchema.required.push(key);
1620
+ }
1621
+ if (valibotSchema.type === "object_with_rest") jsonSchema.additionalProperties = convertSchema({}, valibotSchema.rest, config, context);
1622
+ else if (valibotSchema.type === "strict_object") jsonSchema.additionalProperties = false;
1623
+ break;
1624
+ }
1625
+ case "record": {
1626
+ if ("pipe" in valibotSchema.key) handleError("The \"record\" schema with a schema for the key that contains a \"pipe\" cannot be converted to JSON Schema.", config);
1627
+ if (valibotSchema.key.type !== "string") handleError(`The "record" schema with the "${valibotSchema.key.type}" schema for the key cannot be converted to JSON Schema.`, config);
1628
+ jsonSchema.type = "object";
1629
+ jsonSchema.additionalProperties = convertSchema({}, valibotSchema.value, config, context);
1630
+ break;
1631
+ }
1632
+ case "any":
1633
+ case "unknown": break;
1634
+ case "nullable":
1635
+ case "nullish": {
1636
+ jsonSchema.anyOf = [convertSchema({}, valibotSchema.wrapped, config, context), { type: "null" }];
1637
+ if (valibotSchema.default !== void 0) jsonSchema.default = getDefault(valibotSchema);
1638
+ break;
1639
+ }
1640
+ case "exact_optional":
1641
+ case "optional":
1642
+ case "undefinedable": {
1643
+ jsonSchema = convertSchema(jsonSchema, valibotSchema.wrapped, config, context);
1644
+ if (valibotSchema.default !== void 0) jsonSchema.default = getDefault(valibotSchema);
1645
+ break;
1646
+ }
1647
+ case "literal": {
1648
+ if (typeof valibotSchema.literal !== "boolean" && typeof valibotSchema.literal !== "number" && typeof valibotSchema.literal !== "string") handleError("The value of the \"literal\" schema is not JSON compatible.", config);
1649
+ jsonSchema.const = valibotSchema.literal;
1650
+ break;
1651
+ }
1652
+ case "enum": {
1653
+ jsonSchema.enum = valibotSchema.options;
1654
+ break;
1655
+ }
1656
+ case "picklist": {
1657
+ if (valibotSchema.options.some((option) => typeof option !== "number" && typeof option !== "string")) handleError("An option of the \"picklist\" schema is not JSON compatible.", config);
1658
+ jsonSchema.enum = valibotSchema.options;
1659
+ break;
1660
+ }
1661
+ case "union":
1662
+ case "variant": {
1663
+ jsonSchema.anyOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
1664
+ break;
1665
+ }
1666
+ case "intersect": {
1667
+ jsonSchema.allOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
1668
+ break;
1669
+ }
1670
+ case "lazy": {
1671
+ let wrappedValibotSchema = context.getterMap.get(valibotSchema.getter);
1672
+ if (!wrappedValibotSchema) {
1673
+ wrappedValibotSchema = valibotSchema.getter(void 0);
1674
+ context.getterMap.set(valibotSchema.getter, wrappedValibotSchema);
1675
+ }
1676
+ let referenceId2 = context.referenceMap.get(wrappedValibotSchema);
1677
+ if (!referenceId2) {
1678
+ referenceId2 = `${refCount++}`;
1679
+ context.referenceMap.set(wrappedValibotSchema, referenceId2);
1680
+ context.definitions[referenceId2] = convertSchema({}, wrappedValibotSchema, config, context);
1681
+ }
1682
+ jsonSchema.$ref = `#/$defs/${referenceId2}`;
1683
+ break;
1684
+ }
1685
+ default: handleError(
1686
+ // @ts-expect-error
1687
+ `The "${valibotSchema.type}" schema cannot be converted to JSON Schema.`,
1688
+ config
1689
+ );
1690
+ }
1691
+ return jsonSchema;
1692
+ }
1693
+ function toJsonSchema(schema, config) {
1694
+ const context = {
1695
+ definitions: {},
1696
+ referenceMap: /* @__PURE__ */ new Map(),
1697
+ getterMap: /* @__PURE__ */ new Map()
1698
+ };
1699
+ if (config?.definitions) {
1700
+ for (const key in config.definitions) context.referenceMap.set(config.definitions[key], key);
1701
+ for (const key in config.definitions) context.definitions[key] = convertSchema(
1702
+ {},
1703
+ // @ts-expect-error
1704
+ config.definitions[key],
1705
+ config,
1706
+ context
1707
+ );
1708
+ }
1709
+ const jsonSchema = convertSchema(
1710
+ { $schema: "http://json-schema.org/draft-07/schema#" },
1711
+ // @ts-expect-error
1712
+ schema,
1713
+ config,
1714
+ context
1715
+ );
1716
+ if (context.referenceMap.size) jsonSchema.$defs = context.definitions;
1717
+ return jsonSchema;
1718
+ }
1719
+
438
1720
  //#endregion
439
1721
  //#region src/utils/validator.ts
440
- const StringOrRegExpSchema = valibot.union([valibot.string(), valibot.instance(RegExp)]);
441
- const LogLevelSchema = valibot.union([
442
- valibot.literal("debug"),
443
- valibot.literal("info"),
444
- valibot.literal("warn")
1722
+ const StringOrRegExpSchema = union([string(), instance(RegExp)]);
1723
+ const LogLevelSchema = union([
1724
+ literal("debug"),
1725
+ literal("info"),
1726
+ literal("warn")
445
1727
  ]);
446
- const LogLevelOptionSchema = valibot.union([LogLevelSchema, valibot.literal("silent")]);
447
- const LogLevelWithErrorSchema = valibot.union([LogLevelSchema, valibot.literal("error")]);
448
- const RollupLogSchema = valibot.any();
449
- const RollupLogWithStringSchema = valibot.union([RollupLogSchema, valibot.string()]);
450
- const InputOptionSchema = valibot.union([
451
- valibot.string(),
452
- valibot.array(valibot.string()),
453
- valibot.record(valibot.string(), valibot.string())
1728
+ const LogLevelOptionSchema = union([LogLevelSchema, literal("silent")]);
1729
+ const LogLevelWithErrorSchema = union([LogLevelSchema, literal("error")]);
1730
+ const RollupLogSchema = any();
1731
+ const RollupLogWithStringSchema = union([RollupLogSchema, string()]);
1732
+ const InputOptionSchema = union([
1733
+ string(),
1734
+ array(string()),
1735
+ record(string(), string())
454
1736
  ]);
455
- const ExternalSchema = valibot.union([
1737
+ const ExternalSchema = union([
456
1738
  StringOrRegExpSchema,
457
- valibot.array(StringOrRegExpSchema),
458
- valibot.pipe(valibot.function(), valibot.args(valibot.tuple([
459
- valibot.string(),
460
- valibot.optional(valibot.string()),
461
- valibot.boolean()
462
- ])), valibot.returns(valibot.nullish(valibot.boolean())))
1739
+ array(StringOrRegExpSchema),
1740
+ pipe(function_(), args(tuple([
1741
+ string(),
1742
+ optional(string()),
1743
+ boolean()
1744
+ ])), returns(nullish(boolean())))
463
1745
  ]);
464
- const ModuleTypesSchema = valibot.record(valibot.string(), valibot.union([
465
- valibot.literal("base64"),
466
- valibot.literal("binary"),
467
- valibot.literal("css"),
468
- valibot.literal("dataurl"),
469
- valibot.literal("empty"),
470
- valibot.literal("js"),
471
- valibot.literal("json"),
472
- valibot.literal("jsx"),
473
- valibot.literal("text"),
474
- valibot.literal("ts"),
475
- valibot.literal("tsx")
1746
+ const ModuleTypesSchema = record(string(), union([
1747
+ literal("base64"),
1748
+ literal("binary"),
1749
+ literal("css"),
1750
+ literal("dataurl"),
1751
+ literal("empty"),
1752
+ literal("js"),
1753
+ literal("json"),
1754
+ literal("jsx"),
1755
+ literal("text"),
1756
+ literal("ts"),
1757
+ literal("tsx")
476
1758
  ]));
477
- const JsxOptionsSchema = valibot.strictObject({
478
- development: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Development specific information")),
479
- factory: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Jsx element transformation")),
480
- fragment: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Jsx fragment transformation")),
481
- importSource: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Import the factory of element and fragment if mode is classic")),
482
- jsxImportSource: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Import the factory of element and fragment if mode is automatic")),
483
- mode: valibot.pipe(valibot.optional(valibot.union([
484
- valibot.literal("classic"),
485
- valibot.literal("automatic"),
486
- valibot.literal("preserve")
487
- ])), valibot.description("Jsx transformation mode")),
488
- refresh: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("React refresh transformation"))
1759
+ const JsxOptionsSchema = strictObject({
1760
+ development: pipe(optional(boolean()), description("Development specific information")),
1761
+ factory: pipe(optional(string()), description("Jsx element transformation")),
1762
+ fragment: pipe(optional(string()), description("Jsx fragment transformation")),
1763
+ importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
1764
+ jsxImportSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is automatic")),
1765
+ mode: pipe(optional(union([
1766
+ literal("classic"),
1767
+ literal("automatic"),
1768
+ literal("preserve")
1769
+ ])), description("Jsx transformation mode")),
1770
+ refresh: pipe(optional(boolean()), description("React refresh transformation"))
489
1771
  });
490
- const HelperModeSchema = valibot.union([valibot.literal("Runtime"), valibot.literal("External")]);
491
- const DecoratorOptionSchema = valibot.object({
492
- legacy: valibot.optional(valibot.boolean()),
493
- emitDecoratorMetadata: valibot.optional(valibot.boolean())
1772
+ const HelperModeSchema = union([literal("Runtime"), literal("External")]);
1773
+ const DecoratorOptionSchema = object({
1774
+ legacy: optional(boolean()),
1775
+ emitDecoratorMetadata: optional(boolean())
494
1776
  });
495
- const HelpersSchema = valibot.object({ mode: valibot.optional(HelperModeSchema) });
496
- const RewriteImportExtensionsSchema = valibot.union([
497
- valibot.literal("rewrite"),
498
- valibot.literal("remove"),
499
- valibot.boolean()
1777
+ const HelpersSchema = object({ mode: optional(HelperModeSchema) });
1778
+ const RewriteImportExtensionsSchema = union([
1779
+ literal("rewrite"),
1780
+ literal("remove"),
1781
+ boolean()
500
1782
  ]);
501
- const TypescriptSchema = valibot.object({
502
- jsxPragma: valibot.optional(valibot.string()),
503
- jsxPragmaFrag: valibot.optional(valibot.string()),
504
- onlyRemoveTypeImports: valibot.optional(valibot.boolean()),
505
- allowNamespaces: valibot.optional(valibot.boolean()),
506
- allowDeclareFields: valibot.optional(valibot.boolean()),
507
- declaration: valibot.optional(valibot.object({
508
- stripInternal: valibot.optional(valibot.boolean()),
509
- sourcemap: valibot.optional(valibot.boolean())
1783
+ const TypescriptSchema = object({
1784
+ jsxPragma: optional(string()),
1785
+ jsxPragmaFrag: optional(string()),
1786
+ onlyRemoveTypeImports: optional(boolean()),
1787
+ allowNamespaces: optional(boolean()),
1788
+ allowDeclareFields: optional(boolean()),
1789
+ declaration: optional(object({
1790
+ stripInternal: optional(boolean()),
1791
+ sourcemap: optional(boolean())
510
1792
  })),
511
- rewriteImportExtensions: valibot.optional(RewriteImportExtensionsSchema)
1793
+ rewriteImportExtensions: optional(RewriteImportExtensionsSchema)
512
1794
  });
513
- const AssumptionsSchema = valibot.object({
514
- ignoreFunctionLength: valibot.optional(valibot.boolean()),
515
- noDocumentAll: valibot.optional(valibot.boolean()),
516
- objectRestNoSymbols: valibot.optional(valibot.boolean()),
517
- pureGetters: valibot.optional(valibot.boolean()),
518
- setPublicClassFields: valibot.optional(valibot.boolean())
1795
+ const AssumptionsSchema = object({
1796
+ ignoreFunctionLength: optional(boolean()),
1797
+ noDocumentAll: optional(boolean()),
1798
+ objectRestNoSymbols: optional(boolean()),
1799
+ pureGetters: optional(boolean()),
1800
+ setPublicClassFields: optional(boolean())
519
1801
  });
520
- const TransformOptionsSchema = valibot.object({
521
- assumptions: valibot.optional(AssumptionsSchema),
522
- typescript: valibot.optional(TypescriptSchema),
523
- helpers: valibot.optional(HelpersSchema),
524
- decorators: valibot.optional(DecoratorOptionSchema)
1802
+ const TransformOptionsSchema = object({
1803
+ assumptions: optional(AssumptionsSchema),
1804
+ typescript: optional(TypescriptSchema),
1805
+ helpers: optional(HelpersSchema),
1806
+ decorators: optional(DecoratorOptionSchema)
525
1807
  });
526
- const WatchOptionsSchema = valibot.strictObject({
527
- chokidar: valibot.optional(valibot.never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
528
- exclude: valibot.optional(valibot.union([StringOrRegExpSchema, valibot.array(StringOrRegExpSchema)])),
529
- include: valibot.optional(valibot.union([StringOrRegExpSchema, valibot.array(StringOrRegExpSchema)])),
530
- notify: valibot.pipe(valibot.optional(valibot.strictObject({
531
- compareContents: valibot.optional(valibot.boolean()),
532
- pollInterval: valibot.optional(valibot.number())
533
- })), valibot.description("Notify options")),
534
- skipWrite: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Skip the bundle.write() step")),
535
- buildDelay: valibot.pipe(valibot.optional(valibot.number()), valibot.description("Throttle watch rebuilds"))
1808
+ const WatchOptionsSchema = strictObject({
1809
+ chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
1810
+ exclude: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
1811
+ include: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
1812
+ notify: pipe(optional(strictObject({
1813
+ compareContents: optional(boolean()),
1814
+ pollInterval: optional(number())
1815
+ })), description("Notify options")),
1816
+ skipWrite: pipe(optional(boolean()), description("Skip the bundle.write() step")),
1817
+ buildDelay: pipe(optional(number()), description("Throttle watch rebuilds"))
536
1818
  });
537
- const ChecksOptionsSchema = valibot.strictObject({
538
- circularDependency: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting circular dependency")),
539
- eval: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting eval")),
540
- missingGlobalName: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting missing global name")),
541
- missingNameOptionForIifeExport: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting missing name option for iife export")),
542
- mixedExport: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting mixed export")),
543
- unresolvedEntry: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting unresolved entry")),
544
- unresolvedImport: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting unresolved import")),
545
- filenameConflict: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting filename conflict")),
546
- commonJsVariableInEsm: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting common js variable in esm")),
547
- importIsUndefined: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting import is undefined")),
548
- configurationFieldConflict: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting configuration field conflict"))
1819
+ const ChecksOptionsSchema = strictObject({
1820
+ circularDependency: pipe(optional(boolean()), description("Whether to emit warning when detecting circular dependency")),
1821
+ eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
1822
+ missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
1823
+ missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
1824
+ mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
1825
+ unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
1826
+ unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
1827
+ filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
1828
+ commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
1829
+ importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
1830
+ configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
549
1831
  });
550
- const MinifyOptionsSchema = valibot.strictObject({
551
- mangle: valibot.optional(valibot.boolean()),
552
- compress: valibot.optional(valibot.boolean()),
553
- removeWhitespace: valibot.optional(valibot.boolean())
1832
+ const MinifyOptionsSchema = strictObject({
1833
+ mangle: optional(boolean()),
1834
+ compress: optional(boolean()),
1835
+ removeWhitespace: optional(boolean())
554
1836
  });
555
- const ResolveOptionsSchema = valibot.strictObject({
556
- alias: valibot.optional(valibot.record(valibot.string(), valibot.union([valibot.string(), valibot.array(valibot.string())]))),
557
- aliasFields: valibot.optional(valibot.array(valibot.array(valibot.string()))),
558
- conditionNames: valibot.optional(valibot.array(valibot.string())),
559
- extensionAlias: valibot.optional(valibot.record(valibot.string(), valibot.array(valibot.string()))),
560
- exportsFields: valibot.optional(valibot.array(valibot.array(valibot.string()))),
561
- extensions: valibot.optional(valibot.array(valibot.string())),
562
- mainFields: valibot.optional(valibot.array(valibot.string())),
563
- mainFiles: valibot.optional(valibot.array(valibot.string())),
564
- modules: valibot.optional(valibot.array(valibot.string())),
565
- symlinks: valibot.optional(valibot.boolean()),
566
- tsconfigFilename: valibot.optional(valibot.string())
1837
+ const ResolveOptionsSchema = strictObject({
1838
+ alias: optional(record(string(), union([string(), array(string())]))),
1839
+ aliasFields: optional(array(array(string()))),
1840
+ conditionNames: optional(array(string())),
1841
+ extensionAlias: optional(record(string(), array(string()))),
1842
+ exportsFields: optional(array(array(string()))),
1843
+ extensions: optional(array(string())),
1844
+ mainFields: optional(array(string())),
1845
+ mainFiles: optional(array(string())),
1846
+ modules: optional(array(string())),
1847
+ symlinks: optional(boolean()),
1848
+ tsconfigFilename: optional(string())
567
1849
  });
568
- const TreeshakingOptionsSchema = valibot.union([valibot.boolean(), valibot.looseObject({
569
- annotations: valibot.optional(valibot.boolean()),
570
- manualPureFunctions: valibot.optional(valibot.array(valibot.string())),
571
- unknownGlobalSideEffects: valibot.optional(valibot.boolean())
1850
+ const TreeshakingOptionsSchema = union([boolean(), looseObject({
1851
+ annotations: optional(boolean()),
1852
+ manualPureFunctions: optional(array(string())),
1853
+ unknownGlobalSideEffects: optional(boolean())
572
1854
  })]);
573
- const OnLogSchema = valibot.pipe(valibot.function(), valibot.args(valibot.tuple([
1855
+ const OnLogSchema = pipe(function_(), args(tuple([
574
1856
  LogLevelSchema,
575
1857
  RollupLogSchema,
576
- valibot.pipe(valibot.function(), valibot.args(valibot.tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
1858
+ pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
577
1859
  ])));
578
- const OnwarnSchema = valibot.pipe(valibot.function(), valibot.args(valibot.tuple([RollupLogSchema, valibot.pipe(valibot.function(), valibot.args(valibot.tuple([valibot.union([RollupLogWithStringSchema, valibot.pipe(valibot.function(), valibot.returns(RollupLogWithStringSchema))])])))])));
579
- const HmrSchema = valibot.union([valibot.boolean(), valibot.strictObject({
580
- port: valibot.optional(valibot.number()),
581
- host: valibot.optional(valibot.string()),
582
- implement: valibot.optional(valibot.string())
1860
+ const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
1861
+ const HmrSchema = union([boolean(), strictObject({
1862
+ port: optional(number()),
1863
+ host: optional(string()),
1864
+ implement: optional(string())
583
1865
  })]);
584
- const InputOptionsSchema = valibot.strictObject({
585
- input: valibot.optional(InputOptionSchema),
586
- plugins: valibot.optional(valibot.custom(() => true)),
587
- external: valibot.optional(ExternalSchema),
588
- resolve: valibot.optional(ResolveOptionsSchema),
589
- cwd: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Current working directory")),
590
- platform: valibot.pipe(valibot.optional(valibot.union([
591
- valibot.literal("browser"),
592
- valibot.literal("neutral"),
593
- valibot.literal("node")
594
- ])), valibot.description(`Platform for which the code should be generated (node, ${ansis.default.underline("browser")}, neutral)`)),
595
- shimMissingExports: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Create shim variables for missing exports")),
596
- treeshake: valibot.optional(TreeshakingOptionsSchema),
597
- logLevel: valibot.pipe(valibot.optional(LogLevelOptionSchema), valibot.description(`Log level (${ansis.default.dim("silent")}, ${ansis.default.underline(ansis.default.gray("info"))}, debug, ${ansis.default.yellow("warn")})`)),
598
- onLog: valibot.optional(OnLogSchema),
599
- onwarn: valibot.optional(OnwarnSchema),
600
- moduleTypes: valibot.pipe(valibot.optional(ModuleTypesSchema), valibot.description("Module types for customized extensions")),
601
- experimental: valibot.optional(valibot.strictObject({
602
- disableLiveBindings: valibot.optional(valibot.boolean()),
603
- enableComposingJsPlugins: valibot.optional(valibot.boolean()),
604
- resolveNewUrlToAsset: valibot.optional(valibot.boolean()),
605
- strictExecutionOrder: valibot.optional(valibot.boolean()),
606
- hmr: valibot.optional(HmrSchema)
1866
+ const InputOptionsSchema = strictObject({
1867
+ input: optional(InputOptionSchema),
1868
+ plugins: optional(custom(() => true)),
1869
+ external: optional(ExternalSchema),
1870
+ resolve: optional(ResolveOptionsSchema),
1871
+ cwd: pipe(optional(string()), description("Current working directory")),
1872
+ platform: pipe(optional(union([
1873
+ literal("browser"),
1874
+ literal("neutral"),
1875
+ literal("node")
1876
+ ])), description(`Platform for which the code should be generated (node, ${ansis.default.underline("browser")}, neutral)`)),
1877
+ shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
1878
+ treeshake: optional(TreeshakingOptionsSchema),
1879
+ logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${ansis.default.dim("silent")}, ${ansis.default.underline(ansis.default.gray("info"))}, debug, ${ansis.default.yellow("warn")})`)),
1880
+ onLog: optional(OnLogSchema),
1881
+ onwarn: optional(OnwarnSchema),
1882
+ moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
1883
+ experimental: optional(strictObject({
1884
+ disableLiveBindings: optional(boolean()),
1885
+ enableComposingJsPlugins: optional(boolean()),
1886
+ resolveNewUrlToAsset: optional(boolean()),
1887
+ strictExecutionOrder: optional(boolean()),
1888
+ hmr: optional(HmrSchema)
607
1889
  })),
608
- define: valibot.pipe(valibot.optional(valibot.record(valibot.string(), valibot.string())), valibot.description("Define global variables")),
609
- inject: valibot.optional(valibot.record(valibot.string(), valibot.union([valibot.string(), valibot.tuple([valibot.string(), valibot.string()])]))),
610
- profilerNames: valibot.optional(valibot.boolean()),
611
- jsx: valibot.optional(valibot.union([
612
- valibot.boolean(),
1890
+ define: pipe(optional(record(string(), string())), description("Define global variables")),
1891
+ inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
1892
+ profilerNames: optional(boolean()),
1893
+ jsx: optional(union([
1894
+ boolean(),
613
1895
  JsxOptionsSchema,
614
- valibot.string("react"),
615
- valibot.string("react-jsx"),
616
- valibot.string("preserve")
1896
+ string("react"),
1897
+ string("react-jsx"),
1898
+ string("preserve")
617
1899
  ])),
618
- transform: valibot.optional(TransformOptionsSchema),
619
- watch: valibot.optional(valibot.union([WatchOptionsSchema, valibot.literal(false)])),
620
- dropLabels: valibot.pipe(valibot.optional(valibot.array(valibot.string())), valibot.description("Remove labeled statements with these label names")),
621
- checks: valibot.optional(ChecksOptionsSchema),
622
- keepNames: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Keep function/class name")),
623
- debug: valibot.pipe(valibot.optional(valibot.object({ sessionId: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Used to name the build.")) })), valibot.description("Enable debug mode. Emit debug information to disk. This might slow down the build process significantly."))
1900
+ transform: optional(TransformOptionsSchema),
1901
+ watch: optional(union([WatchOptionsSchema, literal(false)])),
1902
+ dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
1903
+ checks: optional(ChecksOptionsSchema),
1904
+ keepNames: pipe(optional(boolean()), description("Keep function/class name")),
1905
+ debug: pipe(optional(object({ sessionId: pipe(optional(string()), description("Used to name the build.")) })), description("Enable debug mode. Emit debug information to disk. This might slow down the build process significantly."))
624
1906
  });
625
- const InputCliOverrideSchema = valibot.strictObject({
626
- input: valibot.pipe(valibot.optional(valibot.array(valibot.string())), valibot.description("Entry file")),
627
- external: valibot.pipe(valibot.optional(valibot.array(valibot.string())), valibot.description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
628
- inject: valibot.pipe(valibot.optional(valibot.record(valibot.string(), valibot.string())), valibot.description("Inject import statements on demand")),
629
- treeshake: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("enable treeshaking")),
630
- jsx: valibot.pipe(valibot.optional(JsxOptionsSchema), valibot.description("enable jsx"))
1907
+ const InputCliOverrideSchema = strictObject({
1908
+ input: pipe(optional(array(string())), description("Entry file")),
1909
+ external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
1910
+ inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
1911
+ treeshake: pipe(optional(boolean()), description("enable treeshaking")),
1912
+ jsx: pipe(optional(JsxOptionsSchema), description("enable jsx"))
631
1913
  });
632
- const InputCliOptionsSchema = valibot.omit(valibot.strictObject({
1914
+ const InputCliOptionsSchema = omit(strictObject({
633
1915
  ...InputOptionsSchema.entries,
634
1916
  ...InputCliOverrideSchema.entries
635
1917
  }), [
@@ -656,87 +1938,87 @@ var ESTarget = /* @__PURE__ */ function(ESTarget$1) {
656
1938
  ESTarget$1["ESNext"] = "esnext";
657
1939
  return ESTarget$1;
658
1940
  }(ESTarget || {});
659
- const ModuleFormatSchema = valibot.union([
660
- valibot.literal("es"),
661
- valibot.literal("cjs"),
662
- valibot.literal("esm"),
663
- valibot.literal("module"),
664
- valibot.literal("commonjs"),
665
- valibot.literal("iife"),
666
- valibot.literal("umd")
1941
+ const ModuleFormatSchema = union([
1942
+ literal("es"),
1943
+ literal("cjs"),
1944
+ literal("esm"),
1945
+ literal("module"),
1946
+ literal("commonjs"),
1947
+ literal("iife"),
1948
+ literal("umd")
667
1949
  ]);
668
- const AddonFunctionSchema = valibot.pipe(valibot.function(), valibot.args(valibot.tuple([valibot.custom(() => true)])), valibot.returnsAsync(valibot.unionAsync([valibot.string(), valibot.pipeAsync(valibot.promise(), valibot.awaitAsync(), valibot.string())])));
669
- const ChunkFileNamesSchema = valibot.union([valibot.string(), valibot.pipe(valibot.function(), valibot.args(valibot.tuple([valibot.custom(() => true)])), valibot.returns(valibot.string()))]);
670
- const AssetFileNamesSchema = valibot.union([valibot.string(), valibot.pipe(valibot.function(), valibot.args(valibot.tuple([valibot.custom(() => true)])), valibot.returns(valibot.string()))]);
671
- const SanitizeFileNameSchema = valibot.union([valibot.boolean(), valibot.pipe(valibot.function(), valibot.args(valibot.tuple([valibot.string()])), valibot.returns(valibot.string()))]);
672
- const GlobalsFunctionSchema = valibot.pipe(valibot.function(), valibot.args(valibot.tuple([valibot.string()])), valibot.returns(valibot.string()));
673
- const AdvancedChunksSchema = valibot.strictObject({
674
- minSize: valibot.optional(valibot.number()),
675
- maxSize: valibot.optional(valibot.number()),
676
- minModuleSize: valibot.optional(valibot.number()),
677
- maxModuleSize: valibot.optional(valibot.number()),
678
- minShareCount: valibot.optional(valibot.number()),
679
- groups: valibot.optional(valibot.array(valibot.strictObject({
680
- name: valibot.string(),
681
- test: valibot.optional(valibot.union([valibot.string(), valibot.instance(RegExp)])),
682
- priority: valibot.optional(valibot.number()),
683
- minSize: valibot.optional(valibot.number()),
684
- minShareCount: valibot.optional(valibot.number()),
685
- maxSize: valibot.optional(valibot.number()),
686
- minModuleSize: valibot.optional(valibot.number()),
687
- maxModuleSize: valibot.optional(valibot.number())
1950
+ const AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
1951
+ const ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
1952
+ const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
1953
+ const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
1954
+ const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
1955
+ const AdvancedChunksSchema = strictObject({
1956
+ minSize: optional(number()),
1957
+ maxSize: optional(number()),
1958
+ minModuleSize: optional(number()),
1959
+ maxModuleSize: optional(number()),
1960
+ minShareCount: optional(number()),
1961
+ groups: optional(array(strictObject({
1962
+ name: string(),
1963
+ test: optional(union([string(), instance(RegExp)])),
1964
+ priority: optional(number()),
1965
+ minSize: optional(number()),
1966
+ minShareCount: optional(number()),
1967
+ maxSize: optional(number()),
1968
+ minModuleSize: optional(number()),
1969
+ maxModuleSize: optional(number())
688
1970
  })))
689
1971
  });
690
- const OutputOptionsSchema = valibot.strictObject({
691
- dir: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Output directory, defaults to `dist` if `file` is not set")),
692
- file: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Single output file")),
693
- exports: valibot.pipe(valibot.optional(valibot.union([
694
- valibot.literal("auto"),
695
- valibot.literal("named"),
696
- valibot.literal("default"),
697
- valibot.literal("none")
698
- ])), valibot.description(`Specify a export mode (${ansis.default.underline("auto")}, named, default, none)`)),
699
- hashCharacters: valibot.pipe(valibot.optional(valibot.union([
700
- valibot.literal("base64"),
701
- valibot.literal("base36"),
702
- valibot.literal("hex")
703
- ])), valibot.description("Use the specified character set for file hashes")),
704
- format: valibot.pipe(valibot.optional(ModuleFormatSchema), valibot.description(`Output format of the generated bundle (supports ${ansis.default.underline("esm")}, cjs, and iife)`)),
705
- sourcemap: valibot.pipe(valibot.optional(valibot.union([
706
- valibot.boolean(),
707
- valibot.literal("inline"),
708
- valibot.literal("hidden")
709
- ])), valibot.description(`Generate sourcemap (\`-s inline\` for inline, or ${ansis.default.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
710
- sourcemapDebugIds: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Inject sourcemap debug IDs")),
711
- sourcemapIgnoreList: valibot.optional(valibot.union([valibot.boolean(), valibot.custom(() => true)])),
712
- sourcemapPathTransform: valibot.optional(valibot.custom(() => true)),
713
- banner: valibot.optional(valibot.union([valibot.string(), AddonFunctionSchema])),
714
- footer: valibot.optional(valibot.union([valibot.string(), AddonFunctionSchema])),
715
- intro: valibot.optional(valibot.union([valibot.string(), AddonFunctionSchema])),
716
- outro: valibot.optional(valibot.union([valibot.string(), AddonFunctionSchema])),
717
- extend: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Extend global variable defined by name in IIFE / UMD formats")),
718
- esModule: valibot.optional(valibot.union([valibot.boolean(), valibot.literal("if-default-prop")])),
719
- assetFileNames: valibot.optional(AssetFileNamesSchema),
720
- entryFileNames: valibot.optional(ChunkFileNamesSchema),
721
- chunkFileNames: valibot.optional(ChunkFileNamesSchema),
722
- cssEntryFileNames: valibot.optional(ChunkFileNamesSchema),
723
- cssChunkFileNames: valibot.optional(ChunkFileNamesSchema),
724
- sanitizeFileName: valibot.optional(SanitizeFileNameSchema),
725
- minify: valibot.pipe(valibot.optional(valibot.union([
726
- valibot.boolean(),
727
- valibot.string("dce-only"),
1972
+ const OutputOptionsSchema = strictObject({
1973
+ dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
1974
+ file: pipe(optional(string()), description("Single output file")),
1975
+ exports: pipe(optional(union([
1976
+ literal("auto"),
1977
+ literal("named"),
1978
+ literal("default"),
1979
+ literal("none")
1980
+ ])), description(`Specify a export mode (${ansis.default.underline("auto")}, named, default, none)`)),
1981
+ hashCharacters: pipe(optional(union([
1982
+ literal("base64"),
1983
+ literal("base36"),
1984
+ literal("hex")
1985
+ ])), description("Use the specified character set for file hashes")),
1986
+ format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${ansis.default.underline("esm")}, cjs, and iife)`)),
1987
+ sourcemap: pipe(optional(union([
1988
+ boolean(),
1989
+ literal("inline"),
1990
+ literal("hidden")
1991
+ ])), description(`Generate sourcemap (\`-s inline\` for inline, or ${ansis.default.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
1992
+ sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
1993
+ sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
1994
+ sourcemapPathTransform: optional(custom(() => true)),
1995
+ banner: optional(union([string(), AddonFunctionSchema])),
1996
+ footer: optional(union([string(), AddonFunctionSchema])),
1997
+ intro: optional(union([string(), AddonFunctionSchema])),
1998
+ outro: optional(union([string(), AddonFunctionSchema])),
1999
+ extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
2000
+ esModule: optional(union([boolean(), literal("if-default-prop")])),
2001
+ assetFileNames: optional(AssetFileNamesSchema),
2002
+ entryFileNames: optional(ChunkFileNamesSchema),
2003
+ chunkFileNames: optional(ChunkFileNamesSchema),
2004
+ cssEntryFileNames: optional(ChunkFileNamesSchema),
2005
+ cssChunkFileNames: optional(ChunkFileNamesSchema),
2006
+ sanitizeFileName: optional(SanitizeFileNameSchema),
2007
+ minify: pipe(optional(union([
2008
+ boolean(),
2009
+ string("dce-only"),
728
2010
  MinifyOptionsSchema
729
- ])), valibot.description("Minify the bundled file")),
730
- name: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name for UMD / IIFE format outputs")),
731
- globals: valibot.pipe(valibot.optional(valibot.union([valibot.record(valibot.string(), valibot.string()), GlobalsFunctionSchema])), valibot.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
732
- externalLiveBindings: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("external live bindings")),
733
- inlineDynamicImports: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Inline dynamic imports")),
734
- advancedChunks: valibot.optional(AdvancedChunksSchema),
735
- comments: valibot.pipe(valibot.optional(valibot.union([valibot.literal("none"), valibot.literal("preserve-legal")])), valibot.description("Control comments in the output")),
736
- plugins: valibot.optional(valibot.custom(() => true)),
737
- polyfillRequire: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Disable require polyfill injection")),
738
- target: valibot.pipe(valibot.optional(valibot.enum(ESTarget)), valibot.description("The JavaScript target environment")),
739
- hoistTransitiveImports: valibot.optional(valibot.custom((input) => {
2011
+ ])), description("Minify the bundled file")),
2012
+ name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
2013
+ globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2014
+ externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
2015
+ inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
2016
+ advancedChunks: optional(AdvancedChunksSchema),
2017
+ comments: pipe(optional(union([literal("none"), literal("preserve-legal")])), description("Control comments in the output")),
2018
+ plugins: optional(custom(() => true)),
2019
+ polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
2020
+ target: pipe(optional(enum_(ESTarget)), description("The JavaScript target environment")),
2021
+ hoistTransitiveImports: optional(custom((input) => {
740
2022
  if (input) return false;
741
2023
  return true;
742
2024
  }, () => `The 'true' value is not supported`))
@@ -744,26 +2026,26 @@ const OutputOptionsSchema = valibot.strictObject({
744
2026
  const getAddonDescription = (placement, wrapper) => {
745
2027
  return `Code to insert the ${ansis.default.bold(placement)} of the bundled file (${ansis.default.bold(wrapper)} the wrapper function)`;
746
2028
  };
747
- const OutputCliOverrideSchema = valibot.strictObject({
748
- assetFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for asset files")),
749
- entryFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for emitted entry chunks")),
750
- chunkFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for emitted secondary chunks")),
751
- cssEntryFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for emitted css entry chunks")),
752
- cssChunkFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for emitted css secondary chunks")),
753
- sanitizeFileName: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Sanitize file name")),
754
- banner: valibot.pipe(valibot.optional(valibot.string()), valibot.description(getAddonDescription("top", "outside"))),
755
- footer: valibot.pipe(valibot.optional(valibot.string()), valibot.description(getAddonDescription("bottom", "outside"))),
756
- intro: valibot.pipe(valibot.optional(valibot.string()), valibot.description(getAddonDescription("top", "inside"))),
757
- outro: valibot.pipe(valibot.optional(valibot.string()), valibot.description(getAddonDescription("bottom", "inside"))),
758
- esModule: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
759
- globals: valibot.pipe(valibot.optional(valibot.record(valibot.string(), valibot.string())), valibot.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
760
- advancedChunks: valibot.pipe(valibot.optional(valibot.strictObject({
761
- minSize: valibot.pipe(valibot.optional(valibot.number()), valibot.description("Minimum size of the chunk")),
762
- minShareCount: valibot.pipe(valibot.optional(valibot.number()), valibot.description("Minimum share count of the chunk"))
763
- })), valibot.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
764
- minify: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Minify the bundled file"))
2029
+ const OutputCliOverrideSchema = strictObject({
2030
+ assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
2031
+ entryFileNames: pipe(optional(string()), description("Name pattern for emitted entry chunks")),
2032
+ chunkFileNames: pipe(optional(string()), description("Name pattern for emitted secondary chunks")),
2033
+ cssEntryFileNames: pipe(optional(string()), description("Name pattern for emitted css entry chunks")),
2034
+ cssChunkFileNames: pipe(optional(string()), description("Name pattern for emitted css secondary chunks")),
2035
+ sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
2036
+ banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
2037
+ footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
2038
+ intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
2039
+ outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
2040
+ esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
2041
+ globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2042
+ advancedChunks: pipe(optional(strictObject({
2043
+ minSize: pipe(optional(number()), description("Minimum size of the chunk")),
2044
+ minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
2045
+ })), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2046
+ minify: pipe(optional(boolean()), description("Minify the bundled file"))
765
2047
  });
766
- const OutputCliOptionsSchema = valibot.omit(valibot.strictObject({
2048
+ const OutputCliOptionsSchema = omit(strictObject({
767
2049
  ...OutputOptionsSchema.entries,
768
2050
  ...OutputCliOverrideSchema.entries
769
2051
  }), [
@@ -772,16 +2054,16 @@ const OutputCliOptionsSchema = valibot.omit(valibot.strictObject({
772
2054
  "plugins",
773
2055
  "hoistTransitiveImports"
774
2056
  ]);
775
- const CliOptionsSchema = valibot.strictObject({
776
- config: valibot.pipe(valibot.optional(valibot.union([valibot.string(), valibot.boolean()])), valibot.description("Path to the config file (default: `rolldown.config.js`)")),
777
- help: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Show help")),
778
- version: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Show version number")),
779
- watch: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Watch files in bundle and rebuild on changes")),
2057
+ const CliOptionsSchema = strictObject({
2058
+ config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
2059
+ help: pipe(optional(boolean()), description("Show help")),
2060
+ version: pipe(optional(boolean()), description("Show version number")),
2061
+ watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
780
2062
  ...InputCliOptionsSchema.entries,
781
2063
  ...OutputCliOptionsSchema.entries
782
2064
  });
783
2065
  function validateCliOptions(options) {
784
- let parsed = valibot.safeParse(CliOptionsSchema, options);
2066
+ let parsed = safeParse(CliOptionsSchema, options);
785
2067
  return [parsed.output, parsed.issues?.map((issue) => {
786
2068
  const option = issue.path?.map((pathItem) => pathItem.key).join(" ");
787
2069
  return `Invalid value for option ${option}: ${issue.message}`;
@@ -791,7 +2073,7 @@ const inputHelperMsgRecord = { output: { ignored: true } };
791
2073
  const outputHelperMsgRecord = {};
792
2074
  function validateOption(key, options) {
793
2075
  if (globalThis.process?.env?.ROLLDOWN_OPTIONS_VALIDATION === "loose") return;
794
- let parsed = valibot.safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
2076
+ let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
795
2077
  if (!parsed.success) {
796
2078
  const errors = parsed.issues.map((issue) => {
797
2079
  const issuePaths = issue.path.map((path$2) => path$2.key);
@@ -812,13 +2094,13 @@ function validateOption(key, options) {
812
2094
  }
813
2095
  }
814
2096
  function getInputCliKeys() {
815
- return valibot.keyof(InputCliOptionsSchema).options;
2097
+ return keyof(InputCliOptionsSchema).options;
816
2098
  }
817
2099
  function getOutputCliKeys() {
818
- return valibot.keyof(OutputCliOptionsSchema).options;
2100
+ return keyof(OutputCliOptionsSchema).options;
819
2101
  }
820
2102
  function getJsonSchema() {
821
- return (0, __valibot_to_json_schema.toJsonSchema)(CliOptionsSchema);
2103
+ return toJsonSchema(CliOptionsSchema);
822
2104
  }
823
2105
 
824
2106
  //#endregion
@@ -924,7 +2206,7 @@ function joinNewLine(s1, s2) {
924
2206
  function transformModuleInfo(info, option) {
925
2207
  return {
926
2208
  get ast() {
927
- return unsupported("ModuleInfo#ast");
2209
+ return require_filter_index.unsupported("ModuleInfo#ast");
928
2210
  },
929
2211
  get code() {
930
2212
  return info.code;
@@ -955,9 +2237,9 @@ function bindingifySideEffects(sideEffects) {
955
2237
 
956
2238
  //#endregion
957
2239
  //#region src/utils/transform-sourcemap.ts
958
- function isEmptySourcemapFiled(array) {
959
- if (!array) return true;
960
- if (array.length === 0 || !array[0]) return true;
2240
+ function isEmptySourcemapFiled(array$1) {
2241
+ if (!array$1) return true;
2242
+ if (array$1.length === 0 || !array$1[0]) return true;
961
2243
  return false;
962
2244
  }
963
2245
  function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
@@ -1007,19 +2289,20 @@ function t(...n) {
1007
2289
  //#endregion
1008
2290
  //#region src/plugin/bindingify-hook-filter.ts
1009
2291
  function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
1010
- if (typeof matcher === "string" || matcher instanceof RegExp) return [require_filter_expression_index.include(require_filter_expression_index.id(matcher))];
1011
- if (Array.isArray(matcher)) return matcher.map((m) => require_filter_expression_index.include(require_filter_expression_index.id(m)));
1012
- if (matcher.custom) return matcher.custom;
2292
+ if (typeof matcher === "string" || matcher instanceof RegExp) return [require_filter_index.include(generateAtomMatcher(stringKind, matcher))];
2293
+ if (Array.isArray(matcher)) return matcher.map((m) => require_filter_index.include(generateAtomMatcher(stringKind, m)));
1013
2294
  let ret = [];
1014
- let isCode = stringKind === "code";
1015
- if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m) => require_filter_expression_index.exclude(isCode ? require_filter_expression_index.code(m) : require_filter_expression_index.id(m))));
1016
- if (matcher.include) ret.push(...arraify(matcher.include).map((m) => require_filter_expression_index.include(isCode ? require_filter_expression_index.code(m) : require_filter_expression_index.id(m))));
2295
+ if (matcher.exclude) ret.push(...require_filter_index.arraify(matcher.exclude).map((m) => require_filter_index.exclude(generateAtomMatcher(stringKind, m))));
2296
+ if (matcher.include) ret.push(...require_filter_index.arraify(matcher.include).map((m) => require_filter_index.include(generateAtomMatcher(stringKind, m))));
1017
2297
  return ret;
1018
2298
  }
2299
+ function generateAtomMatcher(kind, matcher) {
2300
+ return kind === "code" ? require_filter_index.code(matcher) : require_filter_index.id(matcher);
2301
+ }
1019
2302
  function transformFilterMatcherToFilterExprs(filterOption) {
1020
2303
  if (!filterOption) return void 0;
1021
- const { id: id$1, code: code$1, moduleType: moduleType$1, custom } = filterOption;
1022
- if (custom) return custom;
2304
+ if (Array.isArray(filterOption)) return filterOption;
2305
+ const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
1023
2306
  let ret = [];
1024
2307
  let idIncludes = [];
1025
2308
  let idExcludes = [];
@@ -1029,33 +2312,21 @@ function transformFilterMatcherToFilterExprs(filterOption) {
1029
2312
  if (code$1) [codeIncludes, codeExcludes] = d(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m) => m.kind === "include");
1030
2313
  ret.push(...idExcludes);
1031
2314
  ret.push(...codeExcludes);
1032
- let cursor;
2315
+ let andExprList = [];
1033
2316
  if (moduleType$1) {
1034
2317
  let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
1035
- cursor = joinFilterExprsWithOr(moduleTypes.map((m) => require_filter_expression_index.moduleType(m)));
1036
- }
1037
- if (idIncludes.length) {
1038
- let joinedOrExpr = joinFilterExprsWithOr(idIncludes.map((item) => item.expr));
1039
- if (!cursor) cursor = joinedOrExpr;
1040
- else cursor = require_filter_expression_index.and(cursor, joinedOrExpr);
1041
- }
1042
- if (codeIncludes.length) {
1043
- let joinedOrExpr = joinFilterExprsWithOr(codeIncludes.map((item) => item.expr));
1044
- if (!cursor) cursor = joinedOrExpr;
1045
- else cursor = require_filter_expression_index.and(cursor, joinedOrExpr);
2318
+ andExprList.push(require_filter_index.or(...moduleTypes.map((m) => require_filter_index.moduleType(m))));
1046
2319
  }
1047
- if (cursor) ret.push(require_filter_expression_index.include(cursor));
2320
+ if (idIncludes.length) andExprList.push(require_filter_index.or(...idIncludes.map((item) => item.expr)));
2321
+ if (codeIncludes.length) andExprList.push(require_filter_index.or(...codeIncludes.map((item) => item.expr)));
2322
+ if (andExprList.length) ret.push(require_filter_index.include(require_filter_index.and(...andExprList)));
1048
2323
  return ret;
1049
2324
  }
1050
- function joinFilterExprsWithOr(filterExprs) {
1051
- if (filterExprs.length === 1) return filterExprs[0];
1052
- return require_filter_expression_index.or(filterExprs[0], joinFilterExprsWithOr(filterExprs.slice(1)));
1053
- }
1054
- function bindingifyGeneralHookFilter(matcher, stringKind) {
1055
- let filterExprs = generalHookFilterMatcherToFilterExprs(matcher, stringKind);
1056
- let custom = [];
1057
- if (filterExprs) custom = filterExprs.map(bindingifyFilterExpr);
1058
- return { custom: custom.length > 0 ? custom : void 0 };
2325
+ function bindingifyGeneralHookFilter(stringKind, pattern) {
2326
+ let filterExprs = generalHookFilterMatcherToFilterExprs(pattern, stringKind);
2327
+ let ret = [];
2328
+ if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
2329
+ return ret.length > 0 ? { value: ret } : void 0;
1059
2330
  }
1060
2331
  function bindingifyFilterExpr(expr) {
1061
2332
  let list = [];
@@ -1065,9 +2336,21 @@ function bindingifyFilterExpr(expr) {
1065
2336
  function bindingifyFilterExprImpl(expr, list) {
1066
2337
  switch (expr.kind) {
1067
2338
  case "and": {
1068
- bindingifyFilterExprImpl(expr.right, list);
1069
- bindingifyFilterExprImpl(expr.left, list);
1070
- list.push({ kind: "And" });
2339
+ let args$1 = expr.args;
2340
+ for (let i$1 = args$1.length - 1; i$1 >= 0; i$1--) bindingifyFilterExprImpl(args$1[i$1], list);
2341
+ list.push({
2342
+ kind: "And",
2343
+ payload: args$1.length
2344
+ });
2345
+ break;
2346
+ }
2347
+ case "or": {
2348
+ let args$1 = expr.args;
2349
+ for (let i$1 = args$1.length - 1; i$1 >= 0; i$1--) bindingifyFilterExprImpl(args$1[i$1], list);
2350
+ list.push({
2351
+ kind: "Or",
2352
+ payload: args$1.length
2353
+ });
1071
2354
  break;
1072
2355
  }
1073
2356
  case "not": {
@@ -1078,21 +2361,21 @@ function bindingifyFilterExprImpl(expr, list) {
1078
2361
  case "id": {
1079
2362
  list.push({
1080
2363
  kind: "Id",
1081
- value: expr.pattern
2364
+ payload: expr.pattern
1082
2365
  });
1083
2366
  break;
1084
2367
  }
1085
2368
  case "moduleType": {
1086
2369
  list.push({
1087
2370
  kind: "ModuleType",
1088
- value: expr.pattern
2371
+ payload: expr.pattern
1089
2372
  });
1090
2373
  break;
1091
2374
  }
1092
2375
  case "code": {
1093
2376
  list.push({
1094
2377
  kind: "Code",
1095
- value: expr.pattern
2378
+ payload: expr.pattern
1096
2379
  });
1097
2380
  break;
1098
2381
  }
@@ -1106,27 +2389,30 @@ function bindingifyFilterExprImpl(expr, list) {
1106
2389
  list.push({ kind: "Exclude" });
1107
2390
  break;
1108
2391
  }
1109
- default: throw new Error(`Unknown filter expression kind: ${expr.kind}`);
2392
+ default: throw new Error(`Unknown filter expression: ${expr}`);
1110
2393
  }
1111
2394
  }
1112
2395
  function bindingifyResolveIdFilter(filterOption) {
1113
- return filterOption?.id ? bindingifyGeneralHookFilter(filterOption.id, "id") : void 0;
2396
+ if (!filterOption) return void 0;
2397
+ if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2398
+ return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
1114
2399
  }
1115
2400
  function bindingifyLoadFilter(filterOption) {
1116
- return filterOption?.id ? bindingifyGeneralHookFilter(filterOption.id, "id") : void 0;
2401
+ if (!filterOption) return void 0;
2402
+ if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2403
+ return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
1117
2404
  }
1118
2405
  function bindingifyTransformFilter(filterOption) {
1119
2406
  if (!filterOption) return void 0;
1120
- let custom = transformFilterMatcherToFilterExprs(filterOption);
2407
+ let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
1121
2408
  let ret = [];
1122
- if (custom) ret = custom.map(bindingifyFilterExpr);
1123
- return { custom: ret.length > 0 ? ret : void 0 };
2409
+ if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
2410
+ return { value: ret.length > 0 ? ret : void 0 };
1124
2411
  }
1125
2412
  function bindingifyRenderChunkFilter(filterOption) {
1126
- if (filterOption) {
1127
- const { code: code$1 } = filterOption;
1128
- return { custom: code$1 ? bindingifyGeneralHookFilter(code$1, "code").custom : void 0 };
1129
- }
2413
+ if (!filterOption) return void 0;
2414
+ if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2415
+ return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
1130
2416
  }
1131
2417
 
1132
2418
  //#endregion
@@ -1180,10 +2466,10 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
1180
2466
  async function createLoadModulePromise(context, data) {
1181
2467
  const loadPromise = data.loadModulePromiseMap.get(id$1);
1182
2468
  if (loadPromise) return loadPromise;
1183
- const promise = new Promise((resolve, _) => {
2469
+ const promise$1 = new Promise((resolve, _) => {
1184
2470
  data.loadModulePromiseResolveFnMap.set(id$1, resolve);
1185
2471
  });
1186
- data.loadModulePromiseMap.set(id$1, promise);
2472
+ data.loadModulePromiseMap.set(id$1, promise$1);
1187
2473
  try {
1188
2474
  await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
1189
2475
  } catch (e) {
@@ -1191,7 +2477,7 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
1191
2477
  data.loadModulePromiseResolveFnMap.delete(id$1);
1192
2478
  throw e;
1193
2479
  }
1194
- return promise;
2480
+ return promise$1;
1195
2481
  }
1196
2482
  await createLoadModulePromise(this.context, this.data);
1197
2483
  return this.data.getModuleInfo(id$1, this.context);
@@ -1208,12 +2494,12 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
1208
2494
  const info = this.data.getModuleOption(res.id) || {};
1209
2495
  return {
1210
2496
  ...res,
1211
- external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
2497
+ external: res.external === "relative" ? require_filter_index.unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
1212
2498
  ...info
1213
2499
  };
1214
2500
  }
1215
2501
  emitFile = (file) => {
1216
- if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
2502
+ if (file.type === "prebuilt-chunk") return require_filter_index.unimplemented("PluginContext.emitFile with type prebuilt-chunk");
1217
2503
  if (file.type === "chunk") return this.context.emitChunk(file);
1218
2504
  const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
1219
2505
  const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
@@ -1278,41 +2564,41 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
1278
2564
 
1279
2565
  //#endregion
1280
2566
  //#region src/plugin/bindingify-build-hooks.ts
1281
- function bindingifyBuildStart(args) {
1282
- const hook = args.plugin.buildStart;
2567
+ function bindingifyBuildStart(args$1) {
2568
+ const hook = args$1.plugin.buildStart;
1283
2569
  if (!hook) return {};
1284
2570
  const { handler, meta } = normalizeHook(hook);
1285
2571
  return {
1286
2572
  plugin: async (ctx, opts) => {
1287
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedInputOptionsImpl(opts, args.onLog));
2573
+ await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), new NormalizedInputOptionsImpl(opts, args$1.onLog));
1288
2574
  },
1289
2575
  meta: bindingifyPluginHookMeta(meta)
1290
2576
  };
1291
2577
  }
1292
- function bindingifyBuildEnd(args) {
1293
- const hook = args.plugin.buildEnd;
2578
+ function bindingifyBuildEnd(args$1) {
2579
+ const hook = args$1.plugin.buildEnd;
1294
2580
  if (!hook) return {};
1295
2581
  const { handler, meta } = normalizeHook(hook);
1296
2582
  return {
1297
2583
  plugin: async (ctx, err) => {
1298
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), err ? normalizeErrors(err) : void 0);
2584
+ await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), err ? normalizeErrors(err) : void 0);
1299
2585
  },
1300
2586
  meta: bindingifyPluginHookMeta(meta)
1301
2587
  };
1302
2588
  }
1303
- function bindingifyResolveId(args) {
1304
- const hook = args.plugin.resolveId;
2589
+ function bindingifyResolveId(args$1) {
2590
+ const hook = args$1.plugin.resolveId;
1305
2591
  if (!hook) return {};
1306
2592
  const { handler, meta, options } = normalizeHook(hook);
1307
2593
  return {
1308
2594
  plugin: async (ctx, specifier, importer, extraOptions) => {
1309
- const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
2595
+ const contextResolveOptions = extraOptions.custom != null ? args$1.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
1310
2596
  const newExtraOptions = {
1311
2597
  ...extraOptions,
1312
2598
  custom: contextResolveOptions?.custom,
1313
2599
  [SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
1314
2600
  };
1315
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), specifier, importer ?? void 0, newExtraOptions);
2601
+ const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), specifier, importer ?? void 0, newExtraOptions);
1316
2602
  if (ret == null) return;
1317
2603
  if (ret === false) return {
1318
2604
  id: specifier,
@@ -1323,7 +2609,7 @@ function bindingifyResolveId(args) {
1323
2609
  id: ret,
1324
2610
  normalizeExternalId: true
1325
2611
  };
1326
- let exist = args.pluginContextData.updateModuleOption(ret.id, {
2612
+ let exist = args$1.pluginContextData.updateModuleOption(ret.id, {
1327
2613
  meta: ret.meta || {},
1328
2614
  moduleSideEffects: ret.moduleSideEffects ?? null,
1329
2615
  invalidate: false
@@ -1339,13 +2625,13 @@ function bindingifyResolveId(args) {
1339
2625
  filter: bindingifyResolveIdFilter(options.filter)
1340
2626
  };
1341
2627
  }
1342
- function bindingifyResolveDynamicImport(args) {
1343
- const hook = args.plugin.resolveDynamicImport;
2628
+ function bindingifyResolveDynamicImport(args$1) {
2629
+ const hook = args$1.plugin.resolveDynamicImport;
1344
2630
  if (!hook) return {};
1345
2631
  const { handler, meta } = normalizeHook(hook);
1346
2632
  return {
1347
2633
  plugin: async (ctx, specifier, importer) => {
1348
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), specifier, importer ?? void 0);
2634
+ const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), specifier, importer ?? void 0);
1349
2635
  if (ret == null) return;
1350
2636
  if (ret === false) return {
1351
2637
  id: specifier,
@@ -1357,7 +2643,7 @@ function bindingifyResolveDynamicImport(args) {
1357
2643
  external: ret.external
1358
2644
  };
1359
2645
  if (ret.moduleSideEffects !== null) result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
1360
- args.pluginContextData.updateModuleOption(ret.id, {
2646
+ args$1.pluginContextData.updateModuleOption(ret.id, {
1361
2647
  meta: ret.meta || {},
1362
2648
  moduleSideEffects: ret.moduleSideEffects || null,
1363
2649
  invalidate: false
@@ -1367,16 +2653,16 @@ function bindingifyResolveDynamicImport(args) {
1367
2653
  meta: bindingifyPluginHookMeta(meta)
1368
2654
  };
1369
2655
  }
1370
- function bindingifyTransform(args) {
1371
- const hook = args.plugin.transform;
2656
+ function bindingifyTransform(args$1) {
2657
+ const hook = args$1.plugin.transform;
1372
2658
  if (!hook) return {};
1373
2659
  const { handler, meta, options } = normalizeHook(hook);
1374
2660
  return {
1375
2661
  plugin: async (ctx, code$1, id$1, meta$1) => {
1376
- const ret = await handler.call(new TransformPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id$1, code$1, args.onLog, args.logLevel, args.watchMode), code$1, id$1, meta$1);
2662
+ const ret = await handler.call(new TransformPluginContextImpl(args$1.outputOptions, ctx.inner(), args$1.plugin, args$1.pluginContextData, ctx, id$1, code$1, args$1.onLog, args$1.logLevel, args$1.watchMode), code$1, id$1, meta$1);
1377
2663
  if (ret == null) return void 0;
1378
2664
  if (typeof ret === "string") return { code: ret };
1379
- let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
2665
+ let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
1380
2666
  meta: ret.meta ?? {},
1381
2667
  moduleSideEffects: ret.moduleSideEffects ?? null,
1382
2668
  invalidate: false
@@ -1392,16 +2678,16 @@ function bindingifyTransform(args) {
1392
2678
  filter: bindingifyTransformFilter(options.filter)
1393
2679
  };
1394
2680
  }
1395
- function bindingifyLoad(args) {
1396
- const hook = args.plugin.load;
2681
+ function bindingifyLoad(args$1) {
2682
+ const hook = args$1.plugin.load;
1397
2683
  if (!hook) return {};
1398
2684
  const { handler, meta, options } = normalizeHook(hook);
1399
2685
  return {
1400
2686
  plugin: async (ctx, id$1) => {
1401
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode, id$1), id$1);
2687
+ const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode, id$1), id$1);
1402
2688
  if (ret == null) return;
1403
2689
  if (typeof ret === "string") return { code: ret };
1404
- let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
2690
+ let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
1405
2691
  meta: ret.meta || {},
1406
2692
  moduleSideEffects: ret.moduleSideEffects ?? null,
1407
2693
  invalidate: false
@@ -1428,13 +2714,13 @@ function preProcessSourceMap(ret, id$1) {
1428
2714
  }
1429
2715
  return map;
1430
2716
  }
1431
- function bindingifyModuleParsed(args) {
1432
- const hook = args.plugin.moduleParsed;
2717
+ function bindingifyModuleParsed(args$1) {
2718
+ const hook = args$1.plugin.moduleParsed;
1433
2719
  if (!hook) return {};
1434
2720
  const { handler, meta } = normalizeHook(hook);
1435
2721
  return {
1436
2722
  plugin: async (ctx, moduleInfo) => {
1437
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
2723
+ await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformModuleInfo(moduleInfo, args$1.pluginContextData.getModuleOption(moduleInfo.id)));
1438
2724
  },
1439
2725
  meta: bindingifyPluginHookMeta(meta)
1440
2726
  };
@@ -1558,7 +2844,7 @@ function bindingifyFormat(format) {
1558
2844
  case "iife": return "iife";
1559
2845
  case "umd": return "umd";
1560
2846
  case "experimental-app": return "app";
1561
- default: unimplemented(`output.format: ${format}`);
2847
+ default: require_filter_index.unimplemented(`output.format: ${format}`);
1562
2848
  }
1563
2849
  }
1564
2850
  function bindingifySourcemap(sourcemap) {
@@ -1832,25 +3118,25 @@ function collectChangedBundle(changed, bundle) {
1832
3118
 
1833
3119
  //#endregion
1834
3120
  //#region src/plugin/bindingify-output-hooks.ts
1835
- function bindingifyRenderStart(args) {
1836
- const hook = args.plugin.renderStart;
3121
+ function bindingifyRenderStart(args$1) {
3122
+ const hook = args$1.plugin.renderStart;
1837
3123
  if (!hook) return {};
1838
3124
  const { handler, meta } = normalizeHook(hook);
1839
3125
  return {
1840
3126
  plugin: async (ctx, opts) => {
1841
- handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), new NormalizedInputOptionsImpl(opts, args.onLog));
3127
+ handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), new NormalizedOutputOptionsImpl(opts, args$1.outputOptions, args$1.normalizedOutputPlugins), new NormalizedInputOptionsImpl(opts, args$1.onLog));
1842
3128
  },
1843
3129
  meta: bindingifyPluginHookMeta(meta)
1844
3130
  };
1845
3131
  }
1846
- function bindingifyRenderChunk(args) {
1847
- const hook = args.plugin.renderChunk;
3132
+ function bindingifyRenderChunk(args$1) {
3133
+ const hook = args$1.plugin.renderChunk;
1848
3134
  if (!hook) return {};
1849
3135
  const { handler, meta, options } = normalizeHook(hook);
1850
3136
  return {
1851
3137
  plugin: async (ctx, code$1, chunk, opts, meta$1) => {
1852
- if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
1853
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), code$1, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), args.pluginContextData.getRenderChunkMeta());
3138
+ if (args$1.pluginContextData.getRenderChunkMeta() == null) args$1.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
3139
+ const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), code$1, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args$1.outputOptions, args$1.normalizedOutputPlugins), args$1.pluginContextData.getRenderChunkMeta());
1854
3140
  if (ret == null) return;
1855
3141
  if (typeof ret === "string") return { code: ret };
1856
3142
  if (!ret.map) return { code: ret.code };
@@ -1863,30 +3149,30 @@ function bindingifyRenderChunk(args) {
1863
3149
  filter: bindingifyRenderChunkFilter(options.filter)
1864
3150
  };
1865
3151
  }
1866
- function bindingifyAugmentChunkHash(args) {
1867
- const hook = args.plugin.augmentChunkHash;
3152
+ function bindingifyAugmentChunkHash(args$1) {
3153
+ const hook = args$1.plugin.augmentChunkHash;
1868
3154
  if (!hook) return {};
1869
3155
  const { handler, meta } = normalizeHook(hook);
1870
3156
  return {
1871
3157
  plugin: async (ctx, chunk) => {
1872
- return await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3158
+ return await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
1873
3159
  },
1874
3160
  meta: bindingifyPluginHookMeta(meta)
1875
3161
  };
1876
3162
  }
1877
- function bindingifyRenderError(args) {
1878
- const hook = args.plugin.renderError;
3163
+ function bindingifyRenderError(args$1) {
3164
+ const hook = args$1.plugin.renderError;
1879
3165
  if (!hook) return {};
1880
3166
  const { handler, meta } = normalizeHook(hook);
1881
3167
  return {
1882
3168
  plugin: async (ctx, err) => {
1883
- handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), normalizeErrors(err));
3169
+ handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), normalizeErrors(err));
1884
3170
  },
1885
3171
  meta: bindingifyPluginHookMeta(meta)
1886
3172
  };
1887
3173
  }
1888
- function bindingifyGenerateBundle(args) {
1889
- const hook = args.plugin.generateBundle;
3174
+ function bindingifyGenerateBundle(args$1) {
3175
+ const hook = args$1.plugin.generateBundle;
1890
3176
  if (!hook) return {};
1891
3177
  const { handler, meta } = normalizeHook(hook);
1892
3178
  return {
@@ -1896,14 +3182,14 @@ function bindingifyGenerateBundle(args) {
1896
3182
  deleted: new Set()
1897
3183
  };
1898
3184
  const output = transformToOutputBundle(bundle, changed);
1899
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output, isWrite);
3185
+ await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), new NormalizedOutputOptionsImpl(opts, args$1.outputOptions, args$1.normalizedOutputPlugins), output, isWrite);
1900
3186
  return collectChangedBundle(changed, output);
1901
3187
  },
1902
3188
  meta: bindingifyPluginHookMeta(meta)
1903
3189
  };
1904
3190
  }
1905
- function bindingifyWriteBundle(args) {
1906
- const hook = args.plugin.writeBundle;
3191
+ function bindingifyWriteBundle(args$1) {
3192
+ const hook = args$1.plugin.writeBundle;
1907
3193
  if (!hook) return {};
1908
3194
  const { handler, meta } = normalizeHook(hook);
1909
3195
  return {
@@ -1913,67 +3199,67 @@ function bindingifyWriteBundle(args) {
1913
3199
  deleted: new Set()
1914
3200
  };
1915
3201
  const output = transformToOutputBundle(bundle, changed);
1916
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output);
3202
+ await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), new NormalizedOutputOptionsImpl(opts, args$1.outputOptions, args$1.normalizedOutputPlugins), output);
1917
3203
  return collectChangedBundle(changed, output);
1918
3204
  },
1919
3205
  meta: bindingifyPluginHookMeta(meta)
1920
3206
  };
1921
3207
  }
1922
- function bindingifyCloseBundle(args) {
1923
- const hook = args.plugin.closeBundle;
3208
+ function bindingifyCloseBundle(args$1) {
3209
+ const hook = args$1.plugin.closeBundle;
1924
3210
  if (!hook) return {};
1925
3211
  const { handler, meta } = normalizeHook(hook);
1926
3212
  return {
1927
3213
  plugin: async (ctx) => {
1928
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
3214
+ await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode));
1929
3215
  },
1930
3216
  meta: bindingifyPluginHookMeta(meta)
1931
3217
  };
1932
3218
  }
1933
- function bindingifyBanner(args) {
1934
- const hook = args.plugin.banner;
3219
+ function bindingifyBanner(args$1) {
3220
+ const hook = args$1.plugin.banner;
1935
3221
  if (!hook) return {};
1936
3222
  const { handler, meta } = normalizeHook(hook);
1937
3223
  return {
1938
3224
  plugin: async (ctx, chunk) => {
1939
3225
  if (typeof handler === "string") return handler;
1940
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3226
+ return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
1941
3227
  },
1942
3228
  meta: bindingifyPluginHookMeta(meta)
1943
3229
  };
1944
3230
  }
1945
- function bindingifyFooter(args) {
1946
- const hook = args.plugin.footer;
3231
+ function bindingifyFooter(args$1) {
3232
+ const hook = args$1.plugin.footer;
1947
3233
  if (!hook) return {};
1948
3234
  const { handler, meta } = normalizeHook(hook);
1949
3235
  return {
1950
3236
  plugin: async (ctx, chunk) => {
1951
3237
  if (typeof handler === "string") return handler;
1952
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3238
+ return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
1953
3239
  },
1954
3240
  meta: bindingifyPluginHookMeta(meta)
1955
3241
  };
1956
3242
  }
1957
- function bindingifyIntro(args) {
1958
- const hook = args.plugin.intro;
3243
+ function bindingifyIntro(args$1) {
3244
+ const hook = args$1.plugin.intro;
1959
3245
  if (!hook) return {};
1960
3246
  const { handler, meta } = normalizeHook(hook);
1961
3247
  return {
1962
3248
  plugin: async (ctx, chunk) => {
1963
3249
  if (typeof handler === "string") return handler;
1964
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3250
+ return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
1965
3251
  },
1966
3252
  meta: bindingifyPluginHookMeta(meta)
1967
3253
  };
1968
3254
  }
1969
- function bindingifyOutro(args) {
1970
- const hook = args.plugin.outro;
3255
+ function bindingifyOutro(args$1) {
3256
+ const hook = args$1.plugin.outro;
1971
3257
  if (!hook) return {};
1972
3258
  const { handler, meta } = normalizeHook(hook);
1973
3259
  return {
1974
3260
  plugin: async (ctx, chunk) => {
1975
3261
  if (typeof handler === "string") return handler;
1976
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3262
+ return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
1977
3263
  },
1978
3264
  meta: bindingifyPluginHookMeta(meta)
1979
3265
  };
@@ -1981,24 +3267,24 @@ function bindingifyOutro(args) {
1981
3267
 
1982
3268
  //#endregion
1983
3269
  //#region src/plugin/bindingify-watch-hooks.ts
1984
- function bindingifyWatchChange(args) {
1985
- const hook = args.plugin.watchChange;
3270
+ function bindingifyWatchChange(args$1) {
3271
+ const hook = args$1.plugin.watchChange;
1986
3272
  if (!hook) return {};
1987
3273
  const { handler, meta } = normalizeHook(hook);
1988
3274
  return {
1989
3275
  plugin: async (ctx, id$1, event) => {
1990
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id$1, { event });
3276
+ await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), id$1, { event });
1991
3277
  },
1992
3278
  meta: bindingifyPluginHookMeta(meta)
1993
3279
  };
1994
3280
  }
1995
- function bindingifyCloseWatcher(args) {
1996
- const hook = args.plugin.closeWatcher;
3281
+ function bindingifyCloseWatcher(args$1) {
3282
+ const hook = args$1.plugin.closeWatcher;
1997
3283
  if (!hook) return {};
1998
3284
  const { handler, meta } = normalizeHook(hook);
1999
3285
  return {
2000
3286
  plugin: async (ctx) => {
2001
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
3287
+ await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode));
2002
3288
  },
2003
3289
  meta: bindingifyPluginHookMeta(meta)
2004
3290
  };
@@ -2068,7 +3354,7 @@ function extractHookUsage(plugin) {
2068
3354
  //#endregion
2069
3355
  //#region src/plugin/bindingify-plugin.ts
2070
3356
  function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
2071
- const args = {
3357
+ const args$1 = {
2072
3358
  plugin,
2073
3359
  options,
2074
3360
  outputOptions,
@@ -2078,26 +3364,26 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
2078
3364
  watchMode,
2079
3365
  normalizedOutputPlugins
2080
3366
  };
2081
- const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
2082
- const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
2083
- const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args);
2084
- const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args);
2085
- const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
2086
- const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
2087
- const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
2088
- const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args);
2089
- const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
2090
- const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
2091
- const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
2092
- const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args);
2093
- const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args);
2094
- const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args);
2095
- const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args);
2096
- const { plugin: footer, meta: footerMeta } = bindingifyFooter(args);
2097
- const { plugin: intro, meta: introMeta } = bindingifyIntro(args);
2098
- const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
2099
- const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
2100
- const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
3367
+ const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args$1);
3368
+ const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args$1);
3369
+ const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args$1);
3370
+ const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args$1);
3371
+ const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args$1);
3372
+ const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args$1);
3373
+ const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args$1);
3374
+ const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args$1);
3375
+ const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args$1);
3376
+ const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args$1);
3377
+ const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args$1);
3378
+ const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args$1);
3379
+ const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args$1);
3380
+ const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args$1);
3381
+ const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args$1);
3382
+ const { plugin: footer, meta: footerMeta } = bindingifyFooter(args$1);
3383
+ const { plugin: intro, meta: introMeta } = bindingifyIntro(args$1);
3384
+ const { plugin: outro, meta: outroMeta } = bindingifyOutro(args$1);
3385
+ const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args$1);
3386
+ const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args$1);
2101
3387
  let hookUsage = extractHookUsage(plugin).inner();
2102
3388
  const result = {
2103
3389
  name: plugin.name,
@@ -2173,13 +3459,13 @@ function wrapHandlers(plugin) {
2173
3459
  "closeWatcher"
2174
3460
  ]) {
2175
3461
  const handler = plugin[hookName];
2176
- if (handler) plugin[hookName] = async (...args) => {
3462
+ if (handler) plugin[hookName] = async (...args$1) => {
2177
3463
  try {
2178
- return await handler(...args);
3464
+ return await handler(...args$1);
2179
3465
  } catch (e) {
2180
3466
  return require_parse_ast_index.error(require_parse_ast_index.logPluginError(e, plugin.name, {
2181
3467
  hook: hookName,
2182
- id: hookName === "transform" ? args[2] : void 0
3468
+ id: hookName === "transform" ? args$1[2] : void 0
2183
3469
  }));
2184
3470
  }
2185
3471
  };
@@ -2352,7 +3638,7 @@ function bindingifyExternal(external) {
2352
3638
  if (id$1.startsWith("\0")) return false;
2353
3639
  return external(id$1, importer, isResolved) ?? false;
2354
3640
  };
2355
- const externalArr = arraify(external);
3641
+ const externalArr = require_filter_index.arraify(external);
2356
3642
  return (id$1, _importer, _isResolved) => {
2357
3643
  return externalArr.some((pat) => {
2358
3644
  if (pat instanceof RegExp) return pat.test(id$1);
@@ -2367,7 +3653,7 @@ function bindingifyResolve(resolve) {
2367
3653
  return {
2368
3654
  alias: alias ? Object.entries(alias).map(([name, replacement]) => ({
2369
3655
  find: name,
2370
- replacements: arraify(replacement)
3656
+ replacements: require_filter_index.arraify(replacement)
2371
3657
  })) : void 0,
2372
3658
  extensionAlias: extensionAlias ? Object.entries(extensionAlias).map(([name, value]) => ({
2373
3659
  target: name,
@@ -2614,7 +3900,7 @@ function createComposedPlugin(plugins) {
2614
3900
  if (symbolForCallerThatSkipSelf === handlerSymbol) continue;
2615
3901
  const { handler: handlerFn } = normalizeHook(handler);
2616
3902
  const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), source, importer, rawHookResolveIdOptions);
2617
- if (!isNullish(result)) return result;
3903
+ if (!require_filter_index.isNullish(result)) return result;
2618
3904
  }
2619
3905
  };
2620
3906
  }
@@ -2640,7 +3926,7 @@ function createComposedPlugin(plugins) {
2640
3926
  for (const [handler, plugin] of batchedHandlers) {
2641
3927
  const { handler: handlerFn } = normalizeHook(handler);
2642
3928
  const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1);
2643
- if (!isNullish(result)) return result;
3929
+ if (!require_filter_index.isNullish(result)) return result;
2644
3930
  }
2645
3931
  };
2646
3932
  }
@@ -2662,7 +3948,7 @@ function createComposedPlugin(plugins) {
2662
3948
  throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
2663
3949
  };
2664
3950
  const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, id$1, moduleType$1);
2665
- if (!isNullish(result)) {
3951
+ if (!require_filter_index.isNullish(result)) {
2666
3952
  if (typeof result === "string") updateOutput(result);
2667
3953
  else if (result.code) updateOutput(result.code, result.moduleSideEffects);
2668
3954
  }
@@ -2694,7 +3980,7 @@ function createComposedPlugin(plugins) {
2694
3980
  for (const [handler, plugin] of batchedHandlers) {
2695
3981
  const { handler: handlerFn } = normalizeHook(handler);
2696
3982
  const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, chunk, options, meta);
2697
- if (!isNullish(result)) return result;
3983
+ if (!require_filter_index.isNullish(result)) return result;
2698
3984
  }
2699
3985
  };
2700
3986
  }
@@ -2938,6 +4224,9 @@ var RolldownBuild = class {
2938
4224
  async generateHmrPatch(changedFiles) {
2939
4225
  return this.#bundler?.bundler.generateHmrPatch(changedFiles);
2940
4226
  }
4227
+ async hmrInvalidate(file, firstInvalidatedBy) {
4228
+ return this.#bundler?.bundler.hmrInvalidate(file, firstInvalidatedBy);
4229
+ }
2941
4230
  get watchFiles() {
2942
4231
  return this.#bundler?.bundler.watchFiles ?? [];
2943
4232
  }
@@ -3061,8 +4350,8 @@ var Watcher = class {
3061
4350
  }
3062
4351
  };
3063
4352
  async function createWatcher(emitter, input) {
3064
- const options = arraify(input);
3065
- const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
4353
+ const options = require_filter_index.arraify(input);
4354
+ const bundlerOptions = await Promise.all(options.map((option) => require_filter_index.arraify(option.output || {}).map(async (output) => {
3066
4355
  const inputOptions = await PluginDriver.callOptionsHook(option, true);
3067
4356
  return createBundlerOptions(inputOptions, output, true);
3068
4357
  })).flat());
@@ -3090,46 +4379,6 @@ const watch = (input) => {
3090
4379
  return emitter;
3091
4380
  };
3092
4381
 
3093
- //#endregion
3094
- //#region src/plugin/with-filter.ts
3095
- function withFilterImpl(pluginOption, filterObjectList) {
3096
- if (isPromiseLike(pluginOption)) return pluginOption.then((p) => withFilter(p, filterObjectList));
3097
- if (pluginOption == false || pluginOption == null) return pluginOption;
3098
- if (Array.isArray(pluginOption)) return pluginOption.map((p) => withFilter(p, filterObjectList));
3099
- let plugin = pluginOption;
3100
- let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
3101
- if (filterObjectIndex === -1) return plugin;
3102
- let filterObject = filterObjectList[filterObjectIndex];
3103
- Object.keys(plugin).forEach((key) => {
3104
- switch (key) {
3105
- case "transform":
3106
- case "resolveId":
3107
- case "load":
3108
- if (!plugin[key]) return;
3109
- if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
3110
- else plugin[key] = {
3111
- handler: plugin[key],
3112
- filter: filterObject[key]
3113
- };
3114
- break;
3115
- default: break;
3116
- }
3117
- });
3118
- return plugin;
3119
- }
3120
- function withFilter(pluginOption, filterObject) {
3121
- return withFilterImpl(pluginOption, arraify(filterObject));
3122
- }
3123
- function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
3124
- if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
3125
- for (let i$1 = 0; i$1 < overrideFilterObjectList.length; i$1++) for (let j = 0; j < (overrideFilterObjectList[i$1].pluginNamePattern ?? []).length; j++) {
3126
- let pattern = overrideFilterObjectList[i$1].pluginNamePattern[j];
3127
- if (typeof pattern === "string" && pattern === pluginName) return i$1;
3128
- else if (pattern instanceof RegExp && pattern.test(pluginName)) return i$1;
3129
- }
3130
- return -1;
3131
- }
3132
-
3133
4382
  //#endregion
3134
4383
  //#region src/utils/define-config.ts
3135
4384
  function defineConfig(config) {
@@ -3159,12 +4408,6 @@ Object.defineProperty(exports, 'VERSION', {
3159
4408
  return VERSION;
3160
4409
  }
3161
4410
  });
3162
- Object.defineProperty(exports, 'arraify', {
3163
- enumerable: true,
3164
- get: function () {
3165
- return arraify;
3166
- }
3167
- });
3168
4411
  Object.defineProperty(exports, 'bindingifyPlugin', {
3169
4412
  enumerable: true,
3170
4413
  get: function () {
@@ -3204,7 +4447,7 @@ Object.defineProperty(exports, 'defineConfig', {
3204
4447
  Object.defineProperty(exports, 'description', {
3205
4448
  enumerable: true,
3206
4449
  get: function () {
3207
- return description;
4450
+ return description$1;
3208
4451
  }
3209
4452
  });
3210
4453
  Object.defineProperty(exports, 'dynamicImportVarsPlugin', {
@@ -3332,10 +4575,4 @@ Object.defineProperty(exports, 'watch', {
3332
4575
  get: function () {
3333
4576
  return watch;
3334
4577
  }
3335
- });
3336
- Object.defineProperty(exports, 'withFilter', {
3337
- enumerable: true,
3338
- get: function () {
3339
- return withFilter;
3340
- }
3341
4578
  });