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