@noir-lang/noir_wasm 0.20.0-9a3d1d2.nightly → 0.20.0-e3dcc21.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.
@@ -11,6 +11,14 @@ export function acir_read_bytes(bytes: Uint8Array): any;
11
11
  */
12
12
  export function acir_write_bytes(acir: any): Uint8Array;
13
13
  /**
14
+ * @param {string} entry_point
15
+ * @param {boolean | undefined} contracts
16
+ * @param {DependencyGraph | undefined} dependency_graph
17
+ * @param {PathToFileSourceMap} file_source_map
18
+ * @returns {CompileResult}
19
+ */
20
+ export function compile(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
21
+ /**
14
22
  * @param {string} level
15
23
  */
16
24
  export function init_log_level(level: string): void;
@@ -18,13 +26,6 @@ export function init_log_level(level: string): void;
18
26
  * @returns {any}
19
27
  */
20
28
  export function build_info(): any;
21
- /**
22
- * @param {string} entry_point
23
- * @param {boolean | undefined} contracts
24
- * @param {DependencyGraph | undefined} dependency_graph
25
- * @returns {CompileResult}
26
- */
27
- export function compile(entry_point: string, contracts?: boolean, dependency_graph?: DependencyGraph): CompileResult;
28
29
 
29
30
  export type Diagnostic = {
30
31
  message: string;
@@ -81,3 +82,17 @@ export type CompileResult = (
81
82
  );
82
83
 
83
84
 
85
+ /**
86
+ */
87
+ export class PathToFileSourceMap {
88
+ free(): void;
89
+ /**
90
+ */
91
+ constructor();
92
+ /**
93
+ * @param {string} path
94
+ * @param {string} source_code
95
+ * @returns {boolean}
96
+ */
97
+ add_source_code(path: string, source_code: string): boolean;
98
+ }
@@ -1,7 +1,6 @@
1
1
  let imports = {};
2
2
  imports['__wbindgen_placeholder__'] = module.exports;
3
3
  let wasm;
4
- const { read_file } = require(`@noir-lang/source-resolver`);
5
4
  const { TextDecoder, TextEncoder } = require(`util`);
6
5
 
7
6
  const heap = new Array(128).fill(undefined);
@@ -223,35 +222,27 @@ module.exports.acir_write_bytes = function(acir) {
223
222
  }
224
223
  };
225
224
 
226
- /**
227
- * @param {string} level
228
- */
229
- module.exports.init_log_level = function(level) {
230
- const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
231
- const len0 = WASM_VECTOR_LEN;
232
- wasm.init_log_level(ptr0, len0);
233
- };
234
-
235
- /**
236
- * @returns {any}
237
- */
238
- module.exports.build_info = function() {
239
- const ret = wasm.build_info();
240
- return takeObject(ret);
241
- };
242
-
225
+ function _assertClass(instance, klass) {
226
+ if (!(instance instanceof klass)) {
227
+ throw new Error(`expected instance of ${klass.name}`);
228
+ }
229
+ return instance.ptr;
230
+ }
243
231
  /**
244
232
  * @param {string} entry_point
245
233
  * @param {boolean | undefined} contracts
246
234
  * @param {DependencyGraph | undefined} dependency_graph
235
+ * @param {PathToFileSourceMap} file_source_map
247
236
  * @returns {CompileResult}
248
237
  */
249
- module.exports.compile = function(entry_point, contracts, dependency_graph) {
238
+ module.exports.compile = function(entry_point, contracts, dependency_graph, file_source_map) {
250
239
  try {
251
240
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
252
241
  const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
253
242
  const len0 = WASM_VECTOR_LEN;
254
- wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph));
243
+ _assertClass(file_source_map, PathToFileSourceMap);
244
+ var ptr1 = file_source_map.__destroy_into_raw();
245
+ wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
255
246
  var r0 = getInt32Memory0()[retptr / 4 + 0];
256
247
  var r1 = getInt32Memory0()[retptr / 4 + 1];
257
248
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -264,6 +255,23 @@ module.exports.compile = function(entry_point, contracts, dependency_graph) {
264
255
  }
265
256
  };
266
257
 
258
+ /**
259
+ * @param {string} level
260
+ */
261
+ module.exports.init_log_level = function(level) {
262
+ const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
263
+ const len0 = WASM_VECTOR_LEN;
264
+ wasm.init_log_level(ptr0, len0);
265
+ };
266
+
267
+ /**
268
+ * @returns {any}
269
+ */
270
+ module.exports.build_info = function() {
271
+ const ret = wasm.build_info();
272
+ return takeObject(ret);
273
+ };
274
+
267
275
  function handleError(f, args) {
268
276
  try {
269
277
  return f.apply(this, args);
@@ -271,6 +279,50 @@ function handleError(f, args) {
271
279
  wasm.__wbindgen_export_3(addHeapObject(e));
272
280
  }
273
281
  }
282
+ /**
283
+ */
284
+ class PathToFileSourceMap {
285
+
286
+ static __wrap(ptr) {
287
+ ptr = ptr >>> 0;
288
+ const obj = Object.create(PathToFileSourceMap.prototype);
289
+ obj.__wbg_ptr = ptr;
290
+
291
+ return obj;
292
+ }
293
+
294
+ __destroy_into_raw() {
295
+ const ptr = this.__wbg_ptr;
296
+ this.__wbg_ptr = 0;
297
+
298
+ return ptr;
299
+ }
300
+
301
+ free() {
302
+ const ptr = this.__destroy_into_raw();
303
+ wasm.__wbg_pathtofilesourcemap_free(ptr);
304
+ }
305
+ /**
306
+ */
307
+ constructor() {
308
+ const ret = wasm.pathtofilesourcemap_new();
309
+ return PathToFileSourceMap.__wrap(ret);
310
+ }
311
+ /**
312
+ * @param {string} path
313
+ * @param {string} source_code
314
+ * @returns {boolean}
315
+ */
316
+ add_source_code(path, source_code) {
317
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
318
+ const len0 = WASM_VECTOR_LEN;
319
+ const ptr1 = passStringToWasm0(source_code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
320
+ const len1 = WASM_VECTOR_LEN;
321
+ const ret = wasm.pathtofilesourcemap_add_source_code(this.__wbg_ptr, ptr0, len0, ptr1, len1);
322
+ return ret !== 0;
323
+ }
324
+ }
325
+ module.exports.PathToFileSourceMap = PathToFileSourceMap;
274
326
 
275
327
  module.exports.__wbindgen_object_drop_ref = function(arg0) {
276
328
  takeObject(arg0);
@@ -291,14 +343,6 @@ module.exports.__wbg_constructor_1292ee4141d8f79d = function() {
291
343
  return addHeapObject(ret);
292
344
  };
293
345
 
294
- module.exports.__wbg_readfile_698fcfe83a414130 = function() { return handleError(function (arg0, arg1, arg2) {
295
- const ret = read_file(getStringFromWasm0(arg1, arg2));
296
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
297
- const len1 = WASM_VECTOR_LEN;
298
- getInt32Memory0()[arg0 / 4 + 1] = len1;
299
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
300
- }, arguments) };
301
-
302
346
  module.exports.__wbindgen_string_new = function(arg0, arg1) {
303
347
  const ret = getStringFromWasm0(arg0, arg1);
304
348
  return addHeapObject(ret);
Binary file
@@ -3,9 +3,12 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export function acir_read_bytes(a: number, b: number): number;
5
5
  export function acir_write_bytes(a: number, b: number): void;
6
+ export function __wbg_pathtofilesourcemap_free(a: number): void;
7
+ export function pathtofilesourcemap_new(): number;
8
+ export function pathtofilesourcemap_add_source_code(a: number, b: number, c: number, d: number, e: number): number;
9
+ export function compile(a: number, b: number, c: number, d: number, e: number, f: number): void;
6
10
  export function init_log_level(a: number, b: number): void;
7
11
  export function build_info(): number;
8
- export function compile(a: number, b: number, c: number, d: number, e: number): void;
9
12
  export function __wbindgen_export_0(a: number): number;
10
13
  export function __wbindgen_export_1(a: number, b: number, c: number): number;
11
14
  export function __wbindgen_add_to_stack_pointer(a: 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.20.0-9a3d1d2.nightly",
6
+ "version": "0.20.0-e3dcc21.nightly",
7
7
  "license": "(MIT OR Apache-2.0)",
8
8
  "main": "./nodejs/noir_wasm.js",
9
9
  "types": "./web/noir_wasm.d.ts",
@@ -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.20.0-9a3d1d2.nightly"
34
+ "@noir-lang/source-resolver": "0.20.0-e3dcc21.nightly"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@esm-bundle/chai": "^4.3.4-fix.0",
@@ -11,6 +11,14 @@ export function acir_read_bytes(bytes: Uint8Array): any;
11
11
  */
12
12
  export function acir_write_bytes(acir: any): Uint8Array;
13
13
  /**
14
+ * @param {string} entry_point
15
+ * @param {boolean | undefined} contracts
16
+ * @param {DependencyGraph | undefined} dependency_graph
17
+ * @param {PathToFileSourceMap} file_source_map
18
+ * @returns {CompileResult}
19
+ */
20
+ export function compile(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
21
+ /**
14
22
  * @param {string} level
15
23
  */
16
24
  export function init_log_level(level: string): void;
@@ -18,13 +26,6 @@ export function init_log_level(level: string): void;
18
26
  * @returns {any}
19
27
  */
20
28
  export function build_info(): any;
21
- /**
22
- * @param {string} entry_point
23
- * @param {boolean | undefined} contracts
24
- * @param {DependencyGraph | undefined} dependency_graph
25
- * @returns {CompileResult}
26
- */
27
- export function compile(entry_point: string, contracts?: boolean, dependency_graph?: DependencyGraph): CompileResult;
28
29
 
29
30
  export type Diagnostic = {
30
31
  message: string;
@@ -81,6 +82,20 @@ export type CompileResult = (
81
82
  );
82
83
 
83
84
 
85
+ /**
86
+ */
87
+ export class PathToFileSourceMap {
88
+ free(): void;
89
+ /**
90
+ */
91
+ constructor();
92
+ /**
93
+ * @param {string} path
94
+ * @param {string} source_code
95
+ * @returns {boolean}
96
+ */
97
+ add_source_code(path: string, source_code: string): boolean;
98
+ }
84
99
 
85
100
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
86
101
 
@@ -88,9 +103,12 @@ export interface InitOutput {
88
103
  readonly memory: WebAssembly.Memory;
89
104
  readonly acir_read_bytes: (a: number, b: number) => number;
90
105
  readonly acir_write_bytes: (a: number, b: number) => void;
106
+ readonly __wbg_pathtofilesourcemap_free: (a: number) => void;
107
+ readonly pathtofilesourcemap_new: () => number;
108
+ readonly pathtofilesourcemap_add_source_code: (a: number, b: number, c: number, d: number, e: number) => number;
109
+ readonly compile: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
91
110
  readonly init_log_level: (a: number, b: number) => void;
92
111
  readonly build_info: () => number;
93
- readonly compile: (a: number, b: number, c: number, d: number, e: number) => void;
94
112
  readonly __wbindgen_export_0: (a: number) => number;
95
113
  readonly __wbindgen_export_1: (a: number, b: number, c: number) => number;
96
114
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
package/web/noir_wasm.js CHANGED
@@ -1,5 +1,3 @@
1
- import { read_file } from '@noir-lang/source-resolver';
2
-
3
1
  let wasm;
4
2
 
5
3
  const heap = new Array(128).fill(undefined);
@@ -221,35 +219,27 @@ export function acir_write_bytes(acir) {
221
219
  }
222
220
  }
223
221
 
224
- /**
225
- * @param {string} level
226
- */
227
- export function init_log_level(level) {
228
- const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
229
- const len0 = WASM_VECTOR_LEN;
230
- wasm.init_log_level(ptr0, len0);
231
- }
232
-
233
- /**
234
- * @returns {any}
235
- */
236
- export function build_info() {
237
- const ret = wasm.build_info();
238
- return takeObject(ret);
222
+ function _assertClass(instance, klass) {
223
+ if (!(instance instanceof klass)) {
224
+ throw new Error(`expected instance of ${klass.name}`);
225
+ }
226
+ return instance.ptr;
239
227
  }
240
-
241
228
  /**
242
229
  * @param {string} entry_point
243
230
  * @param {boolean | undefined} contracts
244
231
  * @param {DependencyGraph | undefined} dependency_graph
232
+ * @param {PathToFileSourceMap} file_source_map
245
233
  * @returns {CompileResult}
246
234
  */
247
- export function compile(entry_point, contracts, dependency_graph) {
235
+ export function compile(entry_point, contracts, dependency_graph, file_source_map) {
248
236
  try {
249
237
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
250
238
  const ptr0 = passStringToWasm0(entry_point, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
251
239
  const len0 = WASM_VECTOR_LEN;
252
- wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph));
240
+ _assertClass(file_source_map, PathToFileSourceMap);
241
+ var ptr1 = file_source_map.__destroy_into_raw();
242
+ wasm.compile(retptr, ptr0, len0, isLikeNone(contracts) ? 0xFFFFFF : contracts ? 1 : 0, isLikeNone(dependency_graph) ? 0 : addHeapObject(dependency_graph), ptr1);
253
243
  var r0 = getInt32Memory0()[retptr / 4 + 0];
254
244
  var r1 = getInt32Memory0()[retptr / 4 + 1];
255
245
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -262,6 +252,23 @@ export function compile(entry_point, contracts, dependency_graph) {
262
252
  }
263
253
  }
264
254
 
255
+ /**
256
+ * @param {string} level
257
+ */
258
+ export function init_log_level(level) {
259
+ const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
260
+ const len0 = WASM_VECTOR_LEN;
261
+ wasm.init_log_level(ptr0, len0);
262
+ }
263
+
264
+ /**
265
+ * @returns {any}
266
+ */
267
+ export function build_info() {
268
+ const ret = wasm.build_info();
269
+ return takeObject(ret);
270
+ }
271
+
265
272
  function handleError(f, args) {
266
273
  try {
267
274
  return f.apply(this, args);
@@ -269,6 +276,49 @@ function handleError(f, args) {
269
276
  wasm.__wbindgen_export_3(addHeapObject(e));
270
277
  }
271
278
  }
279
+ /**
280
+ */
281
+ export class PathToFileSourceMap {
282
+
283
+ static __wrap(ptr) {
284
+ ptr = ptr >>> 0;
285
+ const obj = Object.create(PathToFileSourceMap.prototype);
286
+ obj.__wbg_ptr = ptr;
287
+
288
+ return obj;
289
+ }
290
+
291
+ __destroy_into_raw() {
292
+ const ptr = this.__wbg_ptr;
293
+ this.__wbg_ptr = 0;
294
+
295
+ return ptr;
296
+ }
297
+
298
+ free() {
299
+ const ptr = this.__destroy_into_raw();
300
+ wasm.__wbg_pathtofilesourcemap_free(ptr);
301
+ }
302
+ /**
303
+ */
304
+ constructor() {
305
+ const ret = wasm.pathtofilesourcemap_new();
306
+ return PathToFileSourceMap.__wrap(ret);
307
+ }
308
+ /**
309
+ * @param {string} path
310
+ * @param {string} source_code
311
+ * @returns {boolean}
312
+ */
313
+ add_source_code(path, source_code) {
314
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
315
+ const len0 = WASM_VECTOR_LEN;
316
+ const ptr1 = passStringToWasm0(source_code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
317
+ const len1 = WASM_VECTOR_LEN;
318
+ const ret = wasm.pathtofilesourcemap_add_source_code(this.__wbg_ptr, ptr0, len0, ptr1, len1);
319
+ return ret !== 0;
320
+ }
321
+ }
272
322
 
273
323
  async function __wbg_load(module, imports) {
274
324
  if (typeof Response === 'function' && module instanceof Response) {
@@ -319,13 +369,6 @@ function __wbg_get_imports() {
319
369
  const ret = new Object();
320
370
  return addHeapObject(ret);
321
371
  };
322
- imports.wbg.__wbg_readfile_698fcfe83a414130 = function() { return handleError(function (arg0, arg1, arg2) {
323
- const ret = read_file(getStringFromWasm0(arg1, arg2));
324
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
325
- const len1 = WASM_VECTOR_LEN;
326
- getInt32Memory0()[arg0 / 4 + 1] = len1;
327
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
328
- }, arguments) };
329
372
  imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
330
373
  const ret = getStringFromWasm0(arg0, arg1);
331
374
  return addHeapObject(ret);
Binary file
@@ -3,9 +3,12 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export function acir_read_bytes(a: number, b: number): number;
5
5
  export function acir_write_bytes(a: number, b: number): void;
6
+ export function __wbg_pathtofilesourcemap_free(a: number): void;
7
+ export function pathtofilesourcemap_new(): number;
8
+ export function pathtofilesourcemap_add_source_code(a: number, b: number, c: number, d: number, e: number): number;
9
+ export function compile(a: number, b: number, c: number, d: number, e: number, f: number): void;
6
10
  export function init_log_level(a: number, b: number): void;
7
11
  export function build_info(): number;
8
- export function compile(a: number, b: number, c: number, d: number, e: number): void;
9
12
  export function __wbindgen_export_0(a: number): number;
10
13
  export function __wbindgen_export_1(a: number, b: number, c: number): number;
11
14
  export function __wbindgen_add_to_stack_pointer(a: number): number;