@parsanol/wasm 0.18.21 → 0.19.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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Ribose Inc. <open.source@ribose.com>"
6
6
  ],
7
7
  "description": "Parsanol PEG parser — WebAssembly bindings",
8
- "version": "0.18.21",
8
+ "version": "0.19.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -15,7 +15,8 @@
15
15
  "parsanol_bg.wasm",
16
16
  "parsanol_bg.wasm.d.ts",
17
17
  "parsanol.js",
18
- "parsanol.d.ts"
18
+ "parsanol.d.ts",
19
+ "README.md"
19
20
  ],
20
21
  "homepage": "https://github.com/parsanol/parsanol-rs",
21
22
  "types": "parsanol.d.ts",
package/parsanol.d.ts CHANGED
@@ -1,3 +1,10 @@
1
+ // Node usage: the default init fetches the wasm next to the module,
2
+ // which Node does not serve; use initSync with pre-read bytes:
3
+ // import { initSync } from ./parsanol.js;
4
+ // import { readFileSync } from node:fs;
5
+ // initSync({ module: readFileSync(./parsanol_bg.wasm) });
6
+ // The async bootstrap is the DEFAULT export (__wbg_init): Promise<InitOutput>.
7
+ // parseAndBind returns {} when the entry declares no bindings block.
1
8
  /* tslint:disable */
2
9
  /* eslint-disable */
3
10
 
@@ -22,7 +29,10 @@ export class PargArtifactJs {
22
29
  */
23
30
  constructor(artifact_json: string);
24
31
  /**
25
- * Parse and bind in one step.
32
+ * Parse and bind in one step: the bound attribute hash as JSON.
33
+ *
34
+ * Returns `{}` when the entry declares no `bindings` block — the
35
+ * parse succeeded, there was simply nothing to bind.
26
36
  */
27
37
  parseAndBind(entry: string, input: string): string;
28
38
  /**
@@ -125,9 +135,16 @@ export class WasmParser {
125
135
  }
126
136
 
127
137
  /**
128
- * Initialize function for WASM
138
+ * Install the panic hook (better panic messages in the console).
139
+ *
140
+ * The glue's real bootstrap is the DEFAULT export —
141
+ * `__wbg_init(module_or_path?)` / `initSync` — which calls this on
142
+ * its way up; calling it directly is only needed outside the
143
+ * bootstrap. It is deliberately NOT named `init`: that name in the
144
+ * generated d.ts typed the bootstrap as `() => void` and hid the
145
+ * real signatures (rs#308).
129
146
  */
130
- export function init(): void;
147
+ export function setPanicHook(): void;
131
148
 
132
149
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
133
150
 
@@ -135,7 +152,6 @@ export interface InitOutput {
135
152
  readonly memory: WebAssembly.Memory;
136
153
  readonly __wbg_pargartifactjs_free: (a: number, b: number) => void;
137
154
  readonly __wbg_wasmparser_free: (a: number, b: number) => void;
138
- readonly init: () => void;
139
155
  readonly pargartifactjs_applyBindings: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
140
156
  readonly pargartifactjs_entryNames: (a: number) => [number, number];
141
157
  readonly pargartifactjs_new: (a: number, b: number) => [number, number, number];
@@ -144,6 +160,7 @@ export interface InitOutput {
144
160
  readonly pargartifactjs_parseShapeRecovering: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
145
161
  readonly pargartifactjs_runTests: (a: number) => [number, number, number];
146
162
  readonly pargartifactjs_schema: (a: number) => [number, number, number];
163
+ readonly pargartifactjs_schemaTypescript: (a: number) => [number, number, number];
147
164
  readonly parsanol_c_last_error: () => number;
148
165
  readonly parsanol_c_parse: (a: bigint, b: number, c: number, d: number) => number;
149
166
  readonly parsanol_c_parse_len: (a: bigint, b: number, c: number, d: number, e: number) => number;
@@ -167,7 +184,7 @@ export interface InitOutput {
167
184
  readonly parsanol_result_free: (a: number) => void;
168
185
  readonly parsanol_result_success: (a: number) => number;
169
186
  readonly parsanol_version: () => number;
170
- readonly pargartifactjs_schemaTypescript: (a: number) => [number, number, number];
187
+ readonly setPanicHook: () => void;
171
188
  readonly wasmparser_fromArtifact: (a: number, b: number, c: number, d: number) => [number, number, number];
172
189
  readonly wasmparser_new: (a: number, b: number) => [number, number, number];
173
190
  readonly wasmparser_parse: (a: number, b: number, c: number) => [number, number, number];
package/parsanol.js CHANGED
@@ -59,7 +59,10 @@ export class PargArtifactJs {
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}
@@ -305,10 +308,17 @@ export class WasmParser {
305
308
  if (Symbol.dispose) WasmParser.prototype[Symbol.dispose] = WasmParser.prototype.free;
306
309
 
307
310
  /**
308
- * Initialize function for WASM
311
+ * Install the panic hook (better panic messages in the console).
312
+ *
313
+ * The glue's real bootstrap is the DEFAULT export —
314
+ * `__wbg_init(module_or_path?)` / `initSync` — which calls this on
315
+ * its way up; calling it directly is only needed outside the
316
+ * bootstrap. It is deliberately NOT named `init`: that name in the
317
+ * generated d.ts typed the bootstrap as `() => void` and hid the
318
+ * real signatures (rs#308).
309
319
  */
310
- export function init() {
311
- wasm.init();
320
+ export function setPanicHook() {
321
+ wasm.setPanicHook();
312
322
  }
313
323
  function __wbg_get_imports() {
314
324
  const import0 = {
package/parsanol_bg.wasm CHANGED
Binary file
@@ -3,7 +3,6 @@
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 init: () => void;
7
6
  export const pargartifactjs_applyBindings: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
8
7
  export const pargartifactjs_entryNames: (a: number) => [number, number];
9
8
  export const pargartifactjs_new: (a: number, b: number) => [number, number, number];
@@ -12,6 +11,7 @@ export const pargartifactjs_parseShape: (a: number, b: number, c: number, d: num
12
11
  export const pargartifactjs_parseShapeRecovering: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
13
12
  export const pargartifactjs_runTests: (a: number) => [number, number, number];
14
13
  export const pargartifactjs_schema: (a: number) => [number, number, number];
14
+ export const pargartifactjs_schemaTypescript: (a: number) => [number, number, number];
15
15
  export const parsanol_c_last_error: () => number;
16
16
  export const parsanol_c_parse: (a: bigint, b: number, c: number, d: number) => number;
17
17
  export const parsanol_c_parse_len: (a: bigint, b: number, c: number, d: number, e: number) => number;
@@ -35,7 +35,7 @@ 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 pargartifactjs_schemaTypescript: (a: number) => [number, number, number];
38
+ export const setPanicHook: () => void;
39
39
  export const wasmparser_fromArtifact: (a: number, b: number, c: number, d: number) => [number, number, number];
40
40
  export const wasmparser_new: (a: number, b: number) => [number, number, number];
41
41
  export const wasmparser_parse: (a: number, b: number, c: number) => [number, number, number];