Make decodal the published library crate

This commit is contained in:
2026-06-25 22:51:16 +09:00
parent 6e2363632b
commit 87fef44c68
20 changed files with 159 additions and 96 deletions
+8 -3
View File
@@ -1,5 +1,5 @@
[package]
name = "decodal"
name = "decodal-cli"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
@@ -9,10 +9,15 @@ readme.workspace = true
description = "Command-line interface for the Decodal data description language."
keywords = ["decodal", "dsl", "config", "cli"]
categories = ["command-line-utilities", "config"]
publish = false
[[bin]]
name = "decodal"
path = "src/main.rs"
[features]
default = []
regex = ["decodal-core/regex"]
regex = ["decodal/regex"]
[dependencies]
decodal-core = { version = "0.1.0", path = "../decodal-core" }
decodal = { version = "0.1.0", path = "../decodal-core" }
+2 -2
View File
@@ -4,7 +4,7 @@ use std::{
process::ExitCode,
};
use decodal_core::{
use decodal::{
Data, Diagnostic, DiagnosticKind, Engine, LoadedSource, SourceId, SourceLoader, Span,
format_diagnostic_with,
};
@@ -28,7 +28,7 @@ fn run() -> Result<(), String> {
Ok(())
}
"--version" | "-V" => {
println!("Decodal {}", decodal_core::version());
println!("Decodal {}", decodal::version());
Ok(())
}
"check" => {
+2 -2
View File
@@ -1,12 +1,12 @@
[package]
name = "decodal-core"
name = "decodal"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
readme.workspace = true
description = "Core parser, evaluator, and embedding API for the Decodal data description language."
description = "Parser, evaluator, and embedding API for the Decodal data description language."
keywords = ["decodal", "dsl", "config", "schema"]
categories = ["config", "parser-implementations"]
+2 -2
View File
@@ -1,6 +1,6 @@
use decodal_core::{Data, EmptyLoader, Engine, HostValue};
use decodal::{Data, EmptyLoader, Engine, HostValue};
fn main() -> decodal_core::Result<()> {
fn main() -> decodal::Result<()> {
let mut engine = Engine::new(EmptyLoader);
engine.bind_global(
+2 -1
View File
@@ -9,12 +9,13 @@ readme.workspace = true
description = "WebAssembly wrapper for evaluating Decodal in browser playgrounds."
keywords = ["decodal", "wasm", "dsl", "config"]
categories = ["wasm", "config"]
publish = false
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
decodal-core = { version = "0.1.0", path = "../decodal-core" }
decodal = { version = "0.1.0", path = "../decodal-core" }
serde_json.workspace = true
wasm-bindgen.workspace = true
+3 -3
View File
@@ -1,6 +1,6 @@
use std::collections::BTreeMap;
use decodal_core::{
use decodal::{
Data, Diagnostic, DiagnosticKind, EmptyLoader, Engine, LoadedSource, SourceId, SourceLoader,
Span, format_diagnostic_with,
};
@@ -81,7 +81,7 @@ impl SourceLoader for VirtualLoader {
&mut self,
current_key: Option<&str>,
specifier: &str,
) -> decodal_core::Result<LoadedSource> {
) -> decodal::Result<LoadedSource> {
let key = resolve_import(current_key, specifier).ok_or_else(|| {
Diagnostic::new(
DiagnosticKind::Import,
@@ -139,7 +139,7 @@ fn normalize_path(path: &str) -> Option<String> {
}
}
fn format_diagnostic_with_root(diagnostic: &decodal_core::Diagnostic, root_name: &str) -> String {
fn format_diagnostic_with_root(diagnostic: &decodal::Diagnostic, root_name: &str) -> String {
format_diagnostic_with(diagnostic, |source| {
(source == SourceId(0)).then_some(root_name)
})