Decodal/packages/decodal-wasm/README.md

894 B

decodal-wasm

WebAssembly runtime package for Decodal.

This package exposes the Decodal evaluator to browsers and other JavaScript runtimes that can load WebAssembly modules. It is generated from the Rust crate in crates/decodal-wasm with wasm-pack and is used by the official playground.

Use decodal-codemirror separately when you need CodeMirror 6 language support.

Install

npm install decodal-wasm

JSR:

deno add jsr:@hare/decodal-wasm

Usage

import init, { evaluateProject } from 'decodal-wasm';

await init();

const result = evaluateProject(JSON.stringify({
  entry: 'main.dcdl',
  files: {
    'main.dcdl': 'Server = { port = Int default 8080; };',
  },
}));

console.log(JSON.parse(result));

The exported functions return JSON strings so callers can handle diagnostics and successful results without depending on Rust data structures.