@noir-lang/noir_wasm 0.21.0 → 0.22.0-2fcbef5.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/nodejs/noir_wasm.d.ts +53 -12
- package/nodejs/noir_wasm.js +180 -48
- package/nodejs/noir_wasm_bg.wasm +0 -0
- package/nodejs/noir_wasm_bg.wasm.d.ts +9 -2
- package/package.json +9 -4
- package/web/noir_wasm.d.ts +62 -14
- package/web/noir_wasm.js +175 -47
- package/web/noir_wasm_bg.wasm +0 -0
- package/web/noir_wasm_bg.wasm.d.ts +9 -2
package/nodejs/noir_wasm.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* @param {
|
|
10
|
-
* @returns {
|
|
4
|
+
* This is a method that exposes the same API as `compile`
|
|
5
|
+
* But uses the Context based APi internally
|
|
6
|
+
* @param {string} entry_point
|
|
7
|
+
* @param {boolean | undefined} contracts
|
|
8
|
+
* @param {DependencyGraph | undefined} dependency_graph
|
|
9
|
+
* @param {PathToFileSourceMap} file_source_map
|
|
10
|
+
* @returns {CompileResult}
|
|
11
11
|
*/
|
|
12
|
-
export function
|
|
12
|
+
export function compile_(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
|
|
13
13
|
/**
|
|
14
|
-
* @param {string}
|
|
14
|
+
* @param {string} filter
|
|
15
15
|
*/
|
|
16
|
-
export function init_log_level(
|
|
16
|
+
export function init_log_level(filter: string): void;
|
|
17
17
|
/**
|
|
18
18
|
* @returns {any}
|
|
19
19
|
*/
|
|
@@ -52,14 +52,12 @@ export type DependencyGraph = {
|
|
|
52
52
|
export type CompiledContract = {
|
|
53
53
|
noir_version: string;
|
|
54
54
|
name: string;
|
|
55
|
-
backend: string;
|
|
56
55
|
functions: Array<any>;
|
|
57
56
|
events: Array<any>;
|
|
58
57
|
};
|
|
59
58
|
|
|
60
59
|
export type CompiledProgram = {
|
|
61
60
|
noir_version: string;
|
|
62
|
-
backend: string;
|
|
63
61
|
abi: any;
|
|
64
62
|
bytecode: string;
|
|
65
63
|
}
|
|
@@ -82,6 +80,49 @@ export type CompileResult = (
|
|
|
82
80
|
);
|
|
83
81
|
|
|
84
82
|
|
|
83
|
+
/**
|
|
84
|
+
* This is a wrapper class that is wasm-bindgen compatible
|
|
85
|
+
* We do not use js_name and rename it like CrateId because
|
|
86
|
+
* then the impl block is not picked up in javascript.
|
|
87
|
+
*/
|
|
88
|
+
export class CompilerContext {
|
|
89
|
+
free(): void;
|
|
90
|
+
/**
|
|
91
|
+
* @param {PathToFileSourceMap} source_map
|
|
92
|
+
*/
|
|
93
|
+
constructor(source_map: PathToFileSourceMap);
|
|
94
|
+
/**
|
|
95
|
+
* @param {string} path_to_crate
|
|
96
|
+
* @returns {CrateId}
|
|
97
|
+
*/
|
|
98
|
+
process_root_crate(path_to_crate: string): CrateId;
|
|
99
|
+
/**
|
|
100
|
+
* @param {string} path_to_crate
|
|
101
|
+
* @returns {CrateId}
|
|
102
|
+
*/
|
|
103
|
+
process_dependency_crate(path_to_crate: string): CrateId;
|
|
104
|
+
/**
|
|
105
|
+
* @param {string} crate_name
|
|
106
|
+
* @param {CrateId} from
|
|
107
|
+
* @param {CrateId} to
|
|
108
|
+
*/
|
|
109
|
+
add_dependency_edge(crate_name: string, from: CrateId, to: CrateId): void;
|
|
110
|
+
/**
|
|
111
|
+
* @param {number} program_width
|
|
112
|
+
* @returns {CompileResult}
|
|
113
|
+
*/
|
|
114
|
+
compile_program(program_width: number): CompileResult;
|
|
115
|
+
/**
|
|
116
|
+
* @param {number} program_width
|
|
117
|
+
* @returns {CompileResult}
|
|
118
|
+
*/
|
|
119
|
+
compile_contract(program_width: number): CompileResult;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
*/
|
|
123
|
+
export class CrateId {
|
|
124
|
+
free(): void;
|
|
125
|
+
}
|
|
85
126
|
/**
|
|
86
127
|
*/
|
|
87
128
|
export class PathToFileSourceMap {
|
package/nodejs/noir_wasm.js
CHANGED
|
@@ -183,50 +183,46 @@ function debugString(val) {
|
|
|
183
183
|
return className;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
function
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return ptr;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* @param {Uint8Array} bytes
|
|
194
|
-
* @returns {any}
|
|
195
|
-
*/
|
|
196
|
-
module.exports.acir_read_bytes = function(bytes) {
|
|
197
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_0);
|
|
198
|
-
const len0 = WASM_VECTOR_LEN;
|
|
199
|
-
const ret = wasm.acir_read_bytes(ptr0, len0);
|
|
200
|
-
return takeObject(ret);
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
204
|
-
ptr = ptr >>> 0;
|
|
205
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
186
|
+
function _assertClass(instance, klass) {
|
|
187
|
+
if (!(instance instanceof klass)) {
|
|
188
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
189
|
+
}
|
|
190
|
+
return instance.ptr;
|
|
206
191
|
}
|
|
207
192
|
/**
|
|
208
|
-
*
|
|
209
|
-
*
|
|
193
|
+
* This is a method that exposes the same API as `compile`
|
|
194
|
+
* But uses the Context based APi internally
|
|
195
|
+
* @param {string} entry_point
|
|
196
|
+
* @param {boolean | undefined} contracts
|
|
197
|
+
* @param {DependencyGraph | undefined} dependency_graph
|
|
198
|
+
* @param {PathToFileSourceMap} file_source_map
|
|
199
|
+
* @returns {CompileResult}
|
|
210
200
|
*/
|
|
211
|
-
module.exports.
|
|
201
|
+
module.exports.compile_ = function(entry_point, contracts, dependency_graph, file_source_map) {
|
|
212
202
|
try {
|
|
213
203
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
214
|
-
wasm.
|
|
204
|
+
const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
205
|
+
const len0 = WASM_VECTOR_LEN;
|
|
206
|
+
_assertClass(file_source_map, PathToFileSourceMap);
|
|
207
|
+
var ptr1 = file_source_map.__destroy_into_raw();
|
|
208
|
+
wasm.compile_(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
|
|
215
209
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
216
210
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
217
|
-
var
|
|
218
|
-
|
|
219
|
-
|
|
211
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
212
|
+
if (r2) {
|
|
213
|
+
throw takeObject(r1);
|
|
214
|
+
}
|
|
215
|
+
return takeObject(r0);
|
|
220
216
|
} finally {
|
|
221
217
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
222
218
|
}
|
|
223
219
|
};
|
|
224
220
|
|
|
225
221
|
/**
|
|
226
|
-
* @param {string}
|
|
222
|
+
* @param {string} filter
|
|
227
223
|
*/
|
|
228
|
-
module.exports.init_log_level = function(
|
|
229
|
-
const ptr0 = passStringToWasm0(
|
|
224
|
+
module.exports.init_log_level = function(filter) {
|
|
225
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
230
226
|
const len0 = WASM_VECTOR_LEN;
|
|
231
227
|
wasm.init_log_level(ptr0, len0);
|
|
232
228
|
};
|
|
@@ -239,12 +235,6 @@ module.exports.build_info = function() {
|
|
|
239
235
|
return takeObject(ret);
|
|
240
236
|
};
|
|
241
237
|
|
|
242
|
-
function _assertClass(instance, klass) {
|
|
243
|
-
if (!(instance instanceof klass)) {
|
|
244
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
245
|
-
}
|
|
246
|
-
return instance.ptr;
|
|
247
|
-
}
|
|
248
238
|
/**
|
|
249
239
|
* @param {string} entry_point
|
|
250
240
|
* @param {boolean | undefined} contracts
|
|
@@ -280,6 +270,140 @@ function handleError(f, args) {
|
|
|
280
270
|
}
|
|
281
271
|
}
|
|
282
272
|
/**
|
|
273
|
+
* This is a wrapper class that is wasm-bindgen compatible
|
|
274
|
+
* We do not use js_name and rename it like CrateId because
|
|
275
|
+
* then the impl block is not picked up in javascript.
|
|
276
|
+
*/
|
|
277
|
+
class CompilerContext {
|
|
278
|
+
|
|
279
|
+
static __wrap(ptr) {
|
|
280
|
+
ptr = ptr >>> 0;
|
|
281
|
+
const obj = Object.create(CompilerContext.prototype);
|
|
282
|
+
obj.__wbg_ptr = ptr;
|
|
283
|
+
|
|
284
|
+
return obj;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
__destroy_into_raw() {
|
|
288
|
+
const ptr = this.__wbg_ptr;
|
|
289
|
+
this.__wbg_ptr = 0;
|
|
290
|
+
|
|
291
|
+
return ptr;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
free() {
|
|
295
|
+
const ptr = this.__destroy_into_raw();
|
|
296
|
+
wasm.__wbg_compilercontext_free(ptr);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* @param {PathToFileSourceMap} source_map
|
|
300
|
+
*/
|
|
301
|
+
constructor(source_map) {
|
|
302
|
+
_assertClass(source_map, PathToFileSourceMap);
|
|
303
|
+
var ptr0 = source_map.__destroy_into_raw();
|
|
304
|
+
const ret = wasm.compilercontext_new(ptr0);
|
|
305
|
+
return CompilerContext.__wrap(ret);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* @param {string} path_to_crate
|
|
309
|
+
* @returns {CrateId}
|
|
310
|
+
*/
|
|
311
|
+
process_root_crate(path_to_crate) {
|
|
312
|
+
const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
313
|
+
const len0 = WASM_VECTOR_LEN;
|
|
314
|
+
const ret = wasm.compilercontext_process_root_crate(this.__wbg_ptr, ptr0, len0);
|
|
315
|
+
return CrateId.__wrap(ret);
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* @param {string} path_to_crate
|
|
319
|
+
* @returns {CrateId}
|
|
320
|
+
*/
|
|
321
|
+
process_dependency_crate(path_to_crate) {
|
|
322
|
+
const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
323
|
+
const len0 = WASM_VECTOR_LEN;
|
|
324
|
+
const ret = wasm.compilercontext_process_dependency_crate(this.__wbg_ptr, ptr0, len0);
|
|
325
|
+
return CrateId.__wrap(ret);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* @param {string} crate_name
|
|
329
|
+
* @param {CrateId} from
|
|
330
|
+
* @param {CrateId} to
|
|
331
|
+
*/
|
|
332
|
+
add_dependency_edge(crate_name, from, to) {
|
|
333
|
+
const ptr0 = passStringToWasm0(crate_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
334
|
+
const len0 = WASM_VECTOR_LEN;
|
|
335
|
+
_assertClass(from, CrateId);
|
|
336
|
+
_assertClass(to, CrateId);
|
|
337
|
+
wasm.compilercontext_add_dependency_edge(this.__wbg_ptr, ptr0, len0, from.__wbg_ptr, to.__wbg_ptr);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* @param {number} program_width
|
|
341
|
+
* @returns {CompileResult}
|
|
342
|
+
*/
|
|
343
|
+
compile_program(program_width) {
|
|
344
|
+
try {
|
|
345
|
+
const ptr = this.__destroy_into_raw();
|
|
346
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
347
|
+
wasm.compilercontext_compile_program(retptr, ptr, program_width);
|
|
348
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
349
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
350
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
351
|
+
if (r2) {
|
|
352
|
+
throw takeObject(r1);
|
|
353
|
+
}
|
|
354
|
+
return takeObject(r0);
|
|
355
|
+
} finally {
|
|
356
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* @param {number} program_width
|
|
361
|
+
* @returns {CompileResult}
|
|
362
|
+
*/
|
|
363
|
+
compile_contract(program_width) {
|
|
364
|
+
try {
|
|
365
|
+
const ptr = this.__destroy_into_raw();
|
|
366
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
367
|
+
wasm.compilercontext_compile_contract(retptr, ptr, program_width);
|
|
368
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
369
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
370
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
371
|
+
if (r2) {
|
|
372
|
+
throw takeObject(r1);
|
|
373
|
+
}
|
|
374
|
+
return takeObject(r0);
|
|
375
|
+
} finally {
|
|
376
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
module.exports.CompilerContext = CompilerContext;
|
|
381
|
+
/**
|
|
382
|
+
*/
|
|
383
|
+
class CrateId {
|
|
384
|
+
|
|
385
|
+
static __wrap(ptr) {
|
|
386
|
+
ptr = ptr >>> 0;
|
|
387
|
+
const obj = Object.create(CrateId.prototype);
|
|
388
|
+
obj.__wbg_ptr = ptr;
|
|
389
|
+
|
|
390
|
+
return obj;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
__destroy_into_raw() {
|
|
394
|
+
const ptr = this.__wbg_ptr;
|
|
395
|
+
this.__wbg_ptr = 0;
|
|
396
|
+
|
|
397
|
+
return ptr;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
free() {
|
|
401
|
+
const ptr = this.__destroy_into_raw();
|
|
402
|
+
wasm.__wbg_crateid_free(ptr);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
module.exports.CrateId = CrateId;
|
|
406
|
+
/**
|
|
283
407
|
*/
|
|
284
408
|
class PathToFileSourceMap {
|
|
285
409
|
|
|
@@ -328,24 +452,19 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
|
328
452
|
takeObject(arg0);
|
|
329
453
|
};
|
|
330
454
|
|
|
331
|
-
module.exports.
|
|
455
|
+
module.exports.__wbg_constructor_a29cdb41a75eb0e8 = function(arg0) {
|
|
332
456
|
const ret = new Error(takeObject(arg0));
|
|
333
457
|
return addHeapObject(ret);
|
|
334
458
|
};
|
|
335
459
|
|
|
336
|
-
module.exports.
|
|
337
|
-
const ret = getObject(arg0) === undefined;
|
|
338
|
-
return ret;
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
module.exports.__wbg_constructor_0fbcf25c6da50731 = function() {
|
|
460
|
+
module.exports.__wbg_constructor_a3b5b211c5053ce8 = function() {
|
|
342
461
|
const ret = new Object();
|
|
343
462
|
return addHeapObject(ret);
|
|
344
463
|
};
|
|
345
464
|
|
|
346
|
-
module.exports.
|
|
347
|
-
const ret =
|
|
348
|
-
return
|
|
465
|
+
module.exports.__wbindgen_is_undefined = function(arg0) {
|
|
466
|
+
const ret = getObject(arg0) === undefined;
|
|
467
|
+
return ret;
|
|
349
468
|
};
|
|
350
469
|
|
|
351
470
|
module.exports.__wbg_new_abda76e883ba8a5f = function() {
|
|
@@ -373,6 +492,15 @@ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
|
373
492
|
}
|
|
374
493
|
};
|
|
375
494
|
|
|
495
|
+
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
496
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
497
|
+
return addHeapObject(ret);
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
module.exports.__wbg_debug_e3f6a1578e6d45ca = function(arg0) {
|
|
501
|
+
console.debug(getObject(arg0));
|
|
502
|
+
};
|
|
503
|
+
|
|
376
504
|
module.exports.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
|
|
377
505
|
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
378
506
|
};
|
|
@@ -385,12 +513,16 @@ module.exports.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) {
|
|
|
385
513
|
console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
386
514
|
};
|
|
387
515
|
|
|
516
|
+
module.exports.__wbg_info_05db236d79f1b785 = function(arg0) {
|
|
517
|
+
console.info(getObject(arg0));
|
|
518
|
+
};
|
|
519
|
+
|
|
388
520
|
module.exports.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) {
|
|
389
521
|
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
390
522
|
};
|
|
391
523
|
|
|
392
|
-
module.exports.
|
|
393
|
-
console.
|
|
524
|
+
module.exports.__wbg_warn_9bdd743e9f5fe1e0 = function(arg0) {
|
|
525
|
+
console.warn(getObject(arg0));
|
|
394
526
|
};
|
|
395
527
|
|
|
396
528
|
module.exports.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
|
package/nodejs/noir_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function
|
|
5
|
-
export function
|
|
4
|
+
export function __wbg_compilercontext_free(a: number): void;
|
|
5
|
+
export function __wbg_crateid_free(a: number): void;
|
|
6
|
+
export function compilercontext_new(a: number): number;
|
|
7
|
+
export function compilercontext_process_root_crate(a: number, b: number, c: number): number;
|
|
8
|
+
export function compilercontext_process_dependency_crate(a: number, b: number, c: number): number;
|
|
9
|
+
export function compilercontext_add_dependency_edge(a: number, b: number, c: number, d: number, e: number): void;
|
|
10
|
+
export function compilercontext_compile_program(a: number, b: number, c: number): void;
|
|
11
|
+
export function compilercontext_compile_contract(a: number, b: number, c: number): void;
|
|
12
|
+
export function compile_(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
6
13
|
export function init_log_level(a: number, b: number): void;
|
|
7
14
|
export function build_info(): number;
|
|
8
15
|
export function __wbg_pathtofilesourcemap_free(a: number): void;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noir-lang/noir_wasm",
|
|
3
|
-
"
|
|
3
|
+
"contributors": [
|
|
4
4
|
"The Noir Team <team@noir-lang.org>"
|
|
5
5
|
],
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.22.0-2fcbef5.nightly",
|
|
7
7
|
"license": "(MIT OR Apache-2.0)",
|
|
8
8
|
"main": "./nodejs/noir_wasm.js",
|
|
9
9
|
"types": "./web/noir_wasm.d.ts",
|
|
@@ -14,9 +14,14 @@
|
|
|
14
14
|
"package.json"
|
|
15
15
|
],
|
|
16
16
|
"sideEffects": false,
|
|
17
|
+
"homepage": "https://noir-lang.org/",
|
|
17
18
|
"repository": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
19
|
+
"url": "https://github.com/noir-lang/noir.git",
|
|
20
|
+
"directory": "compiler/wasm",
|
|
21
|
+
"type": "git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/noir-lang/noir/issues"
|
|
20
25
|
},
|
|
21
26
|
"scripts": {
|
|
22
27
|
"build": "bash ./build.sh",
|
package/web/noir_wasm.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* @param {
|
|
10
|
-
* @returns {
|
|
4
|
+
* This is a method that exposes the same API as `compile`
|
|
5
|
+
* But uses the Context based APi internally
|
|
6
|
+
* @param {string} entry_point
|
|
7
|
+
* @param {boolean | undefined} contracts
|
|
8
|
+
* @param {DependencyGraph | undefined} dependency_graph
|
|
9
|
+
* @param {PathToFileSourceMap} file_source_map
|
|
10
|
+
* @returns {CompileResult}
|
|
11
11
|
*/
|
|
12
|
-
export function
|
|
12
|
+
export function compile_(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
|
|
13
13
|
/**
|
|
14
|
-
* @param {string}
|
|
14
|
+
* @param {string} filter
|
|
15
15
|
*/
|
|
16
|
-
export function init_log_level(
|
|
16
|
+
export function init_log_level(filter: string): void;
|
|
17
17
|
/**
|
|
18
18
|
* @returns {any}
|
|
19
19
|
*/
|
|
@@ -52,14 +52,12 @@ export type DependencyGraph = {
|
|
|
52
52
|
export type CompiledContract = {
|
|
53
53
|
noir_version: string;
|
|
54
54
|
name: string;
|
|
55
|
-
backend: string;
|
|
56
55
|
functions: Array<any>;
|
|
57
56
|
events: Array<any>;
|
|
58
57
|
};
|
|
59
58
|
|
|
60
59
|
export type CompiledProgram = {
|
|
61
60
|
noir_version: string;
|
|
62
|
-
backend: string;
|
|
63
61
|
abi: any;
|
|
64
62
|
bytecode: string;
|
|
65
63
|
}
|
|
@@ -82,6 +80,49 @@ export type CompileResult = (
|
|
|
82
80
|
);
|
|
83
81
|
|
|
84
82
|
|
|
83
|
+
/**
|
|
84
|
+
* This is a wrapper class that is wasm-bindgen compatible
|
|
85
|
+
* We do not use js_name and rename it like CrateId because
|
|
86
|
+
* then the impl block is not picked up in javascript.
|
|
87
|
+
*/
|
|
88
|
+
export class CompilerContext {
|
|
89
|
+
free(): void;
|
|
90
|
+
/**
|
|
91
|
+
* @param {PathToFileSourceMap} source_map
|
|
92
|
+
*/
|
|
93
|
+
constructor(source_map: PathToFileSourceMap);
|
|
94
|
+
/**
|
|
95
|
+
* @param {string} path_to_crate
|
|
96
|
+
* @returns {CrateId}
|
|
97
|
+
*/
|
|
98
|
+
process_root_crate(path_to_crate: string): CrateId;
|
|
99
|
+
/**
|
|
100
|
+
* @param {string} path_to_crate
|
|
101
|
+
* @returns {CrateId}
|
|
102
|
+
*/
|
|
103
|
+
process_dependency_crate(path_to_crate: string): CrateId;
|
|
104
|
+
/**
|
|
105
|
+
* @param {string} crate_name
|
|
106
|
+
* @param {CrateId} from
|
|
107
|
+
* @param {CrateId} to
|
|
108
|
+
*/
|
|
109
|
+
add_dependency_edge(crate_name: string, from: CrateId, to: CrateId): void;
|
|
110
|
+
/**
|
|
111
|
+
* @param {number} program_width
|
|
112
|
+
* @returns {CompileResult}
|
|
113
|
+
*/
|
|
114
|
+
compile_program(program_width: number): CompileResult;
|
|
115
|
+
/**
|
|
116
|
+
* @param {number} program_width
|
|
117
|
+
* @returns {CompileResult}
|
|
118
|
+
*/
|
|
119
|
+
compile_contract(program_width: number): CompileResult;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
*/
|
|
123
|
+
export class CrateId {
|
|
124
|
+
free(): void;
|
|
125
|
+
}
|
|
85
126
|
/**
|
|
86
127
|
*/
|
|
87
128
|
export class PathToFileSourceMap {
|
|
@@ -101,8 +142,15 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
101
142
|
|
|
102
143
|
export interface InitOutput {
|
|
103
144
|
readonly memory: WebAssembly.Memory;
|
|
104
|
-
readonly
|
|
105
|
-
readonly
|
|
145
|
+
readonly __wbg_compilercontext_free: (a: number) => void;
|
|
146
|
+
readonly __wbg_crateid_free: (a: number) => void;
|
|
147
|
+
readonly compilercontext_new: (a: number) => number;
|
|
148
|
+
readonly compilercontext_process_root_crate: (a: number, b: number, c: number) => number;
|
|
149
|
+
readonly compilercontext_process_dependency_crate: (a: number, b: number, c: number) => number;
|
|
150
|
+
readonly compilercontext_add_dependency_edge: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
151
|
+
readonly compilercontext_compile_program: (a: number, b: number, c: number) => void;
|
|
152
|
+
readonly compilercontext_compile_contract: (a: number, b: number, c: number) => void;
|
|
153
|
+
readonly compile_: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
106
154
|
readonly init_log_level: (a: number, b: number) => void;
|
|
107
155
|
readonly build_info: () => number;
|
|
108
156
|
readonly __wbg_pathtofilesourcemap_free: (a: number) => void;
|
package/web/noir_wasm.js
CHANGED
|
@@ -180,50 +180,46 @@ function debugString(val) {
|
|
|
180
180
|
return className;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
function
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return ptr;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* @param {Uint8Array} bytes
|
|
191
|
-
* @returns {any}
|
|
192
|
-
*/
|
|
193
|
-
export function acir_read_bytes(bytes) {
|
|
194
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_0);
|
|
195
|
-
const len0 = WASM_VECTOR_LEN;
|
|
196
|
-
const ret = wasm.acir_read_bytes(ptr0, len0);
|
|
197
|
-
return takeObject(ret);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
201
|
-
ptr = ptr >>> 0;
|
|
202
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
183
|
+
function _assertClass(instance, klass) {
|
|
184
|
+
if (!(instance instanceof klass)) {
|
|
185
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
186
|
+
}
|
|
187
|
+
return instance.ptr;
|
|
203
188
|
}
|
|
204
189
|
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
190
|
+
* This is a method that exposes the same API as `compile`
|
|
191
|
+
* But uses the Context based APi internally
|
|
192
|
+
* @param {string} entry_point
|
|
193
|
+
* @param {boolean | undefined} contracts
|
|
194
|
+
* @param {DependencyGraph | undefined} dependency_graph
|
|
195
|
+
* @param {PathToFileSourceMap} file_source_map
|
|
196
|
+
* @returns {CompileResult}
|
|
207
197
|
*/
|
|
208
|
-
export function
|
|
198
|
+
export function compile_(entry_point, contracts, dependency_graph, file_source_map) {
|
|
209
199
|
try {
|
|
210
200
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
211
|
-
wasm.
|
|
201
|
+
const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
202
|
+
const len0 = WASM_VECTOR_LEN;
|
|
203
|
+
_assertClass(file_source_map, PathToFileSourceMap);
|
|
204
|
+
var ptr1 = file_source_map.__destroy_into_raw();
|
|
205
|
+
wasm.compile_(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
|
|
212
206
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
213
207
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
214
|
-
var
|
|
215
|
-
|
|
216
|
-
|
|
208
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
209
|
+
if (r2) {
|
|
210
|
+
throw takeObject(r1);
|
|
211
|
+
}
|
|
212
|
+
return takeObject(r0);
|
|
217
213
|
} finally {
|
|
218
214
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
219
215
|
}
|
|
220
216
|
}
|
|
221
217
|
|
|
222
218
|
/**
|
|
223
|
-
* @param {string}
|
|
219
|
+
* @param {string} filter
|
|
224
220
|
*/
|
|
225
|
-
export function init_log_level(
|
|
226
|
-
const ptr0 = passStringToWasm0(
|
|
221
|
+
export function init_log_level(filter) {
|
|
222
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
227
223
|
const len0 = WASM_VECTOR_LEN;
|
|
228
224
|
wasm.init_log_level(ptr0, len0);
|
|
229
225
|
}
|
|
@@ -236,12 +232,6 @@ export function build_info() {
|
|
|
236
232
|
return takeObject(ret);
|
|
237
233
|
}
|
|
238
234
|
|
|
239
|
-
function _assertClass(instance, klass) {
|
|
240
|
-
if (!(instance instanceof klass)) {
|
|
241
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
242
|
-
}
|
|
243
|
-
return instance.ptr;
|
|
244
|
-
}
|
|
245
235
|
/**
|
|
246
236
|
* @param {string} entry_point
|
|
247
237
|
* @param {boolean | undefined} contracts
|
|
@@ -277,6 +267,138 @@ function handleError(f, args) {
|
|
|
277
267
|
}
|
|
278
268
|
}
|
|
279
269
|
/**
|
|
270
|
+
* This is a wrapper class that is wasm-bindgen compatible
|
|
271
|
+
* We do not use js_name and rename it like CrateId because
|
|
272
|
+
* then the impl block is not picked up in javascript.
|
|
273
|
+
*/
|
|
274
|
+
export class CompilerContext {
|
|
275
|
+
|
|
276
|
+
static __wrap(ptr) {
|
|
277
|
+
ptr = ptr >>> 0;
|
|
278
|
+
const obj = Object.create(CompilerContext.prototype);
|
|
279
|
+
obj.__wbg_ptr = ptr;
|
|
280
|
+
|
|
281
|
+
return obj;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
__destroy_into_raw() {
|
|
285
|
+
const ptr = this.__wbg_ptr;
|
|
286
|
+
this.__wbg_ptr = 0;
|
|
287
|
+
|
|
288
|
+
return ptr;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
free() {
|
|
292
|
+
const ptr = this.__destroy_into_raw();
|
|
293
|
+
wasm.__wbg_compilercontext_free(ptr);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* @param {PathToFileSourceMap} source_map
|
|
297
|
+
*/
|
|
298
|
+
constructor(source_map) {
|
|
299
|
+
_assertClass(source_map, PathToFileSourceMap);
|
|
300
|
+
var ptr0 = source_map.__destroy_into_raw();
|
|
301
|
+
const ret = wasm.compilercontext_new(ptr0);
|
|
302
|
+
return CompilerContext.__wrap(ret);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* @param {string} path_to_crate
|
|
306
|
+
* @returns {CrateId}
|
|
307
|
+
*/
|
|
308
|
+
process_root_crate(path_to_crate) {
|
|
309
|
+
const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
310
|
+
const len0 = WASM_VECTOR_LEN;
|
|
311
|
+
const ret = wasm.compilercontext_process_root_crate(this.__wbg_ptr, ptr0, len0);
|
|
312
|
+
return CrateId.__wrap(ret);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* @param {string} path_to_crate
|
|
316
|
+
* @returns {CrateId}
|
|
317
|
+
*/
|
|
318
|
+
process_dependency_crate(path_to_crate) {
|
|
319
|
+
const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
320
|
+
const len0 = WASM_VECTOR_LEN;
|
|
321
|
+
const ret = wasm.compilercontext_process_dependency_crate(this.__wbg_ptr, ptr0, len0);
|
|
322
|
+
return CrateId.__wrap(ret);
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* @param {string} crate_name
|
|
326
|
+
* @param {CrateId} from
|
|
327
|
+
* @param {CrateId} to
|
|
328
|
+
*/
|
|
329
|
+
add_dependency_edge(crate_name, from, to) {
|
|
330
|
+
const ptr0 = passStringToWasm0(crate_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
331
|
+
const len0 = WASM_VECTOR_LEN;
|
|
332
|
+
_assertClass(from, CrateId);
|
|
333
|
+
_assertClass(to, CrateId);
|
|
334
|
+
wasm.compilercontext_add_dependency_edge(this.__wbg_ptr, ptr0, len0, from.__wbg_ptr, to.__wbg_ptr);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* @param {number} program_width
|
|
338
|
+
* @returns {CompileResult}
|
|
339
|
+
*/
|
|
340
|
+
compile_program(program_width) {
|
|
341
|
+
try {
|
|
342
|
+
const ptr = this.__destroy_into_raw();
|
|
343
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
344
|
+
wasm.compilercontext_compile_program(retptr, ptr, program_width);
|
|
345
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
346
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
347
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
348
|
+
if (r2) {
|
|
349
|
+
throw takeObject(r1);
|
|
350
|
+
}
|
|
351
|
+
return takeObject(r0);
|
|
352
|
+
} finally {
|
|
353
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* @param {number} program_width
|
|
358
|
+
* @returns {CompileResult}
|
|
359
|
+
*/
|
|
360
|
+
compile_contract(program_width) {
|
|
361
|
+
try {
|
|
362
|
+
const ptr = this.__destroy_into_raw();
|
|
363
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
364
|
+
wasm.compilercontext_compile_contract(retptr, ptr, program_width);
|
|
365
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
366
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
367
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
368
|
+
if (r2) {
|
|
369
|
+
throw takeObject(r1);
|
|
370
|
+
}
|
|
371
|
+
return takeObject(r0);
|
|
372
|
+
} finally {
|
|
373
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
*/
|
|
379
|
+
export class CrateId {
|
|
380
|
+
|
|
381
|
+
static __wrap(ptr) {
|
|
382
|
+
ptr = ptr >>> 0;
|
|
383
|
+
const obj = Object.create(CrateId.prototype);
|
|
384
|
+
obj.__wbg_ptr = ptr;
|
|
385
|
+
|
|
386
|
+
return obj;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
__destroy_into_raw() {
|
|
390
|
+
const ptr = this.__wbg_ptr;
|
|
391
|
+
this.__wbg_ptr = 0;
|
|
392
|
+
|
|
393
|
+
return ptr;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
free() {
|
|
397
|
+
const ptr = this.__destroy_into_raw();
|
|
398
|
+
wasm.__wbg_crateid_free(ptr);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
280
402
|
*/
|
|
281
403
|
export class PathToFileSourceMap {
|
|
282
404
|
|
|
@@ -357,21 +479,17 @@ function __wbg_get_imports() {
|
|
|
357
479
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
358
480
|
takeObject(arg0);
|
|
359
481
|
};
|
|
360
|
-
imports.wbg.
|
|
482
|
+
imports.wbg.__wbg_constructor_a29cdb41a75eb0e8 = function(arg0) {
|
|
361
483
|
const ret = new Error(takeObject(arg0));
|
|
362
484
|
return addHeapObject(ret);
|
|
363
485
|
};
|
|
364
|
-
imports.wbg.
|
|
365
|
-
const ret = getObject(arg0) === undefined;
|
|
366
|
-
return ret;
|
|
367
|
-
};
|
|
368
|
-
imports.wbg.__wbg_constructor_0fbcf25c6da50731 = function() {
|
|
486
|
+
imports.wbg.__wbg_constructor_a3b5b211c5053ce8 = function() {
|
|
369
487
|
const ret = new Object();
|
|
370
488
|
return addHeapObject(ret);
|
|
371
489
|
};
|
|
372
|
-
imports.wbg.
|
|
373
|
-
const ret =
|
|
374
|
-
return
|
|
490
|
+
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
491
|
+
const ret = getObject(arg0) === undefined;
|
|
492
|
+
return ret;
|
|
375
493
|
};
|
|
376
494
|
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
|
377
495
|
const ret = new Error();
|
|
@@ -395,6 +513,13 @@ function __wbg_get_imports() {
|
|
|
395
513
|
wasm.__wbindgen_export_2(deferred0_0, deferred0_1);
|
|
396
514
|
}
|
|
397
515
|
};
|
|
516
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
517
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
518
|
+
return addHeapObject(ret);
|
|
519
|
+
};
|
|
520
|
+
imports.wbg.__wbg_debug_e3f6a1578e6d45ca = function(arg0) {
|
|
521
|
+
console.debug(getObject(arg0));
|
|
522
|
+
};
|
|
398
523
|
imports.wbg.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
|
|
399
524
|
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
400
525
|
};
|
|
@@ -404,11 +529,14 @@ function __wbg_get_imports() {
|
|
|
404
529
|
imports.wbg.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) {
|
|
405
530
|
console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
406
531
|
};
|
|
532
|
+
imports.wbg.__wbg_info_05db236d79f1b785 = function(arg0) {
|
|
533
|
+
console.info(getObject(arg0));
|
|
534
|
+
};
|
|
407
535
|
imports.wbg.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) {
|
|
408
536
|
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
409
537
|
};
|
|
410
|
-
imports.wbg.
|
|
411
|
-
console.
|
|
538
|
+
imports.wbg.__wbg_warn_9bdd743e9f5fe1e0 = function(arg0) {
|
|
539
|
+
console.warn(getObject(arg0));
|
|
412
540
|
};
|
|
413
541
|
imports.wbg.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
|
|
414
542
|
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
package/web/noir_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function
|
|
5
|
-
export function
|
|
4
|
+
export function __wbg_compilercontext_free(a: number): void;
|
|
5
|
+
export function __wbg_crateid_free(a: number): void;
|
|
6
|
+
export function compilercontext_new(a: number): number;
|
|
7
|
+
export function compilercontext_process_root_crate(a: number, b: number, c: number): number;
|
|
8
|
+
export function compilercontext_process_dependency_crate(a: number, b: number, c: number): number;
|
|
9
|
+
export function compilercontext_add_dependency_edge(a: number, b: number, c: number, d: number, e: number): void;
|
|
10
|
+
export function compilercontext_compile_program(a: number, b: number, c: number): void;
|
|
11
|
+
export function compilercontext_compile_contract(a: number, b: number, c: number): void;
|
|
12
|
+
export function compile_(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
6
13
|
export function init_log_level(a: number, b: number): void;
|
|
7
14
|
export function build_info(): number;
|
|
8
15
|
export function __wbg_pathtofilesourcemap_free(a: number): void;
|