@noir-lang/noir_wasm 0.22.0-fbb51ed.nightly → 0.23.0-057c208.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/build/cjs/package.json +15 -0
- package/build/esm/package.json +18 -0
- package/dist/node/index_bg.wasm +0 -0
- package/dist/node/main.js +12857 -0
- package/dist/node/main.js.map +1 -0
- package/dist/types/build/cjs/index.d.ts +93 -0
- package/dist/types/build/esm/index.d.ts +92 -0
- package/dist/types/src/index.d.cts +8 -0
- package/dist/types/src/index.d.mts +8 -0
- package/dist/types/src/noir/debug.d.ts +2 -0
- package/dist/types/src/noir/dependencies/dependency-manager.d.ts +48 -0
- package/dist/types/src/noir/dependencies/dependency-resolver.d.ts +22 -0
- package/dist/types/src/noir/dependencies/github-dependency-resolver.d.ts +29 -0
- package/dist/types/src/noir/dependencies/local-dependency-resolver.d.ts +12 -0
- package/dist/types/src/noir/file-manager/file-manager.d.ts +74 -0
- package/dist/types/src/noir/file-manager/memfs-file-manager.d.ts +8 -0
- package/dist/types/src/noir/file-manager/nodejs-file-manager.d.ts +7 -0
- package/dist/types/src/noir/noir-wasm-compiler.d.ts +31 -0
- package/dist/types/src/noir/package.d.ts +81 -0
- package/dist/types/src/types/noir_artifact.d.ts +173 -0
- package/dist/types/src/types/noir_package_config.d.ts +44 -0
- package/dist/types/src/utils.d.ts +5 -0
- package/dist/types/web-test-runner.config.d.mts +9 -0
- package/dist/types/webpack.config.d.ts +4 -0
- package/dist/web/index.html +9 -0
- package/dist/web/main.mjs +35340 -0
- package/dist/web/main.mjs.map +1 -0
- package/package.json +56 -16
- package/nodejs/noir_wasm.d.ts +0 -139
- package/nodejs/noir_wasm.js +0 -575
- package/nodejs/noir_wasm_bg.wasm +0 -0
- package/nodejs/noir_wasm_bg.wasm.d.ts +0 -23
- package/web/noir_wasm.d.ts +0 -186
- package/web/noir_wasm.js +0 -628
- package/web/noir_wasm_bg.wasm +0 -0
- package/web/noir_wasm_bg.wasm.d.ts +0 -23
package/web/noir_wasm.js
DELETED
|
@@ -1,628 +0,0 @@
|
|
|
1
|
-
let wasm;
|
|
2
|
-
|
|
3
|
-
const heap = new Array(128).fill(undefined);
|
|
4
|
-
|
|
5
|
-
heap.push(undefined, null, true, false);
|
|
6
|
-
|
|
7
|
-
function getObject(idx) { return heap[idx]; }
|
|
8
|
-
|
|
9
|
-
let heap_next = heap.length;
|
|
10
|
-
|
|
11
|
-
function dropObject(idx) {
|
|
12
|
-
if (idx < 132) return;
|
|
13
|
-
heap[idx] = heap_next;
|
|
14
|
-
heap_next = idx;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function takeObject(idx) {
|
|
18
|
-
const ret = getObject(idx);
|
|
19
|
-
dropObject(idx);
|
|
20
|
-
return ret;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
24
|
-
|
|
25
|
-
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
26
|
-
|
|
27
|
-
let cachedUint8Memory0 = null;
|
|
28
|
-
|
|
29
|
-
function getUint8Memory0() {
|
|
30
|
-
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
31
|
-
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
32
|
-
}
|
|
33
|
-
return cachedUint8Memory0;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function getStringFromWasm0(ptr, len) {
|
|
37
|
-
ptr = ptr >>> 0;
|
|
38
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function addHeapObject(obj) {
|
|
42
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
43
|
-
const idx = heap_next;
|
|
44
|
-
heap_next = heap[idx];
|
|
45
|
-
|
|
46
|
-
heap[idx] = obj;
|
|
47
|
-
return idx;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
let WASM_VECTOR_LEN = 0;
|
|
51
|
-
|
|
52
|
-
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
53
|
-
|
|
54
|
-
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
55
|
-
? function (arg, view) {
|
|
56
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
|
57
|
-
}
|
|
58
|
-
: function (arg, view) {
|
|
59
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
60
|
-
view.set(buf);
|
|
61
|
-
return {
|
|
62
|
-
read: arg.length,
|
|
63
|
-
written: buf.length
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
68
|
-
|
|
69
|
-
if (realloc === undefined) {
|
|
70
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
71
|
-
const ptr = malloc(buf.length) >>> 0;
|
|
72
|
-
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
73
|
-
WASM_VECTOR_LEN = buf.length;
|
|
74
|
-
return ptr;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
let len = arg.length;
|
|
78
|
-
let ptr = malloc(len) >>> 0;
|
|
79
|
-
|
|
80
|
-
const mem = getUint8Memory0();
|
|
81
|
-
|
|
82
|
-
let offset = 0;
|
|
83
|
-
|
|
84
|
-
for (; offset < len; offset++) {
|
|
85
|
-
const code = arg.charCodeAt(offset);
|
|
86
|
-
if (code > 0x7F) break;
|
|
87
|
-
mem[ptr + offset] = code;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (offset !== len) {
|
|
91
|
-
if (offset !== 0) {
|
|
92
|
-
arg = arg.slice(offset);
|
|
93
|
-
}
|
|
94
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0;
|
|
95
|
-
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
96
|
-
const ret = encodeString(arg, view);
|
|
97
|
-
|
|
98
|
-
offset += ret.written;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
WASM_VECTOR_LEN = offset;
|
|
102
|
-
return ptr;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function isLikeNone(x) {
|
|
106
|
-
return x === undefined || x === null;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
let cachedInt32Memory0 = null;
|
|
110
|
-
|
|
111
|
-
function getInt32Memory0() {
|
|
112
|
-
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
113
|
-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
114
|
-
}
|
|
115
|
-
return cachedInt32Memory0;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function debugString(val) {
|
|
119
|
-
// primitive types
|
|
120
|
-
const type = typeof val;
|
|
121
|
-
if (type == 'number' || type == 'boolean' || val == null) {
|
|
122
|
-
return `${val}`;
|
|
123
|
-
}
|
|
124
|
-
if (type == 'string') {
|
|
125
|
-
return `"${val}"`;
|
|
126
|
-
}
|
|
127
|
-
if (type == 'symbol') {
|
|
128
|
-
const description = val.description;
|
|
129
|
-
if (description == null) {
|
|
130
|
-
return 'Symbol';
|
|
131
|
-
} else {
|
|
132
|
-
return `Symbol(${description})`;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (type == 'function') {
|
|
136
|
-
const name = val.name;
|
|
137
|
-
if (typeof name == 'string' && name.length > 0) {
|
|
138
|
-
return `Function(${name})`;
|
|
139
|
-
} else {
|
|
140
|
-
return 'Function';
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
// objects
|
|
144
|
-
if (Array.isArray(val)) {
|
|
145
|
-
const length = val.length;
|
|
146
|
-
let debug = '[';
|
|
147
|
-
if (length > 0) {
|
|
148
|
-
debug += debugString(val[0]);
|
|
149
|
-
}
|
|
150
|
-
for(let i = 1; i < length; i++) {
|
|
151
|
-
debug += ', ' + debugString(val[i]);
|
|
152
|
-
}
|
|
153
|
-
debug += ']';
|
|
154
|
-
return debug;
|
|
155
|
-
}
|
|
156
|
-
// Test for built-in
|
|
157
|
-
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
158
|
-
let className;
|
|
159
|
-
if (builtInMatches.length > 1) {
|
|
160
|
-
className = builtInMatches[1];
|
|
161
|
-
} else {
|
|
162
|
-
// Failed to match the standard '[object ClassName]'
|
|
163
|
-
return toString.call(val);
|
|
164
|
-
}
|
|
165
|
-
if (className == 'Object') {
|
|
166
|
-
// we're a user defined class or Object
|
|
167
|
-
// JSON.stringify avoids problems with cycles, and is generally much
|
|
168
|
-
// easier than looping through ownProperties of `val`.
|
|
169
|
-
try {
|
|
170
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
171
|
-
} catch (_) {
|
|
172
|
-
return 'Object';
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
// errors
|
|
176
|
-
if (val instanceof Error) {
|
|
177
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
178
|
-
}
|
|
179
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
180
|
-
return className;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function _assertClass(instance, klass) {
|
|
184
|
-
if (!(instance instanceof klass)) {
|
|
185
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
186
|
-
}
|
|
187
|
-
return instance.ptr;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* This is a method that exposes the same API as `compile`
|
|
191
|
-
* But uses the Context based APi internally
|
|
192
|
-
* @param {string} entry_point
|
|
193
|
-
* @param {boolean | undefined} contracts
|
|
194
|
-
* @param {DependencyGraph | undefined} dependency_graph
|
|
195
|
-
* @param {PathToFileSourceMap} file_source_map
|
|
196
|
-
* @returns {CompileResult}
|
|
197
|
-
*/
|
|
198
|
-
export function compile_(entry_point, contracts, dependency_graph, file_source_map) {
|
|
199
|
-
try {
|
|
200
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
201
|
-
const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
202
|
-
const len0 = WASM_VECTOR_LEN;
|
|
203
|
-
_assertClass(file_source_map, PathToFileSourceMap);
|
|
204
|
-
var ptr1 = file_source_map.__destroy_into_raw();
|
|
205
|
-
wasm.compile_(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
|
|
206
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
207
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
208
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
209
|
-
if (r2) {
|
|
210
|
-
throw takeObject(r1);
|
|
211
|
-
}
|
|
212
|
-
return takeObject(r0);
|
|
213
|
-
} finally {
|
|
214
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* @param {string} filter
|
|
220
|
-
*/
|
|
221
|
-
export function init_log_level(filter) {
|
|
222
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
223
|
-
const len0 = WASM_VECTOR_LEN;
|
|
224
|
-
wasm.init_log_level(ptr0, len0);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* @returns {any}
|
|
229
|
-
*/
|
|
230
|
-
export function build_info() {
|
|
231
|
-
const ret = wasm.build_info();
|
|
232
|
-
return takeObject(ret);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* @param {string} entry_point
|
|
237
|
-
* @param {boolean | undefined} contracts
|
|
238
|
-
* @param {DependencyGraph | undefined} dependency_graph
|
|
239
|
-
* @param {PathToFileSourceMap} file_source_map
|
|
240
|
-
* @returns {CompileResult}
|
|
241
|
-
*/
|
|
242
|
-
export function compile(entry_point, contracts, dependency_graph, file_source_map) {
|
|
243
|
-
try {
|
|
244
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
245
|
-
const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
246
|
-
const len0 = WASM_VECTOR_LEN;
|
|
247
|
-
_assertClass(file_source_map, PathToFileSourceMap);
|
|
248
|
-
var ptr1 = file_source_map.__destroy_into_raw();
|
|
249
|
-
wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
|
|
250
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
251
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
252
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
253
|
-
if (r2) {
|
|
254
|
-
throw takeObject(r1);
|
|
255
|
-
}
|
|
256
|
-
return takeObject(r0);
|
|
257
|
-
} finally {
|
|
258
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
function handleError(f, args) {
|
|
263
|
-
try {
|
|
264
|
-
return f.apply(this, args);
|
|
265
|
-
} catch (e) {
|
|
266
|
-
wasm.__wbindgen_export_3(addHeapObject(e));
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* This is a wrapper class that is wasm-bindgen compatible
|
|
271
|
-
* We do not use js_name and rename it like CrateId because
|
|
272
|
-
* then the impl block is not picked up in javascript.
|
|
273
|
-
*/
|
|
274
|
-
export class CompilerContext {
|
|
275
|
-
|
|
276
|
-
static __wrap(ptr) {
|
|
277
|
-
ptr = ptr >>> 0;
|
|
278
|
-
const obj = Object.create(CompilerContext.prototype);
|
|
279
|
-
obj.__wbg_ptr = ptr;
|
|
280
|
-
|
|
281
|
-
return obj;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
__destroy_into_raw() {
|
|
285
|
-
const ptr = this.__wbg_ptr;
|
|
286
|
-
this.__wbg_ptr = 0;
|
|
287
|
-
|
|
288
|
-
return ptr;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
free() {
|
|
292
|
-
const ptr = this.__destroy_into_raw();
|
|
293
|
-
wasm.__wbg_compilercontext_free(ptr);
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* @param {PathToFileSourceMap} source_map
|
|
297
|
-
*/
|
|
298
|
-
constructor(source_map) {
|
|
299
|
-
_assertClass(source_map, PathToFileSourceMap);
|
|
300
|
-
var ptr0 = source_map.__destroy_into_raw();
|
|
301
|
-
const ret = wasm.compilercontext_new(ptr0);
|
|
302
|
-
return CompilerContext.__wrap(ret);
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* @param {string} path_to_crate
|
|
306
|
-
* @returns {CrateId}
|
|
307
|
-
*/
|
|
308
|
-
process_root_crate(path_to_crate) {
|
|
309
|
-
const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
310
|
-
const len0 = WASM_VECTOR_LEN;
|
|
311
|
-
const ret = wasm.compilercontext_process_root_crate(this.__wbg_ptr, ptr0, len0);
|
|
312
|
-
return CrateId.__wrap(ret);
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* @param {string} path_to_crate
|
|
316
|
-
* @returns {CrateId}
|
|
317
|
-
*/
|
|
318
|
-
process_dependency_crate(path_to_crate) {
|
|
319
|
-
const ptr0 = passStringToWasm0(path_to_crate, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
320
|
-
const len0 = WASM_VECTOR_LEN;
|
|
321
|
-
const ret = wasm.compilercontext_process_dependency_crate(this.__wbg_ptr, ptr0, len0);
|
|
322
|
-
return CrateId.__wrap(ret);
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* @param {string} crate_name
|
|
326
|
-
* @param {CrateId} from
|
|
327
|
-
* @param {CrateId} to
|
|
328
|
-
*/
|
|
329
|
-
add_dependency_edge(crate_name, from, to) {
|
|
330
|
-
const ptr0 = passStringToWasm0(crate_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
331
|
-
const len0 = WASM_VECTOR_LEN;
|
|
332
|
-
_assertClass(from, CrateId);
|
|
333
|
-
_assertClass(to, CrateId);
|
|
334
|
-
wasm.compilercontext_add_dependency_edge(this.__wbg_ptr, ptr0, len0, from.__wbg_ptr, to.__wbg_ptr);
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* @param {number} program_width
|
|
338
|
-
* @returns {CompileResult}
|
|
339
|
-
*/
|
|
340
|
-
compile_program(program_width) {
|
|
341
|
-
try {
|
|
342
|
-
const ptr = this.__destroy_into_raw();
|
|
343
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
344
|
-
wasm.compilercontext_compile_program(retptr, ptr, program_width);
|
|
345
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
346
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
347
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
348
|
-
if (r2) {
|
|
349
|
-
throw takeObject(r1);
|
|
350
|
-
}
|
|
351
|
-
return takeObject(r0);
|
|
352
|
-
} finally {
|
|
353
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* @param {number} program_width
|
|
358
|
-
* @returns {CompileResult}
|
|
359
|
-
*/
|
|
360
|
-
compile_contract(program_width) {
|
|
361
|
-
try {
|
|
362
|
-
const ptr = this.__destroy_into_raw();
|
|
363
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
364
|
-
wasm.compilercontext_compile_contract(retptr, ptr, program_width);
|
|
365
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
366
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
367
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
368
|
-
if (r2) {
|
|
369
|
-
throw takeObject(r1);
|
|
370
|
-
}
|
|
371
|
-
return takeObject(r0);
|
|
372
|
-
} finally {
|
|
373
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
*/
|
|
379
|
-
export class CrateId {
|
|
380
|
-
|
|
381
|
-
static __wrap(ptr) {
|
|
382
|
-
ptr = ptr >>> 0;
|
|
383
|
-
const obj = Object.create(CrateId.prototype);
|
|
384
|
-
obj.__wbg_ptr = ptr;
|
|
385
|
-
|
|
386
|
-
return obj;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
__destroy_into_raw() {
|
|
390
|
-
const ptr = this.__wbg_ptr;
|
|
391
|
-
this.__wbg_ptr = 0;
|
|
392
|
-
|
|
393
|
-
return ptr;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
free() {
|
|
397
|
-
const ptr = this.__destroy_into_raw();
|
|
398
|
-
wasm.__wbg_crateid_free(ptr);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
*/
|
|
403
|
-
export class PathToFileSourceMap {
|
|
404
|
-
|
|
405
|
-
static __wrap(ptr) {
|
|
406
|
-
ptr = ptr >>> 0;
|
|
407
|
-
const obj = Object.create(PathToFileSourceMap.prototype);
|
|
408
|
-
obj.__wbg_ptr = ptr;
|
|
409
|
-
|
|
410
|
-
return obj;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
__destroy_into_raw() {
|
|
414
|
-
const ptr = this.__wbg_ptr;
|
|
415
|
-
this.__wbg_ptr = 0;
|
|
416
|
-
|
|
417
|
-
return ptr;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
free() {
|
|
421
|
-
const ptr = this.__destroy_into_raw();
|
|
422
|
-
wasm.__wbg_pathtofilesourcemap_free(ptr);
|
|
423
|
-
}
|
|
424
|
-
/**
|
|
425
|
-
*/
|
|
426
|
-
constructor() {
|
|
427
|
-
const ret = wasm.pathtofilesourcemap_new();
|
|
428
|
-
return PathToFileSourceMap.__wrap(ret);
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* @param {string} path
|
|
432
|
-
* @param {string} source_code
|
|
433
|
-
* @returns {boolean}
|
|
434
|
-
*/
|
|
435
|
-
add_source_code(path, source_code) {
|
|
436
|
-
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
437
|
-
const len0 = WASM_VECTOR_LEN;
|
|
438
|
-
const ptr1 = passStringToWasm0(source_code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
439
|
-
const len1 = WASM_VECTOR_LEN;
|
|
440
|
-
const ret = wasm.pathtofilesourcemap_add_source_code(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
441
|
-
return ret !== 0;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
async function __wbg_load(module, imports) {
|
|
446
|
-
if (typeof Response === 'function' && module instanceof Response) {
|
|
447
|
-
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
448
|
-
try {
|
|
449
|
-
return await WebAssembly.instantiateStreaming(module, imports);
|
|
450
|
-
|
|
451
|
-
} catch (e) {
|
|
452
|
-
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
453
|
-
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);
|
|
454
|
-
|
|
455
|
-
} else {
|
|
456
|
-
throw e;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
const bytes = await module.arrayBuffer();
|
|
462
|
-
return await WebAssembly.instantiate(bytes, imports);
|
|
463
|
-
|
|
464
|
-
} else {
|
|
465
|
-
const instance = await WebAssembly.instantiate(module, imports);
|
|
466
|
-
|
|
467
|
-
if (instance instanceof WebAssembly.Instance) {
|
|
468
|
-
return { instance, module };
|
|
469
|
-
|
|
470
|
-
} else {
|
|
471
|
-
return instance;
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
function __wbg_get_imports() {
|
|
477
|
-
const imports = {};
|
|
478
|
-
imports.wbg = {};
|
|
479
|
-
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
480
|
-
takeObject(arg0);
|
|
481
|
-
};
|
|
482
|
-
imports.wbg.__wbg_constructor_a29cdb41a75eb0e8 = function(arg0) {
|
|
483
|
-
const ret = new Error(takeObject(arg0));
|
|
484
|
-
return addHeapObject(ret);
|
|
485
|
-
};
|
|
486
|
-
imports.wbg.__wbg_constructor_a3b5b211c5053ce8 = function() {
|
|
487
|
-
const ret = new Object();
|
|
488
|
-
return addHeapObject(ret);
|
|
489
|
-
};
|
|
490
|
-
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
491
|
-
const ret = getObject(arg0) === undefined;
|
|
492
|
-
return ret;
|
|
493
|
-
};
|
|
494
|
-
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
|
495
|
-
const ret = new Error();
|
|
496
|
-
return addHeapObject(ret);
|
|
497
|
-
};
|
|
498
|
-
imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
|
|
499
|
-
const ret = getObject(arg1).stack;
|
|
500
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
501
|
-
const len1 = WASM_VECTOR_LEN;
|
|
502
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
503
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
504
|
-
};
|
|
505
|
-
imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
506
|
-
let deferred0_0;
|
|
507
|
-
let deferred0_1;
|
|
508
|
-
try {
|
|
509
|
-
deferred0_0 = arg0;
|
|
510
|
-
deferred0_1 = arg1;
|
|
511
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
512
|
-
} finally {
|
|
513
|
-
wasm.__wbindgen_export_2(deferred0_0, deferred0_1);
|
|
514
|
-
}
|
|
515
|
-
};
|
|
516
|
-
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
517
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
518
|
-
return addHeapObject(ret);
|
|
519
|
-
};
|
|
520
|
-
imports.wbg.__wbg_debug_e3f6a1578e6d45ca = function(arg0) {
|
|
521
|
-
console.debug(getObject(arg0));
|
|
522
|
-
};
|
|
523
|
-
imports.wbg.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
|
|
524
|
-
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
525
|
-
};
|
|
526
|
-
imports.wbg.__wbg_error_a7e23606158b68b9 = function(arg0) {
|
|
527
|
-
console.error(getObject(arg0));
|
|
528
|
-
};
|
|
529
|
-
imports.wbg.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) {
|
|
530
|
-
console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
531
|
-
};
|
|
532
|
-
imports.wbg.__wbg_info_05db236d79f1b785 = function(arg0) {
|
|
533
|
-
console.info(getObject(arg0));
|
|
534
|
-
};
|
|
535
|
-
imports.wbg.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) {
|
|
536
|
-
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
537
|
-
};
|
|
538
|
-
imports.wbg.__wbg_warn_9bdd743e9f5fe1e0 = function(arg0) {
|
|
539
|
-
console.warn(getObject(arg0));
|
|
540
|
-
};
|
|
541
|
-
imports.wbg.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
|
|
542
|
-
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
543
|
-
};
|
|
544
|
-
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
545
|
-
const obj = getObject(arg1);
|
|
546
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
547
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
548
|
-
var len1 = WASM_VECTOR_LEN;
|
|
549
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
550
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
551
|
-
};
|
|
552
|
-
imports.wbg.__wbg_set_07da13cc24b69217 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
553
|
-
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
554
|
-
return ret;
|
|
555
|
-
}, arguments) };
|
|
556
|
-
imports.wbg.__wbg_parse_76a8a18ca3f8730b = function() { return handleError(function (arg0, arg1) {
|
|
557
|
-
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
558
|
-
return addHeapObject(ret);
|
|
559
|
-
}, arguments) };
|
|
560
|
-
imports.wbg.__wbg_stringify_d06ad2addc54d51e = function() { return handleError(function (arg0) {
|
|
561
|
-
const ret = JSON.stringify(getObject(arg0));
|
|
562
|
-
return addHeapObject(ret);
|
|
563
|
-
}, arguments) };
|
|
564
|
-
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
565
|
-
const ret = debugString(getObject(arg1));
|
|
566
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
567
|
-
const len1 = WASM_VECTOR_LEN;
|
|
568
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
569
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
570
|
-
};
|
|
571
|
-
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
572
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
573
|
-
};
|
|
574
|
-
|
|
575
|
-
return imports;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
function __wbg_init_memory(imports, maybe_memory) {
|
|
579
|
-
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
function __wbg_finalize_init(instance, module) {
|
|
583
|
-
wasm = instance.exports;
|
|
584
|
-
__wbg_init.__wbindgen_wasm_module = module;
|
|
585
|
-
cachedInt32Memory0 = null;
|
|
586
|
-
cachedUint8Memory0 = null;
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
return wasm;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
function initSync(module) {
|
|
593
|
-
if (wasm !== undefined) return wasm;
|
|
594
|
-
|
|
595
|
-
const imports = __wbg_get_imports();
|
|
596
|
-
|
|
597
|
-
__wbg_init_memory(imports);
|
|
598
|
-
|
|
599
|
-
if (!(module instanceof WebAssembly.Module)) {
|
|
600
|
-
module = new WebAssembly.Module(module);
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
const instance = new WebAssembly.Instance(module, imports);
|
|
604
|
-
|
|
605
|
-
return __wbg_finalize_init(instance, module);
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
async function __wbg_init(input) {
|
|
609
|
-
if (wasm !== undefined) return wasm;
|
|
610
|
-
|
|
611
|
-
if (typeof input === 'undefined') {
|
|
612
|
-
input = new URL('noir_wasm_bg.wasm', import.meta.url);
|
|
613
|
-
}
|
|
614
|
-
const imports = __wbg_get_imports();
|
|
615
|
-
|
|
616
|
-
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
617
|
-
input = fetch(input);
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
__wbg_init_memory(imports);
|
|
621
|
-
|
|
622
|
-
const { instance, module } = await __wbg_load(await input, imports);
|
|
623
|
-
|
|
624
|
-
return __wbg_finalize_init(instance, module);
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
export { initSync }
|
|
628
|
-
export default __wbg_init;
|
package/web/noir_wasm_bg.wasm
DELETED
|
Binary file
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function __wbg_compilercontext_free(a: number): void;
|
|
5
|
-
export function __wbg_crateid_free(a: number): void;
|
|
6
|
-
export function compilercontext_new(a: number): number;
|
|
7
|
-
export function compilercontext_process_root_crate(a: number, b: number, c: number): number;
|
|
8
|
-
export function compilercontext_process_dependency_crate(a: number, b: number, c: number): number;
|
|
9
|
-
export function compilercontext_add_dependency_edge(a: number, b: number, c: number, d: number, e: number): void;
|
|
10
|
-
export function compilercontext_compile_program(a: number, b: number, c: number): void;
|
|
11
|
-
export function compilercontext_compile_contract(a: number, b: number, c: number): void;
|
|
12
|
-
export function compile_(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
13
|
-
export function init_log_level(a: number, b: number): void;
|
|
14
|
-
export function build_info(): number;
|
|
15
|
-
export function __wbg_pathtofilesourcemap_free(a: number): void;
|
|
16
|
-
export function pathtofilesourcemap_new(): number;
|
|
17
|
-
export function pathtofilesourcemap_add_source_code(a: number, b: number, c: number, d: number, e: number): number;
|
|
18
|
-
export function compile(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
19
|
-
export function __wbindgen_export_0(a: number): number;
|
|
20
|
-
export function __wbindgen_export_1(a: number, b: number, c: number): number;
|
|
21
|
-
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
|
22
|
-
export function __wbindgen_export_2(a: number, b: number): void;
|
|
23
|
-
export function __wbindgen_export_3(a: number): void;
|