pdl-wasm
v0.62.0
Published
Browser runtime loader and TypeScript ABI types for PDL.
Downloads
143
Readme
pdl-wasm
Browser runtime loader and structural TypeScript ABI types for PDL 0.62.x.
The browser ABI accepts a typed context map for reactive param and
state declarations, and its editor-service ABI includes parser-backed semantic
token names for table bindings, columns, and context references. Downstream
browser hosts should consume those names
through this package and shared editor integrations such as pdl-editor rather
than implementing PDL-specific token classification in TypeScript.
Published packages expose dist/index.mjs, dist/index.cjs, and
dist/index.d.ts, and package tarballs include dist/pdl.wasm. During local
source-mode development, build or copy pdl.wasm into the host app's public
assets and pass that URL explicitly:
import { loadPdlRuntime } from "pdl-wasm";
const runtime = await loadPdlRuntime({ wasmUrl: "/wasm/pdl.wasm" });runtime.ast(source, options?) parses PDL source without resolving imports,
loading data, inferring schemas, or executing pipelines. options.programPath
sets the returned source_path label:
const parsed = runtime.ast(source, { programPath: "memory/main.pdl" });
console.log(parsed.program?.main?.stages.length, parsed.diagnostics);runtime.languageReference(options?) returns PDL reference Markdown embedded in
the WASM binary. With no options it returns the full composed reference; pass
part to request only the language or tooling source template:
const full = runtime.languageReference();
const languageOnly = runtime.languageReference({ part: "language" });
const toolingOnly = runtime.languageReference({ part: "tooling" });
console.log(full.version, full.part, full.sources);
console.log(languageOnly.markdown);The language-only reference omits CLI commands, package usage, and agent setup sections. It is intended for source-inspection tools and small LLM context windows that only need syntax, stages, expressions, functions, formats, declarations, reserved words, and runtime semantics.
For package-surface validation, run npm run build:wasm and
npm pack --dry-run; the generated tarball includes the JavaScript entrypoints,
TypeScript declarations, and dist/pdl.wasm.
