@rolldown/browser 1.0.0-beta.8-commit.852c603 → 1.0.0-beta.8-commit.a720367

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/browser.mjs +1464 -498
  2. package/dist/cli.cjs +7 -7
  3. package/dist/cli.mjs +3 -3
  4. package/dist/experimental-index.cjs +3 -3
  5. package/dist/experimental-index.d.cts +1 -1
  6. package/dist/experimental-index.d.mts +1 -1
  7. package/dist/experimental-index.mjs +3 -3
  8. package/dist/filter-index.cjs +12 -0
  9. package/dist/{filter-expression-index.d.cts → filter-index.d.cts} +2 -2
  10. package/dist/{filter-expression-index.d.mts → filter-index.d.mts} +2 -2
  11. package/dist/filter-index.mjs +4 -0
  12. package/dist/index.cjs +4 -5
  13. package/dist/index.d.cts +2 -2
  14. package/dist/index.d.mts +2 -2
  15. package/dist/index.mjs +4 -4
  16. package/dist/parallel-plugin-worker.cjs +3 -3
  17. package/dist/parallel-plugin-worker.mjs +3 -3
  18. package/dist/parallel-plugin.d.cts +1 -1
  19. package/dist/parallel-plugin.d.mts +1 -1
  20. package/dist/parse-ast-index.cjs +1 -1
  21. package/dist/parse-ast-index.mjs +1 -1
  22. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  23. package/dist/shared/filter-index-ChddWdsi.cjs +255 -0
  24. package/dist/shared/filter-index-DmisSKZF.mjs +174 -0
  25. package/dist/shared/{input-options.d-C0G2toUx.d.cts → input-options.d-CBiF1NIG.d.cts} +22 -24
  26. package/dist/shared/{input-options.d-D_2wMOSn.d.mts → input-options.d-LWRQj-14.d.mts} +22 -24
  27. package/dist/shared/{src-RM00Zc4c.mjs → src-D1Nyx72w.mjs} +1754 -511
  28. package/dist/shared/{src-DbbYa-_8.cjs → src-zKH-Bkca.cjs} +1755 -518
  29. package/package.json +2 -4
  30. package/dist/filter-expression-index.cjs +0 -11
  31. package/dist/filter-expression-index.mjs +0 -4
  32. package/dist/shared/filter-expression-index-CIS7Rrin.mjs +0 -69
  33. package/dist/shared/filter-expression-index-CRtoeipP.cjs +0 -119
  34. /package/dist/shared/{parse-ast-index-DWHg_E7J.mjs → parse-ast-index-B5wGnMSg.mjs} +0 -0
  35. /package/dist/shared/{parse-ast-index-B9pj8J1q.cjs → parse-ast-index-DTWvag1h.cjs} +0 -0
package/dist/browser.mjs CHANGED
@@ -1,11 +1,9 @@
1
1
  import { BindingHookSideEffects, BindingLogLevel, BindingPluginOrder, BindingWatcher, Bundler, parseSync, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
2
2
  import path from "pathe";
3
- import "@valibot/to-json-schema";
4
3
  import colors from "ansis";
5
- import * as v from "valibot";
6
4
 
7
5
  //#region package.json
8
- var version = "1.0.0-beta.8-commit.852c603";
6
+ var version = "1.0.0-beta.8-commit.a720367";
9
7
 
10
8
  //#endregion
11
9
  //#region src/builtin-plugin/utils.ts
@@ -33,9 +31,6 @@ function arraify(value) {
33
31
  function isNullish(value) {
34
32
  return value === null || value === void 0;
35
33
  }
36
- function isPromiseLike(value) {
37
- return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
38
- }
39
34
  function unimplemented(info) {
40
35
  if (info) throw new Error(`unimplemented: ${info}`);
41
36
  throw new Error("unimplemented");
@@ -424,11 +419,11 @@ const DEFINED_HOOK_NAMES = {
424
419
 
425
420
  //#endregion
426
421
  //#region src/utils/async-flatten.ts
427
- async function asyncFlatten(array) {
422
+ async function asyncFlatten(array$1) {
428
423
  do
429
- array = (await Promise.all(array)).flat(Infinity);
430
- while (array.some((v$1) => v$1?.then));
431
- return array;
424
+ array$1 = (await Promise.all(array$1)).flat(Infinity);
425
+ while (array$1.some((v) => v?.then));
426
+ return array$1;
432
427
  }
433
428
 
434
429
  //#endregion
@@ -543,201 +538,1170 @@ function getSortedPlugins(hookName, plugins) {
543
538
  ];
544
539
  }
545
540
 
541
+ //#endregion
542
+ //#region ../../node_modules/.pnpm/valibot@1.0.0_typescript@5.8.3/node_modules/valibot/dist/index.js
543
+ var store;
544
+ /* @__NO_SIDE_EFFECTS__ */
545
+ function getGlobalConfig(config2) {
546
+ return {
547
+ lang: config2?.lang ?? store?.lang,
548
+ message: config2?.message,
549
+ abortEarly: config2?.abortEarly ?? store?.abortEarly,
550
+ abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
551
+ };
552
+ }
553
+ var store2;
554
+ /* @__NO_SIDE_EFFECTS__ */
555
+ function getGlobalMessage(lang) {
556
+ return store2?.get(lang);
557
+ }
558
+ var store3;
559
+ /* @__NO_SIDE_EFFECTS__ */
560
+ function getSchemaMessage(lang) {
561
+ return store3?.get(lang);
562
+ }
563
+ var store4;
564
+ /* @__NO_SIDE_EFFECTS__ */
565
+ function getSpecificMessage(reference, lang) {
566
+ return store4?.get(reference)?.get(lang);
567
+ }
568
+ /* @__NO_SIDE_EFFECTS__ */
569
+ function _stringify(input) {
570
+ const type = typeof input;
571
+ if (type === "string") return `"${input}"`;
572
+ if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
573
+ if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
574
+ return type;
575
+ }
576
+ function _addIssue(context, label, dataset, config2, other) {
577
+ const input = other && "input" in other ? other.input : dataset.value;
578
+ const expected = other?.expected ?? context.expects ?? null;
579
+ const received = other?.received ?? /* @__PURE__ */ _stringify(input);
580
+ const issue = {
581
+ kind: context.kind,
582
+ type: context.type,
583
+ input,
584
+ expected,
585
+ received,
586
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
587
+ requirement: context.requirement,
588
+ path: other?.path,
589
+ issues: other?.issues,
590
+ lang: config2.lang,
591
+ abortEarly: config2.abortEarly,
592
+ abortPipeEarly: config2.abortPipeEarly
593
+ };
594
+ const isSchema = context.kind === "schema";
595
+ const message = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
596
+ if (message !== void 0) issue.message = typeof message === "function" ? message(issue) : message;
597
+ if (isSchema) dataset.typed = false;
598
+ if (dataset.issues) dataset.issues.push(issue);
599
+ else dataset.issues = [issue];
600
+ }
601
+ /* @__NO_SIDE_EFFECTS__ */
602
+ function _getStandardProps(context) {
603
+ return {
604
+ version: 1,
605
+ vendor: "valibot",
606
+ validate(value2) {
607
+ return context["~run"]({ value: value2 }, /* @__PURE__ */ getGlobalConfig());
608
+ }
609
+ };
610
+ }
611
+ /* @__NO_SIDE_EFFECTS__ */
612
+ function _isValidObjectKey(object2, key) {
613
+ return Object.hasOwn(object2, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
614
+ }
615
+ /* @__NO_SIDE_EFFECTS__ */
616
+ function _joinExpects(values2, separator) {
617
+ const list = [...new Set(values2)];
618
+ if (list.length > 1) return `(${list.join(` ${separator} `)})`;
619
+ return list[0] ?? "never";
620
+ }
621
+ var ValiError = class extends Error {
622
+ /**
623
+ * Creates a Valibot error with useful information.
624
+ *
625
+ * @param issues The error issues.
626
+ */
627
+ constructor(issues) {
628
+ super(issues[0].message);
629
+ this.name = "ValiError";
630
+ this.issues = issues;
631
+ }
632
+ };
633
+ /* @__NO_SIDE_EFFECTS__ */
634
+ function args(schema) {
635
+ return {
636
+ kind: "transformation",
637
+ type: "args",
638
+ reference: args,
639
+ async: false,
640
+ schema,
641
+ "~run"(dataset, config2) {
642
+ const func = dataset.value;
643
+ dataset.value = (...args_) => {
644
+ const argsDataset = this.schema["~run"]({ value: args_ }, config2);
645
+ if (argsDataset.issues) throw new ValiError(argsDataset.issues);
646
+ return func(...argsDataset.value);
647
+ };
648
+ return dataset;
649
+ }
650
+ };
651
+ }
652
+ /* @__NO_SIDE_EFFECTS__ */
653
+ function awaitAsync() {
654
+ return {
655
+ kind: "transformation",
656
+ type: "await",
657
+ reference: awaitAsync,
658
+ async: true,
659
+ async "~run"(dataset) {
660
+ dataset.value = await dataset.value;
661
+ return dataset;
662
+ }
663
+ };
664
+ }
665
+ /* @__NO_SIDE_EFFECTS__ */
666
+ function description(description_) {
667
+ return {
668
+ kind: "metadata",
669
+ type: "description",
670
+ reference: description,
671
+ description: description_
672
+ };
673
+ }
674
+ /* @__NO_SIDE_EFFECTS__ */
675
+ function returns(schema) {
676
+ return {
677
+ kind: "transformation",
678
+ type: "returns",
679
+ reference: returns,
680
+ async: false,
681
+ schema,
682
+ "~run"(dataset, config2) {
683
+ const func = dataset.value;
684
+ dataset.value = (...args_) => {
685
+ const returnsDataset = this.schema["~run"]({ value: func(...args_) }, config2);
686
+ if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
687
+ return returnsDataset.value;
688
+ };
689
+ return dataset;
690
+ }
691
+ };
692
+ }
693
+ /* @__NO_SIDE_EFFECTS__ */
694
+ function returnsAsync(schema) {
695
+ return {
696
+ kind: "transformation",
697
+ type: "returns",
698
+ reference: returnsAsync,
699
+ async: false,
700
+ schema,
701
+ "~run"(dataset, config2) {
702
+ const func = dataset.value;
703
+ dataset.value = async (...args_) => {
704
+ const returnsDataset = await this.schema["~run"]({ value: await func(...args_) }, config2);
705
+ if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
706
+ return returnsDataset.value;
707
+ };
708
+ return dataset;
709
+ }
710
+ };
711
+ }
712
+ /* @__NO_SIDE_EFFECTS__ */
713
+ function getFallback(schema, dataset, config2) {
714
+ return typeof schema.fallback === "function" ? schema.fallback(dataset, config2) : schema.fallback;
715
+ }
716
+ /* @__NO_SIDE_EFFECTS__ */
717
+ function getDefault(schema, dataset, config2) {
718
+ return typeof schema.default === "function" ? schema.default(dataset, config2) : schema.default;
719
+ }
720
+ /* @__NO_SIDE_EFFECTS__ */
721
+ function any() {
722
+ return {
723
+ kind: "schema",
724
+ type: "any",
725
+ reference: any,
726
+ expects: "any",
727
+ async: false,
728
+ get "~standard"() {
729
+ return /* @__PURE__ */ _getStandardProps(this);
730
+ },
731
+ "~run"(dataset) {
732
+ dataset.typed = true;
733
+ return dataset;
734
+ }
735
+ };
736
+ }
737
+ /* @__NO_SIDE_EFFECTS__ */
738
+ function array(item, message) {
739
+ return {
740
+ kind: "schema",
741
+ type: "array",
742
+ reference: array,
743
+ expects: "Array",
744
+ async: false,
745
+ item,
746
+ message,
747
+ get "~standard"() {
748
+ return /* @__PURE__ */ _getStandardProps(this);
749
+ },
750
+ "~run"(dataset, config2) {
751
+ const input = dataset.value;
752
+ if (Array.isArray(input)) {
753
+ dataset.typed = true;
754
+ dataset.value = [];
755
+ for (let key = 0; key < input.length; key++) {
756
+ const value2 = input[key];
757
+ const itemDataset = this.item["~run"]({ value: value2 }, config2);
758
+ if (itemDataset.issues) {
759
+ const pathItem = {
760
+ type: "array",
761
+ origin: "value",
762
+ input,
763
+ key,
764
+ value: value2
765
+ };
766
+ for (const issue of itemDataset.issues) {
767
+ if (issue.path) issue.path.unshift(pathItem);
768
+ else issue.path = [pathItem];
769
+ dataset.issues?.push(issue);
770
+ }
771
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
772
+ if (config2.abortEarly) {
773
+ dataset.typed = false;
774
+ break;
775
+ }
776
+ }
777
+ if (!itemDataset.typed) dataset.typed = false;
778
+ dataset.value.push(itemDataset.value);
779
+ }
780
+ } else _addIssue(this, "type", dataset, config2);
781
+ return dataset;
782
+ }
783
+ };
784
+ }
785
+ /* @__NO_SIDE_EFFECTS__ */
786
+ function boolean(message) {
787
+ return {
788
+ kind: "schema",
789
+ type: "boolean",
790
+ reference: boolean,
791
+ expects: "boolean",
792
+ async: false,
793
+ message,
794
+ get "~standard"() {
795
+ return /* @__PURE__ */ _getStandardProps(this);
796
+ },
797
+ "~run"(dataset, config2) {
798
+ if (typeof dataset.value === "boolean") dataset.typed = true;
799
+ else _addIssue(this, "type", dataset, config2);
800
+ return dataset;
801
+ }
802
+ };
803
+ }
804
+ /* @__NO_SIDE_EFFECTS__ */
805
+ function custom(check2, message) {
806
+ return {
807
+ kind: "schema",
808
+ type: "custom",
809
+ reference: custom,
810
+ expects: "unknown",
811
+ async: false,
812
+ check: check2,
813
+ message,
814
+ get "~standard"() {
815
+ return /* @__PURE__ */ _getStandardProps(this);
816
+ },
817
+ "~run"(dataset, config2) {
818
+ if (this.check(dataset.value)) dataset.typed = true;
819
+ else _addIssue(this, "type", dataset, config2);
820
+ return dataset;
821
+ }
822
+ };
823
+ }
824
+ /* @__NO_SIDE_EFFECTS__ */
825
+ function enum_(enum__, message) {
826
+ const options = [];
827
+ for (const key in enum__) if (`${+key}` !== key || typeof enum__[key] !== "string" || !Object.is(enum__[enum__[key]], +key)) options.push(enum__[key]);
828
+ return {
829
+ kind: "schema",
830
+ type: "enum",
831
+ reference: enum_,
832
+ expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
833
+ async: false,
834
+ enum: enum__,
835
+ options,
836
+ message,
837
+ get "~standard"() {
838
+ return /* @__PURE__ */ _getStandardProps(this);
839
+ },
840
+ "~run"(dataset, config2) {
841
+ if (this.options.includes(dataset.value)) dataset.typed = true;
842
+ else _addIssue(this, "type", dataset, config2);
843
+ return dataset;
844
+ }
845
+ };
846
+ }
847
+ /* @__NO_SIDE_EFFECTS__ */
848
+ function function_(message) {
849
+ return {
850
+ kind: "schema",
851
+ type: "function",
852
+ reference: function_,
853
+ expects: "Function",
854
+ async: false,
855
+ message,
856
+ get "~standard"() {
857
+ return /* @__PURE__ */ _getStandardProps(this);
858
+ },
859
+ "~run"(dataset, config2) {
860
+ if (typeof dataset.value === "function") dataset.typed = true;
861
+ else _addIssue(this, "type", dataset, config2);
862
+ return dataset;
863
+ }
864
+ };
865
+ }
866
+ /* @__NO_SIDE_EFFECTS__ */
867
+ function instance(class_, message) {
868
+ return {
869
+ kind: "schema",
870
+ type: "instance",
871
+ reference: instance,
872
+ expects: class_.name,
873
+ async: false,
874
+ class: class_,
875
+ message,
876
+ get "~standard"() {
877
+ return /* @__PURE__ */ _getStandardProps(this);
878
+ },
879
+ "~run"(dataset, config2) {
880
+ if (dataset.value instanceof this.class) dataset.typed = true;
881
+ else _addIssue(this, "type", dataset, config2);
882
+ return dataset;
883
+ }
884
+ };
885
+ }
886
+ /* @__NO_SIDE_EFFECTS__ */
887
+ function literal(literal_, message) {
888
+ return {
889
+ kind: "schema",
890
+ type: "literal",
891
+ reference: literal,
892
+ expects: /* @__PURE__ */ _stringify(literal_),
893
+ async: false,
894
+ literal: literal_,
895
+ message,
896
+ get "~standard"() {
897
+ return /* @__PURE__ */ _getStandardProps(this);
898
+ },
899
+ "~run"(dataset, config2) {
900
+ if (dataset.value === this.literal) dataset.typed = true;
901
+ else _addIssue(this, "type", dataset, config2);
902
+ return dataset;
903
+ }
904
+ };
905
+ }
906
+ /* @__NO_SIDE_EFFECTS__ */
907
+ function looseObject(entries, message) {
908
+ return {
909
+ kind: "schema",
910
+ type: "loose_object",
911
+ reference: looseObject,
912
+ expects: "Object",
913
+ async: false,
914
+ entries,
915
+ message,
916
+ get "~standard"() {
917
+ return /* @__PURE__ */ _getStandardProps(this);
918
+ },
919
+ "~run"(dataset, config2) {
920
+ const input = dataset.value;
921
+ if (input && typeof input === "object") {
922
+ dataset.typed = true;
923
+ dataset.value = {};
924
+ for (const key in this.entries) {
925
+ const valueSchema = this.entries[key];
926
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
927
+ const value2 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
928
+ const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
929
+ if (valueDataset.issues) {
930
+ const pathItem = {
931
+ type: "object",
932
+ origin: "value",
933
+ input,
934
+ key,
935
+ value: value2
936
+ };
937
+ for (const issue of valueDataset.issues) {
938
+ if (issue.path) issue.path.unshift(pathItem);
939
+ else issue.path = [pathItem];
940
+ dataset.issues?.push(issue);
941
+ }
942
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
943
+ if (config2.abortEarly) {
944
+ dataset.typed = false;
945
+ break;
946
+ }
947
+ }
948
+ if (!valueDataset.typed) dataset.typed = false;
949
+ dataset.value[key] = valueDataset.value;
950
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
951
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
952
+ _addIssue(this, "key", dataset, config2, {
953
+ input: void 0,
954
+ expected: `"${key}"`,
955
+ path: [{
956
+ type: "object",
957
+ origin: "key",
958
+ input,
959
+ key,
960
+ value: input[key]
961
+ }]
962
+ });
963
+ if (config2.abortEarly) break;
964
+ }
965
+ }
966
+ if (!dataset.issues || !config2.abortEarly) {
967
+ for (const key in input) if (/* @__PURE__ */ _isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
968
+ }
969
+ } else _addIssue(this, "type", dataset, config2);
970
+ return dataset;
971
+ }
972
+ };
973
+ }
974
+ /* @__NO_SIDE_EFFECTS__ */
975
+ function never(message) {
976
+ return {
977
+ kind: "schema",
978
+ type: "never",
979
+ reference: never,
980
+ expects: "never",
981
+ async: false,
982
+ message,
983
+ get "~standard"() {
984
+ return /* @__PURE__ */ _getStandardProps(this);
985
+ },
986
+ "~run"(dataset, config2) {
987
+ _addIssue(this, "type", dataset, config2);
988
+ return dataset;
989
+ }
990
+ };
991
+ }
992
+ /* @__NO_SIDE_EFFECTS__ */
993
+ function nullish(wrapped, default_) {
994
+ return {
995
+ kind: "schema",
996
+ type: "nullish",
997
+ reference: nullish,
998
+ expects: `(${wrapped.expects} | null | undefined)`,
999
+ async: false,
1000
+ wrapped,
1001
+ default: default_,
1002
+ get "~standard"() {
1003
+ return /* @__PURE__ */ _getStandardProps(this);
1004
+ },
1005
+ "~run"(dataset, config2) {
1006
+ if (dataset.value === null || dataset.value === void 0) {
1007
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
1008
+ if (dataset.value === null || dataset.value === void 0) {
1009
+ dataset.typed = true;
1010
+ return dataset;
1011
+ }
1012
+ }
1013
+ return this.wrapped["~run"](dataset, config2);
1014
+ }
1015
+ };
1016
+ }
1017
+ /* @__NO_SIDE_EFFECTS__ */
1018
+ function number(message) {
1019
+ return {
1020
+ kind: "schema",
1021
+ type: "number",
1022
+ reference: number,
1023
+ expects: "number",
1024
+ async: false,
1025
+ message,
1026
+ get "~standard"() {
1027
+ return /* @__PURE__ */ _getStandardProps(this);
1028
+ },
1029
+ "~run"(dataset, config2) {
1030
+ if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
1031
+ else _addIssue(this, "type", dataset, config2);
1032
+ return dataset;
1033
+ }
1034
+ };
1035
+ }
1036
+ /* @__NO_SIDE_EFFECTS__ */
1037
+ function object(entries, message) {
1038
+ return {
1039
+ kind: "schema",
1040
+ type: "object",
1041
+ reference: object,
1042
+ expects: "Object",
1043
+ async: false,
1044
+ entries,
1045
+ message,
1046
+ get "~standard"() {
1047
+ return /* @__PURE__ */ _getStandardProps(this);
1048
+ },
1049
+ "~run"(dataset, config2) {
1050
+ const input = dataset.value;
1051
+ if (input && typeof input === "object") {
1052
+ dataset.typed = true;
1053
+ dataset.value = {};
1054
+ for (const key in this.entries) {
1055
+ const valueSchema = this.entries[key];
1056
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
1057
+ const value2 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
1058
+ const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
1059
+ if (valueDataset.issues) {
1060
+ const pathItem = {
1061
+ type: "object",
1062
+ origin: "value",
1063
+ input,
1064
+ key,
1065
+ value: value2
1066
+ };
1067
+ for (const issue of valueDataset.issues) {
1068
+ if (issue.path) issue.path.unshift(pathItem);
1069
+ else issue.path = [pathItem];
1070
+ dataset.issues?.push(issue);
1071
+ }
1072
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1073
+ if (config2.abortEarly) {
1074
+ dataset.typed = false;
1075
+ break;
1076
+ }
1077
+ }
1078
+ if (!valueDataset.typed) dataset.typed = false;
1079
+ dataset.value[key] = valueDataset.value;
1080
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
1081
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
1082
+ _addIssue(this, "key", dataset, config2, {
1083
+ input: void 0,
1084
+ expected: `"${key}"`,
1085
+ path: [{
1086
+ type: "object",
1087
+ origin: "key",
1088
+ input,
1089
+ key,
1090
+ value: input[key]
1091
+ }]
1092
+ });
1093
+ if (config2.abortEarly) break;
1094
+ }
1095
+ }
1096
+ } else _addIssue(this, "type", dataset, config2);
1097
+ return dataset;
1098
+ }
1099
+ };
1100
+ }
1101
+ /* @__NO_SIDE_EFFECTS__ */
1102
+ function optional(wrapped, default_) {
1103
+ return {
1104
+ kind: "schema",
1105
+ type: "optional",
1106
+ reference: optional,
1107
+ expects: `(${wrapped.expects} | undefined)`,
1108
+ async: false,
1109
+ wrapped,
1110
+ default: default_,
1111
+ get "~standard"() {
1112
+ return /* @__PURE__ */ _getStandardProps(this);
1113
+ },
1114
+ "~run"(dataset, config2) {
1115
+ if (dataset.value === void 0) {
1116
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
1117
+ if (dataset.value === void 0) {
1118
+ dataset.typed = true;
1119
+ return dataset;
1120
+ }
1121
+ }
1122
+ return this.wrapped["~run"](dataset, config2);
1123
+ }
1124
+ };
1125
+ }
1126
+ /* @__NO_SIDE_EFFECTS__ */
1127
+ function promise(message) {
1128
+ return {
1129
+ kind: "schema",
1130
+ type: "promise",
1131
+ reference: promise,
1132
+ expects: "Promise",
1133
+ async: false,
1134
+ message,
1135
+ get "~standard"() {
1136
+ return /* @__PURE__ */ _getStandardProps(this);
1137
+ },
1138
+ "~run"(dataset, config2) {
1139
+ if (dataset.value instanceof Promise) dataset.typed = true;
1140
+ else _addIssue(this, "type", dataset, config2);
1141
+ return dataset;
1142
+ }
1143
+ };
1144
+ }
1145
+ /* @__NO_SIDE_EFFECTS__ */
1146
+ function record(key, value2, message) {
1147
+ return {
1148
+ kind: "schema",
1149
+ type: "record",
1150
+ reference: record,
1151
+ expects: "Object",
1152
+ async: false,
1153
+ key,
1154
+ value: value2,
1155
+ message,
1156
+ get "~standard"() {
1157
+ return /* @__PURE__ */ _getStandardProps(this);
1158
+ },
1159
+ "~run"(dataset, config2) {
1160
+ const input = dataset.value;
1161
+ if (input && typeof input === "object") {
1162
+ dataset.typed = true;
1163
+ dataset.value = {};
1164
+ for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
1165
+ const entryValue = input[entryKey];
1166
+ const keyDataset = this.key["~run"]({ value: entryKey }, config2);
1167
+ if (keyDataset.issues) {
1168
+ const pathItem = {
1169
+ type: "object",
1170
+ origin: "key",
1171
+ input,
1172
+ key: entryKey,
1173
+ value: entryValue
1174
+ };
1175
+ for (const issue of keyDataset.issues) {
1176
+ issue.path = [pathItem];
1177
+ dataset.issues?.push(issue);
1178
+ }
1179
+ if (!dataset.issues) dataset.issues = keyDataset.issues;
1180
+ if (config2.abortEarly) {
1181
+ dataset.typed = false;
1182
+ break;
1183
+ }
1184
+ }
1185
+ const valueDataset = this.value["~run"]({ value: entryValue }, config2);
1186
+ if (valueDataset.issues) {
1187
+ const pathItem = {
1188
+ type: "object",
1189
+ origin: "value",
1190
+ input,
1191
+ key: entryKey,
1192
+ value: entryValue
1193
+ };
1194
+ for (const issue of valueDataset.issues) {
1195
+ if (issue.path) issue.path.unshift(pathItem);
1196
+ else issue.path = [pathItem];
1197
+ dataset.issues?.push(issue);
1198
+ }
1199
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1200
+ if (config2.abortEarly) {
1201
+ dataset.typed = false;
1202
+ break;
1203
+ }
1204
+ }
1205
+ if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
1206
+ if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
1207
+ }
1208
+ } else _addIssue(this, "type", dataset, config2);
1209
+ return dataset;
1210
+ }
1211
+ };
1212
+ }
1213
+ /* @__NO_SIDE_EFFECTS__ */
1214
+ function strictObject(entries, message) {
1215
+ return {
1216
+ kind: "schema",
1217
+ type: "strict_object",
1218
+ reference: strictObject,
1219
+ expects: "Object",
1220
+ async: false,
1221
+ entries,
1222
+ message,
1223
+ get "~standard"() {
1224
+ return /* @__PURE__ */ _getStandardProps(this);
1225
+ },
1226
+ "~run"(dataset, config2) {
1227
+ const input = dataset.value;
1228
+ if (input && typeof input === "object") {
1229
+ dataset.typed = true;
1230
+ dataset.value = {};
1231
+ for (const key in this.entries) {
1232
+ const valueSchema = this.entries[key];
1233
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
1234
+ const value2 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
1235
+ const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
1236
+ if (valueDataset.issues) {
1237
+ const pathItem = {
1238
+ type: "object",
1239
+ origin: "value",
1240
+ input,
1241
+ key,
1242
+ value: value2
1243
+ };
1244
+ for (const issue of valueDataset.issues) {
1245
+ if (issue.path) issue.path.unshift(pathItem);
1246
+ else issue.path = [pathItem];
1247
+ dataset.issues?.push(issue);
1248
+ }
1249
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1250
+ if (config2.abortEarly) {
1251
+ dataset.typed = false;
1252
+ break;
1253
+ }
1254
+ }
1255
+ if (!valueDataset.typed) dataset.typed = false;
1256
+ dataset.value[key] = valueDataset.value;
1257
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
1258
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
1259
+ _addIssue(this, "key", dataset, config2, {
1260
+ input: void 0,
1261
+ expected: `"${key}"`,
1262
+ path: [{
1263
+ type: "object",
1264
+ origin: "key",
1265
+ input,
1266
+ key,
1267
+ value: input[key]
1268
+ }]
1269
+ });
1270
+ if (config2.abortEarly) break;
1271
+ }
1272
+ }
1273
+ if (!dataset.issues || !config2.abortEarly) {
1274
+ for (const key in input) if (!(key in this.entries)) {
1275
+ _addIssue(this, "key", dataset, config2, {
1276
+ input: key,
1277
+ expected: "never",
1278
+ path: [{
1279
+ type: "object",
1280
+ origin: "key",
1281
+ input,
1282
+ key,
1283
+ value: input[key]
1284
+ }]
1285
+ });
1286
+ break;
1287
+ }
1288
+ }
1289
+ } else _addIssue(this, "type", dataset, config2);
1290
+ return dataset;
1291
+ }
1292
+ };
1293
+ }
1294
+ /* @__NO_SIDE_EFFECTS__ */
1295
+ function string(message) {
1296
+ return {
1297
+ kind: "schema",
1298
+ type: "string",
1299
+ reference: string,
1300
+ expects: "string",
1301
+ async: false,
1302
+ message,
1303
+ get "~standard"() {
1304
+ return /* @__PURE__ */ _getStandardProps(this);
1305
+ },
1306
+ "~run"(dataset, config2) {
1307
+ if (typeof dataset.value === "string") dataset.typed = true;
1308
+ else _addIssue(this, "type", dataset, config2);
1309
+ return dataset;
1310
+ }
1311
+ };
1312
+ }
1313
+ /* @__NO_SIDE_EFFECTS__ */
1314
+ function tuple(items, message) {
1315
+ return {
1316
+ kind: "schema",
1317
+ type: "tuple",
1318
+ reference: tuple,
1319
+ expects: "Array",
1320
+ async: false,
1321
+ items,
1322
+ message,
1323
+ get "~standard"() {
1324
+ return /* @__PURE__ */ _getStandardProps(this);
1325
+ },
1326
+ "~run"(dataset, config2) {
1327
+ const input = dataset.value;
1328
+ if (Array.isArray(input)) {
1329
+ dataset.typed = true;
1330
+ dataset.value = [];
1331
+ for (let key = 0; key < this.items.length; key++) {
1332
+ const value2 = input[key];
1333
+ const itemDataset = this.items[key]["~run"]({ value: value2 }, config2);
1334
+ if (itemDataset.issues) {
1335
+ const pathItem = {
1336
+ type: "array",
1337
+ origin: "value",
1338
+ input,
1339
+ key,
1340
+ value: value2
1341
+ };
1342
+ for (const issue of itemDataset.issues) {
1343
+ if (issue.path) issue.path.unshift(pathItem);
1344
+ else issue.path = [pathItem];
1345
+ dataset.issues?.push(issue);
1346
+ }
1347
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
1348
+ if (config2.abortEarly) {
1349
+ dataset.typed = false;
1350
+ break;
1351
+ }
1352
+ }
1353
+ if (!itemDataset.typed) dataset.typed = false;
1354
+ dataset.value.push(itemDataset.value);
1355
+ }
1356
+ } else _addIssue(this, "type", dataset, config2);
1357
+ return dataset;
1358
+ }
1359
+ };
1360
+ }
1361
+ /* @__NO_SIDE_EFFECTS__ */
1362
+ function _subIssues(datasets) {
1363
+ let issues;
1364
+ if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
1365
+ else issues = dataset.issues;
1366
+ return issues;
1367
+ }
1368
+ /* @__NO_SIDE_EFFECTS__ */
1369
+ function union(options, message) {
1370
+ return {
1371
+ kind: "schema",
1372
+ type: "union",
1373
+ reference: union,
1374
+ expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
1375
+ async: false,
1376
+ options,
1377
+ message,
1378
+ get "~standard"() {
1379
+ return /* @__PURE__ */ _getStandardProps(this);
1380
+ },
1381
+ "~run"(dataset, config2) {
1382
+ let validDataset;
1383
+ let typedDatasets;
1384
+ let untypedDatasets;
1385
+ for (const schema of this.options) {
1386
+ const optionDataset = schema["~run"]({ value: dataset.value }, config2);
1387
+ if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
1388
+ else typedDatasets = [optionDataset];
1389
+ else {
1390
+ validDataset = optionDataset;
1391
+ break;
1392
+ }
1393
+ else if (untypedDatasets) untypedDatasets.push(optionDataset);
1394
+ else untypedDatasets = [optionDataset];
1395
+ }
1396
+ if (validDataset) return validDataset;
1397
+ if (typedDatasets) {
1398
+ if (typedDatasets.length === 1) return typedDatasets[0];
1399
+ _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
1400
+ dataset.typed = true;
1401
+ } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
1402
+ else _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
1403
+ return dataset;
1404
+ }
1405
+ };
1406
+ }
1407
+ /* @__NO_SIDE_EFFECTS__ */
1408
+ function unionAsync(options, message) {
1409
+ return {
1410
+ kind: "schema",
1411
+ type: "union",
1412
+ reference: unionAsync,
1413
+ expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
1414
+ async: true,
1415
+ options,
1416
+ message,
1417
+ get "~standard"() {
1418
+ return /* @__PURE__ */ _getStandardProps(this);
1419
+ },
1420
+ async "~run"(dataset, config2) {
1421
+ let validDataset;
1422
+ let typedDatasets;
1423
+ let untypedDatasets;
1424
+ for (const schema of this.options) {
1425
+ const optionDataset = await schema["~run"]({ value: dataset.value }, config2);
1426
+ if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
1427
+ else typedDatasets = [optionDataset];
1428
+ else {
1429
+ validDataset = optionDataset;
1430
+ break;
1431
+ }
1432
+ else if (untypedDatasets) untypedDatasets.push(optionDataset);
1433
+ else untypedDatasets = [optionDataset];
1434
+ }
1435
+ if (validDataset) return validDataset;
1436
+ if (typedDatasets) {
1437
+ if (typedDatasets.length === 1) return typedDatasets[0];
1438
+ _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
1439
+ dataset.typed = true;
1440
+ } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
1441
+ else _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
1442
+ return dataset;
1443
+ }
1444
+ };
1445
+ }
1446
+ /* @__NO_SIDE_EFFECTS__ */
1447
+ function omit(schema, keys) {
1448
+ const entries = { ...schema.entries };
1449
+ for (const key of keys) delete entries[key];
1450
+ return {
1451
+ ...schema,
1452
+ entries,
1453
+ get "~standard"() {
1454
+ return /* @__PURE__ */ _getStandardProps(this);
1455
+ }
1456
+ };
1457
+ }
1458
+ /* @__NO_SIDE_EFFECTS__ */
1459
+ function pipe(...pipe2) {
1460
+ return {
1461
+ ...pipe2[0],
1462
+ pipe: pipe2,
1463
+ get "~standard"() {
1464
+ return /* @__PURE__ */ _getStandardProps(this);
1465
+ },
1466
+ "~run"(dataset, config2) {
1467
+ for (const item of pipe2) if (item.kind !== "metadata") {
1468
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
1469
+ dataset.typed = false;
1470
+ break;
1471
+ }
1472
+ if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) dataset = item["~run"](dataset, config2);
1473
+ }
1474
+ return dataset;
1475
+ }
1476
+ };
1477
+ }
1478
+ /* @__NO_SIDE_EFFECTS__ */
1479
+ function pipeAsync(...pipe2) {
1480
+ return {
1481
+ ...pipe2[0],
1482
+ pipe: pipe2,
1483
+ async: true,
1484
+ get "~standard"() {
1485
+ return /* @__PURE__ */ _getStandardProps(this);
1486
+ },
1487
+ async "~run"(dataset, config2) {
1488
+ for (const item of pipe2) if (item.kind !== "metadata") {
1489
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
1490
+ dataset.typed = false;
1491
+ break;
1492
+ }
1493
+ if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) dataset = await item["~run"](dataset, config2);
1494
+ }
1495
+ return dataset;
1496
+ }
1497
+ };
1498
+ }
1499
+ /* @__NO_SIDE_EFFECTS__ */
1500
+ function safeParse(schema, input, config2) {
1501
+ const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
1502
+ return {
1503
+ typed: dataset.typed,
1504
+ success: !dataset.issues,
1505
+ output: dataset.value,
1506
+ issues: dataset.issues
1507
+ };
1508
+ }
1509
+
546
1510
  //#endregion
547
1511
  //#region src/utils/validator.ts
548
- const StringOrRegExpSchema = v.union([v.string(), v.instance(RegExp)]);
549
- const LogLevelSchema = v.union([
550
- v.literal("debug"),
551
- v.literal("info"),
552
- v.literal("warn")
1512
+ const StringOrRegExpSchema = union([string(), instance(RegExp)]);
1513
+ const LogLevelSchema = union([
1514
+ literal("debug"),
1515
+ literal("info"),
1516
+ literal("warn")
553
1517
  ]);
554
- const LogLevelOptionSchema = v.union([LogLevelSchema, v.literal("silent")]);
555
- const LogLevelWithErrorSchema = v.union([LogLevelSchema, v.literal("error")]);
556
- const RollupLogSchema = v.any();
557
- const RollupLogWithStringSchema = v.union([RollupLogSchema, v.string()]);
558
- const InputOptionSchema = v.union([
559
- v.string(),
560
- v.array(v.string()),
561
- v.record(v.string(), v.string())
1518
+ const LogLevelOptionSchema = union([LogLevelSchema, literal("silent")]);
1519
+ const LogLevelWithErrorSchema = union([LogLevelSchema, literal("error")]);
1520
+ const RollupLogSchema = any();
1521
+ const RollupLogWithStringSchema = union([RollupLogSchema, string()]);
1522
+ const InputOptionSchema = union([
1523
+ string(),
1524
+ array(string()),
1525
+ record(string(), string())
562
1526
  ]);
563
- const ExternalSchema = v.union([
1527
+ const ExternalSchema = union([
564
1528
  StringOrRegExpSchema,
565
- v.array(StringOrRegExpSchema),
566
- v.pipe(v.function(), v.args(v.tuple([
567
- v.string(),
568
- v.optional(v.string()),
569
- v.boolean()
570
- ])), v.returns(v.nullish(v.boolean())))
1529
+ array(StringOrRegExpSchema),
1530
+ pipe(function_(), args(tuple([
1531
+ string(),
1532
+ optional(string()),
1533
+ boolean()
1534
+ ])), returns(nullish(boolean())))
571
1535
  ]);
572
- const ModuleTypesSchema = v.record(v.string(), v.union([
573
- v.literal("base64"),
574
- v.literal("binary"),
575
- v.literal("css"),
576
- v.literal("dataurl"),
577
- v.literal("empty"),
578
- v.literal("js"),
579
- v.literal("json"),
580
- v.literal("jsx"),
581
- v.literal("text"),
582
- v.literal("ts"),
583
- v.literal("tsx")
1536
+ const ModuleTypesSchema = record(string(), union([
1537
+ literal("base64"),
1538
+ literal("binary"),
1539
+ literal("css"),
1540
+ literal("dataurl"),
1541
+ literal("empty"),
1542
+ literal("js"),
1543
+ literal("json"),
1544
+ literal("jsx"),
1545
+ literal("text"),
1546
+ literal("ts"),
1547
+ literal("tsx")
584
1548
  ]));
585
- const JsxOptionsSchema = v.strictObject({
586
- development: v.pipe(v.optional(v.boolean()), v.description("Development specific information")),
587
- factory: v.pipe(v.optional(v.string()), v.description("Jsx element transformation")),
588
- fragment: v.pipe(v.optional(v.string()), v.description("Jsx fragment transformation")),
589
- importSource: v.pipe(v.optional(v.string()), v.description("Import the factory of element and fragment if mode is classic")),
590
- jsxImportSource: v.pipe(v.optional(v.string()), v.description("Import the factory of element and fragment if mode is automatic")),
591
- mode: v.pipe(v.optional(v.union([
592
- v.literal("classic"),
593
- v.literal("automatic"),
594
- v.literal("preserve")
595
- ])), v.description("Jsx transformation mode")),
596
- refresh: v.pipe(v.optional(v.boolean()), v.description("React refresh transformation"))
1549
+ const JsxOptionsSchema = strictObject({
1550
+ development: pipe(optional(boolean()), description("Development specific information")),
1551
+ factory: pipe(optional(string()), description("Jsx element transformation")),
1552
+ fragment: pipe(optional(string()), description("Jsx fragment transformation")),
1553
+ importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
1554
+ jsxImportSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is automatic")),
1555
+ mode: pipe(optional(union([
1556
+ literal("classic"),
1557
+ literal("automatic"),
1558
+ literal("preserve")
1559
+ ])), description("Jsx transformation mode")),
1560
+ refresh: pipe(optional(boolean()), description("React refresh transformation"))
597
1561
  });
598
- const HelperModeSchema = v.union([v.literal("Runtime"), v.literal("External")]);
599
- const DecoratorOptionSchema = v.object({
600
- legacy: v.optional(v.boolean()),
601
- emitDecoratorMetadata: v.optional(v.boolean())
1562
+ const HelperModeSchema = union([literal("Runtime"), literal("External")]);
1563
+ const DecoratorOptionSchema = object({
1564
+ legacy: optional(boolean()),
1565
+ emitDecoratorMetadata: optional(boolean())
602
1566
  });
603
- const HelpersSchema = v.object({ mode: v.optional(HelperModeSchema) });
604
- const RewriteImportExtensionsSchema = v.union([
605
- v.literal("rewrite"),
606
- v.literal("remove"),
607
- v.boolean()
1567
+ const HelpersSchema = object({ mode: optional(HelperModeSchema) });
1568
+ const RewriteImportExtensionsSchema = union([
1569
+ literal("rewrite"),
1570
+ literal("remove"),
1571
+ boolean()
608
1572
  ]);
609
- const TypescriptSchema = v.object({
610
- jsxPragma: v.optional(v.string()),
611
- jsxPragmaFrag: v.optional(v.string()),
612
- onlyRemoveTypeImports: v.optional(v.boolean()),
613
- allowNamespaces: v.optional(v.boolean()),
614
- allowDeclareFields: v.optional(v.boolean()),
615
- declaration: v.optional(v.object({
616
- stripInternal: v.optional(v.boolean()),
617
- sourcemap: v.optional(v.boolean())
1573
+ const TypescriptSchema = object({
1574
+ jsxPragma: optional(string()),
1575
+ jsxPragmaFrag: optional(string()),
1576
+ onlyRemoveTypeImports: optional(boolean()),
1577
+ allowNamespaces: optional(boolean()),
1578
+ allowDeclareFields: optional(boolean()),
1579
+ declaration: optional(object({
1580
+ stripInternal: optional(boolean()),
1581
+ sourcemap: optional(boolean())
618
1582
  })),
619
- rewriteImportExtensions: v.optional(RewriteImportExtensionsSchema)
1583
+ rewriteImportExtensions: optional(RewriteImportExtensionsSchema)
620
1584
  });
621
- const AssumptionsSchema = v.object({
622
- ignoreFunctionLength: v.optional(v.boolean()),
623
- noDocumentAll: v.optional(v.boolean()),
624
- objectRestNoSymbols: v.optional(v.boolean()),
625
- pureGetters: v.optional(v.boolean()),
626
- setPublicClassFields: v.optional(v.boolean())
1585
+ const AssumptionsSchema = object({
1586
+ ignoreFunctionLength: optional(boolean()),
1587
+ noDocumentAll: optional(boolean()),
1588
+ objectRestNoSymbols: optional(boolean()),
1589
+ pureGetters: optional(boolean()),
1590
+ setPublicClassFields: optional(boolean())
627
1591
  });
628
- const TransformOptionsSchema = v.object({
629
- assumptions: v.optional(AssumptionsSchema),
630
- typescript: v.optional(TypescriptSchema),
631
- helpers: v.optional(HelpersSchema),
632
- decorators: v.optional(DecoratorOptionSchema)
1592
+ const TransformOptionsSchema = object({
1593
+ assumptions: optional(AssumptionsSchema),
1594
+ typescript: optional(TypescriptSchema),
1595
+ helpers: optional(HelpersSchema),
1596
+ decorators: optional(DecoratorOptionSchema)
633
1597
  });
634
- const WatchOptionsSchema = v.strictObject({
635
- chokidar: v.optional(v.never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
636
- exclude: v.optional(v.union([StringOrRegExpSchema, v.array(StringOrRegExpSchema)])),
637
- include: v.optional(v.union([StringOrRegExpSchema, v.array(StringOrRegExpSchema)])),
638
- notify: v.pipe(v.optional(v.strictObject({
639
- compareContents: v.optional(v.boolean()),
640
- pollInterval: v.optional(v.number())
641
- })), v.description("Notify options")),
642
- skipWrite: v.pipe(v.optional(v.boolean()), v.description("Skip the bundle.write() step")),
643
- buildDelay: v.pipe(v.optional(v.number()), v.description("Throttle watch rebuilds"))
1598
+ const WatchOptionsSchema = strictObject({
1599
+ chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
1600
+ exclude: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
1601
+ include: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
1602
+ notify: pipe(optional(strictObject({
1603
+ compareContents: optional(boolean()),
1604
+ pollInterval: optional(number())
1605
+ })), description("Notify options")),
1606
+ skipWrite: pipe(optional(boolean()), description("Skip the bundle.write() step")),
1607
+ buildDelay: pipe(optional(number()), description("Throttle watch rebuilds"))
644
1608
  });
645
- const ChecksOptionsSchema = v.strictObject({
646
- circularDependency: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting circular dependency")),
647
- eval: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting eval")),
648
- missingGlobalName: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting missing global name")),
649
- missingNameOptionForIifeExport: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting missing name option for iife export")),
650
- mixedExport: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting mixed export")),
651
- unresolvedEntry: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting unresolved entry")),
652
- unresolvedImport: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting unresolved import")),
653
- filenameConflict: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting filename conflict")),
654
- commonJsVariableInEsm: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting common js variable in esm")),
655
- importIsUndefined: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting import is undefined")),
656
- configurationFieldConflict: v.pipe(v.optional(v.boolean()), v.description("Whether to emit warning when detecting configuration field conflict"))
1609
+ const ChecksOptionsSchema = strictObject({
1610
+ circularDependency: pipe(optional(boolean()), description("Whether to emit warning when detecting circular dependency")),
1611
+ eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
1612
+ missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
1613
+ missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
1614
+ mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
1615
+ unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
1616
+ unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
1617
+ filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
1618
+ commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
1619
+ importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
1620
+ configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
657
1621
  });
658
- const MinifyOptionsSchema = v.strictObject({
659
- mangle: v.optional(v.boolean()),
660
- compress: v.optional(v.boolean()),
661
- removeWhitespace: v.optional(v.boolean())
1622
+ const MinifyOptionsSchema = strictObject({
1623
+ mangle: optional(boolean()),
1624
+ compress: optional(boolean()),
1625
+ removeWhitespace: optional(boolean())
662
1626
  });
663
- const ResolveOptionsSchema = v.strictObject({
664
- alias: v.optional(v.record(v.string(), v.union([v.string(), v.array(v.string())]))),
665
- aliasFields: v.optional(v.array(v.array(v.string()))),
666
- conditionNames: v.optional(v.array(v.string())),
667
- extensionAlias: v.optional(v.record(v.string(), v.array(v.string()))),
668
- exportsFields: v.optional(v.array(v.array(v.string()))),
669
- extensions: v.optional(v.array(v.string())),
670
- mainFields: v.optional(v.array(v.string())),
671
- mainFiles: v.optional(v.array(v.string())),
672
- modules: v.optional(v.array(v.string())),
673
- symlinks: v.optional(v.boolean()),
674
- tsconfigFilename: v.optional(v.string())
1627
+ const ResolveOptionsSchema = strictObject({
1628
+ alias: optional(record(string(), union([string(), array(string())]))),
1629
+ aliasFields: optional(array(array(string()))),
1630
+ conditionNames: optional(array(string())),
1631
+ extensionAlias: optional(record(string(), array(string()))),
1632
+ exportsFields: optional(array(array(string()))),
1633
+ extensions: optional(array(string())),
1634
+ mainFields: optional(array(string())),
1635
+ mainFiles: optional(array(string())),
1636
+ modules: optional(array(string())),
1637
+ symlinks: optional(boolean()),
1638
+ tsconfigFilename: optional(string())
675
1639
  });
676
- const TreeshakingOptionsSchema = v.union([v.boolean(), v.looseObject({
677
- annotations: v.optional(v.boolean()),
678
- manualPureFunctions: v.optional(v.array(v.string())),
679
- unknownGlobalSideEffects: v.optional(v.boolean())
1640
+ const TreeshakingOptionsSchema = union([boolean(), looseObject({
1641
+ annotations: optional(boolean()),
1642
+ manualPureFunctions: optional(array(string())),
1643
+ unknownGlobalSideEffects: optional(boolean())
680
1644
  })]);
681
- const OnLogSchema = v.pipe(v.function(), v.args(v.tuple([
1645
+ const OnLogSchema = pipe(function_(), args(tuple([
682
1646
  LogLevelSchema,
683
1647
  RollupLogSchema,
684
- v.pipe(v.function(), v.args(v.tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
1648
+ pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
685
1649
  ])));
686
- const 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))])])))])));
687
- const HmrSchema = v.union([v.boolean(), v.strictObject({
688
- port: v.optional(v.number()),
689
- host: v.optional(v.string()),
690
- implement: v.optional(v.string())
1650
+ const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
1651
+ const HmrSchema = union([boolean(), strictObject({
1652
+ port: optional(number()),
1653
+ host: optional(string()),
1654
+ implement: optional(string())
691
1655
  })]);
692
- const InputOptionsSchema = v.strictObject({
693
- input: v.optional(InputOptionSchema),
694
- plugins: v.optional(v.custom(() => true)),
695
- external: v.optional(ExternalSchema),
696
- resolve: v.optional(ResolveOptionsSchema),
697
- cwd: v.pipe(v.optional(v.string()), v.description("Current working directory")),
698
- platform: v.pipe(v.optional(v.union([
699
- v.literal("browser"),
700
- v.literal("neutral"),
701
- v.literal("node")
702
- ])), v.description(`Platform for which the code should be generated (node, ${colors.underline("browser")}, neutral)`)),
703
- shimMissingExports: v.pipe(v.optional(v.boolean()), v.description("Create shim variables for missing exports")),
704
- treeshake: v.optional(TreeshakingOptionsSchema),
705
- logLevel: v.pipe(v.optional(LogLevelOptionSchema), v.description(`Log level (${colors.dim("silent")}, ${colors.underline(colors.gray("info"))}, debug, ${colors.yellow("warn")})`)),
706
- onLog: v.optional(OnLogSchema),
707
- onwarn: v.optional(OnwarnSchema),
708
- moduleTypes: v.pipe(v.optional(ModuleTypesSchema), v.description("Module types for customized extensions")),
709
- experimental: v.optional(v.strictObject({
710
- disableLiveBindings: v.optional(v.boolean()),
711
- enableComposingJsPlugins: v.optional(v.boolean()),
712
- resolveNewUrlToAsset: v.optional(v.boolean()),
713
- strictExecutionOrder: v.optional(v.boolean()),
714
- hmr: v.optional(HmrSchema)
1656
+ const InputOptionsSchema = strictObject({
1657
+ input: optional(InputOptionSchema),
1658
+ plugins: optional(custom(() => true)),
1659
+ external: optional(ExternalSchema),
1660
+ resolve: optional(ResolveOptionsSchema),
1661
+ cwd: pipe(optional(string()), description("Current working directory")),
1662
+ platform: pipe(optional(union([
1663
+ literal("browser"),
1664
+ literal("neutral"),
1665
+ literal("node")
1666
+ ])), description(`Platform for which the code should be generated (node, ${colors.underline("browser")}, neutral)`)),
1667
+ shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
1668
+ treeshake: optional(TreeshakingOptionsSchema),
1669
+ logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${colors.dim("silent")}, ${colors.underline(colors.gray("info"))}, debug, ${colors.yellow("warn")})`)),
1670
+ onLog: optional(OnLogSchema),
1671
+ onwarn: optional(OnwarnSchema),
1672
+ moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
1673
+ experimental: optional(strictObject({
1674
+ disableLiveBindings: optional(boolean()),
1675
+ enableComposingJsPlugins: optional(boolean()),
1676
+ resolveNewUrlToAsset: optional(boolean()),
1677
+ strictExecutionOrder: optional(boolean()),
1678
+ hmr: optional(HmrSchema)
715
1679
  })),
716
- define: v.pipe(v.optional(v.record(v.string(), v.string())), v.description("Define global variables")),
717
- inject: v.optional(v.record(v.string(), v.union([v.string(), v.tuple([v.string(), v.string()])]))),
718
- profilerNames: v.optional(v.boolean()),
719
- jsx: v.optional(v.union([
720
- v.boolean(),
1680
+ define: pipe(optional(record(string(), string())), description("Define global variables")),
1681
+ inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
1682
+ profilerNames: optional(boolean()),
1683
+ jsx: optional(union([
1684
+ boolean(),
721
1685
  JsxOptionsSchema,
722
- v.string("react"),
723
- v.string("react-jsx"),
724
- v.string("preserve")
1686
+ string("react"),
1687
+ string("react-jsx"),
1688
+ string("preserve")
725
1689
  ])),
726
- transform: v.optional(TransformOptionsSchema),
727
- watch: v.optional(v.union([WatchOptionsSchema, v.literal(false)])),
728
- dropLabels: v.pipe(v.optional(v.array(v.string())), v.description("Remove labeled statements with these label names")),
729
- checks: v.optional(ChecksOptionsSchema),
730
- keepNames: v.pipe(v.optional(v.boolean()), v.description("Keep function/class name")),
731
- 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."))
1690
+ transform: optional(TransformOptionsSchema),
1691
+ watch: optional(union([WatchOptionsSchema, literal(false)])),
1692
+ dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
1693
+ checks: optional(ChecksOptionsSchema),
1694
+ keepNames: pipe(optional(boolean()), description("Keep function/class name")),
1695
+ 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."))
732
1696
  });
733
- const InputCliOverrideSchema = v.strictObject({
734
- input: v.pipe(v.optional(v.array(v.string())), v.description("Entry file")),
735
- external: v.pipe(v.optional(v.array(v.string())), v.description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
736
- inject: v.pipe(v.optional(v.record(v.string(), v.string())), v.description("Inject import statements on demand")),
737
- treeshake: v.pipe(v.optional(v.boolean()), v.description("enable treeshaking")),
738
- jsx: v.pipe(v.optional(JsxOptionsSchema), v.description("enable jsx"))
1697
+ const InputCliOverrideSchema = strictObject({
1698
+ input: pipe(optional(array(string())), description("Entry file")),
1699
+ external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
1700
+ inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
1701
+ treeshake: pipe(optional(boolean()), description("enable treeshaking")),
1702
+ jsx: pipe(optional(JsxOptionsSchema), description("enable jsx"))
739
1703
  });
740
- const InputCliOptionsSchema = v.omit(v.strictObject({
1704
+ const InputCliOptionsSchema = omit(strictObject({
741
1705
  ...InputOptionsSchema.entries,
742
1706
  ...InputCliOverrideSchema.entries
743
1707
  }), [
@@ -764,87 +1728,87 @@ var ESTarget = /* @__PURE__ */ function(ESTarget$1) {
764
1728
  ESTarget$1["ESNext"] = "esnext";
765
1729
  return ESTarget$1;
766
1730
  }(ESTarget || {});
767
- const ModuleFormatSchema = v.union([
768
- v.literal("es"),
769
- v.literal("cjs"),
770
- v.literal("esm"),
771
- v.literal("module"),
772
- v.literal("commonjs"),
773
- v.literal("iife"),
774
- v.literal("umd")
1731
+ const ModuleFormatSchema = union([
1732
+ literal("es"),
1733
+ literal("cjs"),
1734
+ literal("esm"),
1735
+ literal("module"),
1736
+ literal("commonjs"),
1737
+ literal("iife"),
1738
+ literal("umd")
775
1739
  ]);
776
- const 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())])));
777
- const ChunkFileNamesSchema = v.union([v.string(), v.pipe(v.function(), v.args(v.tuple([v.custom(() => true)])), v.returns(v.string()))]);
778
- const AssetFileNamesSchema = v.union([v.string(), v.pipe(v.function(), v.args(v.tuple([v.custom(() => true)])), v.returns(v.string()))]);
779
- const SanitizeFileNameSchema = v.union([v.boolean(), v.pipe(v.function(), v.args(v.tuple([v.string()])), v.returns(v.string()))]);
780
- const GlobalsFunctionSchema = v.pipe(v.function(), v.args(v.tuple([v.string()])), v.returns(v.string()));
781
- const AdvancedChunksSchema = v.strictObject({
782
- minSize: v.optional(v.number()),
783
- maxSize: v.optional(v.number()),
784
- minModuleSize: v.optional(v.number()),
785
- maxModuleSize: v.optional(v.number()),
786
- minShareCount: v.optional(v.number()),
787
- groups: v.optional(v.array(v.strictObject({
788
- name: v.string(),
789
- test: v.optional(v.union([v.string(), v.instance(RegExp)])),
790
- priority: v.optional(v.number()),
791
- minSize: v.optional(v.number()),
792
- minShareCount: v.optional(v.number()),
793
- maxSize: v.optional(v.number()),
794
- minModuleSize: v.optional(v.number()),
795
- maxModuleSize: v.optional(v.number())
1740
+ const AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
1741
+ const ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
1742
+ const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
1743
+ const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
1744
+ const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
1745
+ const AdvancedChunksSchema = strictObject({
1746
+ minSize: optional(number()),
1747
+ maxSize: optional(number()),
1748
+ minModuleSize: optional(number()),
1749
+ maxModuleSize: optional(number()),
1750
+ minShareCount: optional(number()),
1751
+ groups: optional(array(strictObject({
1752
+ name: string(),
1753
+ test: optional(union([string(), instance(RegExp)])),
1754
+ priority: optional(number()),
1755
+ minSize: optional(number()),
1756
+ minShareCount: optional(number()),
1757
+ maxSize: optional(number()),
1758
+ minModuleSize: optional(number()),
1759
+ maxModuleSize: optional(number())
796
1760
  })))
797
1761
  });
798
- const OutputOptionsSchema = v.strictObject({
799
- dir: v.pipe(v.optional(v.string()), v.description("Output directory, defaults to `dist` if `file` is not set")),
800
- file: v.pipe(v.optional(v.string()), v.description("Single output file")),
801
- exports: v.pipe(v.optional(v.union([
802
- v.literal("auto"),
803
- v.literal("named"),
804
- v.literal("default"),
805
- v.literal("none")
806
- ])), v.description(`Specify a export mode (${colors.underline("auto")}, named, default, none)`)),
807
- hashCharacters: v.pipe(v.optional(v.union([
808
- v.literal("base64"),
809
- v.literal("base36"),
810
- v.literal("hex")
811
- ])), v.description("Use the specified character set for file hashes")),
812
- format: v.pipe(v.optional(ModuleFormatSchema), v.description(`Output format of the generated bundle (supports ${colors.underline("esm")}, cjs, and iife)`)),
813
- sourcemap: v.pipe(v.optional(v.union([
814
- v.boolean(),
815
- v.literal("inline"),
816
- v.literal("hidden")
817
- ])), 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")})`)),
818
- sourcemapDebugIds: v.pipe(v.optional(v.boolean()), v.description("Inject sourcemap debug IDs")),
819
- sourcemapIgnoreList: v.optional(v.union([v.boolean(), v.custom(() => true)])),
820
- sourcemapPathTransform: v.optional(v.custom(() => true)),
821
- banner: v.optional(v.union([v.string(), AddonFunctionSchema])),
822
- footer: v.optional(v.union([v.string(), AddonFunctionSchema])),
823
- intro: v.optional(v.union([v.string(), AddonFunctionSchema])),
824
- outro: v.optional(v.union([v.string(), AddonFunctionSchema])),
825
- extend: v.pipe(v.optional(v.boolean()), v.description("Extend global variable defined by name in IIFE / UMD formats")),
826
- esModule: v.optional(v.union([v.boolean(), v.literal("if-default-prop")])),
827
- assetFileNames: v.optional(AssetFileNamesSchema),
828
- entryFileNames: v.optional(ChunkFileNamesSchema),
829
- chunkFileNames: v.optional(ChunkFileNamesSchema),
830
- cssEntryFileNames: v.optional(ChunkFileNamesSchema),
831
- cssChunkFileNames: v.optional(ChunkFileNamesSchema),
832
- sanitizeFileName: v.optional(SanitizeFileNameSchema),
833
- minify: v.pipe(v.optional(v.union([
834
- v.boolean(),
835
- v.string("dce-only"),
1762
+ const OutputOptionsSchema = strictObject({
1763
+ dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
1764
+ file: pipe(optional(string()), description("Single output file")),
1765
+ exports: pipe(optional(union([
1766
+ literal("auto"),
1767
+ literal("named"),
1768
+ literal("default"),
1769
+ literal("none")
1770
+ ])), description(`Specify a export mode (${colors.underline("auto")}, named, default, none)`)),
1771
+ hashCharacters: pipe(optional(union([
1772
+ literal("base64"),
1773
+ literal("base36"),
1774
+ literal("hex")
1775
+ ])), description("Use the specified character set for file hashes")),
1776
+ format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${colors.underline("esm")}, cjs, and iife)`)),
1777
+ sourcemap: pipe(optional(union([
1778
+ boolean(),
1779
+ literal("inline"),
1780
+ literal("hidden")
1781
+ ])), description(`Generate sourcemap (\`-s inline\` for inline, or ${colors.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
1782
+ sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
1783
+ sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
1784
+ sourcemapPathTransform: optional(custom(() => true)),
1785
+ banner: optional(union([string(), AddonFunctionSchema])),
1786
+ footer: optional(union([string(), AddonFunctionSchema])),
1787
+ intro: optional(union([string(), AddonFunctionSchema])),
1788
+ outro: optional(union([string(), AddonFunctionSchema])),
1789
+ extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
1790
+ esModule: optional(union([boolean(), literal("if-default-prop")])),
1791
+ assetFileNames: optional(AssetFileNamesSchema),
1792
+ entryFileNames: optional(ChunkFileNamesSchema),
1793
+ chunkFileNames: optional(ChunkFileNamesSchema),
1794
+ cssEntryFileNames: optional(ChunkFileNamesSchema),
1795
+ cssChunkFileNames: optional(ChunkFileNamesSchema),
1796
+ sanitizeFileName: optional(SanitizeFileNameSchema),
1797
+ minify: pipe(optional(union([
1798
+ boolean(),
1799
+ string("dce-only"),
836
1800
  MinifyOptionsSchema
837
- ])), v.description("Minify the bundled file")),
838
- name: v.pipe(v.optional(v.string()), v.description("Name for UMD / IIFE format outputs")),
839
- 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`)")),
840
- externalLiveBindings: v.pipe(v.optional(v.boolean()), v.description("external live bindings")),
841
- inlineDynamicImports: v.pipe(v.optional(v.boolean()), v.description("Inline dynamic imports")),
842
- advancedChunks: v.optional(AdvancedChunksSchema),
843
- comments: v.pipe(v.optional(v.union([v.literal("none"), v.literal("preserve-legal")])), v.description("Control comments in the output")),
844
- plugins: v.optional(v.custom(() => true)),
845
- polyfillRequire: v.pipe(v.optional(v.boolean()), v.description("Disable require polyfill injection")),
846
- target: v.pipe(v.optional(v.enum(ESTarget)), v.description("The JavaScript target environment")),
847
- hoistTransitiveImports: v.optional(v.custom((input) => {
1801
+ ])), description("Minify the bundled file")),
1802
+ name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
1803
+ globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
1804
+ externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
1805
+ inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
1806
+ advancedChunks: optional(AdvancedChunksSchema),
1807
+ comments: pipe(optional(union([literal("none"), literal("preserve-legal")])), description("Control comments in the output")),
1808
+ plugins: optional(custom(() => true)),
1809
+ polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
1810
+ target: pipe(optional(enum_(ESTarget)), description("The JavaScript target environment")),
1811
+ hoistTransitiveImports: optional(custom((input) => {
848
1812
  if (input) return false;
849
1813
  return true;
850
1814
  }, () => `The 'true' value is not supported`))
@@ -852,26 +1816,26 @@ const OutputOptionsSchema = v.strictObject({
852
1816
  const getAddonDescription = (placement, wrapper) => {
853
1817
  return `Code to insert the ${colors.bold(placement)} of the bundled file (${colors.bold(wrapper)} the wrapper function)`;
854
1818
  };
855
- const OutputCliOverrideSchema = v.strictObject({
856
- assetFileNames: v.pipe(v.optional(v.string()), v.description("Name pattern for asset files")),
857
- entryFileNames: v.pipe(v.optional(v.string()), v.description("Name pattern for emitted entry chunks")),
858
- chunkFileNames: v.pipe(v.optional(v.string()), v.description("Name pattern for emitted secondary chunks")),
859
- cssEntryFileNames: v.pipe(v.optional(v.string()), v.description("Name pattern for emitted css entry chunks")),
860
- cssChunkFileNames: v.pipe(v.optional(v.string()), v.description("Name pattern for emitted css secondary chunks")),
861
- sanitizeFileName: v.pipe(v.optional(v.boolean()), v.description("Sanitize file name")),
862
- banner: v.pipe(v.optional(v.string()), v.description(getAddonDescription("top", "outside"))),
863
- footer: v.pipe(v.optional(v.string()), v.description(getAddonDescription("bottom", "outside"))),
864
- intro: v.pipe(v.optional(v.string()), v.description(getAddonDescription("top", "inside"))),
865
- outro: v.pipe(v.optional(v.string()), v.description(getAddonDescription("bottom", "inside"))),
866
- 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)")),
867
- globals: v.pipe(v.optional(v.record(v.string(), v.string())), v.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
868
- advancedChunks: v.pipe(v.optional(v.strictObject({
869
- minSize: v.pipe(v.optional(v.number()), v.description("Minimum size of the chunk")),
870
- minShareCount: v.pipe(v.optional(v.number()), v.description("Minimum share count of the chunk"))
871
- })), v.description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
872
- minify: v.pipe(v.optional(v.boolean()), v.description("Minify the bundled file"))
1819
+ const OutputCliOverrideSchema = strictObject({
1820
+ assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
1821
+ entryFileNames: pipe(optional(string()), description("Name pattern for emitted entry chunks")),
1822
+ chunkFileNames: pipe(optional(string()), description("Name pattern for emitted secondary chunks")),
1823
+ cssEntryFileNames: pipe(optional(string()), description("Name pattern for emitted css entry chunks")),
1824
+ cssChunkFileNames: pipe(optional(string()), description("Name pattern for emitted css secondary chunks")),
1825
+ sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
1826
+ banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
1827
+ footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
1828
+ intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
1829
+ outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
1830
+ esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
1831
+ globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
1832
+ advancedChunks: pipe(optional(strictObject({
1833
+ minSize: pipe(optional(number()), description("Minimum size of the chunk")),
1834
+ minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
1835
+ })), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
1836
+ minify: pipe(optional(boolean()), description("Minify the bundled file"))
873
1837
  });
874
- const OutputCliOptionsSchema = v.omit(v.strictObject({
1838
+ const OutputCliOptionsSchema = omit(strictObject({
875
1839
  ...OutputOptionsSchema.entries,
876
1840
  ...OutputCliOverrideSchema.entries
877
1841
  }), [
@@ -880,11 +1844,11 @@ const OutputCliOptionsSchema = v.omit(v.strictObject({
880
1844
  "plugins",
881
1845
  "hoistTransitiveImports"
882
1846
  ]);
883
- const CliOptionsSchema = v.strictObject({
884
- config: v.pipe(v.optional(v.union([v.string(), v.boolean()])), v.description("Path to the config file (default: `rolldown.config.js`)")),
885
- help: v.pipe(v.optional(v.boolean()), v.description("Show help")),
886
- version: v.pipe(v.optional(v.boolean()), v.description("Show version number")),
887
- watch: v.pipe(v.optional(v.boolean()), v.description("Watch files in bundle and rebuild on changes")),
1847
+ const CliOptionsSchema = strictObject({
1848
+ config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
1849
+ help: pipe(optional(boolean()), description("Show help")),
1850
+ version: pipe(optional(boolean()), description("Show version number")),
1851
+ watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
888
1852
  ...InputCliOptionsSchema.entries,
889
1853
  ...OutputCliOptionsSchema.entries
890
1854
  });
@@ -892,7 +1856,7 @@ const inputHelperMsgRecord = { output: { ignored: true } };
892
1856
  const outputHelperMsgRecord = {};
893
1857
  function validateOption(key, options) {
894
1858
  if (globalThis.process?.env?.ROLLDOWN_OPTIONS_VALIDATION === "loose") return;
895
- let parsed = v.safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
1859
+ let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
896
1860
  if (!parsed.success) {
897
1861
  const errors = parsed.issues.map((issue) => {
898
1862
  const issuePaths = issue.path.map((path$1) => path$1.key);
@@ -1047,9 +2011,9 @@ function bindingifySideEffects(sideEffects) {
1047
2011
 
1048
2012
  //#endregion
1049
2013
  //#region src/utils/transform-sourcemap.ts
1050
- function isEmptySourcemapFiled(array) {
1051
- if (!array) return true;
1052
- if (array.length === 0 || !array[0]) return true;
2014
+ function isEmptySourcemapFiled(array$1) {
2015
+ if (!array$1) return true;
2016
+ if (array$1.length === 0 || !array$1[0]) return true;
1053
2017
  return false;
1054
2018
  }
1055
2019
  function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
@@ -1097,68 +2061,104 @@ function t(...n) {
1097
2061
  }
1098
2062
 
1099
2063
  //#endregion
1100
- //#region src/filter-expression-index.ts
1101
- function and(left, right) {
1102
- return {
1103
- kind: "and",
1104
- left,
1105
- right
1106
- };
2064
+ //#region src/filter-index.ts
2065
+ var And = class {
2066
+ kind;
2067
+ args;
2068
+ constructor(...args$1) {
2069
+ if (args$1.length === 0) throw new Error("`And` expects at least one operand");
2070
+ this.args = args$1;
2071
+ this.kind = "and";
2072
+ }
2073
+ };
2074
+ var Or = class {
2075
+ kind;
2076
+ args;
2077
+ constructor(...args$1) {
2078
+ if (args$1.length === 0) throw new Error("`Or` expects at least one operand");
2079
+ this.args = args$1;
2080
+ this.kind = "or";
2081
+ }
2082
+ };
2083
+ var Id = class {
2084
+ kind;
2085
+ pattern;
2086
+ constructor(pattern) {
2087
+ this.pattern = pattern;
2088
+ this.kind = "id";
2089
+ }
2090
+ };
2091
+ var ModuleType = class {
2092
+ kind;
2093
+ pattern;
2094
+ constructor(pattern) {
2095
+ this.pattern = pattern;
2096
+ this.kind = "moduleType";
2097
+ }
2098
+ };
2099
+ var Code = class {
2100
+ kind;
2101
+ pattern;
2102
+ constructor(expr) {
2103
+ this.pattern = expr;
2104
+ this.kind = "code";
2105
+ }
2106
+ };
2107
+ var Include = class {
2108
+ kind;
2109
+ expr;
2110
+ constructor(expr) {
2111
+ this.expr = expr;
2112
+ this.kind = "include";
2113
+ }
2114
+ };
2115
+ var Exclude = class {
2116
+ kind;
2117
+ expr;
2118
+ constructor(expr) {
2119
+ this.expr = expr;
2120
+ this.kind = "exclude";
2121
+ }
2122
+ };
2123
+ function and(...args$1) {
2124
+ return new And(...args$1);
1107
2125
  }
1108
- function or(left, right) {
1109
- return {
1110
- kind: "or",
1111
- left,
1112
- right
1113
- };
2126
+ function or(...args$1) {
2127
+ return new Or(...args$1);
1114
2128
  }
1115
2129
  function id(pattern) {
1116
- return {
1117
- kind: "id",
1118
- pattern
1119
- };
2130
+ return new Id(pattern);
1120
2131
  }
1121
2132
  function moduleType(pattern) {
1122
- return {
1123
- kind: "moduleType",
1124
- pattern
1125
- };
2133
+ return new ModuleType(pattern);
1126
2134
  }
1127
2135
  function code(pattern) {
1128
- return {
1129
- kind: "code",
1130
- pattern
1131
- };
2136
+ return new Code(pattern);
1132
2137
  }
1133
2138
  function include(expr) {
1134
- return {
1135
- kind: "include",
1136
- expr
1137
- };
2139
+ return new Include(expr);
1138
2140
  }
1139
2141
  function exclude(expr) {
1140
- return {
1141
- kind: "exclude",
1142
- expr
1143
- };
2142
+ return new Exclude(expr);
1144
2143
  }
1145
2144
 
1146
2145
  //#endregion
1147
2146
  //#region src/plugin/bindingify-hook-filter.ts
1148
2147
  function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
1149
- if (typeof matcher === "string" || matcher instanceof RegExp) return [include(id(matcher))];
1150
- if (Array.isArray(matcher)) return matcher.map((m) => include(id(m)));
1151
- if (matcher.custom) return matcher.custom;
2148
+ if (typeof matcher === "string" || matcher instanceof RegExp) return [include(generateAtomMatcher(stringKind, matcher))];
2149
+ if (Array.isArray(matcher)) return matcher.map((m) => include(generateAtomMatcher(stringKind, m)));
1152
2150
  let ret = [];
1153
- let isCode = stringKind === "code";
1154
- if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m) => exclude(isCode ? code(m) : id(m))));
1155
- if (matcher.include) ret.push(...arraify(matcher.include).map((m) => include(isCode ? code(m) : id(m))));
2151
+ if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m) => exclude(generateAtomMatcher(stringKind, m))));
2152
+ if (matcher.include) ret.push(...arraify(matcher.include).map((m) => include(generateAtomMatcher(stringKind, m))));
1156
2153
  return ret;
1157
2154
  }
2155
+ function generateAtomMatcher(kind, matcher) {
2156
+ return kind === "code" ? code(matcher) : id(matcher);
2157
+ }
1158
2158
  function transformFilterMatcherToFilterExprs(filterOption) {
1159
2159
  if (!filterOption) return void 0;
1160
- const { id: id$1, code: code$1, moduleType: moduleType$1, custom } = filterOption;
1161
- if (custom) return custom;
2160
+ if (Array.isArray(filterOption)) return filterOption;
2161
+ const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
1162
2162
  let ret = [];
1163
2163
  let idIncludes = [];
1164
2164
  let idExcludes = [];
@@ -1168,33 +2168,21 @@ function transformFilterMatcherToFilterExprs(filterOption) {
1168
2168
  if (code$1) [codeIncludes, codeExcludes] = d(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m) => m.kind === "include");
1169
2169
  ret.push(...idExcludes);
1170
2170
  ret.push(...codeExcludes);
1171
- let cursor;
2171
+ let andExprList = [];
1172
2172
  if (moduleType$1) {
1173
2173
  let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
1174
- cursor = joinFilterExprsWithOr(moduleTypes.map((m) => moduleType(m)));
2174
+ andExprList.push(or(...moduleTypes.map((m) => moduleType(m))));
1175
2175
  }
1176
- if (idIncludes.length) {
1177
- let joinedOrExpr = joinFilterExprsWithOr(idIncludes.map((item) => item.expr));
1178
- if (!cursor) cursor = joinedOrExpr;
1179
- else cursor = and(cursor, joinedOrExpr);
1180
- }
1181
- if (codeIncludes.length) {
1182
- let joinedOrExpr = joinFilterExprsWithOr(codeIncludes.map((item) => item.expr));
1183
- if (!cursor) cursor = joinedOrExpr;
1184
- else cursor = and(cursor, joinedOrExpr);
1185
- }
1186
- if (cursor) ret.push(include(cursor));
2176
+ if (idIncludes.length) andExprList.push(or(...idIncludes.map((item) => item.expr)));
2177
+ if (codeIncludes.length) andExprList.push(or(...codeIncludes.map((item) => item.expr)));
2178
+ if (andExprList.length) ret.push(include(and(...andExprList)));
1187
2179
  return ret;
1188
2180
  }
1189
- function joinFilterExprsWithOr(filterExprs) {
1190
- if (filterExprs.length === 1) return filterExprs[0];
1191
- return or(filterExprs[0], joinFilterExprsWithOr(filterExprs.slice(1)));
1192
- }
1193
- function bindingifyGeneralHookFilter(matcher, stringKind) {
1194
- let filterExprs = generalHookFilterMatcherToFilterExprs(matcher, stringKind);
1195
- let custom = [];
1196
- if (filterExprs) custom = filterExprs.map(bindingifyFilterExpr);
1197
- return { custom: custom.length > 0 ? custom : void 0 };
2181
+ function bindingifyGeneralHookFilter(stringKind, pattern) {
2182
+ let filterExprs = generalHookFilterMatcherToFilterExprs(pattern, stringKind);
2183
+ let ret = [];
2184
+ if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
2185
+ return ret.length > 0 ? { value: ret } : void 0;
1198
2186
  }
1199
2187
  function bindingifyFilterExpr(expr) {
1200
2188
  let list = [];
@@ -1204,9 +2192,21 @@ function bindingifyFilterExpr(expr) {
1204
2192
  function bindingifyFilterExprImpl(expr, list) {
1205
2193
  switch (expr.kind) {
1206
2194
  case "and": {
1207
- bindingifyFilterExprImpl(expr.right, list);
1208
- bindingifyFilterExprImpl(expr.left, list);
1209
- list.push({ kind: "And" });
2195
+ let args$1 = expr.args;
2196
+ for (let i$1 = args$1.length - 1; i$1 >= 0; i$1--) bindingifyFilterExprImpl(args$1[i$1], list);
2197
+ list.push({
2198
+ kind: "And",
2199
+ payload: args$1.length
2200
+ });
2201
+ break;
2202
+ }
2203
+ case "or": {
2204
+ let args$1 = expr.args;
2205
+ for (let i$1 = args$1.length - 1; i$1 >= 0; i$1--) bindingifyFilterExprImpl(args$1[i$1], list);
2206
+ list.push({
2207
+ kind: "Or",
2208
+ payload: args$1.length
2209
+ });
1210
2210
  break;
1211
2211
  }
1212
2212
  case "not": {
@@ -1217,21 +2217,21 @@ function bindingifyFilterExprImpl(expr, list) {
1217
2217
  case "id": {
1218
2218
  list.push({
1219
2219
  kind: "Id",
1220
- value: expr.pattern
2220
+ payload: expr.pattern
1221
2221
  });
1222
2222
  break;
1223
2223
  }
1224
2224
  case "moduleType": {
1225
2225
  list.push({
1226
2226
  kind: "ModuleType",
1227
- value: expr.pattern
2227
+ payload: expr.pattern
1228
2228
  });
1229
2229
  break;
1230
2230
  }
1231
2231
  case "code": {
1232
2232
  list.push({
1233
2233
  kind: "Code",
1234
- value: expr.pattern
2234
+ payload: expr.pattern
1235
2235
  });
1236
2236
  break;
1237
2237
  }
@@ -1245,27 +2245,30 @@ function bindingifyFilterExprImpl(expr, list) {
1245
2245
  list.push({ kind: "Exclude" });
1246
2246
  break;
1247
2247
  }
1248
- default: throw new Error(`Unknown filter expression kind: ${expr.kind}`);
2248
+ default: throw new Error(`Unknown filter expression: ${expr}`);
1249
2249
  }
1250
2250
  }
1251
2251
  function bindingifyResolveIdFilter(filterOption) {
1252
- return filterOption?.id ? bindingifyGeneralHookFilter(filterOption.id, "id") : void 0;
2252
+ if (!filterOption) return void 0;
2253
+ if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2254
+ return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
1253
2255
  }
1254
2256
  function bindingifyLoadFilter(filterOption) {
1255
- return filterOption?.id ? bindingifyGeneralHookFilter(filterOption.id, "id") : void 0;
2257
+ if (!filterOption) return void 0;
2258
+ if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2259
+ return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
1256
2260
  }
1257
2261
  function bindingifyTransformFilter(filterOption) {
1258
2262
  if (!filterOption) return void 0;
1259
- let custom = transformFilterMatcherToFilterExprs(filterOption);
2263
+ let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
1260
2264
  let ret = [];
1261
- if (custom) ret = custom.map(bindingifyFilterExpr);
1262
- return { custom: ret.length > 0 ? ret : void 0 };
2265
+ if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
2266
+ return { value: ret.length > 0 ? ret : void 0 };
1263
2267
  }
1264
2268
  function bindingifyRenderChunkFilter(filterOption) {
1265
- if (filterOption) {
1266
- const { code: code$1 } = filterOption;
1267
- return { custom: code$1 ? bindingifyGeneralHookFilter(code$1, "code").custom : void 0 };
1268
- }
2269
+ if (!filterOption) return void 0;
2270
+ if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2271
+ return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
1269
2272
  }
1270
2273
 
1271
2274
  //#endregion
@@ -1392,10 +2395,10 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
1392
2395
  async function createLoadModulePromise(context, data) {
1393
2396
  const loadPromise = data.loadModulePromiseMap.get(id$1);
1394
2397
  if (loadPromise) return loadPromise;
1395
- const promise = new Promise((resolve, _) => {
2398
+ const promise$1 = new Promise((resolve, _) => {
1396
2399
  data.loadModulePromiseResolveFnMap.set(id$1, resolve);
1397
2400
  });
1398
- data.loadModulePromiseMap.set(id$1, promise);
2401
+ data.loadModulePromiseMap.set(id$1, promise$1);
1399
2402
  try {
1400
2403
  await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
1401
2404
  } catch (e) {
@@ -1403,7 +2406,7 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
1403
2406
  data.loadModulePromiseResolveFnMap.delete(id$1);
1404
2407
  throw e;
1405
2408
  }
1406
- return promise;
2409
+ return promise$1;
1407
2410
  }
1408
2411
  await createLoadModulePromise(this.context, this.data);
1409
2412
  return this.data.getModuleInfo(id$1, this.context);
@@ -1490,41 +2493,41 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
1490
2493
 
1491
2494
  //#endregion
1492
2495
  //#region src/plugin/bindingify-build-hooks.ts
1493
- function bindingifyBuildStart(args) {
1494
- const hook = args.plugin.buildStart;
2496
+ function bindingifyBuildStart(args$1) {
2497
+ const hook = args$1.plugin.buildStart;
1495
2498
  if (!hook) return {};
1496
2499
  const { handler, meta } = normalizeHook(hook);
1497
2500
  return {
1498
2501
  plugin: async (ctx, opts) => {
1499
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedInputOptionsImpl(opts, args.onLog));
2502
+ 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));
1500
2503
  },
1501
2504
  meta: bindingifyPluginHookMeta(meta)
1502
2505
  };
1503
2506
  }
1504
- function bindingifyBuildEnd(args) {
1505
- const hook = args.plugin.buildEnd;
2507
+ function bindingifyBuildEnd(args$1) {
2508
+ const hook = args$1.plugin.buildEnd;
1506
2509
  if (!hook) return {};
1507
2510
  const { handler, meta } = normalizeHook(hook);
1508
2511
  return {
1509
2512
  plugin: async (ctx, err) => {
1510
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), err ? normalizeErrors(err) : void 0);
2513
+ 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);
1511
2514
  },
1512
2515
  meta: bindingifyPluginHookMeta(meta)
1513
2516
  };
1514
2517
  }
1515
- function bindingifyResolveId(args) {
1516
- const hook = args.plugin.resolveId;
2518
+ function bindingifyResolveId(args$1) {
2519
+ const hook = args$1.plugin.resolveId;
1517
2520
  if (!hook) return {};
1518
2521
  const { handler, meta, options } = normalizeHook(hook);
1519
2522
  return {
1520
2523
  plugin: async (ctx, specifier, importer, extraOptions) => {
1521
- const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
2524
+ const contextResolveOptions = extraOptions.custom != null ? args$1.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
1522
2525
  const newExtraOptions = {
1523
2526
  ...extraOptions,
1524
2527
  custom: contextResolveOptions?.custom,
1525
2528
  [SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
1526
2529
  };
1527
- 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);
2530
+ 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);
1528
2531
  if (ret == null) return;
1529
2532
  if (ret === false) return {
1530
2533
  id: specifier,
@@ -1535,7 +2538,7 @@ function bindingifyResolveId(args) {
1535
2538
  id: ret,
1536
2539
  normalizeExternalId: true
1537
2540
  };
1538
- let exist = args.pluginContextData.updateModuleOption(ret.id, {
2541
+ let exist = args$1.pluginContextData.updateModuleOption(ret.id, {
1539
2542
  meta: ret.meta || {},
1540
2543
  moduleSideEffects: ret.moduleSideEffects ?? null,
1541
2544
  invalidate: false
@@ -1551,13 +2554,13 @@ function bindingifyResolveId(args) {
1551
2554
  filter: bindingifyResolveIdFilter(options.filter)
1552
2555
  };
1553
2556
  }
1554
- function bindingifyResolveDynamicImport(args) {
1555
- const hook = args.plugin.resolveDynamicImport;
2557
+ function bindingifyResolveDynamicImport(args$1) {
2558
+ const hook = args$1.plugin.resolveDynamicImport;
1556
2559
  if (!hook) return {};
1557
2560
  const { handler, meta } = normalizeHook(hook);
1558
2561
  return {
1559
2562
  plugin: async (ctx, specifier, importer) => {
1560
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), specifier, importer ?? void 0);
2563
+ 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);
1561
2564
  if (ret == null) return;
1562
2565
  if (ret === false) return {
1563
2566
  id: specifier,
@@ -1569,7 +2572,7 @@ function bindingifyResolveDynamicImport(args) {
1569
2572
  external: ret.external
1570
2573
  };
1571
2574
  if (ret.moduleSideEffects !== null) result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
1572
- args.pluginContextData.updateModuleOption(ret.id, {
2575
+ args$1.pluginContextData.updateModuleOption(ret.id, {
1573
2576
  meta: ret.meta || {},
1574
2577
  moduleSideEffects: ret.moduleSideEffects || null,
1575
2578
  invalidate: false
@@ -1579,16 +2582,16 @@ function bindingifyResolveDynamicImport(args) {
1579
2582
  meta: bindingifyPluginHookMeta(meta)
1580
2583
  };
1581
2584
  }
1582
- function bindingifyTransform(args) {
1583
- const hook = args.plugin.transform;
2585
+ function bindingifyTransform(args$1) {
2586
+ const hook = args$1.plugin.transform;
1584
2587
  if (!hook) return {};
1585
2588
  const { handler, meta, options } = normalizeHook(hook);
1586
2589
  return {
1587
2590
  plugin: async (ctx, code$1, id$1, meta$1) => {
1588
- 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);
2591
+ 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);
1589
2592
  if (ret == null) return void 0;
1590
2593
  if (typeof ret === "string") return { code: ret };
1591
- let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
2594
+ let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
1592
2595
  meta: ret.meta ?? {},
1593
2596
  moduleSideEffects: ret.moduleSideEffects ?? null,
1594
2597
  invalidate: false
@@ -1604,16 +2607,16 @@ function bindingifyTransform(args) {
1604
2607
  filter: bindingifyTransformFilter(options.filter)
1605
2608
  };
1606
2609
  }
1607
- function bindingifyLoad(args) {
1608
- const hook = args.plugin.load;
2610
+ function bindingifyLoad(args$1) {
2611
+ const hook = args$1.plugin.load;
1609
2612
  if (!hook) return {};
1610
2613
  const { handler, meta, options } = normalizeHook(hook);
1611
2614
  return {
1612
2615
  plugin: async (ctx, id$1) => {
1613
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode, id$1), id$1);
2616
+ 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);
1614
2617
  if (ret == null) return;
1615
2618
  if (typeof ret === "string") return { code: ret };
1616
- let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
2619
+ let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
1617
2620
  meta: ret.meta || {},
1618
2621
  moduleSideEffects: ret.moduleSideEffects ?? null,
1619
2622
  invalidate: false
@@ -1640,13 +2643,13 @@ function preProcessSourceMap(ret, id$1) {
1640
2643
  }
1641
2644
  return map;
1642
2645
  }
1643
- function bindingifyModuleParsed(args) {
1644
- const hook = args.plugin.moduleParsed;
2646
+ function bindingifyModuleParsed(args$1) {
2647
+ const hook = args$1.plugin.moduleParsed;
1645
2648
  if (!hook) return {};
1646
2649
  const { handler, meta } = normalizeHook(hook);
1647
2650
  return {
1648
2651
  plugin: async (ctx, moduleInfo) => {
1649
- 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)));
2652
+ 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)));
1650
2653
  },
1651
2654
  meta: bindingifyPluginHookMeta(meta)
1652
2655
  };
@@ -2044,25 +3047,25 @@ function collectChangedBundle(changed, bundle) {
2044
3047
 
2045
3048
  //#endregion
2046
3049
  //#region src/plugin/bindingify-output-hooks.ts
2047
- function bindingifyRenderStart(args) {
2048
- const hook = args.plugin.renderStart;
3050
+ function bindingifyRenderStart(args$1) {
3051
+ const hook = args$1.plugin.renderStart;
2049
3052
  if (!hook) return {};
2050
3053
  const { handler, meta } = normalizeHook(hook);
2051
3054
  return {
2052
3055
  plugin: async (ctx, opts) => {
2053
- 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));
3056
+ 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));
2054
3057
  },
2055
3058
  meta: bindingifyPluginHookMeta(meta)
2056
3059
  };
2057
3060
  }
2058
- function bindingifyRenderChunk(args) {
2059
- const hook = args.plugin.renderChunk;
3061
+ function bindingifyRenderChunk(args$1) {
3062
+ const hook = args$1.plugin.renderChunk;
2060
3063
  if (!hook) return {};
2061
3064
  const { handler, meta, options } = normalizeHook(hook);
2062
3065
  return {
2063
3066
  plugin: async (ctx, code$1, chunk, opts, meta$1) => {
2064
- if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
2065
- 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());
3067
+ if (args$1.pluginContextData.getRenderChunkMeta() == null) args$1.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
3068
+ 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());
2066
3069
  if (ret == null) return;
2067
3070
  if (typeof ret === "string") return { code: ret };
2068
3071
  if (!ret.map) return { code: ret.code };
@@ -2075,30 +3078,30 @@ function bindingifyRenderChunk(args) {
2075
3078
  filter: bindingifyRenderChunkFilter(options.filter)
2076
3079
  };
2077
3080
  }
2078
- function bindingifyAugmentChunkHash(args) {
2079
- const hook = args.plugin.augmentChunkHash;
3081
+ function bindingifyAugmentChunkHash(args$1) {
3082
+ const hook = args$1.plugin.augmentChunkHash;
2080
3083
  if (!hook) return {};
2081
3084
  const { handler, meta } = normalizeHook(hook);
2082
3085
  return {
2083
3086
  plugin: async (ctx, chunk) => {
2084
- return await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3087
+ 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));
2085
3088
  },
2086
3089
  meta: bindingifyPluginHookMeta(meta)
2087
3090
  };
2088
3091
  }
2089
- function bindingifyRenderError(args) {
2090
- const hook = args.plugin.renderError;
3092
+ function bindingifyRenderError(args$1) {
3093
+ const hook = args$1.plugin.renderError;
2091
3094
  if (!hook) return {};
2092
3095
  const { handler, meta } = normalizeHook(hook);
2093
3096
  return {
2094
3097
  plugin: async (ctx, err) => {
2095
- handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), normalizeErrors(err));
3098
+ 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));
2096
3099
  },
2097
3100
  meta: bindingifyPluginHookMeta(meta)
2098
3101
  };
2099
3102
  }
2100
- function bindingifyGenerateBundle(args) {
2101
- const hook = args.plugin.generateBundle;
3103
+ function bindingifyGenerateBundle(args$1) {
3104
+ const hook = args$1.plugin.generateBundle;
2102
3105
  if (!hook) return {};
2103
3106
  const { handler, meta } = normalizeHook(hook);
2104
3107
  return {
@@ -2108,14 +3111,14 @@ function bindingifyGenerateBundle(args) {
2108
3111
  deleted: new Set()
2109
3112
  };
2110
3113
  const output = transformToOutputBundle(bundle, changed);
2111
- 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);
3114
+ 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);
2112
3115
  return collectChangedBundle(changed, output);
2113
3116
  },
2114
3117
  meta: bindingifyPluginHookMeta(meta)
2115
3118
  };
2116
3119
  }
2117
- function bindingifyWriteBundle(args) {
2118
- const hook = args.plugin.writeBundle;
3120
+ function bindingifyWriteBundle(args$1) {
3121
+ const hook = args$1.plugin.writeBundle;
2119
3122
  if (!hook) return {};
2120
3123
  const { handler, meta } = normalizeHook(hook);
2121
3124
  return {
@@ -2125,67 +3128,67 @@ function bindingifyWriteBundle(args) {
2125
3128
  deleted: new Set()
2126
3129
  };
2127
3130
  const output = transformToOutputBundle(bundle, changed);
2128
- 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);
3131
+ 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);
2129
3132
  return collectChangedBundle(changed, output);
2130
3133
  },
2131
3134
  meta: bindingifyPluginHookMeta(meta)
2132
3135
  };
2133
3136
  }
2134
- function bindingifyCloseBundle(args) {
2135
- const hook = args.plugin.closeBundle;
3137
+ function bindingifyCloseBundle(args$1) {
3138
+ const hook = args$1.plugin.closeBundle;
2136
3139
  if (!hook) return {};
2137
3140
  const { handler, meta } = normalizeHook(hook);
2138
3141
  return {
2139
3142
  plugin: async (ctx) => {
2140
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
3143
+ await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode));
2141
3144
  },
2142
3145
  meta: bindingifyPluginHookMeta(meta)
2143
3146
  };
2144
3147
  }
2145
- function bindingifyBanner(args) {
2146
- const hook = args.plugin.banner;
3148
+ function bindingifyBanner(args$1) {
3149
+ const hook = args$1.plugin.banner;
2147
3150
  if (!hook) return {};
2148
3151
  const { handler, meta } = normalizeHook(hook);
2149
3152
  return {
2150
3153
  plugin: async (ctx, chunk) => {
2151
3154
  if (typeof handler === "string") return handler;
2152
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3155
+ 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));
2153
3156
  },
2154
3157
  meta: bindingifyPluginHookMeta(meta)
2155
3158
  };
2156
3159
  }
2157
- function bindingifyFooter(args) {
2158
- const hook = args.plugin.footer;
3160
+ function bindingifyFooter(args$1) {
3161
+ const hook = args$1.plugin.footer;
2159
3162
  if (!hook) return {};
2160
3163
  const { handler, meta } = normalizeHook(hook);
2161
3164
  return {
2162
3165
  plugin: async (ctx, chunk) => {
2163
3166
  if (typeof handler === "string") return handler;
2164
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3167
+ 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));
2165
3168
  },
2166
3169
  meta: bindingifyPluginHookMeta(meta)
2167
3170
  };
2168
3171
  }
2169
- function bindingifyIntro(args) {
2170
- const hook = args.plugin.intro;
3172
+ function bindingifyIntro(args$1) {
3173
+ const hook = args$1.plugin.intro;
2171
3174
  if (!hook) return {};
2172
3175
  const { handler, meta } = normalizeHook(hook);
2173
3176
  return {
2174
3177
  plugin: async (ctx, chunk) => {
2175
3178
  if (typeof handler === "string") return handler;
2176
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3179
+ 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));
2177
3180
  },
2178
3181
  meta: bindingifyPluginHookMeta(meta)
2179
3182
  };
2180
3183
  }
2181
- function bindingifyOutro(args) {
2182
- const hook = args.plugin.outro;
3184
+ function bindingifyOutro(args$1) {
3185
+ const hook = args$1.plugin.outro;
2183
3186
  if (!hook) return {};
2184
3187
  const { handler, meta } = normalizeHook(hook);
2185
3188
  return {
2186
3189
  plugin: async (ctx, chunk) => {
2187
3190
  if (typeof handler === "string") return handler;
2188
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3191
+ 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));
2189
3192
  },
2190
3193
  meta: bindingifyPluginHookMeta(meta)
2191
3194
  };
@@ -2193,24 +3196,24 @@ function bindingifyOutro(args) {
2193
3196
 
2194
3197
  //#endregion
2195
3198
  //#region src/plugin/bindingify-watch-hooks.ts
2196
- function bindingifyWatchChange(args) {
2197
- const hook = args.plugin.watchChange;
3199
+ function bindingifyWatchChange(args$1) {
3200
+ const hook = args$1.plugin.watchChange;
2198
3201
  if (!hook) return {};
2199
3202
  const { handler, meta } = normalizeHook(hook);
2200
3203
  return {
2201
3204
  plugin: async (ctx, id$1, event) => {
2202
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id$1, { event });
3205
+ 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 });
2203
3206
  },
2204
3207
  meta: bindingifyPluginHookMeta(meta)
2205
3208
  };
2206
3209
  }
2207
- function bindingifyCloseWatcher(args) {
2208
- const hook = args.plugin.closeWatcher;
3210
+ function bindingifyCloseWatcher(args$1) {
3211
+ const hook = args$1.plugin.closeWatcher;
2209
3212
  if (!hook) return {};
2210
3213
  const { handler, meta } = normalizeHook(hook);
2211
3214
  return {
2212
3215
  plugin: async (ctx) => {
2213
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
3216
+ await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode));
2214
3217
  },
2215
3218
  meta: bindingifyPluginHookMeta(meta)
2216
3219
  };
@@ -2280,7 +3283,7 @@ function extractHookUsage(plugin) {
2280
3283
  //#endregion
2281
3284
  //#region src/plugin/bindingify-plugin.ts
2282
3285
  function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
2283
- const args = {
3286
+ const args$1 = {
2284
3287
  plugin,
2285
3288
  options,
2286
3289
  outputOptions,
@@ -2290,26 +3293,26 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
2290
3293
  watchMode,
2291
3294
  normalizedOutputPlugins
2292
3295
  };
2293
- const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
2294
- const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
2295
- const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args);
2296
- const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args);
2297
- const { plugin: transform$1, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
2298
- const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
2299
- const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
2300
- const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args);
2301
- const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
2302
- const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
2303
- const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
2304
- const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args);
2305
- const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args);
2306
- const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args);
2307
- const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args);
2308
- const { plugin: footer, meta: footerMeta } = bindingifyFooter(args);
2309
- const { plugin: intro, meta: introMeta } = bindingifyIntro(args);
2310
- const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
2311
- const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
2312
- const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
3296
+ const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args$1);
3297
+ const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args$1);
3298
+ const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args$1);
3299
+ const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args$1);
3300
+ const { plugin: transform$1, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args$1);
3301
+ const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args$1);
3302
+ const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args$1);
3303
+ const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args$1);
3304
+ const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args$1);
3305
+ const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args$1);
3306
+ const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args$1);
3307
+ const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args$1);
3308
+ const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args$1);
3309
+ const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args$1);
3310
+ const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args$1);
3311
+ const { plugin: footer, meta: footerMeta } = bindingifyFooter(args$1);
3312
+ const { plugin: intro, meta: introMeta } = bindingifyIntro(args$1);
3313
+ const { plugin: outro, meta: outroMeta } = bindingifyOutro(args$1);
3314
+ const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args$1);
3315
+ const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args$1);
2313
3316
  let hookUsage = extractHookUsage(plugin).inner();
2314
3317
  const result = {
2315
3318
  name: plugin.name,
@@ -2385,13 +3388,13 @@ function wrapHandlers(plugin) {
2385
3388
  "closeWatcher"
2386
3389
  ]) {
2387
3390
  const handler = plugin[hookName];
2388
- if (handler) plugin[hookName] = async (...args) => {
3391
+ if (handler) plugin[hookName] = async (...args$1) => {
2389
3392
  try {
2390
- return await handler(...args);
3393
+ return await handler(...args$1);
2391
3394
  } catch (e) {
2392
3395
  return error(logPluginError(e, plugin.name, {
2393
3396
  hook: hookName,
2394
- id: hookName === "transform" ? args[2] : void 0
3397
+ id: hookName === "transform" ? args$1[2] : void 0
2395
3398
  }));
2396
3399
  }
2397
3400
  };
@@ -2445,13 +3448,13 @@ var PluginContextData = class {
2445
3448
  get() {
2446
3449
  return moduleSideEffects;
2447
3450
  },
2448
- set: (v$1) => {
3451
+ set: (v) => {
2449
3452
  this.updateModuleOption(id$1, {
2450
- moduleSideEffects: v$1,
3453
+ moduleSideEffects: v,
2451
3454
  meta: info.meta,
2452
3455
  invalidate: true
2453
3456
  });
2454
- moduleSideEffects = v$1;
3457
+ moduleSideEffects = v;
2455
3458
  }
2456
3459
  });
2457
3460
  return info;
@@ -3098,6 +4101,9 @@ var RolldownBuild = class {
3098
4101
  async generateHmrPatch(changedFiles) {
3099
4102
  return this.#bundler?.bundler.generateHmrPatch(changedFiles);
3100
4103
  }
4104
+ async hmrInvalidate(file, firstInvalidatedBy) {
4105
+ return this.#bundler?.bundler.hmrInvalidate(file, firstInvalidatedBy);
4106
+ }
3101
4107
  get watchFiles() {
3102
4108
  return this.#bundler?.bundler.watchFiles ?? [];
3103
4109
  }
@@ -3250,46 +4256,6 @@ const watch = (input) => {
3250
4256
  return emitter;
3251
4257
  };
3252
4258
 
3253
- //#endregion
3254
- //#region src/plugin/with-filter.ts
3255
- function withFilterImpl(pluginOption, filterObjectList) {
3256
- if (isPromiseLike(pluginOption)) return pluginOption.then((p) => withFilter(p, filterObjectList));
3257
- if (pluginOption == false || pluginOption == null) return pluginOption;
3258
- if (Array.isArray(pluginOption)) return pluginOption.map((p) => withFilter(p, filterObjectList));
3259
- let plugin = pluginOption;
3260
- let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
3261
- if (filterObjectIndex === -1) return plugin;
3262
- let filterObject = filterObjectList[filterObjectIndex];
3263
- Object.keys(plugin).forEach((key) => {
3264
- switch (key) {
3265
- case "transform":
3266
- case "resolveId":
3267
- case "load":
3268
- if (!plugin[key]) return;
3269
- if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
3270
- else plugin[key] = {
3271
- handler: plugin[key],
3272
- filter: filterObject[key]
3273
- };
3274
- break;
3275
- default: break;
3276
- }
3277
- });
3278
- return plugin;
3279
- }
3280
- function withFilter(pluginOption, filterObject) {
3281
- return withFilterImpl(pluginOption, arraify(filterObject));
3282
- }
3283
- function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
3284
- if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
3285
- for (let i$1 = 0; i$1 < overrideFilterObjectList.length; i$1++) for (let j = 0; j < (overrideFilterObjectList[i$1].pluginNamePattern ?? []).length; j++) {
3286
- let pattern = overrideFilterObjectList[i$1].pluginNamePattern[j];
3287
- if (typeof pattern === "string" && pattern === pluginName) return i$1;
3288
- else if (pattern instanceof RegExp && pattern.test(pluginName)) return i$1;
3289
- }
3290
- return -1;
3291
- }
3292
-
3293
4259
  //#endregion
3294
4260
  //#region src/utils/define-config.ts
3295
4261
  function defineConfig(config) {
@@ -3301,4 +4267,4 @@ function defineConfig(config) {
3301
4267
  const VERSION = version;
3302
4268
 
3303
4269
  //#endregion
3304
- export { VERSION, build, defineConfig, rolldown, watch, withFilter };
4270
+ export { VERSION, build, defineConfig, rolldown, watch };