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