@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/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
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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#noir_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 #noir_wasm
|
|
19
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
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 {string} entry_point
|
|
23
|
+
* @param {boolean | undefined} contracts
|
|
24
|
+
* @param {string[] | undefined} dependencies
|
|
25
|
+
* @returns {any}
|
|
26
|
+
*/
|
|
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
|
+
|
|
44
|
+
/**
|
|
45
|
+
*/
|
|
46
|
+
export class CompileError {
|
|
47
|
+
free(): void;
|
|
48
|
+
/**
|
|
49
|
+
*/
|
|
50
|
+
diagnostics: any;
|
|
51
|
+
/**
|
|
52
|
+
*/
|
|
53
|
+
message: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
let imports = {};
|
|
2
|
+
imports['__wbindgen_placeholder__'] = module.exports;
|
|
3
|
+
let wasm;
|
|
4
|
+
const { read_file } = require(`@noir-lang/source-resolver`);
|
|
5
|
+
const { TextEncoder, TextDecoder } = 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
|
+
function addHeapObject(obj) {
|
|
28
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
29
|
+
const idx = heap_next;
|
|
30
|
+
heap_next = heap[idx];
|
|
31
|
+
|
|
32
|
+
heap[idx] = obj;
|
|
33
|
+
return idx;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let WASM_VECTOR_LEN = 0;
|
|
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
|
+
|
|
47
|
+
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
48
|
+
|
|
49
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
50
|
+
? function (arg, view) {
|
|
51
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
52
|
+
}
|
|
53
|
+
: function (arg, view) {
|
|
54
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
55
|
+
view.set(buf);
|
|
56
|
+
return {
|
|
57
|
+
read: arg.length,
|
|
58
|
+
written: buf.length
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
63
|
+
|
|
64
|
+
if (realloc === undefined) {
|
|
65
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
66
|
+
const ptr = malloc(buf.length) >>> 0;
|
|
67
|
+
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
68
|
+
WASM_VECTOR_LEN = buf.length;
|
|
69
|
+
return ptr;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let len = arg.length;
|
|
73
|
+
let ptr = malloc(len) >>> 0;
|
|
74
|
+
|
|
75
|
+
const mem = getUint8Memory0();
|
|
76
|
+
|
|
77
|
+
let offset = 0;
|
|
78
|
+
|
|
79
|
+
for (; offset < len; offset++) {
|
|
80
|
+
const code = arg.charCodeAt(offset);
|
|
81
|
+
if (code > 0x7F) break;
|
|
82
|
+
mem[ptr + offset] = code;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (offset !== len) {
|
|
86
|
+
if (offset !== 0) {
|
|
87
|
+
arg = arg.slice(offset);
|
|
88
|
+
}
|
|
89
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0;
|
|
90
|
+
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
91
|
+
const ret = encodeString(arg, view);
|
|
92
|
+
|
|
93
|
+
offset += ret.written;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
WASM_VECTOR_LEN = offset;
|
|
97
|
+
return ptr;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function isLikeNone(x) {
|
|
101
|
+
return x === undefined || x === null;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
let cachedInt32Memory0 = null;
|
|
105
|
+
|
|
106
|
+
function getInt32Memory0() {
|
|
107
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
108
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
109
|
+
}
|
|
110
|
+
return cachedInt32Memory0;
|
|
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
|
+
/**
|
|
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 {string} entry_point
|
|
179
|
+
* @param {boolean | undefined} contracts
|
|
180
|
+
* @param {string[] | undefined} dependencies
|
|
181
|
+
* @returns {any}
|
|
182
|
+
*/
|
|
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
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
function handleError(f, args) {
|
|
202
|
+
try {
|
|
203
|
+
return f.apply(this, args);
|
|
204
|
+
} catch (e) {
|
|
205
|
+
wasm.__wbindgen_export_3(addHeapObject(e));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
*/
|
|
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
|
+
}
|
|
219
|
+
|
|
220
|
+
__destroy_into_raw() {
|
|
221
|
+
const ptr = this.__wbg_ptr;
|
|
222
|
+
this.__wbg_ptr = 0;
|
|
223
|
+
|
|
224
|
+
return ptr;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
free() {
|
|
228
|
+
const ptr = this.__destroy_into_raw();
|
|
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));
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* @returns {any}
|
|
246
|
+
*/
|
|
247
|
+
get diagnostics() {
|
|
248
|
+
const ret = wasm.__wbg_get_compileerror_diagnostics(this.__wbg_ptr);
|
|
249
|
+
return takeObject(ret);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* @param {any} arg0
|
|
253
|
+
*/
|
|
254
|
+
set diagnostics(arg0) {
|
|
255
|
+
wasm.__wbg_set_compileerror_diagnostics(this.__wbg_ptr, addHeapObject(arg0));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
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
|
+
};
|
|
264
|
+
|
|
265
|
+
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
266
|
+
takeObject(arg0);
|
|
267
|
+
};
|
|
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
|
+
|
|
283
|
+
module.exports.__wbindgen_is_undefined = function(arg0) {
|
|
284
|
+
const ret = getObject(arg0) === undefined;
|
|
285
|
+
return ret;
|
|
286
|
+
};
|
|
287
|
+
|
|
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) };
|
|
295
|
+
|
|
296
|
+
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
297
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
298
|
+
return addHeapObject(ret);
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
module.exports.__wbg_new_abda76e883ba8a5f = function() {
|
|
302
|
+
const ret = new Error();
|
|
303
|
+
return addHeapObject(ret);
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
module.exports.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
|
|
307
|
+
const ret = getObject(arg1).stack;
|
|
308
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
309
|
+
const len1 = WASM_VECTOR_LEN;
|
|
310
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
311
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
315
|
+
let deferred0_0;
|
|
316
|
+
let deferred0_1;
|
|
317
|
+
try {
|
|
318
|
+
deferred0_0 = arg0;
|
|
319
|
+
deferred0_1 = arg1;
|
|
320
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
321
|
+
} finally {
|
|
322
|
+
wasm.__wbindgen_export_2(deferred0_0, deferred0_1);
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
module.exports.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
|
|
327
|
+
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
module.exports.__wbg_error_a7e23606158b68b9 = function(arg0) {
|
|
331
|
+
console.error(getObject(arg0));
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
module.exports.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) {
|
|
335
|
+
console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
module.exports.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) {
|
|
339
|
+
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
module.exports.__wbg_log_9b164efbe6db702f = function(arg0, arg1, arg2, arg3) {
|
|
343
|
+
console.log(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
module.exports.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
|
|
347
|
+
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
module.exports.__wbg_get_7303ed2ef026b2f5 = function(arg0, arg1) {
|
|
351
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
352
|
+
return addHeapObject(ret);
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
module.exports.__wbg_length_820c786973abdd8a = function(arg0) {
|
|
356
|
+
const ret = getObject(arg0).length;
|
|
357
|
+
return ret;
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
module.exports.__wbg_parse_76a8a18ca3f8730b = function() { return handleError(function (arg0, arg1) {
|
|
361
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
362
|
+
return addHeapObject(ret);
|
|
363
|
+
}, arguments) };
|
|
364
|
+
|
|
365
|
+
module.exports.__wbg_stringify_d06ad2addc54d51e = function() { return handleError(function (arg0) {
|
|
366
|
+
const ret = JSON.stringify(getObject(arg0));
|
|
367
|
+
return addHeapObject(ret);
|
|
368
|
+
}, arguments) };
|
|
369
|
+
|
|
370
|
+
module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
371
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
const path = require('path').join(__dirname, 'noir_wasm_bg.wasm');
|
|
375
|
+
const bytes = require('fs').readFileSync(path);
|
|
376
|
+
|
|
377
|
+
const wasmModule = new WebAssembly.Module(bytes);
|
|
378
|
+
const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
379
|
+
wasm = wasmInstance.exports;
|
|
380
|
+
module.exports.__wasm = wasm;
|
|
381
|
+
|
|
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/package.json
CHANGED
|
@@ -1,13 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noir-lang/noir_wasm",
|
|
3
|
-
"
|
|
3
|
+
"collaborators": [
|
|
4
|
+
"The Noir Team <team@noir-lang.org>"
|
|
5
|
+
],
|
|
6
|
+
"version": "0.16.0-10eae15.nightly",
|
|
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
|
-
"
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/noir-lang/noir.git"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "bash ./build.sh",
|
|
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 ./"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@noir-lang/source-resolver": "0.16.0-10eae15.nightly"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@esm-bundle/chai": "^4.3.4-fix.0",
|
|
38
|
+
"@web/dev-server-esbuild": "^0.3.6",
|
|
39
|
+
"@web/test-runner": "^0.15.3",
|
|
40
|
+
"@web/test-runner-playwright": "^0.10.0",
|
|
41
|
+
"mocha": "^10.2.0"
|
|
42
|
+
}
|
|
13
43
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
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 {string} entry_point
|
|
23
|
+
* @param {boolean | undefined} contracts
|
|
24
|
+
* @param {string[] | undefined} dependencies
|
|
25
|
+
* @returns {any}
|
|
26
|
+
*/
|
|
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
|
+
|
|
44
|
+
/**
|
|
45
|
+
*/
|
|
46
|
+
export class CompileError {
|
|
47
|
+
free(): void;
|
|
48
|
+
/**
|
|
49
|
+
*/
|
|
50
|
+
diagnostics: any;
|
|
51
|
+
/**
|
|
52
|
+
*/
|
|
53
|
+
message: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
57
|
+
|
|
58
|
+
export interface InitOutput {
|
|
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;
|
|
65
|
+
readonly init_log_level: (a: number, b: number) => void;
|
|
66
|
+
readonly build_info: () => number;
|
|
67
|
+
readonly acir_read_bytes: (a: number, b: number) => number;
|
|
68
|
+
readonly acir_write_bytes: (a: number, b: number) => void;
|
|
69
|
+
readonly compile: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
70
|
+
readonly __wbindgen_export_0: (a: number) => number;
|
|
71
|
+
readonly __wbindgen_export_1: (a: number, b: number, c: number) => number;
|
|
72
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
73
|
+
readonly __wbindgen_export_2: (a: number, b: number) => void;
|
|
74
|
+
readonly __wbindgen_export_3: (a: number) => void;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
78
|
+
/**
|
|
79
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
80
|
+
* a precompiled `WebAssembly.Module`.
|
|
81
|
+
*
|
|
82
|
+
* @param {SyncInitInput} module
|
|
83
|
+
*
|
|
84
|
+
* @returns {InitOutput}
|
|
85
|
+
*/
|
|
86
|
+
export function initSync(module: SyncInitInput): InitOutput;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
90
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
91
|
+
*
|
|
92
|
+
* @param {InitInput | Promise<InitInput>} module_or_path
|
|
93
|
+
*
|
|
94
|
+
* @returns {Promise<InitOutput>}
|
|
95
|
+
*/
|
|
96
|
+
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|