Revert "Add Decodal formatter"

This reverts commit 22f6bc1ab9.
This commit is contained in:
2026-07-09 17:46:24 +09:00
parent 22f6bc1ab9
commit ac99c4cb4e
16 changed files with 24 additions and 606 deletions
+1 -19
View File
@@ -2,7 +2,7 @@ use std::collections::BTreeMap;
use decodal::{
Data, Diagnostic, DiagnosticKind, EmptyLoader, Engine, LoadedSource, SourceId, SourceLoader,
Span, format_diagnostic_with, format_source,
Span, format_diagnostic_with,
};
use wasm_bindgen::prelude::*;
@@ -11,17 +11,6 @@ pub fn evaluate(source: &str) -> String {
encode_result(evaluate_inner(source))
}
#[wasm_bindgen(js_name = formatSource)]
pub fn format_source_json(source: &str) -> String {
match format_source(source) {
Ok(formatted) => format!("{{\"ok\":true,\"source\":{}}}", json_string(&formatted)),
Err(error) => format!(
"{{\"ok\":false,\"error\":{}}}",
json_string(&format_diagnostic_with_root(&error, "playground"))
),
}
}
#[wasm_bindgen(js_name = evaluateProject)]
pub fn evaluate_project(entry: &str, files_json: &str) -> String {
encode_result(evaluate_project_inner(entry, files_json))
@@ -225,13 +214,6 @@ fn json_string(value: &str) -> String {
mod tests {
use super::{evaluate_project_inner, normalize_path, resolve_import};
#[test]
fn formats_source_for_web() {
let output = super::format_source_json("value={a=1;};");
assert!(output.contains("\"ok\":true"));
assert!(output.contains("value = {\\n a = 1;\\n};\\n"));
}
#[test]
fn normalizes_virtual_paths() {
assert_eq!(