rolldown 1.0.0-beta.8-commit.baf6ca1 → 1.0.0-beta.8-commit.101b994

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.
@@ -3,23 +3,21 @@ const require_chunk = require('./chunk-qZFfknuJ.cjs');
3
3
  const require_parse_ast_index = require('./parse-ast-index-Bbz37LOL.cjs');
4
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.baf6ca1";
14
- var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
11
+ var version = "1.0.0-beta.8-commit.101b994";
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
  }
@@ -292,11 +290,11 @@ const DEFINED_HOOK_NAMES = {
292
290
 
293
291
  //#endregion
294
292
  //#region src/utils/async-flatten.ts
295
- async function asyncFlatten(array) {
293
+ async function asyncFlatten(array$1) {
296
294
  do
297
- array = (await Promise.all(array)).flat(Infinity);
298
- while (array.some((v) => v?.then));
299
- return array;
295
+ array$1 = (await Promise.all(array$1)).flat(Infinity);
296
+ while (array$1.some((v) => v?.then));
297
+ return array$1;
300
298
  }
301
299
 
302
300
  //#endregion
@@ -411,201 +409,1509 @@ function getSortedPlugins(hookName, plugins) {
411
409
  ];
412
410
  }
413
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
+
414
1720
  //#endregion
415
1721
  //#region src/utils/validator.ts
416
- const StringOrRegExpSchema = valibot.union([valibot.string(), valibot.instance(RegExp)]);
417
- const LogLevelSchema = valibot.union([
418
- valibot.literal("debug"),
419
- valibot.literal("info"),
420
- valibot.literal("warn")
1722
+ const StringOrRegExpSchema = union([string(), instance(RegExp)]);
1723
+ const LogLevelSchema = union([
1724
+ literal("debug"),
1725
+ literal("info"),
1726
+ literal("warn")
421
1727
  ]);
422
- const LogLevelOptionSchema = valibot.union([LogLevelSchema, valibot.literal("silent")]);
423
- const LogLevelWithErrorSchema = valibot.union([LogLevelSchema, valibot.literal("error")]);
424
- const RollupLogSchema = valibot.any();
425
- const RollupLogWithStringSchema = valibot.union([RollupLogSchema, valibot.string()]);
426
- const InputOptionSchema = valibot.union([
427
- valibot.string(),
428
- valibot.array(valibot.string()),
429
- 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())
430
1736
  ]);
431
- const ExternalSchema = valibot.union([
1737
+ const ExternalSchema = union([
432
1738
  StringOrRegExpSchema,
433
- valibot.array(StringOrRegExpSchema),
434
- valibot.pipe(valibot.function(), valibot.args(valibot.tuple([
435
- valibot.string(),
436
- valibot.optional(valibot.string()),
437
- valibot.boolean()
438
- ])), 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())))
439
1745
  ]);
440
- const ModuleTypesSchema = valibot.record(valibot.string(), valibot.union([
441
- valibot.literal("base64"),
442
- valibot.literal("binary"),
443
- valibot.literal("css"),
444
- valibot.literal("dataurl"),
445
- valibot.literal("empty"),
446
- valibot.literal("js"),
447
- valibot.literal("json"),
448
- valibot.literal("jsx"),
449
- valibot.literal("text"),
450
- valibot.literal("ts"),
451
- 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")
452
1758
  ]));
453
- const JsxOptionsSchema = valibot.strictObject({
454
- development: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Development specific information")),
455
- factory: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Jsx element transformation")),
456
- fragment: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Jsx fragment transformation")),
457
- importSource: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Import the factory of element and fragment if mode is classic")),
458
- jsxImportSource: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Import the factory of element and fragment if mode is automatic")),
459
- mode: valibot.pipe(valibot.optional(valibot.union([
460
- valibot.literal("classic"),
461
- valibot.literal("automatic"),
462
- valibot.literal("preserve")
463
- ])), valibot.description("Jsx transformation mode")),
464
- 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"))
465
1771
  });
466
- const HelperModeSchema = valibot.union([valibot.literal("Runtime"), valibot.literal("External")]);
467
- const DecoratorOptionSchema = valibot.object({
468
- legacy: valibot.optional(valibot.boolean()),
469
- 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())
470
1776
  });
471
- const HelpersSchema = valibot.object({ mode: valibot.optional(HelperModeSchema) });
472
- const RewriteImportExtensionsSchema = valibot.union([
473
- valibot.literal("rewrite"),
474
- valibot.literal("remove"),
475
- valibot.boolean()
1777
+ const HelpersSchema = object({ mode: optional(HelperModeSchema) });
1778
+ const RewriteImportExtensionsSchema = union([
1779
+ literal("rewrite"),
1780
+ literal("remove"),
1781
+ boolean()
476
1782
  ]);
477
- const TypescriptSchema = valibot.object({
478
- jsxPragma: valibot.optional(valibot.string()),
479
- jsxPragmaFrag: valibot.optional(valibot.string()),
480
- onlyRemoveTypeImports: valibot.optional(valibot.boolean()),
481
- allowNamespaces: valibot.optional(valibot.boolean()),
482
- allowDeclareFields: valibot.optional(valibot.boolean()),
483
- declaration: valibot.optional(valibot.object({
484
- stripInternal: valibot.optional(valibot.boolean()),
485
- 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())
486
1792
  })),
487
- rewriteImportExtensions: valibot.optional(RewriteImportExtensionsSchema)
1793
+ rewriteImportExtensions: optional(RewriteImportExtensionsSchema)
488
1794
  });
489
- const AssumptionsSchema = valibot.object({
490
- ignoreFunctionLength: valibot.optional(valibot.boolean()),
491
- noDocumentAll: valibot.optional(valibot.boolean()),
492
- objectRestNoSymbols: valibot.optional(valibot.boolean()),
493
- pureGetters: valibot.optional(valibot.boolean()),
494
- 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())
495
1801
  });
496
- const TransformOptionsSchema = valibot.object({
497
- assumptions: valibot.optional(AssumptionsSchema),
498
- typescript: valibot.optional(TypescriptSchema),
499
- helpers: valibot.optional(HelpersSchema),
500
- decorators: valibot.optional(DecoratorOptionSchema)
1802
+ const TransformOptionsSchema = object({
1803
+ assumptions: optional(AssumptionsSchema),
1804
+ typescript: optional(TypescriptSchema),
1805
+ helpers: optional(HelpersSchema),
1806
+ decorators: optional(DecoratorOptionSchema)
501
1807
  });
502
- const WatchOptionsSchema = valibot.strictObject({
503
- chokidar: valibot.optional(valibot.never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
504
- exclude: valibot.optional(valibot.union([StringOrRegExpSchema, valibot.array(StringOrRegExpSchema)])),
505
- include: valibot.optional(valibot.union([StringOrRegExpSchema, valibot.array(StringOrRegExpSchema)])),
506
- notify: valibot.pipe(valibot.optional(valibot.strictObject({
507
- compareContents: valibot.optional(valibot.boolean()),
508
- pollInterval: valibot.optional(valibot.number())
509
- })), valibot.description("Notify options")),
510
- skipWrite: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Skip the bundle.write() step")),
511
- 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"))
512
1818
  });
513
- const ChecksOptionsSchema = valibot.strictObject({
514
- circularDependency: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting circular dependency")),
515
- eval: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting eval")),
516
- missingGlobalName: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting missing global name")),
517
- missingNameOptionForIifeExport: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting missing name option for iife export")),
518
- mixedExport: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting mixed export")),
519
- unresolvedEntry: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting unresolved entry")),
520
- unresolvedImport: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting unresolved import")),
521
- filenameConflict: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting filename conflict")),
522
- commonJsVariableInEsm: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting common js variable in esm")),
523
- importIsUndefined: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Whether to emit warning when detecting import is undefined")),
524
- 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"))
525
1831
  });
526
- const MinifyOptionsSchema = valibot.strictObject({
527
- mangle: valibot.optional(valibot.boolean()),
528
- compress: valibot.optional(valibot.boolean()),
529
- removeWhitespace: valibot.optional(valibot.boolean())
1832
+ const MinifyOptionsSchema = strictObject({
1833
+ mangle: optional(boolean()),
1834
+ compress: optional(boolean()),
1835
+ removeWhitespace: optional(boolean())
530
1836
  });
531
- const ResolveOptionsSchema = valibot.strictObject({
532
- alias: valibot.optional(valibot.record(valibot.string(), valibot.union([valibot.string(), valibot.array(valibot.string())]))),
533
- aliasFields: valibot.optional(valibot.array(valibot.array(valibot.string()))),
534
- conditionNames: valibot.optional(valibot.array(valibot.string())),
535
- extensionAlias: valibot.optional(valibot.record(valibot.string(), valibot.array(valibot.string()))),
536
- exportsFields: valibot.optional(valibot.array(valibot.array(valibot.string()))),
537
- extensions: valibot.optional(valibot.array(valibot.string())),
538
- mainFields: valibot.optional(valibot.array(valibot.string())),
539
- mainFiles: valibot.optional(valibot.array(valibot.string())),
540
- modules: valibot.optional(valibot.array(valibot.string())),
541
- symlinks: valibot.optional(valibot.boolean()),
542
- 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())
543
1849
  });
544
- const TreeshakingOptionsSchema = valibot.union([valibot.boolean(), valibot.looseObject({
545
- annotations: valibot.optional(valibot.boolean()),
546
- manualPureFunctions: valibot.optional(valibot.array(valibot.string())),
547
- unknownGlobalSideEffects: valibot.optional(valibot.boolean())
1850
+ const TreeshakingOptionsSchema = union([boolean(), looseObject({
1851
+ annotations: optional(boolean()),
1852
+ manualPureFunctions: optional(array(string())),
1853
+ unknownGlobalSideEffects: optional(boolean())
548
1854
  })]);
549
- const OnLogSchema = valibot.pipe(valibot.function(), valibot.args(valibot.tuple([
1855
+ const OnLogSchema = pipe(function_(), args(tuple([
550
1856
  LogLevelSchema,
551
1857
  RollupLogSchema,
552
- valibot.pipe(valibot.function(), valibot.args(valibot.tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
1858
+ pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
553
1859
  ])));
554
- 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))])])))])));
555
- const HmrSchema = valibot.union([valibot.boolean(), valibot.strictObject({
556
- port: valibot.optional(valibot.number()),
557
- host: valibot.optional(valibot.string()),
558
- 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())
559
1865
  })]);
560
- const InputOptionsSchema = valibot.strictObject({
561
- input: valibot.optional(InputOptionSchema),
562
- plugins: valibot.optional(valibot.custom(() => true)),
563
- external: valibot.optional(ExternalSchema),
564
- resolve: valibot.optional(ResolveOptionsSchema),
565
- cwd: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Current working directory")),
566
- platform: valibot.pipe(valibot.optional(valibot.union([
567
- valibot.literal("browser"),
568
- valibot.literal("neutral"),
569
- valibot.literal("node")
570
- ])), valibot.description(`Platform for which the code should be generated (node, ${ansis.default.underline("browser")}, neutral)`)),
571
- shimMissingExports: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Create shim variables for missing exports")),
572
- treeshake: valibot.optional(TreeshakingOptionsSchema),
573
- 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")})`)),
574
- onLog: valibot.optional(OnLogSchema),
575
- onwarn: valibot.optional(OnwarnSchema),
576
- moduleTypes: valibot.pipe(valibot.optional(ModuleTypesSchema), valibot.description("Module types for customized extensions")),
577
- experimental: valibot.optional(valibot.strictObject({
578
- disableLiveBindings: valibot.optional(valibot.boolean()),
579
- enableComposingJsPlugins: valibot.optional(valibot.boolean()),
580
- resolveNewUrlToAsset: valibot.optional(valibot.boolean()),
581
- strictExecutionOrder: valibot.optional(valibot.boolean()),
582
- 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)
583
1889
  })),
584
- define: valibot.pipe(valibot.optional(valibot.record(valibot.string(), valibot.string())), valibot.description("Define global variables")),
585
- inject: valibot.optional(valibot.record(valibot.string(), valibot.union([valibot.string(), valibot.tuple([valibot.string(), valibot.string()])]))),
586
- profilerNames: valibot.optional(valibot.boolean()),
587
- jsx: valibot.optional(valibot.union([
588
- 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(),
589
1895
  JsxOptionsSchema,
590
- valibot.string("react"),
591
- valibot.string("react-jsx"),
592
- valibot.string("preserve")
1896
+ string("react"),
1897
+ string("react-jsx"),
1898
+ string("preserve")
593
1899
  ])),
594
- transform: valibot.optional(TransformOptionsSchema),
595
- watch: valibot.optional(valibot.union([WatchOptionsSchema, valibot.literal(false)])),
596
- dropLabels: valibot.pipe(valibot.optional(valibot.array(valibot.string())), valibot.description("Remove labeled statements with these label names")),
597
- checks: valibot.optional(ChecksOptionsSchema),
598
- keepNames: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Keep function/class name")),
599
- 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."))
600
1906
  });
601
- const InputCliOverrideSchema = valibot.strictObject({
602
- input: valibot.pipe(valibot.optional(valibot.array(valibot.string())), valibot.description("Entry file")),
603
- external: valibot.pipe(valibot.optional(valibot.array(valibot.string())), valibot.description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
604
- inject: valibot.pipe(valibot.optional(valibot.record(valibot.string(), valibot.string())), valibot.description("Inject import statements on demand")),
605
- treeshake: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("enable treeshaking")),
606
- 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"))
607
1913
  });
608
- const InputCliOptionsSchema = valibot.omit(valibot.strictObject({
1914
+ const InputCliOptionsSchema = omit(strictObject({
609
1915
  ...InputOptionsSchema.entries,
610
1916
  ...InputCliOverrideSchema.entries
611
1917
  }), [
@@ -632,87 +1938,87 @@ var ESTarget = /* @__PURE__ */ function(ESTarget$1) {
632
1938
  ESTarget$1["ESNext"] = "esnext";
633
1939
  return ESTarget$1;
634
1940
  }(ESTarget || {});
635
- const ModuleFormatSchema = valibot.union([
636
- valibot.literal("es"),
637
- valibot.literal("cjs"),
638
- valibot.literal("esm"),
639
- valibot.literal("module"),
640
- valibot.literal("commonjs"),
641
- valibot.literal("iife"),
642
- 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")
643
1949
  ]);
644
- 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())])));
645
- const ChunkFileNamesSchema = valibot.union([valibot.string(), valibot.pipe(valibot.function(), valibot.args(valibot.tuple([valibot.custom(() => true)])), valibot.returns(valibot.string()))]);
646
- const AssetFileNamesSchema = valibot.union([valibot.string(), valibot.pipe(valibot.function(), valibot.args(valibot.tuple([valibot.custom(() => true)])), valibot.returns(valibot.string()))]);
647
- const SanitizeFileNameSchema = valibot.union([valibot.boolean(), valibot.pipe(valibot.function(), valibot.args(valibot.tuple([valibot.string()])), valibot.returns(valibot.string()))]);
648
- const GlobalsFunctionSchema = valibot.pipe(valibot.function(), valibot.args(valibot.tuple([valibot.string()])), valibot.returns(valibot.string()));
649
- const AdvancedChunksSchema = valibot.strictObject({
650
- minSize: valibot.optional(valibot.number()),
651
- maxSize: valibot.optional(valibot.number()),
652
- minModuleSize: valibot.optional(valibot.number()),
653
- maxModuleSize: valibot.optional(valibot.number()),
654
- minShareCount: valibot.optional(valibot.number()),
655
- groups: valibot.optional(valibot.array(valibot.strictObject({
656
- name: valibot.string(),
657
- test: valibot.optional(valibot.union([valibot.string(), valibot.instance(RegExp)])),
658
- priority: valibot.optional(valibot.number()),
659
- minSize: valibot.optional(valibot.number()),
660
- minShareCount: valibot.optional(valibot.number()),
661
- maxSize: valibot.optional(valibot.number()),
662
- minModuleSize: valibot.optional(valibot.number()),
663
- 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())
664
1970
  })))
665
1971
  });
666
- const OutputOptionsSchema = valibot.strictObject({
667
- dir: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Output directory, defaults to `dist` if `file` is not set")),
668
- file: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Single output file")),
669
- exports: valibot.pipe(valibot.optional(valibot.union([
670
- valibot.literal("auto"),
671
- valibot.literal("named"),
672
- valibot.literal("default"),
673
- valibot.literal("none")
674
- ])), valibot.description(`Specify a export mode (${ansis.default.underline("auto")}, named, default, none)`)),
675
- hashCharacters: valibot.pipe(valibot.optional(valibot.union([
676
- valibot.literal("base64"),
677
- valibot.literal("base36"),
678
- valibot.literal("hex")
679
- ])), valibot.description("Use the specified character set for file hashes")),
680
- format: valibot.pipe(valibot.optional(ModuleFormatSchema), valibot.description(`Output format of the generated bundle (supports ${ansis.default.underline("esm")}, cjs, and iife)`)),
681
- sourcemap: valibot.pipe(valibot.optional(valibot.union([
682
- valibot.boolean(),
683
- valibot.literal("inline"),
684
- valibot.literal("hidden")
685
- ])), 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")})`)),
686
- sourcemapDebugIds: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Inject sourcemap debug IDs")),
687
- sourcemapIgnoreList: valibot.optional(valibot.union([valibot.boolean(), valibot.custom(() => true)])),
688
- sourcemapPathTransform: valibot.optional(valibot.custom(() => true)),
689
- banner: valibot.optional(valibot.union([valibot.string(), AddonFunctionSchema])),
690
- footer: valibot.optional(valibot.union([valibot.string(), AddonFunctionSchema])),
691
- intro: valibot.optional(valibot.union([valibot.string(), AddonFunctionSchema])),
692
- outro: valibot.optional(valibot.union([valibot.string(), AddonFunctionSchema])),
693
- extend: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Extend global variable defined by name in IIFE / UMD formats")),
694
- esModule: valibot.optional(valibot.union([valibot.boolean(), valibot.literal("if-default-prop")])),
695
- assetFileNames: valibot.optional(AssetFileNamesSchema),
696
- entryFileNames: valibot.optional(ChunkFileNamesSchema),
697
- chunkFileNames: valibot.optional(ChunkFileNamesSchema),
698
- cssEntryFileNames: valibot.optional(ChunkFileNamesSchema),
699
- cssChunkFileNames: valibot.optional(ChunkFileNamesSchema),
700
- sanitizeFileName: valibot.optional(SanitizeFileNameSchema),
701
- minify: valibot.pipe(valibot.optional(valibot.union([
702
- valibot.boolean(),
703
- 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"),
704
2010
  MinifyOptionsSchema
705
- ])), valibot.description("Minify the bundled file")),
706
- name: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name for UMD / IIFE format outputs")),
707
- 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`)")),
708
- externalLiveBindings: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("external live bindings")),
709
- inlineDynamicImports: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Inline dynamic imports")),
710
- advancedChunks: valibot.optional(AdvancedChunksSchema),
711
- comments: valibot.pipe(valibot.optional(valibot.union([valibot.literal("none"), valibot.literal("preserve-legal")])), valibot.description("Control comments in the output")),
712
- plugins: valibot.optional(valibot.custom(() => true)),
713
- polyfillRequire: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Disable require polyfill injection")),
714
- target: valibot.pipe(valibot.optional(valibot.enum(ESTarget)), valibot.description("The JavaScript target environment")),
715
- 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) => {
716
2022
  if (input) return false;
717
2023
  return true;
718
2024
  }, () => `The 'true' value is not supported`))
@@ -720,26 +2026,26 @@ const OutputOptionsSchema = valibot.strictObject({
720
2026
  const getAddonDescription = (placement, wrapper) => {
721
2027
  return `Code to insert the ${ansis.default.bold(placement)} of the bundled file (${ansis.default.bold(wrapper)} the wrapper function)`;
722
2028
  };
723
- const OutputCliOverrideSchema = valibot.strictObject({
724
- assetFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for asset files")),
725
- entryFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for emitted entry chunks")),
726
- chunkFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for emitted secondary chunks")),
727
- cssEntryFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for emitted css entry chunks")),
728
- cssChunkFileNames: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Name pattern for emitted css secondary chunks")),
729
- sanitizeFileName: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Sanitize file name")),
730
- banner: valibot.pipe(valibot.optional(valibot.string()), valibot.description(getAddonDescription("top", "outside"))),
731
- footer: valibot.pipe(valibot.optional(valibot.string()), valibot.description(getAddonDescription("bottom", "outside"))),
732
- intro: valibot.pipe(valibot.optional(valibot.string()), valibot.description(getAddonDescription("top", "inside"))),
733
- outro: valibot.pipe(valibot.optional(valibot.string()), valibot.description(getAddonDescription("bottom", "inside"))),
734
- 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)")),
735
- globals: valibot.pipe(valibot.optional(valibot.record(valibot.string(), valibot.string())), valibot.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
736
- advancedChunks: valibot.pipe(valibot.optional(valibot.strictObject({
737
- minSize: valibot.pipe(valibot.optional(valibot.number()), valibot.description("Minimum size of the chunk")),
738
- minShareCount: valibot.pipe(valibot.optional(valibot.number()), valibot.description("Minimum share count of the chunk"))
739
- })), valibot.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
740
- 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"))
741
2047
  });
742
- const OutputCliOptionsSchema = valibot.omit(valibot.strictObject({
2048
+ const OutputCliOptionsSchema = omit(strictObject({
743
2049
  ...OutputOptionsSchema.entries,
744
2050
  ...OutputCliOverrideSchema.entries
745
2051
  }), [
@@ -748,16 +2054,16 @@ const OutputCliOptionsSchema = valibot.omit(valibot.strictObject({
748
2054
  "plugins",
749
2055
  "hoistTransitiveImports"
750
2056
  ]);
751
- const CliOptionsSchema = valibot.strictObject({
752
- config: valibot.pipe(valibot.optional(valibot.union([valibot.string(), valibot.boolean()])), valibot.description("Path to the config file (default: `rolldown.config.js`)")),
753
- help: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Show help")),
754
- version: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("Show version number")),
755
- 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")),
756
2062
  ...InputCliOptionsSchema.entries,
757
2063
  ...OutputCliOptionsSchema.entries
758
2064
  });
759
2065
  function validateCliOptions(options) {
760
- let parsed = valibot.safeParse(CliOptionsSchema, options);
2066
+ let parsed = safeParse(CliOptionsSchema, options);
761
2067
  return [parsed.output, parsed.issues?.map((issue) => {
762
2068
  const option = issue.path?.map((pathItem) => pathItem.key).join(" ");
763
2069
  return `Invalid value for option ${option}: ${issue.message}`;
@@ -767,7 +2073,7 @@ const inputHelperMsgRecord = { output: { ignored: true } };
767
2073
  const outputHelperMsgRecord = {};
768
2074
  function validateOption(key, options) {
769
2075
  if (globalThis.process?.env?.ROLLDOWN_OPTIONS_VALIDATION === "loose") return;
770
- let parsed = valibot.safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
2076
+ let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
771
2077
  if (!parsed.success) {
772
2078
  const errors = parsed.issues.map((issue) => {
773
2079
  const issuePaths = issue.path.map((path$2) => path$2.key);
@@ -788,13 +2094,13 @@ function validateOption(key, options) {
788
2094
  }
789
2095
  }
790
2096
  function getInputCliKeys() {
791
- return valibot.keyof(InputCliOptionsSchema).options;
2097
+ return keyof(InputCliOptionsSchema).options;
792
2098
  }
793
2099
  function getOutputCliKeys() {
794
- return valibot.keyof(OutputCliOptionsSchema).options;
2100
+ return keyof(OutputCliOptionsSchema).options;
795
2101
  }
796
2102
  function getJsonSchema() {
797
- return (0, __valibot_to_json_schema.toJsonSchema)(CliOptionsSchema);
2103
+ return toJsonSchema(CliOptionsSchema);
798
2104
  }
799
2105
 
800
2106
  //#endregion
@@ -931,9 +2237,9 @@ function bindingifySideEffects(sideEffects) {
931
2237
 
932
2238
  //#endregion
933
2239
  //#region src/utils/transform-sourcemap.ts
934
- function isEmptySourcemapFiled(array) {
935
- if (!array) return true;
936
- 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;
937
2243
  return false;
938
2244
  }
939
2245
  function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
@@ -983,14 +2289,16 @@ function t(...n) {
983
2289
  //#endregion
984
2290
  //#region src/plugin/bindingify-hook-filter.ts
985
2291
  function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
986
- if (typeof matcher === "string" || matcher instanceof RegExp) return [require_filter_index.include(require_filter_index.id(matcher))];
987
- if (Array.isArray(matcher)) return matcher.map((m) => require_filter_index.include(require_filter_index.id(m)));
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)));
988
2294
  let ret = [];
989
- let isCode = stringKind === "code";
990
- if (matcher.exclude) ret.push(...require_filter_index.arraify(matcher.exclude).map((m) => require_filter_index.exclude(isCode ? require_filter_index.code(m) : require_filter_index.id(m))));
991
- if (matcher.include) ret.push(...require_filter_index.arraify(matcher.include).map((m) => require_filter_index.include(isCode ? require_filter_index.code(m) : require_filter_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))));
992
2297
  return ret;
993
2298
  }
2299
+ function generateAtomMatcher(kind, matcher) {
2300
+ return kind === "code" ? require_filter_index.code(matcher) : require_filter_index.id(matcher);
2301
+ }
994
2302
  function transformFilterMatcherToFilterExprs(filterOption) {
995
2303
  if (!filterOption) return void 0;
996
2304
  if (Array.isArray(filterOption)) return filterOption;
@@ -1028,20 +2336,20 @@ function bindingifyFilterExpr(expr) {
1028
2336
  function bindingifyFilterExprImpl(expr, list) {
1029
2337
  switch (expr.kind) {
1030
2338
  case "and": {
1031
- let args = expr.args;
1032
- for (let i$1 = args.length - 1; i$1 >= 0; i$1--) bindingifyFilterExprImpl(args[i$1], list);
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);
1033
2341
  list.push({
1034
2342
  kind: "And",
1035
- payload: args.length
2343
+ payload: args$1.length
1036
2344
  });
1037
2345
  break;
1038
2346
  }
1039
2347
  case "or": {
1040
- let args = expr.args;
1041
- for (let i$1 = args.length - 1; i$1 >= 0; i$1--) bindingifyFilterExprImpl(args[i$1], list);
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);
1042
2350
  list.push({
1043
2351
  kind: "Or",
1044
- payload: args.length
2352
+ payload: args$1.length
1045
2353
  });
1046
2354
  break;
1047
2355
  }
@@ -1158,10 +2466,10 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
1158
2466
  async function createLoadModulePromise(context, data) {
1159
2467
  const loadPromise = data.loadModulePromiseMap.get(id$1);
1160
2468
  if (loadPromise) return loadPromise;
1161
- const promise = new Promise((resolve, _) => {
2469
+ const promise$1 = new Promise((resolve, _) => {
1162
2470
  data.loadModulePromiseResolveFnMap.set(id$1, resolve);
1163
2471
  });
1164
- data.loadModulePromiseMap.set(id$1, promise);
2472
+ data.loadModulePromiseMap.set(id$1, promise$1);
1165
2473
  try {
1166
2474
  await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
1167
2475
  } catch (e) {
@@ -1169,7 +2477,7 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
1169
2477
  data.loadModulePromiseResolveFnMap.delete(id$1);
1170
2478
  throw e;
1171
2479
  }
1172
- return promise;
2480
+ return promise$1;
1173
2481
  }
1174
2482
  await createLoadModulePromise(this.context, this.data);
1175
2483
  return this.data.getModuleInfo(id$1, this.context);
@@ -1256,41 +2564,41 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
1256
2564
 
1257
2565
  //#endregion
1258
2566
  //#region src/plugin/bindingify-build-hooks.ts
1259
- function bindingifyBuildStart(args) {
1260
- const hook = args.plugin.buildStart;
2567
+ function bindingifyBuildStart(args$1) {
2568
+ const hook = args$1.plugin.buildStart;
1261
2569
  if (!hook) return {};
1262
2570
  const { handler, meta } = normalizeHook(hook);
1263
2571
  return {
1264
2572
  plugin: async (ctx, opts) => {
1265
- 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));
1266
2574
  },
1267
2575
  meta: bindingifyPluginHookMeta(meta)
1268
2576
  };
1269
2577
  }
1270
- function bindingifyBuildEnd(args) {
1271
- const hook = args.plugin.buildEnd;
2578
+ function bindingifyBuildEnd(args$1) {
2579
+ const hook = args$1.plugin.buildEnd;
1272
2580
  if (!hook) return {};
1273
2581
  const { handler, meta } = normalizeHook(hook);
1274
2582
  return {
1275
2583
  plugin: async (ctx, err) => {
1276
- 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);
1277
2585
  },
1278
2586
  meta: bindingifyPluginHookMeta(meta)
1279
2587
  };
1280
2588
  }
1281
- function bindingifyResolveId(args) {
1282
- const hook = args.plugin.resolveId;
2589
+ function bindingifyResolveId(args$1) {
2590
+ const hook = args$1.plugin.resolveId;
1283
2591
  if (!hook) return {};
1284
2592
  const { handler, meta, options } = normalizeHook(hook);
1285
2593
  return {
1286
2594
  plugin: async (ctx, specifier, importer, extraOptions) => {
1287
- 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;
1288
2596
  const newExtraOptions = {
1289
2597
  ...extraOptions,
1290
2598
  custom: contextResolveOptions?.custom,
1291
2599
  [SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
1292
2600
  };
1293
- 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);
1294
2602
  if (ret == null) return;
1295
2603
  if (ret === false) return {
1296
2604
  id: specifier,
@@ -1301,7 +2609,7 @@ function bindingifyResolveId(args) {
1301
2609
  id: ret,
1302
2610
  normalizeExternalId: true
1303
2611
  };
1304
- let exist = args.pluginContextData.updateModuleOption(ret.id, {
2612
+ let exist = args$1.pluginContextData.updateModuleOption(ret.id, {
1305
2613
  meta: ret.meta || {},
1306
2614
  moduleSideEffects: ret.moduleSideEffects ?? null,
1307
2615
  invalidate: false
@@ -1317,13 +2625,13 @@ function bindingifyResolveId(args) {
1317
2625
  filter: bindingifyResolveIdFilter(options.filter)
1318
2626
  };
1319
2627
  }
1320
- function bindingifyResolveDynamicImport(args) {
1321
- const hook = args.plugin.resolveDynamicImport;
2628
+ function bindingifyResolveDynamicImport(args$1) {
2629
+ const hook = args$1.plugin.resolveDynamicImport;
1322
2630
  if (!hook) return {};
1323
2631
  const { handler, meta } = normalizeHook(hook);
1324
2632
  return {
1325
2633
  plugin: async (ctx, specifier, importer) => {
1326
- 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);
1327
2635
  if (ret == null) return;
1328
2636
  if (ret === false) return {
1329
2637
  id: specifier,
@@ -1335,7 +2643,7 @@ function bindingifyResolveDynamicImport(args) {
1335
2643
  external: ret.external
1336
2644
  };
1337
2645
  if (ret.moduleSideEffects !== null) result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
1338
- args.pluginContextData.updateModuleOption(ret.id, {
2646
+ args$1.pluginContextData.updateModuleOption(ret.id, {
1339
2647
  meta: ret.meta || {},
1340
2648
  moduleSideEffects: ret.moduleSideEffects || null,
1341
2649
  invalidate: false
@@ -1345,16 +2653,16 @@ function bindingifyResolveDynamicImport(args) {
1345
2653
  meta: bindingifyPluginHookMeta(meta)
1346
2654
  };
1347
2655
  }
1348
- function bindingifyTransform(args) {
1349
- const hook = args.plugin.transform;
2656
+ function bindingifyTransform(args$1) {
2657
+ const hook = args$1.plugin.transform;
1350
2658
  if (!hook) return {};
1351
2659
  const { handler, meta, options } = normalizeHook(hook);
1352
2660
  return {
1353
2661
  plugin: async (ctx, code$1, id$1, meta$1) => {
1354
- 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);
1355
2663
  if (ret == null) return void 0;
1356
2664
  if (typeof ret === "string") return { code: ret };
1357
- let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
2665
+ let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
1358
2666
  meta: ret.meta ?? {},
1359
2667
  moduleSideEffects: ret.moduleSideEffects ?? null,
1360
2668
  invalidate: false
@@ -1370,16 +2678,16 @@ function bindingifyTransform(args) {
1370
2678
  filter: bindingifyTransformFilter(options.filter)
1371
2679
  };
1372
2680
  }
1373
- function bindingifyLoad(args) {
1374
- const hook = args.plugin.load;
2681
+ function bindingifyLoad(args$1) {
2682
+ const hook = args$1.plugin.load;
1375
2683
  if (!hook) return {};
1376
2684
  const { handler, meta, options } = normalizeHook(hook);
1377
2685
  return {
1378
2686
  plugin: async (ctx, id$1) => {
1379
- 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);
1380
2688
  if (ret == null) return;
1381
2689
  if (typeof ret === "string") return { code: ret };
1382
- let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
2690
+ let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
1383
2691
  meta: ret.meta || {},
1384
2692
  moduleSideEffects: ret.moduleSideEffects ?? null,
1385
2693
  invalidate: false
@@ -1406,13 +2714,13 @@ function preProcessSourceMap(ret, id$1) {
1406
2714
  }
1407
2715
  return map;
1408
2716
  }
1409
- function bindingifyModuleParsed(args) {
1410
- const hook = args.plugin.moduleParsed;
2717
+ function bindingifyModuleParsed(args$1) {
2718
+ const hook = args$1.plugin.moduleParsed;
1411
2719
  if (!hook) return {};
1412
2720
  const { handler, meta } = normalizeHook(hook);
1413
2721
  return {
1414
2722
  plugin: async (ctx, moduleInfo) => {
1415
- 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)));
1416
2724
  },
1417
2725
  meta: bindingifyPluginHookMeta(meta)
1418
2726
  };
@@ -1810,25 +3118,25 @@ function collectChangedBundle(changed, bundle) {
1810
3118
 
1811
3119
  //#endregion
1812
3120
  //#region src/plugin/bindingify-output-hooks.ts
1813
- function bindingifyRenderStart(args) {
1814
- const hook = args.plugin.renderStart;
3121
+ function bindingifyRenderStart(args$1) {
3122
+ const hook = args$1.plugin.renderStart;
1815
3123
  if (!hook) return {};
1816
3124
  const { handler, meta } = normalizeHook(hook);
1817
3125
  return {
1818
3126
  plugin: async (ctx, opts) => {
1819
- 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));
1820
3128
  },
1821
3129
  meta: bindingifyPluginHookMeta(meta)
1822
3130
  };
1823
3131
  }
1824
- function bindingifyRenderChunk(args) {
1825
- const hook = args.plugin.renderChunk;
3132
+ function bindingifyRenderChunk(args$1) {
3133
+ const hook = args$1.plugin.renderChunk;
1826
3134
  if (!hook) return {};
1827
3135
  const { handler, meta, options } = normalizeHook(hook);
1828
3136
  return {
1829
3137
  plugin: async (ctx, code$1, chunk, opts, meta$1) => {
1830
- if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
1831
- 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());
1832
3140
  if (ret == null) return;
1833
3141
  if (typeof ret === "string") return { code: ret };
1834
3142
  if (!ret.map) return { code: ret.code };
@@ -1841,30 +3149,30 @@ function bindingifyRenderChunk(args) {
1841
3149
  filter: bindingifyRenderChunkFilter(options.filter)
1842
3150
  };
1843
3151
  }
1844
- function bindingifyAugmentChunkHash(args) {
1845
- const hook = args.plugin.augmentChunkHash;
3152
+ function bindingifyAugmentChunkHash(args$1) {
3153
+ const hook = args$1.plugin.augmentChunkHash;
1846
3154
  if (!hook) return {};
1847
3155
  const { handler, meta } = normalizeHook(hook);
1848
3156
  return {
1849
3157
  plugin: async (ctx, chunk) => {
1850
- 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));
1851
3159
  },
1852
3160
  meta: bindingifyPluginHookMeta(meta)
1853
3161
  };
1854
3162
  }
1855
- function bindingifyRenderError(args) {
1856
- const hook = args.plugin.renderError;
3163
+ function bindingifyRenderError(args$1) {
3164
+ const hook = args$1.plugin.renderError;
1857
3165
  if (!hook) return {};
1858
3166
  const { handler, meta } = normalizeHook(hook);
1859
3167
  return {
1860
3168
  plugin: async (ctx, err) => {
1861
- 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));
1862
3170
  },
1863
3171
  meta: bindingifyPluginHookMeta(meta)
1864
3172
  };
1865
3173
  }
1866
- function bindingifyGenerateBundle(args) {
1867
- const hook = args.plugin.generateBundle;
3174
+ function bindingifyGenerateBundle(args$1) {
3175
+ const hook = args$1.plugin.generateBundle;
1868
3176
  if (!hook) return {};
1869
3177
  const { handler, meta } = normalizeHook(hook);
1870
3178
  return {
@@ -1874,14 +3182,14 @@ function bindingifyGenerateBundle(args) {
1874
3182
  deleted: new Set()
1875
3183
  };
1876
3184
  const output = transformToOutputBundle(bundle, changed);
1877
- 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);
1878
3186
  return collectChangedBundle(changed, output);
1879
3187
  },
1880
3188
  meta: bindingifyPluginHookMeta(meta)
1881
3189
  };
1882
3190
  }
1883
- function bindingifyWriteBundle(args) {
1884
- const hook = args.plugin.writeBundle;
3191
+ function bindingifyWriteBundle(args$1) {
3192
+ const hook = args$1.plugin.writeBundle;
1885
3193
  if (!hook) return {};
1886
3194
  const { handler, meta } = normalizeHook(hook);
1887
3195
  return {
@@ -1891,67 +3199,67 @@ function bindingifyWriteBundle(args) {
1891
3199
  deleted: new Set()
1892
3200
  };
1893
3201
  const output = transformToOutputBundle(bundle, changed);
1894
- 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);
1895
3203
  return collectChangedBundle(changed, output);
1896
3204
  },
1897
3205
  meta: bindingifyPluginHookMeta(meta)
1898
3206
  };
1899
3207
  }
1900
- function bindingifyCloseBundle(args) {
1901
- const hook = args.plugin.closeBundle;
3208
+ function bindingifyCloseBundle(args$1) {
3209
+ const hook = args$1.plugin.closeBundle;
1902
3210
  if (!hook) return {};
1903
3211
  const { handler, meta } = normalizeHook(hook);
1904
3212
  return {
1905
3213
  plugin: async (ctx) => {
1906
- 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));
1907
3215
  },
1908
3216
  meta: bindingifyPluginHookMeta(meta)
1909
3217
  };
1910
3218
  }
1911
- function bindingifyBanner(args) {
1912
- const hook = args.plugin.banner;
3219
+ function bindingifyBanner(args$1) {
3220
+ const hook = args$1.plugin.banner;
1913
3221
  if (!hook) return {};
1914
3222
  const { handler, meta } = normalizeHook(hook);
1915
3223
  return {
1916
3224
  plugin: async (ctx, chunk) => {
1917
3225
  if (typeof handler === "string") return handler;
1918
- 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));
1919
3227
  },
1920
3228
  meta: bindingifyPluginHookMeta(meta)
1921
3229
  };
1922
3230
  }
1923
- function bindingifyFooter(args) {
1924
- const hook = args.plugin.footer;
3231
+ function bindingifyFooter(args$1) {
3232
+ const hook = args$1.plugin.footer;
1925
3233
  if (!hook) return {};
1926
3234
  const { handler, meta } = normalizeHook(hook);
1927
3235
  return {
1928
3236
  plugin: async (ctx, chunk) => {
1929
3237
  if (typeof handler === "string") return handler;
1930
- 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));
1931
3239
  },
1932
3240
  meta: bindingifyPluginHookMeta(meta)
1933
3241
  };
1934
3242
  }
1935
- function bindingifyIntro(args) {
1936
- const hook = args.plugin.intro;
3243
+ function bindingifyIntro(args$1) {
3244
+ const hook = args$1.plugin.intro;
1937
3245
  if (!hook) return {};
1938
3246
  const { handler, meta } = normalizeHook(hook);
1939
3247
  return {
1940
3248
  plugin: async (ctx, chunk) => {
1941
3249
  if (typeof handler === "string") return handler;
1942
- 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));
1943
3251
  },
1944
3252
  meta: bindingifyPluginHookMeta(meta)
1945
3253
  };
1946
3254
  }
1947
- function bindingifyOutro(args) {
1948
- const hook = args.plugin.outro;
3255
+ function bindingifyOutro(args$1) {
3256
+ const hook = args$1.plugin.outro;
1949
3257
  if (!hook) return {};
1950
3258
  const { handler, meta } = normalizeHook(hook);
1951
3259
  return {
1952
3260
  plugin: async (ctx, chunk) => {
1953
3261
  if (typeof handler === "string") return handler;
1954
- 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));
1955
3263
  },
1956
3264
  meta: bindingifyPluginHookMeta(meta)
1957
3265
  };
@@ -1959,24 +3267,24 @@ function bindingifyOutro(args) {
1959
3267
 
1960
3268
  //#endregion
1961
3269
  //#region src/plugin/bindingify-watch-hooks.ts
1962
- function bindingifyWatchChange(args) {
1963
- const hook = args.plugin.watchChange;
3270
+ function bindingifyWatchChange(args$1) {
3271
+ const hook = args$1.plugin.watchChange;
1964
3272
  if (!hook) return {};
1965
3273
  const { handler, meta } = normalizeHook(hook);
1966
3274
  return {
1967
3275
  plugin: async (ctx, id$1, event) => {
1968
- 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 });
1969
3277
  },
1970
3278
  meta: bindingifyPluginHookMeta(meta)
1971
3279
  };
1972
3280
  }
1973
- function bindingifyCloseWatcher(args) {
1974
- const hook = args.plugin.closeWatcher;
3281
+ function bindingifyCloseWatcher(args$1) {
3282
+ const hook = args$1.plugin.closeWatcher;
1975
3283
  if (!hook) return {};
1976
3284
  const { handler, meta } = normalizeHook(hook);
1977
3285
  return {
1978
3286
  plugin: async (ctx) => {
1979
- 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));
1980
3288
  },
1981
3289
  meta: bindingifyPluginHookMeta(meta)
1982
3290
  };
@@ -2046,7 +3354,7 @@ function extractHookUsage(plugin) {
2046
3354
  //#endregion
2047
3355
  //#region src/plugin/bindingify-plugin.ts
2048
3356
  function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
2049
- const args = {
3357
+ const args$1 = {
2050
3358
  plugin,
2051
3359
  options,
2052
3360
  outputOptions,
@@ -2056,26 +3364,26 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
2056
3364
  watchMode,
2057
3365
  normalizedOutputPlugins
2058
3366
  };
2059
- const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
2060
- const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
2061
- const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args);
2062
- const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args);
2063
- const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
2064
- const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
2065
- const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
2066
- const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args);
2067
- const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
2068
- const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
2069
- const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
2070
- const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args);
2071
- const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args);
2072
- const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args);
2073
- const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args);
2074
- const { plugin: footer, meta: footerMeta } = bindingifyFooter(args);
2075
- const { plugin: intro, meta: introMeta } = bindingifyIntro(args);
2076
- const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
2077
- const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
2078
- 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);
2079
3387
  let hookUsage = extractHookUsage(plugin).inner();
2080
3388
  const result = {
2081
3389
  name: plugin.name,
@@ -2151,13 +3459,13 @@ function wrapHandlers(plugin) {
2151
3459
  "closeWatcher"
2152
3460
  ]) {
2153
3461
  const handler = plugin[hookName];
2154
- if (handler) plugin[hookName] = async (...args) => {
3462
+ if (handler) plugin[hookName] = async (...args$1) => {
2155
3463
  try {
2156
- return await handler(...args);
3464
+ return await handler(...args$1);
2157
3465
  } catch (e) {
2158
3466
  return require_parse_ast_index.error(require_parse_ast_index.logPluginError(e, plugin.name, {
2159
3467
  hook: hookName,
2160
- id: hookName === "transform" ? args[2] : void 0
3468
+ id: hookName === "transform" ? args$1[2] : void 0
2161
3469
  }));
2162
3470
  }
2163
3471
  };
@@ -2916,6 +4224,9 @@ var RolldownBuild = class {
2916
4224
  async generateHmrPatch(changedFiles) {
2917
4225
  return this.#bundler?.bundler.generateHmrPatch(changedFiles);
2918
4226
  }
4227
+ async hmrInvalidate(file, firstInvalidatedBy) {
4228
+ return this.#bundler?.bundler.hmrInvalidate(file, firstInvalidatedBy);
4229
+ }
2919
4230
  get watchFiles() {
2920
4231
  return this.#bundler?.bundler.watchFiles ?? [];
2921
4232
  }
@@ -3136,7 +4447,7 @@ Object.defineProperty(exports, 'defineConfig', {
3136
4447
  Object.defineProperty(exports, 'description', {
3137
4448
  enumerable: true,
3138
4449
  get: function () {
3139
- return description;
4450
+ return description$1;
3140
4451
  }
3141
4452
  });
3142
4453
  Object.defineProperty(exports, 'dynamicImportVarsPlugin', {