@parsanol/wasm 0.8.11 → 0.8.12

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.8.11",
8
+ "version": "0.8.12",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
package/parsanol.d.ts CHANGED
@@ -93,11 +93,11 @@ export interface InitOutput {
93
93
  readonly parsanol_result_success: (a: number) => number;
94
94
  readonly parsanol_string_free: (a: number) => void;
95
95
  readonly parsanol_version: () => number;
96
+ readonly init: () => void;
96
97
  readonly wasmparser_new: (a: number, b: number) => [number, number, number];
97
98
  readonly wasmparser_parse: (a: number, b: number, c: number) => [number, number, number];
98
99
  readonly wasmparser_parse_flat: (a: number, b: number, c: number) => [number, number, number, number];
99
100
  readonly wasmparser_parse_json: (a: number, b: number, c: number) => [number, number, number, number];
100
- readonly init: () => void;
101
101
  readonly __wbindgen_malloc: (a: number, b: number) => number;
102
102
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
103
103
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
package/parsanol.js CHANGED
@@ -36,7 +36,7 @@ export class WasmParser {
36
36
  if (ret[2]) {
37
37
  throw takeFromExternrefTable0(ret[1]);
38
38
  }
39
- this.__wbg_ptr = ret[0] >>> 0;
39
+ this.__wbg_ptr = ret[0];
40
40
  WasmParserFinalization.register(this, this.__wbg_ptr, this);
41
41
  return this;
42
42
  }
@@ -131,11 +131,10 @@ if (Symbol.dispose) WasmParser.prototype[Symbol.dispose] = WasmParser.prototype.
131
131
  export function init() {
132
132
  wasm.init();
133
133
  }
134
-
135
134
  function __wbg_get_imports() {
136
135
  const import0 = {
137
136
  __proto__: null,
138
- __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
137
+ __wbg___wbindgen_string_get_92ab86bb19cbc12f: function(arg0, arg1) {
139
138
  const obj = arg1;
140
139
  const ret = typeof(obj) === 'string' ? obj : undefined;
141
140
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -143,10 +142,10 @@ function __wbg_get_imports() {
143
142
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
144
143
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
145
144
  },
146
- __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
145
+ __wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
147
146
  throw new Error(getStringFromWasm0(arg0, arg1));
148
147
  },
149
- __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
148
+ __wbg_error_757e9472f8410341: function(arg0, arg1) {
150
149
  let deferred0_0;
151
150
  let deferred0_1;
152
151
  try {
@@ -157,26 +156,26 @@ function __wbg_get_imports() {
157
156
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
158
157
  }
159
158
  },
160
- __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
159
+ __wbg_getRandomValues_a608c4436c19407a: function() { return handleError(function (arg0, arg1) {
161
160
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
162
161
  }, arguments); },
163
162
  __wbg_new_227d7c05414eb861: function() {
164
163
  const ret = new Error();
165
164
  return ret;
166
165
  },
167
- __wbg_new_a70fbab9066b301f: function() {
168
- const ret = new Array();
166
+ __wbg_new_bebc3f4757acf305: function() {
167
+ const ret = new Object();
169
168
  return ret;
170
169
  },
171
- __wbg_new_ab79df5bd7c26067: function() {
172
- const ret = new Object();
170
+ __wbg_new_ffa92086ea89f79c: function() {
171
+ const ret = new Array();
173
172
  return ret;
174
173
  },
175
- __wbg_push_e87b0e732085a946: function(arg0, arg1) {
174
+ __wbg_push_bfdf956ba476f65b: function(arg0, arg1) {
176
175
  const ret = arg0.push(arg1);
177
176
  return ret;
178
177
  },
179
- __wbg_set_7eaa4f96924fd6b3: function() { return handleError(function (arg0, arg1, arg2) {
178
+ __wbg_set_a377297433dfea63: function() { return handleError(function (arg0, arg1, arg2) {
180
179
  const ret = Reflect.set(arg0, arg1, arg2);
181
180
  return ret;
182
181
  }, arguments); },
@@ -187,16 +186,16 @@ function __wbg_get_imports() {
187
186
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
188
187
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
189
188
  },
190
- __wbg_stringify_5ae93966a84901ac: function() { return handleError(function (arg0) {
189
+ __wbg_stringify_54b3d9b61602aee6: function() { return handleError(function (arg0) {
191
190
  const ret = JSON.stringify(arg0);
192
191
  return ret;
193
192
  }, arguments); },
194
- __wbindgen_cast_0000000000000001: function(arg0) {
193
+ __wbindgen_generic_0000000000000001: function(arg0) {
195
194
  // Cast intrinsic for `F64 -> Externref`.
196
195
  const ret = arg0;
197
196
  return ret;
198
197
  },
199
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
198
+ __wbindgen_generic_0000000000000002: function(arg0, arg1) {
200
199
  // Cast intrinsic for `Ref(String) -> Externref`.
201
200
  const ret = getStringFromWasm0(arg0, arg1);
202
201
  return ret;
@@ -219,7 +218,7 @@ function __wbg_get_imports() {
219
218
 
220
219
  const WasmParserFinalization = (typeof FinalizationRegistry === 'undefined')
221
220
  ? { register: () => {}, unregister: () => {} }
222
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmparser_free(ptr >>> 0, 1));
221
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmparser_free(ptr, 1));
223
222
 
224
223
  function addToExternrefTable0(obj) {
225
224
  const idx = wasm.__externref_table_alloc();
@@ -254,8 +253,7 @@ function getDataViewMemory0() {
254
253
  }
255
254
 
256
255
  function getStringFromWasm0(ptr, len) {
257
- ptr = ptr >>> 0;
258
- return decodeText(ptr, len);
256
+ return decodeText(ptr >>> 0, len);
259
257
  }
260
258
 
261
259
  let cachedUint8ArrayMemory0 = null;
@@ -351,8 +349,9 @@ if (!('encodeInto' in cachedTextEncoder)) {
351
349
 
352
350
  let WASM_VECTOR_LEN = 0;
353
351
 
354
- let wasmModule, wasm;
352
+ let wasmModule, wasmInstance, wasm;
355
353
  function __wbg_finalize_init(instance, module) {
354
+ wasmInstance = instance;
356
355
  wasm = instance.exports;
357
356
  wasmModule = module;
358
357
  cachedBigUint64ArrayMemory0 = null;
@@ -364,11 +363,15 @@ function __wbg_finalize_init(instance, module) {
364
363
 
365
364
  async function __wbg_load(module, imports) {
366
365
  if (typeof Response === 'function' && module instanceof Response) {
366
+ if (!module.ok) {
367
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
368
+ }
369
+
367
370
  if (typeof WebAssembly.instantiateStreaming === 'function') {
368
371
  try {
369
372
  return await WebAssembly.instantiateStreaming(module, imports);
370
373
  } catch (e) {
371
- const validResponse = module.ok && expectedResponseType(module.type);
374
+ const validResponse = expectedResponseType(module.type);
372
375
 
373
376
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
374
377
  console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
package/parsanol_bg.wasm CHANGED
Binary file
@@ -22,11 +22,11 @@ export const parsanol_result_free: (a: number) => void;
22
22
  export const parsanol_result_success: (a: number) => number;
23
23
  export const parsanol_string_free: (a: number) => void;
24
24
  export const parsanol_version: () => number;
25
+ export const init: () => void;
25
26
  export const wasmparser_new: (a: number, b: number) => [number, number, number];
26
27
  export const wasmparser_parse: (a: number, b: number, c: number) => [number, number, number];
27
28
  export const wasmparser_parse_flat: (a: number, b: number, c: number) => [number, number, number, number];
28
29
  export const wasmparser_parse_json: (a: number, b: number, c: number) => [number, number, number, number];
29
- export const init: () => void;
30
30
  export const __wbindgen_malloc: (a: number, b: number) => number;
31
31
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
32
32
  export const __wbindgen_free: (a: number, b: number, c: number) => void;