@oxog/vld 2.2.7 → 2.4.0
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/CHANGELOG.md +25 -0
- package/dist/chunks/index-CKPStM3V.js +1 -0
- package/dist/cjs/chunks/index-lejEpLfv.cjs +1 -0
- package/dist/cjs/cli/bin.cjs +1 -1
- package/dist/cjs/compile.cjs +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/locales/gu.cjs +1 -0
- package/dist/cjs/locales/index.cjs +1 -1
- package/dist/cjs/locales/kn.cjs +1 -0
- package/dist/cjs/locales/ne.cjs +1 -0
- package/dist/cjs/locales/pt-BR-v4.cjs +1 -0
- package/dist/cjs/locales/sk.cjs +1 -0
- package/dist/cjs/v3/index.cjs +1 -1
- package/dist/cjs/v4/core/index.cjs +1 -1
- package/dist/cjs/v4/index.cjs +1 -1
- package/dist/cjs/v4/locales/index.cjs +1 -1
- package/dist/cjs/v4/mini/index.cjs +1 -1
- package/dist/cjs/v4-mini/index.cjs +1 -1
- package/dist/cjs/validators/object.cjs +1 -1
- package/dist/cjs/validators/string-formats.cjs +1 -1
- package/dist/compile.d.ts +81 -0
- package/dist/compile.js +1 -0
- package/dist/index.d.ts +316 -9
- package/dist/index.js +1 -1
- package/dist/locales/gu.d.ts +2 -0
- package/dist/locales/gu.js +1 -0
- package/dist/locales/index.js +1 -1
- package/dist/locales/kn.d.ts +2 -0
- package/dist/locales/kn.js +1 -0
- package/dist/locales/ne.d.ts +2 -0
- package/dist/locales/ne.js +1 -0
- package/dist/locales/pt-BR-v4.d.ts +2 -0
- package/dist/locales/pt-BR-v4.js +1 -0
- package/dist/locales/sk.d.ts +2 -0
- package/dist/locales/sk.js +1 -0
- package/dist/v3/index.js +1 -1
- package/dist/v4/core/index.d.ts +13 -0
- package/dist/v4/core/index.js +1 -1
- package/dist/v4/index.d.ts +1 -0
- package/dist/v4/index.js +1 -1
- package/dist/v4/locales/index.d.ts +6 -0
- package/dist/v4/locales/index.js +1 -1
- package/dist/v4/mini/index.js +1 -1
- package/dist/v4-mini/index.d.ts +2 -0
- package/dist/v4-mini/index.js +1 -1
- package/dist/validators/custom.js +1 -1
- package/dist/validators/object.d.ts +9 -0
- package/dist/validators/object.js +1 -1
- package/dist/validators/string-formats.d.ts +1 -0
- package/dist/validators/string-formats.js +1 -1
- package/package.json +7 -2
- package/dist/chunks/index-yjpbvFgw.js +0 -1
- package/dist/cjs/chunks/index-BEV9nG0N.cjs +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VLD AOT compiler - generates a flat, loop-free JavaScript validator that
|
|
3
|
+
* mirrors Zod 4.5's `z.compile()` strategy.
|
|
4
|
+
*
|
|
5
|
+
* Zod's secret: a compiled validator is a single function whose body is a
|
|
6
|
+
* sequence of `const vNinput["key"]; if (typeof vN !== "X") return INVALID;`
|
|
7
|
+
* statements, followed by either `return true` (validate-only path) or a
|
|
8
|
+
* result-building step (parse path). No function calls, no IIFEs, no shadow
|
|
9
|
+
* bindings. V8's TurboFan inliner produces machine code that is essentially
|
|
10
|
+
* a sequence of type checks and a `return`.
|
|
11
|
+
*
|
|
12
|
+
* The implementation below walks the schema, emits the same shape, and
|
|
13
|
+
* caches compiled validators on the schema's `_zod.bag.validator` so
|
|
14
|
+
* subsequent `v.validate()` / `v.compile()` calls return the same function.
|
|
15
|
+
*/
|
|
16
|
+
import { VldBase } from './validators/base.js';
|
|
17
|
+
import { VldObject } from './validators/object.js';
|
|
18
|
+
export declare class ZodCompileError extends Error {
|
|
19
|
+
constructor(message: string);
|
|
20
|
+
}
|
|
21
|
+
export declare class ZodCompileAsyncError extends ZodCompileError {
|
|
22
|
+
constructor(message?: string);
|
|
23
|
+
}
|
|
24
|
+
export { ZodCompileAsyncError as _ZodCompileAsyncError };
|
|
25
|
+
export declare class ZodCompileUnsupportedError extends ZodCompileError {
|
|
26
|
+
constructor(message?: string);
|
|
27
|
+
}
|
|
28
|
+
export { ZodCompileUnsupportedError as _ZodCompileUnsupportedError };
|
|
29
|
+
/**
|
|
30
|
+
* A compiled validator is `(input) => parsedValue | COMPILE_INVALID`. It is
|
|
31
|
+
* identified so the outer `validate()` and `parse()` wrappers can take the
|
|
32
|
+
* fast path and fall back to the standard parser on rejection.
|
|
33
|
+
*/
|
|
34
|
+
export type CompiledValidator = ((input: unknown) => unknown) & {
|
|
35
|
+
__vld_compiled: true;
|
|
36
|
+
};
|
|
37
|
+
declare const COMPILE_INVALID: unique symbol;
|
|
38
|
+
export declare const memoizer: <K extends object, V>(compute: (key: K) => V) => ((key: K) => V);
|
|
39
|
+
/**
|
|
40
|
+
* Build the compiled validator for a schema. Returns `null` if the schema
|
|
41
|
+
* cannot be fully lowered - callers fall back to the runtime parser.
|
|
42
|
+
*/
|
|
43
|
+
export declare function compileFn(schema: VldBase<any, any>, options?: {
|
|
44
|
+
validateOnly?: boolean;
|
|
45
|
+
}): CompiledValidator | null;
|
|
46
|
+
/**
|
|
47
|
+
* Slimmer validator used by `v.validate()`. Identical checks to `compileFn`
|
|
48
|
+
* but emits `return true` instead of allocating a result object/array, so
|
|
49
|
+
* V8 inlines the body more aggressively.
|
|
50
|
+
*/
|
|
51
|
+
export declare function compileFnValidate(schema: VldBase<any, any>): CompiledValidator | null;
|
|
52
|
+
/**
|
|
53
|
+
* Wrap a compiled validator into a VLD-compatible schema. The wrapper's
|
|
54
|
+
* `parse` and `safeParse` first call the compiled fast path; on failure
|
|
55
|
+
* they delegate to the underlying schema.
|
|
56
|
+
*
|
|
57
|
+
* `compiled` is the *parse* validator: it returns the parsed value on
|
|
58
|
+
* success and COMPILE_INVALID on failure. `validateOnly` (if supplied)
|
|
59
|
+
* is a slimmer validator that only returns `true` / COMPILE_INVALID; it is
|
|
60
|
+
* what `validate()` uses.
|
|
61
|
+
*
|
|
62
|
+
* For maximum parse performance we delegate the result-construction step
|
|
63
|
+
* to the schema's own parse method (VldObject.parse, VldArray.parse, etc.),
|
|
64
|
+
* which already does the per-shape work (strip unknown keys, clone, etc.)
|
|
65
|
+
* and is heavily optimised. The compiled parse path then becomes
|
|
66
|
+
* "compiledValidate(input) ? schema.parse(input) : throw", which keeps
|
|
67
|
+
* V8's inlining budget focused on a tiny validator function - exactly
|
|
68
|
+
* Zod 4.5's strategy.
|
|
69
|
+
*/
|
|
70
|
+
export declare function applyCompiled<T extends VldBase<any, any>>(schema: T, compiled: CompiledValidator, validateOnly?: CompiledValidator): T;
|
|
71
|
+
export declare function compile<T extends VldBase<any, any>>(schema: T, options?: {
|
|
72
|
+
JITless?: boolean;
|
|
73
|
+
}): T;
|
|
74
|
+
export declare function validate(schema: VldBase<any, any>, value: unknown): boolean;
|
|
75
|
+
export declare function validateAsync(schema: VldBase<any, any>, value: unknown): Promise<boolean>;
|
|
76
|
+
export declare function properties<T extends Record<string, VldBase<any, any>>>(shape: T): VldObject<Partial<{
|
|
77
|
+
[K in keyof T]: T[K] extends VldBase<any, infer O> ? O : never;
|
|
78
|
+
}>>;
|
|
79
|
+
export declare function getDiscriminatedOption(discriminator: string, options: ReadonlyArray<VldBase<any, any>>, value: unknown): VldBase<any, any> | undefined;
|
|
80
|
+
export declare function toZod(value: unknown): VldBase<any, any>;
|
|
81
|
+
export { COMPILE_INVALID };
|
package/dist/compile.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{VldBase as t}from"./validators/base.js";import{VldString as e}from"./validators/string.js";import{VldNumber as i}from"./validators/number.js";import{VldBoolean as r}from"./validators/boolean.js";import{VldBigInt as n}from"./validators/bigint.js";import{VldUndefined as s}from"./validators/undefined.js";import{VldNull as o}from"./validators/null.js";import{VldObject as a}from"./validators/object.js";import{VldArray as u}from"./validators/array.js";import{VldUnknown as l}from"./validators/unknown.js";class h extends Error{constructor(t){super(t),this.name="ZodCompileError"}}class c extends h{constructor(t="Cannot compile async schema"){super(t),this.name="ZodCompileAsyncError"}}class f extends h{constructor(t="Schema node is not supported by the AOT compiler"){super(t),this.name="ZodCompileUnsupportedError"}}const $=Symbol.for("@oxog/vld/compile-invalid");const d=t=>{const e=new WeakMap;return i=>{const r=e.get(i);if(void 0!==r)return r;const n=t(i);return e.set(i,n),n}};function v(t){return t&&t.constructor&&t.constructor.name||""}function p(t,e){return`__${e}${t.scratch++}`}function _(t,e,i){if(!i.failed){if("VldString"===v(t)){const r=t._checks,n=t._checkMetas,s=[];if(n)for(const t of n)switch(t.kind){case"min":s.push(`__v.length >= ${t.value}`);break;case"max":s.push(`__v.length <= ${t.value}`);break;case"length":s.push(`__v.length === ${t.value}`);break;case"regex":{const e=(t.pattern??t.value?.source??String(t.value)).replace(/\\/g,"\\\\").replace(/\//g,"\\/");s.push(`/${e}/.test(__v)`);break}case"startsWith":s.push(`__v.startsWith(${JSON.stringify(t.value)})`);break;case"endsWith":s.push(`__v.endsWith(${JSON.stringify(t.value)})`);break;case"includes":s.push(`__v.includes(${JSON.stringify(t.value)})`);break;case"email":case"url":case"uuid":case"ip":break;default:if(r&&r.length>0)return void(i.failed=!0)}else if(r&&r.length>0)return void(i.failed=!0);return void(0===s.length?i.hoist.push(`if (typeof ${e} !== "string") ${i.throwOnFail?"throw":"return"} ${i.invalid}; ${i.validateOnly?i.outParam+" = true; ":(i.skipOutAssign?"":i.outParam+" = ")+e};`):i.hoist.push(`{ const __v = ${e}; if (typeof __v !== "string" || !(${s.join(" && ")})) ${i.throwOnFail?"throw":"return"} ${i.invalid}; ${i.outParam} = __v; }`))}if("VldNumber"===v(t)){const r=t._checks,n=t._checkMetas,s=[];if(n)for(const t of n)switch(t.kind){case"int":s.push("Number.isInteger(__v)");break;case"finite":s.push("Number.isFinite(__v)");break;case"min":s.push(!1!==t.inclusive?`__v >= ${t.value}`:`__v > ${t.value}`);break;case"max":s.push(!1!==t.inclusive?`__v <= ${t.value}`:`__v < ${t.value}`);break;case"gt":s.push(`__v > ${t.value}`);break;case"gte":s.push(`__v >= ${t.value}`);break;case"lt":s.push(`__v < ${t.value}`);break;case"lte":s.push(`__v <= ${t.value}`);break;case"multipleOf":s.push(`__v % ${t.value} === 0`);break;case"positive":s.push("__v > 0");break;case"negative":s.push("__v < 0");break;case"nonnegative":s.push("__v >= 0");break;case"nonpositive":s.push("__v <= 0");break;case"safe":s.push("Number.isSafeInteger(__v)");break;default:if(r&&r.length>0)return void(i.failed=!0)}else if(r&&r.length>0)return void(i.failed=!0);const o=['typeof __v === "number"',"!Number.isNaN(__v)",...s];return void i.hoist.push(`{ const __v = ${e}; if (!(${o.join(" && ")})) ${i.throwOnFail?"throw":"return"} ${i.invalid}; ${i.outParam} = __v; }`)}if("VldBoolean"!==v(t)){if("VldBigInt"===v(t)){const r=t._checks,n=t._checkMetas,s=[];if(n)for(const t of n)switch(t.kind){case"min":s.push(`__v >= ${t.value}n`);break;case"max":s.push(`__v <= ${t.value}n`);break;case"positive":s.push("__v > 0n");break;case"negative":s.push("__v < 0n");break;case"nonnegative":s.push("__v >= 0n");break;case"nonpositive":s.push("__v <= 0n");break;default:if(r&&r.length>0)return void(i.failed=!0)}else if(r&&r.length>0)return void(i.failed=!0);const o=['typeof __v === "bigint"',...s];return void i.hoist.push(`{ const __v = ${e}; if (!(${o.join(" && ")})) ${i.throwOnFail?"throw":"return"} ${i.invalid}; ${i.outParam} = __v; }`)}if("VldDate"!==v(t))if("VldNull"!==v(t))if("VldUndefined"!==v(t))if("VldAny"!==v(t)&&"VldUnknown"!==v(t)){if("VldLiteral"===v(t)){const r=t._values||[];if(0===r.length)return void i.hoist.push(`${i.throwOnFail?"throw":"return"} ${i.invalid};`);if(1===r.length){const t=r[0],n="number"==typeof t&&Number.isNaN(t)?"NaN":JSON.stringify(t);return void i.hoist.push(`if (!Object.is(${n}, ${e})) ${i.throwOnFail?"throw":"return"} ${i.invalid}; ${i.validateOnly?i.outParam+" = true; ":(i.skipOutAssign?"":i.outParam+" = ")+e};`)}const n=p(i,"set");return i.hoist.push(`const ${n} = new Set([${r.map(t=>"number"==typeof t&&Number.isNaN(t)?"NaN":JSON.stringify(t)).join(",")}]);`),void i.hoist.push(`if (!${n}.has(${e})) ${i.throwOnFail?"throw":"return"} ${i.invalid}; ${i.validateOnly?i.outParam+" = true; ":(i.skipOutAssign?"":i.outParam+" = ")+e};`)}if("VldEnum"===v(t)){const r=t._values||[],n=p(i,"set");return i.hoist.push(`const ${n} = new Set([${r.map(t=>JSON.stringify(t)).join(",")}]);`),void i.hoist.push(`if (!${n}.has(${e})) ${i.throwOnFail?"throw":"return"} ${i.invalid}; ${i.validateOnly?i.outParam+" = true; ":(i.skipOutAssign?"":i.outParam+" = ")+e};`)}if("VldOptional"===v(t)){const r=t.baseValidator;return i.hoist.push(`if (${e} === undefined) { ${i.outParam} = undefined; } else {`),_(r,e,i),void i.hoist.push("}")}if("VldArray"===v(t)){const r=t.config?.itemValidator??t.config?.element;if(!r)return void(i.failed=!0);const n=p(i,"arr"),s=p(i,"i");if("VldObject"===v(r)){if(i.hoist.push(`if (!Array.isArray(${e})) ${i.throwOnFail?"throw":"return"} ${i.invalid};`),i.validateOnly){if(i.hoist.push(`for (let ${s} = 0; ${s} < ${e}.length; ${s}++) {`),_(r,`${e}[${s}]`,i),i.failed)return;return i.hoist.push("}"),void i.hoist.push(`${i.outParam} = true;`)}i.hoist.push(`const ${n} = new Array(${e}.length);`);const t={invalid:i.invalid,outParam:"__slot",scratch:0,hoist:[],failed:!1,skipOutAssign:!0};return t.hoist.push(`for (let ${s} = 0; ${s} < ${e}.length; ${s}++) {`," let __slot;"),_(r,`${e}[${s}]`,t),t.failed?void(i.failed=!0):(t.hoist.push(` ${n}[${s}] = __slot;`,"}"),i.hoist.push(...t.hoist),void i.hoist.push(`${i.outParam} = ${n};`))}const o=p(i,"it");if(i.hoist.push(`if (!Array.isArray(${e})) ${i.throwOnFail?"throw":"return"} ${i.invalid};`),i.validateOnly)return i.hoist.push(`for (let ${s} = 0; ${s} < ${e}.length; ${s}++) {`,` const ${o} = ${e}[${s}];`),_(r,o,i),i.hoist.push("}"),void i.hoist.push(`${i.outParam} = true;`);if(i.hoist.push(`const ${n} = new Array(${e}.length);`,`for (let ${s} = 0; ${s} < ${e}.length; ${s}++) {`),_(r,`${e}[${s}]`,i),i.failed)return;return void i.hoist.push(` ${n}[${s}] = ${e}[${s}];`,"}",`${i.outParam} = ${n};`)}if("VldTuple"===v(t)){const r=t.validators.filter(t=>Boolean(t)),n=t.restValidator,s=p(i,"tup"),o=n?`${e}.length < ${r.length}`:`${e}.length !== ${r.length}`;if(i.hoist.push(`if (!Array.isArray(${e}) || ${o}) ${i.throwOnFail?"throw":"return"} ${i.invalid};`),i.validateOnly){for(let t=0;t<r.length;t++){const n=r[t];if(!n)return void(i.failed=!0);if(_(n,`${e}[${t}]`,i),i.failed)return}if(n){const t=p(i,"i");i.hoist.push(`for (let ${t} = ${r.length}; ${t} < ${e}.length; ${t}++) {`),_(n,`${e}[${t}]`,i),i.hoist.push("}")}return void i.hoist.push(`${i.outParam} = true;`)}i.hoist.push(`const ${s} = new Array(${e}.length);`);for(let t=0;t<r.length;t++){const n=r[t];if(!n)return void(i.failed=!0);const o=p(i,"it");i.hoist.push(`{ const ${o} = ${e}[${t}];`);const a=i.skipOutAssign??!1;i.skipOutAssign=!0,_(n,o,i),i.skipOutAssign=a,i.hoist.push(` ${s}[${t}] = ${o}; }`)}if(n){const t=p(i,"i"),o=p(i,"it");i.hoist.push(`for (let ${t} = ${r.length}; ${t} < ${e}.length; ${t}++) {`,` const ${o} = ${e}[${t}];`);const a=i.skipOutAssign??!1;i.skipOutAssign=!0,_(n,o,i),i.skipOutAssign=a,i.hoist.push(` ${s}[${t}] = ${o}; }`)}return void i.hoist.push(`${i.outParam} = ${s};`)}if("VldObject"===v(t)){const r=t._config?.shape;if(!r)return void(i.failed=!0);const n=p(i,"o");if(i.hoist.push(`if (typeof ${e} !== "object" || ${e} === null || Array.isArray(${e})) ${i.throwOnFail?"throw":"return"} ${i.invalid};`),i.validateOnly){for(const t of Object.keys(r)){const n=r[t];if(!n)return void(i.failed=!0);if(_(n,`${e}${/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t)?`.${t}`:`[${JSON.stringify(t)}]`}`,i),i.failed)return}return void i.hoist.push(`${i.outParam} = true;`)}i.hoist.push(`const ${n} = {};`);for(const t of Object.keys(r)){const s=r[t];if(!s)return void(i.failed=!0);const o=/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t)?`.${t}`:`[${JSON.stringify(t)}]`,a=p(i,"p");i.hoist.push(`{ const ${a} = ${e}${o};`);const u=i.skipOutAssign??!1;i.skipOutAssign=!0,_(s,a,i),i.skipOutAssign=u,i.hoist.push(` ${n}${o} = ${a}; }`)}return void i.hoist.push(`${i.outParam} = ${n};`)}if("VldRecord"===v(t)){const r=t.keyValidator,n=t.valueValidator,s=p(i,"rec"),o=p(i,"ks"),a=p(i,"i"),u=p(i,"k"),l=p(i,"v");return i.hoist.push(`if (typeof ${e} !== "object" || ${e} === null || Array.isArray(${e})) ${i.throwOnFail?"throw":"return"} ${i.invalid};`,`const ${s} = {};`,`const ${o} = Object.keys(${e});`,`for (let ${a} = 0; ${a} < ${o}.length; ${a}++) {`,` let ${u} = ${o}[${a}];`),_(r,u,i),i.hoist.push(` let ${l} = ${e}[${o}[${a}]];`),_(n,l,i),void i.hoist.push(` ${s}[${u}] = ${l};`,"}",""+(i.validateOnly?i.outParam+" = true; ":i.outParam+" = "+s+";"))}if("VldUnion"===v(t)){const e=t.validators.filter(t=>Boolean(t));if(0===e.length)return void(i.failed=!0);const r=p(i,"u");i.hoist.push(`let ${r} = ${i.invalid};`);for(let t=0;t<e.length;t++){const n=e[t],s=v(n);if("VldString"===s){i.hoist.push(`if (typeof value === "string") { ${r} = value; }`,`else if (${r} === ${i.invalid}) { /* fall through to next option */ }`);continue}if("VldNumber"===s){i.hoist.push(`if (typeof value === "number" && value === value) { ${r} = value; }`,`else if (${r} === ${i.invalid}) { /* fall through */ }`);continue}if("VldBoolean"===s){i.hoist.push(`if (typeof value === "boolean") { ${r} = value; }`,`else if (${r} === ${i.invalid}) { /* fall through */ }`);continue}if("VldNull"===s){i.hoist.push(`if (value === null) { ${r} = value; }`,`else if (${r} === ${i.invalid}) { /* fall through */ }`);continue}if("VldUndefined"===s){i.hoist.push(`if (value === undefined) { ${r} = value; }`,`else if (${r} === ${i.invalid}) { /* fall through */ }`);continue}if("VldLiteral"===s){const t=n._values||[];if(1===t.length){const e=t[0],n="number"==typeof e&&Number.isNaN(e)?"NaN":JSON.stringify(e);i.hoist.push(`if (Object.is(${n}, value)) { ${r} = value; }`,`else if (${r} === ${i.invalid}) { /* fall through */ }`);continue}}const o={invalid:i.invalid,outParam:r,scratch:0,hoist:[],failed:!1,skipOutAssign:!0};if(_(n,"value",o),o.failed)return void(i.failed=!0);i.hoist.push(`${r} = ((value) => {`,...o.hoist.map(t=>" "+t)," return value;","})(value);",`if (${r} !== ${i.invalid}) { /* matched */ }`)}return void i.hoist.push(`if (${r} === ${i.invalid}) ${i.throwOnFail?"throw":"return"} ${i.invalid}; ${i.outParam} = ${r};`)}i.failed=!0}else i.hoist.push((i.validateOnly?i.outParam+" = true; ":(i.skipOutAssign?"":i.outParam+" = ")+e)+";");else i.hoist.push(`if (${e} !== undefined) ${i.throwOnFail?"throw":"return"} ${i.invalid}; ${i.outParam} = undefined;`);else i.hoist.push(`if (${e} !== null) ${i.throwOnFail?"throw":"return"} ${i.invalid}; ${i.outParam} = null;`);else i.hoist.push(`{ const __v = ${e}; if (!(__v instanceof Date) || __v.getTime() !== __v.getTime()) ${i.throwOnFail?"throw":"return"} ${i.invalid}; ${i.outParam} = __v; }`)}else i.hoist.push(`if (typeof ${e} !== "boolean") ${i.throwOnFail?"throw":"return"} ${i.invalid}; ${i.validateOnly?i.outParam+" = true; ":(i.skipOutAssign?"":i.outParam+" = ")+e};`)}}function g(t,e){if(!t||"function"!=typeof t.parse)return null;const i=!!e?.validateOnly,r={invalid:"__INV",outParam:i?"__ok":"__out",scratch:0,hoist:[],failed:!1,validateOnly:i};if(r.hoist.push(i?"let __ok;":"let __out;"),_(t,"value",r),r.failed)return"1"===process.env.VLD_COMPILE_DEBUG&&console.error("[compile] failed to lower schema; partial body:\n"+r.hoist.join("\n")),null;r.hoist.push(i?"return __ok;":"return __out;");const n=r.hoist.join("\n"),s=new Function("value",r.invalid,n),o=t=>s(t,$);return Object.defineProperty(o,"__vld_compiled",{value:!0,enumerable:!1}),o}function m(t){return g(t,{validateOnly:!0})}function b(t,e,i){const r=t.parse.bind(t),n=t.safeParse.bind(t),s=$,o=i??e;return t.parse=t=>o(t)===s?r(t):t,t.safeParse=t=>o(t)===s?n(t):{success:!0,data:t},Object.defineProperty(t,"_zod",{value:{bag:{validator:e,validatorValidate:i}},enumerable:!1,configurable:!0}),t}function y(t,e){const i=t?._zod?.bag?.validator;if(i)return t;const r=function(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}(t);if(e?.JITless)return Object.defineProperty(r,"_zod",{value:{bag:{}},enumerable:!1,configurable:!0}),r;const n=m(r);return n?b(r,n,n):r}function O(t,e){const i=t?._zod?.bag?.validatorValidate??t?._zod?.bag?.validator;if(i)try{return i(e)!==$}catch{return!1}const r=t.safeParse(e);return Boolean(r?.success)}async function k(t,e){const i=t?._zod?.bag?.validatorValidate??t?._zod?.bag?.validator;if(i)try{return i(e)!==$}catch{return!1}const r=await t.safeParseAsync(e);return Boolean(r?.success)}function w(t){const e={};for(const i of Object.keys(t))e[i]=t[i].optional();return a.create(e)}function A(t,e,i){if(null===i||"object"!=typeof i||Array.isArray(i))return;const r=i[t];for(const i of e){const e=i._config?.shape;if(!e)continue;const n=e[t];if(!n)continue;const s=n._values||[];for(const t of s)if(Object.is(t,r))return i}}function P(h){if(h instanceof t)return h;if(null===h)return o.create();switch(null===h?"null":Array.isArray(h)?"array":typeof h){case"string":return e.create();case"number":return i.create();case"boolean":return r.create();case"bigint":return n.create();case"undefined":return s.create();case"array":return u.create(l.create());case"object":return a.create(h);default:return l.create()}}export{$ as COMPILE_INVALID,c as ZodCompileAsyncError,h as ZodCompileError,f as ZodCompileUnsupportedError,c as _ZodCompileAsyncError,f as _ZodCompileUnsupportedError,b as applyCompiled,y as compile,g as compileFn,m as compileFnValidate,A as getDiscriminatedOption,d as memoizer,w as properties,P as toZod,O as validate,k as validateAsync};
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { VldBase, type ErrorParam, type ParseResult, type SchemaMetadata, type SuperRefineContext } from './validators/base.js';
|
|
17
17
|
import type { Infer, Input, Output } from './validators/index.js';
|
|
18
|
+
import { registry } from './registry.js';
|
|
18
19
|
import { VldError, type VldIssue } from './errors-core.js';
|
|
19
20
|
import { VldString } from './validators/string.js';
|
|
20
21
|
import { VldNumber } from './validators/number.js';
|
|
@@ -63,6 +64,7 @@ import { VldCoerceDate } from './coercion/date.js';
|
|
|
63
64
|
import { VldCoerceBigInt } from './coercion/bigint.js';
|
|
64
65
|
import { flattenError as flattenErrorFn, prettifyError as prettifyErrorFn, treeifyError as treeifyErrorFn } from './errors.js';
|
|
65
66
|
import { fromJSONSchema as fromJSONSchemaFn, toJSONSchema as toJSONSchemaFn } from './utils/json-schema.js';
|
|
67
|
+
import { validate as validateFn, validateAsync as validateAsyncFn, properties as propertiesFn, getDiscriminatedOption as getDiscriminatedOptionFn, toZod as toZodFn, ZodCompileError as ZodCompileErrorClass, ZodCompileAsyncError as ZodCompileAsyncErrorClass, ZodCompileUnsupportedError as ZodCompileUnsupportedErrorClass } from './compile.js';
|
|
66
68
|
import * as stringFormats from './validators/string-formats.js';
|
|
67
69
|
type NativeEnumLike = Record<string, string | number>;
|
|
68
70
|
type Constructor<T = unknown> = abstract new (...args: any[]) => T;
|
|
@@ -134,7 +136,8 @@ export declare const core: {
|
|
|
134
136
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
135
137
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
136
138
|
};
|
|
137
|
-
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "
|
|
139
|
+
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "date" | "null" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
140
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
138
141
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
139
142
|
emoji: () => RegExp;
|
|
140
143
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -336,7 +339,8 @@ export declare const v: {
|
|
|
336
339
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
337
340
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
338
341
|
};
|
|
339
|
-
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "
|
|
342
|
+
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "date" | "null" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
343
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
340
344
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
341
345
|
emoji: () => RegExp;
|
|
342
346
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -476,7 +480,8 @@ export declare const v: {
|
|
|
476
480
|
guid: () => stringFormats.VldStringFormat;
|
|
477
481
|
httpUrl: () => stringFormats.VldStringFormat;
|
|
478
482
|
ksuid: () => stringFormats.VldStringFormat;
|
|
479
|
-
regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "
|
|
483
|
+
regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "date" | "null" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
484
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
480
485
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
481
486
|
emoji: () => RegExp;
|
|
482
487
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -487,6 +492,15 @@ export declare const v: {
|
|
|
487
492
|
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
488
493
|
uuid: (version?: number) => RegExp;
|
|
489
494
|
}>;
|
|
495
|
+
compile: <T extends VldBase<any, any>>(schema: T, options?: {
|
|
496
|
+
JITless?: boolean;
|
|
497
|
+
}) => T;
|
|
498
|
+
validate: typeof validateFn;
|
|
499
|
+
validateAsync: typeof validateAsyncFn;
|
|
500
|
+
properties: typeof propertiesFn;
|
|
501
|
+
getDiscriminatedOption: typeof getDiscriminatedOptionFn;
|
|
502
|
+
memoizer: <K extends object, V>(compute: (key: K) => V) => ((key: K) => V);
|
|
503
|
+
toZod: typeof toZodFn;
|
|
490
504
|
templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral;
|
|
491
505
|
base64Bytes: () => VldBase64;
|
|
492
506
|
hexBytes: () => VldHex;
|
|
@@ -515,6 +529,95 @@ export declare const v: {
|
|
|
515
529
|
flattenError: typeof flattenErrorFn;
|
|
516
530
|
toJSONSchema: typeof toJSONSchemaFn;
|
|
517
531
|
fromJSONSchema: typeof fromJSONSchemaFn;
|
|
532
|
+
globalRegistry: import("./registry.js").SchemaRegistry<SchemaMetadata>;
|
|
533
|
+
registry: typeof registry;
|
|
534
|
+
_default: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, defaultValue: TOutput | (() => TOutput)) => VldDefault<TInput, TOutput>;
|
|
535
|
+
success: <TOutput = unknown>(_val?: TOutput) => VldCustom<TOutput>;
|
|
536
|
+
_function: () => VldFunction;
|
|
537
|
+
ZodType: typeof VldBase;
|
|
538
|
+
ZodTypeAny: typeof VldBase;
|
|
539
|
+
ZodTypeDef: ObjectConstructor;
|
|
540
|
+
ZodError: typeof VldError;
|
|
541
|
+
ZodRealError: typeof VldError;
|
|
542
|
+
ZodCompileError: typeof ZodCompileErrorClass;
|
|
543
|
+
ZodCompileAsyncError: typeof ZodCompileAsyncErrorClass;
|
|
544
|
+
ZodCompileUnsupportedError: typeof ZodCompileUnsupportedErrorClass;
|
|
545
|
+
_ZodString: typeof VldString;
|
|
546
|
+
ZodString: typeof VldString;
|
|
547
|
+
ZodStringFormat: typeof VldString;
|
|
548
|
+
ZodEmail: typeof VldString;
|
|
549
|
+
ZodGUID: typeof VldString;
|
|
550
|
+
ZodUUID: typeof VldString;
|
|
551
|
+
ZodURL: typeof VldString;
|
|
552
|
+
ZodEmoji: typeof VldString;
|
|
553
|
+
ZodNanoID: typeof VldString;
|
|
554
|
+
ZodCUID: typeof VldString;
|
|
555
|
+
ZodCUID2: typeof VldString;
|
|
556
|
+
ZodULID: typeof VldString;
|
|
557
|
+
ZodXID: typeof VldString;
|
|
558
|
+
ZodKSUID: typeof VldString;
|
|
559
|
+
ZodIPv4: typeof VldString;
|
|
560
|
+
ZodMAC: typeof VldString;
|
|
561
|
+
ZodIPv6: typeof VldString;
|
|
562
|
+
ZodCIDRv4: typeof VldString;
|
|
563
|
+
ZodCIDRv6: typeof VldString;
|
|
564
|
+
ZodBase64: typeof VldString;
|
|
565
|
+
ZodBase64URL: typeof VldString;
|
|
566
|
+
ZodE164: typeof VldString;
|
|
567
|
+
ZodJWT: typeof VldString;
|
|
568
|
+
ZodCustomStringFormat: typeof VldString;
|
|
569
|
+
ZodNumber: typeof VldNumber;
|
|
570
|
+
ZodNumberFormat: typeof VldNumber;
|
|
571
|
+
ZodBoolean: typeof VldBoolean;
|
|
572
|
+
ZodBigInt: typeof VldBigInt;
|
|
573
|
+
ZodBigIntFormat: typeof VldBigInt;
|
|
574
|
+
ZodSymbol: typeof VldSymbol;
|
|
575
|
+
ZodUndefined: typeof VldUndefined;
|
|
576
|
+
ZodNull: typeof VldNull;
|
|
577
|
+
ZodAny: typeof VldAny;
|
|
578
|
+
ZodUnknown: typeof VldUnknown;
|
|
579
|
+
ZodNever: typeof VldNever;
|
|
580
|
+
ZodVoid: typeof VldVoid;
|
|
581
|
+
ZodDate: typeof VldDate;
|
|
582
|
+
ZodArray: typeof VldArray;
|
|
583
|
+
ZodObject: typeof VldObject;
|
|
584
|
+
ZodUnion: typeof VldUnion;
|
|
585
|
+
ZodXor: typeof VldXor;
|
|
586
|
+
ZodDiscriminatedUnion: typeof VldDiscriminatedUnion;
|
|
587
|
+
ZodIntersection: typeof VldIntersection;
|
|
588
|
+
ZodTuple: typeof VldTuple;
|
|
589
|
+
ZodRecord: typeof VldRecord;
|
|
590
|
+
ZodMap: typeof VldMap;
|
|
591
|
+
ZodSet: typeof VldSet;
|
|
592
|
+
ZodEnum: typeof VldEnum;
|
|
593
|
+
ZodLiteral: typeof VldLiteral;
|
|
594
|
+
ZodFile: typeof VldFile;
|
|
595
|
+
ZodTransform: typeof VldBase;
|
|
596
|
+
ZodOptional: typeof VldBase;
|
|
597
|
+
ZodExactOptional: typeof VldBase;
|
|
598
|
+
ZodNullable: typeof VldBase;
|
|
599
|
+
ZodDefault: typeof VldBase;
|
|
600
|
+
ZodPrefault: typeof VldBase;
|
|
601
|
+
ZodNonOptional: typeof VldBase;
|
|
602
|
+
ZodSuccess: typeof VldCustom;
|
|
603
|
+
ZodCatch: typeof VldBase;
|
|
604
|
+
ZodNaN: typeof VldNan;
|
|
605
|
+
ZodPipe: typeof VldBase;
|
|
606
|
+
ZodCodec: typeof VldCodec;
|
|
607
|
+
ZodPreprocess: typeof VldBase;
|
|
608
|
+
ZodReadonly: typeof VldBase;
|
|
609
|
+
ZodTemplateLiteral: typeof VldTemplateLiteral;
|
|
610
|
+
ZodLazy: typeof VldLazy;
|
|
611
|
+
ZodPromise: typeof VldPromise;
|
|
612
|
+
ZodFunction: typeof VldFunction;
|
|
613
|
+
ZodCustom: typeof VldCustom;
|
|
614
|
+
ZodISODateTime: typeof VldString;
|
|
615
|
+
ZodISODate: typeof VldString;
|
|
616
|
+
ZodISOTime: typeof VldString;
|
|
617
|
+
ZodISODuration: typeof VldString;
|
|
618
|
+
$brand: symbol;
|
|
619
|
+
$output: symbol;
|
|
620
|
+
$input: symbol;
|
|
518
621
|
};
|
|
519
622
|
export declare namespace v {
|
|
520
623
|
type infer<T extends VldBase<any, any>> = Infer<T>;
|
|
@@ -689,7 +792,8 @@ export declare const z: {
|
|
|
689
792
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
690
793
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
691
794
|
};
|
|
692
|
-
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "
|
|
795
|
+
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "date" | "null" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
796
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
693
797
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
694
798
|
emoji: () => RegExp;
|
|
695
799
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -829,7 +933,8 @@ export declare const z: {
|
|
|
829
933
|
guid: () => stringFormats.VldStringFormat;
|
|
830
934
|
httpUrl: () => stringFormats.VldStringFormat;
|
|
831
935
|
ksuid: () => stringFormats.VldStringFormat;
|
|
832
|
-
regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "
|
|
936
|
+
regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "date" | "null" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
937
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
833
938
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
834
939
|
emoji: () => RegExp;
|
|
835
940
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -840,6 +945,15 @@ export declare const z: {
|
|
|
840
945
|
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
841
946
|
uuid: (version?: number) => RegExp;
|
|
842
947
|
}>;
|
|
948
|
+
compile: <T extends VldBase<any, any>>(schema: T, options?: {
|
|
949
|
+
JITless?: boolean;
|
|
950
|
+
}) => T;
|
|
951
|
+
validate: typeof validateFn;
|
|
952
|
+
validateAsync: typeof validateAsyncFn;
|
|
953
|
+
properties: typeof propertiesFn;
|
|
954
|
+
getDiscriminatedOption: typeof getDiscriminatedOptionFn;
|
|
955
|
+
memoizer: <K extends object, V>(compute: (key: K) => V) => ((key: K) => V);
|
|
956
|
+
toZod: typeof toZodFn;
|
|
843
957
|
templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral;
|
|
844
958
|
base64Bytes: () => VldBase64;
|
|
845
959
|
hexBytes: () => VldHex;
|
|
@@ -868,6 +982,95 @@ export declare const z: {
|
|
|
868
982
|
flattenError: typeof flattenErrorFn;
|
|
869
983
|
toJSONSchema: typeof toJSONSchemaFn;
|
|
870
984
|
fromJSONSchema: typeof fromJSONSchemaFn;
|
|
985
|
+
globalRegistry: import("./registry.js").SchemaRegistry<SchemaMetadata>;
|
|
986
|
+
registry: typeof registry;
|
|
987
|
+
_default: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, defaultValue: TOutput | (() => TOutput)) => VldDefault<TInput, TOutput>;
|
|
988
|
+
success: <TOutput = unknown>(_val?: TOutput) => VldCustom<TOutput>;
|
|
989
|
+
_function: () => VldFunction;
|
|
990
|
+
ZodType: typeof VldBase;
|
|
991
|
+
ZodTypeAny: typeof VldBase;
|
|
992
|
+
ZodTypeDef: ObjectConstructor;
|
|
993
|
+
ZodError: typeof VldError;
|
|
994
|
+
ZodRealError: typeof VldError;
|
|
995
|
+
ZodCompileError: typeof ZodCompileErrorClass;
|
|
996
|
+
ZodCompileAsyncError: typeof ZodCompileAsyncErrorClass;
|
|
997
|
+
ZodCompileUnsupportedError: typeof ZodCompileUnsupportedErrorClass;
|
|
998
|
+
_ZodString: typeof VldString;
|
|
999
|
+
ZodString: typeof VldString;
|
|
1000
|
+
ZodStringFormat: typeof VldString;
|
|
1001
|
+
ZodEmail: typeof VldString;
|
|
1002
|
+
ZodGUID: typeof VldString;
|
|
1003
|
+
ZodUUID: typeof VldString;
|
|
1004
|
+
ZodURL: typeof VldString;
|
|
1005
|
+
ZodEmoji: typeof VldString;
|
|
1006
|
+
ZodNanoID: typeof VldString;
|
|
1007
|
+
ZodCUID: typeof VldString;
|
|
1008
|
+
ZodCUID2: typeof VldString;
|
|
1009
|
+
ZodULID: typeof VldString;
|
|
1010
|
+
ZodXID: typeof VldString;
|
|
1011
|
+
ZodKSUID: typeof VldString;
|
|
1012
|
+
ZodIPv4: typeof VldString;
|
|
1013
|
+
ZodMAC: typeof VldString;
|
|
1014
|
+
ZodIPv6: typeof VldString;
|
|
1015
|
+
ZodCIDRv4: typeof VldString;
|
|
1016
|
+
ZodCIDRv6: typeof VldString;
|
|
1017
|
+
ZodBase64: typeof VldString;
|
|
1018
|
+
ZodBase64URL: typeof VldString;
|
|
1019
|
+
ZodE164: typeof VldString;
|
|
1020
|
+
ZodJWT: typeof VldString;
|
|
1021
|
+
ZodCustomStringFormat: typeof VldString;
|
|
1022
|
+
ZodNumber: typeof VldNumber;
|
|
1023
|
+
ZodNumberFormat: typeof VldNumber;
|
|
1024
|
+
ZodBoolean: typeof VldBoolean;
|
|
1025
|
+
ZodBigInt: typeof VldBigInt;
|
|
1026
|
+
ZodBigIntFormat: typeof VldBigInt;
|
|
1027
|
+
ZodSymbol: typeof VldSymbol;
|
|
1028
|
+
ZodUndefined: typeof VldUndefined;
|
|
1029
|
+
ZodNull: typeof VldNull;
|
|
1030
|
+
ZodAny: typeof VldAny;
|
|
1031
|
+
ZodUnknown: typeof VldUnknown;
|
|
1032
|
+
ZodNever: typeof VldNever;
|
|
1033
|
+
ZodVoid: typeof VldVoid;
|
|
1034
|
+
ZodDate: typeof VldDate;
|
|
1035
|
+
ZodArray: typeof VldArray;
|
|
1036
|
+
ZodObject: typeof VldObject;
|
|
1037
|
+
ZodUnion: typeof VldUnion;
|
|
1038
|
+
ZodXor: typeof VldXor;
|
|
1039
|
+
ZodDiscriminatedUnion: typeof VldDiscriminatedUnion;
|
|
1040
|
+
ZodIntersection: typeof VldIntersection;
|
|
1041
|
+
ZodTuple: typeof VldTuple;
|
|
1042
|
+
ZodRecord: typeof VldRecord;
|
|
1043
|
+
ZodMap: typeof VldMap;
|
|
1044
|
+
ZodSet: typeof VldSet;
|
|
1045
|
+
ZodEnum: typeof VldEnum;
|
|
1046
|
+
ZodLiteral: typeof VldLiteral;
|
|
1047
|
+
ZodFile: typeof VldFile;
|
|
1048
|
+
ZodTransform: typeof VldBase;
|
|
1049
|
+
ZodOptional: typeof VldBase;
|
|
1050
|
+
ZodExactOptional: typeof VldBase;
|
|
1051
|
+
ZodNullable: typeof VldBase;
|
|
1052
|
+
ZodDefault: typeof VldBase;
|
|
1053
|
+
ZodPrefault: typeof VldBase;
|
|
1054
|
+
ZodNonOptional: typeof VldBase;
|
|
1055
|
+
ZodSuccess: typeof VldCustom;
|
|
1056
|
+
ZodCatch: typeof VldBase;
|
|
1057
|
+
ZodNaN: typeof VldNan;
|
|
1058
|
+
ZodPipe: typeof VldBase;
|
|
1059
|
+
ZodCodec: typeof VldCodec;
|
|
1060
|
+
ZodPreprocess: typeof VldBase;
|
|
1061
|
+
ZodReadonly: typeof VldBase;
|
|
1062
|
+
ZodTemplateLiteral: typeof VldTemplateLiteral;
|
|
1063
|
+
ZodLazy: typeof VldLazy;
|
|
1064
|
+
ZodPromise: typeof VldPromise;
|
|
1065
|
+
ZodFunction: typeof VldFunction;
|
|
1066
|
+
ZodCustom: typeof VldCustom;
|
|
1067
|
+
ZodISODateTime: typeof VldString;
|
|
1068
|
+
ZodISODate: typeof VldString;
|
|
1069
|
+
ZodISOTime: typeof VldString;
|
|
1070
|
+
ZodISODuration: typeof VldString;
|
|
1071
|
+
$brand: symbol;
|
|
1072
|
+
$output: symbol;
|
|
1073
|
+
$input: symbol;
|
|
871
1074
|
};
|
|
872
1075
|
/**
|
|
873
1076
|
* Zod-compatible root-level factory aliases.
|
|
@@ -902,7 +1105,8 @@ export declare const string: () => VldString, number: () => VldNumber, int: () =
|
|
|
902
1105
|
datetime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
903
1106
|
dateTime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
904
1107
|
duration: () => stringFormats.VldStringFormat;
|
|
905
|
-
}, stringFormat: (name: string, validator: ((val: string) => boolean) | RegExp) => stringFormats.VldStringFormat, normalize: (form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})) => VldTransform<string, string, string>, slugify: () => VldTransform<string, string, string>, mime: (types: string | string[], message?: string) => VldFile, xid: () => stringFormats.VldStringFormat, guid: () => stringFormats.VldStringFormat, httpUrl: () => stringFormats.VldStringFormat, ksuid: () => stringFormats.VldStringFormat, regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "
|
|
1108
|
+
}, stringFormat: (name: string, validator: ((val: string) => boolean) | RegExp) => stringFormats.VldStringFormat, normalize: (form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})) => VldTransform<string, string, string>, slugify: () => VldTransform<string, string, string>, mime: (types: string | string[], message?: string) => VldFile, xid: () => stringFormats.VldStringFormat, guid: () => stringFormats.VldStringFormat, httpUrl: () => stringFormats.VldStringFormat, ksuid: () => stringFormats.VldStringFormat, regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "date" | "null" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
1109
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
906
1110
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
907
1111
|
emoji: () => RegExp;
|
|
908
1112
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -915,7 +1119,9 @@ export declare const string: () => VldString, number: () => VldNumber, int: () =
|
|
|
915
1119
|
}>, templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral, base64Bytes: () => VldBase64, hexBytes: () => VldHex, uint8Array: () => VldUint8Array, codec: <TInput, TOutput>(inputValidator: VldBase<unknown, TInput>, outputValidator: VldBase<unknown, TOutput>, transform: {
|
|
916
1120
|
decode: (value: TInput) => TOutput | Promise<TOutput>;
|
|
917
1121
|
encode: (value: TOutput) => TInput | Promise<TInput>;
|
|
918
|
-
}) => VldCodec<TInput, TOutput>, promise: <T>(inner: VldBase<unknown, T>) => VldPromise<T>, prefault: <TInput, TOutput>(validator: VldBase<TInput, TOutput>, defaultValue: TInput | (() => TInput)) => VldPrefault<TInput, TOutput>, parse: <T>(schema: VldBase<unknown, T>, value: unknown) => T, safeParse: <T>(schema: VldBase<unknown, T>, value: unknown) => ParseResult<T>, parseAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<T>, safeParseAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<ParseResult<T>>, decode: <T>(schema: VldBase<unknown, T>, value: unknown) => T, safeDecode: <T>(schema: VldBase<unknown, T>, value: unknown) => ParseResult<T>, decodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<T>, safeDecodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<ParseResult<T>>, encode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => TInput, safeEncode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => ParseResult<TInput>, encodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<TInput>, safeEncodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<ParseResult<TInput>>, formatError: (error: Error) => FormattedError, NEVER: VldNever
|
|
1122
|
+
}) => VldCodec<TInput, TOutput>, promise: <T>(inner: VldBase<unknown, T>) => VldPromise<T>, prefault: <TInput, TOutput>(validator: VldBase<TInput, TOutput>, defaultValue: TInput | (() => TInput)) => VldPrefault<TInput, TOutput>, parse: <T>(schema: VldBase<unknown, T>, value: unknown) => T, safeParse: <T>(schema: VldBase<unknown, T>, value: unknown) => ParseResult<T>, parseAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<T>, safeParseAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<ParseResult<T>>, decode: <T>(schema: VldBase<unknown, T>, value: unknown) => T, safeDecode: <T>(schema: VldBase<unknown, T>, value: unknown) => ParseResult<T>, decodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<T>, safeDecodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<ParseResult<T>>, encode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => TInput, safeEncode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => ParseResult<TInput>, encodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<TInput>, safeEncodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<ParseResult<TInput>>, formatError: (error: Error) => FormattedError, NEVER: VldNever, compile: <T extends VldBase<any, any>>(schema: T, options?: {
|
|
1123
|
+
JITless?: boolean;
|
|
1124
|
+
}) => T, validate: typeof validateFn, validateAsync: typeof validateAsyncFn, properties: typeof propertiesFn, getDiscriminatedOption: typeof getDiscriminatedOptionFn, memoizer: <K extends object, V>(compute: (key: K) => V) => ((key: K) => V), toZod: typeof toZodFn;
|
|
919
1125
|
declare const catchFactory: <T>(validator: VldBase<unknown, T>, fallbackValue: T) => VldCatch<unknown, T>;
|
|
920
1126
|
declare const enumFactory: typeof enumFactoryCompat;
|
|
921
1127
|
declare const functionFactory: () => VldFunction;
|
|
@@ -1028,7 +1234,8 @@ declare const defaultFactory: {
|
|
|
1028
1234
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
1029
1235
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
1030
1236
|
};
|
|
1031
|
-
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "
|
|
1237
|
+
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "date" | "null" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
1238
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
1032
1239
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
1033
1240
|
emoji: () => RegExp;
|
|
1034
1241
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -1168,7 +1375,8 @@ declare const defaultFactory: {
|
|
|
1168
1375
|
guid: () => stringFormats.VldStringFormat;
|
|
1169
1376
|
httpUrl: () => stringFormats.VldStringFormat;
|
|
1170
1377
|
ksuid: () => stringFormats.VldStringFormat;
|
|
1171
|
-
regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "
|
|
1378
|
+
regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "date" | "null" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
1379
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
1172
1380
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
1173
1381
|
emoji: () => RegExp;
|
|
1174
1382
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -1179,6 +1387,15 @@ declare const defaultFactory: {
|
|
|
1179
1387
|
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
1180
1388
|
uuid: (version?: number) => RegExp;
|
|
1181
1389
|
}>;
|
|
1390
|
+
compile: <T extends VldBase<any, any>>(schema: T, options?: {
|
|
1391
|
+
JITless?: boolean;
|
|
1392
|
+
}) => T;
|
|
1393
|
+
validate: typeof validateFn;
|
|
1394
|
+
validateAsync: typeof validateAsyncFn;
|
|
1395
|
+
properties: typeof propertiesFn;
|
|
1396
|
+
getDiscriminatedOption: typeof getDiscriminatedOptionFn;
|
|
1397
|
+
memoizer: <K extends object, V>(compute: (key: K) => V) => ((key: K) => V);
|
|
1398
|
+
toZod: typeof toZodFn;
|
|
1182
1399
|
templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral;
|
|
1183
1400
|
base64Bytes: () => VldBase64;
|
|
1184
1401
|
hexBytes: () => VldHex;
|
|
@@ -1207,6 +1424,95 @@ declare const defaultFactory: {
|
|
|
1207
1424
|
flattenError: typeof flattenErrorFn;
|
|
1208
1425
|
toJSONSchema: typeof toJSONSchemaFn;
|
|
1209
1426
|
fromJSONSchema: typeof fromJSONSchemaFn;
|
|
1427
|
+
globalRegistry: import("./registry.js").SchemaRegistry<SchemaMetadata>;
|
|
1428
|
+
registry: typeof registry;
|
|
1429
|
+
_default: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, defaultValue: TOutput | (() => TOutput)) => VldDefault<TInput, TOutput>;
|
|
1430
|
+
success: <TOutput = unknown>(_val?: TOutput) => VldCustom<TOutput>;
|
|
1431
|
+
_function: () => VldFunction;
|
|
1432
|
+
ZodType: typeof VldBase;
|
|
1433
|
+
ZodTypeAny: typeof VldBase;
|
|
1434
|
+
ZodTypeDef: ObjectConstructor;
|
|
1435
|
+
ZodError: typeof VldError;
|
|
1436
|
+
ZodRealError: typeof VldError;
|
|
1437
|
+
ZodCompileError: typeof ZodCompileErrorClass;
|
|
1438
|
+
ZodCompileAsyncError: typeof ZodCompileAsyncErrorClass;
|
|
1439
|
+
ZodCompileUnsupportedError: typeof ZodCompileUnsupportedErrorClass;
|
|
1440
|
+
_ZodString: typeof VldString;
|
|
1441
|
+
ZodString: typeof VldString;
|
|
1442
|
+
ZodStringFormat: typeof VldString;
|
|
1443
|
+
ZodEmail: typeof VldString;
|
|
1444
|
+
ZodGUID: typeof VldString;
|
|
1445
|
+
ZodUUID: typeof VldString;
|
|
1446
|
+
ZodURL: typeof VldString;
|
|
1447
|
+
ZodEmoji: typeof VldString;
|
|
1448
|
+
ZodNanoID: typeof VldString;
|
|
1449
|
+
ZodCUID: typeof VldString;
|
|
1450
|
+
ZodCUID2: typeof VldString;
|
|
1451
|
+
ZodULID: typeof VldString;
|
|
1452
|
+
ZodXID: typeof VldString;
|
|
1453
|
+
ZodKSUID: typeof VldString;
|
|
1454
|
+
ZodIPv4: typeof VldString;
|
|
1455
|
+
ZodMAC: typeof VldString;
|
|
1456
|
+
ZodIPv6: typeof VldString;
|
|
1457
|
+
ZodCIDRv4: typeof VldString;
|
|
1458
|
+
ZodCIDRv6: typeof VldString;
|
|
1459
|
+
ZodBase64: typeof VldString;
|
|
1460
|
+
ZodBase64URL: typeof VldString;
|
|
1461
|
+
ZodE164: typeof VldString;
|
|
1462
|
+
ZodJWT: typeof VldString;
|
|
1463
|
+
ZodCustomStringFormat: typeof VldString;
|
|
1464
|
+
ZodNumber: typeof VldNumber;
|
|
1465
|
+
ZodNumberFormat: typeof VldNumber;
|
|
1466
|
+
ZodBoolean: typeof VldBoolean;
|
|
1467
|
+
ZodBigInt: typeof VldBigInt;
|
|
1468
|
+
ZodBigIntFormat: typeof VldBigInt;
|
|
1469
|
+
ZodSymbol: typeof VldSymbol;
|
|
1470
|
+
ZodUndefined: typeof VldUndefined;
|
|
1471
|
+
ZodNull: typeof VldNull;
|
|
1472
|
+
ZodAny: typeof VldAny;
|
|
1473
|
+
ZodUnknown: typeof VldUnknown;
|
|
1474
|
+
ZodNever: typeof VldNever;
|
|
1475
|
+
ZodVoid: typeof VldVoid;
|
|
1476
|
+
ZodDate: typeof VldDate;
|
|
1477
|
+
ZodArray: typeof VldArray;
|
|
1478
|
+
ZodObject: typeof VldObject;
|
|
1479
|
+
ZodUnion: typeof VldUnion;
|
|
1480
|
+
ZodXor: typeof VldXor;
|
|
1481
|
+
ZodDiscriminatedUnion: typeof VldDiscriminatedUnion;
|
|
1482
|
+
ZodIntersection: typeof VldIntersection;
|
|
1483
|
+
ZodTuple: typeof VldTuple;
|
|
1484
|
+
ZodRecord: typeof VldRecord;
|
|
1485
|
+
ZodMap: typeof VldMap;
|
|
1486
|
+
ZodSet: typeof VldSet;
|
|
1487
|
+
ZodEnum: typeof VldEnum;
|
|
1488
|
+
ZodLiteral: typeof VldLiteral;
|
|
1489
|
+
ZodFile: typeof VldFile;
|
|
1490
|
+
ZodTransform: typeof VldBase;
|
|
1491
|
+
ZodOptional: typeof VldBase;
|
|
1492
|
+
ZodExactOptional: typeof VldBase;
|
|
1493
|
+
ZodNullable: typeof VldBase;
|
|
1494
|
+
ZodDefault: typeof VldBase;
|
|
1495
|
+
ZodPrefault: typeof VldBase;
|
|
1496
|
+
ZodNonOptional: typeof VldBase;
|
|
1497
|
+
ZodSuccess: typeof VldCustom;
|
|
1498
|
+
ZodCatch: typeof VldBase;
|
|
1499
|
+
ZodNaN: typeof VldNan;
|
|
1500
|
+
ZodPipe: typeof VldBase;
|
|
1501
|
+
ZodCodec: typeof VldCodec;
|
|
1502
|
+
ZodPreprocess: typeof VldBase;
|
|
1503
|
+
ZodReadonly: typeof VldBase;
|
|
1504
|
+
ZodTemplateLiteral: typeof VldTemplateLiteral;
|
|
1505
|
+
ZodLazy: typeof VldLazy;
|
|
1506
|
+
ZodPromise: typeof VldPromise;
|
|
1507
|
+
ZodFunction: typeof VldFunction;
|
|
1508
|
+
ZodCustom: typeof VldCustom;
|
|
1509
|
+
ZodISODateTime: typeof VldString;
|
|
1510
|
+
ZodISODate: typeof VldString;
|
|
1511
|
+
ZodISOTime: typeof VldString;
|
|
1512
|
+
ZodISODuration: typeof VldString;
|
|
1513
|
+
$brand: symbol;
|
|
1514
|
+
$output: symbol;
|
|
1515
|
+
$input: symbol;
|
|
1210
1516
|
};
|
|
1211
1517
|
declare const zodStringFactory: typeof VldString;
|
|
1212
1518
|
export { catchFactory as catch, defaultFactory as _default, enumFactory as enum, functionFactory as function, functionFactory as _function, instanceOfFactory as instanceof, mapFactory as mapSchema, neverFactory as never, nullFactory as null, undefinedFactory as undefined, voidFactory as void, zodStringFactory as _ZodString };
|
|
@@ -1245,3 +1551,4 @@ export { createLogger, initLogger, getLogger, setLogLevel, enableDebug, disableL
|
|
|
1245
1551
|
export { pigment, supportsColor, bold, dim, italic, underline, red, green, yellow, blue, magenta, cyan, white, gray, grey, strip, vldTheme, createTheme, type Theme } from './pigment.js';
|
|
1246
1552
|
export { toJSONSchema, fromJSONSchema, type JSONSchemaDefinition, type ToJSONSchemaOptions } from './utils/json-schema.js';
|
|
1247
1553
|
export default v;
|
|
1554
|
+
export { compileFn as zodCompileFn, ZodCompileAsyncError, ZodCompileUnsupportedError } from './compile.js';
|