@noir-lang/noir_wasm 0.12.0 → 0.16.0-10eae15.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/CHANGELOG.md +24 -0
- package/README.md +2 -2
- package/nodejs/noir_wasm.d.ts +25 -6
- package/nodejs/noir_wasm.js +105 -69
- package/nodejs/noir_wasm_bg.wasm +0 -0
- package/nodejs/noir_wasm_bg.wasm.d.ts +6 -3
- package/package.json +12 -7
- package/web/noir_wasm.d.ts +31 -9
- package/web/noir_wasm.js +99 -62
- package/web/noir_wasm_bg.wasm +0 -0
- package/web/noir_wasm_bg.wasm.d.ts +6 -3
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
|
@@ -19,17 +19,36 @@ export function acir_read_bytes(bytes: Uint8Array): any;
|
|
|
19
19
|
*/
|
|
20
20
|
export function acir_write_bytes(acir: any): Uint8Array;
|
|
21
21
|
/**
|
|
22
|
-
* @param {
|
|
22
|
+
* @param {string} entry_point
|
|
23
|
+
* @param {boolean | undefined} contracts
|
|
24
|
+
* @param {string[] | undefined} dependencies
|
|
23
25
|
* @returns {any}
|
|
24
26
|
*/
|
|
25
|
-
export function compile(
|
|
27
|
+
export function compile(entry_point: string, contracts?: boolean, dependencies?: string[]): any;
|
|
28
|
+
|
|
29
|
+
export type Diagnostic = {
|
|
30
|
+
message: string;
|
|
31
|
+
file_path: string;
|
|
32
|
+
secondaries: ReadonlyArray<{
|
|
33
|
+
message: string;
|
|
34
|
+
start: number;
|
|
35
|
+
end: number;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface CompileError {
|
|
40
|
+
diagnostics: ReadonlyArray<Diagnostic>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
26
44
|
/**
|
|
27
|
-
* A struct representing a Trap
|
|
28
45
|
*/
|
|
29
|
-
export class
|
|
46
|
+
export class CompileError {
|
|
30
47
|
free(): void;
|
|
31
48
|
/**
|
|
32
|
-
* @returns {Symbol}
|
|
33
49
|
*/
|
|
34
|
-
|
|
50
|
+
diagnostics: any;
|
|
51
|
+
/**
|
|
52
|
+
*/
|
|
53
|
+
message: string;
|
|
35
54
|
}
|
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
|
|
|
@@ -24,24 +24,6 @@ function takeObject(idx) {
|
|
|
24
24
|
return ret;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
28
|
-
|
|
29
|
-
cachedTextDecoder.decode();
|
|
30
|
-
|
|
31
|
-
let cachedUint8Memory0 = null;
|
|
32
|
-
|
|
33
|
-
function getUint8Memory0() {
|
|
34
|
-
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
35
|
-
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
36
|
-
}
|
|
37
|
-
return cachedUint8Memory0;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function getStringFromWasm0(ptr, len) {
|
|
41
|
-
ptr = ptr >>> 0;
|
|
42
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
27
|
function addHeapObject(obj) {
|
|
46
28
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
47
29
|
const idx = heap_next;
|
|
@@ -53,6 +35,15 @@ function addHeapObject(obj) {
|
|
|
53
35
|
|
|
54
36
|
let WASM_VECTOR_LEN = 0;
|
|
55
37
|
|
|
38
|
+
let cachedUint8Memory0 = null;
|
|
39
|
+
|
|
40
|
+
function getUint8Memory0() {
|
|
41
|
+
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
42
|
+
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
43
|
+
}
|
|
44
|
+
return cachedUint8Memory0;
|
|
45
|
+
}
|
|
46
|
+
|
|
56
47
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
57
48
|
|
|
58
49
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -118,6 +109,15 @@ function getInt32Memory0() {
|
|
|
118
109
|
}
|
|
119
110
|
return cachedInt32Memory0;
|
|
120
111
|
}
|
|
112
|
+
|
|
113
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
114
|
+
|
|
115
|
+
cachedTextDecoder.decode();
|
|
116
|
+
|
|
117
|
+
function getStringFromWasm0(ptr, len) {
|
|
118
|
+
ptr = ptr >>> 0;
|
|
119
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
120
|
+
}
|
|
121
121
|
/**
|
|
122
122
|
* @param {string} level
|
|
123
123
|
*/
|
|
@@ -175,12 +175,27 @@ module.exports.acir_write_bytes = function(acir) {
|
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
/**
|
|
178
|
-
* @param {
|
|
178
|
+
* @param {string} entry_point
|
|
179
|
+
* @param {boolean | undefined} contracts
|
|
180
|
+
* @param {string[] | undefined} dependencies
|
|
179
181
|
* @returns {any}
|
|
180
182
|
*/
|
|
181
|
-
module.exports.compile = function(
|
|
182
|
-
|
|
183
|
-
|
|
183
|
+
module.exports.compile = function(entry_point, contracts, dependencies) {
|
|
184
|
+
try {
|
|
185
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
186
|
+
const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
187
|
+
const len0 = WASM_VECTOR_LEN;
|
|
188
|
+
wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependencies) ? 0 : addHeapObject(dependencies));
|
|
189
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
190
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
191
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
192
|
+
if (r2) {
|
|
193
|
+
throw takeObject(r1);
|
|
194
|
+
}
|
|
195
|
+
return takeObject(r0);
|
|
196
|
+
} finally {
|
|
197
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
198
|
+
}
|
|
184
199
|
};
|
|
185
200
|
|
|
186
201
|
function handleError(f, args) {
|
|
@@ -191,9 +206,16 @@ function handleError(f, args) {
|
|
|
191
206
|
}
|
|
192
207
|
}
|
|
193
208
|
/**
|
|
194
|
-
* A struct representing a Trap
|
|
195
209
|
*/
|
|
196
|
-
class
|
|
210
|
+
class CompileError {
|
|
211
|
+
|
|
212
|
+
static __wrap(ptr) {
|
|
213
|
+
ptr = ptr >>> 0;
|
|
214
|
+
const obj = Object.create(CompileError.prototype);
|
|
215
|
+
obj.__wbg_ptr = ptr;
|
|
216
|
+
|
|
217
|
+
return obj;
|
|
218
|
+
}
|
|
197
219
|
|
|
198
220
|
__destroy_into_raw() {
|
|
199
221
|
const ptr = this.__wbg_ptr;
|
|
@@ -204,31 +226,72 @@ class Trap {
|
|
|
204
226
|
|
|
205
227
|
free() {
|
|
206
228
|
const ptr = this.__destroy_into_raw();
|
|
207
|
-
wasm.
|
|
229
|
+
wasm.__wbg_compileerror_free(ptr);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* @returns {string}
|
|
233
|
+
*/
|
|
234
|
+
get message() {
|
|
235
|
+
const ret = wasm.__wbg_get_compileerror_message(this.__wbg_ptr);
|
|
236
|
+
return takeObject(ret);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* @param {string} arg0
|
|
240
|
+
*/
|
|
241
|
+
set message(arg0) {
|
|
242
|
+
wasm.__wbg_set_compileerror_message(this.__wbg_ptr, addHeapObject(arg0));
|
|
208
243
|
}
|
|
209
244
|
/**
|
|
210
|
-
* @returns {
|
|
245
|
+
* @returns {any}
|
|
211
246
|
*/
|
|
212
|
-
|
|
213
|
-
const ret = wasm.
|
|
247
|
+
get diagnostics() {
|
|
248
|
+
const ret = wasm.__wbg_get_compileerror_diagnostics(this.__wbg_ptr);
|
|
214
249
|
return takeObject(ret);
|
|
215
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* @param {any} arg0
|
|
253
|
+
*/
|
|
254
|
+
set diagnostics(arg0) {
|
|
255
|
+
wasm.__wbg_set_compileerror_diagnostics(this.__wbg_ptr, addHeapObject(arg0));
|
|
256
|
+
}
|
|
216
257
|
}
|
|
217
|
-
module.exports.
|
|
258
|
+
module.exports.CompileError = CompileError;
|
|
259
|
+
|
|
260
|
+
module.exports.__wbg_compileerror_new = function(arg0) {
|
|
261
|
+
const ret = CompileError.__wrap(arg0);
|
|
262
|
+
return addHeapObject(ret);
|
|
263
|
+
};
|
|
218
264
|
|
|
219
265
|
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
220
266
|
takeObject(arg0);
|
|
221
267
|
};
|
|
222
268
|
|
|
269
|
+
module.exports.__wbindgen_object_clone_ref = function(arg0) {
|
|
270
|
+
const ret = getObject(arg0);
|
|
271
|
+
return addHeapObject(ret);
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
275
|
+
const obj = getObject(arg1);
|
|
276
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
277
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
278
|
+
var len1 = WASM_VECTOR_LEN;
|
|
279
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
280
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
281
|
+
};
|
|
282
|
+
|
|
223
283
|
module.exports.__wbindgen_is_undefined = function(arg0) {
|
|
224
284
|
const ret = getObject(arg0) === undefined;
|
|
225
285
|
return ret;
|
|
226
286
|
};
|
|
227
287
|
|
|
228
|
-
module.exports.
|
|
229
|
-
const ret =
|
|
230
|
-
|
|
231
|
-
|
|
288
|
+
module.exports.__wbg_readfile_0c1777c7c5aa8c92 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
289
|
+
const ret = read_file(getStringFromWasm0(arg1, arg2));
|
|
290
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
291
|
+
const len1 = WASM_VECTOR_LEN;
|
|
292
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
293
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
294
|
+
}, arguments) };
|
|
232
295
|
|
|
233
296
|
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
234
297
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
@@ -260,38 +323,6 @@ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
|
260
323
|
}
|
|
261
324
|
};
|
|
262
325
|
|
|
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
326
|
module.exports.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
|
|
296
327
|
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
297
328
|
};
|
|
@@ -316,10 +347,15 @@ module.exports.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
|
|
|
316
347
|
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
317
348
|
};
|
|
318
349
|
|
|
319
|
-
module.exports.
|
|
320
|
-
const ret = getObject(arg0)
|
|
350
|
+
module.exports.__wbg_get_7303ed2ef026b2f5 = function(arg0, arg1) {
|
|
351
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
321
352
|
return addHeapObject(ret);
|
|
322
|
-
}
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
module.exports.__wbg_length_820c786973abdd8a = function(arg0) {
|
|
356
|
+
const ret = getObject(arg0).length;
|
|
357
|
+
return ret;
|
|
358
|
+
};
|
|
323
359
|
|
|
324
360
|
module.exports.__wbg_parse_76a8a18ca3f8730b = function() { return handleError(function (arg0, arg1) {
|
|
325
361
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
package/nodejs/noir_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export function __wbg_compileerror_free(a: number): void;
|
|
5
|
+
export function __wbg_get_compileerror_message(a: number): number;
|
|
6
|
+
export function __wbg_set_compileerror_message(a: number, b: number): void;
|
|
7
|
+
export function __wbg_get_compileerror_diagnostics(a: number): number;
|
|
8
|
+
export function __wbg_set_compileerror_diagnostics(a: number, b: number): void;
|
|
4
9
|
export function init_log_level(a: number, b: number): void;
|
|
5
10
|
export function build_info(): number;
|
|
6
11
|
export function acir_read_bytes(a: number, b: number): number;
|
|
7
12
|
export function acir_write_bytes(a: number, b: number): void;
|
|
8
|
-
export function compile(a: number):
|
|
9
|
-
export function __wbg_trap_free(a: number): void;
|
|
10
|
-
export function trap___wbgd_downcast_token(): number;
|
|
13
|
+
export function compile(a: number, b: number, c: number, d: number, e: number): void;
|
|
11
14
|
export function __wbindgen_export_0(a: number): number;
|
|
12
15
|
export function __wbindgen_export_1(a: number, b: number, c: number): number;
|
|
13
16
|
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-10eae15.nightly",
|
|
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,24 @@
|
|
|
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)$1\" '.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",
|
|
30
|
+
"build:nix": "nix build -L .#noir_wasm",
|
|
31
|
+
"install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/noir_wasm/nodejs ./ && cp -rL ./result/noir_wasm/web ./"
|
|
26
32
|
},
|
|
27
33
|
"peerDependencies": {
|
|
28
|
-
"@noir-lang/source-resolver": "
|
|
34
|
+
"@noir-lang/source-resolver": "0.16.0-10eae15.nightly"
|
|
29
35
|
},
|
|
30
36
|
"devDependencies": {
|
|
31
37
|
"@esm-bundle/chai": "^4.3.4-fix.0",
|
|
32
38
|
"@web/dev-server-esbuild": "^0.3.6",
|
|
33
39
|
"@web/test-runner": "^0.15.3",
|
|
34
40
|
"@web/test-runner-playwright": "^0.10.0",
|
|
35
|
-
"@web/test-runner-webdriver": "^0.7.0",
|
|
36
41
|
"mocha": "^10.2.0"
|
|
37
42
|
}
|
|
38
|
-
}
|
|
43
|
+
}
|
package/web/noir_wasm.d.ts
CHANGED
|
@@ -19,32 +19,54 @@ export function acir_read_bytes(bytes: Uint8Array): any;
|
|
|
19
19
|
*/
|
|
20
20
|
export function acir_write_bytes(acir: any): Uint8Array;
|
|
21
21
|
/**
|
|
22
|
-
* @param {
|
|
22
|
+
* @param {string} entry_point
|
|
23
|
+
* @param {boolean | undefined} contracts
|
|
24
|
+
* @param {string[] | undefined} dependencies
|
|
23
25
|
* @returns {any}
|
|
24
26
|
*/
|
|
25
|
-
export function compile(
|
|
27
|
+
export function compile(entry_point: string, contracts?: boolean, dependencies?: string[]): any;
|
|
28
|
+
|
|
29
|
+
export type Diagnostic = {
|
|
30
|
+
message: string;
|
|
31
|
+
file_path: string;
|
|
32
|
+
secondaries: ReadonlyArray<{
|
|
33
|
+
message: string;
|
|
34
|
+
start: number;
|
|
35
|
+
end: number;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface CompileError {
|
|
40
|
+
diagnostics: ReadonlyArray<Diagnostic>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
26
44
|
/**
|
|
27
|
-
* A struct representing a Trap
|
|
28
45
|
*/
|
|
29
|
-
export class
|
|
46
|
+
export class CompileError {
|
|
30
47
|
free(): void;
|
|
31
48
|
/**
|
|
32
|
-
* @returns {Symbol}
|
|
33
49
|
*/
|
|
34
|
-
|
|
50
|
+
diagnostics: any;
|
|
51
|
+
/**
|
|
52
|
+
*/
|
|
53
|
+
message: string;
|
|
35
54
|
}
|
|
36
55
|
|
|
37
56
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
38
57
|
|
|
39
58
|
export interface InitOutput {
|
|
40
59
|
readonly memory: WebAssembly.Memory;
|
|
60
|
+
readonly __wbg_compileerror_free: (a: number) => void;
|
|
61
|
+
readonly __wbg_get_compileerror_message: (a: number) => number;
|
|
62
|
+
readonly __wbg_set_compileerror_message: (a: number, b: number) => void;
|
|
63
|
+
readonly __wbg_get_compileerror_diagnostics: (a: number) => number;
|
|
64
|
+
readonly __wbg_set_compileerror_diagnostics: (a: number, b: number) => void;
|
|
41
65
|
readonly init_log_level: (a: number, b: number) => void;
|
|
42
66
|
readonly build_info: () => number;
|
|
43
67
|
readonly acir_read_bytes: (a: number, b: number) => number;
|
|
44
68
|
readonly acir_write_bytes: (a: number, b: number) => void;
|
|
45
|
-
readonly compile: (a: number) =>
|
|
46
|
-
readonly __wbg_trap_free: (a: number) => void;
|
|
47
|
-
readonly trap___wbgd_downcast_token: () => number;
|
|
69
|
+
readonly compile: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
48
70
|
readonly __wbindgen_export_0: (a: number) => number;
|
|
49
71
|
readonly __wbindgen_export_1: (a: number, b: number, c: number) => number;
|
|
50
72
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
package/web/noir_wasm.js
CHANGED
|
@@ -22,24 +22,6 @@ function takeObject(idx) {
|
|
|
22
22
|
return ret;
|
|
23
23
|
}
|
|
24
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(); };
|
|
28
|
-
|
|
29
|
-
let cachedUint8Memory0 = null;
|
|
30
|
-
|
|
31
|
-
function getUint8Memory0() {
|
|
32
|
-
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
33
|
-
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
34
|
-
}
|
|
35
|
-
return cachedUint8Memory0;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function getStringFromWasm0(ptr, len) {
|
|
39
|
-
ptr = ptr >>> 0;
|
|
40
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
25
|
function addHeapObject(obj) {
|
|
44
26
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
45
27
|
const idx = heap_next;
|
|
@@ -51,6 +33,15 @@ function addHeapObject(obj) {
|
|
|
51
33
|
|
|
52
34
|
let WASM_VECTOR_LEN = 0;
|
|
53
35
|
|
|
36
|
+
let cachedUint8Memory0 = null;
|
|
37
|
+
|
|
38
|
+
function getUint8Memory0() {
|
|
39
|
+
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
40
|
+
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
41
|
+
}
|
|
42
|
+
return cachedUint8Memory0;
|
|
43
|
+
}
|
|
44
|
+
|
|
54
45
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
55
46
|
|
|
56
47
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -116,6 +107,15 @@ function getInt32Memory0() {
|
|
|
116
107
|
}
|
|
117
108
|
return cachedInt32Memory0;
|
|
118
109
|
}
|
|
110
|
+
|
|
111
|
+
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
112
|
+
|
|
113
|
+
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
114
|
+
|
|
115
|
+
function getStringFromWasm0(ptr, len) {
|
|
116
|
+
ptr = ptr >>> 0;
|
|
117
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
118
|
+
}
|
|
119
119
|
/**
|
|
120
120
|
* @param {string} level
|
|
121
121
|
*/
|
|
@@ -173,12 +173,27 @@ export function acir_write_bytes(acir) {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
|
-
* @param {
|
|
176
|
+
* @param {string} entry_point
|
|
177
|
+
* @param {boolean | undefined} contracts
|
|
178
|
+
* @param {string[] | undefined} dependencies
|
|
177
179
|
* @returns {any}
|
|
178
180
|
*/
|
|
179
|
-
export function compile(
|
|
180
|
-
|
|
181
|
-
|
|
181
|
+
export function compile(entry_point, contracts, dependencies) {
|
|
182
|
+
try {
|
|
183
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
184
|
+
const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
185
|
+
const len0 = WASM_VECTOR_LEN;
|
|
186
|
+
wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependencies) ? 0 : addHeapObject(dependencies));
|
|
187
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
188
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
189
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
190
|
+
if (r2) {
|
|
191
|
+
throw takeObject(r1);
|
|
192
|
+
}
|
|
193
|
+
return takeObject(r0);
|
|
194
|
+
} finally {
|
|
195
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
196
|
+
}
|
|
182
197
|
}
|
|
183
198
|
|
|
184
199
|
function handleError(f, args) {
|
|
@@ -189,9 +204,16 @@ function handleError(f, args) {
|
|
|
189
204
|
}
|
|
190
205
|
}
|
|
191
206
|
/**
|
|
192
|
-
* A struct representing a Trap
|
|
193
207
|
*/
|
|
194
|
-
export class
|
|
208
|
+
export class CompileError {
|
|
209
|
+
|
|
210
|
+
static __wrap(ptr) {
|
|
211
|
+
ptr = ptr >>> 0;
|
|
212
|
+
const obj = Object.create(CompileError.prototype);
|
|
213
|
+
obj.__wbg_ptr = ptr;
|
|
214
|
+
|
|
215
|
+
return obj;
|
|
216
|
+
}
|
|
195
217
|
|
|
196
218
|
__destroy_into_raw() {
|
|
197
219
|
const ptr = this.__wbg_ptr;
|
|
@@ -202,15 +224,34 @@ export class Trap {
|
|
|
202
224
|
|
|
203
225
|
free() {
|
|
204
226
|
const ptr = this.__destroy_into_raw();
|
|
205
|
-
wasm.
|
|
227
|
+
wasm.__wbg_compileerror_free(ptr);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* @returns {string}
|
|
231
|
+
*/
|
|
232
|
+
get message() {
|
|
233
|
+
const ret = wasm.__wbg_get_compileerror_message(this.__wbg_ptr);
|
|
234
|
+
return takeObject(ret);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* @param {string} arg0
|
|
238
|
+
*/
|
|
239
|
+
set message(arg0) {
|
|
240
|
+
wasm.__wbg_set_compileerror_message(this.__wbg_ptr, addHeapObject(arg0));
|
|
206
241
|
}
|
|
207
242
|
/**
|
|
208
|
-
* @returns {
|
|
243
|
+
* @returns {any}
|
|
209
244
|
*/
|
|
210
|
-
|
|
211
|
-
const ret = wasm.
|
|
245
|
+
get diagnostics() {
|
|
246
|
+
const ret = wasm.__wbg_get_compileerror_diagnostics(this.__wbg_ptr);
|
|
212
247
|
return takeObject(ret);
|
|
213
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* @param {any} arg0
|
|
251
|
+
*/
|
|
252
|
+
set diagnostics(arg0) {
|
|
253
|
+
wasm.__wbg_set_compileerror_diagnostics(this.__wbg_ptr, addHeapObject(arg0));
|
|
254
|
+
}
|
|
214
255
|
}
|
|
215
256
|
|
|
216
257
|
async function __wbg_load(module, imports) {
|
|
@@ -247,17 +288,36 @@ async function __wbg_load(module, imports) {
|
|
|
247
288
|
function __wbg_get_imports() {
|
|
248
289
|
const imports = {};
|
|
249
290
|
imports.wbg = {};
|
|
291
|
+
imports.wbg.__wbg_compileerror_new = function(arg0) {
|
|
292
|
+
const ret = CompileError.__wrap(arg0);
|
|
293
|
+
return addHeapObject(ret);
|
|
294
|
+
};
|
|
250
295
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
251
296
|
takeObject(arg0);
|
|
252
297
|
};
|
|
298
|
+
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
299
|
+
const ret = getObject(arg0);
|
|
300
|
+
return addHeapObject(ret);
|
|
301
|
+
};
|
|
302
|
+
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
303
|
+
const obj = getObject(arg1);
|
|
304
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
305
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
306
|
+
var len1 = WASM_VECTOR_LEN;
|
|
307
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
308
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
309
|
+
};
|
|
253
310
|
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
254
311
|
const ret = getObject(arg0) === undefined;
|
|
255
312
|
return ret;
|
|
256
313
|
};
|
|
257
|
-
imports.wbg.
|
|
258
|
-
const ret =
|
|
259
|
-
|
|
260
|
-
|
|
314
|
+
imports.wbg.__wbg_readfile_0c1777c7c5aa8c92 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
315
|
+
const ret = read_file(getStringFromWasm0(arg1, arg2));
|
|
316
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
317
|
+
const len1 = WASM_VECTOR_LEN;
|
|
318
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
319
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
320
|
+
}, arguments) };
|
|
261
321
|
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
262
322
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
263
323
|
return addHeapObject(ret);
|
|
@@ -284,33 +344,6 @@ function __wbg_get_imports() {
|
|
|
284
344
|
wasm.__wbindgen_export_2(deferred0_0, deferred0_1);
|
|
285
345
|
}
|
|
286
346
|
};
|
|
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
347
|
imports.wbg.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
|
|
315
348
|
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
316
349
|
};
|
|
@@ -329,10 +362,14 @@ function __wbg_get_imports() {
|
|
|
329
362
|
imports.wbg.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
|
|
330
363
|
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
331
364
|
};
|
|
332
|
-
imports.wbg.
|
|
333
|
-
const ret = getObject(arg0)
|
|
365
|
+
imports.wbg.__wbg_get_7303ed2ef026b2f5 = function(arg0, arg1) {
|
|
366
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
334
367
|
return addHeapObject(ret);
|
|
335
|
-
}
|
|
368
|
+
};
|
|
369
|
+
imports.wbg.__wbg_length_820c786973abdd8a = function(arg0) {
|
|
370
|
+
const ret = getObject(arg0).length;
|
|
371
|
+
return ret;
|
|
372
|
+
};
|
|
336
373
|
imports.wbg.__wbg_parse_76a8a18ca3f8730b = function() { return handleError(function (arg0, arg1) {
|
|
337
374
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
338
375
|
return addHeapObject(ret);
|
package/web/noir_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export function __wbg_compileerror_free(a: number): void;
|
|
5
|
+
export function __wbg_get_compileerror_message(a: number): number;
|
|
6
|
+
export function __wbg_set_compileerror_message(a: number, b: number): void;
|
|
7
|
+
export function __wbg_get_compileerror_diagnostics(a: number): number;
|
|
8
|
+
export function __wbg_set_compileerror_diagnostics(a: number, b: number): void;
|
|
4
9
|
export function init_log_level(a: number, b: number): void;
|
|
5
10
|
export function build_info(): number;
|
|
6
11
|
export function acir_read_bytes(a: number, b: number): number;
|
|
7
12
|
export function acir_write_bytes(a: number, b: number): void;
|
|
8
|
-
export function compile(a: number):
|
|
9
|
-
export function __wbg_trap_free(a: number): void;
|
|
10
|
-
export function trap___wbgd_downcast_token(): number;
|
|
13
|
+
export function compile(a: number, b: number, c: number, d: number, e: number): void;
|
|
11
14
|
export function __wbindgen_export_0(a: number): number;
|
|
12
15
|
export function __wbindgen_export_1(a: number, b: number, c: number): number;
|
|
13
16
|
export function __wbindgen_add_to_stack_pointer(a: number): number;
|