typesea 0.1.0 → 0.3.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 +85 -6
- package/README.md +143 -28
- package/dist/adapters/index.d.ts +50 -8
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +169 -48
- package/dist/aot/index.d.ts +19 -3
- package/dist/aot/index.d.ts.map +1 -1
- package/dist/aot/index.js +115 -17
- package/dist/async/index.d.ts +28 -56
- package/dist/async/index.d.ts.map +1 -1
- package/dist/async/index.js +94 -37
- package/dist/builders/composite.d.ts +43 -9
- package/dist/builders/composite.d.ts.map +1 -1
- package/dist/builders/composite.js +100 -17
- package/dist/builders/index.d.ts +8 -5
- package/dist/builders/index.d.ts.map +1 -1
- package/dist/builders/index.js +7 -4
- package/dist/builders/modifier.d.ts +36 -5
- package/dist/builders/modifier.d.ts.map +1 -1
- package/dist/builders/modifier.js +52 -5
- package/dist/builders/object/guard.d.ts +72 -24
- package/dist/builders/object/guard.d.ts.map +1 -1
- package/dist/builders/object/guard.js +139 -29
- package/dist/builders/object/index.d.ts +4 -2
- package/dist/builders/object/index.d.ts.map +1 -1
- package/dist/builders/object/index.js +3 -1
- package/dist/builders/object/schema.d.ts +88 -11
- package/dist/builders/object/schema.d.ts.map +1 -1
- package/dist/builders/object/schema.js +290 -23
- package/dist/builders/object/types.d.ts +20 -31
- package/dist/builders/object/types.d.ts.map +1 -1
- package/dist/builders/object/types.js +2 -0
- package/dist/builders/runtime.d.ts +40 -0
- package/dist/builders/runtime.d.ts.map +1 -0
- package/dist/builders/runtime.js +150 -0
- package/dist/builders/scalar.d.ts +49 -9
- package/dist/builders/scalar.d.ts.map +1 -1
- package/dist/builders/scalar.js +87 -9
- package/dist/builders/table.d.ts +35 -5
- package/dist/builders/table.d.ts.map +1 -1
- package/dist/builders/table.js +35 -5
- package/dist/builders/types.d.ts +20 -4
- package/dist/builders/types.d.ts.map +1 -1
- package/dist/builders/types.js +2 -0
- package/dist/compile/check-composite.d.ts +25 -2
- package/dist/compile/check-composite.d.ts.map +1 -1
- package/dist/compile/check-composite.js +699 -27
- package/dist/compile/check-scalar.d.ts +88 -0
- package/dist/compile/check-scalar.d.ts.map +1 -1
- package/dist/compile/check-scalar.js +570 -3
- package/dist/compile/check.d.ts +12 -0
- package/dist/compile/check.d.ts.map +1 -1
- package/dist/compile/check.js +62 -3
- package/dist/compile/context.d.ts +47 -9
- package/dist/compile/context.d.ts.map +1 -1
- package/dist/compile/context.js +53 -8
- package/dist/compile/first.d.ts +26 -0
- package/dist/compile/first.d.ts.map +1 -0
- package/dist/compile/first.js +850 -0
- package/dist/compile/graph-predicate.d.ts +4 -2
- package/dist/compile/graph-predicate.d.ts.map +1 -1
- package/dist/compile/graph-predicate.js +2272 -165
- package/dist/compile/guard.d.ts +16 -24
- package/dist/compile/guard.d.ts.map +1 -1
- package/dist/compile/guard.js +202 -72
- package/dist/compile/index.d.ts +3 -1
- package/dist/compile/index.d.ts.map +1 -1
- package/dist/compile/index.js +2 -0
- package/dist/compile/issue.d.ts +110 -0
- package/dist/compile/issue.d.ts.map +1 -1
- package/dist/compile/issue.js +184 -1
- package/dist/compile/names.d.ts +12 -2
- package/dist/compile/names.d.ts.map +1 -1
- package/dist/compile/names.js +19 -3
- package/dist/compile/predicate.d.ts +24 -0
- package/dist/compile/predicate.d.ts.map +1 -1
- package/dist/compile/predicate.js +287 -10
- package/dist/compile/runtime.d.ts +100 -13
- package/dist/compile/runtime.d.ts.map +1 -1
- package/dist/compile/runtime.js +56 -6
- package/dist/compile/source.d.ts +10 -2
- package/dist/compile/source.d.ts.map +1 -1
- package/dist/compile/source.js +385 -26
- package/dist/compile/types.d.ts +22 -0
- package/dist/compile/types.d.ts.map +1 -1
- package/dist/compile/types.js +2 -0
- package/dist/decoder/index.d.ts +92 -46
- package/dist/decoder/index.d.ts.map +1 -1
- package/dist/decoder/index.js +266 -39
- package/dist/evaluate/check-composite.d.ts +111 -2
- package/dist/evaluate/check-composite.d.ts.map +1 -1
- package/dist/evaluate/check-composite.js +343 -8
- package/dist/evaluate/check-scalar.d.ts +25 -0
- package/dist/evaluate/check-scalar.d.ts.map +1 -1
- package/dist/evaluate/check-scalar.js +124 -3
- package/dist/evaluate/check.d.ts +7 -0
- package/dist/evaluate/check.d.ts.map +1 -1
- package/dist/evaluate/check.js +62 -4
- package/dist/evaluate/index.d.ts +2 -0
- package/dist/evaluate/index.d.ts.map +1 -1
- package/dist/evaluate/index.js +2 -0
- package/dist/evaluate/issue.d.ts +11 -1
- package/dist/evaluate/issue.d.ts.map +1 -1
- package/dist/evaluate/issue.js +15 -1
- package/dist/evaluate/predicate.d.ts +16 -5
- package/dist/evaluate/predicate.d.ts.map +1 -1
- package/dist/evaluate/predicate.js +20 -5
- package/dist/evaluate/shared.d.ts +78 -13
- package/dist/evaluate/shared.d.ts.map +1 -1
- package/dist/evaluate/shared.js +101 -8
- package/dist/evaluate/state.d.ts +35 -13
- package/dist/evaluate/state.d.ts.map +1 -1
- package/dist/evaluate/state.js +35 -2
- package/dist/guard/array.d.ts +48 -0
- package/dist/guard/array.d.ts.map +1 -0
- package/dist/guard/array.js +84 -0
- package/dist/guard/base.d.ts +111 -31
- package/dist/guard/base.d.ts.map +1 -1
- package/dist/guard/base.js +165 -32
- package/dist/guard/date.d.ts +34 -0
- package/dist/guard/date.d.ts.map +1 -0
- package/dist/guard/date.js +60 -0
- package/dist/guard/error.d.ts +10 -5
- package/dist/guard/error.d.ts.map +1 -1
- package/dist/guard/error.js +10 -5
- package/dist/guard/index.d.ts +4 -0
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +4 -0
- package/dist/guard/number.d.ts +86 -11
- package/dist/guard/number.d.ts.map +1 -1
- package/dist/guard/number.js +159 -11
- package/dist/guard/props.d.ts +27 -3
- package/dist/guard/props.d.ts.map +1 -1
- package/dist/guard/props.js +27 -3
- package/dist/guard/read.d.ts +115 -10
- package/dist/guard/read.d.ts.map +1 -1
- package/dist/guard/read.js +185 -10
- package/dist/guard/registry.d.ts +12 -2
- package/dist/guard/registry.d.ts.map +1 -1
- package/dist/guard/registry.js +15 -3
- package/dist/guard/string.d.ts +115 -13
- package/dist/guard/string.d.ts.map +1 -1
- package/dist/guard/string.js +250 -13
- package/dist/guard/types.d.ts +110 -40
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/guard/types.js +2 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/internal/index.d.ts +42 -6
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +51 -8
- package/dist/ir/builder.d.ts +17 -127
- package/dist/ir/builder.d.ts.map +1 -1
- package/dist/ir/builder.js +80 -137
- package/dist/ir/freeze.d.ts +4 -0
- package/dist/ir/freeze.d.ts.map +1 -1
- package/dist/ir/freeze.js +66 -0
- package/dist/ir/index.d.ts +3 -1
- package/dist/ir/index.d.ts.map +1 -1
- package/dist/ir/index.js +2 -0
- package/dist/ir/regexp.d.ts +2 -0
- package/dist/ir/regexp.d.ts.map +1 -1
- package/dist/ir/regexp.js +2 -0
- package/dist/ir/types.d.ts +94 -56
- package/dist/ir/types.d.ts.map +1 -1
- package/dist/ir/types.js +2 -0
- package/dist/ir/validate.d.ts +8 -1
- package/dist/ir/validate.d.ts.map +1 -1
- package/dist/ir/validate.js +511 -61
- package/dist/issue/index.d.ts +42 -10
- package/dist/issue/index.d.ts.map +1 -1
- package/dist/issue/index.js +65 -11
- package/dist/json-schema/emit-combinator.d.ts +44 -4
- package/dist/json-schema/emit-combinator.d.ts.map +1 -1
- package/dist/json-schema/emit-combinator.js +44 -4
- package/dist/json-schema/emit-composite.d.ts +16 -2
- package/dist/json-schema/emit-composite.d.ts.map +1 -1
- package/dist/json-schema/emit-composite.js +81 -13
- package/dist/json-schema/emit-scalar.d.ts +26 -3
- package/dist/json-schema/emit-scalar.d.ts.map +1 -1
- package/dist/json-schema/emit-scalar.js +124 -10
- package/dist/json-schema/emit-types.d.ts +11 -1
- package/dist/json-schema/emit-types.d.ts.map +1 -1
- package/dist/json-schema/emit-types.js +2 -0
- package/dist/json-schema/emit.d.ts +12 -1
- package/dist/json-schema/emit.d.ts.map +1 -1
- package/dist/json-schema/emit.js +23 -3
- package/dist/json-schema/freeze.d.ts +13 -2
- package/dist/json-schema/freeze.d.ts.map +1 -1
- package/dist/json-schema/freeze.js +41 -8
- package/dist/json-schema/index.d.ts +16 -2
- package/dist/json-schema/index.d.ts.map +1 -1
- package/dist/json-schema/index.js +23 -3
- package/dist/json-schema/issue.d.ts +4 -1
- package/dist/json-schema/issue.d.ts.map +1 -1
- package/dist/json-schema/issue.js +4 -1
- package/dist/json-schema/read.d.ts +24 -3
- package/dist/json-schema/read.d.ts.map +1 -1
- package/dist/json-schema/read.js +59 -12
- package/dist/json-schema/types.d.ts +45 -16
- package/dist/json-schema/types.d.ts.map +1 -1
- package/dist/json-schema/types.js +2 -0
- package/dist/kind/index.d.ts +40 -28
- package/dist/kind/index.d.ts.map +1 -1
- package/dist/kind/index.js +41 -13
- package/dist/lower/index.d.ts +6 -1
- package/dist/lower/index.d.ts.map +1 -1
- package/dist/lower/index.js +462 -46
- package/dist/message/index.d.ts +64 -10
- package/dist/message/index.d.ts.map +1 -1
- package/dist/message/index.js +155 -17
- package/dist/optimize/algebraic.d.ts +54 -0
- package/dist/optimize/algebraic.d.ts.map +1 -0
- package/dist/optimize/algebraic.js +314 -0
- package/dist/optimize/compact.d.ts +8 -1
- package/dist/optimize/compact.d.ts.map +1 -1
- package/dist/optimize/compact.js +13 -2
- package/dist/optimize/domain.d.ts +16 -0
- package/dist/optimize/domain.d.ts.map +1 -0
- package/dist/optimize/domain.js +619 -0
- package/dist/optimize/fold-boolean.d.ts +17 -2
- package/dist/optimize/fold-boolean.d.ts.map +1 -1
- package/dist/optimize/fold-boolean.js +59 -14
- package/dist/optimize/fold-common.d.ts +43 -8
- package/dist/optimize/fold-common.d.ts.map +1 -1
- package/dist/optimize/fold-common.js +37 -6
- package/dist/optimize/fold-constraints.d.ts +33 -0
- package/dist/optimize/fold-constraints.d.ts.map +1 -0
- package/dist/optimize/fold-constraints.js +484 -0
- package/dist/optimize/fold-scalar.d.ts +98 -13
- package/dist/optimize/fold-scalar.d.ts.map +1 -1
- package/dist/optimize/fold-scalar.js +98 -13
- package/dist/optimize/fold.d.ts +8 -1
- package/dist/optimize/fold.d.ts.map +1 -1
- package/dist/optimize/fold.js +22 -2
- package/dist/optimize/index.d.ts +9 -1
- package/dist/optimize/index.d.ts.map +1 -1
- package/dist/optimize/index.js +18 -3
- package/dist/optimize/map-node.d.ts +3 -1
- package/dist/optimize/map-node.d.ts.map +1 -1
- package/dist/optimize/map-node.js +48 -3
- package/dist/optimize/peephole.d.ts +16 -0
- package/dist/optimize/peephole.d.ts.map +1 -0
- package/dist/optimize/peephole.js +254 -0
- package/dist/optimize/remap.d.ts +2 -0
- package/dist/optimize/remap.d.ts.map +1 -1
- package/dist/optimize/remap.js +2 -0
- package/dist/optimize/rewrite.d.ts +13 -8
- package/dist/optimize/rewrite.d.ts.map +1 -1
- package/dist/optimize/rewrite.js +13 -8
- package/dist/plan/cache.d.ts +9 -3
- package/dist/plan/cache.d.ts.map +1 -1
- package/dist/plan/cache.js +34 -6
- package/dist/plan/index.d.ts +2 -0
- package/dist/plan/index.d.ts.map +1 -1
- package/dist/plan/index.js +2 -0
- package/dist/plan/predicate.d.ts +2 -0
- package/dist/plan/predicate.d.ts.map +1 -1
- package/dist/plan/predicate.js +298 -29
- package/dist/plan/schema-predicate.d.ts +6 -0
- package/dist/plan/schema-predicate.d.ts.map +1 -1
- package/dist/plan/schema-predicate.js +382 -19
- package/dist/plan/types.d.ts +2 -0
- package/dist/plan/types.d.ts.map +1 -1
- package/dist/plan/types.js +2 -0
- package/dist/result/index.d.ts +19 -5
- package/dist/result/index.d.ts.map +1 -1
- package/dist/result/index.js +10 -2
- package/dist/schema/common.d.ts +69 -6
- package/dist/schema/common.d.ts.map +1 -1
- package/dist/schema/common.js +104 -10
- package/dist/schema/freeze.d.ts +4 -0
- package/dist/schema/freeze.d.ts.map +1 -1
- package/dist/schema/freeze.js +40 -0
- package/dist/schema/index.d.ts +5 -2
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +4 -1
- package/dist/schema/lazy.d.ts +4 -0
- package/dist/schema/lazy.d.ts.map +1 -1
- package/dist/schema/lazy.js +4 -0
- package/dist/schema/literal.d.ts +7 -1
- package/dist/schema/literal.d.ts.map +1 -1
- package/dist/schema/literal.js +7 -1
- package/dist/schema/types.d.ts +109 -100
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/types.js +13 -2
- package/dist/schema/undefined.d.ts +17 -0
- package/dist/schema/undefined.d.ts.map +1 -0
- package/dist/schema/undefined.js +77 -0
- package/dist/schema/validate.d.ts +8 -1
- package/dist/schema/validate.d.ts.map +1 -1
- package/dist/schema/validate.js +255 -57
- package/docs/api.md +128 -8
- package/docs/assets/benchmark-headline.svg +163 -0
- package/docs/engine-notes.md +62 -15
- package/docs/index.html +1340 -702
- package/docs/ko/api.md +375 -0
- package/docs/ko/engine-notes.md +156 -0
- package/docs/ko/readme.md +378 -0
- package/package.json +66 -65
package/dist/compile/guard.d.ts
CHANGED
|
@@ -1,41 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file compile/guard.ts
|
|
3
3
|
* @brief Compiled guard construction and receiver validation.
|
|
4
|
+
* @details Generated-source helpers keep the side-table ABI and JavaScript source shape
|
|
5
|
+
* stable across runtime and AOT emission.
|
|
4
6
|
*/
|
|
5
7
|
import { BaseGuard, type Guard, type Presence, type RuntimeValue } from "../guard/index.js";
|
|
6
8
|
import type { CheckResult } from "../issue/index.js";
|
|
7
9
|
import { type Schema } from "../schema/index.js";
|
|
8
|
-
import { type BooleanPredicate, type IssueCollectorRoot } from "./runtime.js";
|
|
10
|
+
import { type BooleanPredicate, type CheckResultRoot, type IssueCollectorRoot } from "./runtime.js";
|
|
9
11
|
import type { CompileOptions, CompiledGuard } from "./types.js";
|
|
10
12
|
/**
|
|
11
|
-
* @brief
|
|
12
|
-
* @details
|
|
13
|
-
*
|
|
13
|
+
* @brief Guard backed by generated predicate and diagnostic collectors.
|
|
14
|
+
* @details The boolean predicate is the hot path; the collector is only entered
|
|
15
|
+
* after a failed predicate so successful validation does not allocate issues.
|
|
16
|
+
* @invariant test, collect, and source are immutable after construction.
|
|
14
17
|
*/
|
|
15
18
|
export declare class CompiledBaseGuard<TValue, TPresence extends Presence = "required"> extends BaseGuard<TValue, TPresence> implements CompiledGuard<TValue, TPresence> {
|
|
19
|
+
#private;
|
|
16
20
|
readonly source: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*/
|
|
23
|
-
constructor(schema: Schema, test: BooleanPredicate, collect: IssueCollectorRoot, source: string);
|
|
24
|
-
/**
|
|
25
|
-
* @brief is.
|
|
26
|
-
*/
|
|
27
|
-
is(this: unknown, value: unknown): value is RuntimeValue<TValue, TPresence>;
|
|
28
|
-
/**
|
|
29
|
-
* @brief check.
|
|
30
|
-
*/
|
|
31
|
-
check(this: unknown, value: unknown): CheckResult<RuntimeValue<TValue, TPresence>>;
|
|
32
|
-
/**
|
|
33
|
-
* @brief assert.
|
|
34
|
-
*/
|
|
35
|
-
assert(this: unknown, value: unknown): asserts value is RuntimeValue<TValue, TPresence>;
|
|
21
|
+
constructor(schema: Schema, test: BooleanPredicate, collect: IssueCollectorRoot, source: string, trustedCollector?: boolean, checkResult?: CheckResultRoot, checkFirstResult?: CheckResultRoot);
|
|
22
|
+
is(this: CompiledBaseGuard<TValue, TPresence>, value: unknown): value is RuntimeValue<TValue, TPresence>;
|
|
23
|
+
check(this: CompiledBaseGuard<TValue, TPresence>, value: unknown): CheckResult<RuntimeValue<TValue, TPresence>>;
|
|
24
|
+
checkFirst(this: CompiledBaseGuard<TValue, TPresence>, value: unknown): CheckResult<RuntimeValue<TValue, TPresence>>;
|
|
25
|
+
assert(this: CompiledBaseGuard<TValue, TPresence>, value: unknown): asserts value is RuntimeValue<TValue, TPresence>;
|
|
36
26
|
}
|
|
37
27
|
/**
|
|
38
|
-
* @brief
|
|
28
|
+
* @brief Emit a V8-visible validator function for a guard schema.
|
|
29
|
+
* @details The generated function keeps literals and dynamic schema fallbacks in
|
|
30
|
+
* side tables so the source body remains monomorphic and easy to inline.
|
|
39
31
|
*/
|
|
40
32
|
export declare function compile<TValue, TPresence extends Presence>(guard: Guard<TValue, TPresence>, options?: Partial<CompileOptions>): CompiledBaseGuard<TValue, TPresence>;
|
|
41
33
|
//# sourceMappingURL=guard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../src/compile/guard.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../src/compile/guard.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACH,SAAS,EAET,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,YAAY,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAGH,KAAK,MAAM,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAKH,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAEpB,KAAK,kBAAkB,EAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAER,cAAc,EACd,aAAa,EAChB,MAAM,YAAY,CAAC;AAMpB;;;;;GAKG;AACH,qBAAa,iBAAiB,CAC1B,MAAM,EACN,SAAS,SAAS,QAAQ,GAAG,UAAU,CACzC,SAAQ,SAAS,CAAC,MAAM,EAAE,SAAS,CAAE,YAAW,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC;;IAO9E,SAAwB,MAAM,EAAE,MAAM,CAAC;gBAGnC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,MAAM,EACd,gBAAgB,UAAQ,EACxB,WAAW,CAAC,EAAE,eAAe,EAC7B,gBAAgB,CAAC,EAAE,eAAe;IAqCtB,EAAE,CACd,IAAI,EAAE,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,EAC1C,KAAK,EAAE,OAAO,GACf,KAAK,IAAI,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC;IAI3B,KAAK,CACjB,IAAI,EAAE,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,EAC1C,KAAK,EAAE,OAAO,GACf,WAAW,CAAC,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAW/B,UAAU,CACtB,IAAI,EAAE,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,EAC1C,KAAK,EAAE,OAAO,GACf,WAAW,CAAC,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAW/B,MAAM,CAClB,IAAI,EAAE,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,EAC1C,KAAK,EAAE,OAAO,GACf,OAAO,CAAC,KAAK,IAAI,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC;CAYtD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,SAAS,SAAS,QAAQ,EACtD,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,EAC/B,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAClC,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,CA2CtC"}
|
package/dist/compile/guard.js
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file compile/guard.ts
|
|
3
3
|
* @brief Compiled guard construction and receiver validation.
|
|
4
|
+
* @details Generated-source helpers keep the side-table ABI and JavaScript source shape
|
|
5
|
+
* stable across runtime and AOT emission.
|
|
4
6
|
*/
|
|
5
7
|
import { BaseGuard, TypeSeaAssertionError } from "../guard/index.js";
|
|
6
8
|
import { finalizeIssueArray } from "../issue/index.js";
|
|
7
9
|
import { err, ok } from "../result/index.js";
|
|
8
10
|
import { freezeSchema, isSchemaValue } from "../schema/index.js";
|
|
9
|
-
import { makeDynamicCheck, makeDynamicIssueCheck, strictKeys } from "./runtime.js";
|
|
11
|
+
import { makeDynamicCheck, makeDynamicFirstIssueCheck, makeDynamicIssueCheck, strictKeys } from "./runtime.js";
|
|
10
12
|
import { emitCompiledSourceBundle } from "./source.js";
|
|
13
|
+
const trustedCollectors = new WeakSet();
|
|
14
|
+
const trustedCheckResults = new WeakSet();
|
|
15
|
+
const trustedPredicates = new WeakSet();
|
|
11
16
|
/**
|
|
12
|
-
* @brief
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* @brief compiled base guard.
|
|
17
|
-
* @details Owns its state directly; methods expose receiver checks and explicit result flow.
|
|
18
|
-
* @invariant Construction leaves the instance in a fully usable state before it escapes.
|
|
17
|
+
* @brief Guard backed by generated predicate and diagnostic collectors.
|
|
18
|
+
* @details The boolean predicate is the hot path; the collector is only entered
|
|
19
|
+
* after a failed predicate so successful validation does not allocate issues.
|
|
20
|
+
* @invariant test, collect, and source are immutable after construction.
|
|
19
21
|
*/
|
|
20
22
|
export class CompiledBaseGuard extends BaseGuard {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
#test;
|
|
24
|
+
#collect;
|
|
25
|
+
#trustedCollector;
|
|
26
|
+
#checkResult;
|
|
27
|
+
#checkFirstResult;
|
|
28
|
+
constructor(schema, test, collect, source, trustedCollector = false, checkResult, checkFirstResult) {
|
|
26
29
|
if (typeof test !== "function") {
|
|
27
30
|
throw new TypeError("compiled guard test must be a function");
|
|
28
31
|
}
|
|
@@ -33,111 +36,222 @@ export class CompiledBaseGuard extends BaseGuard {
|
|
|
33
36
|
throw new TypeError("compiled guard source must be a string");
|
|
34
37
|
}
|
|
35
38
|
super(schema);
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
this.#test = test;
|
|
40
|
+
this.#collect = collect;
|
|
41
|
+
this.#trustedCollector = trustedCollector && trustedCollectors.has(collect);
|
|
42
|
+
this.#checkResult = checkResult !== undefined &&
|
|
43
|
+
trustedCheckResults.has(checkResult)
|
|
44
|
+
? checkResult
|
|
45
|
+
: undefined;
|
|
46
|
+
this.#checkFirstResult = checkFirstResult !== undefined &&
|
|
47
|
+
trustedCheckResults.has(checkFirstResult)
|
|
48
|
+
? checkFirstResult
|
|
49
|
+
: undefined;
|
|
38
50
|
defineReadonlyProperty(this, "source", source, true);
|
|
39
|
-
|
|
51
|
+
if (trustedPredicates.has(test) &&
|
|
52
|
+
this.#checkResult !== undefined &&
|
|
53
|
+
this.#checkFirstResult !== undefined) {
|
|
54
|
+
defineTrustedHotMethods(this, test, this.#checkResult, this.#checkFirstResult);
|
|
55
|
+
}
|
|
40
56
|
Object.freeze(this);
|
|
41
57
|
}
|
|
42
|
-
/**
|
|
43
|
-
* @brief is.
|
|
44
|
-
*/
|
|
45
58
|
is(value) {
|
|
46
|
-
return isStrictTrue(
|
|
59
|
+
return isStrictTrue(this.#test(value));
|
|
47
60
|
}
|
|
48
|
-
/**
|
|
49
|
-
* @brief check.
|
|
50
|
-
*/
|
|
51
61
|
check(value) {
|
|
52
|
-
|
|
62
|
+
if (this.#checkResult !== undefined) {
|
|
63
|
+
return this.#checkResult(value);
|
|
64
|
+
}
|
|
65
|
+
return runCompiledCheck(this.#collect, this.#trustedCollector, value);
|
|
66
|
+
}
|
|
67
|
+
checkFirst(value) {
|
|
68
|
+
if (this.#checkFirstResult !== undefined) {
|
|
69
|
+
return this.#checkFirstResult(value);
|
|
70
|
+
}
|
|
71
|
+
return runCompiledCheckFirst(this.#collect, this.#trustedCollector, value);
|
|
53
72
|
}
|
|
54
|
-
/**
|
|
55
|
-
* @brief assert.
|
|
56
|
-
*/
|
|
57
73
|
assert(value) {
|
|
58
|
-
const result =
|
|
74
|
+
const result = this.#checkResult === undefined
|
|
75
|
+
? runCompiledCheck(this.#collect, this.#trustedCollector, value)
|
|
76
|
+
: this.#checkResult(value);
|
|
59
77
|
if (!result.ok) {
|
|
60
78
|
throw new TypeSeaAssertionError(result.error);
|
|
61
79
|
}
|
|
62
80
|
}
|
|
63
81
|
}
|
|
64
82
|
/**
|
|
65
|
-
* @brief
|
|
83
|
+
* @brief Emit a V8-visible validator function for a guard schema.
|
|
84
|
+
* @details The generated function keeps literals and dynamic schema fallbacks in
|
|
85
|
+
* side tables so the source body remains monomorphic and easy to inline.
|
|
66
86
|
*/
|
|
67
87
|
export function compile(guard, options) {
|
|
68
88
|
const schema = readCompileSchema(guard);
|
|
69
89
|
const name = readCompileName(options);
|
|
70
|
-
const
|
|
90
|
+
const mode = readCompileMode(options);
|
|
91
|
+
const bundle = emitCompiledSourceBundle(schema, name, mode);
|
|
71
92
|
// compile() intentionally emits source so V8 can optimize the validator body.
|
|
72
93
|
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
73
|
-
const factory = new Function("l", "r", "k", "u", "d", "m", "sk", bundle.source);
|
|
94
|
+
const factory = new Function("l", "r", "k", "u", "d", "m", "mf", "sk", bundle.source);
|
|
74
95
|
const dynamicCheck = makeDynamicCheck(bundle.dynamicSchemas);
|
|
75
|
-
const
|
|
76
|
-
|
|
96
|
+
const dynamicFirstIssueCheck = makeDynamicFirstIssueCheck(bundle.dynamicSchemas);
|
|
97
|
+
const runtime = factory(bundle.literals, bundle.regexps, bundle.keysets, bundle.strings, dynamicCheck, makeDynamicIssueCheck(bundle.dynamicSchemas), dynamicFirstIssueCheck, strictKeys);
|
|
98
|
+
trustedPredicates.add(runtime.is);
|
|
99
|
+
trustedCollectors.add(runtime.check);
|
|
100
|
+
trustedCheckResults.add(runtime.result);
|
|
101
|
+
trustedCheckResults.add(runtime.first);
|
|
102
|
+
return new CompiledBaseGuard(schema, runtime.is, runtime.check, bundle.source, true, runtime.result, runtime.first);
|
|
77
103
|
}
|
|
78
104
|
/**
|
|
79
|
-
* @brief
|
|
105
|
+
* @brief Execute define trusted hot methods.
|
|
106
|
+
* @details Code generation helpers keep emitted JavaScript shape stable across runtime and AOT paths.
|
|
107
|
+
*/
|
|
108
|
+
function defineTrustedHotMethods(guard, test, checkResult, checkFirstResult) {
|
|
109
|
+
const self = guard;
|
|
110
|
+
/*
|
|
111
|
+
* Compiled guards receive own methods after construction. The closure over
|
|
112
|
+
* `self` keeps detached calls from reaching optimized validators with a
|
|
113
|
+
* forged receiver while preserving a tiny call shape for V8.
|
|
114
|
+
*/
|
|
115
|
+
defineReadonlyProperty(guard, "is",
|
|
116
|
+
/**
|
|
117
|
+
* @brief Execute compiled trusted is.
|
|
118
|
+
* @details Code generation helpers keep emitted JavaScript shape stable across runtime and AOT paths.
|
|
119
|
+
*/
|
|
120
|
+
function compiledTrustedIs(value) {
|
|
121
|
+
if (this !== self) {
|
|
122
|
+
throw new TypeError("compiled guard method receiver is invalid");
|
|
123
|
+
}
|
|
124
|
+
return test(value);
|
|
125
|
+
}, false);
|
|
126
|
+
defineReadonlyProperty(guard, "check",
|
|
127
|
+
/**
|
|
128
|
+
* @brief Execute compiled trusted check.
|
|
129
|
+
* @details Code generation helpers keep emitted JavaScript shape stable across runtime and AOT paths.
|
|
130
|
+
*/
|
|
131
|
+
function compiledTrustedCheck(value) {
|
|
132
|
+
if (this !== self) {
|
|
133
|
+
throw new TypeError("compiled guard method receiver is invalid");
|
|
134
|
+
}
|
|
135
|
+
return checkResult(value);
|
|
136
|
+
}, false);
|
|
137
|
+
defineReadonlyProperty(guard, "assert",
|
|
138
|
+
/**
|
|
139
|
+
* @brief Execute compiled trusted assert.
|
|
140
|
+
* @details Code generation helpers keep emitted JavaScript shape stable across runtime and AOT paths.
|
|
141
|
+
*/
|
|
142
|
+
function compiledTrustedAssert(value) {
|
|
143
|
+
if (this !== self) {
|
|
144
|
+
throw new TypeError("compiled guard method receiver is invalid");
|
|
145
|
+
}
|
|
146
|
+
const result = checkResult(value);
|
|
147
|
+
if (!result.ok) {
|
|
148
|
+
throw new TypeSeaAssertionError(result.error);
|
|
149
|
+
}
|
|
150
|
+
}, false);
|
|
151
|
+
defineReadonlyProperty(guard, "checkFirst",
|
|
152
|
+
/**
|
|
153
|
+
* @brief Execute compiled trusted checkFirst.
|
|
154
|
+
* @details Code generation helpers keep emitted JavaScript shape stable across runtime and AOT paths.
|
|
155
|
+
*/
|
|
156
|
+
function compiledTrustedCheckFirst(value) {
|
|
157
|
+
if (this !== self) {
|
|
158
|
+
throw new TypeError("compiled guard method receiver is invalid");
|
|
159
|
+
}
|
|
160
|
+
return checkFirstResult(value);
|
|
161
|
+
}, false);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* @brief Normalize the guard input for runtime compilation.
|
|
165
|
+
* @param guard Candidate guard-like value.
|
|
166
|
+
* @returns Frozen schema passed to source emission.
|
|
167
|
+
* @throws TypeError when the input does not expose a valid TypeSea schema.
|
|
168
|
+
* @details Runtime compilation may be called with structural guard-like values.
|
|
169
|
+
* The schema is descriptor-read so inherited getters cannot influence emitted
|
|
170
|
+
* code or mutate the schema between validation and codegen.
|
|
80
171
|
*/
|
|
81
172
|
function readCompileSchema(guard) {
|
|
82
173
|
if (!isRecord(guard)) {
|
|
83
174
|
throw new TypeError("compile guard must be a TypeSea guard");
|
|
84
175
|
}
|
|
85
|
-
const schema = guard
|
|
176
|
+
const schema = readOwnDataProperty(guard, "schema");
|
|
86
177
|
if (!isSchemaValue(schema)) {
|
|
87
178
|
throw new TypeError("compile guard must contain a valid TypeSea schema");
|
|
88
179
|
}
|
|
89
180
|
return freezeSchema(schema);
|
|
90
181
|
}
|
|
91
182
|
/**
|
|
92
|
-
* @brief
|
|
183
|
+
* @brief Accept only the literal boolean success value from compiled predicates.
|
|
184
|
+
* @details Generated-source helpers keep the side-table ABI and JavaScript source shape
|
|
185
|
+
* stable across runtime and AOT emission.
|
|
186
|
+
* @param value Predicate return value.
|
|
187
|
+
* @returns True only for `true`.
|
|
93
188
|
*/
|
|
94
189
|
function isStrictTrue(value) {
|
|
95
190
|
return value === true;
|
|
96
191
|
}
|
|
97
192
|
/**
|
|
98
|
-
* @brief
|
|
193
|
+
* @brief Read one own data slot from a compile input object.
|
|
194
|
+
* @details Generated-source helpers keep the side-table ABI and JavaScript source shape
|
|
195
|
+
* stable across runtime and AOT emission.
|
|
196
|
+
* @param value Object being normalized.
|
|
197
|
+
* @param key Field name or symbol.
|
|
198
|
+
* @returns Stored field value, or undefined when absent.
|
|
99
199
|
*/
|
|
100
|
-
function
|
|
101
|
-
const
|
|
102
|
-
if (
|
|
103
|
-
|
|
200
|
+
function readOwnDataProperty(value, key) {
|
|
201
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
202
|
+
if (descriptor === undefined ||
|
|
203
|
+
!Object.prototype.hasOwnProperty.call(descriptor, "value")) {
|
|
204
|
+
return undefined;
|
|
104
205
|
}
|
|
105
|
-
return
|
|
206
|
+
return descriptor.value;
|
|
106
207
|
}
|
|
107
208
|
/**
|
|
108
|
-
* @brief
|
|
209
|
+
* @brief Convert a generated issue collector result into a public Result.
|
|
210
|
+
* @param collect Generated collector function.
|
|
211
|
+
* @param trustedCollector Whether the collector came from TypeSea codegen.
|
|
212
|
+
* @param value Candidate runtime value.
|
|
213
|
+
* @returns Success result or frozen diagnostic issue result.
|
|
214
|
+
* @details Trusted collectors already emit internal issue records, so the fast
|
|
215
|
+
* path freezes only the final vector. Untrusted collectors are normalized
|
|
216
|
+
* through finalizeIssueArray before publication.
|
|
109
217
|
*/
|
|
110
|
-
function
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
218
|
+
function runCompiledCheck(collect, trustedCollector, value) {
|
|
219
|
+
const rawIssues = collect(value);
|
|
220
|
+
if (trustedCollector) {
|
|
221
|
+
if (rawIssues === undefined || rawIssues.length === 0) {
|
|
222
|
+
return ok(value);
|
|
223
|
+
}
|
|
224
|
+
return err(Object.freeze(rawIssues));
|
|
116
225
|
}
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
119
|
-
|
|
226
|
+
const issues = finalizeIssueArray(rawIssues);
|
|
227
|
+
if (issues.length === 0) {
|
|
228
|
+
return ok(value);
|
|
120
229
|
}
|
|
121
|
-
return
|
|
230
|
+
return err(issues);
|
|
122
231
|
}
|
|
123
232
|
/**
|
|
124
|
-
* @brief
|
|
233
|
+
* @brief Convert a generated collector result into a one-issue public Result.
|
|
234
|
+
* @details This fallback is used only for manually constructed compiled guards.
|
|
235
|
+
* Trusted codegen normally installs a dedicated first-result function.
|
|
236
|
+
* @param collect Generated collector function.
|
|
237
|
+
* @param trustedCollector Whether the collector came from TypeSea codegen.
|
|
238
|
+
* @param value Candidate runtime value.
|
|
239
|
+
* @returns Success result or a frozen failure carrying at most one issue.
|
|
125
240
|
*/
|
|
126
|
-
function
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (!isRecord(guard)) {
|
|
131
|
-
throw new TypeError("compiled guard receiver must be a TypeSea guard");
|
|
241
|
+
function runCompiledCheckFirst(collect, trustedCollector, value) {
|
|
242
|
+
const result = runCompiledCheck(collect, trustedCollector, value);
|
|
243
|
+
if (result.ok || result.error.length <= 1) {
|
|
244
|
+
return result;
|
|
132
245
|
}
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
|
|
246
|
+
const first = result.error[0];
|
|
247
|
+
if (first === undefined) {
|
|
248
|
+
return ok(value);
|
|
136
249
|
}
|
|
137
|
-
return
|
|
250
|
+
return err(Object.freeze([first]));
|
|
138
251
|
}
|
|
139
252
|
/**
|
|
140
|
-
* @brief define readonly property.
|
|
253
|
+
* @brief Execute define readonly property.
|
|
254
|
+
* @details Code generation helpers keep emitted JavaScript shape stable across runtime and AOT paths.
|
|
141
255
|
*/
|
|
142
256
|
function defineReadonlyProperty(target, key, value, enumerable) {
|
|
143
257
|
Object.defineProperty(target, key, {
|
|
@@ -148,7 +262,8 @@ function defineReadonlyProperty(target, key, value, enumerable) {
|
|
|
148
262
|
});
|
|
149
263
|
}
|
|
150
264
|
/**
|
|
151
|
-
* @brief
|
|
265
|
+
* @brief Read compile name.
|
|
266
|
+
* @details Code generation helpers keep emitted JavaScript shape stable across runtime and AOT paths.
|
|
152
267
|
*/
|
|
153
268
|
function readCompileName(options) {
|
|
154
269
|
if (options === undefined) {
|
|
@@ -167,14 +282,29 @@ function readCompileName(options) {
|
|
|
167
282
|
return name;
|
|
168
283
|
}
|
|
169
284
|
/**
|
|
170
|
-
* @brief
|
|
285
|
+
* @brief Read compile mode.
|
|
286
|
+
* @details Code generation helpers keep emitted JavaScript shape stable across runtime and AOT paths.
|
|
171
287
|
*/
|
|
172
|
-
function
|
|
173
|
-
|
|
288
|
+
function readCompileMode(options) {
|
|
289
|
+
if (options === undefined) {
|
|
290
|
+
return "safe";
|
|
291
|
+
}
|
|
292
|
+
if (!isRecord(options)) {
|
|
293
|
+
throw new TypeError("compile options must be an object");
|
|
294
|
+
}
|
|
295
|
+
const mode = options["mode"];
|
|
296
|
+
if (mode === undefined) {
|
|
297
|
+
return "safe";
|
|
298
|
+
}
|
|
299
|
+
if (mode === "safe" || mode === "unsafe" || mode === "unchecked") {
|
|
300
|
+
return mode;
|
|
301
|
+
}
|
|
302
|
+
throw new TypeError("compile mode must be \"safe\", \"unsafe\", or \"unchecked\"");
|
|
174
303
|
}
|
|
175
304
|
/**
|
|
176
|
-
* @brief
|
|
305
|
+
* @brief Check record.
|
|
306
|
+
* @details Code generation helpers keep emitted JavaScript shape stable across runtime and AOT paths.
|
|
177
307
|
*/
|
|
178
|
-
function
|
|
179
|
-
return
|
|
308
|
+
function isRecord(value) {
|
|
309
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
180
310
|
}
|
package/dist/compile/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file compile/index.ts
|
|
3
3
|
* @brief Public compile module barrel.
|
|
4
|
+
* @details This barrel keeps public import paths stable while implementation files remain
|
|
5
|
+
* split by responsibility.
|
|
4
6
|
*/
|
|
5
7
|
export { CompiledBaseGuard, compile } from "./guard.js";
|
|
6
8
|
export { emitCompiledSourceBundle } from "./source.js";
|
|
7
|
-
export type { CompileOptions, CompiledGuard, CompiledSourceBundle } from "./types.js";
|
|
9
|
+
export type { CompileMode, CompileOptions, CompiledGuard, CompiledSourceBundle } from "./types.js";
|
|
8
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compile/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compile/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACH,iBAAiB,EACjB,OAAO,EACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EACH,wBAAwB,EAC3B,MAAM,aAAa,CAAC;AAErB,YAAY,EACR,WAAW,EACX,cAAc,EACd,aAAa,EACb,oBAAoB,EACvB,MAAM,YAAY,CAAC"}
|
package/dist/compile/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file compile/index.ts
|
|
3
3
|
* @brief Public compile module barrel.
|
|
4
|
+
* @details This barrel keeps public import paths stable while implementation files remain
|
|
5
|
+
* split by responsibility.
|
|
4
6
|
*/
|
|
5
7
|
export { CompiledBaseGuard, compile } from "./guard.js";
|
|
6
8
|
export { emitCompiledSourceBundle } from "./source.js";
|
package/dist/compile/issue.d.ts
CHANGED
|
@@ -1,18 +1,128 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file compile/issue.ts
|
|
3
3
|
* @brief Diagnostic issue source snippets.
|
|
4
|
+
* @details Generated-source helpers keep the side-table ABI and JavaScript source shape
|
|
5
|
+
* stable across runtime and AOT emission.
|
|
4
6
|
*/
|
|
5
7
|
import type { EmitContext } from "./types.js";
|
|
6
8
|
/**
|
|
7
9
|
* @brief emit pattern issue.
|
|
10
|
+
* @details Generated-source helpers keep the side-table ABI and JavaScript source shape
|
|
11
|
+
* stable across runtime and AOT emission.
|
|
12
|
+
* @param value Generated expression for the string value.
|
|
13
|
+
* @param path Generated expression for the current diagnostic path.
|
|
14
|
+
* @param issues Generated expression for the diagnostic buffer.
|
|
15
|
+
* @param regex Pattern used by the schema check.
|
|
16
|
+
* @param name Human-readable pattern name stored in the issue.
|
|
17
|
+
* @param context Shared code-generation context.
|
|
18
|
+
* @returns JavaScript source that appends a pattern issue when the test fails.
|
|
8
19
|
*/
|
|
9
20
|
export declare function emitPatternIssue(value: string, path: string, issues: string, regex: RegExp, name: string, context: EmitContext): string;
|
|
21
|
+
/**
|
|
22
|
+
* @brief emit pattern issue at one appended path segment.
|
|
23
|
+
* @details Generated-source helpers keep the side-table ABI and JavaScript source shape
|
|
24
|
+
* stable across runtime and AOT emission.
|
|
25
|
+
* @param value Generated expression for the string value.
|
|
26
|
+
* @param path Generated expression for the current diagnostic path.
|
|
27
|
+
* @param segmentExpression Generated expression for the appended segment.
|
|
28
|
+
* @param issues Generated expression for the diagnostic buffer.
|
|
29
|
+
* @param regex Pattern used by the schema check.
|
|
30
|
+
* @param name Human-readable pattern name stored in the issue.
|
|
31
|
+
* @param context Shared code-generation context.
|
|
32
|
+
* @returns JavaScript source that appends a one-segment pattern issue.
|
|
33
|
+
*/
|
|
34
|
+
export declare function emitPatternIssueAtSegment(value: string, path: string, segmentExpression: string, issues: string, regex: RegExp, name: string, context: EmitContext): string;
|
|
35
|
+
/**
|
|
36
|
+
* @brief emit pattern issue at two appended path segments.
|
|
37
|
+
* @details Generated-source helpers keep the side-table ABI and JavaScript source shape
|
|
38
|
+
* stable across runtime and AOT emission.
|
|
39
|
+
* @param value Generated expression for the string value.
|
|
40
|
+
* @param path Generated expression for the current diagnostic path.
|
|
41
|
+
* @param firstSegmentExpression Generated expression for the first appended segment.
|
|
42
|
+
* @param secondSegmentExpression Generated expression for the second appended segment.
|
|
43
|
+
* @param issues Generated expression for the diagnostic buffer.
|
|
44
|
+
* @param regex Pattern used by the schema check.
|
|
45
|
+
* @param name Human-readable pattern name stored in the issue.
|
|
46
|
+
* @param context Shared code-generation context.
|
|
47
|
+
* @returns JavaScript source that appends a two-segment pattern issue.
|
|
48
|
+
*/
|
|
49
|
+
export declare function emitPatternIssueAtTwoSegments(value: string, path: string, firstSegmentExpression: string, secondSegmentExpression: string, issues: string, regex: RegExp, name: string, context: EmitContext): string;
|
|
10
50
|
/**
|
|
11
51
|
* @brief emit issue.
|
|
52
|
+
* @details Generated-source helpers keep the side-table ABI and JavaScript source shape
|
|
53
|
+
* stable across runtime and AOT emission.
|
|
54
|
+
* @param issues Generated expression for the diagnostic buffer.
|
|
55
|
+
* @param path Generated expression for the current diagnostic path.
|
|
56
|
+
* @param code Issue code string.
|
|
57
|
+
* @param expected Expected type or condition text.
|
|
58
|
+
* @param actualExpression Generated expression for actual type text.
|
|
59
|
+
* @returns JavaScript source that appends an issue at the current path.
|
|
12
60
|
*/
|
|
13
61
|
export declare function emitIssue(issues: string, path: string, code: string, expected: string, actualExpression: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* @brief emit issue at one appended path segment.
|
|
64
|
+
* @details Generated-source helpers keep the side-table ABI and JavaScript source shape
|
|
65
|
+
* stable across runtime and AOT emission.
|
|
66
|
+
* @param issues Generated expression for the diagnostic buffer.
|
|
67
|
+
* @param path Generated expression for the current diagnostic path.
|
|
68
|
+
* @param segmentExpression Generated expression for the appended segment.
|
|
69
|
+
* @param code Issue code string.
|
|
70
|
+
* @param expected Expected type or condition text.
|
|
71
|
+
* @param actualExpression Generated expression for actual type text.
|
|
72
|
+
* @returns JavaScript source that appends an issue under one extra segment.
|
|
73
|
+
*/
|
|
74
|
+
export declare function emitIssueAtSegment(issues: string, path: string, segmentExpression: string, code: string, expected: string, actualExpression: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* @brief emit issue at two appended path segments.
|
|
77
|
+
* @details Generated-source helpers keep the side-table ABI and JavaScript source shape
|
|
78
|
+
* stable across runtime and AOT emission.
|
|
79
|
+
* @param issues Generated expression for the diagnostic buffer.
|
|
80
|
+
* @param path Generated expression for the current diagnostic path.
|
|
81
|
+
* @param firstSegmentExpression Generated expression for the first appended segment.
|
|
82
|
+
* @param secondSegmentExpression Generated expression for the second appended segment.
|
|
83
|
+
* @param code Issue code string.
|
|
84
|
+
* @param expected Expected type or condition text.
|
|
85
|
+
* @param actualExpression Generated expression for actual type text.
|
|
86
|
+
* @returns JavaScript source that appends an issue under two extra segments.
|
|
87
|
+
*/
|
|
88
|
+
export declare function emitIssueAtTwoSegments(issues: string, path: string, firstSegmentExpression: string, secondSegmentExpression: string, code: string, expected: string, actualExpression: string): string;
|
|
14
89
|
/**
|
|
15
90
|
* @brief emit issue expr.
|
|
91
|
+
* @details Generated-source helpers keep the side-table ABI and JavaScript source shape
|
|
92
|
+
* stable across runtime and AOT emission.
|
|
93
|
+
* @param issues Generated expression for the diagnostic buffer.
|
|
94
|
+
* @param path Generated expression for the current diagnostic path.
|
|
95
|
+
* @param code Issue code string.
|
|
96
|
+
* @param expectedExpression Generated expression for expected text.
|
|
97
|
+
* @param actualExpression Generated expression for actual type text.
|
|
98
|
+
* @returns JavaScript source that appends an issue using expression operands.
|
|
16
99
|
*/
|
|
17
100
|
export declare function emitIssueExpr(issues: string, path: string, code: string, expectedExpression: string, actualExpression: string): string;
|
|
101
|
+
/**
|
|
102
|
+
* @brief emit issue expr at one appended path segment.
|
|
103
|
+
* @details Generated-source helpers keep the side-table ABI and JavaScript source shape
|
|
104
|
+
* stable across runtime and AOT emission.
|
|
105
|
+
* @param issues Generated expression for the diagnostic buffer.
|
|
106
|
+
* @param path Generated expression for the current diagnostic path.
|
|
107
|
+
* @param segmentExpression Generated expression for the appended segment.
|
|
108
|
+
* @param code Issue code string.
|
|
109
|
+
* @param expectedExpression Generated expression for expected text.
|
|
110
|
+
* @param actualExpression Generated expression for actual type text.
|
|
111
|
+
* @returns JavaScript source using the most compact one-segment issue helper.
|
|
112
|
+
*/
|
|
113
|
+
export declare function emitIssueExprAtSegment(issues: string, path: string, segmentExpression: string, code: string, expectedExpression: string, actualExpression: string): string;
|
|
114
|
+
/**
|
|
115
|
+
* @brief emit issue expr at two appended path segments.
|
|
116
|
+
* @details Generated-source helpers keep the side-table ABI and JavaScript source shape
|
|
117
|
+
* stable across runtime and AOT emission.
|
|
118
|
+
* @param issues Generated expression for the diagnostic buffer.
|
|
119
|
+
* @param path Generated expression for the current diagnostic path.
|
|
120
|
+
* @param firstSegmentExpression Generated expression for the first appended segment.
|
|
121
|
+
* @param secondSegmentExpression Generated expression for the second appended segment.
|
|
122
|
+
* @param code Issue code string.
|
|
123
|
+
* @param expectedExpression Generated expression for expected text.
|
|
124
|
+
* @param actualExpression Generated expression for actual type text.
|
|
125
|
+
* @returns JavaScript source using the two-segment issue helper.
|
|
126
|
+
*/
|
|
127
|
+
export declare function emitIssueExprAtTwoSegments(issues: string, path: string, firstSegmentExpression: string, secondSegmentExpression: string, code: string, expectedExpression: string, actualExpression: string): string;
|
|
18
128
|
//# sourceMappingURL=issue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issue.d.ts","sourceRoot":"","sources":["../../src/compile/issue.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"issue.d.ts","sourceRoot":"","sources":["../../src/compile/issue.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC5B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,WAAW,GACrB,MAAM,CAkBR;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CACrC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,iBAAiB,EAAE,MAAM,EACzB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,WAAW,GACrB,MAAM,CAeR;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,6BAA6B,CACzC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,sBAAsB,EAAE,MAAM,EAC9B,uBAAuB,EAAE,MAAM,EAC/B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,WAAW,GACrB,MAAM,CAgBR;AAaD;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CACrB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,GACzB,MAAM,CAQR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAC9B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,iBAAiB,EAAE,MAAM,EACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,GACzB,MAAM,CASR;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,sBAAsB,EAAE,MAAM,EAC9B,uBAAuB,EAAE,MAAM,EAC/B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,GACzB,MAAM,CAUR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CACzB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,MAAM,GACzB,MAAM,CAER;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,iBAAiB,EAAE,MAAM,EACzB,IAAI,EAAE,MAAM,EACZ,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,MAAM,GACzB,MAAM,CAWR;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CACtC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,sBAAsB,EAAE,MAAM,EAC9B,uBAAuB,EAAE,MAAM,EAC/B,IAAI,EAAE,MAAM,EACZ,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,MAAM,GACzB,MAAM,CAER"}
|