@noir-lang/noir_wasm 0.12.0 → 0.16.0-20a160c
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/CHANGELOG.md +24 -0
- package/README.md +2 -2
- package/nodejs/noir_wasm.d.ts +13 -17
- package/nodejs/noir_wasm.js +95 -114
- package/nodejs/noir_wasm_bg.wasm +0 -0
- package/nodejs/noir_wasm_bg.wasm.d.ts +3 -5
- package/package.json +10 -7
- package/web/noir_wasm.d.ts +16 -22
- package/web/noir_wasm.js +90 -106
- package/web/noir_wasm_bg.wasm +0 -0
- package/web/noir_wasm_bg.wasm.d.ts +3 -5
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.7.0](https://github.com/noir-lang/noir/compare/noir_wasm-v0.6.0...noir_wasm-v0.7.0) (2023-06-19)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* update to ACVM 0.13.0 ([#1393](https://github.com/noir-lang/noir/issues/1393))
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **ci:** update noir to build wasm with a nix flake file ([#1208](https://github.com/noir-lang/noir/issues/1208)) ([2209369](https://github.com/noir-lang/noir/commit/22093699a1a9c0c654c57fcce683fb42808db3e4))
|
|
13
|
+
* pass in closure to `Driver` to signal backend opcode support ([#1349](https://github.com/noir-lang/noir/issues/1349)) ([1e958c2](https://github.com/noir-lang/noir/commit/1e958c2aef89328e5354457c2a1e8697486e2978))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* Fix nargo not showing compiler errors or warnings ([#1694](https://github.com/noir-lang/noir/issues/1694)) ([4233068](https://github.com/noir-lang/noir/commit/4233068e790e6b2544b61571183fdfe8dbaa7c57))
|
|
19
|
+
* **noirc_driver:** Move error printing into nargo ([#1598](https://github.com/noir-lang/noir/issues/1598)) ([561cd63](https://github.com/noir-lang/noir/commit/561cd63debc24d96fa95d3eced72d8b2f8122f49))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Miscellaneous Chores
|
|
23
|
+
|
|
24
|
+
* update to ACVM 0.13.0 ([#1393](https://github.com/noir-lang/noir/issues/1393)) ([22dee75](https://github.com/noir-lang/noir/commit/22dee75464d3d02af17109d9065d37342fbbcddb))
|
package/README.md
CHANGED
|
@@ -9,11 +9,11 @@ The package also handles dependency management like how Nargo (Noir's CLI tool)
|
|
|
9
9
|
Outside of the [noir repo](https://github.com/noir-lang/noir), this package can be built using the command below:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
nix build -L github:noir-lang/noir/master#
|
|
12
|
+
nix build -L github:noir-lang/noir/master#noir_wasm
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
If you are within the noir repo and would like to build local changes, you can use:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
nix build -L #
|
|
18
|
+
nix build -L #noir_wasm
|
|
19
19
|
```
|
package/nodejs/noir_wasm.d.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* @param {string} level
|
|
5
|
-
*/
|
|
6
|
-
export function init_log_level(level: string): void;
|
|
7
|
-
/**
|
|
8
|
-
* @returns {any}
|
|
9
|
-
*/
|
|
10
|
-
export function build_info(): any;
|
|
11
|
-
/**
|
|
12
4
|
* @param {Uint8Array} bytes
|
|
13
5
|
* @returns {any}
|
|
14
6
|
*/
|
|
@@ -19,17 +11,21 @@ export function acir_read_bytes(bytes: Uint8Array): any;
|
|
|
19
11
|
*/
|
|
20
12
|
export function acir_write_bytes(acir: any): Uint8Array;
|
|
21
13
|
/**
|
|
22
|
-
* @param {
|
|
23
|
-
* @returns {any}
|
|
14
|
+
* @param {string} level
|
|
24
15
|
*/
|
|
25
|
-
export function
|
|
16
|
+
export function init_log_level(level: string): void;
|
|
26
17
|
/**
|
|
27
|
-
*
|
|
18
|
+
* @returns {any}
|
|
28
19
|
*/
|
|
29
|
-
export
|
|
30
|
-
free(): void;
|
|
20
|
+
export function build_info(): any;
|
|
31
21
|
/**
|
|
32
|
-
* @
|
|
22
|
+
* @param {string} entry_point
|
|
23
|
+
* @param {boolean | undefined} contracts
|
|
24
|
+
* @param {string[] | undefined} dependencies
|
|
25
|
+
* @returns {any}
|
|
33
26
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
export function compile(entry_point: string, contracts?: boolean, dependencies?: string[]): any;
|
|
28
|
+
|
|
29
|
+
export type CompileError = Error;
|
|
30
|
+
|
|
31
|
+
|
package/nodejs/noir_wasm.js
CHANGED
|
@@ -2,7 +2,7 @@ let imports = {};
|
|
|
2
2
|
imports['__wbindgen_placeholder__'] = module.exports;
|
|
3
3
|
let wasm;
|
|
4
4
|
const { read_file } = require(`@noir-lang/source-resolver`);
|
|
5
|
-
const {
|
|
5
|
+
const { TextEncoder, TextDecoder } = require(`util`);
|
|
6
6
|
|
|
7
7
|
const heap = new Array(128).fill(undefined);
|
|
8
8
|
|
|
@@ -10,23 +10,7 @@ heap.push(undefined, null, true, false);
|
|
|
10
10
|
|
|
11
11
|
function getObject(idx) { return heap[idx]; }
|
|
12
12
|
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
function dropObject(idx) {
|
|
16
|
-
if (idx < 132) return;
|
|
17
|
-
heap[idx] = heap_next;
|
|
18
|
-
heap_next = idx;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function takeObject(idx) {
|
|
22
|
-
const ret = getObject(idx);
|
|
23
|
-
dropObject(idx);
|
|
24
|
-
return ret;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
28
|
-
|
|
29
|
-
cachedTextDecoder.decode();
|
|
13
|
+
let WASM_VECTOR_LEN = 0;
|
|
30
14
|
|
|
31
15
|
let cachedUint8Memory0 = null;
|
|
32
16
|
|
|
@@ -37,22 +21,6 @@ function getUint8Memory0() {
|
|
|
37
21
|
return cachedUint8Memory0;
|
|
38
22
|
}
|
|
39
23
|
|
|
40
|
-
function getStringFromWasm0(ptr, len) {
|
|
41
|
-
ptr = ptr >>> 0;
|
|
42
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function addHeapObject(obj) {
|
|
46
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
47
|
-
const idx = heap_next;
|
|
48
|
-
heap_next = heap[idx];
|
|
49
|
-
|
|
50
|
-
heap[idx] = obj;
|
|
51
|
-
return idx;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
let WASM_VECTOR_LEN = 0;
|
|
55
|
-
|
|
56
24
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
57
25
|
|
|
58
26
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -118,22 +86,38 @@ function getInt32Memory0() {
|
|
|
118
86
|
}
|
|
119
87
|
return cachedInt32Memory0;
|
|
120
88
|
}
|
|
121
|
-
/**
|
|
122
|
-
* @param {string} level
|
|
123
|
-
*/
|
|
124
|
-
module.exports.init_log_level = function(level) {
|
|
125
|
-
const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
126
|
-
const len0 = WASM_VECTOR_LEN;
|
|
127
|
-
wasm.init_log_level(ptr0, len0);
|
|
128
|
-
};
|
|
129
89
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
90
|
+
let heap_next = heap.length;
|
|
91
|
+
|
|
92
|
+
function dropObject(idx) {
|
|
93
|
+
if (idx < 132) return;
|
|
94
|
+
heap[idx] = heap_next;
|
|
95
|
+
heap_next = idx;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function takeObject(idx) {
|
|
99
|
+
const ret = getObject(idx);
|
|
100
|
+
dropObject(idx);
|
|
101
|
+
return ret;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
105
|
+
|
|
106
|
+
cachedTextDecoder.decode();
|
|
107
|
+
|
|
108
|
+
function getStringFromWasm0(ptr, len) {
|
|
109
|
+
ptr = ptr >>> 0;
|
|
110
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function addHeapObject(obj) {
|
|
114
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
115
|
+
const idx = heap_next;
|
|
116
|
+
heap_next = heap[idx];
|
|
117
|
+
|
|
118
|
+
heap[idx] = obj;
|
|
119
|
+
return idx;
|
|
120
|
+
}
|
|
137
121
|
|
|
138
122
|
function passArray8ToWasm0(arg, malloc) {
|
|
139
123
|
const ptr = malloc(arg.length * 1) >>> 0;
|
|
@@ -175,14 +159,46 @@ module.exports.acir_write_bytes = function(acir) {
|
|
|
175
159
|
};
|
|
176
160
|
|
|
177
161
|
/**
|
|
178
|
-
* @param {
|
|
162
|
+
* @param {string} level
|
|
163
|
+
*/
|
|
164
|
+
module.exports.init_log_level = function(level) {
|
|
165
|
+
const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
166
|
+
const len0 = WASM_VECTOR_LEN;
|
|
167
|
+
wasm.init_log_level(ptr0, len0);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
/**
|
|
179
171
|
* @returns {any}
|
|
180
172
|
*/
|
|
181
|
-
module.exports.
|
|
182
|
-
const ret = wasm.
|
|
173
|
+
module.exports.build_info = function() {
|
|
174
|
+
const ret = wasm.build_info();
|
|
183
175
|
return takeObject(ret);
|
|
184
176
|
};
|
|
185
177
|
|
|
178
|
+
/**
|
|
179
|
+
* @param {string} entry_point
|
|
180
|
+
* @param {boolean | undefined} contracts
|
|
181
|
+
* @param {string[] | undefined} dependencies
|
|
182
|
+
* @returns {any}
|
|
183
|
+
*/
|
|
184
|
+
module.exports.compile = function(entry_point, contracts, dependencies) {
|
|
185
|
+
try {
|
|
186
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
187
|
+
const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
188
|
+
const len0 = WASM_VECTOR_LEN;
|
|
189
|
+
wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependencies) ? 0 : addHeapObject(dependencies));
|
|
190
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
191
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
192
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
193
|
+
if (r2) {
|
|
194
|
+
throw takeObject(r1);
|
|
195
|
+
}
|
|
196
|
+
return takeObject(r0);
|
|
197
|
+
} finally {
|
|
198
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
186
202
|
function handleError(f, args) {
|
|
187
203
|
try {
|
|
188
204
|
return f.apply(this, args);
|
|
@@ -190,31 +206,15 @@ function handleError(f, args) {
|
|
|
190
206
|
wasm.__wbindgen_export_3(addHeapObject(e));
|
|
191
207
|
}
|
|
192
208
|
}
|
|
193
|
-
/**
|
|
194
|
-
* A struct representing a Trap
|
|
195
|
-
*/
|
|
196
|
-
class Trap {
|
|
197
|
-
|
|
198
|
-
__destroy_into_raw() {
|
|
199
|
-
const ptr = this.__wbg_ptr;
|
|
200
|
-
this.__wbg_ptr = 0;
|
|
201
|
-
|
|
202
|
-
return ptr;
|
|
203
|
-
}
|
|
204
209
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const ret = wasm.trap___wbgd_downcast_token();
|
|
214
|
-
return takeObject(ret);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
module.exports.Trap = Trap;
|
|
210
|
+
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
211
|
+
const obj = getObject(arg1);
|
|
212
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
213
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
214
|
+
var len1 = WASM_VECTOR_LEN;
|
|
215
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
216
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
217
|
+
};
|
|
218
218
|
|
|
219
219
|
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
220
220
|
takeObject(arg0);
|
|
@@ -225,11 +225,19 @@ module.exports.__wbindgen_is_undefined = function(arg0) {
|
|
|
225
225
|
return ret;
|
|
226
226
|
};
|
|
227
227
|
|
|
228
|
-
module.exports.
|
|
229
|
-
const ret =
|
|
230
|
-
return ret;
|
|
228
|
+
module.exports.__wbg_constructor_ac1f808f67a5f1e9 = function(arg0) {
|
|
229
|
+
const ret = new Error(takeObject(arg0));
|
|
230
|
+
return addHeapObject(ret);
|
|
231
231
|
};
|
|
232
232
|
|
|
233
|
+
module.exports.__wbg_readfile_0c1777c7c5aa8c92 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
234
|
+
const ret = read_file(getStringFromWasm0(arg1, arg2));
|
|
235
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
236
|
+
const len1 = WASM_VECTOR_LEN;
|
|
237
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
238
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
239
|
+
}, arguments) };
|
|
240
|
+
|
|
233
241
|
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
234
242
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
235
243
|
return addHeapObject(ret);
|
|
@@ -260,38 +268,6 @@ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
|
260
268
|
}
|
|
261
269
|
};
|
|
262
270
|
|
|
263
|
-
module.exports.__wbg_readfile_8efacfffd6a3a749 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
264
|
-
const ret = read_file(getStringFromWasm0(arg1, arg2));
|
|
265
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
266
|
-
const len1 = WASM_VECTOR_LEN;
|
|
267
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
268
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
269
|
-
}, arguments) };
|
|
270
|
-
|
|
271
|
-
module.exports.__wbindgen_object_clone_ref = function(arg0) {
|
|
272
|
-
const ret = getObject(arg0);
|
|
273
|
-
return addHeapObject(ret);
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
277
|
-
const obj = getObject(arg1);
|
|
278
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
279
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
280
|
-
var len1 = WASM_VECTOR_LEN;
|
|
281
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
282
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
module.exports.__wbg_static_accessor_SYMBOL_45d4d15e3c4aeb33 = function() {
|
|
286
|
-
const ret = Symbol;
|
|
287
|
-
return addHeapObject(ret);
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
module.exports.__wbindgen_is_symbol = function(arg0) {
|
|
291
|
-
const ret = typeof(getObject(arg0)) === 'symbol';
|
|
292
|
-
return ret;
|
|
293
|
-
};
|
|
294
|
-
|
|
295
271
|
module.exports.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
|
|
296
272
|
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
297
273
|
};
|
|
@@ -316,10 +292,15 @@ module.exports.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
|
|
|
316
292
|
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
317
293
|
};
|
|
318
294
|
|
|
319
|
-
module.exports.
|
|
320
|
-
const ret = getObject(arg0)
|
|
295
|
+
module.exports.__wbg_get_7303ed2ef026b2f5 = function(arg0, arg1) {
|
|
296
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
321
297
|
return addHeapObject(ret);
|
|
322
|
-
}
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
module.exports.__wbg_length_820c786973abdd8a = function(arg0) {
|
|
301
|
+
const ret = getObject(arg0).length;
|
|
302
|
+
return ret;
|
|
303
|
+
};
|
|
323
304
|
|
|
324
305
|
module.exports.__wbg_parse_76a8a18ca3f8730b = function() { return handleError(function (arg0, arg1) {
|
|
325
306
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
package/nodejs/noir_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function init_log_level(a: number, b: number): void;
|
|
5
|
-
export function build_info(): number;
|
|
6
4
|
export function acir_read_bytes(a: number, b: number): number;
|
|
7
5
|
export function acir_write_bytes(a: number, b: number): void;
|
|
8
|
-
export function
|
|
9
|
-
export function
|
|
10
|
-
export function
|
|
6
|
+
export function init_log_level(a: number, b: number): void;
|
|
7
|
+
export function build_info(): number;
|
|
8
|
+
export function compile(a: number, b: number, c: number, d: number, e: number): void;
|
|
11
9
|
export function __wbindgen_export_0(a: number): number;
|
|
12
10
|
export function __wbindgen_export_1(a: number, b: number, c: number): number;
|
|
13
11
|
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"collaborators": [
|
|
4
4
|
"The Noir Team <team@noir-lang.org>"
|
|
5
5
|
],
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.16.0-20a160c",
|
|
7
7
|
"license": "(MIT OR Apache-2.0)",
|
|
8
8
|
"main": "./nodejs/noir_wasm.js",
|
|
9
9
|
"types": "./web/noir_wasm.d.ts",
|
|
@@ -20,19 +20,22 @@
|
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "bash ./build.sh",
|
|
23
|
-
"test": "
|
|
24
|
-
"test:node": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"
|
|
25
|
-
"test:browser": "web-test-runner"
|
|
23
|
+
"test": "yarn test:node && yarn test:browser",
|
|
24
|
+
"test:node": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' mocha",
|
|
25
|
+
"test:browser": "web-test-runner",
|
|
26
|
+
"clean": "chmod u+w web nodejs || true && rm -rf ./nodejs ./web ./target ./result",
|
|
27
|
+
"nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json",
|
|
28
|
+
"publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
|
|
29
|
+
"lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0"
|
|
26
30
|
},
|
|
27
31
|
"peerDependencies": {
|
|
28
|
-
"@noir-lang/source-resolver": "
|
|
32
|
+
"@noir-lang/source-resolver": "0.16.0-20a160c"
|
|
29
33
|
},
|
|
30
34
|
"devDependencies": {
|
|
31
35
|
"@esm-bundle/chai": "^4.3.4-fix.0",
|
|
32
36
|
"@web/dev-server-esbuild": "^0.3.6",
|
|
33
37
|
"@web/test-runner": "^0.15.3",
|
|
34
38
|
"@web/test-runner-playwright": "^0.10.0",
|
|
35
|
-
"@web/test-runner-webdriver": "^0.7.0",
|
|
36
39
|
"mocha": "^10.2.0"
|
|
37
40
|
}
|
|
38
|
-
}
|
|
41
|
+
}
|
package/web/noir_wasm.d.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* @param {string} level
|
|
5
|
-
*/
|
|
6
|
-
export function init_log_level(level: string): void;
|
|
7
|
-
/**
|
|
8
|
-
* @returns {any}
|
|
9
|
-
*/
|
|
10
|
-
export function build_info(): any;
|
|
11
|
-
/**
|
|
12
4
|
* @param {Uint8Array} bytes
|
|
13
5
|
* @returns {any}
|
|
14
6
|
*/
|
|
@@ -19,32 +11,34 @@ export function acir_read_bytes(bytes: Uint8Array): any;
|
|
|
19
11
|
*/
|
|
20
12
|
export function acir_write_bytes(acir: any): Uint8Array;
|
|
21
13
|
/**
|
|
22
|
-
* @param {
|
|
23
|
-
* @returns {any}
|
|
14
|
+
* @param {string} level
|
|
24
15
|
*/
|
|
25
|
-
export function
|
|
16
|
+
export function init_log_level(level: string): void;
|
|
26
17
|
/**
|
|
27
|
-
*
|
|
18
|
+
* @returns {any}
|
|
28
19
|
*/
|
|
29
|
-
export
|
|
30
|
-
free(): void;
|
|
20
|
+
export function build_info(): any;
|
|
31
21
|
/**
|
|
32
|
-
* @
|
|
22
|
+
* @param {string} entry_point
|
|
23
|
+
* @param {boolean | undefined} contracts
|
|
24
|
+
* @param {string[] | undefined} dependencies
|
|
25
|
+
* @returns {any}
|
|
33
26
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
export function compile(entry_point: string, contracts?: boolean, dependencies?: string[]): any;
|
|
28
|
+
|
|
29
|
+
export type CompileError = Error;
|
|
30
|
+
|
|
31
|
+
|
|
36
32
|
|
|
37
33
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
38
34
|
|
|
39
35
|
export interface InitOutput {
|
|
40
36
|
readonly memory: WebAssembly.Memory;
|
|
41
|
-
readonly init_log_level: (a: number, b: number) => void;
|
|
42
|
-
readonly build_info: () => number;
|
|
43
37
|
readonly acir_read_bytes: (a: number, b: number) => number;
|
|
44
38
|
readonly acir_write_bytes: (a: number, b: number) => void;
|
|
45
|
-
readonly
|
|
46
|
-
readonly
|
|
47
|
-
readonly
|
|
39
|
+
readonly init_log_level: (a: number, b: number) => void;
|
|
40
|
+
readonly build_info: () => number;
|
|
41
|
+
readonly compile: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
48
42
|
readonly __wbindgen_export_0: (a: number) => number;
|
|
49
43
|
readonly __wbindgen_export_1: (a: number, b: number, c: number) => number;
|
|
50
44
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
package/web/noir_wasm.js
CHANGED
|
@@ -8,23 +8,7 @@ heap.push(undefined, null, true, false);
|
|
|
8
8
|
|
|
9
9
|
function getObject(idx) { return heap[idx]; }
|
|
10
10
|
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
function dropObject(idx) {
|
|
14
|
-
if (idx < 132) return;
|
|
15
|
-
heap[idx] = heap_next;
|
|
16
|
-
heap_next = idx;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function takeObject(idx) {
|
|
20
|
-
const ret = getObject(idx);
|
|
21
|
-
dropObject(idx);
|
|
22
|
-
return ret;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
26
|
-
|
|
27
|
-
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
11
|
+
let WASM_VECTOR_LEN = 0;
|
|
28
12
|
|
|
29
13
|
let cachedUint8Memory0 = null;
|
|
30
14
|
|
|
@@ -35,22 +19,6 @@ function getUint8Memory0() {
|
|
|
35
19
|
return cachedUint8Memory0;
|
|
36
20
|
}
|
|
37
21
|
|
|
38
|
-
function getStringFromWasm0(ptr, len) {
|
|
39
|
-
ptr = ptr >>> 0;
|
|
40
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function addHeapObject(obj) {
|
|
44
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
45
|
-
const idx = heap_next;
|
|
46
|
-
heap_next = heap[idx];
|
|
47
|
-
|
|
48
|
-
heap[idx] = obj;
|
|
49
|
-
return idx;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
let WASM_VECTOR_LEN = 0;
|
|
53
|
-
|
|
54
22
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
55
23
|
|
|
56
24
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -116,21 +84,37 @@ function getInt32Memory0() {
|
|
|
116
84
|
}
|
|
117
85
|
return cachedInt32Memory0;
|
|
118
86
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
87
|
+
|
|
88
|
+
let heap_next = heap.length;
|
|
89
|
+
|
|
90
|
+
function dropObject(idx) {
|
|
91
|
+
if (idx < 132) return;
|
|
92
|
+
heap[idx] = heap_next;
|
|
93
|
+
heap_next = idx;
|
|
126
94
|
}
|
|
127
95
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
96
|
+
function takeObject(idx) {
|
|
97
|
+
const ret = getObject(idx);
|
|
98
|
+
dropObject(idx);
|
|
99
|
+
return ret;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
103
|
+
|
|
104
|
+
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
105
|
+
|
|
106
|
+
function getStringFromWasm0(ptr, len) {
|
|
107
|
+
ptr = ptr >>> 0;
|
|
108
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function addHeapObject(obj) {
|
|
112
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
113
|
+
const idx = heap_next;
|
|
114
|
+
heap_next = heap[idx];
|
|
115
|
+
|
|
116
|
+
heap[idx] = obj;
|
|
117
|
+
return idx;
|
|
134
118
|
}
|
|
135
119
|
|
|
136
120
|
function passArray8ToWasm0(arg, malloc) {
|
|
@@ -173,14 +157,46 @@ export function acir_write_bytes(acir) {
|
|
|
173
157
|
}
|
|
174
158
|
|
|
175
159
|
/**
|
|
176
|
-
* @param {
|
|
160
|
+
* @param {string} level
|
|
161
|
+
*/
|
|
162
|
+
export function init_log_level(level) {
|
|
163
|
+
const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
164
|
+
const len0 = WASM_VECTOR_LEN;
|
|
165
|
+
wasm.init_log_level(ptr0, len0);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
177
169
|
* @returns {any}
|
|
178
170
|
*/
|
|
179
|
-
export function
|
|
180
|
-
const ret = wasm.
|
|
171
|
+
export function build_info() {
|
|
172
|
+
const ret = wasm.build_info();
|
|
181
173
|
return takeObject(ret);
|
|
182
174
|
}
|
|
183
175
|
|
|
176
|
+
/**
|
|
177
|
+
* @param {string} entry_point
|
|
178
|
+
* @param {boolean | undefined} contracts
|
|
179
|
+
* @param {string[] | undefined} dependencies
|
|
180
|
+
* @returns {any}
|
|
181
|
+
*/
|
|
182
|
+
export function compile(entry_point, contracts, dependencies) {
|
|
183
|
+
try {
|
|
184
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
185
|
+
const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
186
|
+
const len0 = WASM_VECTOR_LEN;
|
|
187
|
+
wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependencies) ? 0 : addHeapObject(dependencies));
|
|
188
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
189
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
190
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
191
|
+
if (r2) {
|
|
192
|
+
throw takeObject(r1);
|
|
193
|
+
}
|
|
194
|
+
return takeObject(r0);
|
|
195
|
+
} finally {
|
|
196
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
184
200
|
function handleError(f, args) {
|
|
185
201
|
try {
|
|
186
202
|
return f.apply(this, args);
|
|
@@ -188,30 +204,6 @@ function handleError(f, args) {
|
|
|
188
204
|
wasm.__wbindgen_export_3(addHeapObject(e));
|
|
189
205
|
}
|
|
190
206
|
}
|
|
191
|
-
/**
|
|
192
|
-
* A struct representing a Trap
|
|
193
|
-
*/
|
|
194
|
-
export class Trap {
|
|
195
|
-
|
|
196
|
-
__destroy_into_raw() {
|
|
197
|
-
const ptr = this.__wbg_ptr;
|
|
198
|
-
this.__wbg_ptr = 0;
|
|
199
|
-
|
|
200
|
-
return ptr;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
free() {
|
|
204
|
-
const ptr = this.__destroy_into_raw();
|
|
205
|
-
wasm.__wbg_trap_free(ptr);
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* @returns {Symbol}
|
|
209
|
-
*/
|
|
210
|
-
static __wbgd_downcast_token() {
|
|
211
|
-
const ret = wasm.trap___wbgd_downcast_token();
|
|
212
|
-
return takeObject(ret);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
207
|
|
|
216
208
|
async function __wbg_load(module, imports) {
|
|
217
209
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
@@ -247,6 +239,14 @@ async function __wbg_load(module, imports) {
|
|
|
247
239
|
function __wbg_get_imports() {
|
|
248
240
|
const imports = {};
|
|
249
241
|
imports.wbg = {};
|
|
242
|
+
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
243
|
+
const obj = getObject(arg1);
|
|
244
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
245
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
246
|
+
var len1 = WASM_VECTOR_LEN;
|
|
247
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
248
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
249
|
+
};
|
|
250
250
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
251
251
|
takeObject(arg0);
|
|
252
252
|
};
|
|
@@ -254,10 +254,17 @@ function __wbg_get_imports() {
|
|
|
254
254
|
const ret = getObject(arg0) === undefined;
|
|
255
255
|
return ret;
|
|
256
256
|
};
|
|
257
|
-
imports.wbg.
|
|
258
|
-
const ret =
|
|
259
|
-
return ret;
|
|
257
|
+
imports.wbg.__wbg_constructor_ac1f808f67a5f1e9 = function(arg0) {
|
|
258
|
+
const ret = new Error(takeObject(arg0));
|
|
259
|
+
return addHeapObject(ret);
|
|
260
260
|
};
|
|
261
|
+
imports.wbg.__wbg_readfile_0c1777c7c5aa8c92 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
262
|
+
const ret = read_file(getStringFromWasm0(arg1, arg2));
|
|
263
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
264
|
+
const len1 = WASM_VECTOR_LEN;
|
|
265
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
266
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
267
|
+
}, arguments) };
|
|
261
268
|
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
262
269
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
263
270
|
return addHeapObject(ret);
|
|
@@ -284,33 +291,6 @@ function __wbg_get_imports() {
|
|
|
284
291
|
wasm.__wbindgen_export_2(deferred0_0, deferred0_1);
|
|
285
292
|
}
|
|
286
293
|
};
|
|
287
|
-
imports.wbg.__wbg_readfile_8efacfffd6a3a749 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
288
|
-
const ret = read_file(getStringFromWasm0(arg1, arg2));
|
|
289
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
290
|
-
const len1 = WASM_VECTOR_LEN;
|
|
291
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
292
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
293
|
-
}, arguments) };
|
|
294
|
-
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
295
|
-
const ret = getObject(arg0);
|
|
296
|
-
return addHeapObject(ret);
|
|
297
|
-
};
|
|
298
|
-
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
299
|
-
const obj = getObject(arg1);
|
|
300
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
301
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
302
|
-
var len1 = WASM_VECTOR_LEN;
|
|
303
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
304
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
305
|
-
};
|
|
306
|
-
imports.wbg.__wbg_static_accessor_SYMBOL_45d4d15e3c4aeb33 = function() {
|
|
307
|
-
const ret = Symbol;
|
|
308
|
-
return addHeapObject(ret);
|
|
309
|
-
};
|
|
310
|
-
imports.wbg.__wbindgen_is_symbol = function(arg0) {
|
|
311
|
-
const ret = typeof(getObject(arg0)) === 'symbol';
|
|
312
|
-
return ret;
|
|
313
|
-
};
|
|
314
294
|
imports.wbg.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
|
|
315
295
|
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
316
296
|
};
|
|
@@ -329,10 +309,14 @@ function __wbg_get_imports() {
|
|
|
329
309
|
imports.wbg.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
|
|
330
310
|
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
331
311
|
};
|
|
332
|
-
imports.wbg.
|
|
333
|
-
const ret = getObject(arg0)
|
|
312
|
+
imports.wbg.__wbg_get_7303ed2ef026b2f5 = function(arg0, arg1) {
|
|
313
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
334
314
|
return addHeapObject(ret);
|
|
335
|
-
}
|
|
315
|
+
};
|
|
316
|
+
imports.wbg.__wbg_length_820c786973abdd8a = function(arg0) {
|
|
317
|
+
const ret = getObject(arg0).length;
|
|
318
|
+
return ret;
|
|
319
|
+
};
|
|
336
320
|
imports.wbg.__wbg_parse_76a8a18ca3f8730b = function() { return handleError(function (arg0, arg1) {
|
|
337
321
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
338
322
|
return addHeapObject(ret);
|
package/web/noir_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function init_log_level(a: number, b: number): void;
|
|
5
|
-
export function build_info(): number;
|
|
6
4
|
export function acir_read_bytes(a: number, b: number): number;
|
|
7
5
|
export function acir_write_bytes(a: number, b: number): void;
|
|
8
|
-
export function
|
|
9
|
-
export function
|
|
10
|
-
export function
|
|
6
|
+
export function init_log_level(a: number, b: number): void;
|
|
7
|
+
export function build_info(): number;
|
|
8
|
+
export function compile(a: number, b: number, c: number, d: number, e: number): void;
|
|
11
9
|
export function __wbindgen_export_0(a: number): number;
|
|
12
10
|
export function __wbindgen_export_1(a: number, b: number, c: number): number;
|
|
13
11
|
export function __wbindgen_add_to_stack_pointer(a: number): number;
|