@noir-lang/noir_wasm 0.16.0-38acee5.aztec → 0.16.0-4646a93.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.
@@ -1,6 +1,14 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
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
+ /**
4
12
  * @param {Uint8Array} bytes
5
13
  * @returns {any}
6
14
  */
@@ -11,14 +19,6 @@ export function acir_read_bytes(bytes: Uint8Array): any;
11
19
  */
12
20
  export function acir_write_bytes(acir: any): Uint8Array;
13
21
  /**
14
- * @param {string} level
15
- */
16
- export function init_log_level(level: string): void;
17
- /**
18
- * @returns {any}
19
- */
20
- export function build_info(): any;
21
- /**
22
22
  * @param {string} entry_point
23
23
  * @param {boolean | undefined} contracts
24
24
  * @param {string[] | undefined} dependencies
@@ -26,6 +26,29 @@ export function build_info(): any;
26
26
  */
27
27
  export function compile(entry_point: string, contracts?: boolean, dependencies?: string[]): any;
28
28
 
29
- export type CompileError = Error;
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
+ }
30
42
 
31
43
 
44
+ /**
45
+ */
46
+ export class CompileError {
47
+ free(): void;
48
+ /**
49
+ */
50
+ diagnostics: any;
51
+ /**
52
+ */
53
+ message: string;
54
+ }
@@ -24,6 +24,15 @@ function takeObject(idx) {
24
24
  return ret;
25
25
  }
26
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
+
27
36
  let WASM_VECTOR_LEN = 0;
28
37
 
29
38
  let cachedUint8Memory0 = null;
@@ -109,15 +118,22 @@ function getStringFromWasm0(ptr, len) {
109
118
  ptr = ptr >>> 0;
110
119
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
111
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
+ };
112
129
 
113
- function addHeapObject(obj) {
114
- if (heap_next === heap.length) heap.push(heap.length + 1);
115
- const idx = heap_next;
116
- heap_next = heap[idx];
117
-
118
- heap[idx] = obj;
119
- return idx;
120
- }
130
+ /**
131
+ * @returns {any}
132
+ */
133
+ module.exports.build_info = function() {
134
+ const ret = wasm.build_info();
135
+ return takeObject(ret);
136
+ };
121
137
 
122
138
  function passArray8ToWasm0(arg, malloc) {
123
139
  const ptr = malloc(arg.length * 1) >>> 0;
@@ -158,23 +174,6 @@ module.exports.acir_write_bytes = function(acir) {
158
174
  }
159
175
  };
160
176
 
161
- /**
162
- * @param {string} level
163
- */
164
- module.exports.init_log_level = function(level) {
165
- const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
166
- const len0 = WASM_VECTOR_LEN;
167
- wasm.init_log_level(ptr0, len0);
168
- };
169
-
170
- /**
171
- * @returns {any}
172
- */
173
- module.exports.build_info = function() {
174
- const ret = wasm.build_info();
175
- return takeObject(ret);
176
- };
177
-
178
177
  /**
179
178
  * @param {string} entry_point
180
179
  * @param {boolean | undefined} contracts
@@ -206,14 +205,60 @@ function handleError(f, args) {
206
205
  wasm.__wbindgen_export_3(addHeapObject(e));
207
206
  }
208
207
  }
208
+ /**
209
+ */
210
+ class CompileError {
209
211
 
210
- module.exports.__wbindgen_is_undefined = function(arg0) {
211
- const ret = getObject(arg0) === undefined;
212
- return ret;
213
- };
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
+ }
214
219
 
215
- module.exports.__wbg_constructor_ac1f808f67a5f1e9 = function(arg0) {
216
- const ret = new Error(takeObject(arg0));
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);
217
262
  return addHeapObject(ret);
218
263
  };
219
264
 
@@ -221,6 +266,11 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
221
266
  takeObject(arg0);
222
267
  };
223
268
 
269
+ module.exports.__wbindgen_object_clone_ref = function(arg0) {
270
+ const ret = getObject(arg0);
271
+ return addHeapObject(ret);
272
+ };
273
+
224
274
  module.exports.__wbindgen_string_get = function(arg0, arg1) {
225
275
  const obj = getObject(arg1);
226
276
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -230,6 +280,11 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
230
280
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
231
281
  };
232
282
 
283
+ module.exports.__wbindgen_is_undefined = function(arg0) {
284
+ const ret = getObject(arg0) === undefined;
285
+ return ret;
286
+ };
287
+
233
288
  module.exports.__wbg_readfile_0c1777c7c5aa8c92 = function() { return handleError(function (arg0, arg1, arg2) {
234
289
  const ret = read_file(getStringFromWasm0(arg1, arg2));
235
290
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
Binary file
@@ -1,10 +1,15 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function acir_read_bytes(a: number, b: number): number;
5
- export function acir_write_bytes(a: number, b: number): void;
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;
6
9
  export function init_log_level(a: number, b: number): void;
7
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;
8
13
  export function compile(a: number, b: number, c: number, d: number, e: number): void;
9
14
  export function __wbindgen_export_0(a: number): number;
10
15
  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 <team@noir-lang.org>"
5
5
  ],
6
- "version": "0.16.0-38acee5.aztec",
6
+ "version": "0.16.0-4646a93.nightly",
7
7
  "license": "(MIT OR Apache-2.0)",
8
8
  "main": "./nodejs/noir_wasm.js",
9
9
  "types": "./web/noir_wasm.d.ts",
@@ -20,8 +20,8 @@
20
20
  },
21
21
  "scripts": {
22
22
  "build": "bash ./build.sh",
23
- "test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
24
- "test:node": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
23
+ "test": "yarn test:node && yarn test:browser",
24
+ "test:node": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' mocha",
25
25
  "test:browser": "web-test-runner",
26
26
  "clean": "chmod u+w web nodejs || true && rm -rf ./nodejs ./web ./target ./result",
27
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",
@@ -31,7 +31,7 @@
31
31
  "install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/noir_wasm/nodejs ./ && cp -rL ./result/noir_wasm/web ./"
32
32
  },
33
33
  "peerDependencies": {
34
- "@noir-lang/source-resolver": "0.16.0-38acee5.aztec"
34
+ "@noir-lang/source-resolver": "0.16.0-4646a93.nightly"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@esm-bundle/chai": "^4.3.4-fix.0",
@@ -1,6 +1,14 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
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
+ /**
4
12
  * @param {Uint8Array} bytes
5
13
  * @returns {any}
6
14
  */
@@ -11,14 +19,6 @@ export function acir_read_bytes(bytes: Uint8Array): any;
11
19
  */
12
20
  export function acir_write_bytes(acir: any): Uint8Array;
13
21
  /**
14
- * @param {string} level
15
- */
16
- export function init_log_level(level: string): void;
17
- /**
18
- * @returns {any}
19
- */
20
- export function build_info(): any;
21
- /**
22
22
  * @param {string} entry_point
23
23
  * @param {boolean | undefined} contracts
24
24
  * @param {string[] | undefined} dependencies
@@ -26,18 +26,46 @@ export function build_info(): any;
26
26
  */
27
27
  export function compile(entry_point: string, contracts?: boolean, dependencies?: string[]): any;
28
28
 
29
- export type CompileError = Error;
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
+ }
30
38
 
39
+ interface CompileError {
40
+ diagnostics: ReadonlyArray<Diagnostic>;
41
+ }
31
42
 
32
43
 
44
+ /**
45
+ */
46
+ export class CompileError {
47
+ free(): void;
48
+ /**
49
+ */
50
+ diagnostics: any;
51
+ /**
52
+ */
53
+ message: string;
54
+ }
55
+
33
56
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
34
57
 
35
58
  export interface InitOutput {
36
59
  readonly memory: WebAssembly.Memory;
37
- readonly acir_read_bytes: (a: number, b: number) => number;
38
- readonly acir_write_bytes: (a: number, b: number) => void;
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;
39
65
  readonly init_log_level: (a: number, b: number) => void;
40
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;
41
69
  readonly compile: (a: number, b: number, c: number, d: number, e: number) => void;
42
70
  readonly __wbindgen_export_0: (a: number) => number;
43
71
  readonly __wbindgen_export_1: (a: number, b: number, c: number) => number;
package/web/noir_wasm.js CHANGED
@@ -22,6 +22,15 @@ function takeObject(idx) {
22
22
  return ret;
23
23
  }
24
24
 
25
+ function addHeapObject(obj) {
26
+ if (heap_next === heap.length) heap.push(heap.length + 1);
27
+ const idx = heap_next;
28
+ heap_next = heap[idx];
29
+
30
+ heap[idx] = obj;
31
+ return idx;
32
+ }
33
+
25
34
  let WASM_VECTOR_LEN = 0;
26
35
 
27
36
  let cachedUint8Memory0 = null;
@@ -107,14 +116,21 @@ function getStringFromWasm0(ptr, len) {
107
116
  ptr = ptr >>> 0;
108
117
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
109
118
  }
119
+ /**
120
+ * @param {string} level
121
+ */
122
+ export function init_log_level(level) {
123
+ const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
124
+ const len0 = WASM_VECTOR_LEN;
125
+ wasm.init_log_level(ptr0, len0);
126
+ }
110
127
 
111
- function addHeapObject(obj) {
112
- if (heap_next === heap.length) heap.push(heap.length + 1);
113
- const idx = heap_next;
114
- heap_next = heap[idx];
115
-
116
- heap[idx] = obj;
117
- return idx;
128
+ /**
129
+ * @returns {any}
130
+ */
131
+ export function build_info() {
132
+ const ret = wasm.build_info();
133
+ return takeObject(ret);
118
134
  }
119
135
 
120
136
  function passArray8ToWasm0(arg, malloc) {
@@ -156,23 +172,6 @@ export function acir_write_bytes(acir) {
156
172
  }
157
173
  }
158
174
 
159
- /**
160
- * @param {string} level
161
- */
162
- export function init_log_level(level) {
163
- const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
164
- const len0 = WASM_VECTOR_LEN;
165
- wasm.init_log_level(ptr0, len0);
166
- }
167
-
168
- /**
169
- * @returns {any}
170
- */
171
- export function build_info() {
172
- const ret = wasm.build_info();
173
- return takeObject(ret);
174
- }
175
-
176
175
  /**
177
176
  * @param {string} entry_point
178
177
  * @param {boolean | undefined} contracts
@@ -204,6 +203,56 @@ function handleError(f, args) {
204
203
  wasm.__wbindgen_export_3(addHeapObject(e));
205
204
  }
206
205
  }
206
+ /**
207
+ */
208
+ export class CompileError {
209
+
210
+ static __wrap(ptr) {
211
+ ptr = ptr >>> 0;
212
+ const obj = Object.create(CompileError.prototype);
213
+ obj.__wbg_ptr = ptr;
214
+
215
+ return obj;
216
+ }
217
+
218
+ __destroy_into_raw() {
219
+ const ptr = this.__wbg_ptr;
220
+ this.__wbg_ptr = 0;
221
+
222
+ return ptr;
223
+ }
224
+
225
+ free() {
226
+ const ptr = this.__destroy_into_raw();
227
+ wasm.__wbg_compileerror_free(ptr);
228
+ }
229
+ /**
230
+ * @returns {string}
231
+ */
232
+ get message() {
233
+ const ret = wasm.__wbg_get_compileerror_message(this.__wbg_ptr);
234
+ return takeObject(ret);
235
+ }
236
+ /**
237
+ * @param {string} arg0
238
+ */
239
+ set message(arg0) {
240
+ wasm.__wbg_set_compileerror_message(this.__wbg_ptr, addHeapObject(arg0));
241
+ }
242
+ /**
243
+ * @returns {any}
244
+ */
245
+ get diagnostics() {
246
+ const ret = wasm.__wbg_get_compileerror_diagnostics(this.__wbg_ptr);
247
+ return takeObject(ret);
248
+ }
249
+ /**
250
+ * @param {any} arg0
251
+ */
252
+ set diagnostics(arg0) {
253
+ wasm.__wbg_set_compileerror_diagnostics(this.__wbg_ptr, addHeapObject(arg0));
254
+ }
255
+ }
207
256
 
208
257
  async function __wbg_load(module, imports) {
209
258
  if (typeof Response === 'function' && module instanceof Response) {
@@ -239,17 +288,17 @@ async function __wbg_load(module, imports) {
239
288
  function __wbg_get_imports() {
240
289
  const imports = {};
241
290
  imports.wbg = {};
242
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
243
- const ret = getObject(arg0) === undefined;
244
- return ret;
245
- };
246
- imports.wbg.__wbg_constructor_ac1f808f67a5f1e9 = function(arg0) {
247
- const ret = new Error(takeObject(arg0));
291
+ imports.wbg.__wbg_compileerror_new = function(arg0) {
292
+ const ret = CompileError.__wrap(arg0);
248
293
  return addHeapObject(ret);
249
294
  };
250
295
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
251
296
  takeObject(arg0);
252
297
  };
298
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
299
+ const ret = getObject(arg0);
300
+ return addHeapObject(ret);
301
+ };
253
302
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
254
303
  const obj = getObject(arg1);
255
304
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -258,6 +307,10 @@ function __wbg_get_imports() {
258
307
  getInt32Memory0()[arg0 / 4 + 1] = len1;
259
308
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
260
309
  };
310
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
311
+ const ret = getObject(arg0) === undefined;
312
+ return ret;
313
+ };
261
314
  imports.wbg.__wbg_readfile_0c1777c7c5aa8c92 = function() { return handleError(function (arg0, arg1, arg2) {
262
315
  const ret = read_file(getStringFromWasm0(arg1, arg2));
263
316
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
Binary file
@@ -1,10 +1,15 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function acir_read_bytes(a: number, b: number): number;
5
- export function acir_write_bytes(a: number, b: number): void;
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;
6
9
  export function init_log_level(a: number, b: number): void;
7
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;
8
13
  export function compile(a: number, b: number, c: number, d: number, e: number): void;
9
14
  export function __wbindgen_export_0(a: number): number;
10
15
  export function __wbindgen_export_1(a: number, b: number, c: number): number;