@noir-lang/noir_wasm 0.3.0 → 0.5.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/noir_wasm.js CHANGED
@@ -2,11 +2,15 @@ let imports = {};
2
2
  imports['__wbindgen_placeholder__'] = module.exports;
3
3
  let wasm;
4
4
  const { read_file } = require(String.raw`./snippets/fm-cffb18dcbd478425/file_reader.js`);
5
- const { TextDecoder, TextEncoder } = require(`util`);
5
+ const { TextEncoder, TextDecoder } = require(`util`);
6
6
 
7
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
7
+ const heap = new Array(32).fill(undefined);
8
8
 
9
- cachedTextDecoder.decode();
9
+ heap.push(undefined, null, true, false);
10
+
11
+ function getObject(idx) { return heap[idx]; }
12
+
13
+ let WASM_VECTOR_LEN = 0;
10
14
 
11
15
  let cachedUint8Memory0 = new Uint8Array();
12
16
 
@@ -17,29 +21,6 @@ function getUint8Memory0() {
17
21
  return cachedUint8Memory0;
18
22
  }
19
23
 
20
- function getStringFromWasm0(ptr, len) {
21
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
22
- }
23
-
24
- const heap = new Array(32).fill(undefined);
25
-
26
- heap.push(undefined, null, true, false);
27
-
28
- let heap_next = heap.length;
29
-
30
- function addHeapObject(obj) {
31
- if (heap_next === heap.length) heap.push(heap.length + 1);
32
- const idx = heap_next;
33
- heap_next = heap[idx];
34
-
35
- heap[idx] = obj;
36
- return idx;
37
- }
38
-
39
- function getObject(idx) { return heap[idx]; }
40
-
41
- let WASM_VECTOR_LEN = 0;
42
-
43
24
  let cachedTextEncoder = new TextEncoder('utf-8');
44
25
 
45
26
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -102,6 +83,8 @@ function getInt32Memory0() {
102
83
  return cachedInt32Memory0;
103
84
  }
104
85
 
86
+ let heap_next = heap.length;
87
+
105
88
  function dropObject(idx) {
106
89
  if (idx < 36) return;
107
90
  heap[idx] = heap_next;
@@ -113,6 +96,23 @@ function takeObject(idx) {
113
96
  dropObject(idx);
114
97
  return ret;
115
98
  }
99
+
100
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
101
+
102
+ cachedTextDecoder.decode();
103
+
104
+ function getStringFromWasm0(ptr, len) {
105
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
106
+ }
107
+
108
+ function addHeapObject(obj) {
109
+ if (heap_next === heap.length) heap.push(heap.length + 1);
110
+ const idx = heap_next;
111
+ heap_next = heap[idx];
112
+
113
+ heap[idx] = obj;
114
+ return idx;
115
+ }
116
116
  /**
117
117
  * @param {string} src
118
118
  * @returns {any}
@@ -170,11 +170,6 @@ function handleError(f, args) {
170
170
  }
171
171
  }
172
172
 
173
- module.exports.__wbindgen_json_parse = function(arg0, arg1) {
174
- const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
175
- return addHeapObject(ret);
176
- };
177
-
178
173
  module.exports.__wbindgen_json_serialize = function(arg0, arg1) {
179
174
  const obj = getObject(arg1);
180
175
  const ret = JSON.stringify(obj === undefined ? null : obj);
@@ -188,6 +183,11 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
188
183
  takeObject(arg0);
189
184
  };
190
185
 
186
+ module.exports.__wbindgen_json_parse = function(arg0, arg1) {
187
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
188
+ return addHeapObject(ret);
189
+ };
190
+
191
191
  module.exports.__wbg_readfile_381ecedf0ec0c1aa = function() { return handleError(function (arg0, arg1, arg2) {
192
192
  const ret = read_file(getStringFromWasm0(arg1, arg2));
193
193
  const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
@@ -217,6 +217,138 @@ module.exports.__wbg_error_09919627ac0992f5 = function(arg0, arg1) {
217
217
  }
218
218
  };
219
219
 
220
+ module.exports.__wbg_randomFillSync_91e2b39becca6147 = function() { return handleError(function (arg0, arg1, arg2) {
221
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
222
+ }, arguments) };
223
+
224
+ module.exports.__wbg_getRandomValues_b14734aa289bc356 = function() { return handleError(function (arg0, arg1) {
225
+ getObject(arg0).getRandomValues(getObject(arg1));
226
+ }, arguments) };
227
+
228
+ module.exports.__wbg_process_e56fd54cf6319b6c = function(arg0) {
229
+ const ret = getObject(arg0).process;
230
+ return addHeapObject(ret);
231
+ };
232
+
233
+ module.exports.__wbindgen_is_object = function(arg0) {
234
+ const val = getObject(arg0);
235
+ const ret = typeof(val) === 'object' && val !== null;
236
+ return ret;
237
+ };
238
+
239
+ module.exports.__wbg_versions_77e21455908dad33 = function(arg0) {
240
+ const ret = getObject(arg0).versions;
241
+ return addHeapObject(ret);
242
+ };
243
+
244
+ module.exports.__wbg_node_0dd25d832e4785d5 = function(arg0) {
245
+ const ret = getObject(arg0).node;
246
+ return addHeapObject(ret);
247
+ };
248
+
249
+ module.exports.__wbindgen_is_string = function(arg0) {
250
+ const ret = typeof(getObject(arg0)) === 'string';
251
+ return ret;
252
+ };
253
+
254
+ module.exports.__wbg_crypto_b95d7173266618a9 = function(arg0) {
255
+ const ret = getObject(arg0).crypto;
256
+ return addHeapObject(ret);
257
+ };
258
+
259
+ module.exports.__wbg_msCrypto_5a86d77a66230f81 = function(arg0) {
260
+ const ret = getObject(arg0).msCrypto;
261
+ return addHeapObject(ret);
262
+ };
263
+
264
+ module.exports.__wbg_static_accessor_NODE_MODULE_26b231378c1be7dd = function() {
265
+ const ret = module;
266
+ return addHeapObject(ret);
267
+ };
268
+
269
+ module.exports.__wbg_require_0db1598d9ccecb30 = function() { return handleError(function (arg0, arg1, arg2) {
270
+ const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
271
+ return addHeapObject(ret);
272
+ }, arguments) };
273
+
274
+ module.exports.__wbg_newnoargs_971e9a5abe185139 = function(arg0, arg1) {
275
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
276
+ return addHeapObject(ret);
277
+ };
278
+
279
+ module.exports.__wbg_call_33d7bcddbbfa394a = function() { return handleError(function (arg0, arg1) {
280
+ const ret = getObject(arg0).call(getObject(arg1));
281
+ return addHeapObject(ret);
282
+ }, arguments) };
283
+
284
+ module.exports.__wbindgen_object_clone_ref = function(arg0) {
285
+ const ret = getObject(arg0);
286
+ return addHeapObject(ret);
287
+ };
288
+
289
+ module.exports.__wbg_self_fd00a1ef86d1b2ed = function() { return handleError(function () {
290
+ const ret = self.self;
291
+ return addHeapObject(ret);
292
+ }, arguments) };
293
+
294
+ module.exports.__wbg_window_6f6e346d8bbd61d7 = function() { return handleError(function () {
295
+ const ret = window.window;
296
+ return addHeapObject(ret);
297
+ }, arguments) };
298
+
299
+ module.exports.__wbg_globalThis_3348936ac49df00a = function() { return handleError(function () {
300
+ const ret = globalThis.globalThis;
301
+ return addHeapObject(ret);
302
+ }, arguments) };
303
+
304
+ module.exports.__wbg_global_67175caf56f55ca9 = function() { return handleError(function () {
305
+ const ret = global.global;
306
+ return addHeapObject(ret);
307
+ }, arguments) };
308
+
309
+ module.exports.__wbindgen_is_undefined = function(arg0) {
310
+ const ret = getObject(arg0) === undefined;
311
+ return ret;
312
+ };
313
+
314
+ module.exports.__wbg_buffer_34f5ec9f8a838ba0 = function(arg0) {
315
+ const ret = getObject(arg0).buffer;
316
+ return addHeapObject(ret);
317
+ };
318
+
319
+ module.exports.__wbg_new_cda198d9dbc6d7ea = function(arg0) {
320
+ const ret = new Uint8Array(getObject(arg0));
321
+ return addHeapObject(ret);
322
+ };
323
+
324
+ module.exports.__wbg_set_1a930cfcda1a8067 = function(arg0, arg1, arg2) {
325
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
326
+ };
327
+
328
+ module.exports.__wbg_length_51f19f73d6d9eff3 = function(arg0) {
329
+ const ret = getObject(arg0).length;
330
+ return ret;
331
+ };
332
+
333
+ module.exports.__wbg_newwithlength_66e5530e7079ea1b = function(arg0) {
334
+ const ret = new Uint8Array(arg0 >>> 0);
335
+ return addHeapObject(ret);
336
+ };
337
+
338
+ module.exports.__wbg_subarray_270ff8dd5582c1ac = function(arg0, arg1, arg2) {
339
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
340
+ return addHeapObject(ret);
341
+ };
342
+
343
+ module.exports.__wbindgen_throw = function(arg0, arg1) {
344
+ throw new Error(getStringFromWasm0(arg0, arg1));
345
+ };
346
+
347
+ module.exports.__wbindgen_memory = function() {
348
+ const ret = wasm.memory;
349
+ return addHeapObject(ret);
350
+ };
351
+
220
352
  const path = require('path').join(__dirname, 'noir_wasm_bg.wasm');
221
353
  const bytes = require('fs').readFileSync(path);
222
354
 
package/noir_wasm_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noir-lang/noir_wasm",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "files": [
5
5
  "noir_wasm_bg.wasm",
6
6
  "noir_wasm.js",