@frontmcp/lazy-zod 1.5.0-rc.1 → 1.5.1
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/esm/index.mjs +22 -18
- package/esm/package.json +1 -1
- package/index.d.ts +2 -1
- package/index.js +22 -20
- package/package.json +1 -1
package/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// libs/lazy-zod/src/
|
|
2
|
-
import {
|
|
1
|
+
// libs/lazy-zod/src/index.ts
|
|
2
|
+
import { toJSONSchema as zodToJSONSchema } from "zod";
|
|
3
3
|
|
|
4
4
|
// libs/lazy-zod/src/factories.ts
|
|
5
5
|
var HEAVY_FACTORIES = /* @__PURE__ */ new Set([
|
|
@@ -178,21 +178,6 @@ function lazyZ(factory) {
|
|
|
178
178
|
return wrapLazy(new LazyZodSchema(factory));
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
// libs/lazy-zod/src/lazy-z.ts
|
|
182
|
-
var lazyProxy = new Proxy(realZ, {
|
|
183
|
-
get(target, key, receiver) {
|
|
184
|
-
if (typeof key === "string" && HEAVY_FACTORIES.has(key)) {
|
|
185
|
-
const realFactory = target[key];
|
|
186
|
-
return (...args) => wrapLazy(new LazyZodSchema(() => realFactory.call(target, ...args)));
|
|
187
|
-
}
|
|
188
|
-
return Reflect.get(target, key, receiver);
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
var z = lazyProxy;
|
|
192
|
-
|
|
193
|
-
// libs/lazy-zod/src/eager-z.ts
|
|
194
|
-
import { z as z2 } from "zod";
|
|
195
|
-
|
|
196
181
|
// libs/lazy-zod/src/utils.ts
|
|
197
182
|
function isLazy(value) {
|
|
198
183
|
if (value === null || typeof value !== "object" && typeof value !== "function") return false;
|
|
@@ -240,8 +225,23 @@ function deepMaterialize(value, seen) {
|
|
|
240
225
|
return resolved;
|
|
241
226
|
}
|
|
242
227
|
|
|
228
|
+
// libs/lazy-zod/src/lazy-z.ts
|
|
229
|
+
import { z as realZ } from "zod";
|
|
230
|
+
var lazyProxy = new Proxy(realZ, {
|
|
231
|
+
get(target, key, receiver) {
|
|
232
|
+
if (typeof key === "string" && HEAVY_FACTORIES.has(key)) {
|
|
233
|
+
const realFactory = target[key];
|
|
234
|
+
return (...args) => wrapLazy(new LazyZodSchema(() => realFactory.call(target, ...args)));
|
|
235
|
+
}
|
|
236
|
+
return Reflect.get(target, key, receiver);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
var z = lazyProxy;
|
|
240
|
+
|
|
241
|
+
// libs/lazy-zod/src/eager-z.ts
|
|
242
|
+
import { z as z2 } from "zod";
|
|
243
|
+
|
|
243
244
|
// libs/lazy-zod/src/index.ts
|
|
244
|
-
import { toJSONSchema } from "zod";
|
|
245
245
|
import {
|
|
246
246
|
NEVER,
|
|
247
247
|
ZodAny,
|
|
@@ -271,6 +271,10 @@ import {
|
|
|
271
271
|
ZodUnknown,
|
|
272
272
|
ZodVoid
|
|
273
273
|
} from "zod";
|
|
274
|
+
var toJSONSchema = ((schema, params) => zodToJSONSchema(
|
|
275
|
+
forceMaterialize(schema),
|
|
276
|
+
params
|
|
277
|
+
));
|
|
274
278
|
export {
|
|
275
279
|
LAZY_BRAND,
|
|
276
280
|
LAZY_TARGET,
|
package/esm/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/lazy-zod",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Drop-in zod replacement that lazily constructs compound schemas for dramatic cold-start speedups. Exports `z` (lazy, drop-in), `eagerZ` (real zod, zero overhead), and `lazyZ` (explicit factory wrapper).",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"license": "Apache-2.0",
|
package/index.d.ts
CHANGED
|
@@ -7,12 +7,13 @@
|
|
|
7
7
|
* - `lazyZ(factory)`: explicit factory-style lazy wrapper.
|
|
8
8
|
* - `isLazy`, `forceMaterialize`: runtime escape hatches.
|
|
9
9
|
*/
|
|
10
|
+
import { toJSONSchema as zodToJSONSchema } from 'zod';
|
|
10
11
|
export { z } from './lazy-z';
|
|
11
12
|
export { z as default } from './lazy-z';
|
|
12
13
|
export { eagerZ } from './eager-z';
|
|
13
14
|
export { lazyZ, LazyZodSchema, LAZY_BRAND, LAZY_TARGET, type InferLazy } from './lazy-schema';
|
|
14
15
|
export { isLazy, forceMaterialize } from './utils';
|
|
15
|
-
export
|
|
16
|
+
export declare const toJSONSchema: typeof zodToJSONSchema;
|
|
16
17
|
export type { JSONSchema } from 'zod/v4/core';
|
|
17
18
|
export { NEVER, ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodEnum, ZodError, ZodIntersection, ZodLiteral, ZodNever, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodRecord, ZodString, ZodSymbol, ZodTuple, ZodType, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, } from 'zod';
|
|
18
19
|
export type { ZodTypeAny, ZodRawShape, infer, input, output } from 'zod';
|
package/index.js
CHANGED
|
@@ -55,13 +55,11 @@ __export(index_exports, {
|
|
|
55
55
|
forceMaterialize: () => forceMaterialize,
|
|
56
56
|
isLazy: () => isLazy,
|
|
57
57
|
lazyZ: () => lazyZ,
|
|
58
|
-
toJSONSchema: () =>
|
|
58
|
+
toJSONSchema: () => toJSONSchema,
|
|
59
59
|
z: () => z
|
|
60
60
|
});
|
|
61
61
|
module.exports = __toCommonJS(index_exports);
|
|
62
|
-
|
|
63
|
-
// libs/lazy-zod/src/lazy-z.ts
|
|
64
|
-
var import_zod = require("zod");
|
|
62
|
+
var import_zod3 = require("zod");
|
|
65
63
|
|
|
66
64
|
// libs/lazy-zod/src/factories.ts
|
|
67
65
|
var HEAVY_FACTORIES = /* @__PURE__ */ new Set([
|
|
@@ -240,21 +238,6 @@ function lazyZ(factory) {
|
|
|
240
238
|
return wrapLazy(new LazyZodSchema(factory));
|
|
241
239
|
}
|
|
242
240
|
|
|
243
|
-
// libs/lazy-zod/src/lazy-z.ts
|
|
244
|
-
var lazyProxy = new Proxy(import_zod.z, {
|
|
245
|
-
get(target, key, receiver) {
|
|
246
|
-
if (typeof key === "string" && HEAVY_FACTORIES.has(key)) {
|
|
247
|
-
const realFactory = target[key];
|
|
248
|
-
return (...args) => wrapLazy(new LazyZodSchema(() => realFactory.call(target, ...args)));
|
|
249
|
-
}
|
|
250
|
-
return Reflect.get(target, key, receiver);
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
var z = lazyProxy;
|
|
254
|
-
|
|
255
|
-
// libs/lazy-zod/src/eager-z.ts
|
|
256
|
-
var import_zod2 = require("zod");
|
|
257
|
-
|
|
258
241
|
// libs/lazy-zod/src/utils.ts
|
|
259
242
|
function isLazy(value) {
|
|
260
243
|
if (value === null || typeof value !== "object" && typeof value !== "function") return false;
|
|
@@ -302,9 +285,28 @@ function deepMaterialize(value, seen) {
|
|
|
302
285
|
return resolved;
|
|
303
286
|
}
|
|
304
287
|
|
|
288
|
+
// libs/lazy-zod/src/lazy-z.ts
|
|
289
|
+
var import_zod = require("zod");
|
|
290
|
+
var lazyProxy = new Proxy(import_zod.z, {
|
|
291
|
+
get(target, key, receiver) {
|
|
292
|
+
if (typeof key === "string" && HEAVY_FACTORIES.has(key)) {
|
|
293
|
+
const realFactory = target[key];
|
|
294
|
+
return (...args) => wrapLazy(new LazyZodSchema(() => realFactory.call(target, ...args)));
|
|
295
|
+
}
|
|
296
|
+
return Reflect.get(target, key, receiver);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
var z = lazyProxy;
|
|
300
|
+
|
|
301
|
+
// libs/lazy-zod/src/eager-z.ts
|
|
302
|
+
var import_zod2 = require("zod");
|
|
303
|
+
|
|
305
304
|
// libs/lazy-zod/src/index.ts
|
|
306
|
-
var import_zod3 = require("zod");
|
|
307
305
|
var import_zod4 = require("zod");
|
|
306
|
+
var toJSONSchema = ((schema, params) => (0, import_zod3.toJSONSchema)(
|
|
307
|
+
forceMaterialize(schema),
|
|
308
|
+
params
|
|
309
|
+
));
|
|
308
310
|
// Annotate the CommonJS export names for ESM import in node:
|
|
309
311
|
0 && (module.exports = {
|
|
310
312
|
LAZY_BRAND,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/lazy-zod",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Drop-in zod replacement that lazily constructs compound schemas for dramatic cold-start speedups. Exports `z` (lazy, drop-in), `eagerZ` (real zod, zero overhead), and `lazyZ` (explicit factory wrapper).",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"license": "Apache-2.0",
|