From 1826d5dffe093033b54c73a1342ea1c8febefd83 Mon Sep 17 00:00:00 2001 From: thunkar Date: Mon, 18 Dec 2023 06:16:50 +0000 Subject: [PATCH 01/37] Started merging changes --- compiler/wasm/.gitignore | 1 + compiler/wasm/build.sh | 47 - compiler/wasm/buildPhaseCargoCommand.sh | 39 - compiler/wasm/installPhase.sh | 10 - compiler/wasm/jest.config.ts | 21 + compiler/wasm/package.json | 62 +- .../fixtures/deps/lib-a/Nargo.toml | 0 .../fixtures/deps/lib-a/src/lib.nr | 0 .../fixtures/deps/lib-b/Nargo.toml | 0 .../fixtures/deps/lib-b/src/lib.nr | 0 .../fixtures/deps/noir-script/Nargo.toml | 0 .../fixtures/deps/noir-script/src/main.nr | 0 .../fixtures/simple/noir-script/Nargo.toml | 0 .../fixtures/simple/noir-script/src/main.nr | 0 compiler/wasm/src/index.cts | 10 + compiler/wasm/src/index.mts | 10 + .../src/noir/contract-interface-gen/abi.ts | 150 +++ .../contractTypescript.ts | 210 ++++ .../programTypescript.ts | 189 ++++ .../dependencies/dependency-manager.test.ts | 107 ++ .../noir/dependencies/dependency-manager.ts | 150 +++ .../noir/dependencies/dependency-resolver.ts | 24 + .../github-dependency-resolver.test.ts | 131 +++ .../github-dependency-resolver.ts | 145 +++ .../local-dependency-resolver.test.ts | 52 + .../dependencies/local-dependency-resolver.ts | 31 + .../noir/file-manager/file-manager.test.ts | 90 ++ .../src/noir/file-manager/file-manager.ts | 157 +++ .../noir/file-manager/memfs-file-manager.ts | 58 + compiler/wasm/src/noir/noir-wasm-compiler.ts | 242 +++++ compiler/wasm/src/noir/noir_artifact.ts | 180 ++++ compiler/wasm/src/noir/package.ts | 129 +++ compiler/wasm/src/noir_wasm.ts | 34 + compiler/wasm/src/types/abi.ts | 270 +++++ .../wasm/src/types/noir_package_config.ts | 58 + compiler/wasm/src/types/utils.ts | 53 + compiler/wasm/tsconfig.cjs.json | 7 + compiler/wasm/tsconfig.esm.json | 10 + compiler/wasm/tsconfig.json | 15 +- compiler/wasm/webpack.config.ts | 130 +++ yarn.lock | 997 +++++++++++++++++- 41 files changed, 3674 insertions(+), 145 deletions(-) delete mode 100755 compiler/wasm/build.sh delete mode 100755 compiler/wasm/buildPhaseCargoCommand.sh delete mode 100755 compiler/wasm/installPhase.sh create mode 100644 compiler/wasm/jest.config.ts rename compiler/wasm/{ => public}/fixtures/deps/lib-a/Nargo.toml (100%) rename compiler/wasm/{ => public}/fixtures/deps/lib-a/src/lib.nr (100%) rename compiler/wasm/{ => public}/fixtures/deps/lib-b/Nargo.toml (100%) rename compiler/wasm/{ => public}/fixtures/deps/lib-b/src/lib.nr (100%) rename compiler/wasm/{ => public}/fixtures/deps/noir-script/Nargo.toml (100%) rename compiler/wasm/{ => public}/fixtures/deps/noir-script/src/main.nr (100%) rename compiler/wasm/{ => public}/fixtures/simple/noir-script/Nargo.toml (100%) rename compiler/wasm/{ => public}/fixtures/simple/noir-script/src/main.nr (100%) create mode 100644 compiler/wasm/src/index.cts create mode 100644 compiler/wasm/src/index.mts create mode 100644 compiler/wasm/src/noir/contract-interface-gen/abi.ts create mode 100644 compiler/wasm/src/noir/contract-interface-gen/contractTypescript.ts create mode 100644 compiler/wasm/src/noir/contract-interface-gen/programTypescript.ts create mode 100644 compiler/wasm/src/noir/dependencies/dependency-manager.test.ts create mode 100644 compiler/wasm/src/noir/dependencies/dependency-manager.ts create mode 100644 compiler/wasm/src/noir/dependencies/dependency-resolver.ts create mode 100644 compiler/wasm/src/noir/dependencies/github-dependency-resolver.test.ts create mode 100644 compiler/wasm/src/noir/dependencies/github-dependency-resolver.ts create mode 100644 compiler/wasm/src/noir/dependencies/local-dependency-resolver.test.ts create mode 100644 compiler/wasm/src/noir/dependencies/local-dependency-resolver.ts create mode 100644 compiler/wasm/src/noir/file-manager/file-manager.test.ts create mode 100644 compiler/wasm/src/noir/file-manager/file-manager.ts create mode 100644 compiler/wasm/src/noir/file-manager/memfs-file-manager.ts create mode 100644 compiler/wasm/src/noir/noir-wasm-compiler.ts create mode 100644 compiler/wasm/src/noir/noir_artifact.ts create mode 100644 compiler/wasm/src/noir/package.ts create mode 100644 compiler/wasm/src/noir_wasm.ts create mode 100644 compiler/wasm/src/types/abi.ts create mode 100644 compiler/wasm/src/types/noir_package_config.ts create mode 100644 compiler/wasm/src/types/utils.ts create mode 100644 compiler/wasm/tsconfig.cjs.json create mode 100644 compiler/wasm/tsconfig.esm.json create mode 100644 compiler/wasm/webpack.config.ts diff --git a/compiler/wasm/.gitignore b/compiler/wasm/.gitignore index f968dafbcc3..47f2e0067b3 100644 --- a/compiler/wasm/.gitignore +++ b/compiler/wasm/.gitignore @@ -1 +1,2 @@ noir-script/target +dist/ \ No newline at end of file diff --git a/compiler/wasm/build.sh b/compiler/wasm/build.sh deleted file mode 100755 index 24af149bcea..00000000000 --- a/compiler/wasm/build.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -function require_command { - if ! command -v "$1" >/dev/null 2>&1; then - echo "Error: $1 is required but not installed." >&2 - exit 1 - fi -} -function check_installed { - if ! command -v "$1" >/dev/null 2>&1; then - echo "$1 is not installed. Please install it." >&2 - return 1 - fi - return 0 -} -function run_or_fail { - "$@" - local status=$? - if [ $status -ne 0 ]; then - echo "Command '$*' failed with exit code $status" >&2 - exit $status - fi -} - -require_command jq -require_command cargo -require_command wasm-bindgen -check_installed wasm-opt - -self_path=$(dirname "$(readlink -f "$0")") -export pname=$(cargo read-manifest | jq -r '.name') -export CARGO_TARGET_DIR=$self_path/target - -rm -rf $self_path/outputs >/dev/null 2>&1 -rm -rf $self_path/result >/dev/null 2>&1 - -if [ -n "$out" ]; then - echo "Will install package to $out (defined outside installPhase.sh script)" -else - export out="$self_path/outputs/out" - echo "Will install package to $out" -fi - -run_or_fail $self_path/buildPhaseCargoCommand.sh -run_or_fail $self_path/installPhase.sh - -ln -s $out $self_path/result diff --git a/compiler/wasm/buildPhaseCargoCommand.sh b/compiler/wasm/buildPhaseCargoCommand.sh deleted file mode 100755 index 2ab0f1eb3cb..00000000000 --- a/compiler/wasm/buildPhaseCargoCommand.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash - -function run_or_fail { - "$@" - local status=$? - if [ $status -ne 0 ]; then - echo "Command '$*' failed with exit code $status" >&2 - exit $status - fi -} -function run_if_available { - if command -v "$1" >/dev/null 2>&1; then - "$@" - else - echo "$1 is not installed. Please install it to use this feature." >&2 - fi -} - -export self_path=$(dirname "$(readlink -f "$0")") - -# Clear out the existing build artifacts as these aren't automatically removed by wasm-pack. -if [ -d ./pkg/ ]; then - rm -rf $self_path/pkg/ -fi - -TARGET=wasm32-unknown-unknown -WASM_BINARY=$CARGO_TARGET_DIR/$TARGET/release/${pname}.wasm - -NODE_DIR=$self_path/nodejs/ -BROWSER_DIR=$self_path/web/ -NODE_WASM=${NODE_DIR}/${pname}_bg.wasm -BROWSER_WASM=${BROWSER_DIR}/${pname}_bg.wasm - -# Build the new wasm package -run_or_fail cargo build --lib --release --target $TARGET --package ${pname} ${cargoExtraArgs} -run_or_fail wasm-bindgen $WASM_BINARY --out-dir $NODE_DIR --typescript --target nodejs -run_or_fail wasm-bindgen $WASM_BINARY --out-dir $BROWSER_DIR --typescript --target web -run_if_available wasm-opt $NODE_WASM -o $NODE_WASM -O -run_if_available wasm-opt $BROWSER_WASM -o $BROWSER_WASM -O \ No newline at end of file diff --git a/compiler/wasm/installPhase.sh b/compiler/wasm/installPhase.sh deleted file mode 100755 index e5be98a3339..00000000000 --- a/compiler/wasm/installPhase.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -export self_path=$(dirname "$(readlink -f "$0")") - -export out_path=$out/noir_wasm - -mkdir -p $out_path -cp $self_path/README.md $out_path/ -cp $self_path/package.json $out_path/ -cp -r $self_path/nodejs $out_path/ -cp -r $self_path/web $out_path/ diff --git a/compiler/wasm/jest.config.ts b/compiler/wasm/jest.config.ts new file mode 100644 index 00000000000..53645580c20 --- /dev/null +++ b/compiler/wasm/jest.config.ts @@ -0,0 +1,21 @@ +import type { Config } from 'jest'; + +const config: Config = { + moduleNameMapper: { + '^(\\.{1,2}/.*)\\.[cm]?js$': '$1', + }, + extensionsToTreatAsEsm: ['.ts'], + moduleFileExtensions: ['js', 'ts', 'cts'], + testRegex: './.*\\.test\\.(js|mjs|ts)$', + rootDir: './', + transform: { + '^.+\\.tsx?$': [ + 'ts-jest', + { + useESM: true, + }, + ], + }, +}; + +export default config; diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index 40774c3449b..7163bb0bec2 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -3,25 +3,25 @@ "collaborators": [ "The Noir Team " ], - "version": "0.21.0", + "version": "0.20.0", "license": "(MIT OR Apache-2.0)", - "main": "./nodejs/noir_wasm.js", - "types": "./web/noir_wasm.d.ts", - "module": "./web/noir_wasm.js", - "files": [ - "nodejs", - "web", - "package.json" - ], - "sideEffects": false, + "main": "dist/main.js", + "types": "dist/types", + "exports": { + "node": "./dist/node/main.js", + "default": "./dist/web/main.js", + "import": "./dist/web/main.js", + "require": "./dist/node/main.js" + }, "repository": { "type": "git", "url": "https://github.com/noir-lang/noir.git" }, "scripts": { - "build": "bash ./build.sh", - "test": "yarn test:node && yarn test:browser", - "test:node": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' mocha", + "serve": "webpack serve", + "build": "webpack", + "test": "yarn test:node", + "test:node": "mocha", "test:browser": "web-test-runner", "clean": "chmod u+w web nodejs || true && rm -rf ./nodejs ./web ./target ./result", "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", @@ -31,10 +31,44 @@ "install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/noir_wasm/nodejs ./ && cp -rL ./result/noir_wasm/web ./" }, "devDependencies": { + "@babel/plugin-proposal-class-properties": "^7.18.6", + "@babel/plugin-transform-private-methods": "^7.23.3", + "@babel/preset-env": "^7.23.5", + "@babel/preset-typescript": "^7.23.3", "@esm-bundle/chai": "^4.3.4-fix.0", + "@ltd/j-toml": "^1.38.0", + "@types/babel__preset-env": "^7", + "@types/lodash.compact": "^3", + "@types/node": "^20.10.0", + "@types/pako": "^2", + "@types/path-browserify": "^1", + "@types/readable-stream": "^4", + "@wasm-tool/wasm-pack-plugin": "^1.7.0", "@web/dev-server-esbuild": "^0.3.6", "@web/test-runner": "^0.15.3", "@web/test-runner-playwright": "^0.10.0", - "mocha": "^10.2.0" + "assert": "^2.1.0", + "babel-loader": "^9.1.3", + "browserify-fs": "^1.0.0", + "buffer": "^6.0.3", + "copy-webpack-plugin": "^11.0.0", + "file-loader": "^6.2.0", + "html-webpack-plugin": "^5.5.4", + "lodash.compact": "^3.0.1", + "mocha": "^10.2.0", + "pako": "^2.1.0", + "path-browserify": "^1.0.1", + "process": "^0.11.10", + "readable-stream": "^4.4.2", + "text-encoding": "^0.7.0", + "ts-loader": "^9.5.1", + "ts-node": "^10.9.1", + "typescript": "~5.2.2", + "unzipit": "^1.4.3", + "url": "^0.11.3", + "util": "^0.12.5", + "webpack": "^5.49.0", + "webpack-cli": "^4.7.2", + "webpack-dev-server": "^4.15.1" } } diff --git a/compiler/wasm/fixtures/deps/lib-a/Nargo.toml b/compiler/wasm/public/fixtures/deps/lib-a/Nargo.toml similarity index 100% rename from compiler/wasm/fixtures/deps/lib-a/Nargo.toml rename to compiler/wasm/public/fixtures/deps/lib-a/Nargo.toml diff --git a/compiler/wasm/fixtures/deps/lib-a/src/lib.nr b/compiler/wasm/public/fixtures/deps/lib-a/src/lib.nr similarity index 100% rename from compiler/wasm/fixtures/deps/lib-a/src/lib.nr rename to compiler/wasm/public/fixtures/deps/lib-a/src/lib.nr diff --git a/compiler/wasm/fixtures/deps/lib-b/Nargo.toml b/compiler/wasm/public/fixtures/deps/lib-b/Nargo.toml similarity index 100% rename from compiler/wasm/fixtures/deps/lib-b/Nargo.toml rename to compiler/wasm/public/fixtures/deps/lib-b/Nargo.toml diff --git a/compiler/wasm/fixtures/deps/lib-b/src/lib.nr b/compiler/wasm/public/fixtures/deps/lib-b/src/lib.nr similarity index 100% rename from compiler/wasm/fixtures/deps/lib-b/src/lib.nr rename to compiler/wasm/public/fixtures/deps/lib-b/src/lib.nr diff --git a/compiler/wasm/fixtures/deps/noir-script/Nargo.toml b/compiler/wasm/public/fixtures/deps/noir-script/Nargo.toml similarity index 100% rename from compiler/wasm/fixtures/deps/noir-script/Nargo.toml rename to compiler/wasm/public/fixtures/deps/noir-script/Nargo.toml diff --git a/compiler/wasm/fixtures/deps/noir-script/src/main.nr b/compiler/wasm/public/fixtures/deps/noir-script/src/main.nr similarity index 100% rename from compiler/wasm/fixtures/deps/noir-script/src/main.nr rename to compiler/wasm/public/fixtures/deps/noir-script/src/main.nr diff --git a/compiler/wasm/fixtures/simple/noir-script/Nargo.toml b/compiler/wasm/public/fixtures/simple/noir-script/Nargo.toml similarity index 100% rename from compiler/wasm/fixtures/simple/noir-script/Nargo.toml rename to compiler/wasm/public/fixtures/simple/noir-script/Nargo.toml diff --git a/compiler/wasm/fixtures/simple/noir-script/src/main.nr b/compiler/wasm/public/fixtures/simple/noir-script/src/main.nr similarity index 100% rename from compiler/wasm/fixtures/simple/noir-script/src/main.nr rename to compiler/wasm/public/fixtures/simple/noir-script/src/main.nr diff --git a/compiler/wasm/src/index.cts b/compiler/wasm/src/index.cts new file mode 100644 index 00000000000..1d39d92f274 --- /dev/null +++ b/compiler/wasm/src/index.cts @@ -0,0 +1,10 @@ +import { compileUsingNoirWasm } from './noir_wasm'; +import { FileManager } from './noir/file-manager/file-manager'; + +async function compile(fileManager: FileManager, projectPath: string) { + const cjsModule = await require('../build/cjs'); + console.log('hey cjs'); + return compileUsingNoirWasm(fileManager, projectPath, cjsModule.compile, new cjsModule.PathToFileSourceMap()); +} + +export { compile }; diff --git a/compiler/wasm/src/index.mts b/compiler/wasm/src/index.mts new file mode 100644 index 00000000000..6bc14c10b2f --- /dev/null +++ b/compiler/wasm/src/index.mts @@ -0,0 +1,10 @@ +import { FileManager } from './noir/file-manager/file-manager'; +import { compileUsingNoirWasm } from './noir_wasm'; + +async function compile(fileManager: FileManager, projectPath: string) { + const esmModule = await import('../build/esm'); + console.log('hey esm'); + return compileUsingNoirWasm(fileManager, projectPath, esmModule.compile, new esmModule.PathToFileSourceMap()); +} + +export { compile }; diff --git a/compiler/wasm/src/noir/contract-interface-gen/abi.ts b/compiler/wasm/src/noir/contract-interface-gen/abi.ts new file mode 100644 index 00000000000..c30a884e832 --- /dev/null +++ b/compiler/wasm/src/noir/contract-interface-gen/abi.ts @@ -0,0 +1,150 @@ +import { deflate } from 'pako'; + +import { + NoirCompilationResult, + NoirContractCompilationArtifacts, + NoirFunctionEntry, + NoirProgramCompilationArtifacts, + ProgramArtifact, + isNoirContractCompilationArtifacts, + isNoirProgramCompilationArtifacts, +} from '../noir_artifact.js'; +import { ABIType, ContractArtifact, DebugMetadata, FunctionArtifact, FunctionType } from '../../types/abi.js'; + +// TODO - What to do? +export const FUNCTION_TREE_HEIGHT = 5; +export const mockVerificationKey = + '0000000200000800000000740000000f00000003515f3109623eb3c25aa5b16a1a79fd558bac7a7ce62c4560a8c537c77ce80dd339128d1d37b6582ee9e6df9567efb64313471dfa18f520f9ce53161b50dbf7731bc5f900000003515f322bc4cce83a486a92c92fd59bd84e0f92595baa639fc2ed86b00ffa0dfded2a092a669a3bdb7a273a015eda494457cc7ed5236f26cee330c290d45a33b9daa94800000003515f332729426c008c085a81bd34d8ef12dd31e80130339ef99d50013a89e4558eee6d0fa4ffe2ee7b7b62eb92608b2251ac31396a718f9b34978888789042b790a30100000003515f342be6b6824a913eb7a57b03cb1ee7bfb4de02f2f65fe8a4e97baa7766ddb353a82a8a25c49dc63778cd9fe96173f12a2bc77f3682f4c4448f98f1df82c75234a100000003515f351f85760d6ab567465aadc2f180af9eae3800e6958fec96aef53fd8a7b195d7c000c6267a0dd5cfc22b3fe804f53e266069c0e36f51885baec1e7e67650c62e170000000c515f41524954484d455449430d9d0f8ece2aa12012fa21e6e5c859e97bd5704e5c122064a66051294bc5e04213f61f54a0ebdf6fee4d4a6ecf693478191de0c2899bcd8e86a636c8d3eff43400000003515f43224a99d02c86336737c8dd5b746c40d2be6aead8393889a76a18d664029096e90f7fe81adcc92a74350eada9622ac453f49ebac24a066a1f83b394df54dfa0130000000c515f46495845445f42415345060e8a013ed289c2f9fd7473b04f6594b138ddb4b4cf6b901622a14088f04b8d2c83ff74fce56e3d5573b99c7b26d85d5046ce0c6559506acb7a675e7713eb3a00000007515f4c4f4749430721a91cb8da4b917e054f72147e1760cfe0ef3d45090ac0f4961d84ec1996961a25e787b26bd8b50b1a99450f77a424a83513c2b33af268cd253b0587ff50c700000003515f4d05dbd8623b8652511e1eb38d38887a69eceb082f807514f09e127237c5213b401b9325b48c6c225968002318095f89d0ef9cf629b2b7f0172e03bc39aacf6ed800000007515f52414e474504b57a3805e41df328f5ca9aefa40fad5917391543b7b65c6476e60b8f72e9ad07c92f3b3e11c8feae96dedc4b14a6226ef3201244f37cfc1ee5b96781f48d2b000000075349474d415f3125001d1954a18571eaa007144c5a567bb0d2be4def08a8be918b8c05e3b27d312c59ed41e09e144eab5de77ca89a2fd783be702a47c951d3112e3de02ce6e47c000000075349474d415f3223994e6a23618e60fa01c449a7ab88378709197e186d48d604bfb6931ffb15ad11c5ec7a0700570f80088fd5198ab5d5c227f2ad2a455a6edeec024156bb7beb000000075349474d415f3300cda5845f23468a13275d18bddae27c6bb189cf9aa95b6a03a0cb6688c7e8d829639b45cf8607c525cc400b55ebf90205f2f378626dc3406cc59b2d1b474fba000000075349474d415f342d299e7928496ea2d37f10b43afd6a80c90a33b483090d18069ffa275eedb2fc2f82121e8de43dc036d99b478b6227ceef34248939987a19011f065d8b5cef5c0000000010000000000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f'; + +/** + * Returns whether the ABI type is an Aztec or Ethereum Address defined in Aztec.nr. + * @param abiType - Type to check. + * @returns Boolean. + */ +export function isAddressStruct(abiType: ABIType) { + return isEthereumAddressStruct(abiType) || isAztecAddressStruct(abiType); +} + +/** + * Returns whether the ABI type is an Ethereum Address defined in Aztec.nr. + * @param abiType - Type to check. + * @returns Boolean. + */ +export function isEthereumAddressStruct(abiType: ABIType) { + return abiType.kind === 'struct' && abiType.path.endsWith('::types::address::EthereumAddress'); +} + +/** + * Returns whether the ABI type is an Aztec Address defined in Aztec.nr. + * @param abiType - Type to check. + * @returns Boolean. + */ +export function isAztecAddressStruct(abiType: ABIType) { + return abiType.kind === 'struct' && abiType.path.endsWith('::types::address::AztecAddress'); +} + +/** + * Generates a function build artifact. Replaces verification key with a mock value. + * @param fn - Noir function entry. + * @returns Function artifact. + */ +function generateFunctionArtifact(fn: NoirFunctionEntry): FunctionArtifact { + const functionType = fn.function_type.toLowerCase() as FunctionType; + const isInternal = fn.is_internal; + + // If the function is not unconstrained, the first item is inputs or CallContext which we should omit + let parameters = fn.abi.parameters; + if (functionType !== FunctionType.UNCONSTRAINED) { + parameters = parameters.slice(1); + } + + // If the function is secret, the return is the public inputs, which should be omitted + const returnTypes = functionType === FunctionType.SECRET ? [] : [fn.abi.return_type]; + + return { + name: fn.name, + functionType, + isInternal, + parameters, + returnTypes, + bytecode: fn.bytecode, + verificationKey: mockVerificationKey, + }; +} + +/** + * Entrypoint for generating the .json artifact for compiled contract or program + * @param compileResult - Noir build output. + * @returns Aztec contract build artifact. + */ +export function generateArtifact(compileResult: NoirCompilationResult) { + if (isNoirContractCompilationArtifacts(compileResult)) { + return generateContractArtifact(compileResult); + } else if (isNoirProgramCompilationArtifacts(compileResult)) { + return generateProgramArtifact(compileResult); + } else { + throw Error('Unsupported artifact type'); + } +} + +/** + * Given a Nargo output generates an Aztec-compatible contract artifact. + * @param compiled - Noir build output. + * @returns Aztec contract build artifact. + */ +export function generateProgramArtifact( + { program }: NoirProgramCompilationArtifacts, + // eslint-disable-next-line camelcase + noir_version?: string, +): ProgramArtifact { + return { + // eslint-disable-next-line camelcase + noir_version, + hash: program.hash, + backend: program.backend, + abi: program.abi, + + // TODO: should we parse and write the debug? it doesn't seem to be in the nargo output + // debug: someParsedDebug, + }; +} + +/** + * Given a Nargo output generates an Aztec-compatible contract artifact. + * @param compiled - Noir build output. + * @returns Aztec contract build artifact. + */ +export function generateContractArtifact( + { contract, debug }: NoirContractCompilationArtifacts, + aztecNrVersion?: string, +): ContractArtifact { + const constructorArtifact = contract.functions.find(({ name }) => name === 'constructor'); + if (constructorArtifact === undefined) { + throw new Error('Contract must have a constructor function'); + } + if (contract.functions.length > 2 ** FUNCTION_TREE_HEIGHT) { + throw new Error(`Contract can only have a maximum of ${2 ** FUNCTION_TREE_HEIGHT} functions`); + } + const originalFunctions = contract.functions; + // TODO why sort? we should have idempotent compilation so this should not be needed. + const sortedFunctions = [...contract.functions].sort((fnA, fnB) => fnA.name.localeCompare(fnB.name)); + let parsedDebug: DebugMetadata | undefined = undefined; + + if (debug) { + parsedDebug = { + debugSymbols: sortedFunctions.map((fn) => { + const originalIndex = originalFunctions.indexOf(fn); + return Buffer.from(deflate(JSON.stringify(debug.debug_symbols[originalIndex]))).toString('base64'); + }), + fileMap: debug.file_map, + }; + } + + return { + name: contract.name, + functions: sortedFunctions.map(generateFunctionArtifact), + events: contract.events, + debug: parsedDebug, + aztecNrVersion, + }; +} diff --git a/compiler/wasm/src/noir/contract-interface-gen/contractTypescript.ts b/compiler/wasm/src/noir/contract-interface-gen/contractTypescript.ts new file mode 100644 index 00000000000..dc601140781 --- /dev/null +++ b/compiler/wasm/src/noir/contract-interface-gen/contractTypescript.ts @@ -0,0 +1,210 @@ +import compact from 'lodash.compact'; +import { ABIParameter, ContractArtifact, FunctionArtifact } from '../../types/abi'; +import { isAztecAddressStruct, isEthereumAddressStruct } from './abi'; + +/** + * Returns the corresponding typescript type for a given Noir type. + * @param type - The input Noir type. + * @returns An equivalent typescript type. + */ +function abiTypeToTypescript(type: ABIParameter['type']): string { + switch (type.kind) { + case 'field': + return 'FieldLike'; + case 'boolean': + return 'boolean'; + case 'integer': + return '(bigint | number)'; + case 'string': + return 'string'; + case 'array': + return `${abiTypeToTypescript(type.type)}[]`; + case 'struct': + if (isEthereumAddressStruct(type)) { + return 'EthAddressLike'; + } + if (isAztecAddressStruct(type)) { + return 'AztecAddressLike'; + } + return `{ ${type.fields.map((f) => `${f.name}: ${abiTypeToTypescript(f.type)}`).join(', ')} }`; + default: + throw new Error(`Unknown type ${type}`); + } +} + +/** + * Generates the typescript code to represent a Noir parameter. + * @param param - A Noir parameter with name and type. + * @returns The corresponding ts code. + */ +function generateParameter(param: ABIParameter) { + return `${param.name}: ${abiTypeToTypescript(param.type)}`; +} + +/** + * Generates the typescript code to represent a Noir function as a type. + * @param param - A Noir function. + * @returns The corresponding ts code. + */ +function generateMethod(entry: FunctionArtifact) { + const args = entry.parameters.map(generateParameter).join(', '); + return ` + /** ${entry.name}(${entry.parameters.map((p) => `${p.name}: ${p.type.kind}`).join(', ')}) */ + ${entry.name}: ((${args}) => ContractFunctionInteraction) & Pick;`; +} + +/** + * Generates a deploy method for this contract. + * @param input - Build artifact of the contract. + * @returns A type-safe deploy method in ts. + */ +function generateDeploy(input: ContractArtifact) { + const ctor = input.functions.find((f) => f.name === 'constructor'); + const args = (ctor?.parameters ?? []).map(generateParameter).join(', '); + const artifactName = `${input.name}ContractArtifact`; + + return ` + /** + * Creates a tx to deploy a new instance of this contract. + */ + public static deploy(wallet: Wallet, ${args}) { + return new DeployMethod<${input.name}Contract>(Point.ZERO, wallet, ${artifactName}, Array.from(arguments).slice(1)); + } + + /** + * Creates a tx to deploy a new instance of this contract using the specified public key to derive the address. + */ + public static deployWithPublicKey(publicKey: PublicKey, wallet: Wallet, ${args}) { + return new DeployMethod<${input.name}Contract>(publicKey, wallet, ${artifactName}, Array.from(arguments).slice(2)); + } + `; +} + +/** + * Generates the constructor by supplying the ABI to the parent class so the user doesn't have to. + * @param name - Name of the contract to derive the ABI name from. + * @returns A constructor method. + * @remarks The constructor is private because we want to force the user to use the create method. + */ +function generateConstructor(name: string) { + return ` + private constructor( + completeAddress: CompleteAddress, + wallet: Wallet, + portalContract = EthAddress.ZERO + ) { + super(completeAddress, ${name}ContractArtifact, wallet, portalContract); + } + `; +} + +/** + * Generates the at method for this contract. + * @param name - Name of the contract to derive the ABI name from. + * @returns An at method. + * @remarks We don't use constructor directly because of the async `wallet.getContractData` call. + */ +function generateAt(name: string) { + return ` + /** + * Creates a contract instance. + * @param address - The deployed contract's address. + * @param wallet - The wallet to use when interacting with the contract. + * @returns A promise that resolves to a new Contract instance. + */ + public static async at( + address: AztecAddress, + wallet: Wallet, + ) { + return Contract.at(address, ${name}Contract.artifact, wallet) as Promise<${name}Contract>; + }`; +} + +/** + * Generates a static getter for the contract's artifact. + * @param name - Name of the contract used to derive name of the artifact import. + */ +function generateArtifactGetter(name: string) { + const artifactName = `${name}ContractArtifact`; + return ` + /** + * Returns this contract's artifact. + */ + public static get artifact(): ContractArtifact { + return ${artifactName}; + } + `; +} + +/** + * Generates statements for importing the artifact from json and re-exporting it. + * @param name - Name of the contract. + * @param artifactImportPath - Path to load the ABI from. + * @returns Code. + */ +function generateAbiStatement(name: string, artifactImportPath: string) { + const stmts = [ + `import ${name}ContractArtifactJson from '${artifactImportPath}' assert { type: 'json' };`, + `export const ${name}ContractArtifact = ${name}ContractArtifactJson as ContractArtifact;`, + ]; + return stmts.join('\n'); +} + +/** + * Generates the typescript code to represent a contract. + * @param input - The compiled Noir artifact. + * @param artifactImportPath - Optional path to import the artifact (if not set, will be required in the constructor). + * @returns The corresponding ts code. + */ +export function generateTypescriptContractInterface(input: ContractArtifact, artifactImportPath?: string) { + // `compact` removes all falsey values from an array + const methods = compact(input.functions.filter((f) => f.name !== 'constructor').map(generateMethod)); + const deploy = artifactImportPath && generateDeploy(input); + const ctor = artifactImportPath && generateConstructor(input.name); + const at = artifactImportPath && generateAt(input.name); + const artifactStatement = artifactImportPath && generateAbiStatement(input.name, artifactImportPath); + const artifactGetter = artifactImportPath && generateArtifactGetter(input.name); + + return ` +/* Autogenerated file, do not edit! */ + +/* eslint-disable */ +import { + AztecAddress, + AztecAddressLike, + CompleteAddress, + Contract, + ContractArtifact, + ContractBase, + ContractFunctionInteraction, + ContractMethod, + DeployMethod, + EthAddress, + EthAddressLike, + FieldLike, + Fr, + Point, + PublicKey, + Wallet, +} from '@aztec/aztec.js'; +${artifactStatement} + +/** + * Type-safe interface for contract ${input.name}; + */ +export class ${input.name}Contract extends ContractBase { + ${ctor} + + ${at} + + ${deploy} + + ${artifactGetter} + + /** Type-safe wrappers for the public methods exposed by the contract. */ + public methods!: { + ${methods.join('\n')} + }; +} +`; +} diff --git a/compiler/wasm/src/noir/contract-interface-gen/programTypescript.ts b/compiler/wasm/src/noir/contract-interface-gen/programTypescript.ts new file mode 100644 index 00000000000..267a8fd36c2 --- /dev/null +++ b/compiler/wasm/src/noir/contract-interface-gen/programTypescript.ts @@ -0,0 +1,189 @@ +import { ABIType } from '../../types/abi'; +import { NoirFunctionAbi } from '../noir_artifact'; + +/** + * Keep track off all of the Noir primitive types that were used. + * Most of these will not have a 1-1 definition in TypeScript, + * so we will need to generate type aliases for them. + * + * We want to generate type aliases + * for specific types that are used in the ABI. + * + * For example: + * - If `Field` is used we want to alias that + * with `number`. + * - If `u32` is used we want to alias that with `number` too. + */ +type PrimitiveTypesUsed = { + /** + * The name of the type alias that we will generate. + */ + aliasName: string; + /** + * The TypeScript type that we will alias to. + */ + tsType: string; +}; + +const noirPrimitiveTypesToTsTypes = new Map(); + +/** + * Typescript does not allow us to check for equality of non-primitive types + * easily, so we create a addIfUnique function that will only add an item + * to the map if it is not already there by using JSON.stringify. + * @param item - The item to add to the map. + */ +function addIfUnique(item: PrimitiveTypesUsed) { + const key = JSON.stringify(item); + if (!noirPrimitiveTypesToTsTypes.has(key)) { + noirPrimitiveTypesToTsTypes.set(key, item); + } +} + +/** + * Converts an ABI type to a TypeScript type. + * @param type - The ABI type to convert. + * @returns The typescript code to define the type. + */ +function abiTypeToTs(type: ABIType): string { + switch (type.kind) { + case 'integer': { + let tsIntType = ''; + if (type.sign === 'signed') { + tsIntType = `i${type.width}`; + } else { + tsIntType = `u${type.width}`; + } + addIfUnique({ aliasName: tsIntType, tsType: 'string' }); + return tsIntType; + } + case 'boolean': + return `boolean`; + case 'array': + return `FixedLengthArray<${abiTypeToTs(type.type)}, ${type.length}>`; + case 'struct': + return getLastComponentOfPath(type.path); + case 'field': + addIfUnique({ aliasName: 'Field', tsType: 'string' }); + return 'Field'; + default: + throw new Error(`Unknown ABI type ${type}`); + } +} + +/** + * Returns the last component of a path, e.g. "foo::bar::baz" -\> "baz" + * Note: that if we have a path such as "Baz", we will return "Baz". + * + * Since these paths corresponds to structs, we can assume that we + * cannot have "foo::bar::". + * + * We also make the assumption that since these paths are coming from + * Noir, then we will not have two paths that look like this: + * - foo::bar::Baz + * - cat::dog::Baz + * ie the last component of the path (struct name) is enough to uniquely identify + * the whole path. + * + * TODO: We should double check this assumption when we use type aliases, + * I expect that `foo::bar::Baz as Dog` would effectively give `foo::bar::Dog` + * @param str - The path to get the last component of. + * @returns The last component of the path. + */ +function getLastComponentOfPath(str: string): string { + const parts = str.split('::'); + const lastPart = parts[parts.length - 1]; + return lastPart; +} + +/** + * Generates TypeScript interfaces for the structs used in the ABI. + * @param type - The ABI type to generate the interface for. + * @param output - The set of structs that we have already generated bindings for. + * @returns The TypeScript code to define the struct. + */ +function generateStructInterfaces(type: ABIType, output: Set): string { + let result = ''; + + // Edge case to handle the array of structs case. + if (type.kind === 'array' && type.type.kind === 'struct' && !output.has(getLastComponentOfPath(type.type.path))) { + result += generateStructInterfaces(type.type, output); + } + if (type.kind !== 'struct') { + return result; + } + + // List of structs encountered while viewing this type that we need to generate + // bindings for. + const typesEncountered = new Set(); + + // Codegen the struct and then its fields, so that the structs fields + // are defined before the struct itself. + let codeGeneratedStruct = ''; + let codeGeneratedStructFields = ''; + + const structName = getLastComponentOfPath(type.path); + if (!output.has(structName)) { + codeGeneratedStruct += `export interface ${structName} {\n`; + for (const field of type.fields) { + codeGeneratedStruct += ` ${field.name}: ${abiTypeToTs(field.type)};\n`; + typesEncountered.add(field.type); + } + codeGeneratedStruct += `}\n\n`; + output.add(structName); + + // Generate code for the encountered structs in the field above + for (const type of typesEncountered) { + codeGeneratedStructFields += generateStructInterfaces(type, output); + } + } + + return codeGeneratedStructFields + '\n' + codeGeneratedStruct; +} + +/** + * Generates a TypeScript interface for the ABI. + * @param abiObj - The ABI to generate the interface for. + * @returns The TypeScript code to define the interface. + */ +export function generateTypescriptProgramInterface(abiObj: NoirFunctionAbi): string { + let result = ``; + const outputStructs = new Set(); + + // Define structs for composite types + for (const param of abiObj.parameters) { + result += generateStructInterfaces(param.type, outputStructs); + } + + // Generating Return type, if it exists + // + if (abiObj.return_type != null) { + result += generateStructInterfaces(abiObj.return_type, outputStructs); + result += `export type ReturnType = ${abiTypeToTs(abiObj.return_type)};\n`; + } + + // Generating Input type + result += '\nexport interface InputType {\n'; + for (const param of abiObj.parameters) { + result += ` ${param.name}: ${abiTypeToTs(param.type)};\n`; + } + result += '}'; + + // Add the primitive Noir types that do not have a 1-1 mapping to TypeScript. + let primitiveTypeAliases = ''; + for (const [, value] of noirPrimitiveTypesToTsTypes) { + primitiveTypeAliases += `\nexport type ${value.aliasName} = ${value.tsType};`; + } + + const fixedLengthArray = + '\nexport type FixedLengthArray = L extends 0 ? never[]: T[] & { length: L }'; + + return ( + `/* Autogenerated file, do not edit! */\n\n/* eslint-disable */\n` + + fixedLengthArray + + '\n' + + primitiveTypeAliases + + '\n' + + result + ); +} diff --git a/compiler/wasm/src/noir/dependencies/dependency-manager.test.ts b/compiler/wasm/src/noir/dependencies/dependency-manager.test.ts new file mode 100644 index 00000000000..5f9ba570d4d --- /dev/null +++ b/compiler/wasm/src/noir/dependencies/dependency-manager.test.ts @@ -0,0 +1,107 @@ +import { NoirDependencyConfig } from '@aztec/foundation/noir'; + +import { NoirPackage } from '../package.js'; +import { NoirDependencyManager } from './dependency-manager.js'; +import { NoirDependency, NoirDependencyResolver } from './dependency-resolver.js'; + +describe('DependencyManager', () => { + let manager: NoirDependencyManager; + + beforeEach(() => { + manager = new NoirDependencyManager( + [new TestDependencyResolver()], + new NoirPackage('/test_contract', '/test_contract/src', { + dependencies: { + lib1: { + path: '/lib1', + }, + lib2: { + path: '/lib2', + }, + lib3: { + path: '/lib3', + }, + }, + package: { + name: 'test_contract', + type: 'contract', + }, + }), + ); + }); + + it('successfully resolves dependencies', async () => { + await expect(manager.resolveDependencies()).resolves.toBeUndefined(); + }); + + it('resolves all libraries', async () => { + await manager.resolveDependencies(); + expect(manager.getPackageNames()).toEqual(['lib1', 'lib2', 'lib3']); + }); + + it('resolves root dependencies', async () => { + await manager.resolveDependencies(); + expect(manager.getEntrypointDependencies()).toEqual(['lib1', 'lib2', 'lib3']); + }); + + it('resolves library dependencies', async () => { + await manager.resolveDependencies(); + expect(manager.getLibraryDependencies()).toEqual({ + lib2: ['lib3'], + }); + }); +}); + +class TestDependencyResolver implements NoirDependencyResolver { + // eslint-disable-next-line require-await + public async resolveDependency(pkg: NoirPackage, dep: NoirDependencyConfig): Promise { + if (!('path' in dep)) { + return null; + } + + switch (dep.path) { + case '/lib1': + return { + version: '', + package: new NoirPackage('/lib1', '/lib1/src', { + dependencies: {}, + package: { + name: 'lib1', + type: 'lib', + }, + }), + }; + + case '/lib2': + return { + version: '', + package: new NoirPackage('/lib2', '/lib2/src', { + dependencies: { + lib3: { + path: '../lib3', + }, + }, + package: { + name: 'lib2', + type: 'lib', + }, + }), + }; + + case '/lib3': + return { + version: '', + package: new NoirPackage('/lib3', '/lib3/src', { + dependencies: {}, + package: { + name: 'lib3', + type: 'lib', + }, + }), + }; + + default: + throw new Error(); + } + } +} diff --git a/compiler/wasm/src/noir/dependencies/dependency-manager.ts b/compiler/wasm/src/noir/dependencies/dependency-manager.ts new file mode 100644 index 00000000000..78b20eb99e7 --- /dev/null +++ b/compiler/wasm/src/noir/dependencies/dependency-manager.ts @@ -0,0 +1,150 @@ +import { join } from 'path'; + +import { NoirPackage } from '../package'; +import { NoirDependency, NoirDependencyResolver } from './dependency-resolver'; +import { NoirDependencyConfig } from '../../types/noir_package_config'; +import { LogData, LogFn } from '../../types/utils'; + +/** + * Noir Dependency Resolver + */ +export class NoirDependencyManager { + #entryPoint: NoirPackage; + #libraries = new Map(); + #dependencies = new Map(); + #log: LogFn; + #resolvers: readonly NoirDependencyResolver[]; + + /** + * Creates a new dependency resolver + * @param resolvers - A list of dependency resolvers to use + * @param entryPoint - The entry point of the project + */ + constructor(resolvers: readonly NoirDependencyResolver[] = [], entryPoint: NoirPackage) { + this.#resolvers = resolvers; + this.#entryPoint = entryPoint; + this.#log = (msg: string, _data?: LogData) => { + console.log(msg); + }; + } + + /** + * Gets dependencies for the entry point + */ + public getEntrypointDependencies() { + return this.#dependencies.get('') ?? []; + } + + /** + * Get transitive libraries used by the package + */ + public getLibraries() { + return Array.from(this.#libraries.entries()); + } + + /** + * A map of library dependencies + */ + public getLibraryDependencies() { + const entries = Array.from(this.#dependencies.entries()); + return Object.fromEntries(entries.filter(([name]) => name !== '')); + } + + /** + * Resolves dependencies for a package. + */ + public async resolveDependencies(): Promise { + await this.#breadthFirstResolveDependencies(); + } + + /** + * Gets the version of a dependency in the dependency tree + * @param name - Dependency name + * @returns The dependency's version + */ + public getVersionOf(name: string): string | undefined { + const dep = this.#libraries.get(name); + return dep?.version; + } + + async #breadthFirstResolveDependencies(): Promise { + /** Represents a package to resolve dependencies for */ + type Job = { + /** Package name */ + packageName: string; + /** The package location */ + noirPackage: NoirPackage; + }; + + const queue: Job[] = [ + { + packageName: '', + noirPackage: this.#entryPoint, + }, + ]; + + while (queue.length > 0) { + const { packageName, noirPackage } = queue.shift()!; + for (const [name, config] of Object.entries(noirPackage.getDependencies())) { + // TODO what happens if more than one package has the same name but different versions? + if (this.#libraries.has(name)) { + this.#log(`skipping already resolved dependency ${name}`); + this.#dependencies.set(packageName, [...(this.#dependencies.get(packageName) ?? []), name]); + + continue; + } + const dependency = await this.#resolveDependency(noirPackage, config); + if (dependency.package.getType() !== 'lib') { + this.#log(`Non-library package ${name}`, config); + throw new Error(`Dependency ${name} is not a library`); + } + + this.#libraries.set(name, dependency); + this.#dependencies.set(packageName, [...(this.#dependencies.get(packageName) ?? []), name]); + + queue.push({ + noirPackage: dependency.package, + packageName: name, + }); + } + } + } + + async #resolveDependency(pkg: NoirPackage, config: NoirDependencyConfig): Promise { + let dependency: NoirDependency | null = null; + for (const resolver of this.#resolvers) { + dependency = await resolver.resolveDependency(pkg, config); + if (dependency) { + break; + } + } + + if (!dependency) { + throw new Error('Dependency not resolved'); + } + + return dependency; + } + + /** + * Gets the names of the crates in this dependency list + */ + public getPackageNames() { + return [...this.#libraries.keys()]; + } + + /** + * Looks up a dependency + * @param sourceId - The source being resolved + * @returns The path to the resolved file + */ + public findFile(sourceId: string): string | null { + const [lib, ...path] = sourceId.split('/').filter((x) => x); + const dep = this.#libraries.get(lib); + if (dep) { + return join(dep.package.getSrcPath(), ...path); + } else { + return null; + } + } +} diff --git a/compiler/wasm/src/noir/dependencies/dependency-resolver.ts b/compiler/wasm/src/noir/dependencies/dependency-resolver.ts new file mode 100644 index 00000000000..8d2c3eb6b8d --- /dev/null +++ b/compiler/wasm/src/noir/dependencies/dependency-resolver.ts @@ -0,0 +1,24 @@ +import { NoirDependencyConfig } from '../../types/noir_package_config'; +import { NoirPackage } from '../package'; + +/** + * A Noir dependency + */ +export type NoirDependency = { + /** version string as determined by the resolver */ + version?: string; + /** the actual package source code */ + package: NoirPackage; +}; + +/** + * Resolves a dependency for a package. + */ +export interface NoirDependencyResolver { + /** + * Resolve a dependency for a package. + * @param pkg - The package to resolve dependencies for + * @param dep - The dependency config to resolve + */ + resolveDependency(pkg: NoirPackage, dep: NoirDependencyConfig): Promise; +} diff --git a/compiler/wasm/src/noir/dependencies/github-dependency-resolver.test.ts b/compiler/wasm/src/noir/dependencies/github-dependency-resolver.test.ts new file mode 100644 index 00000000000..a4d4b603d37 --- /dev/null +++ b/compiler/wasm/src/noir/dependencies/github-dependency-resolver.test.ts @@ -0,0 +1,131 @@ +import { NoirGitDependencyConfig } from '@aztec/foundation/noir'; +import { fileURLToPath } from '@aztec/foundation/url'; + +import { jest } from '@jest/globals'; +import { Volume, createFsFromVolume } from 'memfs'; +import { readFile } from 'node:fs/promises'; +import { dirname, join } from 'path'; + +import { FileManager } from '../file-manager/file-manager.js'; +import { createMemFSFileManager } from '../file-manager/memfs-file-manager.js'; +import { NoirPackage } from '../package.js'; +import { NoirDependencyResolver } from './dependency-resolver.js'; +import { GithubDependencyResolver, resolveGithubCodeArchive, safeFilename } from './github-dependency-resolver.js'; + +const fixtures = join(dirname(fileURLToPath(import.meta.url)), '../../../fixtures'); + +describe('GithubDependencyResolver', () => { + let resolver: NoirDependencyResolver; + let fm: FileManager; + let pkg: NoirPackage; + let libDependency: NoirGitDependencyConfig; + let fetchMock: jest.SpiedFunction; + + beforeEach(() => { + fm = createMemFSFileManager(createFsFromVolume(new Volume()), '/'); + + libDependency = { + git: 'https://github.com/example/repo', + tag: 'v1.0.0', + }; + + pkg = new NoirPackage('/test_contract', '/test_contract/src', { + dependencies: { + // eslint-disable-next-line camelcase + test_lib: libDependency, + }, + package: { + name: 'test_contract', + type: 'contract', + }, + }); + + resolver = new GithubDependencyResolver(fm); + + // cut off outside access + fetchMock = jest.spyOn(globalThis, 'fetch').mockImplementation(() => { + throw new Error(); + }); + }); + + afterEach(() => { + fetchMock.mockRestore(); + }); + + it("returns null if it can't resolve a dependency", async () => { + const dep = await resolver.resolveDependency(pkg, { + path: '/test_lib', + }); + + expect(dep).toBeNull(); + }); + + it('resolves Github dependency', async () => { + fetchMock.mockResolvedValueOnce(new Response(await readFile(join(fixtures, 'test_lib.zip')), { status: 200 })); + const lib = await resolver.resolveDependency(pkg, libDependency); + expect(lib).toBeDefined(); + expect(lib!.version).toEqual(libDependency.tag); + expect(fm.hasFileSync(lib!.package.getEntryPointPath())).toBe(true); + }); + + it.each<[NoirGitDependencyConfig, 'zip' | 'tar', string]>([ + [ + { + git: 'https://github.com/example/lib.nr', + tag: 'v1.0.0', + }, + 'zip', + 'https://github.com/example/lib.nr/archive/v1.0.0.zip', + ], + [ + { + git: 'https://github.com/example/lib.nr', + tag: 'v1.0.0', + }, + 'tar', + 'https://github.com/example/lib.nr/archive/v1.0.0.tar.gz', + ], + [ + { + git: 'https://github.com/example/lib.nr', + tag: 'HEAD', + }, + 'zip', + 'https://github.com/example/lib.nr/archive/HEAD.zip', + ], + [ + { + git: 'https://github.com/example/lib.nr', + tag: 'HEAD', + }, + 'tar', + 'https://github.com/example/lib.nr/archive/HEAD.tar.gz', + ], + ])('resolves to the correct code archive URL', (dep, format, href) => { + const archiveUrl = resolveGithubCodeArchive(dep, format); + expect(archiveUrl.href).toEqual(href); + }); + + it.each([ + { git: 'https://github.com/', tag: 'v1' }, + { git: 'https://github.com/foo', tag: 'v1' }, + { git: 'https://example.com', tag: 'v1' }, + ])('throws if the Github URL is invalid', (dep) => { + expect(() => resolveGithubCodeArchive(dep, 'zip')).toThrow(); + }); + + it.each([ + ['main', 'main'], + ['v1.0.0', 'v1.0.0'], + ['../../../etc/passwd', '.._.._.._etc_passwd'], + ['/etc/passwd', 'etc_passwd'], + ['/SomeOrg/some-repo@v1.0.0', 'SomeOrg_some-repo@v1.0.0'], + ['SomeOrg/some-repo@v1.0.0', 'SomeOrg_some-repo@v1.0.0'], + ])('generates safe file names', (value, expected) => { + expect(safeFilename(value)).toEqual(expected); + }); + + it.each([''])('rejects invalid values', (value) => { + expect(() => safeFilename(value)).toThrow(); + }); +}); diff --git a/compiler/wasm/src/noir/dependencies/github-dependency-resolver.ts b/compiler/wasm/src/noir/dependencies/github-dependency-resolver.ts new file mode 100644 index 00000000000..55f119fdbf3 --- /dev/null +++ b/compiler/wasm/src/noir/dependencies/github-dependency-resolver.ts @@ -0,0 +1,145 @@ +import { delimiter, join, sep } from 'path'; +import { unzip } from 'unzipit'; + +import { FileManager } from '../file-manager/file-manager'; +import { NoirPackage } from '../package'; +import { NoirDependency, NoirDependencyResolver } from './dependency-resolver'; +import { NoirDependencyConfig, NoirGitDependencyConfig } from '../../types/noir_package_config'; +import { LogData } from '../../types/utils'; + +/** + * Downloads dependencies from github + */ +export class GithubDependencyResolver implements NoirDependencyResolver { + #fm: FileManager; + #log; + + constructor(fm: FileManager) { + this.#fm = fm; + this.#log = (msg: string, _data?: LogData) => { + console.log(msg); + }; + } + + /** + * Resolves a dependency from github. Returns null if URL is for a different website. + * @param _pkg - The package to resolve the dependency for + * @param dependency - The dependency configuration + * @returns asd + */ + async resolveDependency(_pkg: NoirPackage, dependency: NoirDependencyConfig): Promise { + // TODO accept ssh urls? + // TODO github authentication? + if (!('git' in dependency) || !dependency.git.startsWith('https://github.com')) { + return null; + } + + const archivePath = await this.#fetchZipFromGithub(dependency); + const libPath = await this.#extractZip(dependency, archivePath); + return { + version: dependency.tag, + package: await NoirPackage.open(libPath, this.#fm), + }; + } + + async #fetchZipFromGithub(dependency: Pick): Promise { + if (!dependency.git.startsWith('https://github.com')) { + throw new Error('Only github dependencies are supported'); + } + + const url = resolveGithubCodeArchive(dependency, 'zip'); + const localArchivePath = join('archives', safeFilename(url.pathname)); + + // TODO should check signature before accepting any file + if (this.#fm.hasFileSync(localArchivePath)) { + this.#log('using cached archive', { url: url.href, path: localArchivePath }); + return localArchivePath; + } + + const response = await fetch(url, { + method: 'GET', + }); + + if (!response.ok || !response.body) { + throw new Error(`Failed to fetch ${url}: ${response.statusText}`); + } + + const tmpFile = localArchivePath + '.tmp'; + await this.#fm.writeFile(tmpFile, response.body); + await this.#fm.moveFile(tmpFile, localArchivePath); + + return localArchivePath; + } + + async #extractZip(dependency: NoirGitDependencyConfig, archivePath: string): Promise { + const gitUrl = new URL(dependency.git); + // extract the archive to this location + const extractLocation = join('libs', safeFilename(gitUrl.pathname + '@' + (dependency.tag ?? 'HEAD'))); + + // where we expect to find this package after extraction + // it might already exist if the archive got unzipped previously + const packagePath = join(extractLocation, dependency.directory ?? ''); + + if (this.#fm.hasFileSync(packagePath)) { + return packagePath; + } + + const { entries } = await unzip(await this.#fm.readFile(archivePath)); + + // extract to a temporary directory, then move it to the final location + // TODO empty the temp directory first + const tmpExtractLocation = extractLocation + '.tmp'; + for (const entry of Object.values(entries)) { + if (entry.isDirectory) { + continue; + } + + // remove the first path segment, because it'll be the archive name + const name = stripSegments(entry.name, 1); + const path = join(tmpExtractLocation, name); + await this.#fm.writeFile(path, (await entry.blob()).stream()); + } + + await this.#fm.moveFile(tmpExtractLocation, extractLocation); + + return packagePath; + } +} + +/** + * Strips the first n segments from a path + */ +function stripSegments(path: string, count: number): string { + const segments = path.split(sep).filter(Boolean); + return segments.slice(count).join(sep); +} + +/** + * Returns a safe filename for a value + * @param val - The value to convert + */ +export function safeFilename(val: string): string { + if (!val) { + throw new Error('invalid value'); + } + + return val.replaceAll(sep, '_').replaceAll(delimiter, '_').replace(/^_+/, ''); +} + +/** + * Resolves a dependency's archive URL. + * @param dependency - The dependency configuration + * @returns The URL to the library archive + */ +export function resolveGithubCodeArchive(dependency: NoirGitDependencyConfig, format: 'zip' | 'tar'): URL { + const gitUrl = new URL(dependency.git); + const [owner, repo] = gitUrl.pathname.slice(1).split('/'); + const ref = dependency.tag ?? 'HEAD'; + const extension = format === 'zip' ? 'zip' : 'tar.gz'; + + if (!owner || !repo || gitUrl.hostname !== 'github.com') { + throw new Error('Invalid Github repository URL'); + } + + return new URL(`https://github.com/${owner}/${repo}/archive/${ref}.${extension}`); +} diff --git a/compiler/wasm/src/noir/dependencies/local-dependency-resolver.test.ts b/compiler/wasm/src/noir/dependencies/local-dependency-resolver.test.ts new file mode 100644 index 00000000000..8cadfeeff92 --- /dev/null +++ b/compiler/wasm/src/noir/dependencies/local-dependency-resolver.test.ts @@ -0,0 +1,52 @@ +import { createFsFromVolume } from 'memfs'; +import { Volume } from 'memfs/lib/volume.js'; +import { readFile } from 'node:fs/promises'; +import { dirname, join } from 'path'; + +import { FileManager } from '../file-manager/file-manager.js'; +import { createMemFSFileManager } from '../file-manager/memfs-file-manager.js'; +import { NoirPackage } from '../package.js'; +import { NoirDependencyResolver } from './dependency-resolver.js'; +import { LocalDependencyResolver } from './local-dependency-resolver.js'; +import { fileURLToPath } from '../../types/utils.js'; + +describe('DependencyResolver', () => { + let resolver: NoirDependencyResolver; + let fm: FileManager; + let pkg: NoirPackage; + + beforeEach(async () => { + const fixtures = join(dirname(fileURLToPath(import.meta.url)), '../../../fixtures'); + const memFS = createFsFromVolume(new Volume()); + memFS.mkdirSync('/test_contract/src', { recursive: true }); + memFS.mkdirSync('/test_lib/src', { recursive: true }); + memFS.writeFileSync('/test_contract/Nargo.toml', await readFile(join(fixtures, 'test_contract/Nargo.toml'))); + memFS.writeFileSync('/test_contract/src/main.nr', await readFile(join(fixtures, 'test_contract/src/main.nr'))); + memFS.writeFileSync('/test_lib/Nargo.toml', await readFile(join(fixtures, 'test_lib/Nargo.toml'))); + memFS.writeFileSync('/test_lib/src/lib.nr', await readFile(join(fixtures, 'test_lib/src/lib.nr'))); + + fm = createMemFSFileManager(memFS, '/'); + + pkg = await NoirPackage.open('/test_contract', fm); + resolver = new LocalDependencyResolver(fm); + }); + + it("returns null if it can't resolve a dependency", async () => { + const dep = await resolver.resolveDependency(pkg, { + git: 'git@some-git-host', + directory: '/', + tag: 'v1.0.0', + }); + + expect(dep).toBeNull(); + }); + + it.each(['../test_contract', '/test_contract'])('resolves a known dependency', async (path) => { + const lib = await resolver.resolveDependency(pkg, { + path, + }); + expect(lib).toBeDefined(); + expect(lib!.version).toBeUndefined(); + expect(fm.hasFileSync(lib!.package.getEntryPointPath())).toBe(true); + }); +}); diff --git a/compiler/wasm/src/noir/dependencies/local-dependency-resolver.ts b/compiler/wasm/src/noir/dependencies/local-dependency-resolver.ts new file mode 100644 index 00000000000..52ed8633a27 --- /dev/null +++ b/compiler/wasm/src/noir/dependencies/local-dependency-resolver.ts @@ -0,0 +1,31 @@ +import { isAbsolute, join } from 'path'; + +import { FileManager } from '../file-manager/file-manager'; +import { NoirPackage } from '../package'; +import { NoirDependency, NoirDependencyResolver } from './dependency-resolver'; +import { NoirDependencyConfig } from '../../types/noir_package_config'; + +/** + * Resolves dependencies on-disk, relative to current package + */ +export class LocalDependencyResolver implements NoirDependencyResolver { + #fm: FileManager; + + constructor(fm: FileManager) { + this.#fm = fm; + } + + async resolveDependency(parent: NoirPackage, config: NoirDependencyConfig): Promise { + if ('path' in config) { + const parentPath = parent.getPackagePath(); + const dependencyPath = isAbsolute(config.path) ? config.path : join(parentPath, config.path); + return { + // unknown version, Nargo.toml doesn't have a version field + version: undefined, + package: await NoirPackage.open(dependencyPath, this.#fm), + }; + } else { + return null; + } + } +} diff --git a/compiler/wasm/src/noir/file-manager/file-manager.test.ts b/compiler/wasm/src/noir/file-manager/file-manager.test.ts new file mode 100644 index 00000000000..0e554526a07 --- /dev/null +++ b/compiler/wasm/src/noir/file-manager/file-manager.test.ts @@ -0,0 +1,90 @@ +import { Volume, createFsFromVolume } from 'memfs'; +import { existsSync, mkdtempSync, rmSync } from 'node:fs'; +import * as fs from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; + +import { FileManager, FileSystem } from './file-manager.js'; +import { createMemFSFileManager } from './memfs-file-manager.js'; + +const memFS = (): { fm: FileManager; teardown: () => void } => { + const fm = createMemFSFileManager(createFsFromVolume(new Volume()), '/'); + return { + fm, + // no-op, it's all in memory + teardown: () => {}, + }; +}; + +const nodeFM = (): { fm: FileManager; teardown: () => void } => { + const fileSystem: FileSystem = { + existsSync: existsSync, + mkdir: async (dir: string, opts?: { recursive: boolean }) => { + await fs.mkdir(dir, opts); + }, + writeFile: fs.writeFile, + readFile: fs.readFile, + rename: fs.rename, + readdir: fs.readdir, + }; + + const dir = mkdtempSync(join(tmpdir(), 'noir-compiler-test')); + const fm = new FileManager(fileSystem, dir); + + return { + fm, + teardown: () => { + rmSync(dir, { + recursive: true, + }); + }, + }; +}; + +/** + * Declare the default test suite for a file manager + * @param setup - Function to setup a file manager + * @param teardown - Optional function to call at the end of the test + */ +describe.each([memFS, nodeFM])('FileManager', (setup) => { + let fm: FileManager; + let testFileContent: string; + let testFileBytes: Uint8Array; + let teardown: () => void; + + beforeEach(() => { + ({ fm, teardown } = setup()); + testFileContent = 'foo'; + testFileBytes = new TextEncoder().encode(testFileContent); + }); + + afterEach(() => { + return teardown?.(); + }); + + it('saves files and correctly reads bytes back', async () => { + await fm.writeFile('test.txt', new Blob([testFileBytes]).stream()); + await expect(fm.readFile('test.txt')).resolves.toEqual(testFileBytes); + }); + + it('saves files and correctly reads UTF-8 string back', async () => { + await fm.writeFile('test.txt', new Blob([testFileBytes]).stream()); + await expect(fm.readFile('test.txt', 'utf-8')).resolves.toEqual(testFileContent); + }); + + it('correctly checks if file exists or not', async () => { + expect(fm.hasFileSync('test.txt')).toBe(false); + await fm.writeFile('test.txt', new Blob([testFileBytes]).stream()); + expect(fm.hasFileSync('test.txt')).toBe(true); + }); + + it('moves files', async () => { + await fm.writeFile('test.txt.tmp', new Blob([testFileBytes]).stream()); + expect(fm.hasFileSync('test.txt.tmp')).toBe(true); + + await fm.moveFile('test.txt.tmp', 'test.txt'); + + expect(fm.hasFileSync('test.txt.tmp')).toBe(false); + expect(fm.hasFileSync('test.txt')).toBe(true); + }); +}); diff --git a/compiler/wasm/src/noir/file-manager/file-manager.ts b/compiler/wasm/src/noir/file-manager/file-manager.ts new file mode 100644 index 00000000000..77dc78bade2 --- /dev/null +++ b/compiler/wasm/src/noir/file-manager/file-manager.ts @@ -0,0 +1,157 @@ +import path, { dirname, isAbsolute, join } from 'path'; + +/** + * A file system interface that matches the node fs module. + */ +export interface FileSystem { + /** Checks if the file exists */ + existsSync: (path: string) => boolean; + /** Creates a directory structure */ + mkdir: ( + dir: string, + opts?: { + /** Create parent directories as needed */ + recursive: boolean; + }, + ) => Promise; + /** Writes a file */ + writeFile: (path: string, data: Uint8Array) => Promise; + /** Reads a file */ + readFile: (path: string, encoding?: 'utf-8') => Promise; + /** Renames a file */ + rename: (oldPath: string, newPath: string) => Promise; + /** Reads a directory */ + readdir: ( + path: string, + options?: { + /** Traverse child directories recursively */ + recursive: boolean; + }, + ) => Promise; +} + +/** + * A file manager that writes file to a specific directory but reads globally. + */ +export class FileManager { + #fs: FileSystem; + #dataDir: string; + + constructor(fs: FileSystem, dataDir: string) { + this.#fs = fs; + this.#dataDir = dataDir; + } + + /** + * Saves a file to the data directory. + * @param name - File to save + * @param stream - File contents + */ + public async writeFile(name: string, stream: ReadableStream): Promise { + if (isAbsolute(name)) { + throw new Error("can't write absolute path"); + } + + const path = this.#getPath(name); + const chunks: Uint8Array[] = []; + const reader = stream.getReader(); + + // eslint-disable-next-line no-constant-condition + while (true) { + const { done, value } = await reader.read(); + if (done) { + break; + } + + chunks.push(value); + } + + const file = new Uint8Array(chunks.reduce((acc, chunk) => acc + chunk.length, 0)); + let offset = 0; + for (const chunk of chunks) { + file.set(chunk, offset); + offset += chunk.length; + } + + await this.#fs.mkdir(dirname(path), { recursive: true }); + await this.#fs.writeFile(this.#getPath(path), file); + } + + /** + * Reads a file from the filesystem and returns a buffer + * Saves a file to the data directory. + * @param oldName - File to save + * @param newName - File contents + */ + async moveFile(oldName: string, newName: string) { + if (isAbsolute(oldName) || isAbsolute(newName)) { + throw new Error("can't move absolute path"); + } + + const oldPath = this.#getPath(oldName); + const newPath = this.#getPath(newName); + + await this.#fs.mkdir(dirname(newPath), { recursive: true }); + await this.#fs.rename(oldPath, newPath); + } + + /** + * Reads a file from the disk and returns a buffer + * @param name - File to read + */ + public async readFile(name: string): Promise; + /** + * Reads a file from the filesystem as a string + * @param name - File to read + * @param encoding - Encoding to use + */ + public async readFile(name: string, encoding: 'utf-8'): Promise; + /** + * Reads a file from the filesystem + * @param name - File to read + * @param encoding - Encoding to use + */ + public async readFile(name: string, encoding?: 'utf-8'): Promise { + const path = this.#getPath(name); + const data = await this.#fs.readFile(path, encoding); + + if (!encoding) { + return typeof data === 'string' + ? new TextEncoder().encode(data) // this branch shouldn't be hit, but just in case + : new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT); + } + + return data; + } + + /** + * Checks if a file exists and is accessible + * @param name - File to check + */ + public hasFileSync(name: string): boolean { + return this.#fs.existsSync(this.#getPath(name)); + } + + #getPath(name: string) { + return isAbsolute(name) ? name : join(this.#dataDir, name); + } + + /** + * Reads a file from the filesystem + * @param dir - File to read + * @param options - Readdir options + */ + public async readdir( + dir: string, + options?: { + /** + * Traverse child directories recursively + */ + recursive: boolean; + }, + ) { + const dirPath = this.#getPath(dir); + const files = await this.#fs.readdir(dirPath, options); + return files.map((file) => path.join(dirPath, file)); + } +} diff --git a/compiler/wasm/src/noir/file-manager/memfs-file-manager.ts b/compiler/wasm/src/noir/file-manager/memfs-file-manager.ts new file mode 100644 index 00000000000..b9ee3226be2 --- /dev/null +++ b/compiler/wasm/src/noir/file-manager/memfs-file-manager.ts @@ -0,0 +1,58 @@ +import { IFs, fs } from 'memfs'; +import { IDirent } from 'memfs/lib/node/types/misc'; + +import { FileManager } from './file-manager'; + +/** + * Creates a new FileManager instance based on a MemFS instance + * @param memFS - the memfs backing instance + * @param dataDir - where to store files + */ +export function createMemFSFileManager(memFS: IFs = fs, dataDir = '/'): FileManager { + const readdirRecursive = async (dir: string): Promise => { + const contents = await memFS.promises.readdir(dir); + let files: string[] = []; + for (const handle in contents) { + if ((handle as unknown as IDirent).isFile()) { + files.push(handle.toString()); + } else { + files = files.concat(await readdirRecursive(handle.toString())); + } + } + return files; + }; + return new FileManager( + { + existsSync: memFS.existsSync.bind(memFS), + mkdir: async ( + dir: string, + options?: { + /** + * Traverse child directories + */ + recursive: boolean; + }, + ) => { + await memFS.promises.mkdir(dir, options); + }, + writeFile: memFS.promises.writeFile.bind(memFS), + rename: memFS.promises.rename.bind(memFS), + readFile: memFS.promises.readFile.bind(memFS), + readdir: async ( + dir: string, + options?: { + /** + * Traverse child directories + */ + recursive: boolean; + }, + ) => { + if (options?.recursive) { + return readdirRecursive(dir); + } + return (await memFS.promises.readdir(dir)).map((handles) => handles.toString()); + }, + }, + dataDir, + ); +} diff --git a/compiler/wasm/src/noir/noir-wasm-compiler.ts b/compiler/wasm/src/noir/noir-wasm-compiler.ts new file mode 100644 index 00000000000..0261013468e --- /dev/null +++ b/compiler/wasm/src/noir/noir-wasm-compiler.ts @@ -0,0 +1,242 @@ +import { isAbsolute } from 'path'; + +import { NoirDependencyManager } from './dependencies/dependency-manager'; +import { GithubDependencyResolver as GithubCodeArchiveDependencyResolver } from './dependencies/github-dependency-resolver'; +import { LocalDependencyResolver } from './dependencies/local-dependency-resolver'; +import { FileManager } from './file-manager/file-manager'; +import { NoirPackage } from './package'; +import { LogData, LogFn } from '../types/utils'; +import { NoirCompilationResult, NoirProgramCompilationArtifacts } from './noir_artifact'; + +/** Compilation options */ +export type NoirWasmCompileOptions = { + /** Logging function */ + log: LogFn; + /** Log debugging information through this function */ + debugLog?: LogFn; +}; + +/** + * Noir Package Compiler + */ +export class NoirWasmContractCompiler { + #log: LogFn; + #debugLog: LogFn; + #package: NoirPackage; + /* eslint-disable @typescript-eslint/no-explicit-any */ + #wasmCompiler: any; + #sourceMap: any; + /* eslint-disable @typescript-eslint/no-explicit-any */ + #fm: FileManager; + #dependencyManager: NoirDependencyManager; + + private constructor( + entrypoint: NoirPackage, + dependencyManager: NoirDependencyManager, + fileManager: FileManager, + wasmCompiler: unknown, + sourceMap: unknown, + opts: NoirWasmCompileOptions, + ) { + this.#log = opts.log; + this.#debugLog = + opts.debugLog ?? + function (msg: string, _data?: LogData) { + console.log(msg); + }; + this.#package = entrypoint; + this.#fm = fileManager; + this.#wasmCompiler = wasmCompiler; + this.#sourceMap = sourceMap; + this.#dependencyManager = dependencyManager; + } + + /** + * Creates a new compiler instance. + * @param fileManager - The file manager to use + * @param projectPath - The path to the project + * @param opts - Compilation options + */ + public static async new( + fileManager: FileManager, + projectPath: string, + /* eslint-disable @typescript-eslint/no-explicit-any */ + wasmCompiler: any, + sourceMap: any, + /* eslint-enable @typescript-eslint/no-explicit-any */ + opts: NoirWasmCompileOptions, + ) { + if (!isAbsolute(projectPath)) { + throw new Error('projectPath must be an absolute path'); + } + + const noirPackage = await NoirPackage.open(projectPath, fileManager); + + const dependencyManager = new NoirDependencyManager( + [ + new LocalDependencyResolver(fileManager), + new GithubCodeArchiveDependencyResolver(fileManager), + // TODO support actual Git repositories + ], + noirPackage, + ); + + return new NoirWasmContractCompiler( + noirPackage, + dependencyManager, + fileManager, + wasmCompiler.compile, + sourceMap, + opts, + ); + } + + /** + * Gets the version of Aztec.nr that was used compiling this contract. + */ + public getResolvedAztecNrVersion() { + // TODO eliminate this hardcoded library name! + // see docs/docs/dev_docs/contracts/setup.md + return this.#dependencyManager.getVersionOf('aztec'); + } + + /** + * Compile EntryPoint + */ + /** + * Compile EntryPoint + */ + public async compile(): Promise { + console.log(`Compiling Program at ${this.#package.getEntryPointPath()}`); + return await this.compileProgram(); + } + + /** + * Compiles the Program. + */ + public async compileProgram(): Promise { + await this.#dependencyManager.resolveDependencies(); + this.#debugLog(`Dependencies: ${this.#dependencyManager.getPackageNames().join(', ')}`); + + try { + const isContract: boolean = false; + + const entrypoint = this.#package.getEntryPointPath(); + const deps = { + /* eslint-disable camelcase */ + root_dependencies: this.#dependencyManager.getEntrypointDependencies(), + library_dependencies: this.#dependencyManager.getLibraryDependencies(), + /* eslint-enable camelcase */ + }; + const packageSources = await this.#package.getSources(this.#fm); + const librarySources = ( + await Promise.all( + this.#dependencyManager + .getLibraries() + .map(async ([alias, library]) => await library.package.getSources(this.#fm, alias)), + ) + ).flat(); + this.#sourceMap.clean(); + [...packageSources, ...librarySources].forEach((sourceFile) => { + this.#sourceMap.add_source_code(sourceFile.path, sourceFile.source); + }); + const result = this.#wasmCompiler.compile(entrypoint, isContract, deps, this.#sourceMap); + + if (!('program' in result)) { + throw new Error('No program found in compilation result'); + } + + return [{ name: this.#package.getNoirPackageConfig().package.name, ...result }]; + } catch (err) { + if (err instanceof Error && err.name === 'CompileError') { + await this.#processCompileError(err); + } + + throw err; + } + } + + /** + * Compiles the Contract. + */ + public async compileContract(): Promise { + if (!(this.#package.getType() === 'contract' || this.#package.getType() === 'bin')) { + this.#log( + `Compile skipped - only supports compiling "contract" and "bin" package types (${this.#package.getType()})`, + ); + return []; + } + this.#debugLog(`Compiling contract at ${this.#package.getEntryPointPath()}`); + await this.#dependencyManager.resolveDependencies(); + this.#debugLog(`Dependencies: ${this.#dependencyManager.getPackageNames().join(', ')}`); + + try { + const isContract: boolean = true; + + const entrypoint = this.#package.getEntryPointPath(); + const deps = { + /* eslint-disable camelcase */ + root_dependencies: this.#dependencyManager.getEntrypointDependencies(), + library_dependencies: this.#dependencyManager.getLibraryDependencies(), + /* eslint-enable camelcase */ + }; + const packageSources = await this.#package.getSources(this.#fm); + const librarySources = ( + await Promise.all( + this.#dependencyManager + .getLibraries() + .map(async ([alias, library]) => await library.package.getSources(this.#fm, alias)), + ) + ).flat(); + this.#sourceMap.clean(); + [...packageSources, ...librarySources].forEach((sourceFile) => { + this.#sourceMap.add_source_code(sourceFile.path, sourceFile.source); + }); + const result = this.#wasmCompiler.compile(entrypoint, isContract, deps, this.#sourceMap); + + if (!('contract' in result)) { + throw new Error('No contract found in compilation result'); + } + + return [result]; + } catch (err) { + if (err instanceof Error && err.name === 'CompileError') { + await this.#processCompileError(err); + throw new Error('Compilation failed'); + } + + throw err; + } + } + + async #resolveFile(path: string) { + try { + const libFile = this.#dependencyManager.findFile(path); + return await this.#fm.readFile(libFile ?? path, 'utf-8'); + } catch (err) { + return ''; + } + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + async #processCompileError(err: any): Promise { + for (const diag of err.diagnostics) { + this.#log(` ${diag.message}`); + const contents = await this.#resolveFile(diag.file); + const lines = contents.split('\n'); + const lineOffsets = lines.reduce((accum, _, idx) => { + if (idx === 0) { + accum.push(0); + } else { + accum.push(accum[idx - 1] + lines[idx - 1].length + 1); + } + return accum; + }, []); + + for (const secondary of diag.secondaries) { + const errorLine = lineOffsets.findIndex((offset) => offset > secondary.start); + this.#log(` ${diag.file}:${errorLine}: ${contents.slice(secondary.start, secondary.end)}`); + } + } + } +} diff --git a/compiler/wasm/src/noir/noir_artifact.ts b/compiler/wasm/src/noir/noir_artifact.ts new file mode 100644 index 00000000000..3b79ecdb178 --- /dev/null +++ b/compiler/wasm/src/noir/noir_artifact.ts @@ -0,0 +1,180 @@ +import { ABIParameter, ABIType, DebugFileMap, DebugInfo, EventAbi } from '../types/abi'; + +/** The Aztec.nr function types. */ +type NoirFunctionType = 'Open' | 'Secret' | 'Unconstrained'; + +/** The ABI of an Aztec.nr function. */ +export interface NoirFunctionAbi { + /** The parameters of the function. */ + parameters: ABIParameter[]; + /** The witness indices of the parameters. Indexed by parameter name. */ + param_witnesses: { + /** input */ + input: { + /** start */ + start: number; + /** end */ + end: number; + }[]; + }; + /** The return type of the function. */ + return_type: ABIType; + /** The witness indices of the return type. */ + return_witnesses: number[]; +} + +/** + * The compilation result of an Aztec.nr function. + */ +export interface NoirFunctionEntry { + /** The name of the function. */ + name: string; + /** The type of the function. */ + function_type: NoirFunctionType; + /** Whether the function is internal. */ + is_internal: boolean; + /** The ABI of the function. */ + abi: NoirFunctionAbi; + /** The bytecode of the function in base64. */ + bytecode: string; + /** The proving key. */ + proving_key: string; + /** The verification key. */ + verification_key: string; +} + +/** + * The compilation result of an Aztec.nr contract. + */ +export interface NoirCompiledContract { + /** The name of the contract. */ + name: string; + /** Compilation backend. */ + backend: string; + /** The functions of the contract. */ + functions: NoirFunctionEntry[]; + /** The events of the contract */ + events: EventAbi[]; +} + +/** + * The compilation result of an Aztec.nr contract. + */ +export interface NoirCompiledCircuit { + /** The hash of the circuit. */ + hash?: number; + /** Compilation backend. */ + backend: string; + /** + * The ABI of the function. + */ + abi: NoirFunctionAbi; + /** The bytecode of the circuit in base64. */ + bytecode: string; +} + +/** + * Defines artifact of a contract. + */ +export interface ProgramArtifact { + /** + * version of noir used to compile + */ + noir_version?: string; + /** + * the name of the project, read from Nargo.toml + */ + name?: string; + /** + * The hash of the contract. + */ + hash?: number; + + /** + * The compilation backend of the artifact. + */ + backend: string; + + /** + * The abi of the program. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + abi: any; // TODO: type + + /** + * The debug metadata of the contract. + * It's used to include the relevant source code section when a constraint is not met during simulation. + */ + debug?: NoirDebugMetadata; +} + +/** + * The debug metadata of an Aztec.nr contract. + */ +export interface NoirDebugMetadata { + /** + * The debug information for each function. + */ + debug_symbols: DebugInfo[]; + /** + * The map of file ID to the source code and path of the file. + */ + file_map: DebugFileMap; +} + +/** + * The compilation artifacts of a given contract. + */ +export interface NoirContractCompilationArtifacts { + /** + * The compiled contract. + */ + contract: NoirCompiledContract; + + /** + * The artifact that contains the debug metadata about the contract. + */ + debug?: NoirDebugMetadata; +} + +/** + * The compilation artifacts of a given program. + */ +export interface NoirProgramCompilationArtifacts { + /** + * not part of the compilation output, injected later + */ + name: string; + /** + * The compiled contract. + */ + program: NoirCompiledCircuit; + + /** + * The artifact that contains the debug metadata about the contract. + */ + debug?: NoirDebugMetadata; +} + +/** + * output of Noir Wasm compilation, can be for a contract or lib/binary + */ +export type NoirCompilationResult = NoirContractCompilationArtifacts | NoirProgramCompilationArtifacts; + +/** + * Check if it has Contract unique property + */ +export function isNoirContractCompilationArtifacts( + artifact: NoirCompilationResult, +): artifact is NoirContractCompilationArtifacts { + return (artifact as NoirContractCompilationArtifacts).contract !== undefined; +} + +/** + * Check if it has Contract unique property + */ +export function isNoirProgramCompilationArtifacts( + artifact: NoirCompilationResult, +): artifact is NoirProgramCompilationArtifacts { + return (artifact as NoirProgramCompilationArtifacts).program !== undefined; +} diff --git a/compiler/wasm/src/noir/package.ts b/compiler/wasm/src/noir/package.ts new file mode 100644 index 00000000000..91b0db2e86a --- /dev/null +++ b/compiler/wasm/src/noir/package.ts @@ -0,0 +1,129 @@ +import { parse } from '@ltd/j-toml'; +import { join } from 'path'; + +import { FileManager } from './file-manager/file-manager'; +import { NoirDependencyConfig, NoirPackageConfig, parseNoirPackageConfig } from '../types/noir_package_config'; + +const CONFIG_FILE_NAME = 'Nargo.toml'; +const SOURCE_EXTENSIONS = ['.nr']; + +/** + * An array of sources for a package + */ +type SourceList = Array<{ + /** + * The source path, taking into account modules and aliases. Eg: mylib/mod/mysource.nr + */ + path: string; + /** + * Resolved source plaintext + */ + source: string; +}>; + +/** + * A Noir package. + */ +export class NoirPackage { + #packagePath: string; + #srcPath: string; + #config: NoirPackageConfig; + #version: string | null = null; + + public constructor(path: string, srcDir: string, config: NoirPackageConfig) { + this.#packagePath = path; + this.#srcPath = srcDir; + this.#config = config; + } + + /** + * Gets this package's path. + */ + public getPackagePath() { + return this.#packagePath; + } + + /** + * Gets this package's Nargo.toml (NoirPackage)Config. + */ + public getNoirPackageConfig() { + return this.#config; + } + + /** + * The path to the source directory. + */ + public getSrcPath() { + return this.#srcPath; + } + + /** + * Gets the entrypoint path for this package. + */ + public getEntryPointPath(): string { + let entrypoint: string; + + switch (this.getType()) { + case 'lib': + // we shouldn't need to compile `lib` type, since the .nr source is read directly + // when the lib is used as a dependency elsewhere. + entrypoint = 'lib.nr'; + break; + case 'contract': + case 'bin': + entrypoint = 'main.nr'; + break; + default: + throw new Error(`Unknown package type: ${this.getType()}`); + } + // TODO check that `src` exists + return join(this.#srcPath, entrypoint); + } + + /** + * Gets the project type + */ + public getType() { + return this.#config.package.type; + } + + /** + * Gets this package's dependencies. + */ + public getDependencies(): Record { + return this.#config.dependencies; + } + + /** + * Gets this package's sources. + * @param fm - A file manager to use + * @param alias - An alias for the sources, if this package is a dependency + */ + public async getSources(fm: FileManager, alias?: string): Promise { + const handles = await fm.readdir(this.#srcPath, { recursive: true }); + return Promise.all( + handles + .filter((handle) => SOURCE_EXTENSIONS.find((ext) => handle.endsWith(ext))) + .map(async (file) => { + const suffix = file.replace(this.#srcPath, ''); + return { + path: this.getType() === 'lib' ? `${alias ? alias : this.#config.package.name}${suffix}` : file, + source: (await fm.readFile(file, 'utf-8')).toString(), + }; + }), + ); + } + + /** + * Opens a path on the filesystem. + * @param path - Path to the package. + * @param fm - A file manager to use. + * @returns The Noir package at the given location + */ + public static async open(path: string, fm: FileManager): Promise { + const fileContents = await fm.readFile(join(path, CONFIG_FILE_NAME), 'utf-8'); + const config = parseNoirPackageConfig(parse(fileContents)); + + return new NoirPackage(path, join(path, 'src'), config); + } +} diff --git a/compiler/wasm/src/noir_wasm.ts b/compiler/wasm/src/noir_wasm.ts new file mode 100644 index 00000000000..6bf2d3967c0 --- /dev/null +++ b/compiler/wasm/src/noir_wasm.ts @@ -0,0 +1,34 @@ +import { ProgramArtifact, NoirProgramCompilationArtifacts } from './noir/noir_artifact'; +import { NoirWasmContractCompiler } from './noir/noir-wasm-compiler'; +import { FileManager } from './noir/file-manager/file-manager'; +import { LogData } from './types/utils'; + +/** + * Given a Nargo output generates an Aztec-compatible contract artifact. + * @param compiled - Noir build output. + * @returns Aztec contract build artifact. + */ +function generateProgramArtifact({ program }: NoirProgramCompilationArtifacts, noir_version?: string): ProgramArtifact { + return { + noir_version, + hash: program.hash, + backend: program.backend, + abi: program.abi, + }; +} +export async function compileUsingNoirWasm( + fileManager: FileManager, + projectPath: string, + wasmCompiler: unknown, + sourceMap: unknown, +): Promise { + const compiler = await NoirWasmContractCompiler.new(fileManager, projectPath, wasmCompiler, sourceMap, { + log: function (msg: string, _data?: LogData) { + console.log(msg); + }, + }); + const artifacts = await compiler.compile(); + return artifacts.map((artifact) => { + return generateProgramArtifact(artifact); + }); +} diff --git a/compiler/wasm/src/types/abi.ts b/compiler/wasm/src/types/abi.ts new file mode 100644 index 00000000000..a3fabb6881d --- /dev/null +++ b/compiler/wasm/src/types/abi.ts @@ -0,0 +1,270 @@ +/** + * A named type. + */ +export interface ABIVariable { + /** + * The name of the variable. + */ + name: string; + /** + * The type of the variable. + */ + type: ABIType; +} + +/** + * Indicates whether a parameter is public or secret/private. + */ +export enum ABIParameterVisibility { + PUBLIC = 'public', + SECRET = 'secret', +} + +/** + * A function parameter. + */ +export interface ABIParameter extends ABIVariable { + /** + * Indicates whether a parameter is public or secret/private. + */ + visibility: ABIParameterVisibility; +} + +/** + * A basic type. + */ +export interface BasicType { + /** + * The kind of the type. + */ + kind: T; +} + +/** + * A variable type. + */ +export type ABIType = BasicType<'field'> | BasicType<'boolean'> | IntegerType | ArrayType | StringType | StructType; + +/** + * An integer type. + */ +export interface IntegerType extends BasicType<'integer'> { + /** + * The sign of the integer. + */ + sign: string; + /** + * The width of the integer in bits. + */ + width: number; +} + +/** + * An array type. + */ +export interface ArrayType extends BasicType<'array'> { + /** + * The length of the array. + */ + length: number; + /** + * The type of the array elements. + */ + type: ABIType; +} + +/** + * A string type. + */ +export interface StringType extends BasicType<'string'> { + /** + * The length of the string. + */ + length: number; +} + +/** + * A struct type. + */ +export interface StructType extends BasicType<'struct'> { + /** + * The fields of the struct. + */ + fields: ABIVariable[]; + /** + * Fully qualified name of the struct. + */ + path: string; +} + +/** + * A contract event. + */ +export interface EventAbi { + /** + * The event name. + */ + name: string; + /** + * Fully qualified name of the event. + */ + path: string; + /** + * The fields of the event. + */ + fields: ABIVariable[]; +} + +/** + * Aztec.nr function types. + */ +export enum FunctionType { + SECRET = 'secret', + OPEN = 'open', + UNCONSTRAINED = 'unconstrained', +} + +/** + * The abi entry of a function. + */ +export interface FunctionAbi { + /** + * The name of the function. + */ + name: string; + /** + * Whether the function is secret. + */ + functionType: FunctionType; + /** + * Whether the function is internal. + */ + isInternal: boolean; + /** + * Function parameters. + */ + parameters: ABIParameter[]; + /** + * The types of the return values. + */ + returnTypes: ABIType[]; +} + +/** + * The artifact entry of a function. + */ +export interface FunctionArtifact extends FunctionAbi { + /** + * The ACIR bytecode of the function. + */ + bytecode: string; + /** + * The verification key of the function. + */ + verificationKey?: string; +} + +/** + * A file ID. It's assigned during compilation. + */ +export type FileId = number; + +/** + * A pointer to a specific section of the source code. + */ +export interface SourceCodeLocation { + /** + * The section of the source code. + */ + span: { + /** + * The byte where the section starts. + */ + start: number; + /** + * The byte where the section ends. + */ + end: number; + }; + /** + * The source code file pointed to. + */ + file: FileId; +} + +/** + * The location of an opcode in the bytecode. + * It's a string of the form `{acirIndex}` or `{acirIndex}:{brilligIndex}`. + */ +export type OpcodeLocation = string; + +/** + * The debug information for a given function. + */ +export interface DebugInfo { + /** + * A map of the opcode location to the source code location. + */ + locations: Record; +} + +/** + * Maps a file ID to its metadata for debugging purposes. + */ +export type DebugFileMap = Record< + FileId, + { + /** + * The source code of the file. + */ + source: string; + /** + * The path of the file. + */ + path: string; + } +>; + +/** + * The debug metadata of an ABI. + */ +export interface DebugMetadata { + /** + * The DebugInfo object, deflated as JSON, compressed using gzip and serialized with base64. + */ + debugSymbols: string[]; + /** + * The map of file ID to the source code and path of the file. + */ + fileMap: DebugFileMap; +} + +/** + * Defines artifact of a contract. + */ +export interface ContractArtifact { + /** + * The name of the contract. + */ + name: string; + + /** + * The version of compiler used to create this artifact + */ + aztecNrVersion?: string; + + /** + * The functions of the contract. + */ + functions: FunctionArtifact[]; + /** + * The events of the contract. + */ + events: EventAbi[]; + + /** + * The debug metadata of the contract. + * It's used to include the relevant source code section when a constraint is not met during simulation. + */ + debug?: DebugMetadata; +} diff --git a/compiler/wasm/src/types/noir_package_config.ts b/compiler/wasm/src/types/noir_package_config.ts new file mode 100644 index 00000000000..708ffcdd663 --- /dev/null +++ b/compiler/wasm/src/types/noir_package_config.ts @@ -0,0 +1,58 @@ +type noirGitDependencySchema = { + git: string; + tag: string; + directory?: string; +}; + +type noirLocalDependencySchema = { + path: string; +}; + +enum type { + lib = 'lib', + contract = 'contract', + bin = 'bin', +} + +type noirPackageConfigSchema = { + package: { + name: string; + type: type; + entry: string; + description: string; + authors: string[]; + compiler_version: string; + backend: string; + license: string; + }; + dependencies: Record; +}; + +/** + * Noir package configuration. + */ +export type NoirPackageConfig = noirPackageConfigSchema; + +/** + * A remote package dependency. + */ +export type NoirGitDependencyConfig = noirGitDependencySchema; + +/** + * A local package dependency. + */ +export type NoirLocalDependencyConfig = noirLocalDependencySchema; + +/** + * A package dependency. + */ +export type NoirDependencyConfig = NoirGitDependencyConfig | NoirLocalDependencyConfig; + +/** + * Checks that an object is a package configuration. + * @param config - Config to check + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function parseNoirPackageConfig(config: any): NoirPackageConfig { + return config; +} diff --git a/compiler/wasm/src/types/utils.ts b/compiler/wasm/src/types/utils.ts new file mode 100644 index 00000000000..513f7c51617 --- /dev/null +++ b/compiler/wasm/src/types/utils.ts @@ -0,0 +1,53 @@ +import { sep } from 'path'; + +/** Structured log data to include with the message. */ +export type LogData = Record; + +/** A callable logger instance. */ +export type LogFn = (msg: string, data?: LogData) => void; + +export function fileURLToPath(uri: string): string { + if (typeof uri !== 'string' || uri.length <= 7 || uri.substring(0, 7) !== 'file://') { + throw new TypeError('must pass in a file:// URI to convert to a file path'); + } + + const rest = decodeURI(uri.substring(7)); + const firstSlash = rest.indexOf('/'); + let host = rest.substring(0, firstSlash); + let path = rest.substring(firstSlash + 1); + + // 2. Scheme Definition + // As a special case, can be the string "localhost" or the empty + // string; this is interpreted as "the machine from which the URL is + // being interpreted". + if (host === 'localhost') { + host = ''; + } + + if (host) { + host = sep + sep + host; + } + + // 3.2 Drives, drive letters, mount points, file system root + // Drive letters are mapped into the top of a file URI in various ways, + // depending on the implementation; some applications substitute + // vertical bar ("|") for the colon after the drive letter, yielding + // "file:///c|/tmp/test.txt". In some cases, the colon is left + // unchanged, as in "file:///c:/tmp/test.txt". In other cases, the + // colon is simply omitted, as in "file:///c/tmp/test.txt". + path = path.replace(/^(.+)\|/, '$1:'); + + // for Windows, we need to invert the path separators from what a URI uses + if (sep === '\\') { + path = path.replace(/\//g, '\\'); + } + + if (/^.+:/.test(path)) { + // has Windows drive at beginning of path + } else { + // unix path… + path = sep + path; + } + + return host + path; +} diff --git a/compiler/wasm/tsconfig.cjs.json b/compiler/wasm/tsconfig.cjs.json new file mode 100644 index 00000000000..62d6c8661a0 --- /dev/null +++ b/compiler/wasm/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS", + "target":"ESNext", + }, + } \ No newline at end of file diff --git a/compiler/wasm/tsconfig.esm.json b/compiler/wasm/tsconfig.esm.json new file mode 100644 index 00000000000..4925831ac09 --- /dev/null +++ b/compiler/wasm/tsconfig.esm.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "ts-node": { + "esm": true + }, + "compilerOptions": { + "module": "NodeNext", + "target":"ESNext", + }, + } \ No newline at end of file diff --git a/compiler/wasm/tsconfig.json b/compiler/wasm/tsconfig.json index eef2ad84833..aa3434f408a 100644 --- a/compiler/wasm/tsconfig.json +++ b/compiler/wasm/tsconfig.json @@ -1,17 +1,16 @@ { "compilerOptions": { - "moduleResolution": "node", - "outDir": "lib", - "target": "ESNext", - "module": "ESNext", + "outDir": "../dist/types", "strict": true, + "baseUrl": ".", "experimentalDecorators": true, - "esModuleInterop": true, "noImplicitAny": true, "removeComments": false, "preserveConstEnums": true, "sourceMap": true, - "resolveJsonModule": true, - "importHelpers": true - } + "importHelpers": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + }, + "include": ["src/**/*.*ts"] } \ No newline at end of file diff --git a/compiler/wasm/webpack.config.ts b/compiler/wasm/webpack.config.ts new file mode 100644 index 00000000000..2eb758c2dad --- /dev/null +++ b/compiler/wasm/webpack.config.ts @@ -0,0 +1,130 @@ +import path from 'path'; +import webpack from 'webpack'; +import 'webpack-dev-server'; +import WasmPackPlugin from '@wasm-tool/wasm-pack-plugin'; + +import HtmlWebpackPlugin from 'html-webpack-plugin'; +import CopyWebpackPlugin from 'copy-webpack-plugin'; + +const config: webpack.Configuration = { + output: { + path: path.resolve(__dirname, 'dist'), + globalObject: 'this', + }, + mode: 'development', + devtool: 'source-map', + experiments: { + asyncWebAssembly: true, + }, + optimization: { + minimize: false, + }, + resolve: { + extensions: ['.cts', '.mts', '.ts', '.js', '.json', '.wasm'], + fallback: { + // assert: require.resolve('assert'), + // buffer: require.resolve('buffer'), + path: require.resolve('path-browserify'), + // process: require.resolve('process/browser'), + stream: require.resolve('readable-stream'), + // url: require.resolve('url'), + // util: require.resolve('util'), + fs: require.resolve('browserify-fs'), + }, + }, +}; + +const webConfig: webpack.Configuration = { + name: 'web', + entry: './src/index.mts', + ...config, + output: { + ...config.output, + path: path.resolve(__dirname, 'dist/web'), + library: { + type: 'window', + }, + }, + plugins: [ + new WasmPackPlugin({ + crateDirectory: path.resolve(__dirname), + outDir: path.resolve(__dirname, './build/esm'), + }), + new CopyWebpackPlugin({ + patterns: [{ from: path.resolve(__dirname, 'public'), to: path.resolve(__dirname, 'dist/web/public') }], + }), + new HtmlWebpackPlugin({ + title: 'Noir Wasm ESM', + }), + new webpack.DefinePlugin({ + 'process.env.NODE_DEBUG': JSON.stringify(process.env.NODE_DEBUG), + }), + ], + module: { + rules: [ + { + test: /\.(shim\.)?[cmjt]t?s?$/, + use: { + loader: 'babel-loader', + options: { + presets: ['@babel/preset-env', '@babel/preset-typescript'], + plugins: ['@babel/plugin-proposal-class-properties', '@babel/plugin-transform-private-methods'], + }, + }, + }, + { + test: /\.wasm$/, + type: 'webassembly/async', + }, + ], + }, + devServer: { + static: path.join(__dirname, 'dist'), + }, + resolve: { + ...config.resolve, + alias: { + fs: 'memfs', + }, + }, +}; + +const nodeConfig: webpack.Configuration = { + name: 'node', + entry: './src/index.cts', + ...config, + output: { + ...config.output, + path: path.resolve(__dirname, 'dist/node'), + library: { + type: 'commonjs2', + }, + }, + target: 'node', + plugins: [ + new WasmPackPlugin({ + crateDirectory: path.resolve(__dirname), + outDir: path.resolve(__dirname, './build/cjs'), + }), + ], + module: { + rules: [ + { + test: /\.(shim\.)?[cmjt]t?s?$/, + use: { + loader: 'babel-loader', + options: { + presets: ['@babel/preset-env', '@babel/preset-typescript'], + plugins: ['@babel/plugin-proposal-class-properties', '@babel/plugin-transform-private-methods'], + }, + }, + }, + { + test: /\.wasm$/, + type: 'webassembly/async', + }, + ], + }, +}; + +export default [webConfig, nodeConfig]; diff --git a/yarn.lock b/yarn.lock index fab2866a228..48fe9a268f9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -342,6 +342,38 @@ __metadata: languageName: node linkType: hard +"@babel/helper-compilation-targets@npm:^7.23.6": + version: 7.23.6 + resolution: "@babel/helper-compilation-targets@npm:7.23.6" + dependencies: + "@babel/compat-data": ^7.23.5 + "@babel/helper-validator-option": ^7.23.5 + browserslist: ^4.22.2 + lru-cache: ^5.1.1 + semver: ^6.3.1 + checksum: c630b98d4527ac8fe2c58d9a06e785dfb2b73ec71b7c4f2ddf90f814b5f75b547f3c015f110a010fd31f76e3864daaf09f3adcd2f6acdbfb18a8de3a48717590 + languageName: node + linkType: hard + +"@babel/helper-create-class-features-plugin@npm:^7.18.6": + version: 7.23.6 + resolution: "@babel/helper-create-class-features-plugin@npm:7.23.6" + dependencies: + "@babel/helper-annotate-as-pure": ^7.22.5 + "@babel/helper-environment-visitor": ^7.22.20 + "@babel/helper-function-name": ^7.23.0 + "@babel/helper-member-expression-to-functions": ^7.23.0 + "@babel/helper-optimise-call-expression": ^7.22.5 + "@babel/helper-replace-supers": ^7.22.20 + "@babel/helper-skip-transparent-expression-wrappers": ^7.22.5 + "@babel/helper-split-export-declaration": ^7.22.6 + semver: ^6.3.1 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 356b71b9f4a3a95917432bf6a452f475a292d394d9310e9c8b23c8edb564bee91e40d4290b8aa8779d2987a7c39ae717b2d76edc7c952078b8952df1a20259e3 + languageName: node + linkType: hard + "@babel/helper-create-class-features-plugin@npm:^7.22.15, @babel/helper-create-class-features-plugin@npm:^7.23.5": version: 7.23.5 resolution: "@babel/helper-create-class-features-plugin@npm:7.23.5" @@ -623,6 +655,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-proposal-class-properties@npm:^7.18.6": + version: 7.18.6 + resolution: "@babel/plugin-proposal-class-properties@npm:7.18.6" + dependencies: + "@babel/helper-create-class-features-plugin": ^7.18.6 + "@babel/helper-plugin-utils": ^7.18.6 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 49a78a2773ec0db56e915d9797e44fd079ab8a9b2e1716e0df07c92532f2c65d76aeda9543883916b8e0ff13606afeffa67c5b93d05b607bc87653ad18a91422 + languageName: node + linkType: hard + "@babel/plugin-proposal-object-rest-spread@npm:7.12.1": version: 7.12.1 resolution: "@babel/plugin-proposal-object-rest-spread@npm:7.12.1" @@ -1074,6 +1118,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-for-of@npm:^7.23.6": + version: 7.23.6 + resolution: "@babel/plugin-transform-for-of@npm:7.23.6" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/helper-skip-transparent-expression-wrappers": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 228c060aa61f6aa89dc447170075f8214863b94f830624e74ade99c1a09316897c12d76e848460b0b506593e58dbc42739af6dc4cb0fe9b84dffe4a596050a36 + languageName: node + linkType: hard + "@babel/plugin-transform-function-name@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-function-name@npm:7.23.3" @@ -1637,6 +1693,96 @@ __metadata: languageName: node linkType: hard +"@babel/preset-env@npm:^7.23.5": + version: 7.23.6 + resolution: "@babel/preset-env@npm:7.23.6" + dependencies: + "@babel/compat-data": ^7.23.5 + "@babel/helper-compilation-targets": ^7.23.6 + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/helper-validator-option": ^7.23.5 + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": ^7.23.3 + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": ^7.23.3 + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": ^7.23.3 + "@babel/plugin-proposal-private-property-in-object": 7.21.0-placeholder-for-preset-env.2 + "@babel/plugin-syntax-async-generators": ^7.8.4 + "@babel/plugin-syntax-class-properties": ^7.12.13 + "@babel/plugin-syntax-class-static-block": ^7.14.5 + "@babel/plugin-syntax-dynamic-import": ^7.8.3 + "@babel/plugin-syntax-export-namespace-from": ^7.8.3 + "@babel/plugin-syntax-import-assertions": ^7.23.3 + "@babel/plugin-syntax-import-attributes": ^7.23.3 + "@babel/plugin-syntax-import-meta": ^7.10.4 + "@babel/plugin-syntax-json-strings": ^7.8.3 + "@babel/plugin-syntax-logical-assignment-operators": ^7.10.4 + "@babel/plugin-syntax-nullish-coalescing-operator": ^7.8.3 + "@babel/plugin-syntax-numeric-separator": ^7.10.4 + "@babel/plugin-syntax-object-rest-spread": ^7.8.3 + "@babel/plugin-syntax-optional-catch-binding": ^7.8.3 + "@babel/plugin-syntax-optional-chaining": ^7.8.3 + "@babel/plugin-syntax-private-property-in-object": ^7.14.5 + "@babel/plugin-syntax-top-level-await": ^7.14.5 + "@babel/plugin-syntax-unicode-sets-regex": ^7.18.6 + "@babel/plugin-transform-arrow-functions": ^7.23.3 + "@babel/plugin-transform-async-generator-functions": ^7.23.4 + "@babel/plugin-transform-async-to-generator": ^7.23.3 + "@babel/plugin-transform-block-scoped-functions": ^7.23.3 + "@babel/plugin-transform-block-scoping": ^7.23.4 + "@babel/plugin-transform-class-properties": ^7.23.3 + "@babel/plugin-transform-class-static-block": ^7.23.4 + "@babel/plugin-transform-classes": ^7.23.5 + "@babel/plugin-transform-computed-properties": ^7.23.3 + "@babel/plugin-transform-destructuring": ^7.23.3 + "@babel/plugin-transform-dotall-regex": ^7.23.3 + "@babel/plugin-transform-duplicate-keys": ^7.23.3 + "@babel/plugin-transform-dynamic-import": ^7.23.4 + "@babel/plugin-transform-exponentiation-operator": ^7.23.3 + "@babel/plugin-transform-export-namespace-from": ^7.23.4 + "@babel/plugin-transform-for-of": ^7.23.6 + "@babel/plugin-transform-function-name": ^7.23.3 + "@babel/plugin-transform-json-strings": ^7.23.4 + "@babel/plugin-transform-literals": ^7.23.3 + "@babel/plugin-transform-logical-assignment-operators": ^7.23.4 + "@babel/plugin-transform-member-expression-literals": ^7.23.3 + "@babel/plugin-transform-modules-amd": ^7.23.3 + "@babel/plugin-transform-modules-commonjs": ^7.23.3 + "@babel/plugin-transform-modules-systemjs": ^7.23.3 + "@babel/plugin-transform-modules-umd": ^7.23.3 + "@babel/plugin-transform-named-capturing-groups-regex": ^7.22.5 + "@babel/plugin-transform-new-target": ^7.23.3 + "@babel/plugin-transform-nullish-coalescing-operator": ^7.23.4 + "@babel/plugin-transform-numeric-separator": ^7.23.4 + "@babel/plugin-transform-object-rest-spread": ^7.23.4 + "@babel/plugin-transform-object-super": ^7.23.3 + "@babel/plugin-transform-optional-catch-binding": ^7.23.4 + "@babel/plugin-transform-optional-chaining": ^7.23.4 + "@babel/plugin-transform-parameters": ^7.23.3 + "@babel/plugin-transform-private-methods": ^7.23.3 + "@babel/plugin-transform-private-property-in-object": ^7.23.4 + "@babel/plugin-transform-property-literals": ^7.23.3 + "@babel/plugin-transform-regenerator": ^7.23.3 + "@babel/plugin-transform-reserved-words": ^7.23.3 + "@babel/plugin-transform-shorthand-properties": ^7.23.3 + "@babel/plugin-transform-spread": ^7.23.3 + "@babel/plugin-transform-sticky-regex": ^7.23.3 + "@babel/plugin-transform-template-literals": ^7.23.3 + "@babel/plugin-transform-typeof-symbol": ^7.23.3 + "@babel/plugin-transform-unicode-escapes": ^7.23.3 + "@babel/plugin-transform-unicode-property-regex": ^7.23.3 + "@babel/plugin-transform-unicode-regex": ^7.23.3 + "@babel/plugin-transform-unicode-sets-regex": ^7.23.3 + "@babel/preset-modules": 0.1.6-no-external-plugins + babel-plugin-polyfill-corejs2: ^0.4.6 + babel-plugin-polyfill-corejs3: ^0.8.5 + babel-plugin-polyfill-regenerator: ^0.5.3 + core-js-compat: ^3.31.0 + semver: ^6.3.1 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 130262f263c8a76915ff5361f78afa9e63b4ecbf3ade8e833dc7546db7b9552ab507835bdea0feb5e70861345ca128a31327fd2e187084a215fc9dd1cc0ed38e + languageName: node + linkType: hard + "@babel/preset-modules@npm:0.1.6-no-external-plugins": version: 0.1.6-no-external-plugins resolution: "@babel/preset-modules@npm:0.1.6-no-external-plugins" @@ -1666,7 +1812,7 @@ __metadata: languageName: node linkType: hard -"@babel/preset-typescript@npm:^7.18.6, @babel/preset-typescript@npm:^7.22.5": +"@babel/preset-typescript@npm:^7.18.6, @babel/preset-typescript@npm:^7.22.5, @babel/preset-typescript@npm:^7.23.3": version: 7.23.3 resolution: "@babel/preset-typescript@npm:7.23.3" dependencies: @@ -1809,7 +1955,7 @@ __metadata: languageName: node linkType: hard -"@discoveryjs/json-ext@npm:0.5.7": +"@discoveryjs/json-ext@npm:0.5.7, @discoveryjs/json-ext@npm:^0.5.0": version: 0.5.7 resolution: "@discoveryjs/json-ext@npm:0.5.7" checksum: 2176d301cc258ea5c2324402997cf8134ebb212469c0d397591636cea8d3c02f2b3cf9fd58dcb748c7a0dade77ebdc1b10284fa63e608c033a1db52fddc69918 @@ -3601,6 +3747,13 @@ __metadata: languageName: node linkType: hard +"@ltd/j-toml@npm:^1.38.0": + version: 1.38.0 + resolution: "@ltd/j-toml@npm:1.38.0" + checksum: 34f5d0ec652e790a7a733f0d3a8d9957d63997bd0efc13a61beb9d772bae75519453884fbc3fd6a2d5fe15674834bdd57ca1824bb1de8f829e5ce195fc5fa3ea + languageName: node + linkType: hard + "@mdn/browser-compat-data@npm:^4.0.0": version: 4.2.1 resolution: "@mdn/browser-compat-data@npm:4.2.1" @@ -4047,11 +4200,45 @@ __metadata: version: 0.0.0-use.local resolution: "@noir-lang/noir_wasm@workspace:compiler/wasm" dependencies: + "@babel/plugin-proposal-class-properties": ^7.18.6 + "@babel/plugin-transform-private-methods": ^7.23.3 + "@babel/preset-env": ^7.23.5 + "@babel/preset-typescript": ^7.23.3 "@esm-bundle/chai": ^4.3.4-fix.0 + "@ltd/j-toml": ^1.38.0 + "@types/babel__preset-env": ^7 + "@types/lodash.compact": ^3 + "@types/node": ^20.10.0 + "@types/pako": ^2 + "@types/path-browserify": ^1 + "@types/readable-stream": ^4 + "@wasm-tool/wasm-pack-plugin": ^1.7.0 "@web/dev-server-esbuild": ^0.3.6 "@web/test-runner": ^0.15.3 "@web/test-runner-playwright": ^0.10.0 + assert: ^2.1.0 + babel-loader: ^9.1.3 + browserify-fs: ^1.0.0 + buffer: ^6.0.3 + copy-webpack-plugin: ^11.0.0 + file-loader: ^6.2.0 + html-webpack-plugin: ^5.5.4 + lodash.compact: ^3.0.1 mocha: ^10.2.0 + pako: ^2.1.0 + path-browserify: ^1.0.1 + process: ^0.11.10 + readable-stream: ^4.4.2 + text-encoding: ^0.7.0 + ts-loader: ^9.5.1 + ts-node: ^10.9.1 + typescript: ~5.2.2 + unzipit: ^1.4.3 + url: ^0.11.3 + util: ^0.12.5 + webpack: ^5.49.0 + webpack-cli: ^4.7.2 + webpack-dev-server: ^4.15.1 languageName: unknown linkType: soft @@ -4984,6 +5171,13 @@ __metadata: languageName: node linkType: hard +"@types/babel__preset-env@npm:^7": + version: 7.9.6 + resolution: "@types/babel__preset-env@npm:7.9.6" + checksum: 4783334e18e4a2e72314b900f9ac6bda002f05e91208cf88a1f631022443004f552565da4cacfebb9686ef9b06191972222d3395be1f2825cfe53cb77c5b856a + languageName: node + linkType: hard + "@types/bn.js@npm:^4.11.3": version: 4.11.6 resolution: "@types/bn.js@npm:4.11.6" @@ -5340,7 +5534,16 @@ __metadata: languageName: node linkType: hard -"@types/lodash@npm:^4": +"@types/lodash.compact@npm:^3": + version: 3.0.9 + resolution: "@types/lodash.compact@npm:3.0.9" + dependencies: + "@types/lodash": "*" + checksum: 857686d1d5ac695b57ab26c61dec4550fc1002d941e8122e52baf8207e33312be303810fbf923ed9acd79ee82463a0a31143d023f79456a0353c99e0b30d4784 + languageName: node + linkType: hard + +"@types/lodash@npm:*, @types/lodash@npm:^4": version: 4.14.202 resolution: "@types/lodash@npm:4.14.202" checksum: a91acf3564a568c6f199912f3eb2c76c99c5a0d7e219394294213b3f2d54f672619f0fde4da22b29dc5d4c31457cd799acc2e5cb6bd90f9af04a1578483b6ff7 @@ -5462,6 +5665,22 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^20.10.0": + version: 20.10.5 + resolution: "@types/node@npm:20.10.5" + dependencies: + undici-types: ~5.26.4 + checksum: e216b679f545a8356960ce985a0e53c3a58fff0eacd855e180b9e223b8db2b5bd07b744a002b8c1f0c37f9194648ab4578533b5c12df2ec10cc02f61d20948d2 + languageName: node + linkType: hard + +"@types/pako@npm:^2": + version: 2.0.3 + resolution: "@types/pako@npm:2.0.3" + checksum: 0746dd5d29eccf5b2e6cceb3ccb093851219e78bd2e2e20d25757e247987139e061e5d4ba37cb5295493f06e3c683c74f8876011cd8a3f3748a09244fbc841d9 + languageName: node + linkType: hard + "@types/parse-json@npm:^4.0.0": version: 4.0.2 resolution: "@types/parse-json@npm:4.0.2" @@ -5483,6 +5702,13 @@ __metadata: languageName: node linkType: hard +"@types/path-browserify@npm:^1": + version: 1.0.2 + resolution: "@types/path-browserify@npm:1.0.2" + checksum: 7b26df1a32827f7e588009386f62e0f900e8d349722b1b8b8c100cd2c4cc1e95c64099f5ec879cd131e69869088f336998a3ddb17085b68312414431a4eace01 + languageName: node + linkType: hard + "@types/pbkdf2@npm:^3.0.0": version: 3.1.2 resolution: "@types/pbkdf2@npm:3.1.2" @@ -5589,6 +5815,16 @@ __metadata: languageName: node linkType: hard +"@types/readable-stream@npm:^4": + version: 4.0.10 + resolution: "@types/readable-stream@npm:4.0.10" + dependencies: + "@types/node": "*" + safe-buffer: ~5.1.1 + checksum: dc7cb95be737d442770fcaf1fbe3860c011f5f024c6f09c8b032f95b7ef9cce0031302715afe13e18d264b3a162e5838ce78873ec8d63eb238db49bc70906a21 + languageName: node + linkType: hard + "@types/resolve@npm:1.17.1": version: 1.17.1 resolution: "@types/resolve@npm:1.17.1" @@ -5878,6 +6114,18 @@ __metadata: languageName: node linkType: hard +"@wasm-tool/wasm-pack-plugin@npm:^1.7.0": + version: 1.7.0 + resolution: "@wasm-tool/wasm-pack-plugin@npm:1.7.0" + dependencies: + chalk: ^2.4.1 + command-exists: ^1.2.7 + watchpack: ^2.1.1 + which: ^2.0.2 + checksum: b0a09f70827b262c4b4689296aae712cc7d9fb742e32eb7e7b720a5b45be1d256864c84c37c8f97de4c762cdae9c35be4a37cdea6832281056921edf4944aea4 + languageName: node + linkType: hard + "@web/browser-logs@npm:^0.2.6": version: 0.2.6 resolution: "@web/browser-logs@npm:0.2.6" @@ -6343,6 +6591,39 @@ __metadata: languageName: node linkType: hard +"@webpack-cli/configtest@npm:^1.2.0": + version: 1.2.0 + resolution: "@webpack-cli/configtest@npm:1.2.0" + peerDependencies: + webpack: 4.x.x || 5.x.x + webpack-cli: 4.x.x + checksum: a2726cd9ec601d2b57e5fc15e0ebf5200a8892065e735911269ac2038e62be4bfc176ea1f88c2c46ff09b4d05d4c10ae045e87b3679372483d47da625a327e28 + languageName: node + linkType: hard + +"@webpack-cli/info@npm:^1.5.0": + version: 1.5.0 + resolution: "@webpack-cli/info@npm:1.5.0" + dependencies: + envinfo: ^7.7.3 + peerDependencies: + webpack-cli: 4.x.x + checksum: 7f56fe037cd7d1fd5c7428588519fbf04a0cad33925ee4202ffbafd00f8ec1f2f67d991245e687d50e0f3e23f7b7814273d56cb9f7da4b05eed47c8d815c6296 + languageName: node + linkType: hard + +"@webpack-cli/serve@npm:^1.7.0": + version: 1.7.0 + resolution: "@webpack-cli/serve@npm:1.7.0" + peerDependencies: + webpack-cli: 4.x.x + peerDependenciesMeta: + webpack-dev-server: + optional: true + checksum: d475e8effa23eb7ff9a48b14d4de425989fd82f906ce71c210921cc3852327c22873be00c35e181a25a6bd03d424ae2b83e7f3b3f410ac7ee31b128ab4ac7713 + languageName: node + linkType: hard + "@xtuc/ieee754@npm:^1.2.0": version: 1.2.0 resolution: "@xtuc/ieee754@npm:1.2.0" @@ -6371,6 +6652,15 @@ __metadata: languageName: node linkType: hard +"abort-controller@npm:^3.0.0": + version: 3.0.0 + resolution: "abort-controller@npm:3.0.0" + dependencies: + event-target-shim: ^5.0.0 + checksum: 170bdba9b47b7e65906a28c8ce4f38a7a369d78e2271706f020849c1bfe0ee2067d4261df8bbb66eb84f79208fd5b710df759d64191db58cfba7ce8ef9c54b75 + languageName: node + linkType: hard + "abstract-level@npm:^1.0.0, abstract-level@npm:^1.0.2, abstract-level@npm:^1.0.3": version: 1.0.3 resolution: "abstract-level@npm:1.0.3" @@ -6386,6 +6676,15 @@ __metadata: languageName: node linkType: hard +"abstract-leveldown@npm:~0.12.0, abstract-leveldown@npm:~0.12.1": + version: 0.12.4 + resolution: "abstract-leveldown@npm:0.12.4" + dependencies: + xtend: ~3.0.0 + checksum: e300f04bb638cc9c462f6e8fa925672e51beb24c1470c39ece709e54f2f499661ac5fe0119175c7dcb6e32c843423d6960009d4d24e72526478b261163e8070b + languageName: node + linkType: hard + "accepts@npm:^1.3.5, accepts@npm:~1.3.4, accepts@npm:~1.3.5, accepts@npm:~1.3.8": version: 1.3.8 resolution: "accepts@npm:1.3.8" @@ -6765,6 +7064,19 @@ __metadata: languageName: node linkType: hard +"assert@npm:^2.1.0": + version: 2.1.0 + resolution: "assert@npm:2.1.0" + dependencies: + call-bind: ^1.0.2 + is-nan: ^1.3.2 + object-is: ^1.1.5 + object.assign: ^4.1.4 + util: ^0.12.5 + checksum: 1ed1cabba9abe55f4109b3f7292b4e4f3cf2953aad8dc148c0b3c3bd676675c31b1abb32ef563b7d5a19d1715bf90d1e5f09fad2a4ee655199468902da80f7c2 + languageName: node + linkType: hard + "assertion-error@npm:^1.1.0": version: 1.1.0 resolution: "assertion-error@npm:1.1.0" @@ -6829,6 +7141,13 @@ __metadata: languageName: node linkType: hard +"available-typed-arrays@npm:^1.0.5": + version: 1.0.5 + resolution: "available-typed-arrays@npm:1.0.5" + checksum: 20eb47b3cefd7db027b9bbb993c658abd36d4edd3fe1060e83699a03ee275b0c9b216cc076ff3f2db29073225fb70e7613987af14269ac1fe2a19803ccc97f1a + languageName: node + linkType: hard + "axios@npm:^0.25.0": version: 0.25.0 resolution: "axios@npm:0.25.0" @@ -7033,6 +7352,15 @@ __metadata: languageName: node linkType: hard +"bl@npm:~0.8.1": + version: 0.8.2 + resolution: "bl@npm:0.8.2" + dependencies: + readable-stream: ~1.0.26 + checksum: 18767c5c861ae1cdbb000bb346e9e8e29137225e8eef97f39db78beeb236beca609f465580c5c1b177d621505f57400834fb4a17a66d264f33a0237293ec2ac5 + languageName: node + linkType: hard + "blakejs@npm:^1.1.0": version: 1.2.1 resolution: "blakejs@npm:1.2.1" @@ -7234,6 +7562,17 @@ __metadata: languageName: node linkType: hard +"browserify-fs@npm:^1.0.0": + version: 1.0.0 + resolution: "browserify-fs@npm:1.0.0" + dependencies: + level-filesystem: ^1.0.1 + level-js: ^2.1.3 + levelup: ^0.18.2 + checksum: e0c35cf42c839c0a217048b1671d91ee6e53fd05f163db4f809e46c2f6264f784768e7c850abc200b0eaca378d42e00e01876eda21fd84fc0a4280bd6200a9c3 + languageName: node + linkType: hard + "browserslist@npm:^4.0.0, browserslist@npm:^4.14.5, browserslist@npm:^4.18.1, browserslist@npm:^4.21.10, browserslist@npm:^4.21.4, browserslist@npm:^4.21.9, browserslist@npm:^4.22.2": version: 4.22.2 resolution: "browserslist@npm:4.22.2" @@ -7406,7 +7745,7 @@ __metadata: languageName: node linkType: hard -"call-bind@npm:^1.0.0, call-bind@npm:^1.0.5": +"call-bind@npm:^1.0.0, call-bind@npm:^1.0.2, call-bind@npm:^1.0.4, call-bind@npm:^1.0.5": version: 1.0.5 resolution: "call-bind@npm:1.0.5" dependencies: @@ -7544,7 +7883,7 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^2.4.2": +"chalk@npm:^2.4.1, chalk@npm:^2.4.2": version: 2.4.2 resolution: "chalk@npm:2.4.2" dependencies: @@ -7881,6 +8220,13 @@ __metadata: languageName: node linkType: hard +"clone@npm:~0.1.9": + version: 0.1.19 + resolution: "clone@npm:0.1.19" + checksum: 5e710e16da67abe30c0664c8fd69c280635be59a4fae0a5fe58ed324e701e99348b48ce67288716fa223edd42ba574e58a3783cb2fcfa381b8b49ce7e56ac3f4 + languageName: node + linkType: hard + "clsx@npm:^1.1.1, clsx@npm:^1.2.1": version: 1.2.1 resolution: "clsx@npm:1.2.1" @@ -7967,7 +8313,7 @@ __metadata: languageName: node linkType: hard -"colorette@npm:^2.0.10": +"colorette@npm:^2.0.10, colorette@npm:^2.0.14": version: 2.0.20 resolution: "colorette@npm:2.0.20" checksum: 0c016fea2b91b733eb9f4bcdb580018f52c0bc0979443dad930e5037a968237ac53d9beb98e218d2e9235834f8eebce7f8e080422d6194e957454255bde71d3d @@ -8011,7 +8357,7 @@ __metadata: languageName: node linkType: hard -"command-exists@npm:^1.2.8": +"command-exists@npm:^1.2.7, command-exists@npm:^1.2.8": version: 1.2.9 resolution: "command-exists@npm:1.2.9" checksum: 729ae3d88a2058c93c58840f30341b7f82688a573019535d198b57a4d8cb0135ced0ad7f52b591e5b28a90feb2c675080ce916e56254a0f7c15cb2395277cac3 @@ -8082,7 +8428,7 @@ __metadata: languageName: node linkType: hard -"commander@npm:^7.2.0": +"commander@npm:^7.0.0, commander@npm:^7.2.0": version: 7.2.0 resolution: "commander@npm:7.2.0" checksum: 53501cbeee61d5157546c0bef0fedb6cdfc763a882136284bed9a07225f09a14b82d2a84e7637edfd1a679fb35ed9502fd58ef1d091e6287f60d790147f68ddc @@ -8141,6 +8487,18 @@ __metadata: languageName: node linkType: hard +"concat-stream@npm:^1.4.4": + version: 1.6.2 + resolution: "concat-stream@npm:1.6.2" + dependencies: + buffer-from: ^1.0.0 + inherits: ^2.0.3 + readable-stream: ^2.2.2 + typedarray: ^0.0.6 + checksum: 1ef77032cb4459dcd5187bd710d6fc962b067b64ec6a505810de3d2b8cc0605638551b42f8ec91edf6fcd26141b32ef19ad749239b58fae3aba99187adc32285 + languageName: node + linkType: hard + "config-chain@npm:^1.1.11": version: 1.1.13 resolution: "config-chain@npm:1.1.13" @@ -8796,6 +9154,15 @@ __metadata: languageName: node linkType: hard +"deferred-leveldown@npm:~0.2.0": + version: 0.2.0 + resolution: "deferred-leveldown@npm:0.2.0" + dependencies: + abstract-leveldown: ~0.12.1 + checksum: f7690ec5b1e951e6f56998be26dd0a1331ef28cb7eaa9e090a282780d47dc006effd4b82a2a82b636cae801378047997aca10c0b44b09c8624633cdb96b07913 + languageName: node + linkType: hard + "define-data-property@npm:^1.0.1, define-data-property@npm:^1.1.1": version: 1.1.1 resolution: "define-data-property@npm:1.1.1" @@ -8821,7 +9188,7 @@ __metadata: languageName: node linkType: hard -"define-properties@npm:^1.2.1": +"define-properties@npm:^1.1.3, define-properties@npm:^1.2.1": version: 1.2.1 resolution: "define-properties@npm:1.2.1" dependencies: @@ -9282,7 +9649,7 @@ __metadata: languageName: node linkType: hard -"enhanced-resolve@npm:^5.15.0": +"enhanced-resolve@npm:^5.0.0, enhanced-resolve@npm:^5.15.0": version: 5.15.0 resolution: "enhanced-resolve@npm:5.15.0" dependencies: @@ -9323,6 +9690,15 @@ __metadata: languageName: node linkType: hard +"envinfo@npm:^7.7.3": + version: 7.11.0 + resolution: "envinfo@npm:7.11.0" + bin: + envinfo: dist/cli.js + checksum: c45a7d20409d5f4cda72483b150d3816b15b434f2944d72c1495d8838bd7c4e7b2f32c12128ffb9b92b5f66f436237b8a525eb3a9a5da2d20013bc4effa28aef + languageName: node + linkType: hard + "err-code@npm:^2.0.2": version: 2.0.3 resolution: "err-code@npm:2.0.3" @@ -9330,6 +9706,17 @@ __metadata: languageName: node linkType: hard +"errno@npm:^0.1.1, errno@npm:~0.1.1": + version: 0.1.8 + resolution: "errno@npm:0.1.8" + dependencies: + prr: ~1.0.1 + bin: + errno: cli.js + checksum: 1271f7b9fbb3bcbec76ffde932485d1e3561856d21d847ec613a9722ee924cdd4e523a62dc71a44174d91e898fe21fdc8d5b50823f4b5e0ce8c35c8271e6ef4a + languageName: node + linkType: hard + "error-ex@npm:^1.3.1": version: 1.3.2 resolution: "error-ex@npm:1.3.2" @@ -9947,6 +10334,13 @@ __metadata: languageName: node linkType: hard +"event-target-shim@npm:^5.0.0": + version: 5.0.1 + resolution: "event-target-shim@npm:5.0.1" + checksum: 1ffe3bb22a6d51bdeb6bf6f7cf97d2ff4a74b017ad12284cc9e6a279e727dc30a5de6bb613e5596ff4dc3e517841339ad09a7eec44266eccb1aa201a30448166 + languageName: node + linkType: hard + "eventemitter3@npm:^4.0.0": version: 4.0.7 resolution: "eventemitter3@npm:4.0.7" @@ -9954,7 +10348,7 @@ __metadata: languageName: node linkType: hard -"events@npm:^3.2.0": +"events@npm:^3.2.0, events@npm:^3.3.0": version: 3.3.0 resolution: "events@npm:3.3.0" checksum: f6f487ad2198aa41d878fa31452f1a3c00958f46e9019286ff4787c84aac329332ab45c9cdc8c445928fc6d7ded294b9e005a7fce9426488518017831b272780 @@ -10142,6 +10536,13 @@ __metadata: languageName: node linkType: hard +"fastest-levenshtein@npm:^1.0.12": + version: 1.0.16 + resolution: "fastest-levenshtein@npm:1.0.16" + checksum: a78d44285c9e2ae2c25f3ef0f8a73f332c1247b7ea7fb4a191e6bb51aa6ee1ef0dfb3ed113616dcdc7023e18e35a8db41f61c8d88988e877cf510df8edafbc71 + languageName: node + linkType: hard + "fastq@npm:^1.6.0": version: 1.15.0 resolution: "fastq@npm:1.15.0" @@ -10371,6 +10772,22 @@ __metadata: languageName: node linkType: hard +"for-each@npm:^0.3.3": + version: 0.3.3 + resolution: "for-each@npm:0.3.3" + dependencies: + is-callable: ^1.1.3 + checksum: 6c48ff2bc63362319c65e2edca4a8e1e3483a2fabc72fbe7feaf8c73db94fc7861bd53bc02c8a66a0c1dd709da6b04eec42e0abdd6b40ce47305ae92a25e5d28 + languageName: node + linkType: hard + +"foreach@npm:~2.0.1": + version: 2.0.6 + resolution: "foreach@npm:2.0.6" + checksum: f7b68494545ee41cbd0b0425ebf5386c265dc38ef2a9b0d5cd91a1b82172e939b4cf9387f8e0ebf6db4e368fc79ed323f2198424d5c774515ac3ed9b08901c0e + languageName: node + linkType: hard + "foreground-child@npm:^3.1.0": version: 3.1.1 resolution: "foreground-child@npm:3.1.1" @@ -10637,7 +11054,16 @@ __metadata: languageName: node linkType: hard -"gensync@npm:^1.0.0-beta.1, gensync@npm:^1.0.0-beta.2": +"fwd-stream@npm:^1.0.4": + version: 1.0.4 + resolution: "fwd-stream@npm:1.0.4" + dependencies: + readable-stream: ~1.0.26-4 + checksum: db4dcf68f214b3fabd6cd9658630dfd1d7ed8d43f7f45408027a90220cd75276e782d1e958821775d7a3a4a83034778e75a097bdc7002c758e8896f76213c65d + languageName: node + linkType: hard + +"gensync@npm:^1.0.0-beta.1, gensync@npm:^1.0.0-beta.2": version: 1.0.0-beta.2 resolution: "gensync@npm:1.0.0-beta.2" checksum: a7437e58c6be12aa6c90f7730eac7fa9833dc78872b4ad2963d2031b00a3367a93f98aec75f9aaac7220848e4026d67a8655e870b24f20a543d103c0d65952ec @@ -11516,7 +11942,7 @@ __metadata: languageName: node linkType: hard -"html-webpack-plugin@npm:^5.5.0, html-webpack-plugin@npm:^5.5.3": +"html-webpack-plugin@npm:^5.5.0, html-webpack-plugin@npm:^5.5.3, html-webpack-plugin@npm:^5.5.4": version: 5.5.4 resolution: "html-webpack-plugin@npm:5.5.4" dependencies: @@ -11734,6 +12160,13 @@ __metadata: languageName: node linkType: hard +"idb-wrapper@npm:^1.5.0": + version: 1.7.2 + resolution: "idb-wrapper@npm:1.7.2" + checksum: a5fa3a771166205e2d5d2b93c66bd31571dada3526b59bc0f8583efb091b6b327125f1a964a25a281b85ef1c44af10a3c511652632ad3adf8229a161132d66ae + languageName: node + linkType: hard + "ieee754@npm:^1.1.13, ieee754@npm:^1.2.1": version: 1.2.1 resolution: "ieee754@npm:1.2.1" @@ -11804,6 +12237,18 @@ __metadata: languageName: node linkType: hard +"import-local@npm:^3.0.2": + version: 3.1.0 + resolution: "import-local@npm:3.1.0" + dependencies: + pkg-dir: ^4.2.0 + resolve-cwd: ^3.0.0 + bin: + import-local-fixture: fixtures/cli.js + checksum: bfcdb63b5e3c0e245e347f3107564035b128a414c4da1172a20dc67db2504e05ede4ac2eee1252359f78b0bfd7b19ef180aec427c2fce6493ae782d73a04cddd + languageName: node + linkType: hard + "imurmurhash@npm:^0.1.4": version: 0.1.4 resolution: "imurmurhash@npm:0.1.4" @@ -11818,6 +12263,13 @@ __metadata: languageName: node linkType: hard +"indexof@npm:~0.0.1": + version: 0.0.1 + resolution: "indexof@npm:0.0.1" + checksum: 0fb04e8b147b8585d981a6df1564f25bb3678d6fa74e33e5cecc1464b10f78e15e8ef6bb688f135fe5c2844a128fac8a7831cbe5adc81fdcf12681b093dfcc25 + languageName: node + linkType: hard + "infima@npm:0.2.0-alpha.43": version: 0.2.0-alpha.43 resolution: "infima@npm:0.2.0-alpha.43" @@ -11842,7 +12294,7 @@ __metadata: languageName: node linkType: hard -"inherits@npm:2, inherits@npm:2.0.4, inherits@npm:^2.0.0, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:^2.0.4, inherits@npm:~2.0.3": +"inherits@npm:2, inherits@npm:2.0.4, inherits@npm:^2.0.0, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:^2.0.4, inherits@npm:~2.0.1, inherits@npm:~2.0.3": version: 2.0.4 resolution: "inherits@npm:2.0.4" checksum: 4a48a733847879d6cf6691860a6b1e3f0f4754176e4d71494c41f3475553768b10f84b5ce1d40fbd0e34e6bfbb864ee35858ad4dd2cf31e02fc4a154b724d7f1 @@ -11914,6 +12366,13 @@ __metadata: languageName: node linkType: hard +"interpret@npm:^2.2.0": + version: 2.2.0 + resolution: "interpret@npm:2.2.0" + checksum: f51efef7cb8d02da16408ffa3504cd6053014c5aeb7bb8c223727e053e4235bf565e45d67028b0c8740d917c603807aa3c27d7bd2f21bf20b6417e2bb3e5fd6e + languageName: node + linkType: hard + "invariant@npm:^2.2.4": version: 2.2.4 resolution: "invariant@npm:2.2.4" @@ -11994,6 +12453,16 @@ __metadata: languageName: node linkType: hard +"is-arguments@npm:^1.0.4": + version: 1.1.1 + resolution: "is-arguments@npm:1.1.1" + dependencies: + call-bind: ^1.0.2 + has-tostringtag: ^1.0.0 + checksum: 7f02700ec2171b691ef3e4d0e3e6c0ba408e8434368504bb593d0d7c891c0dbfda6d19d30808b904a6cb1929bca648c061ba438c39f296c2a8ca083229c49f27 + languageName: node + linkType: hard + "is-arrayish@npm:^0.2.1": version: 0.2.1 resolution: "is-arrayish@npm:0.2.1" @@ -12026,6 +12495,13 @@ __metadata: languageName: node linkType: hard +"is-callable@npm:^1.1.3": + version: 1.2.7 + resolution: "is-callable@npm:1.2.7" + checksum: 61fd57d03b0d984e2ed3720fb1c7a897827ea174bd44402878e059542ea8c4aeedee0ea0985998aa5cc2736b2fa6e271c08587addb5b3959ac52cf665173d1ac + languageName: node + linkType: hard + "is-ci@npm:^2.0.0": version: 2.0.0 resolution: "is-ci@npm:2.0.0" @@ -12184,6 +12660,16 @@ __metadata: languageName: node linkType: hard +"is-nan@npm:^1.3.2": + version: 1.3.2 + resolution: "is-nan@npm:1.3.2" + dependencies: + call-bind: ^1.0.0 + define-properties: ^1.1.3 + checksum: 5dfadcef6ad12d3029d43643d9800adbba21cf3ce2ec849f734b0e14ee8da4070d82b15fdb35138716d02587c6578225b9a22779cab34888a139cc43e4e3610a + languageName: node + linkType: hard + "is-npm@npm:^5.0.0": version: 5.0.0 resolution: "is-npm@npm:5.0.0" @@ -12219,6 +12705,13 @@ __metadata: languageName: node linkType: hard +"is-object@npm:~0.1.2": + version: 0.1.2 + resolution: "is-object@npm:0.1.2" + checksum: 7e500b15f4748278ea0a8d43b1283e75e866c055e4a790389087ce652eab8a9343fd74710738f0fdf13a323c31330d65bdcc106f38e9bb7bc0b9c60ae3fd2a2d + languageName: node + linkType: hard + "is-path-cwd@npm:^2.2.0": version: 2.2.0 resolution: "is-path-cwd@npm:2.2.0" @@ -12314,6 +12807,15 @@ __metadata: languageName: node linkType: hard +"is-typed-array@npm:^1.1.3": + version: 1.1.12 + resolution: "is-typed-array@npm:1.1.12" + dependencies: + which-typed-array: ^1.1.11 + checksum: 4c89c4a3be07186caddadf92197b17fda663a9d259ea0d44a85f171558270d36059d1c386d34a12cba22dfade5aba497ce22778e866adc9406098c8fc4771796 + languageName: node + linkType: hard + "is-typedarray@npm:^1.0.0": version: 1.0.0 resolution: "is-typedarray@npm:1.0.0" @@ -12365,6 +12867,13 @@ __metadata: languageName: node linkType: hard +"is@npm:~0.2.6": + version: 0.2.7 + resolution: "is@npm:0.2.7" + checksum: 45cea1e6deb41150b5753e18041a833657313e9c791c73f96fb9014b613346f5af2e6650858ef50ea6262c79555b65e09b13d30a268139863885025dd65f1059 + languageName: node + linkType: hard + "isarray@npm:0.0.1": version: 0.0.1 resolution: "isarray@npm:0.0.1" @@ -12386,6 +12895,13 @@ __metadata: languageName: node linkType: hard +"isbuffer@npm:~0.0.0": + version: 0.0.0 + resolution: "isbuffer@npm:0.0.0" + checksum: 9796296d3c493974c1f71ccf3170cc8007217a19ce8b3b9dedffd32e8ccc3ac42473b572bbf1b24b86143e826ea157aead11fd1285389518abab76c7da5f50ed + languageName: node + linkType: hard + "isexe@npm:^2.0.0": version: 2.0.0 resolution: "isexe@npm:2.0.0" @@ -12869,6 +13385,94 @@ __metadata: languageName: node linkType: hard +"level-blobs@npm:^0.1.7": + version: 0.1.7 + resolution: "level-blobs@npm:0.1.7" + dependencies: + level-peek: 1.0.6 + once: ^1.3.0 + readable-stream: ^1.0.26-4 + checksum: e3cf78ef0bc64ff350edb4e247b2689cd4f5facf1119694ca8c96c28a05a38dc9d88e0bd065b18af65330bc22f5d588719a5c3e63adaa5feba5ea7913f87bebe + languageName: node + linkType: hard + +"level-filesystem@npm:^1.0.1": + version: 1.2.0 + resolution: "level-filesystem@npm:1.2.0" + dependencies: + concat-stream: ^1.4.4 + errno: ^0.1.1 + fwd-stream: ^1.0.4 + level-blobs: ^0.1.7 + level-peek: ^1.0.6 + level-sublevel: ^5.2.0 + octal: ^1.0.0 + once: ^1.3.0 + xtend: ^2.2.0 + checksum: a29e6a9d8c1879d43610113d1bcb59368685ec0ae413fcf0f8dcbb0a0c26b88fcf16f7481acb2b4650e5951ba0635e73a2c8fbe25cd599c50f80949a5547a367 + languageName: node + linkType: hard + +"level-fix-range@npm:2.0": + version: 2.0.0 + resolution: "level-fix-range@npm:2.0.0" + dependencies: + clone: ~0.1.9 + checksum: 250cefa69e1035d1412b4ba3e5cab83cceb894aa833fb0a93417d8d6230c60f6f8154feffbd0f116461ddd441b909e7df1323355d3e1769b3bb20a55729145b5 + languageName: node + linkType: hard + +"level-fix-range@npm:~1.0.2": + version: 1.0.2 + resolution: "level-fix-range@npm:1.0.2" + checksum: 6c9a3894ea08947fae79c41b75e8b9d57979523b656bec43c589f2dc4455276a150df445d9a7ca880a7c58c2ef19f5cea7f661d777993b870f4943af6b31d5bb + languageName: node + linkType: hard + +"level-hooks@npm:>=4.4.0 <5": + version: 4.5.0 + resolution: "level-hooks@npm:4.5.0" + dependencies: + string-range: ~1.2 + checksum: f198ad2e0901a4719e324e67f546097589af79665ebaaabee7122fda18a41ada3158bb1816b8b82430f30c68610125e4e20b5c09ec3ba7ae262d97dba34f48ab + languageName: node + linkType: hard + +"level-js@npm:^2.1.3": + version: 2.2.4 + resolution: "level-js@npm:2.2.4" + dependencies: + abstract-leveldown: ~0.12.0 + idb-wrapper: ^1.5.0 + isbuffer: ~0.0.0 + ltgt: ^2.1.2 + typedarray-to-buffer: ~1.0.0 + xtend: ~2.1.2 + checksum: 4fed784fcfad4bc6ec97d9c3897e95eaa30326fcdab9f4c7437624d10fa875fa84aafcc2acac0d53181af506cbc012c03f413b4da12ff83758d3bcbb699f8c8e + languageName: node + linkType: hard + +"level-peek@npm:1.0.6, level-peek@npm:^1.0.6": + version: 1.0.6 + resolution: "level-peek@npm:1.0.6" + dependencies: + level-fix-range: ~1.0.2 + checksum: e07d5f8b80675727204d9a226a249139da9e354e633b9d57b7a5186a7b85be445e550ca628f5133bf7a220a9311a193ded5a3f83588dc4eaa53ffb86b426154a + languageName: node + linkType: hard + +"level-sublevel@npm:^5.2.0": + version: 5.2.3 + resolution: "level-sublevel@npm:5.2.3" + dependencies: + level-fix-range: 2.0 + level-hooks: ">=4.4.0 <5" + string-range: ~1.2.1 + xtend: ~2.0.4 + checksum: f0fdffc2f9ca289aa183a1bf7f300a8f92e4f01be60eab37ab36e1f6ec33ed449519d8f69504a616e82f3ddca13a15fa4e19af1dcc1beba9044a4c60b6cd94bf + languageName: node + linkType: hard + "level-supports@npm:^4.0.0": version: 4.0.1 resolution: "level-supports@npm:4.0.1" @@ -12896,6 +13500,21 @@ __metadata: languageName: node linkType: hard +"levelup@npm:^0.18.2": + version: 0.18.6 + resolution: "levelup@npm:0.18.6" + dependencies: + bl: ~0.8.1 + deferred-leveldown: ~0.2.0 + errno: ~0.1.1 + prr: ~0.0.0 + readable-stream: ~1.0.26 + semver: ~2.3.1 + xtend: ~3.0.0 + checksum: 80e140dd83dc94050e283fc02874ae85116cb560d81e14fee0ac111f86006887835ec905dca7a081414c07eca202245a580f1e02f696367b777ecc23a9e05b86 + languageName: node + linkType: hard + "leven@npm:^3.1.0": version: 3.1.0 resolution: "leven@npm:3.1.0" @@ -13023,6 +13642,13 @@ __metadata: languageName: node linkType: hard +"lodash.compact@npm:^3.0.1": + version: 3.0.1 + resolution: "lodash.compact@npm:3.0.1" + checksum: 75039eddfa5ef2ea0da1fc3d36515e92227241f94258b3dcf771196e741c878698ce5b79c0cb7fe758841c9dfd0e6fa222888985aadc0384fd79bbc9680dd829 + languageName: node + linkType: hard + "lodash.debounce@npm:^4.0.8": version: 4.0.8 resolution: "lodash.debounce@npm:4.0.8" @@ -13183,6 +13809,13 @@ __metadata: languageName: node linkType: hard +"ltgt@npm:^2.1.2": + version: 2.2.1 + resolution: "ltgt@npm:2.2.1" + checksum: 7e3874296f7538bc8087b428ac4208008d7b76916354b34a08818ca7c83958c1df10ec427eeeaad895f6b81e41e24745b18d30f89abcc21d228b94f6961d50a2 + languageName: node + linkType: hard + "lunr-languages@npm:^1.4.0": version: 1.14.0 resolution: "lunr-languages@npm:1.14.0" @@ -14207,7 +14840,7 @@ __metadata: languageName: node linkType: hard -"micromatch@npm:^4.0.2, micromatch@npm:^4.0.4, micromatch@npm:^4.0.5": +"micromatch@npm:^4.0.0, micromatch@npm:^4.0.2, micromatch@npm:^4.0.4, micromatch@npm:^4.0.5": version: 4.0.5 resolution: "micromatch@npm:4.0.5" dependencies: @@ -14857,6 +15490,16 @@ __metadata: languageName: node linkType: hard +"object-is@npm:^1.1.5": + version: 1.1.5 + resolution: "object-is@npm:1.1.5" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.3 + checksum: 989b18c4cba258a6b74dc1d74a41805c1a1425bce29f6cabb50dcb1a6a651ea9104a1b07046739a49a5bb1bc49727bcb00efd5c55f932f6ea04ec8927a7901fe + languageName: node + linkType: hard + "object-keys@npm:^1.1.1": version: 1.1.1 resolution: "object-keys@npm:1.1.1" @@ -14864,7 +15507,25 @@ __metadata: languageName: node linkType: hard -"object.assign@npm:^4.1.0": +"object-keys@npm:~0.2.0": + version: 0.2.0 + resolution: "object-keys@npm:0.2.0" + dependencies: + foreach: ~2.0.1 + indexof: ~0.0.1 + is: ~0.2.6 + checksum: 4b96bab88fe9df22a03aec3c59a084bdffc789ad1318a39081e6b8389af6b9ab8571dd3776eed3ec5831137d057fb7ba76911552c6a6efd59b5d126ac3b6e432 + languageName: node + linkType: hard + +"object-keys@npm:~0.4.0": + version: 0.4.0 + resolution: "object-keys@npm:0.4.0" + checksum: 1be3ebe9b48c0d5eda8e4a30657d887a748cb42435e0e2eaf49faf557bdd602cd2b7558b8ce90a4eb2b8592d16b875a1900bce859cbb0f35b21c67e11a45313c + languageName: node + linkType: hard + +"object.assign@npm:^4.1.0, object.assign@npm:^4.1.4": version: 4.1.5 resolution: "object.assign@npm:4.1.5" dependencies: @@ -14890,6 +15551,13 @@ __metadata: languageName: node linkType: hard +"octal@npm:^1.0.0": + version: 1.0.0 + resolution: "octal@npm:1.0.0" + checksum: d648917f4f0a1042d7a4e230262aed00274c9791fe4795e9a2ce3b64ab7f2ca93e62cd55ca5ad4e4bd3fc375ca84d6919d7bf417be461790c1042503ac2c2310 + languageName: node + linkType: hard + "on-finished@npm:2.4.1, on-finished@npm:^2.3.0": version: 2.4.1 resolution: "on-finished@npm:2.4.1" @@ -15170,6 +15838,13 @@ __metadata: languageName: node linkType: hard +"pako@npm:^2.1.0": + version: 2.1.0 + resolution: "pako@npm:2.1.0" + checksum: 71666548644c9a4d056bcaba849ca6fd7242c6cf1af0646d3346f3079a1c7f4a66ffec6f7369ee0dc88f61926c10d6ab05da3e1fca44b83551839e89edd75a3e + languageName: node + linkType: hard + "param-case@npm:^3.0.4": version: 3.0.4 resolution: "param-case@npm:3.0.4" @@ -15281,6 +15956,13 @@ __metadata: languageName: node linkType: hard +"path-browserify@npm:^1.0.1": + version: 1.0.1 + resolution: "path-browserify@npm:1.0.1" + checksum: c6d7fa376423fe35b95b2d67990060c3ee304fc815ff0a2dc1c6c3cfaff2bd0d572ee67e18f19d0ea3bbe32e8add2a05021132ac40509416459fffee35200699 + languageName: node + linkType: hard + "path-exists@npm:^3.0.0": version: 3.0.0 resolution: "path-exists@npm:3.0.0" @@ -15438,7 +16120,7 @@ __metadata: languageName: node linkType: hard -"pkg-dir@npm:^4.1.0": +"pkg-dir@npm:^4.1.0, pkg-dir@npm:^4.2.0": version: 4.2.0 resolution: "pkg-dir@npm:4.2.0" dependencies: @@ -16036,6 +16718,13 @@ __metadata: languageName: node linkType: hard +"process@npm:^0.11.10": + version: 0.11.10 + resolution: "process@npm:0.11.10" + checksum: bfcce49814f7d172a6e6a14d5fa3ac92cc3d0c3b9feb1279774708a719e19acd673995226351a082a9ae99978254e320ccda4240ddc474ba31a76c79491ca7c3 + languageName: node + linkType: hard + "progress@npm:2.0.3": version: 2.0.3 resolution: "progress@npm:2.0.3" @@ -16114,6 +16803,20 @@ __metadata: languageName: node linkType: hard +"prr@npm:~0.0.0": + version: 0.0.0 + resolution: "prr@npm:0.0.0" + checksum: 6552d9d92d9d55ec1afb8952ad80f81bbb1b4379f24ff7c506ad083ea701caf1bf6d4b092a2baeb98ec3f312c5a49d8bdf1d9b20a6db2998d05c2d52aa6a82e7 + languageName: node + linkType: hard + +"prr@npm:~1.0.1": + version: 1.0.1 + resolution: "prr@npm:1.0.1" + checksum: 3bca2db0479fd38f8c4c9439139b0c42dcaadcc2fbb7bb8e0e6afaa1383457f1d19aea9e5f961d5b080f1cfc05bfa1fe9e45c97a1d3fd6d421950a73d3108381 + languageName: node + linkType: hard + "ps-tree@npm:^1.2.0": version: 1.2.0 resolution: "ps-tree@npm:1.2.0" @@ -16135,7 +16838,7 @@ __metadata: languageName: node linkType: hard -"punycode@npm:^1.3.2": +"punycode@npm:^1.3.2, punycode@npm:^1.4.1": version: 1.4.1 resolution: "punycode@npm:1.4.1" checksum: fa6e698cb53db45e4628559e557ddaf554103d2a96a1d62892c8f4032cd3bc8871796cae9eabc1bc700e2b6677611521ce5bb1d9a27700086039965d0cf34518 @@ -16200,7 +16903,7 @@ __metadata: languageName: node linkType: hard -"qs@npm:^6.5.2": +"qs@npm:^6.11.2, qs@npm:^6.5.2": version: 6.11.2 resolution: "qs@npm:6.11.2" dependencies: @@ -16488,7 +17191,19 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:^2.0.1": +"readable-stream@npm:^1.0.26-4": + version: 1.1.14 + resolution: "readable-stream@npm:1.1.14" + dependencies: + core-util-is: ~1.0.0 + inherits: ~2.0.1 + isarray: 0.0.1 + string_decoder: ~0.10.x + checksum: 17dfeae3e909945a4a1abc5613ea92d03269ef54c49288599507fc98ff4615988a1c39a999dcf9aacba70233d9b7040bc11a5f2bfc947e262dedcc0a8b32b5a0 + languageName: node + linkType: hard + +"readable-stream@npm:^2.0.1, readable-stream@npm:^2.2.2": version: 2.3.8 resolution: "readable-stream@npm:2.3.8" dependencies: @@ -16514,6 +17229,31 @@ __metadata: languageName: node linkType: hard +"readable-stream@npm:^4.4.2": + version: 4.4.2 + resolution: "readable-stream@npm:4.4.2" + dependencies: + abort-controller: ^3.0.0 + buffer: ^6.0.3 + events: ^3.3.0 + process: ^0.11.10 + string_decoder: ^1.3.0 + checksum: 6f4063763dbdb52658d22d3f49ca976420e1fbe16bbd241f744383715845350b196a2f08b8d6330f8e219153dff34b140aeefd6296da828e1041a7eab1f20d5e + languageName: node + linkType: hard + +"readable-stream@npm:~1.0.26, readable-stream@npm:~1.0.26-4": + version: 1.0.34 + resolution: "readable-stream@npm:1.0.34" + dependencies: + core-util-is: ~1.0.0 + inherits: ~2.0.1 + isarray: 0.0.1 + string_decoder: ~0.10.x + checksum: 85042c537e4f067daa1448a7e257a201070bfec3dd2706abdbd8ebc7f3418eb4d3ed4b8e5af63e2544d69f88ab09c28d5da3c0b77dc76185fddd189a59863b60 + languageName: node + linkType: hard + "readdirp@npm:~3.6.0": version: 3.6.0 resolution: "readdirp@npm:3.6.0" @@ -16539,6 +17279,15 @@ __metadata: languageName: node linkType: hard +"rechoir@npm:^0.7.0": + version: 0.7.1 + resolution: "rechoir@npm:0.7.1" + dependencies: + resolve: ^1.9.0 + checksum: 2a04aab4e28c05fcd6ee6768446bc8b859d8f108e71fc7f5bcbc5ef25e53330ce2c11d10f82a24591a2df4c49c4f61feabe1fd11f844c66feedd4cd7bb61146a + languageName: node + linkType: hard + "recursive-readdir@npm:^2.2.2": version: 2.2.3 resolution: "recursive-readdir@npm:2.2.3" @@ -16940,6 +17689,15 @@ __metadata: languageName: node linkType: hard +"resolve-cwd@npm:^3.0.0": + version: 3.0.0 + resolution: "resolve-cwd@npm:3.0.0" + dependencies: + resolve-from: ^5.0.0 + checksum: 546e0816012d65778e580ad62b29e975a642989108d9a3c5beabfb2304192fa3c9f9146fbdfe213563c6ff51975ae41bac1d3c6e047dd9572c94863a057b4d81 + languageName: node + linkType: hard + "resolve-from@npm:^4.0.0": version: 4.0.0 resolution: "resolve-from@npm:4.0.0" @@ -16947,6 +17705,13 @@ __metadata: languageName: node linkType: hard +"resolve-from@npm:^5.0.0": + version: 5.0.0 + resolution: "resolve-from@npm:5.0.0" + checksum: 4ceeb9113e1b1372d0cd969f3468fa042daa1dd9527b1b6bb88acb6ab55d8b9cd65dbf18819f9f9ddf0db804990901dcdaade80a215e7b2c23daae38e64f5bdf + languageName: node + linkType: hard + "resolve-path@npm:^1.4.0": version: 1.4.0 resolution: "resolve-path@npm:1.4.0" @@ -16980,7 +17745,7 @@ __metadata: languageName: node linkType: hard -"resolve@npm:^1.1.6, resolve@npm:^1.14.2, resolve@npm:^1.19.0, resolve@npm:^1.3.2": +"resolve@npm:^1.1.6, resolve@npm:^1.14.2, resolve@npm:^1.19.0, resolve@npm:^1.3.2, resolve@npm:^1.9.0": version: 1.22.8 resolution: "resolve@npm:1.22.8" dependencies: @@ -17002,7 +17767,7 @@ __metadata: languageName: node linkType: hard -"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.3.2#~builtin": +"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.3.2#~builtin, resolve@patch:resolve@^1.9.0#~builtin": version: 1.22.8 resolution: "resolve@patch:resolve@npm%3A1.22.8#~builtin::version=1.22.8&hash=c3c19d" dependencies: @@ -17369,6 +18134,15 @@ __metadata: languageName: node linkType: hard +"semver@npm:~2.3.1": + version: 2.3.2 + resolution: "semver@npm:2.3.2" + bin: + semver: ./bin/semver + checksum: e0649fb18a1da909df7b5a6f586314a7f6e052385fc1e6eafa7084dd77c0787e755ab35ca491f9eec986fe1d0d6d36eae85a21eb7e2ed32ae5906796acb92c56 + languageName: node + linkType: hard + "send@npm:0.18.0": version: 0.18.0 resolution: "send@npm:0.18.0" @@ -17775,7 +18549,7 @@ __metadata: languageName: node linkType: hard -"source-map@npm:^0.7.0, source-map@npm:^0.7.3": +"source-map@npm:^0.7.0, source-map@npm:^0.7.3, source-map@npm:^0.7.4": version: 0.7.4 resolution: "source-map@npm:0.7.4" checksum: 01cc5a74b1f0e1d626a58d36ad6898ea820567e87f18dfc9d24a9843a351aaa2ec09b87422589906d6ff1deed29693e176194dc88bcae7c9a852dc74b311dbf5 @@ -17929,6 +18703,13 @@ __metadata: languageName: node linkType: hard +"string-range@npm:~1.2, string-range@npm:~1.2.1": + version: 1.2.2 + resolution: "string-range@npm:1.2.2" + checksum: 7118cc83a7e63fca5fd8bef9b61464bfc51197b5f6dc475c9e1d24a93ce02fa27f7adb4cd7adac5daf599bde442b383608078f9b051bddb108d3b45840923097 + languageName: node + linkType: hard + "string-to-stream@npm:^3.0.1": version: 3.0.1 resolution: "string-to-stream@npm:3.0.1" @@ -17960,7 +18741,7 @@ __metadata: languageName: node linkType: hard -"string_decoder@npm:^1.1.1": +"string_decoder@npm:^1.1.1, string_decoder@npm:^1.3.0": version: 1.3.0 resolution: "string_decoder@npm:1.3.0" dependencies: @@ -17969,6 +18750,13 @@ __metadata: languageName: node linkType: hard +"string_decoder@npm:~0.10.x": + version: 0.10.31 + resolution: "string_decoder@npm:0.10.31" + checksum: fe00f8e303647e5db919948ccb5ce0da7dea209ab54702894dd0c664edd98e5d4df4b80d6fabf7b9e92b237359d21136c95bf068b2f7760b772ca974ba970202 + languageName: node + linkType: hard + "string_decoder@npm:~1.1.1": version: 1.1.1 resolution: "string_decoder@npm:1.1.1" @@ -18293,6 +19081,13 @@ __metadata: languageName: node linkType: hard +"text-encoding@npm:^0.7.0": + version: 0.7.0 + resolution: "text-encoding@npm:0.7.0" + checksum: b6109a843fb1b8748b32e1ecd6df74d370f46c13ac136bcb6ca15db70209bb0b8ec1f296ebb4b0dd9961150e205dcc044b89f8cf7657f6faef78c7569a2a81bc + languageName: node + linkType: hard + "text-table@npm:^0.2.0": version: 0.2.0 resolution: "text-table@npm:0.2.0" @@ -18462,6 +19257,22 @@ __metadata: languageName: node linkType: hard +"ts-loader@npm:^9.5.1": + version: 9.5.1 + resolution: "ts-loader@npm:9.5.1" + dependencies: + chalk: ^4.1.0 + enhanced-resolve: ^5.0.0 + micromatch: ^4.0.0 + semver: ^7.3.4 + source-map: ^0.7.4 + peerDependencies: + typescript: "*" + webpack: ^5.0.0 + checksum: 7cf396e656d905388ea2a9b5e82f16d3c955fda8d3df2fbf219f4bee16ff50a3c995c44ae3e584634e9443f056cec70bb3151add3917ffb4588ecd7394bac0ec + languageName: node + linkType: hard + "ts-node@npm:^10.9.1": version: 10.9.2 resolution: "ts-node@npm:10.9.2" @@ -18664,6 +19475,20 @@ __metadata: languageName: node linkType: hard +"typedarray-to-buffer@npm:~1.0.0": + version: 1.0.4 + resolution: "typedarray-to-buffer@npm:1.0.4" + checksum: ac6989c456a0b175c8362b3ebbd8a74af7b9bcc94f9dc9ffd34436569cd29aea6a1e0e5f5752d0d5bd855a55b2520e960d1d4cb9c9149f863ce09220540df17f + languageName: node + linkType: hard + +"typedarray@npm:^0.0.6": + version: 0.0.6 + resolution: "typedarray@npm:0.0.6" + checksum: 33b39f3d0e8463985eeaeeacc3cb2e28bc3dfaf2a5ed219628c0b629d5d7b810b0eb2165f9f607c34871d5daa92ba1dc69f49051cf7d578b4cbd26c340b9d1b1 + languageName: node + linkType: hard + "typedoc-plugin-frontmatter@npm:^0.0.2": version: 0.0.2 resolution: "typedoc-plugin-frontmatter@npm:0.0.2" @@ -19129,6 +19954,15 @@ __metadata: languageName: node linkType: hard +"unzipit@npm:^1.4.3": + version: 1.4.3 + resolution: "unzipit@npm:1.4.3" + dependencies: + uzip-module: ^1.0.2 + checksum: ce29348edab7b5fb5b7b4d43437f48e35812ac8b3cc2d76efd1acfcad6dd1b96b4f96bfd03250a724b87ba99dd531d7727ad24b590acf727dde79f54f5e779ed + languageName: node + linkType: hard + "update-browserslist-db@npm:^1.0.13": version: 1.0.13 resolution: "update-browserslist-db@npm:1.0.13" @@ -19232,6 +20066,16 @@ __metadata: languageName: node linkType: hard +"url@npm:^0.11.3": + version: 0.11.3 + resolution: "url@npm:0.11.3" + dependencies: + punycode: ^1.4.1 + qs: ^6.11.2 + checksum: f9e7886f46a16f96d2e42fbcc5d682c231c55ef5442c1ff66150c0f6556f6e3a97d094a84f51be15ec2432711d212eb60426659ce418f5fcadeaa3f601532c4e + languageName: node + linkType: hard + "util-deprecate@npm:^1.0.1, util-deprecate@npm:^1.0.2, util-deprecate@npm:~1.0.1": version: 1.0.2 resolution: "util-deprecate@npm:1.0.2" @@ -19239,6 +20083,19 @@ __metadata: languageName: node linkType: hard +"util@npm:^0.12.5": + version: 0.12.5 + resolution: "util@npm:0.12.5" + dependencies: + inherits: ^2.0.3 + is-arguments: ^1.0.4 + is-generator-function: ^1.0.7 + is-typed-array: ^1.1.3 + which-typed-array: ^1.1.2 + checksum: 705e51f0de5b446f4edec10739752ac25856541e0254ea1e7e45e5b9f9b0cb105bc4bd415736a6210edc68245a7f903bf085ffb08dd7deb8a0e847f60538a38a + languageName: node + linkType: hard + "utila@npm:~0.4": version: 0.4.0 resolution: "utila@npm:0.4.0" @@ -19283,6 +20140,13 @@ __metadata: languageName: node linkType: hard +"uzip-module@npm:^1.0.2": + version: 1.0.3 + resolution: "uzip-module@npm:1.0.3" + checksum: fc286c44a04d75055577fae8293d3fee499d1e850f87e88c158b1e3657f4794a3a40ca2d34f73474ff82917176dd5ca9d1c0d1e375a083714e11afabd3afa423 + languageName: node + linkType: hard + "v8-compile-cache-lib@npm:^3.0.1": version: 3.0.1 resolution: "v8-compile-cache-lib@npm:3.0.1" @@ -19404,7 +20268,7 @@ __metadata: languageName: node linkType: hard -"watchpack@npm:^2.4.0": +"watchpack@npm:^2.1.1, watchpack@npm:^2.4.0": version: 2.4.0 resolution: "watchpack@npm:2.4.0" dependencies: @@ -19481,6 +20345,39 @@ __metadata: languageName: node linkType: hard +"webpack-cli@npm:^4.7.2": + version: 4.10.0 + resolution: "webpack-cli@npm:4.10.0" + dependencies: + "@discoveryjs/json-ext": ^0.5.0 + "@webpack-cli/configtest": ^1.2.0 + "@webpack-cli/info": ^1.5.0 + "@webpack-cli/serve": ^1.7.0 + colorette: ^2.0.14 + commander: ^7.0.0 + cross-spawn: ^7.0.3 + fastest-levenshtein: ^1.0.12 + import-local: ^3.0.2 + interpret: ^2.2.0 + rechoir: ^0.7.0 + webpack-merge: ^5.7.3 + peerDependencies: + webpack: 4.x.x || 5.x.x + peerDependenciesMeta: + "@webpack-cli/generators": + optional: true + "@webpack-cli/migrate": + optional: true + webpack-bundle-analyzer: + optional: true + webpack-dev-server: + optional: true + bin: + webpack-cli: bin/cli.js + checksum: 2ff5355ac348e6b40f2630a203b981728834dca96d6d621be96249764b2d0fc01dd54edfcc37f02214d02935de2cf0eefd6ce689d970d154ef493f01ba922390 + languageName: node + linkType: hard + "webpack-dev-middleware@npm:^5.3.1": version: 5.3.3 resolution: "webpack-dev-middleware@npm:5.3.3" @@ -19543,7 +20440,7 @@ __metadata: languageName: node linkType: hard -"webpack-merge@npm:^5.8.0, webpack-merge@npm:^5.9.0": +"webpack-merge@npm:^5.7.3, webpack-merge@npm:^5.8.0, webpack-merge@npm:^5.9.0": version: 5.10.0 resolution: "webpack-merge@npm:5.10.0" dependencies: @@ -19561,7 +20458,7 @@ __metadata: languageName: node linkType: hard -"webpack@npm:^5.73.0, webpack@npm:^5.88.1": +"webpack@npm:^5.49.0, webpack@npm:^5.73.0, webpack@npm:^5.88.1": version: 5.89.0 resolution: "webpack@npm:5.89.0" dependencies: @@ -19650,6 +20547,19 @@ __metadata: languageName: node linkType: hard +"which-typed-array@npm:^1.1.11, which-typed-array@npm:^1.1.2": + version: 1.1.13 + resolution: "which-typed-array@npm:1.1.13" + dependencies: + available-typed-arrays: ^1.0.5 + call-bind: ^1.0.4 + for-each: ^0.3.3 + gopd: ^1.0.1 + has-tostringtag: ^1.0.0 + checksum: 3828a0d5d72c800e369d447e54c7620742a4cc0c9baf1b5e8c17e9b6ff90d8d861a3a6dd4800f1953dbf80e5e5cec954a289e5b4a223e3bee4aeb1f8c5f33309 + languageName: node + linkType: hard + "which@npm:^1.3.1": version: 1.3.1 resolution: "which@npm:1.3.1" @@ -19884,6 +20794,13 @@ __metadata: languageName: node linkType: hard +"xtend@npm:^2.2.0": + version: 2.2.0 + resolution: "xtend@npm:2.2.0" + checksum: 9fcd1ddabefdb3c68a698b08177525ad14a6df3423b13bad9a53900d19374e476a43c219b0756d39675776b2326a35fe477c547cfb8a05ae9fea4ba2235bebe2 + languageName: node + linkType: hard + "xtend@npm:^4.0.0, xtend@npm:^4.0.1": version: 4.0.2 resolution: "xtend@npm:4.0.2" @@ -19891,6 +20808,32 @@ __metadata: languageName: node linkType: hard +"xtend@npm:~2.0.4": + version: 2.0.6 + resolution: "xtend@npm:2.0.6" + dependencies: + is-object: ~0.1.2 + object-keys: ~0.2.0 + checksum: 414531e51cbc56d4676ae2b3a4070052e0c7a36caf7ee74f2e8449fe0fc1752b971a776fca5b85ec02ef3d0a33b8e75491d900474b8407f3f4bba3f49325a785 + languageName: node + linkType: hard + +"xtend@npm:~2.1.2": + version: 2.1.2 + resolution: "xtend@npm:2.1.2" + dependencies: + object-keys: ~0.4.0 + checksum: a8b79f31502c163205984eaa2b196051cd2fab0882b49758e30f2f9018255bc6c462e32a090bf3385d1bda04755ad8cc0052a09e049b0038f49eb9b950d9c447 + languageName: node + linkType: hard + +"xtend@npm:~3.0.0": + version: 3.0.0 + resolution: "xtend@npm:3.0.0" + checksum: ecdc4dd74f26e561dbc13d4148fcc7b8f46f49b9259862fc31e42b7cede9eee62af9d869050a7b8e089475e858744a74ceae3f0da2943755ef712f3277ad2e50 + languageName: node + linkType: hard + "y18n@npm:^5.0.5": version: 5.0.8 resolution: "y18n@npm:5.0.8" From 29c1ddaf4e0ce8ae7903a27f26aaebeee173fa61 Mon Sep 17 00:00:00 2001 From: thunkar Date: Mon, 18 Dec 2023 06:19:43 +0000 Subject: [PATCH 02/37] Moving tests to jest --- .vscode/settings.json | 7 +++++++ compiler/wasm/.eslintrc.js | 2 +- compiler/wasm/.gitignore | 3 ++- compiler/wasm/.mocharc.json | 7 ------- compiler/wasm/package.json | 13 ++++++++++-- compiler/wasm/test/node/index.test.ts | 25 ++++++++++++------------ compiler/wasm/web-test-runner.config.mjs | 19 +++++++++--------- release-tests/test/utils/nargo.js | 2 +- 8 files changed, 44 insertions(+), 34 deletions(-) delete mode 100644 compiler/wasm/.mocharc.json diff --git a/.vscode/settings.json b/.vscode/settings.json index 171d36f4e04..8a942e92eb8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,5 +18,12 @@ }, "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "jestrunner.projectPath": "./", + "jestrunner.debugOptions": { + "runtimeArgs": ["--experimental-vm-modules"], + "env": { + "NODE_NO_WARNINGS": 1 + } } } diff --git a/compiler/wasm/.eslintrc.js b/compiler/wasm/.eslintrc.js index 33335c2a877..5a2cc7f1ec0 100644 --- a/compiler/wasm/.eslintrc.js +++ b/compiler/wasm/.eslintrc.js @@ -1,3 +1,3 @@ module.exports = { - extends: ["../../.eslintrc.js"], + extends: ['../../.eslintrc.js'], }; diff --git a/compiler/wasm/.gitignore b/compiler/wasm/.gitignore index 47f2e0067b3..f9d4af3fe3b 100644 --- a/compiler/wasm/.gitignore +++ b/compiler/wasm/.gitignore @@ -1,2 +1,3 @@ noir-script/target -dist/ \ No newline at end of file +dist +build diff --git a/compiler/wasm/.mocharc.json b/compiler/wasm/.mocharc.json deleted file mode 100644 index 5e3ee32d901..00000000000 --- a/compiler/wasm/.mocharc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extension": [ - "ts" - ], - "spec": "test/node/**/*.test.ts", - "require": "ts-node/register" -} \ No newline at end of file diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index 7163bb0bec2..52205e21ea4 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -35,10 +35,14 @@ "@babel/plugin-transform-private-methods": "^7.23.3", "@babel/preset-env": "^7.23.5", "@babel/preset-typescript": "^7.23.3", - "@esm-bundle/chai": "^4.3.4-fix.0", + "@jest/globals": "^29.7.0", "@ltd/j-toml": "^1.38.0", "@types/babel__preset-env": "^7", + "@types/jest": "^29.5.11", + "@types/lodash.capitalize": "^4", "@types/lodash.compact": "^3", + "@types/lodash.times": "^4", + "@types/lodash.upperfirst": "^4", "@types/node": "^20.10.0", "@types/pako": "^2", "@types/path-browserify": "^1", @@ -54,13 +58,18 @@ "copy-webpack-plugin": "^11.0.0", "file-loader": "^6.2.0", "html-webpack-plugin": "^5.5.4", + "jest": "^29.7.0", + "lodash.capitalize": "^4.2.1", "lodash.compact": "^3.0.1", - "mocha": "^10.2.0", + "lodash.times": "^4.3.2", + "lodash.upperfirst": "^4.3.1", + "memfs": "^4.6.0", "pako": "^2.1.0", "path-browserify": "^1.0.1", "process": "^0.11.10", "readable-stream": "^4.4.2", "text-encoding": "^0.7.0", + "ts-jest": "^29.1.1", "ts-loader": "^9.5.1", "ts-node": "^10.9.1", "typescript": "~5.2.2", diff --git a/compiler/wasm/test/node/index.test.ts b/compiler/wasm/test/node/index.test.ts index 5cf9e3be2df..8ef147dd33d 100644 --- a/compiler/wasm/test/node/index.test.ts +++ b/compiler/wasm/test/node/index.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { depsScriptSourcePath, depsScriptExpectedArtifact, @@ -9,7 +8,9 @@ import { } from '../shared'; import { readFileSync } from 'node:fs'; import { join, resolve } from 'node:path'; -import { compile, PathToFileSourceMap } from '@noir-lang/noir_wasm'; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore +import wasm, { compile } from '../../dist/node/main'; // eslint-disable-next-line @typescript-eslint/no-explicit-any async function getPrecompiledSource(path: string): Promise { @@ -20,7 +21,7 @@ async function getPrecompiledSource(path: string): Promise { describe('noir wasm compilation', () => { describe('can compile simple scripts', () => { it('matching nargos compilation', async () => { - const sourceMap = new PathToFileSourceMap(); + const sourceMap = new wasm.default.PathToFileSourceMap(); sourceMap.add_source_code( join(__dirname, simpleScriptSourcePath), readFileSync(join(__dirname, simpleScriptSourcePath), 'utf-8'), @@ -33,14 +34,14 @@ describe('noir wasm compilation', () => { } // We don't expect the hashes to match due to how `noir_wasm` handles dependencies - expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); - expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); - expect(wasmCircuit.program.backend).to.eq(cliCircuit.backend); - }).timeout(10e3); + expect(wasmCircuit.program.bytecode).toEqual(cliCircuit.bytecode); + expect(wasmCircuit.program.abi).toEqual(cliCircuit.abi); + expect(wasmCircuit.program.backend).toEqual(cliCircuit.backend); + }); }); describe('can compile scripts with dependencies', () => { - const sourceMap: PathToFileSourceMap = new PathToFileSourceMap(); + const sourceMap = new wasm.default.PathToFileSourceMap(); beforeEach(() => { sourceMap.add_source_code('script/main.nr', readFileSync(join(__dirname, depsScriptSourcePath), 'utf-8')); sourceMap.add_source_code('lib_a/lib.nr', readFileSync(join(__dirname, libASourcePath), 'utf-8')); @@ -67,9 +68,9 @@ describe('noir wasm compilation', () => { } // We don't expect the hashes to match due to how `noir_wasm` handles dependencies - expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); - expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); - expect(wasmCircuit.program.backend).to.eq(cliCircuit.backend); - }).timeout(10e3); + expect(wasmCircuit.program.bytecode).toEqual(cliCircuit.bytecode); + expect(wasmCircuit.program.abi).toEqual(cliCircuit.abi); + expect(wasmCircuit.program.backend).toEqual(cliCircuit.backend); + }); }); }); diff --git a/compiler/wasm/web-test-runner.config.mjs b/compiler/wasm/web-test-runner.config.mjs index 3fd65d56618..1bf0463fecb 100644 --- a/compiler/wasm/web-test-runner.config.mjs +++ b/compiler/wasm/web-test-runner.config.mjs @@ -1,14 +1,14 @@ -import { defaultReporter } from "@web/test-runner"; -import { summaryReporter } from "@web/test-runner"; -import { fileURLToPath } from "url"; -import { esbuildPlugin } from "@web/dev-server-esbuild"; -import { playwrightLauncher } from "@web/test-runner-playwright"; +import { defaultReporter } from '@web/test-runner'; +import { summaryReporter } from '@web/test-runner'; +import { fileURLToPath } from 'url'; +import { esbuildPlugin } from '@web/dev-server-esbuild'; +import { playwrightLauncher } from '@web/test-runner-playwright'; const reporter = process.env.CI ? summaryReporter() : defaultReporter(); export default { browsers: [ - playwrightLauncher({ product: "chromium" }), + playwrightLauncher({ product: 'chromium' }), // playwrightLauncher({ product: "webkit" }), // playwrightLauncher({ product: "firefox" }), ], @@ -17,15 +17,14 @@ export default { ts: true, }), ], - files: ["test/browser/**/*.test.ts"], + files: ['test/browser/**/*.test.mjs'], nodeResolve: true, testFramework: { config: { - ui: "bdd", + ui: 'bdd', timeout: 40000, }, }, - rootDir: fileURLToPath(new URL('./../../', import.meta.url)), + rootDir: fileURLToPath(new URL('./../../', import.meta.url)), reporters: [reporter], - }; diff --git a/release-tests/test/utils/nargo.js b/release-tests/test/utils/nargo.js index 537cdfc8be5..6fcaccbcde7 100644 --- a/release-tests/test/utils/nargo.js +++ b/release-tests/test/utils/nargo.js @@ -1,3 +1,3 @@ -import { default as path } from "node:path"; +import { default as path } from "path"; export const NARGO_BIN = process.env.NARGO_BIN ? path.resolve(process.env.NARGO_BIN) : "nargo"; From d40c1eff9cd2d41247e5c65a272ebbb9f1f3fb47 Mon Sep 17 00:00:00 2001 From: thunkar Date: Mon, 18 Dec 2023 09:26:58 +0000 Subject: [PATCH 03/37] Fixed CJS compilation --- compiler/wasm/package.json | 6 +- .../wasm/public/fixtures/deps/test_lib.zip | Bin 0 -> 1198 bytes .../public/fixtures/test_contract/Nargo.toml | 8 + .../public/fixtures/test_contract/src/main.nr | 12 + .../wasm/public/fixtures/test_lib/Nargo.toml | 7 + .../wasm/public/fixtures/test_lib/src/lib.nr | 1 + .../public/fixtures/test_lib/src/module.nr | 1 + .../fixtures/test_lib/src/module/foo.nr | 3 + .../wasm/src/types/noir_package_config.ts | 21 +- .../dependencies/dependency-manager.test.ts | 9 +- .../github-dependency-resolver.test.ts | 25 +- .../local-dependency-resolver.test.ts | 14 +- .../file-manager/file-manager.test.ts | 12 +- compiler/wasm/test/shared.ts | 17 +- .../test/{ => wasm}/browser/index.test.ts | 25 +- .../wasm/test/{ => wasm}/node/index.test.ts | 33 +- compiler/wasm/tsconfig.cjs.json | 1 - compiler/wasm/tsconfig.esm.json | 1 - compiler/wasm/tsconfig.json | 4 +- compiler/wasm/webpack.config.ts | 1 + yarn.lock | 1531 ++++++++++++++++- 21 files changed, 1557 insertions(+), 175 deletions(-) create mode 100644 compiler/wasm/public/fixtures/deps/test_lib.zip create mode 100644 compiler/wasm/public/fixtures/test_contract/Nargo.toml create mode 100644 compiler/wasm/public/fixtures/test_contract/src/main.nr create mode 100644 compiler/wasm/public/fixtures/test_lib/Nargo.toml create mode 100644 compiler/wasm/public/fixtures/test_lib/src/lib.nr create mode 100644 compiler/wasm/public/fixtures/test_lib/src/module.nr create mode 100644 compiler/wasm/public/fixtures/test_lib/src/module/foo.nr rename compiler/wasm/{src/noir => test}/dependencies/dependency-manager.test.ts (88%) rename compiler/wasm/{src/noir => test}/dependencies/github-dependency-resolver.test.ts (81%) rename compiler/wasm/{src/noir => test}/dependencies/local-dependency-resolver.test.ts (77%) rename compiler/wasm/{src/noir => test}/file-manager/file-manager.test.ts (88%) rename compiler/wasm/test/{ => wasm}/browser/index.test.ts (77%) rename compiler/wasm/test/{ => wasm}/node/index.test.ts (60%) diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index 52205e21ea4..941aad0a9f3 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -20,10 +20,10 @@ "scripts": { "serve": "webpack serve", "build": "webpack", - "test": "yarn test:node", - "test:node": "mocha", + "test": "yarn test:node && yarn test:browser", + "test:node": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests", "test:browser": "web-test-runner", - "clean": "chmod u+w web nodejs || true && rm -rf ./nodejs ./web ./target ./result", + "clean": "chmod u+w web nodejs || true && rm -rf ./build ./target ./dist", "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", "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0", diff --git a/compiler/wasm/public/fixtures/deps/test_lib.zip b/compiler/wasm/public/fixtures/deps/test_lib.zip new file mode 100644 index 0000000000000000000000000000000000000000..e5004ee2eceff5ec1ed39df5b9e4955e03770b59 GIT binary patch literal 1198 zcmWIWW@Zs#U|`^2uyu0_XPcmG9tz~e1FNVo`d&UP*p#PG|@x z1GCvF`BY05gVfRrZU#n{uu=vFFd=(7nyW!U!0qAp$ksDVi^MK?xg2`4ylu}yu`Rz( zT|fM@WZSzf);zA#3(}7AZmo=*`Q~b0$gArnn-!-!iS=)~qY)bP=YHXg8Mh`|zv=kW z*0V#=%F$Fm0O&$4pnDj=E(9~61TV4+i;I%=;ckn%qmS-3RAX*m;(N>uGzNrGJPI-f z=wZFQBDi5#Jer%Iq5#CDIjPpD=AP`cBT-WjvRhxG8wpEK#2Jj5 zgpdt(1cn7X5I}B4N>Id^4GKmW5Me+Lhnd*T1|}+eCL^K_HAx}6`Z*4hVF?VE`K)Xp Rm$Ct&G!p|uEf6y>008bOBar|A literal 0 HcmV?d00001 diff --git a/compiler/wasm/public/fixtures/test_contract/Nargo.toml b/compiler/wasm/public/fixtures/test_contract/Nargo.toml new file mode 100644 index 00000000000..44ea20e01ba --- /dev/null +++ b/compiler/wasm/public/fixtures/test_contract/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "test" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +test = { path = "../test_lib" } diff --git a/compiler/wasm/public/fixtures/test_contract/src/main.nr b/compiler/wasm/public/fixtures/test_contract/src/main.nr new file mode 100644 index 00000000000..b980af369cf --- /dev/null +++ b/compiler/wasm/public/fixtures/test_contract/src/main.nr @@ -0,0 +1,12 @@ +contract TestContract { + use dep::test::module::foo; + + fn constructor(param: Field, pub_param: pub Field) -> pub [Field; 2] { + [foo::bar(param), param + pub_param] + } + + open fn openFunction() -> pub Field { + 42 + } + +} diff --git a/compiler/wasm/public/fixtures/test_lib/Nargo.toml b/compiler/wasm/public/fixtures/test_lib/Nargo.toml new file mode 100644 index 00000000000..fe1288f4a6e --- /dev/null +++ b/compiler/wasm/public/fixtures/test_lib/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "testlib" +authors = [""] +compiler_version = ">=0.18.0" +type = "lib" + +[dependencies] \ No newline at end of file diff --git a/compiler/wasm/public/fixtures/test_lib/src/lib.nr b/compiler/wasm/public/fixtures/test_lib/src/lib.nr new file mode 100644 index 00000000000..5c0b5a621e0 --- /dev/null +++ b/compiler/wasm/public/fixtures/test_lib/src/lib.nr @@ -0,0 +1 @@ +mod module; \ No newline at end of file diff --git a/compiler/wasm/public/fixtures/test_lib/src/module.nr b/compiler/wasm/public/fixtures/test_lib/src/module.nr new file mode 100644 index 00000000000..2746c97edf0 --- /dev/null +++ b/compiler/wasm/public/fixtures/test_lib/src/module.nr @@ -0,0 +1 @@ +mod foo; \ No newline at end of file diff --git a/compiler/wasm/public/fixtures/test_lib/src/module/foo.nr b/compiler/wasm/public/fixtures/test_lib/src/module/foo.nr new file mode 100644 index 00000000000..e0c82fb1960 --- /dev/null +++ b/compiler/wasm/public/fixtures/test_lib/src/module/foo.nr @@ -0,0 +1,3 @@ +pub fn bar(param: Field) -> Field { + dep::std::hash::pedersen_hash([param]) +} diff --git a/compiler/wasm/src/types/noir_package_config.ts b/compiler/wasm/src/types/noir_package_config.ts index 708ffcdd663..38876a6c661 100644 --- a/compiler/wasm/src/types/noir_package_config.ts +++ b/compiler/wasm/src/types/noir_package_config.ts @@ -8,22 +8,17 @@ type noirLocalDependencySchema = { path: string; }; -enum type { - lib = 'lib', - contract = 'contract', - bin = 'bin', -} - +type noirPackageType = 'lib' | 'contract' | 'bin'; type noirPackageConfigSchema = { package: { name: string; - type: type; - entry: string; - description: string; - authors: string[]; - compiler_version: string; - backend: string; - license: string; + type: noirPackageType; + entry?: string; + description?: string; + authors?: string[]; + compiler_version?: string; + backend?: string; + license?: string; }; dependencies: Record; }; diff --git a/compiler/wasm/src/noir/dependencies/dependency-manager.test.ts b/compiler/wasm/test/dependencies/dependency-manager.test.ts similarity index 88% rename from compiler/wasm/src/noir/dependencies/dependency-manager.test.ts rename to compiler/wasm/test/dependencies/dependency-manager.test.ts index 5f9ba570d4d..f72ff38eff2 100644 --- a/compiler/wasm/src/noir/dependencies/dependency-manager.test.ts +++ b/compiler/wasm/test/dependencies/dependency-manager.test.ts @@ -1,8 +1,7 @@ -import { NoirDependencyConfig } from '@aztec/foundation/noir'; - -import { NoirPackage } from '../package.js'; -import { NoirDependencyManager } from './dependency-manager.js'; -import { NoirDependency, NoirDependencyResolver } from './dependency-resolver.js'; +import { NoirDependencyConfig } from 'src/types/noir_package_config.js'; +import { NoirPackage } from '../../src/noir/package.js'; +import { NoirDependencyManager } from '../../src/noir/dependencies/dependency-manager.js'; +import { NoirDependency, NoirDependencyResolver } from '../../src/noir/dependencies/dependency-resolver.js'; describe('DependencyManager', () => { let manager: NoirDependencyManager; diff --git a/compiler/wasm/src/noir/dependencies/github-dependency-resolver.test.ts b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts similarity index 81% rename from compiler/wasm/src/noir/dependencies/github-dependency-resolver.test.ts rename to compiler/wasm/test/dependencies/github-dependency-resolver.test.ts index a4d4b603d37..1f56030a6d2 100644 --- a/compiler/wasm/src/noir/dependencies/github-dependency-resolver.test.ts +++ b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts @@ -1,18 +1,21 @@ -import { NoirGitDependencyConfig } from '@aztec/foundation/noir'; -import { fileURLToPath } from '@aztec/foundation/url'; - import { jest } from '@jest/globals'; import { Volume, createFsFromVolume } from 'memfs'; import { readFile } from 'node:fs/promises'; import { dirname, join } from 'path'; -import { FileManager } from '../file-manager/file-manager.js'; -import { createMemFSFileManager } from '../file-manager/memfs-file-manager.js'; -import { NoirPackage } from '../package.js'; -import { NoirDependencyResolver } from './dependency-resolver.js'; -import { GithubDependencyResolver, resolveGithubCodeArchive, safeFilename } from './github-dependency-resolver.js'; +import { FileManager } from '../../src/noir/file-manager/file-manager.js'; +import { createMemFSFileManager } from '../../src/noir/file-manager/memfs-file-manager.js'; +import { NoirPackage } from '../../src/noir/package.js'; +import { NoirDependencyResolver } from '../../src/noir/dependencies/dependency-resolver.js'; +import { + GithubDependencyResolver, + resolveGithubCodeArchive, + safeFilename, +} from '../../src/noir/dependencies/github-dependency-resolver.js'; +import { NoirGitDependencyConfig } from '../../src/types/noir_package_config.js'; +import { fileURLToPath } from '../../src/types/utils.js'; -const fixtures = join(dirname(fileURLToPath(import.meta.url)), '../../../fixtures'); +const fixtures = join(dirname(fileURLToPath(import.meta.url)), '../../public/fixtures'); describe('GithubDependencyResolver', () => { let resolver: NoirDependencyResolver; @@ -61,7 +64,9 @@ describe('GithubDependencyResolver', () => { }); it('resolves Github dependency', async () => { - fetchMock.mockResolvedValueOnce(new Response(await readFile(join(fixtures, 'test_lib.zip')), { status: 200 })); + fetchMock.mockResolvedValueOnce( + new Response(await readFile(join(fixtures, 'deps', 'test_lib.zip')), { status: 200 }), + ); const lib = await resolver.resolveDependency(pkg, libDependency); expect(lib).toBeDefined(); expect(lib!.version).toEqual(libDependency.tag); diff --git a/compiler/wasm/src/noir/dependencies/local-dependency-resolver.test.ts b/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts similarity index 77% rename from compiler/wasm/src/noir/dependencies/local-dependency-resolver.test.ts rename to compiler/wasm/test/dependencies/local-dependency-resolver.test.ts index 8cadfeeff92..e17180785d0 100644 --- a/compiler/wasm/src/noir/dependencies/local-dependency-resolver.test.ts +++ b/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts @@ -3,12 +3,12 @@ import { Volume } from 'memfs/lib/volume.js'; import { readFile } from 'node:fs/promises'; import { dirname, join } from 'path'; -import { FileManager } from '../file-manager/file-manager.js'; -import { createMemFSFileManager } from '../file-manager/memfs-file-manager.js'; -import { NoirPackage } from '../package.js'; -import { NoirDependencyResolver } from './dependency-resolver.js'; -import { LocalDependencyResolver } from './local-dependency-resolver.js'; -import { fileURLToPath } from '../../types/utils.js'; +import { FileManager } from '../../src/noir/file-manager/file-manager.js'; +import { createMemFSFileManager } from '../../src/noir/file-manager/memfs-file-manager.js'; +import { NoirPackage } from '../../src/noir/package.js'; +import { NoirDependencyResolver } from '../../src/noir/dependencies/dependency-resolver.js'; +import { LocalDependencyResolver } from '../../src/noir/dependencies/local-dependency-resolver.js'; +import { fileURLToPath } from '../../src/types/utils.js'; describe('DependencyResolver', () => { let resolver: NoirDependencyResolver; @@ -16,7 +16,7 @@ describe('DependencyResolver', () => { let pkg: NoirPackage; beforeEach(async () => { - const fixtures = join(dirname(fileURLToPath(import.meta.url)), '../../../fixtures'); + const fixtures = join(dirname(fileURLToPath(import.meta.url)), '../../public/fixtures'); const memFS = createFsFromVolume(new Volume()); memFS.mkdirSync('/test_contract/src', { recursive: true }); memFS.mkdirSync('/test_lib/src', { recursive: true }); diff --git a/compiler/wasm/src/noir/file-manager/file-manager.test.ts b/compiler/wasm/test/file-manager/file-manager.test.ts similarity index 88% rename from compiler/wasm/src/noir/file-manager/file-manager.test.ts rename to compiler/wasm/test/file-manager/file-manager.test.ts index 0e554526a07..7455d8c2e90 100644 --- a/compiler/wasm/src/noir/file-manager/file-manager.test.ts +++ b/compiler/wasm/test/file-manager/file-manager.test.ts @@ -1,11 +1,11 @@ import { Volume, createFsFromVolume } from 'memfs'; -import { existsSync, mkdtempSync, rmSync } from 'node:fs'; -import * as fs from 'node:fs/promises'; -import { tmpdir } from 'node:os'; -import { join } from 'node:path'; +import { existsSync, mkdtempSync, rmSync } from 'fs'; +import * as fs from 'fs/promises'; +import { tmpdir } from 'os'; +import { join } from 'path'; -import { FileManager, FileSystem } from './file-manager.js'; -import { createMemFSFileManager } from './memfs-file-manager.js'; +import { FileManager, FileSystem } from '../../src/noir/file-manager/file-manager.js'; +import { createMemFSFileManager } from '../../src/noir/file-manager/memfs-file-manager.js'; const memFS = (): { fm: FileManager; teardown: () => void } => { const fm = createMemFSFileManager(createFsFromVolume(new Volume()), '/'); diff --git a/compiler/wasm/test/shared.ts b/compiler/wasm/test/shared.ts index 6fc370f7ac8..d5f4d936384 100644 --- a/compiler/wasm/test/shared.ts +++ b/compiler/wasm/test/shared.ts @@ -1,8 +1,13 @@ -export const simpleScriptSourcePath = '../../fixtures/simple/noir-script/src/main.nr'; -export const simpleScriptExpectedArtifact = '../../fixtures/simple/noir-script/target/noir_wasm_testing.json'; +import { join, resolve } from 'path'; +import { fileURLToPath } from '../src/types/utils'; -export const depsScriptSourcePath = '../../fixtures/deps/noir-script/src/main.nr'; -export const depsScriptExpectedArtifact = '../../fixtures/deps/noir-script/target/noir_wasm_testing.json'; +const fixtures = resolve(fileURLToPath(import.meta.url), '../../public/fixtures'); -export const libASourcePath = '../../fixtures/deps/lib-a/src/lib.nr'; -export const libBSourcePath = '../../fixtures/deps/lib-b/src/lib.nr'; +export const simpleScriptSourcePath = join(fixtures, 'simple/noir-script/src/main.nr'); +export const simpleScriptExpectedArtifact = join(fixtures, 'simple/noir-script/target/noir_wasm_testing.json'); + +export const depsScriptSourcePath = join(fixtures, 'deps/noir-script/src/main.nr'); +export const depsScriptExpectedArtifact = join(fixtures, 'deps/noir-script/target/noir_wasm_testing.json'); + +export const libASourcePath = join(fixtures, 'deps/lib-a/src/lib.nr'); +export const libBSourcePath = join(fixtures, 'deps/lib-b/src/lib.nr'); diff --git a/compiler/wasm/test/browser/index.test.ts b/compiler/wasm/test/wasm/browser/index.test.ts similarity index 77% rename from compiler/wasm/test/browser/index.test.ts rename to compiler/wasm/test/wasm/browser/index.test.ts index 346c20c834c..b9dc00e600f 100644 --- a/compiler/wasm/test/browser/index.test.ts +++ b/compiler/wasm/test/wasm/browser/index.test.ts @@ -1,5 +1,3 @@ -import { expect } from '@esm-bundle/chai'; -import initNoirWasm, { PathToFileSourceMap, compile } from '@noir-lang/noir_wasm'; import { depsScriptExpectedArtifact, depsScriptSourcePath, @@ -7,11 +5,8 @@ import { libBSourcePath, simpleScriptExpectedArtifact, simpleScriptSourcePath, -} from '../shared'; - -beforeEach(async () => { - await initNoirWasm(); -}); +} from '../../shared'; +import { PathToFileSourceMap, compile } from '../../../build/esm'; async function getFileContent(path: string): Promise { const url = new URL(path, import.meta.url); @@ -39,10 +34,10 @@ describe('noir wasm', () => { } // We don't expect the hashes to match due to how `noir_wasm` handles dependencies - expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); - expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); - expect(wasmCircuit.program.backend).to.eq(cliCircuit.backend); - }).timeout(20e3); // 20 seconds + expect(wasmCircuit.program.bytecode).toEqual(cliCircuit.bytecode); + expect(wasmCircuit.program.abi).toEqual(cliCircuit.abi); + expect(wasmCircuit.program.backend).toEqual(cliCircuit.backend); + }); }); describe('can compile script with dependencies', () => { @@ -77,9 +72,9 @@ describe('noir wasm', () => { const cliCircuit = await getPrecompiledSource(depsScriptExpectedArtifact); // We don't expect the hashes to match due to how `noir_wasm` handles dependencies - expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); - expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); - expect(wasmCircuit.program.backend).to.eq(cliCircuit.backend); - }).timeout(20e3); // 20 seconds + expect(wasmCircuit.program.bytecode).toEqual(cliCircuit.bytecode); + expect(wasmCircuit.program.abi).toEqual(cliCircuit.abi); + expect(wasmCircuit.program.backend).toEqual(cliCircuit.backend); + }); }); }); diff --git a/compiler/wasm/test/node/index.test.ts b/compiler/wasm/test/wasm/node/index.test.ts similarity index 60% rename from compiler/wasm/test/node/index.test.ts rename to compiler/wasm/test/wasm/node/index.test.ts index 8ef147dd33d..e957c3fa0f2 100644 --- a/compiler/wasm/test/node/index.test.ts +++ b/compiler/wasm/test/wasm/node/index.test.ts @@ -5,28 +5,23 @@ import { libBSourcePath, simpleScriptSourcePath, simpleScriptExpectedArtifact, -} from '../shared'; -import { readFileSync } from 'node:fs'; -import { join, resolve } from 'node:path'; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore -import wasm, { compile } from '../../dist/node/main'; +} from '../../shared'; +import { readFileSync } from 'fs'; +import { resolve } from 'path'; + +import { compile, PathToFileSourceMap } from '../../../build/cjs'; -// eslint-disable-next-line @typescript-eslint/no-explicit-any async function getPrecompiledSource(path: string): Promise { - const compiledData = readFileSync(resolve(__dirname, path)).toString(); + const compiledData = readFileSync(resolve(import.meta.url, path)).toString(); return JSON.parse(compiledData); } describe('noir wasm compilation', () => { describe('can compile simple scripts', () => { it('matching nargos compilation', async () => { - const sourceMap = new wasm.default.PathToFileSourceMap(); - sourceMap.add_source_code( - join(__dirname, simpleScriptSourcePath), - readFileSync(join(__dirname, simpleScriptSourcePath), 'utf-8'), - ); - const wasmCircuit = await compile(join(__dirname, simpleScriptSourcePath), undefined, undefined, sourceMap); + const sourceMap = new PathToFileSourceMap(); + sourceMap.add_source_code(simpleScriptSourcePath, readFileSync(simpleScriptSourcePath, 'utf-8')); + const wasmCircuit = compile(simpleScriptSourcePath, undefined, undefined, sourceMap); const cliCircuit = await getPrecompiledSource(simpleScriptExpectedArtifact); if (!('program' in wasmCircuit)) { @@ -41,15 +36,15 @@ describe('noir wasm compilation', () => { }); describe('can compile scripts with dependencies', () => { - const sourceMap = new wasm.default.PathToFileSourceMap(); + const sourceMap = new PathToFileSourceMap(); beforeEach(() => { - sourceMap.add_source_code('script/main.nr', readFileSync(join(__dirname, depsScriptSourcePath), 'utf-8')); - sourceMap.add_source_code('lib_a/lib.nr', readFileSync(join(__dirname, libASourcePath), 'utf-8')); - sourceMap.add_source_code('lib_b/lib.nr', readFileSync(join(__dirname, libBSourcePath), 'utf-8')); + sourceMap.add_source_code('script/main.nr', readFileSync(depsScriptSourcePath, 'utf-8')); + sourceMap.add_source_code('lib_a/lib.nr', readFileSync(libASourcePath, 'utf-8')); + sourceMap.add_source_code('lib_b/lib.nr', readFileSync(libBSourcePath, 'utf-8')); }); it('matching nargos compilation', async () => { - const wasmCircuit = await compile( + const wasmCircuit = compile( 'script/main.nr', false, { diff --git a/compiler/wasm/tsconfig.cjs.json b/compiler/wasm/tsconfig.cjs.json index 62d6c8661a0..beb22971e7b 100644 --- a/compiler/wasm/tsconfig.cjs.json +++ b/compiler/wasm/tsconfig.cjs.json @@ -2,6 +2,5 @@ "extends": "./tsconfig.json", "compilerOptions": { "module": "CommonJS", - "target":"ESNext", }, } \ No newline at end of file diff --git a/compiler/wasm/tsconfig.esm.json b/compiler/wasm/tsconfig.esm.json index 4925831ac09..8480e151f43 100644 --- a/compiler/wasm/tsconfig.esm.json +++ b/compiler/wasm/tsconfig.esm.json @@ -5,6 +5,5 @@ }, "compilerOptions": { "module": "NodeNext", - "target":"ESNext", }, } \ No newline at end of file diff --git a/compiler/wasm/tsconfig.json b/compiler/wasm/tsconfig.json index aa3434f408a..6eeeb831f9e 100644 --- a/compiler/wasm/tsconfig.json +++ b/compiler/wasm/tsconfig.json @@ -11,6 +11,8 @@ "importHelpers": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, + "target": "ESNext", + "moduleResolution": "NodeNext" }, - "include": ["src/**/*.*ts"] + "include": ["src/**/*.*ts", "test/dependencies/dependency-manager.test.ts", "test/dependencies/github-dependency-resolver.test.ts", "test/dependencies/local-dependency-resolver.test.ts", "test/file-manager/file-manager.test.ts"] } \ No newline at end of file diff --git a/compiler/wasm/webpack.config.ts b/compiler/wasm/webpack.config.ts index 2eb758c2dad..4388004ea72 100644 --- a/compiler/wasm/webpack.config.ts +++ b/compiler/wasm/webpack.config.ts @@ -105,6 +105,7 @@ const nodeConfig: webpack.Configuration = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname), outDir: path.resolve(__dirname, './build/cjs'), + extraArgs: '--target nodejs', }), ], module: { diff --git a/yarn.lock b/yarn.lock index 48fe9a268f9..71121e7aabb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -235,7 +235,7 @@ __metadata: languageName: node linkType: hard -"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.12.11, @babel/code-frame@npm:^7.16.0, @babel/code-frame@npm:^7.22.13, @babel/code-frame@npm:^7.23.5, @babel/code-frame@npm:^7.8.3": +"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.12.11, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.16.0, @babel/code-frame@npm:^7.22.13, @babel/code-frame@npm:^7.23.5, @babel/code-frame@npm:^7.8.3": version: 7.23.5 resolution: "@babel/code-frame@npm:7.23.5" dependencies: @@ -276,6 +276,29 @@ __metadata: languageName: node linkType: hard +"@babel/core@npm:^7.11.6, @babel/core@npm:^7.12.3": + version: 7.23.6 + resolution: "@babel/core@npm:7.23.6" + dependencies: + "@ampproject/remapping": ^2.2.0 + "@babel/code-frame": ^7.23.5 + "@babel/generator": ^7.23.6 + "@babel/helper-compilation-targets": ^7.23.6 + "@babel/helper-module-transforms": ^7.23.3 + "@babel/helpers": ^7.23.6 + "@babel/parser": ^7.23.6 + "@babel/template": ^7.22.15 + "@babel/traverse": ^7.23.6 + "@babel/types": ^7.23.6 + convert-source-map: ^2.0.0 + debug: ^4.1.0 + gensync: ^1.0.0-beta.2 + json5: ^2.2.3 + semver: ^6.3.1 + checksum: 4bddd1b80394a64b2ee33eeb216e8a2a49ad3d74f0ca9ba678c84a37f4502b2540662d72530d78228a2a349fda837fa852eea5cd3ae28465d1188acc6055868e + languageName: node + linkType: hard + "@babel/core@npm:^7.18.6, @babel/core@npm:^7.19.6, @babel/core@npm:^7.23.3": version: 7.23.5 resolution: "@babel/core@npm:7.23.5" @@ -311,6 +334,18 @@ __metadata: languageName: node linkType: hard +"@babel/generator@npm:^7.23.6, @babel/generator@npm:^7.7.2": + version: 7.23.6 + resolution: "@babel/generator@npm:7.23.6" + dependencies: + "@babel/types": ^7.23.6 + "@jridgewell/gen-mapping": ^0.3.2 + "@jridgewell/trace-mapping": ^0.3.17 + jsesc: ^2.5.1 + checksum: 1a1a1c4eac210f174cd108d479464d053930a812798e09fee069377de39a893422df5b5b146199ead7239ae6d3a04697b45fc9ac6e38e0f6b76374390f91fc6c + languageName: node + linkType: hard + "@babel/helper-annotate-as-pure@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-annotate-as-pure@npm:7.22.5" @@ -599,6 +634,17 @@ __metadata: languageName: node linkType: hard +"@babel/helpers@npm:^7.23.6": + version: 7.23.6 + resolution: "@babel/helpers@npm:7.23.6" + dependencies: + "@babel/template": ^7.22.15 + "@babel/traverse": ^7.23.6 + "@babel/types": ^7.23.6 + checksum: c5ba62497e1d717161d107c4b3de727565c68b6b9f50f59d6298e613afeca8895799b227c256e06d362e565aec34e26fb5c675b9c3d25055c52b945a21c21e21 + languageName: node + linkType: hard + "@babel/highlight@npm:^7.23.4": version: 7.23.4 resolution: "@babel/highlight@npm:7.23.4" @@ -610,6 +656,15 @@ __metadata: languageName: node linkType: hard +"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.23.6": + version: 7.23.6 + resolution: "@babel/parser@npm:7.23.6" + bin: + parser: ./bin/babel-parser.js + checksum: 140801c43731a6c41fd193f5c02bc71fd647a0360ca616b23d2db8be4b9739b9f951a03fc7c2db4f9b9214f4b27c1074db0f18bc3fa653783082d5af7c8860d5 + languageName: node + linkType: hard + "@babel/parser@npm:^7.12.7, @babel/parser@npm:^7.18.8, @babel/parser@npm:^7.22.15, @babel/parser@npm:^7.22.7, @babel/parser@npm:^7.23.5": version: 7.23.5 resolution: "@babel/parser@npm:7.23.5" @@ -700,7 +755,18 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-class-properties@npm:^7.12.13": +"@babel/plugin-syntax-bigint@npm:^7.8.3": + version: 7.8.3 + resolution: "@babel/plugin-syntax-bigint@npm:7.8.3" + dependencies: + "@babel/helper-plugin-utils": ^7.8.0 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 3a10849d83e47aec50f367a9e56a6b22d662ddce643334b087f9828f4c3dd73bdc5909aaeabe123fed78515767f9ca43498a0e621c438d1cd2802d7fae3c9648 + languageName: node + linkType: hard + +"@babel/plugin-syntax-class-properties@npm:^7.12.13, @babel/plugin-syntax-class-properties@npm:^7.8.3": version: 7.12.13 resolution: "@babel/plugin-syntax-class-properties@npm:7.12.13" dependencies: @@ -766,7 +832,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-import-meta@npm:^7.10.4": +"@babel/plugin-syntax-import-meta@npm:^7.10.4, @babel/plugin-syntax-import-meta@npm:^7.8.3": version: 7.10.4 resolution: "@babel/plugin-syntax-import-meta@npm:7.10.4" dependencies: @@ -799,7 +865,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-jsx@npm:^7.23.3": +"@babel/plugin-syntax-jsx@npm:^7.23.3, @babel/plugin-syntax-jsx@npm:^7.7.2": version: 7.23.3 resolution: "@babel/plugin-syntax-jsx@npm:7.23.3" dependencies: @@ -810,7 +876,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-logical-assignment-operators@npm:^7.10.4": +"@babel/plugin-syntax-logical-assignment-operators@npm:^7.10.4, @babel/plugin-syntax-logical-assignment-operators@npm:^7.8.3": version: 7.10.4 resolution: "@babel/plugin-syntax-logical-assignment-operators@npm:7.10.4" dependencies: @@ -832,7 +898,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-numeric-separator@npm:^7.10.4": +"@babel/plugin-syntax-numeric-separator@npm:^7.10.4, @babel/plugin-syntax-numeric-separator@npm:^7.8.3": version: 7.10.4 resolution: "@babel/plugin-syntax-numeric-separator@npm:7.10.4" dependencies: @@ -887,7 +953,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-top-level-await@npm:^7.14.5": +"@babel/plugin-syntax-top-level-await@npm:^7.14.5, @babel/plugin-syntax-top-level-await@npm:^7.8.3": version: 7.14.5 resolution: "@babel/plugin-syntax-top-level-await@npm:7.14.5" dependencies: @@ -898,7 +964,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-typescript@npm:^7.23.3": +"@babel/plugin-syntax-typescript@npm:^7.23.3, @babel/plugin-syntax-typescript@npm:^7.7.2": version: 7.23.3 resolution: "@babel/plugin-syntax-typescript@npm:7.23.3" dependencies: @@ -1853,7 +1919,7 @@ __metadata: languageName: node linkType: hard -"@babel/template@npm:^7.12.7, @babel/template@npm:^7.22.15": +"@babel/template@npm:^7.12.7, @babel/template@npm:^7.22.15, @babel/template@npm:^7.3.3": version: 7.22.15 resolution: "@babel/template@npm:7.22.15" dependencies: @@ -1882,6 +1948,35 @@ __metadata: languageName: node linkType: hard +"@babel/traverse@npm:^7.23.6": + version: 7.23.6 + resolution: "@babel/traverse@npm:7.23.6" + dependencies: + "@babel/code-frame": ^7.23.5 + "@babel/generator": ^7.23.6 + "@babel/helper-environment-visitor": ^7.22.20 + "@babel/helper-function-name": ^7.23.0 + "@babel/helper-hoist-variables": ^7.22.5 + "@babel/helper-split-export-declaration": ^7.22.6 + "@babel/parser": ^7.23.6 + "@babel/types": ^7.23.6 + debug: ^4.3.1 + globals: ^11.1.0 + checksum: 48f2eac0e86b6cb60dab13a5ea6a26ba45c450262fccdffc334c01089e75935f7546be195e260e97f6e43cea419862eda095018531a2718fef8189153d479f88 + languageName: node + linkType: hard + +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.23.6, @babel/types@npm:^7.3.3": + version: 7.23.6 + resolution: "@babel/types@npm:7.23.6" + dependencies: + "@babel/helper-string-parser": ^7.23.4 + "@babel/helper-validator-identifier": ^7.22.20 + to-fast-properties: ^2.0.0 + checksum: 68187dbec0d637f79bc96263ac95ec8b06d424396678e7e225492be866414ce28ebc918a75354d4c28659be6efe30020b4f0f6df81cc418a2d30645b690a8de0 + languageName: node + linkType: hard + "@babel/types@npm:^7.12.7, @babel/types@npm:^7.20.0, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.5, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": version: 7.23.5 resolution: "@babel/types@npm:7.23.5" @@ -1893,6 +1988,13 @@ __metadata: languageName: node linkType: hard +"@bcoe/v8-coverage@npm:^0.2.3": + version: 0.2.3 + resolution: "@bcoe/v8-coverage@npm:0.2.3" + checksum: 850f9305536d0f2bd13e9e0881cb5f02e4f93fad1189f7b2d4bebf694e3206924eadee1068130d43c11b750efcc9405f88a8e42ef098b6d75239c0f047de1a27 + languageName: node + linkType: hard + "@chainsafe/as-sha256@npm:^0.3.1": version: 0.3.1 resolution: "@chainsafe/as-sha256@npm:0.3.1" @@ -3655,6 +3757,175 @@ __metadata: languageName: node linkType: hard +"@istanbuljs/load-nyc-config@npm:^1.0.0": + version: 1.1.0 + resolution: "@istanbuljs/load-nyc-config@npm:1.1.0" + dependencies: + camelcase: ^5.3.1 + find-up: ^4.1.0 + get-package-type: ^0.1.0 + js-yaml: ^3.13.1 + resolve-from: ^5.0.0 + checksum: d578da5e2e804d5c93228450a1380e1a3c691de4953acc162f387b717258512a3e07b83510a936d9fab03eac90817473917e24f5d16297af3867f59328d58568 + languageName: node + linkType: hard + +"@istanbuljs/schema@npm:^0.1.2": + version: 0.1.3 + resolution: "@istanbuljs/schema@npm:0.1.3" + checksum: 5282759d961d61350f33d9118d16bcaed914ebf8061a52f4fa474b2cb08720c9c81d165e13b82f2e5a8a212cc5af482f0c6fc1ac27b9e067e5394c9a6ed186c9 + languageName: node + linkType: hard + +"@jest/console@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/console@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + "@types/node": "*" + chalk: ^4.0.0 + jest-message-util: ^29.7.0 + jest-util: ^29.7.0 + slash: ^3.0.0 + checksum: 0e3624e32c5a8e7361e889db70b170876401b7d70f509a2538c31d5cd50deb0c1ae4b92dc63fe18a0902e0a48c590c21d53787a0df41a52b34fa7cab96c384d6 + languageName: node + linkType: hard + +"@jest/core@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/core@npm:29.7.0" + dependencies: + "@jest/console": ^29.7.0 + "@jest/reporters": ^29.7.0 + "@jest/test-result": ^29.7.0 + "@jest/transform": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/node": "*" + ansi-escapes: ^4.2.1 + chalk: ^4.0.0 + ci-info: ^3.2.0 + exit: ^0.1.2 + graceful-fs: ^4.2.9 + jest-changed-files: ^29.7.0 + jest-config: ^29.7.0 + jest-haste-map: ^29.7.0 + jest-message-util: ^29.7.0 + jest-regex-util: ^29.6.3 + jest-resolve: ^29.7.0 + jest-resolve-dependencies: ^29.7.0 + jest-runner: ^29.7.0 + jest-runtime: ^29.7.0 + jest-snapshot: ^29.7.0 + jest-util: ^29.7.0 + jest-validate: ^29.7.0 + jest-watcher: ^29.7.0 + micromatch: ^4.0.4 + pretty-format: ^29.7.0 + slash: ^3.0.0 + strip-ansi: ^6.0.0 + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + checksum: af759c9781cfc914553320446ce4e47775ae42779e73621c438feb1e4231a5d4862f84b1d8565926f2d1aab29b3ec3dcfdc84db28608bdf5f29867124ebcfc0d + languageName: node + linkType: hard + +"@jest/environment@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/environment@npm:29.7.0" + dependencies: + "@jest/fake-timers": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/node": "*" + jest-mock: ^29.7.0 + checksum: 6fb398143b2543d4b9b8d1c6dbce83fa5247f84f550330604be744e24c2bd2178bb893657d62d1b97cf2f24baf85c450223f8237cccb71192c36a38ea2272934 + languageName: node + linkType: hard + +"@jest/expect-utils@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/expect-utils@npm:29.7.0" + dependencies: + jest-get-type: ^29.6.3 + checksum: 75eb177f3d00b6331bcaa057e07c0ccb0733a1d0a1943e1d8db346779039cb7f103789f16e502f888a3096fb58c2300c38d1f3748b36a7fa762eb6f6d1b160ed + languageName: node + linkType: hard + +"@jest/expect@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/expect@npm:29.7.0" + dependencies: + expect: ^29.7.0 + jest-snapshot: ^29.7.0 + checksum: a01cb85fd9401bab3370618f4b9013b90c93536562222d920e702a0b575d239d74cecfe98010aaec7ad464f67cf534a353d92d181646a4b792acaa7e912ae55e + languageName: node + linkType: hard + +"@jest/fake-timers@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/fake-timers@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + "@sinonjs/fake-timers": ^10.0.2 + "@types/node": "*" + jest-message-util: ^29.7.0 + jest-mock: ^29.7.0 + jest-util: ^29.7.0 + checksum: caf2bbd11f71c9241b458d1b5a66cbe95debc5a15d96442444b5d5c7ba774f523c76627c6931cca5e10e76f0d08761f6f1f01a608898f4751a0eee54fc3d8d00 + languageName: node + linkType: hard + +"@jest/globals@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/globals@npm:29.7.0" + dependencies: + "@jest/environment": ^29.7.0 + "@jest/expect": ^29.7.0 + "@jest/types": ^29.6.3 + jest-mock: ^29.7.0 + checksum: 97dbb9459135693ad3a422e65ca1c250f03d82b2a77f6207e7fa0edd2c9d2015fbe4346f3dc9ebff1678b9d8da74754d4d440b7837497f8927059c0642a22123 + languageName: node + linkType: hard + +"@jest/reporters@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/reporters@npm:29.7.0" + dependencies: + "@bcoe/v8-coverage": ^0.2.3 + "@jest/console": ^29.7.0 + "@jest/test-result": ^29.7.0 + "@jest/transform": ^29.7.0 + "@jest/types": ^29.6.3 + "@jridgewell/trace-mapping": ^0.3.18 + "@types/node": "*" + chalk: ^4.0.0 + collect-v8-coverage: ^1.0.0 + exit: ^0.1.2 + glob: ^7.1.3 + graceful-fs: ^4.2.9 + istanbul-lib-coverage: ^3.0.0 + istanbul-lib-instrument: ^6.0.0 + istanbul-lib-report: ^3.0.0 + istanbul-lib-source-maps: ^4.0.0 + istanbul-reports: ^3.1.3 + jest-message-util: ^29.7.0 + jest-util: ^29.7.0 + jest-worker: ^29.7.0 + slash: ^3.0.0 + string-length: ^4.0.1 + strip-ansi: ^6.0.0 + v8-to-istanbul: ^9.0.1 + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + checksum: 7eadabd62cc344f629024b8a268ecc8367dba756152b761bdcb7b7e570a3864fc51b2a9810cd310d85e0a0173ef002ba4528d5ea0329fbf66ee2a3ada9c40455 + languageName: node + linkType: hard + "@jest/schemas@npm:^29.6.3": version: 29.6.3 resolution: "@jest/schemas@npm:29.6.3" @@ -3664,6 +3935,64 @@ __metadata: languageName: node linkType: hard +"@jest/source-map@npm:^29.6.3": + version: 29.6.3 + resolution: "@jest/source-map@npm:29.6.3" + dependencies: + "@jridgewell/trace-mapping": ^0.3.18 + callsites: ^3.0.0 + graceful-fs: ^4.2.9 + checksum: bcc5a8697d471396c0003b0bfa09722c3cd879ad697eb9c431e6164e2ea7008238a01a07193dfe3cbb48b1d258eb7251f6efcea36f64e1ebc464ea3c03ae2deb + languageName: node + linkType: hard + +"@jest/test-result@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/test-result@npm:29.7.0" + dependencies: + "@jest/console": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/istanbul-lib-coverage": ^2.0.0 + collect-v8-coverage: ^1.0.0 + checksum: 67b6317d526e335212e5da0e768e3b8ab8a53df110361b80761353ad23b6aea4432b7c5665bdeb87658ea373b90fb1afe02ed3611ef6c858c7fba377505057fa + languageName: node + linkType: hard + +"@jest/test-sequencer@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/test-sequencer@npm:29.7.0" + dependencies: + "@jest/test-result": ^29.7.0 + graceful-fs: ^4.2.9 + jest-haste-map: ^29.7.0 + slash: ^3.0.0 + checksum: 73f43599017946be85c0b6357993b038f875b796e2f0950487a82f4ebcb115fa12131932dd9904026b4ad8be131fe6e28bd8d0aa93b1563705185f9804bff8bd + languageName: node + linkType: hard + +"@jest/transform@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/transform@npm:29.7.0" + dependencies: + "@babel/core": ^7.11.6 + "@jest/types": ^29.6.3 + "@jridgewell/trace-mapping": ^0.3.18 + babel-plugin-istanbul: ^6.1.1 + chalk: ^4.0.0 + convert-source-map: ^2.0.0 + fast-json-stable-stringify: ^2.1.0 + graceful-fs: ^4.2.9 + jest-haste-map: ^29.7.0 + jest-regex-util: ^29.6.3 + jest-util: ^29.7.0 + micromatch: ^4.0.4 + pirates: ^4.0.4 + slash: ^3.0.0 + write-file-atomic: ^4.0.2 + checksum: 0f8ac9f413903b3cb6d240102db848f2a354f63971ab885833799a9964999dd51c388162106a807f810071f864302cdd8e3f0c241c29ce02d85a36f18f3f40ab + languageName: node + linkType: hard + "@jest/types@npm:^29.6.3": version: 29.6.3 resolution: "@jest/types@npm:29.6.3" @@ -3730,7 +4059,7 @@ __metadata: languageName: node linkType: hard -"@jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.9": +"@jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.18, @jridgewell/trace-mapping@npm:^0.3.9": version: 0.3.20 resolution: "@jridgewell/trace-mapping@npm:0.3.20" dependencies: @@ -4204,10 +4533,14 @@ __metadata: "@babel/plugin-transform-private-methods": ^7.23.3 "@babel/preset-env": ^7.23.5 "@babel/preset-typescript": ^7.23.3 - "@esm-bundle/chai": ^4.3.4-fix.0 + "@jest/globals": ^29.7.0 "@ltd/j-toml": ^1.38.0 "@types/babel__preset-env": ^7 + "@types/jest": ^29.5.11 + "@types/lodash.capitalize": ^4 "@types/lodash.compact": ^3 + "@types/lodash.times": ^4 + "@types/lodash.upperfirst": ^4 "@types/node": ^20.10.0 "@types/pako": ^2 "@types/path-browserify": ^1 @@ -4223,13 +4556,18 @@ __metadata: copy-webpack-plugin: ^11.0.0 file-loader: ^6.2.0 html-webpack-plugin: ^5.5.4 + jest: ^29.7.0 + lodash.capitalize: ^4.2.1 lodash.compact: ^3.0.1 - mocha: ^10.2.0 + lodash.times: ^4.3.2 + lodash.upperfirst: ^4.3.1 + memfs: ^4.6.0 pako: ^2.1.0 path-browserify: ^1.0.1 process: ^0.11.10 readable-stream: ^4.4.2 text-encoding: ^0.7.0 + ts-jest: ^29.1.1 ts-loader: ^9.5.1 ts-node: ^10.9.1 typescript: ~5.2.2 @@ -4915,6 +5253,24 @@ __metadata: languageName: node linkType: hard +"@sinonjs/commons@npm:^3.0.0": + version: 3.0.0 + resolution: "@sinonjs/commons@npm:3.0.0" + dependencies: + type-detect: 4.0.8 + checksum: b4b5b73d4df4560fb8c0c7b38c7ad4aeabedd362f3373859d804c988c725889cde33550e4bcc7cd316a30f5152a2d1d43db71b6d0c38f5feef71fd8d016763f8 + languageName: node + linkType: hard + +"@sinonjs/fake-timers@npm:^10.0.2": + version: 10.3.0 + resolution: "@sinonjs/fake-timers@npm:10.3.0" + dependencies: + "@sinonjs/commons": ^3.0.0 + checksum: 614d30cb4d5201550c940945d44c9e0b6d64a888ff2cd5b357f95ad6721070d6b8839cd10e15b76bf5e14af0bcc1d8f9ec00d49a46318f1f669a4bec1d7f3148 + languageName: node + linkType: hard + "@slorber/remark-comment@npm:^1.0.0": version: 1.0.0 resolution: "@slorber/remark-comment@npm:1.0.0" @@ -5171,6 +5527,28 @@ __metadata: languageName: node linkType: hard +"@types/babel__core@npm:^7.1.14": + version: 7.20.5 + resolution: "@types/babel__core@npm:7.20.5" + dependencies: + "@babel/parser": ^7.20.7 + "@babel/types": ^7.20.7 + "@types/babel__generator": "*" + "@types/babel__template": "*" + "@types/babel__traverse": "*" + checksum: a3226f7930b635ee7a5e72c8d51a357e799d19cbf9d445710fa39ab13804f79ab1a54b72ea7d8e504659c7dfc50675db974b526142c754398d7413aa4bc30845 + languageName: node + linkType: hard + +"@types/babel__generator@npm:*": + version: 7.6.8 + resolution: "@types/babel__generator@npm:7.6.8" + dependencies: + "@babel/types": ^7.0.0 + checksum: 5b332ea336a2efffbdeedb92b6781949b73498606ddd4205462f7d96dafd45ff3618770b41de04c4881e333dd84388bfb8afbdf6f2764cbd98be550d85c6bb48 + languageName: node + linkType: hard + "@types/babel__preset-env@npm:^7": version: 7.9.6 resolution: "@types/babel__preset-env@npm:7.9.6" @@ -5178,6 +5556,25 @@ __metadata: languageName: node linkType: hard +"@types/babel__template@npm:*": + version: 7.4.4 + resolution: "@types/babel__template@npm:7.4.4" + dependencies: + "@babel/parser": ^7.1.0 + "@babel/types": ^7.0.0 + checksum: d7a02d2a9b67e822694d8e6a7ddb8f2b71a1d6962dfd266554d2513eefbb205b33ca71a0d163b1caea3981ccf849211f9964d8bd0727124d18ace45aa6c9ae29 + languageName: node + linkType: hard + +"@types/babel__traverse@npm:*, @types/babel__traverse@npm:^7.0.6": + version: 7.20.4 + resolution: "@types/babel__traverse@npm:7.20.4" + dependencies: + "@babel/types": ^7.20.7 + checksum: f044ba80e00d07e46ee917c44f96cfc268fcf6d3871f7dfb8db8d3c6dab1508302f3e6bc508352a4a3ae627d2522e3fc500fa55907e0410a08e2e0902a8f3576 + languageName: node + linkType: hard + "@types/bn.js@npm:^4.11.3": version: 4.11.6 resolution: "@types/bn.js@npm:4.11.6" @@ -5385,6 +5782,15 @@ __metadata: languageName: node linkType: hard +"@types/graceful-fs@npm:^4.1.3": + version: 4.1.9 + resolution: "@types/graceful-fs@npm:4.1.9" + dependencies: + "@types/node": "*" + checksum: 79d746a8f053954bba36bd3d94a90c78de995d126289d656fb3271dd9f1229d33f678da04d10bce6be440494a5a73438e2e363e92802d16b8315b051036c5256 + languageName: node + linkType: hard + "@types/gtag.js@npm:^0.0.12": version: 0.0.12 resolution: "@types/gtag.js@npm:0.0.12" @@ -5479,6 +5885,16 @@ __metadata: languageName: node linkType: hard +"@types/jest@npm:^29.5.11": + version: 29.5.11 + resolution: "@types/jest@npm:29.5.11" + dependencies: + expect: ^29.0.0 + pretty-format: ^29.0.0 + checksum: f892a06ec9f0afa9a61cd7fa316ec614e21d4df1ad301b5a837787e046fcb40dfdf7f264a55e813ac6b9b633cb9d366bd5b8d1cea725e84102477b366df23fdd + languageName: node + linkType: hard + "@types/json-schema@npm:*, @types/json-schema@npm:^7.0.12, @types/json-schema@npm:^7.0.4, @types/json-schema@npm:^7.0.5, @types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9": version: 7.0.15 resolution: "@types/json-schema@npm:7.0.15" @@ -5534,6 +5950,15 @@ __metadata: languageName: node linkType: hard +"@types/lodash.capitalize@npm:^4": + version: 4.2.9 + resolution: "@types/lodash.capitalize@npm:4.2.9" + dependencies: + "@types/lodash": "*" + checksum: 54a9154b2084392986646335d5ed4902a89c24ce675cf8b8cfcd022f6a0eed71c30c2f8cc4b2682cfc5c55a5e1fdad2340609ba58db451dfdd41d82b14c88995 + languageName: node + linkType: hard + "@types/lodash.compact@npm:^3": version: 3.0.9 resolution: "@types/lodash.compact@npm:3.0.9" @@ -5543,6 +5968,24 @@ __metadata: languageName: node linkType: hard +"@types/lodash.times@npm:^4": + version: 4.3.9 + resolution: "@types/lodash.times@npm:4.3.9" + dependencies: + "@types/lodash": "*" + checksum: 452374b3db98bb805e77b3a53955aa76c1e78a7d48c400b08d48b6424ed9328ad826d98364b82506ea2756089320503d3a5797a1456bcdac11451763be536e62 + languageName: node + linkType: hard + +"@types/lodash.upperfirst@npm:^4": + version: 4.3.9 + resolution: "@types/lodash.upperfirst@npm:4.3.9" + dependencies: + "@types/lodash": "*" + checksum: 6cb5dc9c5e653a0f64daa543f2dfa13fdfd1f66d3ed036cb0edec9fd064b5feaf067e72b964bed8e66e49087e2680d274c7c721bf884359896ca590cbd38c651 + languageName: node + linkType: hard + "@types/lodash@npm:*, @types/lodash@npm:^4": version: 4.14.202 resolution: "@types/lodash@npm:4.14.202" @@ -5921,6 +6364,13 @@ __metadata: languageName: node linkType: hard +"@types/stack-utils@npm:^2.0.0": + version: 2.0.3 + resolution: "@types/stack-utils@npm:2.0.3" + checksum: 72576cc1522090fe497337c2b99d9838e320659ac57fa5560fcbdcbafcf5d0216c6b3a0a8a4ee4fdb3b1f5e3420aa4f6223ab57b82fef3578bec3206425c6cf5 + languageName: node + linkType: hard + "@types/unist@npm:*, @types/unist@npm:^3.0.0": version: 3.0.2 resolution: "@types/unist@npm:3.0.2" @@ -6911,7 +7361,7 @@ __metadata: languageName: node linkType: hard -"ansi-escapes@npm:^4.3.0": +"ansi-escapes@npm:^4.2.1, ansi-escapes@npm:^4.3.0": version: 4.3.2 resolution: "ansi-escapes@npm:4.3.2" dependencies: @@ -6968,6 +7418,13 @@ __metadata: languageName: node linkType: hard +"ansi-styles@npm:^5.0.0": + version: 5.2.0 + resolution: "ansi-styles@npm:5.2.0" + checksum: d7f4e97ce0623aea6bc0d90dcd28881ee04cba06c570b97fd3391bd7a268eedfd9d5e2dd4fdcbdd82b8105df5faf6f24aaedc08eaf3da898e702db5948f63469 + languageName: node + linkType: hard + "ansi-styles@npm:^6.1.0": version: 6.2.1 resolution: "ansi-styles@npm:6.2.1" @@ -6975,7 +7432,7 @@ __metadata: languageName: node linkType: hard -"anymatch@npm:~3.1.2": +"anymatch@npm:^3.0.3, anymatch@npm:~3.1.2": version: 3.1.3 resolution: "anymatch@npm:3.1.3" dependencies: @@ -6992,7 +7449,7 @@ __metadata: languageName: node linkType: hard -"arg@npm:5.0.2, arg@npm:^5.0.0": +"arg@npm:5.0.2, arg@npm:^5.0.0, arg@npm:^5.0.2": version: 5.0.2 resolution: "arg@npm:5.0.2" checksum: 6c69ada1a9943d332d9e5382393e897c500908d91d5cb735a01120d5f71daf1b339b7b8980cbeaba8fd1afc68e658a739746179e4315a26e8a28951ff9930078 @@ -7168,6 +7625,23 @@ __metadata: languageName: node linkType: hard +"babel-jest@npm:^29.7.0": + version: 29.7.0 + resolution: "babel-jest@npm:29.7.0" + dependencies: + "@jest/transform": ^29.7.0 + "@types/babel__core": ^7.1.14 + babel-plugin-istanbul: ^6.1.1 + babel-preset-jest: ^29.6.3 + chalk: ^4.0.0 + graceful-fs: ^4.2.9 + slash: ^3.0.0 + peerDependencies: + "@babel/core": ^7.8.0 + checksum: ee6f8e0495afee07cac5e4ee167be705c711a8cc8a737e05a587a131fdae2b3c8f9aa55dfd4d9c03009ac2d27f2de63d8ba96d3e8460da4d00e8af19ef9a83f7 + languageName: node + linkType: hard + "babel-loader@npm:^8.2.5": version: 8.3.0 resolution: "babel-loader@npm:8.3.0" @@ -7226,7 +7700,32 @@ __metadata: languageName: node linkType: hard -"babel-plugin-polyfill-corejs2@npm:^0.4.6": +"babel-plugin-istanbul@npm:^6.1.1": + version: 6.1.1 + resolution: "babel-plugin-istanbul@npm:6.1.1" + dependencies: + "@babel/helper-plugin-utils": ^7.0.0 + "@istanbuljs/load-nyc-config": ^1.0.0 + "@istanbuljs/schema": ^0.1.2 + istanbul-lib-instrument: ^5.0.4 + test-exclude: ^6.0.0 + checksum: cb4fd95738219f232f0aece1116628cccff16db891713c4ccb501cddbbf9272951a5df81f2f2658dfdf4b3e7b236a9d5cbcf04d5d8c07dd5077297339598061a + languageName: node + linkType: hard + +"babel-plugin-jest-hoist@npm:^29.6.3": + version: 29.6.3 + resolution: "babel-plugin-jest-hoist@npm:29.6.3" + dependencies: + "@babel/template": ^7.3.3 + "@babel/types": ^7.3.3 + "@types/babel__core": ^7.1.14 + "@types/babel__traverse": ^7.0.6 + checksum: 51250f22815a7318f17214a9d44650ba89551e6d4f47a2dc259128428324b52f5a73979d010cefd921fd5a720d8c1d55ad74ff601cd94c7bd44d5f6292fde2d1 + languageName: node + linkType: hard + +"babel-plugin-polyfill-corejs2@npm:^0.4.6": version: 0.4.6 resolution: "babel-plugin-polyfill-corejs2@npm:0.4.6" dependencies: @@ -7262,6 +7761,40 @@ __metadata: languageName: node linkType: hard +"babel-preset-current-node-syntax@npm:^1.0.0": + version: 1.0.1 + resolution: "babel-preset-current-node-syntax@npm:1.0.1" + dependencies: + "@babel/plugin-syntax-async-generators": ^7.8.4 + "@babel/plugin-syntax-bigint": ^7.8.3 + "@babel/plugin-syntax-class-properties": ^7.8.3 + "@babel/plugin-syntax-import-meta": ^7.8.3 + "@babel/plugin-syntax-json-strings": ^7.8.3 + "@babel/plugin-syntax-logical-assignment-operators": ^7.8.3 + "@babel/plugin-syntax-nullish-coalescing-operator": ^7.8.3 + "@babel/plugin-syntax-numeric-separator": ^7.8.3 + "@babel/plugin-syntax-object-rest-spread": ^7.8.3 + "@babel/plugin-syntax-optional-catch-binding": ^7.8.3 + "@babel/plugin-syntax-optional-chaining": ^7.8.3 + "@babel/plugin-syntax-top-level-await": ^7.8.3 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: d118c2742498c5492c095bc8541f4076b253e705b5f1ad9a2e7d302d81a84866f0070346662355c8e25fc02caa28dc2da8d69bcd67794a0d60c4d6fab6913cc8 + languageName: node + linkType: hard + +"babel-preset-jest@npm:^29.6.3": + version: 29.6.3 + resolution: "babel-preset-jest@npm:29.6.3" + dependencies: + babel-plugin-jest-hoist: ^29.6.3 + babel-preset-current-node-syntax: ^1.0.0 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: aa4ff2a8a728d9d698ed521e3461a109a1e66202b13d3494e41eea30729a5e7cc03b3a2d56c594423a135429c37bf63a9fa8b0b9ce275298be3095a88c69f6fb + languageName: node + linkType: hard + "bail@npm:^1.0.0": version: 1.0.5 resolution: "bail@npm:1.0.5" @@ -7587,6 +8120,15 @@ __metadata: languageName: node linkType: hard +"bs-logger@npm:0.x": + version: 0.2.6 + resolution: "bs-logger@npm:0.2.6" + dependencies: + fast-json-stable-stringify: 2.x + checksum: d34bdaf68c64bd099ab97c3ea608c9ae7d3f5faa1178b3f3f345acd94e852e608b2d4f9103fb2e503f5e69780e98293df41691b84be909b41cf5045374d54606 + languageName: node + linkType: hard + "bs58@npm:^4.0.0": version: 4.0.1 resolution: "bs58@npm:4.0.1" @@ -7607,6 +8149,15 @@ __metadata: languageName: node linkType: hard +"bser@npm:2.1.1": + version: 2.1.1 + resolution: "bser@npm:2.1.1" + dependencies: + node-int64: ^0.4.0 + checksum: 9ba4dc58ce86300c862bffc3ae91f00b2a03b01ee07f3564beeeaf82aa243b8b03ba53f123b0b842c190d4399b94697970c8e7cf7b1ea44b61aa28c3526a4449 + languageName: node + linkType: hard + "buffer-crc32@npm:~0.2.3": version: 0.2.13 resolution: "buffer-crc32@npm:0.2.13" @@ -7780,6 +8331,13 @@ __metadata: languageName: node linkType: hard +"camelcase@npm:^5.3.1": + version: 5.3.1 + resolution: "camelcase@npm:5.3.1" + checksum: e6effce26b9404e3c0f301498184f243811c30dfe6d0b9051863bd8e4034d09c8c2923794f280d6827e5aa055f6c434115ff97864a16a963366fb35fd673024b + languageName: node + linkType: hard + "camelcase@npm:^6.0.0, camelcase@npm:^6.2.0": version: 6.3.0 resolution: "camelcase@npm:6.3.0" @@ -8094,6 +8652,13 @@ __metadata: languageName: node linkType: hard +"cjs-module-lexer@npm:^1.0.0": + version: 1.2.3 + resolution: "cjs-module-lexer@npm:1.2.3" + checksum: 5ea3cb867a9bb609b6d476cd86590d105f3cfd6514db38ff71f63992ab40939c2feb68967faa15a6d2b1f90daa6416b79ea2de486e9e2485a6f8b66a21b4fb0a + languageName: node + linkType: hard + "classic-level@npm:^1.2.0": version: 1.3.0 resolution: "classic-level@npm:1.3.0" @@ -8274,6 +8839,13 @@ __metadata: languageName: node linkType: hard +"collect-v8-coverage@npm:^1.0.0": + version: 1.0.2 + resolution: "collect-v8-coverage@npm:1.0.2" + checksum: c10f41c39ab84629d16f9f6137bc8a63d332244383fc368caf2d2052b5e04c20cd1fd70f66fcf4e2422b84c8226598b776d39d5f2d2a51867cc1ed5d1982b4da + languageName: node + linkType: hard + "color-convert@npm:^1.9.0": version: 1.9.3 resolution: "color-convert@npm:1.9.3" @@ -8750,6 +9322,23 @@ __metadata: languageName: node linkType: hard +"create-jest@npm:^29.7.0": + version: 29.7.0 + resolution: "create-jest@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + chalk: ^4.0.0 + exit: ^0.1.2 + graceful-fs: ^4.2.9 + jest-config: ^29.7.0 + jest-util: ^29.7.0 + prompts: ^2.0.1 + bin: + create-jest: bin/create-jest.js + checksum: 1427d49458adcd88547ef6fa39041e1fe9033a661293aa8d2c3aa1b4967cb5bf4f0c00436c7a61816558f28ba2ba81a94d5c962e8022ea9a883978fc8e1f2945 + languageName: node + linkType: hard + "create-require@npm:^1.1.0": version: 1.1.1 resolution: "create-require@npm:1.1.1" @@ -9017,7 +9606,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.0, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": +"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.0, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": version: 4.3.4 resolution: "debug@npm:4.3.4" dependencies: @@ -9072,6 +9661,18 @@ __metadata: languageName: node linkType: hard +"dedent@npm:^1.0.0": + version: 1.5.1 + resolution: "dedent@npm:1.5.1" + peerDependencies: + babel-plugin-macros: ^3.1.0 + peerDependenciesMeta: + babel-plugin-macros: + optional: true + checksum: c3c300a14edf1bdf5a873f9e4b22e839d62490bc5c8d6169c1f15858a1a76733d06a9a56930e963d677a2ceeca4b6b0894cc5ea2f501aa382ca5b92af3413c2a + languageName: node + linkType: hard + "deep-eql@npm:^4.0.1, deep-eql@npm:^4.1.3": version: 4.1.3 resolution: "deep-eql@npm:4.1.3" @@ -9273,6 +9874,13 @@ __metadata: languageName: node linkType: hard +"detect-newline@npm:^3.0.0": + version: 3.1.0 + resolution: "detect-newline@npm:3.1.0" + checksum: ae6cd429c41ad01b164c59ea36f264a2c479598e61cba7c99da24175a7ab80ddf066420f2bec9a1c57a6bead411b4655ff15ad7d281c000a89791f48cbe939e7 + languageName: node + linkType: hard + "detect-node@npm:^2.0.4": version: 2.1.0 resolution: "detect-node@npm:2.1.0" @@ -9322,6 +9930,13 @@ __metadata: languageName: node linkType: hard +"diff-sequences@npm:^29.6.3": + version: 29.6.3 + resolution: "diff-sequences@npm:29.6.3" + checksum: f4914158e1f2276343d98ff5b31fc004e7304f5470bf0f1adb2ac6955d85a531a6458d33e87667f98f6ae52ebd3891bb47d420bb48a5bd8b7a27ee25b20e33aa + languageName: node + linkType: hard + "diff@npm:5.0.0": version: 5.0.0 resolution: "diff@npm:5.0.0" @@ -9582,6 +10197,13 @@ __metadata: languageName: node linkType: hard +"emittery@npm:^0.13.1": + version: 0.13.1 + resolution: "emittery@npm:0.13.1" + checksum: 2b089ab6306f38feaabf4f6f02792f9ec85fc054fda79f44f6790e61bbf6bc4e1616afb9b232e0c5ec5289a8a452f79bfa6d905a6fd64e94b49981f0934001c6 + languageName: node + linkType: hard + "emoji-regex@npm:^8.0.0": version: 8.0.0 resolution: "emoji-regex@npm:8.0.0" @@ -9936,6 +10558,13 @@ __metadata: languageName: node linkType: hard +"escape-string-regexp@npm:^2.0.0": + version: 2.0.0 + resolution: "escape-string-regexp@npm:2.0.0" + checksum: 9f8a2d5743677c16e85c810e3024d54f0c8dea6424fad3c79ef6666e81dd0846f7437f5e729dfcdac8981bc9e5294c39b4580814d114076b8d36318f46ae4395 + languageName: node + linkType: hard + "escape-string-regexp@npm:^5.0.0": version: 5.0.0 resolution: "escape-string-regexp@npm:5.0.0" @@ -10400,6 +11029,26 @@ __metadata: languageName: node linkType: hard +"exit@npm:^0.1.2": + version: 0.1.2 + resolution: "exit@npm:0.1.2" + checksum: abc407f07a875c3961e4781dfcb743b58d6c93de9ab263f4f8c9d23bb6da5f9b7764fc773f86b43dd88030444d5ab8abcb611cb680fba8ca075362b77114bba3 + languageName: node + linkType: hard + +"expect@npm:^29.0.0, expect@npm:^29.7.0": + version: 29.7.0 + resolution: "expect@npm:29.7.0" + dependencies: + "@jest/expect-utils": ^29.7.0 + jest-get-type: ^29.6.3 + jest-matcher-utils: ^29.7.0 + jest-message-util: ^29.7.0 + jest-util: ^29.7.0 + checksum: 9257f10288e149b81254a0fda8ffe8d54a7061cd61d7515779998b012579d2b8c22354b0eb901daf0145f347403da582f75f359f4810c007182ad3fb318b5c0c + languageName: node + linkType: hard + "exponential-backoff@npm:^3.1.1": version: 3.1.1 resolution: "exponential-backoff@npm:3.1.1" @@ -10506,7 +11155,7 @@ __metadata: languageName: node linkType: hard -"fast-json-stable-stringify@npm:^2.0.0": +"fast-json-stable-stringify@npm:2.x, fast-json-stable-stringify@npm:^2.0.0, fast-json-stable-stringify@npm:^2.1.0": version: 2.1.0 resolution: "fast-json-stable-stringify@npm:2.1.0" checksum: b191531e36c607977e5b1c47811158733c34ccb3bfde92c44798929e9b4154884378536d26ad90dfecd32e1ffc09c545d23535ad91b3161a27ddbb8ebe0cbecb @@ -10570,6 +11219,15 @@ __metadata: languageName: node linkType: hard +"fb-watchman@npm:^2.0.0": + version: 2.0.2 + resolution: "fb-watchman@npm:2.0.2" + dependencies: + bser: 2.1.1 + checksum: b15a124cef28916fe07b400eb87cbc73ca082c142abf7ca8e8de6af43eca79ca7bd13eb4d4d48240b3bd3136eaac40d16e42d6edf87a8e5d1dd8070626860c78 + languageName: node + linkType: hard + "fd-slicer@npm:~1.1.0": version: 1.1.0 resolution: "fd-slicer@npm:1.1.0" @@ -10715,7 +11373,7 @@ __metadata: languageName: node linkType: hard -"find-up@npm:^4.0.0": +"find-up@npm:^4.0.0, find-up@npm:^4.1.0": version: 4.1.0 resolution: "find-up@npm:4.1.0" dependencies: @@ -11012,7 +11670,7 @@ __metadata: languageName: node linkType: hard -"fsevents@npm:~2.3.2, fsevents@npm:~2.3.3": +"fsevents@npm:^2.3.2, fsevents@npm:~2.3.2, fsevents@npm:~2.3.3": version: 2.3.3 resolution: "fsevents@npm:2.3.3" dependencies: @@ -11031,7 +11689,7 @@ __metadata: languageName: node linkType: hard -"fsevents@patch:fsevents@~2.3.2#~builtin, fsevents@patch:fsevents@~2.3.3#~builtin": +"fsevents@patch:fsevents@^2.3.2#~builtin, fsevents@patch:fsevents@~2.3.2#~builtin, fsevents@patch:fsevents@~2.3.3#~builtin": version: 2.3.3 resolution: "fsevents@patch:fsevents@npm%3A2.3.3#~builtin::version=2.3.3&hash=df0bf1" dependencies: @@ -11103,6 +11761,13 @@ __metadata: languageName: node linkType: hard +"get-package-type@npm:^0.1.0": + version: 0.1.0 + resolution: "get-package-type@npm:0.1.0" + checksum: bba0811116d11e56d702682ddef7c73ba3481f114590e705fc549f4d868972263896af313c57a25c076e3c0d567e11d919a64ba1b30c879be985fc9d44f96148 + languageName: node + linkType: hard + "get-stdin@npm:^8.0.0": version: 8.0.0 resolution: "get-stdin@npm:8.0.0" @@ -11205,7 +11870,7 @@ __metadata: languageName: node linkType: hard -"glob@npm:^7.0.0, glob@npm:^7.1.3, glob@npm:^7.1.6": +"glob@npm:^7.0.0, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.6": version: 7.2.3 resolution: "glob@npm:7.2.3" dependencies: @@ -12133,6 +12798,13 @@ __metadata: languageName: node linkType: hard +"hyperdyperid@npm:^1.2.0": + version: 1.2.0 + resolution: "hyperdyperid@npm:1.2.0" + checksum: 210029d1c86926f09109f6317d143f8b056fc38e8dd11b0c3e3205fc6c6ff8429fb55b4b9c2bce065462719ed9d34366eced387aaa0035d93eb76b306a8547ef + languageName: node + linkType: hard + "iconv-lite@npm:0.4.24": version: 0.4.24 resolution: "iconv-lite@npm:0.4.24" @@ -12586,6 +13258,13 @@ __metadata: languageName: node linkType: hard +"is-generator-fn@npm:^2.0.0": + version: 2.1.0 + resolution: "is-generator-fn@npm:2.1.0" + checksum: a6ad5492cf9d1746f73b6744e0c43c0020510b59d56ddcb78a91cbc173f09b5e6beff53d75c9c5a29feb618bfef2bf458e025ecf3a57ad2268e2fb2569f56215 + languageName: node + linkType: hard + "is-generator-function@npm:^1.0.7": version: 1.0.10 resolution: "is-generator-function@npm:1.0.10" @@ -12874,97 +13553,498 @@ __metadata: languageName: node linkType: hard -"isarray@npm:0.0.1": - version: 0.0.1 - resolution: "isarray@npm:0.0.1" - checksum: 49191f1425681df4a18c2f0f93db3adb85573bcdd6a4482539d98eac9e705d8961317b01175627e860516a2fc45f8f9302db26e5a380a97a520e272e2a40a8d4 +"isarray@npm:0.0.1": + version: 0.0.1 + resolution: "isarray@npm:0.0.1" + checksum: 49191f1425681df4a18c2f0f93db3adb85573bcdd6a4482539d98eac9e705d8961317b01175627e860516a2fc45f8f9302db26e5a380a97a520e272e2a40a8d4 + languageName: node + linkType: hard + +"isarray@npm:~1.0.0": + version: 1.0.0 + resolution: "isarray@npm:1.0.0" + checksum: f032df8e02dce8ec565cf2eb605ea939bdccea528dbcf565cdf92bfa2da9110461159d86a537388ef1acef8815a330642d7885b29010e8f7eac967c9993b65ab + languageName: node + linkType: hard + +"isbinaryfile@npm:^5.0.0": + version: 5.0.0 + resolution: "isbinaryfile@npm:5.0.0" + checksum: 25cc27388d51b8322c103f5894f9e72ec04e017734e57c4b70be2666501ec7e7f6cbb4a5fcfd15260a7cac979bd1ddb7f5231f5a3098c0695c4e7c049513dfaf + languageName: node + linkType: hard + +"isbuffer@npm:~0.0.0": + version: 0.0.0 + resolution: "isbuffer@npm:0.0.0" + checksum: 9796296d3c493974c1f71ccf3170cc8007217a19ce8b3b9dedffd32e8ccc3ac42473b572bbf1b24b86143e826ea157aead11fd1285389518abab76c7da5f50ed + languageName: node + linkType: hard + +"isexe@npm:^2.0.0": + version: 2.0.0 + resolution: "isexe@npm:2.0.0" + checksum: 26bf6c5480dda5161c820c5b5c751ae1e766c587b1f951ea3fcfc973bafb7831ae5b54a31a69bd670220e42e99ec154475025a468eae58ea262f813fdc8d1c62 + languageName: node + linkType: hard + +"isexe@npm:^3.1.1": + version: 3.1.1 + resolution: "isexe@npm:3.1.1" + checksum: 7fe1931ee4e88eb5aa524cd3ceb8c882537bc3a81b02e438b240e47012eef49c86904d0f0e593ea7c3a9996d18d0f1f3be8d3eaa92333977b0c3a9d353d5563e + languageName: node + linkType: hard + +"isobject@npm:^3.0.1": + version: 3.0.1 + resolution: "isobject@npm:3.0.1" + checksum: db85c4c970ce30693676487cca0e61da2ca34e8d4967c2e1309143ff910c207133a969f9e4ddb2dc6aba670aabce4e0e307146c310350b298e74a31f7d464703 + languageName: node + linkType: hard + +"istanbul-lib-coverage@npm:^3.0.0, istanbul-lib-coverage@npm:^3.2.0": + version: 3.2.2 + resolution: "istanbul-lib-coverage@npm:3.2.2" + checksum: 2367407a8d13982d8f7a859a35e7f8dd5d8f75aae4bb5484ede3a9ea1b426dc245aff28b976a2af48ee759fdd9be374ce2bd2669b644f31e76c5f46a2e29a831 + languageName: node + linkType: hard + +"istanbul-lib-instrument@npm:^5.0.4": + version: 5.2.1 + resolution: "istanbul-lib-instrument@npm:5.2.1" + dependencies: + "@babel/core": ^7.12.3 + "@babel/parser": ^7.14.7 + "@istanbuljs/schema": ^0.1.2 + istanbul-lib-coverage: ^3.2.0 + semver: ^6.3.0 + checksum: bf16f1803ba5e51b28bbd49ed955a736488381e09375d830e42ddeb403855b2006f850711d95ad726f2ba3f1ae8e7366de7e51d2b9ac67dc4d80191ef7ddf272 + languageName: node + linkType: hard + +"istanbul-lib-instrument@npm:^6.0.0": + version: 6.0.1 + resolution: "istanbul-lib-instrument@npm:6.0.1" + dependencies: + "@babel/core": ^7.12.3 + "@babel/parser": ^7.14.7 + "@istanbuljs/schema": ^0.1.2 + istanbul-lib-coverage: ^3.2.0 + semver: ^7.5.4 + checksum: fb23472e739cfc9b027cefcd7d551d5e7ca7ff2817ae5150fab99fe42786a7f7b56a29a2aa8309c37092e18297b8003f9c274f50ca4360949094d17fbac81472 + languageName: node + linkType: hard + +"istanbul-lib-report@npm:^3.0.0, istanbul-lib-report@npm:^3.0.1": + version: 3.0.1 + resolution: "istanbul-lib-report@npm:3.0.1" + dependencies: + istanbul-lib-coverage: ^3.0.0 + make-dir: ^4.0.0 + supports-color: ^7.1.0 + checksum: fd17a1b879e7faf9bb1dc8f80b2a16e9f5b7b8498fe6ed580a618c34df0bfe53d2abd35bf8a0a00e628fb7405462576427c7df20bbe4148d19c14b431c974b21 + languageName: node + linkType: hard + +"istanbul-lib-source-maps@npm:^4.0.0": + version: 4.0.1 + resolution: "istanbul-lib-source-maps@npm:4.0.1" + dependencies: + debug: ^4.1.1 + istanbul-lib-coverage: ^3.0.0 + source-map: ^0.6.1 + checksum: 21ad3df45db4b81852b662b8d4161f6446cd250c1ddc70ef96a585e2e85c26ed7cd9c2a396a71533cfb981d1a645508bc9618cae431e55d01a0628e7dec62ef2 + languageName: node + linkType: hard + +"istanbul-reports@npm:^3.0.2, istanbul-reports@npm:^3.1.3": + version: 3.1.6 + resolution: "istanbul-reports@npm:3.1.6" + dependencies: + html-escaper: ^2.0.0 + istanbul-lib-report: ^3.0.0 + checksum: 44c4c0582f287f02341e9720997f9e82c071627e1e862895745d5f52ec72c9b9f38e1d12370015d2a71dcead794f34c7732aaef3fab80a24bc617a21c3d911d6 + languageName: node + linkType: hard + +"jackspeak@npm:^2.3.5": + version: 2.3.6 + resolution: "jackspeak@npm:2.3.6" + dependencies: + "@isaacs/cliui": ^8.0.2 + "@pkgjs/parseargs": ^0.11.0 + dependenciesMeta: + "@pkgjs/parseargs": + optional: true + checksum: 57d43ad11eadc98cdfe7496612f6bbb5255ea69fe51ea431162db302c2a11011642f50cfad57288bd0aea78384a0612b16e131944ad8ecd09d619041c8531b54 + languageName: node + linkType: hard + +"jest-changed-files@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-changed-files@npm:29.7.0" + dependencies: + execa: ^5.0.0 + jest-util: ^29.7.0 + p-limit: ^3.1.0 + checksum: 963e203893c396c5dfc75e00a49426688efea7361b0f0e040035809cecd2d46b3c01c02be2d9e8d38b1138357d2de7719ea5b5be21f66c10f2e9685a5a73bb99 + languageName: node + linkType: hard + +"jest-circus@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-circus@npm:29.7.0" + dependencies: + "@jest/environment": ^29.7.0 + "@jest/expect": ^29.7.0 + "@jest/test-result": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/node": "*" + chalk: ^4.0.0 + co: ^4.6.0 + dedent: ^1.0.0 + is-generator-fn: ^2.0.0 + jest-each: ^29.7.0 + jest-matcher-utils: ^29.7.0 + jest-message-util: ^29.7.0 + jest-runtime: ^29.7.0 + jest-snapshot: ^29.7.0 + jest-util: ^29.7.0 + p-limit: ^3.1.0 + pretty-format: ^29.7.0 + pure-rand: ^6.0.0 + slash: ^3.0.0 + stack-utils: ^2.0.3 + checksum: 349437148924a5a109c9b8aad6d393a9591b4dac1918fc97d81b7fc515bc905af9918495055071404af1fab4e48e4b04ac3593477b1d5dcf48c4e71b527c70a7 + languageName: node + linkType: hard + +"jest-cli@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-cli@npm:29.7.0" + dependencies: + "@jest/core": ^29.7.0 + "@jest/test-result": ^29.7.0 + "@jest/types": ^29.6.3 + chalk: ^4.0.0 + create-jest: ^29.7.0 + exit: ^0.1.2 + import-local: ^3.0.2 + jest-config: ^29.7.0 + jest-util: ^29.7.0 + jest-validate: ^29.7.0 + yargs: ^17.3.1 + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + bin: + jest: bin/jest.js + checksum: 664901277a3f5007ea4870632ed6e7889db9da35b2434e7cb488443e6bf5513889b344b7fddf15112135495b9875892b156faeb2d7391ddb9e2a849dcb7b6c36 + languageName: node + linkType: hard + +"jest-config@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-config@npm:29.7.0" + dependencies: + "@babel/core": ^7.11.6 + "@jest/test-sequencer": ^29.7.0 + "@jest/types": ^29.6.3 + babel-jest: ^29.7.0 + chalk: ^4.0.0 + ci-info: ^3.2.0 + deepmerge: ^4.2.2 + glob: ^7.1.3 + graceful-fs: ^4.2.9 + jest-circus: ^29.7.0 + jest-environment-node: ^29.7.0 + jest-get-type: ^29.6.3 + jest-regex-util: ^29.6.3 + jest-resolve: ^29.7.0 + jest-runner: ^29.7.0 + jest-util: ^29.7.0 + jest-validate: ^29.7.0 + micromatch: ^4.0.4 + parse-json: ^5.2.0 + pretty-format: ^29.7.0 + slash: ^3.0.0 + strip-json-comments: ^3.1.1 + peerDependencies: + "@types/node": "*" + ts-node: ">=9.0.0" + peerDependenciesMeta: + "@types/node": + optional: true + ts-node: + optional: true + checksum: 4cabf8f894c180cac80b7df1038912a3fc88f96f2622de33832f4b3314f83e22b08fb751da570c0ab2b7988f21604bdabade95e3c0c041068ac578c085cf7dff + languageName: node + linkType: hard + +"jest-diff@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-diff@npm:29.7.0" + dependencies: + chalk: ^4.0.0 + diff-sequences: ^29.6.3 + jest-get-type: ^29.6.3 + pretty-format: ^29.7.0 + checksum: 08e24a9dd43bfba1ef07a6374e5af138f53137b79ec3d5cc71a2303515335898888fa5409959172e1e05de966c9e714368d15e8994b0af7441f0721ee8e1bb77 + languageName: node + linkType: hard + +"jest-docblock@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-docblock@npm:29.7.0" + dependencies: + detect-newline: ^3.0.0 + checksum: 66390c3e9451f8d96c5da62f577a1dad701180cfa9b071c5025acab2f94d7a3efc2515cfa1654ebe707213241541ce9c5530232cdc8017c91ed64eea1bd3b192 + languageName: node + linkType: hard + +"jest-each@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-each@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + chalk: ^4.0.0 + jest-get-type: ^29.6.3 + jest-util: ^29.7.0 + pretty-format: ^29.7.0 + checksum: e88f99f0184000fc8813f2a0aa79e29deeb63700a3b9b7928b8a418d7d93cd24933608591dbbdea732b473eb2021c72991b5cc51a17966842841c6e28e6f691c + languageName: node + linkType: hard + +"jest-environment-node@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-environment-node@npm:29.7.0" + dependencies: + "@jest/environment": ^29.7.0 + "@jest/fake-timers": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/node": "*" + jest-mock: ^29.7.0 + jest-util: ^29.7.0 + checksum: 501a9966292cbe0ca3f40057a37587cb6def25e1e0c5e39ac6c650fe78d3c70a2428304341d084ac0cced5041483acef41c477abac47e9a290d5545fd2f15646 + languageName: node + linkType: hard + +"jest-get-type@npm:^29.6.3": + version: 29.6.3 + resolution: "jest-get-type@npm:29.6.3" + checksum: 88ac9102d4679d768accae29f1e75f592b760b44277df288ad76ce5bf038c3f5ce3719dea8aa0f035dac30e9eb034b848ce716b9183ad7cc222d029f03e92205 + languageName: node + linkType: hard + +"jest-haste-map@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-haste-map@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + "@types/graceful-fs": ^4.1.3 + "@types/node": "*" + anymatch: ^3.0.3 + fb-watchman: ^2.0.0 + fsevents: ^2.3.2 + graceful-fs: ^4.2.9 + jest-regex-util: ^29.6.3 + jest-util: ^29.7.0 + jest-worker: ^29.7.0 + micromatch: ^4.0.4 + walker: ^1.0.8 + dependenciesMeta: + fsevents: + optional: true + checksum: c2c8f2d3e792a963940fbdfa563ce14ef9e14d4d86da645b96d3cd346b8d35c5ce0b992ee08593939b5f718cf0a1f5a90011a056548a1dbf58397d4356786f01 + languageName: node + linkType: hard + +"jest-leak-detector@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-leak-detector@npm:29.7.0" + dependencies: + jest-get-type: ^29.6.3 + pretty-format: ^29.7.0 + checksum: e3950e3ddd71e1d0c22924c51a300a1c2db6cf69ec1e51f95ccf424bcc070f78664813bef7aed4b16b96dfbdeea53fe358f8aeaaea84346ae15c3735758f1605 languageName: node linkType: hard -"isarray@npm:~1.0.0": - version: 1.0.0 - resolution: "isarray@npm:1.0.0" - checksum: f032df8e02dce8ec565cf2eb605ea939bdccea528dbcf565cdf92bfa2da9110461159d86a537388ef1acef8815a330642d7885b29010e8f7eac967c9993b65ab +"jest-matcher-utils@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-matcher-utils@npm:29.7.0" + dependencies: + chalk: ^4.0.0 + jest-diff: ^29.7.0 + jest-get-type: ^29.6.3 + pretty-format: ^29.7.0 + checksum: d7259e5f995d915e8a37a8fd494cb7d6af24cd2a287b200f831717ba0d015190375f9f5dc35393b8ba2aae9b2ebd60984635269c7f8cff7d85b077543b7744cd languageName: node linkType: hard -"isbinaryfile@npm:^5.0.0": - version: 5.0.0 - resolution: "isbinaryfile@npm:5.0.0" - checksum: 25cc27388d51b8322c103f5894f9e72ec04e017734e57c4b70be2666501ec7e7f6cbb4a5fcfd15260a7cac979bd1ddb7f5231f5a3098c0695c4e7c049513dfaf +"jest-message-util@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-message-util@npm:29.7.0" + dependencies: + "@babel/code-frame": ^7.12.13 + "@jest/types": ^29.6.3 + "@types/stack-utils": ^2.0.0 + chalk: ^4.0.0 + graceful-fs: ^4.2.9 + micromatch: ^4.0.4 + pretty-format: ^29.7.0 + slash: ^3.0.0 + stack-utils: ^2.0.3 + checksum: a9d025b1c6726a2ff17d54cc694de088b0489456c69106be6b615db7a51b7beb66788bea7a59991a019d924fbf20f67d085a445aedb9a4d6760363f4d7d09930 languageName: node linkType: hard -"isbuffer@npm:~0.0.0": - version: 0.0.0 - resolution: "isbuffer@npm:0.0.0" - checksum: 9796296d3c493974c1f71ccf3170cc8007217a19ce8b3b9dedffd32e8ccc3ac42473b572bbf1b24b86143e826ea157aead11fd1285389518abab76c7da5f50ed +"jest-mock@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-mock@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + "@types/node": "*" + jest-util: ^29.7.0 + checksum: 81ba9b68689a60be1482212878973700347cb72833c5e5af09895882b9eb5c4e02843a1bbdf23f94c52d42708bab53a30c45a3482952c9eec173d1eaac5b86c5 languageName: node linkType: hard -"isexe@npm:^2.0.0": - version: 2.0.0 - resolution: "isexe@npm:2.0.0" - checksum: 26bf6c5480dda5161c820c5b5c751ae1e766c587b1f951ea3fcfc973bafb7831ae5b54a31a69bd670220e42e99ec154475025a468eae58ea262f813fdc8d1c62 +"jest-pnp-resolver@npm:^1.2.2": + version: 1.2.3 + resolution: "jest-pnp-resolver@npm:1.2.3" + peerDependencies: + jest-resolve: "*" + peerDependenciesMeta: + jest-resolve: + optional: true + checksum: db1a8ab2cb97ca19c01b1cfa9a9c8c69a143fde833c14df1fab0766f411b1148ff0df878adea09007ac6a2085ec116ba9a996a6ad104b1e58c20adbf88eed9b2 languageName: node linkType: hard -"isexe@npm:^3.1.1": - version: 3.1.1 - resolution: "isexe@npm:3.1.1" - checksum: 7fe1931ee4e88eb5aa524cd3ceb8c882537bc3a81b02e438b240e47012eef49c86904d0f0e593ea7c3a9996d18d0f1f3be8d3eaa92333977b0c3a9d353d5563e +"jest-regex-util@npm:^29.6.3": + version: 29.6.3 + resolution: "jest-regex-util@npm:29.6.3" + checksum: 0518beeb9bf1228261695e54f0feaad3606df26a19764bc19541e0fc6e2a3737191904607fb72f3f2ce85d9c16b28df79b7b1ec9443aa08c3ef0e9efda6f8f2a languageName: node linkType: hard -"isobject@npm:^3.0.1": - version: 3.0.1 - resolution: "isobject@npm:3.0.1" - checksum: db85c4c970ce30693676487cca0e61da2ca34e8d4967c2e1309143ff910c207133a969f9e4ddb2dc6aba670aabce4e0e307146c310350b298e74a31f7d464703 +"jest-resolve-dependencies@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-resolve-dependencies@npm:29.7.0" + dependencies: + jest-regex-util: ^29.6.3 + jest-snapshot: ^29.7.0 + checksum: aeb75d8150aaae60ca2bb345a0d198f23496494677cd6aefa26fc005faf354061f073982175daaf32b4b9d86b26ca928586344516e3e6969aa614cb13b883984 languageName: node linkType: hard -"istanbul-lib-coverage@npm:^3.0.0": - version: 3.2.2 - resolution: "istanbul-lib-coverage@npm:3.2.2" - checksum: 2367407a8d13982d8f7a859a35e7f8dd5d8f75aae4bb5484ede3a9ea1b426dc245aff28b976a2af48ee759fdd9be374ce2bd2669b644f31e76c5f46a2e29a831 +"jest-resolve@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-resolve@npm:29.7.0" + dependencies: + chalk: ^4.0.0 + graceful-fs: ^4.2.9 + jest-haste-map: ^29.7.0 + jest-pnp-resolver: ^1.2.2 + jest-util: ^29.7.0 + jest-validate: ^29.7.0 + resolve: ^1.20.0 + resolve.exports: ^2.0.0 + slash: ^3.0.0 + checksum: 0ca218e10731aa17920526ec39deaec59ab9b966237905ffc4545444481112cd422f01581230eceb7e82d86f44a543d520a71391ec66e1b4ef1a578bd5c73487 languageName: node linkType: hard -"istanbul-lib-report@npm:^3.0.0, istanbul-lib-report@npm:^3.0.1": - version: 3.0.1 - resolution: "istanbul-lib-report@npm:3.0.1" +"jest-runner@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-runner@npm:29.7.0" dependencies: - istanbul-lib-coverage: ^3.0.0 - make-dir: ^4.0.0 - supports-color: ^7.1.0 - checksum: fd17a1b879e7faf9bb1dc8f80b2a16e9f5b7b8498fe6ed580a618c34df0bfe53d2abd35bf8a0a00e628fb7405462576427c7df20bbe4148d19c14b431c974b21 + "@jest/console": ^29.7.0 + "@jest/environment": ^29.7.0 + "@jest/test-result": ^29.7.0 + "@jest/transform": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/node": "*" + chalk: ^4.0.0 + emittery: ^0.13.1 + graceful-fs: ^4.2.9 + jest-docblock: ^29.7.0 + jest-environment-node: ^29.7.0 + jest-haste-map: ^29.7.0 + jest-leak-detector: ^29.7.0 + jest-message-util: ^29.7.0 + jest-resolve: ^29.7.0 + jest-runtime: ^29.7.0 + jest-util: ^29.7.0 + jest-watcher: ^29.7.0 + jest-worker: ^29.7.0 + p-limit: ^3.1.0 + source-map-support: 0.5.13 + checksum: f0405778ea64812bf9b5c50b598850d94ccf95d7ba21f090c64827b41decd680ee19fcbb494007cdd7f5d0d8906bfc9eceddd8fa583e753e736ecd462d4682fb languageName: node linkType: hard -"istanbul-reports@npm:^3.0.2": - version: 3.1.6 - resolution: "istanbul-reports@npm:3.1.6" - dependencies: - html-escaper: ^2.0.0 - istanbul-lib-report: ^3.0.0 - checksum: 44c4c0582f287f02341e9720997f9e82c071627e1e862895745d5f52ec72c9b9f38e1d12370015d2a71dcead794f34c7732aaef3fab80a24bc617a21c3d911d6 +"jest-runtime@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-runtime@npm:29.7.0" + dependencies: + "@jest/environment": ^29.7.0 + "@jest/fake-timers": ^29.7.0 + "@jest/globals": ^29.7.0 + "@jest/source-map": ^29.6.3 + "@jest/test-result": ^29.7.0 + "@jest/transform": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/node": "*" + chalk: ^4.0.0 + cjs-module-lexer: ^1.0.0 + collect-v8-coverage: ^1.0.0 + glob: ^7.1.3 + graceful-fs: ^4.2.9 + jest-haste-map: ^29.7.0 + jest-message-util: ^29.7.0 + jest-mock: ^29.7.0 + jest-regex-util: ^29.6.3 + jest-resolve: ^29.7.0 + jest-snapshot: ^29.7.0 + jest-util: ^29.7.0 + slash: ^3.0.0 + strip-bom: ^4.0.0 + checksum: d19f113d013e80691e07047f68e1e3448ef024ff2c6b586ce4f90cd7d4c62a2cd1d460110491019719f3c59bfebe16f0e201ed005ef9f80e2cf798c374eed54e languageName: node linkType: hard -"jackspeak@npm:^2.3.5": - version: 2.3.6 - resolution: "jackspeak@npm:2.3.6" +"jest-snapshot@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-snapshot@npm:29.7.0" dependencies: - "@isaacs/cliui": ^8.0.2 - "@pkgjs/parseargs": ^0.11.0 - dependenciesMeta: - "@pkgjs/parseargs": - optional: true - checksum: 57d43ad11eadc98cdfe7496612f6bbb5255ea69fe51ea431162db302c2a11011642f50cfad57288bd0aea78384a0612b16e131944ad8ecd09d619041c8531b54 + "@babel/core": ^7.11.6 + "@babel/generator": ^7.7.2 + "@babel/plugin-syntax-jsx": ^7.7.2 + "@babel/plugin-syntax-typescript": ^7.7.2 + "@babel/types": ^7.3.3 + "@jest/expect-utils": ^29.7.0 + "@jest/transform": ^29.7.0 + "@jest/types": ^29.6.3 + babel-preset-current-node-syntax: ^1.0.0 + chalk: ^4.0.0 + expect: ^29.7.0 + graceful-fs: ^4.2.9 + jest-diff: ^29.7.0 + jest-get-type: ^29.6.3 + jest-matcher-utils: ^29.7.0 + jest-message-util: ^29.7.0 + jest-util: ^29.7.0 + natural-compare: ^1.4.0 + pretty-format: ^29.7.0 + semver: ^7.5.3 + checksum: 86821c3ad0b6899521ce75ee1ae7b01b17e6dfeff9166f2cf17f012e0c5d8c798f30f9e4f8f7f5bed01ea7b55a6bc159f5eda778311162cbfa48785447c237ad languageName: node linkType: hard -"jest-util@npm:^29.7.0": +"jest-util@npm:^29.0.0, jest-util@npm:^29.7.0": version: 29.7.0 resolution: "jest-util@npm:29.7.0" dependencies: @@ -12978,6 +14058,36 @@ __metadata: languageName: node linkType: hard +"jest-validate@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-validate@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + camelcase: ^6.2.0 + chalk: ^4.0.0 + jest-get-type: ^29.6.3 + leven: ^3.1.0 + pretty-format: ^29.7.0 + checksum: 191fcdc980f8a0de4dbdd879fa276435d00eb157a48683af7b3b1b98b0f7d9de7ffe12689b617779097ff1ed77601b9f7126b0871bba4f776e222c40f62e9dae + languageName: node + linkType: hard + +"jest-watcher@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-watcher@npm:29.7.0" + dependencies: + "@jest/test-result": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/node": "*" + ansi-escapes: ^4.2.1 + chalk: ^4.0.0 + emittery: ^0.13.1 + jest-util: ^29.7.0 + string-length: ^4.0.1 + checksum: 67e6e7fe695416deff96b93a14a561a6db69389a0667e9489f24485bb85e5b54e12f3b2ba511ec0b777eca1e727235b073e3ebcdd473d68888650489f88df92f + languageName: node + linkType: hard + "jest-worker@npm:^27.4.5": version: 27.5.1 resolution: "jest-worker@npm:27.5.1" @@ -12989,7 +14099,7 @@ __metadata: languageName: node linkType: hard -"jest-worker@npm:^29.1.2": +"jest-worker@npm:^29.1.2, jest-worker@npm:^29.7.0": version: 29.7.0 resolution: "jest-worker@npm:29.7.0" dependencies: @@ -13001,6 +14111,25 @@ __metadata: languageName: node linkType: hard +"jest@npm:^29.7.0": + version: 29.7.0 + resolution: "jest@npm:29.7.0" + dependencies: + "@jest/core": ^29.7.0 + "@jest/types": ^29.6.3 + import-local: ^3.0.2 + jest-cli: ^29.7.0 + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + bin: + jest: bin/jest.js + checksum: 17ca8d67504a7dbb1998cf3c3077ec9031ba3eb512da8d71cb91bcabb2b8995c4e4b292b740cb9bf1cbff5ce3e110b3f7c777b0cefb6f41ab05445f248d0ee0b + languageName: node + linkType: hard + "jiti@npm:^1.18.2, jiti@npm:^1.20.0": version: 1.21.0 resolution: "jiti@npm:1.21.0" @@ -13106,6 +14235,29 @@ __metadata: languageName: node linkType: hard +"json-joy@npm:^9.2.0": + version: 9.9.1 + resolution: "json-joy@npm:9.9.1" + dependencies: + arg: ^5.0.2 + hyperdyperid: ^1.2.0 + peerDependencies: + quill-delta: ^5 + rxjs: 7 + tslib: 2 + bin: + jj: bin/jj.js + json-pack: bin/json-pack.js + json-pack-test: bin/json-pack-test.js + json-patch: bin/json-patch.js + json-patch-test: bin/json-patch-test.js + json-pointer: bin/json-pointer.js + json-pointer-test: bin/json-pointer-test.js + json-unpack: bin/json-unpack.js + checksum: d165398682f00019796225faf365cd8d060f3e086af39bb5081c30907b7e52eaf13697d1c0f6ee2b010fe255ae1fd776e05ad7d6ee5fb549e98fe982f560884b + languageName: node + linkType: hard + "json-parse-even-better-errors@npm:^2.3.0, json-parse-even-better-errors@npm:^2.3.1": version: 2.3.1 resolution: "json-parse-even-better-errors@npm:2.3.1" @@ -13642,6 +14794,13 @@ __metadata: languageName: node linkType: hard +"lodash.capitalize@npm:^4.2.1": + version: 4.2.1 + resolution: "lodash.capitalize@npm:4.2.1" + checksum: d9195f31d48c105206f1099946d8bbc8ab71435bc1c8708296992a31a992bb901baf120fdcadd773098ac96e62a79e6b023ee7d26a2deb0d6c6aada930e6ad0a + languageName: node + linkType: hard + "lodash.compact@npm:^3.0.1": version: 3.0.1 resolution: "lodash.compact@npm:3.0.1" @@ -13663,7 +14822,7 @@ __metadata: languageName: node linkType: hard -"lodash.memoize@npm:^4.1.2": +"lodash.memoize@npm:4.x, lodash.memoize@npm:^4.1.2": version: 4.1.2 resolution: "lodash.memoize@npm:4.1.2" checksum: 9ff3942feeccffa4f1fafa88d32f0d24fdc62fd15ded5a74a5f950ff5f0c6f61916157246744c620173dddf38d37095a92327d5fd3861e2063e736a5c207d089 @@ -13677,6 +14836,13 @@ __metadata: languageName: node linkType: hard +"lodash.times@npm:^4.3.2": + version: 4.3.2 + resolution: "lodash.times@npm:4.3.2" + checksum: d26a9022e025d6061d356d3098fd80cdc062e7bf896bbbb56e643b2ae39156bf19b6167a4b046aa924b6d572a1e717853e552342ce34016fc5183308e329b575 + languageName: node + linkType: hard + "lodash.uniq@npm:4.5.0, lodash.uniq@npm:^4.5.0": version: 4.5.0 resolution: "lodash.uniq@npm:4.5.0" @@ -13684,6 +14850,13 @@ __metadata: languageName: node linkType: hard +"lodash.upperfirst@npm:^4.3.1": + version: 4.3.1 + resolution: "lodash.upperfirst@npm:4.3.1" + checksum: cadec6955900afe1928cc60cdc4923a79c2ef991e42665419cc81630ed9b4f952a1093b222e0141ab31cbc4dba549f97ec28ff67929d71e01861c97188a5fa83 + languageName: node + linkType: hard + "lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21": version: 4.17.21 resolution: "lodash@npm:4.17.21" @@ -13848,7 +15021,7 @@ __metadata: languageName: node linkType: hard -"make-error@npm:^1.1.1": +"make-error@npm:1.x, make-error@npm:^1.1.1": version: 1.3.6 resolution: "make-error@npm:1.3.6" checksum: b86e5e0e25f7f777b77fabd8e2cbf15737972869d852a22b7e73c17623928fccb826d8e46b9951501d3f20e51ad74ba8c59ed584f610526a48f8ccf88aaec402 @@ -13874,6 +15047,15 @@ __metadata: languageName: node linkType: hard +"makeerror@npm:1.0.12": + version: 1.0.12 + resolution: "makeerror@npm:1.0.12" + dependencies: + tmpl: 1.0.5 + checksum: b38a025a12c8146d6eeea5a7f2bf27d51d8ad6064da8ca9405fcf7bf9b54acd43e3b30ddd7abb9b1bfa4ddb266019133313482570ddb207de568f71ecfcf6060 + languageName: node + linkType: hard + "map-stream@npm:~0.1.0": version: 0.1.0 resolution: "map-stream@npm:0.1.0" @@ -14281,6 +15463,18 @@ __metadata: languageName: node linkType: hard +"memfs@npm:^4.6.0": + version: 4.6.0 + resolution: "memfs@npm:4.6.0" + dependencies: + json-joy: ^9.2.0 + thingies: ^1.11.1 + peerDependencies: + tslib: 2 + checksum: b32a35bee9f96dc011605f3bb39e74e6d2a5de51c952a77bb38a0dfabd3381c40ae382d27f385aa290edee8081597fb1a3b41a07bb3f775fd55312dc30ac1d9d + languageName: node + linkType: hard + "memory-level@npm:^1.0.0": version: 1.0.0 resolution: "memory-level@npm:1.0.0" @@ -15389,6 +16583,13 @@ __metadata: languageName: node linkType: hard +"node-int64@npm:^0.4.0": + version: 0.4.0 + resolution: "node-int64@npm:0.4.0" + checksum: d0b30b1ee6d961851c60d5eaa745d30b5c95d94bc0e74b81e5292f7c42a49e3af87f1eb9e89f59456f80645d679202537de751b7d72e9e40ceea40c5e449057e + languageName: node + linkType: hard + "node-releases@npm:^2.0.14": version: 2.0.14 resolution: "node-releases@npm:2.0.14" @@ -15718,7 +16919,7 @@ __metadata: languageName: node linkType: hard -"p-limit@npm:^3.0.2": +"p-limit@npm:^3.0.2, p-limit@npm:^3.1.0": version: 3.1.0 resolution: "p-limit@npm:3.1.0" dependencies: @@ -16120,6 +17321,13 @@ __metadata: languageName: node linkType: hard +"pirates@npm:^4.0.4": + version: 4.0.6 + resolution: "pirates@npm:4.0.6" + checksum: 46a65fefaf19c6f57460388a5af9ab81e3d7fd0e7bc44ca59d753cb5c4d0df97c6c6e583674869762101836d68675f027d60f841c105d72734df9dfca97cbcc6 + languageName: node + linkType: hard + "pkg-dir@npm:^4.1.0, pkg-dir@npm:^4.2.0": version: 4.2.0 resolution: "pkg-dir@npm:4.2.0" @@ -16678,6 +17886,17 @@ __metadata: languageName: node linkType: hard +"pretty-format@npm:^29.0.0, pretty-format@npm:^29.7.0": + version: 29.7.0 + resolution: "pretty-format@npm:29.7.0" + dependencies: + "@jest/schemas": ^29.6.3 + ansi-styles: ^5.0.0 + react-is: ^18.0.0 + checksum: 032c1602383e71e9c0c02a01bbd25d6759d60e9c7cf21937dde8357aa753da348fcec5def5d1002c9678a8524d5fe099ad98861286550ef44de8808cc61e43b6 + languageName: node + linkType: hard + "pretty-time@npm:^1.1.0": version: 1.1.0 resolution: "pretty-time@npm:1.1.0" @@ -16742,7 +17961,7 @@ __metadata: languageName: node linkType: hard -"prompts@npm:^2.4.2": +"prompts@npm:^2.0.1, prompts@npm:^2.4.2": version: 2.4.2 resolution: "prompts@npm:2.4.2" dependencies: @@ -16894,6 +18113,13 @@ __metadata: languageName: node linkType: hard +"pure-rand@npm:^6.0.0": + version: 6.0.4 + resolution: "pure-rand@npm:6.0.4" + checksum: e1c4e69f8bf7303e5252756d67c3c7551385cd34d94a1f511fe099727ccbab74c898c03a06d4c4a24a89b51858781057b83ebbfe740d984240cdc04fead36068 + languageName: node + linkType: hard + "qs@npm:6.11.0": version: 6.11.0 resolution: "qs@npm:6.11.0" @@ -17091,6 +18317,13 @@ __metadata: languageName: node linkType: hard +"react-is@npm:^18.0.0": + version: 18.2.0 + resolution: "react-is@npm:18.2.0" + checksum: e72d0ba81b5922759e4aff17e0252bd29988f9642ed817f56b25a3e217e13eea8a7f2322af99a06edb779da12d5d636e9fda473d620df9a3da0df2a74141d53e + languageName: node + linkType: hard + "react-json-view-lite@npm:^1.2.0": version: 1.2.1 resolution: "react-json-view-lite@npm:1.2.1" @@ -17736,6 +18969,13 @@ __metadata: languageName: node linkType: hard +"resolve.exports@npm:^2.0.0": + version: 2.0.2 + resolution: "resolve.exports@npm:2.0.2" + checksum: 1c7778ca1b86a94f8ab4055d196c7d87d1874b96df4d7c3e67bbf793140f0717fd506dcafd62785b079cd6086b9264424ad634fb904409764c3509c3df1653f2 + languageName: node + linkType: hard + "resolve@npm:1.17.0": version: 1.17.0 resolution: "resolve@npm:1.17.0" @@ -17745,7 +18985,7 @@ __metadata: languageName: node linkType: hard -"resolve@npm:^1.1.6, resolve@npm:^1.14.2, resolve@npm:^1.19.0, resolve@npm:^1.3.2, resolve@npm:^1.9.0": +"resolve@npm:^1.1.6, resolve@npm:^1.14.2, resolve@npm:^1.19.0, resolve@npm:^1.20.0, resolve@npm:^1.3.2, resolve@npm:^1.9.0": version: 1.22.8 resolution: "resolve@npm:1.22.8" dependencies: @@ -17767,7 +19007,7 @@ __metadata: languageName: node linkType: hard -"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.3.2#~builtin, resolve@patch:resolve@^1.9.0#~builtin": +"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.20.0#~builtin, resolve@patch:resolve@^1.3.2#~builtin, resolve@patch:resolve@^1.9.0#~builtin": version: 1.22.8 resolution: "resolve@patch:resolve@npm%3A1.22.8#~builtin::version=1.22.8&hash=c3c19d" dependencies: @@ -18525,6 +19765,16 @@ __metadata: languageName: node linkType: hard +"source-map-support@npm:0.5.13": + version: 0.5.13 + resolution: "source-map-support@npm:0.5.13" + dependencies: + buffer-from: ^1.0.0 + source-map: ^0.6.0 + checksum: 933550047b6c1a2328599a21d8b7666507427c0f5ef5eaadd56b5da0fd9505e239053c66fe181bf1df469a3b7af9d775778eee283cbb7ae16b902ddc09e93a97 + languageName: node + linkType: hard + "source-map-support@npm:^0.5.13, source-map-support@npm:~0.5.20": version: 0.5.21 resolution: "source-map-support@npm:0.5.21" @@ -18636,6 +19886,15 @@ __metadata: languageName: node linkType: hard +"stack-utils@npm:^2.0.3": + version: 2.0.6 + resolution: "stack-utils@npm:2.0.6" + dependencies: + escape-string-regexp: ^2.0.0 + checksum: 052bf4d25bbf5f78e06c1d5e67de2e088b06871fa04107ca8d3f0e9d9263326e2942c8bedee3545795fc77d787d443a538345eef74db2f8e35db3558c6f91ff7 + languageName: node + linkType: hard + "stacktrace-parser@npm:^0.1.10": version: 0.1.10 resolution: "stacktrace-parser@npm:0.1.10" @@ -18703,6 +19962,16 @@ __metadata: languageName: node linkType: hard +"string-length@npm:^4.0.1": + version: 4.0.2 + resolution: "string-length@npm:4.0.2" + dependencies: + char-regex: ^1.0.2 + strip-ansi: ^6.0.0 + checksum: ce85533ef5113fcb7e522bcf9e62cb33871aa99b3729cec5595f4447f660b0cefd542ca6df4150c97a677d58b0cb727a3fe09ac1de94071d05526c73579bf505 + languageName: node + linkType: hard + "string-range@npm:~1.2, string-range@npm:~1.2.1": version: 1.2.2 resolution: "string-range@npm:1.2.2" @@ -18812,6 +20081,13 @@ __metadata: languageName: node linkType: hard +"strip-bom@npm:^4.0.0": + version: 4.0.0 + resolution: "strip-bom@npm:4.0.0" + checksum: 9dbcfbaf503c57c06af15fe2c8176fb1bf3af5ff65003851a102749f875a6dbe0ab3b30115eccf6e805e9d756830d3e40ec508b62b3f1ddf3761a20ebe29d3f3 + languageName: node + linkType: hard + "strip-final-newline@npm:^2.0.0": version: 2.0.0 resolution: "strip-final-newline@npm:2.0.0" @@ -19081,6 +20357,17 @@ __metadata: languageName: node linkType: hard +"test-exclude@npm:^6.0.0": + version: 6.0.0 + resolution: "test-exclude@npm:6.0.0" + dependencies: + "@istanbuljs/schema": ^0.1.2 + glob: ^7.1.4 + minimatch: ^3.0.4 + checksum: 3b34a3d77165a2cb82b34014b3aba93b1c4637a5011807557dc2f3da826c59975a5ccad765721c4648b39817e3472789f9b0fa98fc854c5c1c7a1e632aacdc28 + languageName: node + linkType: hard + "text-encoding@npm:^0.7.0": version: 0.7.0 resolution: "text-encoding@npm:0.7.0" @@ -19095,6 +20382,15 @@ __metadata: languageName: node linkType: hard +"thingies@npm:^1.11.1": + version: 1.15.0 + resolution: "thingies@npm:1.15.0" + peerDependencies: + tslib: ^2 + checksum: 9721bc0cbcf1565ba1abd70cfe5141a638c88dded74abb24d9b21749e16034af37dfa68edd37e7d1bb1b1c9c8bfb301c4699a8e4bc998a3a9c18052edb829bb2 + languageName: node + linkType: hard + "through@npm:2, through@npm:^2.3.8, through@npm:~2.3, through@npm:~2.3.1": version: 2.3.8 resolution: "through@npm:2.3.8" @@ -19139,6 +20435,13 @@ __metadata: languageName: node linkType: hard +"tmpl@npm:1.0.5": + version: 1.0.5 + resolution: "tmpl@npm:1.0.5" + checksum: cd922d9b853c00fe414c5a774817be65b058d54a2d01ebb415840960406c669a0fc632f66df885e24cb022ec812739199ccbdb8d1164c3e513f85bfca5ab2873 + languageName: node + linkType: hard + "to-fast-properties@npm:^2.0.0": version: 2.0.0 resolution: "to-fast-properties@npm:2.0.0" @@ -19257,6 +20560,39 @@ __metadata: languageName: node linkType: hard +"ts-jest@npm:^29.1.1": + version: 29.1.1 + resolution: "ts-jest@npm:29.1.1" + dependencies: + bs-logger: 0.x + fast-json-stable-stringify: 2.x + jest-util: ^29.0.0 + json5: ^2.2.3 + lodash.memoize: 4.x + make-error: 1.x + semver: ^7.5.3 + yargs-parser: ^21.0.1 + peerDependencies: + "@babel/core": ">=7.0.0-beta.0 <8" + "@jest/types": ^29.0.0 + babel-jest: ^29.0.0 + jest: ^29.0.0 + typescript: ">=4.3 <6" + peerDependenciesMeta: + "@babel/core": + optional: true + "@jest/types": + optional: true + babel-jest: + optional: true + esbuild: + optional: true + bin: + ts-jest: cli.js + checksum: a8c9e284ed4f819526749f6e4dc6421ec666f20ab44d31b0f02b4ed979975f7580b18aea4813172d43e39b29464a71899f8893dd29b06b4a351a3af8ba47b402 + languageName: node + linkType: hard + "ts-loader@npm:^9.5.1": version: 9.5.1 resolution: "ts-loader@npm:9.5.1" @@ -19414,7 +20750,7 @@ __metadata: languageName: node linkType: hard -"type-detect@npm:^4.0.0, type-detect@npm:^4.0.8": +"type-detect@npm:4.0.8, type-detect@npm:^4.0.0, type-detect@npm:^4.0.8": version: 4.0.8 resolution: "type-detect@npm:4.0.8" checksum: 62b5628bff67c0eb0b66afa371bd73e230399a8d2ad30d852716efcc4656a7516904570cd8631a49a3ce57c10225adf5d0cbdcb47f6b0255fe6557c453925a15 @@ -20268,6 +21604,15 @@ __metadata: languageName: node linkType: hard +"walker@npm:^1.0.8": + version: 1.0.8 + resolution: "walker@npm:1.0.8" + dependencies: + makeerror: 1.0.12 + checksum: ad7a257ea1e662e57ef2e018f97b3c02a7240ad5093c392186ce0bcf1f1a60bbadd520d073b9beb921ed99f64f065efb63dfc8eec689a80e569f93c1c5d5e16c + languageName: node + linkType: hard + "watchpack@npm:^2.1.1, watchpack@npm:^2.4.0": version: 2.4.0 resolution: "watchpack@npm:2.4.0" @@ -20694,6 +22039,16 @@ __metadata: languageName: node linkType: hard +"write-file-atomic@npm:^4.0.2": + version: 4.0.2 + resolution: "write-file-atomic@npm:4.0.2" + dependencies: + imurmurhash: ^0.1.4 + signal-exit: ^3.0.7 + checksum: 5da60bd4eeeb935eec97ead3df6e28e5917a6bd317478e4a85a5285e8480b8ed96032bbcc6ecd07b236142a24f3ca871c924ec4a6575e623ec1b11bf8c1c253c + languageName: node + linkType: hard + "ws@npm:7.4.6": version: 7.4.6 resolution: "ws@npm:7.4.6" @@ -20883,7 +22238,7 @@ __metadata: languageName: node linkType: hard -"yargs-parser@npm:^21.1.1": +"yargs-parser@npm:^21.0.1, yargs-parser@npm:^21.1.1": version: 21.1.1 resolution: "yargs-parser@npm:21.1.1" checksum: ed2d96a616a9e3e1cc7d204c62ecc61f7aaab633dcbfab2c6df50f7f87b393993fe6640d017759fe112d0cb1e0119f2b4150a87305cc873fd90831c6a58ccf1c @@ -20932,7 +22287,7 @@ __metadata: languageName: node linkType: hard -"yargs@npm:^17.7.1": +"yargs@npm:^17.3.1, yargs@npm:^17.7.1": version: 17.7.2 resolution: "yargs@npm:17.7.2" dependencies: From 9129dbd24ad95c1ed21a2eba3c026642d7c301ac Mon Sep 17 00:00:00 2001 From: thunkar Date: Tue, 19 Dec 2023 10:09:47 +0000 Subject: [PATCH 04/37] Cleanup --- compiler/wasm/.mocharc.json | 14 ++ compiler/wasm/Cargo.toml | 5 + compiler/wasm/jest.config.ts | 21 -- compiler/wasm/package.json | 18 +- .../{test_lib => deps/lib-c}/Nargo.toml | 2 +- .../{test_lib => deps/lib-c}/src/lib.nr | 0 .../{test_lib => deps/lib-c}/src/module.nr | 0 .../lib-c}/src/module/foo.nr | 0 .../Nargo.toml | 2 +- .../src/main.nr | 0 .../simple/{noir-script => }/Nargo.toml | 0 .../simple/{noir-script => }/src/main.nr | 0 .../noir-script => with-deps}/Nargo.toml | 2 +- .../noir-script => with-deps}/src/main.nr | 0 .../src/noir/contract-interface-gen/abi.ts | 150 ------------- .../contractTypescript.ts | 210 ------------------ .../programTypescript.ts | 189 ---------------- .../noir/dependencies/dependency-manager.ts | 2 +- .../github-dependency-resolver.ts | 2 +- compiler/wasm/src/noir/noir-wasm-compiler.ts | 75 +------ compiler/wasm/src/noir_wasm.ts | 24 +- compiler/wasm/src/types/abi.ts | 154 ------------- .../wasm/src/{noir => types}/noir_artifact.ts | 88 +++++--- compiler/wasm/src/{types => }/utils.ts | 0 compiler/wasm/test/compiler/index.test.ts | 84 +++++++ .../dependencies/dependency-manager.test.ts | 18 +- .../github-dependency-resolver.test.ts | 94 ++++---- .../local-dependency-resolver.test.ts | 41 ++-- .../test/file-manager/file-manager.test.ts | 38 ++-- compiler/wasm/test/shared.ts | 17 +- compiler/wasm/test/wasm/browser/index.test.ts | 20 +- compiler/wasm/test/wasm/node/index.test.ts | 36 +-- compiler/wasm/tsconfig.cjs.json | 6 - compiler/wasm/tsconfig.esm.json | 9 - compiler/wasm/tsconfig.json | 9 +- compiler/wasm/web-test-runner.config.mjs | 4 +- compiler/wasm/webpack.config.ts | 8 +- 37 files changed, 343 insertions(+), 999 deletions(-) create mode 100644 compiler/wasm/.mocharc.json delete mode 100644 compiler/wasm/jest.config.ts rename compiler/wasm/public/fixtures/{test_lib => deps/lib-c}/Nargo.toml (83%) rename compiler/wasm/public/fixtures/{test_lib => deps/lib-c}/src/lib.nr (100%) rename compiler/wasm/public/fixtures/{test_lib => deps/lib-c}/src/module.nr (100%) rename compiler/wasm/public/fixtures/{test_lib => deps/lib-c}/src/module/foo.nr (100%) rename compiler/wasm/public/fixtures/{test_contract => noir-contract}/Nargo.toml (75%) rename compiler/wasm/public/fixtures/{test_contract => noir-contract}/src/main.nr (100%) rename compiler/wasm/public/fixtures/simple/{noir-script => }/Nargo.toml (100%) rename compiler/wasm/public/fixtures/simple/{noir-script => }/src/main.nr (100%) rename compiler/wasm/public/fixtures/{deps/noir-script => with-deps}/Nargo.toml (70%) rename compiler/wasm/public/fixtures/{deps/noir-script => with-deps}/src/main.nr (100%) delete mode 100644 compiler/wasm/src/noir/contract-interface-gen/abi.ts delete mode 100644 compiler/wasm/src/noir/contract-interface-gen/contractTypescript.ts delete mode 100644 compiler/wasm/src/noir/contract-interface-gen/programTypescript.ts rename compiler/wasm/src/{noir => types}/noir_artifact.ts (68%) rename compiler/wasm/src/{types => }/utils.ts (100%) create mode 100644 compiler/wasm/test/compiler/index.test.ts delete mode 100644 compiler/wasm/tsconfig.cjs.json delete mode 100644 compiler/wasm/tsconfig.esm.json diff --git a/compiler/wasm/.mocharc.json b/compiler/wasm/.mocharc.json new file mode 100644 index 00000000000..0a24f530091 --- /dev/null +++ b/compiler/wasm/.mocharc.json @@ -0,0 +1,14 @@ +{ + "require": "ts-node/register", + "extensions": [ + "ts" + ], + "spec": [ + "**/!(browser)/*.test.ts" + ], + "node-option": [ + "experimental-specifier-resolution=node", + "loader=ts-node/esm" + ] + } + \ No newline at end of file diff --git a/compiler/wasm/Cargo.toml b/compiler/wasm/Cargo.toml index 58ad7764fdc..4b3130eab7d 100644 --- a/compiler/wasm/Cargo.toml +++ b/compiler/wasm/Cargo.toml @@ -33,3 +33,8 @@ getrandom = { workspace = true, features = ["js"] } [build-dependencies] build-data.workspace = true + +# `wasm-opt` is on by default in for the release profile, but it can be +# disabled by setting it to `false` +[package.metadata.wasm-pack.profile.release] +wasm-opt = false diff --git a/compiler/wasm/jest.config.ts b/compiler/wasm/jest.config.ts deleted file mode 100644 index 53645580c20..00000000000 --- a/compiler/wasm/jest.config.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { Config } from 'jest'; - -const config: Config = { - moduleNameMapper: { - '^(\\.{1,2}/.*)\\.[cm]?js$': '$1', - }, - extensionsToTreatAsEsm: ['.ts'], - moduleFileExtensions: ['js', 'ts', 'cts'], - testRegex: './.*\\.test\\.(js|mjs|ts)$', - rootDir: './', - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - useESM: true, - }, - ], - }, -}; - -export default config; diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index 941aad0a9f3..1d95d87b523 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -19,9 +19,10 @@ }, "scripts": { "serve": "webpack serve", + "build-fixtures": "cd public/fixtures && cd simple && nargo compile && cd ../with-deps && nargo compile && cd ../noir-contract && nargo compile && cd ../", "build": "webpack", "test": "yarn test:node && yarn test:browser", - "test:node": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --passWithNoTests", + "test:node": "NODE_NO_WARNINGS=1 $(yarn bin mocha) --config ./.mocharc.json", "test:browser": "web-test-runner", "clean": "chmod u+w web nodejs || true && rm -rf ./build ./target ./dist", "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", @@ -38,15 +39,19 @@ "@jest/globals": "^29.7.0", "@ltd/j-toml": "^1.38.0", "@types/babel__preset-env": "^7", - "@types/jest": "^29.5.11", + "@types/chai": "^4", + "@types/chai-as-promised": "^7.1.8", "@types/lodash.capitalize": "^4", "@types/lodash.compact": "^3", "@types/lodash.times": "^4", "@types/lodash.upperfirst": "^4", + "@types/mocha": "^10.0.6", + "@types/mocha-each": "^2", "@types/node": "^20.10.0", "@types/pako": "^2", "@types/path-browserify": "^1", "@types/readable-stream": "^4", + "@types/sinon": "^17", "@wasm-tool/wasm-pack-plugin": "^1.7.0", "@web/dev-server-esbuild": "^0.3.6", "@web/test-runner": "^0.15.3", @@ -55,23 +60,28 @@ "babel-loader": "^9.1.3", "browserify-fs": "^1.0.0", "buffer": "^6.0.3", + "chai": "^4.3.10", "copy-webpack-plugin": "^11.0.0", + "cross-env": "^7.0.3", "file-loader": "^6.2.0", "html-webpack-plugin": "^5.5.4", - "jest": "^29.7.0", "lodash.capitalize": "^4.2.1", "lodash.compact": "^3.0.1", "lodash.times": "^4.3.2", "lodash.upperfirst": "^4.3.1", "memfs": "^4.6.0", + "mocha": "^10.2.0", + "mocha-each": "^2.0.1", "pako": "^2.1.0", "path-browserify": "^1.0.1", + "playwright": "^1.40.1", "process": "^0.11.10", "readable-stream": "^4.4.2", + "sinon": "^17.0.1", "text-encoding": "^0.7.0", - "ts-jest": "^29.1.1", "ts-loader": "^9.5.1", "ts-node": "^10.9.1", + "tsconfig-paths": "^4.2.0", "typescript": "~5.2.2", "unzipit": "^1.4.3", "url": "^0.11.3", diff --git a/compiler/wasm/public/fixtures/test_lib/Nargo.toml b/compiler/wasm/public/fixtures/deps/lib-c/Nargo.toml similarity index 83% rename from compiler/wasm/public/fixtures/test_lib/Nargo.toml rename to compiler/wasm/public/fixtures/deps/lib-c/Nargo.toml index fe1288f4a6e..dafdb62e045 100644 --- a/compiler/wasm/public/fixtures/test_lib/Nargo.toml +++ b/compiler/wasm/public/fixtures/deps/lib-c/Nargo.toml @@ -1,5 +1,5 @@ [package] -name = "testlib" +name = "lib_c" authors = [""] compiler_version = ">=0.18.0" type = "lib" diff --git a/compiler/wasm/public/fixtures/test_lib/src/lib.nr b/compiler/wasm/public/fixtures/deps/lib-c/src/lib.nr similarity index 100% rename from compiler/wasm/public/fixtures/test_lib/src/lib.nr rename to compiler/wasm/public/fixtures/deps/lib-c/src/lib.nr diff --git a/compiler/wasm/public/fixtures/test_lib/src/module.nr b/compiler/wasm/public/fixtures/deps/lib-c/src/module.nr similarity index 100% rename from compiler/wasm/public/fixtures/test_lib/src/module.nr rename to compiler/wasm/public/fixtures/deps/lib-c/src/module.nr diff --git a/compiler/wasm/public/fixtures/test_lib/src/module/foo.nr b/compiler/wasm/public/fixtures/deps/lib-c/src/module/foo.nr similarity index 100% rename from compiler/wasm/public/fixtures/test_lib/src/module/foo.nr rename to compiler/wasm/public/fixtures/deps/lib-c/src/module/foo.nr diff --git a/compiler/wasm/public/fixtures/test_contract/Nargo.toml b/compiler/wasm/public/fixtures/noir-contract/Nargo.toml similarity index 75% rename from compiler/wasm/public/fixtures/test_contract/Nargo.toml rename to compiler/wasm/public/fixtures/noir-contract/Nargo.toml index 44ea20e01ba..2e64f3ebc9c 100644 --- a/compiler/wasm/public/fixtures/test_contract/Nargo.toml +++ b/compiler/wasm/public/fixtures/noir-contract/Nargo.toml @@ -5,4 +5,4 @@ compiler_version = ">=0.18.0" type = "contract" [dependencies] -test = { path = "../test_lib" } +test = { path = "../deps/lib-c" } diff --git a/compiler/wasm/public/fixtures/test_contract/src/main.nr b/compiler/wasm/public/fixtures/noir-contract/src/main.nr similarity index 100% rename from compiler/wasm/public/fixtures/test_contract/src/main.nr rename to compiler/wasm/public/fixtures/noir-contract/src/main.nr diff --git a/compiler/wasm/public/fixtures/simple/noir-script/Nargo.toml b/compiler/wasm/public/fixtures/simple/Nargo.toml similarity index 100% rename from compiler/wasm/public/fixtures/simple/noir-script/Nargo.toml rename to compiler/wasm/public/fixtures/simple/Nargo.toml diff --git a/compiler/wasm/public/fixtures/simple/noir-script/src/main.nr b/compiler/wasm/public/fixtures/simple/src/main.nr similarity index 100% rename from compiler/wasm/public/fixtures/simple/noir-script/src/main.nr rename to compiler/wasm/public/fixtures/simple/src/main.nr diff --git a/compiler/wasm/public/fixtures/deps/noir-script/Nargo.toml b/compiler/wasm/public/fixtures/with-deps/Nargo.toml similarity index 70% rename from compiler/wasm/public/fixtures/deps/noir-script/Nargo.toml rename to compiler/wasm/public/fixtures/with-deps/Nargo.toml index 7c8182a02ae..b7543525059 100644 --- a/compiler/wasm/public/fixtures/deps/noir-script/Nargo.toml +++ b/compiler/wasm/public/fixtures/with-deps/Nargo.toml @@ -4,4 +4,4 @@ type="bin" authors = [""] [dependencies] -lib_a = { path="../lib-a" } +lib_a = { path="../deps/lib-a" } diff --git a/compiler/wasm/public/fixtures/deps/noir-script/src/main.nr b/compiler/wasm/public/fixtures/with-deps/src/main.nr similarity index 100% rename from compiler/wasm/public/fixtures/deps/noir-script/src/main.nr rename to compiler/wasm/public/fixtures/with-deps/src/main.nr diff --git a/compiler/wasm/src/noir/contract-interface-gen/abi.ts b/compiler/wasm/src/noir/contract-interface-gen/abi.ts deleted file mode 100644 index c30a884e832..00000000000 --- a/compiler/wasm/src/noir/contract-interface-gen/abi.ts +++ /dev/null @@ -1,150 +0,0 @@ -import { deflate } from 'pako'; - -import { - NoirCompilationResult, - NoirContractCompilationArtifacts, - NoirFunctionEntry, - NoirProgramCompilationArtifacts, - ProgramArtifact, - isNoirContractCompilationArtifacts, - isNoirProgramCompilationArtifacts, -} from '../noir_artifact.js'; -import { ABIType, ContractArtifact, DebugMetadata, FunctionArtifact, FunctionType } from '../../types/abi.js'; - -// TODO - What to do? -export const FUNCTION_TREE_HEIGHT = 5; -export const mockVerificationKey = - '0000000200000800000000740000000f00000003515f3109623eb3c25aa5b16a1a79fd558bac7a7ce62c4560a8c537c77ce80dd339128d1d37b6582ee9e6df9567efb64313471dfa18f520f9ce53161b50dbf7731bc5f900000003515f322bc4cce83a486a92c92fd59bd84e0f92595baa639fc2ed86b00ffa0dfded2a092a669a3bdb7a273a015eda494457cc7ed5236f26cee330c290d45a33b9daa94800000003515f332729426c008c085a81bd34d8ef12dd31e80130339ef99d50013a89e4558eee6d0fa4ffe2ee7b7b62eb92608b2251ac31396a718f9b34978888789042b790a30100000003515f342be6b6824a913eb7a57b03cb1ee7bfb4de02f2f65fe8a4e97baa7766ddb353a82a8a25c49dc63778cd9fe96173f12a2bc77f3682f4c4448f98f1df82c75234a100000003515f351f85760d6ab567465aadc2f180af9eae3800e6958fec96aef53fd8a7b195d7c000c6267a0dd5cfc22b3fe804f53e266069c0e36f51885baec1e7e67650c62e170000000c515f41524954484d455449430d9d0f8ece2aa12012fa21e6e5c859e97bd5704e5c122064a66051294bc5e04213f61f54a0ebdf6fee4d4a6ecf693478191de0c2899bcd8e86a636c8d3eff43400000003515f43224a99d02c86336737c8dd5b746c40d2be6aead8393889a76a18d664029096e90f7fe81adcc92a74350eada9622ac453f49ebac24a066a1f83b394df54dfa0130000000c515f46495845445f42415345060e8a013ed289c2f9fd7473b04f6594b138ddb4b4cf6b901622a14088f04b8d2c83ff74fce56e3d5573b99c7b26d85d5046ce0c6559506acb7a675e7713eb3a00000007515f4c4f4749430721a91cb8da4b917e054f72147e1760cfe0ef3d45090ac0f4961d84ec1996961a25e787b26bd8b50b1a99450f77a424a83513c2b33af268cd253b0587ff50c700000003515f4d05dbd8623b8652511e1eb38d38887a69eceb082f807514f09e127237c5213b401b9325b48c6c225968002318095f89d0ef9cf629b2b7f0172e03bc39aacf6ed800000007515f52414e474504b57a3805e41df328f5ca9aefa40fad5917391543b7b65c6476e60b8f72e9ad07c92f3b3e11c8feae96dedc4b14a6226ef3201244f37cfc1ee5b96781f48d2b000000075349474d415f3125001d1954a18571eaa007144c5a567bb0d2be4def08a8be918b8c05e3b27d312c59ed41e09e144eab5de77ca89a2fd783be702a47c951d3112e3de02ce6e47c000000075349474d415f3223994e6a23618e60fa01c449a7ab88378709197e186d48d604bfb6931ffb15ad11c5ec7a0700570f80088fd5198ab5d5c227f2ad2a455a6edeec024156bb7beb000000075349474d415f3300cda5845f23468a13275d18bddae27c6bb189cf9aa95b6a03a0cb6688c7e8d829639b45cf8607c525cc400b55ebf90205f2f378626dc3406cc59b2d1b474fba000000075349474d415f342d299e7928496ea2d37f10b43afd6a80c90a33b483090d18069ffa275eedb2fc2f82121e8de43dc036d99b478b6227ceef34248939987a19011f065d8b5cef5c0000000010000000000000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f'; - -/** - * Returns whether the ABI type is an Aztec or Ethereum Address defined in Aztec.nr. - * @param abiType - Type to check. - * @returns Boolean. - */ -export function isAddressStruct(abiType: ABIType) { - return isEthereumAddressStruct(abiType) || isAztecAddressStruct(abiType); -} - -/** - * Returns whether the ABI type is an Ethereum Address defined in Aztec.nr. - * @param abiType - Type to check. - * @returns Boolean. - */ -export function isEthereumAddressStruct(abiType: ABIType) { - return abiType.kind === 'struct' && abiType.path.endsWith('::types::address::EthereumAddress'); -} - -/** - * Returns whether the ABI type is an Aztec Address defined in Aztec.nr. - * @param abiType - Type to check. - * @returns Boolean. - */ -export function isAztecAddressStruct(abiType: ABIType) { - return abiType.kind === 'struct' && abiType.path.endsWith('::types::address::AztecAddress'); -} - -/** - * Generates a function build artifact. Replaces verification key with a mock value. - * @param fn - Noir function entry. - * @returns Function artifact. - */ -function generateFunctionArtifact(fn: NoirFunctionEntry): FunctionArtifact { - const functionType = fn.function_type.toLowerCase() as FunctionType; - const isInternal = fn.is_internal; - - // If the function is not unconstrained, the first item is inputs or CallContext which we should omit - let parameters = fn.abi.parameters; - if (functionType !== FunctionType.UNCONSTRAINED) { - parameters = parameters.slice(1); - } - - // If the function is secret, the return is the public inputs, which should be omitted - const returnTypes = functionType === FunctionType.SECRET ? [] : [fn.abi.return_type]; - - return { - name: fn.name, - functionType, - isInternal, - parameters, - returnTypes, - bytecode: fn.bytecode, - verificationKey: mockVerificationKey, - }; -} - -/** - * Entrypoint for generating the .json artifact for compiled contract or program - * @param compileResult - Noir build output. - * @returns Aztec contract build artifact. - */ -export function generateArtifact(compileResult: NoirCompilationResult) { - if (isNoirContractCompilationArtifacts(compileResult)) { - return generateContractArtifact(compileResult); - } else if (isNoirProgramCompilationArtifacts(compileResult)) { - return generateProgramArtifact(compileResult); - } else { - throw Error('Unsupported artifact type'); - } -} - -/** - * Given a Nargo output generates an Aztec-compatible contract artifact. - * @param compiled - Noir build output. - * @returns Aztec contract build artifact. - */ -export function generateProgramArtifact( - { program }: NoirProgramCompilationArtifacts, - // eslint-disable-next-line camelcase - noir_version?: string, -): ProgramArtifact { - return { - // eslint-disable-next-line camelcase - noir_version, - hash: program.hash, - backend: program.backend, - abi: program.abi, - - // TODO: should we parse and write the debug? it doesn't seem to be in the nargo output - // debug: someParsedDebug, - }; -} - -/** - * Given a Nargo output generates an Aztec-compatible contract artifact. - * @param compiled - Noir build output. - * @returns Aztec contract build artifact. - */ -export function generateContractArtifact( - { contract, debug }: NoirContractCompilationArtifacts, - aztecNrVersion?: string, -): ContractArtifact { - const constructorArtifact = contract.functions.find(({ name }) => name === 'constructor'); - if (constructorArtifact === undefined) { - throw new Error('Contract must have a constructor function'); - } - if (contract.functions.length > 2 ** FUNCTION_TREE_HEIGHT) { - throw new Error(`Contract can only have a maximum of ${2 ** FUNCTION_TREE_HEIGHT} functions`); - } - const originalFunctions = contract.functions; - // TODO why sort? we should have idempotent compilation so this should not be needed. - const sortedFunctions = [...contract.functions].sort((fnA, fnB) => fnA.name.localeCompare(fnB.name)); - let parsedDebug: DebugMetadata | undefined = undefined; - - if (debug) { - parsedDebug = { - debugSymbols: sortedFunctions.map((fn) => { - const originalIndex = originalFunctions.indexOf(fn); - return Buffer.from(deflate(JSON.stringify(debug.debug_symbols[originalIndex]))).toString('base64'); - }), - fileMap: debug.file_map, - }; - } - - return { - name: contract.name, - functions: sortedFunctions.map(generateFunctionArtifact), - events: contract.events, - debug: parsedDebug, - aztecNrVersion, - }; -} diff --git a/compiler/wasm/src/noir/contract-interface-gen/contractTypescript.ts b/compiler/wasm/src/noir/contract-interface-gen/contractTypescript.ts deleted file mode 100644 index dc601140781..00000000000 --- a/compiler/wasm/src/noir/contract-interface-gen/contractTypescript.ts +++ /dev/null @@ -1,210 +0,0 @@ -import compact from 'lodash.compact'; -import { ABIParameter, ContractArtifact, FunctionArtifact } from '../../types/abi'; -import { isAztecAddressStruct, isEthereumAddressStruct } from './abi'; - -/** - * Returns the corresponding typescript type for a given Noir type. - * @param type - The input Noir type. - * @returns An equivalent typescript type. - */ -function abiTypeToTypescript(type: ABIParameter['type']): string { - switch (type.kind) { - case 'field': - return 'FieldLike'; - case 'boolean': - return 'boolean'; - case 'integer': - return '(bigint | number)'; - case 'string': - return 'string'; - case 'array': - return `${abiTypeToTypescript(type.type)}[]`; - case 'struct': - if (isEthereumAddressStruct(type)) { - return 'EthAddressLike'; - } - if (isAztecAddressStruct(type)) { - return 'AztecAddressLike'; - } - return `{ ${type.fields.map((f) => `${f.name}: ${abiTypeToTypescript(f.type)}`).join(', ')} }`; - default: - throw new Error(`Unknown type ${type}`); - } -} - -/** - * Generates the typescript code to represent a Noir parameter. - * @param param - A Noir parameter with name and type. - * @returns The corresponding ts code. - */ -function generateParameter(param: ABIParameter) { - return `${param.name}: ${abiTypeToTypescript(param.type)}`; -} - -/** - * Generates the typescript code to represent a Noir function as a type. - * @param param - A Noir function. - * @returns The corresponding ts code. - */ -function generateMethod(entry: FunctionArtifact) { - const args = entry.parameters.map(generateParameter).join(', '); - return ` - /** ${entry.name}(${entry.parameters.map((p) => `${p.name}: ${p.type.kind}`).join(', ')}) */ - ${entry.name}: ((${args}) => ContractFunctionInteraction) & Pick;`; -} - -/** - * Generates a deploy method for this contract. - * @param input - Build artifact of the contract. - * @returns A type-safe deploy method in ts. - */ -function generateDeploy(input: ContractArtifact) { - const ctor = input.functions.find((f) => f.name === 'constructor'); - const args = (ctor?.parameters ?? []).map(generateParameter).join(', '); - const artifactName = `${input.name}ContractArtifact`; - - return ` - /** - * Creates a tx to deploy a new instance of this contract. - */ - public static deploy(wallet: Wallet, ${args}) { - return new DeployMethod<${input.name}Contract>(Point.ZERO, wallet, ${artifactName}, Array.from(arguments).slice(1)); - } - - /** - * Creates a tx to deploy a new instance of this contract using the specified public key to derive the address. - */ - public static deployWithPublicKey(publicKey: PublicKey, wallet: Wallet, ${args}) { - return new DeployMethod<${input.name}Contract>(publicKey, wallet, ${artifactName}, Array.from(arguments).slice(2)); - } - `; -} - -/** - * Generates the constructor by supplying the ABI to the parent class so the user doesn't have to. - * @param name - Name of the contract to derive the ABI name from. - * @returns A constructor method. - * @remarks The constructor is private because we want to force the user to use the create method. - */ -function generateConstructor(name: string) { - return ` - private constructor( - completeAddress: CompleteAddress, - wallet: Wallet, - portalContract = EthAddress.ZERO - ) { - super(completeAddress, ${name}ContractArtifact, wallet, portalContract); - } - `; -} - -/** - * Generates the at method for this contract. - * @param name - Name of the contract to derive the ABI name from. - * @returns An at method. - * @remarks We don't use constructor directly because of the async `wallet.getContractData` call. - */ -function generateAt(name: string) { - return ` - /** - * Creates a contract instance. - * @param address - The deployed contract's address. - * @param wallet - The wallet to use when interacting with the contract. - * @returns A promise that resolves to a new Contract instance. - */ - public static async at( - address: AztecAddress, - wallet: Wallet, - ) { - return Contract.at(address, ${name}Contract.artifact, wallet) as Promise<${name}Contract>; - }`; -} - -/** - * Generates a static getter for the contract's artifact. - * @param name - Name of the contract used to derive name of the artifact import. - */ -function generateArtifactGetter(name: string) { - const artifactName = `${name}ContractArtifact`; - return ` - /** - * Returns this contract's artifact. - */ - public static get artifact(): ContractArtifact { - return ${artifactName}; - } - `; -} - -/** - * Generates statements for importing the artifact from json and re-exporting it. - * @param name - Name of the contract. - * @param artifactImportPath - Path to load the ABI from. - * @returns Code. - */ -function generateAbiStatement(name: string, artifactImportPath: string) { - const stmts = [ - `import ${name}ContractArtifactJson from '${artifactImportPath}' assert { type: 'json' };`, - `export const ${name}ContractArtifact = ${name}ContractArtifactJson as ContractArtifact;`, - ]; - return stmts.join('\n'); -} - -/** - * Generates the typescript code to represent a contract. - * @param input - The compiled Noir artifact. - * @param artifactImportPath - Optional path to import the artifact (if not set, will be required in the constructor). - * @returns The corresponding ts code. - */ -export function generateTypescriptContractInterface(input: ContractArtifact, artifactImportPath?: string) { - // `compact` removes all falsey values from an array - const methods = compact(input.functions.filter((f) => f.name !== 'constructor').map(generateMethod)); - const deploy = artifactImportPath && generateDeploy(input); - const ctor = artifactImportPath && generateConstructor(input.name); - const at = artifactImportPath && generateAt(input.name); - const artifactStatement = artifactImportPath && generateAbiStatement(input.name, artifactImportPath); - const artifactGetter = artifactImportPath && generateArtifactGetter(input.name); - - return ` -/* Autogenerated file, do not edit! */ - -/* eslint-disable */ -import { - AztecAddress, - AztecAddressLike, - CompleteAddress, - Contract, - ContractArtifact, - ContractBase, - ContractFunctionInteraction, - ContractMethod, - DeployMethod, - EthAddress, - EthAddressLike, - FieldLike, - Fr, - Point, - PublicKey, - Wallet, -} from '@aztec/aztec.js'; -${artifactStatement} - -/** - * Type-safe interface for contract ${input.name}; - */ -export class ${input.name}Contract extends ContractBase { - ${ctor} - - ${at} - - ${deploy} - - ${artifactGetter} - - /** Type-safe wrappers for the public methods exposed by the contract. */ - public methods!: { - ${methods.join('\n')} - }; -} -`; -} diff --git a/compiler/wasm/src/noir/contract-interface-gen/programTypescript.ts b/compiler/wasm/src/noir/contract-interface-gen/programTypescript.ts deleted file mode 100644 index 267a8fd36c2..00000000000 --- a/compiler/wasm/src/noir/contract-interface-gen/programTypescript.ts +++ /dev/null @@ -1,189 +0,0 @@ -import { ABIType } from '../../types/abi'; -import { NoirFunctionAbi } from '../noir_artifact'; - -/** - * Keep track off all of the Noir primitive types that were used. - * Most of these will not have a 1-1 definition in TypeScript, - * so we will need to generate type aliases for them. - * - * We want to generate type aliases - * for specific types that are used in the ABI. - * - * For example: - * - If `Field` is used we want to alias that - * with `number`. - * - If `u32` is used we want to alias that with `number` too. - */ -type PrimitiveTypesUsed = { - /** - * The name of the type alias that we will generate. - */ - aliasName: string; - /** - * The TypeScript type that we will alias to. - */ - tsType: string; -}; - -const noirPrimitiveTypesToTsTypes = new Map(); - -/** - * Typescript does not allow us to check for equality of non-primitive types - * easily, so we create a addIfUnique function that will only add an item - * to the map if it is not already there by using JSON.stringify. - * @param item - The item to add to the map. - */ -function addIfUnique(item: PrimitiveTypesUsed) { - const key = JSON.stringify(item); - if (!noirPrimitiveTypesToTsTypes.has(key)) { - noirPrimitiveTypesToTsTypes.set(key, item); - } -} - -/** - * Converts an ABI type to a TypeScript type. - * @param type - The ABI type to convert. - * @returns The typescript code to define the type. - */ -function abiTypeToTs(type: ABIType): string { - switch (type.kind) { - case 'integer': { - let tsIntType = ''; - if (type.sign === 'signed') { - tsIntType = `i${type.width}`; - } else { - tsIntType = `u${type.width}`; - } - addIfUnique({ aliasName: tsIntType, tsType: 'string' }); - return tsIntType; - } - case 'boolean': - return `boolean`; - case 'array': - return `FixedLengthArray<${abiTypeToTs(type.type)}, ${type.length}>`; - case 'struct': - return getLastComponentOfPath(type.path); - case 'field': - addIfUnique({ aliasName: 'Field', tsType: 'string' }); - return 'Field'; - default: - throw new Error(`Unknown ABI type ${type}`); - } -} - -/** - * Returns the last component of a path, e.g. "foo::bar::baz" -\> "baz" - * Note: that if we have a path such as "Baz", we will return "Baz". - * - * Since these paths corresponds to structs, we can assume that we - * cannot have "foo::bar::". - * - * We also make the assumption that since these paths are coming from - * Noir, then we will not have two paths that look like this: - * - foo::bar::Baz - * - cat::dog::Baz - * ie the last component of the path (struct name) is enough to uniquely identify - * the whole path. - * - * TODO: We should double check this assumption when we use type aliases, - * I expect that `foo::bar::Baz as Dog` would effectively give `foo::bar::Dog` - * @param str - The path to get the last component of. - * @returns The last component of the path. - */ -function getLastComponentOfPath(str: string): string { - const parts = str.split('::'); - const lastPart = parts[parts.length - 1]; - return lastPart; -} - -/** - * Generates TypeScript interfaces for the structs used in the ABI. - * @param type - The ABI type to generate the interface for. - * @param output - The set of structs that we have already generated bindings for. - * @returns The TypeScript code to define the struct. - */ -function generateStructInterfaces(type: ABIType, output: Set): string { - let result = ''; - - // Edge case to handle the array of structs case. - if (type.kind === 'array' && type.type.kind === 'struct' && !output.has(getLastComponentOfPath(type.type.path))) { - result += generateStructInterfaces(type.type, output); - } - if (type.kind !== 'struct') { - return result; - } - - // List of structs encountered while viewing this type that we need to generate - // bindings for. - const typesEncountered = new Set(); - - // Codegen the struct and then its fields, so that the structs fields - // are defined before the struct itself. - let codeGeneratedStruct = ''; - let codeGeneratedStructFields = ''; - - const structName = getLastComponentOfPath(type.path); - if (!output.has(structName)) { - codeGeneratedStruct += `export interface ${structName} {\n`; - for (const field of type.fields) { - codeGeneratedStruct += ` ${field.name}: ${abiTypeToTs(field.type)};\n`; - typesEncountered.add(field.type); - } - codeGeneratedStruct += `}\n\n`; - output.add(structName); - - // Generate code for the encountered structs in the field above - for (const type of typesEncountered) { - codeGeneratedStructFields += generateStructInterfaces(type, output); - } - } - - return codeGeneratedStructFields + '\n' + codeGeneratedStruct; -} - -/** - * Generates a TypeScript interface for the ABI. - * @param abiObj - The ABI to generate the interface for. - * @returns The TypeScript code to define the interface. - */ -export function generateTypescriptProgramInterface(abiObj: NoirFunctionAbi): string { - let result = ``; - const outputStructs = new Set(); - - // Define structs for composite types - for (const param of abiObj.parameters) { - result += generateStructInterfaces(param.type, outputStructs); - } - - // Generating Return type, if it exists - // - if (abiObj.return_type != null) { - result += generateStructInterfaces(abiObj.return_type, outputStructs); - result += `export type ReturnType = ${abiTypeToTs(abiObj.return_type)};\n`; - } - - // Generating Input type - result += '\nexport interface InputType {\n'; - for (const param of abiObj.parameters) { - result += ` ${param.name}: ${abiTypeToTs(param.type)};\n`; - } - result += '}'; - - // Add the primitive Noir types that do not have a 1-1 mapping to TypeScript. - let primitiveTypeAliases = ''; - for (const [, value] of noirPrimitiveTypesToTsTypes) { - primitiveTypeAliases += `\nexport type ${value.aliasName} = ${value.tsType};`; - } - - const fixedLengthArray = - '\nexport type FixedLengthArray = L extends 0 ? never[]: T[] & { length: L }'; - - return ( - `/* Autogenerated file, do not edit! */\n\n/* eslint-disable */\n` + - fixedLengthArray + - '\n' + - primitiveTypeAliases + - '\n' + - result - ); -} diff --git a/compiler/wasm/src/noir/dependencies/dependency-manager.ts b/compiler/wasm/src/noir/dependencies/dependency-manager.ts index 78b20eb99e7..ba438326f93 100644 --- a/compiler/wasm/src/noir/dependencies/dependency-manager.ts +++ b/compiler/wasm/src/noir/dependencies/dependency-manager.ts @@ -3,7 +3,7 @@ import { join } from 'path'; import { NoirPackage } from '../package'; import { NoirDependency, NoirDependencyResolver } from './dependency-resolver'; import { NoirDependencyConfig } from '../../types/noir_package_config'; -import { LogData, LogFn } from '../../types/utils'; +import { LogData, LogFn } from '../../utils'; /** * Noir Dependency Resolver diff --git a/compiler/wasm/src/noir/dependencies/github-dependency-resolver.ts b/compiler/wasm/src/noir/dependencies/github-dependency-resolver.ts index 55f119fdbf3..221603c41bb 100644 --- a/compiler/wasm/src/noir/dependencies/github-dependency-resolver.ts +++ b/compiler/wasm/src/noir/dependencies/github-dependency-resolver.ts @@ -5,7 +5,7 @@ import { FileManager } from '../file-manager/file-manager'; import { NoirPackage } from '../package'; import { NoirDependency, NoirDependencyResolver } from './dependency-resolver'; import { NoirDependencyConfig, NoirGitDependencyConfig } from '../../types/noir_package_config'; -import { LogData } from '../../types/utils'; +import { LogData } from '../../utils'; /** * Downloads dependencies from github diff --git a/compiler/wasm/src/noir/noir-wasm-compiler.ts b/compiler/wasm/src/noir/noir-wasm-compiler.ts index 0261013468e..e28829b150c 100644 --- a/compiler/wasm/src/noir/noir-wasm-compiler.ts +++ b/compiler/wasm/src/noir/noir-wasm-compiler.ts @@ -5,8 +5,8 @@ import { GithubDependencyResolver as GithubCodeArchiveDependencyResolver } from import { LocalDependencyResolver } from './dependencies/local-dependency-resolver'; import { FileManager } from './file-manager/file-manager'; import { NoirPackage } from './package'; -import { LogData, LogFn } from '../types/utils'; -import { NoirCompilationResult, NoirProgramCompilationArtifacts } from './noir_artifact'; +import { LogData, LogFn } from '../utils'; +import { NoirCompilationResult } from '../types/noir_artifact'; /** Compilation options */ export type NoirWasmCompileOptions = { @@ -91,87 +91,26 @@ export class NoirWasmContractCompiler { ); } - /** - * Gets the version of Aztec.nr that was used compiling this contract. - */ - public getResolvedAztecNrVersion() { - // TODO eliminate this hardcoded library name! - // see docs/docs/dev_docs/contracts/setup.md - return this.#dependencyManager.getVersionOf('aztec'); - } - /** * Compile EntryPoint */ /** * Compile EntryPoint */ - public async compile(): Promise { - console.log(`Compiling Program at ${this.#package.getEntryPointPath()}`); - return await this.compileProgram(); - } - - /** - * Compiles the Program. - */ - public async compileProgram(): Promise { - await this.#dependencyManager.resolveDependencies(); - this.#debugLog(`Dependencies: ${this.#dependencyManager.getPackageNames().join(', ')}`); - - try { - const isContract: boolean = false; - - const entrypoint = this.#package.getEntryPointPath(); - const deps = { - /* eslint-disable camelcase */ - root_dependencies: this.#dependencyManager.getEntrypointDependencies(), - library_dependencies: this.#dependencyManager.getLibraryDependencies(), - /* eslint-enable camelcase */ - }; - const packageSources = await this.#package.getSources(this.#fm); - const librarySources = ( - await Promise.all( - this.#dependencyManager - .getLibraries() - .map(async ([alias, library]) => await library.package.getSources(this.#fm, alias)), - ) - ).flat(); - this.#sourceMap.clean(); - [...packageSources, ...librarySources].forEach((sourceFile) => { - this.#sourceMap.add_source_code(sourceFile.path, sourceFile.source); - }); - const result = this.#wasmCompiler.compile(entrypoint, isContract, deps, this.#sourceMap); - - if (!('program' in result)) { - throw new Error('No program found in compilation result'); - } + public async compile(): Promise { + console.log(`Compiling at ${this.#package.getEntryPointPath()}`); - return [{ name: this.#package.getNoirPackageConfig().package.name, ...result }]; - } catch (err) { - if (err instanceof Error && err.name === 'CompileError') { - await this.#processCompileError(err); - } - - throw err; - } - } - - /** - * Compiles the Contract. - */ - public async compileContract(): Promise { if (!(this.#package.getType() === 'contract' || this.#package.getType() === 'bin')) { this.#log( `Compile skipped - only supports compiling "contract" and "bin" package types (${this.#package.getType()})`, ); return []; } - this.#debugLog(`Compiling contract at ${this.#package.getEntryPointPath()}`); await this.#dependencyManager.resolveDependencies(); this.#debugLog(`Dependencies: ${this.#dependencyManager.getPackageNames().join(', ')}`); try { - const isContract: boolean = true; + const isContract: boolean = this.#package.getType() === 'contract'; const entrypoint = this.#package.getEntryPointPath(); const deps = { @@ -194,8 +133,8 @@ export class NoirWasmContractCompiler { }); const result = this.#wasmCompiler.compile(entrypoint, isContract, deps, this.#sourceMap); - if (!('contract' in result)) { - throw new Error('No contract found in compilation result'); + if ((isContract && !('contract' in result)) || (!isContract && !('program' in result))) { + throw new Error('Invalid compilation result'); } return [result]; diff --git a/compiler/wasm/src/noir_wasm.ts b/compiler/wasm/src/noir_wasm.ts index 6bf2d3967c0..901837a6e14 100644 --- a/compiler/wasm/src/noir_wasm.ts +++ b/compiler/wasm/src/noir_wasm.ts @@ -1,34 +1,18 @@ -import { ProgramArtifact, NoirProgramCompilationArtifacts } from './noir/noir_artifact'; +import { NoirCompilationResult } from './types/noir_artifact'; import { NoirWasmContractCompiler } from './noir/noir-wasm-compiler'; import { FileManager } from './noir/file-manager/file-manager'; -import { LogData } from './types/utils'; +import { LogData } from './utils'; -/** - * Given a Nargo output generates an Aztec-compatible contract artifact. - * @param compiled - Noir build output. - * @returns Aztec contract build artifact. - */ -function generateProgramArtifact({ program }: NoirProgramCompilationArtifacts, noir_version?: string): ProgramArtifact { - return { - noir_version, - hash: program.hash, - backend: program.backend, - abi: program.abi, - }; -} export async function compileUsingNoirWasm( fileManager: FileManager, projectPath: string, wasmCompiler: unknown, sourceMap: unknown, -): Promise { +): Promise { const compiler = await NoirWasmContractCompiler.new(fileManager, projectPath, wasmCompiler, sourceMap, { log: function (msg: string, _data?: LogData) { console.log(msg); }, }); - const artifacts = await compiler.compile(); - return artifacts.map((artifact) => { - return generateProgramArtifact(artifact); - }); + return await compiler.compile(); } diff --git a/compiler/wasm/src/types/abi.ts b/compiler/wasm/src/types/abi.ts index a3fabb6881d..f2ee83f1d22 100644 --- a/compiler/wasm/src/types/abi.ts +++ b/compiler/wasm/src/types/abi.ts @@ -114,157 +114,3 @@ export interface EventAbi { */ fields: ABIVariable[]; } - -/** - * Aztec.nr function types. - */ -export enum FunctionType { - SECRET = 'secret', - OPEN = 'open', - UNCONSTRAINED = 'unconstrained', -} - -/** - * The abi entry of a function. - */ -export interface FunctionAbi { - /** - * The name of the function. - */ - name: string; - /** - * Whether the function is secret. - */ - functionType: FunctionType; - /** - * Whether the function is internal. - */ - isInternal: boolean; - /** - * Function parameters. - */ - parameters: ABIParameter[]; - /** - * The types of the return values. - */ - returnTypes: ABIType[]; -} - -/** - * The artifact entry of a function. - */ -export interface FunctionArtifact extends FunctionAbi { - /** - * The ACIR bytecode of the function. - */ - bytecode: string; - /** - * The verification key of the function. - */ - verificationKey?: string; -} - -/** - * A file ID. It's assigned during compilation. - */ -export type FileId = number; - -/** - * A pointer to a specific section of the source code. - */ -export interface SourceCodeLocation { - /** - * The section of the source code. - */ - span: { - /** - * The byte where the section starts. - */ - start: number; - /** - * The byte where the section ends. - */ - end: number; - }; - /** - * The source code file pointed to. - */ - file: FileId; -} - -/** - * The location of an opcode in the bytecode. - * It's a string of the form `{acirIndex}` or `{acirIndex}:{brilligIndex}`. - */ -export type OpcodeLocation = string; - -/** - * The debug information for a given function. - */ -export interface DebugInfo { - /** - * A map of the opcode location to the source code location. - */ - locations: Record; -} - -/** - * Maps a file ID to its metadata for debugging purposes. - */ -export type DebugFileMap = Record< - FileId, - { - /** - * The source code of the file. - */ - source: string; - /** - * The path of the file. - */ - path: string; - } ->; - -/** - * The debug metadata of an ABI. - */ -export interface DebugMetadata { - /** - * The DebugInfo object, deflated as JSON, compressed using gzip and serialized with base64. - */ - debugSymbols: string[]; - /** - * The map of file ID to the source code and path of the file. - */ - fileMap: DebugFileMap; -} - -/** - * Defines artifact of a contract. - */ -export interface ContractArtifact { - /** - * The name of the contract. - */ - name: string; - - /** - * The version of compiler used to create this artifact - */ - aztecNrVersion?: string; - - /** - * The functions of the contract. - */ - functions: FunctionArtifact[]; - /** - * The events of the contract. - */ - events: EventAbi[]; - - /** - * The debug metadata of the contract. - * It's used to include the relevant source code section when a constraint is not met during simulation. - */ - debug?: DebugMetadata; -} diff --git a/compiler/wasm/src/noir/noir_artifact.ts b/compiler/wasm/src/types/noir_artifact.ts similarity index 68% rename from compiler/wasm/src/noir/noir_artifact.ts rename to compiler/wasm/src/types/noir_artifact.ts index 3b79ecdb178..c3cc38f705b 100644 --- a/compiler/wasm/src/noir/noir_artifact.ts +++ b/compiler/wasm/src/types/noir_artifact.ts @@ -1,9 +1,9 @@ -import { ABIParameter, ABIType, DebugFileMap, DebugInfo, EventAbi } from '../types/abi'; +import { ABIParameter, ABIType, EventAbi } from './abi'; -/** The Aztec.nr function types. */ -type NoirFunctionType = 'Open' | 'Secret' | 'Unconstrained'; +/** The Noir function types. */ +export type NoirFunctionType = 'Open' | 'Secret' | 'Unconstrained'; -/** The ABI of an Aztec.nr function. */ +/** The ABI of an Noir function. */ export interface NoirFunctionAbi { /** The parameters of the function. */ parameters: ABIParameter[]; @@ -24,7 +24,7 @@ export interface NoirFunctionAbi { } /** - * The compilation result of an Aztec.nr function. + * The compilation result of an Noir function. */ export interface NoirFunctionEntry { /** The name of the function. */ @@ -44,7 +44,7 @@ export interface NoirFunctionEntry { } /** - * The compilation result of an Aztec.nr contract. + * The compilation result of an Noir contract. */ export interface NoirCompiledContract { /** The name of the contract. */ @@ -58,7 +58,7 @@ export interface NoirCompiledContract { } /** - * The compilation result of an Aztec.nr contract. + * The compilation result of an Noir contract. */ export interface NoirCompiledCircuit { /** The hash of the circuit. */ @@ -74,42 +74,68 @@ export interface NoirCompiledCircuit { } /** - * Defines artifact of a contract. + * A file ID. It's assigned during compilation. */ -export interface ProgramArtifact { - /** - * version of noir used to compile - */ - noir_version?: string; - /** - * the name of the project, read from Nargo.toml - */ - name?: string; - /** - * The hash of the contract. - */ - hash?: number; +export type FileId = number; +/** + * A pointer to a specific section of the source code. + */ +export interface SourceCodeLocation { /** - * The compilation backend of the artifact. + * The section of the source code. */ - backend: string; - + span: { + /** + * The byte where the section starts. + */ + start: number; + /** + * The byte where the section ends. + */ + end: number; + }; /** - * The abi of the program. + * The source code file pointed to. */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any - abi: any; // TODO: type + file: FileId; +} + +/** + * The location of an opcode in the bytecode. + * It's a string of the form `{acirIndex}` or `{acirIndex}:{brilligIndex}`. + */ +export type OpcodeLocation = string; +/** + * The debug information for a given function. + */ +export interface DebugInfo { /** - * The debug metadata of the contract. - * It's used to include the relevant source code section when a constraint is not met during simulation. + * A map of the opcode location to the source code location. */ - debug?: NoirDebugMetadata; + locations: Record; } /** - * The debug metadata of an Aztec.nr contract. + * Maps a file ID to its metadata for debugging purposes. + */ +export type DebugFileMap = Record< + FileId, + { + /** + * The source code of the file. + */ + source: string; + /** + * The path of the file. + */ + path: string; + } +>; + +/** + * The debug metadata of an Noir contract. */ export interface NoirDebugMetadata { /** diff --git a/compiler/wasm/src/types/utils.ts b/compiler/wasm/src/utils.ts similarity index 100% rename from compiler/wasm/src/types/utils.ts rename to compiler/wasm/src/utils.ts diff --git a/compiler/wasm/test/compiler/index.test.ts b/compiler/wasm/test/compiler/index.test.ts new file mode 100644 index 00000000000..bf244aaaeea --- /dev/null +++ b/compiler/wasm/test/compiler/index.test.ts @@ -0,0 +1,84 @@ +// import { ContractArtifact } from '@aztec/foundation/abi'; +// import { LogFn, createDebugLogger } from '@aztec/foundation/log'; +// import { fileURLToPath } from '@aztec/foundation/url'; + +// import { execSync } from 'child_process'; +// import path from 'path'; + +// import { +// ProgramArtifact, +// compileUsingNargo, +// compileUsingNoirWasm, +// generateNoirContractInterface, +// generateTypescriptContractInterface, +// } from './index.js'; + +// function isNargoAvailable() { +// try { +// execSync(`which nargo`); +// return true; +// } catch (error) { +// return false; +// } +// } + +// describe('noir-compiler', () => { +// let projectPath: string; +// let log: LogFn; +// beforeAll(() => { +// const currentDirName = path.dirname(fileURLToPath(import.meta.url)); +// projectPath = path.join(currentDirName, 'fixtures/test_contract'); +// log = createDebugLogger('noir-compiler:test'); +// }); + +// const nargoAvailable = isNargoAvailable(); +// const conditionalDescribe = nargoAvailable ? describe : describe.skip; +// const conditionalIt = nargoAvailable ? it : it.skip; +// const withoutDebug = ({ +// debug: _debug, +// ...rest +// }: ContractArtifact | ProgramArtifact): Omit => rest; + +// function compilerTest( +// compileFn: (path: string, opts: { log: LogFn }) => Promise<(ProgramArtifact | ContractArtifact)[]>, +// ) { +// let compiled: (ProgramArtifact | ContractArtifact)[]; +// let compiledContract: ContractArtifact[]; + +// beforeAll(async () => { +// compiled = await compileFn(projectPath, { log }); +// compiledContract = compiled.map(_compiled => _compiled as ContractArtifact); +// }); + +// it('compiles the test contract', () => { +// expect(compiledContract.map(withoutDebug)).toMatchSnapshot(); +// }); + +// it('generates typescript interface', () => { +// const result = generateTypescriptContractInterface(compiledContract[0], `../target/test.json`); +// expect(result).toMatchSnapshot(); +// }); + +// it('generates Aztec.nr external interface', () => { +// const result = generateNoirContractInterface(compiledContract[0]); +// expect(result).toMatchSnapshot(); +// }); +// } + +// describe('using wasm binary', () => { +// compilerTest(compileUsingNoirWasm); +// }); + +// conditionalDescribe('using nargo', () => { +// compilerTest(compileUsingNargo); +// }); + +// conditionalIt('both nargo and noir_wasm should compile identically', async () => { +// const [noirWasmArtifact, nargoArtifact] = await Promise.all([ +// compileUsingNoirWasm(projectPath, { log }), +// compileUsingNargo(projectPath, { log }), +// ]); + +// expect(nargoArtifact.map(withoutDebug)).toEqual(noirWasmArtifact.map(withoutDebug)); +// }); +// }); diff --git a/compiler/wasm/test/dependencies/dependency-manager.test.ts b/compiler/wasm/test/dependencies/dependency-manager.test.ts index f72ff38eff2..1595166227c 100644 --- a/compiler/wasm/test/dependencies/dependency-manager.test.ts +++ b/compiler/wasm/test/dependencies/dependency-manager.test.ts @@ -1,7 +1,9 @@ -import { NoirDependencyConfig } from 'src/types/noir_package_config.js'; -import { NoirPackage } from '../../src/noir/package.js'; -import { NoirDependencyManager } from '../../src/noir/dependencies/dependency-manager.js'; -import { NoirDependency, NoirDependencyResolver } from '../../src/noir/dependencies/dependency-resolver.js'; +import { NoirDependencyConfig } from 'src/types/noir_package_config'; +import { NoirPackage } from '../../src/noir/package'; +import { NoirDependencyManager } from '../../src/noir/dependencies/dependency-manager'; +import { NoirDependency, NoirDependencyResolver } from '../../src/noir/dependencies/dependency-resolver'; + +import { expect } from 'chai'; describe('DependencyManager', () => { let manager: NoirDependencyManager; @@ -30,22 +32,22 @@ describe('DependencyManager', () => { }); it('successfully resolves dependencies', async () => { - await expect(manager.resolveDependencies()).resolves.toBeUndefined(); + await expect(manager.resolveDependencies()).to.eventually.be.undefined; }); it('resolves all libraries', async () => { await manager.resolveDependencies(); - expect(manager.getPackageNames()).toEqual(['lib1', 'lib2', 'lib3']); + expect(manager.getPackageNames()).to.eql(['lib1', 'lib2', 'lib3']); }); it('resolves root dependencies', async () => { await manager.resolveDependencies(); - expect(manager.getEntrypointDependencies()).toEqual(['lib1', 'lib2', 'lib3']); + expect(manager.getEntrypointDependencies()).to.eql(['lib1', 'lib2', 'lib3']); }); it('resolves library dependencies', async () => { await manager.resolveDependencies(); - expect(manager.getLibraryDependencies()).toEqual({ + expect(manager.getLibraryDependencies()).to.eql({ lib2: ['lib3'], }); }); diff --git a/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts index 1f56030a6d2..cb39f863274 100644 --- a/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts +++ b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts @@ -1,30 +1,37 @@ -import { jest } from '@jest/globals'; import { Volume, createFsFromVolume } from 'memfs'; -import { readFile } from 'node:fs/promises'; +import { readFile } from 'fs/promises'; import { dirname, join } from 'path'; -import { FileManager } from '../../src/noir/file-manager/file-manager.js'; -import { createMemFSFileManager } from '../../src/noir/file-manager/memfs-file-manager.js'; -import { NoirPackage } from '../../src/noir/package.js'; -import { NoirDependencyResolver } from '../../src/noir/dependencies/dependency-resolver.js'; +import { FileManager } from '../../src/noir/file-manager/file-manager'; +import { createMemFSFileManager } from '../../src/noir/file-manager/memfs-file-manager'; +import { NoirPackage } from '../../src/noir/package'; +import { NoirDependencyResolver } from '../../src/noir/dependencies/dependency-resolver'; import { GithubDependencyResolver, resolveGithubCodeArchive, safeFilename, -} from '../../src/noir/dependencies/github-dependency-resolver.js'; -import { NoirGitDependencyConfig } from '../../src/types/noir_package_config.js'; -import { fileURLToPath } from '../../src/types/utils.js'; +} from '../../src/noir/dependencies/github-dependency-resolver'; +import { NoirGitDependencyConfig } from '../../src/types/noir_package_config'; +import { fileURLToPath } from '../../src/utils'; +import Sinon, { SinonStub } from 'sinon'; +import { expect } from 'chai'; +import forEach from 'mocha-each'; +import chai from 'chai'; +import chaiAsPromised from 'chai-as-promised'; -const fixtures = join(dirname(fileURLToPath(import.meta.url)), '../../public/fixtures'); +chai.use(chaiAsPromised); + +const fixtures = join(__dirname, '../../public/fixtures'); describe('GithubDependencyResolver', () => { let resolver: NoirDependencyResolver; let fm: FileManager; let pkg: NoirPackage; let libDependency: NoirGitDependencyConfig; - let fetchMock: jest.SpiedFunction; + let fetchStub: SinonStub | undefined; beforeEach(() => { + fetchStub = Sinon.stub(globalThis, 'fetch'); fm = createMemFSFileManager(createFsFromVolume(new Volume()), '/'); libDependency = { @@ -46,13 +53,11 @@ describe('GithubDependencyResolver', () => { resolver = new GithubDependencyResolver(fm); // cut off outside access - fetchMock = jest.spyOn(globalThis, 'fetch').mockImplementation(() => { - throw new Error(); - }); + fetchStub.onCall(0).throws(new Error()); }); afterEach(() => { - fetchMock.mockRestore(); + fetchStub?.restore(); }); it("returns null if it can't resolve a dependency", async () => { @@ -60,77 +65,78 @@ describe('GithubDependencyResolver', () => { path: '/test_lib', }); - expect(dep).toBeNull(); + expect(dep).to.be.null; }); it('resolves Github dependency', async () => { - fetchMock.mockResolvedValueOnce( - new Response(await readFile(join(fixtures, 'deps', 'test_lib.zip')), { status: 200 }), - ); + fetchStub?.onCall(0).returns(new Response(await readFile(join(fixtures, 'deps', 'test_lib.zip')), { status: 200 })); const lib = await resolver.resolveDependency(pkg, libDependency); - expect(lib).toBeDefined(); - expect(lib!.version).toEqual(libDependency.tag); - expect(fm.hasFileSync(lib!.package.getEntryPointPath())).toBe(true); + expect(lib).not.to.be.undefined; + expect(lib!.version).to.eq(libDependency.tag); + expect(fm.hasFileSync(lib!.package.getEntryPointPath())).to.eq(true); }); - it.each<[NoirGitDependencyConfig, 'zip' | 'tar', string]>([ + forEach([ [ + 'https://github.com/example/lib.nr/archive/v1.0.0.zip', + 'zip', { git: 'https://github.com/example/lib.nr', tag: 'v1.0.0', }, - 'zip', - 'https://github.com/example/lib.nr/archive/v1.0.0.zip', ], [ + 'https://github.com/example/lib.nr/archive/v1.0.0.tar.gz', + 'tar', { git: 'https://github.com/example/lib.nr', tag: 'v1.0.0', }, - 'tar', - 'https://github.com/example/lib.nr/archive/v1.0.0.tar.gz', ], [ + 'https://github.com/example/lib.nr/archive/HEAD.zip', + 'zip', { git: 'https://github.com/example/lib.nr', tag: 'HEAD', }, - 'zip', - 'https://github.com/example/lib.nr/archive/HEAD.zip', ], [ + 'https://github.com/example/lib.nr/archive/HEAD.tar.gz', + 'tar', { git: 'https://github.com/example/lib.nr', tag: 'HEAD', }, - 'tar', - 'https://github.com/example/lib.nr/archive/HEAD.tar.gz', ], - ])('resolves to the correct code archive URL', (dep, format, href) => { - const archiveUrl = resolveGithubCodeArchive(dep, format); - expect(archiveUrl.href).toEqual(href); - }); - - it.each([ + ]).it( + 'resolves to the correct code archive URL %s', + async (href: string, format: 'zip' | 'tar', dep: NoirGitDependencyConfig) => { + const archiveUrl = resolveGithubCodeArchive(dep, format); + expect(archiveUrl.href).to.eq(href); + }, + ); + + forEach([ { git: 'https://github.com/', tag: 'v1' }, { git: 'https://github.com/foo', tag: 'v1' }, { git: 'https://example.com', tag: 'v1' }, - ])('throws if the Github URL is invalid', (dep) => { - expect(() => resolveGithubCodeArchive(dep, 'zip')).toThrow(); + ]).it('throws if the Github URL is invalid %j', (dep) => { + expect(() => resolveGithubCodeArchive(dep, 'zip')).to.throw(); }); - it.each([ + forEach([ ['main', 'main'], ['v1.0.0', 'v1.0.0'], ['../../../etc/passwd', '.._.._.._etc_passwd'], ['/etc/passwd', 'etc_passwd'], ['/SomeOrg/some-repo@v1.0.0', 'SomeOrg_some-repo@v1.0.0'], ['SomeOrg/some-repo@v1.0.0', 'SomeOrg_some-repo@v1.0.0'], - ])('generates safe file names', (value, expected) => { - expect(safeFilename(value)).toEqual(expected); + ]).it('generates safe file names from %s', (value, expected) => { + expect(safeFilename(value)).to.eq(expected); }); - it.each([''])('rejects invalid values', (value) => { - expect(() => safeFilename(value)).toThrow(); + forEach(['']).it('rejects invalid values', (value) => { + expect(() => safeFilename(value)).to.throw(); }); }); diff --git a/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts b/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts index e17180785d0..1c9270ee7a6 100644 --- a/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts +++ b/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts @@ -1,14 +1,15 @@ import { createFsFromVolume } from 'memfs'; -import { Volume } from 'memfs/lib/volume.js'; +import { Volume } from 'memfs/lib/volume'; import { readFile } from 'node:fs/promises'; import { dirname, join } from 'path'; -import { FileManager } from '../../src/noir/file-manager/file-manager.js'; -import { createMemFSFileManager } from '../../src/noir/file-manager/memfs-file-manager.js'; -import { NoirPackage } from '../../src/noir/package.js'; -import { NoirDependencyResolver } from '../../src/noir/dependencies/dependency-resolver.js'; -import { LocalDependencyResolver } from '../../src/noir/dependencies/local-dependency-resolver.js'; -import { fileURLToPath } from '../../src/types/utils.js'; +import { FileManager } from '../../src/noir/file-manager/file-manager'; +import { createMemFSFileManager } from '../../src/noir/file-manager/memfs-file-manager'; +import { NoirPackage } from '../../src/noir/package'; +import { NoirDependencyResolver } from '../../src/noir/dependencies/dependency-resolver'; +import { LocalDependencyResolver } from '../../src/noir/dependencies/local-dependency-resolver'; +import { expect } from 'chai'; +import forEach from 'mocha-each'; describe('DependencyResolver', () => { let resolver: NoirDependencyResolver; @@ -16,18 +17,18 @@ describe('DependencyResolver', () => { let pkg: NoirPackage; beforeEach(async () => { - const fixtures = join(dirname(fileURLToPath(import.meta.url)), '../../public/fixtures'); + const fixtures = join(__dirname, '../../public/fixtures'); const memFS = createFsFromVolume(new Volume()); - memFS.mkdirSync('/test_contract/src', { recursive: true }); - memFS.mkdirSync('/test_lib/src', { recursive: true }); - memFS.writeFileSync('/test_contract/Nargo.toml', await readFile(join(fixtures, 'test_contract/Nargo.toml'))); - memFS.writeFileSync('/test_contract/src/main.nr', await readFile(join(fixtures, 'test_contract/src/main.nr'))); - memFS.writeFileSync('/test_lib/Nargo.toml', await readFile(join(fixtures, 'test_lib/Nargo.toml'))); - memFS.writeFileSync('/test_lib/src/lib.nr', await readFile(join(fixtures, 'test_lib/src/lib.nr'))); + memFS.mkdirSync('/noir-contract/src', { recursive: true }); + memFS.mkdirSync('/lib-c/src', { recursive: true }); + memFS.writeFileSync('/noir-contract/Nargo.toml', await readFile(join(fixtures, 'noir-contract/Nargo.toml'))); + memFS.writeFileSync('/noir-contract/src/main.nr', await readFile(join(fixtures, 'noir-contract/src/main.nr'))); + memFS.writeFileSync('/lib-c/Nargo.toml', await readFile(join(fixtures, 'deps/lib-c/Nargo.toml'))); + memFS.writeFileSync('/lib-c/src/lib.nr', await readFile(join(fixtures, 'deps/lib-c/src/lib.nr'))); fm = createMemFSFileManager(memFS, '/'); - pkg = await NoirPackage.open('/test_contract', fm); + pkg = await NoirPackage.open('/noir-contract', fm); resolver = new LocalDependencyResolver(fm); }); @@ -38,15 +39,15 @@ describe('DependencyResolver', () => { tag: 'v1.0.0', }); - expect(dep).toBeNull(); + expect(dep).to.be.null; }); - it.each(['../test_contract', '/test_contract'])('resolves a known dependency', async (path) => { + forEach(['../noir-contract', '/noir-contract']).it('resolves a known dependency %s', async (path) => { const lib = await resolver.resolveDependency(pkg, { path, }); - expect(lib).toBeDefined(); - expect(lib!.version).toBeUndefined(); - expect(fm.hasFileSync(lib!.package.getEntryPointPath())).toBe(true); + expect(lib).not.to.be.undefined; + expect(lib!.version).to.be.undefined; + expect(fm.hasFileSync(lib!.package.getEntryPointPath())).to.eq(true); }); }); diff --git a/compiler/wasm/test/file-manager/file-manager.test.ts b/compiler/wasm/test/file-manager/file-manager.test.ts index 7455d8c2e90..8a80854109a 100644 --- a/compiler/wasm/test/file-manager/file-manager.test.ts +++ b/compiler/wasm/test/file-manager/file-manager.test.ts @@ -4,8 +4,11 @@ import * as fs from 'fs/promises'; import { tmpdir } from 'os'; import { join } from 'path'; -import { FileManager, FileSystem } from '../../src/noir/file-manager/file-manager.js'; -import { createMemFSFileManager } from '../../src/noir/file-manager/memfs-file-manager.js'; +import { FileManager, FileSystem } from '../../src/noir/file-manager/file-manager'; +import { createMemFSFileManager } from '../../src/noir/file-manager/memfs-file-manager'; + +import { expect } from 'chai'; +import forEach from 'mocha-each'; const memFS = (): { fm: FileManager; teardown: () => void } => { const fm = createMemFSFileManager(createFsFromVolume(new Volume()), '/'); @@ -16,7 +19,7 @@ const memFS = (): { fm: FileManager; teardown: () => void } => { }; }; -const nodeFM = (): { fm: FileManager; teardown: () => void } => { +const nodeFS = (): { fm: FileManager; teardown: () => void } => { const fileSystem: FileSystem = { existsSync: existsSync, mkdir: async (dir: string, opts?: { recursive: boolean }) => { @@ -46,14 +49,17 @@ const nodeFM = (): { fm: FileManager; teardown: () => void } => { * @param setup - Function to setup a file manager * @param teardown - Optional function to call at the end of the test */ -describe.each([memFS, nodeFM])('FileManager', (setup) => { +forEach([ + ['memFs', memFS], + ['nodeFS', nodeFS], +]).describe('FileManager: %s', (name, fs) => { let fm: FileManager; let testFileContent: string; let testFileBytes: Uint8Array; let teardown: () => void; beforeEach(() => { - ({ fm, teardown } = setup()); + ({ fm, teardown } = fs()); testFileContent = 'foo'; testFileBytes = new TextEncoder().encode(testFileContent); }); @@ -62,29 +68,29 @@ describe.each([memFS, nodeFM])('FileManager', (setup) => { return teardown?.(); }); - it('saves files and correctly reads bytes back', async () => { + it(`saves files and correctly reads bytes back using ${name}`, async () => { await fm.writeFile('test.txt', new Blob([testFileBytes]).stream()); - await expect(fm.readFile('test.txt')).resolves.toEqual(testFileBytes); + expect(fm.readFile('test.txt')).to.eventually.eq(testFileBytes); }); - it('saves files and correctly reads UTF-8 string back', async () => { + it(`saves files and correctly reads UTF-8 string back using ${name}`, async () => { await fm.writeFile('test.txt', new Blob([testFileBytes]).stream()); - await expect(fm.readFile('test.txt', 'utf-8')).resolves.toEqual(testFileContent); + expect(fm.readFile('test.txt', 'utf-8')).to.eventually.eq(testFileContent); }); - it('correctly checks if file exists or not', async () => { - expect(fm.hasFileSync('test.txt')).toBe(false); + it(`correctly checks if file exists or not using ${name}`, async () => { + expect(fm.hasFileSync('test.txt')).to.eq(false); await fm.writeFile('test.txt', new Blob([testFileBytes]).stream()); - expect(fm.hasFileSync('test.txt')).toBe(true); + expect(fm.hasFileSync('test.txt')).to.eq(true); }); - it('moves files', async () => { + it(`moves files using ${name}`, async () => { await fm.writeFile('test.txt.tmp', new Blob([testFileBytes]).stream()); - expect(fm.hasFileSync('test.txt.tmp')).toBe(true); + expect(fm.hasFileSync('test.txt.tmp')).to.eq(true); await fm.moveFile('test.txt.tmp', 'test.txt'); - expect(fm.hasFileSync('test.txt.tmp')).toBe(false); - expect(fm.hasFileSync('test.txt')).toBe(true); + expect(fm.hasFileSync('test.txt.tmp')).to.eq(false); + expect(fm.hasFileSync('test.txt')).to.eq(true); }); }); diff --git a/compiler/wasm/test/shared.ts b/compiler/wasm/test/shared.ts index d5f4d936384..5305735127a 100644 --- a/compiler/wasm/test/shared.ts +++ b/compiler/wasm/test/shared.ts @@ -1,13 +1,12 @@ -import { join, resolve } from 'path'; -import { fileURLToPath } from '../src/types/utils'; +const currentPath = __dirname.split('/'); -const fixtures = resolve(fileURLToPath(import.meta.url), '../../public/fixtures'); +const fixtures = `/${currentPath.slice(0, currentPath.length - 1).join('/')}/public/fixtures`; -export const simpleScriptSourcePath = join(fixtures, 'simple/noir-script/src/main.nr'); -export const simpleScriptExpectedArtifact = join(fixtures, 'simple/noir-script/target/noir_wasm_testing.json'); +export const simpleScriptSourcePath = `${fixtures}/simple/src/main.nr`; +export const simpleScriptExpectedArtifact = `${fixtures}/simple/target/noir_wasm_testing.json`; -export const depsScriptSourcePath = join(fixtures, 'deps/noir-script/src/main.nr'); -export const depsScriptExpectedArtifact = join(fixtures, 'deps/noir-script/target/noir_wasm_testing.json'); +export const depsScriptSourcePath = `${fixtures}/with-deps/src/main.nr`; +export const depsScriptExpectedArtifact = `${fixtures}/with-deps/target/noir_wasm_testing.json`; -export const libASourcePath = join(fixtures, 'deps/lib-a/src/lib.nr'); -export const libBSourcePath = join(fixtures, 'deps/lib-b/src/lib.nr'); +export const libASourcePath = `${fixtures}/deps/lib-a/src/lib.nr`; +export const libBSourcePath = `${fixtures}/deps/lib-b/src/lib.nr`; diff --git a/compiler/wasm/test/wasm/browser/index.test.ts b/compiler/wasm/test/wasm/browser/index.test.ts index 714cbcf848a..dbdc7c7ea20 100644 --- a/compiler/wasm/test/wasm/browser/index.test.ts +++ b/compiler/wasm/test/wasm/browser/index.test.ts @@ -6,9 +6,13 @@ import { simpleScriptExpectedArtifact, simpleScriptSourcePath, } from '../../shared'; -import { PathToFileSourceMap, compile } from '../../../build/esm'; +import esmBuild from '../../../build/esm'; +import { expect } from 'chai'; + +const { PathToFileSourceMap, compile } = esmBuild; async function getFileContent(path: string): Promise { + // @ts-expect-error import.meta.url is only defined in the context of ESM, in which this test runs const url = new URL(path, import.meta.url); const response = await fetch(url); return await response.text(); @@ -26,7 +30,7 @@ describe('noir wasm', () => { const sourceMap = new PathToFileSourceMap(); sourceMap.add_source_code('main.nr', await getFileContent(simpleScriptSourcePath)); - const wasmCircuit = await compile('main.nr', undefined, undefined, sourceMap); + const wasmCircuit = compile('main.nr', undefined, undefined, sourceMap); const cliCircuit = await getPrecompiledSource(simpleScriptExpectedArtifact); if (!('program' in wasmCircuit)) { @@ -34,9 +38,9 @@ describe('noir wasm', () => { } // We don't expect the hashes to match due to how `noir_wasm` handles dependencies - expect(wasmCircuit.program.noir_version).toEqual(cliCircuit.noir_version); - expect(wasmCircuit.program.bytecode).toEqual(cliCircuit.bytecode); - expect(wasmCircuit.program.abi).toEqual(cliCircuit.abi); + expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); + expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); + expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); }); }); @@ -73,9 +77,9 @@ describe('noir wasm', () => { // We don't expect the hashes to match due to how `noir_wasm` handles dependencies - expect(wasmCircuit.program.noir_version).toEqual(cliCircuit.noir_version); - expect(wasmCircuit.program.bytecode).toEqual(cliCircuit.bytecode); - expect(wasmCircuit.program.abi).toEqual(cliCircuit.abi); + expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); + expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); + expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); }); }); }); diff --git a/compiler/wasm/test/wasm/node/index.test.ts b/compiler/wasm/test/wasm/node/index.test.ts index 6850c4e33b5..8d7effb33a2 100644 --- a/compiler/wasm/test/wasm/node/index.test.ts +++ b/compiler/wasm/test/wasm/node/index.test.ts @@ -8,11 +8,13 @@ import { } from '../../shared'; import { readFileSync } from 'fs'; import { resolve } from 'path'; +import { expect } from 'chai'; import { compile, PathToFileSourceMap, compile_, CompilerContext } from '../../../build/cjs'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any async function getPrecompiledSource(path: string): Promise { - const compiledData = readFileSync(resolve(import.meta.url, path)).toString(); + const compiledData = readFileSync(resolve(__dirname, path)).toString(); return JSON.parse(compiledData); } @@ -29,11 +31,11 @@ describe('noir wasm compilation', () => { } // We don't expect the hashes to match due to how `noir_wasm` handles dependencies - expect(wasmCircuit.program.bytecode).toEqual(cliCircuit.bytecode); - expect(wasmCircuit.program.abi).toEqual(cliCircuit.abi); - expect(wasmCircuit.program.noir_version).toEqual(cliCircuit.noir_version); + expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); + expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); + expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); }); - }); + }).timeout(10e3); describe('can compile scripts with dependencies', () => { const sourceMap = new PathToFileSourceMap(); @@ -63,11 +65,11 @@ describe('noir wasm compilation', () => { } // We don't expect the hashes to match due to how `noir_wasm` handles dependencies - expect(wasmCircuit.program.bytecode).toEqual(cliCircuit.bytecode); - expect(wasmCircuit.program.abi).toEqual(cliCircuit.abi); - expect(wasmCircuit.program.noir_version).toEqual(cliCircuit.noir_version); + expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); + expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); + expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); }); - }); + }).timeout(10e3); describe('can compile scripts with dependencies -- context-api', () => { let sourceMap: PathToFileSourceMap; @@ -112,10 +114,10 @@ describe('noir wasm compilation', () => { } // We don't expect the hashes to match due to how `noir_wasm` handles dependencies - expect(wasmCircuit.program.noir_version).toEqual(cliCircuit.noir_version); - expect(wasmCircuit.program.bytecode).toEqual(cliCircuit.bytecode); - expect(wasmCircuit.program.abi).toEqual(cliCircuit.abi); - }); + expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); + expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); + expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); + }).timeout(10e3); it('matching nargos compilation - context-implementation-compile-api', async () => { const wasmCircuit = await compile_( @@ -137,9 +139,9 @@ describe('noir wasm compilation', () => { } // We don't expect the hashes to match due to how `noir_wasm` handles dependencies - expect(wasmCircuit.program.noir_version).toEqual(cliCircuit.noir_version); - expect(wasmCircuit.program.bytecode).toEqual(cliCircuit.bytecode); - expect(wasmCircuit.program.abi).toEqual(cliCircuit.abi); - }); + expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); + expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); + expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); + }).timeout(10e3); }); }); diff --git a/compiler/wasm/tsconfig.cjs.json b/compiler/wasm/tsconfig.cjs.json deleted file mode 100644 index beb22971e7b..00000000000 --- a/compiler/wasm/tsconfig.cjs.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "CommonJS", - }, - } \ No newline at end of file diff --git a/compiler/wasm/tsconfig.esm.json b/compiler/wasm/tsconfig.esm.json deleted file mode 100644 index 8480e151f43..00000000000 --- a/compiler/wasm/tsconfig.esm.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "ts-node": { - "esm": true - }, - "compilerOptions": { - "module": "NodeNext", - }, - } \ No newline at end of file diff --git a/compiler/wasm/tsconfig.json b/compiler/wasm/tsconfig.json index 6eeeb831f9e..93e0fd2aa8c 100644 --- a/compiler/wasm/tsconfig.json +++ b/compiler/wasm/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { - "outDir": "../dist/types", + "declaration": true, + "declarationDir": "dist/types", "strict": true, "baseUrl": ".", "experimentalDecorators": true, @@ -12,7 +13,9 @@ "allowSyntheticDefaultImports": true, "esModuleInterop": true, "target": "ESNext", - "moduleResolution": "NodeNext" + "module": "CommonJS", + "moduleResolution": "node", }, - "include": ["src/**/*.*ts", "test/dependencies/dependency-manager.test.ts", "test/dependencies/github-dependency-resolver.test.ts", "test/dependencies/local-dependency-resolver.test.ts", "test/file-manager/file-manager.test.ts"] + "include": ["src"], + "exclude": ["node_modules", "build", "dist"] } \ No newline at end of file diff --git a/compiler/wasm/web-test-runner.config.mjs b/compiler/wasm/web-test-runner.config.mjs index 1bf0463fecb..3076d82b44a 100644 --- a/compiler/wasm/web-test-runner.config.mjs +++ b/compiler/wasm/web-test-runner.config.mjs @@ -17,7 +17,7 @@ export default { ts: true, }), ], - files: ['test/browser/**/*.test.mjs'], + files: ['**/browser/*.test.ts'], nodeResolve: true, testFramework: { config: { @@ -25,6 +25,6 @@ export default { timeout: 40000, }, }, - rootDir: fileURLToPath(new URL('./../../', import.meta.url)), + rootDir: fileURLToPath(new URL('./../../../', import.meta.url)), reporters: [reporter], }; diff --git a/compiler/wasm/webpack.config.ts b/compiler/wasm/webpack.config.ts index 4388004ea72..756ea8349de 100644 --- a/compiler/wasm/webpack.config.ts +++ b/compiler/wasm/webpack.config.ts @@ -49,6 +49,7 @@ const webConfig: webpack.Configuration = { new WasmPackPlugin({ crateDirectory: path.resolve(__dirname), outDir: path.resolve(__dirname, './build/esm'), + forceMode: 'production', }), new CopyWebpackPlugin({ patterns: [{ from: path.resolve(__dirname, 'public'), to: path.resolve(__dirname, 'dist/web/public') }], @@ -106,6 +107,7 @@ const nodeConfig: webpack.Configuration = { crateDirectory: path.resolve(__dirname), outDir: path.resolve(__dirname, './build/cjs'), extraArgs: '--target nodejs', + forceMode: 'production', }), ], module: { @@ -113,11 +115,7 @@ const nodeConfig: webpack.Configuration = { { test: /\.(shim\.)?[cmjt]t?s?$/, use: { - loader: 'babel-loader', - options: { - presets: ['@babel/preset-env', '@babel/preset-typescript'], - plugins: ['@babel/plugin-proposal-class-properties', '@babel/plugin-transform-private-methods'], - }, + loader: 'ts-loader', }, }, { From 487d48eaf710b793360189bedcb485d7e0813f4d Mon Sep 17 00:00:00 2001 From: thunkar Date: Wed, 20 Dec 2023 11:50:37 +0000 Subject: [PATCH 05/37] Working, tests green --- compiler/wasm/package.json | 17 +- compiler/wasm/src/index.cts | 28 +- compiler/wasm/src/index.mts | 29 +- .../src/noir/file-manager/file-manager.ts | 10 +- .../noir/file-manager/nodejs-file-manager.ts | 61 + compiler/wasm/src/noir/noir-wasm-compiler.ts | 12 +- compiler/wasm/src/noir_wasm.ts | 18 - .../wasm/test/compiler/browser/index.test.ts | 41 + compiler/wasm/test/compiler/index.test.ts | 84 -- .../wasm/test/compiler/node/index.test.ts | 26 + .../dependencies/dependency-manager.test.ts | 2 +- .../github-dependency-resolver.test.ts | 3 +- .../local-dependency-resolver.test.ts | 3 +- compiler/wasm/test/shared.ts | 45 +- compiler/wasm/test/wasm/browser/index.test.ts | 85 -- .../wasm/test/wasm/{node => }/index.test.ts | 21 +- compiler/wasm/tsconfig.esm.json | 6 + compiler/wasm/tsconfig.json | 5 +- compiler/wasm/web-test-runner.config.mjs | 8 +- compiler/wasm/webpack.config.ts | 70 +- yarn.lock | 1144 ++++------------- 21 files changed, 526 insertions(+), 1192 deletions(-) create mode 100644 compiler/wasm/src/noir/file-manager/nodejs-file-manager.ts delete mode 100644 compiler/wasm/src/noir_wasm.ts create mode 100644 compiler/wasm/test/compiler/browser/index.test.ts delete mode 100644 compiler/wasm/test/compiler/index.test.ts create mode 100644 compiler/wasm/test/compiler/node/index.test.ts delete mode 100644 compiler/wasm/test/wasm/browser/index.test.ts rename compiler/wasm/test/wasm/{node => }/index.test.ts (96%) create mode 100644 compiler/wasm/tsconfig.esm.json diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index 1d95d87b523..1f4155da45f 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -13,18 +13,23 @@ "import": "./dist/web/main.js", "require": "./dist/node/main.js" }, + "files": [ + "dist", + "package.json" + ], "repository": { "type": "git", "url": "https://github.com/noir-lang/noir.git" }, "scripts": { "serve": "webpack serve", - "build-fixtures": "cd public/fixtures && cd simple && nargo compile && cd ../with-deps && nargo compile && cd ../noir-contract && nargo compile && cd ../", - "build": "webpack", + "build:fixtures": "cd public/fixtures && cd simple && nargo compile && cd ../with-deps && nargo compile && cd ../noir-contract && nargo compile && cd ../", + "build:webpack": "webpack", + "build": "yarn build:webpack && yarn build:fixtures", "test": "yarn test:node && yarn test:browser", "test:node": "NODE_NO_WARNINGS=1 $(yarn bin mocha) --config ./.mocharc.json", "test:browser": "web-test-runner", - "clean": "chmod u+w web nodejs || true && rm -rf ./build ./target ./dist", + "clean": "rm -rf ./build ./target ./dist public/fixtures/simple/target public/fixtures/with-deps/target public/fixtures/noir-contract/target", "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", "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0", @@ -32,10 +37,7 @@ "install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/noir_wasm/nodejs ./ && cp -rL ./result/noir_wasm/web ./" }, "devDependencies": { - "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/plugin-transform-private-methods": "^7.23.3", - "@babel/preset-env": "^7.23.5", - "@babel/preset-typescript": "^7.23.3", + "@esm-bundle/chai": "^4.3.4-fix.0", "@jest/globals": "^29.7.0", "@ltd/j-toml": "^1.38.0", "@types/babel__preset-env": "^7", @@ -57,7 +59,6 @@ "@web/test-runner": "^0.15.3", "@web/test-runner-playwright": "^0.10.0", "assert": "^2.1.0", - "babel-loader": "^9.1.3", "browserify-fs": "^1.0.0", "buffer": "^6.0.3", "chai": "^4.3.10", diff --git a/compiler/wasm/src/index.cts b/compiler/wasm/src/index.cts index 1d39d92f274..d2e1ea06557 100644 --- a/compiler/wasm/src/index.cts +++ b/compiler/wasm/src/index.cts @@ -1,10 +1,26 @@ -import { compileUsingNoirWasm } from './noir_wasm'; import { FileManager } from './noir/file-manager/file-manager'; +import { createNodejsFileManager } from './noir/file-manager/nodejs-file-manager'; +import { NoirWasmContractCompiler } from './noir/noir-wasm-compiler'; +import { LogData, LogFn } from './utils'; -async function compile(fileManager: FileManager, projectPath: string) { - const cjsModule = await require('../build/cjs'); - console.log('hey cjs'); - return compileUsingNoirWasm(fileManager, projectPath, cjsModule.compile, new cjsModule.PathToFileSourceMap()); +async function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn) { + const cjs = await require('../build/cjs'); + const compiler = await NoirWasmContractCompiler.new( + fileManager, + projectPath ?? fileManager.getDataDir(), + cjs, + new cjs.PathToFileSourceMap(), + { + log: + logFn ?? + function (msg: string, _data?: LogData) { + console.log(msg); + }, + }, + ); + return await compiler.compile(); } -export { compile }; +const createFileManager = createNodejsFileManager; + +export { compile, createFileManager }; diff --git a/compiler/wasm/src/index.mts b/compiler/wasm/src/index.mts index 6bc14c10b2f..93d81bbe290 100644 --- a/compiler/wasm/src/index.mts +++ b/compiler/wasm/src/index.mts @@ -1,10 +1,27 @@ import { FileManager } from './noir/file-manager/file-manager'; -import { compileUsingNoirWasm } from './noir_wasm'; +import { createNodejsFileManager } from './noir/file-manager/nodejs-file-manager'; +import { NoirWasmContractCompiler } from './noir/noir-wasm-compiler'; +import { LogData, LogFn } from './utils'; -async function compile(fileManager: FileManager, projectPath: string) { - const esmModule = await import('../build/esm'); - console.log('hey esm'); - return compileUsingNoirWasm(fileManager, projectPath, esmModule.compile, new esmModule.PathToFileSourceMap()); +async function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn) { + const esm = await import('../build/esm'); + await esm.default; + const compiler = await NoirWasmContractCompiler.new( + fileManager, + projectPath ?? fileManager.getDataDir(), + esm, + new esm.PathToFileSourceMap(), + { + log: + logFn ?? + function (msg: string, _data?: LogData) { + console.log(msg); + }, + }, + ); + return await compiler.compile(); } -export { compile }; +const createFileManager = createNodejsFileManager; + +export { compile, createFileManager }; diff --git a/compiler/wasm/src/noir/file-manager/file-manager.ts b/compiler/wasm/src/noir/file-manager/file-manager.ts index 77dc78bade2..9369f4146be 100644 --- a/compiler/wasm/src/noir/file-manager/file-manager.ts +++ b/compiler/wasm/src/noir/file-manager/file-manager.ts @@ -42,6 +42,13 @@ export class FileManager { this.#dataDir = dataDir; } + /** + * Returns the data directory + */ + getDataDir() { + return this.#dataDir; + } + /** * Saves a file to the data directory. * @param name - File to save @@ -151,7 +158,6 @@ export class FileManager { }, ) { const dirPath = this.#getPath(dir); - const files = await this.#fs.readdir(dirPath, options); - return files.map((file) => path.join(dirPath, file)); + return await this.#fs.readdir(dirPath, options); } } diff --git a/compiler/wasm/src/noir/file-manager/nodejs-file-manager.ts b/compiler/wasm/src/noir/file-manager/nodejs-file-manager.ts new file mode 100644 index 00000000000..9fe397bef61 --- /dev/null +++ b/compiler/wasm/src/noir/file-manager/nodejs-file-manager.ts @@ -0,0 +1,61 @@ +import { existsSync } from 'fs'; +import { promises as fs } from 'fs'; + +import { FileManager } from './file-manager'; + +/** + * Creates a new FileManager instance based on nodejs fs + * @param dataDir - where to store files + */ +export function createNodejsFileManager(dataDir: string): FileManager { + // This is needed because memfs doesn't support the recursive flag yet + const readdirRecursive = async (dir: string): Promise => { + const contents = await fs.readdir(dir); + let files: string[] = []; + for (const handle of contents) { + if ((await fs.stat(`${dir}/${handle}`)).isFile()) { + files.push(`${dir}/${handle.toString()}`); + } else { + files = files.concat(await readdirRecursive(`${dir}/${handle.toString()}`)); + } + } + return files; + }; + return new FileManager( + { + ...fs, + ...{ + // ExistsSync is not available in the fs/promises module + existsSync, + // This is added here because the node types are not compatible with the FileSystem type for mkdir + // Typescripts tries to use a different variant of the function that is not the one that has the optional options. + mkdir: async ( + dir: string, + opts?: { + /** + * Traverse child directories + */ + recursive: boolean; + }, + ) => { + await fs.mkdir(dir, opts); + }, + readdir: async ( + dir: string, + options?: { + /** + * Traverse child directories + */ + recursive: boolean; + }, + ) => { + if (options?.recursive) { + return readdirRecursive(dir); + } + return (await fs.readdir(dir)).map((handles) => handles.toString()); + }, + }, + }, + dataDir, + ); +} diff --git a/compiler/wasm/src/noir/noir-wasm-compiler.ts b/compiler/wasm/src/noir/noir-wasm-compiler.ts index e28829b150c..24a6757824f 100644 --- a/compiler/wasm/src/noir/noir-wasm-compiler.ts +++ b/compiler/wasm/src/noir/noir-wasm-compiler.ts @@ -66,6 +66,7 @@ export class NoirWasmContractCompiler { /* eslint-enable @typescript-eslint/no-explicit-any */ opts: NoirWasmCompileOptions, ) { + // Assume the filemanager is initialized at the project root if (!isAbsolute(projectPath)) { throw new Error('projectPath must be an absolute path'); } @@ -81,14 +82,7 @@ export class NoirWasmContractCompiler { noirPackage, ); - return new NoirWasmContractCompiler( - noirPackage, - dependencyManager, - fileManager, - wasmCompiler.compile, - sourceMap, - opts, - ); + return new NoirWasmContractCompiler(noirPackage, dependencyManager, fileManager, wasmCompiler, sourceMap, opts); } /** @@ -127,8 +121,8 @@ export class NoirWasmContractCompiler { .map(async ([alias, library]) => await library.package.getSources(this.#fm, alias)), ) ).flat(); - this.#sourceMap.clean(); [...packageSources, ...librarySources].forEach((sourceFile) => { + this.#debugLog(`Adding source ${sourceFile.path}`); this.#sourceMap.add_source_code(sourceFile.path, sourceFile.source); }); const result = this.#wasmCompiler.compile(entrypoint, isContract, deps, this.#sourceMap); diff --git a/compiler/wasm/src/noir_wasm.ts b/compiler/wasm/src/noir_wasm.ts deleted file mode 100644 index 901837a6e14..00000000000 --- a/compiler/wasm/src/noir_wasm.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { NoirCompilationResult } from './types/noir_artifact'; -import { NoirWasmContractCompiler } from './noir/noir-wasm-compiler'; -import { FileManager } from './noir/file-manager/file-manager'; -import { LogData } from './utils'; - -export async function compileUsingNoirWasm( - fileManager: FileManager, - projectPath: string, - wasmCompiler: unknown, - sourceMap: unknown, -): Promise { - const compiler = await NoirWasmContractCompiler.new(fileManager, projectPath, wasmCompiler, sourceMap, { - log: function (msg: string, _data?: LogData) { - console.log(msg); - }, - }); - return await compiler.compile(); -} diff --git a/compiler/wasm/test/compiler/browser/index.test.ts b/compiler/wasm/test/compiler/browser/index.test.ts new file mode 100644 index 00000000000..2c8fd3cd964 --- /dev/null +++ b/compiler/wasm/test/compiler/browser/index.test.ts @@ -0,0 +1,41 @@ +import { getPaths } from '../../shared'; +import { expect } from '@esm-bundle/chai'; + +// @ts-expect-error Import without typings, probably there's a better way +import { compile, createFileManager } from '../../../dist/web/main'; +import { FileManager } from '../../../dist/types/noir/file-manager/file-manager'; +import { NoirCompiledContract } from '../../../dist/types/types/noir_artifact'; + +const paths = getPaths('.'); + +async function getFile(path: string) { + const basePath = new URL('./../../../', import.meta.url).toString().replace(/\/$/g, ''); + const url = `${basePath}${path.replace('.', '')}`; + const response = await fetch(url); + return response; +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +async function getPrecompiledSource(path: string): Promise { + const response = await getFile(path); + const compiledData = await response.text(); + return JSON.parse(compiledData); +} + +describe('noir-compiler', () => { + it('both nargo and noir_wasm should compile identically', async () => { + const { contractExpectedArtifact } = paths; + const fm: FileManager = createFileManager('/'); + const files = Object.values(paths).filter((fileOrDir) => /^\.?\/.*\..*$/.test(fileOrDir)); + for (const path of files) { + await fm.writeFile(path, (await getFile(path)).body as ReadableStream); + } + const nargoArtifact = (await getPrecompiledSource(contractExpectedArtifact)) as NoirCompiledContract; + nargoArtifact.functions.sort((a, b) => a.name.localeCompare(b.name)); + const noirWasmArtifact = await compile(fm, '/public/fixtures/noir-contract'); + const noirWasmContract = noirWasmArtifact[0].contract as NoirCompiledContract; + expect(noirWasmContract).not.to.be.undefined; + noirWasmContract.functions.sort((a, b) => a.name.localeCompare(b.name)); + expect(nargoArtifact).to.deep.eq(noirWasmContract); + }); +}); diff --git a/compiler/wasm/test/compiler/index.test.ts b/compiler/wasm/test/compiler/index.test.ts deleted file mode 100644 index bf244aaaeea..00000000000 --- a/compiler/wasm/test/compiler/index.test.ts +++ /dev/null @@ -1,84 +0,0 @@ -// import { ContractArtifact } from '@aztec/foundation/abi'; -// import { LogFn, createDebugLogger } from '@aztec/foundation/log'; -// import { fileURLToPath } from '@aztec/foundation/url'; - -// import { execSync } from 'child_process'; -// import path from 'path'; - -// import { -// ProgramArtifact, -// compileUsingNargo, -// compileUsingNoirWasm, -// generateNoirContractInterface, -// generateTypescriptContractInterface, -// } from './index.js'; - -// function isNargoAvailable() { -// try { -// execSync(`which nargo`); -// return true; -// } catch (error) { -// return false; -// } -// } - -// describe('noir-compiler', () => { -// let projectPath: string; -// let log: LogFn; -// beforeAll(() => { -// const currentDirName = path.dirname(fileURLToPath(import.meta.url)); -// projectPath = path.join(currentDirName, 'fixtures/test_contract'); -// log = createDebugLogger('noir-compiler:test'); -// }); - -// const nargoAvailable = isNargoAvailable(); -// const conditionalDescribe = nargoAvailable ? describe : describe.skip; -// const conditionalIt = nargoAvailable ? it : it.skip; -// const withoutDebug = ({ -// debug: _debug, -// ...rest -// }: ContractArtifact | ProgramArtifact): Omit => rest; - -// function compilerTest( -// compileFn: (path: string, opts: { log: LogFn }) => Promise<(ProgramArtifact | ContractArtifact)[]>, -// ) { -// let compiled: (ProgramArtifact | ContractArtifact)[]; -// let compiledContract: ContractArtifact[]; - -// beforeAll(async () => { -// compiled = await compileFn(projectPath, { log }); -// compiledContract = compiled.map(_compiled => _compiled as ContractArtifact); -// }); - -// it('compiles the test contract', () => { -// expect(compiledContract.map(withoutDebug)).toMatchSnapshot(); -// }); - -// it('generates typescript interface', () => { -// const result = generateTypescriptContractInterface(compiledContract[0], `../target/test.json`); -// expect(result).toMatchSnapshot(); -// }); - -// it('generates Aztec.nr external interface', () => { -// const result = generateNoirContractInterface(compiledContract[0]); -// expect(result).toMatchSnapshot(); -// }); -// } - -// describe('using wasm binary', () => { -// compilerTest(compileUsingNoirWasm); -// }); - -// conditionalDescribe('using nargo', () => { -// compilerTest(compileUsingNargo); -// }); - -// conditionalIt('both nargo and noir_wasm should compile identically', async () => { -// const [noirWasmArtifact, nargoArtifact] = await Promise.all([ -// compileUsingNoirWasm(projectPath, { log }), -// compileUsingNargo(projectPath, { log }), -// ]); - -// expect(nargoArtifact.map(withoutDebug)).toEqual(noirWasmArtifact.map(withoutDebug)); -// }); -// }); diff --git a/compiler/wasm/test/compiler/node/index.test.ts b/compiler/wasm/test/compiler/node/index.test.ts new file mode 100644 index 00000000000..a24db422288 --- /dev/null +++ b/compiler/wasm/test/compiler/node/index.test.ts @@ -0,0 +1,26 @@ +import { join, resolve } from 'path'; +import { getPaths } from '../../shared'; + +import { expect } from 'chai'; +import { readFile } from 'fs/promises'; + +// @ts-expect-error Import without typings, probably there's a better way +import { compile, createFileManager } from '../../../dist/node/main'; + +import { NoirCompiledContract } from '../../../dist/types/types/noir_artifact'; + +const basePath = resolve(join(__dirname, '../../../')); +const { contractProjectPath, contractExpectedArtifact } = getPaths(basePath); + +describe('noir-compiler', () => { + it('both nargo and noir_wasm should compile identically', async () => { + const fm = createFileManager(contractProjectPath); + const nargoArtifact = JSON.parse((await readFile(contractExpectedArtifact)).toString()) as NoirCompiledContract; + nargoArtifact.functions.sort((a, b) => a.name.localeCompare(b.name)); + const noirWasmArtifact = await compile(fm); + const noirWasmContract = noirWasmArtifact[0].contract as NoirCompiledContract; + expect(noirWasmContract).not.to.be.undefined; + noirWasmContract.functions.sort((a, b) => a.name.localeCompare(b.name)); + expect(nargoArtifact).to.deep.eq(noirWasmContract); + }); +}); diff --git a/compiler/wasm/test/dependencies/dependency-manager.test.ts b/compiler/wasm/test/dependencies/dependency-manager.test.ts index 1595166227c..64ad1487f55 100644 --- a/compiler/wasm/test/dependencies/dependency-manager.test.ts +++ b/compiler/wasm/test/dependencies/dependency-manager.test.ts @@ -1,4 +1,4 @@ -import { NoirDependencyConfig } from 'src/types/noir_package_config'; +import { NoirDependencyConfig } from '../../src/types/noir_package_config'; import { NoirPackage } from '../../src/noir/package'; import { NoirDependencyManager } from '../../src/noir/dependencies/dependency-manager'; import { NoirDependency, NoirDependencyResolver } from '../../src/noir/dependencies/dependency-resolver'; diff --git a/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts index cb39f863274..322a2230a66 100644 --- a/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts +++ b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts @@ -1,6 +1,6 @@ import { Volume, createFsFromVolume } from 'memfs'; import { readFile } from 'fs/promises'; -import { dirname, join } from 'path'; +import { join } from 'path'; import { FileManager } from '../../src/noir/file-manager/file-manager'; import { createMemFSFileManager } from '../../src/noir/file-manager/memfs-file-manager'; @@ -12,7 +12,6 @@ import { safeFilename, } from '../../src/noir/dependencies/github-dependency-resolver'; import { NoirGitDependencyConfig } from '../../src/types/noir_package_config'; -import { fileURLToPath } from '../../src/utils'; import Sinon, { SinonStub } from 'sinon'; import { expect } from 'chai'; import forEach from 'mocha-each'; diff --git a/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts b/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts index 1c9270ee7a6..43c95b7618d 100644 --- a/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts +++ b/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts @@ -1,5 +1,4 @@ -import { createFsFromVolume } from 'memfs'; -import { Volume } from 'memfs/lib/volume'; +import { createFsFromVolume, Volume } from 'memfs'; import { readFile } from 'node:fs/promises'; import { dirname, join } from 'path'; diff --git a/compiler/wasm/test/shared.ts b/compiler/wasm/test/shared.ts index 5305735127a..1e35fc212d9 100644 --- a/compiler/wasm/test/shared.ts +++ b/compiler/wasm/test/shared.ts @@ -1,12 +1,41 @@ -const currentPath = __dirname.split('/'); +export function getPaths(basePath: string) { + const fixtures = `${basePath}/public/fixtures`; -const fixtures = `/${currentPath.slice(0, currentPath.length - 1).join('/')}/public/fixtures`; + const simpleScriptSourcePath = `${fixtures}/simple/src/main.nr`; + const simpleScriptExpectedArtifact = `${fixtures}/simple/target/noir_wasm_testing.json`; -export const simpleScriptSourcePath = `${fixtures}/simple/src/main.nr`; -export const simpleScriptExpectedArtifact = `${fixtures}/simple/target/noir_wasm_testing.json`; + const depsScriptSourcePath = `${fixtures}/with-deps/src/main.nr`; + const depsScriptExpectedArtifact = `${fixtures}/with-deps/target/noir_wasm_testing.json`; -export const depsScriptSourcePath = `${fixtures}/with-deps/src/main.nr`; -export const depsScriptExpectedArtifact = `${fixtures}/with-deps/target/noir_wasm_testing.json`; + const libASourcePath = `${fixtures}/deps/lib-a/src/lib.nr`; + const libBSourcePath = `${fixtures}/deps/lib-b/src/lib.nr`; -export const libASourcePath = `${fixtures}/deps/lib-a/src/lib.nr`; -export const libBSourcePath = `${fixtures}/deps/lib-b/src/lib.nr`; + const libCProjectPath = `${fixtures}/deps/lib-c`; + const libCSourcePath = `${libCProjectPath}/src/lib.nr`; + const libCModulePath = `${libCProjectPath}/src/module.nr`; + const libCModuleSourcePath = `${libCProjectPath}/src/module/foo.nr`; + const libCTOMLPath = `${libCProjectPath}/Nargo.toml`; + + const contractProjectPath = `${fixtures}/noir-contract`; + const contractSourcePath = `${contractProjectPath}/src/main.nr`; + const contractTOMLPath = `${contractProjectPath}/Nargo.toml`; + const contractExpectedArtifact = `${contractProjectPath}/target/test-TestContract.json`; + + return { + simpleScriptSourcePath, + simpleScriptExpectedArtifact, + depsScriptSourcePath, + depsScriptExpectedArtifact, + libASourcePath, + libBSourcePath, + libCProjectPath, + libCSourcePath, + libCModulePath, + libCModuleSourcePath, + libCTOMLPath, + contractProjectPath, + contractSourcePath, + contractTOMLPath, + contractExpectedArtifact, + }; +} diff --git a/compiler/wasm/test/wasm/browser/index.test.ts b/compiler/wasm/test/wasm/browser/index.test.ts deleted file mode 100644 index dbdc7c7ea20..00000000000 --- a/compiler/wasm/test/wasm/browser/index.test.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { - depsScriptExpectedArtifact, - depsScriptSourcePath, - libASourcePath, - libBSourcePath, - simpleScriptExpectedArtifact, - simpleScriptSourcePath, -} from '../../shared'; -import esmBuild from '../../../build/esm'; -import { expect } from 'chai'; - -const { PathToFileSourceMap, compile } = esmBuild; - -async function getFileContent(path: string): Promise { - // @ts-expect-error import.meta.url is only defined in the context of ESM, in which this test runs - const url = new URL(path, import.meta.url); - const response = await fetch(url); - return await response.text(); -} - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -async function getPrecompiledSource(path: string): Promise { - const compiledData = await getFileContent(path); - return JSON.parse(compiledData); -} - -describe('noir wasm', () => { - describe('can compile script without dependencies', () => { - it('matching nargos compilation', async () => { - const sourceMap = new PathToFileSourceMap(); - sourceMap.add_source_code('main.nr', await getFileContent(simpleScriptSourcePath)); - - const wasmCircuit = compile('main.nr', undefined, undefined, sourceMap); - const cliCircuit = await getPrecompiledSource(simpleScriptExpectedArtifact); - - if (!('program' in wasmCircuit)) { - throw Error('Expected program to be present'); - } - - // We don't expect the hashes to match due to how `noir_wasm` handles dependencies - expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); - expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); - expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); - }); - }); - - describe('can compile script with dependencies', () => { - it('matching nargos compilation', async () => { - const [scriptSource, libASource, libBSource] = await Promise.all([ - getFileContent(depsScriptSourcePath), - getFileContent(libASourcePath), - getFileContent(libBSourcePath), - ]); - - const sourceMap = new PathToFileSourceMap(); - sourceMap.add_source_code('script/main.nr', scriptSource); - sourceMap.add_source_code('lib_a/lib.nr', libASource); - sourceMap.add_source_code('lib_b/lib.nr', libBSource); - - const wasmCircuit = await compile( - 'script/main.nr', - false, - { - root_dependencies: ['lib_a'], - library_dependencies: { - lib_a: ['lib_b'], - }, - }, - sourceMap, - ); - - if (!('program' in wasmCircuit)) { - throw Error('Expected program to be present'); - } - - const cliCircuit = await getPrecompiledSource(depsScriptExpectedArtifact); - - // We don't expect the hashes to match due to how `noir_wasm` handles dependencies - - expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); - expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); - expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); - }); - }); -}); diff --git a/compiler/wasm/test/wasm/node/index.test.ts b/compiler/wasm/test/wasm/index.test.ts similarity index 96% rename from compiler/wasm/test/wasm/node/index.test.ts rename to compiler/wasm/test/wasm/index.test.ts index 8d7effb33a2..1c433733396 100644 --- a/compiler/wasm/test/wasm/node/index.test.ts +++ b/compiler/wasm/test/wasm/index.test.ts @@ -1,16 +1,19 @@ -import { +import { getPaths } from '../shared'; +import { readFileSync } from 'fs'; +import { join, resolve } from 'path'; +import { expect } from 'chai'; + +import { compile, PathToFileSourceMap, compile_, CompilerContext } from '../../build/cjs'; + +const basePath = resolve(join(__dirname, '../../')); +const { + simpleScriptSourcePath, + simpleScriptExpectedArtifact, depsScriptSourcePath, depsScriptExpectedArtifact, libASourcePath, libBSourcePath, - simpleScriptSourcePath, - simpleScriptExpectedArtifact, -} from '../../shared'; -import { readFileSync } from 'fs'; -import { resolve } from 'path'; -import { expect } from 'chai'; - -import { compile, PathToFileSourceMap, compile_, CompilerContext } from '../../../build/cjs'; +} = getPaths(basePath); // eslint-disable-next-line @typescript-eslint/no-explicit-any async function getPrecompiledSource(path: string): Promise { diff --git a/compiler/wasm/tsconfig.esm.json b/compiler/wasm/tsconfig.esm.json new file mode 100644 index 00000000000..c91b56ea59c --- /dev/null +++ b/compiler/wasm/tsconfig.esm.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "ESNext", + }, +} \ No newline at end of file diff --git a/compiler/wasm/tsconfig.json b/compiler/wasm/tsconfig.json index 93e0fd2aa8c..ff2b3443b22 100644 --- a/compiler/wasm/tsconfig.json +++ b/compiler/wasm/tsconfig.json @@ -14,8 +14,7 @@ "esModuleInterop": true, "target": "ESNext", "module": "CommonJS", - "moduleResolution": "node", + "moduleResolution": "Node" }, - "include": ["src"], - "exclude": ["node_modules", "build", "dist"] + "include": ["./src"] } \ No newline at end of file diff --git a/compiler/wasm/web-test-runner.config.mjs b/compiler/wasm/web-test-runner.config.mjs index 3076d82b44a..c92e20fd3da 100644 --- a/compiler/wasm/web-test-runner.config.mjs +++ b/compiler/wasm/web-test-runner.config.mjs @@ -19,12 +19,6 @@ export default { ], files: ['**/browser/*.test.ts'], nodeResolve: true, - testFramework: { - config: { - ui: 'bdd', - timeout: 40000, - }, - }, - rootDir: fileURLToPath(new URL('./../../../', import.meta.url)), + rootDir: fileURLToPath(new URL('./../../', import.meta.url)), reporters: [reporter], }; diff --git a/compiler/wasm/webpack.config.ts b/compiler/wasm/webpack.config.ts index 756ea8349de..b832570f5eb 100644 --- a/compiler/wasm/webpack.config.ts +++ b/compiler/wasm/webpack.config.ts @@ -1,20 +1,19 @@ -import path from 'path'; +import { resolve, join } from 'path'; import webpack from 'webpack'; import 'webpack-dev-server'; import WasmPackPlugin from '@wasm-tool/wasm-pack-plugin'; - import HtmlWebpackPlugin from 'html-webpack-plugin'; import CopyWebpackPlugin from 'copy-webpack-plugin'; const config: webpack.Configuration = { output: { - path: path.resolve(__dirname, 'dist'), - globalObject: 'this', + path: resolve(__dirname, 'dist'), }, mode: 'development', devtool: 'source-map', experiments: { asyncWebAssembly: true, + syncWebAssembly: true, }, optimization: { minimize: false, @@ -22,14 +21,10 @@ const config: webpack.Configuration = { resolve: { extensions: ['.cts', '.mts', '.ts', '.js', '.json', '.wasm'], fallback: { - // assert: require.resolve('assert'), - // buffer: require.resolve('buffer'), path: require.resolve('path-browserify'), - // process: require.resolve('process/browser'), stream: require.resolve('readable-stream'), - // url: require.resolve('url'), - // util: require.resolve('util'), fs: require.resolve('browserify-fs'), + buffer: require.resolve('buffer'), }, }, }; @@ -38,40 +33,48 @@ const webConfig: webpack.Configuration = { name: 'web', entry: './src/index.mts', ...config, + experiments: { + ...config.experiments, + outputModule: true, + }, output: { + filename: 'main.mjs', ...config.output, - path: path.resolve(__dirname, 'dist/web'), + path: resolve(__dirname, 'dist/web'), library: { type: 'window', }, + libraryTarget: 'module', }, plugins: [ new WasmPackPlugin({ - crateDirectory: path.resolve(__dirname), - outDir: path.resolve(__dirname, './build/esm'), + crateDirectory: resolve(__dirname), + outDir: resolve(__dirname, './build/esm'), + extraArgs: '--target bundler', forceMode: 'production', }), - new CopyWebpackPlugin({ - patterns: [{ from: path.resolve(__dirname, 'public'), to: path.resolve(__dirname, 'dist/web/public') }], - }), new HtmlWebpackPlugin({ title: 'Noir Wasm ESM', }), new webpack.DefinePlugin({ 'process.env.NODE_DEBUG': JSON.stringify(process.env.NODE_DEBUG), }), + new webpack.ProvidePlugin({ + process: 'process/browser', + }), + new webpack.ProvidePlugin({ + Buffer: ['buffer', 'Buffer'], + }), ], module: { rules: [ { - test: /\.(shim\.)?[cmjt]t?s?$/, - use: { - loader: 'babel-loader', - options: { - presets: ['@babel/preset-env', '@babel/preset-typescript'], - plugins: ['@babel/plugin-proposal-class-properties', '@babel/plugin-transform-private-methods'], - }, + test: /.m?ts$/, + loader: 'ts-loader', + options: { + configFile: 'tsconfig.esm.json', }, + exclude: /node_modules/, }, { test: /\.wasm$/, @@ -80,7 +83,7 @@ const webConfig: webpack.Configuration = { ], }, devServer: { - static: path.join(__dirname, 'dist'), + static: join(__dirname, 'dist'), }, resolve: { ...config.resolve, @@ -96,7 +99,7 @@ const nodeConfig: webpack.Configuration = { ...config, output: { ...config.output, - path: path.resolve(__dirname, 'dist/node'), + path: resolve(__dirname, 'dist/node'), library: { type: 'commonjs2', }, @@ -104,19 +107,26 @@ const nodeConfig: webpack.Configuration = { target: 'node', plugins: [ new WasmPackPlugin({ - crateDirectory: path.resolve(__dirname), - outDir: path.resolve(__dirname, './build/cjs'), + crateDirectory: resolve(__dirname), + outDir: resolve(__dirname, './build/cjs'), extraArgs: '--target nodejs', forceMode: 'production', }), + new CopyWebpackPlugin({ + patterns: [ + { + from: resolve(__dirname, './build/cjs/index_bg.wasm'), + to: resolve(__dirname, 'dist/node/index_bg.wasm'), + }, + ], + }), ], module: { rules: [ { - test: /\.(shim\.)?[cmjt]t?s?$/, - use: { - loader: 'ts-loader', - }, + test: /.c?ts$/, + use: 'ts-loader', + exclude: /node_modules/, }, { test: /\.wasm$/, diff --git a/yarn.lock b/yarn.lock index 71121e7aabb..99e123cae96 100644 --- a/yarn.lock +++ b/yarn.lock @@ -390,25 +390,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-create-class-features-plugin@npm:^7.18.6": - version: 7.23.6 - resolution: "@babel/helper-create-class-features-plugin@npm:7.23.6" - dependencies: - "@babel/helper-annotate-as-pure": ^7.22.5 - "@babel/helper-environment-visitor": ^7.22.20 - "@babel/helper-function-name": ^7.23.0 - "@babel/helper-member-expression-to-functions": ^7.23.0 - "@babel/helper-optimise-call-expression": ^7.22.5 - "@babel/helper-replace-supers": ^7.22.20 - "@babel/helper-skip-transparent-expression-wrappers": ^7.22.5 - "@babel/helper-split-export-declaration": ^7.22.6 - semver: ^6.3.1 - peerDependencies: - "@babel/core": ^7.0.0 - checksum: 356b71b9f4a3a95917432bf6a452f475a292d394d9310e9c8b23c8edb564bee91e40d4290b8aa8779d2987a7c39ae717b2d76edc7c952078b8952df1a20259e3 - languageName: node - linkType: hard - "@babel/helper-create-class-features-plugin@npm:^7.22.15, @babel/helper-create-class-features-plugin@npm:^7.23.5": version: 7.23.5 resolution: "@babel/helper-create-class-features-plugin@npm:7.23.5" @@ -656,21 +637,21 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.23.6": - version: 7.23.6 - resolution: "@babel/parser@npm:7.23.6" +"@babel/parser@npm:^7.12.7, @babel/parser@npm:^7.18.8, @babel/parser@npm:^7.22.15, @babel/parser@npm:^7.22.7, @babel/parser@npm:^7.23.5": + version: 7.23.5 + resolution: "@babel/parser@npm:7.23.5" bin: parser: ./bin/babel-parser.js - checksum: 140801c43731a6c41fd193f5c02bc71fd647a0360ca616b23d2db8be4b9739b9f951a03fc7c2db4f9b9214f4b27c1074db0f18bc3fa653783082d5af7c8860d5 + checksum: ea763629310f71580c4a3ea9d3705195b7ba994ada2cc98f9a584ebfdacf54e92b2735d351672824c2c2b03c7f19206899f4d95650d85ce514a822b19a8734c7 languageName: node linkType: hard -"@babel/parser@npm:^7.12.7, @babel/parser@npm:^7.18.8, @babel/parser@npm:^7.22.15, @babel/parser@npm:^7.22.7, @babel/parser@npm:^7.23.5": - version: 7.23.5 - resolution: "@babel/parser@npm:7.23.5" +"@babel/parser@npm:^7.14.7, @babel/parser@npm:^7.23.6": + version: 7.23.6 + resolution: "@babel/parser@npm:7.23.6" bin: parser: ./bin/babel-parser.js - checksum: ea763629310f71580c4a3ea9d3705195b7ba994ada2cc98f9a584ebfdacf54e92b2735d351672824c2c2b03c7f19206899f4d95650d85ce514a822b19a8734c7 + checksum: 140801c43731a6c41fd193f5c02bc71fd647a0360ca616b23d2db8be4b9739b9f951a03fc7c2db4f9b9214f4b27c1074db0f18bc3fa653783082d5af7c8860d5 languageName: node linkType: hard @@ -710,18 +691,6 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-proposal-class-properties@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-proposal-class-properties@npm:7.18.6" - dependencies: - "@babel/helper-create-class-features-plugin": ^7.18.6 - "@babel/helper-plugin-utils": ^7.18.6 - peerDependencies: - "@babel/core": ^7.0.0-0 - checksum: 49a78a2773ec0db56e915d9797e44fd079ab8a9b2e1716e0df07c92532f2c65d76aeda9543883916b8e0ff13606afeffa67c5b93d05b607bc87653ad18a91422 - languageName: node - linkType: hard - "@babel/plugin-proposal-object-rest-spread@npm:7.12.1": version: 7.12.1 resolution: "@babel/plugin-proposal-object-rest-spread@npm:7.12.1" @@ -1184,18 +1153,6 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-for-of@npm:^7.23.6": - version: 7.23.6 - resolution: "@babel/plugin-transform-for-of@npm:7.23.6" - dependencies: - "@babel/helper-plugin-utils": ^7.22.5 - "@babel/helper-skip-transparent-expression-wrappers": ^7.22.5 - peerDependencies: - "@babel/core": ^7.0.0-0 - checksum: 228c060aa61f6aa89dc447170075f8214863b94f830624e74ade99c1a09316897c12d76e848460b0b506593e58dbc42739af6dc4cb0fe9b84dffe4a596050a36 - languageName: node - linkType: hard - "@babel/plugin-transform-function-name@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-transform-function-name@npm:7.23.3" @@ -1759,96 +1716,6 @@ __metadata: languageName: node linkType: hard -"@babel/preset-env@npm:^7.23.5": - version: 7.23.6 - resolution: "@babel/preset-env@npm:7.23.6" - dependencies: - "@babel/compat-data": ^7.23.5 - "@babel/helper-compilation-targets": ^7.23.6 - "@babel/helper-plugin-utils": ^7.22.5 - "@babel/helper-validator-option": ^7.23.5 - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": ^7.23.3 - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": ^7.23.3 - "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": ^7.23.3 - "@babel/plugin-proposal-private-property-in-object": 7.21.0-placeholder-for-preset-env.2 - "@babel/plugin-syntax-async-generators": ^7.8.4 - "@babel/plugin-syntax-class-properties": ^7.12.13 - "@babel/plugin-syntax-class-static-block": ^7.14.5 - "@babel/plugin-syntax-dynamic-import": ^7.8.3 - "@babel/plugin-syntax-export-namespace-from": ^7.8.3 - "@babel/plugin-syntax-import-assertions": ^7.23.3 - "@babel/plugin-syntax-import-attributes": ^7.23.3 - "@babel/plugin-syntax-import-meta": ^7.10.4 - "@babel/plugin-syntax-json-strings": ^7.8.3 - "@babel/plugin-syntax-logical-assignment-operators": ^7.10.4 - "@babel/plugin-syntax-nullish-coalescing-operator": ^7.8.3 - "@babel/plugin-syntax-numeric-separator": ^7.10.4 - "@babel/plugin-syntax-object-rest-spread": ^7.8.3 - "@babel/plugin-syntax-optional-catch-binding": ^7.8.3 - "@babel/plugin-syntax-optional-chaining": ^7.8.3 - "@babel/plugin-syntax-private-property-in-object": ^7.14.5 - "@babel/plugin-syntax-top-level-await": ^7.14.5 - "@babel/plugin-syntax-unicode-sets-regex": ^7.18.6 - "@babel/plugin-transform-arrow-functions": ^7.23.3 - "@babel/plugin-transform-async-generator-functions": ^7.23.4 - "@babel/plugin-transform-async-to-generator": ^7.23.3 - "@babel/plugin-transform-block-scoped-functions": ^7.23.3 - "@babel/plugin-transform-block-scoping": ^7.23.4 - "@babel/plugin-transform-class-properties": ^7.23.3 - "@babel/plugin-transform-class-static-block": ^7.23.4 - "@babel/plugin-transform-classes": ^7.23.5 - "@babel/plugin-transform-computed-properties": ^7.23.3 - "@babel/plugin-transform-destructuring": ^7.23.3 - "@babel/plugin-transform-dotall-regex": ^7.23.3 - "@babel/plugin-transform-duplicate-keys": ^7.23.3 - "@babel/plugin-transform-dynamic-import": ^7.23.4 - "@babel/plugin-transform-exponentiation-operator": ^7.23.3 - "@babel/plugin-transform-export-namespace-from": ^7.23.4 - "@babel/plugin-transform-for-of": ^7.23.6 - "@babel/plugin-transform-function-name": ^7.23.3 - "@babel/plugin-transform-json-strings": ^7.23.4 - "@babel/plugin-transform-literals": ^7.23.3 - "@babel/plugin-transform-logical-assignment-operators": ^7.23.4 - "@babel/plugin-transform-member-expression-literals": ^7.23.3 - "@babel/plugin-transform-modules-amd": ^7.23.3 - "@babel/plugin-transform-modules-commonjs": ^7.23.3 - "@babel/plugin-transform-modules-systemjs": ^7.23.3 - "@babel/plugin-transform-modules-umd": ^7.23.3 - "@babel/plugin-transform-named-capturing-groups-regex": ^7.22.5 - "@babel/plugin-transform-new-target": ^7.23.3 - "@babel/plugin-transform-nullish-coalescing-operator": ^7.23.4 - "@babel/plugin-transform-numeric-separator": ^7.23.4 - "@babel/plugin-transform-object-rest-spread": ^7.23.4 - "@babel/plugin-transform-object-super": ^7.23.3 - "@babel/plugin-transform-optional-catch-binding": ^7.23.4 - "@babel/plugin-transform-optional-chaining": ^7.23.4 - "@babel/plugin-transform-parameters": ^7.23.3 - "@babel/plugin-transform-private-methods": ^7.23.3 - "@babel/plugin-transform-private-property-in-object": ^7.23.4 - "@babel/plugin-transform-property-literals": ^7.23.3 - "@babel/plugin-transform-regenerator": ^7.23.3 - "@babel/plugin-transform-reserved-words": ^7.23.3 - "@babel/plugin-transform-shorthand-properties": ^7.23.3 - "@babel/plugin-transform-spread": ^7.23.3 - "@babel/plugin-transform-sticky-regex": ^7.23.3 - "@babel/plugin-transform-template-literals": ^7.23.3 - "@babel/plugin-transform-typeof-symbol": ^7.23.3 - "@babel/plugin-transform-unicode-escapes": ^7.23.3 - "@babel/plugin-transform-unicode-property-regex": ^7.23.3 - "@babel/plugin-transform-unicode-regex": ^7.23.3 - "@babel/plugin-transform-unicode-sets-regex": ^7.23.3 - "@babel/preset-modules": 0.1.6-no-external-plugins - babel-plugin-polyfill-corejs2: ^0.4.6 - babel-plugin-polyfill-corejs3: ^0.8.5 - babel-plugin-polyfill-regenerator: ^0.5.3 - core-js-compat: ^3.31.0 - semver: ^6.3.1 - peerDependencies: - "@babel/core": ^7.0.0-0 - checksum: 130262f263c8a76915ff5361f78afa9e63b4ecbf3ade8e833dc7546db7b9552ab507835bdea0feb5e70861345ca128a31327fd2e187084a215fc9dd1cc0ed38e - languageName: node - linkType: hard - "@babel/preset-modules@npm:0.1.6-no-external-plugins": version: 0.1.6-no-external-plugins resolution: "@babel/preset-modules@npm:0.1.6-no-external-plugins" @@ -1878,7 +1745,7 @@ __metadata: languageName: node linkType: hard -"@babel/preset-typescript@npm:^7.18.6, @babel/preset-typescript@npm:^7.22.5, @babel/preset-typescript@npm:^7.23.3": +"@babel/preset-typescript@npm:^7.18.6, @babel/preset-typescript@npm:^7.22.5": version: 7.23.3 resolution: "@babel/preset-typescript@npm:7.23.3" dependencies: @@ -1919,7 +1786,7 @@ __metadata: languageName: node linkType: hard -"@babel/template@npm:^7.12.7, @babel/template@npm:^7.22.15, @babel/template@npm:^7.3.3": +"@babel/template@npm:^7.12.7, @babel/template@npm:^7.22.15": version: 7.22.15 resolution: "@babel/template@npm:7.22.15" dependencies: @@ -1966,17 +1833,6 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.23.6, @babel/types@npm:^7.3.3": - version: 7.23.6 - resolution: "@babel/types@npm:7.23.6" - dependencies: - "@babel/helper-string-parser": ^7.23.4 - "@babel/helper-validator-identifier": ^7.22.20 - to-fast-properties: ^2.0.0 - checksum: 68187dbec0d637f79bc96263ac95ec8b06d424396678e7e225492be866414ce28ebc918a75354d4c28659be6efe30020b4f0f6df81cc418a2d30645b690a8de0 - languageName: node - linkType: hard - "@babel/types@npm:^7.12.7, @babel/types@npm:^7.20.0, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.5, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": version: 7.23.5 resolution: "@babel/types@npm:7.23.5" @@ -1988,10 +1844,14 @@ __metadata: languageName: node linkType: hard -"@bcoe/v8-coverage@npm:^0.2.3": - version: 0.2.3 - resolution: "@bcoe/v8-coverage@npm:0.2.3" - checksum: 850f9305536d0f2bd13e9e0881cb5f02e4f93fad1189f7b2d4bebf694e3206924eadee1068130d43c11b750efcc9405f88a8e42ef098b6d75239c0f047de1a27 +"@babel/types@npm:^7.23.6, @babel/types@npm:^7.3.3": + version: 7.23.6 + resolution: "@babel/types@npm:7.23.6" + dependencies: + "@babel/helper-string-parser": ^7.23.4 + "@babel/helper-validator-identifier": ^7.22.20 + to-fast-properties: ^2.0.0 + checksum: 68187dbec0d637f79bc96263ac95ec8b06d424396678e7e225492be866414ce28ebc918a75354d4c28659be6efe30020b4f0f6df81cc418a2d30645b690a8de0 languageName: node linkType: hard @@ -3777,61 +3637,6 @@ __metadata: languageName: node linkType: hard -"@jest/console@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/console@npm:29.7.0" - dependencies: - "@jest/types": ^29.6.3 - "@types/node": "*" - chalk: ^4.0.0 - jest-message-util: ^29.7.0 - jest-util: ^29.7.0 - slash: ^3.0.0 - checksum: 0e3624e32c5a8e7361e889db70b170876401b7d70f509a2538c31d5cd50deb0c1ae4b92dc63fe18a0902e0a48c590c21d53787a0df41a52b34fa7cab96c384d6 - languageName: node - linkType: hard - -"@jest/core@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/core@npm:29.7.0" - dependencies: - "@jest/console": ^29.7.0 - "@jest/reporters": ^29.7.0 - "@jest/test-result": ^29.7.0 - "@jest/transform": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/node": "*" - ansi-escapes: ^4.2.1 - chalk: ^4.0.0 - ci-info: ^3.2.0 - exit: ^0.1.2 - graceful-fs: ^4.2.9 - jest-changed-files: ^29.7.0 - jest-config: ^29.7.0 - jest-haste-map: ^29.7.0 - jest-message-util: ^29.7.0 - jest-regex-util: ^29.6.3 - jest-resolve: ^29.7.0 - jest-resolve-dependencies: ^29.7.0 - jest-runner: ^29.7.0 - jest-runtime: ^29.7.0 - jest-snapshot: ^29.7.0 - jest-util: ^29.7.0 - jest-validate: ^29.7.0 - jest-watcher: ^29.7.0 - micromatch: ^4.0.4 - pretty-format: ^29.7.0 - slash: ^3.0.0 - strip-ansi: ^6.0.0 - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - checksum: af759c9781cfc914553320446ce4e47775ae42779e73621c438feb1e4231a5d4862f84b1d8565926f2d1aab29b3ec3dcfdc84db28608bdf5f29867124ebcfc0d - languageName: node - linkType: hard - "@jest/environment@npm:^29.7.0": version: 29.7.0 resolution: "@jest/environment@npm:29.7.0" @@ -3889,43 +3694,6 @@ __metadata: languageName: node linkType: hard -"@jest/reporters@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/reporters@npm:29.7.0" - dependencies: - "@bcoe/v8-coverage": ^0.2.3 - "@jest/console": ^29.7.0 - "@jest/test-result": ^29.7.0 - "@jest/transform": ^29.7.0 - "@jest/types": ^29.6.3 - "@jridgewell/trace-mapping": ^0.3.18 - "@types/node": "*" - chalk: ^4.0.0 - collect-v8-coverage: ^1.0.0 - exit: ^0.1.2 - glob: ^7.1.3 - graceful-fs: ^4.2.9 - istanbul-lib-coverage: ^3.0.0 - istanbul-lib-instrument: ^6.0.0 - istanbul-lib-report: ^3.0.0 - istanbul-lib-source-maps: ^4.0.0 - istanbul-reports: ^3.1.3 - jest-message-util: ^29.7.0 - jest-util: ^29.7.0 - jest-worker: ^29.7.0 - slash: ^3.0.0 - string-length: ^4.0.1 - strip-ansi: ^6.0.0 - v8-to-istanbul: ^9.0.1 - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - checksum: 7eadabd62cc344f629024b8a268ecc8367dba756152b761bdcb7b7e570a3864fc51b2a9810cd310d85e0a0173ef002ba4528d5ea0329fbf66ee2a3ada9c40455 - languageName: node - linkType: hard - "@jest/schemas@npm:^29.6.3": version: 29.6.3 resolution: "@jest/schemas@npm:29.6.3" @@ -3935,41 +3703,6 @@ __metadata: languageName: node linkType: hard -"@jest/source-map@npm:^29.6.3": - version: 29.6.3 - resolution: "@jest/source-map@npm:29.6.3" - dependencies: - "@jridgewell/trace-mapping": ^0.3.18 - callsites: ^3.0.0 - graceful-fs: ^4.2.9 - checksum: bcc5a8697d471396c0003b0bfa09722c3cd879ad697eb9c431e6164e2ea7008238a01a07193dfe3cbb48b1d258eb7251f6efcea36f64e1ebc464ea3c03ae2deb - languageName: node - linkType: hard - -"@jest/test-result@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/test-result@npm:29.7.0" - dependencies: - "@jest/console": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/istanbul-lib-coverage": ^2.0.0 - collect-v8-coverage: ^1.0.0 - checksum: 67b6317d526e335212e5da0e768e3b8ab8a53df110361b80761353ad23b6aea4432b7c5665bdeb87658ea373b90fb1afe02ed3611ef6c858c7fba377505057fa - languageName: node - linkType: hard - -"@jest/test-sequencer@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/test-sequencer@npm:29.7.0" - dependencies: - "@jest/test-result": ^29.7.0 - graceful-fs: ^4.2.9 - jest-haste-map: ^29.7.0 - slash: ^3.0.0 - checksum: 73f43599017946be85c0b6357993b038f875b796e2f0950487a82f4ebcb115fa12131932dd9904026b4ad8be131fe6e28bd8d0aa93b1563705185f9804bff8bd - languageName: node - linkType: hard - "@jest/transform@npm:^29.7.0": version: 29.7.0 resolution: "@jest/transform@npm:29.7.0" @@ -4529,47 +4262,52 @@ __metadata: version: 0.0.0-use.local resolution: "@noir-lang/noir_wasm@workspace:compiler/wasm" dependencies: - "@babel/plugin-proposal-class-properties": ^7.18.6 - "@babel/plugin-transform-private-methods": ^7.23.3 - "@babel/preset-env": ^7.23.5 - "@babel/preset-typescript": ^7.23.3 + "@esm-bundle/chai": ^4.3.4-fix.0 "@jest/globals": ^29.7.0 "@ltd/j-toml": ^1.38.0 "@types/babel__preset-env": ^7 - "@types/jest": ^29.5.11 + "@types/chai": ^4 + "@types/chai-as-promised": ^7.1.8 "@types/lodash.capitalize": ^4 "@types/lodash.compact": ^3 "@types/lodash.times": ^4 "@types/lodash.upperfirst": ^4 + "@types/mocha": ^10.0.6 + "@types/mocha-each": ^2 "@types/node": ^20.10.0 "@types/pako": ^2 "@types/path-browserify": ^1 "@types/readable-stream": ^4 + "@types/sinon": ^17 "@wasm-tool/wasm-pack-plugin": ^1.7.0 "@web/dev-server-esbuild": ^0.3.6 "@web/test-runner": ^0.15.3 "@web/test-runner-playwright": ^0.10.0 assert: ^2.1.0 - babel-loader: ^9.1.3 browserify-fs: ^1.0.0 buffer: ^6.0.3 + chai: ^4.3.10 copy-webpack-plugin: ^11.0.0 + cross-env: ^7.0.3 file-loader: ^6.2.0 html-webpack-plugin: ^5.5.4 - jest: ^29.7.0 lodash.capitalize: ^4.2.1 lodash.compact: ^3.0.1 lodash.times: ^4.3.2 lodash.upperfirst: ^4.3.1 memfs: ^4.6.0 + mocha: ^10.2.0 + mocha-each: ^2.0.1 pako: ^2.1.0 path-browserify: ^1.0.1 + playwright: ^1.40.1 process: ^0.11.10 readable-stream: ^4.4.2 + sinon: ^17.0.1 text-encoding: ^0.7.0 - ts-jest: ^29.1.1 ts-loader: ^9.5.1 ts-node: ^10.9.1 + tsconfig-paths: ^4.2.0 typescript: ~5.2.2 unzipit: ^1.4.3 url: ^0.11.3 @@ -5253,6 +4991,15 @@ __metadata: languageName: node linkType: hard +"@sinonjs/commons@npm:^2.0.0": + version: 2.0.0 + resolution: "@sinonjs/commons@npm:2.0.0" + dependencies: + type-detect: 4.0.8 + checksum: 5023ba17edf2b85ed58262313b8e9b59e23c6860681a9af0200f239fe939e2b79736d04a260e8270ddd57196851dde3ba754d7230be5c5234e777ae2ca8af137 + languageName: node + linkType: hard + "@sinonjs/commons@npm:^3.0.0": version: 3.0.0 resolution: "@sinonjs/commons@npm:3.0.0" @@ -5271,6 +5018,33 @@ __metadata: languageName: node linkType: hard +"@sinonjs/fake-timers@npm:^11.2.2": + version: 11.2.2 + resolution: "@sinonjs/fake-timers@npm:11.2.2" + dependencies: + "@sinonjs/commons": ^3.0.0 + checksum: 68c29b0e1856fdc280df03ddbf57c726420b78e9f943a241b471edc018fb14ff36fdc1daafd6026cba08c3c7f50c976fb7ae11b88ff44cd7f609692ca7d25158 + languageName: node + linkType: hard + +"@sinonjs/samsam@npm:^8.0.0": + version: 8.0.0 + resolution: "@sinonjs/samsam@npm:8.0.0" + dependencies: + "@sinonjs/commons": ^2.0.0 + lodash.get: ^4.4.2 + type-detect: ^4.0.8 + checksum: 95e40d0bb9f7288e27c379bee1b03c3dc51e7e78b9d5ea6aef66a690da7e81efc4715145b561b449cefc5361a171791e3ce30fb1a46ab247d4c0766024c60a60 + languageName: node + linkType: hard + +"@sinonjs/text-encoding@npm:^0.7.1": + version: 0.7.2 + resolution: "@sinonjs/text-encoding@npm:0.7.2" + checksum: fe690002a32ba06906cf87e2e8fe84d1590294586f2a7fd180a65355b53660c155c3273d8011a5f2b77209b819aa7306678ae6e4aea0df014bd7ffd4bbbcf1ab + languageName: node + linkType: hard + "@slorber/remark-comment@npm:^1.0.0": version: 1.0.0 resolution: "@slorber/remark-comment@npm:1.0.0" @@ -5527,28 +5301,6 @@ __metadata: languageName: node linkType: hard -"@types/babel__core@npm:^7.1.14": - version: 7.20.5 - resolution: "@types/babel__core@npm:7.20.5" - dependencies: - "@babel/parser": ^7.20.7 - "@babel/types": ^7.20.7 - "@types/babel__generator": "*" - "@types/babel__template": "*" - "@types/babel__traverse": "*" - checksum: a3226f7930b635ee7a5e72c8d51a357e799d19cbf9d445710fa39ab13804f79ab1a54b72ea7d8e504659c7dfc50675db974b526142c754398d7413aa4bc30845 - languageName: node - linkType: hard - -"@types/babel__generator@npm:*": - version: 7.6.8 - resolution: "@types/babel__generator@npm:7.6.8" - dependencies: - "@babel/types": ^7.0.0 - checksum: 5b332ea336a2efffbdeedb92b6781949b73498606ddd4205462f7d96dafd45ff3618770b41de04c4881e333dd84388bfb8afbdf6f2764cbd98be550d85c6bb48 - languageName: node - linkType: hard - "@types/babel__preset-env@npm:^7": version: 7.9.6 resolution: "@types/babel__preset-env@npm:7.9.6" @@ -5556,25 +5308,6 @@ __metadata: languageName: node linkType: hard -"@types/babel__template@npm:*": - version: 7.4.4 - resolution: "@types/babel__template@npm:7.4.4" - dependencies: - "@babel/parser": ^7.1.0 - "@babel/types": ^7.0.0 - checksum: d7a02d2a9b67e822694d8e6a7ddb8f2b71a1d6962dfd266554d2513eefbb205b33ca71a0d163b1caea3981ccf849211f9964d8bd0727124d18ace45aa6c9ae29 - languageName: node - linkType: hard - -"@types/babel__traverse@npm:*, @types/babel__traverse@npm:^7.0.6": - version: 7.20.4 - resolution: "@types/babel__traverse@npm:7.20.4" - dependencies: - "@babel/types": ^7.20.7 - checksum: f044ba80e00d07e46ee917c44f96cfc268fcf6d3871f7dfb8db8d3c6dab1508302f3e6bc508352a4a3ae627d2522e3fc500fa55907e0410a08e2e0902a8f3576 - languageName: node - linkType: hard - "@types/bn.js@npm:^4.11.3": version: 4.11.6 resolution: "@types/bn.js@npm:4.11.6" @@ -5612,7 +5345,7 @@ __metadata: languageName: node linkType: hard -"@types/chai-as-promised@npm:^7.1.3": +"@types/chai-as-promised@npm:^7.1.3, @types/chai-as-promised@npm:^7.1.8": version: 7.1.8 resolution: "@types/chai-as-promised@npm:7.1.8" dependencies: @@ -5885,16 +5618,6 @@ __metadata: languageName: node linkType: hard -"@types/jest@npm:^29.5.11": - version: 29.5.11 - resolution: "@types/jest@npm:29.5.11" - dependencies: - expect: ^29.0.0 - pretty-format: ^29.0.0 - checksum: f892a06ec9f0afa9a61cd7fa316ec614e21d4df1ad301b5a837787e046fcb40dfdf7f264a55e813ac6b9b633cb9d366bd5b8d1cea725e84102477b366df23fdd - languageName: node - linkType: hard - "@types/json-schema@npm:*, @types/json-schema@npm:^7.0.12, @types/json-schema@npm:^7.0.4, @types/json-schema@npm:^7.0.5, @types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9": version: 7.0.15 resolution: "@types/json-schema@npm:7.0.15" @@ -6046,7 +5769,16 @@ __metadata: languageName: node linkType: hard -"@types/mocha@npm:^10.0.1": +"@types/mocha-each@npm:^2": + version: 2.0.4 + resolution: "@types/mocha-each@npm:2.0.4" + dependencies: + "@types/mocha": "*" + checksum: 2588284db079e2d0a17735c8fb5c12cba9feabf2de55c9ab49e1f3b38cc522691d30ed3abb1bcb21c087b27f373e3f4123ef7bd8d9a4f95cef38f6c8045c71f3 + languageName: node + linkType: hard + +"@types/mocha@npm:*, @types/mocha@npm:^10.0.1, @types/mocha@npm:^10.0.6": version: 10.0.6 resolution: "@types/mocha@npm:10.0.6" checksum: f7c836cf6cf27dc0f5970d262591b56f2a3caeaec8cfdc612c12e1cfbb207f601f710ece207e935164d4e3343b93be5054d0db5544f31f453b3923775d82099f @@ -6355,6 +6087,22 @@ __metadata: languageName: node linkType: hard +"@types/sinon@npm:^17": + version: 17.0.2 + resolution: "@types/sinon@npm:17.0.2" + dependencies: + "@types/sinonjs__fake-timers": "*" + checksum: 3a56615f2dc7d0b67d3e4b8ae358df2ff2164d89fabb22e9b46e6afe7d4df844a354ea65d409af9baf29ac0103ea562ab44dd0176405a9cf82a4ff183939f22f + languageName: node + linkType: hard + +"@types/sinonjs__fake-timers@npm:*": + version: 8.1.5 + resolution: "@types/sinonjs__fake-timers@npm:8.1.5" + checksum: 7e3c08f6c13df44f3ea7d9a5155ddf77e3f7314c156fa1c5a829a4f3763bafe2f75b1283b887f06e6b4296996a2f299b70f64ff82625f9af5885436e2524d10c + languageName: node + linkType: hard + "@types/sockjs@npm:^0.3.33": version: 0.3.36 resolution: "@types/sockjs@npm:0.3.36" @@ -7361,7 +7109,7 @@ __metadata: languageName: node linkType: hard -"ansi-escapes@npm:^4.2.1, ansi-escapes@npm:^4.3.0": +"ansi-escapes@npm:^4.3.0": version: 4.3.2 resolution: "ansi-escapes@npm:4.3.2" dependencies: @@ -7625,23 +7373,6 @@ __metadata: languageName: node linkType: hard -"babel-jest@npm:^29.7.0": - version: 29.7.0 - resolution: "babel-jest@npm:29.7.0" - dependencies: - "@jest/transform": ^29.7.0 - "@types/babel__core": ^7.1.14 - babel-plugin-istanbul: ^6.1.1 - babel-preset-jest: ^29.6.3 - chalk: ^4.0.0 - graceful-fs: ^4.2.9 - slash: ^3.0.0 - peerDependencies: - "@babel/core": ^7.8.0 - checksum: ee6f8e0495afee07cac5e4ee167be705c711a8cc8a737e05a587a131fdae2b3c8f9aa55dfd4d9c03009ac2d27f2de63d8ba96d3e8460da4d00e8af19ef9a83f7 - languageName: node - linkType: hard - "babel-loader@npm:^8.2.5": version: 8.3.0 resolution: "babel-loader@npm:8.3.0" @@ -7713,18 +7444,6 @@ __metadata: languageName: node linkType: hard -"babel-plugin-jest-hoist@npm:^29.6.3": - version: 29.6.3 - resolution: "babel-plugin-jest-hoist@npm:29.6.3" - dependencies: - "@babel/template": ^7.3.3 - "@babel/types": ^7.3.3 - "@types/babel__core": ^7.1.14 - "@types/babel__traverse": ^7.0.6 - checksum: 51250f22815a7318f17214a9d44650ba89551e6d4f47a2dc259128428324b52f5a73979d010cefd921fd5a720d8c1d55ad74ff601cd94c7bd44d5f6292fde2d1 - languageName: node - linkType: hard - "babel-plugin-polyfill-corejs2@npm:^0.4.6": version: 0.4.6 resolution: "babel-plugin-polyfill-corejs2@npm:0.4.6" @@ -7783,18 +7502,6 @@ __metadata: languageName: node linkType: hard -"babel-preset-jest@npm:^29.6.3": - version: 29.6.3 - resolution: "babel-preset-jest@npm:29.6.3" - dependencies: - babel-plugin-jest-hoist: ^29.6.3 - babel-preset-current-node-syntax: ^1.0.0 - peerDependencies: - "@babel/core": ^7.0.0 - checksum: aa4ff2a8a728d9d698ed521e3461a109a1e66202b13d3494e41eea30729a5e7cc03b3a2d56c594423a135429c37bf63a9fa8b0b9ce275298be3095a88c69f6fb - languageName: node - linkType: hard - "bail@npm:^1.0.0": version: 1.0.5 resolution: "bail@npm:1.0.5" @@ -8120,15 +7827,6 @@ __metadata: languageName: node linkType: hard -"bs-logger@npm:0.x": - version: 0.2.6 - resolution: "bs-logger@npm:0.2.6" - dependencies: - fast-json-stable-stringify: 2.x - checksum: d34bdaf68c64bd099ab97c3ea608c9ae7d3f5faa1178b3f3f345acd94e852e608b2d4f9103fb2e503f5e69780e98293df41691b84be909b41cf5045374d54606 - languageName: node - linkType: hard - "bs58@npm:^4.0.0": version: 4.0.1 resolution: "bs58@npm:4.0.1" @@ -8410,7 +8108,7 @@ __metadata: languageName: node linkType: hard -"chai@npm:^4.3.7, chai@npm:^4.3.8": +"chai@npm:^4.3.10, chai@npm:^4.3.7, chai@npm:^4.3.8": version: 4.3.10 resolution: "chai@npm:4.3.10" dependencies: @@ -8652,13 +8350,6 @@ __metadata: languageName: node linkType: hard -"cjs-module-lexer@npm:^1.0.0": - version: 1.2.3 - resolution: "cjs-module-lexer@npm:1.2.3" - checksum: 5ea3cb867a9bb609b6d476cd86590d105f3cfd6514db38ff71f63992ab40939c2feb68967faa15a6d2b1f90daa6416b79ea2de486e9e2485a6f8b66a21b4fb0a - languageName: node - linkType: hard - "classic-level@npm:^1.2.0": version: 1.3.0 resolution: "classic-level@npm:1.3.0" @@ -8839,13 +8530,6 @@ __metadata: languageName: node linkType: hard -"collect-v8-coverage@npm:^1.0.0": - version: 1.0.2 - resolution: "collect-v8-coverage@npm:1.0.2" - checksum: c10f41c39ab84629d16f9f6137bc8a63d332244383fc368caf2d2052b5e04c20cd1fd70f66fcf4e2422b84c8226598b776d39d5f2d2a51867cc1ed5d1982b4da - languageName: node - linkType: hard - "color-convert@npm:^1.9.0": version: 1.9.3 resolution: "color-convert@npm:1.9.3" @@ -9322,23 +9006,6 @@ __metadata: languageName: node linkType: hard -"create-jest@npm:^29.7.0": - version: 29.7.0 - resolution: "create-jest@npm:29.7.0" - dependencies: - "@jest/types": ^29.6.3 - chalk: ^4.0.0 - exit: ^0.1.2 - graceful-fs: ^4.2.9 - jest-config: ^29.7.0 - jest-util: ^29.7.0 - prompts: ^2.0.1 - bin: - create-jest: bin/create-jest.js - checksum: 1427d49458adcd88547ef6fa39041e1fe9033a661293aa8d2c3aa1b4967cb5bf4f0c00436c7a61816558f28ba2ba81a94d5c962e8022ea9a883978fc8e1f2945 - languageName: node - linkType: hard - "create-require@npm:^1.1.0": version: 1.1.1 resolution: "create-require@npm:1.1.1" @@ -9346,6 +9013,18 @@ __metadata: languageName: node linkType: hard +"cross-env@npm:^7.0.3": + version: 7.0.3 + resolution: "cross-env@npm:7.0.3" + dependencies: + cross-spawn: ^7.0.1 + bin: + cross-env: src/bin/cross-env.js + cross-env-shell: src/bin/cross-env-shell.js + checksum: 26f2f3ea2ab32617f57effb70d329c2070d2f5630adc800985d8b30b56e8bf7f5f439dd3a0358b79cee6f930afc23cf8e23515f17ccfb30092c6b62c6b630a79 + languageName: node + linkType: hard + "cross-fetch@npm:3.1.5": version: 3.1.5 resolution: "cross-fetch@npm:3.1.5" @@ -9355,7 +9034,7 @@ __metadata: languageName: node linkType: hard -"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": +"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.1, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": version: 7.0.3 resolution: "cross-spawn@npm:7.0.3" dependencies: @@ -9661,18 +9340,6 @@ __metadata: languageName: node linkType: hard -"dedent@npm:^1.0.0": - version: 1.5.1 - resolution: "dedent@npm:1.5.1" - peerDependencies: - babel-plugin-macros: ^3.1.0 - peerDependenciesMeta: - babel-plugin-macros: - optional: true - checksum: c3c300a14edf1bdf5a873f9e4b22e839d62490bc5c8d6169c1f15858a1a76733d06a9a56930e963d677a2ceeca4b6b0894cc5ea2f501aa382ca5b92af3413c2a - languageName: node - linkType: hard - "deep-eql@npm:^4.0.1, deep-eql@npm:^4.1.3": version: 4.1.3 resolution: "deep-eql@npm:4.1.3" @@ -9874,13 +9541,6 @@ __metadata: languageName: node linkType: hard -"detect-newline@npm:^3.0.0": - version: 3.1.0 - resolution: "detect-newline@npm:3.1.0" - checksum: ae6cd429c41ad01b164c59ea36f264a2c479598e61cba7c99da24175a7ab80ddf066420f2bec9a1c57a6bead411b4655ff15ad7d281c000a89791f48cbe939e7 - languageName: node - linkType: hard - "detect-node@npm:^2.0.4": version: 2.1.0 resolution: "detect-node@npm:2.1.0" @@ -9951,7 +9611,7 @@ __metadata: languageName: node linkType: hard -"diff@npm:^5.0.0": +"diff@npm:^5.0.0, diff@npm:^5.1.0": version: 5.1.0 resolution: "diff@npm:5.1.0" checksum: c7bf0df7c9bfbe1cf8a678fd1b2137c4fb11be117a67bc18a0e03ae75105e8533dbfb1cda6b46beb3586ef5aed22143ef9d70713977d5fb1f9114e21455fba90 @@ -10197,13 +9857,6 @@ __metadata: languageName: node linkType: hard -"emittery@npm:^0.13.1": - version: 0.13.1 - resolution: "emittery@npm:0.13.1" - checksum: 2b089ab6306f38feaabf4f6f02792f9ec85fc054fda79f44f6790e61bbf6bc4e1616afb9b232e0c5ec5289a8a452f79bfa6d905a6fd64e94b49981f0934001c6 - languageName: node - linkType: hard - "emoji-regex@npm:^8.0.0": version: 8.0.0 resolution: "emoji-regex@npm:8.0.0" @@ -11029,14 +10682,7 @@ __metadata: languageName: node linkType: hard -"exit@npm:^0.1.2": - version: 0.1.2 - resolution: "exit@npm:0.1.2" - checksum: abc407f07a875c3961e4781dfcb743b58d6c93de9ab263f4f8c9d23bb6da5f9b7764fc773f86b43dd88030444d5ab8abcb611cb680fba8ca075362b77114bba3 - languageName: node - linkType: hard - -"expect@npm:^29.0.0, expect@npm:^29.7.0": +"expect@npm:^29.7.0": version: 29.7.0 resolution: "expect@npm:29.7.0" dependencies: @@ -11155,7 +10801,7 @@ __metadata: languageName: node linkType: hard -"fast-json-stable-stringify@npm:2.x, fast-json-stable-stringify@npm:^2.0.0, fast-json-stable-stringify@npm:^2.1.0": +"fast-json-stable-stringify@npm:^2.0.0, fast-json-stable-stringify@npm:^2.1.0": version: 2.1.0 resolution: "fast-json-stable-stringify@npm:2.1.0" checksum: b191531e36c607977e5b1c47811158733c34ccb3bfde92c44798929e9b4154884378536d26ad90dfecd32e1ffc09c545d23535ad91b3161a27ddbb8ebe0cbecb @@ -13258,13 +12904,6 @@ __metadata: languageName: node linkType: hard -"is-generator-fn@npm:^2.0.0": - version: 2.1.0 - resolution: "is-generator-fn@npm:2.1.0" - checksum: a6ad5492cf9d1746f73b6744e0c43c0020510b59d56ddcb78a91cbc173f09b5e6beff53d75c9c5a29feb618bfef2bf458e025ecf3a57ad2268e2fb2569f56215 - languageName: node - linkType: hard - "is-generator-function@npm:^1.0.7": version: 1.0.10 resolution: "is-generator-function@npm:1.0.10" @@ -13609,225 +13248,62 @@ __metadata: languageName: node linkType: hard -"istanbul-lib-instrument@npm:^5.0.4": - version: 5.2.1 - resolution: "istanbul-lib-instrument@npm:5.2.1" - dependencies: - "@babel/core": ^7.12.3 - "@babel/parser": ^7.14.7 - "@istanbuljs/schema": ^0.1.2 - istanbul-lib-coverage: ^3.2.0 - semver: ^6.3.0 - checksum: bf16f1803ba5e51b28bbd49ed955a736488381e09375d830e42ddeb403855b2006f850711d95ad726f2ba3f1ae8e7366de7e51d2b9ac67dc4d80191ef7ddf272 - languageName: node - linkType: hard - -"istanbul-lib-instrument@npm:^6.0.0": - version: 6.0.1 - resolution: "istanbul-lib-instrument@npm:6.0.1" - dependencies: - "@babel/core": ^7.12.3 - "@babel/parser": ^7.14.7 - "@istanbuljs/schema": ^0.1.2 - istanbul-lib-coverage: ^3.2.0 - semver: ^7.5.4 - checksum: fb23472e739cfc9b027cefcd7d551d5e7ca7ff2817ae5150fab99fe42786a7f7b56a29a2aa8309c37092e18297b8003f9c274f50ca4360949094d17fbac81472 - languageName: node - linkType: hard - -"istanbul-lib-report@npm:^3.0.0, istanbul-lib-report@npm:^3.0.1": - version: 3.0.1 - resolution: "istanbul-lib-report@npm:3.0.1" - dependencies: - istanbul-lib-coverage: ^3.0.0 - make-dir: ^4.0.0 - supports-color: ^7.1.0 - checksum: fd17a1b879e7faf9bb1dc8f80b2a16e9f5b7b8498fe6ed580a618c34df0bfe53d2abd35bf8a0a00e628fb7405462576427c7df20bbe4148d19c14b431c974b21 - languageName: node - linkType: hard - -"istanbul-lib-source-maps@npm:^4.0.0": - version: 4.0.1 - resolution: "istanbul-lib-source-maps@npm:4.0.1" - dependencies: - debug: ^4.1.1 - istanbul-lib-coverage: ^3.0.0 - source-map: ^0.6.1 - checksum: 21ad3df45db4b81852b662b8d4161f6446cd250c1ddc70ef96a585e2e85c26ed7cd9c2a396a71533cfb981d1a645508bc9618cae431e55d01a0628e7dec62ef2 - languageName: node - linkType: hard - -"istanbul-reports@npm:^3.0.2, istanbul-reports@npm:^3.1.3": - version: 3.1.6 - resolution: "istanbul-reports@npm:3.1.6" - dependencies: - html-escaper: ^2.0.0 - istanbul-lib-report: ^3.0.0 - checksum: 44c4c0582f287f02341e9720997f9e82c071627e1e862895745d5f52ec72c9b9f38e1d12370015d2a71dcead794f34c7732aaef3fab80a24bc617a21c3d911d6 - languageName: node - linkType: hard - -"jackspeak@npm:^2.3.5": - version: 2.3.6 - resolution: "jackspeak@npm:2.3.6" - dependencies: - "@isaacs/cliui": ^8.0.2 - "@pkgjs/parseargs": ^0.11.0 - dependenciesMeta: - "@pkgjs/parseargs": - optional: true - checksum: 57d43ad11eadc98cdfe7496612f6bbb5255ea69fe51ea431162db302c2a11011642f50cfad57288bd0aea78384a0612b16e131944ad8ecd09d619041c8531b54 - languageName: node - linkType: hard - -"jest-changed-files@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-changed-files@npm:29.7.0" - dependencies: - execa: ^5.0.0 - jest-util: ^29.7.0 - p-limit: ^3.1.0 - checksum: 963e203893c396c5dfc75e00a49426688efea7361b0f0e040035809cecd2d46b3c01c02be2d9e8d38b1138357d2de7719ea5b5be21f66c10f2e9685a5a73bb99 - languageName: node - linkType: hard - -"jest-circus@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-circus@npm:29.7.0" - dependencies: - "@jest/environment": ^29.7.0 - "@jest/expect": ^29.7.0 - "@jest/test-result": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/node": "*" - chalk: ^4.0.0 - co: ^4.6.0 - dedent: ^1.0.0 - is-generator-fn: ^2.0.0 - jest-each: ^29.7.0 - jest-matcher-utils: ^29.7.0 - jest-message-util: ^29.7.0 - jest-runtime: ^29.7.0 - jest-snapshot: ^29.7.0 - jest-util: ^29.7.0 - p-limit: ^3.1.0 - pretty-format: ^29.7.0 - pure-rand: ^6.0.0 - slash: ^3.0.0 - stack-utils: ^2.0.3 - checksum: 349437148924a5a109c9b8aad6d393a9591b4dac1918fc97d81b7fc515bc905af9918495055071404af1fab4e48e4b04ac3593477b1d5dcf48c4e71b527c70a7 - languageName: node - linkType: hard - -"jest-cli@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-cli@npm:29.7.0" +"istanbul-lib-instrument@npm:^5.0.4": + version: 5.2.1 + resolution: "istanbul-lib-instrument@npm:5.2.1" dependencies: - "@jest/core": ^29.7.0 - "@jest/test-result": ^29.7.0 - "@jest/types": ^29.6.3 - chalk: ^4.0.0 - create-jest: ^29.7.0 - exit: ^0.1.2 - import-local: ^3.0.2 - jest-config: ^29.7.0 - jest-util: ^29.7.0 - jest-validate: ^29.7.0 - yargs: ^17.3.1 - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - bin: - jest: bin/jest.js - checksum: 664901277a3f5007ea4870632ed6e7889db9da35b2434e7cb488443e6bf5513889b344b7fddf15112135495b9875892b156faeb2d7391ddb9e2a849dcb7b6c36 + "@babel/core": ^7.12.3 + "@babel/parser": ^7.14.7 + "@istanbuljs/schema": ^0.1.2 + istanbul-lib-coverage: ^3.2.0 + semver: ^6.3.0 + checksum: bf16f1803ba5e51b28bbd49ed955a736488381e09375d830e42ddeb403855b2006f850711d95ad726f2ba3f1ae8e7366de7e51d2b9ac67dc4d80191ef7ddf272 languageName: node linkType: hard -"jest-config@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-config@npm:29.7.0" +"istanbul-lib-report@npm:^3.0.0, istanbul-lib-report@npm:^3.0.1": + version: 3.0.1 + resolution: "istanbul-lib-report@npm:3.0.1" dependencies: - "@babel/core": ^7.11.6 - "@jest/test-sequencer": ^29.7.0 - "@jest/types": ^29.6.3 - babel-jest: ^29.7.0 - chalk: ^4.0.0 - ci-info: ^3.2.0 - deepmerge: ^4.2.2 - glob: ^7.1.3 - graceful-fs: ^4.2.9 - jest-circus: ^29.7.0 - jest-environment-node: ^29.7.0 - jest-get-type: ^29.6.3 - jest-regex-util: ^29.6.3 - jest-resolve: ^29.7.0 - jest-runner: ^29.7.0 - jest-util: ^29.7.0 - jest-validate: ^29.7.0 - micromatch: ^4.0.4 - parse-json: ^5.2.0 - pretty-format: ^29.7.0 - slash: ^3.0.0 - strip-json-comments: ^3.1.1 - peerDependencies: - "@types/node": "*" - ts-node: ">=9.0.0" - peerDependenciesMeta: - "@types/node": - optional: true - ts-node: - optional: true - checksum: 4cabf8f894c180cac80b7df1038912a3fc88f96f2622de33832f4b3314f83e22b08fb751da570c0ab2b7988f21604bdabade95e3c0c041068ac578c085cf7dff + istanbul-lib-coverage: ^3.0.0 + make-dir: ^4.0.0 + supports-color: ^7.1.0 + checksum: fd17a1b879e7faf9bb1dc8f80b2a16e9f5b7b8498fe6ed580a618c34df0bfe53d2abd35bf8a0a00e628fb7405462576427c7df20bbe4148d19c14b431c974b21 languageName: node linkType: hard -"jest-diff@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-diff@npm:29.7.0" +"istanbul-reports@npm:^3.0.2": + version: 3.1.6 + resolution: "istanbul-reports@npm:3.1.6" dependencies: - chalk: ^4.0.0 - diff-sequences: ^29.6.3 - jest-get-type: ^29.6.3 - pretty-format: ^29.7.0 - checksum: 08e24a9dd43bfba1ef07a6374e5af138f53137b79ec3d5cc71a2303515335898888fa5409959172e1e05de966c9e714368d15e8994b0af7441f0721ee8e1bb77 + html-escaper: ^2.0.0 + istanbul-lib-report: ^3.0.0 + checksum: 44c4c0582f287f02341e9720997f9e82c071627e1e862895745d5f52ec72c9b9f38e1d12370015d2a71dcead794f34c7732aaef3fab80a24bc617a21c3d911d6 languageName: node linkType: hard -"jest-docblock@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-docblock@npm:29.7.0" +"jackspeak@npm:^2.3.5": + version: 2.3.6 + resolution: "jackspeak@npm:2.3.6" dependencies: - detect-newline: ^3.0.0 - checksum: 66390c3e9451f8d96c5da62f577a1dad701180cfa9b071c5025acab2f94d7a3efc2515cfa1654ebe707213241541ce9c5530232cdc8017c91ed64eea1bd3b192 + "@isaacs/cliui": ^8.0.2 + "@pkgjs/parseargs": ^0.11.0 + dependenciesMeta: + "@pkgjs/parseargs": + optional: true + checksum: 57d43ad11eadc98cdfe7496612f6bbb5255ea69fe51ea431162db302c2a11011642f50cfad57288bd0aea78384a0612b16e131944ad8ecd09d619041c8531b54 languageName: node linkType: hard -"jest-each@npm:^29.7.0": +"jest-diff@npm:^29.7.0": version: 29.7.0 - resolution: "jest-each@npm:29.7.0" + resolution: "jest-diff@npm:29.7.0" dependencies: - "@jest/types": ^29.6.3 chalk: ^4.0.0 + diff-sequences: ^29.6.3 jest-get-type: ^29.6.3 - jest-util: ^29.7.0 pretty-format: ^29.7.0 - checksum: e88f99f0184000fc8813f2a0aa79e29deeb63700a3b9b7928b8a418d7d93cd24933608591dbbdea732b473eb2021c72991b5cc51a17966842841c6e28e6f691c - languageName: node - linkType: hard - -"jest-environment-node@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-environment-node@npm:29.7.0" - dependencies: - "@jest/environment": ^29.7.0 - "@jest/fake-timers": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/node": "*" - jest-mock: ^29.7.0 - jest-util: ^29.7.0 - checksum: 501a9966292cbe0ca3f40057a37587cb6def25e1e0c5e39ac6c650fe78d3c70a2428304341d084ac0cced5041483acef41c477abac47e9a290d5545fd2f15646 + checksum: 08e24a9dd43bfba1ef07a6374e5af138f53137b79ec3d5cc71a2303515335898888fa5409959172e1e05de966c9e714368d15e8994b0af7441f0721ee8e1bb77 languageName: node linkType: hard @@ -13861,16 +13337,6 @@ __metadata: languageName: node linkType: hard -"jest-leak-detector@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-leak-detector@npm:29.7.0" - dependencies: - jest-get-type: ^29.6.3 - pretty-format: ^29.7.0 - checksum: e3950e3ddd71e1d0c22924c51a300a1c2db6cf69ec1e51f95ccf424bcc070f78664813bef7aed4b16b96dfbdeea53fe358f8aeaaea84346ae15c3735758f1605 - languageName: node - linkType: hard - "jest-matcher-utils@npm:^29.7.0": version: 29.7.0 resolution: "jest-matcher-utils@npm:29.7.0" @@ -13911,18 +13377,6 @@ __metadata: languageName: node linkType: hard -"jest-pnp-resolver@npm:^1.2.2": - version: 1.2.3 - resolution: "jest-pnp-resolver@npm:1.2.3" - peerDependencies: - jest-resolve: "*" - peerDependenciesMeta: - jest-resolve: - optional: true - checksum: db1a8ab2cb97ca19c01b1cfa9a9c8c69a143fde833c14df1fab0766f411b1148ff0df878adea09007ac6a2085ec116ba9a996a6ad104b1e58c20adbf88eed9b2 - languageName: node - linkType: hard - "jest-regex-util@npm:^29.6.3": version: 29.6.3 resolution: "jest-regex-util@npm:29.6.3" @@ -13930,92 +13384,6 @@ __metadata: languageName: node linkType: hard -"jest-resolve-dependencies@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-resolve-dependencies@npm:29.7.0" - dependencies: - jest-regex-util: ^29.6.3 - jest-snapshot: ^29.7.0 - checksum: aeb75d8150aaae60ca2bb345a0d198f23496494677cd6aefa26fc005faf354061f073982175daaf32b4b9d86b26ca928586344516e3e6969aa614cb13b883984 - languageName: node - linkType: hard - -"jest-resolve@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-resolve@npm:29.7.0" - dependencies: - chalk: ^4.0.0 - graceful-fs: ^4.2.9 - jest-haste-map: ^29.7.0 - jest-pnp-resolver: ^1.2.2 - jest-util: ^29.7.0 - jest-validate: ^29.7.0 - resolve: ^1.20.0 - resolve.exports: ^2.0.0 - slash: ^3.0.0 - checksum: 0ca218e10731aa17920526ec39deaec59ab9b966237905ffc4545444481112cd422f01581230eceb7e82d86f44a543d520a71391ec66e1b4ef1a578bd5c73487 - languageName: node - linkType: hard - -"jest-runner@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-runner@npm:29.7.0" - dependencies: - "@jest/console": ^29.7.0 - "@jest/environment": ^29.7.0 - "@jest/test-result": ^29.7.0 - "@jest/transform": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/node": "*" - chalk: ^4.0.0 - emittery: ^0.13.1 - graceful-fs: ^4.2.9 - jest-docblock: ^29.7.0 - jest-environment-node: ^29.7.0 - jest-haste-map: ^29.7.0 - jest-leak-detector: ^29.7.0 - jest-message-util: ^29.7.0 - jest-resolve: ^29.7.0 - jest-runtime: ^29.7.0 - jest-util: ^29.7.0 - jest-watcher: ^29.7.0 - jest-worker: ^29.7.0 - p-limit: ^3.1.0 - source-map-support: 0.5.13 - checksum: f0405778ea64812bf9b5c50b598850d94ccf95d7ba21f090c64827b41decd680ee19fcbb494007cdd7f5d0d8906bfc9eceddd8fa583e753e736ecd462d4682fb - languageName: node - linkType: hard - -"jest-runtime@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-runtime@npm:29.7.0" - dependencies: - "@jest/environment": ^29.7.0 - "@jest/fake-timers": ^29.7.0 - "@jest/globals": ^29.7.0 - "@jest/source-map": ^29.6.3 - "@jest/test-result": ^29.7.0 - "@jest/transform": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/node": "*" - chalk: ^4.0.0 - cjs-module-lexer: ^1.0.0 - collect-v8-coverage: ^1.0.0 - glob: ^7.1.3 - graceful-fs: ^4.2.9 - jest-haste-map: ^29.7.0 - jest-message-util: ^29.7.0 - jest-mock: ^29.7.0 - jest-regex-util: ^29.6.3 - jest-resolve: ^29.7.0 - jest-snapshot: ^29.7.0 - jest-util: ^29.7.0 - slash: ^3.0.0 - strip-bom: ^4.0.0 - checksum: d19f113d013e80691e07047f68e1e3448ef024ff2c6b586ce4f90cd7d4c62a2cd1d460110491019719f3c59bfebe16f0e201ed005ef9f80e2cf798c374eed54e - languageName: node - linkType: hard - "jest-snapshot@npm:^29.7.0": version: 29.7.0 resolution: "jest-snapshot@npm:29.7.0" @@ -14044,7 +13412,7 @@ __metadata: languageName: node linkType: hard -"jest-util@npm:^29.0.0, jest-util@npm:^29.7.0": +"jest-util@npm:^29.7.0": version: 29.7.0 resolution: "jest-util@npm:29.7.0" dependencies: @@ -14058,36 +13426,6 @@ __metadata: languageName: node linkType: hard -"jest-validate@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-validate@npm:29.7.0" - dependencies: - "@jest/types": ^29.6.3 - camelcase: ^6.2.0 - chalk: ^4.0.0 - jest-get-type: ^29.6.3 - leven: ^3.1.0 - pretty-format: ^29.7.0 - checksum: 191fcdc980f8a0de4dbdd879fa276435d00eb157a48683af7b3b1b98b0f7d9de7ffe12689b617779097ff1ed77601b9f7126b0871bba4f776e222c40f62e9dae - languageName: node - linkType: hard - -"jest-watcher@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-watcher@npm:29.7.0" - dependencies: - "@jest/test-result": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/node": "*" - ansi-escapes: ^4.2.1 - chalk: ^4.0.0 - emittery: ^0.13.1 - jest-util: ^29.7.0 - string-length: ^4.0.1 - checksum: 67e6e7fe695416deff96b93a14a561a6db69389a0667e9489f24485bb85e5b54e12f3b2ba511ec0b777eca1e727235b073e3ebcdd473d68888650489f88df92f - languageName: node - linkType: hard - "jest-worker@npm:^27.4.5": version: 27.5.1 resolution: "jest-worker@npm:27.5.1" @@ -14111,25 +13449,6 @@ __metadata: languageName: node linkType: hard -"jest@npm:^29.7.0": - version: 29.7.0 - resolution: "jest@npm:29.7.0" - dependencies: - "@jest/core": ^29.7.0 - "@jest/types": ^29.6.3 - import-local: ^3.0.2 - jest-cli: ^29.7.0 - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - bin: - jest: bin/jest.js - checksum: 17ca8d67504a7dbb1998cf3c3077ec9031ba3eb512da8d71cb91bcabb2b8995c4e4b292b740cb9bf1cbff5ce3e110b3f7c777b0cefb6f41ab05445f248d0ee0b - languageName: node - linkType: hard - "jiti@npm:^1.18.2, jiti@npm:^1.20.0": version: 1.21.0 resolution: "jiti@npm:1.21.0" @@ -14286,7 +13605,7 @@ __metadata: languageName: node linkType: hard -"json5@npm:^2.1.2, json5@npm:^2.2.3": +"json5@npm:^2.1.2, json5@npm:^2.2.2, json5@npm:^2.2.3": version: 2.2.3 resolution: "json5@npm:2.2.3" bin: @@ -14339,6 +13658,13 @@ __metadata: languageName: node linkType: hard +"just-extend@npm:^4.0.2": + version: 4.2.1 + resolution: "just-extend@npm:4.2.1" + checksum: ff9fdede240fad313efeeeb68a660b942e5586d99c0058064c78884894a2690dc09bba44c994ad4e077e45d913fef01a9240c14a72c657b53687ac58de53b39c + languageName: node + linkType: hard + "katex@npm:^0.16.0": version: 0.16.9 resolution: "katex@npm:0.16.9" @@ -14815,6 +14141,13 @@ __metadata: languageName: node linkType: hard +"lodash.get@npm:^4.4.2": + version: 4.4.2 + resolution: "lodash.get@npm:4.4.2" + checksum: e403047ddb03181c9d0e92df9556570e2b67e0f0a930fcbbbd779370972368f5568e914f913e93f3b08f6d492abc71e14d4e9b7a18916c31fa04bd2306efe545 + languageName: node + linkType: hard + "lodash.isequal@npm:^4.5.0": version: 4.5.0 resolution: "lodash.isequal@npm:4.5.0" @@ -14822,7 +14155,7 @@ __metadata: languageName: node linkType: hard -"lodash.memoize@npm:4.x, lodash.memoize@npm:^4.1.2": +"lodash.memoize@npm:^4.1.2": version: 4.1.2 resolution: "lodash.memoize@npm:4.1.2" checksum: 9ff3942feeccffa4f1fafa88d32f0d24fdc62fd15ded5a74a5f950ff5f0c6f61916157246744c620173dddf38d37095a92327d5fd3861e2063e736a5c207d089 @@ -15021,7 +14354,7 @@ __metadata: languageName: node linkType: hard -"make-error@npm:1.x, make-error@npm:^1.1.1": +"make-error@npm:^1.1.1": version: 1.3.6 resolution: "make-error@npm:1.3.6" checksum: b86e5e0e25f7f777b77fabd8e2cbf15737972869d852a22b7e73c17623928fccb826d8e46b9951501d3f20e51ad74ba8c59ed584f610526a48f8ccf88aaec402 @@ -16306,6 +15639,15 @@ __metadata: languageName: node linkType: hard +"mocha-each@npm:^2.0.1": + version: 2.0.1 + resolution: "mocha-each@npm:2.0.1" + dependencies: + sprintf-js: ^1.0.3 + checksum: 0de01ce517c2f7e7c3e19ef3f444809913f2f1602cb2571e6a3f8cb7ef3040f4f01b0f9f11a317e4ec1aeb9d39ceae4947c96668560cf638fe4d02ea549c2d4c + languageName: node + linkType: hard + "mocha@npm:^10.0.0, mocha@npm:^10.2.0": version: 10.2.0 resolution: "mocha@npm:10.2.0" @@ -16473,6 +15815,19 @@ __metadata: languageName: node linkType: hard +"nise@npm:^5.1.5": + version: 5.1.5 + resolution: "nise@npm:5.1.5" + dependencies: + "@sinonjs/commons": ^2.0.0 + "@sinonjs/fake-timers": ^10.0.2 + "@sinonjs/text-encoding": ^0.7.1 + just-extend: ^4.0.2 + path-to-regexp: ^1.7.0 + checksum: c763dc62c5796cafa5c9268e14a5b34db6e6fa2f1dbc57a891fe5d7ea632a87868e22b5bb34965006f984630793ea11368351e94971163228d9e20b2e88edce8 + languageName: node + linkType: hard + "no-case@npm:^3.0.4": version: 3.0.4 resolution: "no-case@npm:3.0.4" @@ -16919,7 +16274,7 @@ __metadata: languageName: node linkType: hard -"p-limit@npm:^3.0.2, p-limit@npm:^3.1.0": +"p-limit@npm:^3.0.2": version: 3.1.0 resolution: "p-limit@npm:3.1.0" dependencies: @@ -17364,7 +16719,7 @@ __metadata: languageName: node linkType: hard -"playwright@npm:^1.22.2": +"playwright@npm:^1.22.2, playwright@npm:^1.40.1": version: 1.40.1 resolution: "playwright@npm:1.40.1" dependencies: @@ -17886,7 +17241,7 @@ __metadata: languageName: node linkType: hard -"pretty-format@npm:^29.0.0, pretty-format@npm:^29.7.0": +"pretty-format@npm:^29.7.0": version: 29.7.0 resolution: "pretty-format@npm:29.7.0" dependencies: @@ -17961,7 +17316,7 @@ __metadata: languageName: node linkType: hard -"prompts@npm:^2.0.1, prompts@npm:^2.4.2": +"prompts@npm:^2.4.2": version: 2.4.2 resolution: "prompts@npm:2.4.2" dependencies: @@ -18113,13 +17468,6 @@ __metadata: languageName: node linkType: hard -"pure-rand@npm:^6.0.0": - version: 6.0.4 - resolution: "pure-rand@npm:6.0.4" - checksum: e1c4e69f8bf7303e5252756d67c3c7551385cd34d94a1f511fe099727ccbab74c898c03a06d4c4a24a89b51858781057b83ebbfe740d984240cdc04fead36068 - languageName: node - linkType: hard - "qs@npm:6.11.0": version: 6.11.0 resolution: "qs@npm:6.11.0" @@ -18969,13 +18317,6 @@ __metadata: languageName: node linkType: hard -"resolve.exports@npm:^2.0.0": - version: 2.0.2 - resolution: "resolve.exports@npm:2.0.2" - checksum: 1c7778ca1b86a94f8ab4055d196c7d87d1874b96df4d7c3e67bbf793140f0717fd506dcafd62785b079cd6086b9264424ad634fb904409764c3509c3df1653f2 - languageName: node - linkType: hard - "resolve@npm:1.17.0": version: 1.17.0 resolution: "resolve@npm:1.17.0" @@ -18985,7 +18326,7 @@ __metadata: languageName: node linkType: hard -"resolve@npm:^1.1.6, resolve@npm:^1.14.2, resolve@npm:^1.19.0, resolve@npm:^1.20.0, resolve@npm:^1.3.2, resolve@npm:^1.9.0": +"resolve@npm:^1.1.6, resolve@npm:^1.14.2, resolve@npm:^1.19.0, resolve@npm:^1.3.2, resolve@npm:^1.9.0": version: 1.22.8 resolution: "resolve@npm:1.22.8" dependencies: @@ -19007,7 +18348,7 @@ __metadata: languageName: node linkType: hard -"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.20.0#~builtin, resolve@patch:resolve@^1.3.2#~builtin, resolve@patch:resolve@^1.9.0#~builtin": +"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.3.2#~builtin, resolve@patch:resolve@^1.9.0#~builtin": version: 1.22.8 resolution: "resolve@patch:resolve@npm%3A1.22.8#~builtin::version=1.22.8&hash=c3c19d" dependencies: @@ -19620,6 +18961,20 @@ __metadata: languageName: node linkType: hard +"sinon@npm:^17.0.1": + version: 17.0.1 + resolution: "sinon@npm:17.0.1" + dependencies: + "@sinonjs/commons": ^3.0.0 + "@sinonjs/fake-timers": ^11.2.2 + "@sinonjs/samsam": ^8.0.0 + diff: ^5.1.0 + nise: ^5.1.5 + supports-color: ^7.2.0 + checksum: a807c2997d6eabdcaa4409df9fd9816a3e839f96d7e5d76610a33f5e1b60cf37616c6288f0f580262da17ea4ee626c6d1600325bf423e30c5a7f0d9a203e26c0 + languageName: node + linkType: hard + "sirv@npm:^2.0.3": version: 2.0.3 resolution: "sirv@npm:2.0.3" @@ -19765,16 +19120,6 @@ __metadata: languageName: node linkType: hard -"source-map-support@npm:0.5.13": - version: 0.5.13 - resolution: "source-map-support@npm:0.5.13" - dependencies: - buffer-from: ^1.0.0 - source-map: ^0.6.0 - checksum: 933550047b6c1a2328599a21d8b7666507427c0f5ef5eaadd56b5da0fd9505e239053c66fe181bf1df469a3b7af9d775778eee283cbb7ae16b902ddc09e93a97 - languageName: node - linkType: hard - "source-map-support@npm:^0.5.13, source-map-support@npm:~0.5.20": version: 0.5.21 resolution: "source-map-support@npm:0.5.21" @@ -19856,6 +19201,13 @@ __metadata: languageName: node linkType: hard +"sprintf-js@npm:^1.0.3": + version: 1.1.3 + resolution: "sprintf-js@npm:1.1.3" + checksum: a3fdac7b49643875b70864a9d9b469d87a40dfeaf5d34d9d0c5b1cda5fd7d065531fcb43c76357d62254c57184a7b151954156563a4d6a747015cfb41021cad0 + languageName: node + linkType: hard + "sprintf-js@npm:~1.0.2": version: 1.0.3 resolution: "sprintf-js@npm:1.0.3" @@ -19962,16 +19314,6 @@ __metadata: languageName: node linkType: hard -"string-length@npm:^4.0.1": - version: 4.0.2 - resolution: "string-length@npm:4.0.2" - dependencies: - char-regex: ^1.0.2 - strip-ansi: ^6.0.0 - checksum: ce85533ef5113fcb7e522bcf9e62cb33871aa99b3729cec5595f4447f660b0cefd542ca6df4150c97a677d58b0cb727a3fe09ac1de94071d05526c73579bf505 - languageName: node - linkType: hard - "string-range@npm:~1.2, string-range@npm:~1.2.1": version: 1.2.2 resolution: "string-range@npm:1.2.2" @@ -20081,10 +19423,10 @@ __metadata: languageName: node linkType: hard -"strip-bom@npm:^4.0.0": - version: 4.0.0 - resolution: "strip-bom@npm:4.0.0" - checksum: 9dbcfbaf503c57c06af15fe2c8176fb1bf3af5ff65003851a102749f875a6dbe0ab3b30115eccf6e805e9d756830d3e40ec508b62b3f1ddf3761a20ebe29d3f3 +"strip-bom@npm:^3.0.0": + version: 3.0.0 + resolution: "strip-bom@npm:3.0.0" + checksum: 8d50ff27b7ebe5ecc78f1fe1e00fcdff7af014e73cf724b46fb81ef889eeb1015fc5184b64e81a2efe002180f3ba431bdd77e300da5c6685d702780fbf0c8d5b languageName: node linkType: hard @@ -20189,7 +19531,7 @@ __metadata: languageName: node linkType: hard -"supports-color@npm:^7.1.0": +"supports-color@npm:^7.1.0, supports-color@npm:^7.2.0": version: 7.2.0 resolution: "supports-color@npm:7.2.0" dependencies: @@ -20560,39 +19902,6 @@ __metadata: languageName: node linkType: hard -"ts-jest@npm:^29.1.1": - version: 29.1.1 - resolution: "ts-jest@npm:29.1.1" - dependencies: - bs-logger: 0.x - fast-json-stable-stringify: 2.x - jest-util: ^29.0.0 - json5: ^2.2.3 - lodash.memoize: 4.x - make-error: 1.x - semver: ^7.5.3 - yargs-parser: ^21.0.1 - peerDependencies: - "@babel/core": ">=7.0.0-beta.0 <8" - "@jest/types": ^29.0.0 - babel-jest: ^29.0.0 - jest: ^29.0.0 - typescript: ">=4.3 <6" - peerDependenciesMeta: - "@babel/core": - optional: true - "@jest/types": - optional: true - babel-jest: - optional: true - esbuild: - optional: true - bin: - ts-jest: cli.js - checksum: a8c9e284ed4f819526749f6e4dc6421ec666f20ab44d31b0f02b4ed979975f7580b18aea4813172d43e39b29464a71899f8893dd29b06b4a351a3af8ba47b402 - languageName: node - linkType: hard - "ts-loader@npm:^9.5.1": version: 9.5.1 resolution: "ts-loader@npm:9.5.1" @@ -20669,6 +19978,17 @@ __metadata: languageName: node linkType: hard +"tsconfig-paths@npm:^4.2.0": + version: 4.2.0 + resolution: "tsconfig-paths@npm:4.2.0" + dependencies: + json5: ^2.2.2 + minimist: ^1.2.6 + strip-bom: ^3.0.0 + checksum: 28c5f7bbbcabc9dabd4117e8fdc61483f6872a1c6b02a4b1c4d68c5b79d06896c3cc9547610c4c3ba64658531caa2de13ead1ea1bf321c7b53e969c4752b98c7 + languageName: node + linkType: hard + "tslib@npm:2.4.0": version: 2.4.0 resolution: "tslib@npm:2.4.0" @@ -22238,7 +21558,7 @@ __metadata: languageName: node linkType: hard -"yargs-parser@npm:^21.0.1, yargs-parser@npm:^21.1.1": +"yargs-parser@npm:^21.1.1": version: 21.1.1 resolution: "yargs-parser@npm:21.1.1" checksum: ed2d96a616a9e3e1cc7d204c62ecc61f7aaab633dcbfab2c6df50f7f87b393993fe6640d017759fe112d0cb1e0119f2b4150a87305cc873fd90831c6a58ccf1c @@ -22287,7 +21607,7 @@ __metadata: languageName: node linkType: hard -"yargs@npm:^17.3.1, yargs@npm:^17.7.1": +"yargs@npm:^17.7.1": version: 17.7.2 resolution: "yargs@npm:17.7.2" dependencies: From c3233a5921d619fc4df427a986bf34535b0280f5 Mon Sep 17 00:00:00 2001 From: thunkar Date: Thu, 21 Dec 2023 08:10:51 +0000 Subject: [PATCH 06/37] Deps cleanup --- compiler/wasm/package.json | 24 +- yarn.lock | 735 ++----------------------------------- 2 files changed, 29 insertions(+), 730 deletions(-) diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index 60ec79b2378..fb4cc73fb25 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -38,19 +38,12 @@ }, "devDependencies": { "@esm-bundle/chai": "^4.3.4-fix.0", - "@jest/globals": "^29.7.0", "@ltd/j-toml": "^1.38.0", - "@types/babel__preset-env": "^7", + "@noir-lang/noirc_abi": "workspace:*", "@types/chai": "^4", - "@types/chai-as-promised": "^7.1.8", - "@types/lodash.capitalize": "^4", - "@types/lodash.compact": "^3", - "@types/lodash.times": "^4", - "@types/lodash.upperfirst": "^4", "@types/mocha": "^10.0.6", "@types/mocha-each": "^2", "@types/node": "^20.10.0", - "@types/pako": "^2", "@types/path-browserify": "^1", "@types/readable-stream": "^4", "@types/sinon": "^17", @@ -58,18 +51,10 @@ "@web/dev-server-esbuild": "^0.3.6", "@web/test-runner": "^0.15.3", "@web/test-runner-playwright": "^0.10.0", - "assert": "^2.1.0", "browserify-fs": "^1.0.0", - "buffer": "^6.0.3", "chai": "^4.3.10", "copy-webpack-plugin": "^11.0.0", - "cross-env": "^7.0.3", - "file-loader": "^6.2.0", "html-webpack-plugin": "^5.5.4", - "lodash.capitalize": "^4.2.1", - "lodash.compact": "^3.0.1", - "lodash.times": "^4.3.2", - "lodash.upperfirst": "^4.3.1", "memfs": "^4.6.0", "mocha": "^10.2.0", "mocha-each": "^2.0.1", @@ -79,16 +64,15 @@ "process": "^0.11.10", "readable-stream": "^4.4.2", "sinon": "^17.0.1", - "text-encoding": "^0.7.0", "ts-loader": "^9.5.1", "ts-node": "^10.9.1", - "tsconfig-paths": "^4.2.0", "typescript": "~5.2.2", "unzipit": "^1.4.3", - "url": "^0.11.3", - "util": "^0.12.5", "webpack": "^5.49.0", "webpack-cli": "^4.7.2", "webpack-dev-server": "^4.15.1" + }, + "dependencies": { + "assert": "^2.1.0" } } diff --git a/yarn.lock b/yarn.lock index 99e123cae96..30a2ec8297f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -235,7 +235,7 @@ __metadata: languageName: node linkType: hard -"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.12.11, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.16.0, @babel/code-frame@npm:^7.22.13, @babel/code-frame@npm:^7.23.5, @babel/code-frame@npm:^7.8.3": +"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.12.11, @babel/code-frame@npm:^7.16.0, @babel/code-frame@npm:^7.22.13, @babel/code-frame@npm:^7.23.5, @babel/code-frame@npm:^7.8.3": version: 7.23.5 resolution: "@babel/code-frame@npm:7.23.5" dependencies: @@ -276,29 +276,6 @@ __metadata: languageName: node linkType: hard -"@babel/core@npm:^7.11.6, @babel/core@npm:^7.12.3": - version: 7.23.6 - resolution: "@babel/core@npm:7.23.6" - dependencies: - "@ampproject/remapping": ^2.2.0 - "@babel/code-frame": ^7.23.5 - "@babel/generator": ^7.23.6 - "@babel/helper-compilation-targets": ^7.23.6 - "@babel/helper-module-transforms": ^7.23.3 - "@babel/helpers": ^7.23.6 - "@babel/parser": ^7.23.6 - "@babel/template": ^7.22.15 - "@babel/traverse": ^7.23.6 - "@babel/types": ^7.23.6 - convert-source-map: ^2.0.0 - debug: ^4.1.0 - gensync: ^1.0.0-beta.2 - json5: ^2.2.3 - semver: ^6.3.1 - checksum: 4bddd1b80394a64b2ee33eeb216e8a2a49ad3d74f0ca9ba678c84a37f4502b2540662d72530d78228a2a349fda837fa852eea5cd3ae28465d1188acc6055868e - languageName: node - linkType: hard - "@babel/core@npm:^7.18.6, @babel/core@npm:^7.19.6, @babel/core@npm:^7.23.3": version: 7.23.5 resolution: "@babel/core@npm:7.23.5" @@ -334,18 +311,6 @@ __metadata: languageName: node linkType: hard -"@babel/generator@npm:^7.23.6, @babel/generator@npm:^7.7.2": - version: 7.23.6 - resolution: "@babel/generator@npm:7.23.6" - dependencies: - "@babel/types": ^7.23.6 - "@jridgewell/gen-mapping": ^0.3.2 - "@jridgewell/trace-mapping": ^0.3.17 - jsesc: ^2.5.1 - checksum: 1a1a1c4eac210f174cd108d479464d053930a812798e09fee069377de39a893422df5b5b146199ead7239ae6d3a04697b45fc9ac6e38e0f6b76374390f91fc6c - languageName: node - linkType: hard - "@babel/helper-annotate-as-pure@npm:^7.22.5": version: 7.22.5 resolution: "@babel/helper-annotate-as-pure@npm:7.22.5" @@ -377,19 +342,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-compilation-targets@npm:^7.23.6": - version: 7.23.6 - resolution: "@babel/helper-compilation-targets@npm:7.23.6" - dependencies: - "@babel/compat-data": ^7.23.5 - "@babel/helper-validator-option": ^7.23.5 - browserslist: ^4.22.2 - lru-cache: ^5.1.1 - semver: ^6.3.1 - checksum: c630b98d4527ac8fe2c58d9a06e785dfb2b73ec71b7c4f2ddf90f814b5f75b547f3c015f110a010fd31f76e3864daaf09f3adcd2f6acdbfb18a8de3a48717590 - languageName: node - linkType: hard - "@babel/helper-create-class-features-plugin@npm:^7.22.15, @babel/helper-create-class-features-plugin@npm:^7.23.5": version: 7.23.5 resolution: "@babel/helper-create-class-features-plugin@npm:7.23.5" @@ -615,17 +567,6 @@ __metadata: languageName: node linkType: hard -"@babel/helpers@npm:^7.23.6": - version: 7.23.6 - resolution: "@babel/helpers@npm:7.23.6" - dependencies: - "@babel/template": ^7.22.15 - "@babel/traverse": ^7.23.6 - "@babel/types": ^7.23.6 - checksum: c5ba62497e1d717161d107c4b3de727565c68b6b9f50f59d6298e613afeca8895799b227c256e06d362e565aec34e26fb5c675b9c3d25055c52b945a21c21e21 - languageName: node - linkType: hard - "@babel/highlight@npm:^7.23.4": version: 7.23.4 resolution: "@babel/highlight@npm:7.23.4" @@ -646,15 +587,6 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.14.7, @babel/parser@npm:^7.23.6": - version: 7.23.6 - resolution: "@babel/parser@npm:7.23.6" - bin: - parser: ./bin/babel-parser.js - checksum: 140801c43731a6c41fd193f5c02bc71fd647a0360ca616b23d2db8be4b9739b9f951a03fc7c2db4f9b9214f4b27c1074db0f18bc3fa653783082d5af7c8860d5 - languageName: node - linkType: hard - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:7.23.3" @@ -724,18 +656,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-bigint@npm:^7.8.3": - version: 7.8.3 - resolution: "@babel/plugin-syntax-bigint@npm:7.8.3" - dependencies: - "@babel/helper-plugin-utils": ^7.8.0 - peerDependencies: - "@babel/core": ^7.0.0-0 - checksum: 3a10849d83e47aec50f367a9e56a6b22d662ddce643334b087f9828f4c3dd73bdc5909aaeabe123fed78515767f9ca43498a0e621c438d1cd2802d7fae3c9648 - languageName: node - linkType: hard - -"@babel/plugin-syntax-class-properties@npm:^7.12.13, @babel/plugin-syntax-class-properties@npm:^7.8.3": +"@babel/plugin-syntax-class-properties@npm:^7.12.13": version: 7.12.13 resolution: "@babel/plugin-syntax-class-properties@npm:7.12.13" dependencies: @@ -801,7 +722,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-import-meta@npm:^7.10.4, @babel/plugin-syntax-import-meta@npm:^7.8.3": +"@babel/plugin-syntax-import-meta@npm:^7.10.4": version: 7.10.4 resolution: "@babel/plugin-syntax-import-meta@npm:7.10.4" dependencies: @@ -834,7 +755,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-jsx@npm:^7.23.3, @babel/plugin-syntax-jsx@npm:^7.7.2": +"@babel/plugin-syntax-jsx@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-syntax-jsx@npm:7.23.3" dependencies: @@ -845,7 +766,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-logical-assignment-operators@npm:^7.10.4, @babel/plugin-syntax-logical-assignment-operators@npm:^7.8.3": +"@babel/plugin-syntax-logical-assignment-operators@npm:^7.10.4": version: 7.10.4 resolution: "@babel/plugin-syntax-logical-assignment-operators@npm:7.10.4" dependencies: @@ -867,7 +788,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-numeric-separator@npm:^7.10.4, @babel/plugin-syntax-numeric-separator@npm:^7.8.3": +"@babel/plugin-syntax-numeric-separator@npm:^7.10.4": version: 7.10.4 resolution: "@babel/plugin-syntax-numeric-separator@npm:7.10.4" dependencies: @@ -922,7 +843,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-top-level-await@npm:^7.14.5, @babel/plugin-syntax-top-level-await@npm:^7.8.3": +"@babel/plugin-syntax-top-level-await@npm:^7.14.5": version: 7.14.5 resolution: "@babel/plugin-syntax-top-level-await@npm:7.14.5" dependencies: @@ -933,7 +854,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-typescript@npm:^7.23.3, @babel/plugin-syntax-typescript@npm:^7.7.2": +"@babel/plugin-syntax-typescript@npm:^7.23.3": version: 7.23.3 resolution: "@babel/plugin-syntax-typescript@npm:7.23.3" dependencies: @@ -1815,24 +1736,6 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.23.6": - version: 7.23.6 - resolution: "@babel/traverse@npm:7.23.6" - dependencies: - "@babel/code-frame": ^7.23.5 - "@babel/generator": ^7.23.6 - "@babel/helper-environment-visitor": ^7.22.20 - "@babel/helper-function-name": ^7.23.0 - "@babel/helper-hoist-variables": ^7.22.5 - "@babel/helper-split-export-declaration": ^7.22.6 - "@babel/parser": ^7.23.6 - "@babel/types": ^7.23.6 - debug: ^4.3.1 - globals: ^11.1.0 - checksum: 48f2eac0e86b6cb60dab13a5ea6a26ba45c450262fccdffc334c01089e75935f7546be195e260e97f6e43cea419862eda095018531a2718fef8189153d479f88 - languageName: node - linkType: hard - "@babel/types@npm:^7.12.7, @babel/types@npm:^7.20.0, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.5, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": version: 7.23.5 resolution: "@babel/types@npm:7.23.5" @@ -1844,17 +1747,6 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.23.6, @babel/types@npm:^7.3.3": - version: 7.23.6 - resolution: "@babel/types@npm:7.23.6" - dependencies: - "@babel/helper-string-parser": ^7.23.4 - "@babel/helper-validator-identifier": ^7.22.20 - to-fast-properties: ^2.0.0 - checksum: 68187dbec0d637f79bc96263ac95ec8b06d424396678e7e225492be866414ce28ebc918a75354d4c28659be6efe30020b4f0f6df81cc418a2d30645b690a8de0 - languageName: node - linkType: hard - "@chainsafe/as-sha256@npm:^0.3.1": version: 0.3.1 resolution: "@chainsafe/as-sha256@npm:0.3.1" @@ -3617,83 +3509,6 @@ __metadata: languageName: node linkType: hard -"@istanbuljs/load-nyc-config@npm:^1.0.0": - version: 1.1.0 - resolution: "@istanbuljs/load-nyc-config@npm:1.1.0" - dependencies: - camelcase: ^5.3.1 - find-up: ^4.1.0 - get-package-type: ^0.1.0 - js-yaml: ^3.13.1 - resolve-from: ^5.0.0 - checksum: d578da5e2e804d5c93228450a1380e1a3c691de4953acc162f387b717258512a3e07b83510a936d9fab03eac90817473917e24f5d16297af3867f59328d58568 - languageName: node - linkType: hard - -"@istanbuljs/schema@npm:^0.1.2": - version: 0.1.3 - resolution: "@istanbuljs/schema@npm:0.1.3" - checksum: 5282759d961d61350f33d9118d16bcaed914ebf8061a52f4fa474b2cb08720c9c81d165e13b82f2e5a8a212cc5af482f0c6fc1ac27b9e067e5394c9a6ed186c9 - languageName: node - linkType: hard - -"@jest/environment@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/environment@npm:29.7.0" - dependencies: - "@jest/fake-timers": ^29.7.0 - "@jest/types": ^29.6.3 - "@types/node": "*" - jest-mock: ^29.7.0 - checksum: 6fb398143b2543d4b9b8d1c6dbce83fa5247f84f550330604be744e24c2bd2178bb893657d62d1b97cf2f24baf85c450223f8237cccb71192c36a38ea2272934 - languageName: node - linkType: hard - -"@jest/expect-utils@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/expect-utils@npm:29.7.0" - dependencies: - jest-get-type: ^29.6.3 - checksum: 75eb177f3d00b6331bcaa057e07c0ccb0733a1d0a1943e1d8db346779039cb7f103789f16e502f888a3096fb58c2300c38d1f3748b36a7fa762eb6f6d1b160ed - languageName: node - linkType: hard - -"@jest/expect@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/expect@npm:29.7.0" - dependencies: - expect: ^29.7.0 - jest-snapshot: ^29.7.0 - checksum: a01cb85fd9401bab3370618f4b9013b90c93536562222d920e702a0b575d239d74cecfe98010aaec7ad464f67cf534a353d92d181646a4b792acaa7e912ae55e - languageName: node - linkType: hard - -"@jest/fake-timers@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/fake-timers@npm:29.7.0" - dependencies: - "@jest/types": ^29.6.3 - "@sinonjs/fake-timers": ^10.0.2 - "@types/node": "*" - jest-message-util: ^29.7.0 - jest-mock: ^29.7.0 - jest-util: ^29.7.0 - checksum: caf2bbd11f71c9241b458d1b5a66cbe95debc5a15d96442444b5d5c7ba774f523c76627c6931cca5e10e76f0d08761f6f1f01a608898f4751a0eee54fc3d8d00 - languageName: node - linkType: hard - -"@jest/globals@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/globals@npm:29.7.0" - dependencies: - "@jest/environment": ^29.7.0 - "@jest/expect": ^29.7.0 - "@jest/types": ^29.6.3 - jest-mock: ^29.7.0 - checksum: 97dbb9459135693ad3a422e65ca1c250f03d82b2a77f6207e7fa0edd2c9d2015fbe4346f3dc9ebff1678b9d8da74754d4d440b7837497f8927059c0642a22123 - languageName: node - linkType: hard - "@jest/schemas@npm:^29.6.3": version: 29.6.3 resolution: "@jest/schemas@npm:29.6.3" @@ -3703,29 +3518,6 @@ __metadata: languageName: node linkType: hard -"@jest/transform@npm:^29.7.0": - version: 29.7.0 - resolution: "@jest/transform@npm:29.7.0" - dependencies: - "@babel/core": ^7.11.6 - "@jest/types": ^29.6.3 - "@jridgewell/trace-mapping": ^0.3.18 - babel-plugin-istanbul: ^6.1.1 - chalk: ^4.0.0 - convert-source-map: ^2.0.0 - fast-json-stable-stringify: ^2.1.0 - graceful-fs: ^4.2.9 - jest-haste-map: ^29.7.0 - jest-regex-util: ^29.6.3 - jest-util: ^29.7.0 - micromatch: ^4.0.4 - pirates: ^4.0.4 - slash: ^3.0.0 - write-file-atomic: ^4.0.2 - checksum: 0f8ac9f413903b3cb6d240102db848f2a354f63971ab885833799a9964999dd51c388162106a807f810071f864302cdd8e3f0c241c29ce02d85a36f18f3f40ab - languageName: node - linkType: hard - "@jest/types@npm:^29.6.3": version: 29.6.3 resolution: "@jest/types@npm:29.6.3" @@ -3792,7 +3584,7 @@ __metadata: languageName: node linkType: hard -"@jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.18, @jridgewell/trace-mapping@npm:^0.3.9": +"@jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.9": version: 0.3.20 resolution: "@jridgewell/trace-mapping@npm:0.3.20" dependencies: @@ -4263,19 +4055,12 @@ __metadata: resolution: "@noir-lang/noir_wasm@workspace:compiler/wasm" dependencies: "@esm-bundle/chai": ^4.3.4-fix.0 - "@jest/globals": ^29.7.0 "@ltd/j-toml": ^1.38.0 - "@types/babel__preset-env": ^7 + "@noir-lang/noirc_abi": "workspace:*" "@types/chai": ^4 - "@types/chai-as-promised": ^7.1.8 - "@types/lodash.capitalize": ^4 - "@types/lodash.compact": ^3 - "@types/lodash.times": ^4 - "@types/lodash.upperfirst": ^4 "@types/mocha": ^10.0.6 "@types/mocha-each": ^2 "@types/node": ^20.10.0 - "@types/pako": ^2 "@types/path-browserify": ^1 "@types/readable-stream": ^4 "@types/sinon": ^17 @@ -4285,16 +4070,9 @@ __metadata: "@web/test-runner-playwright": ^0.10.0 assert: ^2.1.0 browserify-fs: ^1.0.0 - buffer: ^6.0.3 chai: ^4.3.10 copy-webpack-plugin: ^11.0.0 - cross-env: ^7.0.3 - file-loader: ^6.2.0 html-webpack-plugin: ^5.5.4 - lodash.capitalize: ^4.2.1 - lodash.compact: ^3.0.1 - lodash.times: ^4.3.2 - lodash.upperfirst: ^4.3.1 memfs: ^4.6.0 mocha: ^10.2.0 mocha-each: ^2.0.1 @@ -4304,14 +4082,10 @@ __metadata: process: ^0.11.10 readable-stream: ^4.4.2 sinon: ^17.0.1 - text-encoding: ^0.7.0 ts-loader: ^9.5.1 ts-node: ^10.9.1 - tsconfig-paths: ^4.2.0 typescript: ~5.2.2 unzipit: ^1.4.3 - url: ^0.11.3 - util: ^0.12.5 webpack: ^5.49.0 webpack-cli: ^4.7.2 webpack-dev-server: ^4.15.1 @@ -5301,13 +5075,6 @@ __metadata: languageName: node linkType: hard -"@types/babel__preset-env@npm:^7": - version: 7.9.6 - resolution: "@types/babel__preset-env@npm:7.9.6" - checksum: 4783334e18e4a2e72314b900f9ac6bda002f05e91208cf88a1f631022443004f552565da4cacfebb9686ef9b06191972222d3395be1f2825cfe53cb77c5b856a - languageName: node - linkType: hard - "@types/bn.js@npm:^4.11.3": version: 4.11.6 resolution: "@types/bn.js@npm:4.11.6" @@ -5345,7 +5112,7 @@ __metadata: languageName: node linkType: hard -"@types/chai-as-promised@npm:^7.1.3, @types/chai-as-promised@npm:^7.1.8": +"@types/chai-as-promised@npm:^7.1.3": version: 7.1.8 resolution: "@types/chai-as-promised@npm:7.1.8" dependencies: @@ -5515,15 +5282,6 @@ __metadata: languageName: node linkType: hard -"@types/graceful-fs@npm:^4.1.3": - version: 4.1.9 - resolution: "@types/graceful-fs@npm:4.1.9" - dependencies: - "@types/node": "*" - checksum: 79d746a8f053954bba36bd3d94a90c78de995d126289d656fb3271dd9f1229d33f678da04d10bce6be440494a5a73438e2e363e92802d16b8315b051036c5256 - languageName: node - linkType: hard - "@types/gtag.js@npm:^0.0.12": version: 0.0.12 resolution: "@types/gtag.js@npm:0.0.12" @@ -5673,43 +5431,7 @@ __metadata: languageName: node linkType: hard -"@types/lodash.capitalize@npm:^4": - version: 4.2.9 - resolution: "@types/lodash.capitalize@npm:4.2.9" - dependencies: - "@types/lodash": "*" - checksum: 54a9154b2084392986646335d5ed4902a89c24ce675cf8b8cfcd022f6a0eed71c30c2f8cc4b2682cfc5c55a5e1fdad2340609ba58db451dfdd41d82b14c88995 - languageName: node - linkType: hard - -"@types/lodash.compact@npm:^3": - version: 3.0.9 - resolution: "@types/lodash.compact@npm:3.0.9" - dependencies: - "@types/lodash": "*" - checksum: 857686d1d5ac695b57ab26c61dec4550fc1002d941e8122e52baf8207e33312be303810fbf923ed9acd79ee82463a0a31143d023f79456a0353c99e0b30d4784 - languageName: node - linkType: hard - -"@types/lodash.times@npm:^4": - version: 4.3.9 - resolution: "@types/lodash.times@npm:4.3.9" - dependencies: - "@types/lodash": "*" - checksum: 452374b3db98bb805e77b3a53955aa76c1e78a7d48c400b08d48b6424ed9328ad826d98364b82506ea2756089320503d3a5797a1456bcdac11451763be536e62 - languageName: node - linkType: hard - -"@types/lodash.upperfirst@npm:^4": - version: 4.3.9 - resolution: "@types/lodash.upperfirst@npm:4.3.9" - dependencies: - "@types/lodash": "*" - checksum: 6cb5dc9c5e653a0f64daa543f2dfa13fdfd1f66d3ed036cb0edec9fd064b5feaf067e72b964bed8e66e49087e2680d274c7c721bf884359896ca590cbd38c651 - languageName: node - linkType: hard - -"@types/lodash@npm:*, @types/lodash@npm:^4": +"@types/lodash@npm:^4": version: 4.14.202 resolution: "@types/lodash@npm:4.14.202" checksum: a91acf3564a568c6f199912f3eb2c76c99c5a0d7e219394294213b3f2d54f672619f0fde4da22b29dc5d4c31457cd799acc2e5cb6bd90f9af04a1578483b6ff7 @@ -5849,13 +5571,6 @@ __metadata: languageName: node linkType: hard -"@types/pako@npm:^2": - version: 2.0.3 - resolution: "@types/pako@npm:2.0.3" - checksum: 0746dd5d29eccf5b2e6cceb3ccb093851219e78bd2e2e20d25757e247987139e061e5d4ba37cb5295493f06e3c683c74f8876011cd8a3f3748a09244fbc841d9 - languageName: node - linkType: hard - "@types/parse-json@npm:^4.0.0": version: 4.0.2 resolution: "@types/parse-json@npm:4.0.2" @@ -6112,13 +5827,6 @@ __metadata: languageName: node linkType: hard -"@types/stack-utils@npm:^2.0.0": - version: 2.0.3 - resolution: "@types/stack-utils@npm:2.0.3" - checksum: 72576cc1522090fe497337c2b99d9838e320659ac57fa5560fcbdcbafcf5d0216c6b3a0a8a4ee4fdb3b1f5e3420aa4f6223ab57b82fef3578bec3206425c6cf5 - languageName: node - linkType: hard - "@types/unist@npm:*, @types/unist@npm:^3.0.0": version: 3.0.2 resolution: "@types/unist@npm:3.0.2" @@ -7166,13 +6874,6 @@ __metadata: languageName: node linkType: hard -"ansi-styles@npm:^5.0.0": - version: 5.2.0 - resolution: "ansi-styles@npm:5.2.0" - checksum: d7f4e97ce0623aea6bc0d90dcd28881ee04cba06c570b97fd3391bd7a268eedfd9d5e2dd4fdcbdd82b8105df5faf6f24aaedc08eaf3da898e702db5948f63469 - languageName: node - linkType: hard - "ansi-styles@npm:^6.1.0": version: 6.2.1 resolution: "ansi-styles@npm:6.2.1" @@ -7180,7 +6881,7 @@ __metadata: languageName: node linkType: hard -"anymatch@npm:^3.0.3, anymatch@npm:~3.1.2": +"anymatch@npm:~3.1.2": version: 3.1.3 resolution: "anymatch@npm:3.1.3" dependencies: @@ -7431,19 +7132,6 @@ __metadata: languageName: node linkType: hard -"babel-plugin-istanbul@npm:^6.1.1": - version: 6.1.1 - resolution: "babel-plugin-istanbul@npm:6.1.1" - dependencies: - "@babel/helper-plugin-utils": ^7.0.0 - "@istanbuljs/load-nyc-config": ^1.0.0 - "@istanbuljs/schema": ^0.1.2 - istanbul-lib-instrument: ^5.0.4 - test-exclude: ^6.0.0 - checksum: cb4fd95738219f232f0aece1116628cccff16db891713c4ccb501cddbbf9272951a5df81f2f2658dfdf4b3e7b236a9d5cbcf04d5d8c07dd5077297339598061a - languageName: node - linkType: hard - "babel-plugin-polyfill-corejs2@npm:^0.4.6": version: 0.4.6 resolution: "babel-plugin-polyfill-corejs2@npm:0.4.6" @@ -7480,28 +7168,6 @@ __metadata: languageName: node linkType: hard -"babel-preset-current-node-syntax@npm:^1.0.0": - version: 1.0.1 - resolution: "babel-preset-current-node-syntax@npm:1.0.1" - dependencies: - "@babel/plugin-syntax-async-generators": ^7.8.4 - "@babel/plugin-syntax-bigint": ^7.8.3 - "@babel/plugin-syntax-class-properties": ^7.8.3 - "@babel/plugin-syntax-import-meta": ^7.8.3 - "@babel/plugin-syntax-json-strings": ^7.8.3 - "@babel/plugin-syntax-logical-assignment-operators": ^7.8.3 - "@babel/plugin-syntax-nullish-coalescing-operator": ^7.8.3 - "@babel/plugin-syntax-numeric-separator": ^7.8.3 - "@babel/plugin-syntax-object-rest-spread": ^7.8.3 - "@babel/plugin-syntax-optional-catch-binding": ^7.8.3 - "@babel/plugin-syntax-optional-chaining": ^7.8.3 - "@babel/plugin-syntax-top-level-await": ^7.8.3 - peerDependencies: - "@babel/core": ^7.0.0 - checksum: d118c2742498c5492c095bc8541f4076b253e705b5f1ad9a2e7d302d81a84866f0070346662355c8e25fc02caa28dc2da8d69bcd67794a0d60c4d6fab6913cc8 - languageName: node - linkType: hard - "bail@npm:^1.0.0": version: 1.0.5 resolution: "bail@npm:1.0.5" @@ -7847,15 +7513,6 @@ __metadata: languageName: node linkType: hard -"bser@npm:2.1.1": - version: 2.1.1 - resolution: "bser@npm:2.1.1" - dependencies: - node-int64: ^0.4.0 - checksum: 9ba4dc58ce86300c862bffc3ae91f00b2a03b01ee07f3564beeeaf82aa243b8b03ba53f123b0b842c190d4399b94697970c8e7cf7b1ea44b61aa28c3526a4449 - languageName: node - linkType: hard - "buffer-crc32@npm:~0.2.3": version: 0.2.13 resolution: "buffer-crc32@npm:0.2.13" @@ -8029,13 +7686,6 @@ __metadata: languageName: node linkType: hard -"camelcase@npm:^5.3.1": - version: 5.3.1 - resolution: "camelcase@npm:5.3.1" - checksum: e6effce26b9404e3c0f301498184f243811c30dfe6d0b9051863bd8e4034d09c8c2923794f280d6827e5aa055f6c434115ff97864a16a963366fb35fd673024b - languageName: node - linkType: hard - "camelcase@npm:^6.0.0, camelcase@npm:^6.2.0": version: 6.3.0 resolution: "camelcase@npm:6.3.0" @@ -9013,18 +8663,6 @@ __metadata: languageName: node linkType: hard -"cross-env@npm:^7.0.3": - version: 7.0.3 - resolution: "cross-env@npm:7.0.3" - dependencies: - cross-spawn: ^7.0.1 - bin: - cross-env: src/bin/cross-env.js - cross-env-shell: src/bin/cross-env-shell.js - checksum: 26f2f3ea2ab32617f57effb70d329c2070d2f5630adc800985d8b30b56e8bf7f5f439dd3a0358b79cee6f930afc23cf8e23515f17ccfb30092c6b62c6b630a79 - languageName: node - linkType: hard - "cross-fetch@npm:3.1.5": version: 3.1.5 resolution: "cross-fetch@npm:3.1.5" @@ -9034,7 +8672,7 @@ __metadata: languageName: node linkType: hard -"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.1, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": +"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": version: 7.0.3 resolution: "cross-spawn@npm:7.0.3" dependencies: @@ -9285,7 +8923,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.0, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": +"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.0, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": version: 4.3.4 resolution: "debug@npm:4.3.4" dependencies: @@ -9590,13 +9228,6 @@ __metadata: languageName: node linkType: hard -"diff-sequences@npm:^29.6.3": - version: 29.6.3 - resolution: "diff-sequences@npm:29.6.3" - checksum: f4914158e1f2276343d98ff5b31fc004e7304f5470bf0f1adb2ac6955d85a531a6458d33e87667f98f6ae52ebd3891bb47d420bb48a5bd8b7a27ee25b20e33aa - languageName: node - linkType: hard - "diff@npm:5.0.0": version: 5.0.0 resolution: "diff@npm:5.0.0" @@ -10211,13 +9842,6 @@ __metadata: languageName: node linkType: hard -"escape-string-regexp@npm:^2.0.0": - version: 2.0.0 - resolution: "escape-string-regexp@npm:2.0.0" - checksum: 9f8a2d5743677c16e85c810e3024d54f0c8dea6424fad3c79ef6666e81dd0846f7437f5e729dfcdac8981bc9e5294c39b4580814d114076b8d36318f46ae4395 - languageName: node - linkType: hard - "escape-string-regexp@npm:^5.0.0": version: 5.0.0 resolution: "escape-string-regexp@npm:5.0.0" @@ -10682,19 +10306,6 @@ __metadata: languageName: node linkType: hard -"expect@npm:^29.7.0": - version: 29.7.0 - resolution: "expect@npm:29.7.0" - dependencies: - "@jest/expect-utils": ^29.7.0 - jest-get-type: ^29.6.3 - jest-matcher-utils: ^29.7.0 - jest-message-util: ^29.7.0 - jest-util: ^29.7.0 - checksum: 9257f10288e149b81254a0fda8ffe8d54a7061cd61d7515779998b012579d2b8c22354b0eb901daf0145f347403da582f75f359f4810c007182ad3fb318b5c0c - languageName: node - linkType: hard - "exponential-backoff@npm:^3.1.1": version: 3.1.1 resolution: "exponential-backoff@npm:3.1.1" @@ -10801,7 +10412,7 @@ __metadata: languageName: node linkType: hard -"fast-json-stable-stringify@npm:^2.0.0, fast-json-stable-stringify@npm:^2.1.0": +"fast-json-stable-stringify@npm:^2.0.0": version: 2.1.0 resolution: "fast-json-stable-stringify@npm:2.1.0" checksum: b191531e36c607977e5b1c47811158733c34ccb3bfde92c44798929e9b4154884378536d26ad90dfecd32e1ffc09c545d23535ad91b3161a27ddbb8ebe0cbecb @@ -10865,15 +10476,6 @@ __metadata: languageName: node linkType: hard -"fb-watchman@npm:^2.0.0": - version: 2.0.2 - resolution: "fb-watchman@npm:2.0.2" - dependencies: - bser: 2.1.1 - checksum: b15a124cef28916fe07b400eb87cbc73ca082c142abf7ca8e8de6af43eca79ca7bd13eb4d4d48240b3bd3136eaac40d16e42d6edf87a8e5d1dd8070626860c78 - languageName: node - linkType: hard - "fd-slicer@npm:~1.1.0": version: 1.1.0 resolution: "fd-slicer@npm:1.1.0" @@ -11019,7 +10621,7 @@ __metadata: languageName: node linkType: hard -"find-up@npm:^4.0.0, find-up@npm:^4.1.0": +"find-up@npm:^4.0.0": version: 4.1.0 resolution: "find-up@npm:4.1.0" dependencies: @@ -11316,7 +10918,7 @@ __metadata: languageName: node linkType: hard -"fsevents@npm:^2.3.2, fsevents@npm:~2.3.2, fsevents@npm:~2.3.3": +"fsevents@npm:~2.3.2, fsevents@npm:~2.3.3": version: 2.3.3 resolution: "fsevents@npm:2.3.3" dependencies: @@ -11335,7 +10937,7 @@ __metadata: languageName: node linkType: hard -"fsevents@patch:fsevents@^2.3.2#~builtin, fsevents@patch:fsevents@~2.3.2#~builtin, fsevents@patch:fsevents@~2.3.3#~builtin": +"fsevents@patch:fsevents@~2.3.2#~builtin, fsevents@patch:fsevents@~2.3.3#~builtin": version: 2.3.3 resolution: "fsevents@patch:fsevents@npm%3A2.3.3#~builtin::version=2.3.3&hash=df0bf1" dependencies: @@ -11407,13 +11009,6 @@ __metadata: languageName: node linkType: hard -"get-package-type@npm:^0.1.0": - version: 0.1.0 - resolution: "get-package-type@npm:0.1.0" - checksum: bba0811116d11e56d702682ddef7c73ba3481f114590e705fc549f4d868972263896af313c57a25c076e3c0d567e11d919a64ba1b30c879be985fc9d44f96148 - languageName: node - linkType: hard - "get-stdin@npm:^8.0.0": version: 8.0.0 resolution: "get-stdin@npm:8.0.0" @@ -11516,7 +11111,7 @@ __metadata: languageName: node linkType: hard -"glob@npm:^7.0.0, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.6": +"glob@npm:^7.0.0, glob@npm:^7.1.3, glob@npm:^7.1.6": version: 7.2.3 resolution: "glob@npm:7.2.3" dependencies: @@ -13241,26 +12836,13 @@ __metadata: languageName: node linkType: hard -"istanbul-lib-coverage@npm:^3.0.0, istanbul-lib-coverage@npm:^3.2.0": +"istanbul-lib-coverage@npm:^3.0.0": version: 3.2.2 resolution: "istanbul-lib-coverage@npm:3.2.2" checksum: 2367407a8d13982d8f7a859a35e7f8dd5d8f75aae4bb5484ede3a9ea1b426dc245aff28b976a2af48ee759fdd9be374ce2bd2669b644f31e76c5f46a2e29a831 languageName: node linkType: hard -"istanbul-lib-instrument@npm:^5.0.4": - version: 5.2.1 - resolution: "istanbul-lib-instrument@npm:5.2.1" - dependencies: - "@babel/core": ^7.12.3 - "@babel/parser": ^7.14.7 - "@istanbuljs/schema": ^0.1.2 - istanbul-lib-coverage: ^3.2.0 - semver: ^6.3.0 - checksum: bf16f1803ba5e51b28bbd49ed955a736488381e09375d830e42ddeb403855b2006f850711d95ad726f2ba3f1ae8e7366de7e51d2b9ac67dc4d80191ef7ddf272 - languageName: node - linkType: hard - "istanbul-lib-report@npm:^3.0.0, istanbul-lib-report@npm:^3.0.1": version: 3.0.1 resolution: "istanbul-lib-report@npm:3.0.1" @@ -13295,123 +12877,6 @@ __metadata: languageName: node linkType: hard -"jest-diff@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-diff@npm:29.7.0" - dependencies: - chalk: ^4.0.0 - diff-sequences: ^29.6.3 - jest-get-type: ^29.6.3 - pretty-format: ^29.7.0 - checksum: 08e24a9dd43bfba1ef07a6374e5af138f53137b79ec3d5cc71a2303515335898888fa5409959172e1e05de966c9e714368d15e8994b0af7441f0721ee8e1bb77 - languageName: node - linkType: hard - -"jest-get-type@npm:^29.6.3": - version: 29.6.3 - resolution: "jest-get-type@npm:29.6.3" - checksum: 88ac9102d4679d768accae29f1e75f592b760b44277df288ad76ce5bf038c3f5ce3719dea8aa0f035dac30e9eb034b848ce716b9183ad7cc222d029f03e92205 - languageName: node - linkType: hard - -"jest-haste-map@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-haste-map@npm:29.7.0" - dependencies: - "@jest/types": ^29.6.3 - "@types/graceful-fs": ^4.1.3 - "@types/node": "*" - anymatch: ^3.0.3 - fb-watchman: ^2.0.0 - fsevents: ^2.3.2 - graceful-fs: ^4.2.9 - jest-regex-util: ^29.6.3 - jest-util: ^29.7.0 - jest-worker: ^29.7.0 - micromatch: ^4.0.4 - walker: ^1.0.8 - dependenciesMeta: - fsevents: - optional: true - checksum: c2c8f2d3e792a963940fbdfa563ce14ef9e14d4d86da645b96d3cd346b8d35c5ce0b992ee08593939b5f718cf0a1f5a90011a056548a1dbf58397d4356786f01 - languageName: node - linkType: hard - -"jest-matcher-utils@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-matcher-utils@npm:29.7.0" - dependencies: - chalk: ^4.0.0 - jest-diff: ^29.7.0 - jest-get-type: ^29.6.3 - pretty-format: ^29.7.0 - checksum: d7259e5f995d915e8a37a8fd494cb7d6af24cd2a287b200f831717ba0d015190375f9f5dc35393b8ba2aae9b2ebd60984635269c7f8cff7d85b077543b7744cd - languageName: node - linkType: hard - -"jest-message-util@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-message-util@npm:29.7.0" - dependencies: - "@babel/code-frame": ^7.12.13 - "@jest/types": ^29.6.3 - "@types/stack-utils": ^2.0.0 - chalk: ^4.0.0 - graceful-fs: ^4.2.9 - micromatch: ^4.0.4 - pretty-format: ^29.7.0 - slash: ^3.0.0 - stack-utils: ^2.0.3 - checksum: a9d025b1c6726a2ff17d54cc694de088b0489456c69106be6b615db7a51b7beb66788bea7a59991a019d924fbf20f67d085a445aedb9a4d6760363f4d7d09930 - languageName: node - linkType: hard - -"jest-mock@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-mock@npm:29.7.0" - dependencies: - "@jest/types": ^29.6.3 - "@types/node": "*" - jest-util: ^29.7.0 - checksum: 81ba9b68689a60be1482212878973700347cb72833c5e5af09895882b9eb5c4e02843a1bbdf23f94c52d42708bab53a30c45a3482952c9eec173d1eaac5b86c5 - languageName: node - linkType: hard - -"jest-regex-util@npm:^29.6.3": - version: 29.6.3 - resolution: "jest-regex-util@npm:29.6.3" - checksum: 0518beeb9bf1228261695e54f0feaad3606df26a19764bc19541e0fc6e2a3737191904607fb72f3f2ce85d9c16b28df79b7b1ec9443aa08c3ef0e9efda6f8f2a - languageName: node - linkType: hard - -"jest-snapshot@npm:^29.7.0": - version: 29.7.0 - resolution: "jest-snapshot@npm:29.7.0" - dependencies: - "@babel/core": ^7.11.6 - "@babel/generator": ^7.7.2 - "@babel/plugin-syntax-jsx": ^7.7.2 - "@babel/plugin-syntax-typescript": ^7.7.2 - "@babel/types": ^7.3.3 - "@jest/expect-utils": ^29.7.0 - "@jest/transform": ^29.7.0 - "@jest/types": ^29.6.3 - babel-preset-current-node-syntax: ^1.0.0 - chalk: ^4.0.0 - expect: ^29.7.0 - graceful-fs: ^4.2.9 - jest-diff: ^29.7.0 - jest-get-type: ^29.6.3 - jest-matcher-utils: ^29.7.0 - jest-message-util: ^29.7.0 - jest-util: ^29.7.0 - natural-compare: ^1.4.0 - pretty-format: ^29.7.0 - semver: ^7.5.3 - checksum: 86821c3ad0b6899521ce75ee1ae7b01b17e6dfeff9166f2cf17f012e0c5d8c798f30f9e4f8f7f5bed01ea7b55a6bc159f5eda778311162cbfa48785447c237ad - languageName: node - linkType: hard - "jest-util@npm:^29.7.0": version: 29.7.0 resolution: "jest-util@npm:29.7.0" @@ -13437,7 +12902,7 @@ __metadata: languageName: node linkType: hard -"jest-worker@npm:^29.1.2, jest-worker@npm:^29.7.0": +"jest-worker@npm:^29.1.2": version: 29.7.0 resolution: "jest-worker@npm:29.7.0" dependencies: @@ -13605,7 +13070,7 @@ __metadata: languageName: node linkType: hard -"json5@npm:^2.1.2, json5@npm:^2.2.2, json5@npm:^2.2.3": +"json5@npm:^2.1.2, json5@npm:^2.2.3": version: 2.2.3 resolution: "json5@npm:2.2.3" bin: @@ -14120,20 +13585,6 @@ __metadata: languageName: node linkType: hard -"lodash.capitalize@npm:^4.2.1": - version: 4.2.1 - resolution: "lodash.capitalize@npm:4.2.1" - checksum: d9195f31d48c105206f1099946d8bbc8ab71435bc1c8708296992a31a992bb901baf120fdcadd773098ac96e62a79e6b023ee7d26a2deb0d6c6aada930e6ad0a - languageName: node - linkType: hard - -"lodash.compact@npm:^3.0.1": - version: 3.0.1 - resolution: "lodash.compact@npm:3.0.1" - checksum: 75039eddfa5ef2ea0da1fc3d36515e92227241f94258b3dcf771196e741c878698ce5b79c0cb7fe758841c9dfd0e6fa222888985aadc0384fd79bbc9680dd829 - languageName: node - linkType: hard - "lodash.debounce@npm:^4.0.8": version: 4.0.8 resolution: "lodash.debounce@npm:4.0.8" @@ -14169,13 +13620,6 @@ __metadata: languageName: node linkType: hard -"lodash.times@npm:^4.3.2": - version: 4.3.2 - resolution: "lodash.times@npm:4.3.2" - checksum: d26a9022e025d6061d356d3098fd80cdc062e7bf896bbbb56e643b2ae39156bf19b6167a4b046aa924b6d572a1e717853e552342ce34016fc5183308e329b575 - languageName: node - linkType: hard - "lodash.uniq@npm:4.5.0, lodash.uniq@npm:^4.5.0": version: 4.5.0 resolution: "lodash.uniq@npm:4.5.0" @@ -14183,13 +13627,6 @@ __metadata: languageName: node linkType: hard -"lodash.upperfirst@npm:^4.3.1": - version: 4.3.1 - resolution: "lodash.upperfirst@npm:4.3.1" - checksum: cadec6955900afe1928cc60cdc4923a79c2ef991e42665419cc81630ed9b4f952a1093b222e0141ab31cbc4dba549f97ec28ff67929d71e01861c97188a5fa83 - languageName: node - linkType: hard - "lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21": version: 4.17.21 resolution: "lodash@npm:4.17.21" @@ -14380,15 +13817,6 @@ __metadata: languageName: node linkType: hard -"makeerror@npm:1.0.12": - version: 1.0.12 - resolution: "makeerror@npm:1.0.12" - dependencies: - tmpl: 1.0.5 - checksum: b38a025a12c8146d6eeea5a7f2bf27d51d8ad6064da8ca9405fcf7bf9b54acd43e3b30ddd7abb9b1bfa4ddb266019133313482570ddb207de568f71ecfcf6060 - languageName: node - linkType: hard - "map-stream@npm:~0.1.0": version: 0.1.0 resolution: "map-stream@npm:0.1.0" @@ -15938,13 +15366,6 @@ __metadata: languageName: node linkType: hard -"node-int64@npm:^0.4.0": - version: 0.4.0 - resolution: "node-int64@npm:0.4.0" - checksum: d0b30b1ee6d961851c60d5eaa745d30b5c95d94bc0e74b81e5292f7c42a49e3af87f1eb9e89f59456f80645d679202537de751b7d72e9e40ceea40c5e449057e - languageName: node - linkType: hard - "node-releases@npm:^2.0.14": version: 2.0.14 resolution: "node-releases@npm:2.0.14" @@ -16676,13 +16097,6 @@ __metadata: languageName: node linkType: hard -"pirates@npm:^4.0.4": - version: 4.0.6 - resolution: "pirates@npm:4.0.6" - checksum: 46a65fefaf19c6f57460388a5af9ab81e3d7fd0e7bc44ca59d753cb5c4d0df97c6c6e583674869762101836d68675f027d60f841c105d72734df9dfca97cbcc6 - languageName: node - linkType: hard - "pkg-dir@npm:^4.1.0, pkg-dir@npm:^4.2.0": version: 4.2.0 resolution: "pkg-dir@npm:4.2.0" @@ -17241,17 +16655,6 @@ __metadata: languageName: node linkType: hard -"pretty-format@npm:^29.7.0": - version: 29.7.0 - resolution: "pretty-format@npm:29.7.0" - dependencies: - "@jest/schemas": ^29.6.3 - ansi-styles: ^5.0.0 - react-is: ^18.0.0 - checksum: 032c1602383e71e9c0c02a01bbd25d6759d60e9c7cf21937dde8357aa753da348fcec5def5d1002c9678a8524d5fe099ad98861286550ef44de8808cc61e43b6 - languageName: node - linkType: hard - "pretty-time@npm:^1.1.0": version: 1.1.0 resolution: "pretty-time@npm:1.1.0" @@ -17412,7 +16815,7 @@ __metadata: languageName: node linkType: hard -"punycode@npm:^1.3.2, punycode@npm:^1.4.1": +"punycode@npm:^1.3.2": version: 1.4.1 resolution: "punycode@npm:1.4.1" checksum: fa6e698cb53db45e4628559e557ddaf554103d2a96a1d62892c8f4032cd3bc8871796cae9eabc1bc700e2b6677611521ce5bb1d9a27700086039965d0cf34518 @@ -17477,7 +16880,7 @@ __metadata: languageName: node linkType: hard -"qs@npm:^6.11.2, qs@npm:^6.5.2": +"qs@npm:^6.5.2": version: 6.11.2 resolution: "qs@npm:6.11.2" dependencies: @@ -17665,13 +17068,6 @@ __metadata: languageName: node linkType: hard -"react-is@npm:^18.0.0": - version: 18.2.0 - resolution: "react-is@npm:18.2.0" - checksum: e72d0ba81b5922759e4aff17e0252bd29988f9642ed817f56b25a3e217e13eea8a7f2322af99a06edb779da12d5d636e9fda473d620df9a3da0df2a74141d53e - languageName: node - linkType: hard - "react-json-view-lite@npm:^1.2.0": version: 1.2.1 resolution: "react-json-view-lite@npm:1.2.1" @@ -19238,15 +18634,6 @@ __metadata: languageName: node linkType: hard -"stack-utils@npm:^2.0.3": - version: 2.0.6 - resolution: "stack-utils@npm:2.0.6" - dependencies: - escape-string-regexp: ^2.0.0 - checksum: 052bf4d25bbf5f78e06c1d5e67de2e088b06871fa04107ca8d3f0e9d9263326e2942c8bedee3545795fc77d787d443a538345eef74db2f8e35db3558c6f91ff7 - languageName: node - linkType: hard - "stacktrace-parser@npm:^0.1.10": version: 0.1.10 resolution: "stacktrace-parser@npm:0.1.10" @@ -19423,13 +18810,6 @@ __metadata: languageName: node linkType: hard -"strip-bom@npm:^3.0.0": - version: 3.0.0 - resolution: "strip-bom@npm:3.0.0" - checksum: 8d50ff27b7ebe5ecc78f1fe1e00fcdff7af014e73cf724b46fb81ef889eeb1015fc5184b64e81a2efe002180f3ba431bdd77e300da5c6685d702780fbf0c8d5b - languageName: node - linkType: hard - "strip-final-newline@npm:^2.0.0": version: 2.0.0 resolution: "strip-final-newline@npm:2.0.0" @@ -19699,24 +19079,6 @@ __metadata: languageName: node linkType: hard -"test-exclude@npm:^6.0.0": - version: 6.0.0 - resolution: "test-exclude@npm:6.0.0" - dependencies: - "@istanbuljs/schema": ^0.1.2 - glob: ^7.1.4 - minimatch: ^3.0.4 - checksum: 3b34a3d77165a2cb82b34014b3aba93b1c4637a5011807557dc2f3da826c59975a5ccad765721c4648b39817e3472789f9b0fa98fc854c5c1c7a1e632aacdc28 - languageName: node - linkType: hard - -"text-encoding@npm:^0.7.0": - version: 0.7.0 - resolution: "text-encoding@npm:0.7.0" - checksum: b6109a843fb1b8748b32e1ecd6df74d370f46c13ac136bcb6ca15db70209bb0b8ec1f296ebb4b0dd9961150e205dcc044b89f8cf7657f6faef78c7569a2a81bc - languageName: node - linkType: hard - "text-table@npm:^0.2.0": version: 0.2.0 resolution: "text-table@npm:0.2.0" @@ -19777,13 +19139,6 @@ __metadata: languageName: node linkType: hard -"tmpl@npm:1.0.5": - version: 1.0.5 - resolution: "tmpl@npm:1.0.5" - checksum: cd922d9b853c00fe414c5a774817be65b058d54a2d01ebb415840960406c669a0fc632f66df885e24cb022ec812739199ccbdb8d1164c3e513f85bfca5ab2873 - languageName: node - linkType: hard - "to-fast-properties@npm:^2.0.0": version: 2.0.0 resolution: "to-fast-properties@npm:2.0.0" @@ -19978,17 +19333,6 @@ __metadata: languageName: node linkType: hard -"tsconfig-paths@npm:^4.2.0": - version: 4.2.0 - resolution: "tsconfig-paths@npm:4.2.0" - dependencies: - json5: ^2.2.2 - minimist: ^1.2.6 - strip-bom: ^3.0.0 - checksum: 28c5f7bbbcabc9dabd4117e8fdc61483f6872a1c6b02a4b1c4d68c5b79d06896c3cc9547610c4c3ba64658531caa2de13ead1ea1bf321c7b53e969c4752b98c7 - languageName: node - linkType: hard - "tslib@npm:2.4.0": version: 2.4.0 resolution: "tslib@npm:2.4.0" @@ -20722,16 +20066,6 @@ __metadata: languageName: node linkType: hard -"url@npm:^0.11.3": - version: 0.11.3 - resolution: "url@npm:0.11.3" - dependencies: - punycode: ^1.4.1 - qs: ^6.11.2 - checksum: f9e7886f46a16f96d2e42fbcc5d682c231c55ef5442c1ff66150c0f6556f6e3a97d094a84f51be15ec2432711d212eb60426659ce418f5fcadeaa3f601532c4e - languageName: node - linkType: hard - "util-deprecate@npm:^1.0.1, util-deprecate@npm:^1.0.2, util-deprecate@npm:~1.0.1": version: 1.0.2 resolution: "util-deprecate@npm:1.0.2" @@ -20924,15 +20258,6 @@ __metadata: languageName: node linkType: hard -"walker@npm:^1.0.8": - version: 1.0.8 - resolution: "walker@npm:1.0.8" - dependencies: - makeerror: 1.0.12 - checksum: ad7a257ea1e662e57ef2e018f97b3c02a7240ad5093c392186ce0bcf1f1a60bbadd520d073b9beb921ed99f64f065efb63dfc8eec689a80e569f93c1c5d5e16c - languageName: node - linkType: hard - "watchpack@npm:^2.1.1, watchpack@npm:^2.4.0": version: 2.4.0 resolution: "watchpack@npm:2.4.0" @@ -21359,16 +20684,6 @@ __metadata: languageName: node linkType: hard -"write-file-atomic@npm:^4.0.2": - version: 4.0.2 - resolution: "write-file-atomic@npm:4.0.2" - dependencies: - imurmurhash: ^0.1.4 - signal-exit: ^3.0.7 - checksum: 5da60bd4eeeb935eec97ead3df6e28e5917a6bd317478e4a85a5285e8480b8ed96032bbcc6ecd07b236142a24f3ca871c924ec4a6575e623ec1b11bf8c1c253c - languageName: node - linkType: hard - "ws@npm:7.4.6": version: 7.4.6 resolution: "ws@npm:7.4.6" From 81c79782fc416c57e6ce0dbb06c86e98ca3b30d0 Mon Sep 17 00:00:00 2001 From: sirasistant Date: Thu, 21 Dec 2023 08:59:00 +0000 Subject: [PATCH 07/37] chore: try to build noir_wasm with yarn --- .github/workflows/test-js-packages.yml | 30 +++++++++++++++++--------- flake.nix | 29 ++----------------------- 2 files changed, 22 insertions(+), 37 deletions(-) diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index a298d67a485..a59e5d58948 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -47,6 +47,7 @@ jobs: retention-days: 3 build-noir-wasm: + needs: [build-nargo, build-noirc-abi] runs-on: ubuntu-latest timeout-minutes: 30 @@ -54,19 +55,29 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 - - name: Setup Nix - uses: ./.github/actions/nix + - name: Setup toolchain + uses: dtolnay/rust-toolchain@1.71.1 + + - uses: Swatinem/rust-cache@v2 with: - github-token: ${{ secrets.GITHUB_TOKEN }} - nix-cache-name: "noir" - cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + key: x86_64-unknown-linux-gnu + cache-on-failure: true + save-if: ${{ github.event_name != 'merge_group' }} - - name: Build wasm package - run: | - nix build -L .#noir_wasm + - name: Download wasm package artifact + uses: actions/download-artifact@v3 + with: + name: noirc_abi_wasm + path: ./tooling/noirc_abi_wasm + + - name: Install Yarn dependencies + uses: ./.github/actions/setup + + - name: Build noir_wasm + run: yarn workspace @noir-lang/noir_wasm build - name: Dereference symlink - run: echo "UPLOAD_PATH=$(readlink -f ./result/noir_wasm)" >> $GITHUB_ENV + run: echo "UPLOAD_PATH=$(readlink -f ./compiler/wasm)" >> $GITHUB_ENV - name: Upload artifact uses: actions/upload-artifact@v3 @@ -75,7 +86,6 @@ jobs: path: ${{ env.UPLOAD_PATH }} retention-days: 3 - build-acvm-js: runs-on: ubuntu-latest timeout-minutes: 30 diff --git a/flake.nix b/flake.nix index 6a146becbb8..2300d009114 100644 --- a/flake.nix +++ b/flake.nix @@ -118,9 +118,6 @@ native-cargo-artifacts = craneLib.buildDepsOnly (nativeConfig // { pname = "nargo"; }); - noir-wasm-cargo-artifacts = craneLib.buildDepsOnly (wasmConfig // { - pname = "noir_wasm"; - }); noirc-abi-wasm-cargo-artifacts = craneLib.buildDepsOnly (wasmConfig // { pname = "noirc_abi_wasm"; }); @@ -139,25 +136,6 @@ doCheck = false; }); - noir_wasm = craneLib.buildPackage (wasmConfig // { - pname = "noir_wasm"; - - inherit GIT_COMMIT GIT_DIRTY; - - cargoArtifacts = noir-wasm-cargo-artifacts; - - buildPhaseCargoCommand = '' - bash compiler/wasm/buildPhaseCargoCommand.sh release - ''; - - installPhase = '' - bash compiler/wasm/installPhase.sh - ''; - - # We don't want to run tests because they don't work in the Nix sandbox - doCheck = false; - }); - noirc_abi_wasm = craneLib.buildPackage (wasmConfig // rec { pname = "noirc_abi_wasm"; @@ -232,18 +210,16 @@ # Nix flakes cannot build more than one derivation in one command (see https://github.com/NixOS/nix/issues/5591) # so we use `symlinkJoin` to build everything as the "all" package. - all = pkgs.symlinkJoin { name = "all"; paths = [ nargo noir_wasm noirc_abi_wasm acvm_js ]; }; - all_wasm = pkgs.symlinkJoin { name = "all_wasm"; paths = [ noir_wasm noirc_abi_wasm acvm_js ]; }; + all = pkgs.symlinkJoin { name = "all"; paths = [ nargo noirc_abi_wasm acvm_js ]; }; + all_wasm = pkgs.symlinkJoin { name = "all_wasm"; paths = [ noirc_abi_wasm acvm_js ]; }; # We also export individual packages to enable `nix build .#nargo -L`, etc. inherit nargo; - inherit noir_wasm; inherit noirc_abi_wasm; inherit acvm_js; # We expose the `*-cargo-artifacts` derivations so we can cache our cargo dependencies in CI inherit native-cargo-artifacts; - inherit noir-wasm-cargo-artifacts; inherit noirc-abi-wasm-cargo-artifacts; inherit acvm-js-cargo-artifacts; }; @@ -253,7 +229,6 @@ devShells.default = pkgs.mkShell (environment // { inputsFrom = [ nargo - noir_wasm noirc_abi_wasm acvm_js ]; From 6335dc874ea9731ae5804c6b1e9784241cf6e390 Mon Sep 17 00:00:00 2001 From: sirasistant Date: Thu, 21 Dec 2023 09:14:02 +0000 Subject: [PATCH 08/37] chore: build the fixtures on test --- .github/workflows/test-js-packages.yml | 24 +++++++++++++----------- compiler/wasm/package.json | 11 ++++------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index a59e5d58948..a87d7518b8e 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -47,7 +47,7 @@ jobs: retention-days: 3 build-noir-wasm: - needs: [build-nargo, build-noirc-abi] + needs: [build-noirc-abi] runs-on: ubuntu-latest timeout-minutes: 30 @@ -64,7 +64,7 @@ jobs: cache-on-failure: true save-if: ${{ github.event_name != 'merge_group' }} - - name: Download wasm package artifact + - name: Download noirc_abi_wasm package artifact uses: actions/download-artifact@v3 with: name: noirc_abi_wasm @@ -305,16 +305,15 @@ jobs: name: nargo path: ./nargo - - name: Compile fixtures with Nargo CLI - working-directory: ./compiler/wasm/fixtures + - name: Download nargo binary + uses: actions/download-artifact@v3 + with: + name: nargo + path: ./nargo + + - name: Add nargo to path run: | - nargo_binary=${{ github.workspace }}/nargo/nargo - chmod +x $nargo_binary - for dir in $(ls -d */); do - pushd $dir/noir-script - $nargo_binary compile - popd - done + echo "./nargo" >> $GITHUB_PATH - name: Install Yarn dependencies uses: ./.github/actions/setup @@ -322,6 +321,9 @@ jobs: - name: Install Playwright uses: ./.github/actions/install-playwright + - name: Build fixtures + run: yarn workspace @noir-lang/noir_wasm test:build_fixtures + - name: Run node tests run: yarn workspace @noir-lang/noir_wasm test:node diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index fb4cc73fb25..d28481530b6 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -23,18 +23,15 @@ }, "scripts": { "serve": "webpack serve", - "build:fixtures": "cd public/fixtures && cd simple && nargo compile && cd ../with-deps && nargo compile && cd ../noir-contract && nargo compile && cd ../", - "build:webpack": "webpack", - "build": "yarn build:webpack && yarn build:fixtures", - "test": "yarn test:node && yarn test:browser", + "build": "webpack", + "test": "yarn test:build_fixtures && yarn test:node && yarn test:browser", + "test:build_fixtures": "cd public/fixtures && cd simple && nargo compile && cd ../with-deps && nargo compile && cd ../noir-contract && nargo compile && cd ../", "test:node": "NODE_NO_WARNINGS=1 $(yarn bin mocha) --config ./.mocharc.json", "test:browser": "web-test-runner", "clean": "rm -rf ./build ./target ./dist public/fixtures/simple/target public/fixtures/with-deps/target public/fixtures/noir-contract/target", "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", "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", - "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0", - "build:nix": "nix build -L .#noir_wasm", - "install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/noir_wasm/nodejs ./ && cp -rL ./result/noir_wasm/web ./" + "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0" }, "devDependencies": { "@esm-bundle/chai": "^4.3.4-fix.0", From edbe2fb699fe4798a6b83783e3c3be973c563906 Mon Sep 17 00:00:00 2001 From: sirasistant Date: Thu, 21 Dec 2023 09:31:31 +0000 Subject: [PATCH 09/37] chore: add nargo to path --- .github/workflows/test-js-packages.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index a87d7518b8e..7874f38df19 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -299,11 +299,8 @@ jobs: name: noir_wasm path: ./compiler/wasm - - name: Download nargo binary - uses: actions/download-artifact@v3 - with: - name: nargo - path: ./nargo + - name: Install Yarn dependencies + uses: ./.github/actions/setup - name: Download nargo binary uses: actions/download-artifact@v3 @@ -311,12 +308,12 @@ jobs: name: nargo path: ./nargo - - name: Add nargo to path + - name: Set nargo on PATH run: | - echo "./nargo" >> $GITHUB_PATH - - - name: Install Yarn dependencies - uses: ./.github/actions/setup + nargo_binary="${{ github.workspace }}/nargo/nargo" + chmod +x $nargo_binary + echo "$(dirname $nargo_binary)" >> $GITHUB_PATH + export PATH="$PATH:$(dirname $nargo_binary)" - name: Install Playwright uses: ./.github/actions/install-playwright From c29145b53916eddc6ee71569c331858ac19d40e8 Mon Sep 17 00:00:00 2001 From: thunkar Date: Thu, 21 Dec 2023 10:29:03 +0000 Subject: [PATCH 10/37] Fix types --- compiler/wasm/src/types/abi.ts | 116 ----------------------- compiler/wasm/src/types/noir_artifact.ts | 44 ++++----- 2 files changed, 21 insertions(+), 139 deletions(-) delete mode 100644 compiler/wasm/src/types/abi.ts diff --git a/compiler/wasm/src/types/abi.ts b/compiler/wasm/src/types/abi.ts deleted file mode 100644 index f2ee83f1d22..00000000000 --- a/compiler/wasm/src/types/abi.ts +++ /dev/null @@ -1,116 +0,0 @@ -/** - * A named type. - */ -export interface ABIVariable { - /** - * The name of the variable. - */ - name: string; - /** - * The type of the variable. - */ - type: ABIType; -} - -/** - * Indicates whether a parameter is public or secret/private. - */ -export enum ABIParameterVisibility { - PUBLIC = 'public', - SECRET = 'secret', -} - -/** - * A function parameter. - */ -export interface ABIParameter extends ABIVariable { - /** - * Indicates whether a parameter is public or secret/private. - */ - visibility: ABIParameterVisibility; -} - -/** - * A basic type. - */ -export interface BasicType { - /** - * The kind of the type. - */ - kind: T; -} - -/** - * A variable type. - */ -export type ABIType = BasicType<'field'> | BasicType<'boolean'> | IntegerType | ArrayType | StringType | StructType; - -/** - * An integer type. - */ -export interface IntegerType extends BasicType<'integer'> { - /** - * The sign of the integer. - */ - sign: string; - /** - * The width of the integer in bits. - */ - width: number; -} - -/** - * An array type. - */ -export interface ArrayType extends BasicType<'array'> { - /** - * The length of the array. - */ - length: number; - /** - * The type of the array elements. - */ - type: ABIType; -} - -/** - * A string type. - */ -export interface StringType extends BasicType<'string'> { - /** - * The length of the string. - */ - length: number; -} - -/** - * A struct type. - */ -export interface StructType extends BasicType<'struct'> { - /** - * The fields of the struct. - */ - fields: ABIVariable[]; - /** - * Fully qualified name of the struct. - */ - path: string; -} - -/** - * A contract event. - */ -export interface EventAbi { - /** - * The event name. - */ - name: string; - /** - * Fully qualified name of the event. - */ - path: string; - /** - * The fields of the event. - */ - fields: ABIVariable[]; -} diff --git a/compiler/wasm/src/types/noir_artifact.ts b/compiler/wasm/src/types/noir_artifact.ts index c3cc38f705b..6a894f4e607 100644 --- a/compiler/wasm/src/types/noir_artifact.ts +++ b/compiler/wasm/src/types/noir_artifact.ts @@ -1,28 +1,26 @@ -import { ABIParameter, ABIType, EventAbi } from './abi'; +import { Abi, AbiParameter } from '@noir-lang/noirc_abi'; + +/** + * A contract event. + */ +export interface EventAbi { + /** + * The event name. + */ + name: string; + /** + * Fully qualified name of the event. + */ + path: string; + /** + * The fields of the event. + */ + fields: AbiParameter[]; +} /** The Noir function types. */ export type NoirFunctionType = 'Open' | 'Secret' | 'Unconstrained'; -/** The ABI of an Noir function. */ -export interface NoirFunctionAbi { - /** The parameters of the function. */ - parameters: ABIParameter[]; - /** The witness indices of the parameters. Indexed by parameter name. */ - param_witnesses: { - /** input */ - input: { - /** start */ - start: number; - /** end */ - end: number; - }[]; - }; - /** The return type of the function. */ - return_type: ABIType; - /** The witness indices of the return type. */ - return_witnesses: number[]; -} - /** * The compilation result of an Noir function. */ @@ -34,7 +32,7 @@ export interface NoirFunctionEntry { /** Whether the function is internal. */ is_internal: boolean; /** The ABI of the function. */ - abi: NoirFunctionAbi; + abi: Abi; /** The bytecode of the function in base64. */ bytecode: string; /** The proving key. */ @@ -68,7 +66,7 @@ export interface NoirCompiledCircuit { /** * The ABI of the function. */ - abi: NoirFunctionAbi; + abi: Abi; /** The bytecode of the circuit in base64. */ bytecode: string; } From 777d5906ca854c71d8f78968ec3b8f0744e59226 Mon Sep 17 00:00:00 2001 From: thunkar Date: Thu, 21 Dec 2023 10:44:44 +0000 Subject: [PATCH 11/37] Used require for cjs import --- compiler/wasm/test/compiler/node/index.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/wasm/test/compiler/node/index.test.ts b/compiler/wasm/test/compiler/node/index.test.ts index a24db422288..f8986ac036f 100644 --- a/compiler/wasm/test/compiler/node/index.test.ts +++ b/compiler/wasm/test/compiler/node/index.test.ts @@ -4,10 +4,11 @@ import { getPaths } from '../../shared'; import { expect } from 'chai'; import { readFile } from 'fs/promises'; -// @ts-expect-error Import without typings, probably there's a better way -import { compile, createFileManager } from '../../../dist/node/main'; +import type { NoirCompiledContract } from '../../../dist/types/types/noir_artifact'; -import { NoirCompiledContract } from '../../../dist/types/types/noir_artifact'; +// eslint-disable-next-line @typescript-eslint/no-var-requires +const cjs = require('../../../dist/node/main'); +const { createFileManager, compile } = cjs; const basePath = resolve(join(__dirname, '../../../')); const { contractProjectPath, contractExpectedArtifact } = getPaths(basePath); From 6efba0ca2cb0bb2f774b5da44552f6af8814878b Mon Sep 17 00:00:00 2001 From: thunkar Date: Thu, 21 Dec 2023 15:14:45 +0000 Subject: [PATCH 12/37] Moved integration tests to the correct package --- .github/workflows/test-js-packages.yml | 6 - .../circuits/deps_testing/Nargo.toml | 8 ++ .../circuits/deps_testing}/src/main.nr | 0 .../circuits/lib_with_module}/Nargo.toml | 0 .../circuits/lib_with_module}/src/lib.nr | 0 .../circuits/lib_with_module}/src/module.nr | 0 .../lib_with_module}/src/module/foo.nr | 0 .../scripts/codegen-verifiers.sh | 5 + .../test/browser/compile_prove_verify.test.ts | 30 ++--- .../test/browser/compile_with_deps.test.ts} | 21 ++-- .../test/browser/recursion.test.ts | 31 ++--- .../integration-tests/test/browser/utils.ts | 4 +- .../test/node/compile_with_deps.test.ts} | 19 ++- .../onchain_recursive_verification.test.ts | 45 +++---- .../test/node/smart_contract_verifier.test.ts | 10 +- compiler/integration-tests/test/shared.ts | 26 ++++ compiler/wasm/package.json | 20 ++- compiler/wasm/src/index.cts | 3 +- compiler/wasm/src/index.mts | 3 +- compiler/wasm/src/types/abi.ts | 116 ++++++++++++++++++ .../github-dependency-resolver.test.ts | 4 +- .../local-dependency-resolver.test.ts | 6 +- .../fixtures/deps/lib-a/Nargo.toml | 0 .../fixtures/deps/lib-a/src/lib.nr | 0 .../fixtures/deps/lib-b/Nargo.toml | 0 .../fixtures/deps/lib-b/src/lib.nr | 0 .../wasm/test/fixtures/deps/lib-c/Nargo.toml | 7 ++ .../wasm/test/fixtures/deps/lib-c/src/lib.nr | 1 + .../test/fixtures/deps/lib-c/src/module.nr | 1 + .../fixtures/deps/lib-c/src/module/foo.nr | 3 + .../fixtures/deps/test_lib.zip | Bin .../fixtures/noir-contract/Nargo.toml | 0 .../test/fixtures/noir-contract/src/main.nr | 12 ++ .../fixtures/simple/Nargo.toml | 0 .../fixtures/simple/src/main.nr | 0 .../fixtures/with-deps/Nargo.toml | 0 .../fixtures/with-deps/src/main.nr | 0 compiler/wasm/test/shared.ts | 22 +--- compiler/wasm/test/wasm/index.test.ts | 2 +- compiler/wasm/web-test-runner.config.mjs | 24 ---- 40 files changed, 262 insertions(+), 167 deletions(-) create mode 100644 compiler/integration-tests/circuits/deps_testing/Nargo.toml rename compiler/{wasm/public/fixtures/noir-contract => integration-tests/circuits/deps_testing}/src/main.nr (100%) rename compiler/{wasm/public/fixtures/deps/lib-c => integration-tests/circuits/lib_with_module}/Nargo.toml (100%) rename compiler/{wasm/public/fixtures/deps/lib-c => integration-tests/circuits/lib_with_module}/src/lib.nr (100%) rename compiler/{wasm/public/fixtures/deps/lib-c => integration-tests/circuits/lib_with_module}/src/module.nr (100%) rename compiler/{wasm/public/fixtures/deps/lib-c => integration-tests/circuits/lib_with_module}/src/module/foo.nr (100%) rename compiler/{wasm/test/compiler/browser/index.test.ts => integration-tests/test/browser/compile_with_deps.test.ts} (59%) rename compiler/{wasm/test/compiler/node/index.test.ts => integration-tests/test/node/compile_with_deps.test.ts} (61%) create mode 100644 compiler/integration-tests/test/shared.ts create mode 100644 compiler/wasm/src/types/abi.ts rename compiler/wasm/{public => test}/fixtures/deps/lib-a/Nargo.toml (100%) rename compiler/wasm/{public => test}/fixtures/deps/lib-a/src/lib.nr (100%) rename compiler/wasm/{public => test}/fixtures/deps/lib-b/Nargo.toml (100%) rename compiler/wasm/{public => test}/fixtures/deps/lib-b/src/lib.nr (100%) create mode 100644 compiler/wasm/test/fixtures/deps/lib-c/Nargo.toml create mode 100644 compiler/wasm/test/fixtures/deps/lib-c/src/lib.nr create mode 100644 compiler/wasm/test/fixtures/deps/lib-c/src/module.nr create mode 100644 compiler/wasm/test/fixtures/deps/lib-c/src/module/foo.nr rename compiler/wasm/{public => test}/fixtures/deps/test_lib.zip (100%) rename compiler/wasm/{public => test}/fixtures/noir-contract/Nargo.toml (100%) create mode 100644 compiler/wasm/test/fixtures/noir-contract/src/main.nr rename compiler/wasm/{public => test}/fixtures/simple/Nargo.toml (100%) rename compiler/wasm/{public => test}/fixtures/simple/src/main.nr (100%) rename compiler/wasm/{public => test}/fixtures/with-deps/Nargo.toml (100%) rename compiler/wasm/{public => test}/fixtures/with-deps/src/main.nr (100%) delete mode 100644 compiler/wasm/web-test-runner.config.mjs diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index 7874f38df19..dc911ea7544 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -315,18 +315,12 @@ jobs: echo "$(dirname $nargo_binary)" >> $GITHUB_PATH export PATH="$PATH:$(dirname $nargo_binary)" - - name: Install Playwright - uses: ./.github/actions/install-playwright - - name: Build fixtures run: yarn workspace @noir-lang/noir_wasm test:build_fixtures - name: Run node tests run: yarn workspace @noir-lang/noir_wasm test:node - - name: Run browser tests - run: yarn workspace @noir-lang/noir_wasm test:browser - test-noir-codegen: needs: [build-acvm-js, build-noirc-abi] name: noir_codegen diff --git a/compiler/integration-tests/circuits/deps_testing/Nargo.toml b/compiler/integration-tests/circuits/deps_testing/Nargo.toml new file mode 100644 index 00000000000..580fe0e28da --- /dev/null +++ b/compiler/integration-tests/circuits/deps_testing/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "test" +authors = [""] +compiler_version = ">=0.18.0" +type = "contract" + +[dependencies] +test = { path = "../lib_with_module" } diff --git a/compiler/wasm/public/fixtures/noir-contract/src/main.nr b/compiler/integration-tests/circuits/deps_testing/src/main.nr similarity index 100% rename from compiler/wasm/public/fixtures/noir-contract/src/main.nr rename to compiler/integration-tests/circuits/deps_testing/src/main.nr diff --git a/compiler/wasm/public/fixtures/deps/lib-c/Nargo.toml b/compiler/integration-tests/circuits/lib_with_module/Nargo.toml similarity index 100% rename from compiler/wasm/public/fixtures/deps/lib-c/Nargo.toml rename to compiler/integration-tests/circuits/lib_with_module/Nargo.toml diff --git a/compiler/wasm/public/fixtures/deps/lib-c/src/lib.nr b/compiler/integration-tests/circuits/lib_with_module/src/lib.nr similarity index 100% rename from compiler/wasm/public/fixtures/deps/lib-c/src/lib.nr rename to compiler/integration-tests/circuits/lib_with_module/src/lib.nr diff --git a/compiler/wasm/public/fixtures/deps/lib-c/src/module.nr b/compiler/integration-tests/circuits/lib_with_module/src/module.nr similarity index 100% rename from compiler/wasm/public/fixtures/deps/lib-c/src/module.nr rename to compiler/integration-tests/circuits/lib_with_module/src/module.nr diff --git a/compiler/wasm/public/fixtures/deps/lib-c/src/module/foo.nr b/compiler/integration-tests/circuits/lib_with_module/src/module/foo.nr similarity index 100% rename from compiler/wasm/public/fixtures/deps/lib-c/src/module/foo.nr rename to compiler/integration-tests/circuits/lib_with_module/src/module/foo.nr diff --git a/compiler/integration-tests/scripts/codegen-verifiers.sh b/compiler/integration-tests/scripts/codegen-verifiers.sh index e377a3ee3f8..485b668cb98 100644 --- a/compiler/integration-tests/scripts/codegen-verifiers.sh +++ b/compiler/integration-tests/scripts/codegen-verifiers.sh @@ -21,6 +21,11 @@ contracts_dir=$self_path/../contracts rm -rf $contracts_dir mkdir $contracts_dir +# Build dependency testing contract +# Run codegen-verifier for recursion +dep_testing_dir=$repo_root/compiler/integration-tests/circuits/deps_testing +nargo --program-dir $dep_testing_dir compile + cp $mul_dir/contract/1_mul/plonk_vk.sol $contracts_dir/1_mul.sol cp $assert_statement_dir/contract/assert_statement/plonk_vk.sol $contracts_dir/assert_statement.sol cp $recursion_dir/contract/recursion/plonk_vk.sol $contracts_dir/recursion.sol diff --git a/compiler/integration-tests/test/browser/compile_prove_verify.test.ts b/compiler/integration-tests/test/browser/compile_prove_verify.test.ts index 29e2fbc55b8..ae47e0fb458 100644 --- a/compiler/integration-tests/test/browser/compile_prove_verify.test.ts +++ b/compiler/integration-tests/test/browser/compile_prove_verify.test.ts @@ -1,22 +1,13 @@ import { expect } from '@esm-bundle/chai'; import * as TOML from 'smol-toml'; -import newCompiler, { - CompiledProgram, - PathToFileSourceMap, - compile, - init_log_level as compilerLogLevel, -} from '@noir-lang/noir_wasm'; +import { NoirCompiledCircuit, compile, createFileManager } from '@noir-lang/noir_wasm'; import { Noir } from '@noir-lang/noir_js'; import { InputMap } from '@noir-lang/noirc_abi'; import { BarretenbergBackend } from '@noir-lang/backend_barretenberg'; import { getFile } from './utils.js'; -await newCompiler(); - -compilerLogLevel('INFO'); - const test_cases = [ { case: 'test_programs/execution_success/1_mul', @@ -32,12 +23,11 @@ const suite = Mocha.Suite.create(mocha.suite, 'Noir end to end test'); suite.timeout(60 * 20e3); //20mins -function getCircuit(noirSource: string): CompiledProgram { - const sourceMap = new PathToFileSourceMap(); - sourceMap.add_source_code('main.nr', noirSource); - - // We're ignoring this in the resolver but pass in something sensible. - const result = compile('main.nr', undefined, undefined, sourceMap); +async function getCircuit(projectPath: string): Promise { + const fm = createFileManager('/'); + await fm.writeFile('./src/main.nr', await getFile(`${projectPath}/src/main.nr`)); + await fm.writeFile('./Nargo.toml', await getFile(`${projectPath}/Nargo.toml`)); + const [result] = await compile(fm); if (!('program' in result)) { throw new Error('Compilation failed'); } @@ -51,11 +41,9 @@ test_cases.forEach((testInfo) => { const base_relative_path = '../../../../..'; const test_case = testInfo.case; - const noir_source = await getFile(`${base_relative_path}/${test_case}/src/main.nr`); - - let noir_program: CompiledProgram; + let noir_program: NoirCompiledCircuit; try { - noir_program = getCircuit(noir_source); + noir_program = await getCircuit(`${base_relative_path}/${test_case}`); expect(noir_program, 'Compile output ').to.be.an('object'); } catch (e) { @@ -66,7 +54,7 @@ test_cases.forEach((testInfo) => { const backend = new BarretenbergBackend(noir_program); const program = new Noir(noir_program, backend); - const prover_toml = await getFile(`${base_relative_path}/${test_case}/Prover.toml`); + const prover_toml = await new Response(await getFile(`${base_relative_path}/${test_case}/Prover.toml`)).text(); const inputs: InputMap = TOML.parse(prover_toml) as InputMap; // JS Proving diff --git a/compiler/wasm/test/compiler/browser/index.test.ts b/compiler/integration-tests/test/browser/compile_with_deps.test.ts similarity index 59% rename from compiler/wasm/test/compiler/browser/index.test.ts rename to compiler/integration-tests/test/browser/compile_with_deps.test.ts index 2c8fd3cd964..cbf1bfe8a9b 100644 --- a/compiler/wasm/test/compiler/browser/index.test.ts +++ b/compiler/integration-tests/test/browser/compile_with_deps.test.ts @@ -1,15 +1,11 @@ -import { getPaths } from '../../shared'; +import { compile, createFileManager } from '@noir-lang/noir_wasm'; +import { getPaths } from '../shared'; import { expect } from '@esm-bundle/chai'; -// @ts-expect-error Import without typings, probably there's a better way -import { compile, createFileManager } from '../../../dist/web/main'; -import { FileManager } from '../../../dist/types/noir/file-manager/file-manager'; -import { NoirCompiledContract } from '../../../dist/types/types/noir_artifact'; - const paths = getPaths('.'); async function getFile(path: string) { - const basePath = new URL('./../../../', import.meta.url).toString().replace(/\/$/g, ''); + const basePath = new URL('./../../', import.meta.url).toString().replace(/\/$/g, ''); const url = `${basePath}${path.replace('.', '')}`; const response = await fetch(url); return response; @@ -25,15 +21,18 @@ async function getPrecompiledSource(path: string): Promise { describe('noir-compiler', () => { it('both nargo and noir_wasm should compile identically', async () => { const { contractExpectedArtifact } = paths; - const fm: FileManager = createFileManager('/'); + const fm = createFileManager('/'); const files = Object.values(paths).filter((fileOrDir) => /^\.?\/.*\..*$/.test(fileOrDir)); for (const path of files) { await fm.writeFile(path, (await getFile(path)).body as ReadableStream); } - const nargoArtifact = (await getPrecompiledSource(contractExpectedArtifact)) as NoirCompiledContract; + const nargoArtifact = await getPrecompiledSource(contractExpectedArtifact); nargoArtifact.functions.sort((a, b) => a.name.localeCompare(b.name)); - const noirWasmArtifact = await compile(fm, '/public/fixtures/noir-contract'); - const noirWasmContract = noirWasmArtifact[0].contract as NoirCompiledContract; + const [noirWasmArtifact] = await compile(fm, '/circuits/deps_testing'); + if (!('contract' in noirWasmArtifact)) { + throw new Error('Compilation failed'); + } + const noirWasmContract = noirWasmArtifact.contract; expect(noirWasmContract).not.to.be.undefined; noirWasmContract.functions.sort((a, b) => a.name.localeCompare(b.name)); expect(nargoArtifact).to.deep.eq(noirWasmContract); diff --git a/compiler/integration-tests/test/browser/recursion.test.ts b/compiler/integration-tests/test/browser/recursion.test.ts index faa317b2c3c..d2654fa94de 100644 --- a/compiler/integration-tests/test/browser/recursion.test.ts +++ b/compiler/integration-tests/test/browser/recursion.test.ts @@ -2,59 +2,46 @@ import { expect } from '@esm-bundle/chai'; import { TEST_LOG_LEVEL } from '../environment.js'; import { Logger } from 'tslog'; -import newCompiler, { - CompiledProgram, - PathToFileSourceMap, - compile, - init_log_level as compilerLogLevel, -} from '@noir-lang/noir_wasm'; import { acvm, abi, Noir } from '@noir-lang/noir_js'; import * as TOML from 'smol-toml'; import { BarretenbergBackend } from '@noir-lang/backend_barretenberg'; import { getFile } from './utils.js'; import { Field, InputMap } from '@noir-lang/noirc_abi'; +import { NoirCompiledCircuit, createFileManager, compile } from '@noir-lang/noir_wasm'; const logger = new Logger({ name: 'test', minLevel: TEST_LOG_LEVEL }); const { default: initACVM } = acvm; const { default: newABICoder } = abi; -await newCompiler(); await newABICoder(); await initACVM(); -compilerLogLevel('INFO'); - const base_relative_path = '../../../../..'; const circuit_main = 'test_programs/execution_success/assert_statement'; const circuit_recursion = 'compiler/integration-tests/circuits/recursion'; -function getCircuit(noirSource: string): CompiledProgram { - const sourceMap = new PathToFileSourceMap(); - sourceMap.add_source_code('main.nr', noirSource); - const result = compile('main.nr', undefined, undefined, sourceMap); +async function getCircuit(projectPath: string): Promise { + const fm = createFileManager('/'); + await fm.writeFile('./src/main.nr', await getFile(`${projectPath}/src/main.nr`)); + await fm.writeFile('./Nargo.toml', await getFile(`${projectPath}/Nargo.toml`)); + const [result] = await compile(fm); if (!('program' in result)) { throw new Error('Compilation failed'); } - return result.program; } describe('It compiles noir program code, receiving circuit bytes and abi object.', () => { - let circuit_main_source; let circuit_main_toml; - let circuit_recursion_source; before(async () => { - circuit_main_source = await getFile(`${base_relative_path}/${circuit_main}/src/main.nr`); - circuit_main_toml = await getFile(`${base_relative_path}/${circuit_main}/Prover.toml`); - - circuit_recursion_source = await getFile(`${base_relative_path}/${circuit_recursion}/src/main.nr`); + circuit_main_toml = await new Response(await getFile(`${base_relative_path}/${circuit_main}/Prover.toml`)).text(); }); it('Should generate valid inner proof for correct input, then verify proof within a proof', async () => { - const main_program = getCircuit(circuit_main_source); + const main_program = await getCircuit(`${base_relative_path}/${circuit_main}`); const main_inputs: InputMap = TOML.parse(circuit_main_toml) as InputMap; const main_backend = new BarretenbergBackend(main_program); @@ -84,7 +71,7 @@ describe('It compiles noir program code, receiving circuit bytes and abi object. logger.debug('recursion_inputs', recursion_inputs); - const recursion_program = await getCircuit(circuit_recursion_source); + const recursion_program = await getCircuit(`${base_relative_path}/${circuit_recursion}`); const recursion_backend = new BarretenbergBackend(recursion_program); diff --git a/compiler/integration-tests/test/browser/utils.ts b/compiler/integration-tests/test/browser/utils.ts index 35588407193..a5e3fe1bc61 100644 --- a/compiler/integration-tests/test/browser/utils.ts +++ b/compiler/integration-tests/test/browser/utils.ts @@ -1,8 +1,8 @@ -export async function getFile(file_path: string): Promise { +export async function getFile(file_path: string): Promise> { const file_url = new URL(file_path, import.meta.url); const response = await fetch(file_url); if (!response.ok) throw new Error('Network response was not OK'); - return await response.text(); + return response.body as ReadableStream; } diff --git a/compiler/wasm/test/compiler/node/index.test.ts b/compiler/integration-tests/test/node/compile_with_deps.test.ts similarity index 61% rename from compiler/wasm/test/compiler/node/index.test.ts rename to compiler/integration-tests/test/node/compile_with_deps.test.ts index f8986ac036f..6c01630b37c 100644 --- a/compiler/wasm/test/compiler/node/index.test.ts +++ b/compiler/integration-tests/test/node/compile_with_deps.test.ts @@ -1,16 +1,12 @@ import { join, resolve } from 'path'; -import { getPaths } from '../../shared'; +import { getPaths } from '../shared'; import { expect } from 'chai'; import { readFile } from 'fs/promises'; +import { compile, createFileManager } from '@noir-lang/noir_wasm'; +import { NoirCompiledContract } from '@noir-lang/noir_wasm/dist/types/types/noir_artifact'; -import type { NoirCompiledContract } from '../../../dist/types/types/noir_artifact'; - -// eslint-disable-next-line @typescript-eslint/no-var-requires -const cjs = require('../../../dist/node/main'); -const { createFileManager, compile } = cjs; - -const basePath = resolve(join(__dirname, '../../../')); +const basePath = resolve(join(__dirname, '../../')); const { contractProjectPath, contractExpectedArtifact } = getPaths(basePath); describe('noir-compiler', () => { @@ -18,8 +14,11 @@ describe('noir-compiler', () => { const fm = createFileManager(contractProjectPath); const nargoArtifact = JSON.parse((await readFile(contractExpectedArtifact)).toString()) as NoirCompiledContract; nargoArtifact.functions.sort((a, b) => a.name.localeCompare(b.name)); - const noirWasmArtifact = await compile(fm); - const noirWasmContract = noirWasmArtifact[0].contract as NoirCompiledContract; + const [noirWasmArtifact] = await compile(fm); + if (!('contract' in noirWasmArtifact)) { + throw new Error('Compilation failed'); + } + const noirWasmContract = noirWasmArtifact.contract; expect(noirWasmContract).not.to.be.undefined; noirWasmContract.functions.sort((a, b) => a.name.localeCompare(b.name)); expect(nargoArtifact).to.deep.eq(noirWasmContract); diff --git a/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts b/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts index 6c20d44882b..dd797e808cb 100644 --- a/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts +++ b/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts @@ -2,35 +2,35 @@ import { expect } from 'chai'; import { ethers } from 'hardhat'; import { readFileSync } from 'node:fs'; -import { resolve } from 'path'; +import { resolve, join } from 'path'; import toml from 'toml'; -import { - compile, - CompiledProgram, - init_log_level as compilerLogLevel, - PathToFileSourceMap, -} from '@noir-lang/noir_wasm'; import { Noir } from '@noir-lang/noir_js'; import { BarretenbergBackend, flattenPublicInputs } from '@noir-lang/backend_barretenberg'; import { Field, InputMap } from '@noir-lang/noirc_abi'; -compilerLogLevel('INFO'); +import { compile, createFileManager } from '@noir-lang/noir_wasm'; it(`smart contract can verify a recursive proof`, async () => { - const innerSourcePath = resolve(`../../test_programs/execution_success/assert_statement/src/main.nr`); - const sourceMapInnerProgram = new PathToFileSourceMap(); - sourceMapInnerProgram.add_source_code(innerSourcePath, readFileSync(innerSourcePath, 'utf-8')); - const innerProgram = ( - compile(innerSourcePath, undefined, undefined, sourceMapInnerProgram) as { program: CompiledProgram } - ).program; - - const recursionSourcePath = resolve(`./circuits/recursion/src/main.nr`); - const sourceMapRecursionProgram = new PathToFileSourceMap(); - sourceMapRecursionProgram.add_source_code(recursionSourcePath, readFileSync(recursionSourcePath, 'utf-8')); - const recursionProgram = ( - compile(recursionSourcePath, undefined, undefined, sourceMapRecursionProgram) as { program: CompiledProgram } - ).program; + const basePath = resolve(join(__dirname, '../../../../')); + const fm = createFileManager(basePath); + const [innerCompilationResult] = await compile( + fm, + join(basePath, './test_programs/execution_success/assert_statement'), + ); + if (!('program' in innerCompilationResult)) { + throw new Error('Compilation failed'); + } + const innerProgram = innerCompilationResult.program; + + const [recursionCompilationResult] = await compile( + fm, + join(basePath, './compiler/integration-tests/circuits/recursion'), + ); + if (!('program' in recursionCompilationResult)) { + throw new Error('Compilation failed'); + } + const recursionProgram = recursionCompilationResult.program; // Intermediate proof @@ -38,8 +38,9 @@ it(`smart contract can verify a recursive proof`, async () => { const inner = new Noir(innerProgram); const inner_prover_toml = readFileSync( - resolve(`../../test_programs/execution_success/assert_statement/Prover.toml`), + join(basePath, `./test_programs/execution_success/assert_statement/Prover.toml`), ).toString(); + const inner_inputs = toml.parse(inner_prover_toml); const { witness: main_witness } = await inner.execute(inner_inputs); diff --git a/compiler/integration-tests/test/node/smart_contract_verifier.test.ts b/compiler/integration-tests/test/node/smart_contract_verifier.test.ts index 5b3d0e2d337..8fcea352e4c 100644 --- a/compiler/integration-tests/test/node/smart_contract_verifier.test.ts +++ b/compiler/integration-tests/test/node/smart_contract_verifier.test.ts @@ -5,11 +5,10 @@ import { readFileSync } from 'node:fs'; import { resolve } from 'path'; import toml from 'toml'; -import { PathToFileSourceMap, compile, init_log_level as compilerLogLevel } from '@noir-lang/noir_wasm'; import { Noir } from '@noir-lang/noir_js'; import { BarretenbergBackend, flattenPublicInputs } from '@noir-lang/backend_barretenberg'; -compilerLogLevel('INFO'); +import { compile, createFileManager } from '@noir-lang/noir_wasm'; const test_cases = [ { @@ -31,11 +30,8 @@ test_cases.forEach((testInfo) => { const base_relative_path = '../..'; const test_case = testInfo.case; - const noirSourcePath = resolve(`${base_relative_path}/${test_case}/src/main.nr`); - const sourceMap = new PathToFileSourceMap(); - sourceMap.add_source_code(noirSourcePath, readFileSync(noirSourcePath, 'utf-8')); - - const compileResult = compile(noirSourcePath, undefined, undefined, sourceMap); + const fm = createFileManager(resolve(`${base_relative_path}/${test_case}`)); + const [compileResult] = await compile(fm); if (!('program' in compileResult)) { throw new Error('Compilation failed'); } diff --git a/compiler/integration-tests/test/shared.ts b/compiler/integration-tests/test/shared.ts new file mode 100644 index 00000000000..8980d979f19 --- /dev/null +++ b/compiler/integration-tests/test/shared.ts @@ -0,0 +1,26 @@ +export function getPaths(basePath: string) { + const fixtures = `${basePath}/circuits`; + + const libProjectPath = `${fixtures}/lib_with_module`; + const libSourcePath = `${libProjectPath}/src/lib.nr`; + const libModulePath = `${libProjectPath}/src/module.nr`; + const libModuleSourcePath = `${libProjectPath}/src/module/foo.nr`; + const libTOMLPath = `${libProjectPath}/Nargo.toml`; + + const contractProjectPath = `${fixtures}/deps_testing`; + const contractSourcePath = `${contractProjectPath}/src/main.nr`; + const contractTOMLPath = `${contractProjectPath}/Nargo.toml`; + const contractExpectedArtifact = `${contractProjectPath}/target/test-TestContract.json`; + + return { + libProjectPath, + libSourcePath, + libModulePath, + libModuleSourcePath, + libTOMLPath, + contractProjectPath, + contractSourcePath, + contractTOMLPath, + contractExpectedArtifact, + }; +} diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index d28481530b6..2da4f370710 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -6,11 +6,11 @@ "version": "0.22.0", "license": "(MIT OR Apache-2.0)", "main": "dist/main.js", - "types": "dist/types", + "types": "./dist/types/index.d.cts", "exports": { "node": "./dist/node/main.js", - "default": "./dist/web/main.js", - "import": "./dist/web/main.js", + "default": "./dist/web/main.mjs", + "import": "./dist/web/main.mjs", "require": "./dist/node/main.js" }, "files": [ @@ -22,12 +22,10 @@ "url": "https://github.com/noir-lang/noir.git" }, "scripts": { - "serve": "webpack serve", "build": "webpack", - "test": "yarn test:build_fixtures && yarn test:node && yarn test:browser", - "test:build_fixtures": "cd public/fixtures && cd simple && nargo compile && cd ../with-deps && nargo compile && cd ../noir-contract && nargo compile && cd ../", + "test": "yarn test:build_fixtures && yarn test:node", + "test:build_fixtures": "cd test/fixtures && cd simple && nargo compile && cd ../with-deps && nargo compile && cd ../../", "test:node": "NODE_NO_WARNINGS=1 $(yarn bin mocha) --config ./.mocharc.json", - "test:browser": "web-test-runner", "clean": "rm -rf ./build ./target ./dist public/fixtures/simple/target public/fixtures/with-deps/target public/fixtures/noir-contract/target", "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", "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", @@ -48,6 +46,7 @@ "@web/dev-server-esbuild": "^0.3.6", "@web/test-runner": "^0.15.3", "@web/test-runner-playwright": "^0.10.0", + "assert": "^2.1.0", "browserify-fs": "^1.0.0", "chai": "^4.3.10", "copy-webpack-plugin": "^11.0.0", @@ -57,7 +56,6 @@ "mocha-each": "^2.0.1", "pako": "^2.1.0", "path-browserify": "^1.0.1", - "playwright": "^1.40.1", "process": "^0.11.10", "readable-stream": "^4.4.2", "sinon": "^17.0.1", @@ -66,10 +64,6 @@ "typescript": "~5.2.2", "unzipit": "^1.4.3", "webpack": "^5.49.0", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.15.1" - }, - "dependencies": { - "assert": "^2.1.0" + "webpack-cli": "^4.7.2" } } diff --git a/compiler/wasm/src/index.cts b/compiler/wasm/src/index.cts index d2e1ea06557..2717f999fc7 100644 --- a/compiler/wasm/src/index.cts +++ b/compiler/wasm/src/index.cts @@ -2,6 +2,7 @@ import { FileManager } from './noir/file-manager/file-manager'; import { createNodejsFileManager } from './noir/file-manager/nodejs-file-manager'; import { NoirWasmContractCompiler } from './noir/noir-wasm-compiler'; import { LogData, LogFn } from './utils'; +import { NoirCompiledCircuit } from './types/noir_artifact'; async function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn) { const cjs = await require('../build/cjs'); @@ -23,4 +24,4 @@ async function compile(fileManager: FileManager, projectPath?: string, logFn?: L const createFileManager = createNodejsFileManager; -export { compile, createFileManager }; +export { compile, createFileManager, NoirCompiledCircuit }; diff --git a/compiler/wasm/src/index.mts b/compiler/wasm/src/index.mts index 93d81bbe290..e0d45a5f1d2 100644 --- a/compiler/wasm/src/index.mts +++ b/compiler/wasm/src/index.mts @@ -2,6 +2,7 @@ import { FileManager } from './noir/file-manager/file-manager'; import { createNodejsFileManager } from './noir/file-manager/nodejs-file-manager'; import { NoirWasmContractCompiler } from './noir/noir-wasm-compiler'; import { LogData, LogFn } from './utils'; +import { NoirCompiledCircuit } from './types/noir_artifact'; async function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn) { const esm = await import('../build/esm'); @@ -24,4 +25,4 @@ async function compile(fileManager: FileManager, projectPath?: string, logFn?: L const createFileManager = createNodejsFileManager; -export { compile, createFileManager }; +export { compile, createFileManager, NoirCompiledCircuit }; diff --git a/compiler/wasm/src/types/abi.ts b/compiler/wasm/src/types/abi.ts new file mode 100644 index 00000000000..f2ee83f1d22 --- /dev/null +++ b/compiler/wasm/src/types/abi.ts @@ -0,0 +1,116 @@ +/** + * A named type. + */ +export interface ABIVariable { + /** + * The name of the variable. + */ + name: string; + /** + * The type of the variable. + */ + type: ABIType; +} + +/** + * Indicates whether a parameter is public or secret/private. + */ +export enum ABIParameterVisibility { + PUBLIC = 'public', + SECRET = 'secret', +} + +/** + * A function parameter. + */ +export interface ABIParameter extends ABIVariable { + /** + * Indicates whether a parameter is public or secret/private. + */ + visibility: ABIParameterVisibility; +} + +/** + * A basic type. + */ +export interface BasicType { + /** + * The kind of the type. + */ + kind: T; +} + +/** + * A variable type. + */ +export type ABIType = BasicType<'field'> | BasicType<'boolean'> | IntegerType | ArrayType | StringType | StructType; + +/** + * An integer type. + */ +export interface IntegerType extends BasicType<'integer'> { + /** + * The sign of the integer. + */ + sign: string; + /** + * The width of the integer in bits. + */ + width: number; +} + +/** + * An array type. + */ +export interface ArrayType extends BasicType<'array'> { + /** + * The length of the array. + */ + length: number; + /** + * The type of the array elements. + */ + type: ABIType; +} + +/** + * A string type. + */ +export interface StringType extends BasicType<'string'> { + /** + * The length of the string. + */ + length: number; +} + +/** + * A struct type. + */ +export interface StructType extends BasicType<'struct'> { + /** + * The fields of the struct. + */ + fields: ABIVariable[]; + /** + * Fully qualified name of the struct. + */ + path: string; +} + +/** + * A contract event. + */ +export interface EventAbi { + /** + * The event name. + */ + name: string; + /** + * Fully qualified name of the event. + */ + path: string; + /** + * The fields of the event. + */ + fields: ABIVariable[]; +} diff --git a/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts index 322a2230a66..4c939589396 100644 --- a/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts +++ b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts @@ -1,6 +1,6 @@ import { Volume, createFsFromVolume } from 'memfs'; import { readFile } from 'fs/promises'; -import { join } from 'path'; +import { join, resolve } from 'path'; import { FileManager } from '../../src/noir/file-manager/file-manager'; import { createMemFSFileManager } from '../../src/noir/file-manager/memfs-file-manager'; @@ -20,7 +20,7 @@ import chaiAsPromised from 'chai-as-promised'; chai.use(chaiAsPromised); -const fixtures = join(__dirname, '../../public/fixtures'); +const fixtures = resolve(join(__dirname, '../fixtures')); describe('GithubDependencyResolver', () => { let resolver: NoirDependencyResolver; diff --git a/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts b/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts index 43c95b7618d..7fe420f9aab 100644 --- a/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts +++ b/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts @@ -1,6 +1,5 @@ import { createFsFromVolume, Volume } from 'memfs'; -import { readFile } from 'node:fs/promises'; -import { dirname, join } from 'path'; +import { readFile } from 'fs/promises'; import { FileManager } from '../../src/noir/file-manager/file-manager'; import { createMemFSFileManager } from '../../src/noir/file-manager/memfs-file-manager'; @@ -9,6 +8,7 @@ import { NoirDependencyResolver } from '../../src/noir/dependencies/dependency-r import { LocalDependencyResolver } from '../../src/noir/dependencies/local-dependency-resolver'; import { expect } from 'chai'; import forEach from 'mocha-each'; +import { join } from 'path'; describe('DependencyResolver', () => { let resolver: NoirDependencyResolver; @@ -16,7 +16,7 @@ describe('DependencyResolver', () => { let pkg: NoirPackage; beforeEach(async () => { - const fixtures = join(__dirname, '../../public/fixtures'); + const fixtures = join(__dirname, '../fixtures'); const memFS = createFsFromVolume(new Volume()); memFS.mkdirSync('/noir-contract/src', { recursive: true }); memFS.mkdirSync('/lib-c/src', { recursive: true }); diff --git a/compiler/wasm/public/fixtures/deps/lib-a/Nargo.toml b/compiler/wasm/test/fixtures/deps/lib-a/Nargo.toml similarity index 100% rename from compiler/wasm/public/fixtures/deps/lib-a/Nargo.toml rename to compiler/wasm/test/fixtures/deps/lib-a/Nargo.toml diff --git a/compiler/wasm/public/fixtures/deps/lib-a/src/lib.nr b/compiler/wasm/test/fixtures/deps/lib-a/src/lib.nr similarity index 100% rename from compiler/wasm/public/fixtures/deps/lib-a/src/lib.nr rename to compiler/wasm/test/fixtures/deps/lib-a/src/lib.nr diff --git a/compiler/wasm/public/fixtures/deps/lib-b/Nargo.toml b/compiler/wasm/test/fixtures/deps/lib-b/Nargo.toml similarity index 100% rename from compiler/wasm/public/fixtures/deps/lib-b/Nargo.toml rename to compiler/wasm/test/fixtures/deps/lib-b/Nargo.toml diff --git a/compiler/wasm/public/fixtures/deps/lib-b/src/lib.nr b/compiler/wasm/test/fixtures/deps/lib-b/src/lib.nr similarity index 100% rename from compiler/wasm/public/fixtures/deps/lib-b/src/lib.nr rename to compiler/wasm/test/fixtures/deps/lib-b/src/lib.nr diff --git a/compiler/wasm/test/fixtures/deps/lib-c/Nargo.toml b/compiler/wasm/test/fixtures/deps/lib-c/Nargo.toml new file mode 100644 index 00000000000..dafdb62e045 --- /dev/null +++ b/compiler/wasm/test/fixtures/deps/lib-c/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "lib_c" +authors = [""] +compiler_version = ">=0.18.0" +type = "lib" + +[dependencies] \ No newline at end of file diff --git a/compiler/wasm/test/fixtures/deps/lib-c/src/lib.nr b/compiler/wasm/test/fixtures/deps/lib-c/src/lib.nr new file mode 100644 index 00000000000..5c0b5a621e0 --- /dev/null +++ b/compiler/wasm/test/fixtures/deps/lib-c/src/lib.nr @@ -0,0 +1 @@ +mod module; \ No newline at end of file diff --git a/compiler/wasm/test/fixtures/deps/lib-c/src/module.nr b/compiler/wasm/test/fixtures/deps/lib-c/src/module.nr new file mode 100644 index 00000000000..2746c97edf0 --- /dev/null +++ b/compiler/wasm/test/fixtures/deps/lib-c/src/module.nr @@ -0,0 +1 @@ +mod foo; \ No newline at end of file diff --git a/compiler/wasm/test/fixtures/deps/lib-c/src/module/foo.nr b/compiler/wasm/test/fixtures/deps/lib-c/src/module/foo.nr new file mode 100644 index 00000000000..e0c82fb1960 --- /dev/null +++ b/compiler/wasm/test/fixtures/deps/lib-c/src/module/foo.nr @@ -0,0 +1,3 @@ +pub fn bar(param: Field) -> Field { + dep::std::hash::pedersen_hash([param]) +} diff --git a/compiler/wasm/public/fixtures/deps/test_lib.zip b/compiler/wasm/test/fixtures/deps/test_lib.zip similarity index 100% rename from compiler/wasm/public/fixtures/deps/test_lib.zip rename to compiler/wasm/test/fixtures/deps/test_lib.zip diff --git a/compiler/wasm/public/fixtures/noir-contract/Nargo.toml b/compiler/wasm/test/fixtures/noir-contract/Nargo.toml similarity index 100% rename from compiler/wasm/public/fixtures/noir-contract/Nargo.toml rename to compiler/wasm/test/fixtures/noir-contract/Nargo.toml diff --git a/compiler/wasm/test/fixtures/noir-contract/src/main.nr b/compiler/wasm/test/fixtures/noir-contract/src/main.nr new file mode 100644 index 00000000000..b980af369cf --- /dev/null +++ b/compiler/wasm/test/fixtures/noir-contract/src/main.nr @@ -0,0 +1,12 @@ +contract TestContract { + use dep::test::module::foo; + + fn constructor(param: Field, pub_param: pub Field) -> pub [Field; 2] { + [foo::bar(param), param + pub_param] + } + + open fn openFunction() -> pub Field { + 42 + } + +} diff --git a/compiler/wasm/public/fixtures/simple/Nargo.toml b/compiler/wasm/test/fixtures/simple/Nargo.toml similarity index 100% rename from compiler/wasm/public/fixtures/simple/Nargo.toml rename to compiler/wasm/test/fixtures/simple/Nargo.toml diff --git a/compiler/wasm/public/fixtures/simple/src/main.nr b/compiler/wasm/test/fixtures/simple/src/main.nr similarity index 100% rename from compiler/wasm/public/fixtures/simple/src/main.nr rename to compiler/wasm/test/fixtures/simple/src/main.nr diff --git a/compiler/wasm/public/fixtures/with-deps/Nargo.toml b/compiler/wasm/test/fixtures/with-deps/Nargo.toml similarity index 100% rename from compiler/wasm/public/fixtures/with-deps/Nargo.toml rename to compiler/wasm/test/fixtures/with-deps/Nargo.toml diff --git a/compiler/wasm/public/fixtures/with-deps/src/main.nr b/compiler/wasm/test/fixtures/with-deps/src/main.nr similarity index 100% rename from compiler/wasm/public/fixtures/with-deps/src/main.nr rename to compiler/wasm/test/fixtures/with-deps/src/main.nr diff --git a/compiler/wasm/test/shared.ts b/compiler/wasm/test/shared.ts index 1e35fc212d9..6b9274f4765 100644 --- a/compiler/wasm/test/shared.ts +++ b/compiler/wasm/test/shared.ts @@ -1,5 +1,5 @@ export function getPaths(basePath: string) { - const fixtures = `${basePath}/public/fixtures`; + const fixtures = `${basePath}/fixtures`; const simpleScriptSourcePath = `${fixtures}/simple/src/main.nr`; const simpleScriptExpectedArtifact = `${fixtures}/simple/target/noir_wasm_testing.json`; @@ -10,17 +10,6 @@ export function getPaths(basePath: string) { const libASourcePath = `${fixtures}/deps/lib-a/src/lib.nr`; const libBSourcePath = `${fixtures}/deps/lib-b/src/lib.nr`; - const libCProjectPath = `${fixtures}/deps/lib-c`; - const libCSourcePath = `${libCProjectPath}/src/lib.nr`; - const libCModulePath = `${libCProjectPath}/src/module.nr`; - const libCModuleSourcePath = `${libCProjectPath}/src/module/foo.nr`; - const libCTOMLPath = `${libCProjectPath}/Nargo.toml`; - - const contractProjectPath = `${fixtures}/noir-contract`; - const contractSourcePath = `${contractProjectPath}/src/main.nr`; - const contractTOMLPath = `${contractProjectPath}/Nargo.toml`; - const contractExpectedArtifact = `${contractProjectPath}/target/test-TestContract.json`; - return { simpleScriptSourcePath, simpleScriptExpectedArtifact, @@ -28,14 +17,5 @@ export function getPaths(basePath: string) { depsScriptExpectedArtifact, libASourcePath, libBSourcePath, - libCProjectPath, - libCSourcePath, - libCModulePath, - libCModuleSourcePath, - libCTOMLPath, - contractProjectPath, - contractSourcePath, - contractTOMLPath, - contractExpectedArtifact, }; } diff --git a/compiler/wasm/test/wasm/index.test.ts b/compiler/wasm/test/wasm/index.test.ts index 1c433733396..09ee971d2d2 100644 --- a/compiler/wasm/test/wasm/index.test.ts +++ b/compiler/wasm/test/wasm/index.test.ts @@ -5,7 +5,7 @@ import { expect } from 'chai'; import { compile, PathToFileSourceMap, compile_, CompilerContext } from '../../build/cjs'; -const basePath = resolve(join(__dirname, '../../')); +const basePath = resolve(join(__dirname, '../')); const { simpleScriptSourcePath, simpleScriptExpectedArtifact, diff --git a/compiler/wasm/web-test-runner.config.mjs b/compiler/wasm/web-test-runner.config.mjs deleted file mode 100644 index c92e20fd3da..00000000000 --- a/compiler/wasm/web-test-runner.config.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import { defaultReporter } from '@web/test-runner'; -import { summaryReporter } from '@web/test-runner'; -import { fileURLToPath } from 'url'; -import { esbuildPlugin } from '@web/dev-server-esbuild'; -import { playwrightLauncher } from '@web/test-runner-playwright'; - -const reporter = process.env.CI ? summaryReporter() : defaultReporter(); - -export default { - browsers: [ - playwrightLauncher({ product: 'chromium' }), - // playwrightLauncher({ product: "webkit" }), - // playwrightLauncher({ product: "firefox" }), - ], - plugins: [ - esbuildPlugin({ - ts: true, - }), - ], - files: ['**/browser/*.test.ts'], - nodeResolve: true, - rootDir: fileURLToPath(new URL('./../../', import.meta.url)), - reporters: [reporter], -}; From 3a0c688724db617e704dfd3a41d108dd0549eec5 Mon Sep 17 00:00:00 2001 From: thunkar Date: Thu, 21 Dec 2023 15:28:39 +0000 Subject: [PATCH 13/37] Updated lock --- yarn.lock | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 30a2ec8297f..8a37f42816d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4078,7 +4078,6 @@ __metadata: mocha-each: ^2.0.1 pako: ^2.1.0 path-browserify: ^1.0.1 - playwright: ^1.40.1 process: ^0.11.10 readable-stream: ^4.4.2 sinon: ^17.0.1 @@ -4088,7 +4087,6 @@ __metadata: unzipit: ^1.4.3 webpack: ^5.49.0 webpack-cli: ^4.7.2 - webpack-dev-server: ^4.15.1 languageName: unknown linkType: soft @@ -16133,7 +16131,7 @@ __metadata: languageName: node linkType: hard -"playwright@npm:^1.22.2, playwright@npm:^1.40.1": +"playwright@npm:^1.22.2": version: 1.40.1 resolution: "playwright@npm:1.40.1" dependencies: From f9833736c1799464f9e4abc721517152f7fd2e66 Mon Sep 17 00:00:00 2001 From: thunkar Date: Thu, 21 Dec 2023 16:32:41 +0000 Subject: [PATCH 14/37] Fixed test loader --- compiler/wasm/.mocharc.json | 3 +-- compiler/wasm/package.json | 1 - compiler/wasm/src/noir/file-manager/file-manager.ts | 2 +- compiler/wasm/tsconfig.json | 6 ++---- yarn.lock | 4 ++-- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/compiler/wasm/.mocharc.json b/compiler/wasm/.mocharc.json index 0a24f530091..44162fd7632 100644 --- a/compiler/wasm/.mocharc.json +++ b/compiler/wasm/.mocharc.json @@ -7,8 +7,7 @@ "**/!(browser)/*.test.ts" ], "node-option": [ - "experimental-specifier-resolution=node", - "loader=ts-node/esm" + "loader=ts-node" ] } \ No newline at end of file diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index 583c33eb152..da3d18a7dc6 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -44,7 +44,6 @@ "@types/chai": "^4", "@types/mocha": "^10.0.6", "@types/mocha-each": "^2", - "@types/node": "^20.10.0", "@types/path-browserify": "^1", "@types/readable-stream": "^4", "@types/sinon": "^17", diff --git a/compiler/wasm/src/noir/file-manager/file-manager.ts b/compiler/wasm/src/noir/file-manager/file-manager.ts index 9369f4146be..297e9f541e6 100644 --- a/compiler/wasm/src/noir/file-manager/file-manager.ts +++ b/compiler/wasm/src/noir/file-manager/file-manager.ts @@ -1,4 +1,4 @@ -import path, { dirname, isAbsolute, join } from 'path'; +import { dirname, isAbsolute, join } from 'path'; /** * A file system interface that matches the node fs module. diff --git a/compiler/wasm/tsconfig.json b/compiler/wasm/tsconfig.json index ff2b3443b22..40a89b1d498 100644 --- a/compiler/wasm/tsconfig.json +++ b/compiler/wasm/tsconfig.json @@ -13,8 +13,6 @@ "allowSyntheticDefaultImports": true, "esModuleInterop": true, "target": "ESNext", - "module": "CommonJS", - "moduleResolution": "Node" - }, - "include": ["./src"] + "module": "CommonJS" + } } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 8a37f42816d..a0869cd8b5e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4060,7 +4060,7 @@ __metadata: "@types/chai": ^4 "@types/mocha": ^10.0.6 "@types/mocha-each": ^2 - "@types/node": ^20.10.0 + "@types/node": ^20.10.5 "@types/path-browserify": ^1 "@types/readable-stream": ^4 "@types/sinon": ^17 @@ -5560,7 +5560,7 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^20.10.0": +"@types/node@npm:^20.10.5": version: 20.10.5 resolution: "@types/node@npm:20.10.5" dependencies: From 4eb60f0360f1a68d6010ffef281822e995880cf8 Mon Sep 17 00:00:00 2001 From: thunkar Date: Thu, 21 Dec 2023 16:39:27 +0000 Subject: [PATCH 15/37] Fixed lock, module resolution --- compiler/wasm/package.json | 4 ++++ compiler/wasm/tsconfig.json | 3 ++- yarn.lock | 15 +++++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index da3d18a7dc6..3f12522e4a5 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -68,7 +68,11 @@ "ts-node": "^10.9.1", "typescript": "~5.2.2", "unzipit": "^1.4.3", + "url": "^0.11.3", "webpack": "^5.49.0", "webpack-cli": "^4.7.2" + }, + "dependencies": { + "@types/node": "^20.10.5" } } diff --git a/compiler/wasm/tsconfig.json b/compiler/wasm/tsconfig.json index 40a89b1d498..f849c520e6f 100644 --- a/compiler/wasm/tsconfig.json +++ b/compiler/wasm/tsconfig.json @@ -13,6 +13,7 @@ "allowSyntheticDefaultImports": true, "esModuleInterop": true, "target": "ESNext", - "module": "CommonJS" + "module": "CommonJS", + "moduleResolution": "Node" } } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index a0869cd8b5e..b0d74b65660 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4085,6 +4085,7 @@ __metadata: ts-node: ^10.9.1 typescript: ~5.2.2 unzipit: ^1.4.3 + url: ^0.11.3 webpack: ^5.49.0 webpack-cli: ^4.7.2 languageName: unknown @@ -16813,7 +16814,7 @@ __metadata: languageName: node linkType: hard -"punycode@npm:^1.3.2": +"punycode@npm:^1.3.2, punycode@npm:^1.4.1": version: 1.4.1 resolution: "punycode@npm:1.4.1" checksum: fa6e698cb53db45e4628559e557ddaf554103d2a96a1d62892c8f4032cd3bc8871796cae9eabc1bc700e2b6677611521ce5bb1d9a27700086039965d0cf34518 @@ -16878,7 +16879,7 @@ __metadata: languageName: node linkType: hard -"qs@npm:^6.5.2": +"qs@npm:^6.11.2, qs@npm:^6.5.2": version: 6.11.2 resolution: "qs@npm:6.11.2" dependencies: @@ -20064,6 +20065,16 @@ __metadata: languageName: node linkType: hard +"url@npm:^0.11.3": + version: 0.11.3 + resolution: "url@npm:0.11.3" + dependencies: + punycode: ^1.4.1 + qs: ^6.11.2 + checksum: f9e7886f46a16f96d2e42fbcc5d682c231c55ef5442c1ff66150c0f6556f6e3a97d094a84f51be15ec2432711d212eb60426659ce418f5fcadeaa3f601532c4e + languageName: node + linkType: hard + "util-deprecate@npm:^1.0.1, util-deprecate@npm:^1.0.2, util-deprecate@npm:~1.0.1": version: 1.0.2 resolution: "util-deprecate@npm:1.0.2" From 23f8b6e6ff0a23d8fb9f6cb88123fe8064ab9cc6 Mon Sep 17 00:00:00 2001 From: sirasistant Date: Fri, 22 Dec 2023 10:20:01 +0000 Subject: [PATCH 16/37] chore: renames and removal of duplicated types --- .../test/browser/compile_prove_verify.test.ts | 6 +- .../test/browser/recursion.test.ts | 4 +- compiler/wasm/src/index.cts | 8 +- compiler/wasm/src/index.mts | 8 +- .../noir/dependencies/dependency-manager.ts | 22 ++--- .../noir/dependencies/dependency-resolver.ts | 12 +-- .../github-dependency-resolver.ts | 18 ++-- .../dependencies/local-dependency-resolver.ts | 12 +-- compiler/wasm/src/noir/noir-wasm-compiler.ts | 24 ++--- compiler/wasm/src/noir/package.ts | 16 ++-- compiler/wasm/src/types/abi.ts | 89 +------------------ compiler/wasm/src/types/noir_artifact.ts | 32 +++---- .../wasm/src/types/noir_package_config.ts | 12 +-- .../dependencies/dependency-manager.test.ts | 24 ++--- .../github-dependency-resolver.test.ts | 16 ++-- .../local-dependency-resolver.test.ts | 10 +-- 16 files changed, 113 insertions(+), 200 deletions(-) diff --git a/compiler/integration-tests/test/browser/compile_prove_verify.test.ts b/compiler/integration-tests/test/browser/compile_prove_verify.test.ts index ae47e0fb458..585179b2b99 100644 --- a/compiler/integration-tests/test/browser/compile_prove_verify.test.ts +++ b/compiler/integration-tests/test/browser/compile_prove_verify.test.ts @@ -1,7 +1,7 @@ import { expect } from '@esm-bundle/chai'; import * as TOML from 'smol-toml'; -import { NoirCompiledCircuit, compile, createFileManager } from '@noir-lang/noir_wasm'; +import { CompiledCircuit, compile, createFileManager } from '@noir-lang/noir_wasm'; import { Noir } from '@noir-lang/noir_js'; import { InputMap } from '@noir-lang/noirc_abi'; import { BarretenbergBackend } from '@noir-lang/backend_barretenberg'; @@ -23,7 +23,7 @@ const suite = Mocha.Suite.create(mocha.suite, 'Noir end to end test'); suite.timeout(60 * 20e3); //20mins -async function getCircuit(projectPath: string): Promise { +async function getCircuit(projectPath: string): Promise { const fm = createFileManager('/'); await fm.writeFile('./src/main.nr', await getFile(`${projectPath}/src/main.nr`)); await fm.writeFile('./Nargo.toml', await getFile(`${projectPath}/Nargo.toml`)); @@ -41,7 +41,7 @@ test_cases.forEach((testInfo) => { const base_relative_path = '../../../../..'; const test_case = testInfo.case; - let noir_program: NoirCompiledCircuit; + let noir_program: CompiledCircuit; try { noir_program = await getCircuit(`${base_relative_path}/${test_case}`); diff --git a/compiler/integration-tests/test/browser/recursion.test.ts b/compiler/integration-tests/test/browser/recursion.test.ts index d2654fa94de..5504aeedd0f 100644 --- a/compiler/integration-tests/test/browser/recursion.test.ts +++ b/compiler/integration-tests/test/browser/recursion.test.ts @@ -8,7 +8,7 @@ import * as TOML from 'smol-toml'; import { BarretenbergBackend } from '@noir-lang/backend_barretenberg'; import { getFile } from './utils.js'; import { Field, InputMap } from '@noir-lang/noirc_abi'; -import { NoirCompiledCircuit, createFileManager, compile } from '@noir-lang/noir_wasm'; +import { CompiledCircuit, createFileManager, compile } from '@noir-lang/noir_wasm'; const logger = new Logger({ name: 'test', minLevel: TEST_LOG_LEVEL }); @@ -22,7 +22,7 @@ const base_relative_path = '../../../../..'; const circuit_main = 'test_programs/execution_success/assert_statement'; const circuit_recursion = 'compiler/integration-tests/circuits/recursion'; -async function getCircuit(projectPath: string): Promise { +async function getCircuit(projectPath: string): Promise { const fm = createFileManager('/'); await fm.writeFile('./src/main.nr', await getFile(`${projectPath}/src/main.nr`)); await fm.writeFile('./Nargo.toml', await getFile(`${projectPath}/Nargo.toml`)); diff --git a/compiler/wasm/src/index.cts b/compiler/wasm/src/index.cts index 2717f999fc7..9b6fbf77957 100644 --- a/compiler/wasm/src/index.cts +++ b/compiler/wasm/src/index.cts @@ -1,12 +1,12 @@ import { FileManager } from './noir/file-manager/file-manager'; import { createNodejsFileManager } from './noir/file-manager/nodejs-file-manager'; -import { NoirWasmContractCompiler } from './noir/noir-wasm-compiler'; +import { NoirWasmCompiler } from './noir/noir-wasm-compiler'; import { LogData, LogFn } from './utils'; -import { NoirCompiledCircuit } from './types/noir_artifact'; +import { CompiledCircuit } from './types/noir_artifact'; async function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn) { const cjs = await require('../build/cjs'); - const compiler = await NoirWasmContractCompiler.new( + const compiler = await NoirWasmCompiler.new( fileManager, projectPath ?? fileManager.getDataDir(), cjs, @@ -24,4 +24,4 @@ async function compile(fileManager: FileManager, projectPath?: string, logFn?: L const createFileManager = createNodejsFileManager; -export { compile, createFileManager, NoirCompiledCircuit }; +export { compile, createFileManager, CompiledCircuit }; diff --git a/compiler/wasm/src/index.mts b/compiler/wasm/src/index.mts index e0d45a5f1d2..1828b5c6efd 100644 --- a/compiler/wasm/src/index.mts +++ b/compiler/wasm/src/index.mts @@ -1,13 +1,13 @@ import { FileManager } from './noir/file-manager/file-manager'; import { createNodejsFileManager } from './noir/file-manager/nodejs-file-manager'; -import { NoirWasmContractCompiler } from './noir/noir-wasm-compiler'; +import { NoirWasmCompiler } from './noir/noir-wasm-compiler'; import { LogData, LogFn } from './utils'; -import { NoirCompiledCircuit } from './types/noir_artifact'; +import { CompiledCircuit } from './types/noir_artifact'; async function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn) { const esm = await import('../build/esm'); await esm.default; - const compiler = await NoirWasmContractCompiler.new( + const compiler = await NoirWasmCompiler.new( fileManager, projectPath ?? fileManager.getDataDir(), esm, @@ -25,4 +25,4 @@ async function compile(fileManager: FileManager, projectPath?: string, logFn?: L const createFileManager = createNodejsFileManager; -export { compile, createFileManager, NoirCompiledCircuit }; +export { compile, createFileManager, CompiledCircuit }; diff --git a/compiler/wasm/src/noir/dependencies/dependency-manager.ts b/compiler/wasm/src/noir/dependencies/dependency-manager.ts index ba438326f93..944ec0070c5 100644 --- a/compiler/wasm/src/noir/dependencies/dependency-manager.ts +++ b/compiler/wasm/src/noir/dependencies/dependency-manager.ts @@ -1,26 +1,26 @@ import { join } from 'path'; -import { NoirPackage } from '../package'; -import { NoirDependency, NoirDependencyResolver } from './dependency-resolver'; -import { NoirDependencyConfig } from '../../types/noir_package_config'; +import { Package } from '../package'; +import { Dependency, DependencyResolver } from './dependency-resolver'; +import { DependencyConfig } from '../../types/noir_package_config'; import { LogData, LogFn } from '../../utils'; /** * Noir Dependency Resolver */ -export class NoirDependencyManager { - #entryPoint: NoirPackage; - #libraries = new Map(); +export class DependencyManager { + #entryPoint: Package; + #libraries = new Map(); #dependencies = new Map(); #log: LogFn; - #resolvers: readonly NoirDependencyResolver[]; + #resolvers: readonly DependencyResolver[]; /** * Creates a new dependency resolver * @param resolvers - A list of dependency resolvers to use * @param entryPoint - The entry point of the project */ - constructor(resolvers: readonly NoirDependencyResolver[] = [], entryPoint: NoirPackage) { + constructor(resolvers: readonly DependencyResolver[] = [], entryPoint: Package) { this.#resolvers = resolvers; this.#entryPoint = entryPoint; this.#log = (msg: string, _data?: LogData) => { @@ -73,7 +73,7 @@ export class NoirDependencyManager { /** Package name */ packageName: string; /** The package location */ - noirPackage: NoirPackage; + noirPackage: Package; }; const queue: Job[] = [ @@ -110,8 +110,8 @@ export class NoirDependencyManager { } } - async #resolveDependency(pkg: NoirPackage, config: NoirDependencyConfig): Promise { - let dependency: NoirDependency | null = null; + async #resolveDependency(pkg: Package, config: DependencyConfig): Promise { + let dependency: Dependency | null = null; for (const resolver of this.#resolvers) { dependency = await resolver.resolveDependency(pkg, config); if (dependency) { diff --git a/compiler/wasm/src/noir/dependencies/dependency-resolver.ts b/compiler/wasm/src/noir/dependencies/dependency-resolver.ts index 8d2c3eb6b8d..266d2075e1e 100644 --- a/compiler/wasm/src/noir/dependencies/dependency-resolver.ts +++ b/compiler/wasm/src/noir/dependencies/dependency-resolver.ts @@ -1,24 +1,24 @@ -import { NoirDependencyConfig } from '../../types/noir_package_config'; -import { NoirPackage } from '../package'; +import { DependencyConfig } from '../../types/noir_package_config'; +import { Package } from '../package'; /** * A Noir dependency */ -export type NoirDependency = { +export type Dependency = { /** version string as determined by the resolver */ version?: string; /** the actual package source code */ - package: NoirPackage; + package: Package; }; /** * Resolves a dependency for a package. */ -export interface NoirDependencyResolver { +export interface DependencyResolver { /** * Resolve a dependency for a package. * @param pkg - The package to resolve dependencies for * @param dep - The dependency config to resolve */ - resolveDependency(pkg: NoirPackage, dep: NoirDependencyConfig): Promise; + resolveDependency(pkg: Package, dep: DependencyConfig): Promise; } diff --git a/compiler/wasm/src/noir/dependencies/github-dependency-resolver.ts b/compiler/wasm/src/noir/dependencies/github-dependency-resolver.ts index 221603c41bb..8b08b6f0dd8 100644 --- a/compiler/wasm/src/noir/dependencies/github-dependency-resolver.ts +++ b/compiler/wasm/src/noir/dependencies/github-dependency-resolver.ts @@ -2,15 +2,15 @@ import { delimiter, join, sep } from 'path'; import { unzip } from 'unzipit'; import { FileManager } from '../file-manager/file-manager'; -import { NoirPackage } from '../package'; -import { NoirDependency, NoirDependencyResolver } from './dependency-resolver'; -import { NoirDependencyConfig, NoirGitDependencyConfig } from '../../types/noir_package_config'; +import { Package } from '../package'; +import { Dependency, DependencyResolver } from './dependency-resolver'; +import { DependencyConfig, GitDependencyConfig } from '../../types/noir_package_config'; import { LogData } from '../../utils'; /** * Downloads dependencies from github */ -export class GithubDependencyResolver implements NoirDependencyResolver { +export class GithubDependencyResolver implements DependencyResolver { #fm: FileManager; #log; @@ -27,7 +27,7 @@ export class GithubDependencyResolver implements NoirDependencyResolver { * @param dependency - The dependency configuration * @returns asd */ - async resolveDependency(_pkg: NoirPackage, dependency: NoirDependencyConfig): Promise { + async resolveDependency(_pkg: Package, dependency: DependencyConfig): Promise { // TODO accept ssh urls? // TODO github authentication? if (!('git' in dependency) || !dependency.git.startsWith('https://github.com')) { @@ -38,11 +38,11 @@ export class GithubDependencyResolver implements NoirDependencyResolver { const libPath = await this.#extractZip(dependency, archivePath); return { version: dependency.tag, - package: await NoirPackage.open(libPath, this.#fm), + package: await Package.open(libPath, this.#fm), }; } - async #fetchZipFromGithub(dependency: Pick): Promise { + async #fetchZipFromGithub(dependency: Pick): Promise { if (!dependency.git.startsWith('https://github.com')) { throw new Error('Only github dependencies are supported'); } @@ -71,7 +71,7 @@ export class GithubDependencyResolver implements NoirDependencyResolver { return localArchivePath; } - async #extractZip(dependency: NoirGitDependencyConfig, archivePath: string): Promise { + async #extractZip(dependency: GitDependencyConfig, archivePath: string): Promise { const gitUrl = new URL(dependency.git); // extract the archive to this location const extractLocation = join('libs', safeFilename(gitUrl.pathname + '@' + (dependency.tag ?? 'HEAD'))); @@ -131,7 +131,7 @@ export function safeFilename(val: string): string { * @param dependency - The dependency configuration * @returns The URL to the library archive */ -export function resolveGithubCodeArchive(dependency: NoirGitDependencyConfig, format: 'zip' | 'tar'): URL { +export function resolveGithubCodeArchive(dependency: GitDependencyConfig, format: 'zip' | 'tar'): URL { const gitUrl = new URL(dependency.git); const [owner, repo] = gitUrl.pathname.slice(1).split('/'); const ref = dependency.tag ?? 'HEAD'; diff --git a/compiler/wasm/src/noir/dependencies/local-dependency-resolver.ts b/compiler/wasm/src/noir/dependencies/local-dependency-resolver.ts index 52ed8633a27..50338421143 100644 --- a/compiler/wasm/src/noir/dependencies/local-dependency-resolver.ts +++ b/compiler/wasm/src/noir/dependencies/local-dependency-resolver.ts @@ -1,28 +1,28 @@ import { isAbsolute, join } from 'path'; import { FileManager } from '../file-manager/file-manager'; -import { NoirPackage } from '../package'; -import { NoirDependency, NoirDependencyResolver } from './dependency-resolver'; -import { NoirDependencyConfig } from '../../types/noir_package_config'; +import { Package } from '../package'; +import { Dependency, DependencyResolver } from './dependency-resolver'; +import { DependencyConfig } from '../../types/noir_package_config'; /** * Resolves dependencies on-disk, relative to current package */ -export class LocalDependencyResolver implements NoirDependencyResolver { +export class LocalDependencyResolver implements DependencyResolver { #fm: FileManager; constructor(fm: FileManager) { this.#fm = fm; } - async resolveDependency(parent: NoirPackage, config: NoirDependencyConfig): Promise { + async resolveDependency(parent: Package, config: DependencyConfig): Promise { if ('path' in config) { const parentPath = parent.getPackagePath(); const dependencyPath = isAbsolute(config.path) ? config.path : join(parentPath, config.path); return { // unknown version, Nargo.toml doesn't have a version field version: undefined, - package: await NoirPackage.open(dependencyPath, this.#fm), + package: await Package.open(dependencyPath, this.#fm), }; } else { return null; diff --git a/compiler/wasm/src/noir/noir-wasm-compiler.ts b/compiler/wasm/src/noir/noir-wasm-compiler.ts index 24a6757824f..012e9f5335d 100644 --- a/compiler/wasm/src/noir/noir-wasm-compiler.ts +++ b/compiler/wasm/src/noir/noir-wasm-compiler.ts @@ -1,12 +1,12 @@ import { isAbsolute } from 'path'; -import { NoirDependencyManager } from './dependencies/dependency-manager'; +import { DependencyManager } from './dependencies/dependency-manager'; import { GithubDependencyResolver as GithubCodeArchiveDependencyResolver } from './dependencies/github-dependency-resolver'; import { LocalDependencyResolver } from './dependencies/local-dependency-resolver'; import { FileManager } from './file-manager/file-manager'; -import { NoirPackage } from './package'; +import { Package } from './package'; import { LogData, LogFn } from '../utils'; -import { NoirCompilationResult } from '../types/noir_artifact'; +import { CompilationResult } from '../types/noir_artifact'; /** Compilation options */ export type NoirWasmCompileOptions = { @@ -19,20 +19,20 @@ export type NoirWasmCompileOptions = { /** * Noir Package Compiler */ -export class NoirWasmContractCompiler { +export class NoirWasmCompiler { #log: LogFn; #debugLog: LogFn; - #package: NoirPackage; + #package: Package; /* eslint-disable @typescript-eslint/no-explicit-any */ #wasmCompiler: any; #sourceMap: any; /* eslint-disable @typescript-eslint/no-explicit-any */ #fm: FileManager; - #dependencyManager: NoirDependencyManager; + #dependencyManager: DependencyManager; private constructor( - entrypoint: NoirPackage, - dependencyManager: NoirDependencyManager, + entrypoint: Package, + dependencyManager: DependencyManager, fileManager: FileManager, wasmCompiler: unknown, sourceMap: unknown, @@ -71,9 +71,9 @@ export class NoirWasmContractCompiler { throw new Error('projectPath must be an absolute path'); } - const noirPackage = await NoirPackage.open(projectPath, fileManager); + const noirPackage = await Package.open(projectPath, fileManager); - const dependencyManager = new NoirDependencyManager( + const dependencyManager = new DependencyManager( [ new LocalDependencyResolver(fileManager), new GithubCodeArchiveDependencyResolver(fileManager), @@ -82,7 +82,7 @@ export class NoirWasmContractCompiler { noirPackage, ); - return new NoirWasmContractCompiler(noirPackage, dependencyManager, fileManager, wasmCompiler, sourceMap, opts); + return new NoirWasmCompiler(noirPackage, dependencyManager, fileManager, wasmCompiler, sourceMap, opts); } /** @@ -91,7 +91,7 @@ export class NoirWasmContractCompiler { /** * Compile EntryPoint */ - public async compile(): Promise { + public async compile(): Promise { console.log(`Compiling at ${this.#package.getEntryPointPath()}`); if (!(this.#package.getType() === 'contract' || this.#package.getType() === 'bin')) { diff --git a/compiler/wasm/src/noir/package.ts b/compiler/wasm/src/noir/package.ts index 91b0db2e86a..a2496a03b3a 100644 --- a/compiler/wasm/src/noir/package.ts +++ b/compiler/wasm/src/noir/package.ts @@ -2,7 +2,7 @@ import { parse } from '@ltd/j-toml'; import { join } from 'path'; import { FileManager } from './file-manager/file-manager'; -import { NoirDependencyConfig, NoirPackageConfig, parseNoirPackageConfig } from '../types/noir_package_config'; +import { DependencyConfig, PackageConfig, parseNoirPackageConfig } from '../types/noir_package_config'; const CONFIG_FILE_NAME = 'Nargo.toml'; const SOURCE_EXTENSIONS = ['.nr']; @@ -24,13 +24,13 @@ type SourceList = Array<{ /** * A Noir package. */ -export class NoirPackage { +export class Package { #packagePath: string; #srcPath: string; - #config: NoirPackageConfig; + #config: PackageConfig; #version: string | null = null; - public constructor(path: string, srcDir: string, config: NoirPackageConfig) { + public constructor(path: string, srcDir: string, config: PackageConfig) { this.#packagePath = path; this.#srcPath = srcDir; this.#config = config; @@ -46,7 +46,7 @@ export class NoirPackage { /** * Gets this package's Nargo.toml (NoirPackage)Config. */ - public getNoirPackageConfig() { + public getPackageConfig() { return this.#config; } @@ -90,7 +90,7 @@ export class NoirPackage { /** * Gets this package's dependencies. */ - public getDependencies(): Record { + public getDependencies(): Record { return this.#config.dependencies; } @@ -120,10 +120,10 @@ export class NoirPackage { * @param fm - A file manager to use. * @returns The Noir package at the given location */ - public static async open(path: string, fm: FileManager): Promise { + public static async open(path: string, fm: FileManager): Promise { const fileContents = await fm.readFile(join(path, CONFIG_FILE_NAME), 'utf-8'); const config = parseNoirPackageConfig(parse(fileContents)); - return new NoirPackage(path, join(path, 'src'), config); + return new Package(path, join(path, 'src'), config); } } diff --git a/compiler/wasm/src/types/abi.ts b/compiler/wasm/src/types/abi.ts index f2ee83f1d22..7c20693db8a 100644 --- a/compiler/wasm/src/types/abi.ts +++ b/compiler/wasm/src/types/abi.ts @@ -1,3 +1,5 @@ +import { AbiType } from '@noir-lang/noirc_abi'; + /** * A named type. */ @@ -9,92 +11,7 @@ export interface ABIVariable { /** * The type of the variable. */ - type: ABIType; -} - -/** - * Indicates whether a parameter is public or secret/private. - */ -export enum ABIParameterVisibility { - PUBLIC = 'public', - SECRET = 'secret', -} - -/** - * A function parameter. - */ -export interface ABIParameter extends ABIVariable { - /** - * Indicates whether a parameter is public or secret/private. - */ - visibility: ABIParameterVisibility; -} - -/** - * A basic type. - */ -export interface BasicType { - /** - * The kind of the type. - */ - kind: T; -} - -/** - * A variable type. - */ -export type ABIType = BasicType<'field'> | BasicType<'boolean'> | IntegerType | ArrayType | StringType | StructType; - -/** - * An integer type. - */ -export interface IntegerType extends BasicType<'integer'> { - /** - * The sign of the integer. - */ - sign: string; - /** - * The width of the integer in bits. - */ - width: number; -} - -/** - * An array type. - */ -export interface ArrayType extends BasicType<'array'> { - /** - * The length of the array. - */ - length: number; - /** - * The type of the array elements. - */ - type: ABIType; -} - -/** - * A string type. - */ -export interface StringType extends BasicType<'string'> { - /** - * The length of the string. - */ - length: number; -} - -/** - * A struct type. - */ -export interface StructType extends BasicType<'struct'> { - /** - * The fields of the struct. - */ - fields: ABIVariable[]; - /** - * Fully qualified name of the struct. - */ - path: string; + type: AbiType; } /** diff --git a/compiler/wasm/src/types/noir_artifact.ts b/compiler/wasm/src/types/noir_artifact.ts index 6a894f4e607..4f410d5bbb5 100644 --- a/compiler/wasm/src/types/noir_artifact.ts +++ b/compiler/wasm/src/types/noir_artifact.ts @@ -44,7 +44,7 @@ export interface NoirFunctionEntry { /** * The compilation result of an Noir contract. */ -export interface NoirCompiledContract { +export interface CompiledContract { /** The name of the contract. */ name: string; /** Compilation backend. */ @@ -58,7 +58,7 @@ export interface NoirCompiledContract { /** * The compilation result of an Noir contract. */ -export interface NoirCompiledCircuit { +export interface CompiledCircuit { /** The hash of the circuit. */ hash?: number; /** Compilation backend. */ @@ -135,7 +135,7 @@ export type DebugFileMap = Record< /** * The debug metadata of an Noir contract. */ -export interface NoirDebugMetadata { +export interface DebugMetadata { /** * The debug information for each function. */ @@ -149,22 +149,22 @@ export interface NoirDebugMetadata { /** * The compilation artifacts of a given contract. */ -export interface NoirContractCompilationArtifacts { +export interface ContractCompilationArtifacts { /** * The compiled contract. */ - contract: NoirCompiledContract; + contract: CompiledContract; /** * The artifact that contains the debug metadata about the contract. */ - debug?: NoirDebugMetadata; + debug?: DebugMetadata; } /** * The compilation artifacts of a given program. */ -export interface NoirProgramCompilationArtifacts { +export interface ProgramCompilationArtifacts { /** * not part of the compilation output, injected later */ @@ -172,33 +172,29 @@ export interface NoirProgramCompilationArtifacts { /** * The compiled contract. */ - program: NoirCompiledCircuit; + program: CompiledCircuit; /** * The artifact that contains the debug metadata about the contract. */ - debug?: NoirDebugMetadata; + debug?: DebugMetadata; } /** * output of Noir Wasm compilation, can be for a contract or lib/binary */ -export type NoirCompilationResult = NoirContractCompilationArtifacts | NoirProgramCompilationArtifacts; +export type CompilationResult = ContractCompilationArtifacts | ProgramCompilationArtifacts; /** * Check if it has Contract unique property */ -export function isNoirContractCompilationArtifacts( - artifact: NoirCompilationResult, -): artifact is NoirContractCompilationArtifacts { - return (artifact as NoirContractCompilationArtifacts).contract !== undefined; +export function isContractCompilationArtifacts(artifact: CompilationResult): artifact is ContractCompilationArtifacts { + return (artifact as ContractCompilationArtifacts).contract !== undefined; } /** * Check if it has Contract unique property */ -export function isNoirProgramCompilationArtifacts( - artifact: NoirCompilationResult, -): artifact is NoirProgramCompilationArtifacts { - return (artifact as NoirProgramCompilationArtifacts).program !== undefined; +export function isProgramCompilationArtifacts(artifact: CompilationResult): artifact is ProgramCompilationArtifacts { + return (artifact as ProgramCompilationArtifacts).program !== undefined; } diff --git a/compiler/wasm/src/types/noir_package_config.ts b/compiler/wasm/src/types/noir_package_config.ts index 38876a6c661..b9be51f5686 100644 --- a/compiler/wasm/src/types/noir_package_config.ts +++ b/compiler/wasm/src/types/noir_package_config.ts @@ -20,34 +20,34 @@ type noirPackageConfigSchema = { backend?: string; license?: string; }; - dependencies: Record; + dependencies: Record; }; /** * Noir package configuration. */ -export type NoirPackageConfig = noirPackageConfigSchema; +export type PackageConfig = noirPackageConfigSchema; /** * A remote package dependency. */ -export type NoirGitDependencyConfig = noirGitDependencySchema; +export type GitDependencyConfig = noirGitDependencySchema; /** * A local package dependency. */ -export type NoirLocalDependencyConfig = noirLocalDependencySchema; +export type LocalDependencyConfig = noirLocalDependencySchema; /** * A package dependency. */ -export type NoirDependencyConfig = NoirGitDependencyConfig | NoirLocalDependencyConfig; +export type DependencyConfig = GitDependencyConfig | LocalDependencyConfig; /** * Checks that an object is a package configuration. * @param config - Config to check */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -export function parseNoirPackageConfig(config: any): NoirPackageConfig { +export function parseNoirPackageConfig(config: any): PackageConfig { return config; } diff --git a/compiler/wasm/test/dependencies/dependency-manager.test.ts b/compiler/wasm/test/dependencies/dependency-manager.test.ts index 64ad1487f55..4e2fdbae515 100644 --- a/compiler/wasm/test/dependencies/dependency-manager.test.ts +++ b/compiler/wasm/test/dependencies/dependency-manager.test.ts @@ -1,17 +1,17 @@ -import { NoirDependencyConfig } from '../../src/types/noir_package_config'; -import { NoirPackage } from '../../src/noir/package'; -import { NoirDependencyManager } from '../../src/noir/dependencies/dependency-manager'; -import { NoirDependency, NoirDependencyResolver } from '../../src/noir/dependencies/dependency-resolver'; +import { DependencyConfig } from '../../src/types/noir_package_config'; +import { Package } from '../../src/noir/package'; +import { DependencyManager } from '../../src/noir/dependencies/dependency-manager'; +import { Dependency, DependencyResolver } from '../../src/noir/dependencies/dependency-resolver'; import { expect } from 'chai'; describe('DependencyManager', () => { - let manager: NoirDependencyManager; + let manager: DependencyManager; beforeEach(() => { - manager = new NoirDependencyManager( + manager = new DependencyManager( [new TestDependencyResolver()], - new NoirPackage('/test_contract', '/test_contract/src', { + new Package('/test_contract', '/test_contract/src', { dependencies: { lib1: { path: '/lib1', @@ -53,9 +53,9 @@ describe('DependencyManager', () => { }); }); -class TestDependencyResolver implements NoirDependencyResolver { +class TestDependencyResolver implements DependencyResolver { // eslint-disable-next-line require-await - public async resolveDependency(pkg: NoirPackage, dep: NoirDependencyConfig): Promise { + public async resolveDependency(pkg: Package, dep: DependencyConfig): Promise { if (!('path' in dep)) { return null; } @@ -64,7 +64,7 @@ class TestDependencyResolver implements NoirDependencyResolver { case '/lib1': return { version: '', - package: new NoirPackage('/lib1', '/lib1/src', { + package: new Package('/lib1', '/lib1/src', { dependencies: {}, package: { name: 'lib1', @@ -76,7 +76,7 @@ class TestDependencyResolver implements NoirDependencyResolver { case '/lib2': return { version: '', - package: new NoirPackage('/lib2', '/lib2/src', { + package: new Package('/lib2', '/lib2/src', { dependencies: { lib3: { path: '../lib3', @@ -92,7 +92,7 @@ class TestDependencyResolver implements NoirDependencyResolver { case '/lib3': return { version: '', - package: new NoirPackage('/lib3', '/lib3/src', { + package: new Package('/lib3', '/lib3/src', { dependencies: {}, package: { name: 'lib3', diff --git a/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts index 4c939589396..b1e5a0d6ef2 100644 --- a/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts +++ b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts @@ -4,14 +4,14 @@ import { join, resolve } from 'path'; import { FileManager } from '../../src/noir/file-manager/file-manager'; import { createMemFSFileManager } from '../../src/noir/file-manager/memfs-file-manager'; -import { NoirPackage } from '../../src/noir/package'; -import { NoirDependencyResolver } from '../../src/noir/dependencies/dependency-resolver'; +import { Package } from '../../src/noir/package'; +import { DependencyResolver } from '../../src/noir/dependencies/dependency-resolver'; import { GithubDependencyResolver, resolveGithubCodeArchive, safeFilename, } from '../../src/noir/dependencies/github-dependency-resolver'; -import { NoirGitDependencyConfig } from '../../src/types/noir_package_config'; +import { GitDependencyConfig } from '../../src/types/noir_package_config'; import Sinon, { SinonStub } from 'sinon'; import { expect } from 'chai'; import forEach from 'mocha-each'; @@ -23,10 +23,10 @@ chai.use(chaiAsPromised); const fixtures = resolve(join(__dirname, '../fixtures')); describe('GithubDependencyResolver', () => { - let resolver: NoirDependencyResolver; + let resolver: DependencyResolver; let fm: FileManager; - let pkg: NoirPackage; - let libDependency: NoirGitDependencyConfig; + let pkg: Package; + let libDependency: GitDependencyConfig; let fetchStub: SinonStub | undefined; beforeEach(() => { @@ -38,7 +38,7 @@ describe('GithubDependencyResolver', () => { tag: 'v1.0.0', }; - pkg = new NoirPackage('/test_contract', '/test_contract/src', { + pkg = new Package('/test_contract', '/test_contract/src', { dependencies: { // eslint-disable-next-line camelcase test_lib: libDependency, @@ -110,7 +110,7 @@ describe('GithubDependencyResolver', () => { ], ]).it( 'resolves to the correct code archive URL %s', - async (href: string, format: 'zip' | 'tar', dep: NoirGitDependencyConfig) => { + async (href: string, format: 'zip' | 'tar', dep: GitDependencyConfig) => { const archiveUrl = resolveGithubCodeArchive(dep, format); expect(archiveUrl.href).to.eq(href); }, diff --git a/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts b/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts index 7fe420f9aab..f44f618a7cb 100644 --- a/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts +++ b/compiler/wasm/test/dependencies/local-dependency-resolver.test.ts @@ -3,17 +3,17 @@ import { readFile } from 'fs/promises'; import { FileManager } from '../../src/noir/file-manager/file-manager'; import { createMemFSFileManager } from '../../src/noir/file-manager/memfs-file-manager'; -import { NoirPackage } from '../../src/noir/package'; -import { NoirDependencyResolver } from '../../src/noir/dependencies/dependency-resolver'; +import { Package } from '../../src/noir/package'; +import { DependencyResolver } from '../../src/noir/dependencies/dependency-resolver'; import { LocalDependencyResolver } from '../../src/noir/dependencies/local-dependency-resolver'; import { expect } from 'chai'; import forEach from 'mocha-each'; import { join } from 'path'; describe('DependencyResolver', () => { - let resolver: NoirDependencyResolver; + let resolver: DependencyResolver; let fm: FileManager; - let pkg: NoirPackage; + let pkg: Package; beforeEach(async () => { const fixtures = join(__dirname, '../fixtures'); @@ -27,7 +27,7 @@ describe('DependencyResolver', () => { fm = createMemFSFileManager(memFS, '/'); - pkg = await NoirPackage.open('/noir-contract', fm); + pkg = await Package.open('/noir-contract', fm); resolver = new LocalDependencyResolver(fm); }); From e3b61ff9fb954137f42f83158a6861c959ca1549 Mon Sep 17 00:00:00 2001 From: sirasistant Date: Fri, 22 Dec 2023 11:12:18 +0000 Subject: [PATCH 17/37] chore: zip dependency in test --- compiler/wasm/package.json | 2 ++ compiler/wasm/src/index.cts | 23 +++++++++++++-- compiler/wasm/src/index.mts | 23 +++++++++++++-- .../noir/file-manager/nodejs-file-manager.ts | 27 +++++++++--------- compiler/wasm/src/noir/noir-wasm-compiler.ts | 10 ++----- .../github-dependency-resolver.test.ts | 15 ++++++++-- compiler/wasm/test/fixtures/deps/test_lib.zip | Bin 1198 -> 0 bytes .../test/fixtures/deps/test_lib/Nargo.toml | 7 +++++ .../test/fixtures/deps/test_lib/src/lib.nr | 1 + .../test/fixtures/deps/test_lib/src/module.nr | 1 + .../fixtures/deps/test_lib/src/module/foo.nr | 3 ++ yarn.lock | 18 ++++++++++++ 12 files changed, 101 insertions(+), 29 deletions(-) delete mode 100644 compiler/wasm/test/fixtures/deps/test_lib.zip create mode 100644 compiler/wasm/test/fixtures/deps/test_lib/Nargo.toml create mode 100644 compiler/wasm/test/fixtures/deps/test_lib/src/lib.nr create mode 100644 compiler/wasm/test/fixtures/deps/test_lib/src/module.nr create mode 100644 compiler/wasm/test/fixtures/deps/test_lib/src/module/foo.nr diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index 3f12522e4a5..e8beb2c5110 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -41,6 +41,7 @@ "@esm-bundle/chai": "^4.3.4-fix.0", "@ltd/j-toml": "^1.38.0", "@noir-lang/noirc_abi": "workspace:*", + "@types/adm-zip": "^0.5.0", "@types/chai": "^4", "@types/mocha": "^10.0.6", "@types/mocha-each": "^2", @@ -51,6 +52,7 @@ "@web/dev-server-esbuild": "^0.3.6", "@web/test-runner": "^0.15.3", "@web/test-runner-playwright": "^0.10.0", + "adm-zip": "^0.5.0", "assert": "^2.1.0", "browserify-fs": "^1.0.0", "chai": "^4.3.10", diff --git a/compiler/wasm/src/index.cts b/compiler/wasm/src/index.cts index 9b6fbf77957..ed26bc5e553 100644 --- a/compiler/wasm/src/index.cts +++ b/compiler/wasm/src/index.cts @@ -4,7 +4,11 @@ import { NoirWasmCompiler } from './noir/noir-wasm-compiler'; import { LogData, LogFn } from './utils'; import { CompiledCircuit } from './types/noir_artifact'; -async function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn) { +async function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn, debugLogFn?: LogFn) { + if (logFn && !debugLogFn) { + debugLogFn = logFn; + } + const cjs = await require('../build/cjs'); const compiler = await NoirWasmCompiler.new( fileManager, @@ -14,8 +18,21 @@ async function compile(fileManager: FileManager, projectPath?: string, logFn?: L { log: logFn ?? - function (msg: string, _data?: LogData) { - console.log(msg); + function (msg: string, data?: LogData) { + if (data) { + console.log(msg, data); + } else { + console.log(msg); + } + }, + debugLog: + debugLogFn ?? + function (msg: string, data?: LogData) { + if (data) { + console.debug(msg, data); + } else { + console.debug(msg); + } }, }, ); diff --git a/compiler/wasm/src/index.mts b/compiler/wasm/src/index.mts index 1828b5c6efd..c72f5be3a96 100644 --- a/compiler/wasm/src/index.mts +++ b/compiler/wasm/src/index.mts @@ -4,7 +4,11 @@ import { NoirWasmCompiler } from './noir/noir-wasm-compiler'; import { LogData, LogFn } from './utils'; import { CompiledCircuit } from './types/noir_artifact'; -async function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn) { +async function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn, debugLogFn?: LogFn) { + if (logFn && !debugLogFn) { + debugLogFn = logFn; + } + const esm = await import('../build/esm'); await esm.default; const compiler = await NoirWasmCompiler.new( @@ -15,8 +19,21 @@ async function compile(fileManager: FileManager, projectPath?: string, logFn?: L { log: logFn ?? - function (msg: string, _data?: LogData) { - console.log(msg); + function (msg: string, data?: LogData) { + if (data) { + console.log(msg, data); + } else { + console.log(msg); + } + }, + debugLog: + debugLogFn ?? + function (msg: string, data?: LogData) { + if (data) { + console.debug(msg, data); + } else { + console.debug(msg); + } }, }, ); diff --git a/compiler/wasm/src/noir/file-manager/nodejs-file-manager.ts b/compiler/wasm/src/noir/file-manager/nodejs-file-manager.ts index 9fe397bef61..1a8250f49cc 100644 --- a/compiler/wasm/src/noir/file-manager/nodejs-file-manager.ts +++ b/compiler/wasm/src/noir/file-manager/nodejs-file-manager.ts @@ -3,24 +3,25 @@ import { promises as fs } from 'fs'; import { FileManager } from './file-manager'; +// This is needed because memfs doesn't support the recursive flag yet +export async function readdirRecursive(dir: string): Promise { + const contents = await fs.readdir(dir); + let files: string[] = []; + for (const handle of contents) { + if ((await fs.stat(`${dir}/${handle}`)).isFile()) { + files.push(`${dir}/${handle.toString()}`); + } else { + files = files.concat(await readdirRecursive(`${dir}/${handle.toString()}`)); + } + } + return files; +} + /** * Creates a new FileManager instance based on nodejs fs * @param dataDir - where to store files */ export function createNodejsFileManager(dataDir: string): FileManager { - // This is needed because memfs doesn't support the recursive flag yet - const readdirRecursive = async (dir: string): Promise => { - const contents = await fs.readdir(dir); - let files: string[] = []; - for (const handle of contents) { - if ((await fs.stat(`${dir}/${handle}`)).isFile()) { - files.push(`${dir}/${handle.toString()}`); - } else { - files = files.concat(await readdirRecursive(`${dir}/${handle.toString()}`)); - } - } - return files; - }; return new FileManager( { ...fs, diff --git a/compiler/wasm/src/noir/noir-wasm-compiler.ts b/compiler/wasm/src/noir/noir-wasm-compiler.ts index 012e9f5335d..f0541549a19 100644 --- a/compiler/wasm/src/noir/noir-wasm-compiler.ts +++ b/compiler/wasm/src/noir/noir-wasm-compiler.ts @@ -5,7 +5,7 @@ import { GithubDependencyResolver as GithubCodeArchiveDependencyResolver } from import { LocalDependencyResolver } from './dependencies/local-dependency-resolver'; import { FileManager } from './file-manager/file-manager'; import { Package } from './package'; -import { LogData, LogFn } from '../utils'; +import { LogFn } from '../utils'; import { CompilationResult } from '../types/noir_artifact'; /** Compilation options */ @@ -13,7 +13,7 @@ export type NoirWasmCompileOptions = { /** Logging function */ log: LogFn; /** Log debugging information through this function */ - debugLog?: LogFn; + debugLog: LogFn; }; /** @@ -39,11 +39,7 @@ export class NoirWasmCompiler { opts: NoirWasmCompileOptions, ) { this.#log = opts.log; - this.#debugLog = - opts.debugLog ?? - function (msg: string, _data?: LogData) { - console.log(msg); - }; + this.#debugLog = opts.debugLog; this.#package = entrypoint; this.#fm = fileManager; this.#wasmCompiler = wasmCompiler; diff --git a/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts index b1e5a0d6ef2..860582db0a9 100644 --- a/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts +++ b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts @@ -1,9 +1,10 @@ import { Volume, createFsFromVolume } from 'memfs'; -import { readFile } from 'fs/promises'; -import { join, resolve } from 'path'; +import { dirname, join, resolve } from 'path'; import { FileManager } from '../../src/noir/file-manager/file-manager'; import { createMemFSFileManager } from '../../src/noir/file-manager/memfs-file-manager'; +import { readdirRecursive } from '../../src/noir/file-manager/nodejs-file-manager'; + import { Package } from '../../src/noir/package'; import { DependencyResolver } from '../../src/noir/dependencies/dependency-resolver'; import { @@ -17,6 +18,7 @@ import { expect } from 'chai'; import forEach from 'mocha-each'; import chai from 'chai'; import chaiAsPromised from 'chai-as-promised'; +import AdmZip from 'adm-zip'; chai.use(chaiAsPromised); @@ -68,7 +70,14 @@ describe('GithubDependencyResolver', () => { }); it('resolves Github dependency', async () => { - fetchStub?.onCall(0).returns(new Response(await readFile(join(fixtures, 'deps', 'test_lib.zip')), { status: 200 })); + const zip = new AdmZip(); + const testLibPath = join(fixtures, 'deps', 'test_lib'); + for (const filePath of await readdirRecursive(testLibPath)) { + zip.addLocalFile(filePath, dirname(filePath.replace(testLibPath, 'test_lib'))); + } + + fetchStub?.onCall(0).returns(new Response(zip.toBuffer(), { status: 200 })); + const lib = await resolver.resolveDependency(pkg, libDependency); expect(lib).not.to.be.undefined; expect(lib!.version).to.eq(libDependency.tag); diff --git a/compiler/wasm/test/fixtures/deps/test_lib.zip b/compiler/wasm/test/fixtures/deps/test_lib.zip deleted file mode 100644 index e5004ee2eceff5ec1ed39df5b9e4955e03770b59..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1198 zcmWIWW@Zs#U|`^2uyu0_XPcmG9tz~e1FNVo`d&UP*p#PG|@x z1GCvF`BY05gVfRrZU#n{uu=vFFd=(7nyW!U!0qAp$ksDVi^MK?xg2`4ylu}yu`Rz( zT|fM@WZSzf);zA#3(}7AZmo=*`Q~b0$gArnn-!-!iS=)~qY)bP=YHXg8Mh`|zv=kW z*0V#=%F$Fm0O&$4pnDj=E(9~61TV4+i;I%=;ckn%qmS-3RAX*m;(N>uGzNrGJPI-f z=wZFQBDi5#Jer%Iq5#CDIjPpD=AP`cBT-WjvRhxG8wpEK#2Jj5 zgpdt(1cn7X5I}B4N>Id^4GKmW5Me+Lhnd*T1|}+eCL^K_HAx}6`Z*4hVF?VE`K)Xp Rm$Ct&G!p|uEf6y>008bOBar|A diff --git a/compiler/wasm/test/fixtures/deps/test_lib/Nargo.toml b/compiler/wasm/test/fixtures/deps/test_lib/Nargo.toml new file mode 100644 index 00000000000..f300a1a98a3 --- /dev/null +++ b/compiler/wasm/test/fixtures/deps/test_lib/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "testlib" +authors = [""] +compiler_version = "0.1" +type = "lib" + +[dependencies] \ No newline at end of file diff --git a/compiler/wasm/test/fixtures/deps/test_lib/src/lib.nr b/compiler/wasm/test/fixtures/deps/test_lib/src/lib.nr new file mode 100644 index 00000000000..5c0b5a621e0 --- /dev/null +++ b/compiler/wasm/test/fixtures/deps/test_lib/src/lib.nr @@ -0,0 +1 @@ +mod module; \ No newline at end of file diff --git a/compiler/wasm/test/fixtures/deps/test_lib/src/module.nr b/compiler/wasm/test/fixtures/deps/test_lib/src/module.nr new file mode 100644 index 00000000000..2746c97edf0 --- /dev/null +++ b/compiler/wasm/test/fixtures/deps/test_lib/src/module.nr @@ -0,0 +1 @@ +mod foo; \ No newline at end of file diff --git a/compiler/wasm/test/fixtures/deps/test_lib/src/module/foo.nr b/compiler/wasm/test/fixtures/deps/test_lib/src/module/foo.nr new file mode 100644 index 00000000000..61316bc9280 --- /dev/null +++ b/compiler/wasm/test/fixtures/deps/test_lib/src/module/foo.nr @@ -0,0 +1,3 @@ +fn bar(param: Field) -> Field { + dep::std::hash::pedersen([param])[0] +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index b0d74b65660..7a76ca89da9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4057,6 +4057,7 @@ __metadata: "@esm-bundle/chai": ^4.3.4-fix.0 "@ltd/j-toml": ^1.38.0 "@noir-lang/noirc_abi": "workspace:*" + "@types/adm-zip": ^0.5.0 "@types/chai": ^4 "@types/mocha": ^10.0.6 "@types/mocha-each": ^2 @@ -4068,6 +4069,7 @@ __metadata: "@web/dev-server-esbuild": ^0.3.6 "@web/test-runner": ^0.15.3 "@web/test-runner-playwright": ^0.10.0 + adm-zip: ^0.5.0 assert: ^2.1.0 browserify-fs: ^1.0.0 chai: ^4.3.10 @@ -5067,6 +5069,15 @@ __metadata: languageName: node linkType: hard +"@types/adm-zip@npm:^0.5.0": + version: 0.5.5 + resolution: "@types/adm-zip@npm:0.5.5" + dependencies: + "@types/node": "*" + checksum: 808c25b8a1c2e1c594cf9b1514e7953105cf96e19e38aa7dc109ff2537bda7345b950ef1f4e54a6e824e5503e29d24b0ff6d0aa1ff9bd4afb79ef0ef2df9ebab + languageName: node + linkType: hard + "@types/babel__code-frame@npm:^7.0.2": version: 7.0.6 resolution: "@types/babel__code-frame@npm:7.0.6" @@ -6648,6 +6659,13 @@ __metadata: languageName: node linkType: hard +"adm-zip@npm:^0.5.0": + version: 0.5.10 + resolution: "adm-zip@npm:0.5.10" + checksum: 07ed91cf6423bf5dca4ee63977bc7635e91b8d21829c00829d48dce4c6932e1b19e6cfcbe44f1931c956e68795ae97183fc775913883fa48ce88a1ac11fb2034 + languageName: node + linkType: hard + "aes-js@npm:3.0.0": version: 3.0.0 resolution: "aes-js@npm:3.0.0" From 64c8364e8ad89dad8d521b79e40e180d266651c2 Mon Sep 17 00:00:00 2001 From: thunkar Date: Wed, 3 Jan 2024 16:18:52 +0000 Subject: [PATCH 18/37] Changed compilation for better bundling --- .../test/node/compile_with_deps.test.ts | 3 +-- compiler/wasm/package.json | 2 +- compiler/wasm/src/index.mts | 5 +++-- compiler/wasm/webpack.config.ts | 16 ++++------------ 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/compiler/integration-tests/test/node/compile_with_deps.test.ts b/compiler/integration-tests/test/node/compile_with_deps.test.ts index 6c01630b37c..1f26de968ea 100644 --- a/compiler/integration-tests/test/node/compile_with_deps.test.ts +++ b/compiler/integration-tests/test/node/compile_with_deps.test.ts @@ -4,7 +4,6 @@ import { getPaths } from '../shared'; import { expect } from 'chai'; import { readFile } from 'fs/promises'; import { compile, createFileManager } from '@noir-lang/noir_wasm'; -import { NoirCompiledContract } from '@noir-lang/noir_wasm/dist/types/types/noir_artifact'; const basePath = resolve(join(__dirname, '../../')); const { contractProjectPath, contractExpectedArtifact } = getPaths(basePath); @@ -12,7 +11,7 @@ const { contractProjectPath, contractExpectedArtifact } = getPaths(basePath); describe('noir-compiler', () => { it('both nargo and noir_wasm should compile identically', async () => { const fm = createFileManager(contractProjectPath); - const nargoArtifact = JSON.parse((await readFile(contractExpectedArtifact)).toString()) as NoirCompiledContract; + const nargoArtifact = JSON.parse((await readFile(contractExpectedArtifact)).toString()); nargoArtifact.functions.sort((a, b) => a.name.localeCompare(b.name)); const [noirWasmArtifact] = await compile(fm); if (!('contract' in noirWasmArtifact)) { diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index e8beb2c5110..f8441d661c4 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -6,7 +6,7 @@ "version": "0.22.0", "license": "(MIT OR Apache-2.0)", "main": "dist/main.js", - "types": "./dist/types/index.d.cts", + "types": "./dist/types/src/index.d.cts", "exports": { "node": "./dist/node/main.js", "default": "./dist/web/main.mjs", diff --git a/compiler/wasm/src/index.mts b/compiler/wasm/src/index.mts index c72f5be3a96..4c220437dcd 100644 --- a/compiler/wasm/src/index.mts +++ b/compiler/wasm/src/index.mts @@ -9,8 +9,9 @@ async function compile(fileManager: FileManager, projectPath?: string, logFn?: L debugLogFn = logFn; } - const esm = await import('../build/esm'); - await esm.default; + const esm = await import(/* webpackMode: "eager" */ '../build/esm'); + await esm.default(); + const compiler = await NoirWasmCompiler.new( fileManager, projectPath ?? fileManager.getDataDir(), diff --git a/compiler/wasm/webpack.config.ts b/compiler/wasm/webpack.config.ts index b832570f5eb..d5fe18ed020 100644 --- a/compiler/wasm/webpack.config.ts +++ b/compiler/wasm/webpack.config.ts @@ -11,10 +11,6 @@ const config: webpack.Configuration = { }, mode: 'development', devtool: 'source-map', - experiments: { - asyncWebAssembly: true, - syncWebAssembly: true, - }, optimization: { minimize: false, }, @@ -33,24 +29,20 @@ const webConfig: webpack.Configuration = { name: 'web', entry: './src/index.mts', ...config, - experiments: { - ...config.experiments, - outputModule: true, - }, + experiments: { asyncWebAssembly: true, outputModule: true }, output: { filename: 'main.mjs', ...config.output, path: resolve(__dirname, 'dist/web'), library: { - type: 'window', + type: 'module', }, - libraryTarget: 'module', }, plugins: [ new WasmPackPlugin({ crateDirectory: resolve(__dirname), outDir: resolve(__dirname, './build/esm'), - extraArgs: '--target bundler', + extraArgs: '--target web', forceMode: 'production', }), new HtmlWebpackPlugin({ @@ -78,7 +70,7 @@ const webConfig: webpack.Configuration = { }, { test: /\.wasm$/, - type: 'webassembly/async', + type: 'asset/inline', }, ], }, From e3156b86af82248a7d53435b9970f08e3b9770d7 Mon Sep 17 00:00:00 2001 From: thunkar Date: Fri, 5 Jan 2024 15:21:31 +0000 Subject: [PATCH 19/37] logs --- .../integration-tests/test/browser/compile_with_deps.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/integration-tests/test/browser/compile_with_deps.test.ts b/compiler/integration-tests/test/browser/compile_with_deps.test.ts index cbf1bfe8a9b..ed260547d66 100644 --- a/compiler/integration-tests/test/browser/compile_with_deps.test.ts +++ b/compiler/integration-tests/test/browser/compile_with_deps.test.ts @@ -29,6 +29,9 @@ describe('noir-compiler', () => { const nargoArtifact = await getPrecompiledSource(contractExpectedArtifact); nargoArtifact.functions.sort((a, b) => a.name.localeCompare(b.name)); const [noirWasmArtifact] = await compile(fm, '/circuits/deps_testing'); + console.log(noirWasmArtifact); + console.log('---------'); + console.log(nargoArtifact); if (!('contract' in noirWasmArtifact)) { throw new Error('Compilation failed'); } From b535ec5e570aaaddd617d632d045be4bc43e6d8e Mon Sep 17 00:00:00 2001 From: thunkar Date: Fri, 5 Jan 2024 15:32:03 +0000 Subject: [PATCH 20/37] Increased timeout --- .../integration-tests/test/browser/compile_with_deps.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/integration-tests/test/browser/compile_with_deps.test.ts b/compiler/integration-tests/test/browser/compile_with_deps.test.ts index ed260547d66..d11d5a80039 100644 --- a/compiler/integration-tests/test/browser/compile_with_deps.test.ts +++ b/compiler/integration-tests/test/browser/compile_with_deps.test.ts @@ -39,5 +39,5 @@ describe('noir-compiler', () => { expect(noirWasmContract).not.to.be.undefined; noirWasmContract.functions.sort((a, b) => a.name.localeCompare(b.name)); expect(nargoArtifact).to.deep.eq(noirWasmContract); - }); + }).timeout(60 * 20e3); }); From f808f94084da49a81bfd912b59341cf0bc177a91 Mon Sep 17 00:00:00 2001 From: thunkar Date: Fri, 5 Jan 2024 15:42:56 +0000 Subject: [PATCH 21/37] removed traces --- .../integration-tests/test/browser/compile_with_deps.test.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/compiler/integration-tests/test/browser/compile_with_deps.test.ts b/compiler/integration-tests/test/browser/compile_with_deps.test.ts index d11d5a80039..bd728a324a4 100644 --- a/compiler/integration-tests/test/browser/compile_with_deps.test.ts +++ b/compiler/integration-tests/test/browser/compile_with_deps.test.ts @@ -29,9 +29,6 @@ describe('noir-compiler', () => { const nargoArtifact = await getPrecompiledSource(contractExpectedArtifact); nargoArtifact.functions.sort((a, b) => a.name.localeCompare(b.name)); const [noirWasmArtifact] = await compile(fm, '/circuits/deps_testing'); - console.log(noirWasmArtifact); - console.log('---------'); - console.log(nargoArtifact); if (!('contract' in noirWasmArtifact)) { throw new Error('Compilation failed'); } From 11fa714455e47b5a47a696ded71dfccf481d8e6e Mon Sep 17 00:00:00 2001 From: thunkar Date: Mon, 8 Jan 2024 12:59:20 +0000 Subject: [PATCH 22/37] Addressed PR feedback --- compiler/wasm/Cargo.toml | 5 ----- compiler/wasm/build-fixtures.sh | 3 +++ compiler/wasm/package.json | 12 ++++-------- compiler/wasm/src/types/noir_package_config.ts | 16 ++++++++-------- .../github-dependency-resolver.test.ts | 3 +-- 5 files changed, 16 insertions(+), 23 deletions(-) create mode 100755 compiler/wasm/build-fixtures.sh diff --git a/compiler/wasm/Cargo.toml b/compiler/wasm/Cargo.toml index e4ad2ddb68e..7ea138b60a4 100644 --- a/compiler/wasm/Cargo.toml +++ b/compiler/wasm/Cargo.toml @@ -32,8 +32,3 @@ getrandom = { workspace = true, features = ["js"] } [build-dependencies] build-data.workspace = true - -# `wasm-opt` is on by default in for the release profile, but it can be -# disabled by setting it to `false` -[package.metadata.wasm-pack.profile.release] -wasm-opt = false diff --git a/compiler/wasm/build-fixtures.sh b/compiler/wasm/build-fixtures.sh new file mode 100755 index 00000000000..8b4e4e2abee --- /dev/null +++ b/compiler/wasm/build-fixtures.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +cd test/fixtures && cd simple && nargo compile && cd ../with-deps && nargo compile && cd ../../ \ No newline at end of file diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index f8441d661c4..33aaa411771 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -30,9 +30,9 @@ "scripts": { "build": "webpack", "test": "yarn test:build_fixtures && yarn test:node", - "test:build_fixtures": "cd test/fixtures && cd simple && nargo compile && cd ../with-deps && nargo compile && cd ../../", - "test:node": "NODE_NO_WARNINGS=1 $(yarn bin mocha) --config ./.mocharc.json", - "clean": "rm -rf ./build ./target ./dist public/fixtures/simple/target public/fixtures/with-deps/target public/fixtures/noir-contract/target", + "test:build_fixtures": "./build-fixtures.sh", + "test:node": "NODE_NO_WARNINGS=1 mocha --config ./.mocharc.json", + "clean": "rm -rf ./build ./target ./dist public/fixtures/simple/target public/fixtures/with-deps/target", "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", "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0" @@ -45,6 +45,7 @@ "@types/chai": "^4", "@types/mocha": "^10.0.6", "@types/mocha-each": "^2", + "@types/node": "^20.10.5", "@types/path-browserify": "^1", "@types/readable-stream": "^4", "@types/sinon": "^17", @@ -53,7 +54,6 @@ "@web/test-runner": "^0.15.3", "@web/test-runner-playwright": "^0.10.0", "adm-zip": "^0.5.0", - "assert": "^2.1.0", "browserify-fs": "^1.0.0", "chai": "^4.3.10", "copy-webpack-plugin": "^11.0.0", @@ -61,7 +61,6 @@ "memfs": "^4.6.0", "mocha": "^10.2.0", "mocha-each": "^2.0.1", - "pako": "^2.1.0", "path-browserify": "^1.0.1", "process": "^0.11.10", "readable-stream": "^4.4.2", @@ -73,8 +72,5 @@ "url": "^0.11.3", "webpack": "^5.49.0", "webpack-cli": "^4.7.2" - }, - "dependencies": { - "@types/node": "^20.10.5" } } diff --git a/compiler/wasm/src/types/noir_package_config.ts b/compiler/wasm/src/types/noir_package_config.ts index b9be51f5686..5f07c380cf3 100644 --- a/compiler/wasm/src/types/noir_package_config.ts +++ b/compiler/wasm/src/types/noir_package_config.ts @@ -1,18 +1,18 @@ -type noirGitDependencySchema = { +type NoirGitDependencySchema = { git: string; tag: string; directory?: string; }; -type noirLocalDependencySchema = { +type NoirLocalDependencySchema = { path: string; }; -type noirPackageType = 'lib' | 'contract' | 'bin'; -type noirPackageConfigSchema = { +type NoirPackageType = 'lib' | 'contract' | 'bin'; +type NoirPackageConfigSchema = { package: { name: string; - type: noirPackageType; + type: NoirPackageType; entry?: string; description?: string; authors?: string[]; @@ -26,17 +26,17 @@ type noirPackageConfigSchema = { /** * Noir package configuration. */ -export type PackageConfig = noirPackageConfigSchema; +export type PackageConfig = NoirPackageConfigSchema; /** * A remote package dependency. */ -export type GitDependencyConfig = noirGitDependencySchema; +export type GitDependencyConfig = NoirGitDependencySchema; /** * A local package dependency. */ -export type LocalDependencyConfig = noirLocalDependencySchema; +export type LocalDependencyConfig = NoirLocalDependencySchema; /** * A package dependency. diff --git a/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts index 860582db0a9..086c76ad26a 100644 --- a/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts +++ b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts @@ -14,9 +14,8 @@ import { } from '../../src/noir/dependencies/github-dependency-resolver'; import { GitDependencyConfig } from '../../src/types/noir_package_config'; import Sinon, { SinonStub } from 'sinon'; -import { expect } from 'chai'; +import chai, { expect } from 'chai'; import forEach from 'mocha-each'; -import chai from 'chai'; import chaiAsPromised from 'chai-as-promised'; import AdmZip from 'adm-zip'; From 5cb08f3315838d40a8a3522a01464a5e9329d53a Mon Sep 17 00:00:00 2001 From: thunkar Date: Mon, 8 Jan 2024 12:59:48 +0000 Subject: [PATCH 23/37] Removed vscode settings --- .vscode/settings.json | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 8a942e92eb8..171d36f4e04 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,12 +18,5 @@ }, "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "jestrunner.projectPath": "./", - "jestrunner.debugOptions": { - "runtimeArgs": ["--experimental-vm-modules"], - "env": { - "NODE_NO_WARNINGS": 1 - } } } From 3cfdaada10225e20dc3078f950d3d37ce265baaf Mon Sep 17 00:00:00 2001 From: thunkar Date: Mon, 8 Jan 2024 16:16:42 +0000 Subject: [PATCH 24/37] Addressed feedback --- .github/workflows/test-js-packages.yml | 6 + .../circuits/deps_testing/Nargo.toml | 8 - .../circuits/deps_testing/src/main.nr | 12 - .../circuits/lib_with_module/Nargo.toml | 7 - .../circuits/lib_with_module/src/lib.nr | 1 - .../circuits/lib_with_module/src/module.nr | 1 - .../lib_with_module/src/module/foo.nr | 3 - .../scripts/codegen-verifiers.sh | 3 - .../test/browser/compile_prove_verify.test.ts | 8 +- .../test/browser/recursion.test.ts | 6 +- .../onchain_recursive_verification.test.ts | 4 +- .../test/node/smart_contract_verifier.test.ts | 2 +- compiler/integration-tests/test/shared.ts | 26 - compiler/wasm/.mocharc.json | 2 +- compiler/wasm/build-fixtures.sh | 2 +- compiler/wasm/package.json | 8 +- compiler/wasm/src/index.cts | 11 +- compiler/wasm/src/index.mts | 11 +- compiler/wasm/src/noir/noir-wasm-compiler.ts | 24 +- compiler/wasm/src/types/abi.ts | 33 - .../browser/compile_with_deps.test.ts | 13 +- .../compiler}/node/compile_with_deps.test.ts | 11 +- .../github-dependency-resolver.test.ts | 8 +- .../test/fixtures/deps/test_lib/Nargo.toml | 7 - .../test/fixtures/deps/test_lib/src/lib.nr | 1 - .../test/fixtures/deps/test_lib/src/module.nr | 1 - .../fixtures/deps/test_lib/src/module/foo.nr | 3 - compiler/wasm/test/shared.ts | 20 + compiler/wasm/test/wasm/browser/index.test.ts | 159 ++++ .../wasm/test/wasm/{ => node}/index.test.ts | 14 +- compiler/wasm/tsconfig.json | 5 +- compiler/wasm/web-test-runner.config.mjs | 25 + yarn.lock | 709 +++++++++++++++++- 33 files changed, 975 insertions(+), 179 deletions(-) delete mode 100644 compiler/integration-tests/circuits/deps_testing/Nargo.toml delete mode 100644 compiler/integration-tests/circuits/deps_testing/src/main.nr delete mode 100644 compiler/integration-tests/circuits/lib_with_module/Nargo.toml delete mode 100644 compiler/integration-tests/circuits/lib_with_module/src/lib.nr delete mode 100644 compiler/integration-tests/circuits/lib_with_module/src/module.nr delete mode 100644 compiler/integration-tests/circuits/lib_with_module/src/module/foo.nr delete mode 100644 compiler/integration-tests/test/shared.ts delete mode 100644 compiler/wasm/src/types/abi.ts rename compiler/{integration-tests/test => wasm/test/compiler}/browser/compile_with_deps.test.ts (73%) rename compiler/{integration-tests/test => wasm/test/compiler}/node/compile_with_deps.test.ts (69%) delete mode 100644 compiler/wasm/test/fixtures/deps/test_lib/Nargo.toml delete mode 100644 compiler/wasm/test/fixtures/deps/test_lib/src/lib.nr delete mode 100644 compiler/wasm/test/fixtures/deps/test_lib/src/module.nr delete mode 100644 compiler/wasm/test/fixtures/deps/test_lib/src/module/foo.nr create mode 100644 compiler/wasm/test/wasm/browser/index.test.ts rename compiler/wasm/test/wasm/{ => node}/index.test.ts (96%) create mode 100644 compiler/wasm/web-test-runner.config.mjs diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index 37e480cc21a..136349ffeee 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -318,9 +318,15 @@ jobs: - name: Build fixtures run: yarn workspace @noir-lang/noir_wasm test:build_fixtures + - name: Install Playwright + uses: ./.github/actions/install-playwright + - name: Run node tests run: yarn workspace @noir-lang/noir_wasm test:node + - name: Run browser tests + run: yarn workspace @noir-lang/noir_wasm test:browser + test-noir-codegen: needs: [build-acvm-js, build-noirc-abi, build-nargo] name: noir_codegen diff --git a/compiler/integration-tests/circuits/deps_testing/Nargo.toml b/compiler/integration-tests/circuits/deps_testing/Nargo.toml deleted file mode 100644 index 580fe0e28da..00000000000 --- a/compiler/integration-tests/circuits/deps_testing/Nargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "test" -authors = [""] -compiler_version = ">=0.18.0" -type = "contract" - -[dependencies] -test = { path = "../lib_with_module" } diff --git a/compiler/integration-tests/circuits/deps_testing/src/main.nr b/compiler/integration-tests/circuits/deps_testing/src/main.nr deleted file mode 100644 index b980af369cf..00000000000 --- a/compiler/integration-tests/circuits/deps_testing/src/main.nr +++ /dev/null @@ -1,12 +0,0 @@ -contract TestContract { - use dep::test::module::foo; - - fn constructor(param: Field, pub_param: pub Field) -> pub [Field; 2] { - [foo::bar(param), param + pub_param] - } - - open fn openFunction() -> pub Field { - 42 - } - -} diff --git a/compiler/integration-tests/circuits/lib_with_module/Nargo.toml b/compiler/integration-tests/circuits/lib_with_module/Nargo.toml deleted file mode 100644 index dafdb62e045..00000000000 --- a/compiler/integration-tests/circuits/lib_with_module/Nargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "lib_c" -authors = [""] -compiler_version = ">=0.18.0" -type = "lib" - -[dependencies] \ No newline at end of file diff --git a/compiler/integration-tests/circuits/lib_with_module/src/lib.nr b/compiler/integration-tests/circuits/lib_with_module/src/lib.nr deleted file mode 100644 index 5c0b5a621e0..00000000000 --- a/compiler/integration-tests/circuits/lib_with_module/src/lib.nr +++ /dev/null @@ -1 +0,0 @@ -mod module; \ No newline at end of file diff --git a/compiler/integration-tests/circuits/lib_with_module/src/module.nr b/compiler/integration-tests/circuits/lib_with_module/src/module.nr deleted file mode 100644 index 2746c97edf0..00000000000 --- a/compiler/integration-tests/circuits/lib_with_module/src/module.nr +++ /dev/null @@ -1 +0,0 @@ -mod foo; \ No newline at end of file diff --git a/compiler/integration-tests/circuits/lib_with_module/src/module/foo.nr b/compiler/integration-tests/circuits/lib_with_module/src/module/foo.nr deleted file mode 100644 index e0c82fb1960..00000000000 --- a/compiler/integration-tests/circuits/lib_with_module/src/module/foo.nr +++ /dev/null @@ -1,3 +0,0 @@ -pub fn bar(param: Field) -> Field { - dep::std::hash::pedersen_hash([param]) -} diff --git a/compiler/integration-tests/scripts/codegen-verifiers.sh b/compiler/integration-tests/scripts/codegen-verifiers.sh index 485b668cb98..577cc42b213 100644 --- a/compiler/integration-tests/scripts/codegen-verifiers.sh +++ b/compiler/integration-tests/scripts/codegen-verifiers.sh @@ -21,10 +21,7 @@ contracts_dir=$self_path/../contracts rm -rf $contracts_dir mkdir $contracts_dir -# Build dependency testing contract # Run codegen-verifier for recursion -dep_testing_dir=$repo_root/compiler/integration-tests/circuits/deps_testing -nargo --program-dir $dep_testing_dir compile cp $mul_dir/contract/1_mul/plonk_vk.sol $contracts_dir/1_mul.sol cp $assert_statement_dir/contract/assert_statement/plonk_vk.sol $contracts_dir/assert_statement.sol diff --git a/compiler/integration-tests/test/browser/compile_prove_verify.test.ts b/compiler/integration-tests/test/browser/compile_prove_verify.test.ts index 585179b2b99..0a829def09e 100644 --- a/compiler/integration-tests/test/browser/compile_prove_verify.test.ts +++ b/compiler/integration-tests/test/browser/compile_prove_verify.test.ts @@ -1,7 +1,7 @@ import { expect } from '@esm-bundle/chai'; import * as TOML from 'smol-toml'; -import { CompiledCircuit, compile, createFileManager } from '@noir-lang/noir_wasm'; +import { compile, createFileManager } from '@noir-lang/noir_wasm'; import { Noir } from '@noir-lang/noir_js'; import { InputMap } from '@noir-lang/noirc_abi'; import { BarretenbergBackend } from '@noir-lang/backend_barretenberg'; @@ -23,11 +23,11 @@ const suite = Mocha.Suite.create(mocha.suite, 'Noir end to end test'); suite.timeout(60 * 20e3); //20mins -async function getCircuit(projectPath: string): Promise { +async function getCircuit(projectPath: string) { const fm = createFileManager('/'); await fm.writeFile('./src/main.nr', await getFile(`${projectPath}/src/main.nr`)); await fm.writeFile('./Nargo.toml', await getFile(`${projectPath}/Nargo.toml`)); - const [result] = await compile(fm); + const result = await compile(fm); if (!('program' in result)) { throw new Error('Compilation failed'); } @@ -41,7 +41,7 @@ test_cases.forEach((testInfo) => { const base_relative_path = '../../../../..'; const test_case = testInfo.case; - let noir_program: CompiledCircuit; + let noir_program; try { noir_program = await getCircuit(`${base_relative_path}/${test_case}`); diff --git a/compiler/integration-tests/test/browser/recursion.test.ts b/compiler/integration-tests/test/browser/recursion.test.ts index 5504aeedd0f..83e8a4a9cc1 100644 --- a/compiler/integration-tests/test/browser/recursion.test.ts +++ b/compiler/integration-tests/test/browser/recursion.test.ts @@ -8,7 +8,7 @@ import * as TOML from 'smol-toml'; import { BarretenbergBackend } from '@noir-lang/backend_barretenberg'; import { getFile } from './utils.js'; import { Field, InputMap } from '@noir-lang/noirc_abi'; -import { CompiledCircuit, createFileManager, compile } from '@noir-lang/noir_wasm'; +import { createFileManager, compile } from '@noir-lang/noir_wasm'; const logger = new Logger({ name: 'test', minLevel: TEST_LOG_LEVEL }); @@ -22,11 +22,11 @@ const base_relative_path = '../../../../..'; const circuit_main = 'test_programs/execution_success/assert_statement'; const circuit_recursion = 'compiler/integration-tests/circuits/recursion'; -async function getCircuit(projectPath: string): Promise { +async function getCircuit(projectPath: string) { const fm = createFileManager('/'); await fm.writeFile('./src/main.nr', await getFile(`${projectPath}/src/main.nr`)); await fm.writeFile('./Nargo.toml', await getFile(`${projectPath}/Nargo.toml`)); - const [result] = await compile(fm); + const result = await compile(fm); if (!('program' in result)) { throw new Error('Compilation failed'); } diff --git a/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts b/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts index dd797e808cb..3b874b42f40 100644 --- a/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts +++ b/compiler/integration-tests/test/node/onchain_recursive_verification.test.ts @@ -14,7 +14,7 @@ import { compile, createFileManager } from '@noir-lang/noir_wasm'; it(`smart contract can verify a recursive proof`, async () => { const basePath = resolve(join(__dirname, '../../../../')); const fm = createFileManager(basePath); - const [innerCompilationResult] = await compile( + const innerCompilationResult = await compile( fm, join(basePath, './test_programs/execution_success/assert_statement'), ); @@ -23,7 +23,7 @@ it(`smart contract can verify a recursive proof`, async () => { } const innerProgram = innerCompilationResult.program; - const [recursionCompilationResult] = await compile( + const recursionCompilationResult = await compile( fm, join(basePath, './compiler/integration-tests/circuits/recursion'), ); diff --git a/compiler/integration-tests/test/node/smart_contract_verifier.test.ts b/compiler/integration-tests/test/node/smart_contract_verifier.test.ts index 8fcea352e4c..ee11d1fe2a6 100644 --- a/compiler/integration-tests/test/node/smart_contract_verifier.test.ts +++ b/compiler/integration-tests/test/node/smart_contract_verifier.test.ts @@ -31,7 +31,7 @@ test_cases.forEach((testInfo) => { const test_case = testInfo.case; const fm = createFileManager(resolve(`${base_relative_path}/${test_case}`)); - const [compileResult] = await compile(fm); + const compileResult = await compile(fm); if (!('program' in compileResult)) { throw new Error('Compilation failed'); } diff --git a/compiler/integration-tests/test/shared.ts b/compiler/integration-tests/test/shared.ts deleted file mode 100644 index 8980d979f19..00000000000 --- a/compiler/integration-tests/test/shared.ts +++ /dev/null @@ -1,26 +0,0 @@ -export function getPaths(basePath: string) { - const fixtures = `${basePath}/circuits`; - - const libProjectPath = `${fixtures}/lib_with_module`; - const libSourcePath = `${libProjectPath}/src/lib.nr`; - const libModulePath = `${libProjectPath}/src/module.nr`; - const libModuleSourcePath = `${libProjectPath}/src/module/foo.nr`; - const libTOMLPath = `${libProjectPath}/Nargo.toml`; - - const contractProjectPath = `${fixtures}/deps_testing`; - const contractSourcePath = `${contractProjectPath}/src/main.nr`; - const contractTOMLPath = `${contractProjectPath}/Nargo.toml`; - const contractExpectedArtifact = `${contractProjectPath}/target/test-TestContract.json`; - - return { - libProjectPath, - libSourcePath, - libModulePath, - libModuleSourcePath, - libTOMLPath, - contractProjectPath, - contractSourcePath, - contractTOMLPath, - contractExpectedArtifact, - }; -} diff --git a/compiler/wasm/.mocharc.json b/compiler/wasm/.mocharc.json index 44162fd7632..8009c66f9a8 100644 --- a/compiler/wasm/.mocharc.json +++ b/compiler/wasm/.mocharc.json @@ -4,7 +4,7 @@ "ts" ], "spec": [ - "**/!(browser)/*.test.ts" + "./test/**/!(browser)/*.test.ts" ], "node-option": [ "loader=ts-node" diff --git a/compiler/wasm/build-fixtures.sh b/compiler/wasm/build-fixtures.sh index 8b4e4e2abee..cb3d465fcbb 100755 --- a/compiler/wasm/build-fixtures.sh +++ b/compiler/wasm/build-fixtures.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -cd test/fixtures && cd simple && nargo compile && cd ../with-deps && nargo compile && cd ../../ \ No newline at end of file +cd test/fixtures && cd simple && nargo compile && cd ../with-deps && nargo compile && cd ../noir-contract && nargo compile && cd ../../ \ No newline at end of file diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index 33aaa411771..cd84e4d0cb7 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -29,8 +29,9 @@ }, "scripts": { "build": "webpack", - "test": "yarn test:build_fixtures && yarn test:node", + "test": "yarn test:build_fixtures && yarn test:node && yarn test:browser", "test:build_fixtures": "./build-fixtures.sh", + "test:browser": "web-test-runner", "test:node": "NODE_NO_WARNINGS=1 mocha --config ./.mocharc.json", "clean": "rm -rf ./build ./target ./dist public/fixtures/simple/target public/fixtures/with-deps/target", "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", @@ -51,9 +52,10 @@ "@types/sinon": "^17", "@wasm-tool/wasm-pack-plugin": "^1.7.0", "@web/dev-server-esbuild": "^0.3.6", - "@web/test-runner": "^0.15.3", - "@web/test-runner-playwright": "^0.10.0", + "@web/test-runner": "^0.18.0", + "@web/test-runner-playwright": "^0.11.0", "adm-zip": "^0.5.0", + "assert": "^2.1.0", "browserify-fs": "^1.0.0", "chai": "^4.3.10", "copy-webpack-plugin": "^11.0.0", diff --git a/compiler/wasm/src/index.cts b/compiler/wasm/src/index.cts index ed26bc5e553..31d169e8268 100644 --- a/compiler/wasm/src/index.cts +++ b/compiler/wasm/src/index.cts @@ -2,9 +2,14 @@ import { FileManager } from './noir/file-manager/file-manager'; import { createNodejsFileManager } from './noir/file-manager/nodejs-file-manager'; import { NoirWasmCompiler } from './noir/noir-wasm-compiler'; import { LogData, LogFn } from './utils'; -import { CompiledCircuit } from './types/noir_artifact'; +import { CompilationResult } from './types/noir_artifact'; -async function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn, debugLogFn?: LogFn) { +async function compile( + fileManager: FileManager, + projectPath?: string, + logFn?: LogFn, + debugLogFn?: LogFn, +): Promise { if (logFn && !debugLogFn) { debugLogFn = logFn; } @@ -41,4 +46,4 @@ async function compile(fileManager: FileManager, projectPath?: string, logFn?: L const createFileManager = createNodejsFileManager; -export { compile, createFileManager, CompiledCircuit }; +export { compile, createFileManager, CompilationResult }; diff --git a/compiler/wasm/src/index.mts b/compiler/wasm/src/index.mts index 4c220437dcd..6340e2dc37a 100644 --- a/compiler/wasm/src/index.mts +++ b/compiler/wasm/src/index.mts @@ -2,9 +2,14 @@ import { FileManager } from './noir/file-manager/file-manager'; import { createNodejsFileManager } from './noir/file-manager/nodejs-file-manager'; import { NoirWasmCompiler } from './noir/noir-wasm-compiler'; import { LogData, LogFn } from './utils'; -import { CompiledCircuit } from './types/noir_artifact'; +import { CompilationResult } from './types/noir_artifact'; -async function compile(fileManager: FileManager, projectPath?: string, logFn?: LogFn, debugLogFn?: LogFn) { +async function compile( + fileManager: FileManager, + projectPath?: string, + logFn?: LogFn, + debugLogFn?: LogFn, +): Promise { if (logFn && !debugLogFn) { debugLogFn = logFn; } @@ -43,4 +48,4 @@ async function compile(fileManager: FileManager, projectPath?: string, logFn?: L const createFileManager = createNodejsFileManager; -export { compile, createFileManager, CompiledCircuit }; +export { compile, createFileManager, CompilationResult }; diff --git a/compiler/wasm/src/noir/noir-wasm-compiler.ts b/compiler/wasm/src/noir/noir-wasm-compiler.ts index f0541549a19..2a0af5d8fee 100644 --- a/compiler/wasm/src/noir/noir-wasm-compiler.ts +++ b/compiler/wasm/src/noir/noir-wasm-compiler.ts @@ -87,14 +87,11 @@ export class NoirWasmCompiler { /** * Compile EntryPoint */ - public async compile(): Promise { + public async compile(): Promise { console.log(`Compiling at ${this.#package.getEntryPointPath()}`); if (!(this.#package.getType() === 'contract' || this.#package.getType() === 'bin')) { - this.#log( - `Compile skipped - only supports compiling "contract" and "bin" package types (${this.#package.getType()})`, - ); - return []; + throw new Error(`Only supports compiling "contract" and "bin" package types (${this.#package.getType()})`); } await this.#dependencyManager.resolveDependencies(); this.#debugLog(`Dependencies: ${this.#dependencyManager.getPackageNames().join(', ')}`); @@ -127,11 +124,14 @@ export class NoirWasmCompiler { throw new Error('Invalid compilation result'); } - return [result]; + return result; } catch (err) { if (err instanceof Error && err.name === 'CompileError') { - await this.#processCompileError(err); - throw new Error('Compilation failed'); + const logs = await this.#processCompileError(err); + for (const log of logs) { + this.#log(log); + } + throw new Error(logs.join('\n')); } throw err; @@ -148,9 +148,10 @@ export class NoirWasmCompiler { } // eslint-disable-next-line @typescript-eslint/no-explicit-any - async #processCompileError(err: any): Promise { + async #processCompileError(err: any): Promise { + const logs = []; for (const diag of err.diagnostics) { - this.#log(` ${diag.message}`); + logs.push(` ${diag.message}`); const contents = await this.#resolveFile(diag.file); const lines = contents.split('\n'); const lineOffsets = lines.reduce((accum, _, idx) => { @@ -164,8 +165,9 @@ export class NoirWasmCompiler { for (const secondary of diag.secondaries) { const errorLine = lineOffsets.findIndex((offset) => offset > secondary.start); - this.#log(` ${diag.file}:${errorLine}: ${contents.slice(secondary.start, secondary.end)}`); + logs.push(` ${diag.file}:${errorLine}: ${contents.slice(secondary.start, secondary.end)}`); } } + return logs; } } diff --git a/compiler/wasm/src/types/abi.ts b/compiler/wasm/src/types/abi.ts deleted file mode 100644 index 7c20693db8a..00000000000 --- a/compiler/wasm/src/types/abi.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { AbiType } from '@noir-lang/noirc_abi'; - -/** - * A named type. - */ -export interface ABIVariable { - /** - * The name of the variable. - */ - name: string; - /** - * The type of the variable. - */ - type: AbiType; -} - -/** - * A contract event. - */ -export interface EventAbi { - /** - * The event name. - */ - name: string; - /** - * Fully qualified name of the event. - */ - path: string; - /** - * The fields of the event. - */ - fields: ABIVariable[]; -} diff --git a/compiler/integration-tests/test/browser/compile_with_deps.test.ts b/compiler/wasm/test/compiler/browser/compile_with_deps.test.ts similarity index 73% rename from compiler/integration-tests/test/browser/compile_with_deps.test.ts rename to compiler/wasm/test/compiler/browser/compile_with_deps.test.ts index bd728a324a4..e8d047b74e9 100644 --- a/compiler/integration-tests/test/browser/compile_with_deps.test.ts +++ b/compiler/wasm/test/compiler/browser/compile_with_deps.test.ts @@ -1,10 +1,14 @@ -import { compile, createFileManager } from '@noir-lang/noir_wasm'; -import { getPaths } from '../shared'; +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { getPaths } from '../../shared'; import { expect } from '@esm-bundle/chai'; +// @ts-ignore +import { compile, createFileManager } from '../../../dist/web/main'; +import { CompilationResult, CompiledContract } from '../../../src/types/noir_artifact'; const paths = getPaths('.'); async function getFile(path: string) { + // @ts-ignore const basePath = new URL('./../../', import.meta.url).toString().replace(/\/$/g, ''); const url = `${basePath}${path.replace('.', '')}`; const response = await fetch(url); @@ -24,11 +28,12 @@ describe('noir-compiler', () => { const fm = createFileManager('/'); const files = Object.values(paths).filter((fileOrDir) => /^\.?\/.*\..*$/.test(fileOrDir)); for (const path of files) { + console.log(path); await fm.writeFile(path, (await getFile(path)).body as ReadableStream); } - const nargoArtifact = await getPrecompiledSource(contractExpectedArtifact); + const nargoArtifact = (await getPrecompiledSource(contractExpectedArtifact)) as CompiledContract; nargoArtifact.functions.sort((a, b) => a.name.localeCompare(b.name)); - const [noirWasmArtifact] = await compile(fm, '/circuits/deps_testing'); + const noirWasmArtifact = (await compile(fm, '/fixtures/noir-contract')) as CompilationResult; if (!('contract' in noirWasmArtifact)) { throw new Error('Compilation failed'); } diff --git a/compiler/integration-tests/test/node/compile_with_deps.test.ts b/compiler/wasm/test/compiler/node/compile_with_deps.test.ts similarity index 69% rename from compiler/integration-tests/test/node/compile_with_deps.test.ts rename to compiler/wasm/test/compiler/node/compile_with_deps.test.ts index 1f26de968ea..7eedc723f7b 100644 --- a/compiler/integration-tests/test/node/compile_with_deps.test.ts +++ b/compiler/wasm/test/compiler/node/compile_with_deps.test.ts @@ -1,9 +1,12 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ import { join, resolve } from 'path'; -import { getPaths } from '../shared'; +import { getPaths } from '../../shared'; import { expect } from 'chai'; import { readFile } from 'fs/promises'; -import { compile, createFileManager } from '@noir-lang/noir_wasm'; +// @ts-ignore +import { compile, createFileManager } from '../../../dist/node/main'; +import { CompilationResult, CompiledContract } from '../../../src/types/noir_artifact'; const basePath = resolve(join(__dirname, '../../')); const { contractProjectPath, contractExpectedArtifact } = getPaths(basePath); @@ -11,9 +14,9 @@ const { contractProjectPath, contractExpectedArtifact } = getPaths(basePath); describe('noir-compiler', () => { it('both nargo and noir_wasm should compile identically', async () => { const fm = createFileManager(contractProjectPath); - const nargoArtifact = JSON.parse((await readFile(contractExpectedArtifact)).toString()); + const nargoArtifact = JSON.parse((await readFile(contractExpectedArtifact)).toString()) as CompiledContract; nargoArtifact.functions.sort((a, b) => a.name.localeCompare(b.name)); - const [noirWasmArtifact] = await compile(fm); + const noirWasmArtifact = (await compile(fm)) as CompilationResult; if (!('contract' in noirWasmArtifact)) { throw new Error('Compilation failed'); } diff --git a/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts index 086c76ad26a..e7fae8afe8e 100644 --- a/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts +++ b/compiler/wasm/test/dependencies/github-dependency-resolver.test.ts @@ -42,7 +42,7 @@ describe('GithubDependencyResolver', () => { pkg = new Package('/test_contract', '/test_contract/src', { dependencies: { // eslint-disable-next-line camelcase - test_lib: libDependency, + lib_c: libDependency, }, package: { name: 'test_contract', @@ -62,7 +62,7 @@ describe('GithubDependencyResolver', () => { it("returns null if it can't resolve a dependency", async () => { const dep = await resolver.resolveDependency(pkg, { - path: '/test_lib', + path: '/lib-c', }); expect(dep).to.be.null; @@ -70,9 +70,9 @@ describe('GithubDependencyResolver', () => { it('resolves Github dependency', async () => { const zip = new AdmZip(); - const testLibPath = join(fixtures, 'deps', 'test_lib'); + const testLibPath = join(fixtures, 'deps', 'lib-c'); for (const filePath of await readdirRecursive(testLibPath)) { - zip.addLocalFile(filePath, dirname(filePath.replace(testLibPath, 'test_lib'))); + zip.addLocalFile(filePath, dirname(filePath.replace(testLibPath, 'lib-c'))); } fetchStub?.onCall(0).returns(new Response(zip.toBuffer(), { status: 200 })); diff --git a/compiler/wasm/test/fixtures/deps/test_lib/Nargo.toml b/compiler/wasm/test/fixtures/deps/test_lib/Nargo.toml deleted file mode 100644 index f300a1a98a3..00000000000 --- a/compiler/wasm/test/fixtures/deps/test_lib/Nargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "testlib" -authors = [""] -compiler_version = "0.1" -type = "lib" - -[dependencies] \ No newline at end of file diff --git a/compiler/wasm/test/fixtures/deps/test_lib/src/lib.nr b/compiler/wasm/test/fixtures/deps/test_lib/src/lib.nr deleted file mode 100644 index 5c0b5a621e0..00000000000 --- a/compiler/wasm/test/fixtures/deps/test_lib/src/lib.nr +++ /dev/null @@ -1 +0,0 @@ -mod module; \ No newline at end of file diff --git a/compiler/wasm/test/fixtures/deps/test_lib/src/module.nr b/compiler/wasm/test/fixtures/deps/test_lib/src/module.nr deleted file mode 100644 index 2746c97edf0..00000000000 --- a/compiler/wasm/test/fixtures/deps/test_lib/src/module.nr +++ /dev/null @@ -1 +0,0 @@ -mod foo; \ No newline at end of file diff --git a/compiler/wasm/test/fixtures/deps/test_lib/src/module/foo.nr b/compiler/wasm/test/fixtures/deps/test_lib/src/module/foo.nr deleted file mode 100644 index 61316bc9280..00000000000 --- a/compiler/wasm/test/fixtures/deps/test_lib/src/module/foo.nr +++ /dev/null @@ -1,3 +0,0 @@ -fn bar(param: Field) -> Field { - dep::std::hash::pedersen([param])[0] -} \ No newline at end of file diff --git a/compiler/wasm/test/shared.ts b/compiler/wasm/test/shared.ts index 6b9274f4765..9181919ff39 100644 --- a/compiler/wasm/test/shared.ts +++ b/compiler/wasm/test/shared.ts @@ -10,6 +10,17 @@ export function getPaths(basePath: string) { const libASourcePath = `${fixtures}/deps/lib-a/src/lib.nr`; const libBSourcePath = `${fixtures}/deps/lib-b/src/lib.nr`; + const contractProjectPath = `${fixtures}/noir-contract`; + const contractSourcePath = `${contractProjectPath}/src/main.nr`; + const contractTOMLPath = `${contractProjectPath}/Nargo.toml`; + const contractExpectedArtifact = `${contractProjectPath}/target/test-TestContract.json`; + + const libCProjectPath = `${fixtures}/deps/lib-c`; + const libCSourcePath = `${libCProjectPath}/src/lib.nr`; + const libCModulePath = `${libCProjectPath}/src/module.nr`; + const libCModuleSourcePath = `${libCProjectPath}/src/module/foo.nr`; + const libCTOMLPath = `${libCProjectPath}/Nargo.toml`; + return { simpleScriptSourcePath, simpleScriptExpectedArtifact, @@ -17,5 +28,14 @@ export function getPaths(basePath: string) { depsScriptExpectedArtifact, libASourcePath, libBSourcePath, + contractProjectPath, + contractSourcePath, + contractTOMLPath, + contractExpectedArtifact, + libCProjectPath, + libCSourcePath, + libCModulePath, + libCModuleSourcePath, + libCTOMLPath, }; } diff --git a/compiler/wasm/test/wasm/browser/index.test.ts b/compiler/wasm/test/wasm/browser/index.test.ts new file mode 100644 index 00000000000..a3c86db897c --- /dev/null +++ b/compiler/wasm/test/wasm/browser/index.test.ts @@ -0,0 +1,159 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { getPaths } from '../../shared'; +import { expect } from '@esm-bundle/chai'; + +import init, { compile, PathToFileSourceMap, compile_, CompilerContext } from '../../../build/esm'; + +// @ts-ignore +await init(); + +const { + simpleScriptSourcePath, + simpleScriptExpectedArtifact, + depsScriptSourcePath, + depsScriptExpectedArtifact, + libASourcePath, + libBSourcePath, +} = getPaths('.'); + +async function getFileAsString(path: string) { + // @ts-ignore + const basePath = new URL('./../../', import.meta.url).toString().replace(/\/$/g, ''); + const url = `${basePath}${path.replace('.', '')}`; + const response = await fetch(url); + return response.text(); +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +async function getPrecompiledSource(path: string): Promise { + const response = await getFileAsString(path); + return JSON.parse(response); +} + +describe('noir wasm compilation', () => { + describe('can compile simple scripts', () => { + it('matching nargos compilation', async () => { + const sourceMap = new PathToFileSourceMap(); + sourceMap.add_source_code('script/main.nr', await getFileAsString(simpleScriptSourcePath)); + const wasmCircuit = compile('script/main.nr', undefined, undefined, sourceMap); + const cliCircuit = await getPrecompiledSource(simpleScriptExpectedArtifact); + + if (!('program' in wasmCircuit)) { + throw Error('Expected program to be present'); + } + + // We don't expect the hashes to match due to how `noir_wasm` handles dependencies + expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); + expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); + expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); + }); + }).timeout(20 * 10e3); + + describe('can compile scripts with dependencies', () => { + const sourceMap = new PathToFileSourceMap(); + beforeEach(async () => { + sourceMap.add_source_code('script/main.nr', await getFileAsString(depsScriptSourcePath)); + sourceMap.add_source_code('lib_a/lib.nr', await getFileAsString(libASourcePath)); + sourceMap.add_source_code('lib_b/lib.nr', await getFileAsString(libBSourcePath)); + }); + + it('matching nargos compilation', async () => { + const wasmCircuit = compile( + 'script/main.nr', + false, + { + root_dependencies: ['lib_a'], + library_dependencies: { + lib_a: ['lib_b'], + }, + }, + sourceMap, + ); + + const cliCircuit = await getPrecompiledSource(depsScriptExpectedArtifact); + + if (!('program' in wasmCircuit)) { + throw Error('Expected program to be present'); + } + + // We don't expect the hashes to match due to how `noir_wasm` handles dependencies + expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); + expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); + expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); + }); + }).timeout(20 * 10e3); + + describe('can compile scripts with dependencies -- context-api', () => { + let sourceMap: PathToFileSourceMap; + beforeEach(async () => { + sourceMap = new PathToFileSourceMap(); + sourceMap.add_source_code('script/main.nr', await getFileAsString(depsScriptSourcePath)); + sourceMap.add_source_code('lib_a/lib.nr', await getFileAsString(libASourcePath)); + sourceMap.add_source_code('lib_b/lib.nr', await getFileAsString(libBSourcePath)); + }); + + it('matching nargos compilation - context-api', async () => { + const compilerContext = new CompilerContext(sourceMap); + + // Process root crate + const root_crate_id = compilerContext.process_root_crate('script/main.nr'); + // Process dependencies + // + // This can be direct dependencies or transitive dependencies + // I have named these crate_id_1 and crate_id_2 instead of `lib_a_crate_id` and `lib_b_crate_id` + // because the names of crates in a dependency graph are not determined by the actual package. + // + // It is true that each package is given a name, but if I include a `lib_a` as a dependency + // in my library, I do not need to refer to it as `lib_a` in my dependency graph. + // See https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml + // + // If you have looked at graphs before, then you can think of the dependency graph as a directed acyclic graph (DAG) + const crate_id_1 = compilerContext.process_dependency_crate('lib_a/lib.nr'); + const crate_id_2 = compilerContext.process_dependency_crate('lib_b/lib.nr'); + + // Root crate depends on `crate_id_1` and this edge is called `lib_a` + compilerContext.add_dependency_edge('lib_a', root_crate_id, crate_id_1); + // `crate_id_1` depends on `crate_id_2` and this edge is called `lib_b` + compilerContext.add_dependency_edge('lib_b', crate_id_1, crate_id_2); + + const program_width = 3; + const wasmCircuit = await compilerContext.compile_program(program_width); + + const cliCircuit = await getPrecompiledSource(depsScriptExpectedArtifact); + + if (!('program' in wasmCircuit)) { + throw Error('Expected program to be present'); + } + + // We don't expect the hashes to match due to how `noir_wasm` handles dependencies + expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); + expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); + expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); + }).timeout(20 * 10e3); + + it('matching nargos compilation - context-implementation-compile-api', async () => { + const wasmCircuit = await compile_( + 'script/main.nr', + false, + { + root_dependencies: ['lib_a'], + library_dependencies: { + lib_a: ['lib_b'], + }, + }, + sourceMap, + ); + + const cliCircuit = await getPrecompiledSource(depsScriptExpectedArtifact); + + if (!('program' in wasmCircuit)) { + throw Error('Expected program to be present'); + } + + // We don't expect the hashes to match due to how `noir_wasm` handles dependencies + expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); + expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); + expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); + }).timeout(20 * 10e3); + }); +}); diff --git a/compiler/wasm/test/wasm/index.test.ts b/compiler/wasm/test/wasm/node/index.test.ts similarity index 96% rename from compiler/wasm/test/wasm/index.test.ts rename to compiler/wasm/test/wasm/node/index.test.ts index 09ee971d2d2..0bb272ec526 100644 --- a/compiler/wasm/test/wasm/index.test.ts +++ b/compiler/wasm/test/wasm/node/index.test.ts @@ -1,11 +1,11 @@ -import { getPaths } from '../shared'; +import { getPaths } from '../../shared'; import { readFileSync } from 'fs'; import { join, resolve } from 'path'; import { expect } from 'chai'; -import { compile, PathToFileSourceMap, compile_, CompilerContext } from '../../build/cjs'; +import { compile, PathToFileSourceMap, compile_, CompilerContext } from '../../../build/cjs'; -const basePath = resolve(join(__dirname, '../')); +const basePath = resolve(join(__dirname, '../../')); const { simpleScriptSourcePath, simpleScriptExpectedArtifact, @@ -38,7 +38,7 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); }); - }).timeout(10e3); + }).timeout(20 * 10e3); describe('can compile scripts with dependencies', () => { const sourceMap = new PathToFileSourceMap(); @@ -72,7 +72,7 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); }); - }).timeout(10e3); + }).timeout(20 * 10e3); describe('can compile scripts with dependencies -- context-api', () => { let sourceMap: PathToFileSourceMap; @@ -120,7 +120,7 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); - }).timeout(10e3); + }).timeout(20 * 10e3); it('matching nargos compilation - context-implementation-compile-api', async () => { const wasmCircuit = await compile_( @@ -145,6 +145,6 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); - }).timeout(10e3); + }).timeout(20 * 10e3); }); }); diff --git a/compiler/wasm/tsconfig.json b/compiler/wasm/tsconfig.json index f849c520e6f..f4dda845fdf 100644 --- a/compiler/wasm/tsconfig.json +++ b/compiler/wasm/tsconfig.json @@ -14,6 +14,9 @@ "esModuleInterop": true, "target": "ESNext", "module": "CommonJS", - "moduleResolution": "Node" + "moduleResolution": "Node", + "paths": { + "@noir-lang/noir_wasm/*": ["./*"], + } } } \ No newline at end of file diff --git a/compiler/wasm/web-test-runner.config.mjs b/compiler/wasm/web-test-runner.config.mjs new file mode 100644 index 00000000000..e8e31ab2b57 --- /dev/null +++ b/compiler/wasm/web-test-runner.config.mjs @@ -0,0 +1,25 @@ +import { defaultReporter } from '@web/test-runner'; +import { summaryReporter } from '@web/test-runner'; +import { fileURLToPath } from 'url'; +import { esbuildPlugin } from '@web/dev-server-esbuild'; +import { playwrightLauncher } from '@web/test-runner-playwright'; + +const reporter = process.env.CI ? summaryReporter() : defaultReporter(); + +export default { + browsers: [ + playwrightLauncher({ product: 'chromium' }), + // playwrightLauncher({ product: "webkit" }), + // playwrightLauncher({ product: "firefox" }), + ], + plugins: [ + esbuildPlugin({ + ts: true, + }), + ], + files: ['./test/**/browser/*.test.ts'], + nodeResolve: true, + rootDir: fileURLToPath(new URL('./../../', import.meta.url)), + reporters: [reporter], + debug: true, +}; diff --git a/yarn.lock b/yarn.lock index 7a76ca89da9..50177c2c23d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4067,8 +4067,8 @@ __metadata: "@types/sinon": ^17 "@wasm-tool/wasm-pack-plugin": ^1.7.0 "@web/dev-server-esbuild": ^0.3.6 - "@web/test-runner": ^0.15.3 - "@web/test-runner-playwright": ^0.10.0 + "@web/test-runner": ^0.18.0 + "@web/test-runner-playwright": ^0.11.0 adm-zip: ^0.5.0 assert: ^2.1.0 browserify-fs: ^1.0.0 @@ -4078,7 +4078,6 @@ __metadata: memfs: ^4.6.0 mocha: ^10.2.0 mocha-each: ^2.0.1 - pako: ^2.1.0 path-browserify: ^1.0.1 process: ^0.11.10 readable-stream: ^4.4.2 @@ -4555,6 +4554,28 @@ __metadata: languageName: node linkType: hard +"@puppeteer/browsers@npm:1.4.6": + version: 1.4.6 + resolution: "@puppeteer/browsers@npm:1.4.6" + dependencies: + debug: 4.3.4 + extract-zip: 2.0.1 + progress: 2.0.3 + proxy-agent: 6.3.0 + tar-fs: 3.0.4 + unbzip2-stream: 1.4.3 + yargs: 17.7.1 + peerDependencies: + typescript: ">= 4.7.4" + peerDependenciesMeta: + typescript: + optional: true + bin: + browsers: lib/cjs/main-cli.js + checksum: 29569dd8a8a41737bb0dd40cce6279cfc8764afc6242d2f9d8ae610bed7e466fc77eeb27b9b3ac53dd04927a1a0e26389f282f6ba057210979b36ab455009d64 + languageName: node + linkType: hard + "@rollup/plugin-node-resolve@npm:^13.0.4": version: 13.3.0 resolution: "@rollup/plugin-node-resolve@npm:13.3.0" @@ -4571,6 +4592,25 @@ __metadata: languageName: node linkType: hard +"@rollup/plugin-node-resolve@npm:^15.0.1": + version: 15.2.3 + resolution: "@rollup/plugin-node-resolve@npm:15.2.3" + dependencies: + "@rollup/pluginutils": ^5.0.1 + "@types/resolve": 1.20.2 + deepmerge: ^4.2.2 + is-builtin-module: ^3.2.1 + is-module: ^1.0.0 + resolve: ^1.22.1 + peerDependencies: + rollup: ^2.78.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + checksum: 730f32c2f8fdddff07cf0fca86a5dac7c475605fb96930197a868c066e62eb6388c557545e4f7d99b7a283411754c9fbf98944ab086b6074e04fc1292e234aa8 + languageName: node + linkType: hard + "@rollup/pluginutils@npm:^3.1.0": version: 3.1.0 resolution: "@rollup/pluginutils@npm:3.1.0" @@ -4584,6 +4624,113 @@ __metadata: languageName: node linkType: hard +"@rollup/pluginutils@npm:^5.0.1": + version: 5.1.0 + resolution: "@rollup/pluginutils@npm:5.1.0" + dependencies: + "@types/estree": ^1.0.0 + estree-walker: ^2.0.2 + picomatch: ^2.3.1 + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + checksum: 3cc5a6d91452a6eabbfd1ae79b4dd1f1e809d2eecda6e175deb784e75b0911f47e9ecce73f8dd315d6a8b3f362582c91d3c0f66908b6ced69345b3cbe28f8ce8 + languageName: node + linkType: hard + +"@rollup/rollup-android-arm-eabi@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-android-arm-eabi@npm:4.9.4" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@rollup/rollup-android-arm64@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-android-arm64@npm:4.9.4" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-darwin-arm64@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-darwin-arm64@npm:4.9.4" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-darwin-x64@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-darwin-x64@npm:4.9.4" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm-gnueabihf@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.9.4" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm64-gnu@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.9.4" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm64-musl@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-linux-arm64-musl@npm:4.9.4" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-linux-riscv64-gnu@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.9.4" + conditions: os=linux & cpu=riscv64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-x64-gnu@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-linux-x64-gnu@npm:4.9.4" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-x64-musl@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-linux-x64-musl@npm:4.9.4" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-win32-arm64-msvc@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.9.4" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-win32-ia32-msvc@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.9.4" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@rollup/rollup-win32-x64-msvc@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-win32-x64-msvc@npm:4.9.4" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@scure/base@npm:~1.1.0": version: 1.1.3 resolution: "@scure/base@npm:1.1.3" @@ -5016,6 +5163,13 @@ __metadata: languageName: node linkType: hard +"@tootallnate/quickjs-emscripten@npm:^0.23.0": + version: 0.23.0 + resolution: "@tootallnate/quickjs-emscripten@npm:0.23.0" + checksum: c350a2947ffb80b22e14ff35099fd582d1340d65723384a0fd0515e905e2534459ad2f301a43279a37308a27c99273c932e64649abd57d0bb3ca8c557150eccc + languageName: node + linkType: hard + "@trysound/sax@npm:0.2.0": version: 0.2.0 resolution: "@trysound/sax@npm:0.2.0" @@ -5245,7 +5399,7 @@ __metadata: languageName: node linkType: hard -"@types/estree@npm:*, @types/estree@npm:^1.0.0": +"@types/estree@npm:*, @types/estree@npm:1.0.5, @types/estree@npm:^1.0.0": version: 1.0.5 resolution: "@types/estree@npm:1.0.5" checksum: dd8b5bed28e6213b7acd0fb665a84e693554d850b0df423ac8076cc3ad5823a6bc26b0251d080bdc545af83179ede51dd3f6fa78cad2c46ed1f29624ddf3e41a @@ -5734,6 +5888,13 @@ __metadata: languageName: node linkType: hard +"@types/resolve@npm:1.20.2": + version: 1.20.2 + resolution: "@types/resolve@npm:1.20.2" + checksum: 61c2cad2499ffc8eab36e3b773945d337d848d3ac6b7b0a87c805ba814bc838ef2f262fc0f109bfd8d2e0898ff8bd80ad1025f9ff64f1f71d3d4294c9f14e5f6 + languageName: node + linkType: hard + "@types/responselike@npm:^1.0.0": version: 1.0.3 resolution: "@types/responselike@npm:1.0.3" @@ -6060,6 +6221,15 @@ __metadata: languageName: node linkType: hard +"@web/browser-logs@npm:^0.4.0": + version: 0.4.0 + resolution: "@web/browser-logs@npm:0.4.0" + dependencies: + errorstacks: ^2.2.0 + checksum: 65c6c4312b1ff00ff40fd15c07708f5e113bb8b4f87c972356010546a0664287dd4f64c5475f8be27b6abb29b9272ecc4162aada90ffb732f1779ceec5fd8ad6 + languageName: node + linkType: hard + "@web/config-loader@npm:^0.1.3": version: 0.1.3 resolution: "@web/config-loader@npm:0.1.3" @@ -6069,6 +6239,13 @@ __metadata: languageName: node linkType: hard +"@web/config-loader@npm:^0.3.0": + version: 0.3.1 + resolution: "@web/config-loader@npm:0.3.1" + checksum: 3ff87dc5cf44a98be97477b1d4c36673d282e7567b61e554aff56f8674a187938c51cd8045f868ca5f4b6ff4d52c72fbbc176c26f27df4335f2341d105d2b535 + languageName: node + linkType: hard + "@web/dev-server-core@npm:^0.4.1": version: 0.4.1 resolution: "@web/dev-server-core@npm:0.4.1" @@ -6121,6 +6298,32 @@ __metadata: languageName: node linkType: hard +"@web/dev-server-core@npm:^0.7.0": + version: 0.7.0 + resolution: "@web/dev-server-core@npm:0.7.0" + dependencies: + "@types/koa": ^2.11.6 + "@types/ws": ^7.4.0 + "@web/parse5-utils": ^2.1.0 + chokidar: ^3.4.3 + clone: ^2.1.2 + es-module-lexer: ^1.0.0 + get-stream: ^6.0.0 + is-stream: ^2.0.0 + isbinaryfile: ^5.0.0 + koa: ^2.13.0 + koa-etag: ^4.0.0 + koa-send: ^5.0.1 + koa-static: ^5.0.0 + lru-cache: ^8.0.4 + mime-types: ^2.1.27 + parse5: ^6.0.1 + picomatch: ^2.2.2 + ws: ^7.4.2 + checksum: 68c4440c75eca686626182af94d40f8ffa2e7848074692abd930ae69490af1866c5d10f13e8ad6745fb7ae386ba91377b4bcdbd74604a9600ce4ab2c8df1576c + languageName: node + linkType: hard + "@web/dev-server-esbuild@npm:^0.3.6": version: 0.3.6 resolution: "@web/dev-server-esbuild@npm:0.3.6" @@ -6148,6 +6351,20 @@ __metadata: languageName: node linkType: hard +"@web/dev-server-rollup@npm:^0.6.1": + version: 0.6.1 + resolution: "@web/dev-server-rollup@npm:0.6.1" + dependencies: + "@rollup/plugin-node-resolve": ^15.0.1 + "@web/dev-server-core": ^0.7.0 + nanocolors: ^0.2.1 + parse5: ^6.0.1 + rollup: ^4.4.0 + whatwg-url: ^11.0.0 + checksum: 59536e38d8519bc1edbf4e11adf36c4f5273c02f5fbc5171962cb7acadea2cfd8c44df057ff4422282f34964668280b3564f6b053bfee5327dc0368a382f2e00 + languageName: node + linkType: hard + "@web/dev-server@npm:^0.1.38": version: 0.1.38 resolution: "@web/dev-server@npm:0.1.38" @@ -6173,6 +6390,31 @@ __metadata: languageName: node linkType: hard +"@web/dev-server@npm:^0.4.0": + version: 0.4.1 + resolution: "@web/dev-server@npm:0.4.1" + dependencies: + "@babel/code-frame": ^7.12.11 + "@types/command-line-args": ^5.0.0 + "@web/config-loader": ^0.3.0 + "@web/dev-server-core": ^0.7.0 + "@web/dev-server-rollup": ^0.6.1 + camelcase: ^6.2.0 + command-line-args: ^5.1.1 + command-line-usage: ^7.0.1 + debounce: ^1.2.0 + deepmerge: ^4.2.2 + ip: ^1.1.5 + nanocolors: ^0.2.1 + open: ^8.0.2 + portfinder: ^1.0.32 + bin: + wds: dist/bin.js + web-dev-server: dist/bin.js + checksum: 2d9f2fcef4511e9965de24fef0ff4430a525ccc7bdc2069e51a96d1aaab4a50a935e32725dd128bb3641be4d6a2acb870f0d645208b59036bfd9d7f55c0a33a4 + languageName: node + linkType: hard + "@web/parse5-utils@npm:^1.3.1": version: 1.3.1 resolution: "@web/parse5-utils@npm:1.3.1" @@ -6183,7 +6425,7 @@ __metadata: languageName: node linkType: hard -"@web/parse5-utils@npm:^2.0.2": +"@web/parse5-utils@npm:^2.0.2, @web/parse5-utils@npm:^2.1.0": version: 2.1.0 resolution: "@web/parse5-utils@npm:2.1.0" dependencies: @@ -6205,6 +6447,19 @@ __metadata: languageName: node linkType: hard +"@web/test-runner-chrome@npm:^0.15.0": + version: 0.15.0 + resolution: "@web/test-runner-chrome@npm:0.15.0" + dependencies: + "@web/test-runner-core": ^0.13.0 + "@web/test-runner-coverage-v8": ^0.8.0 + async-mutex: 0.4.0 + chrome-launcher: ^0.15.0 + puppeteer-core: ^20.0.0 + checksum: 091aa83707aa1a6ade8074c37050f9a0fae2729f223b5e7d756f86ccdadcd85e738cc47d0a4ae8ac6ea930142cc20e341f5d3ad30a3a81d6666b353a7e8c2dd4 + languageName: node + linkType: hard + "@web/test-runner-commands@npm:^0.6.6": version: 0.6.6 resolution: "@web/test-runner-commands@npm:0.6.6" @@ -6215,6 +6470,16 @@ __metadata: languageName: node linkType: hard +"@web/test-runner-commands@npm:^0.9.0": + version: 0.9.0 + resolution: "@web/test-runner-commands@npm:0.9.0" + dependencies: + "@web/test-runner-core": ^0.13.0 + mkdirp: ^1.0.4 + checksum: df226f76148c5967df68c2589549b10ffe75f3d34a31d63bea132447271cdf073de7350aa680fcbf4315737b909fc44faad23d9f8e7e3ce37e93e05e67a7f295 + languageName: node + linkType: hard + "@web/test-runner-core@npm:^0.10.20, @web/test-runner-core@npm:^0.10.29": version: 0.10.29 resolution: "@web/test-runner-core@npm:0.10.29" @@ -6283,6 +6548,40 @@ __metadata: languageName: node linkType: hard +"@web/test-runner-core@npm:^0.13.0": + version: 0.13.0 + resolution: "@web/test-runner-core@npm:0.13.0" + dependencies: + "@babel/code-frame": ^7.12.11 + "@types/babel__code-frame": ^7.0.2 + "@types/co-body": ^6.1.0 + "@types/convert-source-map": ^2.0.0 + "@types/debounce": ^1.2.0 + "@types/istanbul-lib-coverage": ^2.0.3 + "@types/istanbul-reports": ^3.0.0 + "@web/browser-logs": ^0.4.0 + "@web/dev-server-core": ^0.7.0 + chokidar: ^3.4.3 + cli-cursor: ^3.1.0 + co-body: ^6.1.0 + convert-source-map: ^2.0.0 + debounce: ^1.2.0 + dependency-graph: ^0.11.0 + globby: ^11.0.1 + ip: ^1.1.5 + istanbul-lib-coverage: ^3.0.0 + istanbul-lib-report: ^3.0.1 + istanbul-reports: ^3.0.2 + log-update: ^4.0.0 + nanocolors: ^0.2.1 + nanoid: ^3.1.25 + open: ^8.0.2 + picomatch: ^2.2.2 + source-map: ^0.7.3 + checksum: 6c2bd4962da51521dc0d2cf660bf4e1fa3a9a92166a8c71e85a9fe9160710bbe83658dfceae6108123dcf85bf41fbabd8d3b7294f350e2f732f3713fcaa9a024 + languageName: node + linkType: hard + "@web/test-runner-coverage-v8@npm:^0.5.0": version: 0.5.0 resolution: "@web/test-runner-coverage-v8@npm:0.5.0" @@ -6308,6 +6607,19 @@ __metadata: languageName: node linkType: hard +"@web/test-runner-coverage-v8@npm:^0.8.0": + version: 0.8.0 + resolution: "@web/test-runner-coverage-v8@npm:0.8.0" + dependencies: + "@web/test-runner-core": ^0.13.0 + istanbul-lib-coverage: ^3.0.0 + lru-cache: ^8.0.4 + picomatch: ^2.2.2 + v8-to-istanbul: ^9.0.1 + checksum: 343f834372b3aeb2c24f4b03ce956d8ad851ef2a85b94507651c2a65321fcdff1b26a2c44d7516e97d9c42786bb003b9c245ad0798a414a814d0264fdbe0761e + languageName: node + linkType: hard + "@web/test-runner-mocha@npm:^0.7.5": version: 0.7.5 resolution: "@web/test-runner-mocha@npm:0.7.5" @@ -6318,6 +6630,15 @@ __metadata: languageName: node linkType: hard +"@web/test-runner-mocha@npm:^0.9.0": + version: 0.9.0 + resolution: "@web/test-runner-mocha@npm:0.9.0" + dependencies: + "@web/test-runner-core": ^0.13.0 + checksum: bcc9410ac9d679e7bb804fc5720b2a0ed3b4d08f2b49c03f2157f5b54c7f525a432712e1da644f04e5190c2480af2dc46a4c736cdba3fda3ba5fa98fd0f01a94 + languageName: node + linkType: hard + "@web/test-runner-playwright@npm:^0.10.0": version: 0.10.3 resolution: "@web/test-runner-playwright@npm:0.10.3" @@ -6329,6 +6650,17 @@ __metadata: languageName: node linkType: hard +"@web/test-runner-playwright@npm:^0.11.0": + version: 0.11.0 + resolution: "@web/test-runner-playwright@npm:0.11.0" + dependencies: + "@web/test-runner-core": ^0.13.0 + "@web/test-runner-coverage-v8": ^0.8.0 + playwright: ^1.22.2 + checksum: 3618b0b559d865af1211b3d86ec57487b32722a0dd640c9a3faca6c692cceec75176d742d0db73c823d300fbe761e5c15b2fad0c5096c3dbfedab313ed1aa7fe + languageName: node + linkType: hard + "@web/test-runner@npm:^0.15.3": version: 0.15.3 resolution: "@web/test-runner@npm:0.15.3" @@ -6356,6 +6688,33 @@ __metadata: languageName: node linkType: hard +"@web/test-runner@npm:^0.18.0": + version: 0.18.0 + resolution: "@web/test-runner@npm:0.18.0" + dependencies: + "@web/browser-logs": ^0.4.0 + "@web/config-loader": ^0.3.0 + "@web/dev-server": ^0.4.0 + "@web/test-runner-chrome": ^0.15.0 + "@web/test-runner-commands": ^0.9.0 + "@web/test-runner-core": ^0.13.0 + "@web/test-runner-mocha": ^0.9.0 + camelcase: ^6.2.0 + command-line-args: ^5.1.1 + command-line-usage: ^7.0.1 + convert-source-map: ^2.0.0 + diff: ^5.0.0 + globby: ^11.0.1 + nanocolors: ^0.2.1 + portfinder: ^1.0.32 + source-map: ^0.7.3 + bin: + web-test-runner: dist/bin.js + wtr: dist/bin.js + checksum: d5e410f08cb954f9854a3d837f5f704b578376ee8b0452cff66aeca2eb3cb98e50556ca3b958bda567b42af2ef2cd0a7424eaea40f9b3e80362ae788fbd33118 + languageName: node + linkType: hard + "@webassemblyjs/ast@npm:1.11.6, @webassemblyjs/ast@npm:^1.11.5": version: 1.11.6 resolution: "@webassemblyjs/ast@npm:1.11.6" @@ -7007,6 +7366,15 @@ __metadata: languageName: node linkType: hard +"ast-types@npm:^0.13.4": + version: 0.13.4 + resolution: "ast-types@npm:0.13.4" + dependencies: + tslib: ^2.0.1 + checksum: 5a51f7b70588ecced3601845a0e203279ca2f5fdc184416a0a1640c93ec0a267241d6090a328e78eebb8de81f8754754e0a4f1558ba2a3d638f8ccbd0b1f0eff + languageName: node + linkType: hard + "astral-regex@npm:^2.0.0": version: 2.0.0 resolution: "astral-regex@npm:2.0.0" @@ -7023,6 +7391,15 @@ __metadata: languageName: node linkType: hard +"async-mutex@npm:0.4.0": + version: 0.4.0 + resolution: "async-mutex@npm:0.4.0" + dependencies: + tslib: ^2.4.0 + checksum: 813a71728b35a4fbfd64dba719f04726d9133c67b577fcd951b7028c4a675a13ee34e69beb82d621f87bf81f5d4f135c4c44be0448550c7db728547244ef71fc + languageName: node + linkType: hard + "async@npm:^2.6.4": version: 2.6.4 resolution: "async@npm:2.6.4" @@ -7091,6 +7468,13 @@ __metadata: languageName: node linkType: hard +"b4a@npm:^1.6.4": + version: 1.6.4 + resolution: "b4a@npm:1.6.4" + checksum: 81b086f9af1f8845fbef4476307236bda3d660c158c201db976f19cdce05f41f93110ab6b12fd7a2696602a490cc43d5410ee36a56d6eef93afb0d6ca69ac3b2 + languageName: node + linkType: hard + "babel-loader@npm:^8.2.5": version: 8.3.0 resolution: "babel-loader@npm:8.3.0" @@ -7222,6 +7606,13 @@ __metadata: languageName: node linkType: hard +"basic-ftp@npm:^5.0.2": + version: 5.0.4 + resolution: "basic-ftp@npm:5.0.4" + checksum: 57725f24debd8c1b36f9bad1bfee39c5d9f5997f32a23e5c957389dcc64373a13b41711e5723b4a3b616a93530b345686119f480c27a115b2fde944c1652ceb1 + languageName: node + linkType: hard + "batch@npm:0.6.1": version: 0.6.1 resolution: "batch@npm:0.6.1" @@ -7982,6 +8373,17 @@ __metadata: languageName: node linkType: hard +"chromium-bidi@npm:0.4.16": + version: 0.4.16 + resolution: "chromium-bidi@npm:0.4.16" + dependencies: + mitt: 3.0.0 + peerDependencies: + devtools-protocol: "*" + checksum: 9cbb362fdf589dbdfd1618499c5bbdac45a3aa1291c1d2faa2f1ea3768738677985175d1bb1511dfe3e188bc78e6ea2acb453564ece7e09f535bbcd2253ce06a + languageName: node + linkType: hard + "chromium-bidi@npm:0.4.7": version: 0.4.7 resolution: "chromium-bidi@npm:0.4.7" @@ -8689,6 +9091,15 @@ __metadata: languageName: node linkType: hard +"cross-fetch@npm:4.0.0": + version: 4.0.0 + resolution: "cross-fetch@npm:4.0.0" + dependencies: + node-fetch: ^2.6.12 + checksum: ecca4f37ffa0e8283e7a8a590926b66713a7ef7892757aa36c2d20ffa27b0ac5c60dcf453119c809abe5923fc0bae3702a4d896bfb406ef1077b0d0018213e24 + languageName: node + linkType: hard + "cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": version: 7.0.3 resolution: "cross-spawn@npm:7.0.3" @@ -8924,6 +9335,13 @@ __metadata: languageName: node linkType: hard +"data-uri-to-buffer@npm:^6.0.0": + version: 6.0.1 + resolution: "data-uri-to-buffer@npm:6.0.1" + checksum: 9140e68c585ae33d950f5943bd476751346c8b789ae80b01a578a33cb8f7f706d1ca7378aff2b1878b2a6d9a8c88c55cc286d88191c8b8ead8255c3c4d934530 + languageName: node + linkType: hard + "debounce@npm:^1.2.0, debounce@npm:^1.2.1": version: 1.2.1 resolution: "debounce@npm:1.2.1" @@ -9122,6 +9540,17 @@ __metadata: languageName: node linkType: hard +"degenerator@npm:^5.0.0": + version: 5.0.1 + resolution: "degenerator@npm:5.0.1" + dependencies: + ast-types: ^0.13.4 + escodegen: ^2.1.0 + esprima: ^4.0.1 + checksum: a64fa39cdf6c2edd75188157d32338ee9de7193d7dbb2aeb4acb1eb30fa4a15ed80ba8dae9bd4d7b085472cf174a5baf81adb761aaa8e326771392c922084152 + languageName: node + linkType: hard + "del@npm:^6.1.1": version: 6.1.1 resolution: "del@npm:6.1.1" @@ -9245,6 +9674,13 @@ __metadata: languageName: node linkType: hard +"devtools-protocol@npm:0.0.1147663": + version: 0.0.1147663 + resolution: "devtools-protocol@npm:0.0.1147663" + checksum: 0631f2b6c6cd7f56e7d62a85bfc291f7e167f0f2de90969ef61fb24e2bd546b2e9530043d2bc3fe6c4d7a9e00473004272d2c2832a10a05e4b75c03a22f549fc + languageName: node + linkType: hard + "diff@npm:5.0.0": version: 5.0.0 resolution: "diff@npm:5.0.0" @@ -9866,6 +10302,24 @@ __metadata: languageName: node linkType: hard +"escodegen@npm:^2.1.0": + version: 2.1.0 + resolution: "escodegen@npm:2.1.0" + dependencies: + esprima: ^4.0.1 + estraverse: ^5.2.0 + esutils: ^2.0.2 + source-map: ~0.6.1 + dependenciesMeta: + source-map: + optional: true + bin: + escodegen: bin/escodegen.js + esgenerate: bin/esgenerate.js + checksum: 096696407e161305cd05aebb95134ad176708bc5cb13d0dcc89a5fcbb959b8ed757e7f2591a5f8036f8f4952d4a724de0df14cd419e29212729fa6df5ce16bf6 + languageName: node + linkType: hard + "eslint-plugin-prettier@npm:^5.0.0": version: 5.0.1 resolution: "eslint-plugin-prettier@npm:5.0.1" @@ -9971,7 +10425,7 @@ __metadata: languageName: node linkType: hard -"esprima@npm:^4.0.0": +"esprima@npm:^4.0.0, esprima@npm:^4.0.1": version: 4.0.1 resolution: "esprima@npm:4.0.1" bin: @@ -10079,6 +10533,13 @@ __metadata: languageName: node linkType: hard +"estree-walker@npm:^2.0.2": + version: 2.0.2 + resolution: "estree-walker@npm:2.0.2" + checksum: 6151e6f9828abe2259e57f5fd3761335bb0d2ebd76dc1a01048ccee22fabcfef3c0859300f6d83ff0d1927849368775ec5a6d265dde2f6de5a1be1721cd94efc + languageName: node + linkType: hard + "estree-walker@npm:^3.0.0": version: 3.0.3 resolution: "estree-walker@npm:3.0.3" @@ -10416,6 +10877,13 @@ __metadata: languageName: node linkType: hard +"fast-fifo@npm:^1.1.0, fast-fifo@npm:^1.2.0": + version: 1.3.2 + resolution: "fast-fifo@npm:1.3.2" + checksum: 6bfcba3e4df5af7be3332703b69a7898a8ed7020837ec4395bb341bd96cc3a6d86c3f6071dd98da289618cf2234c70d84b2a6f09a33dd6f988b1ff60d8e54275 + languageName: node + linkType: hard + "fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.12, fast-glob@npm:^3.2.9, fast-glob@npm:^3.3.0": version: 3.3.2 resolution: "fast-glob@npm:3.3.2" @@ -10881,6 +11349,17 @@ __metadata: languageName: node linkType: hard +"fs-extra@npm:^8.1.0": + version: 8.1.0 + resolution: "fs-extra@npm:8.1.0" + dependencies: + graceful-fs: ^4.2.0 + jsonfile: ^4.0.0 + universalify: ^0.1.0 + checksum: bf44f0e6cea59d5ce071bba4c43ca76d216f89e402dc6285c128abc0902e9b8525135aa808adad72c9d5d218e9f4bcc63962815529ff2f684ad532172a284880 + languageName: node + linkType: hard + "fs-extra@npm:^9.0.0": version: 9.1.0 resolution: "fs-extra@npm:9.1.0" @@ -11067,6 +11546,18 @@ __metadata: languageName: node linkType: hard +"get-uri@npm:^6.0.1": + version: 6.0.2 + resolution: "get-uri@npm:6.0.2" + dependencies: + basic-ftp: ^5.0.2 + data-uri-to-buffer: ^6.0.0 + debug: ^4.3.4 + fs-extra: ^8.1.0 + checksum: 762de3b0e3d4e7afc966e4ce93be587d70c270590da9b4c8fbff888362656c055838d926903d1774cbfeed4d392b4d6def4b2c06d48c050580070426a3a8629b + languageName: node + linkType: hard + "github-slugger@npm:^1.4.0, github-slugger@npm:^1.5.0": version: 1.5.0 resolution: "github-slugger@npm:1.5.0" @@ -12032,7 +12523,7 @@ __metadata: languageName: node linkType: hard -"https-proxy-agent@npm:^7.0.1": +"https-proxy-agent@npm:^7.0.0, https-proxy-agent@npm:^7.0.1, https-proxy-agent@npm:^7.0.2": version: 7.0.2 resolution: "https-proxy-agent@npm:7.0.2" dependencies: @@ -12321,7 +12812,7 @@ __metadata: languageName: node linkType: hard -"ip@npm:^1.1.5": +"ip@npm:^1.1.5, ip@npm:^1.1.8": version: 1.1.8 resolution: "ip@npm:1.1.8" checksum: a2ade53eb339fb0cbe9e69a44caab10d6e3784662285eb5d2677117ee4facc33a64679051c35e0dfdb1a3983a51ce2f5d2cb36446d52e10d01881789b76e28fb @@ -12416,7 +12907,7 @@ __metadata: languageName: node linkType: hard -"is-builtin-module@npm:^3.1.0": +"is-builtin-module@npm:^3.1.0, is-builtin-module@npm:^3.2.1": version: 3.2.1 resolution: "is-builtin-module@npm:3.2.1" dependencies: @@ -13755,6 +14246,13 @@ __metadata: languageName: node linkType: hard +"lru-cache@npm:^7.14.1": + version: 7.18.3 + resolution: "lru-cache@npm:7.18.3" + checksum: e550d772384709deea3f141af34b6d4fa392e2e418c1498c078de0ee63670f1f46f5eee746e8ef7e69e1c895af0d4224e62ee33e66a543a14763b0f2e74c1356 + languageName: node + linkType: hard + "lru-cache@npm:^8.0.4": version: 8.0.5 resolution: "lru-cache@npm:8.0.5" @@ -15260,6 +15758,13 @@ __metadata: languageName: node linkType: hard +"netmask@npm:^2.0.2": + version: 2.0.2 + resolution: "netmask@npm:2.0.2" + checksum: c65cb8d3f7ea5669edddb3217e4c96910a60d0d9a4b52d9847ff6b28b2d0277cd8464eee0ef85133cdee32605c57940cacdd04a9a019079b091b6bba4cb0ec22 + languageName: node + linkType: hard + "nise@npm:^5.1.5": version: 5.1.5 resolution: "nise@npm:5.1.5" @@ -15345,6 +15850,20 @@ __metadata: languageName: node linkType: hard +"node-fetch@npm:^2.6.12": + version: 2.7.0 + resolution: "node-fetch@npm:2.7.0" + dependencies: + whatwg-url: ^5.0.0 + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + checksum: d76d2f5edb451a3f05b15115ec89fc6be39de37c6089f1b6368df03b91e1633fd379a7e01b7ab05089a25034b2023d959b47e59759cb38d88341b2459e89d6e5 + languageName: node + linkType: hard + "node-forge@npm:^1": version: 1.3.1 resolution: "node-forge@npm:1.3.1" @@ -15808,6 +16327,33 @@ __metadata: languageName: node linkType: hard +"pac-proxy-agent@npm:^7.0.0": + version: 7.0.1 + resolution: "pac-proxy-agent@npm:7.0.1" + dependencies: + "@tootallnate/quickjs-emscripten": ^0.23.0 + agent-base: ^7.0.2 + debug: ^4.3.4 + get-uri: ^6.0.1 + http-proxy-agent: ^7.0.0 + https-proxy-agent: ^7.0.2 + pac-resolver: ^7.0.0 + socks-proxy-agent: ^8.0.2 + checksum: 3d4aa48ec1c19db10158ecc1c4c9a9f77792294412d225ceb3dfa45d5a06950dca9755e2db0d9b69f12769119bea0adf2b24390d9c73c8d81df75e28245ae451 + languageName: node + linkType: hard + +"pac-resolver@npm:^7.0.0": + version: 7.0.0 + resolution: "pac-resolver@npm:7.0.0" + dependencies: + degenerator: ^5.0.0 + ip: ^1.1.8 + netmask: ^2.0.2 + checksum: fa3a898c09848e93e35f5e23443fea36ddb393a851c76a23664a5bf3fcbe58ff77a0bcdae1e4f01b9ea87ea493c52e14d97a0fe39f92474d14cd45559c6e3cde + languageName: node + linkType: hard + "package-json@npm:^6.3.0": version: 6.5.0 resolution: "package-json@npm:6.5.0" @@ -15832,13 +16378,6 @@ __metadata: languageName: node linkType: hard -"pako@npm:^2.1.0": - version: 2.1.0 - resolution: "pako@npm:2.1.0" - checksum: 71666548644c9a4d056bcaba849ca6fd7242c6cf1af0646d3346f3079a1c7f4a66ffec6f7369ee0dc88f61926c10d6ab05da3e1fca44b83551839e89edd75a3e - languageName: node - linkType: hard - "param-case@npm:^3.0.4": version: 3.0.4 resolution: "param-case@npm:3.0.4" @@ -16790,6 +17329,22 @@ __metadata: languageName: node linkType: hard +"proxy-agent@npm:6.3.0": + version: 6.3.0 + resolution: "proxy-agent@npm:6.3.0" + dependencies: + agent-base: ^7.0.2 + debug: ^4.3.4 + http-proxy-agent: ^7.0.0 + https-proxy-agent: ^7.0.0 + lru-cache: ^7.14.1 + pac-proxy-agent: ^7.0.0 + proxy-from-env: ^1.1.0 + socks-proxy-agent: ^8.0.1 + checksum: e3fb0633d665e352ed4efe23ae5616b8301423dfa4ff1c5975d093da8a636181a97391f7a91c6a7ffae17c1a305df855e95507f73bcdafda8876198c64b88f5b + languageName: node + linkType: hard + "proxy-from-env@npm:1.1.0, proxy-from-env@npm:^1.1.0": version: 1.1.0 resolution: "proxy-from-env@npm:1.1.0" @@ -16888,6 +17443,25 @@ __metadata: languageName: node linkType: hard +"puppeteer-core@npm:^20.0.0": + version: 20.9.0 + resolution: "puppeteer-core@npm:20.9.0" + dependencies: + "@puppeteer/browsers": 1.4.6 + chromium-bidi: 0.4.16 + cross-fetch: 4.0.0 + debug: 4.3.4 + devtools-protocol: 0.0.1147663 + ws: 8.13.0 + peerDependencies: + typescript: ">= 4.7.4" + peerDependenciesMeta: + typescript: + optional: true + checksum: d298598445b0f2032c02d0ed7d1d18a8d2d2fcaf6fc31fc96e93e2669a7fc6fbee0338bd9b8c8f8822887f18a8fb680b77bb56e96fe1928baadb52292bbd93b4 + languageName: node + linkType: hard + "qs@npm:6.11.0": version: 6.11.0 resolution: "qs@npm:6.11.0" @@ -16913,6 +17487,13 @@ __metadata: languageName: node linkType: hard +"queue-tick@npm:^1.0.1": + version: 1.0.1 + resolution: "queue-tick@npm:1.0.1" + checksum: 57c3292814b297f87f792fbeb99ce982813e4e54d7a8bdff65cf53d5c084113913289d4a48ec8bbc964927a74b847554f9f4579df43c969a6c8e0f026457ad01 + languageName: node + linkType: hard + "queue@npm:6.0.2": version: 6.0.2 resolution: "queue@npm:6.0.2" @@ -17739,7 +18320,7 @@ __metadata: languageName: node linkType: hard -"resolve@npm:^1.1.6, resolve@npm:^1.14.2, resolve@npm:^1.19.0, resolve@npm:^1.3.2, resolve@npm:^1.9.0": +"resolve@npm:^1.1.6, resolve@npm:^1.14.2, resolve@npm:^1.19.0, resolve@npm:^1.22.1, resolve@npm:^1.3.2, resolve@npm:^1.9.0": version: 1.22.8 resolution: "resolve@npm:1.22.8" dependencies: @@ -17761,7 +18342,7 @@ __metadata: languageName: node linkType: hard -"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.3.2#~builtin, resolve@patch:resolve@^1.9.0#~builtin": +"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.22.1#~builtin, resolve@patch:resolve@^1.3.2#~builtin, resolve@patch:resolve@^1.9.0#~builtin": version: 1.22.8 resolution: "resolve@patch:resolve@npm%3A1.22.8#~builtin::version=1.22.8&hash=c3c19d" dependencies: @@ -17880,6 +18461,60 @@ __metadata: languageName: node linkType: hard +"rollup@npm:^4.4.0": + version: 4.9.4 + resolution: "rollup@npm:4.9.4" + dependencies: + "@rollup/rollup-android-arm-eabi": 4.9.4 + "@rollup/rollup-android-arm64": 4.9.4 + "@rollup/rollup-darwin-arm64": 4.9.4 + "@rollup/rollup-darwin-x64": 4.9.4 + "@rollup/rollup-linux-arm-gnueabihf": 4.9.4 + "@rollup/rollup-linux-arm64-gnu": 4.9.4 + "@rollup/rollup-linux-arm64-musl": 4.9.4 + "@rollup/rollup-linux-riscv64-gnu": 4.9.4 + "@rollup/rollup-linux-x64-gnu": 4.9.4 + "@rollup/rollup-linux-x64-musl": 4.9.4 + "@rollup/rollup-win32-arm64-msvc": 4.9.4 + "@rollup/rollup-win32-ia32-msvc": 4.9.4 + "@rollup/rollup-win32-x64-msvc": 4.9.4 + "@types/estree": 1.0.5 + fsevents: ~2.3.2 + dependenciesMeta: + "@rollup/rollup-android-arm-eabi": + optional: true + "@rollup/rollup-android-arm64": + optional: true + "@rollup/rollup-darwin-arm64": + optional: true + "@rollup/rollup-darwin-x64": + optional: true + "@rollup/rollup-linux-arm-gnueabihf": + optional: true + "@rollup/rollup-linux-arm64-gnu": + optional: true + "@rollup/rollup-linux-arm64-musl": + optional: true + "@rollup/rollup-linux-riscv64-gnu": + optional: true + "@rollup/rollup-linux-x64-gnu": + optional: true + "@rollup/rollup-linux-x64-musl": + optional: true + "@rollup/rollup-win32-arm64-msvc": + optional: true + "@rollup/rollup-win32-ia32-msvc": + optional: true + "@rollup/rollup-win32-x64-msvc": + optional: true + fsevents: + optional: true + bin: + rollup: dist/bin/rollup + checksum: 134b1fd8886a1dc86b2cadada979174e736a39aec12d069261fe8b799ad0c4aa3213188ea49adeee155669315016617260e43eea754436c50121aa359899da4d + languageName: node + linkType: hard + "rtl-detect@npm:^1.0.4": version: 1.1.2 resolution: "rtl-detect@npm:1.1.2" @@ -18479,7 +19114,7 @@ __metadata: languageName: node linkType: hard -"socks-proxy-agent@npm:^8.0.1": +"socks-proxy-agent@npm:^8.0.1, socks-proxy-agent@npm:^8.0.2": version: 8.0.2 resolution: "socks-proxy-agent@npm:8.0.2" dependencies: @@ -18550,7 +19185,7 @@ __metadata: languageName: node linkType: hard -"source-map@npm:^0.6.0, source-map@npm:^0.6.1, source-map@npm:~0.6.0": +"source-map@npm:^0.6.0, source-map@npm:^0.6.1, source-map@npm:~0.6.0, source-map@npm:~0.6.1": version: 0.6.1 resolution: "source-map@npm:0.6.1" checksum: 59ce8640cf3f3124f64ac289012c2b8bd377c238e316fb323ea22fbfe83da07d81e000071d7242cad7a23cd91c7de98e4df8830ec3f133cb6133a5f6e9f67bc2 @@ -18711,6 +19346,16 @@ __metadata: languageName: node linkType: hard +"streamx@npm:^2.15.0": + version: 2.15.6 + resolution: "streamx@npm:2.15.6" + dependencies: + fast-fifo: ^1.1.0 + queue-tick: ^1.0.1 + checksum: 37a245f5cee4c33fcb8b018ccb935bad6eab423f05b0d14d018e63dbd2670bb109a69442e961a195b750c2c774f613c19476d11bd727d645eedb655d2dba234b + languageName: node + linkType: hard + "string-format@npm:^2.0.0": version: 2.0.0 resolution: "string-format@npm:2.0.0" @@ -19033,6 +19678,17 @@ __metadata: languageName: node linkType: hard +"tar-fs@npm:3.0.4": + version: 3.0.4 + resolution: "tar-fs@npm:3.0.4" + dependencies: + mkdirp-classic: ^0.5.2 + pump: ^3.0.0 + tar-stream: ^3.1.5 + checksum: dcf4054f9e92ca0efe61c2b3f612914fb259a47900aa908a63106513a6d006c899b426ada53eb88d9dbbf089b5724c8e90b96a2c4ca6171845fa14203d734e30 + languageName: node + linkType: hard + "tar-stream@npm:^2.1.4": version: 2.2.0 resolution: "tar-stream@npm:2.2.0" @@ -19046,6 +19702,17 @@ __metadata: languageName: node linkType: hard +"tar-stream@npm:^3.1.5": + version: 3.1.6 + resolution: "tar-stream@npm:3.1.6" + dependencies: + b4a: ^1.6.4 + fast-fifo: ^1.2.0 + streamx: ^2.15.0 + checksum: f3627f918581976e954ff03cb8d370551053796b82564f8c7ca8fac84c48e4d042026d0854fc222171a34ff9c682b72fae91be9c9b0a112d4c54f9e4f443e9c5 + languageName: node + linkType: hard + "tar@npm:^6.1.11, tar@npm:^6.1.2": version: 6.2.0 resolution: "tar@npm:6.2.0" @@ -19364,7 +20031,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^2.0.3, tslib@npm:^2.1.0, tslib@npm:^2.4.0, tslib@npm:^2.5.0, tslib@npm:^2.6.0, tslib@npm:^2.6.2": +"tslib@npm:^2.0.1, tslib@npm:^2.0.3, tslib@npm:^2.1.0, tslib@npm:^2.4.0, tslib@npm:^2.5.0, tslib@npm:^2.6.0, tslib@npm:^2.6.2": version: 2.6.2 resolution: "tslib@npm:2.6.2" checksum: 329ea56123005922f39642318e3d1f0f8265d1e7fcb92c633e0809521da75eeaca28d2cf96d7248229deb40e5c19adf408259f4b9640afd20d13aecc1430f3ad From 766440d06c3c4d02c3315fef38a48cd273f4e34f Mon Sep 17 00:00:00 2001 From: thunkar Date: Mon, 8 Jan 2024 17:15:18 +0000 Subject: [PATCH 25/37] More PR comments --- compiler/wasm/src/types/noir_artifact.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/compiler/wasm/src/types/noir_artifact.ts b/compiler/wasm/src/types/noir_artifact.ts index 4f410d5bbb5..752766fcd2c 100644 --- a/compiler/wasm/src/types/noir_artifact.ts +++ b/compiler/wasm/src/types/noir_artifact.ts @@ -1,4 +1,18 @@ -import { Abi, AbiParameter } from '@noir-lang/noirc_abi'; +import { Abi, AbiType } from '@noir-lang/noirc_abi'; + +/** + * A named type.f + */ +export interface ABIVariable { + /** + * The name of the variable. + */ + name: string; + /** + * The type of the variable. + */ + type: AbiType; +} /** * A contract event. @@ -15,7 +29,7 @@ export interface EventAbi { /** * The fields of the event. */ - fields: AbiParameter[]; + fields: ABIVariable[]; } /** The Noir function types. */ @@ -35,10 +49,6 @@ export interface NoirFunctionEntry { abi: Abi; /** The bytecode of the function in base64. */ bytecode: string; - /** The proving key. */ - proving_key: string; - /** The verification key. */ - verification_key: string; } /** From dd7f8f4a1d664c60656a4feccdf307a5341f5c7c Mon Sep 17 00:00:00 2001 From: thunkar Date: Mon, 8 Jan 2024 17:26:28 +0000 Subject: [PATCH 26/37] Changed cache key --- .github/workflows/test-js-packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index 136349ffeee..59dddd46a08 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -60,7 +60,7 @@ jobs: - uses: Swatinem/rust-cache@v2 with: - key: x86_64-unknown-linux-gnu + key: noir-wasm cache-on-failure: true save-if: ${{ github.event_name != 'merge_group' }} From f0339d5ff884d8d083923c3e6a7f1ed64f823530 Mon Sep 17 00:00:00 2001 From: thunkar Date: Mon, 8 Jan 2024 17:30:34 +0000 Subject: [PATCH 27/37] oops typo --- compiler/wasm/src/types/noir_artifact.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/wasm/src/types/noir_artifact.ts b/compiler/wasm/src/types/noir_artifact.ts index 752766fcd2c..f2147cfbeda 100644 --- a/compiler/wasm/src/types/noir_artifact.ts +++ b/compiler/wasm/src/types/noir_artifact.ts @@ -1,7 +1,7 @@ import { Abi, AbiType } from '@noir-lang/noirc_abi'; /** - * A named type.f + * A named type. */ export interface ABIVariable { /** From a9664df0ff016d1335d8005298fa6b24d4786add Mon Sep 17 00:00:00 2001 From: thunkar Date: Mon, 8 Jan 2024 17:52:00 +0000 Subject: [PATCH 28/37] Increased timeouts --- compiler/wasm/test/wasm/browser/index.test.ts | 8 ++++---- compiler/wasm/test/wasm/node/index.test.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/wasm/test/wasm/browser/index.test.ts b/compiler/wasm/test/wasm/browser/index.test.ts index a3c86db897c..af44ffb9101 100644 --- a/compiler/wasm/test/wasm/browser/index.test.ts +++ b/compiler/wasm/test/wasm/browser/index.test.ts @@ -47,7 +47,7 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); }); - }).timeout(20 * 10e3); + }).timeout(60 * 20e3); describe('can compile scripts with dependencies', () => { const sourceMap = new PathToFileSourceMap(); @@ -81,7 +81,7 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); }); - }).timeout(20 * 10e3); + }).timeout(60 * 20e3); describe('can compile scripts with dependencies -- context-api', () => { let sourceMap: PathToFileSourceMap; @@ -129,7 +129,7 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); - }).timeout(20 * 10e3); + }).timeout(60 * 20e3); it('matching nargos compilation - context-implementation-compile-api', async () => { const wasmCircuit = await compile_( @@ -154,6 +154,6 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); - }).timeout(20 * 10e3); + }).timeout(60 * 20e3); }); }); diff --git a/compiler/wasm/test/wasm/node/index.test.ts b/compiler/wasm/test/wasm/node/index.test.ts index 0bb272ec526..9ebb4901691 100644 --- a/compiler/wasm/test/wasm/node/index.test.ts +++ b/compiler/wasm/test/wasm/node/index.test.ts @@ -38,7 +38,7 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); }); - }).timeout(20 * 10e3); + }).timeout(60 * 20e3); describe('can compile scripts with dependencies', () => { const sourceMap = new PathToFileSourceMap(); @@ -72,7 +72,7 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); }); - }).timeout(20 * 10e3); + }).timeout(60 * 20e3); describe('can compile scripts with dependencies -- context-api', () => { let sourceMap: PathToFileSourceMap; @@ -120,7 +120,7 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); - }).timeout(20 * 10e3); + }).timeout(60 * 20e3); it('matching nargos compilation - context-implementation-compile-api', async () => { const wasmCircuit = await compile_( @@ -145,6 +145,6 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); - }).timeout(20 * 10e3); + }).timeout(60 * 20e3); }); }); From c51581ed92afb60368ff7034d1f45c666e648690 Mon Sep 17 00:00:00 2001 From: thunkar Date: Mon, 8 Jan 2024 19:50:23 +0000 Subject: [PATCH 29/37] Removed paths from tsconfig.json --- compiler/wasm/tsconfig.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/compiler/wasm/tsconfig.json b/compiler/wasm/tsconfig.json index f4dda845fdf..c7279b3e478 100644 --- a/compiler/wasm/tsconfig.json +++ b/compiler/wasm/tsconfig.json @@ -15,8 +15,5 @@ "target": "ESNext", "module": "CommonJS", "moduleResolution": "Node", - "paths": { - "@noir-lang/noir_wasm/*": ["./*"], - } } } \ No newline at end of file From cd9bb3c3e57cacab09e299a93febe6056638a528 Mon Sep 17 00:00:00 2001 From: thunkar Date: Mon, 8 Jan 2024 20:22:20 +0000 Subject: [PATCH 30/37] Removed debug flag --- compiler/wasm/web-test-runner.config.mjs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/wasm/web-test-runner.config.mjs b/compiler/wasm/web-test-runner.config.mjs index e8e31ab2b57..4d05c95f7d6 100644 --- a/compiler/wasm/web-test-runner.config.mjs +++ b/compiler/wasm/web-test-runner.config.mjs @@ -21,5 +21,4 @@ export default { nodeResolve: true, rootDir: fileURLToPath(new URL('./../../', import.meta.url)), reporters: [reporter], - debug: true, }; From ca744aed173b8be51fa205e526d3390e0bcf368c Mon Sep 17 00:00:00 2001 From: thunkar Date: Mon, 8 Jan 2024 20:53:10 +0000 Subject: [PATCH 31/37] Moved timeouts to tests and not suites --- compiler/wasm/test/wasm/browser/index.test.ts | 8 ++++---- compiler/wasm/test/wasm/node/index.test.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/wasm/test/wasm/browser/index.test.ts b/compiler/wasm/test/wasm/browser/index.test.ts index af44ffb9101..3122fa57945 100644 --- a/compiler/wasm/test/wasm/browser/index.test.ts +++ b/compiler/wasm/test/wasm/browser/index.test.ts @@ -46,8 +46,8 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); - }); - }).timeout(60 * 20e3); + }).timeout(60 * 20e3); + }); describe('can compile scripts with dependencies', () => { const sourceMap = new PathToFileSourceMap(); @@ -80,8 +80,8 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); - }); - }).timeout(60 * 20e3); + }).timeout(60 * 20e3); + }); describe('can compile scripts with dependencies -- context-api', () => { let sourceMap: PathToFileSourceMap; diff --git a/compiler/wasm/test/wasm/node/index.test.ts b/compiler/wasm/test/wasm/node/index.test.ts index 9ebb4901691..c73ce7477e5 100644 --- a/compiler/wasm/test/wasm/node/index.test.ts +++ b/compiler/wasm/test/wasm/node/index.test.ts @@ -37,8 +37,8 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); - }); - }).timeout(60 * 20e3); + }).timeout(60 * 20e3); + }); describe('can compile scripts with dependencies', () => { const sourceMap = new PathToFileSourceMap(); @@ -71,8 +71,8 @@ describe('noir wasm compilation', () => { expect(wasmCircuit.program.bytecode).to.eq(cliCircuit.bytecode); expect(wasmCircuit.program.abi).to.deep.eq(cliCircuit.abi); expect(wasmCircuit.program.noir_version).to.eq(cliCircuit.noir_version); - }); - }).timeout(60 * 20e3); + }).timeout(60 * 20e3); + }); describe('can compile scripts with dependencies -- context-api', () => { let sourceMap: PathToFileSourceMap; From c8b5aa66996c4fc6f665cd7667d3a0f39aa5904d Mon Sep 17 00:00:00 2001 From: thunkar Date: Tue, 9 Jan 2024 14:05:39 +0000 Subject: [PATCH 32/37] Make wasm-pack mimic the opt behavior of other packages --- compiler/wasm/package.json | 2 +- compiler/wasm/wasm-opt-check.sh | 1 + compiler/wasm/webpack.config.ts | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100755 compiler/wasm/wasm-opt-check.sh diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index cd84e4d0cb7..1235a748d13 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -28,7 +28,7 @@ "url": "https://github.com/noir-lang/noir/issues" }, "scripts": { - "build": "webpack", + "build": "WASM_OPT=$(bash -c ./wasm-opt-check.sh) webpack", "test": "yarn test:build_fixtures && yarn test:node && yarn test:browser", "test:build_fixtures": "./build-fixtures.sh", "test:browser": "web-test-runner", diff --git a/compiler/wasm/wasm-opt-check.sh b/compiler/wasm/wasm-opt-check.sh new file mode 100755 index 00000000000..8612b48d3f1 --- /dev/null +++ b/compiler/wasm/wasm-opt-check.sh @@ -0,0 +1 @@ +command -v wasm-opt >/dev/null 2>&1 && echo "true" || { echo >&2 "wasm-opt is not installed, building in dev mode" && echo "false"; exit 1; } \ No newline at end of file diff --git a/compiler/wasm/webpack.config.ts b/compiler/wasm/webpack.config.ts index d5fe18ed020..1f4e75bd615 100644 --- a/compiler/wasm/webpack.config.ts +++ b/compiler/wasm/webpack.config.ts @@ -43,7 +43,7 @@ const webConfig: webpack.Configuration = { crateDirectory: resolve(__dirname), outDir: resolve(__dirname, './build/esm'), extraArgs: '--target web', - forceMode: 'production', + forceMode: process.env.WASM_OPT === 'true' ? 'production' : 'development', }), new HtmlWebpackPlugin({ title: 'Noir Wasm ESM', @@ -102,7 +102,7 @@ const nodeConfig: webpack.Configuration = { crateDirectory: resolve(__dirname), outDir: resolve(__dirname, './build/cjs'), extraArgs: '--target nodejs', - forceMode: 'production', + forceMode: process.env.WASM_OPT === 'true' ? 'production' : 'development', }), new CopyWebpackPlugin({ patterns: [ From de08e5ed43fcccc51a7b9f68455f6fae74721d21 Mon Sep 17 00:00:00 2001 From: Gregorio Juliana Date: Tue, 9 Jan 2024 15:47:31 +0100 Subject: [PATCH 33/37] Update compiler/integration-tests/scripts/codegen-verifiers.sh Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> --- compiler/integration-tests/scripts/codegen-verifiers.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/compiler/integration-tests/scripts/codegen-verifiers.sh b/compiler/integration-tests/scripts/codegen-verifiers.sh index 577cc42b213..e377a3ee3f8 100644 --- a/compiler/integration-tests/scripts/codegen-verifiers.sh +++ b/compiler/integration-tests/scripts/codegen-verifiers.sh @@ -21,8 +21,6 @@ contracts_dir=$self_path/../contracts rm -rf $contracts_dir mkdir $contracts_dir -# Run codegen-verifier for recursion - cp $mul_dir/contract/1_mul/plonk_vk.sol $contracts_dir/1_mul.sol cp $assert_statement_dir/contract/assert_statement/plonk_vk.sol $contracts_dir/assert_statement.sol cp $recursion_dir/contract/recursion/plonk_vk.sol $contracts_dir/recursion.sol From 301020186968e95088d86225b075e1611d92fbb5 Mon Sep 17 00:00:00 2001 From: thunkar Date: Tue, 9 Jan 2024 15:45:58 +0000 Subject: [PATCH 34/37] allow embedding stdlib + wasm-opt disable --- .github/workflows/test-js-packages.yml | 5 +---- Cargo.lock | 1 + Cargo.toml | 1 + compiler/noirc_driver/Cargo.toml | 2 +- compiler/wasm/Cargo.toml | 8 +++++++- compiler/wasm/build-fixtures.sh | 4 +++- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-js-packages.yml b/.github/workflows/test-js-packages.yml index 59dddd46a08..31bd1219654 100644 --- a/.github/workflows/test-js-packages.yml +++ b/.github/workflows/test-js-packages.yml @@ -76,14 +76,11 @@ jobs: - name: Build noir_wasm run: yarn workspace @noir-lang/noir_wasm build - - name: Dereference symlink - run: echo "UPLOAD_PATH=$(readlink -f ./compiler/wasm)" >> $GITHUB_ENV - - name: Upload artifact uses: actions/upload-artifact@v3 with: name: noir_wasm - path: ${{ env.UPLOAD_PATH }} + path: ./compiler/wasm retention-days: 3 build-acvm-js: diff --git a/Cargo.lock b/Cargo.lock index 7a3fc491912..7b96c1dcc59 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2846,6 +2846,7 @@ dependencies = [ "noirc_driver", "noirc_errors", "noirc_frontend", + "rust-embed", "serde", "tracing-subscriber", "tracing-web", diff --git a/Cargo.toml b/Cargo.toml index 5469a63f3dd..05139934c62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -127,6 +127,7 @@ jsonrpc = { version = "0.16.0", features = ["minreq_http"] } tracing = "0.1.40" tracing-web = "0.1.3" tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } +rust-embed = "6.6.0" [profile.dev] # This is required to be able to run `cargo test` in acvm_js due to the `locals exceeds maximum` error. diff --git a/compiler/noirc_driver/Cargo.toml b/compiler/noirc_driver/Cargo.toml index 32c418b0adb..eb9650e8aec 100644 --- a/compiler/noirc_driver/Cargo.toml +++ b/compiler/noirc_driver/Cargo.toml @@ -21,7 +21,7 @@ iter-extended.workspace = true fm.workspace = true serde.workspace = true fxhash.workspace = true -rust-embed = "6.6.0" +rust-embed.workspace = true tracing.workspace = true aztec_macros = { path = "../../aztec_macros" } diff --git a/compiler/wasm/Cargo.toml b/compiler/wasm/Cargo.toml index 7ea138b60a4..7af26269106 100644 --- a/compiler/wasm/Cargo.toml +++ b/compiler/wasm/Cargo.toml @@ -30,5 +30,11 @@ tracing-web.workspace = true # so that we can enable the js feature in getrandom. getrandom = { workspace = true, features = ["js"] } +# This is an unused dependency, we are adding it +# so that we can enable the debug-embed feature in rust-embed. +# This is needed for rust-embed to include the stdlib sources in dev mode +# while simultaneously allowing us to deactivate wasm-opt for speed. +rust-embed = { workspace = true, features = ["debug-embed"] } + [build-dependencies] -build-data.workspace = true +build-data.workspace = true \ No newline at end of file diff --git a/compiler/wasm/build-fixtures.sh b/compiler/wasm/build-fixtures.sh index cb3d465fcbb..3a2330d4726 100755 --- a/compiler/wasm/build-fixtures.sh +++ b/compiler/wasm/build-fixtures.sh @@ -1,3 +1,5 @@ #!/usr/bin/env bash -cd test/fixtures && cd simple && nargo compile && cd ../with-deps && nargo compile && cd ../noir-contract && nargo compile && cd ../../ \ No newline at end of file +nargo compile --program-dir ./test/fixtures/simple +nargo compile --program-dir ./test/fixtures/with-deps +nargo compile --program-dir ./test/fixtures/noir-contract \ No newline at end of file From 7115d282f1220f36e4c8efebcc513bd6e0171fca Mon Sep 17 00:00:00 2001 From: thunkar Date: Tue, 9 Jan 2024 15:49:10 +0000 Subject: [PATCH 35/37] fixed unused dep warning --- compiler/wasm/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/wasm/src/lib.rs b/compiler/wasm/src/lib.rs index e10b992a00e..6d737a0ea6d 100644 --- a/compiler/wasm/src/lib.rs +++ b/compiler/wasm/src/lib.rs @@ -4,6 +4,7 @@ // See Cargo.toml for explanation. use getrandom as _; +use rust_embed as _; use gloo_utils::format::JsValueSerdeExt; From 0c9e195d4566f7d0970c5982644e41a244caeaee Mon Sep 17 00:00:00 2001 From: thunkar Date: Tue, 9 Jan 2024 19:37:07 +0000 Subject: [PATCH 36/37] removed @ts-ignore, proper typings --- .../wasm/test/compiler/browser/compile_with_deps.test.ts | 7 +++---- .../wasm/test/compiler/node/compile_with_deps.test.ts | 8 +++----- compiler/wasm/tsconfig.json | 4 ++++ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/compiler/wasm/test/compiler/browser/compile_with_deps.test.ts b/compiler/wasm/test/compiler/browser/compile_with_deps.test.ts index e8d047b74e9..3580779ff1d 100644 --- a/compiler/wasm/test/compiler/browser/compile_with_deps.test.ts +++ b/compiler/wasm/test/compiler/browser/compile_with_deps.test.ts @@ -1,9 +1,8 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ import { getPaths } from '../../shared'; import { expect } from '@esm-bundle/chai'; -// @ts-ignore -import { compile, createFileManager } from '../../../dist/web/main'; -import { CompilationResult, CompiledContract } from '../../../src/types/noir_artifact'; +import { compile, createFileManager } from '@noir-lang/noir_wasm'; +import { CompiledContract } from '../../../src/types/noir_artifact'; const paths = getPaths('.'); @@ -33,7 +32,7 @@ describe('noir-compiler', () => { } const nargoArtifact = (await getPrecompiledSource(contractExpectedArtifact)) as CompiledContract; nargoArtifact.functions.sort((a, b) => a.name.localeCompare(b.name)); - const noirWasmArtifact = (await compile(fm, '/fixtures/noir-contract')) as CompilationResult; + const noirWasmArtifact = await compile(fm, '/fixtures/noir-contract'); if (!('contract' in noirWasmArtifact)) { throw new Error('Compilation failed'); } diff --git a/compiler/wasm/test/compiler/node/compile_with_deps.test.ts b/compiler/wasm/test/compiler/node/compile_with_deps.test.ts index 7eedc723f7b..546ec03c183 100644 --- a/compiler/wasm/test/compiler/node/compile_with_deps.test.ts +++ b/compiler/wasm/test/compiler/node/compile_with_deps.test.ts @@ -1,12 +1,10 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ import { join, resolve } from 'path'; import { getPaths } from '../../shared'; import { expect } from 'chai'; import { readFile } from 'fs/promises'; -// @ts-ignore -import { compile, createFileManager } from '../../../dist/node/main'; -import { CompilationResult, CompiledContract } from '../../../src/types/noir_artifact'; +import { compile, createFileManager } from '@noir-lang/noir_wasm'; +import { CompiledContract } from '../../../src/types/noir_artifact'; const basePath = resolve(join(__dirname, '../../')); const { contractProjectPath, contractExpectedArtifact } = getPaths(basePath); @@ -16,7 +14,7 @@ describe('noir-compiler', () => { const fm = createFileManager(contractProjectPath); const nargoArtifact = JSON.parse((await readFile(contractExpectedArtifact)).toString()) as CompiledContract; nargoArtifact.functions.sort((a, b) => a.name.localeCompare(b.name)); - const noirWasmArtifact = (await compile(fm)) as CompilationResult; + const noirWasmArtifact = await compile(fm); if (!('contract' in noirWasmArtifact)) { throw new Error('Compilation failed'); } diff --git a/compiler/wasm/tsconfig.json b/compiler/wasm/tsconfig.json index c7279b3e478..60c5ee4b748 100644 --- a/compiler/wasm/tsconfig.json +++ b/compiler/wasm/tsconfig.json @@ -15,5 +15,9 @@ "target": "ESNext", "module": "CommonJS", "moduleResolution": "Node", + "allowJs": true, + "paths": { + "*": ["./dist/types/*"] + } } } \ No newline at end of file From c15d48afdc731586063e44ba92634a3f8c20418a Mon Sep 17 00:00:00 2001 From: thunkar Date: Tue, 9 Jan 2024 19:50:19 +0000 Subject: [PATCH 37/37] fixed compilation after clean --- compiler/wasm/tsconfig.esm.json | 2 +- compiler/wasm/tsconfig.json | 3 --- compiler/wasm/tsconfig.webpack.json | 7 +++++++ compiler/wasm/webpack.config.ts | 5 ++++- 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 compiler/wasm/tsconfig.webpack.json diff --git a/compiler/wasm/tsconfig.esm.json b/compiler/wasm/tsconfig.esm.json index c91b56ea59c..5826fee7c52 100644 --- a/compiler/wasm/tsconfig.esm.json +++ b/compiler/wasm/tsconfig.esm.json @@ -1,5 +1,5 @@ { - "extends": "./tsconfig.json", + "extends": "./tsconfig.webpack.json", "compilerOptions": { "module": "ESNext", }, diff --git a/compiler/wasm/tsconfig.json b/compiler/wasm/tsconfig.json index 60c5ee4b748..6096b419d78 100644 --- a/compiler/wasm/tsconfig.json +++ b/compiler/wasm/tsconfig.json @@ -16,8 +16,5 @@ "module": "CommonJS", "moduleResolution": "Node", "allowJs": true, - "paths": { - "*": ["./dist/types/*"] - } } } \ No newline at end of file diff --git a/compiler/wasm/tsconfig.webpack.json b/compiler/wasm/tsconfig.webpack.json new file mode 100644 index 00000000000..dd1c218a352 --- /dev/null +++ b/compiler/wasm/tsconfig.webpack.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "exclude": [ + "./test/**/*", + "node_modules" + ] +} \ No newline at end of file diff --git a/compiler/wasm/webpack.config.ts b/compiler/wasm/webpack.config.ts index 1f4e75bd615..d5d70df2b8a 100644 --- a/compiler/wasm/webpack.config.ts +++ b/compiler/wasm/webpack.config.ts @@ -117,7 +117,10 @@ const nodeConfig: webpack.Configuration = { rules: [ { test: /.c?ts$/, - use: 'ts-loader', + loader: 'ts-loader', + options: { + configFile: 'tsconfig.webpack.json', + }, exclude: /node_modules/, }, {