@noir-lang/noir_wasm 0.24.0-16d5f18.nightly → 0.24.0-21fc4b8.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,11 +1,13 @@
1
- export function compile_(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
1
+ export function compile_program_(entry_point: string, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): ProgramCompileResult;
2
+ export function compile_contract_(entry_point: string, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): ContractCompileResult;
3
+ export function compile_program(entry_point: string, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): ProgramCompileResult;
4
+ export function compile_contract(entry_point: string, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): ContractCompileResult;
2
5
  export function init_log_level(level: string): void;
3
6
  export function build_info(): any;
4
- export function compile(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
5
7
  export function __wbindgen_object_drop_ref(arg0: any): void;
6
8
  export function __wbindgen_is_undefined(arg0: any): boolean;
7
- export function __wbg_constructor_e8767839abf8a966(arg0: any): number;
8
9
  export function __wbg_constructor_05d6d198f3477d6f(): number;
10
+ export function __wbg_constructor_e8767839abf8a966(arg0: any): number;
9
11
  export function __wbg_new_abda76e883ba8a5f(): number;
10
12
  export function __wbg_stack_658279fe44541cf6(arg0: any, arg1: any): void;
11
13
  export function __wbg_error_f851667af71bcfc6(arg0: any, arg1: any): void;
@@ -70,14 +72,14 @@ export class CompilerContext {
70
72
  add_dependency_edge(crate_name: string, from: CrateId, to: CrateId): void;
71
73
  /**
72
74
  * @param {number} program_width
73
- * @returns {CompileResult}
75
+ * @returns {ProgramCompileResult}
74
76
  */
75
- compile_program(program_width: number): CompileResult;
77
+ compile_program(program_width: number): ProgramCompileResult;
76
78
  /**
77
79
  * @param {number} program_width
78
- * @returns {CompileResult}
80
+ * @returns {ContractCompileResult}
79
81
  */
80
- compile_contract(program_width: number): CompileResult;
82
+ compile_contract(program_width: number): ContractCompileResult;
81
83
  }
82
84
  /**
83
85
  */
@@ -2,28 +2,42 @@
2
2
  * This is a method that exposes the same API as `compile`
3
3
  * But uses the Context based APi internally
4
4
  * @param {string} entry_point
5
- * @param {boolean | undefined} contracts
6
5
  * @param {DependencyGraph | undefined} dependency_graph
7
6
  * @param {PathToFileSourceMap} file_source_map
8
- * @returns {CompileResult}
7
+ * @returns {ProgramCompileResult}
9
8
  */
10
- export function compile_(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
9
+ export function compile_program_(entry_point: string, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): ProgramCompileResult;
11
10
  /**
12
- * @param {string} level
11
+ * This is a method that exposes the same API as `compile`
12
+ * But uses the Context based APi internally
13
+ * @param {string} entry_point
14
+ * @param {DependencyGraph | undefined} dependency_graph
15
+ * @param {PathToFileSourceMap} file_source_map
16
+ * @returns {ContractCompileResult}
13
17
  */
14
- export function init_log_level(level: string): void;
18
+ export function compile_contract_(entry_point: string, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): ContractCompileResult;
15
19
  /**
16
- * @returns {any}
20
+ * @param {string} entry_point
21
+ * @param {DependencyGraph | undefined} dependency_graph
22
+ * @param {PathToFileSourceMap} file_source_map
23
+ * @returns {ProgramCompileResult}
17
24
  */
18
- export function build_info(): any;
25
+ export function compile_program(entry_point: string, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): ProgramCompileResult;
19
26
  /**
20
27
  * @param {string} entry_point
21
- * @param {boolean | undefined} contracts
22
28
  * @param {DependencyGraph | undefined} dependency_graph
23
29
  * @param {PathToFileSourceMap} file_source_map
24
- * @returns {CompileResult}
30
+ * @returns {ContractCompileResult}
31
+ */
32
+ export function compile_contract(entry_point: string, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): ContractCompileResult;
33
+ /**
34
+ * @param {string} level
25
35
  */
26
- export function compile(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
36
+ export function init_log_level(level: string): void;
37
+ /**
38
+ * @returns {any}
39
+ */
40
+ export function build_info(): any;
27
41
  /**
28
42
  * This is a wrapper class that is wasm-bindgen compatible
29
43
  * We do not use js_name and rename it like CrateId because
@@ -56,14 +70,14 @@ export class CompilerContext {
56
70
  add_dependency_edge(crate_name: string, from: CrateId, to: CrateId): void;
57
71
  /**
58
72
  * @param {number} program_width
59
- * @returns {CompileResult}
73
+ * @returns {ProgramCompileResult}
60
74
  */
61
- compile_program(program_width: number): CompileResult;
75
+ compile_program(program_width: number): ProgramCompileResult;
62
76
  /**
63
77
  * @param {number} program_width
64
- * @returns {CompileResult}
78
+ * @returns {ContractCompileResult}
65
79
  */
66
- compile_contract(program_width: number): CompileResult;
80
+ compile_contract(program_width: number): ContractCompileResult;
67
81
  }
68
82
  /**
69
83
  */
@@ -1,7 +1,7 @@
1
1
  import { FileManager } from './noir/file-manager/file-manager';
2
2
  import { createNodejsFileManager } from './noir/file-manager/nodejs-file-manager';
3
3
  import { LogFn } from './utils';
4
- import { CompilationResult } from './types/noir_artifact';
4
+ import { ContractCompilationArtifacts, ProgramCompilationArtifacts } from './types/noir_artifact';
5
5
  import { inflateDebugSymbols } from './noir/debug';
6
6
  /**
7
7
  * Compiles a Noir project
@@ -15,24 +15,55 @@ import { inflateDebugSymbols } from './noir/debug';
15
15
  * ```typescript
16
16
  * // Node.js
17
17
  *
18
- * import { compile, createFileManager } from '@noir-lang/noir_wasm';
18
+ * import { compile_program, createFileManager } from '@noir-lang/noir_wasm';
19
19
  *
20
20
  * const fm = createFileManager(myProjectPath);
21
- * const myCompiledCode = await compile(fm);
21
+ * const myCompiledCode = await compile_program(fm);
22
22
  * ```
23
23
  *
24
24
  * ```typescript
25
25
  * // Browser
26
26
  *
27
- * import { compile, createFileManager } from '@noir-lang/noir_wasm';
27
+ * import { compile_program, createFileManager } from '@noir-lang/noir_wasm';
28
28
  *
29
29
  * const fm = createFileManager('/');
30
30
  * for (const path of files) {
31
31
  * await fm.writeFile(path, await getFileAsStream(path));
32
32
  * }
33
- * const myCompiledCode = await compile(fm);
33
+ * const myCompiledCode = await compile_program(fm);
34
34
  * ```
35
35
  */
36
- declare function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn, debugLogFn?: LogFn): Promise<CompilationResult>;
36
+ declare function compile_program(fileManager: FileManager, projectPath?: string, logFn?: LogFn, debugLogFn?: LogFn): Promise<ProgramCompilationArtifacts>;
37
+ /**
38
+ * Compiles a Noir project
39
+ *
40
+ * @param fileManager - The file manager to use
41
+ * @param projectPath - The path to the project inside the file manager. Defaults to the root of the file manager
42
+ * @param logFn - A logging function. If not provided, console.log will be used
43
+ * @param debugLogFn - A debug logging function. If not provided, logFn will be used
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * // Node.js
48
+ *
49
+ * import { compile_contract, createFileManager } from '@noir-lang/noir_wasm';
50
+ *
51
+ * const fm = createFileManager(myProjectPath);
52
+ * const myCompiledCode = await compile_contract(fm);
53
+ * ```
54
+ *
55
+ * ```typescript
56
+ * // Browser
57
+ *
58
+ * import { compile_contract, createFileManager } from '@noir-lang/noir_wasm';
59
+ *
60
+ * const fm = createFileManager('/');
61
+ * for (const path of files) {
62
+ * await fm.writeFile(path, await getFileAsStream(path));
63
+ * }
64
+ * const myCompiledCode = await compile_contract(fm);
65
+ * ```
66
+ */
67
+ declare function compile_contract(fileManager: FileManager, projectPath?: string, logFn?: LogFn, debugLogFn?: LogFn): Promise<ContractCompilationArtifacts>;
37
68
  declare const createFileManager: typeof createNodejsFileManager;
38
- export { compile, createFileManager, inflateDebugSymbols, CompilationResult };
69
+ export { compile_program as compile, compile_program, compile_contract, createFileManager, inflateDebugSymbols, ProgramCompilationArtifacts, ContractCompilationArtifacts, };
@@ -1,7 +1,7 @@
1
1
  import { FileManager } from './noir/file-manager/file-manager';
2
2
  import { createNodejsFileManager } from './noir/file-manager/nodejs-file-manager';
3
3
  import { LogFn } from './utils';
4
- import { CompilationResult } from './types/noir_artifact';
4
+ import { ContractCompilationArtifacts, ProgramCompilationArtifacts } from './types/noir_artifact';
5
5
  import { inflateDebugSymbols } from './noir/debug';
6
6
  /**
7
7
  * Compiles a Noir project
@@ -15,24 +15,55 @@ import { inflateDebugSymbols } from './noir/debug';
15
15
  * ```typescript
16
16
  * // Node.js
17
17
  *
18
- * import { compile, createFileManager } from '@noir-lang/noir_wasm';
18
+ * import { compile_program, createFileManager } from '@noir-lang/noir_wasm';
19
19
  *
20
20
  * const fm = createFileManager(myProjectPath);
21
- * const myCompiledCode = await compile(fm);
21
+ * const myCompiledCode = await compile_program(fm);
22
22
  * ```
23
23
  *
24
24
  * ```typescript
25
25
  * // Browser
26
26
  *
27
- * import { compile, createFileManager } from '@noir-lang/noir_wasm';
27
+ * import { compile_program, createFileManager } from '@noir-lang/noir_wasm';
28
28
  *
29
29
  * const fm = createFileManager('/');
30
30
  * for (const path of files) {
31
31
  * await fm.writeFile(path, await getFileAsStream(path));
32
32
  * }
33
- * const myCompiledCode = await compile(fm);
33
+ * const myCompiledCode = await compile_program(fm);
34
34
  * ```
35
35
  */
36
- declare function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn, debugLogFn?: LogFn): Promise<CompilationResult>;
36
+ declare function compile_program(fileManager: FileManager, projectPath?: string, logFn?: LogFn, debugLogFn?: LogFn): Promise<ProgramCompilationArtifacts>;
37
+ /**
38
+ * Compiles a Noir project
39
+ *
40
+ * @param fileManager - The file manager to use
41
+ * @param projectPath - The path to the project inside the file manager. Defaults to the root of the file manager
42
+ * @param logFn - A logging function. If not provided, console.log will be used
43
+ * @param debugLogFn - A debug logging function. If not provided, logFn will be used
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * // Node.js
48
+ *
49
+ * import { compile_contract, createFileManager } from '@noir-lang/noir_wasm';
50
+ *
51
+ * const fm = createFileManager(myProjectPath);
52
+ * const myCompiledCode = await compile_contract(fm);
53
+ * ```
54
+ *
55
+ * ```typescript
56
+ * // Browser
57
+ *
58
+ * import { compile_contract, createFileManager } from '@noir-lang/noir_wasm';
59
+ *
60
+ * const fm = createFileManager('/');
61
+ * for (const path of files) {
62
+ * await fm.writeFile(path, await getFileAsStream(path));
63
+ * }
64
+ * const myCompiledCode = await compile_contract(fm);
65
+ * ```
66
+ */
67
+ declare function compile_contract(fileManager: FileManager, projectPath?: string, logFn?: LogFn, debugLogFn?: LogFn): Promise<ContractCompilationArtifacts>;
37
68
  declare const createFileManager: typeof createNodejsFileManager;
38
- export { compile, createFileManager, inflateDebugSymbols, CompilationResult };
69
+ export { compile_program as compile, compile_program, compile_contract, createFileManager, inflateDebugSymbols, ProgramCompilationArtifacts, ContractCompilationArtifacts, };
@@ -1,6 +1,6 @@
1
1
  import { FileManager } from './file-manager/file-manager';
2
2
  import { LogFn } from '../utils';
3
- import { CompilationResult } from '../types/noir_artifact';
3
+ import { ContractCompilationArtifacts, ProgramCompilationArtifacts } from '../types/noir_artifact';
4
4
  /** Compilation options */
5
5
  export type NoirWasmCompileOptions = {
6
6
  /** Logging function */
@@ -24,8 +24,9 @@ export declare class NoirWasmCompiler {
24
24
  /**
25
25
  * Compile EntryPoint
26
26
  */
27
+ compile_program(): Promise<ProgramCompilationArtifacts>;
27
28
  /**
28
29
  * Compile EntryPoint
29
30
  */
30
- compile(): Promise<CompilationResult>;
31
+ compile_contract(): Promise<ContractCompilationArtifacts>;
31
32
  }
@@ -161,15 +161,3 @@ export interface ProgramCompilationArtifacts {
161
161
  /** Compilation warnings. */
162
162
  warnings: Warning[];
163
163
  }
164
- /**
165
- * output of Noir Wasm compilation, can be for a contract or lib/binary
166
- */
167
- export type CompilationResult = ContractCompilationArtifacts | ProgramCompilationArtifacts;
168
- /**
169
- * Check if it has Contract unique property
170
- */
171
- export declare function isContractCompilationArtifacts(artifact: CompilationResult): artifact is ContractCompilationArtifacts;
172
- /**
173
- * Check if it has Contract unique property
174
- */
175
- export declare function isProgramCompilationArtifacts(artifact: CompilationResult): artifact is ProgramCompilationArtifacts;