zod 4.1.0-canary.20250730T051934 → 4.1.0-canary.20250730T094657
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/package.json +1 -1
- package/src/v4/classic/tests/recursive-types.test.ts +15 -0
- package/src/v4/core/api.ts +4 -4
- package/src/v4/core/schemas.ts +15 -3
- package/src/v4/core/util.ts +11 -6
- package/src/v4/core/versions.ts +1 -1
- package/v4/core/api.d.cts +4 -4
- package/v4/core/api.d.ts +4 -4
- package/v4/core/schemas.cjs +9 -2
- package/v4/core/schemas.d.cts +5 -1
- package/v4/core/schemas.d.ts +5 -1
- package/v4/core/schemas.js +9 -2
- package/v4/core/util.cjs +10 -6
- package/v4/core/util.js +10 -6
- package/v4/core/versions.cjs +1 -1
- package/v4/core/versions.js +1 -1
package/package.json
CHANGED
|
@@ -366,6 +366,21 @@ test("object utilities with recursive types", () => {
|
|
|
366
366
|
]);
|
|
367
367
|
});
|
|
368
368
|
|
|
369
|
+
test("tuple with recursive types", () => {
|
|
370
|
+
const TaskListNodeSchema = z.strictObject({
|
|
371
|
+
type: z.literal("taskList"),
|
|
372
|
+
get content() {
|
|
373
|
+
return z.array(z.tuple([TaskListNodeSchema, z.union([TaskListNodeSchema])])).min(1);
|
|
374
|
+
},
|
|
375
|
+
});
|
|
376
|
+
type TaskListNodeSchema = z.infer<typeof TaskListNodeSchema>;
|
|
377
|
+
type _TaskListNodeSchema = {
|
|
378
|
+
type: "taskList";
|
|
379
|
+
content: [_TaskListNodeSchema, _TaskListNodeSchema][];
|
|
380
|
+
};
|
|
381
|
+
expectTypeOf<TaskListNodeSchema>().toEqualTypeOf<_TaskListNodeSchema>();
|
|
382
|
+
});
|
|
383
|
+
|
|
369
384
|
test("recursion compatibility", () => {
|
|
370
385
|
// array
|
|
371
386
|
const A = z.object({
|
package/src/v4/core/api.ts
CHANGED
|
@@ -314,8 +314,8 @@ export function _ksuid<T extends schemas.$ZodKSUID>(
|
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
// IPv4
|
|
317
|
-
export type $ZodIPv4Params = StringFormatParams<schemas.$ZodIPv4, "pattern" | "when">;
|
|
318
|
-
export type $ZodCheckIPv4Params = CheckStringFormatParams<schemas.$ZodIPv4, "pattern" | "when">;
|
|
317
|
+
export type $ZodIPv4Params = StringFormatParams<schemas.$ZodIPv4, "pattern" | "when" | "version">;
|
|
318
|
+
export type $ZodCheckIPv4Params = CheckStringFormatParams<schemas.$ZodIPv4, "pattern" | "when" | "version">;
|
|
319
319
|
export function _ipv4<T extends schemas.$ZodIPv4>(
|
|
320
320
|
Class: util.SchemaClass<T>,
|
|
321
321
|
params?: string | $ZodIPv4Params | $ZodCheckIPv4Params
|
|
@@ -330,8 +330,8 @@ export function _ipv4<T extends schemas.$ZodIPv4>(
|
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
// IPv6
|
|
333
|
-
export type $ZodIPv6Params = StringFormatParams<schemas.$ZodIPv6, "pattern" | "when">;
|
|
334
|
-
export type $ZodCheckIPv6Params = CheckStringFormatParams<schemas.$ZodIPv6, "pattern" | "when">;
|
|
333
|
+
export type $ZodIPv6Params = StringFormatParams<schemas.$ZodIPv6, "pattern" | "when" | "version">;
|
|
334
|
+
export type $ZodCheckIPv6Params = CheckStringFormatParams<schemas.$ZodIPv6, "pattern" | "when" | "version">;
|
|
335
335
|
export function _ipv6<T extends schemas.$ZodIPv6>(
|
|
336
336
|
Class: util.SchemaClass<T>,
|
|
337
337
|
params?: string | $ZodIPv6Params | $ZodCheckIPv6Params
|
package/src/v4/core/schemas.ts
CHANGED
|
@@ -1701,6 +1701,8 @@ export interface $ZodObjectInternals<
|
|
|
1701
1701
|
propValues: util.PropValues;
|
|
1702
1702
|
output: $InferObjectOutput<Shape, Config["out"]>;
|
|
1703
1703
|
input: $InferObjectInput<Shape, Config["in"]>;
|
|
1704
|
+
optin?: "optional" | undefined;
|
|
1705
|
+
optout?: "optional" | undefined;
|
|
1704
1706
|
}
|
|
1705
1707
|
export type $ZodLooseShape = Record<string, any>;
|
|
1706
1708
|
|
|
@@ -2282,9 +2284,12 @@ type TupleOutputTypeWithOptionals<T extends util.TupleItems> = T extends readonl
|
|
|
2282
2284
|
export interface $ZodTupleInternals<
|
|
2283
2285
|
T extends util.TupleItems = readonly $ZodType[],
|
|
2284
2286
|
Rest extends SomeType | null = $ZodType | null,
|
|
2285
|
-
> extends $ZodTypeInternals
|
|
2287
|
+
> extends _$ZodTypeInternals {
|
|
2286
2288
|
def: $ZodTupleDef<T, Rest>;
|
|
2287
2289
|
isst: errors.$ZodIssueInvalidType | errors.$ZodIssueTooBig<unknown[]> | errors.$ZodIssueTooSmall<unknown[]>;
|
|
2290
|
+
// $ZodTypeInternals<$InferTupleOutputType<T, Rest>, $InferTupleInputType<T, Rest>>
|
|
2291
|
+
output: $InferTupleOutputType<T, Rest>;
|
|
2292
|
+
input: $InferTupleInputType<T, Rest>;
|
|
2288
2293
|
}
|
|
2289
2294
|
|
|
2290
2295
|
export interface $ZodTuple<
|
|
@@ -3746,11 +3751,18 @@ export interface $ZodLazy<T extends SomeType = $ZodType> extends $ZodType {
|
|
|
3746
3751
|
export const $ZodLazy: core.$constructor<$ZodLazy> = /*@__PURE__*/ core.$constructor("$ZodLazy", (inst, def) => {
|
|
3747
3752
|
$ZodType.init(inst, def);
|
|
3748
3753
|
|
|
3754
|
+
// let _innerType!: any;
|
|
3755
|
+
// util.defineLazy(def, "getter", () => {
|
|
3756
|
+
// if (!_innerType) {
|
|
3757
|
+
// _innerType = def.getter();
|
|
3758
|
+
// }
|
|
3759
|
+
// return () => _innerType;
|
|
3760
|
+
// });
|
|
3749
3761
|
util.defineLazy(inst._zod, "innerType", () => def.getter() as $ZodType);
|
|
3750
3762
|
util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
|
|
3751
3763
|
util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
|
|
3752
|
-
util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin);
|
|
3753
|
-
util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout);
|
|
3764
|
+
util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin ?? undefined);
|
|
3765
|
+
util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout ?? undefined);
|
|
3754
3766
|
inst._zod.parse = (payload, ctx) => {
|
|
3755
3767
|
const inner = inst._zod.innerType;
|
|
3756
3768
|
return inner._zod.run(payload, ctx);
|
package/src/v4/core/util.ts
CHANGED
|
@@ -257,16 +257,21 @@ export function floatSafeRemainder(val: number, step: number): number {
|
|
|
257
257
|
return (valInt % stepInt) / 10 ** decCount;
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
+
const EVALUATING = Symbol("evaluating");
|
|
261
|
+
|
|
260
262
|
export function defineLazy<T, K extends keyof T>(object: T, key: K, getter: () => T[K]): void {
|
|
261
|
-
|
|
263
|
+
let value: T[K] | typeof EVALUATING | undefined = undefined;
|
|
262
264
|
Object.defineProperty(object, key, {
|
|
263
265
|
get() {
|
|
264
|
-
if (
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
return value;
|
|
266
|
+
if (value === EVALUATING) {
|
|
267
|
+
// Circular reference detected, return undefined to break the cycle
|
|
268
|
+
return undefined as T[K];
|
|
268
269
|
}
|
|
269
|
-
|
|
270
|
+
if (value === undefined) {
|
|
271
|
+
value = EVALUATING;
|
|
272
|
+
value = getter();
|
|
273
|
+
}
|
|
274
|
+
return value;
|
|
270
275
|
},
|
|
271
276
|
set(v) {
|
|
272
277
|
Object.defineProperty(object, key, {
|
package/src/v4/core/versions.ts
CHANGED
package/v4/core/api.d.cts
CHANGED
|
@@ -63,11 +63,11 @@ export declare function _xid<T extends schemas.$ZodXID>(Class: util.SchemaClass<
|
|
|
63
63
|
export type $ZodKSUIDParams = StringFormatParams<schemas.$ZodKSUID, "when">;
|
|
64
64
|
export type $ZodCheckKSUIDParams = CheckStringFormatParams<schemas.$ZodKSUID, "when">;
|
|
65
65
|
export declare function _ksuid<T extends schemas.$ZodKSUID>(Class: util.SchemaClass<T>, params?: string | $ZodKSUIDParams | $ZodCheckKSUIDParams): T;
|
|
66
|
-
export type $ZodIPv4Params = StringFormatParams<schemas.$ZodIPv4, "pattern" | "when">;
|
|
67
|
-
export type $ZodCheckIPv4Params = CheckStringFormatParams<schemas.$ZodIPv4, "pattern" | "when">;
|
|
66
|
+
export type $ZodIPv4Params = StringFormatParams<schemas.$ZodIPv4, "pattern" | "when" | "version">;
|
|
67
|
+
export type $ZodCheckIPv4Params = CheckStringFormatParams<schemas.$ZodIPv4, "pattern" | "when" | "version">;
|
|
68
68
|
export declare function _ipv4<T extends schemas.$ZodIPv4>(Class: util.SchemaClass<T>, params?: string | $ZodIPv4Params | $ZodCheckIPv4Params): T;
|
|
69
|
-
export type $ZodIPv6Params = StringFormatParams<schemas.$ZodIPv6, "pattern" | "when">;
|
|
70
|
-
export type $ZodCheckIPv6Params = CheckStringFormatParams<schemas.$ZodIPv6, "pattern" | "when">;
|
|
69
|
+
export type $ZodIPv6Params = StringFormatParams<schemas.$ZodIPv6, "pattern" | "when" | "version">;
|
|
70
|
+
export type $ZodCheckIPv6Params = CheckStringFormatParams<schemas.$ZodIPv6, "pattern" | "when" | "version">;
|
|
71
71
|
export declare function _ipv6<T extends schemas.$ZodIPv6>(Class: util.SchemaClass<T>, params?: string | $ZodIPv6Params | $ZodCheckIPv6Params): T;
|
|
72
72
|
export type $ZodCIDRv4Params = StringFormatParams<schemas.$ZodCIDRv4, "pattern" | "when">;
|
|
73
73
|
export type $ZodCheckCIDRv4Params = CheckStringFormatParams<schemas.$ZodCIDRv4, "pattern" | "when">;
|
package/v4/core/api.d.ts
CHANGED
|
@@ -63,11 +63,11 @@ export declare function _xid<T extends schemas.$ZodXID>(Class: util.SchemaClass<
|
|
|
63
63
|
export type $ZodKSUIDParams = StringFormatParams<schemas.$ZodKSUID, "when">;
|
|
64
64
|
export type $ZodCheckKSUIDParams = CheckStringFormatParams<schemas.$ZodKSUID, "when">;
|
|
65
65
|
export declare function _ksuid<T extends schemas.$ZodKSUID>(Class: util.SchemaClass<T>, params?: string | $ZodKSUIDParams | $ZodCheckKSUIDParams): T;
|
|
66
|
-
export type $ZodIPv4Params = StringFormatParams<schemas.$ZodIPv4, "pattern" | "when">;
|
|
67
|
-
export type $ZodCheckIPv4Params = CheckStringFormatParams<schemas.$ZodIPv4, "pattern" | "when">;
|
|
66
|
+
export type $ZodIPv4Params = StringFormatParams<schemas.$ZodIPv4, "pattern" | "when" | "version">;
|
|
67
|
+
export type $ZodCheckIPv4Params = CheckStringFormatParams<schemas.$ZodIPv4, "pattern" | "when" | "version">;
|
|
68
68
|
export declare function _ipv4<T extends schemas.$ZodIPv4>(Class: util.SchemaClass<T>, params?: string | $ZodIPv4Params | $ZodCheckIPv4Params): T;
|
|
69
|
-
export type $ZodIPv6Params = StringFormatParams<schemas.$ZodIPv6, "pattern" | "when">;
|
|
70
|
-
export type $ZodCheckIPv6Params = CheckStringFormatParams<schemas.$ZodIPv6, "pattern" | "when">;
|
|
69
|
+
export type $ZodIPv6Params = StringFormatParams<schemas.$ZodIPv6, "pattern" | "when" | "version">;
|
|
70
|
+
export type $ZodCheckIPv6Params = CheckStringFormatParams<schemas.$ZodIPv6, "pattern" | "when" | "version">;
|
|
71
71
|
export declare function _ipv6<T extends schemas.$ZodIPv6>(Class: util.SchemaClass<T>, params?: string | $ZodIPv6Params | $ZodCheckIPv6Params): T;
|
|
72
72
|
export type $ZodCIDRv4Params = StringFormatParams<schemas.$ZodCIDRv4, "pattern" | "when">;
|
|
73
73
|
export type $ZodCheckCIDRv4Params = CheckStringFormatParams<schemas.$ZodCIDRv4, "pattern" | "when">;
|
package/v4/core/schemas.cjs
CHANGED
|
@@ -1684,11 +1684,18 @@ exports.$ZodPromise = core.$constructor("$ZodPromise", (inst, def) => {
|
|
|
1684
1684
|
});
|
|
1685
1685
|
exports.$ZodLazy = core.$constructor("$ZodLazy", (inst, def) => {
|
|
1686
1686
|
exports.$ZodType.init(inst, def);
|
|
1687
|
+
// let _innerType!: any;
|
|
1688
|
+
// util.defineLazy(def, "getter", () => {
|
|
1689
|
+
// if (!_innerType) {
|
|
1690
|
+
// _innerType = def.getter();
|
|
1691
|
+
// }
|
|
1692
|
+
// return () => _innerType;
|
|
1693
|
+
// });
|
|
1687
1694
|
util.defineLazy(inst._zod, "innerType", () => def.getter());
|
|
1688
1695
|
util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
|
|
1689
1696
|
util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
|
|
1690
|
-
util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin);
|
|
1691
|
-
util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout);
|
|
1697
|
+
util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin ?? undefined);
|
|
1698
|
+
util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout ?? undefined);
|
|
1692
1699
|
inst._zod.parse = (payload, ctx) => {
|
|
1693
1700
|
const inner = inst._zod.innerType;
|
|
1694
1701
|
return inner._zod.run(payload, ctx);
|
package/v4/core/schemas.d.cts
CHANGED
|
@@ -587,6 +587,8 @@ out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Config extends
|
|
|
587
587
|
propValues: util.PropValues;
|
|
588
588
|
output: $InferObjectOutput<Shape, Config["out"]>;
|
|
589
589
|
input: $InferObjectInput<Shape, Config["in"]>;
|
|
590
|
+
optin?: "optional" | undefined;
|
|
591
|
+
optout?: "optional" | undefined;
|
|
590
592
|
}
|
|
591
593
|
export type $ZodLooseShape = Record<string, any>;
|
|
592
594
|
export interface $ZodObject<
|
|
@@ -673,9 +675,11 @@ type TupleOutputTypeWithOptionals<T extends util.TupleItems> = T extends readonl
|
|
|
673
675
|
...infer Prefix extends SomeType[],
|
|
674
676
|
infer Tail extends SomeType
|
|
675
677
|
] ? Tail["_zod"]["optout"] extends "optional" ? [...TupleOutputTypeWithOptionals<Prefix>, core.output<Tail>?] : TupleOutputTypeNoOptionals<T> : [];
|
|
676
|
-
export interface $ZodTupleInternals<T extends util.TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends $ZodTypeInternals
|
|
678
|
+
export interface $ZodTupleInternals<T extends util.TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends _$ZodTypeInternals {
|
|
677
679
|
def: $ZodTupleDef<T, Rest>;
|
|
678
680
|
isst: errors.$ZodIssueInvalidType | errors.$ZodIssueTooBig<unknown[]> | errors.$ZodIssueTooSmall<unknown[]>;
|
|
681
|
+
output: $InferTupleOutputType<T, Rest>;
|
|
682
|
+
input: $InferTupleInputType<T, Rest>;
|
|
679
683
|
}
|
|
680
684
|
export interface $ZodTuple<T extends util.TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends $ZodType {
|
|
681
685
|
_zod: $ZodTupleInternals<T, Rest>;
|
package/v4/core/schemas.d.ts
CHANGED
|
@@ -587,6 +587,8 @@ out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Config extends
|
|
|
587
587
|
propValues: util.PropValues;
|
|
588
588
|
output: $InferObjectOutput<Shape, Config["out"]>;
|
|
589
589
|
input: $InferObjectInput<Shape, Config["in"]>;
|
|
590
|
+
optin?: "optional" | undefined;
|
|
591
|
+
optout?: "optional" | undefined;
|
|
590
592
|
}
|
|
591
593
|
export type $ZodLooseShape = Record<string, any>;
|
|
592
594
|
export interface $ZodObject<
|
|
@@ -673,9 +675,11 @@ type TupleOutputTypeWithOptionals<T extends util.TupleItems> = T extends readonl
|
|
|
673
675
|
...infer Prefix extends SomeType[],
|
|
674
676
|
infer Tail extends SomeType
|
|
675
677
|
] ? Tail["_zod"]["optout"] extends "optional" ? [...TupleOutputTypeWithOptionals<Prefix>, core.output<Tail>?] : TupleOutputTypeNoOptionals<T> : [];
|
|
676
|
-
export interface $ZodTupleInternals<T extends util.TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends $ZodTypeInternals
|
|
678
|
+
export interface $ZodTupleInternals<T extends util.TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends _$ZodTypeInternals {
|
|
677
679
|
def: $ZodTupleDef<T, Rest>;
|
|
678
680
|
isst: errors.$ZodIssueInvalidType | errors.$ZodIssueTooBig<unknown[]> | errors.$ZodIssueTooSmall<unknown[]>;
|
|
681
|
+
output: $InferTupleOutputType<T, Rest>;
|
|
682
|
+
input: $InferTupleInputType<T, Rest>;
|
|
679
683
|
}
|
|
680
684
|
export interface $ZodTuple<T extends util.TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends $ZodType {
|
|
681
685
|
_zod: $ZodTupleInternals<T, Rest>;
|
package/v4/core/schemas.js
CHANGED
|
@@ -1653,11 +1653,18 @@ export const $ZodPromise = /*@__PURE__*/ core.$constructor("$ZodPromise", (inst,
|
|
|
1653
1653
|
});
|
|
1654
1654
|
export const $ZodLazy = /*@__PURE__*/ core.$constructor("$ZodLazy", (inst, def) => {
|
|
1655
1655
|
$ZodType.init(inst, def);
|
|
1656
|
+
// let _innerType!: any;
|
|
1657
|
+
// util.defineLazy(def, "getter", () => {
|
|
1658
|
+
// if (!_innerType) {
|
|
1659
|
+
// _innerType = def.getter();
|
|
1660
|
+
// }
|
|
1661
|
+
// return () => _innerType;
|
|
1662
|
+
// });
|
|
1656
1663
|
util.defineLazy(inst._zod, "innerType", () => def.getter());
|
|
1657
1664
|
util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
|
|
1658
1665
|
util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
|
|
1659
|
-
util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin);
|
|
1660
|
-
util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout);
|
|
1666
|
+
util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin ?? undefined);
|
|
1667
|
+
util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout ?? undefined);
|
|
1661
1668
|
inst._zod.parse = (payload, ctx) => {
|
|
1662
1669
|
const inner = inst._zod.innerType;
|
|
1663
1670
|
return inner._zod.run(payload, ctx);
|
package/v4/core/util.cjs
CHANGED
|
@@ -107,16 +107,20 @@ function floatSafeRemainder(val, step) {
|
|
|
107
107
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
108
108
|
return (valInt % stepInt) / 10 ** decCount;
|
|
109
109
|
}
|
|
110
|
+
const EVALUATING = Symbol("evaluating");
|
|
110
111
|
function defineLazy(object, key, getter) {
|
|
111
|
-
|
|
112
|
+
let value = undefined;
|
|
112
113
|
Object.defineProperty(object, key, {
|
|
113
114
|
get() {
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return value;
|
|
115
|
+
if (value === EVALUATING) {
|
|
116
|
+
// Circular reference detected, return undefined to break the cycle
|
|
117
|
+
return undefined;
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
if (value === undefined) {
|
|
120
|
+
value = EVALUATING;
|
|
121
|
+
value = getter();
|
|
122
|
+
}
|
|
123
|
+
return value;
|
|
120
124
|
},
|
|
121
125
|
set(v) {
|
|
122
126
|
Object.defineProperty(object, key, {
|
package/v4/core/util.js
CHANGED
|
@@ -61,16 +61,20 @@ export function floatSafeRemainder(val, step) {
|
|
|
61
61
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
62
62
|
return (valInt % stepInt) / 10 ** decCount;
|
|
63
63
|
}
|
|
64
|
+
const EVALUATING = Symbol("evaluating");
|
|
64
65
|
export function defineLazy(object, key, getter) {
|
|
65
|
-
|
|
66
|
+
let value = undefined;
|
|
66
67
|
Object.defineProperty(object, key, {
|
|
67
68
|
get() {
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return value;
|
|
69
|
+
if (value === EVALUATING) {
|
|
70
|
+
// Circular reference detected, return undefined to break the cycle
|
|
71
|
+
return undefined;
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
if (value === undefined) {
|
|
74
|
+
value = EVALUATING;
|
|
75
|
+
value = getter();
|
|
76
|
+
}
|
|
77
|
+
return value;
|
|
74
78
|
},
|
|
75
79
|
set(v) {
|
|
76
80
|
Object.defineProperty(object, key, {
|
package/v4/core/versions.cjs
CHANGED
package/v4/core/versions.js
CHANGED