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