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