@noir-lang/noir_wasm 0.24.0 → 0.25.0-3ad8869.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.
- package/build/cjs/package.json +1 -1
- package/build/esm/package.json +1 -1
- package/dist/node/index_bg.wasm +0 -0
- package/dist/node/main.js +190 -140
- package/dist/node/main.js.map +1 -1
- package/dist/types/build/cjs/index.d.ts +22 -22
- package/dist/types/build/esm/index.d.ts +26 -12
- package/dist/types/src/index.d.cts +38 -7
- package/dist/types/src/index.d.mts +38 -7
- package/dist/types/src/noir/noir-wasm-compiler.d.ts +3 -2
- package/dist/types/src/noir/package.d.ts +2 -2
- package/dist/types/src/types/noir_artifact.d.ts +6 -18
- package/dist/types/src/types/noir_package_config.d.ts +1 -1
- package/dist/types/webpack.config.d.ts +0 -1
- package/dist/web/main.mjs +197 -141
- package/dist/web/main.mjs.map +1 -1
- package/package.json +7 -7
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
export function
|
|
2
|
-
export function
|
|
3
|
-
export function init_log_level(
|
|
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 init_log_level(level: string): void;
|
|
4
4
|
export function build_info(): any;
|
|
5
|
+
export function compile_program(entry_point: string, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): ProgramCompileResult;
|
|
6
|
+
export function compile_contract(entry_point: string, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): ContractCompileResult;
|
|
5
7
|
export function __wbindgen_object_drop_ref(arg0: any): void;
|
|
6
|
-
export function
|
|
8
|
+
export function __wbg_constructor_e8f4e1ca46363e73(arg0: any): number;
|
|
7
9
|
export function __wbindgen_is_undefined(arg0: any): boolean;
|
|
8
|
-
export function
|
|
9
|
-
export function __wbg_new_abda76e883ba8a5f(
|
|
10
|
-
export function __wbg_stack_658279fe44541cf6(
|
|
11
|
-
export function __wbg_error_f851667af71bcfc6(
|
|
10
|
+
export function __wbg_constructor_9418a5e735182315(): number;
|
|
11
|
+
export function __wbg_new_abda76e883ba8a5f(): number;
|
|
12
|
+
export function __wbg_stack_658279fe44541cf6(arg0: any, arg1: any): void;
|
|
13
|
+
export function __wbg_error_f851667af71bcfc6(arg0: any, arg1: any): void;
|
|
12
14
|
export function __wbindgen_string_new(arg0: any, arg1: any): number;
|
|
13
|
-
export function __wbg_debug_e3f6a1578e6d45ca(
|
|
14
|
-
export function __wbg_debug_efabe4eb183aa5d4(
|
|
15
|
-
export function __wbg_error_a7e23606158b68b9(
|
|
16
|
-
export function __wbg_error_50f42b952a595a23(
|
|
17
|
-
export function __wbg_info_05db236d79f1b785(
|
|
18
|
-
export function __wbg_info_24d8f53d98f12b95(
|
|
19
|
-
export function
|
|
20
|
-
export function
|
|
21
|
-
export function __wbg_warn_9bdd743e9f5fe1e0(...args: any[]): any;
|
|
22
|
-
export function __wbg_warn_8342bfbc6028193a(...args: any[]): any;
|
|
15
|
+
export function __wbg_debug_e3f6a1578e6d45ca(arg0: any): void;
|
|
16
|
+
export function __wbg_debug_efabe4eb183aa5d4(arg0: any, arg1: any, arg2: any, arg3: any): void;
|
|
17
|
+
export function __wbg_error_a7e23606158b68b9(arg0: any): void;
|
|
18
|
+
export function __wbg_error_50f42b952a595a23(arg0: any, arg1: any, arg2: any, arg3: any): void;
|
|
19
|
+
export function __wbg_info_05db236d79f1b785(arg0: any): void;
|
|
20
|
+
export function __wbg_info_24d8f53d98f12b95(arg0: any, arg1: any, arg2: any, arg3: any): void;
|
|
21
|
+
export function __wbg_warn_9bdd743e9f5fe1e0(arg0: any): void;
|
|
22
|
+
export function __wbg_warn_8342bfbc6028193a(arg0: any, arg1: any, arg2: any, arg3: any): void;
|
|
23
23
|
export function __wbindgen_string_get(arg0: any, arg1: any): void;
|
|
24
24
|
export function __wbg_parse_76a8a18ca3f8730b(...args: any[]): any;
|
|
25
25
|
export function __wbg_stringify_d06ad2addc54d51e(...args: any[]): any;
|
|
@@ -72,14 +72,14 @@ export class CompilerContext {
|
|
|
72
72
|
add_dependency_edge(crate_name: string, from: CrateId, to: CrateId): void;
|
|
73
73
|
/**
|
|
74
74
|
* @param {number} program_width
|
|
75
|
-
* @returns {
|
|
75
|
+
* @returns {ProgramCompileResult}
|
|
76
76
|
*/
|
|
77
|
-
compile_program(program_width: number):
|
|
77
|
+
compile_program(program_width: number): ProgramCompileResult;
|
|
78
78
|
/**
|
|
79
79
|
* @param {number} program_width
|
|
80
|
-
* @returns {
|
|
80
|
+
* @returns {ContractCompileResult}
|
|
81
81
|
*/
|
|
82
|
-
compile_contract(program_width: number):
|
|
82
|
+
compile_contract(program_width: number): ContractCompileResult;
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
85
|
*/
|
|
@@ -1,30 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* This is a method that exposes the same API as `compile`
|
|
3
|
+
* But uses the Context based APi internally
|
|
2
4
|
* @param {string} entry_point
|
|
3
|
-
* @param {boolean | undefined} contracts
|
|
4
5
|
* @param {DependencyGraph | undefined} dependency_graph
|
|
5
6
|
* @param {PathToFileSourceMap} file_source_map
|
|
6
|
-
* @returns {
|
|
7
|
+
* @returns {ProgramCompileResult}
|
|
7
8
|
*/
|
|
8
|
-
export function
|
|
9
|
+
export function compile_program_(entry_point: string, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): ProgramCompileResult;
|
|
9
10
|
/**
|
|
10
11
|
* This is a method that exposes the same API as `compile`
|
|
11
12
|
* But uses the Context based APi internally
|
|
12
13
|
* @param {string} entry_point
|
|
13
|
-
* @param {boolean | undefined} contracts
|
|
14
14
|
* @param {DependencyGraph | undefined} dependency_graph
|
|
15
15
|
* @param {PathToFileSourceMap} file_source_map
|
|
16
|
-
* @returns {
|
|
16
|
+
* @returns {ContractCompileResult}
|
|
17
17
|
*/
|
|
18
|
-
export function
|
|
18
|
+
export function compile_contract_(entry_point: string, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): ContractCompileResult;
|
|
19
19
|
/**
|
|
20
|
-
* @param {string}
|
|
20
|
+
* @param {string} level
|
|
21
21
|
*/
|
|
22
|
-
export function init_log_level(
|
|
22
|
+
export function init_log_level(level: string): void;
|
|
23
23
|
/**
|
|
24
24
|
* @returns {any}
|
|
25
25
|
*/
|
|
26
26
|
export function build_info(): any;
|
|
27
27
|
/**
|
|
28
|
+
* @param {string} entry_point
|
|
29
|
+
* @param {DependencyGraph | undefined} dependency_graph
|
|
30
|
+
* @param {PathToFileSourceMap} file_source_map
|
|
31
|
+
* @returns {ProgramCompileResult}
|
|
32
|
+
*/
|
|
33
|
+
export function compile_program(entry_point: string, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): ProgramCompileResult;
|
|
34
|
+
/**
|
|
35
|
+
* @param {string} entry_point
|
|
36
|
+
* @param {DependencyGraph | undefined} dependency_graph
|
|
37
|
+
* @param {PathToFileSourceMap} file_source_map
|
|
38
|
+
* @returns {ContractCompileResult}
|
|
39
|
+
*/
|
|
40
|
+
export function compile_contract(entry_point: string, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): ContractCompileResult;
|
|
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
|
|
30
44
|
* then the impl block is not picked up in javascript.
|
|
@@ -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 {
|
|
73
|
+
* @returns {ProgramCompileResult}
|
|
60
74
|
*/
|
|
61
|
-
compile_program(program_width: number):
|
|
75
|
+
compile_program(program_width: number): ProgramCompileResult;
|
|
62
76
|
/**
|
|
63
77
|
* @param {number} program_width
|
|
64
|
-
* @returns {
|
|
78
|
+
* @returns {ContractCompileResult}
|
|
65
79
|
*/
|
|
66
|
-
compile_contract(program_width: number):
|
|
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 {
|
|
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 {
|
|
18
|
+
* import { compile_program, createFileManager } from '@noir-lang/noir_wasm';
|
|
19
19
|
*
|
|
20
20
|
* const fm = createFileManager(myProjectPath);
|
|
21
|
-
* const myCompiledCode = await
|
|
21
|
+
* const myCompiledCode = await compile_program(fm);
|
|
22
22
|
* ```
|
|
23
23
|
*
|
|
24
24
|
* ```typescript
|
|
25
25
|
* // Browser
|
|
26
26
|
*
|
|
27
|
-
* import {
|
|
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
|
|
33
|
+
* const myCompiledCode = await compile_program(fm);
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
declare function
|
|
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,
|
|
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 {
|
|
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 {
|
|
18
|
+
* import { compile_program, createFileManager } from '@noir-lang/noir_wasm';
|
|
19
19
|
*
|
|
20
20
|
* const fm = createFileManager(myProjectPath);
|
|
21
|
-
* const myCompiledCode = await
|
|
21
|
+
* const myCompiledCode = await compile_program(fm);
|
|
22
22
|
* ```
|
|
23
23
|
*
|
|
24
24
|
* ```typescript
|
|
25
25
|
* // Browser
|
|
26
26
|
*
|
|
27
|
-
* import {
|
|
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
|
|
33
|
+
* const myCompiledCode = await compile_program(fm);
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
declare function
|
|
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,
|
|
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 {
|
|
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
|
-
|
|
31
|
+
compile_contract(): Promise<ContractCompilationArtifacts>;
|
|
31
32
|
}
|
|
@@ -40,13 +40,13 @@ export declare class Package {
|
|
|
40
40
|
backend?: string | undefined;
|
|
41
41
|
license?: string | undefined;
|
|
42
42
|
};
|
|
43
|
-
dependencies
|
|
43
|
+
dependencies?: Record<string, {
|
|
44
44
|
git: string;
|
|
45
45
|
tag: string;
|
|
46
46
|
directory?: string | undefined;
|
|
47
47
|
} | {
|
|
48
48
|
path: string;
|
|
49
|
-
}
|
|
49
|
+
}> | undefined;
|
|
50
50
|
};
|
|
51
51
|
/**
|
|
52
52
|
* The path to the source directory.
|
|
@@ -29,18 +29,16 @@ export interface EventAbi {
|
|
|
29
29
|
*/
|
|
30
30
|
fields: ABIVariable[];
|
|
31
31
|
}
|
|
32
|
-
/** The Noir function types. */
|
|
33
|
-
export type NoirFunctionType = 'Open' | 'Secret' | 'Unconstrained';
|
|
34
32
|
/**
|
|
35
33
|
* The compilation result of an Noir function.
|
|
36
34
|
*/
|
|
37
35
|
export interface NoirFunctionEntry {
|
|
38
36
|
/** The name of the function. */
|
|
39
37
|
name: string;
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
|
|
38
|
+
/** Whether the function is unconstrained. */
|
|
39
|
+
is_unconstrained: boolean;
|
|
40
|
+
/** The custom attributes applied to the function. */
|
|
41
|
+
custom_attributes: string[];
|
|
44
42
|
/** The ABI of the function. */
|
|
45
43
|
abi: Abi;
|
|
46
44
|
/** The bytecode of the function in base64. */
|
|
@@ -67,6 +65,8 @@ export interface ContractArtifact {
|
|
|
67
65
|
* The compilation result of an Noir contract.
|
|
68
66
|
*/
|
|
69
67
|
export interface ProgramArtifact {
|
|
68
|
+
/** Version of noir used for the build. */
|
|
69
|
+
noir_version: string;
|
|
70
70
|
/** The hash of the circuit. */
|
|
71
71
|
hash?: number;
|
|
72
72
|
/** * The ABI of the function. */
|
|
@@ -159,15 +159,3 @@ export interface ProgramCompilationArtifacts {
|
|
|
159
159
|
/** Compilation warnings. */
|
|
160
160
|
warnings: Warning[];
|
|
161
161
|
}
|
|
162
|
-
/**
|
|
163
|
-
* output of Noir Wasm compilation, can be for a contract or lib/binary
|
|
164
|
-
*/
|
|
165
|
-
export type CompilationResult = ContractCompilationArtifacts | ProgramCompilationArtifacts;
|
|
166
|
-
/**
|
|
167
|
-
* Check if it has Contract unique property
|
|
168
|
-
*/
|
|
169
|
-
export declare function isContractCompilationArtifacts(artifact: CompilationResult): artifact is ContractCompilationArtifacts;
|
|
170
|
-
/**
|
|
171
|
-
* Check if it has Contract unique property
|
|
172
|
-
*/
|
|
173
|
-
export declare function isProgramCompilationArtifacts(artifact: CompilationResult): artifact is ProgramCompilationArtifacts;
|
|
@@ -18,7 +18,7 @@ type NoirPackageConfigSchema = {
|
|
|
18
18
|
backend?: string;
|
|
19
19
|
license?: string;
|
|
20
20
|
};
|
|
21
|
-
dependencies
|
|
21
|
+
dependencies?: Record<string, GitDependencyConfig | LocalDependencyConfig>;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
24
|
* Noir package configuration.
|