@noir-lang/noir_wasm 0.2.0 → 0.3.0
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/noir_wasm.d.ts +10 -0
- package/noir_wasm.js +73 -27
- package/noir_wasm_bg.wasm +0 -0
- package/noir_wasm_bg.wasm.d.ts +5 -2
- package/package.json +1 -1
package/noir_wasm.d.ts
CHANGED
|
@@ -5,3 +5,13 @@
|
|
|
5
5
|
* @returns {any}
|
|
6
6
|
*/
|
|
7
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
CHANGED
|
@@ -8,7 +8,8 @@ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true
|
|
|
8
8
|
|
|
9
9
|
cachedTextDecoder.decode();
|
|
10
10
|
|
|
11
|
-
let cachedUint8Memory0;
|
|
11
|
+
let cachedUint8Memory0 = new Uint8Array();
|
|
12
|
+
|
|
12
13
|
function getUint8Memory0() {
|
|
13
14
|
if (cachedUint8Memory0.byteLength === 0) {
|
|
14
15
|
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
@@ -37,18 +38,6 @@ function addHeapObject(obj) {
|
|
|
37
38
|
|
|
38
39
|
function getObject(idx) { return heap[idx]; }
|
|
39
40
|
|
|
40
|
-
function dropObject(idx) {
|
|
41
|
-
if (idx < 36) return;
|
|
42
|
-
heap[idx] = heap_next;
|
|
43
|
-
heap_next = idx;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function takeObject(idx) {
|
|
47
|
-
const ret = getObject(idx);
|
|
48
|
-
dropObject(idx);
|
|
49
|
-
return ret;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
41
|
let WASM_VECTOR_LEN = 0;
|
|
53
42
|
|
|
54
43
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -103,6 +92,27 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
103
92
|
WASM_VECTOR_LEN = offset;
|
|
104
93
|
return ptr;
|
|
105
94
|
}
|
|
95
|
+
|
|
96
|
+
let cachedInt32Memory0 = new Int32Array();
|
|
97
|
+
|
|
98
|
+
function getInt32Memory0() {
|
|
99
|
+
if (cachedInt32Memory0.byteLength === 0) {
|
|
100
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
101
|
+
}
|
|
102
|
+
return cachedInt32Memory0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function dropObject(idx) {
|
|
106
|
+
if (idx < 36) return;
|
|
107
|
+
heap[idx] = heap_next;
|
|
108
|
+
heap_next = idx;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function takeObject(idx) {
|
|
112
|
+
const ret = getObject(idx);
|
|
113
|
+
dropObject(idx);
|
|
114
|
+
return ret;
|
|
115
|
+
}
|
|
106
116
|
/**
|
|
107
117
|
* @param {string} src
|
|
108
118
|
* @returns {any}
|
|
@@ -114,19 +124,49 @@ module.exports.compile = function(src) {
|
|
|
114
124
|
return takeObject(ret);
|
|
115
125
|
};
|
|
116
126
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return cachedInt32Memory0;
|
|
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;
|
|
123
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
|
+
};
|
|
124
164
|
|
|
125
165
|
function handleError(f, args) {
|
|
126
166
|
try {
|
|
127
167
|
return f.apply(this, args);
|
|
128
168
|
} catch (e) {
|
|
129
|
-
wasm.
|
|
169
|
+
wasm.__wbindgen_export_3(addHeapObject(e));
|
|
130
170
|
}
|
|
131
171
|
}
|
|
132
172
|
|
|
@@ -135,18 +175,27 @@ module.exports.__wbindgen_json_parse = function(arg0, arg1) {
|
|
|
135
175
|
return addHeapObject(ret);
|
|
136
176
|
};
|
|
137
177
|
|
|
138
|
-
module.exports.
|
|
139
|
-
const
|
|
178
|
+
module.exports.__wbindgen_json_serialize = function(arg0, arg1) {
|
|
179
|
+
const obj = getObject(arg1);
|
|
180
|
+
const ret = JSON.stringify(obj === undefined ? null : obj);
|
|
140
181
|
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
141
182
|
const len0 = WASM_VECTOR_LEN;
|
|
142
183
|
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
143
184
|
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
144
|
-
}
|
|
185
|
+
};
|
|
145
186
|
|
|
146
187
|
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
147
188
|
takeObject(arg0);
|
|
148
189
|
};
|
|
149
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
|
+
|
|
150
199
|
module.exports.__wbg_new_693216e109162396 = function() {
|
|
151
200
|
const ret = new Error();
|
|
152
201
|
return addHeapObject(ret);
|
|
@@ -164,7 +213,7 @@ module.exports.__wbg_error_09919627ac0992f5 = function(arg0, arg1) {
|
|
|
164
213
|
try {
|
|
165
214
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
166
215
|
} finally {
|
|
167
|
-
wasm.
|
|
216
|
+
wasm.__wbindgen_export_2(arg0, arg1);
|
|
168
217
|
}
|
|
169
218
|
};
|
|
170
219
|
|
|
@@ -176,6 +225,3 @@ const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
|
176
225
|
wasm = wasmInstance.exports;
|
|
177
226
|
module.exports.__wasm = wasm;
|
|
178
227
|
|
|
179
|
-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
180
|
-
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
181
|
-
|
package/noir_wasm_bg.wasm
CHANGED
|
Binary file
|
package/noir_wasm_bg.wasm.d.ts
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export function compile(a: number, b: number): number;
|
|
5
|
+
export function acir_from_bytes(a: number, b: number): number;
|
|
6
|
+
export function acir_to_bytes(a: number, b: number): void;
|
|
5
7
|
export function rust_psm_on_stack(a: number, b: number, c: number, d: number): void;
|
|
6
8
|
export function rust_psm_stack_direction(): number;
|
|
7
9
|
export function rust_psm_stack_pointer(): number;
|
|
8
10
|
export function rust_psm_replace_stack(a: number, b: number, c: number): void;
|
|
9
11
|
export function __wbindgen_export_0(a: number): number;
|
|
10
12
|
export function __wbindgen_export_1(a: number, b: number, c: number): number;
|
|
11
|
-
export function
|
|
12
|
-
export function
|
|
13
|
+
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
|
14
|
+
export function __wbindgen_export_2(a: number, b: number): void;
|
|
15
|
+
export function __wbindgen_export_3(a: number): void;
|