parsanol 0.10.16 → 0.10.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parsanol",
3
- "version": "0.10.16",
3
+ "version": "0.10.18",
4
4
  "description": "PARG artifact runtime for TypeScript — checksum-verified artifact load, wasm parse, bindings, schema-driven materialization",
5
5
  "type": "module",
6
6
  "main": "dist/runtime.js",
@@ -1,2 +1,2 @@
1
- e79ff008757846a8fa5ae593b586cb47903e5502
1
+ ff02baff5864828da72dae182d3b351d97f50007
2
2
  built with: wasm-pack build --target=nodejs --features wasm (from parsanol-rs/parsanol)
@@ -39,7 +39,7 @@ class PargArtifactJs {
39
39
  */
40
40
  entryNames() {
41
41
  const ret = wasm.pargartifactjs_entryNames(this.__wbg_ptr);
42
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
42
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
43
43
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
44
44
  return v1;
45
45
  }
@@ -54,12 +54,15 @@ class PargArtifactJs {
54
54
  if (ret[2]) {
55
55
  throw takeFromExternrefTable0(ret[1]);
56
56
  }
57
- this.__wbg_ptr = ret[0] >>> 0;
57
+ this.__wbg_ptr = ret[0];
58
58
  PargArtifactJsFinalization.register(this, this.__wbg_ptr, this);
59
59
  return this;
60
60
  }
61
61
  /**
62
- * Parse and bind in one step.
62
+ * Parse and bind in one step: the bound attribute hash as JSON.
63
+ *
64
+ * Returns `{}` when the entry declares no `bindings` block — the
65
+ * parse succeeded, there was simply nothing to bind.
63
66
  * @param {string} entry
64
67
  * @param {string} input
65
68
  * @returns {string}
@@ -76,37 +79,37 @@ class PargArtifactJs {
76
79
  return takeFromExternrefTable0(ret[0]);
77
80
  }
78
81
  /**
79
- * Parse an entry with the native engine; returns the parsanol-shape
80
- * tree as JSON text.
82
+ * Best-effort recovery (TODO.sota/1): success returns
83
+ * `{"ok": true, "shape": ...}`; failure returns
84
+ * `{"ok": false, "captures": ..., "error": ..., "consumed_upto"}`.
81
85
  * @param {string} entry
82
86
  * @param {string} input
83
87
  * @returns {string}
84
88
  */
85
- parseShape(entry, input) {
89
+ parseShapeRecovering(entry, input) {
86
90
  const ptr0 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
87
91
  const len0 = WASM_VECTOR_LEN;
88
92
  const ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
89
93
  const len1 = WASM_VECTOR_LEN;
90
- const ret = wasm.pargartifactjs_parseShape(this.__wbg_ptr, ptr0, len0, ptr1, len1);
94
+ const ret = wasm.pargartifactjs_parseShapeRecovering(this.__wbg_ptr, ptr0, len0, ptr1, len1);
91
95
  if (ret[2]) {
92
96
  throw takeFromExternrefTable0(ret[1]);
93
97
  }
94
98
  return takeFromExternrefTable0(ret[0]);
95
99
  }
96
100
  /**
97
- * Best-effort recovery (TODO.sota/1): success returns
98
- * `{"ok": true, "shape": ...}`; failure returns
99
- * `{"ok": false, "captures": ..., "error": ..., "consumed_upto"}`.
101
+ * Parse an entry with the native engine; returns the parsanol-shape
102
+ * tree as JSON text.
100
103
  * @param {string} entry
101
104
  * @param {string} input
102
105
  * @returns {string}
103
106
  */
104
- parseShapeRecovering(entry, input) {
107
+ parseShape(entry, input) {
105
108
  const ptr0 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
106
109
  const len0 = WASM_VECTOR_LEN;
107
110
  const ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
108
111
  const len1 = WASM_VECTOR_LEN;
109
- const ret = wasm.pargartifactjs_parseShapeRecovering(this.__wbg_ptr, ptr0, len0, ptr1, len1);
112
+ const ret = wasm.pargartifactjs_parseShape(this.__wbg_ptr, ptr0, len0, ptr1, len1);
110
113
  if (ret[2]) {
111
114
  throw takeFromExternrefTable0(ret[1]);
112
115
  }
@@ -125,22 +128,22 @@ class PargArtifactJs {
125
128
  return takeFromExternrefTable0(ret[0]);
126
129
  }
127
130
  /**
128
- * The binding-requirements schema as JSON text.
131
+ * The binding-requirements schema as TypeScript source.
129
132
  * @returns {string}
130
133
  */
131
- schema() {
132
- const ret = wasm.pargartifactjs_schema(this.__wbg_ptr);
134
+ schemaTypescript() {
135
+ const ret = wasm.pargartifactjs_schemaTypescript(this.__wbg_ptr);
133
136
  if (ret[2]) {
134
137
  throw takeFromExternrefTable0(ret[1]);
135
138
  }
136
139
  return takeFromExternrefTable0(ret[0]);
137
140
  }
138
141
  /**
139
- * The binding-requirements schema as TypeScript source.
142
+ * The binding-requirements schema as JSON text.
140
143
  * @returns {string}
141
144
  */
142
- schemaTypescript() {
143
- const ret = wasm.pargartifactjs_schemaTypescript(this.__wbg_ptr);
145
+ schema() {
146
+ const ret = wasm.pargartifactjs_schema(this.__wbg_ptr);
144
147
  if (ret[2]) {
145
148
  throw takeFromExternrefTable0(ret[1]);
146
149
  }
@@ -157,7 +160,6 @@ exports.PargArtifactJs = PargArtifactJs;
157
160
  */
158
161
  class WasmParser {
159
162
  static __wrap(ptr) {
160
- ptr = ptr >>> 0;
161
163
  const obj = Object.create(WasmParser.prototype);
162
164
  obj.__wbg_ptr = ptr;
163
165
  WasmParserFinalization.register(obj, obj.__wbg_ptr, obj);
@@ -217,7 +219,7 @@ class WasmParser {
217
219
  if (ret[2]) {
218
220
  throw takeFromExternrefTable0(ret[1]);
219
221
  }
220
- this.__wbg_ptr = ret[0] >>> 0;
222
+ this.__wbg_ptr = ret[0];
221
223
  WasmParserFinalization.register(this, this.__wbg_ptr, this);
222
224
  return this;
223
225
  }
@@ -308,17 +310,23 @@ if (Symbol.dispose) WasmParser.prototype[Symbol.dispose] = WasmParser.prototype.
308
310
  exports.WasmParser = WasmParser;
309
311
 
310
312
  /**
311
- * Initialize function for WASM
313
+ * Install the panic hook (better panic messages in the console).
314
+ *
315
+ * The glue's real bootstrap is the DEFAULT export —
316
+ * `__wbg_init(module_or_path?)` / `initSync` — which calls this on
317
+ * its way up; calling it directly is only needed outside the
318
+ * bootstrap. It is deliberately NOT named `init`: that name in the
319
+ * generated d.ts typed the bootstrap as `() => void` and hid the
320
+ * real signatures (rs#308).
312
321
  */
313
- function init() {
314
- wasm.init();
322
+ function setPanicHook() {
323
+ wasm.setPanicHook();
315
324
  }
316
- exports.init = init;
317
-
325
+ exports.setPanicHook = setPanicHook;
318
326
  function __wbg_get_imports() {
319
327
  const import0 = {
320
328
  __proto__: null,
321
- __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
329
+ __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
322
330
  const obj = arg1;
323
331
  const ret = typeof(obj) === 'string' ? obj : undefined;
324
332
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -326,10 +334,10 @@ function __wbg_get_imports() {
326
334
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
327
335
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
328
336
  },
329
- __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
337
+ __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
330
338
  throw new Error(getStringFromWasm0(arg0, arg1));
331
339
  },
332
- __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
340
+ __wbg_error_757e9472f8410341: function(arg0, arg1) {
333
341
  let deferred0_0;
334
342
  let deferred0_1;
335
343
  try {
@@ -340,26 +348,26 @@ function __wbg_get_imports() {
340
348
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
341
349
  }
342
350
  },
343
- __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
351
+ __wbg_getRandomValues_a608c4436c19407a: function() { return handleError(function (arg0, arg1) {
344
352
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
345
353
  }, arguments); },
346
354
  __wbg_new_227d7c05414eb861: function() {
347
355
  const ret = new Error();
348
356
  return ret;
349
357
  },
350
- __wbg_new_a70fbab9066b301f: function() {
351
- const ret = new Array();
358
+ __wbg_new_617a8cdb8bb1130e: function() {
359
+ const ret = new Object();
352
360
  return ret;
353
361
  },
354
- __wbg_new_ab79df5bd7c26067: function() {
355
- const ret = new Object();
362
+ __wbg_new_ee2291f50781bf1d: function() {
363
+ const ret = new Array();
356
364
  return ret;
357
365
  },
358
- __wbg_push_e87b0e732085a946: function(arg0, arg1) {
366
+ __wbg_push_2baf45db356cf468: function(arg0, arg1) {
359
367
  const ret = arg0.push(arg1);
360
368
  return ret;
361
369
  },
362
- __wbg_set_7eaa4f96924fd6b3: function() { return handleError(function (arg0, arg1, arg2) {
370
+ __wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
363
371
  const ret = Reflect.set(arg0, arg1, arg2);
364
372
  return ret;
365
373
  }, arguments); },
@@ -370,16 +378,16 @@ function __wbg_get_imports() {
370
378
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
371
379
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
372
380
  },
373
- __wbg_stringify_5ae93966a84901ac: function() { return handleError(function (arg0) {
381
+ __wbg_stringify_52ff602c1cc4fbb6: function() { return handleError(function (arg0) {
374
382
  const ret = JSON.stringify(arg0);
375
383
  return ret;
376
384
  }, arguments); },
377
- __wbindgen_cast_0000000000000001: function(arg0) {
385
+ __wbindgen_generic_0000000000000001: function(arg0) {
378
386
  // Cast intrinsic for `F64 -> Externref`.
379
387
  const ret = arg0;
380
388
  return ret;
381
389
  },
382
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
390
+ __wbindgen_generic_0000000000000002: function(arg0, arg1) {
383
391
  // Cast intrinsic for `Ref(String) -> Externref`.
384
392
  const ret = getStringFromWasm0(arg0, arg1);
385
393
  return ret;
@@ -402,10 +410,10 @@ function __wbg_get_imports() {
402
410
 
403
411
  const PargArtifactJsFinalization = (typeof FinalizationRegistry === 'undefined')
404
412
  ? { register: () => {}, unregister: () => {} }
405
- : new FinalizationRegistry(ptr => wasm.__wbg_pargartifactjs_free(ptr >>> 0, 1));
413
+ : new FinalizationRegistry(ptr => wasm.__wbg_pargartifactjs_free(ptr, 1));
406
414
  const WasmParserFinalization = (typeof FinalizationRegistry === 'undefined')
407
415
  ? { register: () => {}, unregister: () => {} }
408
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmparser_free(ptr >>> 0, 1));
416
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmparser_free(ptr, 1));
409
417
 
410
418
  function addToExternrefTable0(obj) {
411
419
  const idx = wasm.__externref_table_alloc();
@@ -451,8 +459,7 @@ function getDataViewMemory0() {
451
459
  }
452
460
 
453
461
  function getStringFromWasm0(ptr, len) {
454
- ptr = ptr >>> 0;
455
- return decodeText(ptr, len);
462
+ return decodeText(ptr >>> 0, len);
456
463
  }
457
464
 
458
465
  let cachedUint8ArrayMemory0 = null;
@@ -543,5 +550,6 @@ let WASM_VECTOR_LEN = 0;
543
550
  const wasmPath = `${__dirname}/parsanol_bg.wasm`;
544
551
  const wasmBytes = require('fs').readFileSync(wasmPath);
545
552
  const wasmModule = new WebAssembly.Module(wasmBytes);
546
- let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
553
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
554
+ let wasm = wasmInstance.exports;
547
555
  wasm.__wbindgen_start();
@@ -22,33 +22,36 @@ export class PargArtifactJs {
22
22
  */
23
23
  constructor(artifact_json: string);
24
24
  /**
25
- * Parse and bind in one step.
25
+ * Parse and bind in one step: the bound attribute hash as JSON.
26
+ *
27
+ * Returns `{}` when the entry declares no `bindings` block — the
28
+ * parse succeeded, there was simply nothing to bind.
26
29
  */
27
30
  parseAndBind(entry: string, input: string): string;
28
- /**
29
- * Parse an entry with the native engine; returns the parsanol-shape
30
- * tree as JSON text.
31
- */
32
- parseShape(entry: string, input: string): string;
33
31
  /**
34
32
  * Best-effort recovery (TODO.sota/1): success returns
35
33
  * `{"ok": true, "shape": ...}`; failure returns
36
34
  * `{"ok": false, "captures": ..., "error": ..., "consumed_upto"}`.
37
35
  */
38
36
  parseShapeRecovering(entry: string, input: string): string;
37
+ /**
38
+ * Parse an entry with the native engine; returns the parsanol-shape
39
+ * tree as JSON text.
40
+ */
41
+ parseShape(entry: string, input: string): string;
39
42
  /**
40
43
  * Run the artifact's embedded tests; returns the failure list as
41
44
  * JSON (empty array means green).
42
45
  */
43
46
  runTests(): string;
44
- /**
45
- * The binding-requirements schema as JSON text.
46
- */
47
- schema(): string;
48
47
  /**
49
48
  * The binding-requirements schema as TypeScript source.
50
49
  */
51
50
  schemaTypescript(): string;
51
+ /**
52
+ * The binding-requirements schema as JSON text.
53
+ */
54
+ schema(): string;
52
55
  }
53
56
 
54
57
  /**
@@ -125,6 +128,13 @@ export class WasmParser {
125
128
  }
126
129
 
127
130
  /**
128
- * Initialize function for WASM
131
+ * Install the panic hook (better panic messages in the console).
132
+ *
133
+ * The glue's real bootstrap is the DEFAULT export —
134
+ * `__wbg_init(module_or_path?)` / `initSync` — which calls this on
135
+ * its way up; calling it directly is only needed outside the
136
+ * bootstrap. It is deliberately NOT named `init`: that name in the
137
+ * generated d.ts typed the bootstrap as `() => void` and hid the
138
+ * real signatures (rs#308).
129
139
  */
130
- export function init(): void;
140
+ export function setPanicHook(): void;
@@ -35,12 +35,12 @@ export const parsanol_result_error: (a: number) => number;
35
35
  export const parsanol_result_free: (a: number) => void;
36
36
  export const parsanol_result_success: (a: number) => number;
37
37
  export const parsanol_version: () => number;
38
+ export const setPanicHook: () => void;
38
39
  export const wasmparser_fromArtifact: (a: number, b: number, c: number, d: number) => [number, number, number];
39
40
  export const wasmparser_new: (a: number, b: number) => [number, number, number];
40
41
  export const wasmparser_parse: (a: number, b: number, c: number) => [number, number, number];
41
42
  export const wasmparser_parse_flat: (a: number, b: number, c: number) => [number, number, number, number];
42
43
  export const wasmparser_parse_json: (a: number, b: number, c: number) => [number, number, number, number];
43
- export const init: () => void;
44
44
  export const parsanol_string_free: (a: number) => void;
45
45
  export const __wbindgen_malloc: (a: number, b: number) => number;
46
46
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;