diff --git a/Makefile b/Makefile index b76b78bc2ff..6cfe0b5f164 100644 --- a/Makefile +++ b/Makefile @@ -73,6 +73,7 @@ fast-foundation: barretenberg bb-tests \ protocol-contracts protocol-contracts-tests \ fnd-release-tests fnd-genesis-tests \ ipc-runtime ipc-codegen-tests \ + react-native-tests \ constants-codegen constants-codegen-tests \ labs-patches-tests \ claude-tests \ @@ -104,7 +105,7 @@ bench: bench-foundation bench-labs # Release: everything, plus the cross builds and release tarballs. Each project's release step packages every # platform's binaries from the cross build directories itself. -release-foundation: fast-foundation bb-cpp-release-dir ipc-runtime-cross +release-foundation: fast-foundation bb-cpp-release-dir ipc-runtime-cross react-native-mobile release-labs: fast-labs @@ -427,6 +428,25 @@ acvm-tests: acvm kv-sqlite-tests: kv-sqlite $(call test,$@,native-packages/kv-sqlite) +# The ACVM's static library for Android and iOS (release only), which @aztec-foundation/react-native ships. +acvm-mobile: acvm + $(call build,$@,native-packages/acvm,build_mobile) + +# @aztec-foundation/react-native: the native module a React Native app links to run the client stack. Its tests run +# bb.js, bb, the ACVM, kv-sqlite and ipc-codegen's echo example from this tree under Hermes, through the module (see +# native-packages/react-native/README.md). +.PHONY: react-native react-native-tests react-native-mobile acvm-mobile +# Its node_modules portal to @aztec-labs/acvm's and kv-sqlite's generated TS packages, so those build first. +react-native: ipc-codegen acvm kv-sqlite + $(call build,$@,native-packages/react-native) + +react-native-tests: react-native bb-ts + $(call test,$@,native-packages/react-native) + +# The libraries the package ships (release only): bb and the ACVM for Android and iOS. +react-native-mobile: bb-cpp-cross-arm64-ios bb-cpp-cross-arm64-ios-sim bb-cpp-cross-arm64-android \ + bb-cpp-cross-x86_64-android acvm-mobile + #============================================================================== # .claude tooling #============================================================================== diff --git a/barretenberg/ts/bb.js/bootstrap.sh b/barretenberg/ts/bb.js/bootstrap.sh index 64093c777cb..b0f4d2ce3a8 100755 --- a/barretenberg/ts/bb.js/bootstrap.sh +++ b/barretenberg/ts/bb.js/bootstrap.sh @@ -26,7 +26,7 @@ function build { if ! cache_download bb.js-$hash.tar.gz; then find . -exec touch -d "@0" {} + 2>/dev/null || true yarn clean - parallel -v --line-buffered --tag 'denoise "yarn {}"' ::: build:esm build:cjs build:browser + parallel -v --line-buffered --tag 'denoise "yarn {}"' ::: build:esm build:cjs build:browser build:react-native cache_upload bb.js-$hash.tar.gz dest fi diff --git a/barretenberg/ts/bb.js/package.json b/barretenberg/ts/bb.js/package.json index 15e429c2d16..c2743d96a40 100644 --- a/barretenberg/ts/bb.js/package.json +++ b/barretenberg/ts/bb.js/package.json @@ -8,6 +8,7 @@ "types": "./dest/node/index.d.ts", "exports": { ".": { + "react-native": "./dest/react-native/index.js", "require": "./dest/node-cjs/index.js", "browser": "./dest/browser/index.js", "default": "./dest/node/index.js" @@ -23,10 +24,11 @@ ], "scripts": { "clean": "rm -rf ./dest .tsbuildinfo .tsbuildinfo.cjs", - "build": "yarn clean && yarn build:esm && yarn build:cjs && yarn build:browser", + "build": "yarn clean && yarn build:esm && yarn build:cjs && yarn build:browser && yarn build:react-native", "build:esm": "tsgo -b tsconfig.esm.json && chmod +x ./dest/node/bin/index.js", "build:cjs": "tsgo -b tsconfig.cjs.json && ./scripts/cjs_postprocess.sh", "build:browser": "tsgo -b tsconfig.browser.json && ./scripts/browser_postprocess.sh", + "build:react-native": "tsgo -b tsconfig.react-native.json && ./scripts/react_native_postprocess.sh", "formatting": "prettier --check ./src && eslint --max-warnings 0 ./src", "formatting:fix": "eslint --fix ./src && prettier -w ./src", "test": "NODE_OPTIONS='--loader ts-node/esm' NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --passWithNoTests", @@ -98,5 +100,6 @@ "ts-node": "^10.9.1", "typescript": "^5.3.3", "typescript-eslint": "^8.32.1" - } + }, + "react-native": "./dest/react-native/index.js" } diff --git a/barretenberg/ts/bb.js/scripts/react_native_postprocess.sh b/barretenberg/ts/bb.js/scripts/react_native_postprocess.sh new file mode 100755 index 00000000000..8ab25e9aa23 --- /dev/null +++ b/barretenberg/ts/bb.js/scripts/react_native_postprocess.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# The React Native build: the browser build's rewrite, to the react-native directories. +DIR="./dest/react-native" + +for node_dir in $(find $DIR -type d \( -name node -o -name browser \)); do + rm -rf $node_dir +done + +# Replace all **/node/** imports and exports with **/react-native/** +find "$DIR" -type f -name "*.js" -exec sed -i 's/\(import\|export\)\(.*\)from\(.*\)\/node\//\1\2from\3\/react-native\//g' {} + diff --git a/barretenberg/ts/bb.js/src/backends/browser/index.ts b/barretenberg/ts/bb.js/src/backends/browser/index.ts index e6cbb4ed822..23ef47815df 100644 --- a/barretenberg/ts/bb.js/src/backends/browser/index.ts +++ b/barretenberg/ts/bb.js/src/backends/browser/index.ts @@ -8,6 +8,9 @@ export function findBbBinary(_customPath?: string): string | null { throw new Error('findBbBinary is not available in a browser.'); } +/** The in-process backend when none is named and no process is used: bb's wasm module. */ +export const IN_PROCESS_BACKEND: BackendType = BackendType.Wasm; + /** * Create backend of specific type (no fallback) */ diff --git a/barretenberg/ts/bb.js/src/backends/index.ts b/barretenberg/ts/bb.js/src/backends/index.ts index cd5a103e73c..c90543cc6b8 100644 --- a/barretenberg/ts/bb.js/src/backends/index.ts +++ b/barretenberg/ts/bb.js/src/backends/index.ts @@ -16,6 +16,12 @@ export enum BackendType { * (BarretenbergSync) or on a native thread of its own (Barretenberg). No process is spawned. */ Napi = 'Napi', + /** + * bb's library linked into a React Native app, through JSI (React Native only, where it is the default): an + * instance of bb of its own, on the calling thread (BarretenbergSync) or on a native thread of its own + * (Barretenberg). + */ + Jsi = 'Jsi', } export type BackendOptions = { diff --git a/barretenberg/ts/bb.js/src/backends/node/index.ts b/barretenberg/ts/bb.js/src/backends/node/index.ts index bab9167925c..923593e8562 100644 --- a/barretenberg/ts/bb.js/src/backends/node/index.ts +++ b/barretenberg/ts/bb.js/src/backends/node/index.ts @@ -18,6 +18,9 @@ const SHM_RING_SIZE = 1024 * 1024 * 4; */ const BB_PROCESS_LIFETIME = { unref: true }; +/** The in-process backend when none is named and no process is used: bb's wasm module. */ +export const IN_PROCESS_BACKEND: BackendType = BackendType.Wasm; + /** * Create backend of specific type (no fallback). Everything here is bb's choice of options over * @aztec-foundation/bb.js-api's backends: thread defaults, ring sizes, artifact overrides. diff --git a/barretenberg/ts/bb.js/src/backends/react-native/index.ts b/barretenberg/ts/bb.js/src/backends/react-native/index.ts new file mode 100644 index 00000000000..659a686f0e7 --- /dev/null +++ b/barretenberg/ts/bb.js/src/backends/react-native/index.ts @@ -0,0 +1,46 @@ +import { createBackend, createBackendSync } from '@aztec-foundation/bb.js-api/react-native'; +import type { IpcClientAsync, IpcClientSync } from '@aztec-foundation/ipc-runtime'; + +import { BackendOptions, BackendType } from '../index.js'; + +/** There is no bb binary in a React Native app; bb is a library linked into it. */ +export function findBbBinary(_customPath?: string): string | null { + throw new Error('findBbBinary is not available in React Native.'); +} + +/** React Native has no WebAssembly: bb runs in-process as the library the app links, over JSI. */ +export const IN_PROCESS_BACKEND: BackendType = BackendType.Jsi; + +/** + * Create backend of specific type (no fallback) + */ +export async function createAsyncBackend( + type: BackendType, + _options: BackendOptions, + logger: (msg: string) => void, +): Promise { + switch (type) { + case BackendType.Jsi: + logger('Using the JSI backend (bb on a native thread of its own)'); + return await createBackend(); + default: + throw new Error(`Backend ${type} not supported in React Native (use BackendType.Jsi)`); + } +} + +/** + * Create backend of specific type (no fallback) + */ +export async function createSyncBackend( + type: BackendType, + _options: BackendOptions, + logger: (msg: string) => void, +): Promise { + switch (type) { + case BackendType.Jsi: + logger('Using the JSI backend (bb on the calling thread)'); + return await createBackendSync(); + default: + throw new Error(`Backend ${type} not supported in React Native (use BackendType.Jsi)`); + } +} diff --git a/barretenberg/ts/bb.js/src/barretenberg/index.ts b/barretenberg/ts/bb.js/src/barretenberg/index.ts index 8caab7f30a8..289f93224ea 100644 --- a/barretenberg/ts/bb.js/src/barretenberg/index.ts +++ b/barretenberg/ts/bb.js/src/barretenberg/index.ts @@ -1,10 +1,10 @@ import { AsyncApi, SyncApi } from '@aztec-foundation/bb.js-api'; import type { IpcClientAsync } from '@aztec-foundation/ipc-runtime'; -import { isIos } from '@aztec-foundation/ipc-runtime/wasm'; import { BackendOptions, BackendType } from '../backends/index.js'; -import { createAsyncBackend, createSyncBackend } from '../backends/node/index.js'; +import { IN_PROCESS_BACKEND, createAsyncBackend, createSyncBackend } from '../backends/node/index.js'; import { Crs, GrumpkinCrs } from '../crs/index.js'; +import { isIos } from '../platform/node/index.js'; const DEFAULT_BB_CRS_SIZE = 2 ** 19; const BN254_SRS_CHUNK_POINTS = 2 ** 17; @@ -49,7 +49,7 @@ export class Barretenberg extends AsyncApi { * If options.backend is set: uses that specific backend (throws if unavailable) * If options.backend is unset: tries backends in order with fallback: * 1. NativeUnixSocket (node, if the bb binary is available) - * 2. Wasm + * 2. Wasm (Jsi in React Native, which has no WebAssembly) * * Every backend runs off the calling thread: a bb process, or bb in-process on a thread of its own (a worker for * Wasm, a native thread for Napi). For calls on the calling thread, use BarretenbergSync. @@ -60,20 +60,24 @@ export class Barretenberg extends AsyncApi { if (options.backend) { // Explicit backend required - no fallback const backend = new Barretenberg(await createAsyncBackend(options.backend, options, logger), options); - if (options.backend === BackendType.Wasm || options.backend === BackendType.Napi) { + if ( + options.backend === BackendType.Wasm || + options.backend === BackendType.Napi || + options.backend === BackendType.Jsi + ) { await backend.initInProcess(); } return backend; } - if (typeof window === 'undefined') { + if (typeof window === 'undefined' && IN_PROCESS_BACKEND !== BackendType.Jsi) { try { return new Barretenberg(await createAsyncBackend(BackendType.NativeUnixSocket, options, logger), options); } catch (err: any) { - logger(`Unix socket unavailable (${err.message}), falling back to WASM`); + logger(`Unix socket unavailable (${err.message}), falling back to ${IN_PROCESS_BACKEND}`); } } - const backend = new Barretenberg(await createAsyncBackend(BackendType.Wasm, options, logger), options); + const backend = new Barretenberg(await createAsyncBackend(IN_PROCESS_BACKEND, options, logger), options); await backend.initInProcess(); return backend; } @@ -197,7 +201,7 @@ export class BarretenbergSync extends SyncApi { * If options.backend is unset: tries backends in order with fallback: * 1. Napi (node, if bb's library is installed): bb in-process, on the calling thread * 2. NativeSharedMem (node, if the bb binary and ipc-runtime's addon are available) - * 3. Wasm + * 3. Wasm (Jsi in React Native, which has no WebAssembly) * * Supported backends: Wasm, Napi, NativeSharedMem * Not supported: NativeUnixSocket (asynchronous only). Every backend runs on the calling thread. @@ -209,7 +213,7 @@ export class BarretenbergSync extends SyncApi { return new BarretenbergSync(await createSyncBackend(options.backend, options, logger)); } - if (typeof window === 'undefined') { + if (typeof window === 'undefined' && IN_PROCESS_BACKEND !== BackendType.Jsi) { for (const backend of [BackendType.Napi, BackendType.NativeSharedMemory]) { try { return new BarretenbergSync(await createSyncBackend(backend, options, logger)); @@ -219,7 +223,7 @@ export class BarretenbergSync extends SyncApi { } } - return new BarretenbergSync(await createSyncBackend(BackendType.Wasm, options, logger)); + return new BarretenbergSync(await createSyncBackend(IN_PROCESS_BACKEND, options, logger)); } /** diff --git a/barretenberg/ts/bb.js/src/crs/react-native/index.ts b/barretenberg/ts/bb.js/src/crs/react-native/index.ts new file mode 100644 index 00000000000..7b0113215f7 --- /dev/null +++ b/barretenberg/ts/bb.js/src/crs/react-native/index.ts @@ -0,0 +1,193 @@ +/** + * The CRS in a React Native app: downloaded once, then read from files in the app's data + * directory through @aztec-foundation/react-native's file functions. The files are named and laid + * out as the node cache's (crs/node), so a cache filled by node can be copied in. + */ + +const CRS_PRIMARY_HOST = 'https://crs.aztec-cdn.foundation'; +const CRS_FALLBACK_HOST = 'https://crs.aztec-labs.com'; + +const BN254_COMPRESSED_POINT_BYTES = 32; +const BN254_UNCOMPRESSED_POINT_BYTES = 64; +const BN254_G2_BYTES = 128; +const GRUMPKIN_POINT_BYTES = 64; + +type Logger = (msg: string) => void; + +/** The file functions @aztec-foundation/react-native installs. */ +interface AppFiles { + dataDir: string; + /** The file's size in bytes, or -1 when there is no such file. */ + fileSize(path: string): number; + /** The first `length` bytes of the file (all of it without a length). */ + readFile(path: string, length?: number): Uint8Array; + /** Writes the file whole (atomically), making its directory. */ + writeFile(path: string, data: Uint8Array): void; +} + +function appFiles(): AppFiles { + const files = (globalThis as { __aztecReactNative?: AppFiles }).__aztecReactNative; + if (!files) { + throw new Error('bb.js: the CRS cache needs @aztec-foundation/react-native; import it before bb.js.'); + } + return files; +} + +function defaultCrsPath(): string { + return `${appFiles().dataDir}/bb-crs`; +} + +/** The bytes at `url`, through XMLHttpRequest, which React Native gives array buffers. */ +function download(url: string, headers: Record): Promise { + return new Promise((resolve, reject) => { + const request = new XMLHttpRequest(); + request.open('GET', url); + request.responseType = 'arraybuffer'; + for (const [name, value] of Object.entries(headers)) { + request.setRequestHeader(name, value); + } + request.onload = () => { + if (request.status === 200 || request.status === 206) { + resolve(new Uint8Array(request.response as ArrayBuffer)); + } else { + reject(new Error(`HTTP ${request.status} from ${url}`)); + } + }; + request.onerror = () => reject(new Error(`Download of ${url} failed`)); + request.send(); + }); +} + +async function downloadWithFallback(file: string, headers: Record = {}): Promise { + let lastError: unknown; + for (let attempt = 0; attempt < 3; attempt++) { + for (const host of [CRS_PRIMARY_HOST, CRS_FALLBACK_HOST]) { + try { + return await download(`${host}/${file}`, headers); + } catch (err) { + lastError = err; + } + } + } + throw lastError; +} + +export class Crs { + private hasUncompressed = false; + + constructor( + public readonly numPoints: number, + public readonly path: string, + private readonly logger: Logger = () => {}, + ) {} + + static async new(numPoints: number, crsPath?: string, logger: Logger = () => {}) { + const crs = new Crs(numPoints, crsPath ?? defaultCrsPath(), logger); + await crs.init(); + return crs; + } + + private get requestedPoints(): number { + return Math.max(this.numPoints, 1); + } + + private get uncompressedPath() { + return `${this.path}/bn254_g1.dat`; + } + + private get compressedPath() { + return `${this.path}/bn254_g1_compressed.dat`; + } + + private get g2Path() { + return `${this.path}/bn254_g2.dat`; + } + + async init(): Promise { + const files = appFiles(); + const points = this.requestedPoints; + const uncompressed = files.fileSize(this.uncompressedPath); + const compressed = files.fileSize(this.compressedPath); + if (files.fileSize(this.g2Path) === BN254_G2_BYTES) { + if ( + uncompressed >= points * BN254_UNCOMPRESSED_POINT_BYTES && + uncompressed % BN254_UNCOMPRESSED_POINT_BYTES === 0 + ) { + this.hasUncompressed = true; + return; + } + if (compressed >= points * BN254_COMPRESSED_POINT_BYTES && compressed % BN254_COMPRESSED_POINT_BYTES === 0) { + return; + } + } + this.logger(`Downloading CRS of size ${points} into ${this.path}`); + const g1 = await downloadWithFallback('g1_compressed.dat', { + Range: `bytes=0-${points * BN254_COMPRESSED_POINT_BYTES - 1}`, + }); + if (g1.length < points * BN254_COMPRESSED_POINT_BYTES) { + throw new Error(`CRS download gave ${g1.length} bytes, expected ${points * BN254_COMPRESSED_POINT_BYTES}`); + } + const g2 = await downloadWithFallback('g2.dat'); + if (g2.length !== BN254_G2_BYTES) { + throw new Error(`CRS g2 download gave ${g2.length} bytes, expected ${BN254_G2_BYTES}`); + } + files.writeFile(this.compressedPath, g1); + files.writeFile(this.g2Path, g2); + this.hasUncompressed = false; + } + + getG1Data(): Uint8Array { + const points = this.requestedPoints; + return this.hasUncompressed + ? appFiles().readFile(this.uncompressedPath, points * BN254_UNCOMPRESSED_POINT_BYTES) + : appFiles().readFile(this.compressedPath, points * BN254_COMPRESSED_POINT_BYTES); + } + + /** Keeps the points bb decompressed, so later starts skip the decompression. */ + cacheUncompressed(data: Uint8Array): Promise { + if (appFiles().fileSize(this.uncompressedPath) < data.length) { + appFiles().writeFile(this.uncompressedPath, data); + } + this.hasUncompressed = true; + return Promise.resolve(); + } + + getG2Data(): Uint8Array { + return appFiles().readFile(this.g2Path, BN254_G2_BYTES); + } +} + +export class GrumpkinCrs { + constructor( + public readonly numPoints: number, + public readonly path: string, + private readonly logger: Logger = () => {}, + ) {} + + static async new(numPoints: number, crsPath?: string, logger: Logger = () => {}) { + const crs = new GrumpkinCrs(numPoints, crsPath ?? defaultCrsPath(), logger); + await crs.init(); + return crs; + } + + private get g1Path() { + return `${this.path}/grumpkin_g1_v2.flat.dat`; + } + + async init(): Promise { + const bytes = this.numPoints * GRUMPKIN_POINT_BYTES; + if (appFiles().fileSize(this.g1Path) >= bytes) { + return; + } + this.logger(`Downloading Grumpkin CRS of size ${this.numPoints} into ${this.path}`); + const g1 = await downloadWithFallback('grumpkin_g1_v2.dat', { Range: `bytes=0-${bytes - 1}` }); + if (g1.length < bytes) { + throw new Error(`Grumpkin CRS download gave ${g1.length} bytes, expected ${bytes}`); + } + appFiles().writeFile(this.g1Path, g1); + } + + getG1Data(): Uint8Array { + return appFiles().readFile(this.g1Path, this.numPoints * GRUMPKIN_POINT_BYTES); + } +} diff --git a/barretenberg/ts/bb.js/src/platform/browser/index.ts b/barretenberg/ts/bb.js/src/platform/browser/index.ts new file mode 100644 index 00000000000..01d3bf0958f --- /dev/null +++ b/barretenberg/ts/bb.js/src/platform/browser/index.ts @@ -0,0 +1 @@ +export { isIos } from '@aztec-foundation/ipc-runtime/wasm'; diff --git a/barretenberg/ts/bb.js/src/platform/node/index.ts b/barretenberg/ts/bb.js/src/platform/node/index.ts new file mode 100644 index 00000000000..01d3bf0958f --- /dev/null +++ b/barretenberg/ts/bb.js/src/platform/node/index.ts @@ -0,0 +1 @@ +export { isIos } from '@aztec-foundation/ipc-runtime/wasm'; diff --git a/barretenberg/ts/bb.js/src/platform/react-native/index.ts b/barretenberg/ts/bb.js/src/platform/react-native/index.ts new file mode 100644 index 00000000000..ae89bc54009 --- /dev/null +++ b/barretenberg/ts/bb.js/src/platform/react-native/index.ts @@ -0,0 +1,4 @@ +/** Whether the app runs on iOS, as @aztec-foundation/react-native reports it. */ +export function isIos(): boolean { + return (globalThis as { __aztecReactNative?: { platform?: string } }).__aztecReactNative?.platform === 'ios'; +} diff --git a/barretenberg/ts/bb.js/src/random/react-native/index.ts b/barretenberg/ts/bb.js/src/random/react-native/index.ts new file mode 100644 index 00000000000..a880e454ba1 --- /dev/null +++ b/barretenberg/ts/bb.js/src/random/react-native/index.ts @@ -0,0 +1,13 @@ +/** Random bytes from crypto.getRandomValues, which @aztec-foundation/react-native provides on Hermes. */ +export const randomBytes = (len: number) => { + const crypto = (globalThis as { crypto?: { getRandomValues(array: T): T } }).crypto; + if (!crypto?.getRandomValues) { + throw new Error('randomBytes: no crypto.getRandomValues (import @aztec-foundation/react-native first)'); + } + const buf = new Uint8Array(len); + // getRandomValues fills at most 65536 bytes per call. + for (let offset = 0; offset < len; offset += 65536) { + crypto.getRandomValues(buf.subarray(offset, Math.min(len, offset + 65536))); + } + return buf; +}; diff --git a/barretenberg/ts/bb.js/tsconfig.react-native.json b/barretenberg/ts/bb.js/tsconfig.react-native.json new file mode 100644 index 00000000000..e58f8fcaa21 --- /dev/null +++ b/barretenberg/ts/bb.js/tsconfig.react-native.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.esm.json", + "compilerOptions": { + "outDir": "dest/react-native", + "noEmit": false + }, + "include": ["src"], + "exclude": ["src/main.ts", "src/**/*.test.ts", "src/bindgen", "src/benchmark", "src/bin"] +} diff --git a/bootstrap.sh b/bootstrap.sh index 40b11f6360a..962bc010178 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -657,9 +657,12 @@ function release { ipc-codegen native-packages/kvdb native-packages/wsdb + native-packages/acvm + native-packages/kv-sqlite barretenberg/ts barretenberg/rust noir + native-packages/react-native l1-contracts protocol/constants-codegen protocol/genesis @@ -686,7 +689,7 @@ function private_release { # ci-release-pr label creates, on demand. There are no private nightlies by design # (nightly-release-tag.yml runs in the public repo alone). ci3_labels_to_env.sh forces # PRIVATE_RELEASE=1 for every release in that repo. We publish only our foundation npm packages (barretenberg/ts, noir, - # ipc-runtime, wsdb, protocol/constants-codegen, protocol/genesis, l1-contracts' l1-artifacts, the noir-projects/fnd + # react-native, ipc-runtime, wsdb, acvm, kv-sqlite, protocol/constants-codegen, protocol/genesis, l1-contracts' l1-artifacts, the noir-projects/fnd # artifacts packages) to the INTERNAL_NPM_REGISTRY npm repo in our internal GCP Artifact Registry. # We run the release step for real on exactly those components and do not invoke the others — the # remaining release sources publish public artifacts (github releases, crates.io) and are not @@ -722,9 +725,10 @@ function private_release { export NPM_CONFIG_GLOBALCONFIG="$npmrc" set -x - # Publish for real, in dependency order: the ipc-codegen-generated @aztec-labs/wsdb has a runtime - # dependency on @aztec-foundation/ipc-runtime, so ipc-runtime must precede wsdb. - local publish=(barretenberg/ts noir ipc-runtime ipc-codegen native-packages/wsdb protocol/constants-codegen protocol/genesis l1-contracts noir-projects/fnd) + # Publish for real, in dependency order: the ipc-codegen-generated packages (@aztec-labs/wsdb, acvm, + # kv-sqlite) have a runtime dependency on @aztec-foundation/ipc-runtime, so ipc-runtime precedes them, and + # @aztec-foundation/react-native depends on ipc-runtime and @aztec-labs/acvm, so it follows them. + local publish=(barretenberg/ts noir ipc-runtime ipc-codegen native-packages/wsdb native-packages/acvm native-packages/kv-sqlite native-packages/react-native protocol/constants-codegen protocol/genesis l1-contracts noir-projects/fnd) for project in "${publish[@]}"; do $project/bootstrap.sh release done diff --git a/ipc-codegen/src/typescript_package_codegen.ts b/ipc-codegen/src/typescript_package_codegen.ts index 59daab6837f..e0a1ccb41c1 100644 --- a/ipc-codegen/src/typescript_package_codegen.ts +++ b/ipc-codegen/src/typescript_package_codegen.ts @@ -813,15 +813,50 @@ ${this.serviceClasses({ process: false, wasm: true, napi: false })}`; * a backend object. */ generateReactNativeIndex(): string { - const { prefix, packageName } = this.opts; + const { prefix, packageName, ffiName } = this.opts; const svc = className(prefix); - - return `import type { IpcClientAsync, IpcClientSync } from '@aztec-foundation/ipc-runtime/registry'; -import { registerBackend as register, registeredBackend } from '@aztec-foundation/ipc-runtime/registry'; + // A package with a native library reaches it over JSI when no backend is registered; one without + // (a process-only service) has only what is registered or passed. + const jsi = this.napi; + const jsiOption = jsi + ? ` /** The library over JSI, when no backend is registered: its file and the services its host calls reach. */ + jsi?: Omit; +` + : ""; + const fallback = (kind: "async" | "sync") => + jsi + ? ` const registered = findRegisteredBackend('${prefix}', '${kind}'); + if (registered) { + return await registered(); + } + if (jsiAvailable()) { + return ${kind === "async" ? "createJsiFfiBackend" : "createJsiFfiBackendSync"}({ ffiName: '${ffiName}'${this.opts.napiLibrary ? `, library: '${this.opts.napiLibrary}'` : ""}, ...options.jsi }); + } + return await registeredBackend('${prefix}', '${kind}', '${packageName}')();` + : ` return await registeredBackend('${prefix}', '${kind}', '${packageName}')();`; + const runtimeImports = [ + "registerBackend as register", + "registeredBackend", + "SERVICE_BACKEND", + ...(jsi + ? [ + "findRegisteredBackend", + "jsiAvailable", + "createJsiFfiBackend", + "createJsiFfiBackendSync", + "type JsiFfiOptions", + ] + : []), + ]; + + return `import type { IpcClientAsync, IpcClientSync } from '@aztec-foundation/ipc-runtime/react-native'; +import { + ${runtimeImports.join(",\n ")}, +} from '@aztec-foundation/ipc-runtime/react-native'; import { AsyncApi } from './generated/async.js'; import { SyncApi } from './generated/sync.js'; -${this.initImport()}${this.generatedExports()}export type { RegisteredBackends } from '@aztec-foundation/ipc-runtime/registry'; +${this.initImport()}${this.generatedExports()}export type { RegisteredBackends } from '@aztec-foundation/ipc-runtime/react-native'; ${this.startType()} /** Make these the backends for ${prefix} in this app; a native backend package calls it on import. */ export function registerBackend(factories: Parameters[1]): void { @@ -829,20 +864,26 @@ export function registerBackend(factories: Parameters[1]): void } export interface ${prefix}CreateOptions { - /** A backend object (anything with call()/destroy()); default: the one a native package registered. */ + /** A backend object (anything with call()/destroy()); default: ${jsi ? "the one a native package registered, else the linked library over JSI" : "the one a native package registered"}. */ backend?: IpcClientAsync; -} +${jsiOption}} export interface ${prefix}CreateSyncOptions { backend?: IpcClientSync; -} +${jsiOption}} export async function createBackend(options: ${prefix}CreateOptions = {}): Promise { - return options.backend ?? (await registeredBackend('${prefix}', 'async', '${packageName}')()); + if (options.backend) { + return options.backend; + } +${fallback("async")} } export async function createBackendSync(options: ${prefix}CreateSyncOptions = {}): Promise { - return options.backend ?? (await registeredBackend('${prefix}', 'sync', '${packageName}')()); + if (options.backend) { + return options.backend; + } +${fallback("sync")} } export class ${svc} extends AsyncApi { @@ -853,7 +894,12 @@ export class ${svc} extends AsyncApi { static async create(options: ${prefix}CreateOptions${this.start()} = {}): Promise<${svc}> { return ${this.construct(svc, "await createBackend(options)")}; } -${this.startedMethod(svc, false)}} +${this.startedMethod(svc, false)} + /** The backend behind this service, so the service can be bound as another's host-call target. */ + get [SERVICE_BACKEND](): IpcClientAsync { + return this.backend; + } +} export class ${svc}Sync extends SyncApi { private constructor(backend: IpcClientSync) { @@ -863,7 +909,12 @@ export class ${svc}Sync extends SyncApi { static async create(options: ${prefix}CreateSyncOptions${this.start()} = {}): Promise<${svc}Sync> { return ${this.construct(svc + "Sync", "await createBackendSync(options)")}; } -${this.startedMethod(svc + "Sync", true)}} +${this.startedMethod(svc + "Sync", true)} + /** The backend behind this service, so the service can be bound as another's host-call target. */ + get [SERVICE_BACKEND](): IpcClientSync { + return this.backend; + } +} `; } diff --git a/ipc-runtime/cpp/jsi/ipc_runtime_jsi.cpp b/ipc-runtime/cpp/jsi/ipc_runtime_jsi.cpp new file mode 100644 index 00000000000..2cb67e5a416 --- /dev/null +++ b/ipc-runtime/cpp/jsi/ipc_runtime_jsi.cpp @@ -0,0 +1,898 @@ +#include "ipc_runtime_jsi.hpp" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace fj = facebook::jsi; + +namespace ipc::jsi { + +namespace { + +using HostCallFn = int32_t (*)(const uint8_t*, size_t, const uint8_t*, size_t, uint8_t**, size_t*); + +/** A host call's answer: response bytes (or an error message) and status, 0 for a response. */ +struct Answer { + std::vector bytes; + int32_t status = 0; +}; + +/** Where the host calls of the instance call in progress on a thread go. */ +using Router = std::function request)>; + +thread_local const Router* current_router = nullptr; +thread_local void* (*current_alloc)(size_t) = nullptr; + +int32_t respond(void* (*alloc)(size_t), const Answer& answer, uint8_t** response, size_t* response_len) +{ + auto* out = static_cast(alloc(answer.bytes.empty() ? 1 : answer.bytes.size())); + if (!answer.bytes.empty()) { + std::memcpy(out, answer.bytes.data(), answer.bytes.size()); + } + *response = out; + *response_len = answer.bytes.size(); + return answer.status; +} + +/** Every library's host-call function: answered by the router of the call in progress on this thread. */ +int32_t host_call(const uint8_t* target, + size_t target_len, + const uint8_t* request, + size_t request_len, + uint8_t** response, + size_t* response_len) +{ + if (current_router == nullptr) { + static const std::string message = "host_call: nothing is bound for this call's host calls (pass hostCall)"; + // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) + return respond(std::malloc, { { message.begin(), message.end() }, 1 }, response, response_len); + } + Answer answer; + try { + answer = (*current_router)(std::string_view(reinterpret_cast(target), target_len), + std::vector(request, request + request_len)); + } catch (const std::exception& e) { + std::string message = e.what(); + answer = { { message.begin(), message.end() }, 1 }; + } + return respond(current_alloc, answer, response, response_len); +} + +class RouterScope { + public: + RouterScope(const Router* router, void* (*alloc)(size_t)) + : previous_router_(current_router) + , previous_alloc_(current_alloc) + { + current_router = router; + current_alloc = alloc; + } + RouterScope(const RouterScope&) = delete; + RouterScope& operator=(const RouterScope&) = delete; + RouterScope(RouterScope&&) = delete; + RouterScope& operator=(RouterScope&&) = delete; + ~RouterScope() + { + current_router = previous_router_; + current_alloc = previous_alloc_; + } + + private: + const Router* previous_router_; + void* (*previous_alloc_)(size_t); +}; + +std::mutex& registry_mutex() +{ + static std::mutex mutex; + return mutex; +} + +std::map>& registry() +{ + static std::map> libraries; + return libraries; +} + +template Fn symbol(void* handle, const std::string& name) +{ + return reinterpret_cast(dlsym(handle, name.c_str())); +} + +std::optional symbols_in(void* handle, const std::string& ffi_name) +{ + if (handle == nullptr) { + return std::nullopt; + } + FfiSymbols symbols; + symbols.create = symbol(handle, ffi_name + "_ipc_ffi_create"); + symbols.call = symbol(handle, ffi_name + "_ipc_ffi_call"); + symbols.destroy = symbol(handle, ffi_name + "_ipc_ffi_destroy"); + symbols.alloc = symbol(handle, ffi_name + "_ipc_ffi_alloc"); + symbols.free = symbol(handle, ffi_name + "_ipc_ffi_free"); + symbols.set_host_call = symbol(handle, ffi_name + "_ipc_ffi_set_host_call"); + symbols.create_async = symbol(handle, ffi_name + "_ipc_ffi_create_async"); + symbols.submit = symbol(handle, ffi_name + "_ipc_ffi_submit"); + symbols.deliver = symbol(handle, ffi_name + "_ipc_ffi_deliver"); + symbols.destroy_async = symbol(handle, ffi_name + "_ipc_ffi_destroy_async"); + if (symbols.create_async == nullptr || symbols.submit == nullptr || symbols.deliver == nullptr || + symbols.destroy_async == nullptr) { + symbols.create_async = nullptr; + } + if (symbols.create == nullptr || symbols.call == nullptr || symbols.destroy == nullptr || + symbols.alloc == nullptr || symbols.free == nullptr) { + return std::nullopt; + } + return symbols; +} + +/** + * The library with this FFI name: registered, else `library` (a file name or path) when given, else + * lib.so/.dylib, else already in the process. + */ +std::shared_ptr find_library(const std::string& ffi_name, const std::string& library) +{ + std::lock_guard lock(registry_mutex()); + auto& entry = registry()[ffi_name]; + if (!entry) { + std::optional found; + std::vector files; + if (!library.empty()) { + files.push_back(library); + } + files.push_back("lib" + ffi_name + ".so"); + files.push_back("lib" + ffi_name + ".dylib"); + for (const auto& file : files) { + if ((found = symbols_in(dlopen(file.c_str(), RTLD_NOW | RTLD_LOCAL), ffi_name))) { + break; + } + } + if (!found) { + found = symbols_in(RTLD_DEFAULT, ffi_name); + } + if (!found) { + registry().erase(ffi_name); + throw std::runtime_error("ipc-runtime: no FFI library \"" + ffi_name + "\" is linked into the app (lib" + + ffi_name + " exporting " + ffi_name + "_ipc_ffi_*)"); + } + if (found->set_host_call != nullptr) { + found->set_host_call(&host_call); + } + entry = std::make_shared(*found); + } + return entry; +} + +/** A host function's first argument, or undefined. */ +const fj::Value& first_arg(const fj::Value* args, size_t count) +{ + static const fj::Value undefined; + return count > 0 ? args[0] : undefined; +} + +/** The bytes of a Uint8Array (or any ArrayBufferView, or an ArrayBuffer). */ +std::vector bytes_of(fj::Runtime& rt, const fj::Value& value) +{ + if (!value.isObject()) { + throw fj::JSError(rt, "ipc-runtime: expected a Uint8Array"); + } + auto object = value.getObject(rt); + if (object.isArrayBuffer(rt)) { + auto buffer = object.getArrayBuffer(rt); + return { buffer.data(rt), buffer.data(rt) + buffer.size(rt) }; + } + auto buffer_value = object.getProperty(rt, "buffer"); + if (!buffer_value.isObject() || !buffer_value.getObject(rt).isArrayBuffer(rt)) { + throw fj::JSError(rt, "ipc-runtime: expected a Uint8Array"); + } + auto buffer = buffer_value.getObject(rt).getArrayBuffer(rt); + auto offset = static_cast(object.getProperty(rt, "byteOffset").asNumber()); + auto length = static_cast(object.getProperty(rt, "byteLength").asNumber()); + if (offset + length > buffer.size(rt)) { + throw fj::JSError(rt, "ipc-runtime: Uint8Array outside its buffer"); + } + const uint8_t* data = buffer.data(rt) + offset; + return { data, data + length }; +} + +class OwnedBuffer final : public fj::MutableBuffer { + public: + explicit OwnedBuffer(std::vector bytes) + : bytes_(std::move(bytes)) + {} + size_t size() const override { return bytes_.size(); } + uint8_t* data() override { return bytes_.data(); } + + private: + std::vector bytes_; +}; + +fj::Value uint8_array(fj::Runtime& rt, std::vector bytes) +{ + fj::ArrayBuffer buffer(rt, std::make_shared(std::move(bytes))); + return rt.global().getPropertyAsFunction(rt, "Uint8Array").callAsConstructor(rt, buffer); +} + +/** Runs the library's call on an instance and returns the response payload. */ +std::vector call_library(const FfiSymbols& library, void* instance, const std::vector& request) +{ + uint8_t* output = nullptr; + size_t output_len = 0; + library.call(instance, request.data(), request.size(), &output, &output_len); + std::vector response(output, output + output_len); + library.free(output); + return response; +} + +/** Host calls answered on the JavaScript thread, which is the calling thread, synchronously. */ +Router synchronous_router(fj::Runtime& rt, std::shared_ptr fn) +{ + return [&rt, fn](std::string_view target, std::vector request) -> Answer { + try { + auto result = + fn->call(rt, fj::String::createFromUtf8(rt, std::string(target)), uint8_array(rt, std::move(request))); + if (result.isObject() && result.getObject(rt).hasProperty(rt, "then")) { + static const std::string message = "a synchronous instance needs synchronous host-call answers"; + return { { message.begin(), message.end() }, 1 }; + } + return { bytes_of(rt, result), 0 }; + } catch (const fj::JSError& e) { + std::string message = e.getMessage(); + return { { message.begin(), message.end() }, 1 }; + } + }; +} + +/** An instance on the JavaScript thread. */ +class SyncInstance final : public fj::HostObject { + public: + explicit SyncInstance(std::shared_ptr library) + : library_(std::move(library)) + , instance_(library_->create()) + { + if (instance_ == nullptr) { + throw std::runtime_error("ipc-runtime: the library could not make an instance"); + } + } + SyncInstance(const SyncInstance&) = delete; + SyncInstance& operator=(const SyncInstance&) = delete; + SyncInstance(SyncInstance&&) = delete; + SyncInstance& operator=(SyncInstance&&) = delete; + ~SyncInstance() override { end(); } + + fj::Value get(fj::Runtime& rt, const fj::PropNameID& name) override + { + auto property = name.utf8(rt); + if (property == "callSync") { + return fj::Function::createFromHostFunction( + rt, name, 2, [this](fj::Runtime& rt, const fj::Value&, const fj::Value* args, size_t count) { + if (instance_ == nullptr) { + throw fj::JSError(rt, "ipc-runtime: instance destroyed"); + } + auto request = bytes_of(rt, first_arg(args, count)); + std::optional router; + if (count > 1 && args[1].isObject() && args[1].getObject(rt).isFunction(rt)) { + router = synchronous_router( + rt, std::make_shared(args[1].getObject(rt).getFunction(rt))); + } + if (in_call_) { + throw fj::JSError(rt, "ipc-runtime: a host call cannot call back into its own instance"); + } + in_call_ = true; + std::vector response; + { + RouterScope scope(router ? &*router : nullptr, library_->alloc); + response = call_library(*library_, instance_, request); + } + in_call_ = false; + return uint8_array(rt, std::move(response)); + }); + } + if (property == "destroy") { + return fj::Function::createFromHostFunction( + rt, name, 0, [this](fj::Runtime&, const fj::Value&, const fj::Value*, size_t) { + end(); + return fj::Value::undefined(); + }); + } + return fj::Value::undefined(); + } + + private: + void end() + { + if (instance_ != nullptr && !in_call_) { + library_->destroy(instance_); + instance_ = nullptr; + } + } + + std::shared_ptr library_; + void* instance_; + bool in_call_ = false; +}; + +/** + * One thread that runs an instance's calls in order. The thread owns the queue with the object, so the object may + * go away from a task of its own (when that task held the instance's last reference): the thread then finishes + * the queue and exits on its own. + */ +class ServiceThread { + public: + ServiceThread() + : state_(std::make_shared()) + , thread_([state = state_] { run(*state); }) + {} + ServiceThread(const ServiceThread&) = delete; + ServiceThread& operator=(const ServiceThread&) = delete; + ServiceThread(ServiceThread&&) = delete; + ServiceThread& operator=(ServiceThread&&) = delete; + ~ServiceThread() + { + { + std::lock_guard lock(state_->mutex); + state_->stopping = true; + } + state_->ready.notify_one(); + if (thread_.get_id() == std::this_thread::get_id()) { + thread_.detach(); + } else { + thread_.join(); + } + } + + void post(std::function task) + { + { + std::lock_guard lock(state_->mutex); + state_->tasks.push_back(std::move(task)); + } + state_->ready.notify_one(); + } + + private: + struct State { + std::mutex mutex; + std::condition_variable ready; + std::deque> tasks; + bool stopping = false; + }; + + static void run(State& state) + { + for (;;) { + std::function task; + { + std::unique_lock lock(state.mutex); + state.ready.wait(lock, [&state] { return state.stopping || !state.tasks.empty(); }); + if (state.tasks.empty()) { + return; + } + task = std::move(state.tasks.front()); + state.tasks.pop_front(); + } + task(); + } + } + + std::shared_ptr state_; + std::thread thread_; +}; + +/** A promise of a host call's answer, settled on the JavaScript thread and waited on by the service thread. */ +class PendingAnswer { + public: + void settle(Answer answer) + { + { + std::lock_guard lock(mutex_); + answer_ = std::move(answer); + } + ready_.notify_one(); + } + Answer wait() + { + std::unique_lock lock(mutex_); + ready_.wait(lock, [this] { return answer_.has_value(); }); + return std::move(*answer_); + } + + private: + std::mutex mutex_; + std::condition_variable ready_; + std::optional answer_; +}; + +Answer error_answer(const std::string& message) +{ + return { { message.begin(), message.end() }, 1 }; +} + +std::string message_of(fj::Runtime& rt, const fj::Value& error) +{ + if (error.isObject()) { + auto message = error.getObject(rt).getProperty(rt, "message"); + if (message.isString()) { + return message.getString(rt).utf8(rt); + } + } + return error.toString(rt).utf8(rt); +} + +/** Settles `pending` with what the JavaScript host-call function answered, now or once its promise settles. */ +void answer_from_js(fj::Runtime& rt, + fj::Function& fn, + std::string target, + std::vector request, + const std::shared_ptr& pending) +{ + fj::Value result; + try { + result = fn.call(rt, fj::String::createFromUtf8(rt, target), uint8_array(rt, std::move(request))); + } catch (const fj::JSError& e) { + pending->settle(error_answer(e.getMessage())); + return; + } + if (!(result.isObject() && result.getObject(rt).hasProperty(rt, "then"))) { + try { + pending->settle({ bytes_of(rt, result), 0 }); + } catch (const fj::JSError& e) { + pending->settle(error_answer(e.getMessage())); + } + return; + } + auto on_value = fj::Function::createFromHostFunction( + rt, + fj::PropNameID::forAscii(rt, "onHostCallAnswer"), + 1, + [pending](fj::Runtime& rt, const fj::Value&, const fj::Value* args, size_t count) { + try { + pending->settle({ bytes_of(rt, first_arg(args, count)), 0 }); + } catch (const fj::JSError& e) { + pending->settle(error_answer(e.getMessage())); + } + return fj::Value::undefined(); + }); + auto on_error = fj::Function::createFromHostFunction( + rt, + fj::PropNameID::forAscii(rt, "onHostCallError"), + 1, + [pending](fj::Runtime& rt, const fj::Value&, const fj::Value* args, size_t count) { + pending->settle(error_answer(message_of(rt, first_arg(args, count)))); + return fj::Value::undefined(); + }); + result.getObject(rt).getPropertyAsFunction(rt, "then").callWithThis(rt, result.getObject(rt), on_value, on_error); +} + +/** An instance on a service thread of its own; its calls return promises. */ +class AsyncInstance final : public fj::HostObject, public std::enable_shared_from_this { + public: + AsyncInstance(std::shared_ptr library, RunOnJs run_on_js) + : library_(std::move(library)) + , run_on_js_(std::move(run_on_js)) + , thread_(std::make_shared()) + {} + AsyncInstance(const AsyncInstance&) = delete; + AsyncInstance& operator=(const AsyncInstance&) = delete; + AsyncInstance(AsyncInstance&&) = delete; + AsyncInstance& operator=(AsyncInstance&&) = delete; + /** Every posted task holds the instance, so none is left to run by now. */ + ~AsyncInstance() override + { + if (instance_ != nullptr) { + library_->destroy(instance_); + } + } + + fj::Value get(fj::Runtime& rt, const fj::PropNameID& name) override + { + auto property = name.utf8(rt); + if (property == "call") { + return fj::Function::createFromHostFunction( + rt, + name, + 2, + [self = shared_from_this()](fj::Runtime& rt, const fj::Value&, const fj::Value* args, size_t count) { + auto request = bytes_of(rt, first_arg(args, count)); + std::shared_ptr host_fn; + if (count > 1 && args[1].isObject() && args[1].getObject(rt).isFunction(rt)) { + host_fn = std::make_shared(args[1].getObject(rt).getFunction(rt)); + } + return self->call(rt, std::move(request), std::move(host_fn)); + }); + } + if (property == "destroy") { + return fj::Function::createFromHostFunction( + rt, name, 0, [self = shared_from_this()](fj::Runtime&, const fj::Value&, const fj::Value*, size_t) { + self->end(); + return fj::Value::undefined(); + }); + } + return fj::Value::undefined(); + } + + private: + fj::Value call(fj::Runtime& rt, std::vector request, std::shared_ptr host_fn) + { + auto promise_ctor = rt.global().getPropertyAsFunction(rt, "Promise"); + auto self = shared_from_this(); + auto executor = fj::Function::createFromHostFunction( + rt, + fj::PropNameID::forAscii(rt, "executor"), + 2, + [self, request = std::move(request), host_fn]( + fj::Runtime& rt, const fj::Value&, const fj::Value* args, size_t) mutable { + auto resolve = std::make_shared(args[0].getObject(rt).getFunction(rt)); + auto reject = std::make_shared(args[1].getObject(rt).getFunction(rt)); + self->start(std::move(request), std::move(host_fn), std::move(resolve), std::move(reject)); + return fj::Value::undefined(); + }); + return promise_ctor.callAsConstructor(rt, executor); + } + + /** + * The JavaScript values one call holds: the host-call function and the promise's resolvers. Only the + * JavaScript thread touches them, and it releases them there when the call settles, so the service thread + * never ends up holding the last reference to one. + */ + struct CallRefs { + std::shared_ptr host_fn; + std::shared_ptr resolve; + std::shared_ptr reject; + }; + + /** Runs the call on the service thread, and settles its promise on the JavaScript thread. */ + void start(std::vector request, + std::shared_ptr host_fn, + std::shared_ptr resolve, + std::shared_ptr reject) + { + if (ended_) { + throw std::runtime_error("ipc-runtime: instance destroyed"); + } + auto refs = std::make_shared(CallRefs{ std::move(host_fn), std::move(resolve), std::move(reject) }); + const bool has_host_fn = refs->host_fn != nullptr; + auto self = shared_from_this(); + thread_->post([self, request = std::move(request), refs, has_host_fn]() { + std::string error; + std::vector response; + try { + if (self->instance_ == nullptr) { + self->instance_ = self->library_->create(); + if (self->instance_ == nullptr) { + throw std::runtime_error("ipc-runtime: the library could not make an instance"); + } + } + Router router = [self, refs, has_host_fn](std::string_view target, + std::vector request) -> Answer { + if (!has_host_fn) { + return error_answer("host_call: nothing is bound for this call's host calls (pass hostCall)"); + } + auto pending = std::make_shared(); + self->run_on_js_([refs, target = std::string(target), request = std::move(request), pending]( + fj::Runtime& rt) mutable { + answer_from_js(rt, *refs->host_fn, std::move(target), std::move(request), pending); + }); + return pending->wait(); + }; + RouterScope scope(&router, self->library_->alloc); + response = call_library(*self->library_, self->instance_, request); + } catch (const std::exception& e) { + error = e.what(); + if (error.empty()) { + error = "ipc-runtime: the call failed"; + } + } + self->run_on_js_([refs, error = std::move(error), response = std::move(response)](fj::Runtime& rt) mutable { + if (error.empty()) { + refs->resolve->call(rt, uint8_array(rt, std::move(response))); + } else { + refs->reject->call(rt, fj::JSError(rt, error).value()); + } + refs->host_fn.reset(); + refs->resolve.reset(); + refs->reject.reset(); + }); + }); + } + + /** Ends the instance once the calls already posted have run, on its own thread. */ + void end() + { + if (ended_) { + return; + } + ended_ = true; + auto self = shared_from_this(); + thread_->post([self] { + if (self->instance_ != nullptr) { + self->library_->destroy(self->instance_); + self->instance_ = nullptr; + } + }); + } + + std::shared_ptr library_; + RunOnJs run_on_js_; + std::shared_ptr thread_; + void* instance_ = nullptr; + bool ended_ = false; +}; + +/** + * An asynchronous instance on a service thread of its own: submit() and deliver() queue to the thread, + * and the instance's responses and host calls reach JavaScript as events, on its thread. The instance is + * made by the thread's first task and ended by its last. + */ +class EventInstance final : public fj::HostObject, public std::enable_shared_from_this { + public: + EventInstance(std::shared_ptr library, RunOnJs run_on_js, std::shared_ptr on_event) + : library_(std::move(library)) + , events_(std::make_shared(std::move(run_on_js), std::move(on_event))) + , thread_(std::make_shared()) + { + thread_->post([library = library_, events = events_, instance = instance_] { + *instance = library->create_async(events.get(), &EventInstance::on_respond, &EventInstance::on_call); + }); + } + EventInstance(const EventInstance&) = delete; + EventInstance& operator=(const EventInstance&) = delete; + EventInstance(EventInstance&&) = delete; + EventInstance& operator=(EventInstance&&) = delete; + ~EventInstance() override { end(); } + + fj::Value get(fj::Runtime& rt, const fj::PropNameID& name) override + { + auto property = name.utf8(rt); + if (property == "submit") { + return fj::Function::createFromHostFunction( + rt, + name, + 2, + [self = shared_from_this()](fj::Runtime& rt, const fj::Value&, const fj::Value* args, size_t count) { + if (count < 2 || !args[0].isNumber()) { + throw fj::JSError(rt, "submit(requestId, request) expects a number and a Uint8Array"); + } + self->post(static_cast(args[0].asNumber()), 0, bytes_of(rt, args[1]), false); + return fj::Value::undefined(); + }); + } + if (property == "deliver") { + return fj::Function::createFromHostFunction( + rt, + name, + 3, + [self = shared_from_this()](fj::Runtime& rt, const fj::Value&, const fj::Value* args, size_t count) { + if (count < 3 || !args[0].isNumber() || !args[1].isNumber()) { + throw fj::JSError(rt, "deliver(callId, status, response) expects two numbers and a Uint8Array"); + } + self->post(static_cast(args[0].asNumber()), + static_cast(args[1].asNumber()), + bytes_of(rt, args[2]), + true); + return fj::Value::undefined(); + }); + } + if (property == "destroy") { + return fj::Function::createFromHostFunction( + rt, name, 0, [self = shared_from_this()](fj::Runtime&, const fj::Value&, const fj::Value*, size_t) { + self->end(); + return fj::Value::undefined(); + }); + } + return fj::Value::undefined(); + } + + private: + /** What the instance's callbacks reach. on_event is only touched, and released, on the JavaScript thread. */ + struct Events : std::enable_shared_from_this { + Events(RunOnJs run_on_js, std::shared_ptr on_event) + : run_on_js(std::move(run_on_js)) + , on_event(std::move(on_event)) + {} + RunOnJs run_on_js; + std::shared_ptr on_event; + }; + + static void report(void* ctx, int kind, uint64_t id, std::string target, std::vector bytes) + { + auto events = static_cast(ctx)->shared_from_this(); + // An event still queued when the instance ends finds on_event gone, and is dropped. + events->run_on_js( + [events, kind, id, target = std::move(target), bytes = std::move(bytes)](fj::Runtime& rt) mutable { + if (!events->on_event) { + return; + } + events->on_event->call(rt, + fj::Value(kind), + fj::Value(static_cast(id)), + fj::String::createFromUtf8(rt, target), + uint8_array(rt, std::move(bytes))); + }); + } + + static void on_respond(void* ctx, uint64_t request_id, const uint8_t* response, size_t len) + { + report(ctx, 0, request_id, std::string(), std::vector(response, response + len)); + } + + static void on_call( + void* ctx, uint64_t call_id, const uint8_t* target, size_t target_len, const uint8_t* request, size_t len) + { + report(ctx, + 1, + call_id, + std::string(reinterpret_cast(target), target_len), + std::vector(request, request + len)); + } + + void post(uint64_t id, int32_t status, std::vector bytes, bool deliver) + { + if (ended_) { + return; + } + thread_->post([library = library_, instance = instance_, id, status, bytes = std::move(bytes), deliver] { + if (*instance == nullptr) { + return; + } + if (deliver) { + library->deliver(*instance, id, status, bytes.data(), bytes.size()); + } else { + library->submit(*instance, id, bytes.data(), bytes.size()); + } + }); + } + + /** + * Lets go of onEvent now, on the JavaScript thread (destroy() and the destructor both run there, the + * destructor possibly as the runtime goes away), and ends the instance once the tasks already posted + * have run. + */ + void end() + { + if (ended_) { + return; + } + ended_ = true; + events_->on_event.reset(); + thread_->post([library = library_, instance = instance_, events = events_] { + if (*instance != nullptr) { + library->destroy_async(*instance); + *instance = nullptr; + } + }); + } + + std::shared_ptr library_; + std::shared_ptr events_; + /** Set and read only on the service thread. */ + std::shared_ptr instance_ = std::make_shared(nullptr); + std::shared_ptr thread_; + bool ended_ = false; +}; + +} // namespace + +void register_ffi(const std::string& ffi_name, const FfiSymbols& symbols) +{ + if (symbols.set_host_call != nullptr) { + symbols.set_host_call(&host_call); + } + std::lock_guard lock(registry_mutex()); + registry()[ffi_name] = std::make_shared(symbols); +} + +void install(fj::Runtime& runtime, RunOnJs run_on_js) +{ + auto api = fj::Object(runtime); + auto shared_run_on_js = std::make_shared(std::move(run_on_js)); + api.setProperty( + runtime, + "createInstance", + fj::Function::createFromHostFunction( + runtime, + fj::PropNameID::forAscii(runtime, "createInstance"), + 1, + [shared_run_on_js](fj::Runtime& rt, const fj::Value&, const fj::Value* args, size_t count) { + if (count < 1 || !args[0].isString()) { + throw fj::JSError(rt, "createInstance(ffiName) expects the library's FFI name"); + } + try { + auto library = + find_library(args[0].getString(rt).utf8(rt), + count > 1 && args[1].isString() ? args[1].getString(rt).utf8(rt) : std::string()); + return fj::Value(rt, + fj::Object::createFromHostObject( + rt, std::make_shared(std::move(library), *shared_run_on_js))); + } catch (const std::runtime_error& e) { + throw fj::JSError(rt, e.what()); + } + })); + api.setProperty( + runtime, + "createInstanceSync", + fj::Function::createFromHostFunction( + runtime, + fj::PropNameID::forAscii(runtime, "createInstanceSync"), + 1, + [](fj::Runtime& rt, const fj::Value&, const fj::Value* args, size_t count) { + if (count < 1 || !args[0].isString()) { + throw fj::JSError(rt, "createInstanceSync(ffiName) expects the library's FFI name"); + } + try { + auto library = + find_library(args[0].getString(rt).utf8(rt), + count > 1 && args[1].isString() ? args[1].getString(rt).utf8(rt) : std::string()); + return fj::Value(rt, fj::Object::createFromHostObject(rt, std::make_shared(library))); + } catch (const std::runtime_error& e) { + throw fj::JSError(rt, e.what()); + } + })); + api.setProperty(runtime, + "hasAsyncInstances", + fj::Function::createFromHostFunction( + runtime, + fj::PropNameID::forAscii(runtime, "hasAsyncInstances"), + 1, + [](fj::Runtime& rt, const fj::Value&, const fj::Value* args, size_t count) { + if (count < 1 || !args[0].isString()) { + throw fj::JSError(rt, "hasAsyncInstances(ffiName) expects the library's FFI name"); + } + try { + auto library = find_library( + args[0].getString(rt).utf8(rt), + count > 1 && args[1].isString() ? args[1].getString(rt).utf8(rt) : std::string()); + return fj::Value(library->create_async != nullptr); + } catch (const std::runtime_error& e) { + throw fj::JSError(rt, e.what()); + } + })); + api.setProperty( + runtime, + "createAsyncInstance", + fj::Function::createFromHostFunction( + runtime, + fj::PropNameID::forAscii(runtime, "createAsyncInstance"), + 3, + [shared_run_on_js](fj::Runtime& rt, const fj::Value&, const fj::Value* args, size_t count) { + if (count < 3 || !args[0].isString() || !args[2].isObject() || !args[2].getObject(rt).isFunction(rt)) { + throw fj::JSError(rt, + "createAsyncInstance(ffiName, library, onEvent) expects the library's FFI name " + "and an event function"); + } + try { + auto library = find_library(args[0].getString(rt).utf8(rt), + args[1].isString() ? args[1].getString(rt).utf8(rt) : std::string()); + if (library->create_async == nullptr) { + throw std::runtime_error("ipc-runtime: \"" + args[0].getString(rt).utf8(rt) + + "\" exports no asynchronous instances"); + } + auto on_event = std::make_shared(args[2].getObject(rt).getFunction(rt)); + return fj::Value(rt, + fj::Object::createFromHostObject( + rt, + std::make_shared( + std::move(library), *shared_run_on_js, std::move(on_event)))); + } catch (const std::runtime_error& e) { + throw fj::JSError(rt, e.what()); + } + })); + runtime.global().setProperty(runtime, "__ipcRuntimeJsi", api); +} + +} // namespace ipc::jsi diff --git a/ipc-runtime/cpp/jsi/ipc_runtime_jsi.hpp b/ipc-runtime/cpp/jsi/ipc_runtime_jsi.hpp new file mode 100644 index 00000000000..edde72c46d3 --- /dev/null +++ b/ipc-runtime/cpp/jsi/ipc_runtime_jsi.hpp @@ -0,0 +1,135 @@ +#pragma once +/** + * @file ipc_runtime_jsi.hpp + * @brief The ipc-codegen FFI contract over JSI, for React Native: what the Node-API addon is to node. + * + * Hermes has no WebAssembly and no workers, so a service runs in a React Native app as its native + * library, linked into the app, and its JavaScript client reaches it through the functions + * install() puts on `globalThis.__ipcRuntimeJsi`: + * + * createInstance(ffiName, library?) an instance on a thread of its own; call() returns a promise + * createInstanceSync(ffiName, library?) an instance on the JavaScript thread; callSync() returns the bytes + * hasAsyncInstances(ffiName, library?) whether the library exports asynchronous instances + * createAsyncInstance(ffiName, library, onEvent) + * an asynchronous instance on a thread of its own (see below) + * + * Each instance has `call`/`callSync(request, hostCall?)` and `destroy()`. `hostCall(target, + * request)` answers the instance's host calls: with a Uint8Array, or for an asynchronous instance + * also with a promise of one, which its thread waits on while the JavaScript thread runs. + * + * An asynchronous instance (the library's _ipc_ffi_create_async and the rest) has + * `submit(requestId, request)`, `deliver(callId, status, response)` and `destroy()`, none of which + * blocks; it reports on the JavaScript thread through `onEvent(kind, id, target, bytes)`: kind 0 the + * response to request `id`, kind 1 a host call `id` to `target`, answered with deliver(). It keeps + * taking requests while its host calls are out, so a host call may lead back into it. + * + * A library is found by its FFI name: registered with register_ffi() (a static library, as on + * iOS), else loaded from `library` when given, else as lib.so / lib.dylib, else + * looked up among the symbols already in the process. + */ + +#include + +#include +#include +#include +#include + +namespace ipc::jsi { + +/** One library's FFI exports: `_ipc_ffi_*`. set_host_call is null for a library that has no host calls. */ +struct FfiSymbols { + void* (*create)() = nullptr; + void (*call)(void* instance, const uint8_t* input, size_t input_len, uint8_t** output, size_t* output_len) = + nullptr; + void (*destroy)(void* instance) = nullptr; + void* (*alloc)(size_t size) = nullptr; + void (*free)(void* ptr) = nullptr; + void (*set_host_call)(int32_t (*host_call)(const uint8_t* target, + size_t target_len, + const uint8_t* request, + size_t request_len, + uint8_t** response, + size_t* response_len)) = nullptr; + /** The asynchronous instances, for a library that has them (all four, or none). */ + void* (*create_async)(void* host_ctx, + void (*respond)(void* host_ctx, uint64_t request_id, const uint8_t* response, size_t len), + void (*call)(void* host_ctx, + uint64_t call_id, + const uint8_t* target, + size_t target_len, + const uint8_t* request, + size_t request_len)) = nullptr; + void (*submit)(void* instance, uint64_t request_id, const uint8_t* input, size_t input_len) = nullptr; + void (*deliver)(void* instance, uint64_t call_id, int32_t status, const uint8_t* response, size_t len) = nullptr; + void (*destroy_async)(void* instance) = nullptr; +}; + +/** Makes a library linked into the app reachable by its FFI name. */ +void register_ffi(const std::string& ffi_name, const FfiSymbols& symbols); + +/** + * Runs a task on the JavaScript thread, with its runtime: React Native's CallInvoker::invokeAsync, + * or a test host's event loop. Called from any thread. + */ +using RunOnJs = std::function)>; + +/** Puts `__ipcRuntimeJsi` on the runtime's global object. Call on the JavaScript thread. */ +void install(facebook::jsi::Runtime& runtime, RunOnJs run_on_js); + +} // namespace ipc::jsi + +/** + * Declares a statically linked library's FFI exports, for registering them under its FFI name from a + * translation unit of the app (where the linker keeps them): + * + * IPC_RUNTIME_JSI_DECLARE_FFI(bb) + * ipc::jsi::register_ffi("bb", IPC_RUNTIME_JSI_SYMBOLS(bb)); + * + * The _WITH_HOST_CALLS variants are for a library that makes host calls (exports set_host_call), and + * the _ASYNC ones for a library that also has asynchronous instances (exports create_async and the rest). + */ +#define IPC_RUNTIME_JSI_DECLARE_FFI(name) \ + extern "C" void* name##_ipc_ffi_create(); \ + extern "C" void name##_ipc_ffi_call(void*, const uint8_t*, size_t, uint8_t**, size_t*); \ + extern "C" void name##_ipc_ffi_destroy(void*); \ + extern "C" void* name##_ipc_ffi_alloc(size_t); \ + extern "C" void name##_ipc_ffi_free(void*); + +#define IPC_RUNTIME_JSI_DECLARE_FFI_WITH_HOST_CALLS(name) \ + IPC_RUNTIME_JSI_DECLARE_FFI(name) \ + extern "C" void name##_ipc_ffi_set_host_call( \ + int32_t (*)(const uint8_t*, size_t, const uint8_t*, size_t, uint8_t**, size_t*)); + +#define IPC_RUNTIME_JSI_SYMBOLS(name) \ + ::ipc::jsi::FfiSymbols \ + { \ + .create = name##_ipc_ffi_create, .call = name##_ipc_ffi_call, .destroy = name##_ipc_ffi_destroy, \ + .alloc = name##_ipc_ffi_alloc, .free = name##_ipc_ffi_free, .set_host_call = nullptr \ + } + +#define IPC_RUNTIME_JSI_SYMBOLS_WITH_HOST_CALLS(name) \ + ::ipc::jsi::FfiSymbols \ + { \ + .create = name##_ipc_ffi_create, .call = name##_ipc_ffi_call, .destroy = name##_ipc_ffi_destroy, \ + .alloc = name##_ipc_ffi_alloc, .free = name##_ipc_ffi_free, .set_host_call = name##_ipc_ffi_set_host_call \ + } + +#define IPC_RUNTIME_JSI_DECLARE_FFI_ASYNC(name) \ + IPC_RUNTIME_JSI_DECLARE_FFI_WITH_HOST_CALLS(name) \ + extern "C" void* name##_ipc_ffi_create_async( \ + void*, \ + void (*)(void*, uint64_t, const uint8_t*, size_t), \ + void (*)(void*, uint64_t, const uint8_t*, size_t, const uint8_t*, size_t)); \ + extern "C" void name##_ipc_ffi_submit(void*, uint64_t, const uint8_t*, size_t); \ + extern "C" void name##_ipc_ffi_deliver(void*, uint64_t, int32_t, const uint8_t*, size_t); \ + extern "C" void name##_ipc_ffi_destroy_async(void*); + +#define IPC_RUNTIME_JSI_SYMBOLS_ASYNC(name) \ + ::ipc::jsi::FfiSymbols \ + { \ + .create = name##_ipc_ffi_create, .call = name##_ipc_ffi_call, .destroy = name##_ipc_ffi_destroy, \ + .alloc = name##_ipc_ffi_alloc, .free = name##_ipc_ffi_free, .set_host_call = name##_ipc_ffi_set_host_call, \ + .create_async = name##_ipc_ffi_create_async, .submit = name##_ipc_ffi_submit, \ + .deliver = name##_ipc_ffi_deliver, .destroy_async = name##_ipc_ffi_destroy_async \ + } diff --git a/ipc-runtime/ts/package.json b/ipc-runtime/ts/package.json index 3be59e0e172..04020b1c936 100644 --- a/ipc-runtime/ts/package.json +++ b/ipc-runtime/ts/package.json @@ -31,6 +31,10 @@ "./registry": { "types": "./dest/backend_registry.d.ts", "default": "./dest/backend_registry.js" + }, + "./react-native": { + "types": "./dest/react_native.d.ts", + "default": "./dest/react_native.js" } }, "scripts": { diff --git a/ipc-runtime/ts/src/backend_registry.ts b/ipc-runtime/ts/src/backend_registry.ts index 38243aa77e7..6d30cc4186d 100644 --- a/ipc-runtime/ts/src/backend_registry.ts +++ b/ipc-runtime/ts/src/backend_registry.ts @@ -33,6 +33,14 @@ export function registerBackend( registry().set(service, factories); } +/** The registered backend for a service, if a native package registered one. */ +export function findRegisteredBackend( + service: string, + kind: K, +): RegisteredBackends[K] | undefined { + return registry().get(service)?.[kind]; +} + /** * The registered backend for a service, or a message naming what to install. `hint` is the * package a caller should be told about. diff --git a/ipc-runtime/ts/src/jsi.ts b/ipc-runtime/ts/src/jsi.ts new file mode 100644 index 00000000000..df2cc1e2db7 --- /dev/null +++ b/ipc-runtime/ts/src/jsi.ts @@ -0,0 +1,216 @@ +import { AsyncInstanceBackend } from "./async_instance.js"; +import type { IpcClientAsync, IpcClientSync } from "./types.js"; +import { + type HostCallTargets, + hostCallOn, + synchronousAnswers, +} from "./wasm/host_call.js"; + +/** + * React Native: a service's native library, linked into the app, reached through the JSI binding + * (`ipc-runtime/cpp/jsi`), which the app's native module installs as `globalThis.__ipcRuntimeJsi`. + * Hermes has no WebAssembly and no workers, so this is how a service runs there. + */ +interface JsiInstance { + call( + request: Uint8Array, + hostCall?: ( + target: string, + request: Uint8Array, + ) => Uint8Array | Promise, + ): Promise; + destroy(): void; +} + +interface JsiInstanceSync { + callSync( + request: Uint8Array, + hostCall?: (target: string, request: Uint8Array) => Uint8Array, + ): Uint8Array; + destroy(): void; +} + +/** An asynchronous instance: it reports its responses and host calls through onEvent. */ +interface JsiAsyncInstance { + submit(requestId: number, request: Uint8Array): void; + deliver(callId: number, status: number, response: Uint8Array): void; + destroy(): void; +} + +interface JsiBinding { + createInstance(ffiName: string, library?: string): JsiInstance; + createInstanceSync(ffiName: string, library?: string): JsiInstanceSync; + /** Absent from a binding built before asynchronous instances. */ + hasAsyncInstances?(ffiName: string, library?: string): boolean; + createAsyncInstance?( + ffiName: string, + library: string | undefined, + onEvent: ( + kind: number, + id: number, + target: string, + bytes: Uint8Array, + ) => void, + ): JsiAsyncInstance; +} + +function binding(): JsiBinding | undefined { + return (globalThis as { __ipcRuntimeJsi?: JsiBinding }).__ipcRuntimeJsi; +} + +/** Whether the JSI binding is installed: the app has @aztec-foundation/react-native's native module. */ +export function jsiAvailable(): boolean { + return binding() !== undefined; +} + +function requireBinding(ffiName: string): JsiBinding { + const jsi = binding(); + if (!jsi) { + throw new Error( + `${ffiName}: the ipc-runtime JSI binding is not installed. Add @aztec-foundation/react-native to the app, ` + + "and import it before anything else (it installs the binding).", + ); + } + return jsi; +} + +export interface JsiFfiOptions { + /** The name the library's FFI symbols carry: `_ipc_ffi_*`. */ + ffiName: string; + /** The library's file, when it is not lib.so (Android) and not registered by the app (iOS). */ + library?: string; + /** The services the instance reaches through its host (see HostCallTarget). */ + hostCall?: HostCallTargets; +} + +function syncCallerOf( + backend: IpcClientAsync | IpcClientSync, +): ((request: Uint8Array) => Uint8Array) | undefined { + const syncCaller = (backend as { syncCaller?: unknown }).syncCaller; + return typeof syncCaller === "function" + ? (syncCaller.call(backend) as (request: Uint8Array) => Uint8Array) + : undefined; +} + +/** + * An instance of the library's service on a native thread of its own; calls return promises. Its + * host calls are answered on the JavaScript thread, asynchronously if need be. When the library has + * asynchronous instances it runs on one, which keeps taking calls while its host calls are out (so + * a host call may lead back into it); otherwise its thread waits on each answer. + */ +export function createJsiFfiBackend( + options: JsiFfiOptions, +): JsiFfiBackend | AsyncInstanceBackend { + const jsi = requireBinding(options.ffiName); + if ( + jsi.createAsyncInstance && + jsi.hasAsyncInstances?.(options.ffiName, options.library) + ) { + const createAsync = jsi.createAsyncInstance.bind(jsi); + return AsyncInstanceBackend.createNow((events) => { + const instance = createAsync( + options.ffiName, + options.library, + (kind, id, target, bytes) => + kind === 0 ? events.respond(id, bytes) : events.call(id, target, bytes), + ); + return { + submit: (requestId, request) => instance.submit(requestId, request), + deliver: (callId, status, response) => + instance.deliver(callId, status, response), + destroy: () => instance.destroy(), + }; + }, options.hostCall); + } + const instance = jsi.createInstance(options.ffiName, options.library); + return new JsiFfiBackend( + options.ffiName, + instance, + hostCallOn(options.hostCall, syncCallerOf), + ); +} + +/** An instance on a native thread of its own (createJsiFfiBackend). */ +export class JsiFfiBackend implements IpcClientAsync { + private destroyed = false; + + /** @internal */ + constructor( + private readonly ffiName: string, + private readonly instance: JsiInstance, + private readonly hostCall: + | (( + target: string, + request: Uint8Array, + ) => Uint8Array | Promise) + | undefined, + ) {} + + call(input: Uint8Array): Promise { + if (this.destroyed) { + return Promise.reject( + new Error(`${this.ffiName}: JSI backend used after destroy()`), + ); + } + return this.instance.call(input, this.hostCall); + } + + destroy(): Promise { + if (!this.destroyed) { + this.destroyed = true; + this.instance.destroy(); + } + return Promise.resolve(); + } +} + +/** + * An instance of the library's service on the JavaScript thread: each call blocks it until the + * service answers, and its host calls must answer synchronously. + */ +export function createJsiFfiBackendSync( + options: JsiFfiOptions, +): JsiFfiBackendSync { + const instance = requireBinding(options.ffiName).createInstanceSync( + options.ffiName, + options.library, + ); + return new JsiFfiBackendSync( + options.ffiName, + instance, + synchronousAnswers(hostCallOn(options.hostCall, syncCallerOf)), + ); +} + +/** An instance on the JavaScript thread (createJsiFfiBackendSync). */ +export class JsiFfiBackendSync implements IpcClientSync { + private destroyed = false; + + /** @internal */ + constructor( + private readonly ffiName: string, + private readonly instance: JsiInstanceSync, + private readonly hostCall: + | ((target: string, request: Uint8Array) => Uint8Array) + | undefined, + ) {} + + /** @internal A synchronous call into the instance, for a host-call target on this thread. */ + syncCaller(): (input: Uint8Array) => Uint8Array { + return (input) => this.call(input); + } + + call(input: Uint8Array): Uint8Array { + if (this.destroyed) { + throw new Error(`${this.ffiName}: JSI backend used after destroy()`); + } + return this.instance.callSync(input, this.hostCall); + } + + destroy(): void { + if (!this.destroyed) { + this.destroyed = true; + this.instance.destroy(); + } + } +} diff --git a/ipc-runtime/ts/src/react_native.ts b/ipc-runtime/ts/src/react_native.ts new file mode 100644 index 00000000000..201c6d9536c --- /dev/null +++ b/ipc-runtime/ts/src/react_native.ts @@ -0,0 +1,18 @@ +/** + * The React Native entry: what a service's client package needs there, with nothing that imports + * node built-ins. Services run as native libraries linked into the app, reached over JSI; a + * backend a native package registers takes precedence. + */ +export * from "./jsi.js"; +export { + AsyncInstanceBackend, + type AsyncInstanceEvents, + type AsyncInstancePort, +} from "./async_instance.js"; +export * from "./backend_registry.js"; +export { + SERVICE_BACKEND, + type HostCallHandler, + type HostCallTarget, + type HostCallTargets, +} from "./wasm/host_call.js"; diff --git a/labs-patches/0017-feat-kv-store-the-browser-store-in-React-Native-on-k.patch b/labs-patches/0017-feat-kv-store-the-browser-store-in-React-Native-on-k.patch new file mode 100644 index 00000000000..832b011584c --- /dev/null +++ b/labs-patches/0017-feat-kv-store-the-browser-store-in-React-Native-on-k.patch @@ -0,0 +1,287 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Charlie <5764343+charlielye@users.noreply.github.com> +Date: Thu, 19 Nov 2026 16:10:39 +0000 +Subject: [PATCH] feat(kv-store): the browser store in React Native, on + kv-sqlite linked into the app + +`@aztec-labs/kv-store/sqlite-opfs` gains a react-native export condition: the +same API (AztecSQLiteOPFSStore.open, listStores, deleteStore, ...) over +AztecKvSqliteStore, whose Kv service is the library @aztec-foundation/react-native +links into the app, reached through JSI. Each store is a database file in the +app's data directory, in the per-store directory layout the browser uses in +OPFS, and one open store holds a directory at a time (SqlitePoolBusyError), as +in the browser. So the PXE and the embedded wallet open their stores unchanged. + +The package imports (#msgpackr, #ordered-binary) get react-native targets that +are files of the package, which is all Metro resolves them to. + +Co-Authored-By: Claude Opus 5.5 +Claude-Session: https://claude.ai/code/session_015HXzMEGRnmFYs5yXRcAWCb + +diff --git a/yarn-project/kv-store/package.json b/yarn-project/kv-store/package.json +index 262759d080bd6da4873f8e5ff218404809d6ca60..aff30df334984a5c46c3a6841991fad68ddda40b 100644 +--- a/yarn-project/kv-store/package.json ++++ b/yarn-project/kv-store/package.json +@@ -9,15 +9,20 @@ + "./lmdb-v2": "./dest/lmdb-v2/index.js", + "./deprecated/indexeddb": "./dest/deprecated/indexeddb/index.js", + "./kv-sqlite": "./dest/kv-sqlite/index.js", +- "./sqlite-opfs": "./dest/sqlite-opfs/index.js", ++ "./sqlite-opfs": { ++ "react-native": "./dest/sqlite-opfs/react_native.js", ++ "default": "./dest/sqlite-opfs/index.js" ++ }, + "./stores": "./dest/stores/index.js" + }, + "imports": { + "#msgpackr": { ++ "react-native": "./dest/sqlite-opfs/internal/msgpackr-no-eval.js", + "browser": "msgpackr/index-no-eval", + "default": "msgpackr" + }, + "#ordered-binary": { ++ "react-native": "./dest/sqlite-opfs/internal/ordered-binary-browser.js", + "browser": "./dest/sqlite-opfs/internal/ordered-binary-browser.js", + "default": "ordered-binary" + } +diff --git a/yarn-project/kv-store/src/kv-sqlite/react_native.test.ts b/yarn-project/kv-store/src/kv-sqlite/react_native.test.ts +new file mode 100644 +index 0000000000000000000000000000000000000000..e9abfa49b75cd7167d73156c4ec1f8843993b6fa +--- /dev/null ++++ b/yarn-project/kv-store/src/kv-sqlite/react_native.test.ts +@@ -0,0 +1,64 @@ ++import { existsSync, mkdtempSync, readdirSync, rmSync, statSync } from 'fs'; ++import { tmpdir } from 'os'; ++import { join } from 'path'; ++ ++import { describeAztecMap } from '../interfaces/map_test_suite.js'; ++import { mockLogger } from '../interfaces/utils.js'; ++import { ++ AztecSQLiteOPFSStore, ++ SqliteEncryptionError, ++ SqlitePoolBusyError, ++ deleteStore, ++ listStores, ++ openTmpStore, ++ storePoolDirectory, ++} from '../sqlite-opfs/react_native.js'; ++ ++// The browser store's React Native form, with the app's files (which @aztec-foundation/react-native installs) over ++// Node's; the Kv service runs on its node backend here, on the library linked into the app there. ++describe('AztecSQLiteOPFSStore (React Native)', () => { ++ let dataDir: string; ++ beforeEach(() => { ++ dataDir = mkdtempSync(join(tmpdir(), 'kv-store-rn-')); ++ (globalThis as any).__aztecReactNative = { ++ dataDir, ++ isDirectory: (path: string) => existsSync(path) && statSync(path).isDirectory(), ++ listDirectory: (path: string) => readdirSync(path), ++ removeDirectory: (path: string) => rmSync(path, { recursive: true, force: true }), ++ }; ++ }); ++ afterEach(() => { ++ delete (globalThis as any).__aztecReactNative; ++ rmSync(dataDir, { recursive: true, force: true }); ++ }); ++ ++ describeAztecMap('AztecMap', () => openTmpStore(true)); ++ ++ const key = () => new Uint8Array(32).fill(3); ++ const open = (name: string, encryptionKey?: Uint8Array) => ++ AztecSQLiteOPFSStore.open(mockLogger, name, false, storePoolDirectory(name), encryptionKey); ++ ++ it('keeps a store in the data directory, encrypted, and lists and deletes it as the browser does', async () => { ++ const a = await open('pxe_data_1', key()); ++ await a.openMap('m').set('k', 'v'); ++ await expect(open('pxe_data_1', key())).rejects.toBeInstanceOf(SqlitePoolBusyError); ++ await a.close(); ++ ++ expect(existsSync(join(dataDir, 'kv-store', '.aztec-kv-pxe_data_1', 'pxe_data_1'))).toBe(true); ++ expect(await listStores()).toEqual(['pxe_data_1']); ++ await expect(open('pxe_data_1', new Uint8Array(32).fill(4))).rejects.toBeInstanceOf(SqliteEncryptionError); ++ ++ const b = await open('pxe_data_1', key()); ++ expect(await b.openMap('m').getAsync('k')).toBe('v'); ++ await expect(deleteStore('pxe_data_1')).rejects.toBeInstanceOf(SqlitePoolBusyError); ++ await b.close(); ++ ++ await deleteStore('pxe_data_1'); ++ expect(await listStores()).toEqual([]); ++ }); ++ ++ it('says what is missing when the app has not imported @aztec-foundation/react-native', async () => { ++ delete (globalThis as any).__aztecReactNative; ++ await expect(open('x')).rejects.toThrow(/@aztec-foundation\/react-native/); ++ }); ++}); +diff --git a/yarn-project/kv-store/src/sqlite-opfs/internal/msgpackr-no-eval.js b/yarn-project/kv-store/src/sqlite-opfs/internal/msgpackr-no-eval.js +new file mode 100644 +index 0000000000000000000000000000000000000000..598b635774857042fc6d73a67417f4b94f54e8b9 +--- /dev/null ++++ b/yarn-project/kv-store/src/sqlite-opfs/internal/msgpackr-no-eval.js +@@ -0,0 +1,4 @@ ++/* eslint-disable */ ++// msgpackr without its eval-based record decoder, as a file: Metro (React Native) resolves package "imports" ++// only to files of this package. ++export * from 'msgpackr/index-no-eval'; +diff --git a/yarn-project/kv-store/src/sqlite-opfs/react_native.ts b/yarn-project/kv-store/src/sqlite-opfs/react_native.ts +new file mode 100644 +index 0000000000000000000000000000000000000000..6ffcb8126f4fc5e861d25f28c2649f72851f9008 +--- /dev/null ++++ b/yarn-project/kv-store/src/sqlite-opfs/react_native.ts +@@ -0,0 +1,155 @@ ++import { type Logger, createLogger } from '@aztec-labs/foundation/log'; ++import { KvService } from '@aztec-labs/kv-sqlite'; ++ ++import { AztecKvSqliteStore, initStore, validateEncryption } from '../kv-sqlite/store.js'; ++import { SqlitePoolBusyError } from './errors.js'; ++ ++export { ++ SqliteCorruptionError, ++ SqliteEncryptionError, ++ SqlitePoolBusyError, ++ SqliteWebLocksUnavailableError, ++} from './errors.js'; ++export type { SqliteEncryptionErrorCode } from './errors.js'; ++ ++/** ++ * The app's files, as @aztec-foundation/react-native installs them on the JavaScript runtime. The store needs the app ++ * to have imported that package, which links the Kv service's library into the app. ++ */ ++interface ReactNativeFiles { ++ dataDir: string; ++ isDirectory(path: string): boolean; ++ listDirectory(path: string): string[]; ++ removeDirectory(path: string): void; ++} ++ ++function files(): ReactNativeFiles { ++ const native = (globalThis as { __aztecReactNative?: ReactNativeFiles }).__aztecReactNative; ++ if (!native) { ++ throw new Error("The store needs @aztec-foundation/react-native: import it first in the app's entry file"); ++ } ++ return native; ++} ++ ++/** Prefix for the per-store directories, as the browser names its OPFS pool directories. */ ++export const OPFS_POOL_DIR_PREFIX = '.aztec-kv-'; ++ ++/** Where the stores live: a directory of the app's data directory. */ ++function storesRoot(): string { ++ return `${files().dataDir}/kv-store`; ++} ++ ++/** The directory holding a store's database, by the store's effective name. */ ++export function storePoolDirectory(effectiveName: string): string { ++ return `${OPFS_POOL_DIR_PREFIX}${effectiveName}`; ++} ++ ++function normalizePoolDirectory(poolDirectory: string): string { ++ const normalized = poolDirectory.replace(/^\/+|\/+$/g, ''); ++ if (!normalized || normalized.split('/').some(part => part === '.' || part === '..')) { ++ throw new Error(`Invalid store directory "${poolDirectory}"`); ++ } ++ return normalized; ++} ++ ++/** The directories of the stores open in this app: one store holds a directory at a time, as in the browser. */ ++const openDirectories = new Set(); ++ ++/** ++ * The browser's sqlite-opfs store in a React Native app: the Kv service's library linked into the app, reached ++ * through JSI, and its database a file in the app's data directory (`/kv-store//`). ++ * The API is the browser's, so the PXE and the embedded wallet open it unchanged. ++ */ ++export class AztecSQLiteOPFSStore extends AztecKvSqliteStore { ++ private constructor( ++ kv: KvService, ++ log: Logger, ++ isEphemeral: boolean, ++ private readonly directory?: string, ++ ) { ++ super(kv, log, isEphemeral); ++ } ++ ++ /** ++ * Opens (or creates) a store, as the browser's does: `ephemeral` keeps it in memory; `poolDirectory` is the ++ * directory holding its database, which one open store holds at a time (another open of it fails with ++ * `SqlitePoolBusyError`); `encryptionKey` (32 bytes) encrypts it at rest. ++ */ ++ static async open( ++ log: Logger, ++ name?: string, ++ ephemeral: boolean = false, ++ poolDirectory?: string, ++ encryptionKey?: Uint8Array, ++ ): Promise { ++ validateEncryption(encryptionKey, ephemeral); ++ const dbName = name && !ephemeral ? name : `tmp-${globalThis.crypto.getRandomValues(new Uint8Array(8)).join('')}`; ++ const directory = ephemeral ? undefined : normalizePoolDirectory(poolDirectory ?? storePoolDirectory(dbName)); ++ if (directory && openDirectories.has(directory)) { ++ throw new SqlitePoolBusyError(directory); ++ } ++ const path = directory ? `${storesRoot()}/${directory}/${dbName.replace(/^\/+/, '')}` : undefined; ++ log.debug(`Opening SQLite ${ephemeral ? 'ephemeral ' : ''}${encryptionKey ? 'encrypted ' : ''}database ${dbName}`); ++ if (directory) { ++ openDirectories.add(directory); ++ } ++ try { ++ const kv = await KvService.create(); ++ try { ++ await initStore(kv, path, encryptionKey); ++ } catch (err) { ++ await kv.destroy().catch(() => {}); ++ throw err; ++ } ++ return new AztecSQLiteOPFSStore(kv, log, ephemeral, directory); ++ } catch (err) { ++ if (directory) { ++ openDirectories.delete(directory); ++ } ++ throw err; ++ } ++ } ++ ++ protected override async release(): Promise { ++ try { ++ await super.release(); ++ } finally { ++ if (this.directory) { ++ openDirectories.delete(this.directory); ++ } ++ } ++ } ++} ++ ++/** The effective names of the stores in the app's data directory, as the browser's lists those in its origin. */ ++export function listStores(): Promise { ++ const root = storesRoot(); ++ const names = files().isDirectory(root) ? files().listDirectory(root) : []; ++ return Promise.resolve( ++ names.filter(name => name.startsWith(OPFS_POOL_DIR_PREFIX)).map(name => name.slice(OPFS_POOL_DIR_PREFIX.length)), ++ ); ++} ++ ++/** Permanently deletes a store by effective name. The store must be closed. */ ++export function deleteStore(effectiveName: string): Promise { ++ return deletePoolDirectory(storePoolDirectory(effectiveName)); ++} ++ ++/** Permanently deletes a store's directory. Its store must be closed. */ ++export function deletePoolDirectory(poolDirectory: string): Promise { ++ const directory = normalizePoolDirectory(poolDirectory); ++ if (openDirectories.has(directory)) { ++ return Promise.reject(new SqlitePoolBusyError(directory)); ++ } ++ files().removeDirectory(`${storesRoot()}/${directory}`); ++ return Promise.resolve(); ++} ++ ++export function openTmpStore(ephemeral: boolean = false): Promise { ++ return AztecSQLiteOPFSStore.open(createLogger('kv-store:sqlite'), undefined, ephemeral); ++} ++ ++/** An encrypted store, in a directory of its own. The key must be 32 bytes. */ ++export function openEncryptedStore(encryptionKey: Uint8Array, name?: string, poolDirectory?: string) { ++ return AztecSQLiteOPFSStore.open(createLogger('kv-store:sqlite'), name, false, poolDirectory, encryptionKey); ++} diff --git a/labs-patches/0018-feat-wallets-resolve-the-embedded-wallet-s-browser-e.patch b/labs-patches/0018-feat-wallets-resolve-the-embedded-wallet-s-browser-e.patch new file mode 100644 index 00000000000..30a3a00ef7d --- /dev/null +++ b/labs-patches/0018-feat-wallets-resolve-the-embedded-wallet-s-browser-e.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Charlie <5764343+charlielye@users.noreply.github.com> +Date: Thu, 19 Nov 2026 16:10:39 +0000 +Subject: [PATCH] feat(wallets): resolve the embedded wallet's browser entry + under React Native + +Metro does not apply the browser export condition on native platforms. + +Co-Authored-By: Claude Opus 5.5 +Claude-Session: https://claude.ai/code/session_015HXzMEGRnmFYs5yXRcAWCb + +diff --git a/yarn-project/wallets/package.json b/yarn-project/wallets/package.json +index 5606b1cfbcdeb10a09e45adcf98b4e0aa19c1438..c05ce7f31ea79a5b7a2e274372f59ad9905ef2b9 100644 +--- a/yarn-project/wallets/package.json ++++ b/yarn-project/wallets/package.json +@@ -5,6 +5,10 @@ + "type": "module", + "exports": { + "./embedded": { ++ "react-native": { ++ "types": "./dest/embedded/entrypoints/browser.d.ts", ++ "default": "./dest/embedded/entrypoints/browser.js" ++ }, + "browser": { + "types": "./dest/embedded/entrypoints/browser.d.ts", + "default": "./dest/embedded/entrypoints/browser.js" diff --git a/labs-patches/0019-chore-playground-raise-the-main-entrypoint-s-size-li.patch b/labs-patches/0019-chore-playground-raise-the-main-entrypoint-s-size-li.patch new file mode 100644 index 00000000000..93131d03bcc --- /dev/null +++ b/labs-patches/0019-chore-playground-raise-the-main-entrypoint-s-size-li.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Charlie <5764343+charlielye@users.noreply.github.com> +Date: Sat, 21 Nov 2026 15:22:49 +0000 +Subject: [PATCH] chore(playground): raise the main entrypoint's size limit to + 1990 KB + +Co-Authored-By: Claude Opus 5.5 +Claude-Session: https://claude.ai/code/session_015HXzMEGRnmFYs5yXRcAWCb + +diff --git a/playground/vite.config.ts b/playground/vite.config.ts +index 20b3c668bbce3cda59e83df9c2acd24785b1eb36..d9eef98e4a62098eec17098eaf01c7911a6c9f07 100644 +--- a/playground/vite.config.ts ++++ b/playground/vite.config.ts +@@ -208,9 +208,10 @@ export default defineConfig(({ mode }) => { + // - 2026-05-12: bumped from 1800 => 1850 after merge-train/barretenberg brought in further bb-side changes (multi-app kernel circuits #23076 etc.) that pushed the main entrypoint to 1801.31 KB, just over the limit raised four days earlier. + // - 2026-06-08: bumped from 1850 => 1925 after aztec RPC namespace / client surface changes pushed the main entrypoint to 1872.57 KB on CI (playground cold build). + // - 2026-07-17: bumped from 1925 => 1960 after the fast-inbox per-block L1-to-L2 message bundle changes to the rollup circuit artifacts pushed the main entrypoint to 1936.60 KB on CI. ++ // - 2026-11-21: bumped from 1960 => 1990 after the browser kv-store on @aztec-labs/kv-sqlite (1964.07 KB on CI) and ipc-runtime's asynchronous instances (1965.87 KB) pushed the main entrypoint over. + { + pattern: /assets\/index-.*\.js$/, +- maxSizeKB: 1960, ++ maxSizeKB: 1990, + description: 'Main entrypoint, hard limit', + }, + // Bump log: diff --git a/native-packages/acvm/bootstrap.sh b/native-packages/acvm/bootstrap.sh index 85c295fa05f..cf863845726 100755 --- a/native-packages/acvm/bootstrap.sh +++ b/native-packages/acvm/bootstrap.sh @@ -67,6 +67,29 @@ function build { yarn build } +# The library's static form for each mobile target, at rust/target//release/libaztec_acvm.a: what +# @aztec-foundation/react-native links into an app (iOS devices and simulators, Android devices and emulators). +# Pure Rust there (blake3's pure feature), so cargo needs only the targets' standard libraries. +mobile_targets="aarch64-apple-ios aarch64-apple-ios-sim aarch64-linux-android x86_64-linux-android" + +function build_mobile { + echo_header "acvm build_mobile" + if cache_download acvm-mobile-$hash.tar.gz; then + return + fi + generate_rust + ( + flock -x 200 + rustup target add $mobile_targets + ) 200>/tmp/rustup.lock + for target in $mobile_targets; do + (cd rust && cargo rustc --locked --release --lib --crate-type staticlib --target $target \ + --no-default-features --features ffi) + done + cache_upload acvm-mobile-$hash.tar.gz \ + $(for target in $mobile_targets; do echo rust/target/$target/release/libaztec_acvm.a; done) +} + function test_cmds { echo "$hash:CPUS=4 native-packages/acvm/bootstrap.sh test_rust" echo "$hash native-packages/acvm/scripts/acvm_test.sh" @@ -97,7 +120,7 @@ function release { (cd oracle && retry "deploy_npm ${REF_NAME#v}") } -export -f ipc_codegen generate_rust generate_ts build_rust build test_cmds test_rust test clean release +export -f ipc_codegen generate_rust generate_ts build_rust build build_mobile test_cmds test_rust test clean release case "$cmd" in "") diff --git a/native-packages/acvm/rust/Cargo.lock b/native-packages/acvm/rust/Cargo.lock index d36d67a048b..b3148b0e798 100644 --- a/native-packages/acvm/rust/Cargo.lock +++ b/native-packages/acvm/rust/Cargo.lock @@ -255,6 +255,7 @@ dependencies = [ "acir", "acvm", "base64 0.22.1", + "blake3", "bn254_blackbox_solver", "flate2", "ipc-runtime", diff --git a/native-packages/acvm/rust/Cargo.toml b/native-packages/acvm/rust/Cargo.toml index 65e5d8cce52..c09a8db11b7 100644 --- a/native-packages/acvm/rust/Cargo.toml +++ b/native-packages/acvm/rust/Cargo.toml @@ -40,6 +40,11 @@ rmp-serde = "1.3" serde = { version = "1.0", features = ["derive"] } thiserror = "1.0" +# A React Native app's static library (bootstrap.sh build_mobile) builds with cargo alone, for targets +# with no C toolchain here: blake3 then takes its pure-Rust implementation. +[target.'cfg(any(target_os = "ios", target_os = "android"))'.dependencies] +blake3 = { version = "1.8", features = ["pure"] } + [profile.release] lto = true diff --git a/native-packages/react-native/.gitignore b/native-packages/react-native/.gitignore new file mode 100644 index 00000000000..c3264e7a101 --- /dev/null +++ b/native-packages/react-native/.gitignore @@ -0,0 +1,8 @@ +node_modules/ +prebuilt/ +third_party/ +build/ +android/build/ +android/.cxx/ +.yarn/ +*.tgz diff --git a/native-packages/react-native/.rebuild_patterns b/native-packages/react-native/.rebuild_patterns new file mode 100644 index 00000000000..4847b7beff4 --- /dev/null +++ b/native-packages/react-native/.rebuild_patterns @@ -0,0 +1,7 @@ +^native-packages/react-native/ +^ipc-runtime/cpp/jsi/ +^native-packages/kv-sqlite/kv_schema\.jsonc$ +^native-packages/kv-sqlite/cpp/src/kv/ +^ipc-codegen/src/ +^ipc-codegen/templates/cpp/ +^noir/noir-repo/tooling/noirc_abi_wasm/test/shared/ diff --git a/native-packages/react-native/.yarnrc.yml b/native-packages/react-native/.yarnrc.yml new file mode 100644 index 00000000000..3186f3f0795 --- /dev/null +++ b/native-packages/react-native/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/native-packages/react-native/AztecReactNative.podspec b/native-packages/react-native/AztecReactNative.podspec new file mode 100644 index 00000000000..1da0adad65e --- /dev/null +++ b/native-packages/react-native/AztecReactNative.podspec @@ -0,0 +1,48 @@ +require 'json' + +package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) + +# The package's native module on iOS: its C++ TurboModule (registered by ios/AztecReactNative.mm), kv-sqlite and +# SQLite3 Multiple Ciphers compiled in, and bb and the ACVM linked statically from prebuilt/ios. Devices and the +# arm64 simulator. +Pod::Spec.new do |s| + s.name = 'AztecReactNative' + s.version = package['version'] + s.summary = package['description'] + s.homepage = 'https://github.com/AztecProtocol/aztec-packages/tree/next/native-packages/react-native' + s.license = package['license'] + s.authors = 'Aztec' + # bb's iOS build targets 16.3 (barretenberg/cpp/CMakePresets.json). + s.platforms = { :ios => '16.3' } + s.source = { :git => 'https://github.com/AztecProtocol/aztec-packages.git', :tag => "v#{s.version}" } + + s.source_files = [ + 'ios/*.{h,mm}', + 'cpp/*.{h,hpp,cpp,c}', + 'third_party/ipc-runtime-jsi/*.{hpp,cpp}', + 'third_party/sqlite3mc/*.h', + ] + s.private_header_files = ['cpp/*.{h,hpp}', 'third_party/**/*.{h,hpp}'] + # Compiled through cpp/sqlite3mc_unit.c (with SQLite's symbols renamed) and cpp/kv_sqlite_unit.cpp. + s.preserve_paths = [ + 'third_party/sqlite3mc/sqlite3mc_amalgamation.c', + 'third_party/kv-sqlite/**/*', + 'third_party/msgpack-c/**/*', + ] + s.vendored_frameworks = ['prebuilt/ios/AztecBB.xcframework', 'prebuilt/ios/AztecACVM.xcframework'] + + s.pod_target_xcconfig = { + 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++20', + 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) AZTEC_REACT_NATIVE_LINKED_LIBRARIES=1', + 'HEADER_SEARCH_PATHS' => [ + '"$(PODS_TARGET_SRCROOT)/cpp"', + '"$(PODS_TARGET_SRCROOT)/third_party/ipc-runtime-jsi"', + '"$(PODS_TARGET_SRCROOT)/third_party/sqlite3mc"', + '"$(PODS_TARGET_SRCROOT)/third_party/kv-sqlite"', + '"$(PODS_TARGET_SRCROOT)/third_party/msgpack-c/include"', + ].join(' '), + } + s.libraries = 'c++' + + install_modules_dependencies(s) +end diff --git a/native-packages/react-native/README.md b/native-packages/react-native/README.md new file mode 100644 index 00000000000..d3f7b42f72f --- /dev/null +++ b/native-packages/react-native/README.md @@ -0,0 +1,82 @@ +# @aztec-foundation/react-native + +Runs Aztec's client stack in a React Native app: a labs PXE or embedded wallet, bb.js (proving) and Noir +(witness generation). Hermes, React Native's JavaScript engine, has no WebAssembly and no workers, so the +package links bb and the ACVM (`@aztec-labs/acvm`, Noir's witness generation and ABI encoder) into the app as native +libraries and reaches them through JSI. The PXE's store is `@aztec-labs/kv-sqlite`, compiled into the module: the +same SQLite store the browser runs, encrypted the same way (SQLite3 Multiple Ciphers, ChaCha20). + +## Requirements + +- React Native 0.76 or later, with the new architecture (the default since 0.76) and Hermes. +- iOS 16.3 or later: devices, and the simulator on Apple silicon. +- Android API 24 or later: `arm64-v8a` devices and `x86_64` emulators. The module builds for 32-bit ABIs too, without + bb and the ACVM; using them there fails. + +## Setup + +Install the package next to the stack's packages, all from the same release: + +```sh +npm install @aztec-foundation/react-native @aztec-labs/wallets @aztec-labs/aztec.js +cd ios && pod install +``` + +Metro needs to resolve Node's built-in modules, which parts of the stack import, and to transform syntax React +Native's Babel preset leaves alone. In `metro.config.js`: + +```js +const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config'); +const { withAztec } = require('@aztec-foundation/react-native/metro'); + +module.exports = withAztec(mergeConfig(getDefaultConfig(__dirname), {})); +``` + +Import the package first in the app's entry file (`index.js`), before anything that uses the stack: + +```js +import '@aztec-foundation/react-native'; +``` + +That installs the native bindings and the built-ins Hermes lacks. Then use the stack as on the web: + +```ts +import { createAztecNodeClient } from '@aztec-labs/aztec.js/node'; +import { EmbeddedWallet } from '@aztec-labs/wallets/embedded'; + +const node = createAztecNodeClient('https://...'); +const wallet = await EmbeddedWallet.create(node); +``` + +bb.js downloads the proving key material (CRS) it needs on first use and keeps it, and the PXE keeps its +databases, under the app's data directory: `/aztec` on Android and `/aztec` on iOS +(`dataDirectory()` returns it). + +## What is in the package + +- `js/`: the entry the app imports. It calls the TurboModule's `install()`, which puts on the JavaScript runtime + ipc-runtime's JSI binding (`__ipcRuntimeJsi`, through which bb.js, Noir's `acvm_js`/`noirc_abi` and the PXE's + store reach their native libraries), `__aztecReactNative` (the app's files, SHA-256, UTF-8 and base64) and + `crypto.getRandomValues`, and installs polyfills (`structuredClone`, the ES2025 `Set` methods, `TextDecoder`, ...). +- `metro/`: `withAztec`. Besides Node's built-ins, it resolves Noir's `acvm_js` and `noirc_abi` (wasm modules) to + `js/noir/`, their API over the ACVM's service, and `hash.js`'s and `ohash`'s SHA-256 to the native one: Hermes has + no JIT, and the PXE hashes every contract artifact and stored value. +- `cpp/`: the TurboModule (`NativeAztecReactNative`), the JSI functions, and kv-sqlite (`kv_sqlite_unit.cpp`, over + the sources `scripts/vendor.sh` copies from `native-packages/kv-sqlite`). +- `android/`: the module's CMake build. Autolinking adds it to the app's native build as a pure C++ dependency. +- `ios/`, `AztecReactNative.podspec`: the module's pod. +- `prebuilt/`: bb (`libaztec_bb.so` on Android, a static library on iOS) and the ACVM (`libaztec_acvm.a`) for each + platform, built by this repository's release. +- `third_party/`: SQLite3 Multiple Ciphers (its exported symbols renamed, so it links beside another SQLite), + kv-sqlite's sources and its generated FFI, msgpack-c's headers and ipc-runtime's JSI binding. + +## Development + +`./bootstrap.sh` fetches `third_party/` (`scripts/vendor.sh`), builds Hermes for this machine +(`scripts/build_hermes.sh`) and the test host (`test/hermes_host.cpp`): Hermes with the module installed, as an app +has it. `./bootstrap.sh test` runs the tests in it (`scripts/run_test.sh `): the module's own with kv-sqlite's, +bb.js's, and `acvm_js`'s and `noirc_abi`'s on the ACVM against Noir's own fixtures, all against this tree's builds +(`make react-native-tests` builds those first). + +A release (`./bootstrap.sh release`) assembles `prebuilt/` from the Android and iOS cross builds +(`make react-native-mobile`, `scripts/build_prebuilt.sh`) and publishes the package. diff --git a/native-packages/react-native/android/CMakeLists.txt b/native-packages/react-native/android/CMakeLists.txt new file mode 100644 index 00000000000..5af9e007aa0 --- /dev/null +++ b/native-packages/react-native/android/CMakeLists.txt @@ -0,0 +1,40 @@ +# The package's C++ TurboModule for Android, added to the app's native build by React Native's autolinking +# (react-native.config.js: a pure C++ dependency, so the package has no Gradle module). +# +# bb ships as a shared library per ABI (prebuilt/android//libaztec_bb.so, with its own C++ runtime linked in +# and only its FFI exported), the ACVM (@aztec-labs/acvm's crate) as a Rust static library. Both exist for arm64-v8a +# and x86_64 only; on another ABI the module builds without them, and bb.js and Noir fail when used. kv-sqlite, the +# PXE's store, is compiled here from source (cpp/kv_sqlite_unit.cpp), for every ABI. +# +# target_link_libraries takes its plain signature throughout: the app's CMake links each autolinked target that way. +cmake_minimum_required(VERSION 3.13) +project(aztec_react_native CXX C) + +set(PKG ${CMAKE_CURRENT_LIST_DIR}/..) +set(PREBUILT ${PKG}/prebuilt/android/${ANDROID_ABI}) + +add_library(aztec_react_native STATIC + ${PKG}/cpp/NativeAztecReactNative.cpp + ${PKG}/cpp/aztec_react_native.cpp + ${PKG}/cpp/kv_sqlite_unit.cpp + ${PKG}/third_party/ipc-runtime-jsi/ipc_runtime_jsi.cpp + ${PKG}/cpp/sqlite3mc_unit.c +) +target_compile_features(aztec_react_native PUBLIC cxx_std_20) +target_include_directories(aztec_react_native + PUBLIC ${PKG}/cpp ${PKG}/third_party/ipc-runtime-jsi + PRIVATE ${PKG}/third_party/sqlite3mc ${PKG}/third_party/kv-sqlite ${PKG}/third_party/msgpack-c/include +) +set_source_files_properties(${PKG}/cpp/sqlite3mc_unit.c PROPERTIES COMPILE_OPTIONS "-w") +target_link_libraries(aztec_react_native jsi reactnative fbjni) + +if(EXISTS ${PREBUILT}/libaztec_bb.so AND EXISTS ${PREBUILT}/libaztec_acvm.a) + add_library(aztec_bb SHARED IMPORTED) + set_target_properties(aztec_bb PROPERTIES IMPORTED_LOCATION ${PREBUILT}/libaztec_bb.so) + add_library(aztec_acvm STATIC IMPORTED) + set_target_properties(aztec_acvm PROPERTIES IMPORTED_LOCATION ${PREBUILT}/libaztec_acvm.a) + target_compile_definitions(aztec_react_native PRIVATE AZTEC_REACT_NATIVE_LINKED_LIBRARIES=1) + target_link_libraries(aztec_react_native aztec_bb aztec_acvm log dl m) +else() + message(WARNING "@aztec-foundation/react-native: no bb or ACVM for ${ANDROID_ABI} (arm64-v8a and x86_64 only)") +endif() diff --git a/native-packages/react-native/android/codegen/AztecReactNative.cpp b/native-packages/react-native/android/codegen/AztecReactNative.cpp new file mode 100644 index 00000000000..2bc3bb4eadc --- /dev/null +++ b/native-packages/react-native/android/codegen/AztecReactNative.cpp @@ -0,0 +1,11 @@ +#include "AztecReactNative.h" + +namespace facebook::react { + +std::shared_ptr AztecReactNative_ModuleProvider(const std::string& /*moduleName*/, + const JavaTurboModule::InitParams& /*params*/) +{ + return nullptr; +} + +} // namespace facebook::react diff --git a/native-packages/react-native/android/codegen/AztecReactNative.h b/native-packages/react-native/android/codegen/AztecReactNative.h new file mode 100644 index 00000000000..987b3e3fd2d --- /dev/null +++ b/native-packages/react-native/android/codegen/AztecReactNative.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include + +#include +#include + +namespace facebook::react { + +/** The package's Java TurboModules: none (its module is NativeAztecReactNative, in C++). */ +std::shared_ptr AztecReactNative_ModuleProvider(const std::string& moduleName, + const JavaTurboModule::InitParams& params); + +} // namespace facebook::react diff --git a/native-packages/react-native/android/codegen/CMakeLists.txt b/native-packages/react-native/android/codegen/CMakeLists.txt new file mode 100644 index 00000000000..1e06feb769d --- /dev/null +++ b/native-packages/react-native/android/codegen/CMakeLists.txt @@ -0,0 +1,8 @@ +# What autolinking expects of a library's codegen output (react_codegen_, with .h +# declaring _ModuleProvider), for a package whose only module is a C++ one: it provides no Java +# modules. Written by hand so the package needs no codegen step in the app. +cmake_minimum_required(VERSION 3.13) +add_library(react_codegen_AztecReactNative STATIC ${CMAKE_CURRENT_LIST_DIR}/AztecReactNative.cpp) +target_include_directories(react_codegen_AztecReactNative PUBLIC ${CMAKE_CURRENT_LIST_DIR}) +target_compile_features(react_codegen_AztecReactNative PUBLIC cxx_std_20) +target_link_libraries(react_codegen_AztecReactNative jsi reactnative fbjni) diff --git a/native-packages/react-native/bootstrap.sh b/native-packages/react-native/bootstrap.sh new file mode 100755 index 00000000000..98d613d9fe7 --- /dev/null +++ b/native-packages/react-native/bootstrap.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +"$(git rev-parse --show-toplevel)/bootstrap.sh" init || exit 1 +source $(git rev-parse --show-toplevel)/ci3/source_bootstrap + +hash=$(cache_content_hash .rebuild_patterns) +hermes_hash=$(hash_str $(cache_content_hash ^native-packages/react-native/scripts/build_hermes.sh) $(arch)-$(os)) +# The tests run bb.js, bb, the ACVM, kv-sqlite and ipc-codegen's echo example from this tree. +test_hash=$(hash_str $hash $(../../barretenberg/cpp/bootstrap.sh hash) $(../../barretenberg/ts/bootstrap.sh hash) \ + $(../acvm/bootstrap.sh hash) $(../kv-sqlite/bootstrap.sh hash) $(../../ipc-codegen/bootstrap.sh hash)) + +# The package's sources (third_party), and the test host: Hermes and the native module, built for this machine. +function build { + echo_header "react-native build" + denoise "retry 'yarn install --immutable'" + denoise scripts/vendor.sh + if ! cache_download react-native-hermes-$hermes_hash.tar.gz; then + denoise scripts/build_hermes.sh + cache_upload react-native-hermes-$hermes_hash.tar.gz build/hermes + fi + denoise scripts/build_host.sh +} + +function test_cmds { + local run="native-packages/react-native/scripts/run_test.sh" + echo "$test_hash:CPUS=2:TIMEOUT=300s $run test/native.test.js" + echo "$test_hash:CPUS=2:TIMEOUT=300s $run test/bb.test.js" + echo "$test_hash:CPUS=2:TIMEOUT=300s $run test/noir.test.js" + echo "$test_hash:CPUS=2:TIMEOUT=300s $run test/echo.test.js" +} + +function test { + echo_header "react-native test" + test_cmds | filter_test_cmds | parallelize +} + +# The package with prebuilt/ (scripts/build_prebuilt.sh), from the cross builds `make react-native-mobile` makes. +function release { + build + scripts/build_prebuilt.sh + local version=${REF_NAME#v} + # The portals to the in-tree packages are for this tree only; deploy_npm pins them at the release's version. + jq --arg v "$version" '.version = $v | del(.resolutions)' package.json >package.json.tmp + mv package.json.tmp package.json + retry "deploy_npm $version" +} + +function clean { + rm -rf build prebuilt third_party node_modules +} + +export -f build test_cmds test release clean + +case "$cmd" in + "") + build + ;; + "hash") + echo "$hash" + ;; + *) + default_cmd_handler "$@" + ;; +esac diff --git a/native-packages/react-native/cpp/NativeAztecReactNative.cpp b/native-packages/react-native/cpp/NativeAztecReactNative.cpp new file mode 100644 index 00000000000..5a91488f4dc --- /dev/null +++ b/native-packages/react-native/cpp/NativeAztecReactNative.cpp @@ -0,0 +1,64 @@ +#include "NativeAztecReactNative.h" + +#include "aztec_react_native.hpp" + +#include + +#if defined(__ANDROID__) +#include +#include +#endif + +namespace facebook::react { + +jsi::Value NativeAztecReactNative::install(jsi::Runtime& rt, TurboModule& module, const jsi::Value* args, size_t count) +{ + std::string data_dir; + if (count > 0 && args[0].isString()) { + data_dir = args[0].getString(rt).utf8(rt); + } + if (data_dir.empty()) { + data_dir = aztec::react_native::default_data_directory(); + } + std::weak_ptr invoker = static_cast(module).jsInvoker_; + aztec::react_native::install( + rt, + [invoker](std::function task) { + if (auto js = invoker.lock()) { + js->invokeAsync([task = std::move(task)](jsi::Runtime& runtime) { task(runtime); }); + } + }, + data_dir); + return jsi::Value(true); +} + +NativeAztecReactNative::NativeAztecReactNative(std::shared_ptr js_invoker) + : TurboModule(std::string(kModuleName), std::move(js_invoker)) +{ + methodMap_["install"] = MethodMetadata{ 1, install }; +} + +} // namespace facebook::react + +#if defined(__ANDROID__) +namespace aztec::react_native { + +// An app's main process is named after its package, and its files directory is /data/user///files +// (Context.getFilesDir()), the user being the app's uid / 100000. +std::string default_data_directory() +{ + std::ifstream cmdline("/proc/self/cmdline"); + std::string process; + std::getline(cmdline, process, '\0'); + auto colon = process.find(':'); + if (colon != std::string::npos) { + process.resize(colon); + } + if (process.empty()) { + throw std::runtime_error("AztecReactNative: cannot tell the app's package; pass install() a directory"); + } + return "/data/user/" + std::to_string(getuid() / 100000) + "/" + process + "/files/aztec"; +} + +} // namespace aztec::react_native +#endif diff --git a/native-packages/react-native/cpp/NativeAztecReactNative.h b/native-packages/react-native/cpp/NativeAztecReactNative.h new file mode 100644 index 00000000000..f445688a13c --- /dev/null +++ b/native-packages/react-native/cpp/NativeAztecReactNative.h @@ -0,0 +1,41 @@ +#pragma once +/** + * @file NativeAztecReactNative.h + * @brief The package's TurboModule, `AztecReactNative`: a C++ module, written without codegen so it links the + * same way under every React Native version the package supports (on Android through autolinking's C++ module + * support, on iOS through AztecReactNative.mm). + * + * Its one method, install(dataDirectory), runs aztec::react_native::install on the JavaScript thread, with the + * module's CallInvoker as the way back to it. An empty dataDirectory means the platform's default + * (default_data_directory()). + */ + +#include + +#include +#include +#include + +namespace facebook::react { + +class NativeAztecReactNative : public TurboModule { + public: + static constexpr std::string_view kModuleName = "AztecReactNative"; + + explicit NativeAztecReactNative(std::shared_ptr js_invoker); + + private: + static jsi::Value install(jsi::Runtime& rt, TurboModule& module, const jsi::Value* args, size_t count); +}; + +} // namespace facebook::react + +namespace aztec::react_native { + +/** + * The app's directory for Aztec's data when JavaScript names none: /aztec on Android, + * /aztec on iOS. + */ +std::string default_data_directory(); + +} // namespace aztec::react_native diff --git a/native-packages/react-native/cpp/aztec_react_native.cpp b/native-packages/react-native/cpp/aztec_react_native.cpp new file mode 100644 index 00000000000..3f756ae8991 --- /dev/null +++ b/native-packages/react-native/cpp/aztec_react_native.cpp @@ -0,0 +1,458 @@ +#include "aztec_react_native.hpp" + +#include "sha256.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(__APPLE__) || defined(__ANDROID__) +#include // arc4random_buf +#else +#include +#endif + +IPC_RUNTIME_JSI_DECLARE_FFI(kv_sqlite) + +#ifdef AZTEC_REACT_NATIVE_LINKED_LIBRARIES +IPC_RUNTIME_JSI_DECLARE_FFI_WITH_HOST_CALLS(bb) +IPC_RUNTIME_JSI_DECLARE_FFI_WITH_HOST_CALLS(acvm) +#endif + +namespace fj = facebook::jsi; + +namespace aztec::react_native { + +namespace { + +class OwnedBuffer final : public fj::MutableBuffer { + public: + explicit OwnedBuffer(std::vector bytes) + : bytes_(std::move(bytes)) + {} + size_t size() const override { return bytes_.size(); } + uint8_t* data() override { return bytes_.data(); } + + private: + std::vector bytes_; +}; + +fj::Value uint8_array(fj::Runtime& rt, std::vector bytes) +{ + fj::ArrayBuffer buffer(rt, std::make_shared(std::move(bytes))); + return rt.global().getPropertyAsFunction(rt, "Uint8Array").callAsConstructor(rt, buffer); +} + +/** The bytes a Uint8Array (or other view) covers, and where. */ +std::pair view_of(fj::Runtime& rt, const fj::Value& value) +{ + if (!value.isObject()) { + throw fj::JSError(rt, "expected a Uint8Array"); + } + auto object = value.getObject(rt); + auto buffer = object.getProperty(rt, "buffer").asObject(rt).getArrayBuffer(rt); + auto offset = static_cast(object.getProperty(rt, "byteOffset").asNumber()); + auto length = static_cast(object.getProperty(rt, "byteLength").asNumber()); + if (offset + length > buffer.size(rt)) { + throw fj::JSError(rt, "Uint8Array outside its buffer"); + } + return { buffer.data(rt) + offset, length }; +} + +void make_dirs(const std::string& dir) +{ + for (size_t slash = dir.find('/', 1);; slash = dir.find('/', slash + 1)) { + auto prefix = dir.substr(0, slash); + if (::mkdir(prefix.c_str(), 0700) != 0 && errno != EEXIST) { + throw std::runtime_error("cannot make directory " + prefix + ": " + std::strerror(errno)); + } + if (slash == std::string::npos) { + return; + } + } +} + +double file_size(const std::string& path) +{ + struct stat st{}; + return ::stat(path.c_str(), &st) == 0 ? static_cast(st.st_size) : -1.0; +} + +std::vector read_file(const std::string& path, double length) +{ + std::ifstream in(path, std::ios::binary); + if (!in) { + throw std::runtime_error("cannot read " + path); + } + std::vector bytes; + if (length >= 0) { + bytes.resize(static_cast(length)); + in.read(reinterpret_cast(bytes.data()), static_cast(bytes.size())); + if (static_cast(in.gcount()) != bytes.size()) { + throw std::runtime_error(path + " is shorter than " + std::to_string(bytes.size()) + " bytes"); + } + } else { + bytes.assign(std::istreambuf_iterator(in), std::istreambuf_iterator()); + } + return bytes; +} + +/** Writes through a temporary file renamed into place, so a reader never sees half a file. */ +void write_file(const std::string& path, const uint8_t* data, size_t length) +{ + auto slash = path.rfind('/'); + if (slash != std::string::npos && slash > 0) { + make_dirs(path.substr(0, slash)); + } + auto tmp = path + ".tmp" + std::to_string(::getpid()); + { + std::ofstream out(tmp, std::ios::binary | std::ios::trunc); + out.write(reinterpret_cast(data), static_cast(length)); + if (!out) { + std::remove(tmp.c_str()); + throw std::runtime_error("cannot write " + path); + } + } + if (std::rename(tmp.c_str(), path.c_str()) != 0) { + std::remove(tmp.c_str()); + throw std::runtime_error("cannot write " + path + ": " + std::strerror(errno)); + } +} + +bool is_directory(const std::string& path) +{ + struct stat st{}; + return ::stat(path.c_str(), &st) == 0 && S_ISDIR(st.st_mode); +} + +std::vector list_directory(const std::string& path) +{ + std::vector names; + DIR* dir = ::opendir(path.c_str()); + if (dir == nullptr) { + if (errno == ENOENT) { + return names; + } + throw std::runtime_error("cannot list " + path + ": " + std::strerror(errno)); + } + while (auto* entry = ::readdir(dir)) { + std::string name = entry->d_name; + if (name != "." && name != "..") { + names.push_back(std::move(name)); + } + } + ::closedir(dir); + return names; +} + +void remove_directory(const std::string& path) +{ + for (const auto& name : list_directory(path)) { + auto child = path + "/" + name; + struct stat st{}; + if (::lstat(child.c_str(), &st) == 0 && S_ISDIR(st.st_mode)) { + remove_directory(child); + } else if (::unlink(child.c_str()) != 0 && errno != ENOENT) { + throw std::runtime_error("cannot remove " + child + ": " + std::strerror(errno)); + } + } + if (::rmdir(path.c_str()) != 0 && errno != ENOENT) { + throw std::runtime_error("cannot remove " + path + ": " + std::strerror(errno)); + } +} + +void random_bytes(uint8_t* data, size_t length) +{ +#if defined(__APPLE__) || defined(__ANDROID__) + arc4random_buf(data, length); +#else + while (length > 0) { + auto got = ::getrandom(data, length, 0); + if (got < 0) { + if (errno == EINTR) { + continue; + } + throw std::runtime_error(std::string("getrandom: ") + std::strerror(errno)); + } + data += got; + length -= static_cast(got); + } +#endif +} + +/** + * The UTF-8 in `data` with each maximal invalid subsequence replaced by U+FFFD, as TextDecoder does (WHATWG + * Encoding), or an error at the first one when `fatal`. + */ +std::string sanitize_utf8(const uint8_t* data, size_t length, bool fatal) +{ + std::string out; + out.reserve(length); + size_t i = 0; + while (i < length) { + uint8_t b = data[i]; + if (b < 0x80) { + out.push_back(char(b)); + i++; + continue; + } + size_t need = 0; + uint8_t lower = 0x80; + uint8_t upper = 0xbf; + if (b >= 0xc2 && b <= 0xdf) { + need = 1; + } else if (b >= 0xe0 && b <= 0xef) { + need = 2; + lower = b == 0xe0 ? 0xa0 : 0x80; + upper = b == 0xed ? 0x9f : 0xbf; + } else if (b >= 0xf0 && b <= 0xf4) { + need = 3; + lower = b == 0xf0 ? 0x90 : 0x80; + upper = b == 0xf4 ? 0x8f : 0xbf; + } + size_t seen = 1; + while (need > 0 && seen <= need && i + seen < length) { + uint8_t c = data[i + seen]; + if (c < lower || c > upper) { + break; + } + lower = 0x80; + upper = 0xbf; + seen++; + } + if (need == 0 || seen <= need) { + if (fatal) { + throw std::runtime_error("the encoded data was not valid utf-8"); + } + out += "\xEF\xBF\xBD"; + i += seen; + continue; + } + out.append(reinterpret_cast(data + i), need + 1); + i += need + 1; + } + return out; +} + +constexpr char BASE64_ALPHABET[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +std::string base64_encode(const uint8_t* data, size_t length) +{ + std::string out; + out.reserve((length + 2) / 3 * 4); + size_t i = 0; + for (; i + 2 < length; i += 3) { + uint32_t n = uint32_t(data[i]) << 16 | uint32_t(data[i + 1]) << 8 | data[i + 2]; + out.push_back(BASE64_ALPHABET[n >> 18]); + out.push_back(BASE64_ALPHABET[(n >> 12) & 63]); + out.push_back(BASE64_ALPHABET[(n >> 6) & 63]); + out.push_back(BASE64_ALPHABET[n & 63]); + } + if (i < length) { + uint32_t n = uint32_t(data[i]) << 16 | (i + 1 < length ? uint32_t(data[i + 1]) << 8 : 0); + out.push_back(BASE64_ALPHABET[n >> 18]); + out.push_back(BASE64_ALPHABET[(n >> 12) & 63]); + out.push_back(i + 1 < length ? BASE64_ALPHABET[(n >> 6) & 63] : '='); + out.push_back('='); + } + return out; +} + +/** Base64 (standard or URL alphabet) as Node's Buffer reads it: other characters are skipped, '=' ends it. */ +std::vector base64_decode(const std::string& text) +{ + std::vector out; + out.reserve(text.size() * 3 / 4); + uint32_t acc = 0; + int bits = 0; + for (char c : text) { + int v = 0; + if (c >= 'A' && c <= 'Z') { + v = c - 'A'; + } else if (c >= 'a' && c <= 'z') { + v = c - 'a' + 26; + } else if (c >= '0' && c <= '9') { + v = c - '0' + 52; + } else if (c == '+' || c == '-') { + v = 62; + } else if (c == '/' || c == '_') { + v = 63; + } else if (c == '=') { + break; + } else { + continue; + } + acc = (acc << 6) | uint32_t(v); + bits += 6; + if (bits >= 8) { + bits -= 8; + out.push_back(uint8_t(acc >> bits)); + } + } + return out; +} + +using Body = std::function; + +void set_function(fj::Runtime& rt, fj::Object& target, const char* name, unsigned params, Body body) +{ + target.setProperty( + rt, + name, + fj::Function::createFromHostFunction( + rt, + fj::PropNameID::forAscii(rt, name), + params, + [name, body = std::move(body)](fj::Runtime& rt, const fj::Value&, const fj::Value* args, size_t count) { + try { + return body(rt, args, count); + } catch (const fj::JSError&) { + throw; + } catch (const std::exception& e) { + throw fj::JSError(rt, std::string(name) + ": " + e.what()); + } + })); +} + +std::string string_arg(fj::Runtime& rt, const fj::Value* args, size_t count, size_t i) +{ + if (i >= count || !args[i].isString()) { + throw fj::JSError(rt, "expected a string argument"); + } + return args[i].getString(rt).utf8(rt); +} + +void install_files(fj::Runtime& rt, const std::string& data_dir) +{ + fj::Object api(rt); + api.setProperty(rt, "dataDir", fj::String::createFromUtf8(rt, data_dir)); +#if defined(__APPLE__) + api.setProperty(rt, "platform", fj::String::createFromAscii(rt, "ios")); +#elif defined(__ANDROID__) + api.setProperty(rt, "platform", fj::String::createFromAscii(rt, "android")); +#else + api.setProperty(rt, "platform", fj::String::createFromAscii(rt, "other")); +#endif + set_function(rt, api, "fileSize", 1, [](fj::Runtime& rt, const fj::Value* args, size_t count) { + return fj::Value(file_size(string_arg(rt, args, count, 0))); + }); + set_function(rt, api, "readFile", 2, [](fj::Runtime& rt, const fj::Value* args, size_t count) { + double length = count > 1 && args[1].isNumber() ? args[1].getNumber() : -1; + return uint8_array(rt, read_file(string_arg(rt, args, count, 0), length)); + }); + set_function(rt, api, "writeFile", 2, [](fj::Runtime& rt, const fj::Value* args, size_t count) { + auto path = string_arg(rt, args, count, 0); + if (count < 2) { + throw fj::JSError(rt, "writeFile(path, data) expects the data"); + } + auto [data, length] = view_of(rt, args[1]); + write_file(path, data, length); + return fj::Value::undefined(); + }); + set_function(rt, api, "isDirectory", 1, [](fj::Runtime& rt, const fj::Value* args, size_t count) { + return fj::Value(is_directory(string_arg(rt, args, count, 0))); + }); + set_function(rt, api, "listDirectory", 1, [](fj::Runtime& rt, const fj::Value* args, size_t count) { + auto names = list_directory(string_arg(rt, args, count, 0)); + fj::Array result(rt, names.size()); + for (size_t i = 0; i < names.size(); i++) { + result.setValueAtIndex(rt, i, fj::String::createFromUtf8(rt, names[i])); + } + return fj::Value(rt, result); + }); + set_function(rt, api, "removeDirectory", 1, [](fj::Runtime& rt, const fj::Value* args, size_t count) { + remove_directory(string_arg(rt, args, count, 0)); + return fj::Value::undefined(); + }); + set_function(rt, api, "removeFile", 1, [](fj::Runtime& rt, const fj::Value* args, size_t count) { + std::remove(string_arg(rt, args, count, 0).c_str()); + return fj::Value::undefined(); + }); + // decodeUtf8(data: Uint8Array, fatal?: boolean): string; base64Encode(data): string; base64Decode(text): + // Uint8Array. The `buffer` package and TextDecoder use them: their JavaScript versions are slow on Hermes. + set_function(rt, api, "decodeUtf8", 2, [](fj::Runtime& rt, const fj::Value* args, size_t count) { + if (count < 1) { + throw fj::JSError(rt, "decodeUtf8 expects a Uint8Array"); + } + auto [data, length] = view_of(rt, args[0]); + bool fatal = count > 1 && args[1].isBool() && args[1].getBool(); + auto text = sanitize_utf8(data, length, fatal); + return fj::Value(rt, + fj::String::createFromUtf8(rt, reinterpret_cast(text.data()), text.size())); + }); + set_function(rt, api, "base64Encode", 1, [](fj::Runtime& rt, const fj::Value* args, size_t count) { + if (count < 1) { + throw fj::JSError(rt, "base64Encode expects a Uint8Array"); + } + auto [data, length] = view_of(rt, args[0]); + return fj::Value(rt, fj::String::createFromAscii(rt, base64_encode(data, length))); + }); + set_function(rt, api, "base64Decode", 1, [](fj::Runtime& rt, const fj::Value* args, size_t count) { + return uint8_array(rt, base64_decode(string_arg(rt, args, count, 0))); + }); + // sha256(data: Uint8Array | string): Uint8Array, a string hashed as its UTF-8. + set_function(rt, api, "sha256", 1, [](fj::Runtime& rt, const fj::Value* args, size_t count) { + if (count < 1) { + throw fj::JSError(rt, "sha256 expects a Uint8Array or a string"); + } + Sha256 hasher; + if (args[0].isString()) { + auto text = args[0].getString(rt).utf8(rt); + hasher.update(reinterpret_cast(text.data()), text.size()); + } else { + auto [data, length] = view_of(rt, args[0]); + hasher.update(data, length); + } + auto digest = hasher.finish(); + return uint8_array(rt, std::vector(digest.begin(), digest.end())); + }); + rt.global().setProperty(rt, "__aztecReactNative", api); +} + +/** crypto.getRandomValues for runtimes without it (Hermes), filling the array in place as the web's does. */ +void install_crypto(fj::Runtime& rt) +{ + auto global = rt.global(); + auto crypto_value = global.getProperty(rt, "crypto"); + if (crypto_value.isObject() && crypto_value.getObject(rt).getProperty(rt, "getRandomValues").isObject()) { + return; + } + fj::Object crypto = crypto_value.isObject() ? crypto_value.getObject(rt) : fj::Object(rt); + set_function(rt, crypto, "getRandomValues", 1, [](fj::Runtime& rt, const fj::Value* args, size_t count) { + if (count < 1) { + throw fj::JSError(rt, "getRandomValues expects a typed array"); + } + auto [data, length] = view_of(rt, args[0]); + if (length > 65536) { + throw fj::JSError(rt, "getRandomValues: more than 65536 bytes requested"); + } + random_bytes(data, length); + return fj::Value(rt, args[0]); + }); + global.setProperty(rt, "crypto", crypto); +} + +} // namespace + +void install(fj::Runtime& runtime, ::ipc::jsi::RunOnJs run_on_js, const std::string& data_dir) +{ +#ifdef AZTEC_REACT_NATIVE_LINKED_LIBRARIES + ::ipc::jsi::register_ffi("bb", IPC_RUNTIME_JSI_SYMBOLS_WITH_HOST_CALLS(bb)); + ::ipc::jsi::register_ffi("acvm", IPC_RUNTIME_JSI_SYMBOLS_WITH_HOST_CALLS(acvm)); +#endif + ::ipc::jsi::register_ffi("kv_sqlite", IPC_RUNTIME_JSI_SYMBOLS(kv_sqlite)); + ::ipc::jsi::install(runtime, std::move(run_on_js)); + install_files(runtime, data_dir); + install_crypto(runtime); +} + +} // namespace aztec::react_native diff --git a/native-packages/react-native/cpp/aztec_react_native.hpp b/native-packages/react-native/cpp/aztec_react_native.hpp new file mode 100644 index 00000000000..79b9a133d79 --- /dev/null +++ b/native-packages/react-native/cpp/aztec_react_native.hpp @@ -0,0 +1,28 @@ +#pragma once +/** + * @file aztec_react_native.hpp + * @brief What a React Native app needs to run Aztec's client stack, installed into its JavaScript runtime. + * + * install() puts on the runtime's global object: + * - `__ipcRuntimeJsi`: ipc-runtime's JSI binding (ipc-runtime/cpp/jsi), with the libraries linked into + * the app registered under their FFI names (bb, acvm) when AZTEC_REACT_NATIVE_LINKED_LIBRARIES is set; + * - `__aztecReactNative`: the platform ("ios", "android"), the app's data directory and functions on its + * files (bb.js caches the CRS there), and sha256; + * - `crypto.getRandomValues`, when the runtime has none (Hermes), from the OS's generator. + * + * It also registers kv-sqlite (kv_sqlite_unit.cpp, compiled into the module) under its FFI name `kv_sqlite`, for + * the PXE's store. + */ + +#include "ipc_runtime_jsi.hpp" + +#include + +#include + +namespace aztec::react_native { + +/** Installs everything above. Call on the JavaScript thread; `data_dir` is the app's files directory. */ +void install(facebook::jsi::Runtime& runtime, ::ipc::jsi::RunOnJs run_on_js, const std::string& data_dir); + +} // namespace aztec::react_native diff --git a/native-packages/react-native/cpp/kv_sqlite_unit.cpp b/native-packages/react-native/cpp/kv_sqlite_unit.cpp new file mode 100644 index 00000000000..fed5b92e57e --- /dev/null +++ b/native-packages/react-native/cpp/kv_sqlite_unit.cpp @@ -0,0 +1,12 @@ +// kv-sqlite's service (native-packages/kv-sqlite), the PXE's store, as the app links it: its sources and its +// generated FFI (kv_sqlite_ipc_ffi_*), vendored into third_party/kv-sqlite by scripts/vendor.sh, in one unit, so +// the app's build needs no list of them. SQLite's names are renamed as sqlite3mc_unit.c compiles them. +#define MSGPACK_NO_BOOST +#define MSGPACK_USE_STD_VARIANT_ADAPTOR + +#include "aztec_sqlite_prefix.h" + +#include "store.cpp" +#include "files_native.cpp" +#include "kv_service.cpp" +#include "generated/kv_ffi.cpp" diff --git a/native-packages/react-native/cpp/sha256.hpp b/native-packages/react-native/cpp/sha256.hpp new file mode 100644 index 00000000000..e34160c0d2c --- /dev/null +++ b/native-packages/react-native/cpp/sha256.hpp @@ -0,0 +1,118 @@ +#pragma once +/** + * @file sha256.hpp + * @brief SHA-256 (FIPS 180-4), for `__aztecReactNative.sha256`: the stack's JavaScript SHA-256 (hash.js, ohash) + * is slow on Hermes, which has no JIT. + */ + +#include +#include +#include +#include + +namespace aztec::react_native { + +class Sha256 { + public: + void update(const uint8_t* data, size_t length) + { + total_ += length; + if (buffered_ > 0) { + size_t take = std::min(length, size_t(64) - buffered_); + std::memcpy(block_.data() + buffered_, data, take); + buffered_ += take; + data += take; + length -= take; + if (buffered_ < 64) { + return; + } + compress(block_.data()); + buffered_ = 0; + } + for (; length >= 64; data += 64, length -= 64) { + compress(data); + } + std::memcpy(block_.data(), data, length); + buffered_ = length; + } + + std::array finish() + { + uint64_t bits = total_ * 8; + uint8_t pad = 0x80; + update(&pad, 1); + uint8_t zero = 0; + while (buffered_ != 56) { + update(&zero, 1); + } + uint8_t length[8]; + for (int i = 0; i < 8; i++) { + length[i] = uint8_t(bits >> (56 - 8 * i)); + } + update(length, 8); + std::array out{}; + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 4; j++) { + out[size_t(4 * i + j)] = uint8_t(state_[size_t(i)] >> (24 - 8 * j)); + } + } + return out; + } + + private: + static uint32_t rotr(uint32_t x, int n) { return (x >> n) | (x << (32 - n)); } + + void compress(const uint8_t* p) + { + static constexpr uint32_t K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, + }; + uint32_t w[64]; + for (int i = 0; i < 16; i++) { + w[i] = uint32_t(p[4 * i]) << 24 | uint32_t(p[4 * i + 1]) << 16 | uint32_t(p[4 * i + 2]) << 8 | + uint32_t(p[4 * i + 3]); + } + for (int i = 16; i < 64; i++) { + uint32_t s0 = rotr(w[i - 15], 7) ^ rotr(w[i - 15], 18) ^ (w[i - 15] >> 3); + uint32_t s1 = rotr(w[i - 2], 17) ^ rotr(w[i - 2], 19) ^ (w[i - 2] >> 10); + w[i] = w[i - 16] + s0 + w[i - 7] + s1; + } + uint32_t a = state_[0], b = state_[1], c = state_[2], d = state_[3]; + uint32_t e = state_[4], f = state_[5], g = state_[6], h = state_[7]; + for (int i = 0; i < 64; i++) { + uint32_t t1 = h + (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) + ((e & f) ^ (~e & g)) + K[i] + w[i]; + uint32_t t2 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + ((a & b) ^ (a & c) ^ (b & c)); + h = g; + g = f; + f = e; + e = d + t1; + d = c; + c = b; + b = a; + a = t1 + t2; + } + state_[0] += a; + state_[1] += b; + state_[2] += c; + state_[3] += d; + state_[4] += e; + state_[5] += f; + state_[6] += g; + state_[7] += h; + } + + std::array state_{ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 }; + std::array block_{}; + size_t buffered_ = 0; + uint64_t total_ = 0; +}; + +} // namespace aztec::react_native diff --git a/native-packages/react-native/cpp/sqlite3mc_unit.c b/native-packages/react-native/cpp/sqlite3mc_unit.c new file mode 100644 index 00000000000..98b7a1a6a65 --- /dev/null +++ b/native-packages/react-native/cpp/sqlite3mc_unit.c @@ -0,0 +1,12 @@ +// SQLite3 Multiple Ciphers, compiled with its exported symbols renamed (aztec_sqlite_prefix.h; see +// scripts/vendor.sh) and the options kv-sqlite builds it with (native-packages/kv-sqlite/cpp/CMakeLists.txt). +#define SQLITE_THREADSAFE 1 +#define SQLITE_DQS 0 +#define SQLITE_OMIT_LOAD_EXTENSION 1 +#define SQLITE_OMIT_SHARED_CACHE 1 +#define SQLITE_DEFAULT_MEMSTATUS 0 +#define SQLITE_LIKE_DOESNT_MATCH_BLOBS 1 + +#include "aztec_sqlite_prefix.h" + +#include "sqlite3mc_amalgamation.c" diff --git a/native-packages/react-native/ios/AztecReactNative.mm b/native-packages/react-native/ios/AztecReactNative.mm new file mode 100644 index 00000000000..9a80bc5d1fe --- /dev/null +++ b/native-packages/react-native/ios/AztecReactNative.mm @@ -0,0 +1,39 @@ +// Registers the C++ TurboModule (NativeAztecReactNative) with React Native on iOS, and gives it the app's +// data directory. + +#import +#import +#import + +#include "NativeAztecReactNative.h" + +@interface AztecReactNative : NSObject +@end + +@implementation AztecReactNative + +RCT_EXPORT_MODULE(AztecReactNative) + ++ (BOOL)requiresMainQueueSetup +{ + return NO; +} + +- (std::shared_ptr)getTurboModule: + (const facebook::react::ObjCTurboModule::InitParams &)params +{ + return std::make_shared(params.jsInvoker); +} + +@end + +namespace aztec::react_native { + +std::string default_data_directory() +{ + NSArray *dirs = + NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); + return std::string([[dirs.firstObject stringByAppendingPathComponent:@"aztec"] UTF8String]); +} + +} // namespace aztec::react_native diff --git a/native-packages/react-native/js/index.d.ts b/native-packages/react-native/js/index.d.ts new file mode 100644 index 00000000000..2821b4c49dd --- /dev/null +++ b/native-packages/react-native/js/index.d.ts @@ -0,0 +1,4 @@ +/** Whether the native bindings are installed (importing this package installs them). */ +export declare function isInstalled(): boolean; +/** The app's directory for Aztec's data: bb's CRS and the PXE's databases live under it. */ +export declare function dataDirectory(): string; diff --git a/native-packages/react-native/js/index.js b/native-packages/react-native/js/index.js new file mode 100644 index 00000000000..9be941c0776 --- /dev/null +++ b/native-packages/react-native/js/index.js @@ -0,0 +1,46 @@ +'use strict'; +/** + * Sets up a React Native app for Aztec's client stack. Import it once, before anything that uses the stack + * (a labs PXE or wallet, bb.js, Noir): + * + * import '@aztec-foundation/react-native'; + * + * It installs the native bindings into the JavaScript runtime (ipc-runtime's JSI binding, which reaches bb, + * the ACVM and kv-sqlite linked into the app; the app's files; crypto.getRandomValues) and the built-ins Hermes lacks + * (polyfills.js). + * The app's Metro config needs `withAztec` from '@aztec-foundation/react-native/metro'. + */ +const { installPolyfills } = require('./polyfills'); + +function installNative() { + if (globalThis.__ipcRuntimeJsi !== undefined && globalThis.__aztecReactNative !== undefined) { + return; + } + const { TurboModuleRegistry } = require('react-native'); + const module = TurboModuleRegistry.get('AztecReactNative'); + if (module == null) { + throw new Error( + "@aztec-foundation/react-native: the native module is not in the app. It needs React Native's new " + + 'architecture; rebuild the app after installing the package (on iOS, run pod install first).', + ); + } + // An empty directory means the platform's default: /aztec on Android, /aztec on + // iOS. + module.install(''); +} + +installNative(); + +installPolyfills(); + +/** Whether the native bindings are installed. */ +function isInstalled() { + return globalThis.__ipcRuntimeJsi !== undefined && globalThis.__aztecReactNative !== undefined; +} + +/** The app's directory for Aztec's data: bb's CRS and the PXE's databases live under it. */ +function dataDirectory() { + return globalThis.__aztecReactNative.dataDir; +} + +module.exports = { isInstalled, dataDirectory }; diff --git a/native-packages/react-native/js/noir/acvm.js b/native-packages/react-native/js/noir/acvm.js new file mode 100644 index 00000000000..e1ddb54fff9 --- /dev/null +++ b/native-packages/react-native/js/noir/acvm.js @@ -0,0 +1,84 @@ +// The ACVM service (@aztec-labs/acvm) on its native library, linked into the app and reached through ipc-runtime's +// JSI binding: what the app's acvm_js and noirc_abi (./acvm_js.js, ./noirc_abi.js, which withAztec resolves those +// packages to) run on, since Hermes has no WebAssembly. +import { createJsiFfiBackend, createJsiFfiBackendSync } from '@aztec-foundation/ipc-runtime/react-native'; +import { AsyncApi, SyncApi } from '@aztec-labs/acvm'; +import { handleRequest } from '@aztec-labs/acvm-oracle'; + +const FFI = { ffiName: 'acvm', library: 'libaztec_acvm.so' }; + +let syncApi; + +/** The service on the JavaScript thread, for the commands that make no foreign calls. */ +export function acvmSync() { + syncApi ??= new SyncApi(createJsiFfiBackendSync(FFI)); + return syncApi; +} + +let nextExecutionId = 1; + +/** + * Runs `run` on an instance of the service on a native thread of its own, whose foreign calls `foreignCall` + * answers on the JavaScript thread. Each execution has an instance of its own, so executions run in parallel. + */ +export async function withExecution(foreignCall, run) { + const executionId = nextExecutionId++; + const backend = createJsiFfiBackend({ + ...FFI, + hostCall: { oracle: request => handleRequest({ foreignCall }, request) }, + }); + try { + return await run(new AsyncApi(backend), executionId); + } finally { + await backend.destroy(); + } +} + +/** acvm_js's field: 0x and 64 hex digits. */ +export function fieldToHex(bytes) { + let hex = '0x'; + for (const byte of bytes) { + hex += byte.toString(16).padStart(2, '0'); + } + return hex; +} + +/** A field, as acvm_js takes it (hex, with or without 0x, at most 64 digits), as 32 big-endian bytes. */ +export function fieldFromHex(value) { + const hex = String(value).replace(/^0x/i, ''); + if (hex.length > 64 || !/^[0-9a-f]*$/i.test(hex)) { + throw new Error(`Invalid hex string: '${value}'`); + } + const padded = hex.padStart(64, '0'); + const bytes = new Uint8Array(32); + for (let i = 0; i < 32; i++) { + bytes[i] = parseInt(padded.slice(2 * i, 2 * i + 2), 16); + } + return bytes; +} + +/** WitnessMap (Map) to the service's witness entries. */ +export function witnessToWire(witness) { + const entries = []; + for (const [index, value] of witness) { + entries.push({ index, value: fieldFromHex(value) }); + } + return entries; +} + +/** The service's witness entries to a WitnessMap. */ +export function witnessFromWire(entries) { + return new Map(entries.map(({ index, value }) => [index, fieldToHex(value)])); +} + +export function stackToWire(stack) { + return stack.map(({ index, witness }) => ({ index, witness: witnessToWire(witness) })); +} + +export function stackFromWire(items) { + return items.map(({ index, witness }) => ({ index, witness: witnessFromWire(witness) })); +} + +export function bytes(value) { + return value instanceof Uint8Array ? value : new Uint8Array(value); +} diff --git a/native-packages/react-native/js/noir/acvm_js.js b/native-packages/react-native/js/noir/acvm_js.js new file mode 100644 index 00000000000..de24232c5f9 --- /dev/null +++ b/native-packages/react-native/js/noir/acvm_js.js @@ -0,0 +1,131 @@ +// @aztec-foundation/noir-acvm_js in a React Native app: acvm_js's API over the ACVM service's native library +// (./acvm.js), which withAztec resolves the package to, since Hermes has no WebAssembly. +import { acvmSync, bytes, fieldFromHex, fieldToHex, stackFromWire, stackToWire, withExecution, witnessFromWire, witnessToWire } from './acvm.js'; + +/** wasm-bindgen's module initialiser: nothing to load here. */ +export default async function init() {} + +export function initSync() {} + +export function initLogLevel() {} + +export function buildInfo() { + return { gitHash: 'native', version: 'native', dirty: 'false' }; +} + +/** acvm_js's ExecutionError: an Error carrying the failure's details. */ +function executionError(failure) { + const error = new Error(failure.message); + error.callStack = failure.callStack ?? undefined; + error.rawAssertionPayload = failure.rawAssertionPayload ?? undefined; + error.acirFunctionId = failure.acirFunctionId ?? undefined; + error.brilligFunctionId = failure.brilligFunctionId ?? undefined; + return error; +} + +async function execute(program, initialWitness, handler, { witness, witnessStack }) { + // A handler's own error is what the caller wants (acvm_js wraps it as the cause of its own); the service only + // sees that the foreign call failed. + let handlerError; + const foreignCall = async ({ name, inputs }) => { + let pending; + try { + pending = handler( + name, + inputs.map(({ values }) => values.map(fieldToHex)), + ); + } catch (error) { + handlerError = { kind: 'calling', error }; + throw error; + } + let outputs; + try { + outputs = await pending; + } catch (error) { + handlerError = { kind: 'awaiting', error }; + throw error; + } + if (!Array.isArray(outputs)) { + throw new Error('Expected `foreign_call_handler` to return an array'); + } + return { + outputs: outputs.map(output => + Array.isArray(output) + ? { values: output.map(fieldFromHex), array: true } + : { values: [fieldFromHex(output)], array: false }, + ), + }; + }; + let result; + try { + result = await withExecution(foreignCall, (acvm, executionId) => + acvm.executeProgram({ + executionId, + bytecode: bytes(program), + initialWitness: witnessToWire(initialWitness), + returnWitnessMap: witness, + returnWitnessStack: witnessStack, + }), + ); + } catch (error) { + if (handlerError) { + const wrapped = new Error( + handlerError.kind === 'calling' ? 'Error calling `foreign_call_callback`' : 'Error awaiting `foreign_call_handler`', + ); + wrapped.cause = handlerError.error; + throw wrapped; + } + throw error; + } + if (result.failure) { + throw executionError(result.failure); + } + return result; +} + +export async function executeCircuit(program, initialWitness, foreignCallHandler) { + const { witness } = await execute(program, initialWitness, foreignCallHandler, { witness: true, witnessStack: false }); + return witnessFromWire(witness); +} + +export async function executeCircuitWithReturnWitness(program, initialWitness, foreignCallHandler) { + const { witness, returnWitness } = await execute(program, initialWitness, foreignCallHandler, { + witness: true, + witnessStack: false, + }); + return { solvedWitness: witnessFromWire(witness), returnWitness: witnessFromWire(returnWitness) }; +} + +export function compressWitness(witness) { + return acvmSync().compressWitnessStack({ stack: [{ index: 0, witness: witnessToWire(witness) }] }).bytes; +} + +export function decompressWitness(compressed) { + const { stack } = acvmSync().decompressWitnessStack({ bytes: bytes(compressed) }); + return witnessFromWire(stack[stack.length - 1].witness); +} + +export function compressWitnessStack(stack) { + return acvmSync().compressWitnessStack({ stack: stackToWire(stack) }).bytes; +} + +export function decompressWitnessStack(compressed) { + return stackFromWire(acvmSync().decompressWitnessStack({ bytes: bytes(compressed) }).stack); +} + +function unsupported(name) { + return () => { + throw new Error(`${name} is not available in React Native's acvm_js`); + }; +} + +export const executeProgram = unsupported('executeProgram'); +export const getReturnWitness = unsupported('getReturnWitness'); +export const getPublicParametersWitness = unsupported('getPublicParametersWitness'); +export const getPublicWitness = unsupported('getPublicWitness'); +export const and = unsupported('and'); +export const xor = unsupported('xor'); +export const sha256_compression = unsupported('sha256_compression'); +export const blake2s256 = unsupported('blake2s256'); +export const ecdsa_secp256k1_verify = unsupported('ecdsa_secp256k1_verify'); +export const ecdsa_secp256r1_verify = unsupported('ecdsa_secp256r1_verify'); diff --git a/native-packages/react-native/js/noir/noirc_abi.js b/native-packages/react-native/js/noir/noirc_abi.js new file mode 100644 index 00000000000..62d4d96b876 --- /dev/null +++ b/native-packages/react-native/js/noir/noirc_abi.js @@ -0,0 +1,45 @@ +// @aztec-foundation/noir-noirc_abi in a React Native app: noirc_abi_wasm's API over the ACVM service's native +// library (./acvm.js), which withAztec resolves the package to, since Hermes has no WebAssembly. Values cross as +// the JSON noirc_abi_wasm's bindings move them through serde_json. +import { acvmSync, bytes, stackFromWire, witnessFromWire, witnessToWire } from './acvm.js'; + +/** wasm-bindgen's module initialiser: nothing to load here. */ +export default async function init() {} + +export function initSync() {} + +export function abiEncode(abi, inputs, returnValue) { + return witnessFromWire( + acvmSync().abiEncode({ + abiJson: JSON.stringify(abi), + inputsJson: JSON.stringify(inputs), + returnValueJson: returnValue === undefined || returnValue === null ? null : JSON.stringify(returnValue), + }).witness, + ); +} + +export function abiDecode(abi, witness) { + return JSON.parse(acvmSync().abiDecode({ abiJson: JSON.stringify(abi), witness: witnessToWire(witness) }).json); +} + +export function abiDecodeError(abi, rawError) { + return JSON.parse( + acvmSync().decodeAssertionPayload({ + abiJson: JSON.stringify(abi), + payload: { selector: String(rawError.selector), data: rawError.data }, + }).json, + ); +} + +export function serializeWitness(witness) { + return acvmSync().compressWitnessStack({ stack: [{ index: 0, witness: witnessToWire(witness) }] }).bytes; +} + +export function deserializeWitness(compressed) { + const { stack } = acvmSync().decompressWitnessStack({ bytes: bytes(compressed) }); + return witnessFromWire(stack[stack.length - 1].witness); +} + +export function deserializeWitnessStack(compressed) { + return stackFromWire(acvmSync().decompressWitnessStack({ bytes: bytes(compressed) }).stack); +} diff --git a/native-packages/react-native/js/polyfills.js b/native-packages/react-native/js/polyfills.js new file mode 100644 index 00000000000..f62e2c8a6db --- /dev/null +++ b/native-packages/react-native/js/polyfills.js @@ -0,0 +1,272 @@ +'use strict'; +/** + * Built-ins the stack (or its dependencies) uses that Hermes lacks, each installed only when missing: + * structuredClone, the ES2025 Set methods, Promise.withResolvers, Object.groupBy / Map.groupBy, Array.fromAsync, + * Array / TypedArray toSorted, and a UTF-8 TextDecoder. On Hermes it also replaces TypedArray#subarray (see + * fastSubarray) and gives the `buffer` package's UTF-8 and base64 conversions native implementations (see + * speedUpBuffer). + */ +const { structuredClonePolyfill } = require('./structured_clone'); + +function define(target, name, value) { + if (typeof target[name] !== 'function') { + Object.defineProperty(target, name, { value, writable: true, configurable: true, enumerable: false }); + } +} + +function installPolyfills() { + define(globalThis, 'structuredClone', structuredClonePolyfill); + + const SetProto = Set.prototype; + const keysOf = other => { + if (other == null || typeof other.has !== 'function' || typeof other.keys !== 'function') { + throw new TypeError('Set method: the argument must be set-like'); + } + return other; + }; + define(SetProto, 'union', function (other) { + const result = new Set(this); + for (const v of keysOf(other).keys()) result.add(v); + return result; + }); + define(SetProto, 'intersection', function (other) { + const o = keysOf(other); + const result = new Set(); + for (const v of this) if (o.has(v)) result.add(v); + return result; + }); + define(SetProto, 'difference', function (other) { + const o = keysOf(other); + const result = new Set(); + for (const v of this) if (!o.has(v)) result.add(v); + return result; + }); + define(SetProto, 'symmetricDifference', function (other) { + const o = keysOf(other); + const result = new Set(this); + for (const v of o.keys()) { + if (this.has(v)) result.delete(v); + else result.add(v); + } + return result; + }); + define(SetProto, 'isSubsetOf', function (other) { + const o = keysOf(other); + for (const v of this) if (!o.has(v)) return false; + return true; + }); + define(SetProto, 'isSupersetOf', function (other) { + for (const v of keysOf(other).keys()) if (!this.has(v)) return false; + return true; + }); + define(SetProto, 'isDisjointFrom', function (other) { + const o = keysOf(other); + for (const v of this) if (o.has(v)) return false; + return true; + }); + + define(Promise, 'withResolvers', function () { + let resolve; + let reject; + const promise = new this((res, rej) => { + resolve = res; + reject = rej; + }); + return { promise, resolve, reject }; + }); + + define(Object, 'groupBy', function (items, keyOf) { + const groups = Object.create(null); + let i = 0; + for (const item of items) { + const key = keyOf(item, i++); + (groups[key] ??= []).push(item); + } + return groups; + }); + define(Map, 'groupBy', function (items, keyOf) { + const groups = new Map(); + let i = 0; + for (const item of items) { + const key = keyOf(item, i++); + if (!groups.has(key)) groups.set(key, []); + groups.get(key).push(item); + } + return groups; + }); + define(Array, 'fromAsync', async function (items, mapFn, thisArg) { + const result = []; + let i = 0; + const iterable = items[Symbol.asyncIterator] ? items : (items[Symbol.iterator] ? items : Array.from(items)); + for await (const item of iterable) { + result.push(mapFn ? await mapFn.call(thisArg, item, i++) : item); + } + return result; + }); + define(Array.prototype, 'toSorted', function (compare) { + return Array.prototype.slice.call(this).sort(compare); + }); + const TypedArrayProto = Object.getPrototypeOf(Uint8Array.prototype); + define(TypedArrayProto, 'toSorted', function (compare) { + return this.slice().sort(compare); + }); + + if (typeof globalThis.TextDecoder !== 'function') { + globalThis.TextDecoder = Utf8Decoder; + } + + if (typeof globalThis.HermesInternal !== 'undefined') { + Object.defineProperty(TypedArrayProto, 'subarray', { + value: fastSubarray, + writable: true, + configurable: true, + enumerable: false, + }); + speedUpBuffer(require('buffer').Buffer); + } +} + +/** + * The `buffer` package converts strings in JavaScript, byte by byte through arrays, which on Hermes (no JIT) is + * most of the time a PXE spends turning contract artifacts to and from Buffers. Its UTF-8 and base64 cases go to + * Hermes's TextEncoder and @aztec-foundation/react-native's native decoders instead; the results are the same. + */ +function speedUpBuffer(Buffer) { + const native = globalThis.__aztecReactNative; + if (native === undefined || Buffer.__aztecNative) { + return; + } + Buffer.__aztecNative = true; + const encoder = new TextEncoder(); + const isUtf8 = enc => enc === undefined || enc === 'utf8' || enc === 'utf-8'; + const lower = enc => (typeof enc === 'string' ? enc.toLowerCase() : enc); + const view = bytes => Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength); + + const from = Buffer.from; + Buffer.from = function (value, encodingOrOffset, length) { + if (typeof value === 'string') { + const enc = lower(encodingOrOffset); + if (isUtf8(enc)) return view(encoder.encode(value)); + if (enc === 'base64' || enc === 'base64url') return view(native.base64Decode(value)); + } + return from.call(this, value, encodingOrOffset, length); + }; + + const byteLength = Buffer.byteLength; + Buffer.byteLength = function (value, encoding) { + if (typeof value === 'string' && isUtf8(lower(encoding))) return encoder.encode(value).length; + return byteLength.call(this, value, encoding); + }; + + const toString = Buffer.prototype.toString; + Buffer.prototype.toString = function (encoding, start, end) { + const enc = lower(encoding); + if (isUtf8(enc) || enc === 'base64') { + const length = this.length; + const s = start === undefined || start < 0 ? 0 : Math.min(start | 0, length); + const e = end === undefined || end > length ? length : end | 0; + if (e <= s) return ''; + const bytes = new Uint8Array(this.buffer, this.byteOffset + s, e - s); + return enc === 'base64' ? native.base64Encode(bytes) : native.decodeUtf8(bytes, false); + } + return toString.apply(this, arguments); + }; +} + +/** + * TypedArray#subarray for Hermes, whose own takes time proportional to the view's length (msgpackr takes a view of + * its whole remaining buffer for every string it writes), and ignores Symbol.species, so a Buffer's subarray is a + * plain Uint8Array where V8 gives a Buffer. A view made with the array's own constructor is neither. + */ +function fastSubarray(begin, end) { + const length = this.length; + const clamp = (value, fallback) => { + if (value === undefined) return fallback; + const n = Math.trunc(Number(value)) || 0; + return n < 0 ? Math.max(length + n, 0) : Math.min(n, length); + }; + const start = clamp(begin, 0); + const count = Math.max(clamp(end, length) - start, 0); + return new this.constructor(this.buffer, this.byteOffset + start * this.BYTES_PER_ELEMENT, count); +} + +/** TextDecoder for UTF-8 (the only encoding the stack decodes), with `fatal` and BOM handling. */ +class Utf8Decoder { + constructor(label = 'utf-8', options = {}) { + const name = String(label).toLowerCase(); + if (name !== 'utf-8' && name !== 'utf8' && name !== 'unicode-1-1-utf-8') { + throw new RangeError(`TextDecoder: unsupported encoding ${label}`); + } + this.encoding = 'utf-8'; + this.fatal = !!options.fatal; + this.ignoreBOM = !!options.ignoreBOM; + } + + decode(input) { + if (input === undefined) return ''; + let bytes = ArrayBuffer.isView(input) + ? new Uint8Array(input.buffer, input.byteOffset, input.byteLength) + : new Uint8Array(input); + let i = 0; + if (!this.ignoreBOM && bytes[0] === 0xef && bytes[1] === 0xbb && bytes[2] === 0xbf) i = 3; + const native = globalThis.__aztecReactNative; + if (native !== undefined) { + if (i > 0) bytes = new Uint8Array(bytes.buffer, bytes.byteOffset + i, bytes.length - i); + try { + return native.decodeUtf8(bytes, this.fatal); + } catch (err) { + throw new TypeError(`TextDecoder: ${err.message}`); + } + } + const units = []; + let out = ''; + const bad = () => { + if (this.fatal) throw new TypeError('TextDecoder: the encoded data was not valid utf-8'); + units.push(0xfffd); + }; + while (i < bytes.length) { + const b = bytes[i]; + let need = 0; + let cp = 0; + let min = 0; + if (b < 0x80) { + units.push(b); + i++; + } else { + if (b >= 0xc2 && b <= 0xdf) [need, cp, min] = [1, b & 0x1f, 0x80]; + else if (b >= 0xe0 && b <= 0xef) [need, cp, min] = [2, b & 0x0f, 0x800]; + else if (b >= 0xf0 && b <= 0xf4) [need, cp, min] = [3, b & 0x07, 0x10000]; + else { + bad(); + i++; + continue; + } + let j = 1; + for (; j <= need; j++) { + const c = bytes[i + j]; + if (c === undefined || (c & 0xc0) !== 0x80) break; + cp = (cp << 6) | (c & 0x3f); + } + if (j <= need || cp < min || cp > 0x10ffff || (cp >= 0xd800 && cp <= 0xdfff)) { + bad(); + i += Math.max(1, j); + continue; + } + if (cp >= 0x10000) { + cp -= 0x10000; + units.push(0xd800 + (cp >> 10), 0xdc00 + (cp & 0x3ff)); + } else { + units.push(cp); + } + i += need + 1; + } + if (units.length >= 8192) { + out += String.fromCharCode.apply(null, units); + units.length = 0; + } + } + return out + String.fromCharCode.apply(null, units); + } +} + +module.exports = { installPolyfills, Utf8Decoder }; diff --git a/native-packages/react-native/js/structured_clone.js b/native-packages/react-native/js/structured_clone.js new file mode 100644 index 00000000000..9aa4a23d4ca --- /dev/null +++ b/native-packages/react-native/js/structured_clone.js @@ -0,0 +1,80 @@ +'use strict'; +/** + * structuredClone for engines without it (Hermes): the structured clone algorithm's data types (primitives, + * bigints, plain objects and arrays, Date, RegExp, Map, Set, ArrayBuffer and its views, Error), with shared + * and cyclic references kept. As with the real one, class instances come out as plain objects and functions + * are refused. + */ +function structuredClonePolyfill(value) { + const seen = new Map(); + + function clone(v) { + if (v === null || typeof v !== 'object') { + if (typeof v === 'function' || typeof v === 'symbol') { + throw new TypeError(`structuredClone: ${typeof v} could not be cloned`); + } + return v; + } + if (seen.has(v)) { + return seen.get(v); + } + let out; + if (Array.isArray(v)) { + out = new Array(v.length); + seen.set(v, out); + for (let i = 0; i < v.length; i++) { + if (i in v) out[i] = clone(v[i]); + } + return out; + } + if (v instanceof Date) { + out = new Date(v.getTime()); + } else if (v instanceof RegExp) { + out = new RegExp(v.source, v.flags); + } else if (v instanceof ArrayBuffer) { + out = v.slice(0); + } else if (ArrayBuffer.isView(v)) { + const buffer = clone(v.buffer); + if (v instanceof DataView) { + out = new DataView(buffer, v.byteOffset, v.byteLength); + } else { + // A Buffer (or other subclass) comes back as its base typed array, as structuredClone gives. + let Ctor = v.constructor; + while (Ctor && Object.getPrototypeOf(Ctor) && Object.getPrototypeOf(Ctor).name !== 'TypedArray') { + Ctor = Object.getPrototypeOf(Ctor); + } + out = new Ctor(buffer, v.byteOffset, v.length); + } + } else if (v instanceof Map) { + out = new Map(); + seen.set(v, out); + for (const [k, item] of v) out.set(clone(k), clone(item)); + return out; + } else if (v instanceof Set) { + out = new Set(); + seen.set(v, out); + for (const item of v) out.add(clone(item)); + return out; + } else if (v instanceof Error) { + out = new Error(v.message); + out.name = v.name; + if (v.stack !== undefined) out.stack = v.stack; + if ('cause' in v) out.cause = clone(v.cause); + } else if (typeof v === 'object' && v[Symbol.toStringTag] === 'Promise') { + throw new TypeError('structuredClone: a Promise could not be cloned'); + } else { + out = {}; + seen.set(v, out); + for (const key of Object.keys(v)) { + out[key] = clone(v[key]); + } + return out; + } + seen.set(v, out); + return out; + } + + return clone(value); +} + +module.exports = { structuredClonePolyfill }; diff --git a/native-packages/react-native/metro/babel_transformer.js b/native-packages/react-native/metro/babel_transformer.js new file mode 100644 index 00000000000..9e5dd0b9fa3 --- /dev/null +++ b/native-packages/react-native/metro/babel_transformer.js @@ -0,0 +1,11 @@ +// The app's Babel transformer (React Native's or Expo's, as withAztec found it), plus the plugin for +// `export * as ns from` (zod 4 uses it; React Native's preset does not transform it). +const upstream = require(process.env.AZTEC_RN_UPSTREAM_BABEL_TRANSFORMER || '@react-native/metro-babel-transformer'); +const exportNamespaceFrom = require('@babel/plugin-transform-export-namespace-from'); + +module.exports = { + ...upstream, + transform(args) { + return upstream.transform({ ...args, plugins: [...(args.plugins || []), exportNamespaceFrom] }); + }, +}; diff --git a/native-packages/react-native/metro/empty.js b/native-packages/react-native/metro/empty.js new file mode 100644 index 00000000000..31d83494c8a --- /dev/null +++ b/native-packages/react-native/metro/empty.js @@ -0,0 +1,2 @@ +// What a Node builtin the app cannot have resolves to (see index.js). +module.exports = {}; diff --git a/native-packages/react-native/metro/hash_js.js b/native-packages/react-native/metro/hash_js.js new file mode 100644 index 00000000000..838a441df95 --- /dev/null +++ b/native-packages/react-native/metro/hash_js.js @@ -0,0 +1,49 @@ +'use strict'; +// hash.js with its SHA-256 computed by @aztec-foundation/react-native's native SHA-256: hash.js's JavaScript one is +// slow on Hermes, which has no JIT, and the stack hashes every contract artifact with it. Everything else is +// hash.js's own. withAztec resolves `hash.js` here, except from this file. +const real = require('hash.js'); + +function nativeSha256(bytes) { + const native = globalThis.__aztecReactNative; + if (native === undefined) { + throw new Error("hash.js: import '@aztec-foundation/react-native' before the rest of the app"); + } + return native.sha256(bytes); +} + +function Sha256() { + if (!(this instanceof Sha256)) return new Sha256(); + this.chunks = []; +} +Sha256.blockSize = 512; +Sha256.outSize = 256; +Sha256.hmacStrength = 192; +Sha256.padLength = 64; + +Sha256.prototype.update = function update(msg, enc) { + if (ArrayBuffer.isView(msg)) { + this.chunks.push(new Uint8Array(msg.buffer.slice(msg.byteOffset, msg.byteOffset + msg.byteLength))); + } else { + this.chunks.push(Uint8Array.from(real.utils.toArray(msg, enc))); + } + return this; +}; + +Sha256.prototype.digest = function digest(enc) { + let total = 0; + for (const chunk of this.chunks) total += chunk.length; + const all = new Uint8Array(total); + let offset = 0; + for (const chunk of this.chunks) { + all.set(chunk, offset); + offset += chunk.length; + } + const out = Array.from(nativeSha256(all)); + return enc === 'hex' ? real.utils.toHex(out) : out; +}; + +module.exports = Object.assign(Object.create(null), real, { + sha256: Sha256, + sha: Object.assign(Object.create(null), real.sha, { sha256: Sha256 }), +}); diff --git a/native-packages/react-native/metro/index.js b/native-packages/react-native/metro/index.js new file mode 100644 index 00000000000..5b77a3d5753 --- /dev/null +++ b/native-packages/react-native/metro/index.js @@ -0,0 +1,102 @@ +// @ts-check +/** + * Metro configuration for an app using Aztec's client stack (a labs PXE, bb.js, Noir): in metro.config.js, + * + * const { withAztec } = require('@aztec-foundation/react-native/metro'); + * module.exports = withAztec(getDefaultConfig(__dirname)); + * + * It resolves Node's built-in modules, which parts of the stack import, to what React Native can run (the + * stack's browser builds need the same of a web bundler), resolves Noir's acvm_js and noirc_abi, which are wasm + * modules, to their API over the ACVM's native library (js/noir), resolves ohash's and hash.js's SHA-256 to the native one + * (Hermes has no JIT; the PXE hashes every contract artifact and every value it stores), and transforms `export * as` (zod 4), which React + * Native's Babel preset leaves alone. + */ +const fs = require('fs'); +const path = require('path'); + +/** + * Node builtins the stack imports, and what they resolve to in the app: a package (one copy of it for the whole + * app, this package's, so a fix-up of it reaches every importer), or null for an empty module. + */ +const NODE_BUILTINS = { + assert: null, + async_hooks: null, + buffer: 'buffer', + child_process: null, + crypto: null, + events: 'events', + fs: null, + 'fs/promises': null, + http: null, + https: null, + module: null, + net: null, + os: null, + path: null, + perf_hooks: null, + process: null, + stream: null, + string_decoder: null, + timers: null, + tty: null, + url: null, + util: 'util', + v8: null, + vm: null, + worker_threads: null, + zlib: null, +}; + +const EMPTY_MODULE = path.join(__dirname, 'empty.js'); +const PACKAGE_ROOT = path.join(__dirname, '..'); +const HASH_JS_SHIM = fs.realpathSync(path.join(__dirname, 'hash_js.js')); + +/** Noir's wasm packages, and their API over the ACVM's native library. */ +const NOIR_MODULES = { + '@aztec-foundation/noir-acvm_js': path.join(PACKAGE_ROOT, 'js/noir/acvm_js.js'), + '@aztec-foundation/noir-noirc_abi': path.join(PACKAGE_ROOT, 'js/noir/noirc_abi.js'), +}; + +/** + * @param {any} config The app's Metro config (from `getDefaultConfig`). + * @returns {any} The config, extended. + */ +function withAztec(config) { + const upstreamResolveRequest = config.resolver?.resolveRequest; + process.env.AZTEC_RN_UPSTREAM_BABEL_TRANSFORMER = + config.transformer?.babelTransformerPath ?? require.resolve('@react-native/metro-babel-transformer'); + return { + ...config, + resolver: { + ...config.resolver, + resolveRequest(context, moduleName, platform) { + if (Object.prototype.hasOwnProperty.call(NOIR_MODULES, moduleName)) { + return { type: 'sourceFile', filePath: NOIR_MODULES[/** @type {keyof typeof NOIR_MODULES} */ (moduleName)] }; + } + if (moduleName === 'ohash/crypto') { + return { type: 'sourceFile', filePath: path.join(__dirname, 'ohash_crypto.js') }; + } + if (moduleName === 'hash.js' && fs.realpathSync(context.originModulePath) !== HASH_JS_SHIM) { + return { type: 'sourceFile', filePath: HASH_JS_SHIM }; + } + const name = moduleName.startsWith('node:') ? moduleName.slice(5) : moduleName; + if (Object.prototype.hasOwnProperty.call(NODE_BUILTINS, name)) { + const target = NODE_BUILTINS[/** @type {keyof typeof NODE_BUILTINS} */ (name)]; + return { + type: 'sourceFile', + filePath: target === null ? EMPTY_MODULE : require.resolve(`${target}/`, { paths: [PACKAGE_ROOT] }), + }; + } + return upstreamResolveRequest + ? upstreamResolveRequest(context, moduleName, platform) + : context.resolveRequest(context, moduleName, platform); + }, + }, + transformer: { + ...config.transformer, + babelTransformerPath: path.join(__dirname, 'babel_transformer.js'), + }, + }; +} + +module.exports = { withAztec, NODE_BUILTINS }; diff --git a/native-packages/react-native/metro/ohash_crypto.js b/native-packages/react-native/metro/ohash_crypto.js new file mode 100644 index 00000000000..8eea7f85bf9 --- /dev/null +++ b/native-packages/react-native/metro/ohash_crypto.js @@ -0,0 +1,30 @@ +'use strict'; +// ohash's digest (base64url SHA-256 of a string's UTF-8), with @aztec-foundation/react-native's native SHA-256: +// ohash's JavaScript one is slow on Hermes, and the kv-store hashes every value it stores with it. withAztec +// resolves `ohash/crypto` here. +const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'; + +function base64url(bytes) { + let out = ''; + let i = 0; + for (; i + 2 < bytes.length; i += 3) { + const n = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2]; + out += ALPHABET[n >> 18] + ALPHABET[(n >> 12) & 63] + ALPHABET[(n >> 6) & 63] + ALPHABET[n & 63]; + } + if (i < bytes.length) { + const n = (bytes[i] << 16) | ((bytes[i + 1] ?? 0) << 8); + out += ALPHABET[n >> 18] + ALPHABET[(n >> 12) & 63]; + if (i + 1 < bytes.length) out += ALPHABET[(n >> 6) & 63]; + } + return out; +} + +function digest(input) { + const native = globalThis.__aztecReactNative; + if (native === undefined) { + throw new Error("ohash: import '@aztec-foundation/react-native' before the rest of the app"); + } + return base64url(native.sha256(input)); +} + +module.exports = { digest }; diff --git a/native-packages/react-native/package.json b/native-packages/react-native/package.json new file mode 100644 index 00000000000..b20d19c22f1 --- /dev/null +++ b/native-packages/react-native/package.json @@ -0,0 +1,71 @@ +{ + "name": "@aztec-foundation/react-native", + "version": "0.1.0", + "description": "Runs Aztec's client stack (a labs PXE, bb.js, Noir) in a React Native app: bb, the ACVM and the PXE's store (kv-sqlite) linked in natively, reached through JSI.", + "type": "commonjs", + "main": "./js/index.js", + "types": "./js/index.d.ts", + "exports": { + ".": { + "types": "./js/index.d.ts", + "default": "./js/index.js" + }, + "./metro": "./metro/index.js", + "./package.json": "./package.json" + }, + "files": [ + "js", + "metro", + "cpp", + "android", + "ios", + "prebuilt", + "third_party", + "AztecReactNative.podspec", + "react-native.config.js", + "README.md" + ], + "dependencies": { + "@aztec-foundation/ipc-runtime": "0.1.0", + "@aztec-labs/acvm": "0.1.0", + "@aztec-labs/acvm-oracle": "0.1.0", + "@babel/plugin-transform-export-namespace-from": "^7.27.1", + "buffer": "^6.0.3", + "events": "^3.3.0", + "hash.js": "^1.1.7", + "util": "^0.12.5" + }, + "peerDependencies": { + "@babel/core": "^7.0.0", + "react-native": ">=0.76" + }, + "packageManager": "yarn@4.13.0", + "devDependencies": { + "@aztec-labs/kv-sqlite": "0.1.0", + "@babel/cli": "^7.29.0", + "@babel/core": "^7.29.0", + "@react-native/babel-preset": "0.88.1", + "esbuild": "^0.25.0", + "msgpackr": "^1.11.2" + }, + "resolutions": { + "@aztec-foundation/ipc-runtime": "portal:../../ipc-runtime/ts", + "@aztec-labs/acvm": "portal:../acvm/ts", + "@aztec-labs/acvm-oracle": "portal:../acvm/oracle", + "@aztec-labs/kv-sqlite": "portal:../kv-sqlite/ts", + "@aztec-labs/acvm-darwin-arm64": "portal:../acvm/ts/packages/acvm-darwin-arm64", + "@aztec-labs/kv-sqlite-darwin-arm64": "portal:../kv-sqlite/ts/packages/kv-sqlite-darwin-arm64", + "@aztec-labs/acvm-darwin-x64": "portal:../acvm/ts/packages/acvm-darwin-x64", + "@aztec-labs/kv-sqlite-darwin-x64": "portal:../kv-sqlite/ts/packages/kv-sqlite-darwin-x64", + "@aztec-labs/acvm-linux-arm64": "portal:../acvm/ts/packages/acvm-linux-arm64", + "@aztec-labs/kv-sqlite-linux-arm64": "portal:../kv-sqlite/ts/packages/kv-sqlite-linux-arm64", + "@aztec-labs/acvm-linux-x64": "portal:../acvm/ts/packages/acvm-linux-x64", + "@aztec-labs/kv-sqlite-linux-x64": "portal:../kv-sqlite/ts/packages/kv-sqlite-linux-x64" + }, + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "https://github.com/AztecProtocol/aztec-packages", + "directory": "native-packages/react-native" + } +} diff --git a/native-packages/react-native/react-native.config.js b/native-packages/react-native/react-native.config.js new file mode 100644 index 00000000000..24d5e1926d3 --- /dev/null +++ b/native-packages/react-native/react-native.config.js @@ -0,0 +1,16 @@ +// React Native autolinking: on Android the package is a pure C++ dependency (android/CMakeLists.txt, no Gradle +// module), with a hand-written stand-in for codegen output (android/codegen); on iOS it is the +// AztecReactNative pod (AztecReactNative.podspec). +module.exports = { + dependency: { + platforms: { + android: { + libraryName: 'AztecReactNative', + cmakeListsPath: 'codegen/CMakeLists.txt', + cxxModuleCMakeListsPath: 'CMakeLists.txt', + cxxModuleCMakeListsModuleName: 'aztec_react_native', + cxxModuleHeaderName: 'NativeAztecReactNative', + }, + }, + }, +}; diff --git a/native-packages/react-native/scripts/build_hermes.sh b/native-packages/react-native/scripts/build_hermes.sh new file mode 100755 index 00000000000..2e07e6e280e --- /dev/null +++ b/native-packages/react-native/scripts/build_hermes.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# Builds Hermes (the VM React Native runs JavaScript on) for this machine, into build/hermes: its runtime +# (lib/libhermesvm.so), JSI (lib/libjsi.a) and their headers. The package's tests run in a host program over it +# (test/hermes_host.cpp), as the JavaScript of an app does. +set -euo pipefail + +cd "$(dirname "$0")/.." + +# The Hermes React Native 0.88 ships (react-native/sdks/.hermesv1version), which the tests' Babel transform +# (React Native 0.88's preset) targets. +hermes_tag=hermes-v260318099.0.5 + +out=$PWD/build/hermes +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT + +curl -sSfL "https://github.com/facebook/hermes/archive/refs/tags/$hermes_tag.tar.gz" | tar -xz -C "$tmp" +src=$tmp/hermes-$hermes_tag + +cmake -S "$src" -B "$tmp/build" -G Ninja -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER=${CC:-clang} -DCMAKE_CXX_COMPILER=${CXX:-clang++} \ + -DHERMES_ENABLE_INTL=OFF -DHERMES_ENABLE_TEST_SUITE=OFF \ + -DHERMES_ENABLE_DEBUGGER=OFF -DHERMES_BUILD_SHARED_JSI=OFF -DHERMES_BUILD_APPLE_FRAMEWORK=OFF >"$tmp/configure.log" 2>&1 || { cat "$tmp/configure.log"; exit 1; } +cmake --build "$tmp/build" --target hermesvm jsi >"$tmp/build.log" 2>&1 || { tail -50 "$tmp/build.log"; exit 1; } + +rm -rf "$out" +mkdir -p "$out/lib" "$out/include" +cp "$(find "$tmp/build" -name libhermesvm.so | head -1)" "$tmp/build/jsi/libjsi.a" "$out/lib/" +(cd "$src/API" && find . -name '*.h' -exec cp --parents {} "$out/include/" \;) +(cd "$src/API/jsi" && find . -name '*.h' -exec cp --parents {} "$out/include/" \;) +(cd "$src/public" && find . -name '*.h' -exec cp --parents {} "$out/include/" \;) +if [ -d "$tmp/build/include" ]; then + (cd "$tmp/build/include" && find . -name '*.h' -exec cp --parents {} "$out/include/" \;) +fi diff --git a/native-packages/react-native/scripts/build_host.sh b/native-packages/react-native/scripts/build_host.sh new file mode 100755 index 00000000000..4b314c10464 --- /dev/null +++ b/native-packages/react-native/scripts/build_host.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# Builds build/hermes_host (test/hermes_host.cpp): Hermes with the package's native module installed, as an app +# has it, and an event loop, for the package's tests. Needs build/hermes (build_hermes.sh) and third_party +# (vendor.sh). +set -euo pipefail + +cd "$(dirname "$0")/.." + +cc=${CC:-clang} +cxx=${CXX:-clang++} +mkdir -p build/obj + +$cc -c -O2 -w -Ithird_party/sqlite3mc cpp/sqlite3mc_unit.c -o build/obj/sqlite3mc.o +$cxx -std=c++20 -O2 -Wall -Wextra -Werror -Ithird_party/kv-sqlite -Ithird_party/msgpack-c/include \ + -Ithird_party/sqlite3mc -c cpp/kv_sqlite_unit.cpp -o build/obj/kv_sqlite.o +$cxx -std=c++20 -O2 -g -Wall -Wextra -Werror \ + -Ibuild/hermes/include -Icpp -Ithird_party/ipc-runtime-jsi \ + test/hermes_host.cpp cpp/aztec_react_native.cpp third_party/ipc-runtime-jsi/ipc_runtime_jsi.cpp \ + build/obj/kv_sqlite.o build/obj/sqlite3mc.o -Lbuild/hermes/lib -lhermesvm build/hermes/lib/libjsi.a \ + -Wl,-rpath,'$ORIGIN/hermes/lib' -ldl -pthread -o build/hermes_host diff --git a/native-packages/react-native/scripts/build_prebuilt.sh b/native-packages/react-native/scripts/build_prebuilt.sh new file mode 100755 index 00000000000..b5e9603b0af --- /dev/null +++ b/native-packages/react-native/scripts/build_prebuilt.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash +# Assembles prebuilt/, the native libraries the package ships, from this tree's cross builds (make +# react-native-mobile builds them): +# prebuilt/android//libaztec_bb.so bb, linked with its own C++ runtime (zig's libc++, which is not the +# NDK's), exporting only its FFI +# prebuilt/android//libaztec_acvm.a the ACVM and Noir's ABI encoder (native-packages/acvm), a Rust +# static library +# prebuilt/ios/AztecBB.xcframework bb's static library, for devices and the arm64 simulator +# prebuilt/ios/AztecACVM.xcframework the ACVM's +set -euo pipefail + +cd "$(dirname "$0")/.." +root=$(git rev-parse --show-toplevel) +bb=$root/barretenberg/cpp +acvm=$root/native-packages/acvm/rust/target + +rm -rf prebuilt +mkdir -p prebuilt/android prebuilt/ios +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT + +echo '{ global: bb_ipc_ffi_*; local: *; };' >"$tmp/bb.map" +for spec in arm64-v8a:aarch64:arm64-android x86_64:x86_64:x86_64-android; do + IFS=: read -r abi arch preset <<<"$spec" + out=prebuilt/android/$abi + mkdir -p "$out" + cat >"$tmp/libc-$abi.txt" <"$dir/Info.plist" < + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64 + LibraryPath + $library + SupportedArchitectures + + arm64 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-arm64-simulator + LibraryPath + $library + SupportedArchitectures + + arm64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + +PLIST +} + +xcframework AztecBB libaztec_bb.a "$bb/build-arm64-ios/lib/libbb-external.a" \ + "$bb/build-arm64-ios-sim/lib/libbb-external.a" +xcframework AztecACVM libaztec_acvm.a "$acvm/aarch64-apple-ios/release/libaztec_acvm.a" \ + "$acvm/aarch64-apple-ios-sim/release/libaztec_acvm.a" + +# Rust's standard library comes with debug information, which the app's build has no use for. +strip=$(command -v llvm-strip-20 || command -v llvm-strip) +find prebuilt -name libaztec_acvm.a -exec "$strip" --strip-debug {} \; diff --git a/native-packages/react-native/scripts/run_test.sh b/native-packages/react-native/scripts/run_test.sh new file mode 100755 index 00000000000..6abd69ad82c --- /dev/null +++ b/native-packages/react-native/scripts/run_test.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Runs one of the package's Hermes tests: bundles it as Metro would resolve it for an app (the react-native +# export condition and package field), transforms it with React Native's Babel preset as Metro does, and runs it in build/hermes_host with a +# fresh data directory. bb's, the ACVM's and the echo example's native libraries are loaded from this tree's builds; +# kv-sqlite is compiled into the host, as into an app. +set -euo pipefail + +cd "$(dirname "$0")/.." +root=$(git rev-parse --show-toplevel) +test=$1 + +work=${KEEP_WORK:-$(mktemp -d)}; mkdir -p "$work" +[ -n "${KEEP_WORK:-}" ] || trap 'rm -rf "$work"' EXIT + +NODE_PATH=$PWD/node_modules node_modules/.bin/esbuild "$test" --bundle --format=iife --platform=neutral \ + --conditions=react-native --main-fields=react-native,module,main --target=es2017 --supported:bigint=true --log-level=warning --external:react-native \ + --alias:@aztec-foundation/bb.js="$root/barretenberg/ts/bb.js" --outfile="$work/bundle.js" +node_modules/.bin/babel --no-babelrc --config-file "$PWD/test/babel.config.json" --compact true "$work/bundle.js" \ + -o "$work/test.js" + +AZTEC_RN_DATA_DIR=$work/data \ + LD_LIBRARY_PATH="$root/barretenberg/cpp/build/lib:$root/native-packages/acvm/rust/target/release:$root/ipc-codegen/echo_example/rust/target/debug${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" \ + build/hermes_host "$work/test.js" diff --git a/native-packages/react-native/scripts/vendor.sh b/native-packages/react-native/scripts/vendor.sh new file mode 100755 index 00000000000..19e0f514ed7 --- /dev/null +++ b/native-packages/react-native/scripts/vendor.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +# Fills third_party/ with the sources the package's native module compiles in the app: +# - kv-sqlite's service (native-packages/kv-sqlite), the PXE's store: its sources, its FFI and dispatch +# generated from its schema, and msgpack-c's headers at the commit kv-sqlite builds with; +# - SQLite3 Multiple Ciphers' amalgamation (the release kv-sqlite builds, so a store has one format in a +# browser, in node and on a phone), with aztec_sqlite_prefix.h, which renames every symbol it exports to +# aztec_: an app may link another SQLite or libsodium, whose symbols would clash; +# - ipc-runtime's JSI binding (ipc-runtime/cpp/jsi). +set -euo pipefail + +cd "$(dirname "$0")/.." +root=$(git rev-parse --show-toplevel) + +# As native-packages/kv-sqlite/cpp/CMakeLists.txt fetches them. +mc_version=2.6.1 +sqlite_version=3.54.0 +mc_sha256=3f25af603566a23c821d8e581778b5ece2a541d2435776de57b8d845c176815a +msgpack_commit=8c602e8579c7e7d65d6f9c6703c9699db3fb0488 + +out=third_party/sqlite3mc +if [ ! -f "$out/aztec_sqlite_prefix.h" ]; then + tmp=$(mktemp -d) + trap 'rm -rf "$tmp"' EXIT + curl -sSfL -o "$tmp/mc.zip" \ + "https://github.com/utelle/SQLite3MultipleCiphers/releases/download/v$mc_version/sqlite3mc-$mc_version-sqlite-$sqlite_version-amalgamation.zip" + echo "$mc_sha256 $tmp/mc.zip" | sha256sum -c --quiet + mkdir -p "$tmp/src" + python3 -m zipfile -e "$tmp/mc.zip" "$tmp/src" + rm -rf "$out" + mkdir -p "$out" + cp "$tmp/src/sqlite3mc_amalgamation.c" "$tmp/src/sqlite3mc_amalgamation.h" "$out/" + + # Every global the amalgamation defines, on this machine, plus the implementation tables other machines + # select (the crypto code picks one per CPU). + ${CC:-cc} -c -O0 -w -DSQLITE_THREADSAFE=1 -DSQLITE_DQS=0 -DSQLITE_OMIT_LOAD_EXTENSION=1 \ + "$out/sqlite3mc_amalgamation.c" -o "$tmp/mc.o" + { + nm -g --defined-only "$tmp/mc.o" | awk '{print $3}' + grep -oE '\bcrypto_[A-Za-z0-9_]+_implementation\b' "$out/sqlite3mc_amalgamation.c" + } | sort -u >"$tmp/symbols" + { + echo "// Generated by scripts/vendor.sh: SQLite3 Multiple Ciphers' exported symbols, renamed." + echo "#pragma once" + while read -r symbol; do + echo "#define $symbol aztec_$symbol" + done <"$tmp/symbols" + } >"$out/aztec_sqlite_prefix.h" + + ${CC:-cc} -c -O0 -w -include "$out/aztec_sqlite_prefix.h" -DSQLITE_THREADSAFE=1 -DSQLITE_DQS=0 \ + -DSQLITE_OMIT_LOAD_EXTENSION=1 "$out/sqlite3mc_amalgamation.c" -o "$tmp/prefixed.o" + if nm -g --defined-only "$tmp/prefixed.o" | awk '{print $3}' | grep -v '^aztec_'; then + echo "vendor.sh: the symbols above escaped aztec_sqlite_prefix.h" >&2 + exit 1 + fi +fi + +if [ ! -f third_party/msgpack-c/include/msgpack.hpp ]; then + rm -rf third_party/msgpack-c.tmp + git init -q third_party/msgpack-c.tmp + git -C third_party/msgpack-c.tmp fetch -q --depth 1 https://github.com/msgpack/msgpack-c.git $msgpack_commit + git -C third_party/msgpack-c.tmp checkout -q FETCH_HEAD + rm -rf third_party/msgpack-c + mkdir -p third_party/msgpack-c + mv third_party/msgpack-c.tmp/include third_party/msgpack-c/include + rm -rf third_party/msgpack-c.tmp +fi + +kv=$root/native-packages/kv-sqlite +rm -rf third_party/kv-sqlite +mkdir -p third_party/kv-sqlite +cp "$kv"/cpp/src/kv/{store.cpp,store.hpp,kv_service.cpp,files_native.cpp,sha256.hpp} third_party/kv-sqlite/ +node --experimental-strip-types --no-warnings "$root/ipc-codegen/src/generate.ts" \ + --schema "$kv/kv_schema.jsonc" --lang cpp --out third_party/kv-sqlite/generated \ + --server --cpp-namespace aztec::kv --cpp-include-dir generated --ffi --ffi-name kv_sqlite >/dev/null + +mkdir -p third_party/ipc-runtime-jsi +cp "$root/ipc-runtime/cpp/jsi/ipc_runtime_jsi.hpp" "$root/ipc-runtime/cpp/jsi/ipc_runtime_jsi.cpp" third_party/ipc-runtime-jsi/ diff --git a/native-packages/react-native/test/babel.config.json b/native-packages/react-native/test/babel.config.json new file mode 100644 index 00000000000..c7ac5a077cc --- /dev/null +++ b/native-packages/react-native/test/babel.config.json @@ -0,0 +1 @@ +{ "presets": [["@react-native/babel-preset", { "enableBabelRuntime": false, "disableImportExportTransform": true }]] } diff --git a/native-packages/react-native/test/bb.test.js b/native-packages/react-native/test/bb.test.js new file mode 100644 index 00000000000..680b002944c --- /dev/null +++ b/native-packages/react-native/test/bb.test.js @@ -0,0 +1,30 @@ +// bb.js's react-native build under Hermes: Barretenberg and BarretenbergSync on bb's native library, through +// ipc-runtime's JSI binding (the CRS is skipped: the test host has no HTTPS). +import '../js/index.js'; + +import { Barretenberg, BarretenbergSync } from '@aztec-foundation/bb.js'; + +import { equal, run, test } from './harness.js'; + +const fr = n => { + const bytes = new Uint8Array(32); + bytes[31] = n; + return bytes; +}; + +test('Barretenberg and BarretenbergSync agree on poseidon2', async () => { + const sync = await BarretenbergSync.new(); + const api = await Barretenberg.new({ skipSrsInit: true }); + const expected = sync.poseidon2Hash({ inputs: [fr(1), fr(2)] }).hash; + const results = await Promise.all([1, 2, 3].map(n => api.poseidon2Hash({ inputs: [fr(n), fr(2)] }))); + equal(results[0].hash, expected, 'async = sync'); + equal( + Array.from(expected, b => b.toString(16).padStart(2, '0')).join(''), + '038682aa1cb5ae4e0a3f13da432a95c77c5c111f6f030faf9cad641ce1ed7383', + 'poseidon2(1, 2)', + ); + await api.destroy(); + sync.destroy(); +}); + +run(); diff --git a/native-packages/react-native/test/echo.test.js b/native-packages/react-native/test/echo.test.js new file mode 100644 index 00000000000..6feb6a0538d --- /dev/null +++ b/native-packages/react-native/test/echo.test.js @@ -0,0 +1,61 @@ +// ipc-codegen's echo example under Hermes, through ipc-runtime's JSI binding: its Relay calls out to +// "peer" before it answers, and "peer" is bound back to the same backend, so every hop is another +// call into the one asynchronous instance while the hops before it wait on their answers. The +// library is the Rust example's (ipc-codegen/echo_example/rust), loaded by file name. +import '../js/index.js'; + +import { createJsiFfiBackend } from '@aztec-foundation/ipc-runtime/react-native'; + +import { equal, rejects, run, test } from './harness.js'; + +const ascii = text => Array.from(text, c => c.charCodeAt(0)); +const str = text => [0xa0 + text.length, ...ascii(text)]; + +// [["EchoRelay", {"data": , "hops": }]] +const relay = (data, hops) => + Uint8Array.from([0x91, 0x92, ...str('EchoRelay'), 0x82, ...str('data'), 0xc4, data.length, ...data, ...str('hops'), hops]); + +// ["EchoRelayResponse", {"data": }] -> the data +function relayed(response) { + const header = [0x92, ...str('EchoRelayResponse'), 0x81, ...str('data'), 0xc4]; + equal(Array.from(response.subarray(0, header.length)), header, 'a Relay response'); + return Array.from(response.subarray(header.length + 1, header.length + 1 + response[header.length])); +} + +const library = 'libecho_wire_compat.so'; + +test('relays nest on one asynchronous instance over JSI', async () => { + let waiting = 0; + let mostWaiting = 0; + const backend = createJsiFfiBackend({ + ffiName: 'echo', + library, + hostCall: { + peer: async request => { + mostWaiting = Math.max(mostWaiting, ++waiting); + try { + return await backend.call(request); + } finally { + waiting--; + } + }, + }, + }); + equal(relayed(await backend.call(relay([9], 5))), [9, 5, 4, 3, 2, 1], 'five hops'); + equal(mostWaiting, 5, 'every hop waits on the next, on the one instance'); + const [a, b] = await Promise.all([backend.call(relay([1], 3)), backend.call(relay([2], 2))]); + equal([relayed(a), relayed(b)], [[1, 3, 2, 1], [2, 2, 1]], 'two relays at once'); + await backend.destroy(); +}); + +test('a relay with no peer fails with the host message', async () => { + const backend = createJsiFfiBackend({ ffiName: 'echo', library }); + const response = await backend.call(relay([1], 1)); + equal(response[1], 0xb1, 'an EchoErrorResponse'); + const text = String.fromCharCode(...response); + if (!text.includes('no host-call target "peer"')) throw new Error(`unexpected error: ${text}`); + await backend.destroy(); + await rejects(() => backend.call(relay([1], 0)), /after destroy/, 'a destroyed backend'); +}); + +run(); diff --git a/native-packages/react-native/test/harness.js b/native-packages/react-native/test/harness.js new file mode 100644 index 00000000000..9b8b08b5b20 --- /dev/null +++ b/native-packages/react-native/test/harness.js @@ -0,0 +1,58 @@ +// A minimal test runner for test/hermes_host.cpp, which has print() and exit() but no test framework. +const tests = []; + +export function test(name, fn) { + tests.push([name, fn]); +} + +export function equal(actual, expected, what) { + const a = JSON.stringify(plain(actual)); + const e = JSON.stringify(plain(expected)); + if (a !== e) throw new Error(`${what}: expected ${clip(e)}, got ${clip(a)}`); +} + +export function assert(condition, what) { + if (!condition) throw new Error(what); +} + +export async function rejects(fn, pattern, what) { + let message; + try { + await fn(); + } catch (e) { + message = e.message; + } + if (message === undefined) throw new Error(`${what}: did not throw`); + if (!pattern.test(message)) throw new Error(`${what}: threw ${message}`); +} + +// Typed arrays (Buffers among them, whose toJSON JSON.stringify would call), Maps and Sets as arrays. +function plain(value) { + if (value instanceof Map) return [...value.entries()].map(plain); + if (value instanceof Set) return [...value].map(plain); + if (ArrayBuffer.isView(value)) return Array.from(value); + if (Array.isArray(value)) return value.map(plain); + if (value !== null && typeof value === 'object') { + return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, plain(v)])); + } + return value; +} + +const clip = text => (text.length > 200 ? `${text.slice(0, 200)}...` : text); + +export function run() { + (async () => { + let failed = 0; + for (const [name, fn] of tests) { + try { + await fn(); + print('ok ', name); + } catch (e) { + failed++; + print('FAIL', name, e.message, e.stack); + } + } + print(`${tests.length - failed}/${tests.length} passed`); + exit(failed ? 1 : 0); + })(); +} diff --git a/native-packages/react-native/test/hermes_host.cpp b/native-packages/react-native/test/hermes_host.cpp new file mode 100644 index 00000000000..0783bdd2e9a --- /dev/null +++ b/native-packages/react-native/test/hermes_host.cpp @@ -0,0 +1,374 @@ +/** + * @file hermes_host.cpp + * @brief A minimal React Native stand-in for testing off-device: Hermes, an event loop (tasks posted from any + * thread, timers, microtasks), print(), readFile(), and what @aztec-foundation/react-native installs into an app + * (aztec::react_native::install), with the app's data directory at $AZTEC_RN_DATA_DIR. + * + * Usage: hermes_host [args...]. The script ends the process with exit(code). + */ +#include "../cpp/aztec_react_native.hpp" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace jsi = facebook::jsi; + +namespace { + +class EventLoop { + public: + using Task = std::function; + + void post(Task task) + { + { + std::lock_guard lock(mutex_); + tasks_.push_back(std::move(task)); + } + ready_.notify_one(); + } + + /** Adds a timer; returns its id. */ + double add_timer(std::shared_ptr fn, double delay_ms) + { + auto id = next_timer_++; + timers_.emplace(std::chrono::steady_clock::now() + std::chrono::microseconds(int64_t(delay_ms * 1000)), + std::make_pair(id, std::move(fn))); + return double(id); + } + + void clear_timer(double id) + { + for (auto it = timers_.begin(); it != timers_.end(); ++it) { + if (double(it->second.first) == id) { + timers_.erase(it); + return; + } + } + } + + /** Runs until exit() is called; returns its code. */ + int run(jsi::Runtime& rt) + { + auto deadline = std::chrono::steady_clock::now() + std::chrono::minutes(30); + while (!exit_code_) { + rt.drainMicrotasks(); + if (exit_code_) { + break; + } + std::optional task; + { + std::unique_lock lock(mutex_); + auto wake = timers_.empty() ? deadline : std::min(deadline, timers_.begin()->first); + ready_.wait_until(lock, wake, [this] { return !tasks_.empty(); }); + if (!tasks_.empty()) { + task = std::move(tasks_.front()); + tasks_.pop_front(); + } + } + if (task) { + (*task)(rt); + continue; + } + auto now = std::chrono::steady_clock::now(); + if (!timers_.empty() && timers_.begin()->first <= now) { + auto fn = timers_.begin()->second.second; + timers_.erase(timers_.begin()); + fn->call(rt); + continue; + } + if (now >= deadline) { + std::cerr << "hermes_host: timed out\n"; + return 124; + } + } + return *exit_code_; + } + + void exit(int code) { exit_code_ = code; } + + private: + std::mutex mutex_; + std::condition_variable ready_; + std::deque tasks_; + std::multimap>> timers_; + uint64_t next_timer_ = 1; + std::optional exit_code_; +}; + +class FileBuffer final : public jsi::MutableBuffer { + public: + explicit FileBuffer(std::string bytes) + : bytes_(std::move(bytes)) + {} + size_t size() const override { return bytes_.size(); } + uint8_t* data() override { return reinterpret_cast(bytes_.data()); } + + private: + std::string bytes_; +}; + +struct HttpResponse { + int status = 0; + std::string headers; + std::string body; + std::string error; +}; + +/** A plain-HTTP/1.1 request (the test host's stand-in for React Native's networking; no TLS). */ +HttpResponse http_request(const std::string& method, + const std::string& url, + const std::vector>& headers, + const std::string& body) +{ + HttpResponse response; + const std::string scheme = "http://"; + if (url.rfind(scheme, 0) != 0) { + response.error = "only http:// URLs are supported by the test host: " + url; + return response; + } + auto rest = url.substr(scheme.size()); + auto slash = rest.find('/'); + auto authority = rest.substr(0, slash); + auto path = slash == std::string::npos ? "/" : rest.substr(slash); + auto colon = authority.rfind(':'); + auto host = colon == std::string::npos ? authority : authority.substr(0, colon); + auto port = colon == std::string::npos ? "80" : authority.substr(colon + 1); + + addrinfo hints{}; + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + addrinfo* addresses = nullptr; + if (getaddrinfo(host.c_str(), port.c_str(), &hints, &addresses) != 0) { + response.error = "cannot resolve " + host; + return response; + } + int fd = -1; + for (auto* a = addresses; a != nullptr; a = a->ai_next) { + fd = ::socket(a->ai_family, a->ai_socktype, a->ai_protocol); + if (fd >= 0 && ::connect(fd, a->ai_addr, a->ai_addrlen) == 0) { + break; + } + if (fd >= 0) { + ::close(fd); + fd = -1; + } + } + freeaddrinfo(addresses); + if (fd < 0) { + response.error = "cannot connect to " + authority; + return response; + } + std::string request = method + " " + path + " HTTP/1.1\r\nHost: " + authority + "\r\nConnection: close\r\n"; + for (const auto& [name, value] : headers) { + request += name + ": " + value + "\r\n"; + } + request += "Content-Length: " + std::to_string(body.size()) + "\r\n\r\n" + body; + for (size_t sent = 0; sent < request.size();) { + auto n = ::send(fd, request.data() + sent, request.size() - sent, MSG_NOSIGNAL); + if (n <= 0) { + ::close(fd); + response.error = "send failed"; + return response; + } + sent += size_t(n); + } + std::string raw; + char chunk[65536]; + for (ssize_t n = 0; (n = ::recv(fd, chunk, sizeof(chunk), 0)) > 0;) { + raw.append(chunk, size_t(n)); + } + ::close(fd); + auto header_end = raw.find("\r\n\r\n"); + if (header_end == std::string::npos || raw.size() < 12) { + response.error = "malformed HTTP response"; + return response; + } + response.status = std::atoi(raw.c_str() + 9); + auto first_line_end = raw.find("\r\n"); + response.headers = raw.substr(first_line_end + 2, header_end - first_line_end - 2); + auto payload = raw.substr(header_end + 4); + std::string lower = response.headers; + for (auto& c : lower) { + c = char(std::tolower(static_cast(c))); + } + if (lower.find("transfer-encoding: chunked") != std::string::npos) { + std::string decoded; + size_t pos = 0; + while (pos < payload.size()) { + auto line_end = payload.find("\r\n", pos); + if (line_end == std::string::npos) { + break; + } + auto size = std::stoul(payload.substr(pos, line_end - pos), nullptr, 16); + if (size == 0) { + break; + } + decoded.append(payload, line_end + 2, size); + pos = line_end + 2 + size + 2; + } + payload = std::move(decoded); + } + response.body = std::move(payload); + return response; +} + +void define(jsi::Runtime& rt, + const char* name, + unsigned params, + std::function fn) +{ + rt.global().setProperty( + rt, + name, + jsi::Function::createFromHostFunction( + rt, + jsi::PropNameID::forAscii(rt, name), + params, + [fn = std::move(fn)](jsi::Runtime& rt, const jsi::Value&, const jsi::Value* args, size_t count) { + return fn(rt, args, count); + })); +} + +} // namespace + +int main(int argc, char** argv) +{ + if (argc < 2) { + std::cerr << "usage: jsi_host [args...]\n"; + return 2; + } + std::ifstream file(argv[1]); + if (!file) { + std::cerr << "hermes_host: cannot read " << argv[1] << "\n"; + return 2; + } + std::stringstream source; + source << file.rdbuf(); + + auto runtime = + facebook::hermes::makeHermesRuntime(::hermes::vm::RuntimeConfig::Builder().withMicrotaskQueue(true).build()); + jsi::Runtime& rt = *runtime; + // Never destroyed: a service thread still working when the script exits (a test that failed with calls in + // flight) posts its result here after main returns. + EventLoop& loop = *new EventLoop; + + define(rt, "print", 1, [](jsi::Runtime& rt, const jsi::Value* args, size_t count) { + std::string line; + for (size_t i = 0; i < count; i++) { + line += (i ? " " : "") + args[i].toString(rt).utf8(rt); + } + std::cout << line << std::endl; + return jsi::Value::undefined(); + }); + define(rt, "exit", 1, [&loop](jsi::Runtime&, const jsi::Value* args, size_t count) { + loop.exit(count > 0 && args[0].isNumber() ? int(args[0].getNumber()) : 0); + return jsi::Value::undefined(); + }); + define(rt, "setTimeout", 2, [&loop](jsi::Runtime& rt, const jsi::Value* args, size_t count) { + auto fn = std::make_shared(args[0].getObject(rt).getFunction(rt)); + return jsi::Value(loop.add_timer(fn, count > 1 && args[1].isNumber() ? args[1].getNumber() : 0)); + }); + define(rt, "clearTimeout", 1, [&loop](jsi::Runtime&, const jsi::Value* args, size_t count) { + if (count > 0 && args[0].isNumber()) { + loop.clear_timer(args[0].getNumber()); + } + return jsi::Value::undefined(); + }); + define(rt, "readFile", 1, [](jsi::Runtime& rt, const jsi::Value* args, size_t count) { + auto path = count > 0 ? args[0].toString(rt).utf8(rt) : std::string(); + std::ifstream in(path, std::ios::binary); + if (!in) { + throw jsi::JSError(rt, "readFile: cannot read " + path); + } + std::stringstream bytes; + bytes << in.rdbuf(); + jsi::ArrayBuffer buffer(rt, std::make_shared(bytes.str())); + return rt.global().getPropertyAsFunction(rt, "Uint8Array").callAsConstructor(rt, buffer); + }); + // httpRequest(method, url, [[name, value]...], body: string, callback(status, headers, body: Uint8Array, error)) + define(rt, "httpRequest", 5, [&loop](jsi::Runtime& rt, const jsi::Value* args, size_t count) { + if (count < 5) { + throw jsi::JSError(rt, "httpRequest(method, url, headers, body, callback)"); + } + auto method = args[0].getString(rt).utf8(rt); + auto url = args[1].getString(rt).utf8(rt); + std::vector> headers; + auto list = args[2].getObject(rt).getArray(rt); + for (size_t i = 0; i < list.size(rt); i++) { + auto pair = list.getValueAtIndex(rt, i).getObject(rt).getArray(rt); + headers.emplace_back(pair.getValueAtIndex(rt, 0).getString(rt).utf8(rt), + pair.getValueAtIndex(rt, 1).getString(rt).utf8(rt)); + } + auto body = args[3].isString() ? args[3].getString(rt).utf8(rt) : std::string(); + auto callback = std::make_shared(args[4].getObject(rt).getFunction(rt)); + std::thread([&loop, method, url, headers, body, callback] { + auto response = std::make_shared(http_request(method, url, headers, body)); + loop.post([response, callback](jsi::Runtime& rt) { + jsi::ArrayBuffer buffer(rt, std::make_shared(std::move(response->body))); + auto bytes = rt.global().getPropertyAsFunction(rt, "Uint8Array").callAsConstructor(rt, buffer); + callback->call(rt, + jsi::Value(response->status), + jsi::String::createFromUtf8(rt, response->headers), + bytes, + response->error.empty() ? jsi::Value::undefined() + : jsi::Value(jsi::String::createFromUtf8(rt, response->error))); + }); + }).detach(); + return jsi::Value::undefined(); + }); + jsi::Array script_args(rt, size_t(argc - 2)); + for (int i = 2; i < argc; i++) { + script_args.setValueAtIndex(rt, size_t(i - 2), jsi::String::createFromUtf8(rt, argv[i])); + } + rt.global().setProperty(rt, "scriptArgs", script_args); + + const char* data_dir = std::getenv("AZTEC_RN_DATA_DIR"); + aztec::react_native::install( + rt, + [&loop](std::function task) { loop.post(std::move(task)); }, + data_dir != nullptr ? data_dir : "/tmp/aztec-rn-data"); + + // HERMES_PROFILE=: sample the JavaScript thread and write the samples there (a Chrome trace) at exit. + const char* profile = std::getenv("HERMES_PROFILE"); + auto* hermes_api = jsi::castInterface(facebook::hermes::makeHermesRootAPI()); + if (profile != nullptr) { + hermes_api->enableSamplingProfiler(1000); + } + auto finish_profile = [&] { + if (profile != nullptr) { + hermes_api->disableSamplingProfiler(); + hermes_api->dumpSampledTraceToFile(profile); + } + }; + try { + rt.evaluateJavaScript(std::make_shared(source.str()), argv[1]); + int code = loop.run(rt); + finish_profile(); + return code; + } catch (const jsi::JSError& e) { + std::cerr << "hermes_host: uncaught " << e.getMessage() << "\n" << e.getStack() << "\n"; + return 1; + } +} diff --git a/native-packages/react-native/test/native.test.js b/native-packages/react-native/test/native.test.js new file mode 100644 index 00000000000..ca92593bbf2 --- /dev/null +++ b/native-packages/react-native/test/native.test.js @@ -0,0 +1,187 @@ +// The package's native module and polyfills under Hermes: what `import '@aztec-foundation/react-native'` gives an +// app, minus the TurboModule (the host installs the module itself). +import '../js/index.js'; + +import { KvService, KvServiceSync } from '@aztec-labs/kv-sqlite'; + +import { assert, equal, rejects, run, test } from './harness.js'; + +const { Buffer } = require('buffer'); +const native = globalThis.__aztecReactNative; +const hex = bytes => Array.from(bytes, b => b.toString(16).padStart(2, '0')).join(''); +const utf8 = text => new TextEncoder().encode(text); + +test('sha256 matches FIPS 180-4 vectors', () => { + equal(hex(native.sha256('')), 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'empty'); + equal(hex(native.sha256('abc')), 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad', 'abc'); + equal( + hex(native.sha256(utf8('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'))), + '248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1', + 'two blocks', + ); + equal( + hex(native.sha256(new Uint8Array(1000000).fill(0x61))), + 'cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0', + 'a million a', + ); + equal(hex(native.sha256('héllo')), hex(native.sha256(utf8('héllo'))), 'a string hashes as its UTF-8'); +}); + +test('base64 round-trips like Node', () => { + equal(native.base64Encode(utf8('')), '', 'empty'); + equal(native.base64Encode(utf8('f')), 'Zg==', 'one byte'); + equal(native.base64Encode(utf8('fo')), 'Zm8=', 'two bytes'); + equal(native.base64Encode(utf8('foobar')), 'Zm9vYmFy', 'six bytes'); + equal(native.base64Decode('Zm9vYg=='), utf8('foob'), 'padded'); + equal(native.base64Decode('Zm9v\nYmFy'), utf8('foobar'), 'whitespace skipped'); + equal(native.base64Decode('-_-_'), native.base64Decode('+/+/'), 'URL alphabet'); +}); + +test('UTF-8 decoding replaces invalid sequences, or throws when fatal', () => { + equal(native.decodeUtf8(utf8('héllo €𝄞')), 'héllo €𝄞', 'valid'); + equal(native.decodeUtf8(new Uint8Array([0x61, 0xff, 0x62])), 'a\ufffdb', 'invalid byte'); + equal(native.decodeUtf8(new Uint8Array([0xe2, 0x82])), '\ufffd', 'truncated'); + equal(native.decodeUtf8(new Uint8Array([0xed, 0xa0, 0x80])), '\ufffd\ufffd\ufffd', 'surrogate'); + equal(native.decodeUtf8(new Uint8Array([0xf0, 0x9f, 0x98, 0x61])), '\ufffda', 'truncated four-byte sequence'); + equal(native.decodeUtf8(new Uint8Array([0xc0, 0xaf])), '\ufffd\ufffd', 'overlong'); + equal(new TextDecoder().decode(new Uint8Array([0xef, 0xbb, 0xbf, 0x61])), 'a', 'BOM'); + let threw = false; + try { + new TextDecoder('utf-8', { fatal: true }).decode(new Uint8Array([0xff])); + } catch (e) { + threw = e instanceof TypeError; + } + assert(threw, 'a fatal decoder throws a TypeError'); +}); + +test("Buffer's string conversions agree with the buffer package's own", () => { + const text = 'héllo €𝄞 '.repeat(50); + const bytes = Buffer.from(text); + assert(bytes instanceof Buffer, 'from(string) is a Buffer'); + equal(bytes, utf8(text), 'utf8 bytes'); + equal(Buffer.byteLength(text), bytes.length, 'byteLength'); + equal(bytes.toString(), text, 'toString'); + equal(bytes.toString('utf8', 1, 7), new TextDecoder().decode(bytes.subarray(1, 7)), 'toString range'); + const b64 = bytes.toString('base64'); + equal(Buffer.from(b64, 'base64'), bytes, 'base64 round trip'); + equal(Buffer.from('00ff10', 'hex'), [0, 255, 16], 'other encodings untouched'); + equal(Buffer.from([1, 2, 3]).toString('hex'), '010203', 'hex toString'); +}); + +test('subarray is a view, and a Buffer of a Buffer', () => { + const buf = Buffer.from([1, 2, 3, 4, 5]); + const sub = buf.subarray(1, -1); + assert(sub instanceof Buffer, 'Buffer'); + equal(sub, [2, 3, 4], 'contents'); + sub[0] = 9; + equal(buf[1], 9, 'shares memory'); + equal(buf.subarray(-2), [4, 5], 'negative start'); + equal(buf.subarray(3, 1).length, 0, 'empty'); + equal(new Uint32Array([1, 2, 3]).subarray(1), [2, 3], 'other typed arrays'); + assert(new Uint16Array(4).subarray(2) instanceof Uint16Array, 'keeps the type'); +}); + +test('structuredClone, the Set methods and the other built-ins Hermes lacks', () => { + const date = new Date(5); + const cyclic = { a: [1, { b: new Map([[1, new Set([2])]]) }], d: date, u: new Uint8Array([7]) }; + cyclic.self = cyclic; + const clone = structuredClone(cyclic); + assert(clone !== cyclic && clone.self === clone, 'cycles'); + equal(clone.a[1].b.get(1), new Set([2]), 'Map and Set'); + assert(clone.d instanceof Date && clone.d.getTime() === 5, 'Date'); + assert(clone.u instanceof Uint8Array && clone.u[0] === 7, 'typed array'); + equal(new Set([1, 2, 3]).intersection(new Set([2, 3, 4])), new Set([2, 3]), 'intersection'); + equal(new Set([1]).union(new Set([2])), new Set([1, 2]), 'union'); + assert(new Set([1]).isSubsetOf(new Set([1, 2])), 'isSubsetOf'); + const { promise, resolve } = Promise.withResolvers(); + resolve(1); + assert(promise instanceof Promise, 'withResolvers'); + equal(Object.groupBy([1, 2, 3], n => (n % 2 ? 'odd' : 'even')), { odd: [1, 3], even: [2] }, 'groupBy'); + equal([3, 1, 2].toSorted(), [1, 2, 3], 'toSorted'); +}); + +test('getRandomValues fills from the OS', () => { + const a = crypto.getRandomValues(new Uint8Array(64)); + const b = crypto.getRandomValues(new Uint8Array(64)); + assert(hex(a) !== hex(b), 'differs'); + let threw = false; + try { + crypto.getRandomValues(new Uint8Array(65537)); + } catch { + threw = true; + } + assert(threw, 'more than 65536 bytes'); +}); + +test("files in the app's data directory", () => { + const dir = `${native.dataDir}/files-test`; + native.removeDirectory(dir); + equal(native.fileSize(`${dir}/a/b.bin`), -1, 'missing file'); + native.writeFile(`${dir}/a/b.bin`, new Uint8Array([1, 2, 3, 4])); + equal(native.fileSize(`${dir}/a/b.bin`), 4, 'size'); + equal(native.readFile(`${dir}/a/b.bin`), [1, 2, 3, 4], 'read'); + equal(native.readFile(`${dir}/a/b.bin`, 2), [1, 2], 'read a prefix'); + assert(native.isDirectory(`${dir}/a`), 'made the directory'); + equal(native.listDirectory(dir), ['a'], 'list'); + native.removeFile(`${dir}/a/b.bin`); + equal(native.listDirectory(`${dir}/a`), [], 'removed'); + native.removeDirectory(dir); + assert(!native.isDirectory(dir), 'removed the directory'); +}); + +// kv-sqlite, compiled into the module, through its generated client: the package's React Native entry reaches the +// library over JSI. +const key = (fill) => new Uint8Array(32).fill(fill); + +test('kv-sqlite stores encrypted with ChaCha20 under the key', async () => { + const path = `${native.dataDir}/kv-sqlite-test/store.sqlite`; + const store = await KvService.create(); + await store.init({ path, encryptionKey: key(7) }); + await store.put({ container: 'map:m', key: utf8('k'), value: utf8('xyz') }); + await store.append({ container: 'multimap:mm', key: utf8('k'), values: [utf8('a'), utf8('b'), utf8('a')], unique: true }); + equal((await store.get({ container: 'map:m', keys: [utf8('k'), utf8('absent')] })).values, [{ value: utf8('xyz') }, { value: null }], 'get'); + equal((await store.values({ container: 'multimap:mm', key: utf8('k') })).values, [utf8('a'), utf8('b')], 'deduplicated'); + const { bytes } = await store.export({}); + assert(String.fromCharCode(...bytes.subarray(0, 15)) !== 'SQLite format 3', 'the file is encrypted'); + await store.destroy(); + + const wrongKey = await KvService.create(); + await rejects(() => wrongKey.init({ path, encryptionKey: key(8) }), /not a database/, 'wrong key'); + await wrongKey.destroy(); + + const reopened = await KvService.create(); + await reopened.init({ path, encryptionKey: key(7) }); + equal((await reopened.count({ container: 'map:m', key: null })).count, 1, 'reopened'); + await reopened.deleteStore({}); + await reopened.destroy(); + equal(native.fileSize(path), -1, 'deleted'); +}); + +test('kv-sqlite instances run concurrently, each on its own thread', async () => { + const stores = await Promise.all([1, 2, 3].map(() => KvService.create())); + await Promise.all(stores.map(store => store.init({ path: null, encryptionKey: null }))); + await Promise.all( + stores.map((store, n) => + store.putMany({ + container: 'map:m', + entries: Array.from({ length: 2000 }, (_, i) => ({ key: utf8(`${n}:${i}`), value: utf8(String(i)) })), + }), + ), + ); + equal( + await Promise.all(stores.map(async store => (await store.count({ container: 'map:m', key: null })).count)), + [2000, 2000, 2000], + 'counts', + ); + await Promise.all(stores.map(store => store.destroy())); +}); + +test('kv-sqlite answers on the JavaScript thread too', async () => { + const store = await KvServiceSync.create(); + store.init({ path: null, encryptionKey: null }); + store.put({ container: 'map:m', key: utf8('k'), value: utf8('v') }); + equal(store.get({ container: 'map:m', keys: [utf8('k')] }).values, [{ value: utf8('v') }], 'get'); + store.destroy(); +}); + +run(); diff --git a/native-packages/react-native/test/noir.test.js b/native-packages/react-native/test/noir.test.js new file mode 100644 index 00000000000..cf918f272fc --- /dev/null +++ b/native-packages/react-native/test/noir.test.js @@ -0,0 +1,188 @@ +// acvm_js and noirc_abi as an app has them (js/noir, which withAztec resolves those packages to), over the ACVM +// service's native library: acvm_js's and noirc_abi_wasm's own fixtures give the witnesses and values their wasm +// builds do. +import '../js/index.js'; + +import * as acvm from '../js/noir/acvm_js.js'; +import * as abi from '../js/noir/noirc_abi.js'; +import * as addition from '../../../noir/noir-repo/acvm-repo/acvm_js/test/shared/addition'; +import * as complexForeignCall from '../../../noir/noir-repo/acvm-repo/acvm_js/test/shared/complex_foreign_call'; +import * as foreignCall from '../../../noir/noir-repo/acvm-repo/acvm_js/test/shared/foreign_call'; +import * as memoryOp from '../../../noir/noir-repo/acvm-repo/acvm_js/test/shared/memory_op'; +import * as multiScalarMul from '../../../noir/noir-repo/acvm-repo/acvm_js/test/shared/multi_scalar_mul'; +import * as nested from '../../../noir/noir-repo/acvm-repo/acvm_js/test/shared/nested_acir_call'; +import * as compression from '../../../noir/noir-repo/acvm-repo/acvm_js/test/shared/witness_compression'; +import * as abiEncode from '../../../noir/noir-repo/tooling/noirc_abi_wasm/test/shared/abi_encode'; +import * as decodeError from '../../../noir/noir-repo/tooling/noirc_abi_wasm/test/shared/decode_error'; +import { assert, equal, rejects, run, test } from './harness.js'; + +const noOracle = () => { + throw Error('unexpected oracle'); +}; +const sorted = witness => new Map([...witness].sort(([a], [b]) => a - b)); + +test('executes a circuit', async () => { + const solved = await acvm.executeCircuit(addition.bytecode, addition.initialWitnessMap, noOracle); + equal(solved.get(addition.resultWitness), addition.expectedResult, 'result'); +}); + +test('answers a foreign call', async () => { + let seen; + const solved = await acvm.executeCircuit( + foreignCall.bytecode, + foreignCall.initialWitnessMap, + async (name, inputs) => { + seen = [name, inputs]; + return foreignCall.oracleResponse; + }, + ); + equal(seen, [foreignCall.oracleCallName, foreignCall.oracleCallInputs], 'oracle call'); + equal(sorted(solved), sorted(foreignCall.expectedWitnessMap), 'witness'); +}); + +test('answers a foreign call of arrays', async () => { + let seen; + const solved = await acvm.executeCircuit( + complexForeignCall.bytecode, + complexForeignCall.initialWitnessMap, + async (name, inputs) => { + seen = [name, inputs]; + return complexForeignCall.oracleResponse; + }, + ); + equal(seen, [complexForeignCall.oracleCallName, complexForeignCall.oracleCallInputs], 'oracle call'); + equal(sorted(solved), sorted(complexForeignCall.expectedWitnessMap), 'witness'); +}); + +test('runs black boxes and memory', async () => { + equal( + sorted(await acvm.executeCircuit(multiScalarMul.bytecode, multiScalarMul.initialWitnessMap, noOracle)), + sorted(multiScalarMul.expectedWitnessMap), + 'msm', + ); + equal( + sorted(await acvm.executeCircuit(memoryOp.bytecode, memoryOp.initialWitnessMap, noOracle)), + sorted(memoryOp.expectedWitnessMap), + 'memory', + ); +}); + +test('executions run in parallel, each with its own oracles', async () => { + const runs = [1, 2, 3].map(async n => { + const solved = await acvm.executeCircuit(foreignCall.bytecode, foreignCall.initialWitnessMap, async () => { + await new Promise(resolve => setTimeout(resolve, 10 * (4 - n))); + return foreignCall.oracleResponse; + }); + return sorted(solved); + }); + for (const solved of await Promise.all(runs)) { + equal(solved, sorted(foreignCall.expectedWitnessMap), 'witness'); + } +}); + +test('compresses witnesses and stacks as nargo does', () => { + equal(acvm.compressWitness(compression.expectedWitnessMap), compression.expectedCompressedWitnessMap, 'compressed'); + equal( + sorted(acvm.decompressWitness(compression.expectedCompressedWitnessMap)), + sorted(compression.expectedWitnessMap), + 'decompressed', + ); + equal( + abi.serializeWitness(compression.expectedWitnessMap), + compression.expectedCompressedWitnessMap, + 'serializeWitness', + ); + equal(acvm.compressWitnessStack(nested.expectedWitnessStack), nested.expectedCompressedWitnessStack, 'stack'); + equal( + acvm + .decompressWitnessStack(nested.expectedCompressedWitnessStack) + .map(({ index, witness }) => [index, sorted(witness)]), + nested.expectedWitnessStack.map(({ index, witness }) => [index, sorted(witness)]), + 'decompressed stack', + ); +}); + +test("a foreign call's error is the cause of the execution's", async () => { + const oracleError = new Error('oracle failed'); + let caught; + try { + await acvm.executeCircuit(foreignCall.bytecode, foreignCall.initialWitnessMap, async () => { + throw oracleError; + }); + } catch (e) { + caught = e; + } + equal(caught?.message, 'Error awaiting `foreign_call_handler`', 'message'); + assert(caught.cause === oracleError, 'the cause is the oracle error'); + await rejects( + () => + acvm.executeCircuit(foreignCall.bytecode, foreignCall.initialWitnessMap, () => { + throw oracleError; + }), + /Error calling `foreign_call_callback`/, + 'a handler that throws', + ); +}); + +test('reports an unsatisfied constraint as an ExecutionError', async () => { + let caught; + try { + await acvm.executeCircuit( + addition.bytecode, + new Map([ + [1, '0x01'], + [2, '0x01'], + [3, '0x05'], + ]), + noOracle, + ); + } catch (e) { + caught = e; + } + assert(caught, 'no error'); + equal(caught.acirFunctionId, 0, 'acirFunctionId'); + assert(Array.isArray(caught.callStack) && caught.callStack.length > 0, 'a call stack'); +}); + +test('encodes and decodes by an ABI', () => { + const witness = abi.abiEncode(abiEncode.abi, abiEncode.inputs); + const decoded = abi.abiDecode(abiEncode.abi, witness); + equal(BigInt(decoded.inputs.foo).toString(), abiEncode.inputs.foo, 'foo'); + equal( + decoded.inputs.bar.map(value => parseInt(value)), + abiEncode.inputs.bar.map(value => parseInt(value)), + 'bar', + ); + equal(decoded.return_value, null, 'return value'); +}); + +test('rejects a number JavaScript may have rounded', () => { + let message = ''; + try { + abi.abiEncode(abiEncode.abi, { foo: 2 ** 60, bar: ['1', '2', '3'] }); + } catch (e) { + message = e.message; + } + assert(/not a safe integer/.test(message), `unsafe integer accepted: ${message}`); +}); + +test('decodes assertion payloads by the error types', () => { + equal( + abi.abiDecodeError(decodeError.abi, { + selector: decodeError.FAKE_STRING_SELECTOR, + data: [], + }), + decodeError.SAMPLE_STRING, + 'a string', + ); + equal( + abi.abiDecodeError(decodeError.abi, { + selector: decodeError.FAKE_FIELD_SELECTOR, + data: ['0x01'], + }), + '0x01', + 'a field', + ); +}); + +run(); diff --git a/native-packages/react-native/yarn.lock b/native-packages/react-native/yarn.lock new file mode 100644 index 00000000000..bfc8499b5dc --- /dev/null +++ b/native-packages/react-native/yarn.lock @@ -0,0 +1,2727 @@ +# This file is generated by running "yarn install" inside your project. +# Manual changes might be lost - proceed with caution! + +__metadata: + version: 8 + cacheKey: 10c0 + +"@aztec-foundation/ipc-runtime@portal:../../ipc-runtime/ts::locator=%40aztec-foundation%2Freact-native%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@aztec-foundation/ipc-runtime@portal:../../ipc-runtime/ts::locator=%40aztec-foundation%2Freact-native%40workspace%3A." + languageName: node + linkType: soft + +"@aztec-foundation/react-native@workspace:.": + version: 0.0.0-use.local + resolution: "@aztec-foundation/react-native@workspace:." + dependencies: + "@aztec-foundation/ipc-runtime": "npm:0.1.0" + "@aztec-labs/acvm": "npm:0.1.0" + "@aztec-labs/acvm-oracle": "npm:0.1.0" + "@aztec-labs/kv-sqlite": "npm:0.1.0" + "@babel/cli": "npm:^7.29.0" + "@babel/core": "npm:^7.29.0" + "@babel/plugin-transform-export-namespace-from": "npm:^7.27.1" + "@react-native/babel-preset": "npm:0.88.1" + buffer: "npm:^6.0.3" + esbuild: "npm:^0.25.0" + events: "npm:^3.3.0" + hash.js: "npm:^1.1.7" + msgpackr: "npm:^1.11.2" + util: "npm:^0.12.5" + peerDependencies: + "@babel/core": ^7.0.0 + react-native: ">=0.76" + languageName: unknown + linkType: soft + +"@aztec-labs/acvm-darwin-arm64@portal:../acvm/ts/packages/acvm-darwin-arm64::locator=%40aztec-foundation%2Freact-native%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@aztec-labs/acvm-darwin-arm64@portal:../acvm/ts/packages/acvm-darwin-arm64::locator=%40aztec-foundation%2Freact-native%40workspace%3A." + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: soft + +"@aztec-labs/acvm-darwin-x64@portal:../acvm/ts/packages/acvm-darwin-x64::locator=%40aztec-foundation%2Freact-native%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@aztec-labs/acvm-darwin-x64@portal:../acvm/ts/packages/acvm-darwin-x64::locator=%40aztec-foundation%2Freact-native%40workspace%3A." + conditions: os=darwin & cpu=x64 + languageName: node + linkType: soft + +"@aztec-labs/acvm-linux-arm64@portal:../acvm/ts/packages/acvm-linux-arm64::locator=%40aztec-foundation%2Freact-native%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@aztec-labs/acvm-linux-arm64@portal:../acvm/ts/packages/acvm-linux-arm64::locator=%40aztec-foundation%2Freact-native%40workspace%3A." + conditions: os=linux & cpu=arm64 + languageName: node + linkType: soft + +"@aztec-labs/acvm-linux-x64@portal:../acvm/ts/packages/acvm-linux-x64::locator=%40aztec-foundation%2Freact-native%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@aztec-labs/acvm-linux-x64@portal:../acvm/ts/packages/acvm-linux-x64::locator=%40aztec-foundation%2Freact-native%40workspace%3A." + conditions: os=linux & cpu=x64 + languageName: node + linkType: soft + +"@aztec-labs/acvm-oracle@portal:../acvm/oracle::locator=%40aztec-foundation%2Freact-native%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@aztec-labs/acvm-oracle@portal:../acvm/oracle::locator=%40aztec-foundation%2Freact-native%40workspace%3A." + dependencies: + msgpackr: "npm:^1.11.2" + tslib: "npm:^2.4.0" + languageName: node + linkType: soft + +"@aztec-labs/acvm@portal:../acvm/ts::locator=%40aztec-foundation%2Freact-native%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@aztec-labs/acvm@portal:../acvm/ts::locator=%40aztec-foundation%2Freact-native%40workspace%3A." + dependencies: + "@aztec-foundation/ipc-runtime": "@aztec-foundation/ipc-runtime" + "@aztec-labs/acvm-darwin-arm64": "npm:0.1.0" + "@aztec-labs/acvm-darwin-x64": "npm:0.1.0" + "@aztec-labs/acvm-linux-arm64": "npm:0.1.0" + "@aztec-labs/acvm-linux-x64": "npm:0.1.0" + msgpackr: "npm:^1.11.2" + tslib: "npm:^2.4.0" + dependenciesMeta: + "@aztec-labs/acvm-darwin-arm64": + optional: true + "@aztec-labs/acvm-darwin-x64": + optional: true + "@aztec-labs/acvm-linux-arm64": + optional: true + "@aztec-labs/acvm-linux-x64": + optional: true + bin: + aztec-acvm: ./dest/bin.js + languageName: node + linkType: soft + +"@aztec-labs/kv-sqlite-darwin-arm64@portal:../kv-sqlite/ts/packages/kv-sqlite-darwin-arm64::locator=%40aztec-foundation%2Freact-native%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@aztec-labs/kv-sqlite-darwin-arm64@portal:../kv-sqlite/ts/packages/kv-sqlite-darwin-arm64::locator=%40aztec-foundation%2Freact-native%40workspace%3A." + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: soft + +"@aztec-labs/kv-sqlite-darwin-x64@portal:../kv-sqlite/ts/packages/kv-sqlite-darwin-x64::locator=%40aztec-foundation%2Freact-native%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@aztec-labs/kv-sqlite-darwin-x64@portal:../kv-sqlite/ts/packages/kv-sqlite-darwin-x64::locator=%40aztec-foundation%2Freact-native%40workspace%3A." + conditions: os=darwin & cpu=x64 + languageName: node + linkType: soft + +"@aztec-labs/kv-sqlite-linux-arm64@portal:../kv-sqlite/ts/packages/kv-sqlite-linux-arm64::locator=%40aztec-foundation%2Freact-native%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@aztec-labs/kv-sqlite-linux-arm64@portal:../kv-sqlite/ts/packages/kv-sqlite-linux-arm64::locator=%40aztec-foundation%2Freact-native%40workspace%3A." + conditions: os=linux & cpu=arm64 + languageName: node + linkType: soft + +"@aztec-labs/kv-sqlite-linux-x64@portal:../kv-sqlite/ts/packages/kv-sqlite-linux-x64::locator=%40aztec-foundation%2Freact-native%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@aztec-labs/kv-sqlite-linux-x64@portal:../kv-sqlite/ts/packages/kv-sqlite-linux-x64::locator=%40aztec-foundation%2Freact-native%40workspace%3A." + conditions: os=linux & cpu=x64 + languageName: node + linkType: soft + +"@aztec-labs/kv-sqlite@portal:../kv-sqlite/ts::locator=%40aztec-foundation%2Freact-native%40workspace%3A.": + version: 0.0.0-use.local + resolution: "@aztec-labs/kv-sqlite@portal:../kv-sqlite/ts::locator=%40aztec-foundation%2Freact-native%40workspace%3A." + dependencies: + "@aztec-foundation/ipc-runtime": "@aztec-foundation/ipc-runtime" + "@aztec-labs/kv-sqlite-darwin-arm64": "npm:0.1.0" + "@aztec-labs/kv-sqlite-darwin-x64": "npm:0.1.0" + "@aztec-labs/kv-sqlite-linux-arm64": "npm:0.1.0" + "@aztec-labs/kv-sqlite-linux-x64": "npm:0.1.0" + msgpackr: "npm:^1.11.2" + tslib: "npm:^2.4.0" + dependenciesMeta: + "@aztec-labs/kv-sqlite-darwin-arm64": + optional: true + "@aztec-labs/kv-sqlite-darwin-x64": + optional: true + "@aztec-labs/kv-sqlite-linux-arm64": + optional: true + "@aztec-labs/kv-sqlite-linux-x64": + optional: true + bin: + kv-sqlite: ./dest/bin.js + languageName: node + linkType: soft + +"@babel/cli@npm:^7.29.0": + version: 7.29.7 + resolution: "@babel/cli@npm:7.29.7" + dependencies: + "@jridgewell/trace-mapping": "npm:^0.3.28" + "@nicolo-ribaudo/chokidar-2": "npm:2.1.8-no-fsevents.3" + chokidar: "npm:^3.6.0" + commander: "npm:^6.2.0" + convert-source-map: "npm:^2.0.0" + fs-readdir-recursive: "npm:^1.1.0" + glob: "npm:^7.2.0" + make-dir: "npm:^2.1.0" + slash: "npm:^2.0.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + dependenciesMeta: + "@nicolo-ribaudo/chokidar-2": + optional: true + chokidar: + optional: true + bin: + babel: ./bin/babel.js + babel-external-helpers: ./bin/babel-external-helpers.js + checksum: 10c0/0f5bd4a8b2958a86ab74375bf51e3e9e6886f8637c59f21b881d6735c22c4cdd39f2582280bfa7342243f0c8de23d6429f2d43e2ecfa0aa150a875fec1a14fce + languageName: node + linkType: hard + +"@babel/code-frame@npm:^7.29.7": + version: 7.29.7 + resolution: "@babel/code-frame@npm:7.29.7" + dependencies: + "@babel/helper-validator-identifier": "npm:^7.29.7" + js-tokens: "npm:^4.0.0" + picocolors: "npm:^1.1.1" + checksum: 10c0/169fc2080169a40c1760155eaaaf739bcb882df0bec76a83adbda5493645bc17270a3434b8848c494b1933e96fe1d147370001e3cda09a39f43ae30f08ef2069 + languageName: node + linkType: hard + +"@babel/compat-data@npm:^7.28.6, @babel/compat-data@npm:^7.29.7": + version: 7.29.7 + resolution: "@babel/compat-data@npm:7.29.7" + checksum: 10c0/47913f05e08a45a1c9df38c02b4b49e391005085b489432647a1abe112e5d9c75e3be8ea5972b7f6da4ec5d1339922ceb9ea02b8a25d4ed1cb8636e5261f344e + languageName: node + linkType: hard + +"@babel/core@npm:^7.25.2, @babel/core@npm:^7.29.0": + version: 7.29.13 + resolution: "@babel/core@npm:7.29.13" + dependencies: + "@babel/code-frame": "npm:^7.29.7" + "@babel/generator": "npm:^7.29.13" + "@babel/helper-compilation-targets": "npm:^7.29.13" + "@babel/helper-module-transforms": "npm:^7.29.13" + "@babel/helpers": "npm:^7.29.13" + "@babel/parser": "npm:^7.29.13" + "@babel/template": "npm:^7.29.7" + "@babel/traverse": "npm:^7.29.13" + "@babel/types": "npm:^7.29.11" + "@jridgewell/remapping": "npm:^2.3.5" + convert-source-map: "npm:^2.0.0" + debug: "npm:^4.1.0" + gensync: "npm:^1.0.0-beta.2" + json5: "npm:^2.2.3" + semver: "npm:^6.3.1" + checksum: 10c0/7c9d372d63c0d30c35b78c70e373eeed9eee2c4b7cfe40f43daf5298f85e1cde8760c410a9a330148162911ae292acb17b5edddc33dd7b681e798949cec23ae1 + languageName: node + linkType: hard + +"@babel/generator@npm:^7.29.13, @babel/generator@npm:^7.29.14": + version: 7.29.14 + resolution: "@babel/generator@npm:7.29.14" + dependencies: + "@babel/parser": "npm:^7.29.14" + "@babel/types": "npm:^7.29.14" + "@jridgewell/gen-mapping": "npm:^0.3.12" + "@jridgewell/trace-mapping": "npm:^0.3.28" + jsesc: "npm:^3.0.2" + checksum: 10c0/39db746c47e0b80290b727e64025dd0ee9060f346271b5ca75ba07485df05f704a74358910bbe8e9f6e2a8fca62ac98f886640d2c84e7740af5fec42fbe0b71a + languageName: node + linkType: hard + +"@babel/helper-annotate-as-pure@npm:^7.29.7": + version: 7.29.7 + resolution: "@babel/helper-annotate-as-pure@npm:7.29.7" + dependencies: + "@babel/types": "npm:^7.29.7" + checksum: 10c0/c56536b52d17632d89d49db2063ed6102f0e3bbadf6a0ccb74e6599d6a77173b644c7fe8c3ef17c7a162709d55b75ee5145ef6db917d16ba7f375fbffcf2e942 + languageName: node + linkType: hard + +"@babel/helper-compilation-targets@npm:^7.28.6, @babel/helper-compilation-targets@npm:^7.29.13, @babel/helper-compilation-targets@npm:^7.29.7": + version: 7.29.13 + resolution: "@babel/helper-compilation-targets@npm:7.29.13" + dependencies: + "@babel/compat-data": "npm:^7.29.7" + "@babel/helper-validator-option": "npm:^7.29.7" + browserslist: "npm:^4.24.0" + lru-cache: "npm:^5.1.1" + semver: "npm:^6.3.1" + checksum: 10c0/e134fb9379f3375bd57c042bf26d9eb1cfae0bb89df498e8cd7e62ca7212a924e09c01be2b25040e7a2fbc9725cf81d692415c50afb568816e8ea4db554c94f7 + languageName: node + linkType: hard + +"@babel/helper-create-class-features-plugin@npm:^7.29.7": + version: 7.29.13 + resolution: "@babel/helper-create-class-features-plugin@npm:7.29.13" + dependencies: + "@babel/helper-annotate-as-pure": "npm:^7.29.7" + "@babel/helper-member-expression-to-functions": "npm:^7.29.7" + "@babel/helper-optimise-call-expression": "npm:^7.29.7" + "@babel/helper-replace-supers": "npm:^7.29.7" + "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.29.13" + "@babel/traverse": "npm:^7.29.13" + semver: "npm:^6.3.1" + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 10c0/c6d7ba6f3df266e04acbe44ec0626101d599d0928d64a9565fbbcab51d377e41f3a0bd3f3192dd529826af498d675c1d32e229382405ee8603171c8cd66cef8d + languageName: node + linkType: hard + +"@babel/helper-create-regexp-features-plugin@npm:^7.29.7": + version: 7.29.14 + resolution: "@babel/helper-create-regexp-features-plugin@npm:7.29.14" + dependencies: + "@babel/helper-annotate-as-pure": "npm:^7.29.7" + regexpu-core: "npm:^6.5.4" + semver: "npm:^6.3.1" + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 10c0/4c4e45ef06242032373c27e17559091047ba450135aaa0b9c2cd7a7c424016176da63c760c97615ceab01bc1dc6ce3265554355d587492b5c0f3d0f8ca6ce6df + languageName: node + linkType: hard + +"@babel/helper-define-polyfill-provider@npm:^0.6.5, @babel/helper-define-polyfill-provider@npm:^0.6.8": + version: 0.6.8 + resolution: "@babel/helper-define-polyfill-provider@npm:0.6.8" + dependencies: + "@babel/helper-compilation-targets": "npm:^7.28.6" + "@babel/helper-plugin-utils": "npm:^7.28.6" + debug: "npm:^4.4.3" + lodash.debounce: "npm:^4.0.8" + resolve: "npm:^1.22.11" + peerDependencies: + "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 + checksum: 10c0/306a169f2cb285f368578219ef18ea9702860d3d02d64334f8d45ea38648be0b9e1edad8c8f732fa34bb4206ccbb9883c395570fd57ab7bbcf293bc5964c5b3a + languageName: node + linkType: hard + +"@babel/helper-globals@npm:^7.29.7": + version: 7.29.7 + resolution: "@babel/helper-globals@npm:7.29.7" + checksum: 10c0/f38417c40b1129a1b2b519ca961b9040c8827d1444fd74068702286b91b77089431dc76b6b9d5c1496e5da2a4f3ad329c6946e688ba3fa0d1d0b3d2b4f34f36a + languageName: node + linkType: hard + +"@babel/helper-member-expression-to-functions@npm:^7.29.7": + version: 7.29.14 + resolution: "@babel/helper-member-expression-to-functions@npm:7.29.14" + dependencies: + "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.29.13" + "@babel/traverse": "npm:^7.29.14" + "@babel/types": "npm:^7.29.14" + checksum: 10c0/018027553cbfed8990d0479c7d3db44e0502674435b1efaa79d0c4ad431f31480904b76f991da2f0c76ea76984a34653532316dc18df5c38e917e37dac5faad6 + languageName: node + linkType: hard + +"@babel/helper-module-imports@npm:^7.29.7": + version: 7.29.7 + resolution: "@babel/helper-module-imports@npm:7.29.7" + dependencies: + "@babel/traverse": "npm:^7.29.7" + "@babel/types": "npm:^7.29.7" + checksum: 10c0/6adf60d97356027413342a092f818d9678c4f5caff716a33e3284b5ae14e47a9e88059d421dde4ee4894691260039a12602c0e7becadc175602194b40dfa345d + languageName: node + linkType: hard + +"@babel/helper-module-transforms@npm:^7.29.13, @babel/helper-module-transforms@npm:^7.29.14": + version: 7.29.14 + resolution: "@babel/helper-module-transforms@npm:7.29.14" + dependencies: + "@babel/helper-module-imports": "npm:^7.29.7" + "@babel/helper-validator-identifier": "npm:^7.29.7" + "@babel/traverse": "npm:^7.29.14" + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 10c0/5ca8b9c36d5b9656196c758df1dc10148086b232f3df43d932a66d84f46faf93da7096667903c1f652539759789dc1ef5fbff0569baeabb110dce27faa988250 + languageName: node + linkType: hard + +"@babel/helper-optimise-call-expression@npm:^7.29.7": + version: 7.29.7 + resolution: "@babel/helper-optimise-call-expression@npm:7.29.7" + dependencies: + "@babel/types": "npm:^7.29.7" + checksum: 10c0/fd0244b9bfbb487db02d59aa2703c6991d654ea5f3f39d912682842bdca2e87b5ae8643b0ce8069bf5fbee39d1aa9db7abefeb5e6ba1aa650dca12777cf5b7e2 + languageName: node + linkType: hard + +"@babel/helper-plugin-utils@npm:^7.28.6, @babel/helper-plugin-utils@npm:^7.29.7, @babel/helper-plugin-utils@npm:^7.8.0": + version: 7.29.7 + resolution: "@babel/helper-plugin-utils@npm:7.29.7" + checksum: 10c0/380477a06133274a2759f9355929cb60a95e8b8fee624a1ae1fa349e1d1645b89daca456f72833f6d1062bffa12ee4271c5bf0cc5a61c0166cdc24c7591e2408 + languageName: node + linkType: hard + +"@babel/helper-remap-async-to-generator@npm:^7.29.7": + version: 7.29.7 + resolution: "@babel/helper-remap-async-to-generator@npm:7.29.7" + dependencies: + "@babel/helper-annotate-as-pure": "npm:^7.29.7" + "@babel/helper-wrap-function": "npm:^7.29.7" + "@babel/traverse": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 10c0/d71a4f2c7e4523568b1fbeb4d85823bda7ebcd48263b2862ee8194b0a647b612e70d6a64472e0842fc7e557a16e9fa5d3c032af5c1308a342e2a3b49a87d4833 + languageName: node + linkType: hard + +"@babel/helper-replace-supers@npm:^7.29.7": + version: 7.29.7 + resolution: "@babel/helper-replace-supers@npm:7.29.7" + dependencies: + "@babel/helper-member-expression-to-functions": "npm:^7.29.7" + "@babel/helper-optimise-call-expression": "npm:^7.29.7" + "@babel/traverse": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 10c0/1c7ae37797f226e965ab85f6affa53d25a10c169c604a4daeb36f9df09e673471e6522f631c13761cf9fbafeca2ea14c241dea8d723a51039d561beb01d86ac4 + languageName: node + linkType: hard + +"@babel/helper-skip-transparent-expression-wrappers@npm:^7.29.13, @babel/helper-skip-transparent-expression-wrappers@npm:^7.29.7": + version: 7.29.13 + resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.29.13" + dependencies: + "@babel/traverse": "npm:^7.29.13" + "@babel/types": "npm:^7.29.11" + checksum: 10c0/7ee6a71df0e921666b308e0c9ffa9b36961df8b7164f46d241885478b24195e506e4d9a0aff9bcd76c09eb27628a7f87af73f04b953b66714ec288d578047b7d + languageName: node + linkType: hard + +"@babel/helper-string-parser@npm:^7.29.14": + version: 7.29.14 + resolution: "@babel/helper-string-parser@npm:7.29.14" + checksum: 10c0/7e296ef8457872da9f9306ef29a67470505bca7f21728ff4fede08746eac2bb122a3a3be39135d337a9c56985bae24e4c2dd8f13896afe64a32e9251363ed7bd + languageName: node + linkType: hard + +"@babel/helper-validator-identifier@npm:^7.29.7": + version: 7.29.7 + resolution: "@babel/helper-validator-identifier@npm:7.29.7" + checksum: 10c0/4795354e7ae0dcafa72de1cd04ec51252dc1498517170beaf019e03effc5b7bf13c6b21a3949a77e07b8125be7f106ed1131350d8ebd4566ae874094a726d62b + languageName: node + linkType: hard + +"@babel/helper-validator-option@npm:^7.29.7": + version: 7.29.7 + resolution: "@babel/helper-validator-option@npm:7.29.7" + checksum: 10c0/d2a06c6d0ac40ba4a2f219fc2cab249c7a94bacdb2686273b7f9598571c908809b48468ff588915a346e6cc7296f60b581023d1d498b747fed06f779d335c2cc + languageName: node + linkType: hard + +"@babel/helper-wrap-function@npm:^7.29.7": + version: 7.29.14 + resolution: "@babel/helper-wrap-function@npm:7.29.14" + dependencies: + "@babel/template": "npm:^7.29.7" + "@babel/traverse": "npm:^7.29.14" + "@babel/types": "npm:^7.29.14" + checksum: 10c0/ff7ee5e0f19a1497d8fcfb8103a4bd2d1951f22adf5e80c4e3efe9594276569aec670f4e6a605e30e459cde707e3fb523095c0ecfd9220c54ec971387424ac4a + languageName: node + linkType: hard + +"@babel/helpers@npm:^7.29.13": + version: 7.29.14 + resolution: "@babel/helpers@npm:7.29.14" + dependencies: + "@babel/template": "npm:^7.29.7" + "@babel/types": "npm:^7.29.14" + checksum: 10c0/143ca284d6a0361f31a15ae3ba48088298a3c95e871925e92258e2b8480a07e753b7c97953d618b3526fefaecde85c3e72b8c1b00cfe48cf4b5bd8310c83bfde + languageName: node + linkType: hard + +"@babel/parser@npm:^7.29.0, @babel/parser@npm:^7.29.13, @babel/parser@npm:^7.29.14, @babel/parser@npm:^7.29.7": + version: 7.29.14 + resolution: "@babel/parser@npm:7.29.14" + dependencies: + "@babel/types": "npm:^7.29.14" + bin: + parser: ./bin/babel-parser.js + checksum: 10c0/5d76040cb386915a5086c864b5966a08bada9fa6074fa2b16cce42ed78ecae309003d3362fef88a96b9a40afc9761604502db93f7cea9db59af077d1ff2109f4 + languageName: node + linkType: hard + +"@babel/plugin-proposal-export-default-from@npm:^7.24.7": + version: 7.29.7 + resolution: "@babel/plugin-proposal-export-default-from@npm:7.29.7" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/4208f28549960372ec17422ff63fccde001fdaec322d1b5b602856088c883d8e7f22159737cd32a691a1d6153a269aa6228cd55d6a10693dfa584864138d8614 + languageName: node + linkType: hard + +"@babel/plugin-syntax-dynamic-import@npm:^7.8.3": + version: 7.8.3 + resolution: "@babel/plugin-syntax-dynamic-import@npm:7.8.3" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.8.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/9c50927bf71adf63f60c75370e2335879402648f468d0172bc912e303c6a3876927d8eb35807331b57f415392732ed05ab9b42c68ac30a936813ab549e0246c5 + languageName: node + linkType: hard + +"@babel/plugin-syntax-export-default-from@npm:^7.24.7": + version: 7.29.7 + resolution: "@babel/plugin-syntax-export-default-from@npm:7.29.7" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/932c0046ec3035851baa59b7b02493279f2810e8d26a4fb0ee8000334fdab6a4b035567184a7bb31db22f93a2775a01ecde31eaa4bd1b3e5cde85e2562d24b00 + languageName: node + linkType: hard + +"@babel/plugin-syntax-flow@npm:^7.12.1, @babel/plugin-syntax-flow@npm:^7.29.7": + version: 7.29.7 + resolution: "@babel/plugin-syntax-flow@npm:7.29.7" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/b2e330dd0dc535c7364937ce2b29a06065e60b1d523db75f36ab4fb89e4ba664e2230cbb1937b35712c9a0ebafc3358f323d6e6b22247d5ebad12fdd3e1f6e98 + languageName: node + linkType: hard + +"@babel/plugin-syntax-jsx@npm:^7.29.7": + version: 7.29.7 + resolution: "@babel/plugin-syntax-jsx@npm:7.29.7" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/1736000de183538ba8eef34520105508860e48b0c763254ba9158af5e814ed8bbceeedbb4281fbda33de787ae5b3870e92f60c6ae7131e7d322e451d57387896 + languageName: node + linkType: hard + +"@babel/plugin-syntax-nullish-coalescing-operator@npm:^7.8.3": + version: 7.8.3 + resolution: "@babel/plugin-syntax-nullish-coalescing-operator@npm:7.8.3" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.8.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/2024fbb1162899094cfc81152449b12bd0cc7053c6d4bda8ac2852545c87d0a851b1b72ed9560673cbf3ef6248257262c3c04aabf73117215c1b9cc7dd2542ce + languageName: node + linkType: hard + +"@babel/plugin-syntax-optional-chaining@npm:^7.8.3": + version: 7.8.3 + resolution: "@babel/plugin-syntax-optional-chaining@npm:7.8.3" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.8.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/46edddf2faa6ebf94147b8e8540dfc60a5ab718e2de4d01b2c0bdf250a4d642c2bd47cbcbb739febcb2bf75514dbcefad3c52208787994b8d0f8822490f55e81 + languageName: node + linkType: hard + +"@babel/plugin-syntax-typescript@npm:^7.29.7": + version: 7.29.7 + resolution: "@babel/plugin-syntax-typescript@npm:7.29.7" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/c49883b0327e8683b770dc823205af5c697da216e590dcf5bf53f3f031e7e381de450b164f8f99853f0837a3de5cb793298e2be6697a0f6e452bb9dd34b5165e + languageName: node + linkType: hard + +"@babel/plugin-transform-async-generator-functions@npm:^7.25.4": + version: 7.29.7 + resolution: "@babel/plugin-transform-async-generator-functions@npm:7.29.7" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + "@babel/helper-remap-async-to-generator": "npm:^7.29.7" + "@babel/traverse": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/efeeb26e8474d75b469b68fd7de74b757929b78aba5714ccb705a42f23d4e0de178ca09b59efd19113d42461bcf876dd9a919fd61f4e5e6fd1d1e5e7998e5bfe + languageName: node + linkType: hard + +"@babel/plugin-transform-async-to-generator@npm:^7.24.7": + version: 7.29.7 + resolution: "@babel/plugin-transform-async-to-generator@npm:7.29.7" + dependencies: + "@babel/helper-module-imports": "npm:^7.29.7" + "@babel/helper-plugin-utils": "npm:^7.29.7" + "@babel/helper-remap-async-to-generator": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/1aa514d28a2a87747f54e031cf6d2884a792a41c8bb9ebcf4d3d663284a4ae14e02c744ad76819ab09b96b6a0cdb60dd20e54c75f2eb9c3cc3fb255e0ef79e74 + languageName: node + linkType: hard + +"@babel/plugin-transform-block-scoping@npm:^7.25.0": + version: 7.29.13 + resolution: "@babel/plugin-transform-block-scoping@npm:7.29.13" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/7dc1f12be162ea66064b89131cc80428676a193e5ea07b2efd9d1968b953c202abe572d57e55163a13169ea94a97b0387e92ab750c0b1bb4ba11c6e3c8b6ee95 + languageName: node + linkType: hard + +"@babel/plugin-transform-class-properties@npm:^7.25.4": + version: 7.29.7 + resolution: "@babel/plugin-transform-class-properties@npm:7.29.7" + dependencies: + "@babel/helper-create-class-features-plugin": "npm:^7.29.7" + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/c370700423439aa9f0c1f8c4b97f2ef7c2dc46a1b04ec3b10e83e6bae5e4e2159f56d8e4376c9d669b3cf827650cc3740170a36e3924e3e9970d27fd85f4e48a + languageName: node + linkType: hard + +"@babel/plugin-transform-classes@npm:^7.25.4": + version: 7.29.11 + resolution: "@babel/plugin-transform-classes@npm:7.29.11" + dependencies: + "@babel/helper-annotate-as-pure": "npm:^7.29.7" + "@babel/helper-compilation-targets": "npm:^7.29.7" + "@babel/helper-globals": "npm:^7.29.7" + "@babel/helper-plugin-utils": "npm:^7.29.7" + "@babel/helper-replace-supers": "npm:^7.29.7" + "@babel/traverse": "npm:^7.29.10" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/213ad53649b213a263e1d31a8d6f9fc9f8d3c808dce74ff5d7fc90b31f3b36bef47bba5ecac5a23aee47ec2f17c1d019c75486ed68094461bdf0d3e1e9e7b06f + languageName: node + linkType: hard + +"@babel/plugin-transform-destructuring@npm:^7.24.8": + version: 7.29.13 + resolution: "@babel/plugin-transform-destructuring@npm:7.29.13" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + "@babel/traverse": "npm:^7.29.13" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/08b59243ebac1b5ba928f443a084ece3aeb2646ab939d899c3d90108b428a044bacc0ef983b4c6b20a7e04c3cff9bc9ac057d67ed31e26c1e22d60ba24418af6 + languageName: node + linkType: hard + +"@babel/plugin-transform-export-namespace-from@npm:^7.27.1": + version: 7.29.7 + resolution: "@babel/plugin-transform-export-namespace-from@npm:7.29.7" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/6cd951e366c5c30223c409157e312d949feecfae8b4b4927053764ec71ff2bacf43aceda9b53239cd90d71caf4ae849c70549e0d3e31377dd8f42a0c283bdda2 + languageName: node + linkType: hard + +"@babel/plugin-transform-flow-strip-types@npm:^7.25.2": + version: 7.29.7 + resolution: "@babel/plugin-transform-flow-strip-types@npm:7.29.7" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + "@babel/plugin-syntax-flow": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/083e864a60927cde7bd75822bdf5c6c72de200ee955e48f6ff5923f0d2b0744ab8f1b64c45e74b88ae3796f03721489afffdb0536f25c54d0dd58508a8904f40 + languageName: node + linkType: hard + +"@babel/plugin-transform-for-of@npm:^7.24.7": + version: 7.29.13 + resolution: "@babel/plugin-transform-for-of@npm:7.29.13" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.29.13" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/dd40a506add1d137b6a96fa7b39a1a75330a9c5c298c68d3d537e17f464c6bb12046554c4b461ea2520519050d4e0ae269c56c33b77fad5cd5d9e4e07a2738b1 + languageName: node + linkType: hard + +"@babel/plugin-transform-modules-commonjs@npm:^7.24.8": + version: 7.29.14 + resolution: "@babel/plugin-transform-modules-commonjs@npm:7.29.14" + dependencies: + "@babel/helper-module-transforms": "npm:^7.29.14" + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/daa4863b5798fd1efab9531f64b706d189d42d590b23f0c1e398f18231116b13a601501d305a80d950c1183154014cd7afd139c76de8e5cd85f926fa47065ac2 + languageName: node + linkType: hard + +"@babel/plugin-transform-named-capturing-groups-regex@npm:^7.24.7": + version: 7.29.7 + resolution: "@babel/plugin-transform-named-capturing-groups-regex@npm:7.29.7" + dependencies: + "@babel/helper-create-regexp-features-plugin": "npm:^7.29.7" + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 10c0/e16e270fc3640baf403497cbbab196cc0f18477576cf3535713c851f69c6e27b2902cc7502c3a863dce7f0432dc344ddcb14766a2af7cf37333aa864c7e5739b + languageName: node + linkType: hard + +"@babel/plugin-transform-nullish-coalescing-operator@npm:^7.24.7": + version: 7.29.7 + resolution: "@babel/plugin-transform-nullish-coalescing-operator@npm:7.29.7" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/b0c186fe38bc66830e1be76f06fabbae8a655d3896a841ba5ffa12d6c40bb9c8a6ecd38a7e2196034b1d7470653109b1ceac1ef5e46a5fdc9291d14afa56e0d0 + languageName: node + linkType: hard + +"@babel/plugin-transform-optional-catch-binding@npm:^7.24.7": + version: 7.29.7 + resolution: "@babel/plugin-transform-optional-catch-binding@npm:7.29.7" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/0df7a9cdaec349e4b893cb26b7ad45454b3ac01de722ccea5e8b4332d15f3e1bc2c130a18367052ce195c957178ad773121c5d586454c438d890585fc548dacc + languageName: node + linkType: hard + +"@babel/plugin-transform-optional-chaining@npm:^7.24.8": + version: 7.29.7 + resolution: "@babel/plugin-transform-optional-chaining@npm:7.29.7" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/71feacf9a7083030f4c69bf4e91db75f2fceae28e58c58b63db040006d908e15bc1e85a464f24ad659f17702e91a64eabbff9f1dd555ba33d78bb1af8a1d697a + languageName: node + linkType: hard + +"@babel/plugin-transform-private-methods@npm:^7.24.7": + version: 7.29.7 + resolution: "@babel/plugin-transform-private-methods@npm:7.29.7" + dependencies: + "@babel/helper-create-class-features-plugin": "npm:^7.29.7" + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/d0dc12fa478d05e346dfb02fad2ed99b308d9a7324bada71530a62dc1ccbf07b4c2581ac677b7196b3994f191ef1922199e2c8f33957b726e2019ce07b4ced0f + languageName: node + linkType: hard + +"@babel/plugin-transform-private-property-in-object@npm:^7.24.7": + version: 7.29.7 + resolution: "@babel/plugin-transform-private-property-in-object@npm:7.29.7" + dependencies: + "@babel/helper-annotate-as-pure": "npm:^7.29.7" + "@babel/helper-create-class-features-plugin": "npm:^7.29.7" + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/6378b34725c6aab4b580cbb5d35ca45ba52213084d54c6672bc4282d86dc45937b8788ad450a9fb60ceb405e3c0d4b25e2804293c2509b54c5e0078babd56a8a + languageName: node + linkType: hard + +"@babel/plugin-transform-react-display-name@npm:^7.24.7": + version: 7.29.7 + resolution: "@babel/plugin-transform-react-display-name@npm:7.29.7" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/0a3b2461b189d6f4ca4f691bb4d1872bdebbac90d2e933a42a2fb22a0d26c81fa1ba7bc8128f3886b3f0f8a0ffe5aa0d7eaf4cd5b9610fc4967913a060501781 + languageName: node + linkType: hard + +"@babel/plugin-transform-react-jsx-self@npm:^7.24.7": + version: 7.29.7 + resolution: "@babel/plugin-transform-react-jsx-self@npm:7.29.7" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/288995f0fd0d61ab740a315fb56c8255eb87dd4a4ac2ac7d0fdd4ce173c3878200141e80da2db0e598c7b2a71e74e604afdbb4c8e14ae6e0527ce0b6294c03da + languageName: node + linkType: hard + +"@babel/plugin-transform-react-jsx-source@npm:^7.24.7": + version: 7.29.7 + resolution: "@babel/plugin-transform-react-jsx-source@npm:7.29.7" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/a121899631e6d99b9e1b276acf736dbb77948a31f8eeeae67b89c8a4ab0f05e51ba64544baa06c286a2b9944f227244e15aac464e2313d286d0511fe51e27975 + languageName: node + linkType: hard + +"@babel/plugin-transform-react-jsx@npm:^7.25.2": + version: 7.29.7 + resolution: "@babel/plugin-transform-react-jsx@npm:7.29.7" + dependencies: + "@babel/helper-annotate-as-pure": "npm:^7.29.7" + "@babel/helper-module-imports": "npm:^7.29.7" + "@babel/helper-plugin-utils": "npm:^7.29.7" + "@babel/plugin-syntax-jsx": "npm:^7.29.7" + "@babel/types": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/ae6487c3deafcffda8a2c1b1eb77e0b7121630fa1a9646cecd73dbbdd8271532a0f7f0e8c01f69b6d39a36d8d79eb67e2d51031369c9055f18f7d8e70d9b5446 + languageName: node + linkType: hard + +"@babel/plugin-transform-regenerator@npm:^7.24.7": + version: 7.29.8 + resolution: "@babel/plugin-transform-regenerator@npm:7.29.8" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/768da9bc3c8cbb0c591bc7db050215b8cea44df9df525d5cd6034aa179b091c2321a745b68139b3fc70b4493f2df1fc99a57acd4029c6d355d32a8ed8bd69f82 + languageName: node + linkType: hard + +"@babel/plugin-transform-runtime@npm:^7.24.7": + version: 7.29.7 + resolution: "@babel/plugin-transform-runtime@npm:7.29.7" + dependencies: + "@babel/helper-module-imports": "npm:^7.29.7" + "@babel/helper-plugin-utils": "npm:^7.29.7" + babel-plugin-polyfill-corejs2: "npm:^0.4.14" + babel-plugin-polyfill-corejs3: "npm:^0.13.0" + babel-plugin-polyfill-regenerator: "npm:^0.6.5" + semver: "npm:^6.3.1" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/570592fc99e55a976000532c5006ac7721b5c508fb905f4f919032291dcd3836617622d1c74177b1f872c88bb48c3f707cb6c2f7477d86d191d8b412d32385e9 + languageName: node + linkType: hard + +"@babel/plugin-transform-typescript@npm:^7.25.2": + version: 7.29.9 + resolution: "@babel/plugin-transform-typescript@npm:7.29.9" + dependencies: + "@babel/helper-annotate-as-pure": "npm:^7.29.7" + "@babel/helper-create-class-features-plugin": "npm:^7.29.7" + "@babel/helper-plugin-utils": "npm:^7.29.7" + "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.29.7" + "@babel/plugin-syntax-typescript": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/6caf62e8359fa08b112d7762036cd3c82ec5c5fd604f5faf4446a7f7b8fa8a85e5536e8425dc61dc3846316b5fdc9adb59de0cc51e39d3354a89bb31705f36de + languageName: node + linkType: hard + +"@babel/plugin-transform-unicode-regex@npm:^7.24.7": + version: 7.29.7 + resolution: "@babel/plugin-transform-unicode-regex@npm:7.29.7" + dependencies: + "@babel/helper-create-regexp-features-plugin": "npm:^7.29.7" + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/1bd788fd953e9b9a662d9a5ec78750f48daa6ef142a141cc96c38278dff49cf082288fd568acc184386f9accb89fa145cf016cc615ef19bd110ff2162a88cfd7 + languageName: node + linkType: hard + +"@babel/template@npm:^7.29.7": + version: 7.29.7 + resolution: "@babel/template@npm:7.29.7" + dependencies: + "@babel/code-frame": "npm:^7.29.7" + "@babel/parser": "npm:^7.29.7" + "@babel/types": "npm:^7.29.7" + checksum: 10c0/8bb7f900dcab0e9e1c5ffbc33ca10e0d26b7b2e2ca804becb73ee771b9c4ed6e2908a4ae4a14c08560febb45d2b6b9a173955e42ad404d05f8b04840a14d9c58 + languageName: node + linkType: hard + +"@babel/traverse@npm:^7.29.0, @babel/traverse@npm:^7.29.10, @babel/traverse@npm:^7.29.13, @babel/traverse@npm:^7.29.14, @babel/traverse@npm:^7.29.7": + version: 7.29.14 + resolution: "@babel/traverse@npm:7.29.14" + dependencies: + "@babel/code-frame": "npm:^7.29.7" + "@babel/generator": "npm:^7.29.14" + "@babel/helper-globals": "npm:^7.29.7" + "@babel/parser": "npm:^7.29.14" + "@babel/template": "npm:^7.29.7" + "@babel/types": "npm:^7.29.14" + debug: "npm:^4.3.1" + checksum: 10c0/f8d393411c7f03d1e5437620affa67857450b84501850414240a05c558894e59800f89310f810ec2711f7ed63fc03ef71d81eef9a3669f64d626c6d1be4c98f7 + languageName: node + linkType: hard + +"@babel/types@npm:^7.29.11, @babel/types@npm:^7.29.14, @babel/types@npm:^7.29.7": + version: 7.29.14 + resolution: "@babel/types@npm:7.29.14" + dependencies: + "@babel/helper-string-parser": "npm:^7.29.14" + "@babel/helper-validator-identifier": "npm:^7.29.7" + checksum: 10c0/40df9841cec707821b711b10c786be8ce52781e159be2ef8be41b546a6cf06021e99bd49b85fde1fd0313560df921335d44df5c442374c07785a4cdf6c2b3932 + languageName: node + linkType: hard + +"@esbuild/aix-ppc64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/aix-ppc64@npm:0.25.12" + conditions: os=aix & cpu=ppc64 + languageName: node + linkType: hard + +"@esbuild/android-arm64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/android-arm64@npm:0.25.12" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/android-arm@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/android-arm@npm:0.25.12" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@esbuild/android-x64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/android-x64@npm:0.25.12" + conditions: os=android & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/darwin-arm64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/darwin-arm64@npm:0.25.12" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/darwin-x64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/darwin-x64@npm:0.25.12" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/freebsd-arm64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/freebsd-arm64@npm:0.25.12" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/freebsd-x64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/freebsd-x64@npm:0.25.12" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/linux-arm64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/linux-arm64@npm:0.25.12" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/linux-arm@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/linux-arm@npm:0.25.12" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@esbuild/linux-ia32@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/linux-ia32@npm:0.25.12" + conditions: os=linux & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/linux-loong64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/linux-loong64@npm:0.25.12" + conditions: os=linux & cpu=loong64 + languageName: node + linkType: hard + +"@esbuild/linux-mips64el@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/linux-mips64el@npm:0.25.12" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + +"@esbuild/linux-ppc64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/linux-ppc64@npm:0.25.12" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + +"@esbuild/linux-riscv64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/linux-riscv64@npm:0.25.12" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + +"@esbuild/linux-s390x@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/linux-s390x@npm:0.25.12" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + +"@esbuild/linux-x64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/linux-x64@npm:0.25.12" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/netbsd-arm64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/netbsd-arm64@npm:0.25.12" + conditions: os=netbsd & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/netbsd-x64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/netbsd-x64@npm:0.25.12" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/openbsd-arm64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/openbsd-arm64@npm:0.25.12" + conditions: os=openbsd & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/openbsd-x64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/openbsd-x64@npm:0.25.12" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/openharmony-arm64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/openharmony-arm64@npm:0.25.12" + conditions: os=openharmony & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/sunos-x64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/sunos-x64@npm:0.25.12" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/win32-arm64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/win32-arm64@npm:0.25.12" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/win32-ia32@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/win32-ia32@npm:0.25.12" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/win32-x64@npm:0.25.12": + version: 0.25.12 + resolution: "@esbuild/win32-x64@npm:0.25.12" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@isaacs/fs-minipass@npm:^4.0.0": + version: 4.0.1 + resolution: "@isaacs/fs-minipass@npm:4.0.1" + dependencies: + minipass: "npm:^7.0.4" + checksum: 10c0/c25b6dc1598790d5b55c0947a9b7d111cfa92594db5296c3b907e2f533c033666f692a3939eadac17b1c7c40d362d0b0635dc874cbfe3e70db7c2b07cc97a5d2 + languageName: node + linkType: hard + +"@jridgewell/gen-mapping@npm:^0.3.12, @jridgewell/gen-mapping@npm:^0.3.5": + version: 0.3.13 + resolution: "@jridgewell/gen-mapping@npm:0.3.13" + dependencies: + "@jridgewell/sourcemap-codec": "npm:^1.5.0" + "@jridgewell/trace-mapping": "npm:^0.3.24" + checksum: 10c0/9a7d65fb13bd9aec1fbab74cda08496839b7e2ceb31f5ab922b323e94d7c481ce0fc4fd7e12e2610915ed8af51178bdc61e168e92a8c8b8303b030b03489b13b + languageName: node + linkType: hard + +"@jridgewell/remapping@npm:^2.3.5": + version: 2.3.5 + resolution: "@jridgewell/remapping@npm:2.3.5" + dependencies: + "@jridgewell/gen-mapping": "npm:^0.3.5" + "@jridgewell/trace-mapping": "npm:^0.3.24" + checksum: 10c0/3de494219ffeb2c5c38711d0d7bb128097edf91893090a2dbc8ee0b55d092bb7347b1fd0f478486c5eab010e855c73927b1666f2107516d472d24a73017d1194 + languageName: node + linkType: hard + +"@jridgewell/resolve-uri@npm:^3.1.0": + version: 3.1.3 + resolution: "@jridgewell/resolve-uri@npm:3.1.3" + checksum: 10c0/b1c5b380e425337d6b9ede3174d88827966afd4cb2bcc80f6dfed16de2b199feb87e5fc8431d884a3aa878dfe422c6259241b2e5c8b13973f0c41f9b0ee4f467 + languageName: node + linkType: hard + +"@jridgewell/sourcemap-codec@npm:^1.4.14, @jridgewell/sourcemap-codec@npm:^1.5.0": + version: 1.6.0 + resolution: "@jridgewell/sourcemap-codec@npm:1.6.0" + checksum: 10c0/b5be700e45a775f218589c3466c4ffea630582b4988657652da464e5ab8a7d18bf928ee4fd2363fb346ede4bea9c6ff0bae05a538358c4565ece6199531b5f72 + languageName: node + linkType: hard + +"@jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.28": + version: 0.3.31 + resolution: "@jridgewell/trace-mapping@npm:0.3.31" + dependencies: + "@jridgewell/resolve-uri": "npm:^3.1.0" + "@jridgewell/sourcemap-codec": "npm:^1.4.14" + checksum: 10c0/4b30ec8cd56c5fd9a661f088230af01e0c1a3888d11ffb6b47639700f71225be21d1f7e168048d6d4f9449207b978a235c07c8f15c07705685d16dc06280e9d9 + languageName: node + linkType: hard + +"@msgpackr-extract/msgpackr-extract-darwin-arm64@npm:3.0.7": + version: 3.0.7 + resolution: "@msgpackr-extract/msgpackr-extract-darwin-arm64@npm:3.0.7" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@msgpackr-extract/msgpackr-extract-darwin-x64@npm:3.0.7": + version: 3.0.7 + resolution: "@msgpackr-extract/msgpackr-extract-darwin-x64@npm:3.0.7" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@msgpackr-extract/msgpackr-extract-linux-arm64@npm:3.0.7": + version: 3.0.7 + resolution: "@msgpackr-extract/msgpackr-extract-linux-arm64@npm:3.0.7" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@msgpackr-extract/msgpackr-extract-linux-arm@npm:3.0.7": + version: 3.0.7 + resolution: "@msgpackr-extract/msgpackr-extract-linux-arm@npm:3.0.7" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@msgpackr-extract/msgpackr-extract-linux-x64@npm:3.0.7": + version: 3.0.7 + resolution: "@msgpackr-extract/msgpackr-extract-linux-x64@npm:3.0.7" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@msgpackr-extract/msgpackr-extract-win32-x64@npm:3.0.7": + version: 3.0.7 + resolution: "@msgpackr-extract/msgpackr-extract-win32-x64@npm:3.0.7" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@nicolo-ribaudo/chokidar-2@npm:2.1.8-no-fsevents.3": + version: 2.1.8-no-fsevents.3 + resolution: "@nicolo-ribaudo/chokidar-2@npm:2.1.8-no-fsevents.3" + checksum: 10c0/27dcabaa0c9a29b3a60217bd3fff87a22cb43ed77863da570c6828e4d0b8f1c6ee52582cd3d439275a2b1f2051005e648ed866b981f2a03b61c645b7e4806ba7 + languageName: node + linkType: hard + +"@react-native/babel-plugin-codegen@npm:0.88.1": + version: 0.88.1 + resolution: "@react-native/babel-plugin-codegen@npm:0.88.1" + dependencies: + "@babel/traverse": "npm:^7.29.0" + "@react-native/codegen": "npm:0.88.1" + checksum: 10c0/32a170bc81fc7786c6b32495f6f4290287c14ac4d9edc03969a9aad35cb6281c40c75b3d74b691ee242ee852e2a47bacb3b03511c542f28a6ed3c5b4af02b2ba + languageName: node + linkType: hard + +"@react-native/babel-preset@npm:0.88.1": + version: 0.88.1 + resolution: "@react-native/babel-preset@npm:0.88.1" + dependencies: + "@babel/core": "npm:^7.25.2" + "@babel/plugin-proposal-export-default-from": "npm:^7.24.7" + "@babel/plugin-syntax-dynamic-import": "npm:^7.8.3" + "@babel/plugin-syntax-export-default-from": "npm:^7.24.7" + "@babel/plugin-syntax-nullish-coalescing-operator": "npm:^7.8.3" + "@babel/plugin-syntax-optional-chaining": "npm:^7.8.3" + "@babel/plugin-transform-async-generator-functions": "npm:^7.25.4" + "@babel/plugin-transform-async-to-generator": "npm:^7.24.7" + "@babel/plugin-transform-block-scoping": "npm:^7.25.0" + "@babel/plugin-transform-class-properties": "npm:^7.25.4" + "@babel/plugin-transform-classes": "npm:^7.25.4" + "@babel/plugin-transform-destructuring": "npm:^7.24.8" + "@babel/plugin-transform-flow-strip-types": "npm:^7.25.2" + "@babel/plugin-transform-for-of": "npm:^7.24.7" + "@babel/plugin-transform-modules-commonjs": "npm:^7.24.8" + "@babel/plugin-transform-named-capturing-groups-regex": "npm:^7.24.7" + "@babel/plugin-transform-nullish-coalescing-operator": "npm:^7.24.7" + "@babel/plugin-transform-optional-catch-binding": "npm:^7.24.7" + "@babel/plugin-transform-optional-chaining": "npm:^7.24.8" + "@babel/plugin-transform-private-methods": "npm:^7.24.7" + "@babel/plugin-transform-private-property-in-object": "npm:^7.24.7" + "@babel/plugin-transform-react-display-name": "npm:^7.24.7" + "@babel/plugin-transform-react-jsx": "npm:^7.25.2" + "@babel/plugin-transform-react-jsx-self": "npm:^7.24.7" + "@babel/plugin-transform-react-jsx-source": "npm:^7.24.7" + "@babel/plugin-transform-regenerator": "npm:^7.24.7" + "@babel/plugin-transform-runtime": "npm:^7.24.7" + "@babel/plugin-transform-typescript": "npm:^7.25.2" + "@babel/plugin-transform-unicode-regex": "npm:^7.24.7" + "@react-native/babel-plugin-codegen": "npm:0.88.1" + babel-plugin-transform-flow-enums: "npm:^0.0.2" + flow-parser: "npm:0.327.0" + react-refresh: "npm:^0.14.0" + peerDependencies: + "@babel/core": "*" + checksum: 10c0/c5eafaa1df33c8231cb381b6464f8aaf949899a5419c5c93eb9f14d058221368db242f9efb21381d8cc2fdd389cf09f6ea6c35164a408ddc8773c94a3e93b750 + languageName: node + linkType: hard + +"@react-native/codegen@npm:0.88.1": + version: 0.88.1 + resolution: "@react-native/codegen@npm:0.88.1" + dependencies: + "@babel/core": "npm:^7.25.2" + "@babel/parser": "npm:^7.29.0" + flow-parser: "npm:0.327.0" + invariant: "npm:^2.2.4" + nullthrows: "npm:^1.1.1" + tinyglobby: "npm:^0.2.15" + yargs: "npm:^17.6.2" + peerDependencies: + "@babel/core": "*" + checksum: 10c0/33f3ef562dcfede10b39e3d68d5be0539314a2737421d385d334a18c96507ba00c430f1c99fad69a9e3c94c3e01c2f07b55fa0b95f8cf18623d32a7e984133cd + languageName: node + linkType: hard + +"abbrev@npm:^5.0.0": + version: 5.0.0 + resolution: "abbrev@npm:5.0.0" + checksum: 10c0/8e88f5c798ea4562d28c5a3e9ad69e3879890bc5d695d8f2dffb8609be4c890aacc8f80ef4553fdd2c6a62d70c2ce8bc57b38074e383beb7487bdafa9ed42ea5 + languageName: node + linkType: hard + +"ansi-regex@npm:^5.0.1": + version: 5.0.1 + resolution: "ansi-regex@npm:5.0.1" + checksum: 10c0/9a64bb8627b434ba9327b60c027742e5d17ac69277960d041898596271d992d4d52ba7267a63ca10232e29f6107fc8a835f6ce8d719b88c5f8493f8254813737 + languageName: node + linkType: hard + +"ansi-styles@npm:^4.0.0": + version: 4.3.0 + resolution: "ansi-styles@npm:4.3.0" + dependencies: + color-convert: "npm:^2.0.1" + checksum: 10c0/895a23929da416f2bd3de7e9cb4eabd340949328ab85ddd6e484a637d8f6820d485f53933446f5291c3b760cbc488beb8e88573dd0f9c7daf83dccc8fe81b041 + languageName: node + linkType: hard + +"anymatch@npm:~3.1.2": + version: 3.1.3 + resolution: "anymatch@npm:3.1.3" + dependencies: + normalize-path: "npm:^3.0.0" + picomatch: "npm:^2.0.4" + checksum: 10c0/57b06ae984bc32a0d22592c87384cd88fe4511b1dd7581497831c56d41939c8a001b28e7b853e1450f2bf61992dfcaa8ae2d0d161a0a90c4fb631ef07098fbac + languageName: node + linkType: hard + +"async-function@npm:^1.0.0": + version: 1.0.0 + resolution: "async-function@npm:1.0.0" + checksum: 10c0/669a32c2cb7e45091330c680e92eaeb791bc1d4132d827591e499cd1f776ff5a873e77e5f92d0ce795a8d60f10761dec9ddfe7225a5de680f5d357f67b1aac73 + languageName: node + linkType: hard + +"async-generator-function@npm:^1.0.0": + version: 1.0.0 + resolution: "async-generator-function@npm:1.0.0" + checksum: 10c0/2c50ef856c543ad500d8d8777d347e3c1ba623b93e99c9263ecc5f965c1b12d2a140e2ab6e43c3d0b85366110696f28114649411cbcd10b452a92a2318394186 + languageName: node + linkType: hard + +"available-typed-arrays@npm:^1.0.7": + version: 1.0.7 + resolution: "available-typed-arrays@npm:1.0.7" + dependencies: + possible-typed-array-names: "npm:^1.0.0" + checksum: 10c0/d07226ef4f87daa01bd0fe80f8f310982e345f372926da2e5296aecc25c41cab440916bbaa4c5e1034b453af3392f67df5961124e4b586df1e99793a1374bdb2 + languageName: node + linkType: hard + +"babel-plugin-polyfill-corejs2@npm:^0.4.14": + version: 0.4.17 + resolution: "babel-plugin-polyfill-corejs2@npm:0.4.17" + dependencies: + "@babel/compat-data": "npm:^7.28.6" + "@babel/helper-define-polyfill-provider": "npm:^0.6.8" + semver: "npm:^6.3.1" + peerDependencies: + "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 + checksum: 10c0/1284960ea403c63b0dd598f338666c4b17d489aefee30b4da6a7313eff1d91edffb0ccf26341a6e5d94231684b74e016eade66b3921ea112f8b0e4980fa08a5c + languageName: node + linkType: hard + +"babel-plugin-polyfill-corejs3@npm:^0.13.0": + version: 0.13.0 + resolution: "babel-plugin-polyfill-corejs3@npm:0.13.0" + dependencies: + "@babel/helper-define-polyfill-provider": "npm:^0.6.5" + core-js-compat: "npm:^3.43.0" + peerDependencies: + "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 + checksum: 10c0/5d8e228da425edc040d8c868486fd01ba10b0440f841156a30d9f8986f330f723e2ee61553c180929519563ef5b64acce2caac36a5a847f095d708dda5d8206d + languageName: node + linkType: hard + +"babel-plugin-polyfill-regenerator@npm:^0.6.5": + version: 0.6.8 + resolution: "babel-plugin-polyfill-regenerator@npm:0.6.8" + dependencies: + "@babel/helper-define-polyfill-provider": "npm:^0.6.8" + peerDependencies: + "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 + checksum: 10c0/7c8b2497c29fa880e0acdc8e7b93e29b81b154179b83beb0476eb2c4e7a78b6b42fc35c2554ca250c9bd6d39941eaf75416254b8592ce50979f9a12e1d51c049 + languageName: node + linkType: hard + +"babel-plugin-transform-flow-enums@npm:^0.0.2": + version: 0.0.2 + resolution: "babel-plugin-transform-flow-enums@npm:0.0.2" + dependencies: + "@babel/plugin-syntax-flow": "npm:^7.12.1" + checksum: 10c0/aa9d022d8d4be0e7c4f1ff7e5308fe7e0ff4d6f9099449913e3a11c1e81916623a8f36432da180a9aa3f53ea534dca4401fe33d6528f043f40357cfa790ee778 + languageName: node + linkType: hard + +"balanced-match@npm:^1.0.0": + version: 1.0.2 + resolution: "balanced-match@npm:1.0.2" + checksum: 10c0/9308baf0a7e4838a82bbfd11e01b1cb0f0cf2893bc1676c27c2a8c0e70cbae1c59120c3268517a8ae7fb6376b4639ef81ca22582611dbee4ed28df945134aaee + languageName: node + linkType: hard + +"base64-js@npm:^1.3.1": + version: 1.5.1 + resolution: "base64-js@npm:1.5.1" + checksum: 10c0/f23823513b63173a001030fae4f2dabe283b99a9d324ade3ad3d148e218134676f1ee8568c877cd79ec1c53158dcf2d2ba527a97c606618928ba99dd930102bf + languageName: node + linkType: hard + +"baseline-browser-mapping@npm:^2.11.37": + version: 2.11.38 + resolution: "baseline-browser-mapping@npm:2.11.38" + bin: + baseline-browser-mapping: dist/cli.cjs + checksum: 10c0/f9b9576f79e4c15a2e7cd2173380922ec82db65a5815fd7a01dc4081cc25ffb25002c07e25076831adec19bf5dcfe11acd0f73473a308e40bb070bc4a98762cb + languageName: node + linkType: hard + +"binary-extensions@npm:^2.0.0": + version: 2.3.0 + resolution: "binary-extensions@npm:2.3.0" + checksum: 10c0/75a59cafc10fb12a11d510e77110c6c7ae3f4ca22463d52487709ca7f18f69d886aa387557cc9864fbdb10153d0bdb4caacabf11541f55e89ed6e18d12ece2b5 + languageName: node + linkType: hard + +"brace-expansion@npm:^1.1.7": + version: 1.1.22 + resolution: "brace-expansion@npm:1.1.22" + dependencies: + balanced-match: "npm:^1.0.0" + concat-map: "npm:0.0.1" + checksum: 10c0/79efabb798348e385f3ec6a0b1cb86811bd164db7b1a25501067de5c436781c2c74cb3cdcf7f9c0f497a6219e7e0d9ee327341c74aa1eb1f178ba690e7202dea + languageName: node + linkType: hard + +"braces@npm:~3.0.2": + version: 3.0.3 + resolution: "braces@npm:3.0.3" + dependencies: + fill-range: "npm:^7.1.1" + checksum: 10c0/7c6dfd30c338d2997ba77500539227b9d1f85e388a5f43220865201e407e076783d0881f2d297b9f80951b4c957fcf0b51c1d2d24227631643c3f7c284b0aa04 + languageName: node + linkType: hard + +"browserslist@npm:^4.24.0, browserslist@npm:^4.29.3": + version: 4.29.6 + resolution: "browserslist@npm:4.29.6" + dependencies: + baseline-browser-mapping: "npm:^2.11.37" + caniuse-lite: "npm:^1.0.30001826" + electron-to-chromium: "npm:^1.5.486" + node-releases: "npm:^2.0.64" + update-browserslist-db: "npm:^1.4.0" + bin: + browserslist: cli.js + checksum: 10c0/ee0469b488aa66af1b97bb1042eadcca06f6c4823358a9eb3da8dd567b28aeccf3e5c8e58ebbf0cbada2af98df5f60b37d82ca555a1529216ba94aa8518133ec + languageName: node + linkType: hard + +"buffer@npm:^6.0.3": + version: 6.0.3 + resolution: "buffer@npm:6.0.3" + dependencies: + base64-js: "npm:^1.3.1" + ieee754: "npm:^1.2.1" + checksum: 10c0/2a905fbbcde73cc5d8bd18d1caa23715d5f83a5935867c2329f0ac06104204ba7947be098fe1317fbd8830e26090ff8e764f08cd14fefc977bb248c3487bcbd0 + languageName: node + linkType: hard + +"call-bind-apply-helpers@npm:^1.0.1, call-bind-apply-helpers@npm:^1.0.2": + version: 1.0.2 + resolution: "call-bind-apply-helpers@npm:1.0.2" + dependencies: + es-errors: "npm:^1.3.0" + function-bind: "npm:^1.1.2" + checksum: 10c0/47bd9901d57b857590431243fea704ff18078b16890a6b3e021e12d279bbf211d039155e27d7566b374d49ee1f8189344bac9833dec7a20cdec370506361c938 + languageName: node + linkType: hard + +"call-bind@npm:^1.0.9": + version: 1.0.9 + resolution: "call-bind@npm:1.0.9" + dependencies: + call-bind-apply-helpers: "npm:^1.0.2" + es-define-property: "npm:^1.0.1" + get-intrinsic: "npm:^1.3.0" + set-function-length: "npm:^1.2.2" + checksum: 10c0/a6621f6da1444481919ce3b4983dff725691e0754d3507ae483ce56e54985f2da7d6f1df512c56dbf28660745cf1ca52553f1fc9aef5557f3ce353ef14fab714 + languageName: node + linkType: hard + +"call-bound@npm:^1.0.2, call-bound@npm:^1.0.4": + version: 1.0.4 + resolution: "call-bound@npm:1.0.4" + dependencies: + call-bind-apply-helpers: "npm:^1.0.2" + get-intrinsic: "npm:^1.3.0" + checksum: 10c0/f4796a6a0941e71c766aea672f63b72bc61234c4f4964dc6d7606e3664c307e7d77845328a8f3359ce39ddb377fed67318f9ee203dea1d47e46165dcf2917644 + languageName: node + linkType: hard + +"caniuse-lite@npm:^1.0.30001826": + version: 1.0.30001826 + resolution: "caniuse-lite@npm:1.0.30001826" + checksum: 10c0/11e9dba4dd105d270f69da022ce6a47be67cd1cc376f74029f99524ba8141a840153aa285f22c9a643a2fe608ffc0879592bcc9b7c20ad6875ad7ede663a1a6d + languageName: node + linkType: hard + +"chokidar@npm:^3.6.0": + version: 3.6.0 + resolution: "chokidar@npm:3.6.0" + dependencies: + anymatch: "npm:~3.1.2" + braces: "npm:~3.0.2" + fsevents: "npm:~2.3.2" + glob-parent: "npm:~5.1.2" + is-binary-path: "npm:~2.1.0" + is-glob: "npm:~4.0.1" + normalize-path: "npm:~3.0.0" + readdirp: "npm:~3.6.0" + dependenciesMeta: + fsevents: + optional: true + checksum: 10c0/8361dcd013f2ddbe260eacb1f3cb2f2c6f2b0ad118708a343a5ed8158941a39cb8fb1d272e0f389712e74ee90ce8ba864eece9e0e62b9705cb468a2f6d917462 + languageName: node + linkType: hard + +"chownr@npm:^3.0.0": + version: 3.0.0 + resolution: "chownr@npm:3.0.0" + checksum: 10c0/43925b87700f7e3893296c8e9c56cc58f926411cce3a6e5898136daaf08f08b9a8eb76d37d3267e707d0dcc17aed2e2ebdf5848c0c3ce95cf910a919935c1b10 + languageName: node + linkType: hard + +"cliui@npm:^8.0.1": + version: 8.0.1 + resolution: "cliui@npm:8.0.1" + dependencies: + string-width: "npm:^4.2.0" + strip-ansi: "npm:^6.0.1" + wrap-ansi: "npm:^7.0.0" + checksum: 10c0/4bda0f09c340cbb6dfdc1ed508b3ca080f12992c18d68c6be4d9cf51756033d5266e61ec57529e610dacbf4da1c634423b0c1b11037709cc6b09045cbd815df5 + languageName: node + linkType: hard + +"color-convert@npm:^2.0.1": + version: 2.0.1 + resolution: "color-convert@npm:2.0.1" + dependencies: + color-name: "npm:~1.1.4" + checksum: 10c0/37e1150172f2e311fe1b2df62c6293a342ee7380da7b9cfdba67ea539909afbd74da27033208d01d6d5cfc65ee7868a22e18d7e7648e004425441c0f8a15a7d7 + languageName: node + linkType: hard + +"color-name@npm:~1.1.4": + version: 1.1.4 + resolution: "color-name@npm:1.1.4" + checksum: 10c0/a1a3f914156960902f46f7f56bc62effc6c94e84b2cae157a526b1c1f74b677a47ec602bf68a61abfa2b42d15b7c5651c6dbe72a43af720bc588dff885b10f95 + languageName: node + linkType: hard + +"commander@npm:^6.2.0": + version: 6.2.1 + resolution: "commander@npm:6.2.1" + checksum: 10c0/85748abd9d18c8bc88febed58b98f66b7c591d9b5017cad459565761d7b29ca13b7783ea2ee5ce84bf235897333706c4ce29adf1ce15c8252780e7000e2ce9ea + languageName: node + linkType: hard + +"concat-map@npm:0.0.1": + version: 0.0.1 + resolution: "concat-map@npm:0.0.1" + checksum: 10c0/c996b1cfdf95b6c90fee4dae37e332c8b6eb7d106430c17d538034c0ad9a1630cb194d2ab37293b1bdd4d779494beee7786d586a50bd9376fd6f7bcc2bd4c98f + languageName: node + linkType: hard + +"convert-source-map@npm:^2.0.0": + version: 2.0.0 + resolution: "convert-source-map@npm:2.0.0" + checksum: 10c0/8f2f7a27a1a011cc6cc88cc4da2d7d0cfa5ee0369508baae3d98c260bb3ac520691464e5bbe4ae7cdf09860c1d69ecc6f70c63c6e7c7f7e3f18ec08484dc7d9b + languageName: node + linkType: hard + +"core-js-compat@npm:^3.43.0": + version: 3.51.0 + resolution: "core-js-compat@npm:3.51.0" + dependencies: + browserslist: "npm:^4.29.3" + checksum: 10c0/733fe5e8d4d5527ffb8ba8fbf815460d1275894387f68e923c3a6e4e7bedba5f8b3eb813ad3e18eeb3a3055094ca9de5c9b47fbf7acab173d5ed0bea6f2ec29a + languageName: node + linkType: hard + +"debug@npm:^4.1.0, debug@npm:^4.3.1, debug@npm:^4.4.3": + version: 4.4.3 + resolution: "debug@npm:4.4.3" + dependencies: + ms: "npm:^2.1.3" + peerDependenciesMeta: + supports-color: + optional: true + checksum: 10c0/d79136ec6c83ecbefd0f6a5593da6a9c91ec4d7ddc4b54c883d6e71ec9accb5f67a1a5e96d00a328196b5b5c86d365e98d8a3a70856aaf16b4e7b1985e67f5a6 + languageName: node + linkType: hard + +"define-data-property@npm:^1.1.4": + version: 1.1.4 + resolution: "define-data-property@npm:1.1.4" + dependencies: + es-define-property: "npm:^1.0.0" + es-errors: "npm:^1.3.0" + gopd: "npm:^1.0.1" + checksum: 10c0/dea0606d1483eb9db8d930d4eac62ca0fa16738b0b3e07046cddfacf7d8c868bbe13fa0cb263eb91c7d0d527960dc3f2f2471a69ed7816210307f6744fe62e37 + languageName: node + linkType: hard + +"detect-libc@npm:^2.0.1": + version: 2.1.2 + resolution: "detect-libc@npm:2.1.2" + checksum: 10c0/acc675c29a5649fa1fb6e255f993b8ee829e510b6b56b0910666949c80c364738833417d0edb5f90e4e46be17228b0f2b66a010513984e18b15deeeac49369c4 + languageName: node + linkType: hard + +"dunder-proto@npm:^1.0.1": + version: 1.0.1 + resolution: "dunder-proto@npm:1.0.1" + dependencies: + call-bind-apply-helpers: "npm:^1.0.1" + es-errors: "npm:^1.3.0" + gopd: "npm:^1.2.0" + checksum: 10c0/199f2a0c1c16593ca0a145dbf76a962f8033ce3129f01284d48c45ed4e14fea9bbacd7b3610b6cdc33486cef20385ac054948fefc6272fcce645c09468f93031 + languageName: node + linkType: hard + +"electron-to-chromium@npm:^1.5.486": + version: 1.5.490 + resolution: "electron-to-chromium@npm:1.5.490" + checksum: 10c0/22794c0ba59c437ff9b0d448734122b47dc790fe88241a15b0f030d9802b6fb8686829b8acc277ec85d4594b27af32e8e07b48771f80f99f5441e621ad96d664 + languageName: node + linkType: hard + +"emoji-regex@npm:^8.0.0": + version: 8.0.0 + resolution: "emoji-regex@npm:8.0.0" + checksum: 10c0/b6053ad39951c4cf338f9092d7bfba448cdfd46fe6a2a034700b149ac9ffbc137e361cbd3c442297f86bed2e5f7576c1b54cc0a6bf8ef5106cc62f496af35010 + languageName: node + linkType: hard + +"env-paths@npm:^2.2.0": + version: 2.2.1 + resolution: "env-paths@npm:2.2.1" + checksum: 10c0/285325677bf00e30845e330eec32894f5105529db97496ee3f598478e50f008c5352a41a30e5e72ec9de8a542b5a570b85699cd63bd2bc646dbcb9f311d83bc4 + languageName: node + linkType: hard + +"es-define-property@npm:^1.0.0, es-define-property@npm:^1.0.1": + version: 1.0.1 + resolution: "es-define-property@npm:1.0.1" + checksum: 10c0/3f54eb49c16c18707949ff25a1456728c883e81259f045003499efba399c08bad00deebf65cccde8c0e07908c1a225c9d472b7107e558f2a48e28d530e34527c + languageName: node + linkType: hard + +"es-errors@npm:^1.3.0": + version: 1.3.0 + resolution: "es-errors@npm:1.3.0" + checksum: 10c0/0a61325670072f98d8ae3b914edab3559b6caa980f08054a3b872052640d91da01d38df55df797fcc916389d77fc92b8d5906cf028f4db46d7e3003abecbca85 + languageName: node + linkType: hard + +"es-object-atoms@npm:^1.0.0, es-object-atoms@npm:^1.1.1": + version: 1.1.2 + resolution: "es-object-atoms@npm:1.1.2" + dependencies: + es-errors: "npm:^1.3.0" + checksum: 10c0/1772861f094f739d6f41b579cfb9a18579daffeb434552a370a5fbef50a32d22227e27b63fdbb757b7ddd429d1b42fe52ccae7966d9302a2ec221b6f1b41bbc4 + languageName: node + linkType: hard + +"esbuild@npm:^0.25.0": + version: 0.25.12 + resolution: "esbuild@npm:0.25.12" + dependencies: + "@esbuild/aix-ppc64": "npm:0.25.12" + "@esbuild/android-arm": "npm:0.25.12" + "@esbuild/android-arm64": "npm:0.25.12" + "@esbuild/android-x64": "npm:0.25.12" + "@esbuild/darwin-arm64": "npm:0.25.12" + "@esbuild/darwin-x64": "npm:0.25.12" + "@esbuild/freebsd-arm64": "npm:0.25.12" + "@esbuild/freebsd-x64": "npm:0.25.12" + "@esbuild/linux-arm": "npm:0.25.12" + "@esbuild/linux-arm64": "npm:0.25.12" + "@esbuild/linux-ia32": "npm:0.25.12" + "@esbuild/linux-loong64": "npm:0.25.12" + "@esbuild/linux-mips64el": "npm:0.25.12" + "@esbuild/linux-ppc64": "npm:0.25.12" + "@esbuild/linux-riscv64": "npm:0.25.12" + "@esbuild/linux-s390x": "npm:0.25.12" + "@esbuild/linux-x64": "npm:0.25.12" + "@esbuild/netbsd-arm64": "npm:0.25.12" + "@esbuild/netbsd-x64": "npm:0.25.12" + "@esbuild/openbsd-arm64": "npm:0.25.12" + "@esbuild/openbsd-x64": "npm:0.25.12" + "@esbuild/openharmony-arm64": "npm:0.25.12" + "@esbuild/sunos-x64": "npm:0.25.12" + "@esbuild/win32-arm64": "npm:0.25.12" + "@esbuild/win32-ia32": "npm:0.25.12" + "@esbuild/win32-x64": "npm:0.25.12" + dependenciesMeta: + "@esbuild/aix-ppc64": + optional: true + "@esbuild/android-arm": + optional: true + "@esbuild/android-arm64": + optional: true + "@esbuild/android-x64": + optional: true + "@esbuild/darwin-arm64": + optional: true + "@esbuild/darwin-x64": + optional: true + "@esbuild/freebsd-arm64": + optional: true + "@esbuild/freebsd-x64": + optional: true + "@esbuild/linux-arm": + optional: true + "@esbuild/linux-arm64": + optional: true + "@esbuild/linux-ia32": + optional: true + "@esbuild/linux-loong64": + optional: true + "@esbuild/linux-mips64el": + optional: true + "@esbuild/linux-ppc64": + optional: true + "@esbuild/linux-riscv64": + optional: true + "@esbuild/linux-s390x": + optional: true + "@esbuild/linux-x64": + optional: true + "@esbuild/netbsd-arm64": + optional: true + "@esbuild/netbsd-x64": + optional: true + "@esbuild/openbsd-arm64": + optional: true + "@esbuild/openbsd-x64": + optional: true + "@esbuild/openharmony-arm64": + optional: true + "@esbuild/sunos-x64": + optional: true + "@esbuild/win32-arm64": + optional: true + "@esbuild/win32-ia32": + optional: true + "@esbuild/win32-x64": + optional: true + bin: + esbuild: bin/esbuild + checksum: 10c0/c205357531423220a9de8e1e6c6514242bc9b1666e762cd67ccdf8fdfdc3f1d0bd76f8d9383958b97ad4c953efdb7b6e8c1f9ca5951cd2b7c5235e8755b34a6b + languageName: node + linkType: hard + +"escalade@npm:^3.1.1, escalade@npm:^3.2.0": + version: 3.2.0 + resolution: "escalade@npm:3.2.0" + checksum: 10c0/ced4dd3a78e15897ed3be74e635110bbf3b08877b0a41be50dcb325ee0e0b5f65fc2d50e9845194d7c4633f327e2e1c6cce00a71b617c5673df0374201d67f65 + languageName: node + linkType: hard + +"events@npm:^3.3.0": + version: 3.3.0 + resolution: "events@npm:3.3.0" + checksum: 10c0/d6b6f2adbccbcda74ddbab52ed07db727ef52e31a61ed26db9feb7dc62af7fc8e060defa65e5f8af9449b86b52cc1a1f6a79f2eafcf4e62add2b7a1fa4a432f6 + languageName: node + linkType: hard + +"exponential-backoff@npm:^3.1.1": + version: 3.1.3 + resolution: "exponential-backoff@npm:3.1.3" + checksum: 10c0/77e3ae682b7b1f4972f563c6dbcd2b0d54ac679e62d5d32f3e5085feba20483cf28bd505543f520e287a56d4d55a28d7874299941faf637e779a1aa5994d1267 + languageName: node + linkType: hard + +"fdir@npm:^6.5.0": + version: 6.5.0 + resolution: "fdir@npm:6.5.0" + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + checksum: 10c0/e345083c4306b3aed6cb8ec551e26c36bab5c511e99ea4576a16750ddc8d3240e63826cc624f5ae17ad4dc82e68a253213b60d556c11bfad064b7607847ed07f + languageName: node + linkType: hard + +"fill-range@npm:^7.1.1": + version: 7.1.1 + resolution: "fill-range@npm:7.1.1" + dependencies: + to-regex-range: "npm:^5.0.1" + checksum: 10c0/b75b691bbe065472f38824f694c2f7449d7f5004aa950426a2c28f0306c60db9b880c0b0e4ed819997ffb882d1da02cfcfc819bddc94d71627f5269682edf018 + languageName: node + linkType: hard + +"flow-estree@npm:0.327.0": + version: 0.327.0 + resolution: "flow-estree@npm:0.327.0" + checksum: 10c0/a6e62d4855e6d1096a3f45efbeb566afa8183cf4bc2beee8bb61dc6e2ab63982014a2dccd88ca23f1f06ace1b7e5dc0d00fa366af5d1fc9ff81d469b9a3cf30e + languageName: node + linkType: hard + +"flow-parser@npm:0.327.0": + version: 0.327.0 + resolution: "flow-parser@npm:0.327.0" + dependencies: + flow-estree: "npm:0.327.0" + checksum: 10c0/8b299cef3d9ffeb9c5a315b2fa40707426abed1d68eec3752c8aebbb9f6513ff613ae2208e176a6b235d3177027c237e265f8f31fcfbe2b1672820f86a7d6ce6 + languageName: node + linkType: hard + +"for-each@npm:^0.3.5": + version: 0.3.5 + resolution: "for-each@npm:0.3.5" + dependencies: + is-callable: "npm:^1.2.7" + checksum: 10c0/0e0b50f6a843a282637d43674d1fb278dda1dd85f4f99b640024cfb10b85058aac0cc781bf689d5fe50b4b7f638e91e548560723a4e76e04fe96ae35ef039cee + languageName: node + linkType: hard + +"fs-readdir-recursive@npm:^1.1.0": + version: 1.1.0 + resolution: "fs-readdir-recursive@npm:1.1.0" + checksum: 10c0/7e190393952143e674b6d1ad4abcafa1b5d3e337fcc21b0cb051079a7140a54617a7df193d562ef9faf21bd7b2148a38601b3d5c16261fa76f278d88dc69989c + languageName: node + linkType: hard + +"fs.realpath@npm:^1.0.0": + version: 1.0.0 + resolution: "fs.realpath@npm:1.0.0" + checksum: 10c0/444cf1291d997165dfd4c0d58b69f0e4782bfd9149fd72faa4fe299e68e0e93d6db941660b37dd29153bf7186672ececa3b50b7e7249477b03fdf850f287c948 + languageName: node + linkType: hard + +"fsevents@npm:~2.3.2": + version: 2.3.3 + resolution: "fsevents@npm:2.3.3" + dependencies: + node-gyp: "npm:latest" + checksum: 10c0/a1f0c44595123ed717febbc478aa952e47adfc28e2092be66b8ab1635147254ca6cfe1df792a8997f22716d4cbafc73309899ff7bfac2ac3ad8cf2e4ecc3ec60 + conditions: os=darwin + languageName: node + linkType: hard + +"fsevents@patch:fsevents@npm%3A~2.3.2#optional!builtin": + version: 2.3.3 + resolution: "fsevents@patch:fsevents@npm%3A2.3.3#optional!builtin::version=2.3.3&hash=df0bf1" + dependencies: + node-gyp: "npm:latest" + conditions: os=darwin + languageName: node + linkType: hard + +"function-bind@npm:^1.1.2": + version: 1.1.2 + resolution: "function-bind@npm:1.1.2" + checksum: 10c0/d8680ee1e5fcd4c197e4ac33b2b4dce03c71f4d91717292785703db200f5c21f977c568d28061226f9b5900cbcd2c84463646134fd5337e7925e0942bc3f46d5 + languageName: node + linkType: hard + +"generator-function@npm:^2.0.0": + version: 2.0.1 + resolution: "generator-function@npm:2.0.1" + checksum: 10c0/8a9f59df0f01cfefafdb3b451b80555e5cf6d76487095db91ac461a0e682e4ff7a9dbce15f4ecec191e53586d59eece01949e05a4b4492879600bbbe8e28d6b8 + languageName: node + linkType: hard + +"gensync@npm:^1.0.0-beta.2": + version: 1.0.0-beta.2 + resolution: "gensync@npm:1.0.0-beta.2" + checksum: 10c0/782aba6cba65b1bb5af3b095d96249d20edbe8df32dbf4696fd49be2583faf676173bf4809386588828e4dd76a3354fcbeb577bab1c833ccd9fc4577f26103f8 + languageName: node + linkType: hard + +"get-caller-file@npm:^2.0.5": + version: 2.0.5 + resolution: "get-caller-file@npm:2.0.5" + checksum: 10c0/c6c7b60271931fa752aeb92f2b47e355eac1af3a2673f47c9589e8f8a41adc74d45551c1bc57b5e66a80609f10ffb72b6f575e4370d61cc3f7f3aaff01757cde + languageName: node + linkType: hard + +"get-intrinsic@npm:^1.2.4, get-intrinsic@npm:^1.3.0": + version: 1.3.1 + resolution: "get-intrinsic@npm:1.3.1" + dependencies: + async-function: "npm:^1.0.0" + async-generator-function: "npm:^1.0.0" + call-bind-apply-helpers: "npm:^1.0.2" + es-define-property: "npm:^1.0.1" + es-errors: "npm:^1.3.0" + es-object-atoms: "npm:^1.1.1" + function-bind: "npm:^1.1.2" + generator-function: "npm:^2.0.0" + get-proto: "npm:^1.0.1" + gopd: "npm:^1.2.0" + has-symbols: "npm:^1.1.0" + hasown: "npm:^2.0.2" + math-intrinsics: "npm:^1.1.0" + checksum: 10c0/9f4ab0cf7efe0fd2c8185f52e6f637e708f3a112610c88869f8f041bb9ecc2ce44bf285dfdbdc6f4f7c277a5b88d8e94a432374d97cca22f3de7fc63795deb5d + languageName: node + linkType: hard + +"get-proto@npm:^1.0.1": + version: 1.0.1 + resolution: "get-proto@npm:1.0.1" + dependencies: + dunder-proto: "npm:^1.0.1" + es-object-atoms: "npm:^1.0.0" + checksum: 10c0/9224acb44603c5526955e83510b9da41baf6ae73f7398875fba50edc5e944223a89c4a72b070fcd78beb5f7bdda58ecb6294adc28f7acfc0da05f76a2399643c + languageName: node + linkType: hard + +"glob-parent@npm:~5.1.2": + version: 5.1.2 + resolution: "glob-parent@npm:5.1.2" + dependencies: + is-glob: "npm:^4.0.1" + checksum: 10c0/cab87638e2112bee3f839ef5f6e0765057163d39c66be8ec1602f3823da4692297ad4e972de876ea17c44d652978638d2fd583c6713d0eb6591706825020c9ee + languageName: node + linkType: hard + +"glob@npm:^7.2.0": + version: 7.2.3 + resolution: "glob@npm:7.2.3" + dependencies: + fs.realpath: "npm:^1.0.0" + inflight: "npm:^1.0.4" + inherits: "npm:2" + minimatch: "npm:^3.1.1" + once: "npm:^1.3.0" + path-is-absolute: "npm:^1.0.0" + checksum: 10c0/65676153e2b0c9095100fe7f25a778bf45608eeb32c6048cf307f579649bcc30353277b3b898a3792602c65764e5baa4f643714dfbdfd64ea271d210c7a425fe + languageName: node + linkType: hard + +"gopd@npm:^1.0.1, gopd@npm:^1.2.0": + version: 1.2.0 + resolution: "gopd@npm:1.2.0" + checksum: 10c0/50fff1e04ba2b7737c097358534eacadad1e68d24cccee3272e04e007bed008e68d2614f3987788428fd192a5ae3889d08fb2331417e4fc4a9ab366b2043cead + languageName: node + linkType: hard + +"graceful-fs@npm:^4.2.6": + version: 4.2.12 + resolution: "graceful-fs@npm:4.2.12" + checksum: 10c0/a4e2ccd9fe7ed384ed0d466363028978c1b1537f0719db826dfa6a850abd8fc418596f14d9a9609f830ba8137df3da1acc1132a6afd635d8633fbe53530c3e6d + languageName: node + linkType: hard + +"has-property-descriptors@npm:^1.0.2": + version: 1.0.2 + resolution: "has-property-descriptors@npm:1.0.2" + dependencies: + es-define-property: "npm:^1.0.0" + checksum: 10c0/253c1f59e80bb476cf0dde8ff5284505d90c3bdb762983c3514d36414290475fe3fd6f574929d84de2a8eec00d35cf07cb6776205ff32efd7c50719125f00236 + languageName: node + linkType: hard + +"has-symbols@npm:^1.0.3, has-symbols@npm:^1.1.0": + version: 1.1.0 + resolution: "has-symbols@npm:1.1.0" + checksum: 10c0/dde0a734b17ae51e84b10986e651c664379018d10b91b6b0e9b293eddb32f0f069688c841fb40f19e9611546130153e0a2a48fd7f512891fb000ddfa36f5a20e + languageName: node + linkType: hard + +"has-tostringtag@npm:^1.0.2": + version: 1.0.2 + resolution: "has-tostringtag@npm:1.0.2" + dependencies: + has-symbols: "npm:^1.0.3" + checksum: 10c0/a8b166462192bafe3d9b6e420a1d581d93dd867adb61be223a17a8d6dad147aa77a8be32c961bb2f27b3ef893cae8d36f564ab651f5e9b7938ae86f74027c48c + languageName: node + linkType: hard + +"hash.js@npm:^1.1.7": + version: 1.1.7 + resolution: "hash.js@npm:1.1.7" + dependencies: + inherits: "npm:^2.0.3" + minimalistic-assert: "npm:^1.0.1" + checksum: 10c0/41ada59494eac5332cfc1ce6b7ebdd7b88a3864a6d6b08a3ea8ef261332ed60f37f10877e0c825aaa4bddebf164fbffa618286aeeec5296675e2671cbfa746c4 + languageName: node + linkType: hard + +"hasown@npm:^2.0.2, hasown@npm:^2.0.4": + version: 2.0.4 + resolution: "hasown@npm:2.0.4" + dependencies: + function-bind: "npm:^1.1.2" + checksum: 10c0/2d8de939e270b70618f8cebb69746620db10617dbb495bc66ddad326955ea24d3ca4af133aff3eb7c1853e0218f867bc2b050ec26fe02e3aea58f880ffc5e506 + languageName: node + linkType: hard + +"ieee754@npm:^1.2.1": + version: 1.2.1 + resolution: "ieee754@npm:1.2.1" + checksum: 10c0/b0782ef5e0935b9f12883a2e2aa37baa75da6e66ce6515c168697b42160807d9330de9a32ec1ed73149aea02e0d822e572bca6f1e22bdcbd2149e13b050b17bb + languageName: node + linkType: hard + +"inflight@npm:^1.0.4": + version: 1.0.6 + resolution: "inflight@npm:1.0.6" + dependencies: + once: "npm:^1.3.0" + wrappy: "npm:1" + checksum: 10c0/7faca22584600a9dc5b9fca2cd5feb7135ac8c935449837b315676b4c90aa4f391ec4f42240178244b5a34e8bede1948627fda392ca3191522fc46b34e985ab2 + languageName: node + linkType: hard + +"inherits@npm:2, inherits@npm:^2.0.3": + version: 2.0.4 + resolution: "inherits@npm:2.0.4" + checksum: 10c0/4e531f648b29039fb7426fb94075e6545faa1eb9fe83c29f0b6d9e7263aceb4289d2d4557db0d428188eeb449cc7c5e77b0a0b2c4e248ff2a65933a0dee49ef2 + languageName: node + linkType: hard + +"invariant@npm:^2.2.4": + version: 2.2.4 + resolution: "invariant@npm:2.2.4" + dependencies: + loose-envify: "npm:^1.0.0" + checksum: 10c0/5af133a917c0bcf65e84e7f23e779e7abc1cd49cb7fdc62d00d1de74b0d8c1b5ee74ac7766099fb3be1b05b26dfc67bab76a17030d2fe7ea2eef867434362dfc + languageName: node + linkType: hard + +"is-arguments@npm:^1.0.4": + version: 1.2.0 + resolution: "is-arguments@npm:1.2.0" + dependencies: + call-bound: "npm:^1.0.2" + has-tostringtag: "npm:^1.0.2" + checksum: 10c0/6377344b31e9fcb707c6751ee89b11f132f32338e6a782ec2eac9393b0cbd32235dad93052998cda778ee058754860738341d8114910d50ada5615912bb929fc + languageName: node + linkType: hard + +"is-binary-path@npm:~2.1.0": + version: 2.1.0 + resolution: "is-binary-path@npm:2.1.0" + dependencies: + binary-extensions: "npm:^2.0.0" + checksum: 10c0/a16eaee59ae2b315ba36fad5c5dcaf8e49c3e27318f8ab8fa3cdb8772bf559c8d1ba750a589c2ccb096113bb64497084361a25960899cb6172a6925ab6123d38 + languageName: node + linkType: hard + +"is-callable@npm:^1.2.7": + version: 1.2.7 + resolution: "is-callable@npm:1.2.7" + checksum: 10c0/ceebaeb9d92e8adee604076971dd6000d38d6afc40bb843ea8e45c5579b57671c3f3b50d7f04869618242c6cee08d1b67806a8cb8edaaaf7c0748b3720d6066f + languageName: node + linkType: hard + +"is-core-module@npm:^2.18.0": + version: 2.18.0 + resolution: "is-core-module@npm:2.18.0" + dependencies: + hasown: "npm:^2.0.4" + checksum: 10c0/2962ad96ff260241a9059ec23b467c69fc5c824168d5f24e806839e32099be69c8e32f444b5ad43854d738e7ca073b31db74c20654f870c96e721d1d785c723b + languageName: node + linkType: hard + +"is-extglob@npm:^2.1.1": + version: 2.1.1 + resolution: "is-extglob@npm:2.1.1" + checksum: 10c0/5487da35691fbc339700bbb2730430b07777a3c21b9ebaecb3072512dfd7b4ba78ac2381a87e8d78d20ea08affb3f1971b4af629173a6bf435ff8a4c47747912 + languageName: node + linkType: hard + +"is-fullwidth-code-point@npm:^3.0.0": + version: 3.0.0 + resolution: "is-fullwidth-code-point@npm:3.0.0" + checksum: 10c0/bb11d825e049f38e04c06373a8d72782eee0205bda9d908cc550ccb3c59b99d750ff9537982e01733c1c94a58e35400661f57042158ff5e8f3e90cf936daf0fc + languageName: node + linkType: hard + +"is-generator-function@npm:^1.0.7": + version: 1.1.2 + resolution: "is-generator-function@npm:1.1.2" + dependencies: + call-bound: "npm:^1.0.4" + generator-function: "npm:^2.0.0" + get-proto: "npm:^1.0.1" + has-tostringtag: "npm:^1.0.2" + safe-regex-test: "npm:^1.1.0" + checksum: 10c0/83da102e89c3e3b71d67b51d47c9f9bc862bceb58f87201727e27f7fa19d1d90b0ab223644ecaee6fc6e3d2d622bb25c966fbdaf87c59158b01ce7c0fe2fa372 + languageName: node + linkType: hard + +"is-glob@npm:^4.0.1, is-glob@npm:~4.0.1": + version: 4.0.3 + resolution: "is-glob@npm:4.0.3" + dependencies: + is-extglob: "npm:^2.1.1" + checksum: 10c0/17fb4014e22be3bbecea9b2e3a76e9e34ff645466be702f1693e8f1ee1adac84710d0be0bd9f967d6354036fd51ab7c2741d954d6e91dae6bb69714de92c197a + languageName: node + linkType: hard + +"is-number@npm:^7.0.0": + version: 7.0.0 + resolution: "is-number@npm:7.0.0" + checksum: 10c0/b4686d0d3053146095ccd45346461bc8e53b80aeb7671cc52a4de02dbbf7dc0d1d2a986e2fe4ae206984b4d34ef37e8b795ebc4f4295c978373e6575e295d811 + languageName: node + linkType: hard + +"is-regex@npm:^1.2.1": + version: 1.2.1 + resolution: "is-regex@npm:1.2.1" + dependencies: + call-bound: "npm:^1.0.2" + gopd: "npm:^1.2.0" + has-tostringtag: "npm:^1.0.2" + hasown: "npm:^2.0.2" + checksum: 10c0/1d3715d2b7889932349241680032e85d0b492cfcb045acb75ffc2c3085e8d561184f1f7e84b6f8321935b4aea39bc9c6ba74ed595b57ce4881a51dfdbc214e04 + languageName: node + linkType: hard + +"is-typed-array@npm:^1.1.3": + version: 1.1.15 + resolution: "is-typed-array@npm:1.1.15" + dependencies: + which-typed-array: "npm:^1.1.16" + checksum: 10c0/415511da3669e36e002820584e264997ffe277ff136643a3126cc949197e6ca3334d0f12d084e83b1994af2e9c8141275c741cf2b7da5a2ff62dd0cac26f76c4 + languageName: node + linkType: hard + +"isexe@npm:^4.0.0": + version: 4.0.0 + resolution: "isexe@npm:4.0.0" + checksum: 10c0/5884815115bceac452877659a9c7726382531592f43dc29e5d48b7c4100661aed54018cb90bd36cb2eaeba521092570769167acbb95c18d39afdccbcca06c5ce + languageName: node + linkType: hard + +"js-tokens@npm:^3.0.0 || ^4.0.0, js-tokens@npm:^4.0.0": + version: 4.0.0 + resolution: "js-tokens@npm:4.0.0" + checksum: 10c0/e248708d377aa058eacf2037b07ded847790e6de892bbad3dac0abba2e759cb9f121b00099a65195616badcb6eca8d14d975cb3e89eb1cfda644756402c8aeed + languageName: node + linkType: hard + +"jsesc@npm:^3.0.2, jsesc@npm:~3.1.0": + version: 3.1.0 + resolution: "jsesc@npm:3.1.0" + bin: + jsesc: bin/jsesc + checksum: 10c0/531779df5ec94f47e462da26b4cbf05eb88a83d9f08aac2ba04206508fc598527a153d08bd462bae82fc78b3eaa1a908e1a4a79f886e9238641c4cdefaf118b1 + languageName: node + linkType: hard + +"json5@npm:^2.2.3": + version: 2.2.3 + resolution: "json5@npm:2.2.3" + bin: + json5: lib/cli.js + checksum: 10c0/5a04eed94810fa55c5ea138b2f7a5c12b97c3750bc63d11e511dcecbfef758003861522a070c2272764ee0f4e3e323862f386945aeb5b85b87ee43f084ba586c + languageName: node + linkType: hard + +"lodash.debounce@npm:^4.0.8": + version: 4.0.8 + resolution: "lodash.debounce@npm:4.0.8" + checksum: 10c0/762998a63e095412b6099b8290903e0a8ddcb353ac6e2e0f2d7e7d03abd4275fe3c689d88960eb90b0dde4f177554d51a690f22a343932ecbc50a5d111849987 + languageName: node + linkType: hard + +"loose-envify@npm:^1.0.0": + version: 1.4.0 + resolution: "loose-envify@npm:1.4.0" + dependencies: + js-tokens: "npm:^3.0.0 || ^4.0.0" + bin: + loose-envify: cli.js + checksum: 10c0/655d110220983c1a4b9c0c679a2e8016d4b67f6e9c7b5435ff5979ecdb20d0813f4dec0a08674fcbdd4846a3f07edbb50a36811fd37930b94aaa0d9daceb017e + languageName: node + linkType: hard + +"lru-cache@npm:^5.1.1": + version: 5.1.1 + resolution: "lru-cache@npm:5.1.1" + dependencies: + yallist: "npm:^3.0.2" + checksum: 10c0/89b2ef2ef45f543011e38737b8a8622a2f8998cddf0e5437174ef8f1f70a8b9d14a918ab3e232cb3ba343b7abddffa667f0b59075b2b80e6b4d63c3de6127482 + languageName: node + linkType: hard + +"make-dir@npm:^2.1.0": + version: 2.1.0 + resolution: "make-dir@npm:2.1.0" + dependencies: + pify: "npm:^4.0.1" + semver: "npm:^5.6.0" + checksum: 10c0/ada869944d866229819735bee5548944caef560d7a8536ecbc6536edca28c72add47cc4f6fc39c54fb25d06b58da1f8994cf7d9df7dadea047064749efc085d8 + languageName: node + linkType: hard + +"math-intrinsics@npm:^1.1.0": + version: 1.1.0 + resolution: "math-intrinsics@npm:1.1.0" + checksum: 10c0/7579ff94e899e2f76ab64491d76cf606274c874d8f2af4a442c016bd85688927fcfca157ba6bf74b08e9439dc010b248ce05b96cc7c126a354c3bae7fcb48b7f + languageName: node + linkType: hard + +"minimalistic-assert@npm:^1.0.1": + version: 1.0.1 + resolution: "minimalistic-assert@npm:1.0.1" + checksum: 10c0/96730e5601cd31457f81a296f521eb56036e6f69133c0b18c13fe941109d53ad23a4204d946a0d638d7f3099482a0cec8c9bb6d642604612ce43ee536be3dddd + languageName: node + linkType: hard + +"minimatch@npm:^3.1.1": + version: 3.1.5 + resolution: "minimatch@npm:3.1.5" + dependencies: + brace-expansion: "npm:^1.1.7" + checksum: 10c0/2ecbdc0d33f07bddb0315a8b5afbcb761307a8778b48f0b312418ccbced99f104a2d17d8aca7573433c70e8ccd1c56823a441897a45e384ea76ef401a26ace70 + languageName: node + linkType: hard + +"minipass@npm:^7.0.4, minipass@npm:^7.1.2": + version: 7.1.3 + resolution: "minipass@npm:7.1.3" + checksum: 10c0/539da88daca16533211ea5a9ee98dc62ff5742f531f54640dd34429e621955e91cc280a91a776026264b7f9f6735947629f920944e9c1558369e8bf22eb33fbb + languageName: node + linkType: hard + +"minizlib@npm:^3.1.0": + version: 3.1.0 + resolution: "minizlib@npm:3.1.0" + dependencies: + minipass: "npm:^7.1.2" + checksum: 10c0/5aad75ab0090b8266069c9aabe582c021ae53eb33c6c691054a13a45db3b4f91a7fb1bd79151e6b4e9e9a86727b522527c0a06ec7d45206b745d54cd3097bcec + languageName: node + linkType: hard + +"ms@npm:^2.1.3": + version: 2.1.3 + resolution: "ms@npm:2.1.3" + checksum: 10c0/d924b57e7312b3b63ad21fc5b3dc0af5e78d61a1fc7cfb5457edaf26326bf62be5307cc87ffb6862ef1c2b33b0233cdb5d4f01c4c958cc0d660948b65a287a48 + languageName: node + linkType: hard + +"msgpackr-extract@npm:^3.0.2": + version: 3.0.7 + resolution: "msgpackr-extract@npm:3.0.7" + dependencies: + "@msgpackr-extract/msgpackr-extract-darwin-arm64": "npm:3.0.7" + "@msgpackr-extract/msgpackr-extract-darwin-x64": "npm:3.0.7" + "@msgpackr-extract/msgpackr-extract-linux-arm": "npm:3.0.7" + "@msgpackr-extract/msgpackr-extract-linux-arm64": "npm:3.0.7" + "@msgpackr-extract/msgpackr-extract-linux-x64": "npm:3.0.7" + "@msgpackr-extract/msgpackr-extract-win32-x64": "npm:3.0.7" + node-gyp: "npm:latest" + node-gyp-build-optional-packages: "npm:5.2.2" + dependenciesMeta: + "@msgpackr-extract/msgpackr-extract-darwin-arm64": + optional: true + "@msgpackr-extract/msgpackr-extract-darwin-x64": + optional: true + "@msgpackr-extract/msgpackr-extract-linux-arm": + optional: true + "@msgpackr-extract/msgpackr-extract-linux-arm64": + optional: true + "@msgpackr-extract/msgpackr-extract-linux-x64": + optional: true + "@msgpackr-extract/msgpackr-extract-win32-x64": + optional: true + bin: + download-msgpackr-prebuilds: bin/download-prebuilds.js + checksum: 10c0/60e392bd77afc92b954adfd3501703d58a9baae2bcafd894e47c92820ec2b4c20483c5b959c03f8802b8b579f596877510a9f9c0e8f486c9e3780ff1362e4a54 + languageName: node + linkType: hard + +"msgpackr@npm:^1.11.2": + version: 1.12.1 + resolution: "msgpackr@npm:1.12.1" + dependencies: + msgpackr-extract: "npm:^3.0.2" + dependenciesMeta: + msgpackr-extract: + optional: true + checksum: 10c0/145a6477ff46ad3154b999ad9f1d80070f50b01f5a12975aad683455fa8968f3e12503d8397a8828bc15fd297da9694fc7b8ae9f21d3df64f559caa10a3a4731 + languageName: node + linkType: hard + +"node-gyp-build-optional-packages@npm:5.2.2": + version: 5.2.2 + resolution: "node-gyp-build-optional-packages@npm:5.2.2" + dependencies: + detect-libc: "npm:^2.0.1" + bin: + node-gyp-build-optional-packages: bin.js + node-gyp-build-optional-packages-optional: optional.js + node-gyp-build-optional-packages-test: build-test.js + checksum: 10c0/c81128c6f91873381be178c5eddcbdf66a148a6a89a427ce2bcd457593ce69baf2a8662b6d22cac092d24aa9c43c230dec4e69b3a0da604503f4777cd77e282b + languageName: node + linkType: hard + +"node-gyp@npm:latest": + version: 13.1.0 + resolution: "node-gyp@npm:13.1.0" + dependencies: + env-paths: "npm:^2.2.0" + exponential-backoff: "npm:^3.1.1" + graceful-fs: "npm:^4.2.6" + nopt: "npm:^10.0.0" + proc-log: "npm:^7.0.0" + semver: "npm:^7.3.5" + tar: "npm:^7.5.7" + tinyglobby: "npm:^0.2.12" + undici: "npm:^8.4.1" + which: "npm:^7.0.0" + bin: + node-gyp: bin/node-gyp.js + checksum: 10c0/c6693e52e0e111b21f5cd8ff303b41b51f40338adcc79ac5c6a02399eba7039d50dc816dcafcc485870291a641f7cb75db8887a9bdd0de537fe635a3a81cba5b + languageName: node + linkType: hard + +"node-releases@npm:^2.0.64": + version: 2.0.65 + resolution: "node-releases@npm:2.0.65" + checksum: 10c0/80a1f49172b1ac7abee612e4ff4fd707763478a8ea0ffb38f428a925622b6bfe320a1103b30d76ae37df3a2544ada7a63c74ca578b19cc332298960bf4c826c4 + languageName: node + linkType: hard + +"nopt@npm:^10.0.0": + version: 10.0.1 + resolution: "nopt@npm:10.0.1" + dependencies: + abbrev: "npm:^5.0.0" + bin: + nopt: bin/nopt.js + checksum: 10c0/980d89257f9587f3e1f77877ddbf905d6aa3b738ec33e49a4fa1a059a0dd82eb28063982b150654a7ae9de386f2ead60e56172db7d37cf56de545f7392a2a26a + languageName: node + linkType: hard + +"normalize-path@npm:^3.0.0, normalize-path@npm:~3.0.0": + version: 3.0.0 + resolution: "normalize-path@npm:3.0.0" + checksum: 10c0/e008c8142bcc335b5e38cf0d63cfd39d6cf2d97480af9abdbe9a439221fd4d749763bab492a8ee708ce7a194bb00c9da6d0a115018672310850489137b3da046 + languageName: node + linkType: hard + +"nullthrows@npm:^1.1.1": + version: 1.1.1 + resolution: "nullthrows@npm:1.1.1" + checksum: 10c0/56f34bd7c3dcb3bd23481a277fa22918120459d3e9d95ca72976c72e9cac33a97483f0b95fc420e2eb546b9fe6db398273aba9a938650cdb8c98ee8f159dcb30 + languageName: node + linkType: hard + +"once@npm:^1.3.0": + version: 1.4.0 + resolution: "once@npm:1.4.0" + dependencies: + wrappy: "npm:1" + checksum: 10c0/5d48aca287dfefabd756621c5dfce5c91a549a93e9fdb7b8246bc4c4790aa2ec17b34a260530474635147aeb631a2dcc8b32c613df0675f96041cbb8244517d0 + languageName: node + linkType: hard + +"path-is-absolute@npm:^1.0.0": + version: 1.0.1 + resolution: "path-is-absolute@npm:1.0.1" + checksum: 10c0/127da03c82172a2a50099cddbf02510c1791fc2cc5f7713ddb613a56838db1e8168b121a920079d052e0936c23005562059756d653b7c544c53185efe53be078 + languageName: node + linkType: hard + +"path-parse@npm:^1.0.7": + version: 1.0.7 + resolution: "path-parse@npm:1.0.7" + checksum: 10c0/11ce261f9d294cc7a58d6a574b7f1b935842355ec66fba3c3fd79e0f036462eaf07d0aa95bb74ff432f9afef97ce1926c720988c6a7451d8a584930ae7de86e1 + languageName: node + linkType: hard + +"picocolors@npm:^1.1.1": + version: 1.1.1 + resolution: "picocolors@npm:1.1.1" + checksum: 10c0/e2e3e8170ab9d7c7421969adaa7e1b31434f789afb9b3f115f6b96d91945041ac3ceb02e9ec6fe6510ff036bcc0bf91e69a1772edc0b707e12b19c0f2d6bcf58 + languageName: node + linkType: hard + +"picomatch@npm:^2.0.4, picomatch@npm:^2.2.1": + version: 2.3.2 + resolution: "picomatch@npm:2.3.2" + checksum: 10c0/a554d1709e59be97d1acb9eaedbbc700a5c03dbd4579807baed95100b00420bc729335440ef15004ae2378984e2487a7c1cebd743cfdb72b6fa9ab69223c0d61 + languageName: node + linkType: hard + +"picomatch@npm:^4.0.4": + version: 4.0.7 + resolution: "picomatch@npm:4.0.7" + checksum: 10c0/beb6ae02c43ae44e84883b90830196d9046b1726ead292adcf7f57945e0bb0d992d68563d87e03b484b6f3c9a5c6defda7523477f047d7f0e663f126cc01787f + languageName: node + linkType: hard + +"pify@npm:^4.0.1": + version: 4.0.1 + resolution: "pify@npm:4.0.1" + checksum: 10c0/6f9d404b0d47a965437403c9b90eca8bb2536407f03de165940e62e72c8c8b75adda5516c6b9b23675a5877cc0bcac6bdfb0ef0e39414cd2476d5495da40e7cf + languageName: node + linkType: hard + +"possible-typed-array-names@npm:^1.0.0": + version: 1.1.0 + resolution: "possible-typed-array-names@npm:1.1.0" + checksum: 10c0/c810983414142071da1d644662ce4caebce890203eb2bc7bf119f37f3fe5796226e117e6cca146b521921fa6531072674174a3325066ac66fce089a53e1e5196 + languageName: node + linkType: hard + +"proc-log@npm:^7.0.0": + version: 7.0.0 + resolution: "proc-log@npm:7.0.0" + checksum: 10c0/b89c2d862604f35fec795477b0c7e376feab3ba0d4f4d291c4e959567442697cf451ac557d0623c1cc38af45a78128b983410f397a10c5d3a67f76c33de4754b + languageName: node + linkType: hard + +"react-refresh@npm:^0.14.0": + version: 0.14.2 + resolution: "react-refresh@npm:0.14.2" + checksum: 10c0/875b72ef56b147a131e33f2abd6ec059d1989854b3ff438898e4f9310bfcc73acff709445b7ba843318a953cb9424bcc2c05af2b3d80011cee28f25aef3e2ebb + languageName: node + linkType: hard + +"readdirp@npm:~3.6.0": + version: 3.6.0 + resolution: "readdirp@npm:3.6.0" + dependencies: + picomatch: "npm:^2.2.1" + checksum: 10c0/6fa848cf63d1b82ab4e985f4cf72bd55b7dcfd8e0a376905804e48c3634b7e749170940ba77b32804d5fe93b3cc521aa95a8d7e7d725f830da6d93f3669ce66b + languageName: node + linkType: hard + +"regenerate-unicode-properties@npm:^10.3.0": + version: 10.3.0 + resolution: "regenerate-unicode-properties@npm:10.3.0" + dependencies: + regenerate: "npm:^1.4.2" + checksum: 10c0/3408a81fc84af7222c5b18886854c0d47e4ed474d94eb5fc37c3f2b11596f2200662dc6573666f651114144407c045ae062ebe2a91d80ed5c348786b1d705264 + languageName: node + linkType: hard + +"regenerate@npm:^1.4.2, regenerate@npm:^1.5.0": + version: 1.5.0 + resolution: "regenerate@npm:1.5.0" + checksum: 10c0/b2627a1fcb66474dcde8c60a243dd1da6d416fbd887d8346f81b8732df625751924d48175eb0982b555d5f8f8de45bc9537d0572e9190058c61e87aa2e546daf + languageName: node + linkType: hard + +"regexpu-core@npm:^6.5.4": + version: 6.5.4 + resolution: "regexpu-core@npm:6.5.4" + dependencies: + regenerate: "npm:^1.5.0" + regenerate-unicode-properties: "npm:^10.3.0" + regjsgen: "npm:^0.8.0" + regjsparser: "npm:^0.14.0" + unicode-match-property-ecmascript: "npm:^2.0.0" + unicode-match-property-value-ecmascript: "npm:^2.2.1" + checksum: 10c0/2b067efb3a25d8e01d75b3932ddaa6fdde499da76a30de880bdfffa9090d95ec0557a971f987c2b44be385ab861393fa5f6893087235210bf602d3d7c523f9a5 + languageName: node + linkType: hard + +"regjsgen@npm:^0.8.0": + version: 0.8.0 + resolution: "regjsgen@npm:0.8.0" + checksum: 10c0/44f526c4fdbf0b29286101a282189e4dbb303f4013cf3fea058668d96d113b9180d3d03d1e13f6d4cbde38b7728bf951aecd9dc199938c080093a9a6f0d7a6bd + languageName: node + linkType: hard + +"regjsparser@npm:^0.14.0": + version: 0.14.1 + resolution: "regjsparser@npm:0.14.1" + dependencies: + jsesc: "npm:~3.1.0" + bin: + regjsparser: bin/parser + checksum: 10c0/92d6b4bb214657115214ebfe729b0b9f8cfde17e982487cd6d769541cda4ca01ee23d365aae99f80ef1491f5a4f408dd8e66f2f5f8df07eaa5b055924fcc69ec + languageName: node + linkType: hard + +"require-directory@npm:^2.1.1": + version: 2.1.1 + resolution: "require-directory@npm:2.1.1" + checksum: 10c0/83aa76a7bc1531f68d92c75a2ca2f54f1b01463cb566cf3fbc787d0de8be30c9dbc211d1d46be3497dac5785fe296f2dd11d531945ac29730643357978966e99 + languageName: node + linkType: hard + +"resolve@npm:^1.22.11": + version: 1.22.14 + resolution: "resolve@npm:1.22.14" + dependencies: + es-errors: "npm:^1.3.0" + is-core-module: "npm:^2.18.0" + path-parse: "npm:^1.0.7" + supports-preserve-symlinks-flag: "npm:^1.0.0" + bin: + resolve: bin/resolve + checksum: 10c0/d661ad8d65baf92b1adff295f5992b085ffbf85136de98f32d8a5c9bade56ff4f1e8babd8f0bd352158aac6cd58e89975565203603b45937f06b5954369b4fe2 + languageName: node + linkType: hard + +"resolve@patch:resolve@npm%3A^1.22.11#optional!builtin": + version: 1.22.14 + resolution: "resolve@patch:resolve@npm%3A1.22.14#optional!builtin::version=1.22.14&hash=c3c19d" + dependencies: + es-errors: "npm:^1.3.0" + is-core-module: "npm:^2.18.0" + path-parse: "npm:^1.0.7" + supports-preserve-symlinks-flag: "npm:^1.0.0" + bin: + resolve: bin/resolve + checksum: 10c0/1e098939ebbdfe6ce355ce60523f2219d6a7072534f9deece27016acda0905768fc578d107afef45ec3b5ff8ccbdc8722c16b09056edd86b210a7df24e5ab198 + languageName: node + linkType: hard + +"safe-regex-test@npm:^1.1.0": + version: 1.1.0 + resolution: "safe-regex-test@npm:1.1.0" + dependencies: + call-bound: "npm:^1.0.2" + es-errors: "npm:^1.3.0" + is-regex: "npm:^1.2.1" + checksum: 10c0/f2c25281bbe5d39cddbbce7f86fca5ea9b3ce3354ea6cd7c81c31b006a5a9fff4286acc5450a3b9122c56c33eba69c56b9131ad751457b2b4a585825e6a10665 + languageName: node + linkType: hard + +"semver@npm:^5.6.0": + version: 5.7.3 + resolution: "semver@npm:5.7.3" + bin: + semver: bin/semver + checksum: 10c0/46308a549dd9d9b9dd2b89c47acce5905e81d456d1e105880c07f31a93469fcd4416c9b6cf437cbcad22093ba8371bca2ad6c4a874c6f073af3500645f236979 + languageName: node + linkType: hard + +"semver@npm:^6.3.1": + version: 6.3.2 + resolution: "semver@npm:6.3.2" + bin: + semver: bin/semver.js + checksum: 10c0/210073b9a7ca6e854ae003d2a735937ac9bce09b34975f28e1dd4c9fce41c1ebfa11aa2babf25ed72c1c79037db39ef7cfba441d05888d558745f47becc14c8f + languageName: node + linkType: hard + +"semver@npm:^7.3.5": + version: 7.8.6 + resolution: "semver@npm:7.8.6" + bin: + semver: bin/semver.js + checksum: 10c0/bf0a4d16eb067e5391323649e46b4a268644d7f8ee88e37c7668d35e861ec145b6e7df576d898007fc0d9a2cedcbc33f71460aa3bbea18eedfa5af58c064d7fe + languageName: node + linkType: hard + +"set-function-length@npm:^1.2.2": + version: 1.2.2 + resolution: "set-function-length@npm:1.2.2" + dependencies: + define-data-property: "npm:^1.1.4" + es-errors: "npm:^1.3.0" + function-bind: "npm:^1.1.2" + get-intrinsic: "npm:^1.2.4" + gopd: "npm:^1.0.1" + has-property-descriptors: "npm:^1.0.2" + checksum: 10c0/82850e62f412a258b71e123d4ed3873fa9377c216809551192bb6769329340176f109c2eeae8c22a8d386c76739855f78e8716515c818bcaef384b51110f0f3c + languageName: node + linkType: hard + +"slash@npm:^2.0.0": + version: 2.0.0 + resolution: "slash@npm:2.0.0" + checksum: 10c0/f83dbd3cb62c41bb8fcbbc6bf5473f3234b97fa1d008f571710a9d3757a28c7169e1811cad1554ccb1cc531460b3d221c9a7b37f549398d9a30707f0a5af9193 + languageName: node + linkType: hard + +"string-width@npm:^4.1.0, string-width@npm:^4.2.0, string-width@npm:^4.2.3": + version: 4.2.3 + resolution: "string-width@npm:4.2.3" + dependencies: + emoji-regex: "npm:^8.0.0" + is-fullwidth-code-point: "npm:^3.0.0" + strip-ansi: "npm:^6.0.1" + checksum: 10c0/1e525e92e5eae0afd7454086eed9c818ee84374bb80328fc41217ae72ff5f065ef1c9d7f72da41de40c75fa8bb3dee63d92373fd492c84260a552c636392a47b + languageName: node + linkType: hard + +"strip-ansi@npm:^6.0.0, strip-ansi@npm:^6.0.1": + version: 6.0.1 + resolution: "strip-ansi@npm:6.0.1" + dependencies: + ansi-regex: "npm:^5.0.1" + checksum: 10c0/1ae5f212a126fe5b167707f716942490e3933085a5ff6c008ab97ab2f272c8025d3aa218b7bd6ab25729ca20cc81cddb252102f8751e13482a5199e873680952 + languageName: node + linkType: hard + +"supports-preserve-symlinks-flag@npm:^1.0.0": + version: 1.0.0 + resolution: "supports-preserve-symlinks-flag@npm:1.0.0" + checksum: 10c0/6c4032340701a9950865f7ae8ef38578d8d7053f5e10518076e6554a9381fa91bd9c6850193695c141f32b21f979c985db07265a758867bac95de05f7d8aeb39 + languageName: node + linkType: hard + +"tar@npm:^7.5.7": + version: 7.5.23 + resolution: "tar@npm:7.5.23" + dependencies: + "@isaacs/fs-minipass": "npm:^4.0.0" + chownr: "npm:^3.0.0" + minipass: "npm:^7.1.2" + minizlib: "npm:^3.1.0" + yallist: "npm:^5.0.0" + checksum: 10c0/41324dc475f655e6a322729dacac14e3114ed4b18cba350be5d1eb52b1aa2794a1c78c2a5b7f49d3d15f53c058158168121eaf6c5d2f75a0a9565b344bf3a18a + languageName: node + linkType: hard + +"tinyglobby@npm:^0.2.12, tinyglobby@npm:^0.2.15": + version: 0.2.17 + resolution: "tinyglobby@npm:0.2.17" + dependencies: + fdir: "npm:^6.5.0" + picomatch: "npm:^4.0.4" + checksum: 10c0/7f7bb0f197c88bc4b20c231e0deca4240ca3bf313a88f5a7fee93a872b84966a4d50220947c0455ad07a60b3b360961c5b7fd979222aeb716a9f99b412002e4c + languageName: node + linkType: hard + +"to-regex-range@npm:^5.0.1": + version: 5.0.1 + resolution: "to-regex-range@npm:5.0.1" + dependencies: + is-number: "npm:^7.0.0" + checksum: 10c0/487988b0a19c654ff3e1961b87f471702e708fa8a8dd02a298ef16da7206692e8552a0250e8b3e8759270f62e9d8314616f6da274734d3b558b1fc7b7724e892 + languageName: node + linkType: hard + +"tslib@npm:^2.4.0": + version: 2.9.1 + resolution: "tslib@npm:2.9.1" + checksum: 10c0/8ff46e7a4d19fa62c23483c89cf5ccc3906e742ef6e6d60bd3826b686143b300b4f6f04161cc1cf31a6b11fe70e1058ae4d4e4a108b5c68326d469684736a83c + languageName: node + linkType: hard + +"undici@npm:^8.4.1": + version: 8.12.4 + resolution: "undici@npm:8.12.4" + checksum: 10c0/2a83590ce3347ca4e8fb83917bd7ad1d0bcb72ecb6d1a5066f01a89b4941becac569412aa27d7318119ea1a20d217018cce535f8eeed3c1b307d87426f96cfe3 + languageName: node + linkType: hard + +"unicode-canonical-property-names-ecmascript@npm:^2.0.0": + version: 2.0.1 + resolution: "unicode-canonical-property-names-ecmascript@npm:2.0.1" + checksum: 10c0/f83bc492fdbe662860795ef37a85910944df7310cac91bd778f1c19ebc911e8b9cde84e703de631e5a2fcca3905e39896f8fc5fc6a44ddaf7f4aff1cda24f381 + languageName: node + linkType: hard + +"unicode-match-property-ecmascript@npm:^2.0.0": + version: 2.0.0 + resolution: "unicode-match-property-ecmascript@npm:2.0.0" + dependencies: + unicode-canonical-property-names-ecmascript: "npm:^2.0.0" + unicode-property-aliases-ecmascript: "npm:^2.0.0" + checksum: 10c0/4d05252cecaf5c8e36d78dc5332e03b334c6242faf7cf16b3658525441386c0a03b5f603d42cbec0f09bb63b9fd25c9b3b09667aee75463cac3efadae2cd17ec + languageName: node + linkType: hard + +"unicode-match-property-value-ecmascript@npm:^2.2.1": + version: 2.2.1 + resolution: "unicode-match-property-value-ecmascript@npm:2.2.1" + checksum: 10c0/93acd1ad9496b600e5379d1aaca154cf551c5d6d4a0aefaf0984fc2e6288e99220adbeb82c935cde461457fb6af0264a1774b8dfd4d9a9e31548df3352a4194d + languageName: node + linkType: hard + +"unicode-property-aliases-ecmascript@npm:^2.0.0": + version: 2.2.0 + resolution: "unicode-property-aliases-ecmascript@npm:2.2.0" + checksum: 10c0/b338529831c988ac696f2bdbcd4579d1c5cc844b24eda7269973c457fa81989bdb49a366af37a448eb1a60f1dae89559ea2a5854db2797e972a0162eee0778c6 + languageName: node + linkType: hard + +"update-browserslist-db@npm:^1.4.0": + version: 1.4.0 + resolution: "update-browserslist-db@npm:1.4.0" + dependencies: + escalade: "npm:^3.2.0" + picocolors: "npm:^1.1.1" + peerDependencies: + browserslist: ">= 4.21.0" + bin: + update-browserslist-db: cli.js + checksum: 10c0/9ae7bb9d6c830e338e9a5b8e7d197e909467b8906df0cfcfe573da10fc96e4d5756260c3597efb00f7b5f515de5a613051b77b0dc8688d80e4c1b5c6b7ad4595 + languageName: node + linkType: hard + +"util@npm:^0.12.5": + version: 0.12.5 + resolution: "util@npm:0.12.5" + dependencies: + inherits: "npm:^2.0.3" + is-arguments: "npm:^1.0.4" + is-generator-function: "npm:^1.0.7" + is-typed-array: "npm:^1.1.3" + which-typed-array: "npm:^1.1.2" + checksum: 10c0/c27054de2cea2229a66c09522d0fa1415fb12d861d08523a8846bf2e4cbf0079d4c3f725f09dcb87493549bcbf05f5798dce1688b53c6c17201a45759e7253f3 + languageName: node + linkType: hard + +"which-typed-array@npm:^1.1.16, which-typed-array@npm:^1.1.2": + version: 1.1.24 + resolution: "which-typed-array@npm:1.1.24" + dependencies: + available-typed-arrays: "npm:^1.0.7" + call-bind: "npm:^1.0.9" + call-bound: "npm:^1.0.4" + for-each: "npm:^0.3.5" + get-proto: "npm:^1.0.1" + gopd: "npm:^1.2.0" + has-tostringtag: "npm:^1.0.2" + checksum: 10c0/26e66a1828fa60b989515178c58f075dc4b53c9d79e085e8615221eee6c32e5b224ea4b0a74338540bcdbf4986f8bd08d5fb4b2a7657d61e7960efd89a85b904 + languageName: node + linkType: hard + +"which@npm:^7.0.0": + version: 7.0.0 + resolution: "which@npm:7.0.0" + dependencies: + isexe: "npm:^4.0.0" + bin: + node-which: bin/which.js + checksum: 10c0/ca0b54f198f78bbc4b7c02e34bda8d335cb352e0adb4cbca1c37b1a957af3a879a82c4c27ca6525bc942f548d8b64f816ef6528360af9f3de55ffb9b979b620d + languageName: node + linkType: hard + +"wrap-ansi@npm:^7.0.0": + version: 7.0.0 + resolution: "wrap-ansi@npm:7.0.0" + dependencies: + ansi-styles: "npm:^4.0.0" + string-width: "npm:^4.1.0" + strip-ansi: "npm:^6.0.0" + checksum: 10c0/d15fc12c11e4cbc4044a552129ebc75ee3f57aa9c1958373a4db0292d72282f54373b536103987a4a7594db1ef6a4f10acf92978f79b98c49306a4b58c77d4da + languageName: node + linkType: hard + +"wrappy@npm:1": + version: 1.0.2 + resolution: "wrappy@npm:1.0.2" + checksum: 10c0/56fece1a4018c6a6c8e28fbc88c87e0fbf4ea8fd64fc6c63b18f4acc4bd13e0ad2515189786dd2c30d3eec9663d70f4ecf699330002f8ccb547e4a18231fc9f0 + languageName: node + linkType: hard + +"y18n@npm:^5.0.5": + version: 5.0.8 + resolution: "y18n@npm:5.0.8" + checksum: 10c0/4df2842c36e468590c3691c894bc9cdbac41f520566e76e24f59401ba7d8b4811eb1e34524d57e54bc6d864bcb66baab7ffd9ca42bf1eda596618f9162b91249 + languageName: node + linkType: hard + +"yallist@npm:^3.0.2": + version: 3.1.1 + resolution: "yallist@npm:3.1.1" + checksum: 10c0/c66a5c46bc89af1625476f7f0f2ec3653c1a1791d2f9407cfb4c2ba812a1e1c9941416d71ba9719876530e3340a99925f697142989371b72d93b9ee628afd8c1 + languageName: node + linkType: hard + +"yallist@npm:^5.0.0": + version: 5.0.0 + resolution: "yallist@npm:5.0.0" + checksum: 10c0/a499c81ce6d4a1d260d4ea0f6d49ab4da09681e32c3f0472dee16667ed69d01dae63a3b81745a24bd78476ec4fcf856114cb4896ace738e01da34b2c42235416 + languageName: node + linkType: hard + +"yargs-parser@npm:^21.1.1": + version: 21.1.1 + resolution: "yargs-parser@npm:21.1.1" + checksum: 10c0/f84b5e48169479d2f402239c59f084cfd1c3acc197a05c59b98bab067452e6b3ea46d4dd8ba2985ba7b3d32a343d77df0debd6b343e5dae3da2aab2cdf5886b2 + languageName: node + linkType: hard + +"yargs@npm:^17.6.2": + version: 17.7.3 + resolution: "yargs@npm:17.7.3" + dependencies: + cliui: "npm:^8.0.1" + escalade: "npm:^3.1.1" + get-caller-file: "npm:^2.0.5" + require-directory: "npm:^2.1.1" + string-width: "npm:^4.2.3" + y18n: "npm:^5.0.5" + yargs-parser: "npm:^21.1.1" + checksum: 10c0/7a28572f7e785a57886e34fdbddb9b28756dec552e1453d5f6e7cdd00ad8721a4e8c4321d33683f5e61cacb36ad43258adbb48396b71ec4ed14abee0fc0d0c1f + languageName: node + linkType: hard