WDK logoWDK documentation

Worklet Bundler

CLI tool for generating WDK Bare worklet bundles

Worklet Bundler packages selected WDK wallet, protocol, and optional generic modules into a Bare runtime bundle that runs outside the host application thread. It can generate the default HRPC worklet used by React Native Core or a framed JSON-RPC bundle for a native host. Powered by @tetherto/wdk-worklet-bundler.

Features

  • Config-driven bundle generation: Map logical network names to wallet packages, protocol names to protocol packages, and HRPC-only generic-module names to package factories.
  • HRPC and JSON-RPC transports: Generate an HRPC JavaScript bundle by default or a length-prefixed JSON-RPC bundle for native hosts.
  • Generated worklet artifacts: Produce a Bare bundle, a stable ./.wdk host import, and generated TypeScript types.
  • Native addon outputs: Link iOS, macOS, and Android addons and generate addons.yml for JSON-RPC/native integrations.
  • Dependency validation helpers: Validate configured modules, detect the active package manager, and generate install or uninstall commands when dependencies are missing.
  • Optional peer deferral: Defer missing peers marked optional by their package metadata, or require them at build time with --no-defer-optional-peers.
  • CLI workflow: Use init, validate, generate, list-modules, and clean without building your own wrapper.
  • Bare suspend and resume handling: Generated HRPC entrypoints suspend and resume both the bare-http1 and bare-https global agents when the Bare thread lifecycle changes.

v1.0.0-beta.7 includes the built CLI and API files for the JSON-RPC, generic-module, and addon-linking surface, defers genuinely missing optional peers during bundling by default, and links bare-posix automatically for supported native platforms. It also detects optional peers installed anywhere in nested, scoped, or symlinked node_modules trees so present dependencies are not incorrectly deferred and omitted from the bundle.

Why this matters

  • Bundle generation keeps wallet and protocol code in a separate Bare worklet instead of the UI thread.
  • The generated type output gives the host app a stable import for the bundle surface.
  • Transport-specific defaults produce a JavaScript HRPC bundle for React Native Core or native addon artifacts for JSON-RPC hosts.

Generic modules are generated only for HRPC through beta.7. A JSON-RPC config can currently accept a modules field but silently omits those modules from the generated entrypoint.


Need Help?

On this page