@linxiraos/pi-omptype 1.1.7 → 1.1.9

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,14 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.1.9] - 2026-09-05
6
+
7
+ - v18.1.10 sync baseline (published as @linxiraos/pi-omptype; zod/typebox subpaths intact).
8
+
9
+ ## [1.1.8] - 2026-09-04
10
+
11
+ - OMP sync v18.1.2–v18.1.5: schema validation runtime maintenance aligned with upstream.
12
+
5
13
  ## [1.1.7] - 2026-09-01
6
14
 
7
15
  - 版本线随 1.1.7 发布对齐(随本体 v18.0.11 同步与主题/网关更新),包内无独立变更。
package/package.json CHANGED
@@ -1,73 +1,60 @@
1
1
  {
2
- "type": "module",
3
- "name": "@linxiraos/pi-omptype",
4
- "version": "1.1.7",
5
- "description": "ArkType-compatible runtime schema validation with lazy JIT compilation",
6
- "homepage": "https://linxira-os.github.io/zeta/",
7
- "author": "Can Boluk",
8
- "license": "MIT",
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/Linxira-OS/linxira-zeta.git",
12
- "directory": "packages/omptype"
13
- },
14
- "bugs": {
15
- "url": "https://github.com/Linxira-OS/linxira-zeta/issues"
16
- },
17
- "keywords": [
18
- "schema",
19
- "validation",
20
- "arktype",
21
- "jit"
22
- ],
23
- "main": "./dist/js/index.js",
24
- "types": "./dist/types/index.d.ts",
25
- "scripts": {
26
- "check": "biome check . && bun run check:types",
27
- "check:types": "tsgo -p tsconfig.json --noEmit",
28
- "lint": "biome lint .",
29
- "fix": "biome check --write --unsafe .",
30
- "fmt": "biome format --write .",
31
- "test": "bun test --parallel",
32
- "bench": "bun bench/bench.ts"
33
- },
34
- "devDependencies": {
35
- "@ark/attest": "0.56.3",
36
- "@ark/schema": "0.56.2",
37
- "@ark/util": "0.56.2",
38
- "@sinclair/typebox": "^0.34.0",
39
- "@types/bun": "^1.3.14",
40
- "arkregex": "0.0.8",
41
- "arktype": "2.2.3"
42
- },
43
- "engines": {
44
- "node": ">=20",
45
- "bun": ">=1.3.14"
46
- },
47
- "files": [
48
- "src",
49
- "README.md",
50
- "CHANGELOG.md",
51
- "LICENSE",
52
- "THIRD-PARTY-NOTICES.txt",
53
- "dist/types",
54
- "dist/js"
55
- ],
56
- "exports": {
57
- ".": {
58
- "types": "./dist/types/index.d.ts",
59
- "bun": "./src/index.ts",
60
- "default": "./dist/js/index.js"
61
- },
62
- "./*": {
63
- "types": "./dist/types/*.d.ts",
64
- "bun": "./src/*.ts",
65
- "default": "./dist/js/*.js"
66
- },
67
- "./*.js": {
68
- "types": "./dist/types/*.d.ts",
69
- "bun": "./src/*.ts",
70
- "default": "./dist/js/*.js"
71
- }
72
- }
2
+ "type": "module",
3
+ "name": "@linxiraos/pi-omptype",
4
+ "version": "1.1.9",
5
+ "description": "ArkType-compatible runtime schema validation with lazy JIT compilation",
6
+ "homepage": "https://linxira-os.github.io/zeta/",
7
+ "author": "Can Boluk",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Linxira-OS/linxira-zeta.git",
12
+ "directory": "packages/omptype"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/Linxira-OS/linxira-zeta/issues"
16
+ },
17
+ "keywords": [
18
+ "schema",
19
+ "validation",
20
+ "arktype",
21
+ "jit"
22
+ ],
23
+ "main": "./src/index.ts",
24
+ "types": "./src/index.ts",
25
+ "scripts": {
26
+ "check": "tsgo -p tsconfig.json --noEmit",
27
+ "check:types": "tsgo -p tsconfig.json --noEmit",
28
+ "test": "bun test --parallel",
29
+ "bench": "bun bench/bench.ts"
30
+ },
31
+ "devDependencies": {
32
+ "@ark/attest": "0.56.3",
33
+ "@ark/schema": "0.56.2",
34
+ "@ark/util": "0.56.2",
35
+ "@sinclair/typebox": "^0.34.0",
36
+ "@types/bun": "^1.3.14",
37
+ "arkregex": "0.0.8",
38
+ "arktype": "2.2.3"
39
+ },
40
+ "engines": {
41
+ "node": ">=20",
42
+ "bun": ">=1.3.14"
43
+ },
44
+ "files": [
45
+ "src",
46
+ "README.md",
47
+ "CHANGELOG.md"
48
+ ],
49
+ "exports": {
50
+ ".": {
51
+ "types": "./src/index.ts",
52
+ "import": "./src/index.ts"
53
+ },
54
+ "./*": {
55
+ "types": "./src/*.ts",
56
+ "import": "./src/*.ts"
57
+ },
58
+ "./*.js": "./src/*.ts"
59
+ }
73
60
  }
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). */