@noir-lang/noir_wasm 0.22.0 → 0.23.0-3a90849.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.
Files changed (36) hide show
  1. package/build/cjs/package.json +15 -0
  2. package/build/esm/package.json +18 -0
  3. package/dist/node/index_bg.wasm +0 -0
  4. package/dist/node/main.js +12857 -0
  5. package/dist/node/main.js.map +1 -0
  6. package/dist/types/build/cjs/index.d.ts +93 -0
  7. package/dist/types/build/esm/index.d.ts +92 -0
  8. package/dist/types/src/index.d.cts +8 -0
  9. package/dist/types/src/index.d.mts +8 -0
  10. package/dist/types/src/noir/debug.d.ts +2 -0
  11. package/dist/types/src/noir/dependencies/dependency-manager.d.ts +48 -0
  12. package/dist/types/src/noir/dependencies/dependency-resolver.d.ts +22 -0
  13. package/dist/types/src/noir/dependencies/github-dependency-resolver.d.ts +29 -0
  14. package/dist/types/src/noir/dependencies/local-dependency-resolver.d.ts +12 -0
  15. package/dist/types/src/noir/file-manager/file-manager.d.ts +74 -0
  16. package/dist/types/src/noir/file-manager/memfs-file-manager.d.ts +8 -0
  17. package/dist/types/src/noir/file-manager/nodejs-file-manager.d.ts +7 -0
  18. package/dist/types/src/noir/noir-wasm-compiler.d.ts +31 -0
  19. package/dist/types/src/noir/package.d.ts +81 -0
  20. package/dist/types/src/types/noir_artifact.d.ts +173 -0
  21. package/dist/types/src/types/noir_package_config.d.ts +44 -0
  22. package/dist/types/src/utils.d.ts +5 -0
  23. package/dist/types/web-test-runner.config.d.mts +9 -0
  24. package/dist/types/webpack.config.d.ts +4 -0
  25. package/dist/web/index.html +9 -0
  26. package/dist/web/main.mjs +35340 -0
  27. package/dist/web/main.mjs.map +1 -0
  28. package/package.json +64 -19
  29. package/nodejs/noir_wasm.d.ts +0 -149
  30. package/nodejs/noir_wasm.js +0 -606
  31. package/nodejs/noir_wasm_bg.wasm +0 -0
  32. package/nodejs/noir_wasm_bg.wasm.d.ts +0 -25
  33. package/web/noir_wasm.d.ts +0 -198
  34. package/web/noir_wasm.js +0 -661
  35. package/web/noir_wasm_bg.wasm +0 -0
  36. package/web/noir_wasm_bg.wasm.d.ts +0 -25
package/package.json CHANGED
@@ -1,40 +1,85 @@
1
1
  {
2
2
  "name": "@noir-lang/noir_wasm",
3
- "collaborators": [
3
+ "contributors": [
4
4
  "The Noir Team <team@noir-lang.org>"
5
5
  ],
6
- "version": "0.22.0",
6
+ "version": "0.23.0-3a90849.nightly",
7
7
  "license": "(MIT OR Apache-2.0)",
8
- "main": "./nodejs/noir_wasm.js",
9
- "types": "./web/noir_wasm.d.ts",
10
- "module": "./web/noir_wasm.js",
8
+ "main": "dist/main.js",
9
+ "types": "./dist/types/src/index.d.cts",
10
+ "exports": {
11
+ "node": "./dist/node/main.js",
12
+ "import": "./dist/web/main.mjs",
13
+ "require": "./dist/node/main.js",
14
+ "types": "./dist/types/src/index.d.cts",
15
+ "default": "./dist/web/main.mjs"
16
+ },
11
17
  "files": [
12
- "nodejs",
13
- "web",
18
+ "dist",
14
19
  "package.json"
15
20
  ],
16
21
  "sideEffects": false,
22
+ "homepage": "https://noir-lang.org/",
17
23
  "repository": {
18
- "type": "git",
19
- "url": "https://github.com/noir-lang/noir.git"
24
+ "url": "https://github.com/noir-lang/noir.git",
25
+ "directory": "compiler/wasm",
26
+ "type": "git"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/noir-lang/noir/issues"
20
30
  },
21
31
  "scripts": {
22
- "build": "bash ./build.sh",
23
- "test": "yarn test:node && yarn test:browser",
24
- "test:node": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' mocha",
32
+ "install:wasm_pack": "./scripts/install_wasm-pack.sh",
33
+ "build": "yarn install:wasm_pack && WASM_OPT=$(./scripts/command-check.sh wasm-opt) webpack",
34
+ "test": "yarn test:build_fixtures && yarn test:node && yarn test:browser",
35
+ "test:build_fixtures": "./scripts/build-fixtures.sh",
25
36
  "test:browser": "web-test-runner",
26
- "clean": "chmod u+w web nodejs || true && rm -rf ./nodejs ./web ./target ./result",
37
+ "test:browser:docker": "docker run --rm -v $(cd ../.. && pwd):/usr/src/noir -w /usr/src/noir/compiler/wasm mcr.microsoft.com/playwright:v1.40.0-jammy yarn test:browser",
38
+ "test:node": "NODE_NO_WARNINGS=1 mocha --config ./.mocharc.json",
39
+ "clean": "rm -rf ./build ./target ./dist public/fixtures/simple/target public/fixtures/with-deps/target",
27
40
  "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
41
  "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
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 ./"
42
+ "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0"
32
43
  },
33
44
  "devDependencies": {
34
45
  "@esm-bundle/chai": "^4.3.4-fix.0",
46
+ "@ltd/j-toml": "^1.38.0",
47
+ "@noir-lang/noirc_abi": "0.23.0-3a90849.nightly",
48
+ "@types/adm-zip": "^0.5.0",
49
+ "@types/chai": "^4",
50
+ "@types/mocha": "^10.0.6",
51
+ "@types/mocha-each": "^2",
52
+ "@types/node": "^20.10.5",
53
+ "@types/pako": "^2",
54
+ "@types/path-browserify": "^1",
55
+ "@types/readable-stream": "^4",
56
+ "@types/sinon": "^17",
57
+ "@wasm-tool/wasm-pack-plugin": "^1.7.0",
35
58
  "@web/dev-server-esbuild": "^0.3.6",
36
- "@web/test-runner": "^0.15.3",
37
- "@web/test-runner-playwright": "^0.10.0",
38
- "mocha": "^10.2.0"
59
+ "@web/test-runner": "^0.18.0",
60
+ "@web/test-runner-playwright": "^0.11.0",
61
+ "adm-zip": "^0.5.0",
62
+ "assert": "^2.1.0",
63
+ "browserify-fs": "^1.0.0",
64
+ "chai": "^4.3.10",
65
+ "copy-webpack-plugin": "^11.0.0",
66
+ "html-webpack-plugin": "^5.5.4",
67
+ "memfs": "^4.6.0",
68
+ "mocha": "^10.2.0",
69
+ "mocha-each": "^2.0.1",
70
+ "path-browserify": "^1.0.1",
71
+ "process": "^0.11.10",
72
+ "readable-stream": "^4.4.2",
73
+ "sinon": "^17.0.1",
74
+ "ts-loader": "^9.5.1",
75
+ "ts-node": "^10.9.1",
76
+ "typescript": "~5.2.2",
77
+ "unzipit": "^1.4.3",
78
+ "url": "^0.11.3",
79
+ "webpack": "^5.49.0",
80
+ "webpack-cli": "^4.7.2"
81
+ },
82
+ "dependencies": {
83
+ "pako": "^2.1.0"
39
84
  }
40
85
  }
@@ -1,149 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * @param {Uint8Array} bytes
5
- * @returns {any}
6
- */
7
- export function acir_read_bytes(bytes: Uint8Array): any;
8
- /**
9
- * @param {any} acir
10
- * @returns {Uint8Array}
11
- */
12
- export function acir_write_bytes(acir: any): Uint8Array;
13
- /**
14
- * This is a method that exposes the same API as `compile`
15
- * But uses the Context based APi internally
16
- * @param {string} entry_point
17
- * @param {boolean | undefined} contracts
18
- * @param {DependencyGraph | undefined} dependency_graph
19
- * @param {PathToFileSourceMap} file_source_map
20
- * @returns {CompileResult}
21
- */
22
- export function compile_(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
23
- /**
24
- * @param {string} level
25
- */
26
- export function init_log_level(level: string): void;
27
- /**
28
- * @returns {any}
29
- */
30
- export function build_info(): any;
31
- /**
32
- * @param {string} entry_point
33
- * @param {boolean | undefined} contracts
34
- * @param {DependencyGraph | undefined} dependency_graph
35
- * @param {PathToFileSourceMap} file_source_map
36
- * @returns {CompileResult}
37
- */
38
- export function compile(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
39
-
40
- export type Diagnostic = {
41
- message: string;
42
- file: string;
43
- secondaries: ReadonlyArray<{
44
- message: string;
45
- start: number;
46
- end: number;
47
- }>;
48
- }
49
-
50
- export interface CompileError extends Error {
51
- message: string;
52
- diagnostics: ReadonlyArray<Diagnostic>;
53
- }
54
-
55
-
56
-
57
- export type DependencyGraph = {
58
- root_dependencies: readonly string[];
59
- library_dependencies: Readonly<Record<string, readonly string[]>>;
60
- }
61
-
62
- export type CompiledContract = {
63
- noir_version: string;
64
- name: string;
65
- functions: Array<any>;
66
- events: Array<any>;
67
- };
68
-
69
- export type CompiledProgram = {
70
- noir_version: string;
71
- abi: any;
72
- bytecode: string;
73
- }
74
-
75
- export type DebugArtifact = {
76
- debug_symbols: Array<any>;
77
- file_map: Record<number, any>;
78
- warnings: Array<any>;
79
- };
80
-
81
- export type CompileResult = (
82
- | {
83
- contract: CompiledContract;
84
- debug: DebugArtifact;
85
- }
86
- | {
87
- program: CompiledProgram;
88
- debug: DebugArtifact;
89
- }
90
- );
91
-
92
-
93
- /**
94
- * This is a wrapper class that is wasm-bindgen compatible
95
- * We do not use js_name and rename it like CrateId because
96
- * then the impl block is not picked up in javascript.
97
- */
98
- export class CompilerContext {
99
- free(): void;
100
- /**
101
- * @param {PathToFileSourceMap} source_map
102
- */
103
- constructor(source_map: PathToFileSourceMap);
104
- /**
105
- * @param {string} path_to_crate
106
- * @returns {CrateId}
107
- */
108
- process_root_crate(path_to_crate: string): CrateId;
109
- /**
110
- * @param {string} path_to_crate
111
- * @returns {CrateId}
112
- */
113
- process_dependency_crate(path_to_crate: string): CrateId;
114
- /**
115
- * @param {string} crate_name
116
- * @param {CrateId} from
117
- * @param {CrateId} to
118
- */
119
- add_dependency_edge(crate_name: string, from: CrateId, to: CrateId): void;
120
- /**
121
- * @param {number} program_width
122
- * @returns {CompileResult}
123
- */
124
- compile_program(program_width: number): CompileResult;
125
- /**
126
- * @param {number} program_width
127
- * @returns {CompileResult}
128
- */
129
- compile_contract(program_width: number): CompileResult;
130
- }
131
- /**
132
- */
133
- export class CrateId {
134
- free(): void;
135
- }
136
- /**
137
- */
138
- export class PathToFileSourceMap {
139
- free(): void;
140
- /**
141
- */
142
- constructor();
143
- /**
144
- * @param {string} path
145
- * @param {string} source_code
146
- * @returns {boolean}
147
- */
148
- add_source_code(path: string, source_code: string): boolean;
149
- }