@rolldown/browser 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 @@ import { and, arraify, code, exclude, id, include, init_filter_index, init_misc,
3
3
  import { augmentCodeLocation, error, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-B5wGnMSg.mjs";
4
4
  import { BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingLogLevel, BindingPluginOrder, BindingWatcher, Bundler, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
5
5
  import path from "node:path";
6
- import { toJsonSchema } from "@valibot/to-json-schema";
7
6
  import colors from "ansis";
8
- import * as v from "valibot";
9
7
  import { availableParallelism } from "node:os";
10
8
  import { Worker } from "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 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
  }
@@ -310,11 +308,11 @@ var init_plugin$1 = __esm({ "src/constants/plugin.ts"() {
310
308
 
311
309
  //#endregion
312
310
  //#region src/utils/async-flatten.ts
313
- async function asyncFlatten(array) {
311
+ async function asyncFlatten(array$1) {
314
312
  do
315
- array = (await Promise.all(array)).flat(Infinity);
316
- while (array.some((v$1) => v$1?.then));
317
- return array;
313
+ array$1 = (await Promise.all(array$1)).flat(Infinity);
314
+ while (array$1.some((v) => v?.then));
315
+ return array$1;
318
316
  }
319
317
  var init_async_flatten = __esm({ "src/utils/async-flatten.ts"() {} });
320
318
 
@@ -454,10 +452,1321 @@ var init_plugin_driver = __esm({ "src/plugin/plugin-driver.ts"() {
454
452
  };
455
453
  } });
456
454
 
455
+ //#endregion
456
+ //#region ../../node_modules/.pnpm/valibot@1.0.0_typescript@5.8.3/node_modules/valibot/dist/index.js
457
+ /* @__NO_SIDE_EFFECTS__ */
458
+ function getGlobalConfig(config2) {
459
+ return {
460
+ lang: config2?.lang ?? store?.lang,
461
+ message: config2?.message,
462
+ abortEarly: config2?.abortEarly ?? store?.abortEarly,
463
+ abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
464
+ };
465
+ }
466
+ /* @__NO_SIDE_EFFECTS__ */
467
+ function getGlobalMessage(lang) {
468
+ return store2?.get(lang);
469
+ }
470
+ /* @__NO_SIDE_EFFECTS__ */
471
+ function getSchemaMessage(lang) {
472
+ return store3?.get(lang);
473
+ }
474
+ /* @__NO_SIDE_EFFECTS__ */
475
+ function getSpecificMessage(reference, lang) {
476
+ return store4?.get(reference)?.get(lang);
477
+ }
478
+ /* @__NO_SIDE_EFFECTS__ */
479
+ function _stringify(input) {
480
+ const type = typeof input;
481
+ if (type === "string") return `"${input}"`;
482
+ if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
483
+ if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
484
+ return type;
485
+ }
486
+ function _addIssue(context, label, dataset, config2, other) {
487
+ const input = other && "input" in other ? other.input : dataset.value;
488
+ const expected = other?.expected ?? context.expects ?? null;
489
+ const received = other?.received ?? /* @__PURE__ */ _stringify(input);
490
+ const issue = {
491
+ kind: context.kind,
492
+ type: context.type,
493
+ input,
494
+ expected,
495
+ received,
496
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
497
+ requirement: context.requirement,
498
+ path: other?.path,
499
+ issues: other?.issues,
500
+ lang: config2.lang,
501
+ abortEarly: config2.abortEarly,
502
+ abortPipeEarly: config2.abortPipeEarly
503
+ };
504
+ const isSchema = context.kind === "schema";
505
+ const message = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
506
+ if (message !== void 0) issue.message = typeof message === "function" ? message(issue) : message;
507
+ if (isSchema) dataset.typed = false;
508
+ if (dataset.issues) dataset.issues.push(issue);
509
+ else dataset.issues = [issue];
510
+ }
511
+ /* @__NO_SIDE_EFFECTS__ */
512
+ function _getStandardProps(context) {
513
+ return {
514
+ version: 1,
515
+ vendor: "valibot",
516
+ validate(value2) {
517
+ return context["~run"]({ value: value2 }, /* @__PURE__ */ getGlobalConfig());
518
+ }
519
+ };
520
+ }
521
+ /* @__NO_SIDE_EFFECTS__ */
522
+ function _isValidObjectKey(object2, key) {
523
+ return Object.hasOwn(object2, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
524
+ }
525
+ /* @__NO_SIDE_EFFECTS__ */
526
+ function _joinExpects(values2, separator) {
527
+ const list = [...new Set(values2)];
528
+ if (list.length > 1) return `(${list.join(` ${separator} `)})`;
529
+ return list[0] ?? "never";
530
+ }
531
+ /* @__NO_SIDE_EFFECTS__ */
532
+ function args(schema) {
533
+ return {
534
+ kind: "transformation",
535
+ type: "args",
536
+ reference: args,
537
+ async: false,
538
+ schema,
539
+ "~run"(dataset, config2) {
540
+ const func = dataset.value;
541
+ dataset.value = (...args_) => {
542
+ const argsDataset = this.schema["~run"]({ value: args_ }, config2);
543
+ if (argsDataset.issues) throw new ValiError(argsDataset.issues);
544
+ return func(...argsDataset.value);
545
+ };
546
+ return dataset;
547
+ }
548
+ };
549
+ }
550
+ /* @__NO_SIDE_EFFECTS__ */
551
+ function awaitAsync() {
552
+ return {
553
+ kind: "transformation",
554
+ type: "await",
555
+ reference: awaitAsync,
556
+ async: true,
557
+ async "~run"(dataset) {
558
+ dataset.value = await dataset.value;
559
+ return dataset;
560
+ }
561
+ };
562
+ }
563
+ /* @__NO_SIDE_EFFECTS__ */
564
+ function description(description_) {
565
+ return {
566
+ kind: "metadata",
567
+ type: "description",
568
+ reference: description,
569
+ description: description_
570
+ };
571
+ }
572
+ /* @__NO_SIDE_EFFECTS__ */
573
+ function returns(schema) {
574
+ return {
575
+ kind: "transformation",
576
+ type: "returns",
577
+ reference: returns,
578
+ async: false,
579
+ schema,
580
+ "~run"(dataset, config2) {
581
+ const func = dataset.value;
582
+ dataset.value = (...args_) => {
583
+ const returnsDataset = this.schema["~run"]({ value: func(...args_) }, config2);
584
+ if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
585
+ return returnsDataset.value;
586
+ };
587
+ return dataset;
588
+ }
589
+ };
590
+ }
591
+ /* @__NO_SIDE_EFFECTS__ */
592
+ function returnsAsync(schema) {
593
+ return {
594
+ kind: "transformation",
595
+ type: "returns",
596
+ reference: returnsAsync,
597
+ async: false,
598
+ schema,
599
+ "~run"(dataset, config2) {
600
+ const func = dataset.value;
601
+ dataset.value = async (...args_) => {
602
+ const returnsDataset = await this.schema["~run"]({ value: await func(...args_) }, config2);
603
+ if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
604
+ return returnsDataset.value;
605
+ };
606
+ return dataset;
607
+ }
608
+ };
609
+ }
610
+ /* @__NO_SIDE_EFFECTS__ */
611
+ function getFallback(schema, dataset, config2) {
612
+ return typeof schema.fallback === "function" ? schema.fallback(dataset, config2) : schema.fallback;
613
+ }
614
+ /* @__NO_SIDE_EFFECTS__ */
615
+ function getDefault(schema, dataset, config2) {
616
+ return typeof schema.default === "function" ? schema.default(dataset, config2) : schema.default;
617
+ }
618
+ /* @__NO_SIDE_EFFECTS__ */
619
+ function any() {
620
+ return {
621
+ kind: "schema",
622
+ type: "any",
623
+ reference: any,
624
+ expects: "any",
625
+ async: false,
626
+ get "~standard"() {
627
+ return /* @__PURE__ */ _getStandardProps(this);
628
+ },
629
+ "~run"(dataset) {
630
+ dataset.typed = true;
631
+ return dataset;
632
+ }
633
+ };
634
+ }
635
+ /* @__NO_SIDE_EFFECTS__ */
636
+ function array(item, message) {
637
+ return {
638
+ kind: "schema",
639
+ type: "array",
640
+ reference: array,
641
+ expects: "Array",
642
+ async: false,
643
+ item,
644
+ message,
645
+ get "~standard"() {
646
+ return /* @__PURE__ */ _getStandardProps(this);
647
+ },
648
+ "~run"(dataset, config2) {
649
+ const input = dataset.value;
650
+ if (Array.isArray(input)) {
651
+ dataset.typed = true;
652
+ dataset.value = [];
653
+ for (let key = 0; key < input.length; key++) {
654
+ const value2 = input[key];
655
+ const itemDataset = this.item["~run"]({ value: value2 }, config2);
656
+ if (itemDataset.issues) {
657
+ const pathItem = {
658
+ type: "array",
659
+ origin: "value",
660
+ input,
661
+ key,
662
+ value: value2
663
+ };
664
+ for (const issue of itemDataset.issues) {
665
+ if (issue.path) issue.path.unshift(pathItem);
666
+ else issue.path = [pathItem];
667
+ dataset.issues?.push(issue);
668
+ }
669
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
670
+ if (config2.abortEarly) {
671
+ dataset.typed = false;
672
+ break;
673
+ }
674
+ }
675
+ if (!itemDataset.typed) dataset.typed = false;
676
+ dataset.value.push(itemDataset.value);
677
+ }
678
+ } else _addIssue(this, "type", dataset, config2);
679
+ return dataset;
680
+ }
681
+ };
682
+ }
683
+ /* @__NO_SIDE_EFFECTS__ */
684
+ function boolean(message) {
685
+ return {
686
+ kind: "schema",
687
+ type: "boolean",
688
+ reference: boolean,
689
+ expects: "boolean",
690
+ async: false,
691
+ message,
692
+ get "~standard"() {
693
+ return /* @__PURE__ */ _getStandardProps(this);
694
+ },
695
+ "~run"(dataset, config2) {
696
+ if (typeof dataset.value === "boolean") dataset.typed = true;
697
+ else _addIssue(this, "type", dataset, config2);
698
+ return dataset;
699
+ }
700
+ };
701
+ }
702
+ /* @__NO_SIDE_EFFECTS__ */
703
+ function custom(check2, message) {
704
+ return {
705
+ kind: "schema",
706
+ type: "custom",
707
+ reference: custom,
708
+ expects: "unknown",
709
+ async: false,
710
+ check: check2,
711
+ message,
712
+ get "~standard"() {
713
+ return /* @__PURE__ */ _getStandardProps(this);
714
+ },
715
+ "~run"(dataset, config2) {
716
+ if (this.check(dataset.value)) dataset.typed = true;
717
+ else _addIssue(this, "type", dataset, config2);
718
+ return dataset;
719
+ }
720
+ };
721
+ }
722
+ /* @__NO_SIDE_EFFECTS__ */
723
+ function enum_(enum__, message) {
724
+ const options = [];
725
+ for (const key in enum__) if (`${+key}` !== key || typeof enum__[key] !== "string" || !Object.is(enum__[enum__[key]], +key)) options.push(enum__[key]);
726
+ return {
727
+ kind: "schema",
728
+ type: "enum",
729
+ reference: enum_,
730
+ expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
731
+ async: false,
732
+ enum: enum__,
733
+ options,
734
+ message,
735
+ get "~standard"() {
736
+ return /* @__PURE__ */ _getStandardProps(this);
737
+ },
738
+ "~run"(dataset, config2) {
739
+ if (this.options.includes(dataset.value)) dataset.typed = true;
740
+ else _addIssue(this, "type", dataset, config2);
741
+ return dataset;
742
+ }
743
+ };
744
+ }
745
+ /* @__NO_SIDE_EFFECTS__ */
746
+ function function_(message) {
747
+ return {
748
+ kind: "schema",
749
+ type: "function",
750
+ reference: function_,
751
+ expects: "Function",
752
+ async: false,
753
+ message,
754
+ get "~standard"() {
755
+ return /* @__PURE__ */ _getStandardProps(this);
756
+ },
757
+ "~run"(dataset, config2) {
758
+ if (typeof dataset.value === "function") dataset.typed = true;
759
+ else _addIssue(this, "type", dataset, config2);
760
+ return dataset;
761
+ }
762
+ };
763
+ }
764
+ /* @__NO_SIDE_EFFECTS__ */
765
+ function instance(class_, message) {
766
+ return {
767
+ kind: "schema",
768
+ type: "instance",
769
+ reference: instance,
770
+ expects: class_.name,
771
+ async: false,
772
+ class: class_,
773
+ message,
774
+ get "~standard"() {
775
+ return /* @__PURE__ */ _getStandardProps(this);
776
+ },
777
+ "~run"(dataset, config2) {
778
+ if (dataset.value instanceof this.class) dataset.typed = true;
779
+ else _addIssue(this, "type", dataset, config2);
780
+ return dataset;
781
+ }
782
+ };
783
+ }
784
+ /* @__NO_SIDE_EFFECTS__ */
785
+ function literal(literal_, message) {
786
+ return {
787
+ kind: "schema",
788
+ type: "literal",
789
+ reference: literal,
790
+ expects: /* @__PURE__ */ _stringify(literal_),
791
+ async: false,
792
+ literal: literal_,
793
+ message,
794
+ get "~standard"() {
795
+ return /* @__PURE__ */ _getStandardProps(this);
796
+ },
797
+ "~run"(dataset, config2) {
798
+ if (dataset.value === this.literal) dataset.typed = true;
799
+ else _addIssue(this, "type", dataset, config2);
800
+ return dataset;
801
+ }
802
+ };
803
+ }
804
+ /* @__NO_SIDE_EFFECTS__ */
805
+ function looseObject(entries, message) {
806
+ return {
807
+ kind: "schema",
808
+ type: "loose_object",
809
+ reference: looseObject,
810
+ expects: "Object",
811
+ async: false,
812
+ entries,
813
+ message,
814
+ get "~standard"() {
815
+ return /* @__PURE__ */ _getStandardProps(this);
816
+ },
817
+ "~run"(dataset, config2) {
818
+ const input = dataset.value;
819
+ if (input && typeof input === "object") {
820
+ dataset.typed = true;
821
+ dataset.value = {};
822
+ for (const key in this.entries) {
823
+ const valueSchema = this.entries[key];
824
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
825
+ const value2 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
826
+ const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
827
+ if (valueDataset.issues) {
828
+ const pathItem = {
829
+ type: "object",
830
+ origin: "value",
831
+ input,
832
+ key,
833
+ value: value2
834
+ };
835
+ for (const issue of valueDataset.issues) {
836
+ if (issue.path) issue.path.unshift(pathItem);
837
+ else issue.path = [pathItem];
838
+ dataset.issues?.push(issue);
839
+ }
840
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
841
+ if (config2.abortEarly) {
842
+ dataset.typed = false;
843
+ break;
844
+ }
845
+ }
846
+ if (!valueDataset.typed) dataset.typed = false;
847
+ dataset.value[key] = valueDataset.value;
848
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
849
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
850
+ _addIssue(this, "key", dataset, config2, {
851
+ input: void 0,
852
+ expected: `"${key}"`,
853
+ path: [{
854
+ type: "object",
855
+ origin: "key",
856
+ input,
857
+ key,
858
+ value: input[key]
859
+ }]
860
+ });
861
+ if (config2.abortEarly) break;
862
+ }
863
+ }
864
+ if (!dataset.issues || !config2.abortEarly) {
865
+ for (const key in input) if (/* @__PURE__ */ _isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
866
+ }
867
+ } else _addIssue(this, "type", dataset, config2);
868
+ return dataset;
869
+ }
870
+ };
871
+ }
872
+ /* @__NO_SIDE_EFFECTS__ */
873
+ function never(message) {
874
+ return {
875
+ kind: "schema",
876
+ type: "never",
877
+ reference: never,
878
+ expects: "never",
879
+ async: false,
880
+ message,
881
+ get "~standard"() {
882
+ return /* @__PURE__ */ _getStandardProps(this);
883
+ },
884
+ "~run"(dataset, config2) {
885
+ _addIssue(this, "type", dataset, config2);
886
+ return dataset;
887
+ }
888
+ };
889
+ }
890
+ /* @__NO_SIDE_EFFECTS__ */
891
+ function nullish(wrapped, default_) {
892
+ return {
893
+ kind: "schema",
894
+ type: "nullish",
895
+ reference: nullish,
896
+ expects: `(${wrapped.expects} | null | undefined)`,
897
+ async: false,
898
+ wrapped,
899
+ default: default_,
900
+ get "~standard"() {
901
+ return /* @__PURE__ */ _getStandardProps(this);
902
+ },
903
+ "~run"(dataset, config2) {
904
+ if (dataset.value === null || dataset.value === void 0) {
905
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
906
+ if (dataset.value === null || dataset.value === void 0) {
907
+ dataset.typed = true;
908
+ return dataset;
909
+ }
910
+ }
911
+ return this.wrapped["~run"](dataset, config2);
912
+ }
913
+ };
914
+ }
915
+ /* @__NO_SIDE_EFFECTS__ */
916
+ function number(message) {
917
+ return {
918
+ kind: "schema",
919
+ type: "number",
920
+ reference: number,
921
+ expects: "number",
922
+ async: false,
923
+ message,
924
+ get "~standard"() {
925
+ return /* @__PURE__ */ _getStandardProps(this);
926
+ },
927
+ "~run"(dataset, config2) {
928
+ if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
929
+ else _addIssue(this, "type", dataset, config2);
930
+ return dataset;
931
+ }
932
+ };
933
+ }
934
+ /* @__NO_SIDE_EFFECTS__ */
935
+ function object(entries, message) {
936
+ return {
937
+ kind: "schema",
938
+ type: "object",
939
+ reference: object,
940
+ expects: "Object",
941
+ async: false,
942
+ entries,
943
+ message,
944
+ get "~standard"() {
945
+ return /* @__PURE__ */ _getStandardProps(this);
946
+ },
947
+ "~run"(dataset, config2) {
948
+ const input = dataset.value;
949
+ if (input && typeof input === "object") {
950
+ dataset.typed = true;
951
+ dataset.value = {};
952
+ for (const key in this.entries) {
953
+ const valueSchema = this.entries[key];
954
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
955
+ const value2 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
956
+ const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
957
+ if (valueDataset.issues) {
958
+ const pathItem = {
959
+ type: "object",
960
+ origin: "value",
961
+ input,
962
+ key,
963
+ value: value2
964
+ };
965
+ for (const issue of valueDataset.issues) {
966
+ if (issue.path) issue.path.unshift(pathItem);
967
+ else issue.path = [pathItem];
968
+ dataset.issues?.push(issue);
969
+ }
970
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
971
+ if (config2.abortEarly) {
972
+ dataset.typed = false;
973
+ break;
974
+ }
975
+ }
976
+ if (!valueDataset.typed) dataset.typed = false;
977
+ dataset.value[key] = valueDataset.value;
978
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
979
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
980
+ _addIssue(this, "key", dataset, config2, {
981
+ input: void 0,
982
+ expected: `"${key}"`,
983
+ path: [{
984
+ type: "object",
985
+ origin: "key",
986
+ input,
987
+ key,
988
+ value: input[key]
989
+ }]
990
+ });
991
+ if (config2.abortEarly) break;
992
+ }
993
+ }
994
+ } else _addIssue(this, "type", dataset, config2);
995
+ return dataset;
996
+ }
997
+ };
998
+ }
999
+ /* @__NO_SIDE_EFFECTS__ */
1000
+ function optional(wrapped, default_) {
1001
+ return {
1002
+ kind: "schema",
1003
+ type: "optional",
1004
+ reference: optional,
1005
+ expects: `(${wrapped.expects} | undefined)`,
1006
+ async: false,
1007
+ wrapped,
1008
+ default: default_,
1009
+ get "~standard"() {
1010
+ return /* @__PURE__ */ _getStandardProps(this);
1011
+ },
1012
+ "~run"(dataset, config2) {
1013
+ if (dataset.value === void 0) {
1014
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
1015
+ if (dataset.value === void 0) {
1016
+ dataset.typed = true;
1017
+ return dataset;
1018
+ }
1019
+ }
1020
+ return this.wrapped["~run"](dataset, config2);
1021
+ }
1022
+ };
1023
+ }
1024
+ /* @__NO_SIDE_EFFECTS__ */
1025
+ function picklist(options, message) {
1026
+ return {
1027
+ kind: "schema",
1028
+ type: "picklist",
1029
+ reference: picklist,
1030
+ expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
1031
+ async: false,
1032
+ options,
1033
+ message,
1034
+ get "~standard"() {
1035
+ return /* @__PURE__ */ _getStandardProps(this);
1036
+ },
1037
+ "~run"(dataset, config2) {
1038
+ if (this.options.includes(dataset.value)) dataset.typed = true;
1039
+ else _addIssue(this, "type", dataset, config2);
1040
+ return dataset;
1041
+ }
1042
+ };
1043
+ }
1044
+ /* @__NO_SIDE_EFFECTS__ */
1045
+ function promise(message) {
1046
+ return {
1047
+ kind: "schema",
1048
+ type: "promise",
1049
+ reference: promise,
1050
+ expects: "Promise",
1051
+ async: false,
1052
+ message,
1053
+ get "~standard"() {
1054
+ return /* @__PURE__ */ _getStandardProps(this);
1055
+ },
1056
+ "~run"(dataset, config2) {
1057
+ if (dataset.value instanceof Promise) dataset.typed = true;
1058
+ else _addIssue(this, "type", dataset, config2);
1059
+ return dataset;
1060
+ }
1061
+ };
1062
+ }
1063
+ /* @__NO_SIDE_EFFECTS__ */
1064
+ function record(key, value2, message) {
1065
+ return {
1066
+ kind: "schema",
1067
+ type: "record",
1068
+ reference: record,
1069
+ expects: "Object",
1070
+ async: false,
1071
+ key,
1072
+ value: value2,
1073
+ message,
1074
+ get "~standard"() {
1075
+ return /* @__PURE__ */ _getStandardProps(this);
1076
+ },
1077
+ "~run"(dataset, config2) {
1078
+ const input = dataset.value;
1079
+ if (input && typeof input === "object") {
1080
+ dataset.typed = true;
1081
+ dataset.value = {};
1082
+ for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
1083
+ const entryValue = input[entryKey];
1084
+ const keyDataset = this.key["~run"]({ value: entryKey }, config2);
1085
+ if (keyDataset.issues) {
1086
+ const pathItem = {
1087
+ type: "object",
1088
+ origin: "key",
1089
+ input,
1090
+ key: entryKey,
1091
+ value: entryValue
1092
+ };
1093
+ for (const issue of keyDataset.issues) {
1094
+ issue.path = [pathItem];
1095
+ dataset.issues?.push(issue);
1096
+ }
1097
+ if (!dataset.issues) dataset.issues = keyDataset.issues;
1098
+ if (config2.abortEarly) {
1099
+ dataset.typed = false;
1100
+ break;
1101
+ }
1102
+ }
1103
+ const valueDataset = this.value["~run"]({ value: entryValue }, config2);
1104
+ if (valueDataset.issues) {
1105
+ const pathItem = {
1106
+ type: "object",
1107
+ origin: "value",
1108
+ input,
1109
+ key: entryKey,
1110
+ value: entryValue
1111
+ };
1112
+ for (const issue of valueDataset.issues) {
1113
+ if (issue.path) issue.path.unshift(pathItem);
1114
+ else issue.path = [pathItem];
1115
+ dataset.issues?.push(issue);
1116
+ }
1117
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1118
+ if (config2.abortEarly) {
1119
+ dataset.typed = false;
1120
+ break;
1121
+ }
1122
+ }
1123
+ if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
1124
+ if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
1125
+ }
1126
+ } else _addIssue(this, "type", dataset, config2);
1127
+ return dataset;
1128
+ }
1129
+ };
1130
+ }
1131
+ /* @__NO_SIDE_EFFECTS__ */
1132
+ function strictObject(entries, message) {
1133
+ return {
1134
+ kind: "schema",
1135
+ type: "strict_object",
1136
+ reference: strictObject,
1137
+ expects: "Object",
1138
+ async: false,
1139
+ entries,
1140
+ message,
1141
+ get "~standard"() {
1142
+ return /* @__PURE__ */ _getStandardProps(this);
1143
+ },
1144
+ "~run"(dataset, config2) {
1145
+ const input = dataset.value;
1146
+ if (input && typeof input === "object") {
1147
+ dataset.typed = true;
1148
+ dataset.value = {};
1149
+ for (const key in this.entries) {
1150
+ const valueSchema = this.entries[key];
1151
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
1152
+ const value2 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
1153
+ const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
1154
+ if (valueDataset.issues) {
1155
+ const pathItem = {
1156
+ type: "object",
1157
+ origin: "value",
1158
+ input,
1159
+ key,
1160
+ value: value2
1161
+ };
1162
+ for (const issue of valueDataset.issues) {
1163
+ if (issue.path) issue.path.unshift(pathItem);
1164
+ else issue.path = [pathItem];
1165
+ dataset.issues?.push(issue);
1166
+ }
1167
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1168
+ if (config2.abortEarly) {
1169
+ dataset.typed = false;
1170
+ break;
1171
+ }
1172
+ }
1173
+ if (!valueDataset.typed) dataset.typed = false;
1174
+ dataset.value[key] = valueDataset.value;
1175
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
1176
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
1177
+ _addIssue(this, "key", dataset, config2, {
1178
+ input: void 0,
1179
+ expected: `"${key}"`,
1180
+ path: [{
1181
+ type: "object",
1182
+ origin: "key",
1183
+ input,
1184
+ key,
1185
+ value: input[key]
1186
+ }]
1187
+ });
1188
+ if (config2.abortEarly) break;
1189
+ }
1190
+ }
1191
+ if (!dataset.issues || !config2.abortEarly) {
1192
+ for (const key in input) if (!(key in this.entries)) {
1193
+ _addIssue(this, "key", dataset, config2, {
1194
+ input: key,
1195
+ expected: "never",
1196
+ path: [{
1197
+ type: "object",
1198
+ origin: "key",
1199
+ input,
1200
+ key,
1201
+ value: input[key]
1202
+ }]
1203
+ });
1204
+ break;
1205
+ }
1206
+ }
1207
+ } else _addIssue(this, "type", dataset, config2);
1208
+ return dataset;
1209
+ }
1210
+ };
1211
+ }
1212
+ /* @__NO_SIDE_EFFECTS__ */
1213
+ function string(message) {
1214
+ return {
1215
+ kind: "schema",
1216
+ type: "string",
1217
+ reference: string,
1218
+ expects: "string",
1219
+ async: false,
1220
+ message,
1221
+ get "~standard"() {
1222
+ return /* @__PURE__ */ _getStandardProps(this);
1223
+ },
1224
+ "~run"(dataset, config2) {
1225
+ if (typeof dataset.value === "string") dataset.typed = true;
1226
+ else _addIssue(this, "type", dataset, config2);
1227
+ return dataset;
1228
+ }
1229
+ };
1230
+ }
1231
+ /* @__NO_SIDE_EFFECTS__ */
1232
+ function tuple(items, message) {
1233
+ return {
1234
+ kind: "schema",
1235
+ type: "tuple",
1236
+ reference: tuple,
1237
+ expects: "Array",
1238
+ async: false,
1239
+ items,
1240
+ message,
1241
+ get "~standard"() {
1242
+ return /* @__PURE__ */ _getStandardProps(this);
1243
+ },
1244
+ "~run"(dataset, config2) {
1245
+ const input = dataset.value;
1246
+ if (Array.isArray(input)) {
1247
+ dataset.typed = true;
1248
+ dataset.value = [];
1249
+ for (let key = 0; key < this.items.length; key++) {
1250
+ const value2 = input[key];
1251
+ const itemDataset = this.items[key]["~run"]({ value: value2 }, config2);
1252
+ if (itemDataset.issues) {
1253
+ const pathItem = {
1254
+ type: "array",
1255
+ origin: "value",
1256
+ input,
1257
+ key,
1258
+ value: value2
1259
+ };
1260
+ for (const issue of itemDataset.issues) {
1261
+ if (issue.path) issue.path.unshift(pathItem);
1262
+ else issue.path = [pathItem];
1263
+ dataset.issues?.push(issue);
1264
+ }
1265
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
1266
+ if (config2.abortEarly) {
1267
+ dataset.typed = false;
1268
+ break;
1269
+ }
1270
+ }
1271
+ if (!itemDataset.typed) dataset.typed = false;
1272
+ dataset.value.push(itemDataset.value);
1273
+ }
1274
+ } else _addIssue(this, "type", dataset, config2);
1275
+ return dataset;
1276
+ }
1277
+ };
1278
+ }
1279
+ /* @__NO_SIDE_EFFECTS__ */
1280
+ function _subIssues(datasets) {
1281
+ let issues;
1282
+ if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
1283
+ else issues = dataset.issues;
1284
+ return issues;
1285
+ }
1286
+ /* @__NO_SIDE_EFFECTS__ */
1287
+ function union(options, message) {
1288
+ return {
1289
+ kind: "schema",
1290
+ type: "union",
1291
+ reference: union,
1292
+ expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
1293
+ async: false,
1294
+ options,
1295
+ message,
1296
+ get "~standard"() {
1297
+ return /* @__PURE__ */ _getStandardProps(this);
1298
+ },
1299
+ "~run"(dataset, config2) {
1300
+ let validDataset;
1301
+ let typedDatasets;
1302
+ let untypedDatasets;
1303
+ for (const schema of this.options) {
1304
+ const optionDataset = schema["~run"]({ value: dataset.value }, config2);
1305
+ if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
1306
+ else typedDatasets = [optionDataset];
1307
+ else {
1308
+ validDataset = optionDataset;
1309
+ break;
1310
+ }
1311
+ else if (untypedDatasets) untypedDatasets.push(optionDataset);
1312
+ else untypedDatasets = [optionDataset];
1313
+ }
1314
+ if (validDataset) return validDataset;
1315
+ if (typedDatasets) {
1316
+ if (typedDatasets.length === 1) return typedDatasets[0];
1317
+ _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
1318
+ dataset.typed = true;
1319
+ } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
1320
+ else _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
1321
+ return dataset;
1322
+ }
1323
+ };
1324
+ }
1325
+ /* @__NO_SIDE_EFFECTS__ */
1326
+ function unionAsync(options, message) {
1327
+ return {
1328
+ kind: "schema",
1329
+ type: "union",
1330
+ reference: unionAsync,
1331
+ expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
1332
+ async: true,
1333
+ options,
1334
+ message,
1335
+ get "~standard"() {
1336
+ return /* @__PURE__ */ _getStandardProps(this);
1337
+ },
1338
+ async "~run"(dataset, config2) {
1339
+ let validDataset;
1340
+ let typedDatasets;
1341
+ let untypedDatasets;
1342
+ for (const schema of this.options) {
1343
+ const optionDataset = await schema["~run"]({ value: dataset.value }, config2);
1344
+ if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
1345
+ else typedDatasets = [optionDataset];
1346
+ else {
1347
+ validDataset = optionDataset;
1348
+ break;
1349
+ }
1350
+ else if (untypedDatasets) untypedDatasets.push(optionDataset);
1351
+ else untypedDatasets = [optionDataset];
1352
+ }
1353
+ if (validDataset) return validDataset;
1354
+ if (typedDatasets) {
1355
+ if (typedDatasets.length === 1) return typedDatasets[0];
1356
+ _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
1357
+ dataset.typed = true;
1358
+ } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
1359
+ else _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
1360
+ return dataset;
1361
+ }
1362
+ };
1363
+ }
1364
+ /* @__NO_SIDE_EFFECTS__ */
1365
+ function keyof(schema, message) {
1366
+ return /* @__PURE__ */ picklist(Object.keys(schema.entries), message);
1367
+ }
1368
+ /* @__NO_SIDE_EFFECTS__ */
1369
+ function omit(schema, keys) {
1370
+ const entries = { ...schema.entries };
1371
+ for (const key of keys) delete entries[key];
1372
+ return {
1373
+ ...schema,
1374
+ entries,
1375
+ get "~standard"() {
1376
+ return /* @__PURE__ */ _getStandardProps(this);
1377
+ }
1378
+ };
1379
+ }
1380
+ /* @__NO_SIDE_EFFECTS__ */
1381
+ function pipe(...pipe2) {
1382
+ return {
1383
+ ...pipe2[0],
1384
+ pipe: pipe2,
1385
+ get "~standard"() {
1386
+ return /* @__PURE__ */ _getStandardProps(this);
1387
+ },
1388
+ "~run"(dataset, config2) {
1389
+ for (const item of pipe2) if (item.kind !== "metadata") {
1390
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
1391
+ dataset.typed = false;
1392
+ break;
1393
+ }
1394
+ if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) dataset = item["~run"](dataset, config2);
1395
+ }
1396
+ return dataset;
1397
+ }
1398
+ };
1399
+ }
1400
+ /* @__NO_SIDE_EFFECTS__ */
1401
+ function pipeAsync(...pipe2) {
1402
+ return {
1403
+ ...pipe2[0],
1404
+ pipe: pipe2,
1405
+ async: true,
1406
+ get "~standard"() {
1407
+ return /* @__PURE__ */ _getStandardProps(this);
1408
+ },
1409
+ async "~run"(dataset, config2) {
1410
+ for (const item of pipe2) if (item.kind !== "metadata") {
1411
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
1412
+ dataset.typed = false;
1413
+ break;
1414
+ }
1415
+ if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) dataset = await item["~run"](dataset, config2);
1416
+ }
1417
+ return dataset;
1418
+ }
1419
+ };
1420
+ }
1421
+ /* @__NO_SIDE_EFFECTS__ */
1422
+ function safeParse(schema, input, config2) {
1423
+ const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
1424
+ return {
1425
+ typed: dataset.typed,
1426
+ success: !dataset.issues,
1427
+ output: dataset.value,
1428
+ issues: dataset.issues
1429
+ };
1430
+ }
1431
+ var store, store2, store3, store4, ValiError;
1432
+ var init_dist$2 = __esm({ "../../node_modules/.pnpm/valibot@1.0.0_typescript@5.8.3/node_modules/valibot/dist/index.js"() {
1433
+ ValiError = class extends Error {
1434
+ /**
1435
+ * Creates a Valibot error with useful information.
1436
+ *
1437
+ * @param issues The error issues.
1438
+ */
1439
+ constructor(issues) {
1440
+ super(issues[0].message);
1441
+ this.name = "ValiError";
1442
+ this.issues = issues;
1443
+ }
1444
+ };
1445
+ } });
1446
+
1447
+ //#endregion
1448
+ //#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
1449
+ function handleError(message, config) {
1450
+ switch (config?.errorMode) {
1451
+ case "ignore": break;
1452
+ case "warn": {
1453
+ console.warn(message);
1454
+ break;
1455
+ }
1456
+ default: throw new Error(message);
1457
+ }
1458
+ }
1459
+ function convertAction(jsonSchema, valibotAction, config) {
1460
+ switch (valibotAction.type) {
1461
+ case "base64": {
1462
+ jsonSchema.contentEncoding = "base64";
1463
+ break;
1464
+ }
1465
+ case "bic":
1466
+ case "cuid2":
1467
+ case "decimal":
1468
+ case "digits":
1469
+ case "emoji":
1470
+ case "hexadecimal":
1471
+ case "hex_color":
1472
+ case "nanoid":
1473
+ case "octal":
1474
+ case "ulid": {
1475
+ jsonSchema.pattern = valibotAction.requirement.source;
1476
+ break;
1477
+ }
1478
+ case "description": {
1479
+ jsonSchema.description = valibotAction.description;
1480
+ break;
1481
+ }
1482
+ case "email": {
1483
+ jsonSchema.format = "email";
1484
+ break;
1485
+ }
1486
+ case "empty": {
1487
+ if (jsonSchema.type === "array") jsonSchema.maxItems = 0;
1488
+ else {
1489
+ if (jsonSchema.type !== "string") handleError(`The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`, config);
1490
+ jsonSchema.maxLength = 0;
1491
+ }
1492
+ break;
1493
+ }
1494
+ case "integer": {
1495
+ jsonSchema.type = "integer";
1496
+ break;
1497
+ }
1498
+ case "ipv4": {
1499
+ jsonSchema.format = "ipv4";
1500
+ break;
1501
+ }
1502
+ case "ipv6": {
1503
+ jsonSchema.format = "ipv6";
1504
+ break;
1505
+ }
1506
+ case "iso_date": {
1507
+ jsonSchema.format = "date";
1508
+ break;
1509
+ }
1510
+ case "iso_date_time":
1511
+ case "iso_timestamp": {
1512
+ jsonSchema.format = "date-time";
1513
+ break;
1514
+ }
1515
+ case "iso_time": {
1516
+ jsonSchema.format = "time";
1517
+ break;
1518
+ }
1519
+ case "length": {
1520
+ if (jsonSchema.type === "array") {
1521
+ jsonSchema.minItems = valibotAction.requirement;
1522
+ jsonSchema.maxItems = valibotAction.requirement;
1523
+ } else {
1524
+ if (jsonSchema.type !== "string") handleError(`The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`, config);
1525
+ jsonSchema.minLength = valibotAction.requirement;
1526
+ jsonSchema.maxLength = valibotAction.requirement;
1527
+ }
1528
+ break;
1529
+ }
1530
+ case "max_length": {
1531
+ if (jsonSchema.type === "array") jsonSchema.maxItems = valibotAction.requirement;
1532
+ else {
1533
+ if (jsonSchema.type !== "string") handleError(`The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`, config);
1534
+ jsonSchema.maxLength = valibotAction.requirement;
1535
+ }
1536
+ break;
1537
+ }
1538
+ case "max_value": {
1539
+ if (jsonSchema.type !== "number") handleError(`The "max_value" action is not supported on type "${jsonSchema.type}".`, config);
1540
+ jsonSchema.maximum = valibotAction.requirement;
1541
+ break;
1542
+ }
1543
+ case "min_length": {
1544
+ if (jsonSchema.type === "array") jsonSchema.minItems = valibotAction.requirement;
1545
+ else {
1546
+ if (jsonSchema.type !== "string") handleError(`The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`, config);
1547
+ jsonSchema.minLength = valibotAction.requirement;
1548
+ }
1549
+ break;
1550
+ }
1551
+ case "min_value": {
1552
+ if (jsonSchema.type !== "number") handleError(`The "min_value" action is not supported on type "${jsonSchema.type}".`, config);
1553
+ jsonSchema.minimum = valibotAction.requirement;
1554
+ break;
1555
+ }
1556
+ case "multiple_of": {
1557
+ jsonSchema.multipleOf = valibotAction.requirement;
1558
+ break;
1559
+ }
1560
+ case "non_empty": {
1561
+ if (jsonSchema.type === "array") jsonSchema.minItems = 1;
1562
+ else {
1563
+ if (jsonSchema.type !== "string") handleError(`The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`, config);
1564
+ jsonSchema.minLength = 1;
1565
+ }
1566
+ break;
1567
+ }
1568
+ case "regex": {
1569
+ if (valibotAction.requirement.flags) handleError("RegExp flags are not supported by JSON Schema.", config);
1570
+ jsonSchema.pattern = valibotAction.requirement.source;
1571
+ break;
1572
+ }
1573
+ case "title": {
1574
+ jsonSchema.title = valibotAction.title;
1575
+ break;
1576
+ }
1577
+ case "url": {
1578
+ jsonSchema.format = "uri";
1579
+ break;
1580
+ }
1581
+ case "uuid": {
1582
+ jsonSchema.format = "uuid";
1583
+ break;
1584
+ }
1585
+ case "value": {
1586
+ jsonSchema.const = valibotAction.requirement;
1587
+ break;
1588
+ }
1589
+ default: handleError(
1590
+ // @ts-expect-error
1591
+ `The "${valibotAction.type}" action cannot be converted to JSON Schema.`,
1592
+ config
1593
+ );
1594
+ }
1595
+ return jsonSchema;
1596
+ }
1597
+ function convertSchema(jsonSchema, valibotSchema, config, context) {
1598
+ const referenceId = context.referenceMap.get(valibotSchema);
1599
+ if (referenceId && referenceId in context.definitions) {
1600
+ jsonSchema.$ref = `#/$defs/${referenceId}`;
1601
+ return jsonSchema;
1602
+ }
1603
+ if ("pipe" in valibotSchema) {
1604
+ for (let index = 0; index < valibotSchema.pipe.length; index++) {
1605
+ const valibotPipeItem = valibotSchema.pipe[index];
1606
+ if (valibotPipeItem.kind === "schema") {
1607
+ if (index > 0) handleError("A \"pipe\" with multiple schemas cannot be converted to JSON Schema.", config);
1608
+ const tempJsonSchema = convertSchema({}, valibotPipeItem, config, context);
1609
+ if (tempJsonSchema.$ref) {
1610
+ const referenceId2 = tempJsonSchema.$ref.split("/")[2];
1611
+ Object.assign(jsonSchema, context.definitions[referenceId2]);
1612
+ } else Object.assign(jsonSchema, tempJsonSchema);
1613
+ } else jsonSchema = convertAction(jsonSchema, valibotPipeItem, config);
1614
+ }
1615
+ return jsonSchema;
1616
+ }
1617
+ switch (valibotSchema.type) {
1618
+ case "boolean": {
1619
+ jsonSchema.type = "boolean";
1620
+ break;
1621
+ }
1622
+ case "null": {
1623
+ jsonSchema.type = "null";
1624
+ break;
1625
+ }
1626
+ case "number": {
1627
+ jsonSchema.type = "number";
1628
+ break;
1629
+ }
1630
+ case "string": {
1631
+ jsonSchema.type = "string";
1632
+ break;
1633
+ }
1634
+ case "array": {
1635
+ jsonSchema.type = "array";
1636
+ jsonSchema.items = convertSchema({}, valibotSchema.item, config, context);
1637
+ break;
1638
+ }
1639
+ case "tuple":
1640
+ case "tuple_with_rest":
1641
+ case "loose_tuple":
1642
+ case "strict_tuple": {
1643
+ jsonSchema.type = "array";
1644
+ jsonSchema.items = [];
1645
+ for (const item of valibotSchema.items) jsonSchema.items.push(convertSchema({}, item, config, context));
1646
+ if (valibotSchema.type === "tuple_with_rest") jsonSchema.additionalItems = convertSchema({}, valibotSchema.rest, config, context);
1647
+ else jsonSchema.additionalItems = valibotSchema.type === "loose_tuple";
1648
+ break;
1649
+ }
1650
+ case "object":
1651
+ case "object_with_rest":
1652
+ case "loose_object":
1653
+ case "strict_object": {
1654
+ jsonSchema.type = "object";
1655
+ jsonSchema.properties = {};
1656
+ jsonSchema.required = [];
1657
+ for (const key in valibotSchema.entries) {
1658
+ const entry = valibotSchema.entries[key];
1659
+ jsonSchema.properties[key] = convertSchema({}, entry, config, context);
1660
+ if (entry.type !== "nullish" && entry.type !== "optional") jsonSchema.required.push(key);
1661
+ }
1662
+ if (valibotSchema.type === "object_with_rest") jsonSchema.additionalProperties = convertSchema({}, valibotSchema.rest, config, context);
1663
+ else if (valibotSchema.type === "strict_object") jsonSchema.additionalProperties = false;
1664
+ break;
1665
+ }
1666
+ case "record": {
1667
+ 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);
1668
+ 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);
1669
+ jsonSchema.type = "object";
1670
+ jsonSchema.additionalProperties = convertSchema({}, valibotSchema.value, config, context);
1671
+ break;
1672
+ }
1673
+ case "any":
1674
+ case "unknown": break;
1675
+ case "nullable":
1676
+ case "nullish": {
1677
+ jsonSchema.anyOf = [convertSchema({}, valibotSchema.wrapped, config, context), { type: "null" }];
1678
+ if (valibotSchema.default !== void 0) jsonSchema.default = getDefault(valibotSchema);
1679
+ break;
1680
+ }
1681
+ case "exact_optional":
1682
+ case "optional":
1683
+ case "undefinedable": {
1684
+ jsonSchema = convertSchema(jsonSchema, valibotSchema.wrapped, config, context);
1685
+ if (valibotSchema.default !== void 0) jsonSchema.default = getDefault(valibotSchema);
1686
+ break;
1687
+ }
1688
+ case "literal": {
1689
+ 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);
1690
+ jsonSchema.const = valibotSchema.literal;
1691
+ break;
1692
+ }
1693
+ case "enum": {
1694
+ jsonSchema.enum = valibotSchema.options;
1695
+ break;
1696
+ }
1697
+ case "picklist": {
1698
+ if (valibotSchema.options.some((option) => typeof option !== "number" && typeof option !== "string")) handleError("An option of the \"picklist\" schema is not JSON compatible.", config);
1699
+ jsonSchema.enum = valibotSchema.options;
1700
+ break;
1701
+ }
1702
+ case "union":
1703
+ case "variant": {
1704
+ jsonSchema.anyOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
1705
+ break;
1706
+ }
1707
+ case "intersect": {
1708
+ jsonSchema.allOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
1709
+ break;
1710
+ }
1711
+ case "lazy": {
1712
+ let wrappedValibotSchema = context.getterMap.get(valibotSchema.getter);
1713
+ if (!wrappedValibotSchema) {
1714
+ wrappedValibotSchema = valibotSchema.getter(void 0);
1715
+ context.getterMap.set(valibotSchema.getter, wrappedValibotSchema);
1716
+ }
1717
+ let referenceId2 = context.referenceMap.get(wrappedValibotSchema);
1718
+ if (!referenceId2) {
1719
+ referenceId2 = `${refCount++}`;
1720
+ context.referenceMap.set(wrappedValibotSchema, referenceId2);
1721
+ context.definitions[referenceId2] = convertSchema({}, wrappedValibotSchema, config, context);
1722
+ }
1723
+ jsonSchema.$ref = `#/$defs/${referenceId2}`;
1724
+ break;
1725
+ }
1726
+ default: handleError(
1727
+ // @ts-expect-error
1728
+ `The "${valibotSchema.type}" schema cannot be converted to JSON Schema.`,
1729
+ config
1730
+ );
1731
+ }
1732
+ return jsonSchema;
1733
+ }
1734
+ function toJsonSchema(schema, config) {
1735
+ const context = {
1736
+ definitions: {},
1737
+ referenceMap: /* @__PURE__ */ new Map(),
1738
+ getterMap: /* @__PURE__ */ new Map()
1739
+ };
1740
+ if (config?.definitions) {
1741
+ for (const key in config.definitions) context.referenceMap.set(config.definitions[key], key);
1742
+ for (const key in config.definitions) context.definitions[key] = convertSchema(
1743
+ {},
1744
+ // @ts-expect-error
1745
+ config.definitions[key],
1746
+ config,
1747
+ context
1748
+ );
1749
+ }
1750
+ const jsonSchema = convertSchema(
1751
+ { $schema: "http://json-schema.org/draft-07/schema#" },
1752
+ // @ts-expect-error
1753
+ schema,
1754
+ config,
1755
+ context
1756
+ );
1757
+ if (context.referenceMap.size) jsonSchema.$defs = context.definitions;
1758
+ return jsonSchema;
1759
+ }
1760
+ var refCount;
1761
+ var init_dist$1 = __esm({ "../../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"() {
1762
+ init_dist$2();
1763
+ refCount = 0;
1764
+ } });
1765
+
457
1766
  //#endregion
458
1767
  //#region src/utils/validator.ts
459
1768
  function validateCliOptions(options) {
460
- let parsed = v.safeParse(CliOptionsSchema, options);
1769
+ let parsed = safeParse(CliOptionsSchema, options);
461
1770
  return [parsed.output, parsed.issues?.map((issue) => {
462
1771
  const option = issue.path?.map((pathItem) => pathItem.key).join(" ");
463
1772
  return `Invalid value for option ${option}: ${issue.message}`;
@@ -465,7 +1774,7 @@ function validateCliOptions(options) {
465
1774
  }
466
1775
  function validateOption(key, options) {
467
1776
  if (globalThis.process?.env?.ROLLDOWN_OPTIONS_VALIDATION === "loose") return;
468
- let parsed = v.safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
1777
+ let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
469
1778
  if (!parsed.success) {
470
1779
  const errors = parsed.issues.map((issue) => {
471
1780
  const issuePaths = issue.path.map((path$1) => path$1.key);
@@ -486,209 +1795,211 @@ function validateOption(key, options) {
486
1795
  }
487
1796
  }
488
1797
  function getInputCliKeys() {
489
- return v.keyof(InputCliOptionsSchema).options;
1798
+ return keyof(InputCliOptionsSchema).options;
490
1799
  }
491
1800
  function getOutputCliKeys() {
492
- return v.keyof(OutputCliOptionsSchema).options;
1801
+ return keyof(OutputCliOptionsSchema).options;
493
1802
  }
494
1803
  function getJsonSchema() {
495
1804
  return toJsonSchema(CliOptionsSchema);
496
1805
  }
497
1806
  var StringOrRegExpSchema, LogLevelSchema, LogLevelOptionSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, InputOptionSchema, ExternalSchema, ModuleTypesSchema, JsxOptionsSchema, HelperModeSchema, DecoratorOptionSchema, HelpersSchema, RewriteImportExtensionsSchema, TypescriptSchema, AssumptionsSchema, TransformOptionsSchema, WatchOptionsSchema, ChecksOptionsSchema, MinifyOptionsSchema, ResolveOptionsSchema, TreeshakingOptionsSchema, OnLogSchema, OnwarnSchema, HmrSchema, InputOptionsSchema, InputCliOverrideSchema, InputCliOptionsSchema, ESTarget, ModuleFormatSchema, AddonFunctionSchema, ChunkFileNamesSchema, AssetFileNamesSchema, SanitizeFileNameSchema, GlobalsFunctionSchema, AdvancedChunksSchema, OutputOptionsSchema, getAddonDescription, OutputCliOverrideSchema, OutputCliOptionsSchema, CliOptionsSchema, inputHelperMsgRecord, outputHelperMsgRecord;
498
1807
  var init_validator = __esm({ "src/utils/validator.ts"() {
499
- StringOrRegExpSchema = v.union([v.string(), v.instance(RegExp)]);
500
- LogLevelSchema = v.union([
501
- v.literal("debug"),
502
- v.literal("info"),
503
- v.literal("warn")
1808
+ init_dist$1();
1809
+ init_dist$2();
1810
+ StringOrRegExpSchema = union([string(), instance(RegExp)]);
1811
+ LogLevelSchema = union([
1812
+ literal("debug"),
1813
+ literal("info"),
1814
+ literal("warn")
504
1815
  ]);
505
- LogLevelOptionSchema = v.union([LogLevelSchema, v.literal("silent")]);
506
- LogLevelWithErrorSchema = v.union([LogLevelSchema, v.literal("error")]);
507
- RollupLogSchema = v.any();
508
- RollupLogWithStringSchema = v.union([RollupLogSchema, v.string()]);
509
- InputOptionSchema = v.union([
510
- v.string(),
511
- v.array(v.string()),
512
- v.record(v.string(), v.string())
1816
+ LogLevelOptionSchema = union([LogLevelSchema, literal("silent")]);
1817
+ LogLevelWithErrorSchema = union([LogLevelSchema, literal("error")]);
1818
+ RollupLogSchema = any();
1819
+ RollupLogWithStringSchema = union([RollupLogSchema, string()]);
1820
+ InputOptionSchema = union([
1821
+ string(),
1822
+ array(string()),
1823
+ record(string(), string())
513
1824
  ]);
514
- ExternalSchema = v.union([
1825
+ ExternalSchema = union([
515
1826
  StringOrRegExpSchema,
516
- v.array(StringOrRegExpSchema),
517
- v.pipe(v.function(), v.args(v.tuple([
518
- v.string(),
519
- v.optional(v.string()),
520
- v.boolean()
521
- ])), v.returns(v.nullish(v.boolean())))
1827
+ array(StringOrRegExpSchema),
1828
+ pipe(function_(), args(tuple([
1829
+ string(),
1830
+ optional(string()),
1831
+ boolean()
1832
+ ])), returns(nullish(boolean())))
522
1833
  ]);
523
- ModuleTypesSchema = v.record(v.string(), v.union([
524
- v.literal("base64"),
525
- v.literal("binary"),
526
- v.literal("css"),
527
- v.literal("dataurl"),
528
- v.literal("empty"),
529
- v.literal("js"),
530
- v.literal("json"),
531
- v.literal("jsx"),
532
- v.literal("text"),
533
- v.literal("ts"),
534
- v.literal("tsx")
1834
+ ModuleTypesSchema = record(string(), union([
1835
+ literal("base64"),
1836
+ literal("binary"),
1837
+ literal("css"),
1838
+ literal("dataurl"),
1839
+ literal("empty"),
1840
+ literal("js"),
1841
+ literal("json"),
1842
+ literal("jsx"),
1843
+ literal("text"),
1844
+ literal("ts"),
1845
+ literal("tsx")
535
1846
  ]));
536
- JsxOptionsSchema = v.strictObject({
537
- development: v.pipe(v.optional(v.boolean()), v.description("Development specific information")),
538
- factory: v.pipe(v.optional(v.string()), v.description("Jsx element transformation")),
539
- fragment: v.pipe(v.optional(v.string()), v.description("Jsx fragment transformation")),
540
- importSource: v.pipe(v.optional(v.string()), v.description("Import the factory of element and fragment if mode is classic")),
541
- jsxImportSource: v.pipe(v.optional(v.string()), v.description("Import the factory of element and fragment if mode is automatic")),
542
- mode: v.pipe(v.optional(v.union([
543
- v.literal("classic"),
544
- v.literal("automatic"),
545
- v.literal("preserve")
546
- ])), v.description("Jsx transformation mode")),
547
- refresh: v.pipe(v.optional(v.boolean()), v.description("React refresh transformation"))
1847
+ JsxOptionsSchema = strictObject({
1848
+ development: pipe(optional(boolean()), description("Development specific information")),
1849
+ factory: pipe(optional(string()), description("Jsx element transformation")),
1850
+ fragment: pipe(optional(string()), description("Jsx fragment transformation")),
1851
+ importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
1852
+ jsxImportSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is automatic")),
1853
+ mode: pipe(optional(union([
1854
+ literal("classic"),
1855
+ literal("automatic"),
1856
+ literal("preserve")
1857
+ ])), description("Jsx transformation mode")),
1858
+ refresh: pipe(optional(boolean()), description("React refresh transformation"))
548
1859
  });
549
- HelperModeSchema = v.union([v.literal("Runtime"), v.literal("External")]);
550
- DecoratorOptionSchema = v.object({
551
- legacy: v.optional(v.boolean()),
552
- emitDecoratorMetadata: v.optional(v.boolean())
1860
+ HelperModeSchema = union([literal("Runtime"), literal("External")]);
1861
+ DecoratorOptionSchema = object({
1862
+ legacy: optional(boolean()),
1863
+ emitDecoratorMetadata: optional(boolean())
553
1864
  });
554
- HelpersSchema = v.object({ mode: v.optional(HelperModeSchema) });
555
- RewriteImportExtensionsSchema = v.union([
556
- v.literal("rewrite"),
557
- v.literal("remove"),
558
- v.boolean()
1865
+ HelpersSchema = object({ mode: optional(HelperModeSchema) });
1866
+ RewriteImportExtensionsSchema = union([
1867
+ literal("rewrite"),
1868
+ literal("remove"),
1869
+ boolean()
559
1870
  ]);
560
- TypescriptSchema = v.object({
561
- jsxPragma: v.optional(v.string()),
562
- jsxPragmaFrag: v.optional(v.string()),
563
- onlyRemoveTypeImports: v.optional(v.boolean()),
564
- allowNamespaces: v.optional(v.boolean()),
565
- allowDeclareFields: v.optional(v.boolean()),
566
- declaration: v.optional(v.object({
567
- stripInternal: v.optional(v.boolean()),
568
- sourcemap: v.optional(v.boolean())
1871
+ TypescriptSchema = object({
1872
+ jsxPragma: optional(string()),
1873
+ jsxPragmaFrag: optional(string()),
1874
+ onlyRemoveTypeImports: optional(boolean()),
1875
+ allowNamespaces: optional(boolean()),
1876
+ allowDeclareFields: optional(boolean()),
1877
+ declaration: optional(object({
1878
+ stripInternal: optional(boolean()),
1879
+ sourcemap: optional(boolean())
569
1880
  })),
570
- rewriteImportExtensions: v.optional(RewriteImportExtensionsSchema)
1881
+ rewriteImportExtensions: optional(RewriteImportExtensionsSchema)
571
1882
  });
572
- AssumptionsSchema = v.object({
573
- ignoreFunctionLength: v.optional(v.boolean()),
574
- noDocumentAll: v.optional(v.boolean()),
575
- objectRestNoSymbols: v.optional(v.boolean()),
576
- pureGetters: v.optional(v.boolean()),
577
- setPublicClassFields: v.optional(v.boolean())
1883
+ AssumptionsSchema = object({
1884
+ ignoreFunctionLength: optional(boolean()),
1885
+ noDocumentAll: optional(boolean()),
1886
+ objectRestNoSymbols: optional(boolean()),
1887
+ pureGetters: optional(boolean()),
1888
+ setPublicClassFields: optional(boolean())
578
1889
  });
579
- TransformOptionsSchema = v.object({
580
- assumptions: v.optional(AssumptionsSchema),
581
- typescript: v.optional(TypescriptSchema),
582
- helpers: v.optional(HelpersSchema),
583
- decorators: v.optional(DecoratorOptionSchema)
1890
+ TransformOptionsSchema = object({
1891
+ assumptions: optional(AssumptionsSchema),
1892
+ typescript: optional(TypescriptSchema),
1893
+ helpers: optional(HelpersSchema),
1894
+ decorators: optional(DecoratorOptionSchema)
584
1895
  });
585
- WatchOptionsSchema = v.strictObject({
586
- chokidar: v.optional(v.never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
587
- exclude: v.optional(v.union([StringOrRegExpSchema, v.array(StringOrRegExpSchema)])),
588
- include: v.optional(v.union([StringOrRegExpSchema, v.array(StringOrRegExpSchema)])),
589
- notify: v.pipe(v.optional(v.strictObject({
590
- compareContents: v.optional(v.boolean()),
591
- pollInterval: v.optional(v.number())
592
- })), v.description("Notify options")),
593
- skipWrite: v.pipe(v.optional(v.boolean()), v.description("Skip the bundle.write() step")),
594
- buildDelay: v.pipe(v.optional(v.number()), v.description("Throttle watch rebuilds"))
1896
+ WatchOptionsSchema = strictObject({
1897
+ chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
1898
+ exclude: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
1899
+ include: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
1900
+ notify: pipe(optional(strictObject({
1901
+ compareContents: optional(boolean()),
1902
+ pollInterval: optional(number())
1903
+ })), description("Notify options")),
1904
+ skipWrite: pipe(optional(boolean()), description("Skip the bundle.write() step")),
1905
+ buildDelay: pipe(optional(number()), description("Throttle watch rebuilds"))
595
1906
  });
596
- ChecksOptionsSchema = v.strictObject({
597
- circularDependency: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting circular dependency")),
598
- eval: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting eval")),
599
- missingGlobalName: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting missing global name")),
600
- missingNameOptionForIifeExport: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting missing name option for iife export")),
601
- mixedExport: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting mixed export")),
602
- unresolvedEntry: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting unresolved entry")),
603
- unresolvedImport: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting unresolved import")),
604
- filenameConflict: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting filename conflict")),
605
- commonJsVariableInEsm: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting common js variable in esm")),
606
- importIsUndefined: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting import is undefined")),
607
- configurationFieldConflict: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting configuration field conflict"))
1907
+ ChecksOptionsSchema = strictObject({
1908
+ circularDependency: pipe(optional(boolean()), description("Whether to emit warning when detecting circular dependency")),
1909
+ eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
1910
+ missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
1911
+ missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
1912
+ mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
1913
+ unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
1914
+ unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
1915
+ filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
1916
+ commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
1917
+ importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
1918
+ configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
608
1919
  });
609
- MinifyOptionsSchema = v.strictObject({
610
- mangle: v.optional(v.boolean()),
611
- compress: v.optional(v.boolean()),
612
- removeWhitespace: v.optional(v.boolean())
1920
+ MinifyOptionsSchema = strictObject({
1921
+ mangle: optional(boolean()),
1922
+ compress: optional(boolean()),
1923
+ removeWhitespace: optional(boolean())
613
1924
  });
614
- ResolveOptionsSchema = v.strictObject({
615
- alias: v.optional(v.record(v.string(), v.union([v.string(), v.array(v.string())]))),
616
- aliasFields: v.optional(v.array(v.array(v.string()))),
617
- conditionNames: v.optional(v.array(v.string())),
618
- extensionAlias: v.optional(v.record(v.string(), v.array(v.string()))),
619
- exportsFields: v.optional(v.array(v.array(v.string()))),
620
- extensions: v.optional(v.array(v.string())),
621
- mainFields: v.optional(v.array(v.string())),
622
- mainFiles: v.optional(v.array(v.string())),
623
- modules: v.optional(v.array(v.string())),
624
- symlinks: v.optional(v.boolean()),
625
- tsconfigFilename: v.optional(v.string())
1925
+ ResolveOptionsSchema = strictObject({
1926
+ alias: optional(record(string(), union([string(), array(string())]))),
1927
+ aliasFields: optional(array(array(string()))),
1928
+ conditionNames: optional(array(string())),
1929
+ extensionAlias: optional(record(string(), array(string()))),
1930
+ exportsFields: optional(array(array(string()))),
1931
+ extensions: optional(array(string())),
1932
+ mainFields: optional(array(string())),
1933
+ mainFiles: optional(array(string())),
1934
+ modules: optional(array(string())),
1935
+ symlinks: optional(boolean()),
1936
+ tsconfigFilename: optional(string())
626
1937
  });
627
- TreeshakingOptionsSchema = v.union([v.boolean(), v.looseObject({
628
- annotations: v.optional(v.boolean()),
629
- manualPureFunctions: v.optional(v.array(v.string())),
630
- unknownGlobalSideEffects: v.optional(v.boolean())
1938
+ TreeshakingOptionsSchema = union([boolean(), looseObject({
1939
+ annotations: optional(boolean()),
1940
+ manualPureFunctions: optional(array(string())),
1941
+ unknownGlobalSideEffects: optional(boolean())
631
1942
  })]);
632
- OnLogSchema = v.pipe(v.function(), v.args(v.tuple([
1943
+ OnLogSchema = pipe(function_(), args(tuple([
633
1944
  LogLevelSchema,
634
1945
  RollupLogSchema,
635
- v.pipe(v.function(), v.args(v.tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
1946
+ pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
636
1947
  ])));
637
- OnwarnSchema = v.pipe(v.function(), v.args(v.tuple([RollupLogSchema, v.pipe(v.function(), v.args(v.tuple([v.union([RollupLogWithStringSchema, v.pipe(v.function(), v.returns(RollupLogWithStringSchema))])])))])));
638
- HmrSchema = v.union([v.boolean(), v.strictObject({
639
- port: v.optional(v.number()),
640
- host: v.optional(v.string()),
641
- implement: v.optional(v.string())
1948
+ OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
1949
+ HmrSchema = union([boolean(), strictObject({
1950
+ port: optional(number()),
1951
+ host: optional(string()),
1952
+ implement: optional(string())
642
1953
  })]);
643
- InputOptionsSchema = v.strictObject({
644
- input: v.optional(InputOptionSchema),
645
- plugins: v.optional(v.custom(() => true)),
646
- external: v.optional(ExternalSchema),
647
- resolve: v.optional(ResolveOptionsSchema),
648
- cwd: v.pipe(v.optional(v.string()), v.description("Current working directory")),
649
- platform: v.pipe(v.optional(v.union([
650
- v.literal("browser"),
651
- v.literal("neutral"),
652
- v.literal("node")
653
- ])), v.description(`Platform for which the code should be generated (node, ${colors.underline("browser")}, neutral)`)),
654
- shimMissingExports: v.pipe(v.optional(v.boolean()), v.description("Create shim variables for missing exports")),
655
- treeshake: v.optional(TreeshakingOptionsSchema),
656
- logLevel: v.pipe(v.optional(LogLevelOptionSchema), v.description(`Log level (${colors.dim("silent")}, ${colors.underline(colors.gray("info"))}, debug, ${colors.yellow("warn")})`)),
657
- onLog: v.optional(OnLogSchema),
658
- onwarn: v.optional(OnwarnSchema),
659
- moduleTypes: v.pipe(v.optional(ModuleTypesSchema), v.description("Module types for customized extensions")),
660
- experimental: v.optional(v.strictObject({
661
- disableLiveBindings: v.optional(v.boolean()),
662
- enableComposingJsPlugins: v.optional(v.boolean()),
663
- resolveNewUrlToAsset: v.optional(v.boolean()),
664
- strictExecutionOrder: v.optional(v.boolean()),
665
- hmr: v.optional(HmrSchema)
1954
+ InputOptionsSchema = strictObject({
1955
+ input: optional(InputOptionSchema),
1956
+ plugins: optional(custom(() => true)),
1957
+ external: optional(ExternalSchema),
1958
+ resolve: optional(ResolveOptionsSchema),
1959
+ cwd: pipe(optional(string()), description("Current working directory")),
1960
+ platform: pipe(optional(union([
1961
+ literal("browser"),
1962
+ literal("neutral"),
1963
+ literal("node")
1964
+ ])), description(`Platform for which the code should be generated (node, ${colors.underline("browser")}, neutral)`)),
1965
+ shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
1966
+ treeshake: optional(TreeshakingOptionsSchema),
1967
+ logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${colors.dim("silent")}, ${colors.underline(colors.gray("info"))}, debug, ${colors.yellow("warn")})`)),
1968
+ onLog: optional(OnLogSchema),
1969
+ onwarn: optional(OnwarnSchema),
1970
+ moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
1971
+ experimental: optional(strictObject({
1972
+ disableLiveBindings: optional(boolean()),
1973
+ enableComposingJsPlugins: optional(boolean()),
1974
+ resolveNewUrlToAsset: optional(boolean()),
1975
+ strictExecutionOrder: optional(boolean()),
1976
+ hmr: optional(HmrSchema)
666
1977
  })),
667
- define: v.pipe(v.optional(v.record(v.string(), v.string())), v.description("Define global variables")),
668
- inject: v.optional(v.record(v.string(), v.union([v.string(), v.tuple([v.string(), v.string()])]))),
669
- profilerNames: v.optional(v.boolean()),
670
- jsx: v.optional(v.union([
671
- v.boolean(),
1978
+ define: pipe(optional(record(string(), string())), description("Define global variables")),
1979
+ inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
1980
+ profilerNames: optional(boolean()),
1981
+ jsx: optional(union([
1982
+ boolean(),
672
1983
  JsxOptionsSchema,
673
- v.string("react"),
674
- v.string("react-jsx"),
675
- v.string("preserve")
1984
+ string("react"),
1985
+ string("react-jsx"),
1986
+ string("preserve")
676
1987
  ])),
677
- transform: v.optional(TransformOptionsSchema),
678
- watch: v.optional(v.union([WatchOptionsSchema, v.literal(false)])),
679
- dropLabels: v.pipe(v.optional(v.array(v.string())), v.description("Remove labeled statements with these label names")),
680
- checks: v.optional(ChecksOptionsSchema),
681
- keepNames: v.pipe(v.optional(v.boolean()), v.description("Keep function/class name")),
682
- debug: v.pipe(v.optional(v.object({ sessionId: v.pipe(v.optional(v.string()), v.description("Used to name the build.")) })), v.description("Enable debug mode. Emit debug information to disk. This might slow down the build process significantly."))
1988
+ transform: optional(TransformOptionsSchema),
1989
+ watch: optional(union([WatchOptionsSchema, literal(false)])),
1990
+ dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
1991
+ checks: optional(ChecksOptionsSchema),
1992
+ keepNames: pipe(optional(boolean()), description("Keep function/class name")),
1993
+ 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."))
683
1994
  });
684
- InputCliOverrideSchema = v.strictObject({
685
- input: v.pipe(v.optional(v.array(v.string())), v.description("Entry file")),
686
- external: v.pipe(v.optional(v.array(v.string())), v.description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
687
- inject: v.pipe(v.optional(v.record(v.string(), v.string())), v.description("Inject import statements on demand")),
688
- treeshake: v.pipe(v.optional(v.boolean()), v.description("enable treeshaking")),
689
- jsx: v.pipe(v.optional(JsxOptionsSchema), v.description("enable jsx"))
1995
+ InputCliOverrideSchema = strictObject({
1996
+ input: pipe(optional(array(string())), description("Entry file")),
1997
+ external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
1998
+ inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
1999
+ treeshake: pipe(optional(boolean()), description("enable treeshaking")),
2000
+ jsx: pipe(optional(JsxOptionsSchema), description("enable jsx"))
690
2001
  });
691
- InputCliOptionsSchema = v.omit(v.strictObject({
2002
+ InputCliOptionsSchema = omit(strictObject({
692
2003
  ...InputOptionsSchema.entries,
693
2004
  ...InputCliOverrideSchema.entries
694
2005
  }), [
@@ -715,87 +2026,87 @@ var init_validator = __esm({ "src/utils/validator.ts"() {
715
2026
  ESTarget$1["ESNext"] = "esnext";
716
2027
  return ESTarget$1;
717
2028
  }(ESTarget || {});
718
- ModuleFormatSchema = v.union([
719
- v.literal("es"),
720
- v.literal("cjs"),
721
- v.literal("esm"),
722
- v.literal("module"),
723
- v.literal("commonjs"),
724
- v.literal("iife"),
725
- v.literal("umd")
2029
+ ModuleFormatSchema = union([
2030
+ literal("es"),
2031
+ literal("cjs"),
2032
+ literal("esm"),
2033
+ literal("module"),
2034
+ literal("commonjs"),
2035
+ literal("iife"),
2036
+ literal("umd")
726
2037
  ]);
727
- AddonFunctionSchema = v.pipe(v.function(), v.args(v.tuple([v.custom(() => true)])), v.returnsAsync(v.unionAsync([v.string(), v.pipeAsync(v.promise(), v.awaitAsync(), v.string())])));
728
- ChunkFileNamesSchema = v.union([v.string(), v.pipe(v.function(), v.args(v.tuple([v.custom(() => true)])), v.returns(v.string()))]);
729
- AssetFileNamesSchema = v.union([v.string(), v.pipe(v.function(), v.args(v.tuple([v.custom(() => true)])), v.returns(v.string()))]);
730
- SanitizeFileNameSchema = v.union([v.boolean(), v.pipe(v.function(), v.args(v.tuple([v.string()])), v.returns(v.string()))]);
731
- GlobalsFunctionSchema = v.pipe(v.function(), v.args(v.tuple([v.string()])), v.returns(v.string()));
732
- AdvancedChunksSchema = v.strictObject({
733
- minSize: v.optional(v.number()),
734
- maxSize: v.optional(v.number()),
735
- minModuleSize: v.optional(v.number()),
736
- maxModuleSize: v.optional(v.number()),
737
- minShareCount: v.optional(v.number()),
738
- groups: v.optional(v.array(v.strictObject({
739
- name: v.string(),
740
- test: v.optional(v.union([v.string(), v.instance(RegExp)])),
741
- priority: v.optional(v.number()),
742
- minSize: v.optional(v.number()),
743
- minShareCount: v.optional(v.number()),
744
- maxSize: v.optional(v.number()),
745
- minModuleSize: v.optional(v.number()),
746
- maxModuleSize: v.optional(v.number())
2038
+ AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
2039
+ ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
2040
+ AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
2041
+ SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
2042
+ GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
2043
+ AdvancedChunksSchema = strictObject({
2044
+ minSize: optional(number()),
2045
+ maxSize: optional(number()),
2046
+ minModuleSize: optional(number()),
2047
+ maxModuleSize: optional(number()),
2048
+ minShareCount: optional(number()),
2049
+ groups: optional(array(strictObject({
2050
+ name: string(),
2051
+ test: optional(union([string(), instance(RegExp)])),
2052
+ priority: optional(number()),
2053
+ minSize: optional(number()),
2054
+ minShareCount: optional(number()),
2055
+ maxSize: optional(number()),
2056
+ minModuleSize: optional(number()),
2057
+ maxModuleSize: optional(number())
747
2058
  })))
748
2059
  });
749
- OutputOptionsSchema = v.strictObject({
750
- dir: v.pipe(v.optional(v.string()), v.description("Output directory, defaults to `dist` if `file` is not set")),
751
- file: v.pipe(v.optional(v.string()), v.description("Single output file")),
752
- exports: v.pipe(v.optional(v.union([
753
- v.literal("auto"),
754
- v.literal("named"),
755
- v.literal("default"),
756
- v.literal("none")
757
- ])), v.description(`Specify a export mode (${colors.underline("auto")}, named, default, none)`)),
758
- hashCharacters: v.pipe(v.optional(v.union([
759
- v.literal("base64"),
760
- v.literal("base36"),
761
- v.literal("hex")
762
- ])), v.description("Use the specified character set for file hashes")),
763
- format: v.pipe(v.optional(ModuleFormatSchema), v.description(`Output format of the generated bundle (supports ${colors.underline("esm")}, cjs, and iife)`)),
764
- sourcemap: v.pipe(v.optional(v.union([
765
- v.boolean(),
766
- v.literal("inline"),
767
- v.literal("hidden")
768
- ])), v.description(`Generate sourcemap (\`-s inline\` for inline, or ${colors.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
769
- sourcemapDebugIds: v.pipe(v.optional(v.boolean()), v.description("Inject sourcemap debug IDs")),
770
- sourcemapIgnoreList: v.optional(v.union([v.boolean(), v.custom(() => true)])),
771
- sourcemapPathTransform: v.optional(v.custom(() => true)),
772
- banner: v.optional(v.union([v.string(), AddonFunctionSchema])),
773
- footer: v.optional(v.union([v.string(), AddonFunctionSchema])),
774
- intro: v.optional(v.union([v.string(), AddonFunctionSchema])),
775
- outro: v.optional(v.union([v.string(), AddonFunctionSchema])),
776
- extend: v.pipe(v.optional(v.boolean()), v.description("Extend global variable defined by name in IIFE / UMD formats")),
777
- esModule: v.optional(v.union([v.boolean(), v.literal("if-default-prop")])),
778
- assetFileNames: v.optional(AssetFileNamesSchema),
779
- entryFileNames: v.optional(ChunkFileNamesSchema),
780
- chunkFileNames: v.optional(ChunkFileNamesSchema),
781
- cssEntryFileNames: v.optional(ChunkFileNamesSchema),
782
- cssChunkFileNames: v.optional(ChunkFileNamesSchema),
783
- sanitizeFileName: v.optional(SanitizeFileNameSchema),
784
- minify: v.pipe(v.optional(v.union([
785
- v.boolean(),
786
- v.string("dce-only"),
2060
+ OutputOptionsSchema = strictObject({
2061
+ dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
2062
+ file: pipe(optional(string()), description("Single output file")),
2063
+ exports: pipe(optional(union([
2064
+ literal("auto"),
2065
+ literal("named"),
2066
+ literal("default"),
2067
+ literal("none")
2068
+ ])), description(`Specify a export mode (${colors.underline("auto")}, named, default, none)`)),
2069
+ hashCharacters: pipe(optional(union([
2070
+ literal("base64"),
2071
+ literal("base36"),
2072
+ literal("hex")
2073
+ ])), description("Use the specified character set for file hashes")),
2074
+ format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${colors.underline("esm")}, cjs, and iife)`)),
2075
+ sourcemap: pipe(optional(union([
2076
+ boolean(),
2077
+ literal("inline"),
2078
+ literal("hidden")
2079
+ ])), description(`Generate sourcemap (\`-s inline\` for inline, or ${colors.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
2080
+ sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
2081
+ sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
2082
+ sourcemapPathTransform: optional(custom(() => true)),
2083
+ banner: optional(union([string(), AddonFunctionSchema])),
2084
+ footer: optional(union([string(), AddonFunctionSchema])),
2085
+ intro: optional(union([string(), AddonFunctionSchema])),
2086
+ outro: optional(union([string(), AddonFunctionSchema])),
2087
+ extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
2088
+ esModule: optional(union([boolean(), literal("if-default-prop")])),
2089
+ assetFileNames: optional(AssetFileNamesSchema),
2090
+ entryFileNames: optional(ChunkFileNamesSchema),
2091
+ chunkFileNames: optional(ChunkFileNamesSchema),
2092
+ cssEntryFileNames: optional(ChunkFileNamesSchema),
2093
+ cssChunkFileNames: optional(ChunkFileNamesSchema),
2094
+ sanitizeFileName: optional(SanitizeFileNameSchema),
2095
+ minify: pipe(optional(union([
2096
+ boolean(),
2097
+ string("dce-only"),
787
2098
  MinifyOptionsSchema
788
- ])), v.description("Minify the bundled file")),
789
- name: v.pipe(v.optional(v.string()), v.description("Name for UMD / IIFE format outputs")),
790
- globals: v.pipe(v.optional(v.union([v.record(v.string(), v.string()), GlobalsFunctionSchema])), v.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
791
- externalLiveBindings: v.pipe(v.optional(v.boolean()), v.description("external live bindings")),
792
- inlineDynamicImports: v.pipe(v.optional(v.boolean()), v.description("Inline dynamic imports")),
793
- advancedChunks: v.optional(AdvancedChunksSchema),
794
- comments: v.pipe(v.optional(v.union([v.literal("none"), v.literal("preserve-legal")])), v.description("Control comments in the output")),
795
- plugins: v.optional(v.custom(() => true)),
796
- polyfillRequire: v.pipe(v.optional(v.boolean()), v.description("Disable require polyfill injection")),
797
- target: v.pipe(v.optional(v.enum(ESTarget)), v.description("The JavaScript target environment")),
798
- hoistTransitiveImports: v.optional(v.custom((input) => {
2099
+ ])), description("Minify the bundled file")),
2100
+ name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
2101
+ globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2102
+ externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
2103
+ inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
2104
+ advancedChunks: optional(AdvancedChunksSchema),
2105
+ comments: pipe(optional(union([literal("none"), literal("preserve-legal")])), description("Control comments in the output")),
2106
+ plugins: optional(custom(() => true)),
2107
+ polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
2108
+ target: pipe(optional(enum_(ESTarget)), description("The JavaScript target environment")),
2109
+ hoistTransitiveImports: optional(custom((input) => {
799
2110
  if (input) return false;
800
2111
  return true;
801
2112
  }, () => `The 'true' value is not supported`))
@@ -803,26 +2114,26 @@ var init_validator = __esm({ "src/utils/validator.ts"() {
803
2114
  getAddonDescription = (placement, wrapper) => {
804
2115
  return `Code to insert the ${colors.bold(placement)} of the bundled file (${colors.bold(wrapper)} the wrapper function)`;
805
2116
  };
806
- OutputCliOverrideSchema = v.strictObject({
807
- assetFileNames: v.pipe(v.optional(v.string()), v.description("Name pattern for asset files")),
808
- entryFileNames: v.pipe(v.optional(v.string()), v.description("Name pattern for emitted entry chunks")),
809
- chunkFileNames: v.pipe(v.optional(v.string()), v.description("Name pattern for emitted secondary chunks")),
810
- cssEntryFileNames: v.pipe(v.optional(v.string()), v.description("Name pattern for emitted css entry chunks")),
811
- cssChunkFileNames: v.pipe(v.optional(v.string()), v.description("Name pattern for emitted css secondary chunks")),
812
- sanitizeFileName: v.pipe(v.optional(v.boolean()), v.description("Sanitize file name")),
813
- banner: v.pipe(v.optional(v.string()), v.description(getAddonDescription("top", "outside"))),
814
- footer: v.pipe(v.optional(v.string()), v.description(getAddonDescription("bottom", "outside"))),
815
- intro: v.pipe(v.optional(v.string()), v.description(getAddonDescription("top", "inside"))),
816
- outro: v.pipe(v.optional(v.string()), v.description(getAddonDescription("bottom", "inside"))),
817
- esModule: v.pipe(v.optional(v.boolean()), v.description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
818
- globals: v.pipe(v.optional(v.record(v.string(), v.string())), v.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
819
- advancedChunks: v.pipe(v.optional(v.strictObject({
820
- minSize: v.pipe(v.optional(v.number()), v.description("Minimum size of the chunk")),
821
- minShareCount: v.pipe(v.optional(v.number()), v.description("Minimum share count of the chunk"))
822
- })), v.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
823
- minify: v.pipe(v.optional(v.boolean()), v.description("Minify the bundled file"))
2117
+ OutputCliOverrideSchema = strictObject({
2118
+ assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
2119
+ entryFileNames: pipe(optional(string()), description("Name pattern for emitted entry chunks")),
2120
+ chunkFileNames: pipe(optional(string()), description("Name pattern for emitted secondary chunks")),
2121
+ cssEntryFileNames: pipe(optional(string()), description("Name pattern for emitted css entry chunks")),
2122
+ cssChunkFileNames: pipe(optional(string()), description("Name pattern for emitted css secondary chunks")),
2123
+ sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
2124
+ banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
2125
+ footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
2126
+ intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
2127
+ outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
2128
+ esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
2129
+ globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2130
+ advancedChunks: pipe(optional(strictObject({
2131
+ minSize: pipe(optional(number()), description("Minimum size of the chunk")),
2132
+ minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
2133
+ })), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2134
+ minify: pipe(optional(boolean()), description("Minify the bundled file"))
824
2135
  });
825
- OutputCliOptionsSchema = v.omit(v.strictObject({
2136
+ OutputCliOptionsSchema = omit(strictObject({
826
2137
  ...OutputOptionsSchema.entries,
827
2138
  ...OutputCliOverrideSchema.entries
828
2139
  }), [
@@ -831,11 +2142,11 @@ var init_validator = __esm({ "src/utils/validator.ts"() {
831
2142
  "plugins",
832
2143
  "hoistTransitiveImports"
833
2144
  ]);
834
- CliOptionsSchema = v.strictObject({
835
- config: v.pipe(v.optional(v.union([v.string(), v.boolean()])), v.description("Path to the config file (default: `rolldown.config.js`)")),
836
- help: v.pipe(v.optional(v.boolean()), v.description("Show help")),
837
- version: v.pipe(v.optional(v.boolean()), v.description("Show version number")),
838
- watch: v.pipe(v.optional(v.boolean()), v.description("Watch files in bundle and rebuild on changes")),
2145
+ CliOptionsSchema = strictObject({
2146
+ config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
2147
+ help: pipe(optional(boolean()), description("Show help")),
2148
+ version: pipe(optional(boolean()), description("Show version number")),
2149
+ watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
839
2150
  ...InputCliOptionsSchema.entries,
840
2151
  ...OutputCliOptionsSchema.entries
841
2152
  });
@@ -983,9 +2294,9 @@ var init_transform_side_effects = __esm({ "src/utils/transform-side-effects.ts"(
983
2294
 
984
2295
  //#endregion
985
2296
  //#region src/utils/transform-sourcemap.ts
986
- function isEmptySourcemapFiled(array) {
987
- if (!array) return true;
988
- if (array.length === 0 || !array[0]) return true;
2297
+ function isEmptySourcemapFiled(array$1) {
2298
+ if (!array$1) return true;
2299
+ if (array$1.length === 0 || !array$1[0]) return true;
989
2300
  return false;
990
2301
  }
991
2302
  function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
@@ -2210,14 +3521,16 @@ var init_dist = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/rem
2210
3521
  //#endregion
2211
3522
  //#region src/plugin/bindingify-hook-filter.ts
2212
3523
  function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
2213
- if (typeof matcher === "string" || matcher instanceof RegExp) return [include(id(matcher))];
2214
- if (Array.isArray(matcher)) return matcher.map((m$10) => include(id(m$10)));
3524
+ if (typeof matcher === "string" || matcher instanceof RegExp) return [include(generateAtomMatcher(stringKind, matcher))];
3525
+ if (Array.isArray(matcher)) return matcher.map((m$10) => include(generateAtomMatcher(stringKind, m$10)));
2215
3526
  let ret = [];
2216
- let isCode = stringKind === "code";
2217
- if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m$10) => exclude(isCode ? code(m$10) : id(m$10))));
2218
- if (matcher.include) ret.push(...arraify(matcher.include).map((m$10) => include(isCode ? code(m$10) : id(m$10))));
3527
+ if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m$10) => exclude(generateAtomMatcher(stringKind, m$10))));
3528
+ if (matcher.include) ret.push(...arraify(matcher.include).map((m$10) => include(generateAtomMatcher(stringKind, m$10))));
2219
3529
  return ret;
2220
3530
  }
3531
+ function generateAtomMatcher(kind, matcher) {
3532
+ return kind === "code" ? code(matcher) : id(matcher);
3533
+ }
2221
3534
  function transformFilterMatcherToFilterExprs(filterOption) {
2222
3535
  if (!filterOption) return void 0;
2223
3536
  if (Array.isArray(filterOption)) return filterOption;
@@ -2255,20 +3568,20 @@ function bindingifyFilterExpr(expr) {
2255
3568
  function bindingifyFilterExprImpl(expr, list) {
2256
3569
  switch (expr.kind) {
2257
3570
  case "and": {
2258
- let args = expr.args;
2259
- for (let i$22 = args.length - 1; i$22 >= 0; i$22--) bindingifyFilterExprImpl(args[i$22], list);
3571
+ let args$1 = expr.args;
3572
+ for (let i$22 = args$1.length - 1; i$22 >= 0; i$22--) bindingifyFilterExprImpl(args$1[i$22], list);
2260
3573
  list.push({
2261
3574
  kind: "And",
2262
- payload: args.length
3575
+ payload: args$1.length
2263
3576
  });
2264
3577
  break;
2265
3578
  }
2266
3579
  case "or": {
2267
- let args = expr.args;
2268
- for (let i$22 = args.length - 1; i$22 >= 0; i$22--) bindingifyFilterExprImpl(args[i$22], list);
3580
+ let args$1 = expr.args;
3581
+ for (let i$22 = args$1.length - 1; i$22 >= 0; i$22--) bindingifyFilterExprImpl(args$1[i$22], list);
2269
3582
  list.push({
2270
3583
  kind: "Or",
2271
- payload: args.length
3584
+ payload: args$1.length
2272
3585
  });
2273
3586
  break;
2274
3587
  }
@@ -2401,10 +3714,10 @@ var init_plugin_context = __esm({ "src/plugin/plugin-context.ts"() {
2401
3714
  async function createLoadModulePromise(context, data) {
2402
3715
  const loadPromise = data.loadModulePromiseMap.get(id$1);
2403
3716
  if (loadPromise) return loadPromise;
2404
- const promise = new Promise((resolve, _) => {
3717
+ const promise$1 = new Promise((resolve, _) => {
2405
3718
  data.loadModulePromiseResolveFnMap.set(id$1, resolve);
2406
3719
  });
2407
- data.loadModulePromiseMap.set(id$1, promise);
3720
+ data.loadModulePromiseMap.set(id$1, promise$1);
2408
3721
  try {
2409
3722
  await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
2410
3723
  } catch (e$5) {
@@ -2412,7 +3725,7 @@ var init_plugin_context = __esm({ "src/plugin/plugin-context.ts"() {
2412
3725
  data.loadModulePromiseResolveFnMap.delete(id$1);
2413
3726
  throw e$5;
2414
3727
  }
2415
- return promise;
3728
+ return promise$1;
2416
3729
  }
2417
3730
  await createLoadModulePromise(this.context, this.data);
2418
3731
  return this.data.getModuleInfo(id$1, this.context);
@@ -2506,41 +3819,41 @@ var init_transform_plugin_context = __esm({ "src/plugin/transform-plugin-context
2506
3819
 
2507
3820
  //#endregion
2508
3821
  //#region src/plugin/bindingify-build-hooks.ts
2509
- function bindingifyBuildStart(args) {
2510
- const hook = args.plugin.buildStart;
3822
+ function bindingifyBuildStart(args$1) {
3823
+ const hook = args$1.plugin.buildStart;
2511
3824
  if (!hook) return {};
2512
3825
  const { handler, meta } = normalizeHook(hook);
2513
3826
  return {
2514
3827
  plugin: async (ctx, opts) => {
2515
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedInputOptionsImpl(opts, args.onLog));
3828
+ 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));
2516
3829
  },
2517
3830
  meta: bindingifyPluginHookMeta(meta)
2518
3831
  };
2519
3832
  }
2520
- function bindingifyBuildEnd(args) {
2521
- const hook = args.plugin.buildEnd;
3833
+ function bindingifyBuildEnd(args$1) {
3834
+ const hook = args$1.plugin.buildEnd;
2522
3835
  if (!hook) return {};
2523
3836
  const { handler, meta } = normalizeHook(hook);
2524
3837
  return {
2525
3838
  plugin: async (ctx, err) => {
2526
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), err ? normalizeErrors(err) : void 0);
3839
+ 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);
2527
3840
  },
2528
3841
  meta: bindingifyPluginHookMeta(meta)
2529
3842
  };
2530
3843
  }
2531
- function bindingifyResolveId(args) {
2532
- const hook = args.plugin.resolveId;
3844
+ function bindingifyResolveId(args$1) {
3845
+ const hook = args$1.plugin.resolveId;
2533
3846
  if (!hook) return {};
2534
3847
  const { handler, meta, options } = normalizeHook(hook);
2535
3848
  return {
2536
3849
  plugin: async (ctx, specifier, importer, extraOptions) => {
2537
- const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
3850
+ const contextResolveOptions = extraOptions.custom != null ? args$1.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
2538
3851
  const newExtraOptions = {
2539
3852
  ...extraOptions,
2540
3853
  custom: contextResolveOptions?.custom,
2541
3854
  [SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
2542
3855
  };
2543
- 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);
3856
+ 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);
2544
3857
  if (ret == null) return;
2545
3858
  if (ret === false) return {
2546
3859
  id: specifier,
@@ -2551,7 +3864,7 @@ function bindingifyResolveId(args) {
2551
3864
  id: ret,
2552
3865
  normalizeExternalId: true
2553
3866
  };
2554
- let exist = args.pluginContextData.updateModuleOption(ret.id, {
3867
+ let exist = args$1.pluginContextData.updateModuleOption(ret.id, {
2555
3868
  meta: ret.meta || {},
2556
3869
  moduleSideEffects: ret.moduleSideEffects ?? null,
2557
3870
  invalidate: false
@@ -2567,13 +3880,13 @@ function bindingifyResolveId(args) {
2567
3880
  filter: bindingifyResolveIdFilter(options.filter)
2568
3881
  };
2569
3882
  }
2570
- function bindingifyResolveDynamicImport(args) {
2571
- const hook = args.plugin.resolveDynamicImport;
3883
+ function bindingifyResolveDynamicImport(args$1) {
3884
+ const hook = args$1.plugin.resolveDynamicImport;
2572
3885
  if (!hook) return {};
2573
3886
  const { handler, meta } = normalizeHook(hook);
2574
3887
  return {
2575
3888
  plugin: async (ctx, specifier, importer) => {
2576
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), specifier, importer ?? void 0);
3889
+ 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);
2577
3890
  if (ret == null) return;
2578
3891
  if (ret === false) return {
2579
3892
  id: specifier,
@@ -2585,7 +3898,7 @@ function bindingifyResolveDynamicImport(args) {
2585
3898
  external: ret.external
2586
3899
  };
2587
3900
  if (ret.moduleSideEffects !== null) result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
2588
- args.pluginContextData.updateModuleOption(ret.id, {
3901
+ args$1.pluginContextData.updateModuleOption(ret.id, {
2589
3902
  meta: ret.meta || {},
2590
3903
  moduleSideEffects: ret.moduleSideEffects || null,
2591
3904
  invalidate: false
@@ -2595,16 +3908,16 @@ function bindingifyResolveDynamicImport(args) {
2595
3908
  meta: bindingifyPluginHookMeta(meta)
2596
3909
  };
2597
3910
  }
2598
- function bindingifyTransform(args) {
2599
- const hook = args.plugin.transform;
3911
+ function bindingifyTransform(args$1) {
3912
+ const hook = args$1.plugin.transform;
2600
3913
  if (!hook) return {};
2601
3914
  const { handler, meta, options } = normalizeHook(hook);
2602
3915
  return {
2603
3916
  plugin: async (ctx, code$1, id$1, meta$1) => {
2604
- 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);
3917
+ 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);
2605
3918
  if (ret == null) return void 0;
2606
3919
  if (typeof ret === "string") return { code: ret };
2607
- let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
3920
+ let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
2608
3921
  meta: ret.meta ?? {},
2609
3922
  moduleSideEffects: ret.moduleSideEffects ?? null,
2610
3923
  invalidate: false
@@ -2620,16 +3933,16 @@ function bindingifyTransform(args) {
2620
3933
  filter: bindingifyTransformFilter(options.filter)
2621
3934
  };
2622
3935
  }
2623
- function bindingifyLoad(args) {
2624
- const hook = args.plugin.load;
3936
+ function bindingifyLoad(args$1) {
3937
+ const hook = args$1.plugin.load;
2625
3938
  if (!hook) return {};
2626
3939
  const { handler, meta, options } = normalizeHook(hook);
2627
3940
  return {
2628
3941
  plugin: async (ctx, id$1) => {
2629
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode, id$1), id$1);
3942
+ 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);
2630
3943
  if (ret == null) return;
2631
3944
  if (typeof ret === "string") return { code: ret };
2632
- let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
3945
+ let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
2633
3946
  meta: ret.meta || {},
2634
3947
  moduleSideEffects: ret.moduleSideEffects ?? null,
2635
3948
  invalidate: false
@@ -2656,13 +3969,13 @@ function preProcessSourceMap(ret, id$1) {
2656
3969
  }
2657
3970
  return map;
2658
3971
  }
2659
- function bindingifyModuleParsed(args) {
2660
- const hook = args.plugin.moduleParsed;
3972
+ function bindingifyModuleParsed(args$1) {
3973
+ const hook = args$1.plugin.moduleParsed;
2661
3974
  if (!hook) return {};
2662
3975
  const { handler, meta } = normalizeHook(hook);
2663
3976
  return {
2664
3977
  plugin: async (ctx, moduleInfo) => {
2665
- 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)));
3978
+ 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)));
2666
3979
  },
2667
3980
  meta: bindingifyPluginHookMeta(meta)
2668
3981
  };
@@ -3093,25 +4406,25 @@ var init_transform_to_rollup_output = __esm({ "src/utils/transform-to-rollup-out
3093
4406
 
3094
4407
  //#endregion
3095
4408
  //#region src/plugin/bindingify-output-hooks.ts
3096
- function bindingifyRenderStart(args) {
3097
- const hook = args.plugin.renderStart;
4409
+ function bindingifyRenderStart(args$1) {
4410
+ const hook = args$1.plugin.renderStart;
3098
4411
  if (!hook) return {};
3099
4412
  const { handler, meta } = normalizeHook(hook);
3100
4413
  return {
3101
4414
  plugin: async (ctx, opts) => {
3102
- 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));
4415
+ 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));
3103
4416
  },
3104
4417
  meta: bindingifyPluginHookMeta(meta)
3105
4418
  };
3106
4419
  }
3107
- function bindingifyRenderChunk(args) {
3108
- const hook = args.plugin.renderChunk;
4420
+ function bindingifyRenderChunk(args$1) {
4421
+ const hook = args$1.plugin.renderChunk;
3109
4422
  if (!hook) return {};
3110
4423
  const { handler, meta, options } = normalizeHook(hook);
3111
4424
  return {
3112
4425
  plugin: async (ctx, code$1, chunk, opts, meta$1) => {
3113
- if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
3114
- 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());
4426
+ if (args$1.pluginContextData.getRenderChunkMeta() == null) args$1.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
4427
+ 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());
3115
4428
  if (ret == null) return;
3116
4429
  if (typeof ret === "string") return { code: ret };
3117
4430
  if (!ret.map) return { code: ret.code };
@@ -3124,30 +4437,30 @@ function bindingifyRenderChunk(args) {
3124
4437
  filter: bindingifyRenderChunkFilter(options.filter)
3125
4438
  };
3126
4439
  }
3127
- function bindingifyAugmentChunkHash(args) {
3128
- const hook = args.plugin.augmentChunkHash;
4440
+ function bindingifyAugmentChunkHash(args$1) {
4441
+ const hook = args$1.plugin.augmentChunkHash;
3129
4442
  if (!hook) return {};
3130
4443
  const { handler, meta } = normalizeHook(hook);
3131
4444
  return {
3132
4445
  plugin: async (ctx, chunk) => {
3133
- return await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
4446
+ 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));
3134
4447
  },
3135
4448
  meta: bindingifyPluginHookMeta(meta)
3136
4449
  };
3137
4450
  }
3138
- function bindingifyRenderError(args) {
3139
- const hook = args.plugin.renderError;
4451
+ function bindingifyRenderError(args$1) {
4452
+ const hook = args$1.plugin.renderError;
3140
4453
  if (!hook) return {};
3141
4454
  const { handler, meta } = normalizeHook(hook);
3142
4455
  return {
3143
4456
  plugin: async (ctx, err) => {
3144
- handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), normalizeErrors(err));
4457
+ 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));
3145
4458
  },
3146
4459
  meta: bindingifyPluginHookMeta(meta)
3147
4460
  };
3148
4461
  }
3149
- function bindingifyGenerateBundle(args) {
3150
- const hook = args.plugin.generateBundle;
4462
+ function bindingifyGenerateBundle(args$1) {
4463
+ const hook = args$1.plugin.generateBundle;
3151
4464
  if (!hook) return {};
3152
4465
  const { handler, meta } = normalizeHook(hook);
3153
4466
  return {
@@ -3157,14 +4470,14 @@ function bindingifyGenerateBundle(args) {
3157
4470
  deleted: new Set()
3158
4471
  };
3159
4472
  const output = transformToOutputBundle(bundle, changed);
3160
- 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);
4473
+ 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);
3161
4474
  return collectChangedBundle(changed, output);
3162
4475
  },
3163
4476
  meta: bindingifyPluginHookMeta(meta)
3164
4477
  };
3165
4478
  }
3166
- function bindingifyWriteBundle(args) {
3167
- const hook = args.plugin.writeBundle;
4479
+ function bindingifyWriteBundle(args$1) {
4480
+ const hook = args$1.plugin.writeBundle;
3168
4481
  if (!hook) return {};
3169
4482
  const { handler, meta } = normalizeHook(hook);
3170
4483
  return {
@@ -3174,67 +4487,67 @@ function bindingifyWriteBundle(args) {
3174
4487
  deleted: new Set()
3175
4488
  };
3176
4489
  const output = transformToOutputBundle(bundle, changed);
3177
- 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);
4490
+ 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);
3178
4491
  return collectChangedBundle(changed, output);
3179
4492
  },
3180
4493
  meta: bindingifyPluginHookMeta(meta)
3181
4494
  };
3182
4495
  }
3183
- function bindingifyCloseBundle(args) {
3184
- const hook = args.plugin.closeBundle;
4496
+ function bindingifyCloseBundle(args$1) {
4497
+ const hook = args$1.plugin.closeBundle;
3185
4498
  if (!hook) return {};
3186
4499
  const { handler, meta } = normalizeHook(hook);
3187
4500
  return {
3188
4501
  plugin: async (ctx) => {
3189
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
4502
+ await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode));
3190
4503
  },
3191
4504
  meta: bindingifyPluginHookMeta(meta)
3192
4505
  };
3193
4506
  }
3194
- function bindingifyBanner(args) {
3195
- const hook = args.plugin.banner;
4507
+ function bindingifyBanner(args$1) {
4508
+ const hook = args$1.plugin.banner;
3196
4509
  if (!hook) return {};
3197
4510
  const { handler, meta } = normalizeHook(hook);
3198
4511
  return {
3199
4512
  plugin: async (ctx, chunk) => {
3200
4513
  if (typeof handler === "string") return handler;
3201
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
4514
+ 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));
3202
4515
  },
3203
4516
  meta: bindingifyPluginHookMeta(meta)
3204
4517
  };
3205
4518
  }
3206
- function bindingifyFooter(args) {
3207
- const hook = args.plugin.footer;
4519
+ function bindingifyFooter(args$1) {
4520
+ const hook = args$1.plugin.footer;
3208
4521
  if (!hook) return {};
3209
4522
  const { handler, meta } = normalizeHook(hook);
3210
4523
  return {
3211
4524
  plugin: async (ctx, chunk) => {
3212
4525
  if (typeof handler === "string") return handler;
3213
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
4526
+ 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));
3214
4527
  },
3215
4528
  meta: bindingifyPluginHookMeta(meta)
3216
4529
  };
3217
4530
  }
3218
- function bindingifyIntro(args) {
3219
- const hook = args.plugin.intro;
4531
+ function bindingifyIntro(args$1) {
4532
+ const hook = args$1.plugin.intro;
3220
4533
  if (!hook) return {};
3221
4534
  const { handler, meta } = normalizeHook(hook);
3222
4535
  return {
3223
4536
  plugin: async (ctx, chunk) => {
3224
4537
  if (typeof handler === "string") return handler;
3225
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
4538
+ 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));
3226
4539
  },
3227
4540
  meta: bindingifyPluginHookMeta(meta)
3228
4541
  };
3229
4542
  }
3230
- function bindingifyOutro(args) {
3231
- const hook = args.plugin.outro;
4543
+ function bindingifyOutro(args$1) {
4544
+ const hook = args$1.plugin.outro;
3232
4545
  if (!hook) return {};
3233
4546
  const { handler, meta } = normalizeHook(hook);
3234
4547
  return {
3235
4548
  plugin: async (ctx, chunk) => {
3236
4549
  if (typeof handler === "string") return handler;
3237
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
4550
+ 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));
3238
4551
  },
3239
4552
  meta: bindingifyPluginHookMeta(meta)
3240
4553
  };
@@ -3254,24 +4567,24 @@ var init_bindingify_output_hooks = __esm({ "src/plugin/bindingify-output-hooks.t
3254
4567
 
3255
4568
  //#endregion
3256
4569
  //#region src/plugin/bindingify-watch-hooks.ts
3257
- function bindingifyWatchChange(args) {
3258
- const hook = args.plugin.watchChange;
4570
+ function bindingifyWatchChange(args$1) {
4571
+ const hook = args$1.plugin.watchChange;
3259
4572
  if (!hook) return {};
3260
4573
  const { handler, meta } = normalizeHook(hook);
3261
4574
  return {
3262
4575
  plugin: async (ctx, id$1, event) => {
3263
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id$1, { event });
4576
+ 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 });
3264
4577
  },
3265
4578
  meta: bindingifyPluginHookMeta(meta)
3266
4579
  };
3267
4580
  }
3268
- function bindingifyCloseWatcher(args) {
3269
- const hook = args.plugin.closeWatcher;
4581
+ function bindingifyCloseWatcher(args$1) {
4582
+ const hook = args$1.plugin.closeWatcher;
3270
4583
  if (!hook) return {};
3271
4584
  const { handler, meta } = normalizeHook(hook);
3272
4585
  return {
3273
4586
  plugin: async (ctx) => {
3274
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
4587
+ await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode));
3275
4588
  },
3276
4589
  meta: bindingifyPluginHookMeta(meta)
3277
4590
  };
@@ -3349,7 +4662,7 @@ var init_hook_usage = __esm({ "src/plugin/generated/hook-usage.ts"() {
3349
4662
  //#endregion
3350
4663
  //#region src/plugin/bindingify-plugin.ts
3351
4664
  function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
3352
- const args = {
4665
+ const args$1 = {
3353
4666
  plugin,
3354
4667
  options,
3355
4668
  outputOptions,
@@ -3359,26 +4672,26 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
3359
4672
  watchMode,
3360
4673
  normalizedOutputPlugins
3361
4674
  };
3362
- const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
3363
- const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
3364
- const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args);
3365
- const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args);
3366
- const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
3367
- const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
3368
- const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
3369
- const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args);
3370
- const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
3371
- const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
3372
- const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
3373
- const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args);
3374
- const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args);
3375
- const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args);
3376
- const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args);
3377
- const { plugin: footer, meta: footerMeta } = bindingifyFooter(args);
3378
- const { plugin: intro, meta: introMeta } = bindingifyIntro(args);
3379
- const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
3380
- const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
3381
- const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
4675
+ const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args$1);
4676
+ const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args$1);
4677
+ const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args$1);
4678
+ const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args$1);
4679
+ const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args$1);
4680
+ const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args$1);
4681
+ const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args$1);
4682
+ const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args$1);
4683
+ const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args$1);
4684
+ const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args$1);
4685
+ const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args$1);
4686
+ const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args$1);
4687
+ const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args$1);
4688
+ const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args$1);
4689
+ const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args$1);
4690
+ const { plugin: footer, meta: footerMeta } = bindingifyFooter(args$1);
4691
+ const { plugin: intro, meta: introMeta } = bindingifyIntro(args$1);
4692
+ const { plugin: outro, meta: outroMeta } = bindingifyOutro(args$1);
4693
+ const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args$1);
4694
+ const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args$1);
3382
4695
  let hookUsage = extractHookUsage(plugin).inner();
3383
4696
  const result = {
3384
4697
  name: plugin.name,
@@ -3454,13 +4767,13 @@ function wrapHandlers(plugin) {
3454
4767
  "closeWatcher"
3455
4768
  ]) {
3456
4769
  const handler = plugin[hookName];
3457
- if (handler) plugin[hookName] = async (...args) => {
4770
+ if (handler) plugin[hookName] = async (...args$1) => {
3458
4771
  try {
3459
- return await handler(...args);
4772
+ return await handler(...args$1);
3460
4773
  } catch (e$5) {
3461
4774
  return error(logPluginError(e$5, plugin.name, {
3462
4775
  hook: hookName,
3463
- id: hookName === "transform" ? args[2] : void 0
4776
+ id: hookName === "transform" ? args$1[2] : void 0
3464
4777
  }));
3465
4778
  }
3466
4779
  };
@@ -3524,13 +4837,13 @@ var init_plugin_context_data = __esm({ "src/plugin/plugin-context-data.ts"() {
3524
4837
  get() {
3525
4838
  return moduleSideEffects;
3526
4839
  },
3527
- set: (v$1) => {
4840
+ set: (v) => {
3528
4841
  this.updateModuleOption(id$1, {
3529
- moduleSideEffects: v$1,
4842
+ moduleSideEffects: v,
3530
4843
  meta: info.meta,
3531
4844
  invalidate: true
3532
4845
  });
3533
- moduleSideEffects = v$1;
4846
+ moduleSideEffects = v;
3534
4847
  }
3535
4848
  });
3536
4849
  return info;
@@ -4273,6 +5586,9 @@ var init_rolldown_build = __esm({ "src/api/rolldown/rolldown-build.ts"() {
4273
5586
  async generateHmrPatch(changedFiles) {
4274
5587
  return this.#bundler?.bundler.generateHmrPatch(changedFiles);
4275
5588
  }
5589
+ async hmrInvalidate(file, firstInvalidatedBy) {
5590
+ return this.#bundler?.bundler.hmrInvalidate(file, firstInvalidatedBy);
5591
+ }
4276
5592
  get watchFiles() {
4277
5593
  return this.#bundler?.bundler.watchFiles ?? [];
4278
5594
  }
@@ -4471,4 +5787,4 @@ var init_src = __esm({ "src/index.ts"() {
4471
5787
  } });
4472
5788
 
4473
5789
  //#endregion
4474
- export { BuiltinPlugin, PluginContextData, VERSION, bindingifyPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundler, defineConfig, description, dynamicImportVarsPlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, init_bindingify_plugin, init_compose_js_plugins, init_constructors, init_create_bundler, init_normalize_string_or_regex, init_plugin_context_data, init_rolldown, init_src, init_transform_to_rollup_output, init_validator, init_watch, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reportPlugin, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch };
5790
+ export { BuiltinPlugin, PluginContextData, VERSION, bindingifyPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundler, defineConfig, description$1 as description, dynamicImportVarsPlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, init_bindingify_plugin, init_compose_js_plugins, init_constructors, init_create_bundler, init_normalize_string_or_regex, init_plugin_context_data, init_rolldown, init_src, init_transform_to_rollup_output, init_validator, init_watch, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reportPlugin, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch };