@noir-lang/noir_wasm 0.16.0-20a160c → 0.16.0-37315f8.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
+ }
@@ -10,6 +10,29 @@ heap.push(undefined, null, true, false);
10
10
 
11
11
  function getObject(idx) { return heap[idx]; }
12
12
 
13
+ let heap_next = heap.length;
14
+
15
+ function dropObject(idx) {
16
+ if (idx < 132) return;
17
+ heap[idx] = heap_next;
18
+ heap_next = idx;
19
+ }
20
+
21
+ function takeObject(idx) {
22
+ const ret = getObject(idx);
23
+ dropObject(idx);
24
+ return ret;
25
+ }
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
+
13
36
  let WASM_VECTOR_LEN = 0;
14
37
 
15
38
  let cachedUint8Memory0 = null;
@@ -87,20 +110,6 @@ function getInt32Memory0() {
87
110
  return cachedInt32Memory0;
88
111
  }
89
112
 
90
- let heap_next = heap.length;
91
-
92
- function dropObject(idx) {
93
- if (idx < 132) return;
94
- heap[idx] = heap_next;
95
- heap_next = idx;
96
- }
97
-
98
- function takeObject(idx) {
99
- const ret = getObject(idx);
100
- dropObject(idx);
101
- return ret;
102
- }
103
-
104
113
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
105
114
 
106
115
  cachedTextDecoder.decode();
@@ -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,6 +205,71 @@ function handleError(f, args) {
206
205
  wasm.__wbindgen_export_3(addHeapObject(e));
207
206
  }
208
207
  }
208
+ /**
209
+ */
210
+ class CompileError {
211
+
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
+ }
219
+
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);
262
+ return addHeapObject(ret);
263
+ };
264
+
265
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
266
+ takeObject(arg0);
267
+ };
268
+
269
+ module.exports.__wbindgen_object_clone_ref = function(arg0) {
270
+ const ret = getObject(arg0);
271
+ return addHeapObject(ret);
272
+ };
209
273
 
210
274
  module.exports.__wbindgen_string_get = function(arg0, arg1) {
211
275
  const obj = getObject(arg1);
@@ -216,20 +280,11 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
216
280
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
217
281
  };
218
282
 
219
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
220
- takeObject(arg0);
221
- };
222
-
223
283
  module.exports.__wbindgen_is_undefined = function(arg0) {
224
284
  const ret = getObject(arg0) === undefined;
225
285
  return ret;
226
286
  };
227
287
 
228
- module.exports.__wbg_constructor_ac1f808f67a5f1e9 = function(arg0) {
229
- const ret = new Error(takeObject(arg0));
230
- return addHeapObject(ret);
231
- };
232
-
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-20a160c",
6
+ "version": "0.16.0-37315f8.nightly",
7
7
  "license": "(MIT OR Apache-2.0)",
8
8
  "main": "./nodejs/noir_wasm.js",
9
9
  "types": "./web/noir_wasm.d.ts",
@@ -24,12 +24,14 @@
24
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
- "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json",
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",
28
28
  "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
29
- "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0"
29
+ "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0",
30
+ "build:nix": "nix build -L .#noir_wasm",
31
+ "install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/noir_wasm/nodejs ./ && cp -rL ./result/noir_wasm/web ./"
30
32
  },
31
33
  "peerDependencies": {
32
- "@noir-lang/source-resolver": "0.16.0-20a160c"
34
+ "@noir-lang/source-resolver": "0.16.0-37315f8.nightly"
33
35
  },
34
36
  "devDependencies": {
35
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
@@ -8,6 +8,29 @@ heap.push(undefined, null, true, false);
8
8
 
9
9
  function getObject(idx) { return heap[idx]; }
10
10
 
11
+ let heap_next = heap.length;
12
+
13
+ function dropObject(idx) {
14
+ if (idx < 132) return;
15
+ heap[idx] = heap_next;
16
+ heap_next = idx;
17
+ }
18
+
19
+ function takeObject(idx) {
20
+ const ret = getObject(idx);
21
+ dropObject(idx);
22
+ return ret;
23
+ }
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
+
11
34
  let WASM_VECTOR_LEN = 0;
12
35
 
13
36
  let cachedUint8Memory0 = null;
@@ -85,20 +108,6 @@ function getInt32Memory0() {
85
108
  return cachedInt32Memory0;
86
109
  }
87
110
 
88
- let heap_next = heap.length;
89
-
90
- function dropObject(idx) {
91
- if (idx < 132) return;
92
- heap[idx] = heap_next;
93
- heap_next = idx;
94
- }
95
-
96
- function takeObject(idx) {
97
- const ret = getObject(idx);
98
- dropObject(idx);
99
- return ret;
100
- }
101
-
102
111
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
103
112
 
104
113
  if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
@@ -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,6 +288,17 @@ async function __wbg_load(module, imports) {
239
288
  function __wbg_get_imports() {
240
289
  const imports = {};
241
290
  imports.wbg = {};
291
+ imports.wbg.__wbg_compileerror_new = function(arg0) {
292
+ const ret = CompileError.__wrap(arg0);
293
+ return addHeapObject(ret);
294
+ };
295
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
296
+ takeObject(arg0);
297
+ };
298
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
299
+ const ret = getObject(arg0);
300
+ return addHeapObject(ret);
301
+ };
242
302
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
243
303
  const obj = getObject(arg1);
244
304
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -247,17 +307,10 @@ function __wbg_get_imports() {
247
307
  getInt32Memory0()[arg0 / 4 + 1] = len1;
248
308
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
249
309
  };
250
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
251
- takeObject(arg0);
252
- };
253
310
  imports.wbg.__wbindgen_is_undefined = function(arg0) {
254
311
  const ret = getObject(arg0) === undefined;
255
312
  return ret;
256
313
  };
257
- imports.wbg.__wbg_constructor_ac1f808f67a5f1e9 = function(arg0) {
258
- const ret = new Error(takeObject(arg0));
259
- return addHeapObject(ret);
260
- };
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;