rolldown 1.0.0-beta.8-commit.a29b7fb → 1.0.0-beta.9
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 +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/config.cjs +2 -2
- package/dist/config.d.cts +2 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +2 -2
- package/dist/experimental-index.cjs +4 -3
- package/dist/experimental-index.d.cts +3 -3
- package/dist/experimental-index.d.mts +3 -3
- package/dist/experimental-index.mjs +2 -2
- 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 +2 -2
- package/dist/index.d.mts +2 -2
- 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-B2S9REyA.d.cts → binding.d-IJB0sH7-.d.mts} +1 -1
- package/dist/shared/{binding.d-CxjatXSj.d.mts → binding.d-zZoPrk0_.d.cts} +1 -1
- package/dist/shared/{define-config.d-BG6egsFz.d.mts → define-config.d-0iclTDLo.d.mts} +4 -3
- package/dist/shared/{define-config.d-WoAESKk3.d.cts → define-config.d-D8GT-e45.d.cts} +4 -3
- package/dist/shared/{load-config-BuenfyXI.cjs → load-config-BAYWM1g8.cjs} +1 -1
- package/dist/shared/{load-config-B7I-Vn3Q.mjs → load-config-CRwUXm-Y.mjs} +1 -1
- package/dist/shared/{src-BzX7ZA4t.cjs → src-DUvB0HDu.cjs} +174 -95
- package/dist/shared/{src-KcnYDM-0.mjs → src-PO2pehsE.mjs} +551 -479
- package/package.json +19 -19
|
@@ -8,7 +8,7 @@ const node_os = require_chunk.__toESM(require("node:os"));
|
|
|
8
8
|
const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
|
|
9
9
|
|
|
10
10
|
//#region package.json
|
|
11
|
-
var version = "1.0.0-beta.
|
|
11
|
+
var version = "1.0.0-beta.9";
|
|
12
12
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
@@ -46,8 +46,8 @@ function dynamicImportVarsPlugin(config) {
|
|
|
46
46
|
function importGlobPlugin(config) {
|
|
47
47
|
return new BuiltinPlugin("builtin:import-glob", config);
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
return new BuiltinPlugin("builtin:
|
|
49
|
+
function reporterPlugin(config) {
|
|
50
|
+
return new BuiltinPlugin("builtin:reporter", config);
|
|
51
51
|
}
|
|
52
52
|
function manifestPlugin(config) {
|
|
53
53
|
return new BuiltinPlugin("builtin:manifest", config);
|
|
@@ -98,6 +98,9 @@ function isolatedDeclarationPlugin(config) {
|
|
|
98
98
|
function assetPlugin(config) {
|
|
99
99
|
return new BuiltinPlugin("builtin:asset", config);
|
|
100
100
|
}
|
|
101
|
+
function webWorkerPostPlugin() {
|
|
102
|
+
return new BuiltinPlugin("builtin:web-worker-post");
|
|
103
|
+
}
|
|
101
104
|
|
|
102
105
|
//#endregion
|
|
103
106
|
//#region src/log/logging.ts
|
|
@@ -414,15 +417,15 @@ function getSortedPlugins(hookName, plugins) {
|
|
|
414
417
|
}
|
|
415
418
|
|
|
416
419
|
//#endregion
|
|
417
|
-
//#region ../../node_modules/.pnpm/valibot@1.
|
|
418
|
-
var store;
|
|
420
|
+
//#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.8.3/node_modules/valibot/dist/index.js
|
|
421
|
+
var store$1;
|
|
419
422
|
/* @__NO_SIDE_EFFECTS__ */
|
|
420
423
|
function getGlobalConfig(config2) {
|
|
421
424
|
return {
|
|
422
|
-
lang: config2?.lang ?? store?.lang,
|
|
425
|
+
lang: config2?.lang ?? store$1?.lang,
|
|
423
426
|
message: config2?.message,
|
|
424
|
-
abortEarly: config2?.abortEarly ?? store?.abortEarly,
|
|
425
|
-
abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
|
|
427
|
+
abortEarly: config2?.abortEarly ?? store$1?.abortEarly,
|
|
428
|
+
abortPipeEarly: config2?.abortPipeEarly ?? store$1?.abortPipeEarly
|
|
426
429
|
};
|
|
427
430
|
}
|
|
428
431
|
var store2;
|
|
@@ -467,8 +470,8 @@ function _addIssue(context, label, dataset, config2, other) {
|
|
|
467
470
|
abortPipeEarly: config2.abortPipeEarly
|
|
468
471
|
};
|
|
469
472
|
const isSchema = context.kind === "schema";
|
|
470
|
-
const
|
|
471
|
-
if (
|
|
473
|
+
const message2 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
|
|
474
|
+
if (message2 !== void 0) issue.message = typeof message2 === "function" ? message2(issue) : message2;
|
|
472
475
|
if (isSchema) dataset.typed = false;
|
|
473
476
|
if (dataset.issues) dataset.issues.push(issue);
|
|
474
477
|
else dataset.issues = [issue];
|
|
@@ -610,7 +613,7 @@ function any() {
|
|
|
610
613
|
};
|
|
611
614
|
}
|
|
612
615
|
/* @__NO_SIDE_EFFECTS__ */
|
|
613
|
-
function array(item,
|
|
616
|
+
function array(item, message2) {
|
|
614
617
|
return {
|
|
615
618
|
kind: "schema",
|
|
616
619
|
type: "array",
|
|
@@ -618,7 +621,7 @@ function array(item, message) {
|
|
|
618
621
|
expects: "Array",
|
|
619
622
|
async: false,
|
|
620
623
|
item,
|
|
621
|
-
message,
|
|
624
|
+
message: message2,
|
|
622
625
|
get "~standard"() {
|
|
623
626
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
624
627
|
},
|
|
@@ -658,14 +661,14 @@ function array(item, message) {
|
|
|
658
661
|
};
|
|
659
662
|
}
|
|
660
663
|
/* @__NO_SIDE_EFFECTS__ */
|
|
661
|
-
function boolean(
|
|
664
|
+
function boolean(message2) {
|
|
662
665
|
return {
|
|
663
666
|
kind: "schema",
|
|
664
667
|
type: "boolean",
|
|
665
668
|
reference: boolean,
|
|
666
669
|
expects: "boolean",
|
|
667
670
|
async: false,
|
|
668
|
-
message,
|
|
671
|
+
message: message2,
|
|
669
672
|
get "~standard"() {
|
|
670
673
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
671
674
|
},
|
|
@@ -677,7 +680,7 @@ function boolean(message) {
|
|
|
677
680
|
};
|
|
678
681
|
}
|
|
679
682
|
/* @__NO_SIDE_EFFECTS__ */
|
|
680
|
-
function custom(check2,
|
|
683
|
+
function custom(check2, message2) {
|
|
681
684
|
return {
|
|
682
685
|
kind: "schema",
|
|
683
686
|
type: "custom",
|
|
@@ -685,7 +688,7 @@ function custom(check2, message) {
|
|
|
685
688
|
expects: "unknown",
|
|
686
689
|
async: false,
|
|
687
690
|
check: check2,
|
|
688
|
-
message,
|
|
691
|
+
message: message2,
|
|
689
692
|
get "~standard"() {
|
|
690
693
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
691
694
|
},
|
|
@@ -697,14 +700,14 @@ function custom(check2, message) {
|
|
|
697
700
|
};
|
|
698
701
|
}
|
|
699
702
|
/* @__NO_SIDE_EFFECTS__ */
|
|
700
|
-
function function_(
|
|
703
|
+
function function_(message2) {
|
|
701
704
|
return {
|
|
702
705
|
kind: "schema",
|
|
703
706
|
type: "function",
|
|
704
707
|
reference: function_,
|
|
705
708
|
expects: "Function",
|
|
706
709
|
async: false,
|
|
707
|
-
message,
|
|
710
|
+
message: message2,
|
|
708
711
|
get "~standard"() {
|
|
709
712
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
710
713
|
},
|
|
@@ -716,7 +719,7 @@ function function_(message) {
|
|
|
716
719
|
};
|
|
717
720
|
}
|
|
718
721
|
/* @__NO_SIDE_EFFECTS__ */
|
|
719
|
-
function instance(class_,
|
|
722
|
+
function instance(class_, message2) {
|
|
720
723
|
return {
|
|
721
724
|
kind: "schema",
|
|
722
725
|
type: "instance",
|
|
@@ -724,7 +727,7 @@ function instance(class_, message) {
|
|
|
724
727
|
expects: class_.name,
|
|
725
728
|
async: false,
|
|
726
729
|
class: class_,
|
|
727
|
-
message,
|
|
730
|
+
message: message2,
|
|
728
731
|
get "~standard"() {
|
|
729
732
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
730
733
|
},
|
|
@@ -736,7 +739,7 @@ function instance(class_, message) {
|
|
|
736
739
|
};
|
|
737
740
|
}
|
|
738
741
|
/* @__NO_SIDE_EFFECTS__ */
|
|
739
|
-
function literal(literal_,
|
|
742
|
+
function literal(literal_, message2) {
|
|
740
743
|
return {
|
|
741
744
|
kind: "schema",
|
|
742
745
|
type: "literal",
|
|
@@ -744,7 +747,7 @@ function literal(literal_, message) {
|
|
|
744
747
|
expects: /* @__PURE__ */ _stringify(literal_),
|
|
745
748
|
async: false,
|
|
746
749
|
literal: literal_,
|
|
747
|
-
message,
|
|
750
|
+
message: message2,
|
|
748
751
|
get "~standard"() {
|
|
749
752
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
750
753
|
},
|
|
@@ -756,15 +759,15 @@ function literal(literal_, message) {
|
|
|
756
759
|
};
|
|
757
760
|
}
|
|
758
761
|
/* @__NO_SIDE_EFFECTS__ */
|
|
759
|
-
function looseObject(
|
|
762
|
+
function looseObject(entries2, message2) {
|
|
760
763
|
return {
|
|
761
764
|
kind: "schema",
|
|
762
765
|
type: "loose_object",
|
|
763
766
|
reference: looseObject,
|
|
764
767
|
expects: "Object",
|
|
765
768
|
async: false,
|
|
766
|
-
entries,
|
|
767
|
-
message,
|
|
769
|
+
entries: entries2,
|
|
770
|
+
message: message2,
|
|
768
771
|
get "~standard"() {
|
|
769
772
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
770
773
|
},
|
|
@@ -824,14 +827,14 @@ function looseObject(entries, message) {
|
|
|
824
827
|
};
|
|
825
828
|
}
|
|
826
829
|
/* @__NO_SIDE_EFFECTS__ */
|
|
827
|
-
function never(
|
|
830
|
+
function never(message2) {
|
|
828
831
|
return {
|
|
829
832
|
kind: "schema",
|
|
830
833
|
type: "never",
|
|
831
834
|
reference: never,
|
|
832
835
|
expects: "never",
|
|
833
836
|
async: false,
|
|
834
|
-
message,
|
|
837
|
+
message: message2,
|
|
835
838
|
get "~standard"() {
|
|
836
839
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
837
840
|
},
|
|
@@ -867,14 +870,14 @@ function nullish(wrapped, default_) {
|
|
|
867
870
|
};
|
|
868
871
|
}
|
|
869
872
|
/* @__NO_SIDE_EFFECTS__ */
|
|
870
|
-
function number(
|
|
873
|
+
function number(message2) {
|
|
871
874
|
return {
|
|
872
875
|
kind: "schema",
|
|
873
876
|
type: "number",
|
|
874
877
|
reference: number,
|
|
875
878
|
expects: "number",
|
|
876
879
|
async: false,
|
|
877
|
-
message,
|
|
880
|
+
message: message2,
|
|
878
881
|
get "~standard"() {
|
|
879
882
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
880
883
|
},
|
|
@@ -886,15 +889,15 @@ function number(message) {
|
|
|
886
889
|
};
|
|
887
890
|
}
|
|
888
891
|
/* @__NO_SIDE_EFFECTS__ */
|
|
889
|
-
function object(
|
|
892
|
+
function object(entries2, message2) {
|
|
890
893
|
return {
|
|
891
894
|
kind: "schema",
|
|
892
895
|
type: "object",
|
|
893
896
|
reference: object,
|
|
894
897
|
expects: "Object",
|
|
895
898
|
async: false,
|
|
896
|
-
entries,
|
|
897
|
-
message,
|
|
899
|
+
entries: entries2,
|
|
900
|
+
message: message2,
|
|
898
901
|
get "~standard"() {
|
|
899
902
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
900
903
|
},
|
|
@@ -976,7 +979,7 @@ function optional(wrapped, default_) {
|
|
|
976
979
|
};
|
|
977
980
|
}
|
|
978
981
|
/* @__NO_SIDE_EFFECTS__ */
|
|
979
|
-
function picklist(options,
|
|
982
|
+
function picklist(options, message2) {
|
|
980
983
|
return {
|
|
981
984
|
kind: "schema",
|
|
982
985
|
type: "picklist",
|
|
@@ -984,7 +987,7 @@ function picklist(options, message) {
|
|
|
984
987
|
expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
|
|
985
988
|
async: false,
|
|
986
989
|
options,
|
|
987
|
-
message,
|
|
990
|
+
message: message2,
|
|
988
991
|
get "~standard"() {
|
|
989
992
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
990
993
|
},
|
|
@@ -996,14 +999,14 @@ function picklist(options, message) {
|
|
|
996
999
|
};
|
|
997
1000
|
}
|
|
998
1001
|
/* @__NO_SIDE_EFFECTS__ */
|
|
999
|
-
function promise(
|
|
1002
|
+
function promise(message2) {
|
|
1000
1003
|
return {
|
|
1001
1004
|
kind: "schema",
|
|
1002
1005
|
type: "promise",
|
|
1003
1006
|
reference: promise,
|
|
1004
1007
|
expects: "Promise",
|
|
1005
1008
|
async: false,
|
|
1006
|
-
message,
|
|
1009
|
+
message: message2,
|
|
1007
1010
|
get "~standard"() {
|
|
1008
1011
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1009
1012
|
},
|
|
@@ -1015,7 +1018,7 @@ function promise(message) {
|
|
|
1015
1018
|
};
|
|
1016
1019
|
}
|
|
1017
1020
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1018
|
-
function record(key, value2,
|
|
1021
|
+
function record(key, value2, message2) {
|
|
1019
1022
|
return {
|
|
1020
1023
|
kind: "schema",
|
|
1021
1024
|
type: "record",
|
|
@@ -1024,7 +1027,7 @@ function record(key, value2, message) {
|
|
|
1024
1027
|
async: false,
|
|
1025
1028
|
key,
|
|
1026
1029
|
value: value2,
|
|
1027
|
-
message,
|
|
1030
|
+
message: message2,
|
|
1028
1031
|
get "~standard"() {
|
|
1029
1032
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1030
1033
|
},
|
|
@@ -1083,15 +1086,15 @@ function record(key, value2, message) {
|
|
|
1083
1086
|
};
|
|
1084
1087
|
}
|
|
1085
1088
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1086
|
-
function strictObject(
|
|
1089
|
+
function strictObject(entries2, message2) {
|
|
1087
1090
|
return {
|
|
1088
1091
|
kind: "schema",
|
|
1089
1092
|
type: "strict_object",
|
|
1090
1093
|
reference: strictObject,
|
|
1091
1094
|
expects: "Object",
|
|
1092
1095
|
async: false,
|
|
1093
|
-
entries,
|
|
1094
|
-
message,
|
|
1096
|
+
entries: entries2,
|
|
1097
|
+
message: message2,
|
|
1095
1098
|
get "~standard"() {
|
|
1096
1099
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1097
1100
|
},
|
|
@@ -1164,14 +1167,14 @@ function strictObject(entries, message) {
|
|
|
1164
1167
|
};
|
|
1165
1168
|
}
|
|
1166
1169
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1167
|
-
function string(
|
|
1170
|
+
function string(message2) {
|
|
1168
1171
|
return {
|
|
1169
1172
|
kind: "schema",
|
|
1170
1173
|
type: "string",
|
|
1171
1174
|
reference: string,
|
|
1172
1175
|
expects: "string",
|
|
1173
1176
|
async: false,
|
|
1174
|
-
message,
|
|
1177
|
+
message: message2,
|
|
1175
1178
|
get "~standard"() {
|
|
1176
1179
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1177
1180
|
},
|
|
@@ -1183,7 +1186,7 @@ function string(message) {
|
|
|
1183
1186
|
};
|
|
1184
1187
|
}
|
|
1185
1188
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1186
|
-
function tuple(items,
|
|
1189
|
+
function tuple(items, message2) {
|
|
1187
1190
|
return {
|
|
1188
1191
|
kind: "schema",
|
|
1189
1192
|
type: "tuple",
|
|
@@ -1191,7 +1194,7 @@ function tuple(items, message) {
|
|
|
1191
1194
|
expects: "Array",
|
|
1192
1195
|
async: false,
|
|
1193
1196
|
items,
|
|
1194
|
-
message,
|
|
1197
|
+
message: message2,
|
|
1195
1198
|
get "~standard"() {
|
|
1196
1199
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1197
1200
|
},
|
|
@@ -1238,7 +1241,7 @@ function _subIssues(datasets) {
|
|
|
1238
1241
|
return issues;
|
|
1239
1242
|
}
|
|
1240
1243
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1241
|
-
function union(options,
|
|
1244
|
+
function union(options, message2) {
|
|
1242
1245
|
return {
|
|
1243
1246
|
kind: "schema",
|
|
1244
1247
|
type: "union",
|
|
@@ -1246,7 +1249,7 @@ function union(options, message) {
|
|
|
1246
1249
|
expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
|
|
1247
1250
|
async: false,
|
|
1248
1251
|
options,
|
|
1249
|
-
message,
|
|
1252
|
+
message: message2,
|
|
1250
1253
|
get "~standard"() {
|
|
1251
1254
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1252
1255
|
},
|
|
@@ -1277,7 +1280,7 @@ function union(options, message) {
|
|
|
1277
1280
|
};
|
|
1278
1281
|
}
|
|
1279
1282
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1280
|
-
function unionAsync(options,
|
|
1283
|
+
function unionAsync(options, message2) {
|
|
1281
1284
|
return {
|
|
1282
1285
|
kind: "schema",
|
|
1283
1286
|
type: "union",
|
|
@@ -1285,7 +1288,7 @@ function unionAsync(options, message) {
|
|
|
1285
1288
|
expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
|
|
1286
1289
|
async: true,
|
|
1287
1290
|
options,
|
|
1288
|
-
message,
|
|
1291
|
+
message: message2,
|
|
1289
1292
|
get "~standard"() {
|
|
1290
1293
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1291
1294
|
},
|
|
@@ -1316,16 +1319,16 @@ function unionAsync(options, message) {
|
|
|
1316
1319
|
};
|
|
1317
1320
|
}
|
|
1318
1321
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1319
|
-
function keyof(schema,
|
|
1320
|
-
return /* @__PURE__ */ picklist(Object.keys(schema.entries),
|
|
1322
|
+
function keyof(schema, message2) {
|
|
1323
|
+
return /* @__PURE__ */ picklist(Object.keys(schema.entries), message2);
|
|
1321
1324
|
}
|
|
1322
1325
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1323
1326
|
function omit(schema, keys) {
|
|
1324
|
-
const
|
|
1325
|
-
for (const key of keys) delete
|
|
1327
|
+
const entries2 = { ...schema.entries };
|
|
1328
|
+
for (const key of keys) delete entries2[key];
|
|
1326
1329
|
return {
|
|
1327
1330
|
...schema,
|
|
1328
|
-
entries,
|
|
1331
|
+
entries: entries2,
|
|
1329
1332
|
get "~standard"() {
|
|
1330
1333
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1331
1334
|
}
|
|
@@ -1384,7 +1387,18 @@ function safeParse(schema, input, config2) {
|
|
|
1384
1387
|
}
|
|
1385
1388
|
|
|
1386
1389
|
//#endregion
|
|
1387
|
-
//#region ../../node_modules/.pnpm/@valibot+to-json-schema@1.
|
|
1390
|
+
//#region ../../node_modules/.pnpm/@valibot+to-json-schema@1.2.0_valibot@1.1.0_typescript@5.8.3_/node_modules/@valibot/to-json-schema/dist/index.js
|
|
1391
|
+
var store;
|
|
1392
|
+
function getGlobalDefs() {
|
|
1393
|
+
return store;
|
|
1394
|
+
}
|
|
1395
|
+
function addError(errors, message) {
|
|
1396
|
+
if (errors) {
|
|
1397
|
+
errors.push(message);
|
|
1398
|
+
return errors;
|
|
1399
|
+
}
|
|
1400
|
+
return [message];
|
|
1401
|
+
}
|
|
1388
1402
|
function handleError(message, config) {
|
|
1389
1403
|
switch (config?.errorMode) {
|
|
1390
1404
|
case "ignore": break;
|
|
@@ -1396,6 +1410,7 @@ function handleError(message, config) {
|
|
|
1396
1410
|
}
|
|
1397
1411
|
}
|
|
1398
1412
|
function convertAction(jsonSchema, valibotAction, config) {
|
|
1413
|
+
let errors;
|
|
1399
1414
|
switch (valibotAction.type) {
|
|
1400
1415
|
case "base64": {
|
|
1401
1416
|
jsonSchema.contentEncoding = "base64";
|
|
@@ -1425,11 +1440,16 @@ function convertAction(jsonSchema, valibotAction, config) {
|
|
|
1425
1440
|
case "empty": {
|
|
1426
1441
|
if (jsonSchema.type === "array") jsonSchema.maxItems = 0;
|
|
1427
1442
|
else {
|
|
1428
|
-
if (jsonSchema.type !== "string")
|
|
1443
|
+
if (jsonSchema.type !== "string") errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
|
|
1429
1444
|
jsonSchema.maxLength = 0;
|
|
1430
1445
|
}
|
|
1431
1446
|
break;
|
|
1432
1447
|
}
|
|
1448
|
+
case "entries": {
|
|
1449
|
+
jsonSchema.minProperties = valibotAction.requirement;
|
|
1450
|
+
jsonSchema.maxProperties = valibotAction.requirement;
|
|
1451
|
+
break;
|
|
1452
|
+
}
|
|
1433
1453
|
case "integer": {
|
|
1434
1454
|
jsonSchema.type = "integer";
|
|
1435
1455
|
break;
|
|
@@ -1460,35 +1480,49 @@ function convertAction(jsonSchema, valibotAction, config) {
|
|
|
1460
1480
|
jsonSchema.minItems = valibotAction.requirement;
|
|
1461
1481
|
jsonSchema.maxItems = valibotAction.requirement;
|
|
1462
1482
|
} else {
|
|
1463
|
-
if (jsonSchema.type !== "string")
|
|
1483
|
+
if (jsonSchema.type !== "string") errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
|
|
1464
1484
|
jsonSchema.minLength = valibotAction.requirement;
|
|
1465
1485
|
jsonSchema.maxLength = valibotAction.requirement;
|
|
1466
1486
|
}
|
|
1467
1487
|
break;
|
|
1468
1488
|
}
|
|
1489
|
+
case "max_entries": {
|
|
1490
|
+
jsonSchema.maxProperties = valibotAction.requirement;
|
|
1491
|
+
break;
|
|
1492
|
+
}
|
|
1469
1493
|
case "max_length": {
|
|
1470
1494
|
if (jsonSchema.type === "array") jsonSchema.maxItems = valibotAction.requirement;
|
|
1471
1495
|
else {
|
|
1472
|
-
if (jsonSchema.type !== "string")
|
|
1496
|
+
if (jsonSchema.type !== "string") errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
|
|
1473
1497
|
jsonSchema.maxLength = valibotAction.requirement;
|
|
1474
1498
|
}
|
|
1475
1499
|
break;
|
|
1476
1500
|
}
|
|
1477
1501
|
case "max_value": {
|
|
1478
|
-
if (jsonSchema.type !== "number")
|
|
1502
|
+
if (jsonSchema.type !== "number") errors = addError(errors, `The "max_value" action is not supported on type "${jsonSchema.type}".`);
|
|
1479
1503
|
jsonSchema.maximum = valibotAction.requirement;
|
|
1480
1504
|
break;
|
|
1481
1505
|
}
|
|
1506
|
+
case "metadata": {
|
|
1507
|
+
if (typeof valibotAction.metadata.title === "string") jsonSchema.title = valibotAction.metadata.title;
|
|
1508
|
+
if (typeof valibotAction.metadata.description === "string") jsonSchema.description = valibotAction.metadata.description;
|
|
1509
|
+
if (Array.isArray(valibotAction.metadata.examples)) jsonSchema.examples = valibotAction.metadata.examples;
|
|
1510
|
+
break;
|
|
1511
|
+
}
|
|
1512
|
+
case "min_entries": {
|
|
1513
|
+
jsonSchema.minProperties = valibotAction.requirement;
|
|
1514
|
+
break;
|
|
1515
|
+
}
|
|
1482
1516
|
case "min_length": {
|
|
1483
1517
|
if (jsonSchema.type === "array") jsonSchema.minItems = valibotAction.requirement;
|
|
1484
1518
|
else {
|
|
1485
|
-
if (jsonSchema.type !== "string")
|
|
1519
|
+
if (jsonSchema.type !== "string") errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
|
|
1486
1520
|
jsonSchema.minLength = valibotAction.requirement;
|
|
1487
1521
|
}
|
|
1488
1522
|
break;
|
|
1489
1523
|
}
|
|
1490
1524
|
case "min_value": {
|
|
1491
|
-
if (jsonSchema.type !== "number")
|
|
1525
|
+
if (jsonSchema.type !== "number") errors = addError(errors, `The "min_value" action is not supported on type "${jsonSchema.type}".`);
|
|
1492
1526
|
jsonSchema.minimum = valibotAction.requirement;
|
|
1493
1527
|
break;
|
|
1494
1528
|
}
|
|
@@ -1499,13 +1533,13 @@ function convertAction(jsonSchema, valibotAction, config) {
|
|
|
1499
1533
|
case "non_empty": {
|
|
1500
1534
|
if (jsonSchema.type === "array") jsonSchema.minItems = 1;
|
|
1501
1535
|
else {
|
|
1502
|
-
if (jsonSchema.type !== "string")
|
|
1536
|
+
if (jsonSchema.type !== "string") errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
|
|
1503
1537
|
jsonSchema.minLength = 1;
|
|
1504
1538
|
}
|
|
1505
1539
|
break;
|
|
1506
1540
|
}
|
|
1507
1541
|
case "regex": {
|
|
1508
|
-
if (valibotAction.requirement.flags)
|
|
1542
|
+
if (valibotAction.requirement.flags) errors = addError(errors, "RegExp flags are not supported by JSON Schema.");
|
|
1509
1543
|
jsonSchema.pattern = valibotAction.requirement.source;
|
|
1510
1544
|
break;
|
|
1511
1545
|
}
|
|
@@ -1525,31 +1559,48 @@ function convertAction(jsonSchema, valibotAction, config) {
|
|
|
1525
1559
|
jsonSchema.const = valibotAction.requirement;
|
|
1526
1560
|
break;
|
|
1527
1561
|
}
|
|
1528
|
-
default:
|
|
1562
|
+
default: errors = addError(errors, `The "${valibotAction.type}" action cannot be converted to JSON Schema.`);
|
|
1529
1563
|
}
|
|
1564
|
+
if (config?.overrideAction) {
|
|
1565
|
+
const actionOverride = config.overrideAction({
|
|
1566
|
+
valibotAction,
|
|
1567
|
+
jsonSchema,
|
|
1568
|
+
errors
|
|
1569
|
+
});
|
|
1570
|
+
if (actionOverride) return { ...actionOverride };
|
|
1571
|
+
}
|
|
1572
|
+
if (errors) for (const message of errors) handleError(message, config);
|
|
1530
1573
|
return jsonSchema;
|
|
1531
1574
|
}
|
|
1532
1575
|
var refCount = 0;
|
|
1533
|
-
function convertSchema(jsonSchema, valibotSchema, config, context) {
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1576
|
+
function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = false) {
|
|
1577
|
+
if (!skipRef) {
|
|
1578
|
+
const referenceId = context.referenceMap.get(valibotSchema);
|
|
1579
|
+
if (referenceId) {
|
|
1580
|
+
jsonSchema.$ref = `#/$defs/${referenceId}`;
|
|
1581
|
+
if (config?.overrideRef) {
|
|
1582
|
+
const refOverride = config.overrideRef({
|
|
1583
|
+
...context,
|
|
1584
|
+
referenceId,
|
|
1585
|
+
valibotSchema,
|
|
1586
|
+
jsonSchema
|
|
1587
|
+
});
|
|
1588
|
+
if (refOverride) jsonSchema.$ref = refOverride;
|
|
1589
|
+
}
|
|
1590
|
+
return jsonSchema;
|
|
1591
|
+
}
|
|
1538
1592
|
}
|
|
1539
1593
|
if ("pipe" in valibotSchema) {
|
|
1540
1594
|
for (let index = 0; index < valibotSchema.pipe.length; index++) {
|
|
1541
1595
|
const valibotPipeItem = valibotSchema.pipe[index];
|
|
1542
1596
|
if (valibotPipeItem.kind === "schema") {
|
|
1543
1597
|
if (index > 0) handleError("A \"pipe\" with multiple schemas cannot be converted to JSON Schema.", config);
|
|
1544
|
-
|
|
1545
|
-
if (tempJsonSchema.$ref) {
|
|
1546
|
-
const referenceId2 = tempJsonSchema.$ref.split("/")[2];
|
|
1547
|
-
Object.assign(jsonSchema, context.definitions[referenceId2]);
|
|
1548
|
-
} else Object.assign(jsonSchema, tempJsonSchema);
|
|
1598
|
+
jsonSchema = convertSchema(jsonSchema, valibotPipeItem, config, context, true);
|
|
1549
1599
|
} else jsonSchema = convertAction(jsonSchema, valibotPipeItem, config);
|
|
1550
1600
|
}
|
|
1551
1601
|
return jsonSchema;
|
|
1552
1602
|
}
|
|
1603
|
+
let errors;
|
|
1553
1604
|
switch (valibotSchema.type) {
|
|
1554
1605
|
case "boolean": {
|
|
1555
1606
|
jsonSchema.type = "boolean";
|
|
@@ -1578,9 +1629,10 @@ function convertSchema(jsonSchema, valibotSchema, config, context) {
|
|
|
1578
1629
|
case "strict_tuple": {
|
|
1579
1630
|
jsonSchema.type = "array";
|
|
1580
1631
|
jsonSchema.items = [];
|
|
1632
|
+
jsonSchema.minItems = valibotSchema.items.length;
|
|
1581
1633
|
for (const item of valibotSchema.items) jsonSchema.items.push(convertSchema({}, item, config, context));
|
|
1582
1634
|
if (valibotSchema.type === "tuple_with_rest") jsonSchema.additionalItems = convertSchema({}, valibotSchema.rest, config, context);
|
|
1583
|
-
else
|
|
1635
|
+
else if (valibotSchema.type === "strict_tuple") jsonSchema.additionalItems = false;
|
|
1584
1636
|
break;
|
|
1585
1637
|
}
|
|
1586
1638
|
case "object":
|
|
@@ -1600,8 +1652,8 @@ function convertSchema(jsonSchema, valibotSchema, config, context) {
|
|
|
1600
1652
|
break;
|
|
1601
1653
|
}
|
|
1602
1654
|
case "record": {
|
|
1603
|
-
if ("pipe" in valibotSchema.key)
|
|
1604
|
-
if (valibotSchema.key.type !== "string")
|
|
1655
|
+
if ("pipe" in valibotSchema.key) errors = addError(errors, "The \"record\" schema with a schema for the key that contains a \"pipe\" cannot be converted to JSON Schema.");
|
|
1656
|
+
if (valibotSchema.key.type !== "string") errors = addError(errors, `The "record" schema with the "${valibotSchema.key.type}" schema for the key cannot be converted to JSON Schema.`);
|
|
1605
1657
|
jsonSchema.type = "object";
|
|
1606
1658
|
jsonSchema.additionalProperties = convertSchema({}, valibotSchema.value, config, context);
|
|
1607
1659
|
break;
|
|
@@ -1622,7 +1674,7 @@ function convertSchema(jsonSchema, valibotSchema, config, context) {
|
|
|
1622
1674
|
break;
|
|
1623
1675
|
}
|
|
1624
1676
|
case "literal": {
|
|
1625
|
-
if (typeof valibotSchema.literal !== "boolean" && typeof valibotSchema.literal !== "number" && typeof valibotSchema.literal !== "string")
|
|
1677
|
+
if (typeof valibotSchema.literal !== "boolean" && typeof valibotSchema.literal !== "number" && typeof valibotSchema.literal !== "string") errors = addError(errors, "The value of the \"literal\" schema is not JSON compatible.");
|
|
1626
1678
|
jsonSchema.const = valibotSchema.literal;
|
|
1627
1679
|
break;
|
|
1628
1680
|
}
|
|
@@ -1631,7 +1683,7 @@ function convertSchema(jsonSchema, valibotSchema, config, context) {
|
|
|
1631
1683
|
break;
|
|
1632
1684
|
}
|
|
1633
1685
|
case "picklist": {
|
|
1634
|
-
if (valibotSchema.options.some((option) => typeof option !== "number" && typeof option !== "string"))
|
|
1686
|
+
if (valibotSchema.options.some((option) => typeof option !== "number" && typeof option !== "string")) errors = addError(errors, "An option of the \"picklist\" schema is not JSON compatible.");
|
|
1635
1687
|
jsonSchema.enum = valibotSchema.options;
|
|
1636
1688
|
break;
|
|
1637
1689
|
}
|
|
@@ -1650,17 +1702,37 @@ function convertSchema(jsonSchema, valibotSchema, config, context) {
|
|
|
1650
1702
|
wrappedValibotSchema = valibotSchema.getter(void 0);
|
|
1651
1703
|
context.getterMap.set(valibotSchema.getter, wrappedValibotSchema);
|
|
1652
1704
|
}
|
|
1653
|
-
let
|
|
1654
|
-
if (!
|
|
1655
|
-
|
|
1656
|
-
context.referenceMap.set(wrappedValibotSchema,
|
|
1657
|
-
context.definitions[
|
|
1705
|
+
let referenceId = context.referenceMap.get(wrappedValibotSchema);
|
|
1706
|
+
if (!referenceId) {
|
|
1707
|
+
referenceId = `${refCount++}`;
|
|
1708
|
+
context.referenceMap.set(wrappedValibotSchema, referenceId);
|
|
1709
|
+
context.definitions[referenceId] = convertSchema({}, wrappedValibotSchema, config, context, true);
|
|
1710
|
+
}
|
|
1711
|
+
jsonSchema.$ref = `#/$defs/${referenceId}`;
|
|
1712
|
+
if (config?.overrideRef) {
|
|
1713
|
+
const refOverride = config.overrideRef({
|
|
1714
|
+
...context,
|
|
1715
|
+
referenceId,
|
|
1716
|
+
valibotSchema,
|
|
1717
|
+
jsonSchema
|
|
1718
|
+
});
|
|
1719
|
+
if (refOverride) jsonSchema.$ref = refOverride;
|
|
1658
1720
|
}
|
|
1659
|
-
jsonSchema.$ref = `#/$defs/${referenceId2}`;
|
|
1660
1721
|
break;
|
|
1661
1722
|
}
|
|
1662
|
-
default:
|
|
1723
|
+
default: errors = addError(errors, `The "${valibotSchema.type}" schema cannot be converted to JSON Schema.`);
|
|
1724
|
+
}
|
|
1725
|
+
if (config?.overrideSchema) {
|
|
1726
|
+
const schemaOverride = config.overrideSchema({
|
|
1727
|
+
...context,
|
|
1728
|
+
referenceId: context.referenceMap.get(valibotSchema),
|
|
1729
|
+
valibotSchema,
|
|
1730
|
+
jsonSchema,
|
|
1731
|
+
errors
|
|
1732
|
+
});
|
|
1733
|
+
if (schemaOverride) return { ...schemaOverride };
|
|
1663
1734
|
}
|
|
1735
|
+
if (errors) for (const message of errors) handleError(message, config);
|
|
1664
1736
|
return jsonSchema;
|
|
1665
1737
|
}
|
|
1666
1738
|
function toJsonSchema(schema, config) {
|
|
@@ -1669,9 +1741,10 @@ function toJsonSchema(schema, config) {
|
|
|
1669
1741
|
referenceMap: /* @__PURE__ */ new Map(),
|
|
1670
1742
|
getterMap: /* @__PURE__ */ new Map()
|
|
1671
1743
|
};
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
for (const key in
|
|
1744
|
+
const definitions = config?.definitions ?? getGlobalDefs();
|
|
1745
|
+
if (definitions) {
|
|
1746
|
+
for (const key in definitions) context.referenceMap.set(definitions[key], key);
|
|
1747
|
+
for (const key in definitions) context.definitions[key] = convertSchema({}, definitions[key], config, context, true);
|
|
1675
1748
|
}
|
|
1676
1749
|
const jsonSchema = convertSchema({ $schema: "http://json-schema.org/draft-07/schema#" }, schema, config, context);
|
|
1677
1750
|
if (context.referenceMap.size) jsonSchema.$defs = context.definitions;
|
|
@@ -2202,7 +2275,7 @@ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
|
|
|
2202
2275
|
}
|
|
2203
2276
|
|
|
2204
2277
|
//#endregion
|
|
2205
|
-
//#region ../../node_modules/.pnpm/remeda@2.21.
|
|
2278
|
+
//#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-D6FCK2GA.js
|
|
2206
2279
|
function u$1(o, n, a) {
|
|
2207
2280
|
let t$1 = (r) => o(r, ...n);
|
|
2208
2281
|
return a === void 0 ? t$1 : Object.assign(t$1, {
|
|
@@ -2212,7 +2285,7 @@ function u$1(o, n, a) {
|
|
|
2212
2285
|
}
|
|
2213
2286
|
|
|
2214
2287
|
//#endregion
|
|
2215
|
-
//#region ../../node_modules/.pnpm/remeda@2.21.
|
|
2288
|
+
//#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-WIMGWYZL.js
|
|
2216
2289
|
function u(r, n, o) {
|
|
2217
2290
|
let a = r.length - n.length;
|
|
2218
2291
|
if (a === 0) return r(...n);
|
|
@@ -2221,7 +2294,7 @@ function u(r, n, o) {
|
|
|
2221
2294
|
}
|
|
2222
2295
|
|
|
2223
2296
|
//#endregion
|
|
2224
|
-
//#region ../../node_modules/.pnpm/remeda@2.21.
|
|
2297
|
+
//#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-3IFJP4R5.js
|
|
2225
2298
|
function d(...r) {
|
|
2226
2299
|
return u(i, r);
|
|
2227
2300
|
}
|
|
@@ -2232,7 +2305,7 @@ var i = (r, t$1) => {
|
|
|
2232
2305
|
};
|
|
2233
2306
|
|
|
2234
2307
|
//#endregion
|
|
2235
|
-
//#region ../../node_modules/.pnpm/remeda@2.21.
|
|
2308
|
+
//#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-5NQBDF4H.js
|
|
2236
2309
|
function t(...n) {
|
|
2237
2310
|
return u(Object.keys, n);
|
|
2238
2311
|
}
|
|
@@ -4528,10 +4601,10 @@ Object.defineProperty(exports, 'normalizedStringOrRegex', {
|
|
|
4528
4601
|
return normalizedStringOrRegex;
|
|
4529
4602
|
}
|
|
4530
4603
|
});
|
|
4531
|
-
Object.defineProperty(exports, '
|
|
4604
|
+
Object.defineProperty(exports, 'reporterPlugin', {
|
|
4532
4605
|
enumerable: true,
|
|
4533
4606
|
get: function () {
|
|
4534
|
-
return
|
|
4607
|
+
return reporterPlugin;
|
|
4535
4608
|
}
|
|
4536
4609
|
});
|
|
4537
4610
|
Object.defineProperty(exports, 'rolldown', {
|
|
@@ -4575,4 +4648,10 @@ Object.defineProperty(exports, 'watch', {
|
|
|
4575
4648
|
get: function () {
|
|
4576
4649
|
return watch;
|
|
4577
4650
|
}
|
|
4651
|
+
});
|
|
4652
|
+
Object.defineProperty(exports, 'webWorkerPostPlugin', {
|
|
4653
|
+
enumerable: true,
|
|
4654
|
+
get: function () {
|
|
4655
|
+
return webWorkerPostPlugin;
|
|
4656
|
+
}
|
|
4578
4657
|
});
|