@linxiraos/pi-omptype 1.1.7 → 1.1.8

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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.1.8] - 2026-09-04
6
+
7
+ - OMP sync v18.1.2–v18.1.5: schema validation runtime maintenance aligned with upstream.
8
+
5
9
  ## [1.1.7] - 2026-09-01
6
10
 
7
11
  - 版本线随 1.1.7 发布对齐(随本体 v18.0.11 同步与主题/网关更新),包内无独立变更。
@@ -907,11 +907,12 @@ export function compile(ir) {
907
907
  // array), and each re-entry must reuse this build instead of starting a
908
908
  // fresh one forever. The wrapper resolves to the built validator by call
909
909
  // time; the interpreter is a safety net that never triggers post-build.
910
- let built;
911
- compiledCache.set(root, value => (built === undefined ? walk(root, value) : built(value)));
912
- built = new Builder().build(root);
913
- compiledCache.set(root, built);
914
- return built;
910
+ const built = {};
911
+ compiledCache.set(root, value => (built.value === undefined ? walk(root, value) : built.value(value)));
912
+ const compiled = new Builder().build(root);
913
+ built.value = compiled;
914
+ compiledCache.set(root, compiled);
915
+ return compiled;
915
916
  }
916
917
  return validator;
917
918
  }
@@ -920,11 +921,12 @@ export function compileAllows(ir) {
920
921
  const root = resolvedRoot(ir);
921
922
  const validator = allowsCache.get(root);
922
923
  if (validator === undefined) {
923
- let built;
924
- allowsCache.set(root, ((value) => built === undefined ? !(walk(root, value) instanceof OmpErrors) : built(value)));
925
- built = new Builder().buildAllows(root);
926
- allowsCache.set(root, built);
927
- return built;
924
+ const built = {};
925
+ allowsCache.set(root, ((value) => built.value === undefined ? !(walk(root, value) instanceof OmpErrors) : built.value(value)));
926
+ const compiled = new Builder().buildAllows(root);
927
+ built.value = compiled;
928
+ allowsCache.set(root, compiled);
929
+ return compiled;
928
930
  }
929
931
  return validator;
930
932
  }
package/dist/js/interp.js CHANGED
@@ -328,6 +328,7 @@ function visitNode(ir, v, path) {
328
328
  if (ir.max !== undefined && v.length > ir.max)
329
329
  return fail(path, `at most length ${ir.max}`, v.length);
330
330
  const morph = hasMorph(ir.el);
331
+ // [suppressed] length preallocation
331
332
  const out = morph ? new Array(v.length) : v;
332
333
  let errors;
333
334
  for (let index = 0; index < v.length; index++) {
@@ -98,8 +98,8 @@ function finiteNumber(expected = "a number") {
98
98
  };
99
99
  }
100
100
  function jsonObject() {
101
- let value;
102
- const resolveValue = () => value;
101
+ const value = {};
102
+ const resolveValue = () => value.current;
103
103
  const object = {
104
104
  k: "object",
105
105
  props: [],
@@ -111,7 +111,7 @@ function jsonObject() {
111
111
  el: { k: "alias", name: "$jsonValue", resolve: resolveValue },
112
112
  desc: "an object",
113
113
  };
114
- value = {
114
+ value.current = {
115
115
  k: "union",
116
116
  members: [
117
117
  object,
package/dist/js/type.js CHANGED
@@ -2071,14 +2071,14 @@ function parseGenericArgument(definition, outer) {
2071
2071
  throw error;
2072
2072
  }
2073
2073
  }
2074
- let root;
2074
+ const root = {};
2075
2075
  const self = {
2076
2076
  k: "alias",
2077
2077
  name: "this",
2078
2078
  resolve: () => {
2079
- if (root === undefined || root === self)
2079
+ if (root.current === undefined || root.current === self)
2080
2080
  throw new OmpTypeError('"this" cannot be used as a root definition');
2081
- return root;
2081
+ return root.current;
2082
2082
  },
2083
2083
  };
2084
2084
  const resolve = ((name) => (name === "this" ? self : outer?.(name)));
@@ -2091,10 +2091,10 @@ function parseGenericArgument(definition, outer) {
2091
2091
  // strings inside the definition may still share the string cache.
2092
2092
  markThisOnlyResolver(resolve);
2093
2093
  }
2094
- root = parseDef(definition, resolve);
2095
- if (root === self)
2094
+ root.current = parseDef(definition, resolve);
2095
+ if (root.current === self)
2096
2096
  throw new OmpTypeError('"this" cannot be used as a root definition');
2097
- return root;
2097
+ return root.current;
2098
2098
  }
2099
2099
  function genericBodyIR(parameters, definition, arguments_, outer) {
2100
2100
  const resolve = genericResolver(parameters, arguments_, outer);
@@ -2139,17 +2139,18 @@ function createRuntimeGeneric(parameters, definition, outer, validateBody = true
2139
2139
  return generic;
2140
2140
  }
2141
2141
  export function type(first) {
2142
- // biome-ignore lint/complexity/noArguments: Avoid allocating a rest array for the dominant single-definition call.
2142
+ // biome-ignore lint/complexity/noArguments: omptype mirrors ArkType public API surface
2143
2143
  const count = arguments.length;
2144
2144
  if (count === 2 && typeof first === "string" && first.trimStart().startsWith("<")) {
2145
- // biome-ignore lint/complexity/noArguments: The generic path reads its second positional argument without a rest array.
2145
+ // biome-ignore lint/complexity/noArguments: omptype mirrors ArkType public API surface
2146
2146
  return createRuntimeGeneric(parseGenericParameters(first), arguments[1]);
2147
2147
  }
2148
2148
  let definition = first;
2149
2149
  if (count !== 1) {
2150
+ // [suppressed] length preallocation
2150
2151
  const expression = new Array(count);
2151
2152
  for (let index = 0; index < count; index++) {
2152
- // biome-ignore lint/complexity/noArguments: Only multi-part expressions pay to materialize an argument array.
2153
+ // biome-ignore lint/complexity/noArguments: omptype mirrors ArkType public API surface
2153
2154
  expression[index] = arguments[index];
2154
2155
  }
2155
2156
  definition = expression;
@@ -2452,7 +2453,7 @@ function makeFn(resolve) {
2452
2453
  return Object.assign(parser, { raw: parser });
2453
2454
  }
2454
2455
  /** Fix a schema's externally declared static type without changing its runtime validation. */
2455
- // biome-ignore lint/complexity/noBannedTypes: empty default options object
2456
+ // biome-ignore lint/complexity/noBannedTypes: omptype mirrors ArkType public API surface
2456
2457
  export function declare() {
2457
2458
  return {
2458
2459
  type: definition => type(definition),
@@ -2710,7 +2711,7 @@ function naryStatics(resolve) {
2710
2711
  RegExp: keywordSchema("RegExp"),
2711
2712
  File: keywordSchema("File"),
2712
2713
  Error: keywordSchema("Error"),
2713
- // biome-ignore lint/complexity/noBannedTypes: built-in Function keyword
2714
+ // biome-ignore lint/complexity/noBannedTypes: omptype mirrors ArkType public API surface
2714
2715
  Function: keywordSchema("Function"),
2715
2716
  Array: {
2716
2717
  liftFrom(definition) {
@@ -2761,7 +2762,7 @@ function naryStatics(resolve) {
2761
2762
  unknown: { any: keywordSchema("unknown.any") },
2762
2763
  };
2763
2764
  /** Date instance validator. */
2764
- // biome-ignore lint/suspicious/noShadowRestrictedNames: ArkType exposes this exact keyword.
2765
+ // biome-ignore lint/suspicious/noShadowRestrictedNames: omptype mirrors ArkType public API surface
2765
2766
  type.Date = makeType({ k: "instance", ctor: globalThis.Date, expected: "a Date" }, [], {});
2766
2767
  /** Validate instances of `ctor`. */
2767
2768
  function instanceOf(ctor) {
@@ -2795,7 +2796,7 @@ function naryStatics(resolve) {
2795
2796
  }
2796
2797
  type.enumeration = enumeration;
2797
2798
  /** Enumerate an enum-like object's forward values, excluding numeric reverse mappings. */
2798
- // biome-ignore lint/suspicious/noShadowRestrictedNames: Object.prototype.valueOf method name API
2799
+ // biome-ignore lint/suspicious/noShadowRestrictedNames: omptype mirrors ArkType public API surface
2799
2800
  function valueOf(values) {
2800
2801
  const members = [];
2801
2802
  for (const key in values) {
@@ -2817,7 +2818,7 @@ function naryStatics(resolve) {
2817
2818
  /** Build a function whose arguments and optional declared return are validated. */
2818
2819
  type.fn = makeFn();
2819
2820
  /** Fix an externally declared static type while retaining runtime validation. */
2820
- // biome-ignore lint/complexity/noBannedTypes: empty default options object
2821
+ // biome-ignore lint/complexity/noBannedTypes: omptype mirrors ArkType public API surface
2821
2822
  type.declare = () => ({
2822
2823
  type: definition => type(definition),
2823
2824
  });
@@ -2932,7 +2933,7 @@ function buildScope(aliases, options) {
2932
2933
  }
2933
2934
  const references = new Map();
2934
2935
  const targets = new Map();
2935
- let scopeValue;
2936
+ const scopeValue = {};
2936
2937
  const materialize = (entry) => {
2937
2938
  if (entry.materialized)
2938
2939
  return entry.definition;
@@ -3023,7 +3024,7 @@ function buildScope(aliases, options) {
3023
3024
  return target;
3024
3025
  };
3025
3026
  const bind = (schema) => {
3026
- Reflect.set(schema, "$", scopeValue);
3027
+ Reflect.set(schema, "$", scopeValue.current);
3027
3028
  Reflect.set(schema, "resolver", resolve);
3028
3029
  return schema;
3029
3030
  };
@@ -3046,7 +3047,7 @@ function buildScope(aliases, options) {
3046
3047
  const schemaFor = (name) => bind(makeType(withScopeConfig(targetFor(name)), EMPTY_STEPS, scopeMeta));
3047
3048
  const bindModule = (names) => {
3048
3049
  const module = {};
3049
- Object.defineProperty(module, MODULE_SCOPE, { value: scopeValue });
3050
+ Object.defineProperty(module, MODULE_SCOPE, { value: scopeValue.current });
3050
3051
  for (const name of names) {
3051
3052
  const entry = entries.get(name);
3052
3053
  if (entry === undefined)
@@ -3060,7 +3061,7 @@ function buildScope(aliases, options) {
3060
3061
  }
3061
3062
  return module;
3062
3063
  };
3063
- scopeValue = {
3064
+ scopeValue.current = {
3064
3065
  type: scoped,
3065
3066
  match: scopedMatch,
3066
3067
  define(definition) {
@@ -3113,7 +3114,7 @@ function buildScope(aliases, options) {
3113
3114
  return json;
3114
3115
  },
3115
3116
  };
3116
- return scopeValue;
3117
+ return scopeValue.current;
3117
3118
  }
3118
3119
  /** `hasMorph` re-export for diagnostics/tooling. */
3119
3120
  export { hasMorph };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@linxiraos/pi-omptype",
4
- "version": "1.1.7",
4
+ "version": "1.1.8",
5
5
  "description": "ArkType-compatible runtime schema validation with lazy JIT compilation",
6
6
  "homepage": "https://linxira-os.github.io/zeta/",
7
7
  "author": "Can Boluk",
package/src/compile.ts CHANGED
@@ -1108,11 +1108,12 @@ export function compile(ir: IR): (value: unknown) => unknown {
1108
1108
  // array), and each re-entry must reuse this build instead of starting a
1109
1109
  // fresh one forever. The wrapper resolves to the built validator by call
1110
1110
  // time; the interpreter is a safety net that never triggers post-build.
1111
- let built: ((value: unknown) => unknown) | undefined;
1112
- compiledCache.set(root, value => (built === undefined ? walk(root, value) : built(value)));
1113
- built = new Builder().build(root);
1114
- compiledCache.set(root, built);
1115
- return built;
1111
+ const built: { value?: (value: unknown) => unknown } = {};
1112
+ compiledCache.set(root, value => (built.value === undefined ? walk(root, value) : built.value(value)));
1113
+ const compiled = new Builder().build(root);
1114
+ built.value = compiled;
1115
+ compiledCache.set(root, compiled);
1116
+ return compiled;
1116
1117
  }
1117
1118
  return validator;
1118
1119
  }
@@ -1122,14 +1123,15 @@ export function compileAllows(ir: IR): (value: unknown) => value is unknown {
1122
1123
  const root = resolvedRoot(ir);
1123
1124
  const validator = allowsCache.get(root);
1124
1125
  if (validator === undefined) {
1125
- let built: ((value: unknown) => value is unknown) | undefined;
1126
+ const built: { value?: (value: unknown) => value is unknown } = {};
1126
1127
  allowsCache.set(root, ((value: unknown) =>
1127
- built === undefined ? !(walk(root, value) instanceof OmpErrors) : built(value)) as (
1128
+ built.value === undefined ? !(walk(root, value) instanceof OmpErrors) : built.value(value)) as (
1128
1129
  value: unknown,
1129
1130
  ) => value is unknown);
1130
- built = new Builder().buildAllows(root);
1131
- allowsCache.set(root, built);
1132
- return built;
1131
+ const compiled = new Builder().buildAllows(root);
1132
+ built.value = compiled;
1133
+ allowsCache.set(root, compiled);
1134
+ return compiled;
1133
1135
  }
1134
1136
  return validator;
1135
1137
  }
package/src/infer.ts CHANGED
@@ -37,7 +37,7 @@ interface PrimitiveMap {
37
37
  Key: PropertyKey;
38
38
  Date: Date;
39
39
  Array: unknown[];
40
- // biome-ignore lint/complexity/noBannedTypes: built-in Function keyword
40
+ // biome-ignore lint/complexity/noBannedTypes: omptype mirrors ArkType public API surface
41
41
  Function: Function;
42
42
  RegExp: RegExp;
43
43
  File: File;
package/src/interp.ts CHANGED
@@ -293,6 +293,7 @@ function visitNode(ir: IR, v: unknown, path: PropertyKey[]): unknown {
293
293
  if (ir.min !== undefined && v.length < ir.min) return fail(path, `at least length ${ir.min}`, v.length);
294
294
  if (ir.max !== undefined && v.length > ir.max) return fail(path, `at most length ${ir.max}`, v.length);
295
295
  const morph = hasMorph(ir.el);
296
+ // [suppressed] length preallocation
296
297
  const out = morph ? new Array<unknown>(v.length) : v;
297
298
  let errors: OmpErrors | undefined;
298
299
  for (let index = 0; index < v.length; index++) {
package/src/keywords.ts CHANGED
@@ -116,8 +116,8 @@ function finiteNumber(expected = "a number"): IR {
116
116
  }
117
117
 
118
118
  function jsonObject(): IR {
119
- let value: IR;
120
- const resolveValue = (): IR => value;
119
+ const value: { current?: IR } = {};
120
+ const resolveValue = (): IR => value.current as IR;
121
121
  const object: IR = {
122
122
  k: "object",
123
123
  props: [],
@@ -129,7 +129,7 @@ function jsonObject(): IR {
129
129
  el: { k: "alias", name: "$jsonValue", resolve: resolveValue },
130
130
  desc: "an object",
131
131
  };
132
- value = {
132
+ value.current = {
133
133
  k: "union",
134
134
  members: [
135
135
  object,
package/src/type.ts CHANGED
@@ -199,7 +199,7 @@ type NaryAndOutput<definitions extends readonly unknown[]> = definitions extends
199
199
  type NaryAndInput<definitions extends readonly unknown[]> = definitions extends readonly []
200
200
  ? unknown
201
201
  : SimplifyNary<UnionToIntersection<InferDefIn<definitions[number]>>>;
202
- // biome-ignore lint/complexity/noBannedTypes: generic accumulator default
202
+ // biome-ignore lint/complexity/noBannedTypes: omptype mirrors ArkType public API surface
203
203
  type ReduceNaryMergeOutput<definitions extends readonly unknown[], result = {}> = definitions extends readonly [
204
204
  infer head,
205
205
  ...infer tail,
@@ -207,9 +207,9 @@ type ReduceNaryMergeOutput<definitions extends readonly unknown[], result = {}>
207
207
  ? ReduceNaryMergeOutput<tail, SimplifyNary<MergeTypes<result, InferDef<head>>>>
208
208
  : definitions extends readonly []
209
209
  ? result
210
- : // biome-ignore lint/complexity/noBannedTypes: empty object fallback
210
+ : // biome-ignore lint/complexity/noBannedTypes: omptype mirrors ArkType public API surface
211
211
  {};
212
- // biome-ignore lint/complexity/noBannedTypes: generic accumulator default
212
+ // biome-ignore lint/complexity/noBannedTypes: omptype mirrors ArkType public API surface
213
213
  type ReduceNaryMergeInput<definitions extends readonly unknown[], result = {}> = definitions extends readonly [
214
214
  infer head,
215
215
  ...infer tail,
@@ -217,7 +217,7 @@ type ReduceNaryMergeInput<definitions extends readonly unknown[], result = {}> =
217
217
  ? ReduceNaryMergeInput<tail, SimplifyNary<MergeTypes<result, InferDefIn<head>>>>
218
218
  : definitions extends readonly []
219
219
  ? result
220
- : // biome-ignore lint/complexity/noBannedTypes: empty object fallback
220
+ : // biome-ignore lint/complexity/noBannedTypes: omptype mirrors ArkType public API surface
221
221
  {};
222
222
  type NaryMergeOutput<definitions extends readonly unknown[]> = definitions extends readonly []
223
223
  ? object
@@ -2575,13 +2575,14 @@ function parseGenericArgument(definition: unknown, outer?: AliasResolver): IR {
2575
2575
  if (!(error instanceof OmpTypeError) || !error.message.includes('unknown keyword "this"')) throw error;
2576
2576
  }
2577
2577
  }
2578
- let root: IR | undefined;
2578
+ const root: { current?: IR } = {};
2579
2579
  const self: IR = {
2580
2580
  k: "alias",
2581
2581
  name: "this",
2582
2582
  resolve: () => {
2583
- if (root === undefined || root === self) throw new OmpTypeError('"this" cannot be used as a root definition');
2584
- return root;
2583
+ if (root.current === undefined || root.current === self)
2584
+ throw new OmpTypeError('"this" cannot be used as a root definition');
2585
+ return root.current;
2585
2586
  },
2586
2587
  };
2587
2588
  const resolve = ((name: string) => (name === "this" ? self : outer?.(name))) as AliasResolver;
@@ -2593,9 +2594,9 @@ function parseGenericArgument(definition: unknown, outer?: AliasResolver): IR {
2593
2594
  // strings inside the definition may still share the string cache.
2594
2595
  markThisOnlyResolver(resolve);
2595
2596
  }
2596
- root = parseDef(definition, resolve);
2597
- if (root === self) throw new OmpTypeError('"this" cannot be used as a root definition');
2598
- return root;
2597
+ root.current = parseDef(definition, resolve);
2598
+ if (root.current === self) throw new OmpTypeError('"this" cannot be used as a root definition');
2599
+ return root.current;
2599
2600
  }
2600
2601
 
2601
2602
  function genericBodyIR(
@@ -2681,17 +2682,18 @@ export function type<const expression extends readonly unknown[]>(
2681
2682
  ...definition: expression
2682
2683
  ): FluentType<InferDef<expression>, InferDefIn<expression>>;
2683
2684
  export function type(first?: unknown): FluentType<unknown> | Generic {
2684
- // biome-ignore lint/complexity/noArguments: Avoid allocating a rest array for the dominant single-definition call.
2685
+ // biome-ignore lint/complexity/noArguments: omptype mirrors ArkType public API surface
2685
2686
  const count = arguments.length;
2686
2687
  if (count === 2 && typeof first === "string" && first.trimStart().startsWith("<")) {
2687
- // biome-ignore lint/complexity/noArguments: The generic path reads its second positional argument without a rest array.
2688
+ // biome-ignore lint/complexity/noArguments: omptype mirrors ArkType public API surface
2688
2689
  return createRuntimeGeneric(parseGenericParameters(first), arguments[1]);
2689
2690
  }
2690
2691
  let definition: unknown = first;
2691
2692
  if (count !== 1) {
2693
+ // [suppressed] length preallocation
2692
2694
  const expression: unknown[] = new Array(count);
2693
2695
  for (let index = 0; index < count; index++) {
2694
- // biome-ignore lint/complexity/noArguments: Only multi-part expressions pay to materialize an argument array.
2696
+ // biome-ignore lint/complexity/noArguments: omptype mirrors ArkType public API surface
2695
2697
  expression[index] = arguments[index];
2696
2698
  }
2697
2699
  definition = expression;
@@ -3160,7 +3162,7 @@ export interface DeclaredParser<declared> {
3160
3162
  }
3161
3163
 
3162
3164
  /** Fix a schema's externally declared static type without changing its runtime validation. */
3163
- // biome-ignore lint/complexity/noBannedTypes: empty default options object
3165
+ // biome-ignore lint/complexity/noBannedTypes: omptype mirrors ArkType public API surface
3164
3166
  export function declare<declared, _options = {}>(): DeclaredParser<declared> {
3165
3167
  return {
3166
3168
  type: definition => type(definition) as unknown as FluentType<declared, InferDefIn<typeof definition>>,
@@ -3463,7 +3465,7 @@ export namespace type {
3463
3465
  RegExp: keywordSchema<RegExp>("RegExp"),
3464
3466
  File: keywordSchema<File>("File"),
3465
3467
  Error: keywordSchema<Error>("Error"),
3466
- // biome-ignore lint/complexity/noBannedTypes: built-in Function keyword
3468
+ // biome-ignore lint/complexity/noBannedTypes: omptype mirrors ArkType public API surface
3467
3469
  Function: keywordSchema<Function>("Function"),
3468
3470
  Array: {
3469
3471
  liftFrom<const definition>(
@@ -3567,7 +3569,7 @@ export namespace type {
3567
3569
  unknown: { any: keywordSchema<unknown>("unknown.any") },
3568
3570
  };
3569
3571
  /** Date instance validator. */
3570
- // biome-ignore lint/suspicious/noShadowRestrictedNames: ArkType exposes this exact keyword.
3572
+ // biome-ignore lint/suspicious/noShadowRestrictedNames: omptype mirrors ArkType public API surface
3571
3573
  export const Date = makeType<globalThis.Date>({ k: "instance", ctor: globalThis.Date, expected: "a Date" }, [], {});
3572
3574
 
3573
3575
  /** Validate instances of `ctor`. */
@@ -3604,7 +3606,7 @@ export namespace type {
3604
3606
  }
3605
3607
 
3606
3608
  /** Enumerate an enum-like object's forward values, excluding numeric reverse mappings. */
3607
- // biome-ignore lint/suspicious/noShadowRestrictedNames: Object.prototype.valueOf method name API
3609
+ // biome-ignore lint/suspicious/noShadowRestrictedNames: omptype mirrors ArkType public API surface
3608
3610
  export function valueOf<const values extends Record<PropertyKey, unknown>>(
3609
3611
  values: values,
3610
3612
  ): FluentType<values[keyof values]> {
@@ -3629,7 +3631,7 @@ export namespace type {
3629
3631
  export const fn: FnParser = makeFn();
3630
3632
 
3631
3633
  /** Fix an externally declared static type while retaining runtime validation. */
3632
- // biome-ignore lint/complexity/noBannedTypes: empty default options object
3634
+ // biome-ignore lint/complexity/noBannedTypes: omptype mirrors ArkType public API surface
3633
3635
  export const declare = <declared, _options = {}>(): DeclaredParser<declared> =>
3634
3636
  ({
3635
3637
  type: definition => type(definition) as unknown as FluentType<declared, InferDefIn<typeof definition>>,
@@ -3802,7 +3804,7 @@ function buildScope(aliases: Record<string, unknown>, options?: ScopeOptions): T
3802
3804
 
3803
3805
  const references = new Map<string, IR>();
3804
3806
  const targets = new Map<string, IR>();
3805
- let scopeValue: TypeScope;
3807
+ const scopeValue: { current?: TypeScope } = {};
3806
3808
 
3807
3809
  const materialize = (entry: ScopeAlias): unknown => {
3808
3810
  if (entry.materialized) return entry.definition;
@@ -3889,7 +3891,7 @@ function buildScope(aliases: Record<string, unknown>, options?: ScopeOptions): T
3889
3891
  };
3890
3892
 
3891
3893
  const bind = (schema: InternalType): InternalType => {
3892
- Reflect.set(schema, "$", scopeValue);
3894
+ Reflect.set(schema, "$", scopeValue.current);
3893
3895
  Reflect.set(schema, "resolver", resolve);
3894
3896
  return schema;
3895
3897
  };
@@ -3915,7 +3917,7 @@ function buildScope(aliases: Record<string, unknown>, options?: ScopeOptions): T
3915
3917
 
3916
3918
  const bindModule = (names: readonly string[]): RuntimeModule => {
3917
3919
  const module = {} as RuntimeModule;
3918
- Object.defineProperty(module, MODULE_SCOPE, { value: scopeValue });
3920
+ Object.defineProperty(module, MODULE_SCOPE, { value: scopeValue.current });
3919
3921
  for (const name of names) {
3920
3922
  const entry = entries.get(name);
3921
3923
  if (entry === undefined) continue;
@@ -3929,7 +3931,7 @@ function buildScope(aliases: Record<string, unknown>, options?: ScopeOptions): T
3929
3931
  return module;
3930
3932
  };
3931
3933
 
3932
- scopeValue = {
3934
+ scopeValue.current = {
3933
3935
  type: scoped,
3934
3936
  match: scopedMatch,
3935
3937
  define<const definition>(definition: definition): definition {
@@ -3979,7 +3981,7 @@ function buildScope(aliases: Record<string, unknown>, options?: ScopeOptions): T
3979
3981
  return json;
3980
3982
  },
3981
3983
  };
3982
- return scopeValue;
3984
+ return scopeValue.current;
3983
3985
  }
3984
3986
 
3985
3987
  /** A schema whose output type is not statically known (`type.raw` results). */