From a6aa89e5c529669fc5ae5dda72ffd7d8e84d16a0 Mon Sep 17 00:00:00 2001 From: Kirill Zhumarin Date: Sat, 29 Aug 2026 08:29:09 +0000 Subject: [PATCH] feat: add WebAssembly module --- .github/workflows/ci.yml | 18 + .gitignore | 3 + CMakeLists.txt | 83 ++- README.md | 127 +++++ package.json | 35 ++ pnpm-lock.yaml | 1035 ++++++++++++++++++++++++++++++++++++++ pnpm-workspace.yaml | 2 + src/index.ts | 175 +++++++ test/index.test.ts | 55 ++ tools/build_wasm.sh | 10 + tsconfig.json | 17 + wasm/Ptr89Wasm.cpp | 108 ++++ wasm/Ptr89Wasm.h | 47 ++ wasm/main.cpp | 32 ++ 14 files changed, 1728 insertions(+), 19 deletions(-) create mode 100644 package.json create mode 100644 pnpm-lock.yaml create mode 100644 pnpm-workspace.yaml create mode 100644 src/index.ts create mode 100644 test/index.test.ts create mode 100755 tools/build_wasm.sh create mode 100644 tsconfig.json create mode 100644 wasm/Ptr89Wasm.cpp create mode 100644 wasm/Ptr89Wasm.h create mode 100644 wasm/main.cpp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f65783..9312270 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,7 @@ on: permissions: contents: write + id-token: write jobs: build: @@ -26,6 +27,23 @@ jobs: tools/build_win.sh tools/build_tar.sh + - uses: mymindstorm/setup-emsdk@v14 + - uses: actions/setup-node@v4 + with: + node-version: '24.x' + registry-url: 'https://registry.npmjs.org' + - run: npm install --global corepack@latest npm@latest + - run: corepack enable pnpm + - run: pnpm install --frozen-lockfile + - run: emcmake cmake -B build-wasm -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS:BOOL=TRUE + - run: cmake --build build-wasm + - run: pnpm run build + - run: pnpm test + - if: github.event_name == 'release' + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - uses: softprops/action-gh-release@v1 with: token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.gitignore b/.gitignore index c340f32..65638de 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ .idea build build-win +build-wasm .cache +dist +node_modules *.vkp *.ini *.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index bb659cb..2d870dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,28 +14,73 @@ add_subdirectory(third_party/spdlog EXCLUDE_FROM_ALL) set(LIB_SRC lib/src/Arch.cpp lib/src/Pattern.cpp lib/src/Tokenizer.cpp lib/src/Parser.cpp lib/src/utils.cpp) -add_executable(ptr89 src/main.cpp ${LIB_SRC}) -target_link_libraries(ptr89 PRIVATE spdlog::spdlog) -target_precompile_headers(ptr89 PRIVATE ) -install(TARGETS ptr89) +add_library(ptr89-lib STATIC ${LIB_SRC}) +set_target_properties(ptr89-lib PROPERTIES OUTPUT_NAME ptr89) +target_link_libraries(ptr89-lib PUBLIC spdlog::spdlog) -if (MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS) +if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + add_executable(ptr89_wasm wasm/main.cpp wasm/Ptr89Wasm.cpp) + set_target_properties(ptr89_wasm PROPERTIES + INTERPROCEDURAL_OPTIMIZATION TRUE + SUFFIX ".js" + ) + target_link_libraries(ptr89_wasm PRIVATE ptr89-lib) + target_compile_options(ptr89-lib PRIVATE -Oz -fwasm-exceptions) + target_compile_options(ptr89_wasm PRIVATE -Oz -fwasm-exceptions) + target_compile_options(spdlog PRIVATE -Oz -fwasm-exceptions) + target_link_options(ptr89_wasm PRIVATE + -sWASM=1 + -sSTRICT=1 + -sEXPORT_ES6=1 + -sMODULARIZE + -sINVOKE_RUN=0 + -sSINGLE_FILE=0 + -sASSERTIONS=0 + -sEXIT_RUNTIME=1 + -sFILESYSTEM=0 + -sDYNAMIC_EXECUTION=0 + -sSTACK_OVERFLOW_CHECK=0 + -sALLOW_MEMORY_GROWTH + -sENVIRONMENT=node,web,worker + -sEXPORTED_FUNCTIONS=['_malloc','_free'] + -sEXPORTED_RUNTIME_METHODS=['HEAPU8','getExceptionMessage','decrementExceptionRefcount'] + -sMALLOC=emmalloc + -fwasm-exceptions + --bind + --emit-tsd "$/ptr89_wasm.d.ts" + ) + + if (BUILD_TESTS) + enable_testing() + find_program(PNPM_EXECUTABLE pnpm REQUIRED) + add_test(NAME wasm-test COMMAND ${PNPM_EXECUTABLE} test) + set_tests_properties(wasm-test PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + endif() else() - if (BUILD_STATIC) - target_link_options(ptr89 PUBLIC -static -static-libgcc -static-libstdc++) + add_executable(ptr89 src/main.cpp) + target_link_libraries(ptr89 PRIVATE ptr89-lib) + target_precompile_headers(ptr89 PRIVATE ) + install(TARGETS ptr89) + + if (MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + else() + if (BUILD_STATIC) + target_link_options(ptr89 PUBLIC -static -static-libgcc -static-libstdc++) + endif() + + if (CMAKE_BUILD_TYPE MATCHES "Release") + target_link_options(ptr89 PUBLIC -s) + endif() + + target_compile_options(ptr89 PRIVATE -Wall -Wextra -Werror -O3) + target_compile_options(ptr89-lib PRIVATE -Wall -Wextra -Werror -O3) endif() - if (CMAKE_BUILD_TYPE MATCHES "Release") - target_link_options(ptr89 PUBLIC -s) + if (BUILD_TESTS) + enable_testing() + add_executable(ptr89-tests src/tests.cpp) + target_link_libraries(ptr89-tests PRIVATE ptr89-lib) + add_test(NAME test COMMAND ptr89-tests) endif() - - target_compile_options(ptr89 PUBLIC -Wall -Wextra -Werror -O3) -endif() - -if (BUILD_TESTS) - enable_testing() - add_executable(ptr89-tests src/tests.cpp ${LIB_SRC}) - target_link_libraries(ptr89-tests PRIVATE spdlog::spdlog) - add_test(NAME test COMMAND ptr89-tests) endif() diff --git a/README.md b/README.md index 833047e..3570731 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,133 @@ Search done in 143 ms ptr89 -f EL71v45.bin --from-ini ELKA.ini > swilib.vkp ``` +# JAVASCRIPT MODULE + +[![NPM Version](https://img.shields.io/npm/v/%40sie-js%2Fptr89)](https://www.npmjs.com/package/@sie-js/ptr89) + +Install the package with pnpm: + +```bash +pnpm add @sie-js/ptr89 +``` + +## Example + +```ts +import { Ptr89 } from "@sie-js/ptr89"; + +const ptr89 = new Ptr89(); +await ptr89.open(fullflash, { arch: "c166" }); + +const matches = ptr89.find("LDR{ DB00 }", 100); +const xrefs = ptr89.findXRefs(0x9A9332, 100); + +ptr89.close(); +``` + +## API + +### `new Ptr89()` + +Creates a pattern finder. Call `open()` before searching. + +### `open(data, options?)` + +```ts +open(data: Uint8Array, options?: { + arch?: "arm" | "c166", + base?: number, + align?: number, +}): Promise; +``` + +Copies a fullflash into WebAssembly memory. The input buffer is no longer +needed after the promise resolves. Calling `open()` again replaces the current +fullflash. Node.js `Buffer` values can be passed directly because `Buffer` +extends `Uint8Array`. + +- `arch` selects the instruction decoder. Default: `"arm"`. +- `base` sets the load address. The ARM default is `0xA0000000`. For C166 it is + calculated as `0x1000000 - data.byteLength`. +- `align` sets the search alignment in bytes. Default: `1`. + +### `find(pattern, limit?)` + +```ts +find(pattern: string, limit?: number): PatternSearchResult[]; +``` + +Finds one pattern in the opened fullflash. The default limit is `100`; a limit +of `0` disables it. The return value has the same fields and type names as CLI +JSON output: + +```ts +type PatternSearchResult = { + type: "offset" | "pointer" | "reference" | "branch" | "static_value"; + address: number; + offset: number; + value: number; +}; +``` + +### `findXRefs(address, limit?)` + +```ts +findXRefs(address: number, limit?: number): XRefSearchResult[]; +``` + +Finds branches, decoded references and stored pointers to a 32-bit address. +The default limit is `100`; a limit of `0` disables it. + +```ts +type XRefSearchResult = { + type: "pointer" | "reference" | "branch"; + address: number; + offset: number; +}; +``` + +### `setDebug(enabled)` + +```ts +setDebug(enabled: boolean): void; +``` + +Enables or disables decoder and pattern-matching logs from the WebAssembly +module. + +### `close()` + +```ts +close(): void; +``` + +Releases the copied fullflash and the underlying Embind object. Calling it +more than once is safe. + +### `prettify(pattern)` + +```ts +prettify(pattern: string): Promise; +``` + +Parses a pattern and returns its normalized representation. Invalid patterns +reject the promise with a syntax error. + +All addresses and offsets are unsigned 32-bit numbers represented as JavaScript +`number` values. + +## Building from sources + +Build the WebAssembly module from sources: + +```bash +pnpm run build:wasm +``` + +The build produces `ptr89_wasm.js`, `ptr89_wasm.wasm` and `ptr89_wasm.d.ts` +in `build-wasm/`. + # Pattern syntax Syntax is fully compatible with WinHex, Smelter and Ghidra SRE patterns. diff --git a/package.json b/package.json new file mode 100644 index 0000000..de0190c --- /dev/null +++ b/package.json @@ -0,0 +1,35 @@ +{ + "name": "@sie-js/ptr89", + "version": "1.0.4", + "description": "ARM/THUMB/C166 binary pattern finder", + "type": "module", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "tsc", + "build:wasm": "tools/build_wasm.sh", + "test": "vitest run", + "test:watch": "vitest" + }, + "files": [ + "dist/*", + "build-wasm/*.js", + "build-wasm/*.wasm", + "build-wasm/*.d.ts" + ], + "imports": { + "#build/*": "./build-wasm/*" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/siemens-mobile-hacks/ptr89.git" + }, + "author": "Siemens Mobile Hackers", + "license": "MIT", + "packageManager": "pnpm@11.3.0", + "devDependencies": { + "@types/node": "^24.10.0", + "typescript": "^5.9.3", + "vitest": "^3.2.6" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..ee4049e --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,1035 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + devDependencies: + '@types/node': + specifier: ^24.10.0 + version: 24.13.3 + typescript: + specifier: ^5.9.3 + version: 5.9.3 + vitest: + specifier: ^3.2.6 + version: 3.2.7(@types/node@24.13.3) + +packages: + + '@esbuild/aix-ppc64@0.28.2': + resolution: {integrity: sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.28.2': + resolution: {integrity: sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.28.2': + resolution: {integrity: sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.28.2': + resolution: {integrity: sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.28.2': + resolution: {integrity: sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.28.2': + resolution: {integrity: sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.28.2': + resolution: {integrity: sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.28.2': + resolution: {integrity: sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.28.2': + resolution: {integrity: sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.28.2': + resolution: {integrity: sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.28.2': + resolution: {integrity: sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.28.2': + resolution: {integrity: sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.28.2': + resolution: {integrity: sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.28.2': + resolution: {integrity: sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.28.2': + resolution: {integrity: sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.28.2': + resolution: {integrity: sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.28.2': + resolution: {integrity: sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.28.2': + resolution: {integrity: sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.28.2': + resolution: {integrity: sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.28.2': + resolution: {integrity: sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.28.2': + resolution: {integrity: sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.28.2': + resolution: {integrity: sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.28.2': + resolution: {integrity: sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.28.2': + resolution: {integrity: sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.28.2': + resolution: {integrity: sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.28.2': + resolution: {integrity: sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + '@jridgewell/sourcemap-codec@1.6.0': + resolution: {integrity: sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==} + + '@napi-rs/lzma-linux-x64-gnu@1.5.1': + resolution: {integrity: sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==} + engines: {node: ^22.20 || ^24.12 || >=25} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@rollup/rollup-android-arm-eabi@4.63.1': + resolution: {integrity: sha512-UZ8sUxPTiHWYX9QNdJedb1kDZSpS1t/VPWBWGSgqHNi9w3Cu6IXvu2mzbhiTiPvtrqgTQJ+zqiAq2iPIPilpaQ==} + cpu: [arm] + os: [android] + + '@rollup/rollup-android-arm64@4.63.1': + resolution: {integrity: sha512-cQ4nFQABN5cDvDpbvJ7bMStCpnaVxynZrRMfUJYgxcIk9Sh54FIO1vtfkg0B69REjER77ioZ/ov+eAApx/KmLQ==} + cpu: [arm64] + os: [android] + + '@rollup/rollup-darwin-arm64@4.63.1': + resolution: {integrity: sha512-FQNqd1lRy/0QhDk3xeRIkSBiCpXCiDnZO3YLVdcDKN1UBiKToNftCzcXYNLshmPDUMlu2TdeS8tGcsU6f3YF1Q==} + cpu: [arm64] + os: [darwin] + + '@rollup/rollup-darwin-x64@4.63.1': + resolution: {integrity: sha512-pvD16V939D3CloK0+qikpGaxiPrDUXTe7Y5cWOMkMSy7m1cawa8EGy/kXYi/G/cKAC4HDAbSnzCIk1WmsoOKXg==} + cpu: [x64] + os: [darwin] + + '@rollup/rollup-freebsd-arm64@4.63.1': + resolution: {integrity: sha512-pcFGeL2345VwdTnJhA6zLbew+YgWB0qBG2+dMtXjCicf6+rm6kO6cOoh5VnTe0ZMrMRgRyuHmCJxZWrIdzYuOw==} + cpu: [arm64] + os: [freebsd] + + '@rollup/rollup-freebsd-x64@4.63.1': + resolution: {integrity: sha512-mRJlqSRulVzcKq/LKA6ICSIc3K/l4fzlVn/gePn2nXIHy8seRi5z/eeRE0d/XMBxcMldiXtQTSpRj0tkkC3g8Q==} + cpu: [x64] + os: [freebsd] + + '@rollup/rollup-linux-arm-gnueabihf@4.63.1': + resolution: {integrity: sha512-YDUNvVM85TI3g/1OpnqKP1h4NeW/j64DfWMf+G3M809xNk1bJSnpFp4sh83NpmVE5DXnkh8ULor4LTVZKoYLHw==} + cpu: [arm] + os: [linux] + libc: [glibc] + + '@rollup/rollup-linux-arm-musleabihf@4.63.1': + resolution: {integrity: sha512-7Mcn71p9ZuQFAj+h+dhQXy/yeLePRS2yKRnmW1DijA9thKO5qap0GNOIQK4yQ6iP3SU0Mrb/yWo8h8vgRba8lw==} + cpu: [arm] + os: [linux] + libc: [musl] + + '@rollup/rollup-linux-arm64-gnu@4.63.1': + resolution: {integrity: sha512-4YiLQTX6U4CSl0L9cluep9A9W6UmTfqBDc2/CH6wlu54pl4E7Jn3cOD8oxzvBDEGk/JMKgJ47C8g+radF7mwvg==} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@rollup/rollup-linux-arm64-musl@4.63.1': + resolution: {integrity: sha512-2ra8F7w8OquwZN9z2/fKFnli69wa8PLwaVzRMIPGb13ByMJwC28Fbp8YcVGoUhlYMTt7j5j9bNgpysrN2UM+vw==} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@rollup/rollup-linux-loong64-gnu@4.63.1': + resolution: {integrity: sha512-Sy20ncyhjmBP0Ml+UvQbimjlk6VFgjW5uNP+qqwHB00mTE8Bl2C1TuHTlRwK2YoXeZbee5lP2XevBWVkAQAtSQ==} + cpu: [loong64] + os: [linux] + libc: [glibc] + + '@rollup/rollup-linux-loong64-musl@4.63.1': + resolution: {integrity: sha512-noITLp8oNjYliPnGWmLyelIHwULGqbHloQHGw1rtxbWhTuWooRpnZarZQJ1y9EUC4szuCusCc+HEpUtxpIwYvA==} + cpu: [loong64] + os: [linux] + libc: [musl] + + '@rollup/rollup-linux-ppc64-gnu@4.63.1': + resolution: {integrity: sha512-hlxxXd+F1mWiAcaFR7Sv9ZQT6m6UfI8+Vy/kFJzztq2pDMU/0wZ9sish0iszNZvsQDo8Gc0i5yuFEOz5dDf6fA==} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@rollup/rollup-linux-ppc64-musl@4.63.1': + resolution: {integrity: sha512-EF7OpqQTQ/BvGqLzUi4rEHuagCV9MugAUXSHemwPW5vxZ75RR+jxO/2j95Ph2dalMpFHSVECjRoioHZgA9zOYA==} + cpu: [ppc64] + os: [linux] + libc: [musl] + + '@rollup/rollup-linux-riscv64-gnu@4.63.1': + resolution: {integrity: sha512-wQO3JesW9PRkwlabQ27y7sPfVOOTLRG73I4F2UYHG5PXun3J9U3y+b7ezVKSYbsvSKGQ1k1cq8Qlun4C9kLt3w==} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@rollup/rollup-linux-riscv64-musl@4.63.1': + resolution: {integrity: sha512-ouAGwhO6wHRXdnOVCOsB0tRFkA7nhNB2Nwax6oECXN0YiN8EYUTBAOudADOB1PI+yDL61TeNx/u7MVCzksNbkQ==} + cpu: [riscv64] + os: [linux] + libc: [musl] + + '@rollup/rollup-linux-s390x-gnu@4.63.1': + resolution: {integrity: sha512-q2R38Sn+1J8RxhfJ+T54wSWmyKXWec+9jgDfqO2AtArEqHO5R2aeayp5H5OYLr5UYDVGsVaZPEFUooMhYCdz5A==} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@rollup/rollup-linux-x64-gnu@4.63.1': + resolution: {integrity: sha512-gfI5T24WLLuFfSKw7Go/zDXjAAV0fny0swTaDv+WjK7vqcw4cRhFfdsyKL1n+ukI+ooBxn3bVQnyrn06WpI50w==} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@rollup/rollup-linux-x64-musl@4.63.1': + resolution: {integrity: sha512-4h6XqthmB4Hspji84wvgk+ElodTsGj+dbZqHJHHtKxj4mYq0ANSEEPX9ys3moJueqsRjwpaJYH7874Itwnj2ow==} + cpu: [x64] + os: [linux] + libc: [musl] + + '@rollup/rollup-openbsd-x64@4.63.1': + resolution: {integrity: sha512-dlfCOa87o1VAYegLQ9EKilx2JCeRofiyPGhTCmqnuXZ6bMPiycO1rq1+sKoulAp7pGLIsTIw+1x5R+zgh5LhhA==} + cpu: [x64] + os: [openbsd] + + '@rollup/rollup-openharmony-arm64@4.63.1': + resolution: {integrity: sha512-cjkLbOlfcm3QGhMM1J5zaZjsw1GggbN6rw9UTSSRrPrR1KkcXnN7Uq9rPw34xImQ9VOY9GN+6u2Zj80B9ptkcw==} + cpu: [arm64] + os: [openharmony] + + '@rollup/rollup-win32-arm64-msvc@4.63.1': + resolution: {integrity: sha512-Li1KdUnWGE4N3e1F/B4RTB1ms+nG4WBgjByO46pkeBVX/2UBsY53xf5vK9WygVmnH3RwncIST7lkSdLSY6P9lg==} + cpu: [arm64] + os: [win32] + + '@rollup/rollup-win32-ia32-msvc@4.63.1': + resolution: {integrity: sha512-t4ZYOSoLTgwhuFMrmTMLx/+i1DQVK7HYqMc6kY46EApwi8X0nIVphzdNoThU3xt6n+N5urG1/gxBdCaKDLavfg==} + cpu: [ia32] + os: [win32] + + '@rollup/rollup-win32-x64-gnu@4.63.1': + resolution: {integrity: sha512-RgroPfMmKlD1RzSDxvwgcPiy2HNQKoYV7OmwIXDsk73uKW5t6B/V8KIy27SMv/FNXFo/oSBtWc9J0X7t91ezZg==} + cpu: [x64] + os: [win32] + + '@rollup/rollup-win32-x64-msvc@4.63.1': + resolution: {integrity: sha512-at8QVep6S3h5Y6gSbdGU06bRY5WJkf6WUduM9YtvYMbYhB1MOFfUgc6kehitQXzOtMSaT70q7f9ydPhpqu821w==} + cpu: [x64] + os: [win32] + + '@types/chai@5.2.3': + resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} + + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + + '@types/estree@1.0.9': + resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==} + + '@types/node@24.13.3': + resolution: {integrity: sha512-Dh8vAsV36ig5wa9OX4pXvMc9D3Veibfw2wix0CUwYODLD8nkj9UsLjASr49nPg+2eKzxhBV+v7L8pXvT4e639Q==} + + '@vitest/expect@3.2.7': + resolution: {integrity: sha512-E8eBXaKibuvH2pSZErOjdVb5vF4PbKYcrnluBTYxEk1l/VhhwZg1kZQsdtjq+CsF5CFydf2Rdkz7jDHKSisi3w==} + + '@vitest/mocker@3.2.7': + resolution: {integrity: sha512-Trr0hYO9CM3Wj6ksWHRhK9IZpIY6wTMO5u/MqXurMxT57sWBaOPEtP3Oq60ihZuh5JsiagKfz95OcxdEP6dBrA==} + peerDependencies: + msw: ^2.4.9 + vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + + '@vitest/pretty-format@3.2.7': + resolution: {integrity: sha512-KUHlwqVu0sRlhCdyPdQ/wBoTfRahjUky1MubOmYw9fWfIZy1gNoHpuaaQBPAaMaVYdQYHJLurzj8ECCj5OwTqA==} + + '@vitest/runner@3.2.7': + resolution: {integrity: sha512-sB9y4ovltoQP+WaUPwmSxO9WIg9Ig694Di5PalVPsYHklAdE027mehpWF2SQSVq+k6sFgaivbTjTJwZLSHbedA==} + + '@vitest/snapshot@3.2.7': + resolution: {integrity: sha512-7C+MwShwtBSI5Buwoyg3s/iY1eHL9PKAf+O1wVh/TdnjXUtkoL/9YQtre90i4MtNXM6edP1wJ2zOBpfCyhIS7g==} + + '@vitest/spy@3.2.7': + resolution: {integrity: sha512-Q2eQGI6d2L/hBtZ0qNuKcAGid68XK6cv1xsoaIma6PaJhHPoqcEJhYpXZ/5myCMqkNgtP6UKuBhbc0nHKnrkuQ==} + + '@vitest/utils@3.2.7': + resolution: {integrity: sha512-x6BDOd7dyo3PFLY3I9/HJ25X/6OurhGXk2/B9gOZNPF7XDVjeBK4k01lQE5uvDpbuheErh91qYuE1E2OEjK3Rw==} + + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + + cac@6.7.14: + resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} + engines: {node: '>=8'} + + chai@5.3.3: + resolution: {integrity: sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==} + engines: {node: '>=18'} + + check-error@2.1.3: + resolution: {integrity: sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==} + engines: {node: '>= 16'} + + debug@4.4.3: + resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + deep-eql@5.0.2: + resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} + engines: {node: '>=6'} + + es-module-lexer@1.7.0: + resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} + + esbuild@0.28.2: + resolution: {integrity: sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==} + engines: {node: '>=18'} + hasBin: true + + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + + expect-type@1.4.0: + resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} + engines: {node: '>=12.0.0'} + + fdir@6.5.0: + resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} + engines: {node: '>=12.0.0'} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + js-tokens@9.0.1: + resolution: {integrity: sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==} + + loupe@3.2.1: + resolution: {integrity: sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==} + + magic-string@0.30.21: + resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + nanoid@3.3.18: + resolution: {integrity: sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + pathe@2.0.3: + resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + + pathval@2.0.1: + resolution: {integrity: sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==} + engines: {node: '>= 14.16'} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + picomatch@4.0.7: + resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==} + engines: {node: '>=12'} + + postcss@8.5.26: + resolution: {integrity: sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ==} + engines: {node: ^10 || ^12 || >=14} + + rollup@4.63.1: + resolution: {integrity: sha512-3Df9jsstwhccuEfmAMi9l8XUh/GOkVObmFTU7CCVBysEbcOZLl84jCtaAZMcPiMz2EGKsATzQcU+Xr3n/wU6cg==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + + siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + + source-map-js@1.2.1: + resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} + engines: {node: '>=0.10.0'} + + stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + + std-env@3.10.0: + resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==} + + strip-literal@3.1.0: + resolution: {integrity: sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==} + + tinybench@2.9.0: + resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + + tinyexec@0.3.2: + resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} + + tinyglobby@0.2.17: + resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} + engines: {node: '>=12.0.0'} + + tinypool@1.1.1: + resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==} + engines: {node: ^18.0.0 || >=20.0.0} + + tinyrainbow@2.0.0: + resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==} + engines: {node: '>=14.0.0'} + + tinyspy@4.0.4: + resolution: {integrity: sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==} + engines: {node: '>=14.0.0'} + + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@7.18.2: + resolution: {integrity: sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==} + + vite-node@3.2.4: + resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true + + vite@7.3.6: + resolution: {integrity: sha512-4XP60spRGjSZFf1qYH+dJIkK2znL3zQfl9KkOV9MkkRR/3Dls0dxaBsQPTloEc5BLXWPL9vsOxopxyKoMmDueg==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + '@types/node': ^20.19.0 || >=22.12.0 + jiti: '>=1.21.0' + less: ^4.0.0 + lightningcss: ^1.21.0 + sass: ^1.70.0 + sass-embedded: ^1.70.0 + stylus: '>=0.54.8' + sugarss: ^5.0.0 + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + '@types/node': + optional: true + jiti: + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + + vitest@3.2.7: + resolution: {integrity: sha512-KrxIJ62Fd89gfysR4WotlgZABiz2dqFPgqGzX7s+CwsqLFomRH7777ZcrOD6+WVAh7khPQP41A+BKbpcJFrdEg==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@types/debug': ^4.1.12 + '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 + '@vitest/browser': 3.2.7 + '@vitest/ui': 3.2.7 + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@types/debug': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + + why-is-node-running@2.3.0: + resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} + engines: {node: '>=8'} + hasBin: true + +snapshots: + + '@esbuild/aix-ppc64@0.28.2': + optional: true + + '@esbuild/android-arm64@0.28.2': + optional: true + + '@esbuild/android-arm@0.28.2': + optional: true + + '@esbuild/android-x64@0.28.2': + optional: true + + '@esbuild/darwin-arm64@0.28.2': + optional: true + + '@esbuild/darwin-x64@0.28.2': + optional: true + + '@esbuild/freebsd-arm64@0.28.2': + optional: true + + '@esbuild/freebsd-x64@0.28.2': + optional: true + + '@esbuild/linux-arm64@0.28.2': + optional: true + + '@esbuild/linux-arm@0.28.2': + optional: true + + '@esbuild/linux-ia32@0.28.2': + optional: true + + '@esbuild/linux-loong64@0.28.2': + optional: true + + '@esbuild/linux-mips64el@0.28.2': + optional: true + + '@esbuild/linux-ppc64@0.28.2': + optional: true + + '@esbuild/linux-riscv64@0.28.2': + optional: true + + '@esbuild/linux-s390x@0.28.2': + optional: true + + '@esbuild/linux-x64@0.28.2': + optional: true + + '@esbuild/netbsd-arm64@0.28.2': + optional: true + + '@esbuild/netbsd-x64@0.28.2': + optional: true + + '@esbuild/openbsd-arm64@0.28.2': + optional: true + + '@esbuild/openbsd-x64@0.28.2': + optional: true + + '@esbuild/openharmony-arm64@0.28.2': + optional: true + + '@esbuild/sunos-x64@0.28.2': + optional: true + + '@esbuild/win32-arm64@0.28.2': + optional: true + + '@esbuild/win32-ia32@0.28.2': + optional: true + + '@esbuild/win32-x64@0.28.2': + optional: true + + '@jridgewell/sourcemap-codec@1.6.0': {} + + '@napi-rs/lzma-linux-x64-gnu@1.5.1': + optional: true + + '@rollup/rollup-android-arm-eabi@4.63.1': + optional: true + + '@rollup/rollup-android-arm64@4.63.1': + optional: true + + '@rollup/rollup-darwin-arm64@4.63.1': + optional: true + + '@rollup/rollup-darwin-x64@4.63.1': + optional: true + + '@rollup/rollup-freebsd-arm64@4.63.1': + optional: true + + '@rollup/rollup-freebsd-x64@4.63.1': + optional: true + + '@rollup/rollup-linux-arm-gnueabihf@4.63.1': + optional: true + + '@rollup/rollup-linux-arm-musleabihf@4.63.1': + optional: true + + '@rollup/rollup-linux-arm64-gnu@4.63.1': + optional: true + + '@rollup/rollup-linux-arm64-musl@4.63.1': + optional: true + + '@rollup/rollup-linux-loong64-gnu@4.63.1': + optional: true + + '@rollup/rollup-linux-loong64-musl@4.63.1': + optional: true + + '@rollup/rollup-linux-ppc64-gnu@4.63.1': + optional: true + + '@rollup/rollup-linux-ppc64-musl@4.63.1': + optional: true + + '@rollup/rollup-linux-riscv64-gnu@4.63.1': + optional: true + + '@rollup/rollup-linux-riscv64-musl@4.63.1': + optional: true + + '@rollup/rollup-linux-s390x-gnu@4.63.1': + optional: true + + '@rollup/rollup-linux-x64-gnu@4.63.1': + optional: true + + '@rollup/rollup-linux-x64-musl@4.63.1': + optional: true + + '@rollup/rollup-openbsd-x64@4.63.1': + optional: true + + '@rollup/rollup-openharmony-arm64@4.63.1': + optional: true + + '@rollup/rollup-win32-arm64-msvc@4.63.1': + optional: true + + '@rollup/rollup-win32-ia32-msvc@4.63.1': + optional: true + + '@rollup/rollup-win32-x64-gnu@4.63.1': + optional: true + + '@rollup/rollup-win32-x64-msvc@4.63.1': + optional: true + + '@types/chai@5.2.3': + dependencies: + '@types/deep-eql': 4.0.2 + assertion-error: 2.0.1 + + '@types/deep-eql@4.0.2': {} + + '@types/estree@1.0.9': {} + + '@types/node@24.13.3': + dependencies: + undici-types: 7.18.2 + + '@vitest/expect@3.2.7': + dependencies: + '@types/chai': 5.2.3 + '@vitest/spy': 3.2.7 + '@vitest/utils': 3.2.7 + chai: 5.3.3 + tinyrainbow: 2.0.0 + + '@vitest/mocker@3.2.7(vite@7.3.6(@types/node@24.13.3))': + dependencies: + '@vitest/spy': 3.2.7 + estree-walker: 3.0.3 + magic-string: 0.30.21 + optionalDependencies: + vite: 7.3.6(@types/node@24.13.3) + + '@vitest/pretty-format@3.2.7': + dependencies: + tinyrainbow: 2.0.0 + + '@vitest/runner@3.2.7': + dependencies: + '@vitest/utils': 3.2.7 + pathe: 2.0.3 + strip-literal: 3.1.0 + + '@vitest/snapshot@3.2.7': + dependencies: + '@vitest/pretty-format': 3.2.7 + magic-string: 0.30.21 + pathe: 2.0.3 + + '@vitest/spy@3.2.7': + dependencies: + tinyspy: 4.0.4 + + '@vitest/utils@3.2.7': + dependencies: + '@vitest/pretty-format': 3.2.7 + loupe: 3.2.1 + tinyrainbow: 2.0.0 + + assertion-error@2.0.1: {} + + cac@6.7.14: {} + + chai@5.3.3: + dependencies: + assertion-error: 2.0.1 + check-error: 2.1.3 + deep-eql: 5.0.2 + loupe: 3.2.1 + pathval: 2.0.1 + + check-error@2.1.3: {} + + debug@4.4.3: + dependencies: + ms: 2.1.3 + + deep-eql@5.0.2: {} + + es-module-lexer@1.7.0: {} + + esbuild@0.28.2: + optionalDependencies: + '@esbuild/aix-ppc64': 0.28.2 + '@esbuild/android-arm': 0.28.2 + '@esbuild/android-arm64': 0.28.2 + '@esbuild/android-x64': 0.28.2 + '@esbuild/darwin-arm64': 0.28.2 + '@esbuild/darwin-x64': 0.28.2 + '@esbuild/freebsd-arm64': 0.28.2 + '@esbuild/freebsd-x64': 0.28.2 + '@esbuild/linux-arm': 0.28.2 + '@esbuild/linux-arm64': 0.28.2 + '@esbuild/linux-ia32': 0.28.2 + '@esbuild/linux-loong64': 0.28.2 + '@esbuild/linux-mips64el': 0.28.2 + '@esbuild/linux-ppc64': 0.28.2 + '@esbuild/linux-riscv64': 0.28.2 + '@esbuild/linux-s390x': 0.28.2 + '@esbuild/linux-x64': 0.28.2 + '@esbuild/netbsd-arm64': 0.28.2 + '@esbuild/netbsd-x64': 0.28.2 + '@esbuild/openbsd-arm64': 0.28.2 + '@esbuild/openbsd-x64': 0.28.2 + '@esbuild/openharmony-arm64': 0.28.2 + '@esbuild/sunos-x64': 0.28.2 + '@esbuild/win32-arm64': 0.28.2 + '@esbuild/win32-ia32': 0.28.2 + '@esbuild/win32-x64': 0.28.2 + + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.9 + + expect-type@1.4.0: {} + + fdir@6.5.0(picomatch@4.0.7): + optionalDependencies: + picomatch: 4.0.7 + + fsevents@2.3.3: + optional: true + + js-tokens@9.0.1: {} + + loupe@3.2.1: {} + + magic-string@0.30.21: + dependencies: + '@jridgewell/sourcemap-codec': 1.6.0 + + ms@2.1.3: {} + + nanoid@3.3.18: {} + + pathe@2.0.3: {} + + pathval@2.0.1: {} + + picocolors@1.1.1: {} + + picomatch@4.0.7: {} + + postcss@8.5.26: + dependencies: + nanoid: 3.3.18 + picocolors: 1.1.1 + source-map-js: 1.2.1 + + rollup@4.63.1: + dependencies: + '@types/estree': 1.0.9 + optionalDependencies: + '@napi-rs/lzma-linux-x64-gnu': 1.5.1 + '@rollup/rollup-android-arm-eabi': 4.63.1 + '@rollup/rollup-android-arm64': 4.63.1 + '@rollup/rollup-darwin-arm64': 4.63.1 + '@rollup/rollup-darwin-x64': 4.63.1 + '@rollup/rollup-freebsd-arm64': 4.63.1 + '@rollup/rollup-freebsd-x64': 4.63.1 + '@rollup/rollup-linux-arm-gnueabihf': 4.63.1 + '@rollup/rollup-linux-arm-musleabihf': 4.63.1 + '@rollup/rollup-linux-arm64-gnu': 4.63.1 + '@rollup/rollup-linux-arm64-musl': 4.63.1 + '@rollup/rollup-linux-loong64-gnu': 4.63.1 + '@rollup/rollup-linux-loong64-musl': 4.63.1 + '@rollup/rollup-linux-ppc64-gnu': 4.63.1 + '@rollup/rollup-linux-ppc64-musl': 4.63.1 + '@rollup/rollup-linux-riscv64-gnu': 4.63.1 + '@rollup/rollup-linux-riscv64-musl': 4.63.1 + '@rollup/rollup-linux-s390x-gnu': 4.63.1 + '@rollup/rollup-linux-x64-gnu': 4.63.1 + '@rollup/rollup-linux-x64-musl': 4.63.1 + '@rollup/rollup-openbsd-x64': 4.63.1 + '@rollup/rollup-openharmony-arm64': 4.63.1 + '@rollup/rollup-win32-arm64-msvc': 4.63.1 + '@rollup/rollup-win32-ia32-msvc': 4.63.1 + '@rollup/rollup-win32-x64-gnu': 4.63.1 + '@rollup/rollup-win32-x64-msvc': 4.63.1 + fsevents: 2.3.3 + + siginfo@2.0.0: {} + + source-map-js@1.2.1: {} + + stackback@0.0.2: {} + + std-env@3.10.0: {} + + strip-literal@3.1.0: + dependencies: + js-tokens: 9.0.1 + + tinybench@2.9.0: {} + + tinyexec@0.3.2: {} + + tinyglobby@0.2.17: + dependencies: + fdir: 6.5.0(picomatch@4.0.7) + picomatch: 4.0.7 + + tinypool@1.1.1: {} + + tinyrainbow@2.0.0: {} + + tinyspy@4.0.4: {} + + typescript@5.9.3: {} + + undici-types@7.18.2: {} + + vite-node@3.2.4(@types/node@24.13.3): + dependencies: + cac: 6.7.14 + debug: 4.4.3 + es-module-lexer: 1.7.0 + pathe: 2.0.3 + vite: 7.3.6(@types/node@24.13.3) + transitivePeerDependencies: + - '@types/node' + - jiti + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + + vite@7.3.6(@types/node@24.13.3): + dependencies: + esbuild: 0.28.2 + fdir: 6.5.0(picomatch@4.0.7) + picomatch: 4.0.7 + postcss: 8.5.26 + rollup: 4.63.1 + tinyglobby: 0.2.17 + optionalDependencies: + '@types/node': 24.13.3 + fsevents: 2.3.3 + + vitest@3.2.7(@types/node@24.13.3): + dependencies: + '@types/chai': 5.2.3 + '@vitest/expect': 3.2.7 + '@vitest/mocker': 3.2.7(vite@7.3.6(@types/node@24.13.3)) + '@vitest/pretty-format': 3.2.7 + '@vitest/runner': 3.2.7 + '@vitest/snapshot': 3.2.7 + '@vitest/spy': 3.2.7 + '@vitest/utils': 3.2.7 + chai: 5.3.3 + debug: 4.4.3 + expect-type: 1.4.0 + magic-string: 0.30.21 + pathe: 2.0.3 + picomatch: 4.0.7 + std-env: 3.10.0 + tinybench: 2.9.0 + tinyexec: 0.3.2 + tinyglobby: 0.2.17 + tinypool: 1.1.1 + tinyrainbow: 2.0.0 + vite: 7.3.6(@types/node@24.13.3) + vite-node: 3.2.4(@types/node@24.13.3) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 24.13.3 + transitivePeerDependencies: + - jiti + - less + - lightningcss + - msw + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + + why-is-node-running@2.3.0: + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..5ed0b5a --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +allowBuilds: + esbuild: true diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..63f8d47 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,175 @@ +import createModule from "#build/ptr89_wasm.js"; + +type WasmModule = Awaited>; +type WasmPtr89 = InstanceType; + +export type Architecture = "arm" | "c166"; +export type PatternSearchResultType = "offset" | "pointer" | "reference" | "branch" | "static_value"; +export type XRefSearchResultType = "pointer" | "reference" | "branch"; + +export interface OpenOptions { + arch?: Architecture; + base?: number; + align?: number; +} + +export interface PatternSearchResult { + type: PatternSearchResultType; + address: number; + offset: number; + value: number; +} + +export interface XRefSearchResult { + type: XRefSearchResultType; + address: number; + offset: number; +} + +const C166_ADDRESS_SPACE_SIZE = 0x1000000; +let modulePromise: ReturnType | undefined; + +function loadModule(): ReturnType { + modulePromise ??= createModule(); + return modulePromise; +} + +function getError(module: WasmModule, error: unknown): Error { + if (error instanceof Error) + return error; + try { + const details = module.getExceptionMessage(error); + const message = Array.isArray(details) ? details[1] ?? details[0] : details; + try { + module.decrementExceptionRefcount(error); + } catch { + // The exception may not be owned by the C++ runtime. + } + return new Error(String(message)); + } catch { + return new Error(String(error)); + } +} + +function validateLimit(limit: number): void { + if (!Number.isSafeInteger(limit) || limit < 0) + throw new RangeError("Result limit must be a non-negative integer."); +} + +export class Ptr89 { + private module?: WasmModule; + private handle?: WasmPtr89; + + async open(data: Uint8Array, options: OpenOptions = {}): Promise { + const arch = options.arch ?? "arm"; + const align = options.align ?? 1; + if (!Number.isSafeInteger(align) || align <= 0) + throw new RangeError("Memory alignment must be a positive integer."); + + let base = options.base; + if (base === undefined) { + if (arch === "c166") { + if (data.byteLength > C166_ADDRESS_SPACE_SIZE) + throw new RangeError("C166 fullflash is larger than the 16 MiB address space; specify base explicitly."); + base = C166_ADDRESS_SPACE_SIZE - data.byteLength; + } else { + base = 0xA0000000; + } + } + if (!Number.isSafeInteger(base) || base < 0 || base > 0xFFFFFFFF) + throw new RangeError("Memory base must be a 32-bit unsigned integer."); + + const module = await loadModule(); + const handle = this.handle ?? new module.Ptr89(); + const ptr = module._malloc(data.byteLength); + module.HEAPU8.set(data, ptr); + try { + handle.open(ptr, data.byteLength, base, align, arch); + this.module = module; + this.handle = handle; + } catch (error) { + if (!this.handle) + handle.delete(); + throw getError(module, error); + } finally { + module._free(ptr); + } + } + + close(): void { + if (!this.handle) + return; + this.handle.close(); + this.handle.delete(); + this.handle = undefined; + this.module = undefined; + } + + setDebug(enabled: boolean): void { + this.getHandle().setDebug(enabled); + } + + find(pattern: string, limit = 100): PatternSearchResult[] { + validateLimit(limit); + const [module, handle] = this.getState(); + try { + const matches = handle.find(pattern, limit); + try { + return Array.from({ length: matches.size() }, (_, i) => { + const match = matches.get(i); + if (!match) + throw new Error(`Missing search result at index ${i}.`); + return match as PatternSearchResult; + }); + } finally { + matches.delete(); + } + } catch (error) { + throw getError(module, error); + } + } + + findXRefs(address: number, limit = 100): XRefSearchResult[] { + validateLimit(limit); + if (!Number.isSafeInteger(address) || address < 0 || address > 0xFFFFFFFF) + throw new RangeError("Address must be a 32-bit unsigned integer."); + + const [module, handle] = this.getState(); + try { + const matches = handle.findXRefs(address, limit); + try { + return Array.from({ length: matches.size() }, (_, i) => { + const match = matches.get(i); + if (!match) + throw new Error(`Missing x-ref result at index ${i}.`); + return match as XRefSearchResult; + }); + } finally { + matches.delete(); + } + } catch (error) { + throw getError(module, error); + } + } + + private getHandle(): WasmPtr89 { + if (!this.handle) + throw new Error("Ptr89 is not opened."); + return this.handle; + } + + private getState(): [WasmModule, WasmPtr89] { + if (!this.module || !this.handle) + throw new Error("Ptr89 is not opened."); + return [this.module, this.handle]; + } +} + +export async function prettify(pattern: string): Promise { + const module = await loadModule(); + try { + return module.prettify(pattern); + } catch (error) { + throw getError(module, error); + } +} diff --git a/test/index.test.ts b/test/index.test.ts new file mode 100644 index 0000000..0392e84 --- /dev/null +++ b/test/index.test.ts @@ -0,0 +1,55 @@ +import { Buffer } from "node:buffer"; +import { describe, expect, it } from "vitest"; + +import { Ptr89, prettify } from "../src/index.js"; + +describe("Ptr89 WASM", () => { + it("finds ARM patterns and x-refs", async () => { + const memory = Buffer.from([ + 0x00, 0x48, // LDR R0, [PC, #0] + 0x00, 0xBF, // NOP + 0x08, 0x00, 0x00, 0xA0, // Pointer to 0xA0000008 + 0x00, 0xBF, // NOP at 0xA0000008 + ]); + const ptr89 = new Ptr89(); + await ptr89.open(memory, { arch: "arm" }); + + expect(ptr89.find("LDR[ 00BF ]", 1)).toEqual([{ + type: "offset", + address: 0xA0000000, + offset: 0, + value: 0xA0000000, + }]); + expect(ptr89.findXRefs(0xA0000008, 10)).toContainEqual({ + type: "reference", + address: 0xA0000000, + offset: 0, + }); + + ptr89.close(); + }); + + it("accepts the C166 architecture as a string", async () => { + const memory = Uint8Array.from([ + 0x0D, 0x01, // JMPR cc_UC, 0xFFFFFE + 0xCC, 0x00, // NOP + 0xDB, 0x00, // RETS + ]); + const ptr89 = new Ptr89(); + await ptr89.open(memory, { arch: "c166" }); + + expect(ptr89.find("[ DB00 ]", 1)).toEqual([{ + type: "offset", + address: 0xFFFFFA, + offset: 0, + value: 0xFFFFFA, + }]); + + ptr89.close(); + }); + + it("prettifies patterns", async () => { + await expect(prettify("00bf")).resolves.toBe("00 BF"); + await expect(prettify("GG")).rejects.toThrow("Syntax error"); + }); +}); diff --git a/tools/build_wasm.sh b/tools/build_wasm.sh new file mode 100755 index 0000000..a435cc7 --- /dev/null +++ b/tools/build_wasm.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -e +set -x +cd "$(dirname "$0")/../" + +pnpm install --frozen-lockfile +emcmake cmake -B build-wasm -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS:BOOL=TRUE +cmake --build build-wasm -- -j"$(nproc)" +pnpm run build +ctest --test-dir build-wasm --output-on-failure diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..623048b --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "declaration": true, + "rootDir": "src", + "outDir": "dist", + "target": "ESNext", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "lib": ["ESNext", "DOM"] + }, + "include": ["src/**/*.ts"], + "exclude": ["node_modules", "dist", "build-wasm"] +} diff --git a/wasm/Ptr89Wasm.cpp b/wasm/Ptr89Wasm.cpp new file mode 100644 index 0000000..5f4f47c --- /dev/null +++ b/wasm/Ptr89Wasm.cpp @@ -0,0 +1,108 @@ +#include "Ptr89Wasm.h" + +#include + +#include + +namespace Ptr89 { + +static const char *getPatternTypeName(PatternType type) { + switch (type) { + case PATTERN_TYPE_OFFSET: + return "offset"; + case PATTERN_TYPE_POINTER: + return "pointer"; + case PATTERN_TYPE_REFERENCE: + return "reference"; + case PATTERN_TYPE_BRANCH_REFERENCE: + return "branch"; + case PATTERN_TYPE_STATIC_VALUE: + return "static_value"; + } + throw std::invalid_argument("Invalid pattern type."); +} + +static const char *getXRefTypeName(XRefType type) { + switch (type) { + case XREF_TYPE_REFERENCE: + return "reference"; + case XREF_TYPE_BRANCH_CALL: + return "branch"; + case XREF_TYPE_POINTER: + return "pointer"; + } + throw std::invalid_argument("Invalid x-ref type."); +} + +Ptr89Wasm::Ptr89Wasm() { + spdlog::set_pattern("%v"); + spdlog::set_level(spdlog::level::warn); +} + +void Ptr89Wasm::open(uintptr_t ptr, size_t size, uint32_t base, int align, const std::string &archName) { + if (ptr == 0 && size != 0) + throw std::invalid_argument("Memory pointer is null."); + if (align <= 0) + throw std::invalid_argument("Memory alignment must be greater than zero."); + + Architecture arch; + if (archName == "arm") { + arch = ARCH_ARM; + } else if (archName == "c166") { + arch = ARCH_C166; + } else { + throw std::invalid_argument("Invalid architecture '" + archName + "'. Expected arm or c166."); + } + + const auto *data = reinterpret_cast(ptr); + m_data.clear(); + if (size != 0) + m_data.assign(data, data + size); + m_base = base; + m_align = align; + m_arch = arch; + m_open = true; +} + +void Ptr89Wasm::close() { + m_data.clear(); + m_data.shrink_to_fit(); + m_open = false; +} + +void Ptr89Wasm::setDebug(bool enabled) { + spdlog::set_level(enabled ? spdlog::level::debug : spdlog::level::warn); +} + +std::vector Ptr89Wasm::find(const std::string &patternText, size_t limit) const { + auto memory = getMemory(); + auto pattern = Pattern::parse(patternText); + auto matches = Pattern::find(pattern, memory, limit); + + std::vector results; + results.reserve(matches.size()); + for (const auto &match: matches) + results.push_back({ getPatternTypeName(pattern->type), match.address, match.offset, match.value }); + return results; +} + +std::vector Ptr89Wasm::findXRefs(uint32_t address, size_t limit) const { + auto matches = Pattern::finXRefs(address, getMemory(), limit); + std::vector results; + results.reserve(matches.size()); + for (const auto &match: matches) + results.push_back({ getXRefTypeName(match.type), match.address, match.offset }); + return results; +} + +Pattern::Memory Ptr89Wasm::getMemory() const { + if (!m_open) + throw std::runtime_error("Ptr89 is not opened."); + return { m_base, m_data.data(), m_data.size(), m_align, m_arch }; +} + +std::string prettify(const std::string &pattern) { + return Pattern::stringify(Pattern::parse(pattern)); +} + +}; // namespace Ptr89 diff --git a/wasm/Ptr89Wasm.h b/wasm/Ptr89Wasm.h new file mode 100644 index 0000000..5e4f64d --- /dev/null +++ b/wasm/Ptr89Wasm.h @@ -0,0 +1,47 @@ +#pragma once + +#include +#include +#include +#include + +#include + +namespace Ptr89 { + +struct WasmPatternSearchResult { + std::string type; + uint32_t address; + uint32_t offset; + uint32_t value; +}; + +struct WasmXRefSearchResult { + std::string type; + uint32_t address; + uint32_t offset; +}; + +class Ptr89Wasm { + private: + std::vector m_data; + uint32_t m_base = 0; + int m_align = 1; + Architecture m_arch = ARCH_ARM; + bool m_open = false; + + Pattern::Memory getMemory() const; + + public: + Ptr89Wasm(); + + void open(uintptr_t ptr, size_t size, uint32_t base, int align, const std::string &archName); + void close(); + void setDebug(bool enabled); + std::vector find(const std::string &patternText, size_t limit) const; + std::vector findXRefs(uint32_t address, size_t limit) const; +}; + +std::string prettify(const std::string &pattern); + +}; // namespace Ptr89 diff --git a/wasm/main.cpp b/wasm/main.cpp new file mode 100644 index 0000000..17eb76f --- /dev/null +++ b/wasm/main.cpp @@ -0,0 +1,32 @@ +#include + +#include "Ptr89Wasm.h" + +using namespace emscripten; +using namespace Ptr89; + +EMSCRIPTEN_BINDINGS(ptr89) { + value_object("PatternSearchResult") + .field("type", &WasmPatternSearchResult::type) + .field("address", &WasmPatternSearchResult::address) + .field("offset", &WasmPatternSearchResult::offset) + .field("value", &WasmPatternSearchResult::value); + + value_object("XRefSearchResult") + .field("type", &WasmXRefSearchResult::type) + .field("address", &WasmXRefSearchResult::address) + .field("offset", &WasmXRefSearchResult::offset); + + register_vector("PatternSearchResults"); + register_vector("XRefSearchResults"); + + class_("Ptr89") + .constructor<>() + .function("open", &Ptr89Wasm::open) + .function("close", &Ptr89Wasm::close) + .function("setDebug", &Ptr89Wasm::setDebug) + .function("find", &Ptr89Wasm::find) + .function("findXRefs", &Ptr89Wasm::findXRefs); + + function("prettify", &prettify); +}