Add Svelte docs site and WASM playground

This commit is contained in:
2026-06-17 00:07:11 +09:00
parent 58d2c9b423
commit 4020b7c2d5
23 changed files with 2359 additions and 1 deletions
+47 -1
View File
@@ -20,6 +20,50 @@ cargo test -p decodal-core --features regex
cargo run -q -p decodal --features regex -- examples/regex/main.dcdl
```
## Web site and playground
The Svelte documentation site and browser playground are kept in:
```text
site/decodal-site/
```
The site imports Markdown files from `doc/manual/souce/` and renders them as mdBook-style pages.
The playground loads `decodal-wasm` and evaluates DCDL entirely in the browser.
Important files:
```text
site/decodal-site/src/App.svelte
site/decodal-site/src/Playground.svelte
site/decodal-site/src/lib/docs.js
crates/decodal-wasm/src/lib.rs
```
Build the WebAssembly package before building the site:
```sh
cd site/decodal-site
npm install
npm run build:wasm
npm run build
```
`npm run build:wasm` writes generated files into:
```text
site/decodal-site/src/wasm/
```
These generated files are committed so the site can be built without requiring every consumer to regenerate the wasm package first.
To run the site locally:
```sh
cd site/decodal-site
npm run dev
```
## Tree-sitter grammar
The Tree-sitter grammar is kept in:
@@ -73,7 +117,7 @@ When the Decodal syntax changes:
## Development shell
The Nix development shell includes Rust tooling, Node.js, and Tree-sitter CLI tooling.
The Nix development shell includes Rust tooling, Node.js, Tree-sitter CLI tooling, and wasm-pack tooling.
```sh
nix develop
@@ -87,5 +131,7 @@ The shell provides:
- `clippy`
- `node`
- `npm`
- `wasm-pack`
- `lld`
- `tree-sitter`
- `nixfmt`