@rspack/core 1.2.1 → 1.2.3
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/compiled/@swc/types/index.d.ts +349 -258
- package/compiled/enhanced-resolve/package.json +1 -1
- package/compiled/zod/index.d.ts +302 -265
- package/compiled/zod/index.js +238 -84
- package/compiled/zod/package.json +1 -1
- package/dist/Chunk.d.ts +2 -0
- package/dist/ChunkGraph.d.ts +3 -0
- package/dist/ChunkGroup.d.ts +1 -0
- package/dist/Compilation.d.ts +0 -6
- package/dist/Dependency.d.ts +1 -0
- package/dist/Module.d.ts +6 -1
- package/dist/ModuleGraph.d.ts +4 -0
- package/dist/ModuleGraphConnection.d.ts +2 -0
- package/dist/NormalModuleFactory.d.ts +4 -1
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +19 -3
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +45 -0
- package/dist/builtin-plugin/RuntimePlugin.d.ts +22 -4
- package/dist/builtin-plugin/html-plugin/options.d.ts +26 -20
- package/dist/builtin-plugin/index.d.ts +1 -0
- package/dist/builtin-plugin/lazy-compilation/backend.d.ts +10 -1
- package/dist/config/defaults.d.ts +1 -0
- package/dist/config/types.d.ts +4 -0
- package/dist/config/zod.d.ts +40 -22
- package/dist/exports.d.ts +5 -1
- package/dist/index.js +6390 -6076
- package/dist/lib/DllReferencePlugin.d.ts +1 -1
- package/package.json +6 -6
package/compiled/zod/index.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
/******/ "use strict";
|
|
3
3
|
/******/ var __webpack_modules__ = ({
|
|
4
4
|
|
|
5
|
-
/***/
|
|
5
|
+
/***/ 143:
|
|
6
6
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10
10
|
exports.ZodError = exports.quotelessJson = exports.ZodIssueCode = void 0;
|
|
11
|
-
const util_1 = __nccwpck_require__(
|
|
11
|
+
const util_1 = __nccwpck_require__(568);
|
|
12
12
|
exports.ZodIssueCode = util_1.util.arrayToEnum([
|
|
13
13
|
"invalid_type",
|
|
14
14
|
"invalid_literal",
|
|
@@ -33,6 +33,9 @@ const quotelessJson = (obj) => {
|
|
|
33
33
|
};
|
|
34
34
|
exports.quotelessJson = quotelessJson;
|
|
35
35
|
class ZodError extends Error {
|
|
36
|
+
get errors() {
|
|
37
|
+
return this.issues;
|
|
38
|
+
}
|
|
36
39
|
constructor(issues) {
|
|
37
40
|
super();
|
|
38
41
|
this.issues = [];
|
|
@@ -53,9 +56,6 @@ class ZodError extends Error {
|
|
|
53
56
|
this.name = "ZodError";
|
|
54
57
|
this.issues = issues;
|
|
55
58
|
}
|
|
56
|
-
get errors() {
|
|
57
|
-
return this.issues;
|
|
58
|
-
}
|
|
59
59
|
format(_mapper) {
|
|
60
60
|
const mapper = _mapper ||
|
|
61
61
|
function (issue) {
|
|
@@ -146,7 +146,7 @@ ZodError.create = (issues) => {
|
|
|
146
146
|
|
|
147
147
|
/***/ }),
|
|
148
148
|
|
|
149
|
-
/***/
|
|
149
|
+
/***/ 193:
|
|
150
150
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
151
151
|
|
|
152
152
|
|
|
@@ -155,7 +155,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
155
155
|
};
|
|
156
156
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
157
157
|
exports.getErrorMap = exports.setErrorMap = exports.defaultErrorMap = void 0;
|
|
158
|
-
const en_1 = __importDefault(__nccwpck_require__(
|
|
158
|
+
const en_1 = __importDefault(__nccwpck_require__(929));
|
|
159
159
|
exports.defaultErrorMap = en_1.default;
|
|
160
160
|
let overrideErrorMap = en_1.default;
|
|
161
161
|
function setErrorMap(map) {
|
|
@@ -170,13 +170,17 @@ exports.getErrorMap = getErrorMap;
|
|
|
170
170
|
|
|
171
171
|
/***/ }),
|
|
172
172
|
|
|
173
|
-
/***/
|
|
173
|
+
/***/ 869:
|
|
174
174
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
175
175
|
|
|
176
176
|
|
|
177
177
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
178
178
|
if (k2 === undefined) k2 = k;
|
|
179
|
-
Object.
|
|
179
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
180
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
181
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
182
|
+
}
|
|
183
|
+
Object.defineProperty(o, k2, desc);
|
|
180
184
|
}) : (function(o, m, k, k2) {
|
|
181
185
|
if (k2 === undefined) k2 = k;
|
|
182
186
|
o[k2] = m[k];
|
|
@@ -185,17 +189,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
185
189
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
186
190
|
};
|
|
187
191
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
188
|
-
__exportStar(__nccwpck_require__(
|
|
189
|
-
__exportStar(__nccwpck_require__(
|
|
190
|
-
__exportStar(__nccwpck_require__(
|
|
191
|
-
__exportStar(__nccwpck_require__(
|
|
192
|
-
__exportStar(__nccwpck_require__(
|
|
193
|
-
__exportStar(__nccwpck_require__(
|
|
192
|
+
__exportStar(__nccwpck_require__(193), exports);
|
|
193
|
+
__exportStar(__nccwpck_require__(641), exports);
|
|
194
|
+
__exportStar(__nccwpck_require__(206), exports);
|
|
195
|
+
__exportStar(__nccwpck_require__(568), exports);
|
|
196
|
+
__exportStar(__nccwpck_require__(413), exports);
|
|
197
|
+
__exportStar(__nccwpck_require__(143), exports);
|
|
194
198
|
|
|
195
199
|
|
|
196
200
|
/***/ }),
|
|
197
201
|
|
|
198
|
-
/***/
|
|
202
|
+
/***/ 424:
|
|
199
203
|
/***/ ((__unused_webpack_module, exports) => {
|
|
200
204
|
|
|
201
205
|
|
|
@@ -205,12 +209,12 @@ var errorUtil;
|
|
|
205
209
|
(function (errorUtil) {
|
|
206
210
|
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
207
211
|
errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
208
|
-
})(errorUtil
|
|
212
|
+
})(errorUtil || (exports.errorUtil = errorUtil = {}));
|
|
209
213
|
|
|
210
214
|
|
|
211
215
|
/***/ }),
|
|
212
216
|
|
|
213
|
-
/***/
|
|
217
|
+
/***/ 641:
|
|
214
218
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
215
219
|
|
|
216
220
|
|
|
@@ -219,8 +223,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
219
223
|
};
|
|
220
224
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
221
225
|
exports.isAsync = exports.isValid = exports.isDirty = exports.isAborted = exports.OK = exports.DIRTY = exports.INVALID = exports.ParseStatus = exports.addIssueToContext = exports.EMPTY_PATH = exports.makeIssue = void 0;
|
|
222
|
-
const errors_1 = __nccwpck_require__(
|
|
223
|
-
const en_1 = __importDefault(__nccwpck_require__(
|
|
226
|
+
const errors_1 = __nccwpck_require__(193);
|
|
227
|
+
const en_1 = __importDefault(__nccwpck_require__(929));
|
|
224
228
|
const makeIssue = (params) => {
|
|
225
229
|
const { data, path, errorMaps, issueData } = params;
|
|
226
230
|
const fullPath = [...path, ...(issueData.path || [])];
|
|
@@ -258,9 +262,9 @@ function addIssueToContext(ctx, issueData) {
|
|
|
258
262
|
data: ctx.data,
|
|
259
263
|
path: ctx.path,
|
|
260
264
|
errorMaps: [
|
|
261
|
-
ctx.common.contextualErrorMap,
|
|
262
|
-
ctx.schemaErrorMap,
|
|
263
|
-
overrideMap,
|
|
265
|
+
ctx.common.contextualErrorMap, // contextual error map is first priority
|
|
266
|
+
ctx.schemaErrorMap, // then schema-bound map if available
|
|
267
|
+
overrideMap, // then global override map
|
|
264
268
|
overrideMap === en_1.default ? undefined : en_1.default, // then global default map
|
|
265
269
|
].filter((x) => !!x),
|
|
266
270
|
});
|
|
@@ -342,7 +346,7 @@ exports.isAsync = isAsync;
|
|
|
342
346
|
|
|
343
347
|
/***/ }),
|
|
344
348
|
|
|
345
|
-
/***/
|
|
349
|
+
/***/ 206:
|
|
346
350
|
/***/ ((__unused_webpack_module, exports) => {
|
|
347
351
|
|
|
348
352
|
|
|
@@ -351,7 +355,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
351
355
|
|
|
352
356
|
/***/ }),
|
|
353
357
|
|
|
354
|
-
/***/
|
|
358
|
+
/***/ 568:
|
|
355
359
|
/***/ ((__unused_webpack_module, exports) => {
|
|
356
360
|
|
|
357
361
|
|
|
@@ -419,7 +423,7 @@ var util;
|
|
|
419
423
|
}
|
|
420
424
|
return value;
|
|
421
425
|
};
|
|
422
|
-
})(util
|
|
426
|
+
})(util || (exports.util = util = {}));
|
|
423
427
|
var objectUtil;
|
|
424
428
|
(function (objectUtil) {
|
|
425
429
|
objectUtil.mergeShapes = (first, second) => {
|
|
@@ -428,7 +432,7 @@ var objectUtil;
|
|
|
428
432
|
...second, // second overwrites first
|
|
429
433
|
};
|
|
430
434
|
};
|
|
431
|
-
})(objectUtil
|
|
435
|
+
})(objectUtil || (exports.objectUtil = objectUtil = {}));
|
|
432
436
|
exports.ZodParsedType = util.arrayToEnum([
|
|
433
437
|
"string",
|
|
434
438
|
"nan",
|
|
@@ -500,13 +504,17 @@ exports.getParsedType = getParsedType;
|
|
|
500
504
|
|
|
501
505
|
/***/ }),
|
|
502
506
|
|
|
503
|
-
/***/
|
|
507
|
+
/***/ 656:
|
|
504
508
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
505
509
|
|
|
506
510
|
|
|
507
511
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
508
512
|
if (k2 === undefined) k2 = k;
|
|
509
|
-
Object.
|
|
513
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
514
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
515
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
516
|
+
}
|
|
517
|
+
Object.defineProperty(o, k2, desc);
|
|
510
518
|
}) : (function(o, m, k, k2) {
|
|
511
519
|
if (k2 === undefined) k2 = k;
|
|
512
520
|
o[k2] = m[k];
|
|
@@ -528,21 +536,21 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
528
536
|
};
|
|
529
537
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
530
538
|
exports.z = void 0;
|
|
531
|
-
const z = __importStar(__nccwpck_require__(
|
|
539
|
+
const z = __importStar(__nccwpck_require__(869));
|
|
532
540
|
exports.z = z;
|
|
533
|
-
__exportStar(__nccwpck_require__(
|
|
541
|
+
__exportStar(__nccwpck_require__(869), exports);
|
|
534
542
|
exports["default"] = z;
|
|
535
543
|
|
|
536
544
|
|
|
537
545
|
/***/ }),
|
|
538
546
|
|
|
539
|
-
/***/
|
|
547
|
+
/***/ 929:
|
|
540
548
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
541
549
|
|
|
542
550
|
|
|
543
551
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
544
|
-
const util_1 = __nccwpck_require__(
|
|
545
|
-
const ZodError_1 = __nccwpck_require__(
|
|
552
|
+
const util_1 = __nccwpck_require__(568);
|
|
553
|
+
const ZodError_1 = __nccwpck_require__(143);
|
|
546
554
|
const errorMap = (issue, _ctx) => {
|
|
547
555
|
let message;
|
|
548
556
|
switch (issue.code) {
|
|
@@ -672,7 +680,7 @@ exports["default"] = errorMap;
|
|
|
672
680
|
|
|
673
681
|
/***/ }),
|
|
674
682
|
|
|
675
|
-
/***/
|
|
683
|
+
/***/ 413:
|
|
676
684
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
677
685
|
|
|
678
686
|
|
|
@@ -691,11 +699,11 @@ var _ZodEnum_cache, _ZodNativeEnum_cache;
|
|
|
691
699
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
692
700
|
exports.boolean = exports.bigint = exports.array = exports.any = exports.coerce = exports.ZodFirstPartyTypeKind = exports.late = exports.ZodSchema = exports.Schema = exports.custom = exports.ZodReadonly = exports.ZodPipeline = exports.ZodBranded = exports.BRAND = exports.ZodNaN = exports.ZodCatch = exports.ZodDefault = exports.ZodNullable = exports.ZodOptional = exports.ZodTransformer = exports.ZodEffects = exports.ZodPromise = exports.ZodNativeEnum = exports.ZodEnum = exports.ZodLiteral = exports.ZodLazy = exports.ZodFunction = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodUnion = exports.ZodObject = exports.ZodArray = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodSymbol = exports.ZodDate = exports.ZodBoolean = exports.ZodBigInt = exports.ZodNumber = exports.ZodString = exports.datetimeRegex = exports.ZodType = void 0;
|
|
693
701
|
exports.NEVER = exports["void"] = exports.unknown = exports.union = exports.undefined = exports.tuple = exports.transformer = exports.symbol = exports.string = exports.strictObject = exports.set = exports.record = exports.promise = exports.preprocess = exports.pipeline = exports.ostring = exports.optional = exports.onumber = exports.oboolean = exports.object = exports.number = exports.nullable = exports["null"] = exports.never = exports.nativeEnum = exports.nan = exports.map = exports.literal = exports.lazy = exports.intersection = exports["instanceof"] = exports["function"] = exports["enum"] = exports.effect = exports.discriminatedUnion = exports.date = void 0;
|
|
694
|
-
const errors_1 = __nccwpck_require__(
|
|
695
|
-
const errorUtil_1 = __nccwpck_require__(
|
|
696
|
-
const parseUtil_1 = __nccwpck_require__(
|
|
697
|
-
const util_1 = __nccwpck_require__(
|
|
698
|
-
const ZodError_1 = __nccwpck_require__(
|
|
702
|
+
const errors_1 = __nccwpck_require__(193);
|
|
703
|
+
const errorUtil_1 = __nccwpck_require__(424);
|
|
704
|
+
const parseUtil_1 = __nccwpck_require__(641);
|
|
705
|
+
const util_1 = __nccwpck_require__(568);
|
|
706
|
+
const ZodError_1 = __nccwpck_require__(143);
|
|
699
707
|
class ParseInputLazyPath {
|
|
700
708
|
constructor(parent, value, path, key) {
|
|
701
709
|
this._cachedPath = [];
|
|
@@ -761,35 +769,6 @@ function processCreateParams(params) {
|
|
|
761
769
|
return { errorMap: customMap, description };
|
|
762
770
|
}
|
|
763
771
|
class ZodType {
|
|
764
|
-
constructor(def) {
|
|
765
|
-
/** Alias of safeParseAsync */
|
|
766
|
-
this.spa = this.safeParseAsync;
|
|
767
|
-
this._def = def;
|
|
768
|
-
this.parse = this.parse.bind(this);
|
|
769
|
-
this.safeParse = this.safeParse.bind(this);
|
|
770
|
-
this.parseAsync = this.parseAsync.bind(this);
|
|
771
|
-
this.safeParseAsync = this.safeParseAsync.bind(this);
|
|
772
|
-
this.spa = this.spa.bind(this);
|
|
773
|
-
this.refine = this.refine.bind(this);
|
|
774
|
-
this.refinement = this.refinement.bind(this);
|
|
775
|
-
this.superRefine = this.superRefine.bind(this);
|
|
776
|
-
this.optional = this.optional.bind(this);
|
|
777
|
-
this.nullable = this.nullable.bind(this);
|
|
778
|
-
this.nullish = this.nullish.bind(this);
|
|
779
|
-
this.array = this.array.bind(this);
|
|
780
|
-
this.promise = this.promise.bind(this);
|
|
781
|
-
this.or = this.or.bind(this);
|
|
782
|
-
this.and = this.and.bind(this);
|
|
783
|
-
this.transform = this.transform.bind(this);
|
|
784
|
-
this.brand = this.brand.bind(this);
|
|
785
|
-
this.default = this.default.bind(this);
|
|
786
|
-
this.catch = this.catch.bind(this);
|
|
787
|
-
this.describe = this.describe.bind(this);
|
|
788
|
-
this.pipe = this.pipe.bind(this);
|
|
789
|
-
this.readonly = this.readonly.bind(this);
|
|
790
|
-
this.isNullable = this.isNullable.bind(this);
|
|
791
|
-
this.isOptional = this.isOptional.bind(this);
|
|
792
|
-
}
|
|
793
772
|
get description() {
|
|
794
773
|
return this._def.description;
|
|
795
774
|
}
|
|
@@ -853,6 +832,48 @@ class ZodType {
|
|
|
853
832
|
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
|
854
833
|
return handleResult(ctx, result);
|
|
855
834
|
}
|
|
835
|
+
"~validate"(data) {
|
|
836
|
+
var _a, _b;
|
|
837
|
+
const ctx = {
|
|
838
|
+
common: {
|
|
839
|
+
issues: [],
|
|
840
|
+
async: !!this["~standard"].async,
|
|
841
|
+
},
|
|
842
|
+
path: [],
|
|
843
|
+
schemaErrorMap: this._def.errorMap,
|
|
844
|
+
parent: null,
|
|
845
|
+
data,
|
|
846
|
+
parsedType: (0, util_1.getParsedType)(data),
|
|
847
|
+
};
|
|
848
|
+
if (!this["~standard"].async) {
|
|
849
|
+
try {
|
|
850
|
+
const result = this._parseSync({ data, path: [], parent: ctx });
|
|
851
|
+
return (0, parseUtil_1.isValid)(result)
|
|
852
|
+
? {
|
|
853
|
+
value: result.value,
|
|
854
|
+
}
|
|
855
|
+
: {
|
|
856
|
+
issues: ctx.common.issues,
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
catch (err) {
|
|
860
|
+
if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
|
|
861
|
+
this["~standard"].async = true;
|
|
862
|
+
}
|
|
863
|
+
ctx.common = {
|
|
864
|
+
issues: [],
|
|
865
|
+
async: true,
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
return this._parseAsync({ data, path: [], parent: ctx }).then((result) => (0, parseUtil_1.isValid)(result)
|
|
870
|
+
? {
|
|
871
|
+
value: result.value,
|
|
872
|
+
}
|
|
873
|
+
: {
|
|
874
|
+
issues: ctx.common.issues,
|
|
875
|
+
});
|
|
876
|
+
}
|
|
856
877
|
async parseAsync(data, params) {
|
|
857
878
|
const result = await this.safeParseAsync(data, params);
|
|
858
879
|
if (result.success)
|
|
@@ -939,6 +960,40 @@ class ZodType {
|
|
|
939
960
|
superRefine(refinement) {
|
|
940
961
|
return this._refinement(refinement);
|
|
941
962
|
}
|
|
963
|
+
constructor(def) {
|
|
964
|
+
/** Alias of safeParseAsync */
|
|
965
|
+
this.spa = this.safeParseAsync;
|
|
966
|
+
this._def = def;
|
|
967
|
+
this.parse = this.parse.bind(this);
|
|
968
|
+
this.safeParse = this.safeParse.bind(this);
|
|
969
|
+
this.parseAsync = this.parseAsync.bind(this);
|
|
970
|
+
this.safeParseAsync = this.safeParseAsync.bind(this);
|
|
971
|
+
this.spa = this.spa.bind(this);
|
|
972
|
+
this.refine = this.refine.bind(this);
|
|
973
|
+
this.refinement = this.refinement.bind(this);
|
|
974
|
+
this.superRefine = this.superRefine.bind(this);
|
|
975
|
+
this.optional = this.optional.bind(this);
|
|
976
|
+
this.nullable = this.nullable.bind(this);
|
|
977
|
+
this.nullish = this.nullish.bind(this);
|
|
978
|
+
this.array = this.array.bind(this);
|
|
979
|
+
this.promise = this.promise.bind(this);
|
|
980
|
+
this.or = this.or.bind(this);
|
|
981
|
+
this.and = this.and.bind(this);
|
|
982
|
+
this.transform = this.transform.bind(this);
|
|
983
|
+
this.brand = this.brand.bind(this);
|
|
984
|
+
this.default = this.default.bind(this);
|
|
985
|
+
this.catch = this.catch.bind(this);
|
|
986
|
+
this.describe = this.describe.bind(this);
|
|
987
|
+
this.pipe = this.pipe.bind(this);
|
|
988
|
+
this.readonly = this.readonly.bind(this);
|
|
989
|
+
this.isNullable = this.isNullable.bind(this);
|
|
990
|
+
this.isOptional = this.isOptional.bind(this);
|
|
991
|
+
this["~standard"] = {
|
|
992
|
+
version: 1,
|
|
993
|
+
vendor: "zod",
|
|
994
|
+
validate: (data) => this["~validate"](data),
|
|
995
|
+
};
|
|
996
|
+
}
|
|
942
997
|
optional() {
|
|
943
998
|
return ZodOptional.create(this, this._def);
|
|
944
999
|
}
|
|
@@ -949,7 +1004,7 @@ class ZodType {
|
|
|
949
1004
|
return this.nullable().optional();
|
|
950
1005
|
}
|
|
951
1006
|
array() {
|
|
952
|
-
return ZodArray.create(this
|
|
1007
|
+
return ZodArray.create(this);
|
|
953
1008
|
}
|
|
954
1009
|
promise() {
|
|
955
1010
|
return ZodPromise.create(this, this._def);
|
|
@@ -1018,11 +1073,12 @@ exports.Schema = ZodType;
|
|
|
1018
1073
|
exports.ZodSchema = ZodType;
|
|
1019
1074
|
const cuidRegex = /^c[^\s-]{8,}$/i;
|
|
1020
1075
|
const cuid2Regex = /^[0-9a-z]+$/;
|
|
1021
|
-
const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}
|
|
1076
|
+
const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
|
|
1022
1077
|
// const uuidRegex =
|
|
1023
1078
|
// /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
1024
1079
|
const uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
|
|
1025
1080
|
const nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
|
1081
|
+
const jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
|
1026
1082
|
const durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
|
1027
1083
|
// from https://stackoverflow.com/a/46181/1550155
|
|
1028
1084
|
// old version: too slow, didn't support unicode
|
|
@@ -1044,9 +1100,15 @@ const _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
|
1044
1100
|
let emojiRegex;
|
|
1045
1101
|
// faster, simpler, safer
|
|
1046
1102
|
const ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
1047
|
-
const
|
|
1103
|
+
const ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
|
|
1104
|
+
// const ipv6Regex =
|
|
1105
|
+
// /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
|
|
1106
|
+
const ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
|
1107
|
+
const ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
1048
1108
|
// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
|
|
1049
1109
|
const base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
1110
|
+
// https://base64.guru/standards/base64url
|
|
1111
|
+
const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
|
|
1050
1112
|
// simple
|
|
1051
1113
|
// const dateRegexSource = `\\d{4}-\\d{2}-\\d{2}`;
|
|
1052
1114
|
// no leap year validation
|
|
@@ -1088,6 +1150,38 @@ function isValidIP(ip, version) {
|
|
|
1088
1150
|
}
|
|
1089
1151
|
return false;
|
|
1090
1152
|
}
|
|
1153
|
+
function isValidJWT(jwt, alg) {
|
|
1154
|
+
if (!jwtRegex.test(jwt))
|
|
1155
|
+
return false;
|
|
1156
|
+
try {
|
|
1157
|
+
const [header] = jwt.split(".");
|
|
1158
|
+
// Convert base64url to base64
|
|
1159
|
+
const base64 = header
|
|
1160
|
+
.replace(/-/g, "+")
|
|
1161
|
+
.replace(/_/g, "/")
|
|
1162
|
+
.padEnd(header.length + ((4 - (header.length % 4)) % 4), "=");
|
|
1163
|
+
const decoded = JSON.parse(atob(base64));
|
|
1164
|
+
if (typeof decoded !== "object" || decoded === null)
|
|
1165
|
+
return false;
|
|
1166
|
+
if (!decoded.typ || !decoded.alg)
|
|
1167
|
+
return false;
|
|
1168
|
+
if (alg && decoded.alg !== alg)
|
|
1169
|
+
return false;
|
|
1170
|
+
return true;
|
|
1171
|
+
}
|
|
1172
|
+
catch (_a) {
|
|
1173
|
+
return false;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
function isValidCidr(ip, version) {
|
|
1177
|
+
if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
|
|
1178
|
+
return true;
|
|
1179
|
+
}
|
|
1180
|
+
if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
|
|
1181
|
+
return true;
|
|
1182
|
+
}
|
|
1183
|
+
return false;
|
|
1184
|
+
}
|
|
1091
1185
|
class ZodString extends ZodType {
|
|
1092
1186
|
_parse(input) {
|
|
1093
1187
|
if (this._def.coerce) {
|
|
@@ -1369,6 +1463,28 @@ class ZodString extends ZodType {
|
|
|
1369
1463
|
status.dirty();
|
|
1370
1464
|
}
|
|
1371
1465
|
}
|
|
1466
|
+
else if (check.kind === "jwt") {
|
|
1467
|
+
if (!isValidJWT(input.data, check.alg)) {
|
|
1468
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1469
|
+
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
1470
|
+
validation: "jwt",
|
|
1471
|
+
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
1472
|
+
message: check.message,
|
|
1473
|
+
});
|
|
1474
|
+
status.dirty();
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
else if (check.kind === "cidr") {
|
|
1478
|
+
if (!isValidCidr(input.data, check.version)) {
|
|
1479
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1480
|
+
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
1481
|
+
validation: "cidr",
|
|
1482
|
+
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
1483
|
+
message: check.message,
|
|
1484
|
+
});
|
|
1485
|
+
status.dirty();
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1372
1488
|
else if (check.kind === "base64") {
|
|
1373
1489
|
if (!base64Regex.test(input.data)) {
|
|
1374
1490
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -1380,6 +1496,17 @@ class ZodString extends ZodType {
|
|
|
1380
1496
|
status.dirty();
|
|
1381
1497
|
}
|
|
1382
1498
|
}
|
|
1499
|
+
else if (check.kind === "base64url") {
|
|
1500
|
+
if (!base64urlRegex.test(input.data)) {
|
|
1501
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1502
|
+
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
1503
|
+
validation: "base64url",
|
|
1504
|
+
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
1505
|
+
message: check.message,
|
|
1506
|
+
});
|
|
1507
|
+
status.dirty();
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1383
1510
|
else {
|
|
1384
1511
|
util_1.util.assertNever(check);
|
|
1385
1512
|
}
|
|
@@ -1426,9 +1553,22 @@ class ZodString extends ZodType {
|
|
|
1426
1553
|
base64(message) {
|
|
1427
1554
|
return this._addCheck({ kind: "base64", ...errorUtil_1.errorUtil.errToObj(message) });
|
|
1428
1555
|
}
|
|
1556
|
+
base64url(message) {
|
|
1557
|
+
// base64url encoding is a modification of base64 that can safely be used in URLs and filenames
|
|
1558
|
+
return this._addCheck({
|
|
1559
|
+
kind: "base64url",
|
|
1560
|
+
...errorUtil_1.errorUtil.errToObj(message),
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
jwt(options) {
|
|
1564
|
+
return this._addCheck({ kind: "jwt", ...errorUtil_1.errorUtil.errToObj(options) });
|
|
1565
|
+
}
|
|
1429
1566
|
ip(options) {
|
|
1430
1567
|
return this._addCheck({ kind: "ip", ...errorUtil_1.errorUtil.errToObj(options) });
|
|
1431
1568
|
}
|
|
1569
|
+
cidr(options) {
|
|
1570
|
+
return this._addCheck({ kind: "cidr", ...errorUtil_1.errorUtil.errToObj(options) });
|
|
1571
|
+
}
|
|
1432
1572
|
datetime(options) {
|
|
1433
1573
|
var _a, _b;
|
|
1434
1574
|
if (typeof options === "string") {
|
|
@@ -1519,8 +1659,7 @@ class ZodString extends ZodType {
|
|
|
1519
1659
|
});
|
|
1520
1660
|
}
|
|
1521
1661
|
/**
|
|
1522
|
-
*
|
|
1523
|
-
* @see {@link ZodString.min}
|
|
1662
|
+
* Equivalent to `.min(1)`
|
|
1524
1663
|
*/
|
|
1525
1664
|
nonempty(message) {
|
|
1526
1665
|
return this.min(1, errorUtil_1.errorUtil.errToObj(message));
|
|
@@ -1582,9 +1721,16 @@ class ZodString extends ZodType {
|
|
|
1582
1721
|
get isIP() {
|
|
1583
1722
|
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
1584
1723
|
}
|
|
1724
|
+
get isCIDR() {
|
|
1725
|
+
return !!this._def.checks.find((ch) => ch.kind === "cidr");
|
|
1726
|
+
}
|
|
1585
1727
|
get isBase64() {
|
|
1586
1728
|
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
|
1587
1729
|
}
|
|
1730
|
+
get isBase64url() {
|
|
1731
|
+
// base64url encoding is a modification of base64 that can safely be used in URLs and filenames
|
|
1732
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64url");
|
|
1733
|
+
}
|
|
1588
1734
|
get minLength() {
|
|
1589
1735
|
let min = null;
|
|
1590
1736
|
for (const ch of this._def.checks) {
|
|
@@ -1879,17 +2025,16 @@ class ZodBigInt extends ZodType {
|
|
|
1879
2025
|
}
|
|
1880
2026
|
_parse(input) {
|
|
1881
2027
|
if (this._def.coerce) {
|
|
1882
|
-
|
|
2028
|
+
try {
|
|
2029
|
+
input.data = BigInt(input.data);
|
|
2030
|
+
}
|
|
2031
|
+
catch (_a) {
|
|
2032
|
+
return this._getInvalidInput(input);
|
|
2033
|
+
}
|
|
1883
2034
|
}
|
|
1884
2035
|
const parsedType = this._getType(input);
|
|
1885
2036
|
if (parsedType !== util_1.ZodParsedType.bigint) {
|
|
1886
|
-
|
|
1887
|
-
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
1888
|
-
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
1889
|
-
expected: util_1.ZodParsedType.bigint,
|
|
1890
|
-
received: ctx.parsedType,
|
|
1891
|
-
});
|
|
1892
|
-
return parseUtil_1.INVALID;
|
|
2037
|
+
return this._getInvalidInput(input);
|
|
1893
2038
|
}
|
|
1894
2039
|
let ctx = undefined;
|
|
1895
2040
|
const status = new parseUtil_1.ParseStatus();
|
|
@@ -1943,6 +2088,15 @@ class ZodBigInt extends ZodType {
|
|
|
1943
2088
|
}
|
|
1944
2089
|
return { status: status.value, value: input.data };
|
|
1945
2090
|
}
|
|
2091
|
+
_getInvalidInput(input) {
|
|
2092
|
+
const ctx = this._getOrReturnCtx(input);
|
|
2093
|
+
(0, parseUtil_1.addIssueToContext)(ctx, {
|
|
2094
|
+
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
2095
|
+
expected: util_1.ZodParsedType.bigint,
|
|
2096
|
+
received: ctx.parsedType,
|
|
2097
|
+
});
|
|
2098
|
+
return parseUtil_1.INVALID;
|
|
2099
|
+
}
|
|
1946
2100
|
gte(value, message) {
|
|
1947
2101
|
return this.setLimit("min", value, true, errorUtil_1.errorUtil.toString(message));
|
|
1948
2102
|
}
|
|
@@ -4255,7 +4409,7 @@ var ZodFirstPartyTypeKind;
|
|
|
4255
4409
|
ZodFirstPartyTypeKind["ZodBranded"] = "ZodBranded";
|
|
4256
4410
|
ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
|
|
4257
4411
|
ZodFirstPartyTypeKind["ZodReadonly"] = "ZodReadonly";
|
|
4258
|
-
})(ZodFirstPartyTypeKind
|
|
4412
|
+
})(ZodFirstPartyTypeKind || (exports.ZodFirstPartyTypeKind = ZodFirstPartyTypeKind = {}));
|
|
4259
4413
|
// requires TS 4.4+
|
|
4260
4414
|
class Class {
|
|
4261
4415
|
constructor(..._) { }
|
|
@@ -4398,7 +4552,7 @@ exports.NEVER = parseUtil_1.INVALID;
|
|
|
4398
4552
|
/******/ // startup
|
|
4399
4553
|
/******/ // Load entry module and return exports
|
|
4400
4554
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
4401
|
-
/******/ var __webpack_exports__ = __nccwpck_require__(
|
|
4555
|
+
/******/ var __webpack_exports__ = __nccwpck_require__(656);
|
|
4402
4556
|
/******/ module.exports = __webpack_exports__;
|
|
4403
4557
|
/******/
|
|
4404
4558
|
/******/ })()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"zod","author":"Colin McDonnell <colin@colinhacks.com>","version":"3.
|
|
1
|
+
{"name":"zod","author":"Colin McDonnell <colin@colinhacks.com>","version":"3.24.1","funding":"https://github.com/sponsors/colinhacks","license":"MIT","types":"index.d.ts","type":"commonjs"}
|
package/dist/Chunk.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { JsChunk } from "@rspack/binding";
|
|
2
2
|
import { ChunkGroup } from "./ChunkGroup";
|
|
3
|
+
import type { EntryOptions } from "./exports";
|
|
3
4
|
export declare class Chunk {
|
|
4
5
|
#private;
|
|
5
6
|
readonly name?: string;
|
|
@@ -30,4 +31,5 @@ export declare class Chunk {
|
|
|
30
31
|
getAllAsyncChunks(): ReadonlySet<Chunk>;
|
|
31
32
|
getAllInitialChunks(): ReadonlySet<Chunk>;
|
|
32
33
|
getAllReferencedChunks(): ReadonlySet<Chunk>;
|
|
34
|
+
getEntryOptions(): Readonly<EntryOptions> | undefined;
|
|
33
35
|
}
|
package/dist/ChunkGraph.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { JsChunkGraph } from "@rspack/binding";
|
|
2
2
|
import { Chunk } from "./Chunk";
|
|
3
|
+
import { ChunkGroup } from "./ChunkGroup";
|
|
4
|
+
import { DependenciesBlock } from "./DependenciesBlock";
|
|
3
5
|
import { Module } from "./Module";
|
|
4
6
|
export declare class ChunkGraph {
|
|
5
7
|
#private;
|
|
@@ -14,4 +16,5 @@ export declare class ChunkGraph {
|
|
|
14
16
|
getModuleChunks(module: Module): Chunk[];
|
|
15
17
|
getModuleChunksIterable(module: Module): Iterable<Chunk>;
|
|
16
18
|
getModuleId(module: Module): string | null;
|
|
19
|
+
getBlockChunkGroup(depBlock: DependenciesBlock): ChunkGroup | null;
|
|
17
20
|
}
|
package/dist/ChunkGroup.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare class ChunkGroup {
|
|
|
7
7
|
readonly index?: number;
|
|
8
8
|
readonly name?: string;
|
|
9
9
|
readonly origins: ReadonlyArray<ChunkGroupOrigin>;
|
|
10
|
+
readonly childrenIterable: Set<ChunkGroup>;
|
|
10
11
|
static __from_binding(binding: JsChunkGroup): ChunkGroup;
|
|
11
12
|
protected constructor(inner: JsChunkGroup);
|
|
12
13
|
getFiles(): ReadonlyArray<string>;
|
package/dist/Compilation.d.ts
CHANGED
|
@@ -250,12 +250,6 @@ export declare class Compilation {
|
|
|
250
250
|
* @param assetInfo - extra asset information
|
|
251
251
|
*/
|
|
252
252
|
emitAsset(filename: string, source: Source, assetInfo?: AssetInfo): void;
|
|
253
|
-
/**
|
|
254
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
255
|
-
*
|
|
256
|
-
* @internal
|
|
257
|
-
*/
|
|
258
|
-
__internal__emit_asset_from_loader(filename: string, source: Source, assetInfo: AssetInfo, module: string): void;
|
|
259
253
|
deleteAsset(filename: string): void;
|
|
260
254
|
renameAsset(filename: string, newFilename: string): void;
|
|
261
255
|
/**
|