m-bus-parser-wasm-pack 0.0.4 → 0.0.6

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.
@@ -1,8 +1,3 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * @param {string} data
5
- * @param {string} format
6
- * @returns {string}
7
- */
8
3
  export function m_bus_parse(data: string, format: string): string;
@@ -1,5 +1,5 @@
1
-
2
1
  import * as wasm from "./m_bus_parser_wasm_pack_bg.wasm";
2
+ export * from "./m_bus_parser_wasm_pack_bg.js";
3
3
  import { __wbg_set_wasm } from "./m_bus_parser_wasm_pack_bg.js";
4
4
  __wbg_set_wasm(wasm);
5
- export * from "./m_bus_parser_wasm_pack_bg.js";
5
+ wasm.__wbindgen_start();
@@ -71,15 +71,6 @@ function passStringToWasm0(arg, malloc, realloc) {
71
71
  return ptr;
72
72
  }
73
73
 
74
- let cachedDataViewMemory0 = null;
75
-
76
- function getDataViewMemory0() {
77
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
78
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
79
- }
80
- return cachedDataViewMemory0;
81
- }
82
-
83
74
  const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
84
75
 
85
76
  let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
@@ -91,28 +82,35 @@ function getStringFromWasm0(ptr, len) {
91
82
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
92
83
  }
93
84
  /**
94
- * @param {string} data
95
- * @param {string} format
96
- * @returns {string}
97
- */
85
+ * @param {string} data
86
+ * @param {string} format
87
+ * @returns {string}
88
+ */
98
89
  export function m_bus_parse(data, format) {
99
90
  let deferred3_0;
100
91
  let deferred3_1;
101
92
  try {
102
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
103
93
  const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
104
94
  const len0 = WASM_VECTOR_LEN;
105
95
  const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
106
96
  const len1 = WASM_VECTOR_LEN;
107
- wasm.m_bus_parse(retptr, ptr0, len0, ptr1, len1);
108
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
109
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
110
- deferred3_0 = r0;
111
- deferred3_1 = r1;
112
- return getStringFromWasm0(r0, r1);
97
+ const ret = wasm.m_bus_parse(ptr0, len0, ptr1, len1);
98
+ deferred3_0 = ret[0];
99
+ deferred3_1 = ret[1];
100
+ return getStringFromWasm0(ret[0], ret[1]);
113
101
  } finally {
114
- wasm.__wbindgen_add_to_stack_pointer(16);
115
102
  wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
116
103
  }
117
104
  }
118
105
 
106
+ export function __wbindgen_init_externref_table() {
107
+ const table = wasm.__wbindgen_export_0;
108
+ const offset = table.grow(4);
109
+ table.set(0, undefined);
110
+ table.set(offset + 0, undefined);
111
+ table.set(offset + 1, null);
112
+ table.set(offset + 2, true);
113
+ table.set(offset + 3, false);
114
+ ;
115
+ };
116
+
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Michael Aebli"
6
6
  ],
7
7
  "description": "A wasm-pack to use the library for parsing M-Bus frames",
8
- "version": "0.0.4",
8
+ "version": "0.0.6",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",