@cynodia/axiom-compiler 0.8.1-alpha.1 → 0.8.2-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,5 +33,22 @@ export interface CompileOptions {
33
33
  * lookups indexed, routes pre-compiled and ordered most-specific-first.
34
34
  */
35
35
  export declare function compileToIR(graph: ApplicationGraph, options?: CompileOptions): ApplicationIR;
36
+ /**
37
+ * Validates a graph against the same capabilities `compileToIR` compiles for by default —
38
+ * the real browser renderer and the real (empty) browser trigger runtime — without
39
+ * compiling it.
40
+ *
41
+ * `validateGraph(graph)` alone is deliberately target-neutral (spec 8.2 §2-4, §41 of spec5):
42
+ * a graph is never rejected for a renderer or trigger runtime nobody named, the same way
43
+ * `RendererCapabilities` was already optional before triggers existed. That means a bare
44
+ * `validateGraph(graph).valid === true` does not by itself say the graph is executable by a
45
+ * browser — a UI node kind no renderer draws, or a client-authority trigger kind the browser
46
+ * trigger runtime does not execute (`CLIENT_TRIGGER_UNSUPPORTED`), both validate silently
47
+ * under the no-options call. A consumer that wants a validate-only answer reflecting actual
48
+ * browser executability — without compiling the whole IR just to catch a thrown
49
+ * `GraphValidationError` — calls this instead; `compileToIR(graph)`'s own validation step is
50
+ * exactly this call, so the two never disagree.
51
+ */
52
+ export declare function validateForBrowser(graph: ApplicationGraph, options?: Pick<CompileOptions, 'renderer' | 'triggerRuntime'>): ValidationResult;
36
53
  export declare function serializeIR(ir: ApplicationIR): string;
37
54
  //# sourceMappingURL=normalize.d.ts.map
package/dist/normalize.js CHANGED
@@ -260,6 +260,28 @@ export function compileToIR(graph, options = {}) {
260
260
  triggers,
261
261
  };
262
262
  }
263
+ /**
264
+ * Validates a graph against the same capabilities `compileToIR` compiles for by default —
265
+ * the real browser renderer and the real (empty) browser trigger runtime — without
266
+ * compiling it.
267
+ *
268
+ * `validateGraph(graph)` alone is deliberately target-neutral (spec 8.2 §2-4, §41 of spec5):
269
+ * a graph is never rejected for a renderer or trigger runtime nobody named, the same way
270
+ * `RendererCapabilities` was already optional before triggers existed. That means a bare
271
+ * `validateGraph(graph).valid === true` does not by itself say the graph is executable by a
272
+ * browser — a UI node kind no renderer draws, or a client-authority trigger kind the browser
273
+ * trigger runtime does not execute (`CLIENT_TRIGGER_UNSUPPORTED`), both validate silently
274
+ * under the no-options call. A consumer that wants a validate-only answer reflecting actual
275
+ * browser executability — without compiling the whole IR just to catch a thrown
276
+ * `GraphValidationError` — calls this instead; `compileToIR(graph)`'s own validation step is
277
+ * exactly this call, so the two never disagree.
278
+ */
279
+ export function validateForBrowser(graph, options = {}) {
280
+ return validateGraph(graph, {
281
+ renderer: options.renderer ?? BROWSER_RENDERER_CAPABILITIES,
282
+ triggerRuntime: options.triggerRuntime ?? BROWSER_TRIGGER_CAPABILITIES,
283
+ });
284
+ }
263
285
  export function serializeIR(ir) {
264
286
  return JSON.stringify(ir);
265
287
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cynodia/axiom-compiler",
3
- "version": "0.8.1-alpha.1",
3
+ "version": "0.8.2-alpha.1",
4
4
  "description": "Normalizes an Axiom application graph and emits a self-contained page.",
5
5
  "license": "MIT",
6
6
  "author": "AskTech AS",
@@ -31,8 +31,8 @@
31
31
  }
32
32
  },
33
33
  "dependencies": {
34
- "@cynodia/axiom-core": "0.8.1-alpha.1",
35
- "@cynodia/axiom-runtime": "0.8.1-alpha.1"
34
+ "@cynodia/axiom-core": "0.8.2-alpha.1",
35
+ "@cynodia/axiom-runtime": "0.8.2-alpha.1"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsc -b tsconfig.json tsconfig.test.json",