@noir-lang/noir_wasm 0.10.0-46a522c → 0.10.0-f5d04f1
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 +1 -1
- package/nodejs/noir_wasm.js +65 -47
- package/nodejs/noir_wasm_bg.wasm +0 -0
- package/package.json +9 -2
- package/web/noir_wasm.js +60 -45
- package/web/noir_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
# Noir Lang WASM JavaScript Package
|
|
2
2
|
|
|
3
3
|
## Tracks
|
|
4
|
-
Noir lang Repository [noir-lang/noir@
|
|
4
|
+
Noir lang Repository [noir-lang/noir@f5d04f1](https://github.com/noir-lang/noir/tree/f5d04f1ec406cb7325de8f81497c7861b89b3a48)
|
package/nodejs/noir_wasm.js
CHANGED
|
@@ -2,44 +2,39 @@ let imports = {};
|
|
|
2
2
|
imports['__wbindgen_placeholder__'] = module.exports;
|
|
3
3
|
let wasm;
|
|
4
4
|
const { read_file } = require(`@noir-lang/noir-source-resolver`);
|
|
5
|
-
const {
|
|
6
|
-
|
|
7
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
8
|
-
|
|
9
|
-
cachedTextDecoder.decode();
|
|
10
|
-
|
|
11
|
-
let cachedUint8Memory0 = new Uint8Array();
|
|
12
|
-
|
|
13
|
-
function getUint8Memory0() {
|
|
14
|
-
if (cachedUint8Memory0.byteLength === 0) {
|
|
15
|
-
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
16
|
-
}
|
|
17
|
-
return cachedUint8Memory0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function getStringFromWasm0(ptr, len) {
|
|
21
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
22
|
-
}
|
|
5
|
+
const { TextEncoder, TextDecoder } = require(`util`);
|
|
23
6
|
|
|
24
7
|
const heap = new Array(32).fill(undefined);
|
|
25
8
|
|
|
26
9
|
heap.push(undefined, null, true, false);
|
|
27
10
|
|
|
28
|
-
|
|
11
|
+
function getObject(idx) { return heap[idx]; }
|
|
29
12
|
|
|
30
|
-
|
|
31
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
32
|
-
const idx = heap_next;
|
|
33
|
-
heap_next = heap[idx];
|
|
13
|
+
let heap_next = heap.length;
|
|
34
14
|
|
|
35
|
-
|
|
36
|
-
|
|
15
|
+
function dropObject(idx) {
|
|
16
|
+
if (idx < 36) return;
|
|
17
|
+
heap[idx] = heap_next;
|
|
18
|
+
heap_next = idx;
|
|
37
19
|
}
|
|
38
20
|
|
|
39
|
-
function
|
|
21
|
+
function takeObject(idx) {
|
|
22
|
+
const ret = getObject(idx);
|
|
23
|
+
dropObject(idx);
|
|
24
|
+
return ret;
|
|
25
|
+
}
|
|
40
26
|
|
|
41
27
|
let WASM_VECTOR_LEN = 0;
|
|
42
28
|
|
|
29
|
+
let cachedUint8Memory0 = new Uint8Array();
|
|
30
|
+
|
|
31
|
+
function getUint8Memory0() {
|
|
32
|
+
if (cachedUint8Memory0.byteLength === 0) {
|
|
33
|
+
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
34
|
+
}
|
|
35
|
+
return cachedUint8Memory0;
|
|
36
|
+
}
|
|
37
|
+
|
|
43
38
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
44
39
|
|
|
45
40
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -93,6 +88,10 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
93
88
|
return ptr;
|
|
94
89
|
}
|
|
95
90
|
|
|
91
|
+
function isLikeNone(x) {
|
|
92
|
+
return x === undefined || x === null;
|
|
93
|
+
}
|
|
94
|
+
|
|
96
95
|
let cachedInt32Memory0 = new Int32Array();
|
|
97
96
|
|
|
98
97
|
function getInt32Memory0() {
|
|
@@ -102,16 +101,12 @@ function getInt32Memory0() {
|
|
|
102
101
|
return cachedInt32Memory0;
|
|
103
102
|
}
|
|
104
103
|
|
|
105
|
-
|
|
106
|
-
if (idx < 36) return;
|
|
107
|
-
heap[idx] = heap_next;
|
|
108
|
-
heap_next = idx;
|
|
109
|
-
}
|
|
104
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
110
105
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return
|
|
106
|
+
cachedTextDecoder.decode();
|
|
107
|
+
|
|
108
|
+
function getStringFromWasm0(ptr, len) {
|
|
109
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
115
110
|
}
|
|
116
111
|
/**
|
|
117
112
|
* @param {string} src
|
|
@@ -141,6 +136,15 @@ module.exports.acir_from_bytes = function(bytes) {
|
|
|
141
136
|
return takeObject(ret);
|
|
142
137
|
};
|
|
143
138
|
|
|
139
|
+
function addHeapObject(obj) {
|
|
140
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
141
|
+
const idx = heap_next;
|
|
142
|
+
heap_next = heap[idx];
|
|
143
|
+
|
|
144
|
+
heap[idx] = obj;
|
|
145
|
+
return idx;
|
|
146
|
+
}
|
|
147
|
+
|
|
144
148
|
function getArrayU8FromWasm0(ptr, len) {
|
|
145
149
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
146
150
|
}
|
|
@@ -170,18 +174,9 @@ function handleError(f, args) {
|
|
|
170
174
|
}
|
|
171
175
|
}
|
|
172
176
|
|
|
173
|
-
module.exports.
|
|
174
|
-
const ret =
|
|
175
|
-
return
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
module.exports.__wbindgen_json_serialize = function(arg0, arg1) {
|
|
179
|
-
const obj = getObject(arg1);
|
|
180
|
-
const ret = JSON.stringify(obj === undefined ? null : obj);
|
|
181
|
-
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
182
|
-
const len0 = WASM_VECTOR_LEN;
|
|
183
|
-
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
184
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
177
|
+
module.exports.__wbindgen_is_undefined = function(arg0) {
|
|
178
|
+
const ret = getObject(arg0) === undefined;
|
|
179
|
+
return ret;
|
|
185
180
|
};
|
|
186
181
|
|
|
187
182
|
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
@@ -217,6 +212,29 @@ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
|
217
212
|
}
|
|
218
213
|
};
|
|
219
214
|
|
|
215
|
+
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
216
|
+
const obj = getObject(arg1);
|
|
217
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
218
|
+
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
219
|
+
var len0 = WASM_VECTOR_LEN;
|
|
220
|
+
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
221
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
module.exports.__wbg_parse_e23be3fecd886e2a = function() { return handleError(function (arg0, arg1) {
|
|
225
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
226
|
+
return addHeapObject(ret);
|
|
227
|
+
}, arguments) };
|
|
228
|
+
|
|
229
|
+
module.exports.__wbg_stringify_d6471d300ded9b68 = function() { return handleError(function (arg0) {
|
|
230
|
+
const ret = JSON.stringify(getObject(arg0));
|
|
231
|
+
return addHeapObject(ret);
|
|
232
|
+
}, arguments) };
|
|
233
|
+
|
|
234
|
+
module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
235
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
236
|
+
};
|
|
237
|
+
|
|
220
238
|
const path = require('path').join(__dirname, 'noir_wasm_bg.wasm');
|
|
221
239
|
const bytes = require('fs').readFileSync(path);
|
|
222
240
|
|
package/nodejs/noir_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noir-lang/noir_wasm",
|
|
3
|
-
"version": "0.10.0-
|
|
3
|
+
"version": "0.10.0-f5d04f1",
|
|
4
4
|
"files": [
|
|
5
5
|
"nodejs",
|
|
6
6
|
"web",
|
|
@@ -9,5 +9,12 @@
|
|
|
9
9
|
"main": "./nodejs/noir_wasm.js",
|
|
10
10
|
"types": "./web/noir_wasm.d.ts",
|
|
11
11
|
"module": "./web/noir_wasm.js",
|
|
12
|
-
"sideEffects": false
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"@noir-lang/noir-source-resolver": "1.0.0"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/noir-lang/noir_wasm.git"
|
|
19
|
+
}
|
|
13
20
|
}
|
package/web/noir_wasm.js
CHANGED
|
@@ -2,42 +2,37 @@ import { read_file } from '@noir-lang/noir-source-resolver';
|
|
|
2
2
|
|
|
3
3
|
let wasm;
|
|
4
4
|
|
|
5
|
-
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
6
|
-
|
|
7
|
-
cachedTextDecoder.decode();
|
|
8
|
-
|
|
9
|
-
let cachedUint8Memory0 = new Uint8Array();
|
|
10
|
-
|
|
11
|
-
function getUint8Memory0() {
|
|
12
|
-
if (cachedUint8Memory0.byteLength === 0) {
|
|
13
|
-
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
14
|
-
}
|
|
15
|
-
return cachedUint8Memory0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function getStringFromWasm0(ptr, len) {
|
|
19
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
5
|
const heap = new Array(32).fill(undefined);
|
|
23
6
|
|
|
24
7
|
heap.push(undefined, null, true, false);
|
|
25
8
|
|
|
26
|
-
|
|
9
|
+
function getObject(idx) { return heap[idx]; }
|
|
27
10
|
|
|
28
|
-
|
|
29
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
30
|
-
const idx = heap_next;
|
|
31
|
-
heap_next = heap[idx];
|
|
11
|
+
let heap_next = heap.length;
|
|
32
12
|
|
|
33
|
-
|
|
34
|
-
|
|
13
|
+
function dropObject(idx) {
|
|
14
|
+
if (idx < 36) return;
|
|
15
|
+
heap[idx] = heap_next;
|
|
16
|
+
heap_next = idx;
|
|
35
17
|
}
|
|
36
18
|
|
|
37
|
-
function
|
|
19
|
+
function takeObject(idx) {
|
|
20
|
+
const ret = getObject(idx);
|
|
21
|
+
dropObject(idx);
|
|
22
|
+
return ret;
|
|
23
|
+
}
|
|
38
24
|
|
|
39
25
|
let WASM_VECTOR_LEN = 0;
|
|
40
26
|
|
|
27
|
+
let cachedUint8Memory0 = new Uint8Array();
|
|
28
|
+
|
|
29
|
+
function getUint8Memory0() {
|
|
30
|
+
if (cachedUint8Memory0.byteLength === 0) {
|
|
31
|
+
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
32
|
+
}
|
|
33
|
+
return cachedUint8Memory0;
|
|
34
|
+
}
|
|
35
|
+
|
|
41
36
|
const cachedTextEncoder = new TextEncoder('utf-8');
|
|
42
37
|
|
|
43
38
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -91,6 +86,10 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
91
86
|
return ptr;
|
|
92
87
|
}
|
|
93
88
|
|
|
89
|
+
function isLikeNone(x) {
|
|
90
|
+
return x === undefined || x === null;
|
|
91
|
+
}
|
|
92
|
+
|
|
94
93
|
let cachedInt32Memory0 = new Int32Array();
|
|
95
94
|
|
|
96
95
|
function getInt32Memory0() {
|
|
@@ -100,16 +99,12 @@ function getInt32Memory0() {
|
|
|
100
99
|
return cachedInt32Memory0;
|
|
101
100
|
}
|
|
102
101
|
|
|
103
|
-
|
|
104
|
-
if (idx < 36) return;
|
|
105
|
-
heap[idx] = heap_next;
|
|
106
|
-
heap_next = idx;
|
|
107
|
-
}
|
|
102
|
+
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
108
103
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return
|
|
104
|
+
cachedTextDecoder.decode();
|
|
105
|
+
|
|
106
|
+
function getStringFromWasm0(ptr, len) {
|
|
107
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
113
108
|
}
|
|
114
109
|
/**
|
|
115
110
|
* @param {string} src
|
|
@@ -139,6 +134,15 @@ export function acir_from_bytes(bytes) {
|
|
|
139
134
|
return takeObject(ret);
|
|
140
135
|
}
|
|
141
136
|
|
|
137
|
+
function addHeapObject(obj) {
|
|
138
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
139
|
+
const idx = heap_next;
|
|
140
|
+
heap_next = heap[idx];
|
|
141
|
+
|
|
142
|
+
heap[idx] = obj;
|
|
143
|
+
return idx;
|
|
144
|
+
}
|
|
145
|
+
|
|
142
146
|
function getArrayU8FromWasm0(ptr, len) {
|
|
143
147
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
144
148
|
}
|
|
@@ -202,17 +206,9 @@ async function load(module, imports) {
|
|
|
202
206
|
function getImports() {
|
|
203
207
|
const imports = {};
|
|
204
208
|
imports.wbg = {};
|
|
205
|
-
imports.wbg.
|
|
206
|
-
const ret =
|
|
207
|
-
return
|
|
208
|
-
};
|
|
209
|
-
imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
|
|
210
|
-
const obj = getObject(arg1);
|
|
211
|
-
const ret = JSON.stringify(obj === undefined ? null : obj);
|
|
212
|
-
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
213
|
-
const len0 = WASM_VECTOR_LEN;
|
|
214
|
-
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
215
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
209
|
+
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
210
|
+
const ret = getObject(arg0) === undefined;
|
|
211
|
+
return ret;
|
|
216
212
|
};
|
|
217
213
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
218
214
|
takeObject(arg0);
|
|
@@ -242,6 +238,25 @@ function getImports() {
|
|
|
242
238
|
wasm.__wbindgen_export_2(arg0, arg1);
|
|
243
239
|
}
|
|
244
240
|
};
|
|
241
|
+
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
242
|
+
const obj = getObject(arg1);
|
|
243
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
244
|
+
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
245
|
+
var len0 = WASM_VECTOR_LEN;
|
|
246
|
+
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
247
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
248
|
+
};
|
|
249
|
+
imports.wbg.__wbg_parse_e23be3fecd886e2a = function() { return handleError(function (arg0, arg1) {
|
|
250
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
251
|
+
return addHeapObject(ret);
|
|
252
|
+
}, arguments) };
|
|
253
|
+
imports.wbg.__wbg_stringify_d6471d300ded9b68 = function() { return handleError(function (arg0) {
|
|
254
|
+
const ret = JSON.stringify(getObject(arg0));
|
|
255
|
+
return addHeapObject(ret);
|
|
256
|
+
}, arguments) };
|
|
257
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
258
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
259
|
+
};
|
|
245
260
|
|
|
246
261
|
return imports;
|
|
247
262
|
}
|
package/web/noir_wasm_bg.wasm
CHANGED
|
Binary file
|