@noir-lang/noir_wasm 0.10.0 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -0
- package/nodejs/noir_wasm.d.ts +25 -0
- package/nodejs/noir_wasm.js +300 -0
- package/nodejs/noir_wasm_bg.wasm +0 -0
- package/{noir_wasm_bg.wasm.d.ts → nodejs/noir_wasm_bg.wasm.d.ts} +5 -3
- package/package.json +36 -9
- package/web/noir_wasm.d.ts +66 -0
- package/web/noir_wasm.js +361 -0
- package/web/noir_wasm_bg.wasm +0 -0
- package/web/noir_wasm_bg.wasm.d.ts +17 -0
- package/noir_wasm.d.ts +0 -17
- package/noir_wasm.js +0 -359
- package/noir_wasm_bg.wasm +0 -0
- package/snippets/fm-cffb18dcbd478425/file_reader.js +0 -6
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Noir Lang WASM JavaScript Package
|
|
2
|
+
|
|
3
|
+
This JavaScript package enables users to compile a Noir program, i.e. generating its artifacts.
|
|
4
|
+
|
|
5
|
+
The package also handles dependency management like how Nargo (Noir's CLI tool) operates, but the package is used just for compilation, not proving, verifying and simulating functions.
|
|
6
|
+
|
|
7
|
+
## Building from source
|
|
8
|
+
|
|
9
|
+
Outside of the [noir repo](https://github.com/noir-lang/noir), this package can be built using the command below:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
nix build -L github:noir-lang/noir/master#wasm
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
If you are within the noir repo and would like to build local changes, you can use:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
nix build -L #wasm
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Tracking
|
|
22
|
+
Built from [noir-lang/noir@2db759f43971c57e2f1f8284c82943e31a555d0c](https://github.com/noir-lang/noir/tree/2db759f43971c57e2f1f8284c82943e31a555d0c)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
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
|
+
* @param {Uint8Array} bytes
|
|
13
|
+
* @returns {any}
|
|
14
|
+
*/
|
|
15
|
+
export function acir_read_bytes(bytes: Uint8Array): any;
|
|
16
|
+
/**
|
|
17
|
+
* @param {any} acir
|
|
18
|
+
* @returns {Uint8Array}
|
|
19
|
+
*/
|
|
20
|
+
export function acir_write_bytes(acir: any): Uint8Array;
|
|
21
|
+
/**
|
|
22
|
+
* @param {any} args
|
|
23
|
+
* @returns {any}
|
|
24
|
+
*/
|
|
25
|
+
export function compile(args: any): any;
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
let imports = {};
|
|
2
|
+
imports['__wbindgen_placeholder__'] = module.exports;
|
|
3
|
+
let wasm;
|
|
4
|
+
const { read_file } = require(`@noir-lang/noir-source-resolver`);
|
|
5
|
+
const { TextDecoder, TextEncoder } = require(`util`);
|
|
6
|
+
|
|
7
|
+
const heap = new Array(128).fill(undefined);
|
|
8
|
+
|
|
9
|
+
heap.push(undefined, null, true, false);
|
|
10
|
+
|
|
11
|
+
function getObject(idx) { return heap[idx]; }
|
|
12
|
+
|
|
13
|
+
let heap_next = heap.length;
|
|
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();
|
|
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
|
+
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
|
+
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
57
|
+
|
|
58
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
59
|
+
? function (arg, view) {
|
|
60
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
61
|
+
}
|
|
62
|
+
: function (arg, view) {
|
|
63
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
64
|
+
view.set(buf);
|
|
65
|
+
return {
|
|
66
|
+
read: arg.length,
|
|
67
|
+
written: buf.length
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
72
|
+
|
|
73
|
+
if (realloc === undefined) {
|
|
74
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
75
|
+
const ptr = malloc(buf.length) >>> 0;
|
|
76
|
+
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
77
|
+
WASM_VECTOR_LEN = buf.length;
|
|
78
|
+
return ptr;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
let len = arg.length;
|
|
82
|
+
let ptr = malloc(len) >>> 0;
|
|
83
|
+
|
|
84
|
+
const mem = getUint8Memory0();
|
|
85
|
+
|
|
86
|
+
let offset = 0;
|
|
87
|
+
|
|
88
|
+
for (; offset < len; offset++) {
|
|
89
|
+
const code = arg.charCodeAt(offset);
|
|
90
|
+
if (code > 0x7F) break;
|
|
91
|
+
mem[ptr + offset] = code;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (offset !== len) {
|
|
95
|
+
if (offset !== 0) {
|
|
96
|
+
arg = arg.slice(offset);
|
|
97
|
+
}
|
|
98
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0;
|
|
99
|
+
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
100
|
+
const ret = encodeString(arg, view);
|
|
101
|
+
|
|
102
|
+
offset += ret.written;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
WASM_VECTOR_LEN = offset;
|
|
106
|
+
return ptr;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function isLikeNone(x) {
|
|
110
|
+
return x === undefined || x === null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
let cachedInt32Memory0 = null;
|
|
114
|
+
|
|
115
|
+
function getInt32Memory0() {
|
|
116
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
117
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
118
|
+
}
|
|
119
|
+
return cachedInt32Memory0;
|
|
120
|
+
}
|
|
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
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @returns {any}
|
|
132
|
+
*/
|
|
133
|
+
module.exports.build_info = function() {
|
|
134
|
+
const ret = wasm.build_info();
|
|
135
|
+
return takeObject(ret);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
139
|
+
const ptr = malloc(arg.length * 1) >>> 0;
|
|
140
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
141
|
+
WASM_VECTOR_LEN = arg.length;
|
|
142
|
+
return ptr;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* @param {Uint8Array} bytes
|
|
146
|
+
* @returns {any}
|
|
147
|
+
*/
|
|
148
|
+
module.exports.acir_read_bytes = function(bytes) {
|
|
149
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_0);
|
|
150
|
+
const len0 = WASM_VECTOR_LEN;
|
|
151
|
+
const ret = wasm.acir_read_bytes(ptr0, len0);
|
|
152
|
+
return takeObject(ret);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
156
|
+
ptr = ptr >>> 0;
|
|
157
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* @param {any} acir
|
|
161
|
+
* @returns {Uint8Array}
|
|
162
|
+
*/
|
|
163
|
+
module.exports.acir_write_bytes = function(acir) {
|
|
164
|
+
try {
|
|
165
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
166
|
+
wasm.acir_write_bytes(retptr, addHeapObject(acir));
|
|
167
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
168
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
169
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
170
|
+
wasm.__wbindgen_export_2(r0, r1 * 1);
|
|
171
|
+
return v1;
|
|
172
|
+
} finally {
|
|
173
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @param {any} args
|
|
179
|
+
* @returns {any}
|
|
180
|
+
*/
|
|
181
|
+
module.exports.compile = function(args) {
|
|
182
|
+
const ret = wasm.compile(addHeapObject(args));
|
|
183
|
+
return takeObject(ret);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
function handleError(f, args) {
|
|
187
|
+
try {
|
|
188
|
+
return f.apply(this, args);
|
|
189
|
+
} catch (e) {
|
|
190
|
+
wasm.__wbindgen_export_3(addHeapObject(e));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
195
|
+
takeObject(arg0);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
module.exports.__wbindgen_is_undefined = function(arg0) {
|
|
199
|
+
const ret = getObject(arg0) === undefined;
|
|
200
|
+
return ret;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
module.exports.__wbindgen_is_null = function(arg0) {
|
|
204
|
+
const ret = getObject(arg0) === null;
|
|
205
|
+
return ret;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
209
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
210
|
+
return addHeapObject(ret);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
module.exports.__wbg_new_abda76e883ba8a5f = function() {
|
|
214
|
+
const ret = new Error();
|
|
215
|
+
return addHeapObject(ret);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
module.exports.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
|
|
219
|
+
const ret = getObject(arg1).stack;
|
|
220
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
221
|
+
const len1 = WASM_VECTOR_LEN;
|
|
222
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
223
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
227
|
+
let deferred0_0;
|
|
228
|
+
let deferred0_1;
|
|
229
|
+
try {
|
|
230
|
+
deferred0_0 = arg0;
|
|
231
|
+
deferred0_1 = arg1;
|
|
232
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
233
|
+
} finally {
|
|
234
|
+
wasm.__wbindgen_export_2(deferred0_0, deferred0_1);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
module.exports.__wbg_readfile_6641677e84090077 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
239
|
+
const ret = read_file(getStringFromWasm0(arg1, arg2));
|
|
240
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
241
|
+
const len1 = WASM_VECTOR_LEN;
|
|
242
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
243
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
244
|
+
}, arguments) };
|
|
245
|
+
|
|
246
|
+
module.exports.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
|
|
247
|
+
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
module.exports.__wbg_error_a7e23606158b68b9 = function(arg0) {
|
|
251
|
+
console.error(getObject(arg0));
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
module.exports.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) {
|
|
255
|
+
console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
module.exports.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) {
|
|
259
|
+
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
module.exports.__wbg_log_9b164efbe6db702f = function(arg0, arg1, arg2, arg3) {
|
|
263
|
+
console.log(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
module.exports.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
|
|
267
|
+
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
271
|
+
const obj = getObject(arg1);
|
|
272
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
273
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
274
|
+
var len1 = WASM_VECTOR_LEN;
|
|
275
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
276
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
module.exports.__wbg_parse_76a8a18ca3f8730b = function() { return handleError(function (arg0, arg1) {
|
|
280
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
281
|
+
return addHeapObject(ret);
|
|
282
|
+
}, arguments) };
|
|
283
|
+
|
|
284
|
+
module.exports.__wbg_stringify_d06ad2addc54d51e = function() { return handleError(function (arg0) {
|
|
285
|
+
const ret = JSON.stringify(getObject(arg0));
|
|
286
|
+
return addHeapObject(ret);
|
|
287
|
+
}, arguments) };
|
|
288
|
+
|
|
289
|
+
module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
290
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
const path = require('path').join(__dirname, 'noir_wasm_bg.wasm');
|
|
294
|
+
const bytes = require('fs').readFileSync(path);
|
|
295
|
+
|
|
296
|
+
const wasmModule = new WebAssembly.Module(bytes);
|
|
297
|
+
const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
298
|
+
wasm = wasmInstance.exports;
|
|
299
|
+
module.exports.__wasm = wasm;
|
|
300
|
+
|
|
Binary file
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function
|
|
5
|
-
export function
|
|
6
|
-
export function
|
|
4
|
+
export function init_log_level(a: number, b: number): void;
|
|
5
|
+
export function build_info(): number;
|
|
6
|
+
export function acir_read_bytes(a: number, b: number): number;
|
|
7
|
+
export function acir_write_bytes(a: number, b: number): void;
|
|
8
|
+
export function compile(a: number): number;
|
|
7
9
|
export function rust_psm_on_stack(a: number, b: number, c: number, d: number): void;
|
|
8
10
|
export function rust_psm_stack_direction(): number;
|
|
9
11
|
export function rust_psm_stack_pointer(): number;
|
package/package.json
CHANGED
|
@@ -1,13 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noir-lang/noir_wasm",
|
|
3
|
-
"
|
|
3
|
+
"collaborators": [
|
|
4
|
+
"The Noir Team <team@noir-lang.org>"
|
|
5
|
+
],
|
|
6
|
+
"version": "0.10.3",
|
|
7
|
+
"license": "(MIT OR Apache-2.0)",
|
|
8
|
+
"main": "./nodejs/noir_wasm.js",
|
|
9
|
+
"types": "./web/noir_wasm.d.ts",
|
|
10
|
+
"module": "./web/noir_wasm.js",
|
|
4
11
|
"files": [
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"noir_wasm.d.ts",
|
|
9
|
-
"snippets/*"
|
|
12
|
+
"nodejs",
|
|
13
|
+
"web",
|
|
14
|
+
"package.json"
|
|
10
15
|
],
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"packageManager": "yarn@3.5.1",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/noir-lang/noir_wasm.git"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
|
|
24
|
+
"test:browser": "web-test-runner"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@noir-lang/noir-source-resolver": "1.1.2"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@esm-bundle/chai": "^4.3.4-fix.0",
|
|
31
|
+
"@noir-lang/noir-source-resolver": "1.1.2",
|
|
32
|
+
"@web/dev-server-esbuild": "^0.3.6",
|
|
33
|
+
"@web/test-runner": "^0.15.3",
|
|
34
|
+
"@web/test-runner-playwright": "^0.10.0",
|
|
35
|
+
"chai": "^4.3.7",
|
|
36
|
+
"mocha": "^10.2.0",
|
|
37
|
+
"ts-node": "^10.9.1",
|
|
38
|
+
"typescript": "^5.0.4"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
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
|
+
* @param {Uint8Array} bytes
|
|
13
|
+
* @returns {any}
|
|
14
|
+
*/
|
|
15
|
+
export function acir_read_bytes(bytes: Uint8Array): any;
|
|
16
|
+
/**
|
|
17
|
+
* @param {any} acir
|
|
18
|
+
* @returns {Uint8Array}
|
|
19
|
+
*/
|
|
20
|
+
export function acir_write_bytes(acir: any): Uint8Array;
|
|
21
|
+
/**
|
|
22
|
+
* @param {any} args
|
|
23
|
+
* @returns {any}
|
|
24
|
+
*/
|
|
25
|
+
export function compile(args: any): any;
|
|
26
|
+
|
|
27
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
28
|
+
|
|
29
|
+
export interface InitOutput {
|
|
30
|
+
readonly memory: WebAssembly.Memory;
|
|
31
|
+
readonly init_log_level: (a: number, b: number) => void;
|
|
32
|
+
readonly build_info: () => number;
|
|
33
|
+
readonly acir_read_bytes: (a: number, b: number) => number;
|
|
34
|
+
readonly acir_write_bytes: (a: number, b: number) => void;
|
|
35
|
+
readonly compile: (a: number) => number;
|
|
36
|
+
readonly rust_psm_on_stack: (a: number, b: number, c: number, d: number) => void;
|
|
37
|
+
readonly rust_psm_stack_direction: () => number;
|
|
38
|
+
readonly rust_psm_stack_pointer: () => number;
|
|
39
|
+
readonly rust_psm_replace_stack: (a: number, b: number, c: number) => void;
|
|
40
|
+
readonly __wbindgen_export_0: (a: number) => number;
|
|
41
|
+
readonly __wbindgen_export_1: (a: number, b: number, c: number) => number;
|
|
42
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
43
|
+
readonly __wbindgen_export_2: (a: number, b: number) => void;
|
|
44
|
+
readonly __wbindgen_export_3: (a: number) => void;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
48
|
+
/**
|
|
49
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
50
|
+
* a precompiled `WebAssembly.Module`.
|
|
51
|
+
*
|
|
52
|
+
* @param {SyncInitInput} module
|
|
53
|
+
*
|
|
54
|
+
* @returns {InitOutput}
|
|
55
|
+
*/
|
|
56
|
+
export function initSync(module: SyncInitInput): InitOutput;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
60
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
61
|
+
*
|
|
62
|
+
* @param {InitInput | Promise<InitInput>} module_or_path
|
|
63
|
+
*
|
|
64
|
+
* @returns {Promise<InitOutput>}
|
|
65
|
+
*/
|
|
66
|
+
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/web/noir_wasm.js
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import { read_file } from '@noir-lang/noir-source-resolver';
|
|
2
|
+
|
|
3
|
+
let wasm;
|
|
4
|
+
|
|
5
|
+
const heap = new Array(128).fill(undefined);
|
|
6
|
+
|
|
7
|
+
heap.push(undefined, null, true, false);
|
|
8
|
+
|
|
9
|
+
function getObject(idx) { return heap[idx]; }
|
|
10
|
+
|
|
11
|
+
let heap_next = heap.length;
|
|
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(); };
|
|
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
|
+
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
|
+
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
55
|
+
|
|
56
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
57
|
+
? function (arg, view) {
|
|
58
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
59
|
+
}
|
|
60
|
+
: function (arg, view) {
|
|
61
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
62
|
+
view.set(buf);
|
|
63
|
+
return {
|
|
64
|
+
read: arg.length,
|
|
65
|
+
written: buf.length
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
70
|
+
|
|
71
|
+
if (realloc === undefined) {
|
|
72
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
73
|
+
const ptr = malloc(buf.length) >>> 0;
|
|
74
|
+
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
75
|
+
WASM_VECTOR_LEN = buf.length;
|
|
76
|
+
return ptr;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let len = arg.length;
|
|
80
|
+
let ptr = malloc(len) >>> 0;
|
|
81
|
+
|
|
82
|
+
const mem = getUint8Memory0();
|
|
83
|
+
|
|
84
|
+
let offset = 0;
|
|
85
|
+
|
|
86
|
+
for (; offset < len; offset++) {
|
|
87
|
+
const code = arg.charCodeAt(offset);
|
|
88
|
+
if (code > 0x7F) break;
|
|
89
|
+
mem[ptr + offset] = code;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (offset !== len) {
|
|
93
|
+
if (offset !== 0) {
|
|
94
|
+
arg = arg.slice(offset);
|
|
95
|
+
}
|
|
96
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0;
|
|
97
|
+
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
98
|
+
const ret = encodeString(arg, view);
|
|
99
|
+
|
|
100
|
+
offset += ret.written;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
WASM_VECTOR_LEN = offset;
|
|
104
|
+
return ptr;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function isLikeNone(x) {
|
|
108
|
+
return x === undefined || x === null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
let cachedInt32Memory0 = null;
|
|
112
|
+
|
|
113
|
+
function getInt32Memory0() {
|
|
114
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
115
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
116
|
+
}
|
|
117
|
+
return cachedInt32Memory0;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @param {string} level
|
|
121
|
+
*/
|
|
122
|
+
export function init_log_level(level) {
|
|
123
|
+
const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
124
|
+
const len0 = WASM_VECTOR_LEN;
|
|
125
|
+
wasm.init_log_level(ptr0, len0);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @returns {any}
|
|
130
|
+
*/
|
|
131
|
+
export function build_info() {
|
|
132
|
+
const ret = wasm.build_info();
|
|
133
|
+
return takeObject(ret);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
137
|
+
const ptr = malloc(arg.length * 1) >>> 0;
|
|
138
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
139
|
+
WASM_VECTOR_LEN = arg.length;
|
|
140
|
+
return ptr;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* @param {Uint8Array} bytes
|
|
144
|
+
* @returns {any}
|
|
145
|
+
*/
|
|
146
|
+
export function acir_read_bytes(bytes) {
|
|
147
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_0);
|
|
148
|
+
const len0 = WASM_VECTOR_LEN;
|
|
149
|
+
const ret = wasm.acir_read_bytes(ptr0, len0);
|
|
150
|
+
return takeObject(ret);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
154
|
+
ptr = ptr >>> 0;
|
|
155
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* @param {any} acir
|
|
159
|
+
* @returns {Uint8Array}
|
|
160
|
+
*/
|
|
161
|
+
export function acir_write_bytes(acir) {
|
|
162
|
+
try {
|
|
163
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
164
|
+
wasm.acir_write_bytes(retptr, addHeapObject(acir));
|
|
165
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
166
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
167
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
168
|
+
wasm.__wbindgen_export_2(r0, r1 * 1);
|
|
169
|
+
return v1;
|
|
170
|
+
} finally {
|
|
171
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @param {any} args
|
|
177
|
+
* @returns {any}
|
|
178
|
+
*/
|
|
179
|
+
export function compile(args) {
|
|
180
|
+
const ret = wasm.compile(addHeapObject(args));
|
|
181
|
+
return takeObject(ret);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function handleError(f, args) {
|
|
185
|
+
try {
|
|
186
|
+
return f.apply(this, args);
|
|
187
|
+
} catch (e) {
|
|
188
|
+
wasm.__wbindgen_export_3(addHeapObject(e));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
async function __wbg_load(module, imports) {
|
|
193
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
194
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
195
|
+
try {
|
|
196
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
197
|
+
|
|
198
|
+
} catch (e) {
|
|
199
|
+
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
200
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
201
|
+
|
|
202
|
+
} else {
|
|
203
|
+
throw e;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const bytes = await module.arrayBuffer();
|
|
209
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
210
|
+
|
|
211
|
+
} else {
|
|
212
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
213
|
+
|
|
214
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
215
|
+
return { instance, module };
|
|
216
|
+
|
|
217
|
+
} else {
|
|
218
|
+
return instance;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function __wbg_get_imports() {
|
|
224
|
+
const imports = {};
|
|
225
|
+
imports.wbg = {};
|
|
226
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
227
|
+
takeObject(arg0);
|
|
228
|
+
};
|
|
229
|
+
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
230
|
+
const ret = getObject(arg0) === undefined;
|
|
231
|
+
return ret;
|
|
232
|
+
};
|
|
233
|
+
imports.wbg.__wbindgen_is_null = function(arg0) {
|
|
234
|
+
const ret = getObject(arg0) === null;
|
|
235
|
+
return ret;
|
|
236
|
+
};
|
|
237
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
238
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
239
|
+
return addHeapObject(ret);
|
|
240
|
+
};
|
|
241
|
+
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
|
242
|
+
const ret = new Error();
|
|
243
|
+
return addHeapObject(ret);
|
|
244
|
+
};
|
|
245
|
+
imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
|
|
246
|
+
const ret = getObject(arg1).stack;
|
|
247
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
248
|
+
const len1 = WASM_VECTOR_LEN;
|
|
249
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
250
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
251
|
+
};
|
|
252
|
+
imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
253
|
+
let deferred0_0;
|
|
254
|
+
let deferred0_1;
|
|
255
|
+
try {
|
|
256
|
+
deferred0_0 = arg0;
|
|
257
|
+
deferred0_1 = arg1;
|
|
258
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
259
|
+
} finally {
|
|
260
|
+
wasm.__wbindgen_export_2(deferred0_0, deferred0_1);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
imports.wbg.__wbg_readfile_6641677e84090077 = 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
|
+
imports.wbg.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
|
|
271
|
+
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
272
|
+
};
|
|
273
|
+
imports.wbg.__wbg_error_a7e23606158b68b9 = function(arg0) {
|
|
274
|
+
console.error(getObject(arg0));
|
|
275
|
+
};
|
|
276
|
+
imports.wbg.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) {
|
|
277
|
+
console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
278
|
+
};
|
|
279
|
+
imports.wbg.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) {
|
|
280
|
+
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
281
|
+
};
|
|
282
|
+
imports.wbg.__wbg_log_9b164efbe6db702f = function(arg0, arg1, arg2, arg3) {
|
|
283
|
+
console.log(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
284
|
+
};
|
|
285
|
+
imports.wbg.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
|
|
286
|
+
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
287
|
+
};
|
|
288
|
+
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
289
|
+
const obj = getObject(arg1);
|
|
290
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
291
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
292
|
+
var len1 = WASM_VECTOR_LEN;
|
|
293
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
294
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
295
|
+
};
|
|
296
|
+
imports.wbg.__wbg_parse_76a8a18ca3f8730b = function() { return handleError(function (arg0, arg1) {
|
|
297
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
298
|
+
return addHeapObject(ret);
|
|
299
|
+
}, arguments) };
|
|
300
|
+
imports.wbg.__wbg_stringify_d06ad2addc54d51e = function() { return handleError(function (arg0) {
|
|
301
|
+
const ret = JSON.stringify(getObject(arg0));
|
|
302
|
+
return addHeapObject(ret);
|
|
303
|
+
}, arguments) };
|
|
304
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
305
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
return imports;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function __wbg_init_memory(imports, maybe_memory) {
|
|
312
|
+
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function __wbg_finalize_init(instance, module) {
|
|
316
|
+
wasm = instance.exports;
|
|
317
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
318
|
+
cachedInt32Memory0 = null;
|
|
319
|
+
cachedUint8Memory0 = null;
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
return wasm;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function initSync(module) {
|
|
326
|
+
if (wasm !== undefined) return wasm;
|
|
327
|
+
|
|
328
|
+
const imports = __wbg_get_imports();
|
|
329
|
+
|
|
330
|
+
__wbg_init_memory(imports);
|
|
331
|
+
|
|
332
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
333
|
+
module = new WebAssembly.Module(module);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
337
|
+
|
|
338
|
+
return __wbg_finalize_init(instance, module);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
async function __wbg_init(input) {
|
|
342
|
+
if (wasm !== undefined) return wasm;
|
|
343
|
+
|
|
344
|
+
if (typeof input === 'undefined') {
|
|
345
|
+
input = new URL('noir_wasm_bg.wasm', import.meta.url);
|
|
346
|
+
}
|
|
347
|
+
const imports = __wbg_get_imports();
|
|
348
|
+
|
|
349
|
+
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
350
|
+
input = fetch(input);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
__wbg_init_memory(imports);
|
|
354
|
+
|
|
355
|
+
const { instance, module } = await __wbg_load(await input, imports);
|
|
356
|
+
|
|
357
|
+
return __wbg_finalize_init(instance, module);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export { initSync }
|
|
361
|
+
export default __wbg_init;
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export function init_log_level(a: number, b: number): void;
|
|
5
|
+
export function build_info(): number;
|
|
6
|
+
export function acir_read_bytes(a: number, b: number): number;
|
|
7
|
+
export function acir_write_bytes(a: number, b: number): void;
|
|
8
|
+
export function compile(a: number): number;
|
|
9
|
+
export function rust_psm_on_stack(a: number, b: number, c: number, d: number): void;
|
|
10
|
+
export function rust_psm_stack_direction(): number;
|
|
11
|
+
export function rust_psm_stack_pointer(): number;
|
|
12
|
+
export function rust_psm_replace_stack(a: number, b: number, c: number): void;
|
|
13
|
+
export function __wbindgen_export_0(a: number): number;
|
|
14
|
+
export function __wbindgen_export_1(a: number, b: number, c: number): number;
|
|
15
|
+
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
|
16
|
+
export function __wbindgen_export_2(a: number, b: number): void;
|
|
17
|
+
export function __wbindgen_export_3(a: number): void;
|
package/noir_wasm.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* @param {string} src
|
|
5
|
-
* @returns {any}
|
|
6
|
-
*/
|
|
7
|
-
export function compile(src: string): any;
|
|
8
|
-
/**
|
|
9
|
-
* @param {Uint8Array} bytes
|
|
10
|
-
* @returns {any}
|
|
11
|
-
*/
|
|
12
|
-
export function acir_from_bytes(bytes: Uint8Array): any;
|
|
13
|
-
/**
|
|
14
|
-
* @param {any} acir
|
|
15
|
-
* @returns {Uint8Array}
|
|
16
|
-
*/
|
|
17
|
-
export function acir_to_bytes(acir: any): Uint8Array;
|
package/noir_wasm.js
DELETED
|
@@ -1,359 +0,0 @@
|
|
|
1
|
-
let imports = {};
|
|
2
|
-
imports['__wbindgen_placeholder__'] = module.exports;
|
|
3
|
-
let wasm;
|
|
4
|
-
const { read_file } = require(String.raw`./snippets/fm-cffb18dcbd478425/file_reader.js`);
|
|
5
|
-
const { TextEncoder, TextDecoder } = require(`util`);
|
|
6
|
-
|
|
7
|
-
const heap = new Array(32).fill(undefined);
|
|
8
|
-
|
|
9
|
-
heap.push(undefined, null, true, false);
|
|
10
|
-
|
|
11
|
-
function getObject(idx) { return heap[idx]; }
|
|
12
|
-
|
|
13
|
-
let WASM_VECTOR_LEN = 0;
|
|
14
|
-
|
|
15
|
-
let cachedUint8Memory0 = new Uint8Array();
|
|
16
|
-
|
|
17
|
-
function getUint8Memory0() {
|
|
18
|
-
if (cachedUint8Memory0.byteLength === 0) {
|
|
19
|
-
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
20
|
-
}
|
|
21
|
-
return cachedUint8Memory0;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
25
|
-
|
|
26
|
-
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
27
|
-
? function (arg, view) {
|
|
28
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
|
29
|
-
}
|
|
30
|
-
: function (arg, view) {
|
|
31
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
32
|
-
view.set(buf);
|
|
33
|
-
return {
|
|
34
|
-
read: arg.length,
|
|
35
|
-
written: buf.length
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
40
|
-
|
|
41
|
-
if (realloc === undefined) {
|
|
42
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
43
|
-
const ptr = malloc(buf.length);
|
|
44
|
-
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
45
|
-
WASM_VECTOR_LEN = buf.length;
|
|
46
|
-
return ptr;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
let len = arg.length;
|
|
50
|
-
let ptr = malloc(len);
|
|
51
|
-
|
|
52
|
-
const mem = getUint8Memory0();
|
|
53
|
-
|
|
54
|
-
let offset = 0;
|
|
55
|
-
|
|
56
|
-
for (; offset < len; offset++) {
|
|
57
|
-
const code = arg.charCodeAt(offset);
|
|
58
|
-
if (code > 0x7F) break;
|
|
59
|
-
mem[ptr + offset] = code;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (offset !== len) {
|
|
63
|
-
if (offset !== 0) {
|
|
64
|
-
arg = arg.slice(offset);
|
|
65
|
-
}
|
|
66
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
|
67
|
-
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
68
|
-
const ret = encodeString(arg, view);
|
|
69
|
-
|
|
70
|
-
offset += ret.written;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
WASM_VECTOR_LEN = offset;
|
|
74
|
-
return ptr;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
let cachedInt32Memory0 = new Int32Array();
|
|
78
|
-
|
|
79
|
-
function getInt32Memory0() {
|
|
80
|
-
if (cachedInt32Memory0.byteLength === 0) {
|
|
81
|
-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
82
|
-
}
|
|
83
|
-
return cachedInt32Memory0;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
let heap_next = heap.length;
|
|
87
|
-
|
|
88
|
-
function dropObject(idx) {
|
|
89
|
-
if (idx < 36) return;
|
|
90
|
-
heap[idx] = heap_next;
|
|
91
|
-
heap_next = idx;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function takeObject(idx) {
|
|
95
|
-
const ret = getObject(idx);
|
|
96
|
-
dropObject(idx);
|
|
97
|
-
return ret;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
101
|
-
|
|
102
|
-
cachedTextDecoder.decode();
|
|
103
|
-
|
|
104
|
-
function getStringFromWasm0(ptr, len) {
|
|
105
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function addHeapObject(obj) {
|
|
109
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
110
|
-
const idx = heap_next;
|
|
111
|
-
heap_next = heap[idx];
|
|
112
|
-
|
|
113
|
-
heap[idx] = obj;
|
|
114
|
-
return idx;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* @param {string} src
|
|
118
|
-
* @returns {any}
|
|
119
|
-
*/
|
|
120
|
-
module.exports.compile = function(src) {
|
|
121
|
-
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
122
|
-
const len0 = WASM_VECTOR_LEN;
|
|
123
|
-
const ret = wasm.compile(ptr0, len0);
|
|
124
|
-
return takeObject(ret);
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
128
|
-
const ptr = malloc(arg.length * 1);
|
|
129
|
-
getUint8Memory0().set(arg, ptr / 1);
|
|
130
|
-
WASM_VECTOR_LEN = arg.length;
|
|
131
|
-
return ptr;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* @param {Uint8Array} bytes
|
|
135
|
-
* @returns {any}
|
|
136
|
-
*/
|
|
137
|
-
module.exports.acir_from_bytes = function(bytes) {
|
|
138
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_0);
|
|
139
|
-
const len0 = WASM_VECTOR_LEN;
|
|
140
|
-
const ret = wasm.acir_from_bytes(ptr0, len0);
|
|
141
|
-
return takeObject(ret);
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
145
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* @param {any} acir
|
|
149
|
-
* @returns {Uint8Array}
|
|
150
|
-
*/
|
|
151
|
-
module.exports.acir_to_bytes = function(acir) {
|
|
152
|
-
try {
|
|
153
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
154
|
-
wasm.acir_to_bytes(retptr, addHeapObject(acir));
|
|
155
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
156
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
157
|
-
var v0 = getArrayU8FromWasm0(r0, r1).slice();
|
|
158
|
-
wasm.__wbindgen_export_2(r0, r1 * 1);
|
|
159
|
-
return v0;
|
|
160
|
-
} finally {
|
|
161
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
function handleError(f, args) {
|
|
166
|
-
try {
|
|
167
|
-
return f.apply(this, args);
|
|
168
|
-
} catch (e) {
|
|
169
|
-
wasm.__wbindgen_export_3(addHeapObject(e));
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
module.exports.__wbindgen_json_serialize = function(arg0, arg1) {
|
|
174
|
-
const obj = getObject(arg1);
|
|
175
|
-
const ret = JSON.stringify(obj === undefined ? null : obj);
|
|
176
|
-
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
177
|
-
const len0 = WASM_VECTOR_LEN;
|
|
178
|
-
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
179
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
183
|
-
takeObject(arg0);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
module.exports.__wbindgen_json_parse = function(arg0, arg1) {
|
|
187
|
-
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
188
|
-
return addHeapObject(ret);
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
module.exports.__wbg_readfile_381ecedf0ec0c1aa = function() { return handleError(function (arg0, arg1, arg2) {
|
|
192
|
-
const ret = read_file(getStringFromWasm0(arg1, arg2));
|
|
193
|
-
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
194
|
-
const len0 = WASM_VECTOR_LEN;
|
|
195
|
-
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
196
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
197
|
-
}, arguments) };
|
|
198
|
-
|
|
199
|
-
module.exports.__wbg_new_693216e109162396 = function() {
|
|
200
|
-
const ret = new Error();
|
|
201
|
-
return addHeapObject(ret);
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
module.exports.__wbg_stack_0ddaca5d1abfb52f = function(arg0, arg1) {
|
|
205
|
-
const ret = getObject(arg1).stack;
|
|
206
|
-
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
207
|
-
const len0 = WASM_VECTOR_LEN;
|
|
208
|
-
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
209
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
module.exports.__wbg_error_09919627ac0992f5 = function(arg0, arg1) {
|
|
213
|
-
try {
|
|
214
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
215
|
-
} finally {
|
|
216
|
-
wasm.__wbindgen_export_2(arg0, arg1);
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
module.exports.__wbg_randomFillSync_91e2b39becca6147 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
221
|
-
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
|
|
222
|
-
}, arguments) };
|
|
223
|
-
|
|
224
|
-
module.exports.__wbg_getRandomValues_b14734aa289bc356 = function() { return handleError(function (arg0, arg1) {
|
|
225
|
-
getObject(arg0).getRandomValues(getObject(arg1));
|
|
226
|
-
}, arguments) };
|
|
227
|
-
|
|
228
|
-
module.exports.__wbg_process_e56fd54cf6319b6c = function(arg0) {
|
|
229
|
-
const ret = getObject(arg0).process;
|
|
230
|
-
return addHeapObject(ret);
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
module.exports.__wbindgen_is_object = function(arg0) {
|
|
234
|
-
const val = getObject(arg0);
|
|
235
|
-
const ret = typeof(val) === 'object' && val !== null;
|
|
236
|
-
return ret;
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
module.exports.__wbg_versions_77e21455908dad33 = function(arg0) {
|
|
240
|
-
const ret = getObject(arg0).versions;
|
|
241
|
-
return addHeapObject(ret);
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
module.exports.__wbg_node_0dd25d832e4785d5 = function(arg0) {
|
|
245
|
-
const ret = getObject(arg0).node;
|
|
246
|
-
return addHeapObject(ret);
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
module.exports.__wbindgen_is_string = function(arg0) {
|
|
250
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
251
|
-
return ret;
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
module.exports.__wbg_crypto_b95d7173266618a9 = function(arg0) {
|
|
255
|
-
const ret = getObject(arg0).crypto;
|
|
256
|
-
return addHeapObject(ret);
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
module.exports.__wbg_msCrypto_5a86d77a66230f81 = function(arg0) {
|
|
260
|
-
const ret = getObject(arg0).msCrypto;
|
|
261
|
-
return addHeapObject(ret);
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
module.exports.__wbg_static_accessor_NODE_MODULE_26b231378c1be7dd = function() {
|
|
265
|
-
const ret = module;
|
|
266
|
-
return addHeapObject(ret);
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
module.exports.__wbg_require_0db1598d9ccecb30 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
270
|
-
const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
|
|
271
|
-
return addHeapObject(ret);
|
|
272
|
-
}, arguments) };
|
|
273
|
-
|
|
274
|
-
module.exports.__wbg_newnoargs_971e9a5abe185139 = function(arg0, arg1) {
|
|
275
|
-
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
276
|
-
return addHeapObject(ret);
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
module.exports.__wbg_call_33d7bcddbbfa394a = function() { return handleError(function (arg0, arg1) {
|
|
280
|
-
const ret = getObject(arg0).call(getObject(arg1));
|
|
281
|
-
return addHeapObject(ret);
|
|
282
|
-
}, arguments) };
|
|
283
|
-
|
|
284
|
-
module.exports.__wbindgen_object_clone_ref = function(arg0) {
|
|
285
|
-
const ret = getObject(arg0);
|
|
286
|
-
return addHeapObject(ret);
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
module.exports.__wbg_self_fd00a1ef86d1b2ed = function() { return handleError(function () {
|
|
290
|
-
const ret = self.self;
|
|
291
|
-
return addHeapObject(ret);
|
|
292
|
-
}, arguments) };
|
|
293
|
-
|
|
294
|
-
module.exports.__wbg_window_6f6e346d8bbd61d7 = function() { return handleError(function () {
|
|
295
|
-
const ret = window.window;
|
|
296
|
-
return addHeapObject(ret);
|
|
297
|
-
}, arguments) };
|
|
298
|
-
|
|
299
|
-
module.exports.__wbg_globalThis_3348936ac49df00a = function() { return handleError(function () {
|
|
300
|
-
const ret = globalThis.globalThis;
|
|
301
|
-
return addHeapObject(ret);
|
|
302
|
-
}, arguments) };
|
|
303
|
-
|
|
304
|
-
module.exports.__wbg_global_67175caf56f55ca9 = function() { return handleError(function () {
|
|
305
|
-
const ret = global.global;
|
|
306
|
-
return addHeapObject(ret);
|
|
307
|
-
}, arguments) };
|
|
308
|
-
|
|
309
|
-
module.exports.__wbindgen_is_undefined = function(arg0) {
|
|
310
|
-
const ret = getObject(arg0) === undefined;
|
|
311
|
-
return ret;
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
module.exports.__wbg_buffer_34f5ec9f8a838ba0 = function(arg0) {
|
|
315
|
-
const ret = getObject(arg0).buffer;
|
|
316
|
-
return addHeapObject(ret);
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
module.exports.__wbg_new_cda198d9dbc6d7ea = function(arg0) {
|
|
320
|
-
const ret = new Uint8Array(getObject(arg0));
|
|
321
|
-
return addHeapObject(ret);
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
module.exports.__wbg_set_1a930cfcda1a8067 = function(arg0, arg1, arg2) {
|
|
325
|
-
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
module.exports.__wbg_length_51f19f73d6d9eff3 = function(arg0) {
|
|
329
|
-
const ret = getObject(arg0).length;
|
|
330
|
-
return ret;
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
module.exports.__wbg_newwithlength_66e5530e7079ea1b = function(arg0) {
|
|
334
|
-
const ret = new Uint8Array(arg0 >>> 0);
|
|
335
|
-
return addHeapObject(ret);
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
module.exports.__wbg_subarray_270ff8dd5582c1ac = function(arg0, arg1, arg2) {
|
|
339
|
-
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
|
340
|
-
return addHeapObject(ret);
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
344
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
module.exports.__wbindgen_memory = function() {
|
|
348
|
-
const ret = wasm.memory;
|
|
349
|
-
return addHeapObject(ret);
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
const path = require('path').join(__dirname, 'noir_wasm_bg.wasm');
|
|
353
|
-
const bytes = require('fs').readFileSync(path);
|
|
354
|
-
|
|
355
|
-
const wasmModule = new WebAssembly.Module(bytes);
|
|
356
|
-
const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
357
|
-
wasm = wasmInstance.exports;
|
|
358
|
-
module.exports.__wasm = wasm;
|
|
359
|
-
|
package/noir_wasm_bg.wasm
DELETED
|
Binary file
|