@noir-lang/noir_wasm 0.11.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 +19 -0
- package/nodejs/noir_wasm.d.ts +54 -0
- package/nodejs/noir_wasm.js +381 -0
- package/nodejs/noir_wasm_bg.wasm +0 -0
- package/nodejs/noir_wasm_bg.wasm.d.ts +18 -0
- package/package.json +38 -8
- package/web/noir_wasm.d.ts +96 -0
- package/web/noir_wasm.js +438 -0
- package/web/noir_wasm_bg.wasm +0 -0
- package/web/noir_wasm_bg.wasm.d.ts +18 -0
- package/noir_wasm.d.ts +0 -56
- package/noir_wasm.js +0 -295
- package/noir_wasm_bg.wasm +0 -0
- package/noir_wasm_bg.wasm.d.ts +0 -15
- package/snippets/fm-cffb18dcbd478425/file_reader.js +0 -6
package/web/noir_wasm.js
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import { read_file } from '@noir-lang/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
|
+
function addHeapObject(obj) {
|
|
26
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
27
|
+
const idx = heap_next;
|
|
28
|
+
heap_next = heap[idx];
|
|
29
|
+
|
|
30
|
+
heap[idx] = obj;
|
|
31
|
+
return idx;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let WASM_VECTOR_LEN = 0;
|
|
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
|
+
|
|
45
|
+
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
46
|
+
|
|
47
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
48
|
+
? function (arg, view) {
|
|
49
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
50
|
+
}
|
|
51
|
+
: function (arg, view) {
|
|
52
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
53
|
+
view.set(buf);
|
|
54
|
+
return {
|
|
55
|
+
read: arg.length,
|
|
56
|
+
written: buf.length
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
61
|
+
|
|
62
|
+
if (realloc === undefined) {
|
|
63
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
64
|
+
const ptr = malloc(buf.length) >>> 0;
|
|
65
|
+
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
66
|
+
WASM_VECTOR_LEN = buf.length;
|
|
67
|
+
return ptr;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
let len = arg.length;
|
|
71
|
+
let ptr = malloc(len) >>> 0;
|
|
72
|
+
|
|
73
|
+
const mem = getUint8Memory0();
|
|
74
|
+
|
|
75
|
+
let offset = 0;
|
|
76
|
+
|
|
77
|
+
for (; offset < len; offset++) {
|
|
78
|
+
const code = arg.charCodeAt(offset);
|
|
79
|
+
if (code > 0x7F) break;
|
|
80
|
+
mem[ptr + offset] = code;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (offset !== len) {
|
|
84
|
+
if (offset !== 0) {
|
|
85
|
+
arg = arg.slice(offset);
|
|
86
|
+
}
|
|
87
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0;
|
|
88
|
+
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
89
|
+
const ret = encodeString(arg, view);
|
|
90
|
+
|
|
91
|
+
offset += ret.written;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
WASM_VECTOR_LEN = offset;
|
|
95
|
+
return ptr;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function isLikeNone(x) {
|
|
99
|
+
return x === undefined || x === null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let cachedInt32Memory0 = null;
|
|
103
|
+
|
|
104
|
+
function getInt32Memory0() {
|
|
105
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
106
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
107
|
+
}
|
|
108
|
+
return cachedInt32Memory0;
|
|
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
|
+
/**
|
|
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 {string} entry_point
|
|
177
|
+
* @param {boolean | undefined} contracts
|
|
178
|
+
* @param {string[] | undefined} dependencies
|
|
179
|
+
* @returns {any}
|
|
180
|
+
*/
|
|
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
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function handleError(f, args) {
|
|
200
|
+
try {
|
|
201
|
+
return f.apply(this, args);
|
|
202
|
+
} catch (e) {
|
|
203
|
+
wasm.__wbindgen_export_3(addHeapObject(e));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
*/
|
|
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
|
+
}
|
|
217
|
+
|
|
218
|
+
__destroy_into_raw() {
|
|
219
|
+
const ptr = this.__wbg_ptr;
|
|
220
|
+
this.__wbg_ptr = 0;
|
|
221
|
+
|
|
222
|
+
return ptr;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
free() {
|
|
226
|
+
const ptr = this.__destroy_into_raw();
|
|
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));
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* @returns {any}
|
|
244
|
+
*/
|
|
245
|
+
get diagnostics() {
|
|
246
|
+
const ret = wasm.__wbg_get_compileerror_diagnostics(this.__wbg_ptr);
|
|
247
|
+
return takeObject(ret);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* @param {any} arg0
|
|
251
|
+
*/
|
|
252
|
+
set diagnostics(arg0) {
|
|
253
|
+
wasm.__wbg_set_compileerror_diagnostics(this.__wbg_ptr, addHeapObject(arg0));
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async function __wbg_load(module, imports) {
|
|
258
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
259
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
260
|
+
try {
|
|
261
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
262
|
+
|
|
263
|
+
} catch (e) {
|
|
264
|
+
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
265
|
+
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);
|
|
266
|
+
|
|
267
|
+
} else {
|
|
268
|
+
throw e;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const bytes = await module.arrayBuffer();
|
|
274
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
275
|
+
|
|
276
|
+
} else {
|
|
277
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
278
|
+
|
|
279
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
280
|
+
return { instance, module };
|
|
281
|
+
|
|
282
|
+
} else {
|
|
283
|
+
return instance;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function __wbg_get_imports() {
|
|
289
|
+
const imports = {};
|
|
290
|
+
imports.wbg = {};
|
|
291
|
+
imports.wbg.__wbg_compileerror_new = function(arg0) {
|
|
292
|
+
const ret = CompileError.__wrap(arg0);
|
|
293
|
+
return addHeapObject(ret);
|
|
294
|
+
};
|
|
295
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
296
|
+
takeObject(arg0);
|
|
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
|
+
};
|
|
310
|
+
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
311
|
+
const ret = getObject(arg0) === undefined;
|
|
312
|
+
return ret;
|
|
313
|
+
};
|
|
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) };
|
|
321
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
322
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
323
|
+
return addHeapObject(ret);
|
|
324
|
+
};
|
|
325
|
+
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
|
326
|
+
const ret = new Error();
|
|
327
|
+
return addHeapObject(ret);
|
|
328
|
+
};
|
|
329
|
+
imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
|
|
330
|
+
const ret = getObject(arg1).stack;
|
|
331
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
332
|
+
const len1 = WASM_VECTOR_LEN;
|
|
333
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
334
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
335
|
+
};
|
|
336
|
+
imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
337
|
+
let deferred0_0;
|
|
338
|
+
let deferred0_1;
|
|
339
|
+
try {
|
|
340
|
+
deferred0_0 = arg0;
|
|
341
|
+
deferred0_1 = arg1;
|
|
342
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
343
|
+
} finally {
|
|
344
|
+
wasm.__wbindgen_export_2(deferred0_0, deferred0_1);
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
imports.wbg.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
|
|
348
|
+
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
349
|
+
};
|
|
350
|
+
imports.wbg.__wbg_error_a7e23606158b68b9 = function(arg0) {
|
|
351
|
+
console.error(getObject(arg0));
|
|
352
|
+
};
|
|
353
|
+
imports.wbg.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) {
|
|
354
|
+
console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
355
|
+
};
|
|
356
|
+
imports.wbg.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) {
|
|
357
|
+
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
358
|
+
};
|
|
359
|
+
imports.wbg.__wbg_log_9b164efbe6db702f = function(arg0, arg1, arg2, arg3) {
|
|
360
|
+
console.log(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
361
|
+
};
|
|
362
|
+
imports.wbg.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
|
|
363
|
+
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
364
|
+
};
|
|
365
|
+
imports.wbg.__wbg_get_7303ed2ef026b2f5 = function(arg0, arg1) {
|
|
366
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
367
|
+
return addHeapObject(ret);
|
|
368
|
+
};
|
|
369
|
+
imports.wbg.__wbg_length_820c786973abdd8a = function(arg0) {
|
|
370
|
+
const ret = getObject(arg0).length;
|
|
371
|
+
return ret;
|
|
372
|
+
};
|
|
373
|
+
imports.wbg.__wbg_parse_76a8a18ca3f8730b = function() { return handleError(function (arg0, arg1) {
|
|
374
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
375
|
+
return addHeapObject(ret);
|
|
376
|
+
}, arguments) };
|
|
377
|
+
imports.wbg.__wbg_stringify_d06ad2addc54d51e = function() { return handleError(function (arg0) {
|
|
378
|
+
const ret = JSON.stringify(getObject(arg0));
|
|
379
|
+
return addHeapObject(ret);
|
|
380
|
+
}, arguments) };
|
|
381
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
382
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
return imports;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function __wbg_init_memory(imports, maybe_memory) {
|
|
389
|
+
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function __wbg_finalize_init(instance, module) {
|
|
393
|
+
wasm = instance.exports;
|
|
394
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
395
|
+
cachedInt32Memory0 = null;
|
|
396
|
+
cachedUint8Memory0 = null;
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
return wasm;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
function initSync(module) {
|
|
403
|
+
if (wasm !== undefined) return wasm;
|
|
404
|
+
|
|
405
|
+
const imports = __wbg_get_imports();
|
|
406
|
+
|
|
407
|
+
__wbg_init_memory(imports);
|
|
408
|
+
|
|
409
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
410
|
+
module = new WebAssembly.Module(module);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
414
|
+
|
|
415
|
+
return __wbg_finalize_init(instance, module);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
async function __wbg_init(input) {
|
|
419
|
+
if (wasm !== undefined) return wasm;
|
|
420
|
+
|
|
421
|
+
if (typeof input === 'undefined') {
|
|
422
|
+
input = new URL('noir_wasm_bg.wasm', import.meta.url);
|
|
423
|
+
}
|
|
424
|
+
const imports = __wbg_get_imports();
|
|
425
|
+
|
|
426
|
+
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
427
|
+
input = fetch(input);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
__wbg_init_memory(imports);
|
|
431
|
+
|
|
432
|
+
const { instance, module } = await __wbg_load(await input, imports);
|
|
433
|
+
|
|
434
|
+
return __wbg_finalize_init(instance, module);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export { initSync }
|
|
438
|
+
export default __wbg_init;
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
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;
|
|
9
|
+
export function init_log_level(a: number, b: number): void;
|
|
10
|
+
export function build_info(): number;
|
|
11
|
+
export function acir_read_bytes(a: number, b: number): number;
|
|
12
|
+
export function acir_write_bytes(a: number, b: number): void;
|
|
13
|
+
export function compile(a: number, b: number, c: number, d: number, e: number): void;
|
|
14
|
+
export function __wbindgen_export_0(a: number): number;
|
|
15
|
+
export function __wbindgen_export_1(a: number, b: number, c: number): number;
|
|
16
|
+
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
|
17
|
+
export function __wbindgen_export_2(a: number, b: number): void;
|
|
18
|
+
export function __wbindgen_export_3(a: number): void;
|
package/noir_wasm.d.ts
DELETED
|
@@ -1,56 +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;
|
|
18
|
-
|
|
19
|
-
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
20
|
-
|
|
21
|
-
export interface InitOutput {
|
|
22
|
-
readonly memory: WebAssembly.Memory;
|
|
23
|
-
readonly compile: (a: number, b: number) => number;
|
|
24
|
-
readonly acir_from_bytes: (a: number, b: number) => number;
|
|
25
|
-
readonly acir_to_bytes: (a: number, b: number) => void;
|
|
26
|
-
readonly rust_psm_on_stack: (a: number, b: number, c: number, d: number) => void;
|
|
27
|
-
readonly rust_psm_stack_direction: () => number;
|
|
28
|
-
readonly rust_psm_stack_pointer: () => number;
|
|
29
|
-
readonly rust_psm_replace_stack: (a: number, b: number, c: number) => void;
|
|
30
|
-
readonly __wbindgen_export_0: (a: number) => number;
|
|
31
|
-
readonly __wbindgen_export_1: (a: number, b: number, c: number) => number;
|
|
32
|
-
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
33
|
-
readonly __wbindgen_export_2: (a: number, b: number) => void;
|
|
34
|
-
readonly __wbindgen_export_3: (a: number) => void;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
38
|
-
/**
|
|
39
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
40
|
-
* a precompiled `WebAssembly.Module`.
|
|
41
|
-
*
|
|
42
|
-
* @param {SyncInitInput} module
|
|
43
|
-
*
|
|
44
|
-
* @returns {InitOutput}
|
|
45
|
-
*/
|
|
46
|
-
export function initSync(module: SyncInitInput): InitOutput;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
50
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
51
|
-
*
|
|
52
|
-
* @param {InitInput | Promise<InitInput>} module_or_path
|
|
53
|
-
*
|
|
54
|
-
* @returns {Promise<InitOutput>}
|
|
55
|
-
*/
|
|
56
|
-
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|