@noir-lang/noir_wasm 0.1.1-fd64be5 → 0.2.0-2688dc4

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 CHANGED
@@ -1,4 +1,4 @@
1
1
  # Noir Lang WASM JavaScript Package
2
2
 
3
3
  ## Tracks
4
- Noir lang Repository [noir-lang/noir@fd64be5](https://github.com/noir-lang/noir/tree/fd64be55fc905a032d53c9ac7a7f7b71da899c37)
4
+ Noir lang Repository [noir-lang/noir@2688dc4](https://github.com/noir-lang/noir/tree/2688dc405968dcd9b7a9486cc9cabffd9698dce8)
@@ -1,10 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * @param {string} src
4
+ * @param {any} args
5
5
  * @returns {any}
6
6
  */
7
- export function compile(src: string): any;
7
+ export function compile(args: any): any;
8
8
  /**
9
9
  * @param {Uint8Array} bytes
10
10
  * @returns {any}
@@ -16,6 +16,16 @@ export function acir_from_bytes(bytes: Uint8Array): any;
16
16
  */
17
17
  export function acir_to_bytes(acir: any): Uint8Array;
18
18
  /**
19
+ * @param {Uint8Array} bytes
20
+ * @returns {any}
21
+ */
22
+ export function acir_read_bytes(bytes: Uint8Array): any;
23
+ /**
24
+ * @param {any} acir
25
+ * @returns {Uint8Array}
26
+ */
27
+ export function acir_write_bytes(acir: any): Uint8Array;
28
+ /**
19
29
  * @returns {any}
20
30
  */
21
31
  export function build_info(): any;
@@ -108,14 +108,21 @@ cachedTextDecoder.decode();
108
108
  function getStringFromWasm0(ptr, len) {
109
109
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
110
110
  }
111
+
112
+ function addHeapObject(obj) {
113
+ if (heap_next === heap.length) heap.push(heap.length + 1);
114
+ const idx = heap_next;
115
+ heap_next = heap[idx];
116
+
117
+ heap[idx] = obj;
118
+ return idx;
119
+ }
111
120
  /**
112
- * @param {string} src
121
+ * @param {any} args
113
122
  * @returns {any}
114
123
  */
115
- module.exports.compile = function(src) {
116
- const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
117
- const len0 = WASM_VECTOR_LEN;
118
- const ret = wasm.compile(ptr0, len0);
124
+ module.exports.compile = function(args) {
125
+ const ret = wasm.compile(addHeapObject(args));
119
126
  return takeObject(ret);
120
127
  };
121
128
 
@@ -136,15 +143,6 @@ module.exports.acir_from_bytes = function(bytes) {
136
143
  return takeObject(ret);
137
144
  };
138
145
 
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
-
148
146
  function getArrayU8FromWasm0(ptr, len) {
149
147
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
150
148
  }
@@ -166,6 +164,35 @@ module.exports.acir_to_bytes = function(acir) {
166
164
  }
167
165
  };
168
166
 
167
+ /**
168
+ * @param {Uint8Array} bytes
169
+ * @returns {any}
170
+ */
171
+ module.exports.acir_read_bytes = function(bytes) {
172
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_0);
173
+ const len0 = WASM_VECTOR_LEN;
174
+ const ret = wasm.acir_read_bytes(ptr0, len0);
175
+ return takeObject(ret);
176
+ };
177
+
178
+ /**
179
+ * @param {any} acir
180
+ * @returns {Uint8Array}
181
+ */
182
+ module.exports.acir_write_bytes = function(acir) {
183
+ try {
184
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
185
+ wasm.acir_write_bytes(retptr, addHeapObject(acir));
186
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
187
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
188
+ var v0 = getArrayU8FromWasm0(r0, r1).slice();
189
+ wasm.__wbindgen_export_2(r0, r1 * 1);
190
+ return v0;
191
+ } finally {
192
+ wasm.__wbindgen_add_to_stack_pointer(16);
193
+ }
194
+ };
195
+
169
196
  /**
170
197
  * @returns {any}
171
198
  */
@@ -191,14 +218,6 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
191
218
  takeObject(arg0);
192
219
  };
193
220
 
194
- module.exports.__wbg_readfile_141fe7d2c0f1edde = function() { return handleError(function (arg0, arg1, arg2) {
195
- const ret = read_file(getStringFromWasm0(arg1, arg2));
196
- const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
197
- const len0 = WASM_VECTOR_LEN;
198
- getInt32Memory0()[arg0 / 4 + 1] = len0;
199
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
200
- }, arguments) };
201
-
202
221
  module.exports.__wbg_new_abda76e883ba8a5f = function() {
203
222
  const ret = new Error();
204
223
  return addHeapObject(ret);
@@ -220,6 +239,14 @@ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
220
239
  }
221
240
  };
222
241
 
242
+ module.exports.__wbg_readfile_1ed72752a157b319 = function() { return handleError(function (arg0, arg1, arg2) {
243
+ const ret = read_file(getStringFromWasm0(arg1, arg2));
244
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
245
+ const len0 = WASM_VECTOR_LEN;
246
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
247
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
248
+ }, arguments) };
249
+
223
250
  module.exports.__wbindgen_string_get = function(arg0, arg1) {
224
251
  const obj = getObject(arg1);
225
252
  const ret = typeof(obj) === 'string' ? obj : undefined;
Binary file
@@ -1,9 +1,11 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function compile(a: number, b: number): number;
4
+ export function compile(a: number): number;
5
5
  export function acir_from_bytes(a: number, b: number): number;
6
6
  export function acir_to_bytes(a: number, b: number): void;
7
+ export function acir_read_bytes(a: number, b: number): number;
8
+ export function acir_write_bytes(a: number, b: number): void;
7
9
  export function build_info(): number;
8
10
  export function __wbindgen_export_0(a: number): number;
9
11
  export function __wbindgen_export_1(a: number, b: number, c: number): number;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "The Noir Team <kevtheappdev@gmail.com>"
5
5
  ],
6
- "version": "0.1.1-fd64be5",
6
+ "version": "0.2.0-2688dc4",
7
7
  "files": [
8
8
  "nodejs",
9
9
  "web",
@@ -21,6 +21,6 @@
21
21
  "url": "https://github.com/noir-lang/noir_wasm.git"
22
22
  },
23
23
  "compiler": {
24
- "versionHash": "fd64be55fc905a032d53c9ac7a7f7b71da899c37"
24
+ "versionHash": "2688dc405968dcd9b7a9486cc9cabffd9698dce8"
25
25
  }
26
26
  }
@@ -1,10 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * @param {string} src
4
+ * @param {any} args
5
5
  * @returns {any}
6
6
  */
7
- export function compile(src: string): any;
7
+ export function compile(args: any): any;
8
8
  /**
9
9
  * @param {Uint8Array} bytes
10
10
  * @returns {any}
@@ -16,6 +16,16 @@ export function acir_from_bytes(bytes: Uint8Array): any;
16
16
  */
17
17
  export function acir_to_bytes(acir: any): Uint8Array;
18
18
  /**
19
+ * @param {Uint8Array} bytes
20
+ * @returns {any}
21
+ */
22
+ export function acir_read_bytes(bytes: Uint8Array): any;
23
+ /**
24
+ * @param {any} acir
25
+ * @returns {Uint8Array}
26
+ */
27
+ export function acir_write_bytes(acir: any): Uint8Array;
28
+ /**
19
29
  * @returns {any}
20
30
  */
21
31
  export function build_info(): any;
@@ -24,9 +34,11 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
24
34
 
25
35
  export interface InitOutput {
26
36
  readonly memory: WebAssembly.Memory;
27
- readonly compile: (a: number, b: number) => number;
37
+ readonly compile: (a: number) => number;
28
38
  readonly acir_from_bytes: (a: number, b: number) => number;
29
39
  readonly acir_to_bytes: (a: number, b: number) => void;
40
+ readonly acir_read_bytes: (a: number, b: number) => number;
41
+ readonly acir_write_bytes: (a: number, b: number) => void;
30
42
  readonly build_info: () => number;
31
43
  readonly __wbindgen_export_0: (a: number) => number;
32
44
  readonly __wbindgen_export_1: (a: number, b: number, c: number) => number;
package/web/noir_wasm.js CHANGED
@@ -106,14 +106,21 @@ cachedTextDecoder.decode();
106
106
  function getStringFromWasm0(ptr, len) {
107
107
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
108
108
  }
109
+
110
+ function addHeapObject(obj) {
111
+ if (heap_next === heap.length) heap.push(heap.length + 1);
112
+ const idx = heap_next;
113
+ heap_next = heap[idx];
114
+
115
+ heap[idx] = obj;
116
+ return idx;
117
+ }
109
118
  /**
110
- * @param {string} src
119
+ * @param {any} args
111
120
  * @returns {any}
112
121
  */
113
- export function compile(src) {
114
- const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
115
- const len0 = WASM_VECTOR_LEN;
116
- const ret = wasm.compile(ptr0, len0);
122
+ export function compile(args) {
123
+ const ret = wasm.compile(addHeapObject(args));
117
124
  return takeObject(ret);
118
125
  }
119
126
 
@@ -134,15 +141,6 @@ export function acir_from_bytes(bytes) {
134
141
  return takeObject(ret);
135
142
  }
136
143
 
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
-
146
144
  function getArrayU8FromWasm0(ptr, len) {
147
145
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
148
146
  }
@@ -164,6 +162,35 @@ export function acir_to_bytes(acir) {
164
162
  }
165
163
  }
166
164
 
165
+ /**
166
+ * @param {Uint8Array} bytes
167
+ * @returns {any}
168
+ */
169
+ export function acir_read_bytes(bytes) {
170
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_0);
171
+ const len0 = WASM_VECTOR_LEN;
172
+ const ret = wasm.acir_read_bytes(ptr0, len0);
173
+ return takeObject(ret);
174
+ }
175
+
176
+ /**
177
+ * @param {any} acir
178
+ * @returns {Uint8Array}
179
+ */
180
+ export function acir_write_bytes(acir) {
181
+ try {
182
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
183
+ wasm.acir_write_bytes(retptr, addHeapObject(acir));
184
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
185
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
186
+ var v0 = getArrayU8FromWasm0(r0, r1).slice();
187
+ wasm.__wbindgen_export_2(r0, r1 * 1);
188
+ return v0;
189
+ } finally {
190
+ wasm.__wbindgen_add_to_stack_pointer(16);
191
+ }
192
+ }
193
+
167
194
  /**
168
195
  * @returns {any}
169
196
  */
@@ -221,13 +248,6 @@ function getImports() {
221
248
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
222
249
  takeObject(arg0);
223
250
  };
224
- imports.wbg.__wbg_readfile_141fe7d2c0f1edde = function() { return handleError(function (arg0, arg1, arg2) {
225
- const ret = read_file(getStringFromWasm0(arg1, arg2));
226
- const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
227
- const len0 = WASM_VECTOR_LEN;
228
- getInt32Memory0()[arg0 / 4 + 1] = len0;
229
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
230
- }, arguments) };
231
251
  imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
232
252
  const ret = new Error();
233
253
  return addHeapObject(ret);
@@ -246,6 +266,13 @@ function getImports() {
246
266
  wasm.__wbindgen_export_2(arg0, arg1);
247
267
  }
248
268
  };
269
+ imports.wbg.__wbg_readfile_1ed72752a157b319 = function() { return handleError(function (arg0, arg1, arg2) {
270
+ const ret = read_file(getStringFromWasm0(arg1, arg2));
271
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
272
+ const len0 = WASM_VECTOR_LEN;
273
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
274
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
275
+ }, arguments) };
249
276
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
250
277
  const obj = getObject(arg1);
251
278
  const ret = typeof(obj) === 'string' ? obj : undefined;
Binary file
@@ -1,9 +1,11 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function compile(a: number, b: number): number;
4
+ export function compile(a: number): number;
5
5
  export function acir_from_bytes(a: number, b: number): number;
6
6
  export function acir_to_bytes(a: number, b: number): void;
7
+ export function acir_read_bytes(a: number, b: number): number;
8
+ export function acir_write_bytes(a: number, b: number): void;
7
9
  export function build_info(): number;
8
10
  export function __wbindgen_export_0(a: number): number;
9
11
  export function __wbindgen_export_1(a: number, b: number, c: number): number;