@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.
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 +56 -16
  29. package/nodejs/noir_wasm.d.ts +0 -139
  30. package/nodejs/noir_wasm.js +0 -575
  31. package/nodejs/noir_wasm_bg.wasm +0 -0
  32. package/nodejs/noir_wasm_bg.wasm.d.ts +0 -23
  33. package/web/noir_wasm.d.ts +0 -186
  34. package/web/noir_wasm.js +0 -628
  35. package/web/noir_wasm_bg.wasm +0 -0
  36. package/web/noir_wasm_bg.wasm.d.ts +0 -23
package/package.json CHANGED
@@ -3,14 +3,19 @@
3
3
  "contributors": [
4
4
  "The Noir Team <team@noir-lang.org>"
5
5
  ],
6
- "version": "0.22.0-fbb51ed.nightly",
6
+ "version": "0.23.0",
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,
@@ -24,22 +29,57 @@
24
29
  "url": "https://github.com/noir-lang/noir/issues"
25
30
  },
26
31
  "scripts": {
27
- "build": "bash ./build.sh",
28
- "test": "yarn test:node && yarn test:browser",
29
- "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",
30
36
  "test:browser": "web-test-runner",
31
- "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",
32
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",
33
41
  "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
34
- "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0",
35
- "build:nix": "nix build -L .#noir_wasm",
36
- "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"
37
43
  },
38
44
  "devDependencies": {
39
45
  "@esm-bundle/chai": "^4.3.4-fix.0",
46
+ "@ltd/j-toml": "^1.38.0",
47
+ "@noir-lang/noirc_abi": "0.23.0",
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",
40
58
  "@web/dev-server-esbuild": "^0.3.6",
41
- "@web/test-runner": "^0.15.3",
42
- "@web/test-runner-playwright": "^0.10.0",
43
- "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"
44
84
  }
45
85
  }
@@ -1,139 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * This is a method that exposes the same API as `compile`
5
- * But uses the Context based APi internally
6
- * @param {string} entry_point
7
- * @param {boolean | undefined} contracts
8
- * @param {DependencyGraph | undefined} dependency_graph
9
- * @param {PathToFileSourceMap} file_source_map
10
- * @returns {CompileResult}
11
- */
12
- export function compile_(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
13
- /**
14
- * @param {string} filter
15
- */
16
- export function init_log_level(filter: string): void;
17
- /**
18
- * @returns {any}
19
- */
20
- export function build_info(): any;
21
- /**
22
- * @param {string} entry_point
23
- * @param {boolean | undefined} contracts
24
- * @param {DependencyGraph | undefined} dependency_graph
25
- * @param {PathToFileSourceMap} file_source_map
26
- * @returns {CompileResult}
27
- */
28
- export function compile(entry_point: string, contracts: boolean | undefined, dependency_graph: DependencyGraph | undefined, file_source_map: PathToFileSourceMap): CompileResult;
29
-
30
- export type Diagnostic = {
31
- message: string;
32
- file: string;
33
- secondaries: ReadonlyArray<{
34
- message: string;
35
- start: number;
36
- end: number;
37
- }>;
38
- }
39
-
40
- export interface CompileError extends Error {
41
- message: string;
42
- diagnostics: ReadonlyArray<Diagnostic>;
43
- }
44
-
45
-
46
-
47
- export type DependencyGraph = {
48
- root_dependencies: readonly string[];
49
- library_dependencies: Readonly<Record<string, readonly string[]>>;
50
- }
51
-
52
- export type CompiledContract = {
53
- noir_version: string;
54
- name: string;
55
- functions: Array<any>;
56
- events: Array<any>;
57
- };
58
-
59
- export type CompiledProgram = {
60
- noir_version: string;
61
- abi: any;
62
- bytecode: string;
63
- }
64
-
65
- export type DebugArtifact = {
66
- debug_symbols: Array<any>;
67
- file_map: Record<number, any>;
68
- warnings: Array<any>;
69
- };
70
-
71
- export type CompileResult = (
72
- | {
73
- contract: CompiledContract;
74
- debug: DebugArtifact;
75
- }
76
- | {
77
- program: CompiledProgram;
78
- debug: DebugArtifact;
79
- }
80
- );
81
-
82
-
83
- /**
84
- * This is a wrapper class that is wasm-bindgen compatible
85
- * We do not use js_name and rename it like CrateId because
86
- * then the impl block is not picked up in javascript.
87
- */
88
- export class CompilerContext {
89
- free(): void;
90
- /**
91
- * @param {PathToFileSourceMap} source_map
92
- */
93
- constructor(source_map: PathToFileSourceMap);
94
- /**
95
- * @param {string} path_to_crate
96
- * @returns {CrateId}
97
- */
98
- process_root_crate(path_to_crate: string): CrateId;
99
- /**
100
- * @param {string} path_to_crate
101
- * @returns {CrateId}
102
- */
103
- process_dependency_crate(path_to_crate: string): CrateId;
104
- /**
105
- * @param {string} crate_name
106
- * @param {CrateId} from
107
- * @param {CrateId} to
108
- */
109
- add_dependency_edge(crate_name: string, from: CrateId, to: CrateId): void;
110
- /**
111
- * @param {number} program_width
112
- * @returns {CompileResult}
113
- */
114
- compile_program(program_width: number): CompileResult;
115
- /**
116
- * @param {number} program_width
117
- * @returns {CompileResult}
118
- */
119
- compile_contract(program_width: number): CompileResult;
120
- }
121
- /**
122
- */
123
- export class CrateId {
124
- free(): void;
125
- }
126
- /**
127
- */
128
- export class PathToFileSourceMap {
129
- free(): void;
130
- /**
131
- */
132
- constructor();
133
- /**
134
- * @param {string} path
135
- * @param {string} source_code
136
- * @returns {boolean}
137
- */
138
- add_source_code(path: string, source_code: string): boolean;
139
- }