Bundle language tools with CodeMirror package

This commit is contained in:
2026-07-09 21:25:04 +09:00
parent 59cb8f31e4
commit 8eac5c5cb4
24 changed files with 155 additions and 219 deletions
+3 -4
View File
@@ -33,8 +33,7 @@ Production = Server & {
</a>
<ul class="package-list">
<li>decodal-wasm on <a href="https://jsr.io/@hare/decodal-wasm@0.1.2">jsr</a> / <a href="https://www.npmjs.com/package/decodal-wasm">npm</a></li>
<li>decodal-language-tools on <a href="https://jsr.io/@hare/decodal-language-tools@0.1.2">jsr</a> / <a href="https://www.npmjs.com/package/decodal-language-tools">npm</a></li>
<li>decodal-codemirror on <a href="https://jsr.io/@hare/decodal-codemirror@0.1.3">jsr</a> / <a href="https://www.npmjs.com/package/decodal-codemirror">npm</a></li>
<li>decodal-codemirror on <a href="https://jsr.io/@hare/decodal-codemirror@0.1.4">jsr</a> / <a href="https://www.npmjs.com/package/decodal-codemirror">npm</a></li>
</ul>
</section>
@@ -49,8 +48,8 @@ Production = Server & {
<article class="home-card">
<h2>Where it runs</h2>
<p>
Use the Rust crate for runtime embedding, the WASM package in browsers, language-tools for formatting,
CodeMirror/Lezer for the Web editor, and Tree-sitter for general editor integration.
Use the Rust crate for runtime embedding, the WASM package in browsers, CodeMirror/Lezer for Web editing
and formatting, and Tree-sitter for general editor integration.
</p>
</article>
<article class="home-card">
+4 -4
View File
@@ -1,10 +1,10 @@
import initRuntime, { evaluateProject } from 'decodal-wasm';
import runtimeWasmUrl from 'decodal-wasm/decodal_wasm_bg.wasm?url';
import initTools, { formatSource } from 'decodal-language-tools';
import toolsWasmUrl from 'decodal-language-tools/decodal_language_tools_bg.wasm?url';
import { EditorView, basicSetup } from 'codemirror';
import { keymap } from '@codemirror/view';
import { decodal } from 'decodal-codemirror';
import { formatDecodal, initDecodalFormatter } from 'decodal-codemirror/format';
import toolsWasmUrl from 'decodal-codemirror/wasm/decodal_language_tools_bg.wasm?url';
import { playgroundExamples } from './playground-examples.js';
const STORAGE_KEY = 'decodal-playground-project-v2';
@@ -221,7 +221,7 @@ function execute() {
}
function formatActiveFile() {
const result = JSON.parse(formatSource(getEditorText()));
const result = formatDecodal(getEditorText());
if (!result.ok) {
output.textContent = result.error;
output.classList.add('error');
@@ -285,7 +285,7 @@ function compareNodes(a, b) {
}
try {
await Promise.all([initRuntime(runtimeWasmUrl), initTools(toolsWasmUrl)]);
await Promise.all([initRuntime(runtimeWasmUrl), initDecodalFormatter(toolsWasmUrl)]);
run.disabled = false;
formatButton.disabled = false;
status.textContent = '';