@noir-lang/noir_wasm 0.23.0 → 0.24.0-3386067.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.
package/README.md CHANGED
@@ -1,9 +1,32 @@
1
1
  # Noir Lang WASM JavaScript Package
2
2
 
3
- This JavaScript package enables users to compile a Noir program, i.e. generating its artifacts.
3
+ This JavaScript package enables users to compile a Noir program, i.e. generating its artifacts, both in Node.JS environments and the browser.
4
4
 
5
5
  The package also handles dependency management like how Nargo (Noir's CLI tool) operates, but the package is used just for compilation, not proving, verifying and simulating functions.
6
6
 
7
+ ## Usage
8
+
9
+ ```typescript
10
+ // Node.js
11
+
12
+ import { compile, createFileManager } from '@noir-lang/noir_wasm';
13
+
14
+ const fm = createFileManager(myProjectPath);
15
+ const myCompiledCode = await compile(fm);
16
+ ```
17
+
18
+ ```typescript
19
+ // Browser
20
+
21
+ import { compile, createFileManager } from '@noir-lang/noir_wasm';
22
+
23
+ const fm = createFileManager('/');
24
+ for (const path of files) {
25
+ await fm.writeFile(path, await getFileAsStream(path));
26
+ }
27
+ const myCompiledCode = await compile(fm);
28
+ ```
29
+
7
30
  ## Building from source
8
31
 
9
32
  Outside of the [noir repo](https://github.com/noir-lang/noir), this package can be built using the command below:
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "The Noir Team <team@noir-lang.org>"
5
5
  ],
6
- "version": "0.23.0",
6
+ "version": "0.24.0",
7
7
  "license": "MIT OR Apache-2.0",
8
8
  "files": [
9
9
  "index_bg.wasm",
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "The Noir Team <team@noir-lang.org>"
5
5
  ],
6
- "version": "0.23.0",
6
+ "version": "0.24.0",
7
7
  "license": "MIT OR Apache-2.0",
8
8
  "files": [
9
9
  "index_bg.wasm",
Binary file
package/dist/node/main.js CHANGED
@@ -32,12 +32,6 @@ function takeObject(idx) {
32
32
  return ret;
33
33
  }
34
34
 
35
- function _assertBoolean(n) {
36
- if (typeof(n) !== 'boolean') {
37
- throw new Error('expected a boolean argument');
38
- }
39
- }
40
-
41
35
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
42
36
 
43
37
  cachedTextDecoder.decode();
@@ -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
 
@@ -202,26 +192,6 @@ function debugString(val) {
202
192
  return className;
203
193
  }
204
194
 
205
- function logError(f, args) {
206
- try {
207
- return f.apply(this, args);
208
- } catch (e) {
209
- let error = (function () {
210
- try {
211
- return e instanceof Error ? `${e.message}\n\nStack:\n${e.stack}` : e.toString();
212
- } catch(_) {
213
- return "<failed to stringify thrown value>";
214
- }
215
- }());
216
- console.error("wasm-bindgen: imported JS function that was not marked as `catch` threw an error:", error);
217
- throw e;
218
- }
219
- }
220
-
221
- function _assertNum(n) {
222
- if (typeof(n) !== 'number') throw new Error('expected a number argument');
223
- }
224
-
225
195
  function _assertClass(instance, klass) {
226
196
  if (!(instance instanceof klass)) {
227
197
  throw new Error(`expected instance of ${klass.name}`);
@@ -229,26 +199,22 @@ function _assertClass(instance, klass) {
229
199
  return instance.ptr;
230
200
  }
231
201
  /**
202
+ * This is a method that exposes the same API as `compile`
203
+ * But uses the Context based APi internally
232
204
  * @param {string} entry_point
233
205
  * @param {boolean | undefined} contracts
234
206
  * @param {DependencyGraph | undefined} dependency_graph
235
207
  * @param {PathToFileSourceMap} file_source_map
236
208
  * @returns {CompileResult}
237
209
  */
238
- module.exports.compile = function(entry_point, contracts, dependency_graph, file_source_map) {
210
+ module.exports.compile_ = function(entry_point, contracts, dependency_graph, file_source_map) {
239
211
  try {
240
212
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
241
213
  const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
242
214
  const len0 = WASM_VECTOR_LEN;
243
- if (!isLikeNone(contracts)) {
244
- _assertBoolean(contracts);
245
- }
246
215
  _assertClass(file_source_map, PathToFileSourceMap);
247
- if (file_source_map.__wbg_ptr === 0) {
248
- throw new Error('Attempt to use a moved value');
249
- }
250
216
  var ptr1 = file_source_map.__destroy_into_raw();
251
- wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
217
+ wasm.compile_(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
252
218
  var r0 = getInt32Memory0()[retptr / 4 + 0];
253
219
  var r1 = getInt32Memory0()[retptr / 4 + 1];
254
220
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -262,28 +228,37 @@ module.exports.compile = function(entry_point, contracts, dependency_graph, file
262
228
  };
263
229
 
264
230
  /**
265
- * This is a method that exposes the same API as `compile`
266
- * But uses the Context based APi internally
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
+
247
+ /**
267
248
  * @param {string} entry_point
268
249
  * @param {boolean | undefined} contracts
269
250
  * @param {DependencyGraph | undefined} dependency_graph
270
251
  * @param {PathToFileSourceMap} file_source_map
271
252
  * @returns {CompileResult}
272
253
  */
273
- module.exports.compile_ = function(entry_point, contracts, dependency_graph, file_source_map) {
254
+ module.exports.compile = function(entry_point, contracts, dependency_graph, file_source_map) {
274
255
  try {
275
256
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
276
257
  const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
277
258
  const len0 = WASM_VECTOR_LEN;
278
- if (!isLikeNone(contracts)) {
279
- _assertBoolean(contracts);
280
- }
281
259
  _assertClass(file_source_map, PathToFileSourceMap);
282
- if (file_source_map.__wbg_ptr === 0) {
283
- throw new Error('Attempt to use a moved value');
284
- }
285
260
  var ptr1 = file_source_map.__destroy_into_raw();
286
- wasm.compile_(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
261
+ wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
287
262
  var r0 = getInt32Memory0()[retptr / 4 + 0];
288
263
  var r1 = getInt32Memory0()[retptr / 4 + 1];
289
264
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -296,23 +271,6 @@ module.exports.compile_ = function(entry_point, contracts, dependency_graph, fil
296
271
  }
297
272
  };
298
273
 
299
- /**
300
- * @param {string} filter
301
- */
302
- module.exports.init_log_level = function(filter) {
303
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
304
- const len0 = WASM_VECTOR_LEN;
305
- wasm.init_log_level(ptr0, len0);
306
- };
307
-
308
- /**
309
- * @returns {any}
310
- */
311
- module.exports.build_info = function() {
312
- const ret = wasm.build_info();
313
- return takeObject(ret);
314
- };
315
-
316
274
  function handleError(f, args) {
317
275
  try {
318
276
  return f.apply(this, args);
@@ -351,9 +309,6 @@ class CompilerContext {
351
309
  */
352
310
  constructor(source_map) {
353
311
  _assertClass(source_map, PathToFileSourceMap);
354
- if (source_map.__wbg_ptr === 0) {
355
- throw new Error('Attempt to use a moved value');
356
- }
357
312
  var ptr0 = source_map.__destroy_into_raw();
358
313
  const ret = wasm.compilercontext_new(ptr0);
359
314
  return CompilerContext.__wrap(ret);
@@ -363,8 +318,6 @@ class CompilerContext {
363
318
  * @returns {CrateId}
364
319
  */
365
320
  process_root_crate(path_to_crate) {
366
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
367
- _assertNum(this.__wbg_ptr);
368
321
  const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
369
322
  const len0 = WASM_VECTOR_LEN;
370
323
  const ret = wasm.compilercontext_process_root_crate(this.__wbg_ptr, ptr0, len0);
@@ -375,8 +328,6 @@ class CompilerContext {
375
328
  * @returns {CrateId}
376
329
  */
377
330
  process_dependency_crate(path_to_crate) {
378
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
379
- _assertNum(this.__wbg_ptr);
380
331
  const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
381
332
  const len0 = WASM_VECTOR_LEN;
382
333
  const ret = wasm.compilercontext_process_dependency_crate(this.__wbg_ptr, ptr0, len0);
@@ -389,19 +340,11 @@ class CompilerContext {
389
340
  */
390
341
  add_dependency_edge(crate_name, from, to) {
391
342
  try {
392
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
393
343
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
394
- _assertNum(this.__wbg_ptr);
395
344
  const ptr0 = passStringToWasm0(crate_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
396
345
  const len0 = WASM_VECTOR_LEN;
397
346
  _assertClass(from, CrateId);
398
- if (from.__wbg_ptr === 0) {
399
- throw new Error('Attempt to use a moved value');
400
- }
401
347
  _assertClass(to, CrateId);
402
- if (to.__wbg_ptr === 0) {
403
- throw new Error('Attempt to use a moved value');
404
- }
405
348
  wasm.compilercontext_add_dependency_edge(retptr, this.__wbg_ptr, ptr0, len0, from.__wbg_ptr, to.__wbg_ptr);
406
349
  var r0 = getInt32Memory0()[retptr / 4 + 0];
407
350
  var r1 = getInt32Memory0()[retptr / 4 + 1];
@@ -418,11 +361,8 @@ class CompilerContext {
418
361
  */
419
362
  compile_program(program_width) {
420
363
  try {
421
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
422
364
  const ptr = this.__destroy_into_raw();
423
365
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
424
- _assertNum(ptr);
425
- _assertNum(program_width);
426
366
  wasm.compilercontext_compile_program(retptr, ptr, program_width);
427
367
  var r0 = getInt32Memory0()[retptr / 4 + 0];
428
368
  var r1 = getInt32Memory0()[retptr / 4 + 1];
@@ -441,11 +381,8 @@ class CompilerContext {
441
381
  */
442
382
  compile_contract(program_width) {
443
383
  try {
444
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
445
384
  const ptr = this.__destroy_into_raw();
446
385
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
447
- _assertNum(ptr);
448
- _assertNum(program_width);
449
386
  wasm.compilercontext_compile_contract(retptr, ptr, program_width);
450
387
  var r0 = getInt32Memory0()[retptr / 4 + 0];
451
388
  var r1 = getInt32Memory0()[retptr / 4 + 1];
@@ -464,10 +401,6 @@ module.exports.CompilerContext = CompilerContext;
464
401
  */
465
402
  class CrateId {
466
403
 
467
- constructor() {
468
- throw new Error('cannot invoke `new` directly');
469
- }
470
-
471
404
  static __wrap(ptr) {
472
405
  ptr = ptr >>> 0;
473
406
  const obj = Object.create(CrateId.prototype);
@@ -524,8 +457,6 @@ class PathToFileSourceMap {
524
457
  * @returns {boolean}
525
458
  */
526
459
  add_source_code(path, source_code) {
527
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
528
- _assertNum(this.__wbg_ptr);
529
460
  const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
530
461
  const len0 = WASM_VECTOR_LEN;
531
462
  const ptr1 = passStringToWasm0(source_code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
@@ -540,36 +471,35 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
540
471
  takeObject(arg0);
541
472
  };
542
473
 
543
- module.exports.__wbg_constructor_28ca684b2f9696ac = function() { return logError(function () {
544
- const ret = new Object();
545
- return addHeapObject(ret);
546
- }, arguments) };
547
-
548
474
  module.exports.__wbindgen_is_undefined = function(arg0) {
549
475
  const ret = getObject(arg0) === undefined;
550
- _assertBoolean(ret);
551
476
  return ret;
552
477
  };
553
478
 
554
- module.exports.__wbg_constructor_287b714b768ecf13 = function() { return logError(function (arg0) {
479
+ module.exports.__wbg_constructor_e8767839abf8a966 = function(arg0) {
555
480
  const ret = new Error(takeObject(arg0));
556
481
  return addHeapObject(ret);
557
- }, arguments) };
482
+ };
558
483
 
559
- module.exports.__wbg_new_abda76e883ba8a5f = function() { return logError(function () {
484
+ module.exports.__wbg_constructor_05d6d198f3477d6f = function() {
485
+ const ret = new Object();
486
+ return addHeapObject(ret);
487
+ };
488
+
489
+ module.exports.__wbg_new_abda76e883ba8a5f = function() {
560
490
  const ret = new Error();
561
491
  return addHeapObject(ret);
562
- }, arguments) };
492
+ };
563
493
 
564
- module.exports.__wbg_stack_658279fe44541cf6 = function() { return logError(function (arg0, arg1) {
494
+ module.exports.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
565
495
  const ret = getObject(arg1).stack;
566
496
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
567
497
  const len1 = WASM_VECTOR_LEN;
568
498
  getInt32Memory0()[arg0 / 4 + 1] = len1;
569
499
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
570
- }, arguments) };
500
+ };
571
501
 
572
- module.exports.__wbg_error_f851667af71bcfc6 = function() { return logError(function (arg0, arg1) {
502
+ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
573
503
  let deferred0_0;
574
504
  let deferred0_1;
575
505
  try {
@@ -579,52 +509,44 @@ module.exports.__wbg_error_f851667af71bcfc6 = function() { return logError(funct
579
509
  } finally {
580
510
  wasm.__wbindgen_export_2(deferred0_0, deferred0_1);
581
511
  }
582
- }, arguments) };
512
+ };
583
513
 
584
514
  module.exports.__wbindgen_string_new = function(arg0, arg1) {
585
515
  const ret = getStringFromWasm0(arg0, arg1);
586
516
  return addHeapObject(ret);
587
517
  };
588
518
 
589
- module.exports.__wbg_debug_e3f6a1578e6d45ca = function() { return logError(function (arg0) {
519
+ module.exports.__wbg_debug_e3f6a1578e6d45ca = function(arg0) {
590
520
  console.debug(getObject(arg0));
591
- }, arguments) };
521
+ };
592
522
 
593
- module.exports.__wbg_debug_efabe4eb183aa5d4 = function() { return logError(function (arg0, arg1, arg2, arg3) {
523
+ module.exports.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
594
524
  console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
595
- }, arguments) };
525
+ };
596
526
 
597
- module.exports.__wbg_error_a7e23606158b68b9 = function() { return logError(function (arg0) {
527
+ module.exports.__wbg_error_a7e23606158b68b9 = function(arg0) {
598
528
  console.error(getObject(arg0));
599
- }, arguments) };
529
+ };
600
530
 
601
- module.exports.__wbg_error_50f42b952a595a23 = function() { return logError(function (arg0, arg1, arg2, arg3) {
531
+ module.exports.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) {
602
532
  console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
603
- }, arguments) };
533
+ };
604
534
 
605
- module.exports.__wbg_info_05db236d79f1b785 = function() { return logError(function (arg0) {
535
+ module.exports.__wbg_info_05db236d79f1b785 = function(arg0) {
606
536
  console.info(getObject(arg0));
607
- }, arguments) };
537
+ };
608
538
 
609
- module.exports.__wbg_info_24d8f53d98f12b95 = function() { return logError(function (arg0, arg1, arg2, arg3) {
539
+ module.exports.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) {
610
540
  console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
611
- }, arguments) };
612
-
613
- module.exports.__wbg_log_dc06ec929fc95a20 = function() { return logError(function (arg0) {
614
- console.log(getObject(arg0));
615
- }, arguments) };
616
-
617
- module.exports.__wbg_log_2f6947e39440ae3b = function() { return logError(function (arg0, arg1, arg2, arg3, arg4) {
618
- console.log(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3), getObject(arg4));
619
- }, arguments) };
541
+ };
620
542
 
621
- module.exports.__wbg_warn_9bdd743e9f5fe1e0 = function() { return logError(function (arg0) {
543
+ module.exports.__wbg_warn_9bdd743e9f5fe1e0 = function(arg0) {
622
544
  console.warn(getObject(arg0));
623
- }, arguments) };
545
+ };
624
546
 
625
- module.exports.__wbg_warn_8342bfbc6028193a = function() { return logError(function (arg0, arg1, arg2, arg3) {
547
+ module.exports.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
626
548
  console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
627
- }, arguments) };
549
+ };
628
550
 
629
551
  module.exports.__wbindgen_string_get = function(arg0, arg1) {
630
552
  const obj = getObject(arg1);
@@ -647,7 +569,6 @@ module.exports.__wbg_stringify_d06ad2addc54d51e = function() { return handleErro
647
569
 
648
570
  module.exports.__wbg_set_07da13cc24b69217 = function() { return handleError(function (arg0, arg1, arg2) {
649
571
  const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
650
- _assertBoolean(ret);
651
572
  return ret;
652
573
  }, arguments) };
653
574
 
@@ -686,7 +607,10 @@ module.exports.__wasm = wasm;
686
607
  Object.defineProperty(exports, "__esModule", ({ value: true }));
687
608
  exports.inflateDebugSymbols = void 0;
688
609
  const pako_1 = __webpack_require__(/*! pako */ "../../node_modules/pako/index.js");
689
- /** Decompresses and decodes the debug symbols */
610
+ /**
611
+ * Decompresses and decodes the debug symbols
612
+ * @param debugSymbols - The base64 encoded debug symbols
613
+ */
690
614
  function inflateDebugSymbols(debugSymbols) {
691
615
  return JSON.parse((0, pako_1.inflate)(Buffer.from(debugSymbols, 'base64'), { to: 'string', raw: true }));
692
616
  }
@@ -1143,8 +1067,9 @@ async function readdirRecursive(dir) {
1143
1067
  }
1144
1068
  exports.readdirRecursive = readdirRecursive;
1145
1069
  /**
1146
- * Creates a new FileManager instance based on nodejs fs
1147
- * @param dataDir - where to store files
1070
+ * Creates a new FileManager instance based on fs in node and memfs in the browser (via webpack alias)
1071
+ *
1072
+ * @param dataDir - root of the file system
1148
1073
  */
1149
1074
  function createNodejsFileManager(dataDir) {
1150
1075
  return new file_manager_1.FileManager({
@@ -1393,7 +1318,7 @@ class Package {
1393
1318
  * Gets this package's dependencies.
1394
1319
  */
1395
1320
  getDependencies() {
1396
- return this.#config.dependencies;
1321
+ return this.#config.dependencies ?? {};
1397
1322
  }
1398
1323
  /**
1399
1324
  * Gets this package's sources.
@@ -12818,6 +12743,36 @@ const nodejs_file_manager_1 = __webpack_require__(/*! ./noir/file-manager/nodejs
12818
12743
  const noir_wasm_compiler_1 = __webpack_require__(/*! ./noir/noir-wasm-compiler */ "./src/noir/noir-wasm-compiler.ts");
12819
12744
  const debug_1 = __webpack_require__(/*! ./noir/debug */ "./src/noir/debug.ts");
12820
12745
  Object.defineProperty(exports, "inflateDebugSymbols", ({ enumerable: true, get: function () { return debug_1.inflateDebugSymbols; } }));
12746
+ /**
12747
+ * Compiles a Noir project
12748
+ *
12749
+ * @param fileManager - The file manager to use
12750
+ * @param projectPath - The path to the project inside the file manager. Defaults to the root of the file manager
12751
+ * @param logFn - A logging function. If not provided, console.log will be used
12752
+ * @param debugLogFn - A debug logging function. If not provided, logFn will be used
12753
+ *
12754
+ * @example
12755
+ * ```typescript
12756
+ * // Node.js
12757
+ *
12758
+ * import { compile, createFileManager } from '@noir-lang/noir_wasm';
12759
+ *
12760
+ * const fm = createFileManager(myProjectPath);
12761
+ * const myCompiledCode = await compile(fm);
12762
+ * ```
12763
+ *
12764
+ * ```typescript
12765
+ * // Browser
12766
+ *
12767
+ * import { compile, createFileManager } from '@noir-lang/noir_wasm';
12768
+ *
12769
+ * const fm = createFileManager('/');
12770
+ * for (const path of files) {
12771
+ * await fm.writeFile(path, await getFileAsStream(path));
12772
+ * }
12773
+ * const myCompiledCode = await compile(fm);
12774
+ * ```
12775
+ */
12821
12776
  async function compile(fileManager, projectPath, logFn, debugLogFn) {
12822
12777
  if (logFn && !debugLogFn) {
12823
12778
  debugLogFn = logFn;