rustledger-wasm
WebAssembly bindings for rustledger, enabling Beancount functionality in JavaScript/TypeScript.
Features
| Feature | Description |
|---|---|
parse() |
Parse Beancount source to JSON |
validateSource() |
Validate ledger with error reporting |
query() |
Run BQL queries |
format() |
Format source with consistent alignment |
expandPads() |
Expand pad directives |
runPlugin() |
Run native plugins (with plugins feature) |
bqlCompletions() |
BQL query completions (with completions feature) |
ParsedLedger |
Stateful class with LSP-like editor features |
Example
import init from '@rustledger/wasm';
await ;
const source = `
2024-01-01 open Assets:Bank USD
2024-01-15 * "Coffee"
Expenses:Food 5.00 USD
Assets:Bank -5.00 USD
`;
const result = ;
if
Stateful API
For multiple operations on the same source, use ParsedLedger to avoid re-parsing:
import from '@rustledger/wasm';
const ledger = ;
if
ledger.; // Release WASM memory
Cargo Features
plugins(default) - Include native plugin supportcompletions(default) - Include BQL query completions
Building
License
GPL-3.0