parsanol 0.10.17 → 0.10.20

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/dist/runtime.d.ts CHANGED
@@ -1,4 +1,13 @@
1
1
  type PargArtifactJs = any;
2
+ /**
3
+ * Compile PARG source to a checksummed artifact in-process — the
4
+ * playground's compiler-in-the-browser seam (site#19). Single-file
5
+ * grammars: `use` imports have no filesystem here and reject with the
6
+ * merge error. The compiler stamp is the wasm build's crate version.
7
+ *
8
+ * @throws when the source does not parse or the grammar is invalid.
9
+ */
10
+ export declare function compileSource(source: string): Record<string, unknown>;
2
11
  /** A field requirement from the binding-requirements schema. */
3
12
  export interface FieldRequirement {
4
13
  type: string;
package/dist/runtime.js CHANGED
@@ -8,6 +8,17 @@ import { createRequire } from "node:module";
8
8
  import { existsSync, readFileSync } from "node:fs";
9
9
  import { fileURLToPath } from "node:url";
10
10
  import { dirname, join } from "node:path";
11
+ /**
12
+ * Compile PARG source to a checksummed artifact in-process — the
13
+ * playground's compiler-in-the-browser seam (site#19). Single-file
14
+ * grammars: `use` imports have no filesystem here and reject with the
15
+ * merge error. The compiler stamp is the wasm build's crate version.
16
+ *
17
+ * @throws when the source does not parse or the grammar is invalid.
18
+ */
19
+ export function compileSource(source) {
20
+ return JSON.parse(wasm().compileSource(source));
21
+ }
11
22
  /** Walk up from this module to the package root (which holds package.json). */
12
23
  const packageRootCache = (() => {
13
24
  let dir = dirname(fileURLToPath(import.meta.url));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "parsanol",
3
- "version": "0.10.17",
4
- "description": "PARG artifact runtime for TypeScript — checksum-verified artifact load, wasm parse, bindings, schema-driven materialization",
3
+ "version": "0.10.20",
4
+ "description": "PARG artifact runtime for TypeScript \u2014 checksum-verified artifact load, wasm parse, bindings, schema-driven materialization",
5
5
  "type": "module",
6
6
  "main": "dist/runtime.js",
7
7
  "types": "dist/runtime.d.ts",
@@ -1,2 +1,2 @@
1
- bf1fb62b747b533e929410a9f08e514679e80010
1
+ 7681162f03d497a7673052e30d60ef9b025931b9
2
2
  built with: wasm-pack build --target=nodejs --features wasm (from parsanol-rs/parsanol)
@@ -1,9 +1,9 @@
1
1
  /* @ts-self-types="./parsanol.d.ts" */
2
2
 
3
3
  /**
4
- * A verified PARG artifact exposed to JavaScript: checksum-verified load,
5
- * native parse, bindings application, embedded-suite runs and the
6
- * binding-requirements schema (PN 2/4).
4
+ * A verified PARG artifact exposed to JavaScript: checksum-verified
5
+ * load, native parse, bindings application, embedded-suite runs and
6
+ * the binding-requirements schema (PN 2/4).
7
7
  */
8
8
  class PargArtifactJs {
9
9
  __destroy_into_raw() {
@@ -309,6 +309,35 @@ class WasmParser {
309
309
  if (Symbol.dispose) WasmParser.prototype[Symbol.dispose] = WasmParser.prototype.free;
310
310
  exports.WasmParser = WasmParser;
311
311
 
312
+ /**
313
+ * Compile PARG source to a checksummed artifact — the playground's
314
+ * compiler-in-the-browser (site#19). Single-file grammars: `use`
315
+ * imports have no filesystem here and reject with the merge error.
316
+ * @param {string} source
317
+ * @returns {string}
318
+ */
319
+ function compileSource(source) {
320
+ let deferred3_0;
321
+ let deferred3_1;
322
+ try {
323
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
324
+ const len0 = WASM_VECTOR_LEN;
325
+ const ret = wasm.compileSource(ptr0, len0);
326
+ var ptr2 = ret[0];
327
+ var len2 = ret[1];
328
+ if (ret[3]) {
329
+ ptr2 = 0; len2 = 0;
330
+ throw takeFromExternrefTable0(ret[2]);
331
+ }
332
+ deferred3_0 = ptr2;
333
+ deferred3_1 = len2;
334
+ return getStringFromWasm0(ptr2, len2);
335
+ } finally {
336
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
337
+ }
338
+ }
339
+ exports.compileSource = compileSource;
340
+
312
341
  /**
313
342
  * Install the panic hook (better panic messages in the console).
314
343
  *
@@ -2,9 +2,9 @@
2
2
  /* eslint-disable */
3
3
 
4
4
  /**
5
- * A verified PARG artifact exposed to JavaScript: checksum-verified load,
6
- * native parse, bindings application, embedded-suite runs and the
7
- * binding-requirements schema (PN 2/4).
5
+ * A verified PARG artifact exposed to JavaScript: checksum-verified
6
+ * load, native parse, bindings application, embedded-suite runs and
7
+ * the binding-requirements schema (PN 2/4).
8
8
  */
9
9
  export class PargArtifactJs {
10
10
  free(): void;
@@ -127,6 +127,13 @@ export class WasmParser {
127
127
  parse_json(input: string): string;
128
128
  }
129
129
 
130
+ /**
131
+ * Compile PARG source to a checksummed artifact — the playground's
132
+ * compiler-in-the-browser (site#19). Single-file grammars: `use`
133
+ * imports have no filesystem here and reject with the merge error.
134
+ */
135
+ export function compileSource(source: string): string;
136
+
130
137
  /**
131
138
  * Install the panic hook (better panic messages in the console).
132
139
  *
@@ -3,6 +3,7 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_pargartifactjs_free: (a: number, b: number) => void;
5
5
  export const __wbg_wasmparser_free: (a: number, b: number) => void;
6
+ export const compileSource: (a: number, b: number) => [number, number, number, number];
6
7
  export const pargartifactjs_applyBindings: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
7
8
  export const pargartifactjs_entryNames: (a: number) => [number, number];
8
9
  export const pargartifactjs_new: (a: number, b: number) => [number, number, number];