@noir-lang/noir_wasm 0.22.0-fbb51ed.nightly → 0.23.0
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 +15 -0
- package/build/esm/package.json +18 -0
- package/dist/node/index_bg.wasm +0 -0
- package/dist/node/main.js +12857 -0
- package/dist/node/main.js.map +1 -0
- package/dist/types/build/cjs/index.d.ts +93 -0
- package/dist/types/build/esm/index.d.ts +92 -0
- package/dist/types/src/index.d.cts +8 -0
- package/dist/types/src/index.d.mts +8 -0
- package/dist/types/src/noir/debug.d.ts +2 -0
- package/dist/types/src/noir/dependencies/dependency-manager.d.ts +48 -0
- package/dist/types/src/noir/dependencies/dependency-resolver.d.ts +22 -0
- package/dist/types/src/noir/dependencies/github-dependency-resolver.d.ts +29 -0
- package/dist/types/src/noir/dependencies/local-dependency-resolver.d.ts +12 -0
- package/dist/types/src/noir/file-manager/file-manager.d.ts +74 -0
- package/dist/types/src/noir/file-manager/memfs-file-manager.d.ts +8 -0
- package/dist/types/src/noir/file-manager/nodejs-file-manager.d.ts +7 -0
- package/dist/types/src/noir/noir-wasm-compiler.d.ts +31 -0
- package/dist/types/src/noir/package.d.ts +81 -0
- package/dist/types/src/types/noir_artifact.d.ts +173 -0
- package/dist/types/src/types/noir_package_config.d.ts +44 -0
- package/dist/types/src/utils.d.ts +5 -0
- package/dist/types/web-test-runner.config.d.mts +9 -0
- package/dist/types/webpack.config.d.ts +4 -0
- package/dist/web/index.html +9 -0
- package/dist/web/main.mjs +35340 -0
- package/dist/web/main.mjs.map +1 -0
- package/package.json +56 -16
- package/nodejs/noir_wasm.d.ts +0 -139
- package/nodejs/noir_wasm.js +0 -575
- package/nodejs/noir_wasm_bg.wasm +0 -0
- package/nodejs/noir_wasm_bg.wasm.d.ts +0 -23
- package/web/noir_wasm.d.ts +0 -186
- package/web/noir_wasm.js +0 -628
- package/web/noir_wasm_bg.wasm +0 -0
- package/web/noir_wasm_bg.wasm.d.ts +0 -23
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export function compile(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
|
|
2
|
+
export function compile_(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
|
|
3
|
+
export function init_log_level(filter: string): void;
|
|
4
|
+
export function build_info(): any;
|
|
5
|
+
export function __wbindgen_object_drop_ref(arg0: any): void;
|
|
6
|
+
export function __wbg_constructor_28ca684b2f9696ac(...args: any[]): any;
|
|
7
|
+
export function __wbindgen_is_undefined(arg0: any): boolean;
|
|
8
|
+
export function __wbg_constructor_287b714b768ecf13(...args: any[]): any;
|
|
9
|
+
export function __wbg_new_abda76e883ba8a5f(...args: any[]): any;
|
|
10
|
+
export function __wbg_stack_658279fe44541cf6(...args: any[]): any;
|
|
11
|
+
export function __wbg_error_f851667af71bcfc6(...args: any[]): any;
|
|
12
|
+
export function __wbindgen_string_new(arg0: any, arg1: any): number;
|
|
13
|
+
export function __wbg_debug_e3f6a1578e6d45ca(...args: any[]): any;
|
|
14
|
+
export function __wbg_debug_efabe4eb183aa5d4(...args: any[]): any;
|
|
15
|
+
export function __wbg_error_a7e23606158b68b9(...args: any[]): any;
|
|
16
|
+
export function __wbg_error_50f42b952a595a23(...args: any[]): any;
|
|
17
|
+
export function __wbg_info_05db236d79f1b785(...args: any[]): any;
|
|
18
|
+
export function __wbg_info_24d8f53d98f12b95(...args: any[]): any;
|
|
19
|
+
export function __wbg_log_dc06ec929fc95a20(...args: any[]): any;
|
|
20
|
+
export function __wbg_log_2f6947e39440ae3b(...args: any[]): any;
|
|
21
|
+
export function __wbg_warn_9bdd743e9f5fe1e0(...args: any[]): any;
|
|
22
|
+
export function __wbg_warn_8342bfbc6028193a(...args: any[]): any;
|
|
23
|
+
export function __wbindgen_string_get(arg0: any, arg1: any): void;
|
|
24
|
+
export function __wbg_parse_76a8a18ca3f8730b(...args: any[]): any;
|
|
25
|
+
export function __wbg_stringify_d06ad2addc54d51e(...args: any[]): any;
|
|
26
|
+
export function __wbg_set_07da13cc24b69217(...args: any[]): any;
|
|
27
|
+
export function __wbindgen_debug_string(arg0: any, arg1: any): void;
|
|
28
|
+
export function __wbindgen_throw(arg0: any, arg1: any): never;
|
|
29
|
+
/**
|
|
30
|
+
*/
|
|
31
|
+
export class PathToFileSourceMap {
|
|
32
|
+
static __wrap(ptr: any): any;
|
|
33
|
+
__destroy_into_raw(): number | undefined;
|
|
34
|
+
__wbg_ptr: number | undefined;
|
|
35
|
+
free(): void;
|
|
36
|
+
/**
|
|
37
|
+
* @param {string} path
|
|
38
|
+
* @param {string} source_code
|
|
39
|
+
* @returns {boolean}
|
|
40
|
+
*/
|
|
41
|
+
add_source_code(path: string, source_code: string): boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* This is a wrapper class that is wasm-bindgen compatible
|
|
45
|
+
* We do not use js_name and rename it like CrateId because
|
|
46
|
+
* then the impl block is not picked up in javascript.
|
|
47
|
+
*/
|
|
48
|
+
export class CompilerContext {
|
|
49
|
+
static __wrap(ptr: any): any;
|
|
50
|
+
/**
|
|
51
|
+
* @param {PathToFileSourceMap} source_map
|
|
52
|
+
*/
|
|
53
|
+
constructor(source_map: PathToFileSourceMap);
|
|
54
|
+
__destroy_into_raw(): number | undefined;
|
|
55
|
+
__wbg_ptr: number | undefined;
|
|
56
|
+
free(): void;
|
|
57
|
+
/**
|
|
58
|
+
* @param {string} path_to_crate
|
|
59
|
+
* @returns {CrateId}
|
|
60
|
+
*/
|
|
61
|
+
process_root_crate(path_to_crate: string): CrateId;
|
|
62
|
+
/**
|
|
63
|
+
* @param {string} path_to_crate
|
|
64
|
+
* @returns {CrateId}
|
|
65
|
+
*/
|
|
66
|
+
process_dependency_crate(path_to_crate: string): CrateId;
|
|
67
|
+
/**
|
|
68
|
+
* @param {string} crate_name
|
|
69
|
+
* @param {CrateId} from
|
|
70
|
+
* @param {CrateId} to
|
|
71
|
+
*/
|
|
72
|
+
add_dependency_edge(crate_name: string, from: CrateId, to: CrateId): void;
|
|
73
|
+
/**
|
|
74
|
+
* @param {number} program_width
|
|
75
|
+
* @returns {CompileResult}
|
|
76
|
+
*/
|
|
77
|
+
compile_program(program_width: number): CompileResult;
|
|
78
|
+
/**
|
|
79
|
+
* @param {number} program_width
|
|
80
|
+
* @returns {CompileResult}
|
|
81
|
+
*/
|
|
82
|
+
compile_contract(program_width: number): CompileResult;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
*/
|
|
86
|
+
export class CrateId {
|
|
87
|
+
static __wrap(ptr: any): any;
|
|
88
|
+
__destroy_into_raw(): number | undefined;
|
|
89
|
+
__wbg_ptr: number | undefined;
|
|
90
|
+
free(): void;
|
|
91
|
+
}
|
|
92
|
+
declare let wasm: any;
|
|
93
|
+
export { wasm as __wasm };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} entry_point
|
|
3
|
+
* @param {boolean | undefined} contracts
|
|
4
|
+
* @param {DependencyGraph | undefined} dependency_graph
|
|
5
|
+
* @param {PathToFileSourceMap} file_source_map
|
|
6
|
+
* @returns {CompileResult}
|
|
7
|
+
*/
|
|
8
|
+
export function compile(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
|
|
9
|
+
/**
|
|
10
|
+
* This is a method that exposes the same API as `compile`
|
|
11
|
+
* But uses the Context based APi internally
|
|
12
|
+
* @param {string} entry_point
|
|
13
|
+
* @param {boolean | undefined} contracts
|
|
14
|
+
* @param {DependencyGraph | undefined} dependency_graph
|
|
15
|
+
* @param {PathToFileSourceMap} file_source_map
|
|
16
|
+
* @returns {CompileResult}
|
|
17
|
+
*/
|
|
18
|
+
export function compile_(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
|
|
19
|
+
/**
|
|
20
|
+
* @param {string} filter
|
|
21
|
+
*/
|
|
22
|
+
export function init_log_level(filter: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* @returns {any}
|
|
25
|
+
*/
|
|
26
|
+
export function build_info(): any;
|
|
27
|
+
/**
|
|
28
|
+
* This is a wrapper class that is wasm-bindgen compatible
|
|
29
|
+
* We do not use js_name and rename it like CrateId because
|
|
30
|
+
* then the impl block is not picked up in javascript.
|
|
31
|
+
*/
|
|
32
|
+
export class CompilerContext {
|
|
33
|
+
static __wrap(ptr: any): any;
|
|
34
|
+
/**
|
|
35
|
+
* @param {PathToFileSourceMap} source_map
|
|
36
|
+
*/
|
|
37
|
+
constructor(source_map: PathToFileSourceMap);
|
|
38
|
+
__destroy_into_raw(): number | undefined;
|
|
39
|
+
__wbg_ptr: number | undefined;
|
|
40
|
+
free(): void;
|
|
41
|
+
/**
|
|
42
|
+
* @param {string} path_to_crate
|
|
43
|
+
* @returns {CrateId}
|
|
44
|
+
*/
|
|
45
|
+
process_root_crate(path_to_crate: string): CrateId;
|
|
46
|
+
/**
|
|
47
|
+
* @param {string} path_to_crate
|
|
48
|
+
* @returns {CrateId}
|
|
49
|
+
*/
|
|
50
|
+
process_dependency_crate(path_to_crate: string): CrateId;
|
|
51
|
+
/**
|
|
52
|
+
* @param {string} crate_name
|
|
53
|
+
* @param {CrateId} from
|
|
54
|
+
* @param {CrateId} to
|
|
55
|
+
*/
|
|
56
|
+
add_dependency_edge(crate_name: string, from: CrateId, to: CrateId): void;
|
|
57
|
+
/**
|
|
58
|
+
* @param {number} program_width
|
|
59
|
+
* @returns {CompileResult}
|
|
60
|
+
*/
|
|
61
|
+
compile_program(program_width: number): CompileResult;
|
|
62
|
+
/**
|
|
63
|
+
* @param {number} program_width
|
|
64
|
+
* @returns {CompileResult}
|
|
65
|
+
*/
|
|
66
|
+
compile_contract(program_width: number): CompileResult;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
*/
|
|
70
|
+
export class CrateId {
|
|
71
|
+
static __wrap(ptr: any): any;
|
|
72
|
+
__destroy_into_raw(): number | undefined;
|
|
73
|
+
__wbg_ptr: number | undefined;
|
|
74
|
+
free(): void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
*/
|
|
78
|
+
export class PathToFileSourceMap {
|
|
79
|
+
static __wrap(ptr: any): any;
|
|
80
|
+
__destroy_into_raw(): number | undefined;
|
|
81
|
+
__wbg_ptr: number | undefined;
|
|
82
|
+
free(): void;
|
|
83
|
+
/**
|
|
84
|
+
* @param {string} path
|
|
85
|
+
* @param {string} source_code
|
|
86
|
+
* @returns {boolean}
|
|
87
|
+
*/
|
|
88
|
+
add_source_code(path: string, source_code: string): boolean;
|
|
89
|
+
}
|
|
90
|
+
export default __wbg_init;
|
|
91
|
+
export function initSync(module: any): any;
|
|
92
|
+
declare function __wbg_init(input: any): Promise<any>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FileManager } from './noir/file-manager/file-manager';
|
|
2
|
+
import { createNodejsFileManager } from './noir/file-manager/nodejs-file-manager';
|
|
3
|
+
import { LogFn } from './utils';
|
|
4
|
+
import { CompilationResult } from './types/noir_artifact';
|
|
5
|
+
import { inflateDebugSymbols } from './noir/debug';
|
|
6
|
+
declare function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn, debugLogFn?: LogFn): Promise<CompilationResult>;
|
|
7
|
+
declare const createFileManager: typeof createNodejsFileManager;
|
|
8
|
+
export { compile, createFileManager, inflateDebugSymbols, CompilationResult };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FileManager } from './noir/file-manager/file-manager';
|
|
2
|
+
import { createNodejsFileManager } from './noir/file-manager/nodejs-file-manager';
|
|
3
|
+
import { LogFn } from './utils';
|
|
4
|
+
import { CompilationResult } from './types/noir_artifact';
|
|
5
|
+
import { inflateDebugSymbols } from './noir/debug';
|
|
6
|
+
declare function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn, debugLogFn?: LogFn): Promise<CompilationResult>;
|
|
7
|
+
declare const createFileManager: typeof createNodejsFileManager;
|
|
8
|
+
export { compile, createFileManager, inflateDebugSymbols, CompilationResult };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Package } from '../package';
|
|
2
|
+
import { Dependency, DependencyResolver } from './dependency-resolver';
|
|
3
|
+
/**
|
|
4
|
+
* Noir Dependency Resolver
|
|
5
|
+
*/
|
|
6
|
+
export declare class DependencyManager {
|
|
7
|
+
#private;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new dependency resolver
|
|
10
|
+
* @param resolvers - A list of dependency resolvers to use
|
|
11
|
+
* @param entryPoint - The entry point of the project
|
|
12
|
+
*/
|
|
13
|
+
constructor(resolvers: readonly DependencyResolver[] | undefined, entryPoint: Package);
|
|
14
|
+
/**
|
|
15
|
+
* Gets dependencies for the entry point
|
|
16
|
+
*/
|
|
17
|
+
getEntrypointDependencies(): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Get transitive libraries used by the package
|
|
20
|
+
*/
|
|
21
|
+
getLibraries(): [string, Dependency][];
|
|
22
|
+
/**
|
|
23
|
+
* A map of library dependencies
|
|
24
|
+
*/
|
|
25
|
+
getLibraryDependencies(): {
|
|
26
|
+
[k: string]: string[];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Resolves dependencies for a package.
|
|
30
|
+
*/
|
|
31
|
+
resolveDependencies(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Gets the version of a dependency in the dependency tree
|
|
34
|
+
* @param name - Dependency name
|
|
35
|
+
* @returns The dependency's version
|
|
36
|
+
*/
|
|
37
|
+
getVersionOf(name: string): string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the names of the crates in this dependency list
|
|
40
|
+
*/
|
|
41
|
+
getPackageNames(): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Looks up a dependency
|
|
44
|
+
* @param sourceId - The source being resolved
|
|
45
|
+
* @returns The path to the resolved file
|
|
46
|
+
*/
|
|
47
|
+
findFile(sourceId: string): string | null;
|
|
48
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DependencyConfig } from '../../types/noir_package_config';
|
|
2
|
+
import { Package } from '../package';
|
|
3
|
+
/**
|
|
4
|
+
* A Noir dependency
|
|
5
|
+
*/
|
|
6
|
+
export type Dependency = {
|
|
7
|
+
/** version string as determined by the resolver */
|
|
8
|
+
version?: string;
|
|
9
|
+
/** the actual package source code */
|
|
10
|
+
package: Package;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Resolves a dependency for a package.
|
|
14
|
+
*/
|
|
15
|
+
export interface DependencyResolver {
|
|
16
|
+
/**
|
|
17
|
+
* Resolve a dependency for a package.
|
|
18
|
+
* @param pkg - The package to resolve dependencies for
|
|
19
|
+
* @param dep - The dependency config to resolve
|
|
20
|
+
*/
|
|
21
|
+
resolveDependency(pkg: Package, dep: DependencyConfig): Promise<Dependency | null>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FileManager } from '../file-manager/file-manager';
|
|
2
|
+
import { Package } from '../package';
|
|
3
|
+
import { Dependency, DependencyResolver } from './dependency-resolver';
|
|
4
|
+
import { DependencyConfig, GitDependencyConfig } from '../../types/noir_package_config';
|
|
5
|
+
/**
|
|
6
|
+
* Downloads dependencies from github
|
|
7
|
+
*/
|
|
8
|
+
export declare class GithubDependencyResolver implements DependencyResolver {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(fm: FileManager);
|
|
11
|
+
/**
|
|
12
|
+
* Resolves a dependency from github. Returns null if URL is for a different website.
|
|
13
|
+
* @param _pkg - The package to resolve the dependency for
|
|
14
|
+
* @param dependency - The dependency configuration
|
|
15
|
+
* @returns asd
|
|
16
|
+
*/
|
|
17
|
+
resolveDependency(_pkg: Package, dependency: DependencyConfig): Promise<Dependency | null>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns a safe filename for a value
|
|
21
|
+
* @param val - The value to convert
|
|
22
|
+
*/
|
|
23
|
+
export declare function safeFilename(val: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Resolves a dependency's archive URL.
|
|
26
|
+
* @param dependency - The dependency configuration
|
|
27
|
+
* @returns The URL to the library archive
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveGithubCodeArchive(dependency: GitDependencyConfig, format: 'zip' | 'tar'): URL;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FileManager } from '../file-manager/file-manager';
|
|
2
|
+
import { Package } from '../package';
|
|
3
|
+
import { Dependency, DependencyResolver } from './dependency-resolver';
|
|
4
|
+
import { DependencyConfig } from '../../types/noir_package_config';
|
|
5
|
+
/**
|
|
6
|
+
* Resolves dependencies on-disk, relative to current package
|
|
7
|
+
*/
|
|
8
|
+
export declare class LocalDependencyResolver implements DependencyResolver {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(fm: FileManager);
|
|
11
|
+
resolveDependency(parent: Package, config: DependencyConfig): Promise<Dependency | null>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A file system interface that matches the node fs module.
|
|
3
|
+
*/
|
|
4
|
+
export interface FileSystem {
|
|
5
|
+
/** Checks if the file exists */
|
|
6
|
+
existsSync: (path: string) => boolean;
|
|
7
|
+
/** Creates a directory structure */
|
|
8
|
+
mkdir: (dir: string, opts?: {
|
|
9
|
+
/** Create parent directories as needed */
|
|
10
|
+
recursive: boolean;
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
/** Writes a file */
|
|
13
|
+
writeFile: (path: string, data: Uint8Array) => Promise<void>;
|
|
14
|
+
/** Reads a file */
|
|
15
|
+
readFile: (path: string, encoding?: 'utf-8') => Promise<Uint8Array | string>;
|
|
16
|
+
/** Renames a file */
|
|
17
|
+
rename: (oldPath: string, newPath: string) => Promise<void>;
|
|
18
|
+
/** Reads a directory */
|
|
19
|
+
readdir: (path: string, options?: {
|
|
20
|
+
/** Traverse child directories recursively */
|
|
21
|
+
recursive: boolean;
|
|
22
|
+
}) => Promise<string[]>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A file manager that writes file to a specific directory but reads globally.
|
|
26
|
+
*/
|
|
27
|
+
export declare class FileManager {
|
|
28
|
+
#private;
|
|
29
|
+
constructor(fs: FileSystem, dataDir: string);
|
|
30
|
+
/**
|
|
31
|
+
* Returns the data directory
|
|
32
|
+
*/
|
|
33
|
+
getDataDir(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Saves a file to the data directory.
|
|
36
|
+
* @param name - File to save
|
|
37
|
+
* @param stream - File contents
|
|
38
|
+
*/
|
|
39
|
+
writeFile(name: string, stream: ReadableStream<Uint8Array>): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Reads a file from the filesystem and returns a buffer
|
|
42
|
+
* Saves a file to the data directory.
|
|
43
|
+
* @param oldName - File to save
|
|
44
|
+
* @param newName - File contents
|
|
45
|
+
*/
|
|
46
|
+
moveFile(oldName: string, newName: string): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Reads a file from the disk and returns a buffer
|
|
49
|
+
* @param name - File to read
|
|
50
|
+
*/
|
|
51
|
+
readFile(name: string): Promise<Uint8Array>;
|
|
52
|
+
/**
|
|
53
|
+
* Reads a file from the filesystem as a string
|
|
54
|
+
* @param name - File to read
|
|
55
|
+
* @param encoding - Encoding to use
|
|
56
|
+
*/
|
|
57
|
+
readFile(name: string, encoding: 'utf-8'): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Checks if a file exists and is accessible
|
|
60
|
+
* @param name - File to check
|
|
61
|
+
*/
|
|
62
|
+
hasFileSync(name: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Reads a file from the filesystem
|
|
65
|
+
* @param dir - File to read
|
|
66
|
+
* @param options - Readdir options
|
|
67
|
+
*/
|
|
68
|
+
readdir(dir: string, options?: {
|
|
69
|
+
/**
|
|
70
|
+
* Traverse child directories recursively
|
|
71
|
+
*/
|
|
72
|
+
recursive: boolean;
|
|
73
|
+
}): Promise<string[]>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IFs } from 'memfs';
|
|
2
|
+
import { FileManager } from './file-manager';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new FileManager instance based on a MemFS instance
|
|
5
|
+
* @param memFS - the memfs backing instance
|
|
6
|
+
* @param dataDir - where to store files
|
|
7
|
+
*/
|
|
8
|
+
export declare function createMemFSFileManager(memFS?: IFs, dataDir?: string): FileManager;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FileManager } from './file-manager';
|
|
2
|
+
export declare function readdirRecursive(dir: string): Promise<string[]>;
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new FileManager instance based on nodejs fs
|
|
5
|
+
* @param dataDir - where to store files
|
|
6
|
+
*/
|
|
7
|
+
export declare function createNodejsFileManager(dataDir: string): FileManager;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FileManager } from './file-manager/file-manager';
|
|
2
|
+
import { LogFn } from '../utils';
|
|
3
|
+
import { CompilationResult } from '../types/noir_artifact';
|
|
4
|
+
/** Compilation options */
|
|
5
|
+
export type NoirWasmCompileOptions = {
|
|
6
|
+
/** Logging function */
|
|
7
|
+
log: LogFn;
|
|
8
|
+
/** Log debugging information through this function */
|
|
9
|
+
debugLog: LogFn;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Noir Package Compiler
|
|
13
|
+
*/
|
|
14
|
+
export declare class NoirWasmCompiler {
|
|
15
|
+
#private;
|
|
16
|
+
private constructor();
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new compiler instance.
|
|
19
|
+
* @param fileManager - The file manager to use
|
|
20
|
+
* @param projectPath - The path to the project
|
|
21
|
+
* @param opts - Compilation options
|
|
22
|
+
*/
|
|
23
|
+
static new(fileManager: FileManager, projectPath: string, wasmCompiler: any, sourceMap: any, opts: NoirWasmCompileOptions): Promise<NoirWasmCompiler>;
|
|
24
|
+
/**
|
|
25
|
+
* Compile EntryPoint
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Compile EntryPoint
|
|
29
|
+
*/
|
|
30
|
+
compile(): Promise<CompilationResult>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { FileManager } from './file-manager/file-manager';
|
|
2
|
+
import { DependencyConfig, PackageConfig } from '../types/noir_package_config';
|
|
3
|
+
/**
|
|
4
|
+
* An array of sources for a package
|
|
5
|
+
*/
|
|
6
|
+
type SourceList = Array<{
|
|
7
|
+
/**
|
|
8
|
+
* The source path, taking into account modules and aliases. Eg: mylib/mod/mysource.nr
|
|
9
|
+
*/
|
|
10
|
+
path: string;
|
|
11
|
+
/**
|
|
12
|
+
* Resolved source plaintext
|
|
13
|
+
*/
|
|
14
|
+
source: string;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* A Noir package.
|
|
18
|
+
*/
|
|
19
|
+
export declare class Package {
|
|
20
|
+
#private;
|
|
21
|
+
constructor(path: string, srcDir: string, config: PackageConfig);
|
|
22
|
+
/**
|
|
23
|
+
* Gets this package's path.
|
|
24
|
+
*/
|
|
25
|
+
getPackagePath(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Gets this package's Nargo.toml (NoirPackage)Config.
|
|
28
|
+
*/
|
|
29
|
+
getPackageConfig(): {
|
|
30
|
+
package: {
|
|
31
|
+
name: string;
|
|
32
|
+
type: "lib" | "contract" | "bin";
|
|
33
|
+
entry?: string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* An array of sources for a package
|
|
36
|
+
*/
|
|
37
|
+
description?: string | undefined;
|
|
38
|
+
authors?: string[] | undefined;
|
|
39
|
+
compiler_version?: string | undefined;
|
|
40
|
+
backend?: string | undefined;
|
|
41
|
+
license?: string | undefined;
|
|
42
|
+
};
|
|
43
|
+
dependencies: Record<string, {
|
|
44
|
+
git: string;
|
|
45
|
+
tag: string;
|
|
46
|
+
directory?: string | undefined;
|
|
47
|
+
} | {
|
|
48
|
+
path: string;
|
|
49
|
+
}>;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The path to the source directory.
|
|
53
|
+
*/
|
|
54
|
+
getSrcPath(): string;
|
|
55
|
+
/**
|
|
56
|
+
* Gets the entrypoint path for this package.
|
|
57
|
+
*/
|
|
58
|
+
getEntryPointPath(): string;
|
|
59
|
+
/**
|
|
60
|
+
* Gets the project type
|
|
61
|
+
*/
|
|
62
|
+
getType(): "lib" | "contract" | "bin";
|
|
63
|
+
/**
|
|
64
|
+
* Gets this package's dependencies.
|
|
65
|
+
*/
|
|
66
|
+
getDependencies(): Record<string, DependencyConfig>;
|
|
67
|
+
/**
|
|
68
|
+
* Gets this package's sources.
|
|
69
|
+
* @param fm - A file manager to use
|
|
70
|
+
* @param alias - An alias for the sources, if this package is a dependency
|
|
71
|
+
*/
|
|
72
|
+
getSources(fm: FileManager, alias?: string): Promise<SourceList>;
|
|
73
|
+
/**
|
|
74
|
+
* Opens a path on the filesystem.
|
|
75
|
+
* @param path - Path to the package.
|
|
76
|
+
* @param fm - A file manager to use.
|
|
77
|
+
* @returns The Noir package at the given location
|
|
78
|
+
*/
|
|
79
|
+
static open(path: string, fm: FileManager): Promise<Package>;
|
|
80
|
+
}
|
|
81
|
+
export {};
|