@noir-lang/noir_wasm 0.24.0-46f2204.nightly → 0.24.0-601fd9a.nightly

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.
Binary file
package/dist/node/main.js CHANGED
@@ -18,12 +18,6 @@ heap.push(undefined, null, true, false);
18
18
 
19
19
  function getObject(idx) { return heap[idx]; }
20
20
 
21
- function _assertBoolean(n) {
22
- if (typeof(n) !== 'boolean') {
23
- throw new Error('expected a boolean argument');
24
- }
25
- }
26
-
27
21
  let heap_next = heap.length;
28
22
 
29
23
  function dropObject(idx) {
@@ -61,8 +55,6 @@ function addHeapObject(obj) {
61
55
  const idx = heap_next;
62
56
  heap_next = heap[idx];
63
57
 
64
- if (typeof(heap_next) !== 'number') throw new Error('corrupt heap');
65
-
66
58
  heap[idx] = obj;
67
59
  return idx;
68
60
  }
@@ -86,8 +78,6 @@ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
86
78
 
87
79
  function passStringToWasm0(arg, malloc, realloc) {
88
80
 
89
- if (typeof(arg) !== 'string') throw new Error('expected a string argument');
90
-
91
81
  if (realloc === undefined) {
92
82
  const buf = cachedTextEncoder.encode(arg);
93
83
  const ptr = malloc(buf.length) >>> 0;
@@ -116,7 +106,7 @@ function passStringToWasm0(arg, malloc, realloc) {
116
106
  ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0;
117
107
  const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
118
108
  const ret = encodeString(arg, view);
119
- if (ret.read !== arg.length) throw new Error('failed to pass whole string');
109
+
120
110
  offset += ret.written;
121
111
  }
122
112
 
@@ -208,10 +198,6 @@ function _assertClass(instance, klass) {
208
198
  }
209
199
  return instance.ptr;
210
200
  }
211
-
212
- function _assertNum(n) {
213
- if (typeof(n) !== 'number') throw new Error('expected a number argument');
214
- }
215
201
  /**
216
202
  * This is a method that exposes the same API as `compile`
217
203
  * But uses the Context based APi internally
@@ -226,13 +212,7 @@ module.exports.compile_ = function(entry_point, contracts, dependency_graph, fil
226
212
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
227
213
  const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
228
214
  const len0 = WASM_VECTOR_LEN;
229
- if (!isLikeNone(contracts)) {
230
- _assertBoolean(contracts);
231
- }
232
215
  _assertClass(file_source_map, PathToFileSourceMap);
233
- if (file_source_map.__wbg_ptr === 0) {
234
- throw new Error('Attempt to use a moved value');
235
- }
236
216
  var ptr1 = file_source_map.__destroy_into_raw();
237
217
  wasm.compile_(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
238
218
  var r0 = getInt32Memory0()[retptr / 4 + 0];
@@ -247,21 +227,23 @@ module.exports.compile_ = function(entry_point, contracts, dependency_graph, fil
247
227
  }
248
228
  };
249
229
 
250
- function logError(f, args) {
251
- try {
252
- return f.apply(this, args);
253
- } catch (e) {
254
- let error = (function () {
255
- try {
256
- return e instanceof Error ? `${e.message}\n\nStack:\n${e.stack}` : e.toString();
257
- } catch(_) {
258
- return "<failed to stringify thrown value>";
259
- }
260
- }());
261
- console.error("wasm-bindgen: imported JS function that was not marked as `catch` threw an error:", error);
262
- throw e;
263
- }
264
- }
230
+ /**
231
+ * @param {string} level
232
+ */
233
+ module.exports.init_log_level = function(level) {
234
+ const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
235
+ const len0 = WASM_VECTOR_LEN;
236
+ wasm.init_log_level(ptr0, len0);
237
+ };
238
+
239
+ /**
240
+ * @returns {any}
241
+ */
242
+ module.exports.build_info = function() {
243
+ const ret = wasm.build_info();
244
+ return takeObject(ret);
245
+ };
246
+
265
247
  /**
266
248
  * @param {string} entry_point
267
249
  * @param {boolean | undefined} contracts
@@ -274,13 +256,7 @@ module.exports.compile = function(entry_point, contracts, dependency_graph, file
274
256
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
275
257
  const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
276
258
  const len0 = WASM_VECTOR_LEN;
277
- if (!isLikeNone(contracts)) {
278
- _assertBoolean(contracts);
279
- }
280
259
  _assertClass(file_source_map, PathToFileSourceMap);
281
- if (file_source_map.__wbg_ptr === 0) {
282
- throw new Error('Attempt to use a moved value');
283
- }
284
260
  var ptr1 = file_source_map.__destroy_into_raw();
285
261
  wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
286
262
  var r0 = getInt32Memory0()[retptr / 4 + 0];
@@ -295,23 +271,6 @@ module.exports.compile = function(entry_point, contracts, dependency_graph, file
295
271
  }
296
272
  };
297
273
 
298
- /**
299
- * @param {string} filter
300
- */
301
- module.exports.init_log_level = function(filter) {
302
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
303
- const len0 = WASM_VECTOR_LEN;
304
- wasm.init_log_level(ptr0, len0);
305
- };
306
-
307
- /**
308
- * @returns {any}
309
- */
310
- module.exports.build_info = function() {
311
- const ret = wasm.build_info();
312
- return takeObject(ret);
313
- };
314
-
315
274
  function handleError(f, args) {
316
275
  try {
317
276
  return f.apply(this, args);
@@ -350,9 +309,6 @@ class CompilerContext {
350
309
  */
351
310
  constructor(source_map) {
352
311
  _assertClass(source_map, PathToFileSourceMap);
353
- if (source_map.__wbg_ptr === 0) {
354
- throw new Error('Attempt to use a moved value');
355
- }
356
312
  var ptr0 = source_map.__destroy_into_raw();
357
313
  const ret = wasm.compilercontext_new(ptr0);
358
314
  return CompilerContext.__wrap(ret);
@@ -362,8 +318,6 @@ class CompilerContext {
362
318
  * @returns {CrateId}
363
319
  */
364
320
  process_root_crate(path_to_crate) {
365
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
366
- _assertNum(this.__wbg_ptr);
367
321
  const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
368
322
  const len0 = WASM_VECTOR_LEN;
369
323
  const ret = wasm.compilercontext_process_root_crate(this.__wbg_ptr, ptr0, len0);
@@ -374,8 +328,6 @@ class CompilerContext {
374
328
  * @returns {CrateId}
375
329
  */
376
330
  process_dependency_crate(path_to_crate) {
377
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
378
- _assertNum(this.__wbg_ptr);
379
331
  const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
380
332
  const len0 = WASM_VECTOR_LEN;
381
333
  const ret = wasm.compilercontext_process_dependency_crate(this.__wbg_ptr, ptr0, len0);
@@ -388,19 +340,11 @@ class CompilerContext {
388
340
  */
389
341
  add_dependency_edge(crate_name, from, to) {
390
342
  try {
391
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
392
343
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
393
- _assertNum(this.__wbg_ptr);
394
344
  const ptr0 = passStringToWasm0(crate_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
395
345
  const len0 = WASM_VECTOR_LEN;
396
346
  _assertClass(from, CrateId);
397
- if (from.__wbg_ptr === 0) {
398
- throw new Error('Attempt to use a moved value');
399
- }
400
347
  _assertClass(to, CrateId);
401
- if (to.__wbg_ptr === 0) {
402
- throw new Error('Attempt to use a moved value');
403
- }
404
348
  wasm.compilercontext_add_dependency_edge(retptr, this.__wbg_ptr, ptr0, len0, from.__wbg_ptr, to.__wbg_ptr);
405
349
  var r0 = getInt32Memory0()[retptr / 4 + 0];
406
350
  var r1 = getInt32Memory0()[retptr / 4 + 1];
@@ -417,11 +361,8 @@ class CompilerContext {
417
361
  */
418
362
  compile_program(program_width) {
419
363
  try {
420
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
421
364
  const ptr = this.__destroy_into_raw();
422
365
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
423
- _assertNum(ptr);
424
- _assertNum(program_width);
425
366
  wasm.compilercontext_compile_program(retptr, ptr, program_width);
426
367
  var r0 = getInt32Memory0()[retptr / 4 + 0];
427
368
  var r1 = getInt32Memory0()[retptr / 4 + 1];
@@ -440,11 +381,8 @@ class CompilerContext {
440
381
  */
441
382
  compile_contract(program_width) {
442
383
  try {
443
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
444
384
  const ptr = this.__destroy_into_raw();
445
385
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
446
- _assertNum(ptr);
447
- _assertNum(program_width);
448
386
  wasm.compilercontext_compile_contract(retptr, ptr, program_width);
449
387
  var r0 = getInt32Memory0()[retptr / 4 + 0];
450
388
  var r1 = getInt32Memory0()[retptr / 4 + 1];
@@ -463,10 +401,6 @@ module.exports.CompilerContext = CompilerContext;
463
401
  */
464
402
  class CrateId {
465
403
 
466
- constructor() {
467
- throw new Error('cannot invoke `new` directly');
468
- }
469
-
470
404
  static __wrap(ptr) {
471
405
  ptr = ptr >>> 0;
472
406
  const obj = Object.create(CrateId.prototype);
@@ -523,8 +457,6 @@ class PathToFileSourceMap {
523
457
  * @returns {boolean}
524
458
  */
525
459
  add_source_code(path, source_code) {
526
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
527
- _assertNum(this.__wbg_ptr);
528
460
  const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
529
461
  const len0 = WASM_VECTOR_LEN;
530
462
  const ptr1 = passStringToWasm0(source_code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
@@ -535,40 +467,39 @@ class PathToFileSourceMap {
535
467
  }
536
468
  module.exports.PathToFileSourceMap = PathToFileSourceMap;
537
469
 
470
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
471
+ takeObject(arg0);
472
+ };
473
+
538
474
  module.exports.__wbindgen_is_undefined = function(arg0) {
539
475
  const ret = getObject(arg0) === undefined;
540
- _assertBoolean(ret);
541
476
  return ret;
542
477
  };
543
478
 
544
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
545
- takeObject(arg0);
479
+ module.exports.__wbg_constructor_e8767839abf8a966 = function(arg0) {
480
+ const ret = new Error(takeObject(arg0));
481
+ return addHeapObject(ret);
546
482
  };
547
483
 
548
- module.exports.__wbg_constructor_05d6d198f3477d6f = function() { return logError(function () {
484
+ module.exports.__wbg_constructor_05d6d198f3477d6f = function() {
549
485
  const ret = new Object();
550
486
  return addHeapObject(ret);
551
- }, arguments) };
552
-
553
- module.exports.__wbg_constructor_e8767839abf8a966 = function() { return logError(function (arg0) {
554
- const ret = new Error(takeObject(arg0));
555
- return addHeapObject(ret);
556
- }, arguments) };
487
+ };
557
488
 
558
- module.exports.__wbg_new_abda76e883ba8a5f = function() { return logError(function () {
489
+ module.exports.__wbg_new_abda76e883ba8a5f = function() {
559
490
  const ret = new Error();
560
491
  return addHeapObject(ret);
561
- }, arguments) };
492
+ };
562
493
 
563
- module.exports.__wbg_stack_658279fe44541cf6 = function() { return logError(function (arg0, arg1) {
494
+ module.exports.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
564
495
  const ret = getObject(arg1).stack;
565
496
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
566
497
  const len1 = WASM_VECTOR_LEN;
567
498
  getInt32Memory0()[arg0 / 4 + 1] = len1;
568
499
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
569
- }, arguments) };
500
+ };
570
501
 
571
- module.exports.__wbg_error_f851667af71bcfc6 = function() { return logError(function (arg0, arg1) {
502
+ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
572
503
  let deferred0_0;
573
504
  let deferred0_1;
574
505
  try {
@@ -578,52 +509,44 @@ module.exports.__wbg_error_f851667af71bcfc6 = function() { return logError(funct
578
509
  } finally {
579
510
  wasm.__wbindgen_export_2(deferred0_0, deferred0_1);
580
511
  }
581
- }, arguments) };
512
+ };
582
513
 
583
514
  module.exports.__wbindgen_string_new = function(arg0, arg1) {
584
515
  const ret = getStringFromWasm0(arg0, arg1);
585
516
  return addHeapObject(ret);
586
517
  };
587
518
 
588
- module.exports.__wbg_debug_e3f6a1578e6d45ca = function() { return logError(function (arg0) {
519
+ module.exports.__wbg_debug_e3f6a1578e6d45ca = function(arg0) {
589
520
  console.debug(getObject(arg0));
590
- }, arguments) };
521
+ };
591
522
 
592
- module.exports.__wbg_debug_efabe4eb183aa5d4 = function() { return logError(function (arg0, arg1, arg2, arg3) {
523
+ module.exports.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
593
524
  console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
594
- }, arguments) };
525
+ };
595
526
 
596
- module.exports.__wbg_error_a7e23606158b68b9 = function() { return logError(function (arg0) {
527
+ module.exports.__wbg_error_a7e23606158b68b9 = function(arg0) {
597
528
  console.error(getObject(arg0));
598
- }, arguments) };
529
+ };
599
530
 
600
- module.exports.__wbg_error_50f42b952a595a23 = function() { return logError(function (arg0, arg1, arg2, arg3) {
531
+ module.exports.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) {
601
532
  console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
602
- }, arguments) };
533
+ };
603
534
 
604
- module.exports.__wbg_info_05db236d79f1b785 = function() { return logError(function (arg0) {
535
+ module.exports.__wbg_info_05db236d79f1b785 = function(arg0) {
605
536
  console.info(getObject(arg0));
606
- }, arguments) };
537
+ };
607
538
 
608
- module.exports.__wbg_info_24d8f53d98f12b95 = function() { return logError(function (arg0, arg1, arg2, arg3) {
539
+ module.exports.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) {
609
540
  console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
610
- }, arguments) };
611
-
612
- module.exports.__wbg_log_dc06ec929fc95a20 = function() { return logError(function (arg0) {
613
- console.log(getObject(arg0));
614
- }, arguments) };
615
-
616
- module.exports.__wbg_log_2f6947e39440ae3b = function() { return logError(function (arg0, arg1, arg2, arg3, arg4) {
617
- console.log(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3), getObject(arg4));
618
- }, arguments) };
541
+ };
619
542
 
620
- module.exports.__wbg_warn_9bdd743e9f5fe1e0 = function() { return logError(function (arg0) {
543
+ module.exports.__wbg_warn_9bdd743e9f5fe1e0 = function(arg0) {
621
544
  console.warn(getObject(arg0));
622
- }, arguments) };
545
+ };
623
546
 
624
- module.exports.__wbg_warn_8342bfbc6028193a = function() { return logError(function (arg0, arg1, arg2, arg3) {
547
+ module.exports.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
625
548
  console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
626
- }, arguments) };
549
+ };
627
550
 
628
551
  module.exports.__wbindgen_string_get = function(arg0, arg1) {
629
552
  const obj = getObject(arg1);
@@ -646,7 +569,6 @@ module.exports.__wbg_stringify_d06ad2addc54d51e = function() { return handleErro
646
569
 
647
570
  module.exports.__wbg_set_07da13cc24b69217 = function() { return handleError(function (arg0, arg1, arg2) {
648
571
  const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
649
- _assertBoolean(ret);
650
572
  return ret;
651
573
  }, arguments) };
652
574
 
@@ -1396,7 +1318,7 @@ class Package {
1396
1318
  * Gets this package's dependencies.
1397
1319
  */
1398
1320
  getDependencies() {
1399
- return this.#config.dependencies;
1321
+ return this.#config.dependencies ?? {};
1400
1322
  }
1401
1323
  /**
1402
1324
  * Gets this package's sources.