Add language tools package
This commit is contained in:
@@ -39,6 +39,24 @@ The JSR package is `@hare/decodal-wasm`.
|
||||
The generated files in `packages/decodal-wasm/` are committed so the site can build without requiring every consumer to run `wasm-pack` first.
|
||||
The WebAssembly package is for execution, not syntax highlighting.
|
||||
|
||||
## Language tools
|
||||
|
||||
Source-level tooling lives in the Rust language tools crate and its generated JavaScript/WebAssembly package.
|
||||
This component is responsible for operations that must preserve source text details such as comments and whitespace.
|
||||
|
||||
Important paths:
|
||||
|
||||
```text
|
||||
crates/decodal-language-tools/
|
||||
packages/decodal-language-tools/
|
||||
```
|
||||
|
||||
The npm package is `decodal-language-tools`.
|
||||
The JSR package is `@hare/decodal-language-tools`.
|
||||
|
||||
The current language tools package exposes the formatter.
|
||||
Future LSP functionality should build on the same source-level tooling layer rather than on the runtime core.
|
||||
|
||||
## Web editor components
|
||||
|
||||
The Web playground editor uses CodeMirror 6 with a generated Lezer parser.
|
||||
@@ -94,6 +112,7 @@ Consumers that need syntax information should use the component that matches the
|
||||
|
||||
- Rust execution and embedding: `decodal`
|
||||
- Browser execution: `decodal-wasm`
|
||||
- Source formatting and future LSP tooling: `decodal-language-tools`
|
||||
- Web editor syntax: Lezer / CodeMirror
|
||||
- General editor syntax: Tree-sitter
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ cargo run -q -p decodal-cli --features regex -- examples/regex/main.dcdl
|
||||
|
||||
The primary crates.io package is `decodal`, which contains the embeddable library.
|
||||
`decodal-derive` provides optional derive macros for Rust struct integration and is published only when the derive crate changes.
|
||||
Workspace support crates such as `decodal-cli` and the Rust source crate `decodal-wasm` are not published to crates.io.
|
||||
The generated WebAssembly package under `packages/decodal-wasm/` is published to npm and JSR.
|
||||
Workspace support crates such as `decodal-cli`, the Rust source crate `decodal-wasm`, and `decodal-language-tools` are not published to crates.io.
|
||||
The generated WebAssembly packages under `packages/decodal-wasm/` and `packages/decodal-language-tools/` are published to npm and JSR.
|
||||
The project is dual licensed as `MIT OR Apache-2.0`.
|
||||
|
||||
```sh
|
||||
@@ -58,7 +58,7 @@ 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.
|
||||
The playground loads `decodal-wasm` for evaluation and `decodal-language-tools` for source formatting.
|
||||
|
||||
Important files:
|
||||
|
||||
@@ -74,25 +74,25 @@ packages/decodal-codemirror/src/decodal.js
|
||||
packages/decodal-codemirror/src/decodal-parser.js
|
||||
packages/decodal-wasm/decodal_wasm.js
|
||||
packages/decodal-wasm/decodal_wasm_bg.wasm
|
||||
packages/decodal-language-tools/decodal_language_tools.js
|
||||
packages/decodal-language-tools/decodal_language_tools_bg.wasm
|
||||
crates/decodal-wasm/src/lib.rs
|
||||
crates/decodal-language-tools/src/lib.rs
|
||||
```
|
||||
|
||||
Build the WebAssembly package before building the site:
|
||||
Build the WebAssembly packages before building the site:
|
||||
|
||||
```sh
|
||||
cd site/decodal-site
|
||||
npm install
|
||||
npm run build:wasm
|
||||
npm run build:packages
|
||||
npm run build
|
||||
```
|
||||
|
||||
`npm run build:wasm` writes generated files into:
|
||||
`npm run build:wasm` writes generated runtime files into `packages/decodal-wasm/`.
|
||||
`npm run build:tools` writes generated language tools files into `packages/decodal-language-tools/`.
|
||||
|
||||
```text
|
||||
packages/decodal-wasm/
|
||||
```
|
||||
|
||||
These generated files are committed so the site can be built without requiring every consumer to regenerate the wasm package first.
|
||||
These generated files are committed so the site can be built without requiring every consumer to regenerate the wasm packages first.
|
||||
|
||||
Publish the generated WebAssembly package from its package directory:
|
||||
|
||||
@@ -113,6 +113,24 @@ The npm package name is `decodal-wasm`.
|
||||
The JSR package name is `@hare/decodal-wasm`.
|
||||
JSR currently expects a single SPDX license identifier in `jsr.json`; the WebAssembly package metadata uses `MIT` while the Rust workspace remains dual licensed as `MIT OR Apache-2.0`.
|
||||
|
||||
Publish the generated language tools package from its package directory:
|
||||
|
||||
```sh
|
||||
cd packages/decodal-language-tools
|
||||
npm publish
|
||||
npx jsr publish
|
||||
```
|
||||
|
||||
Run dry-runs first when preparing a release:
|
||||
|
||||
```sh
|
||||
npm pack --dry-run
|
||||
npx jsr publish --dry-run
|
||||
```
|
||||
|
||||
The npm package name is `decodal-language-tools`.
|
||||
The JSR package name is `@hare/decodal-language-tools`.
|
||||
|
||||
The playground editor uses the `decodal-codemirror` package with the generated Lezer parser in `packages/decodal-codemirror/src/decodal-parser.js`.
|
||||
The canonical grammar is documented in `doc/manual/souce/language/grammar.md`; regenerate the Lezer parser when that grammar or `editors/lezer-decodal/decodal.grammar` changes.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user