From 8f43c895074bab7d27d4ba614f4a6b0594852bbd Mon Sep 17 00:00:00 2001 From: Tim van Elsloo Date: Sun, 15 Jan 2023 23:13:36 +0100 Subject: [PATCH] Renamed `litho-export` to `litho-codegen`. --- Cargo.toml | 4 ++-- litho-cli/Cargo.toml | 2 +- litho-cli/src/commands/generate.rs | 2 +- {litho-export => litho-codegen}/Cargo.toml | 2 +- {litho-export => litho-codegen}/src/lib.rs | 16 ++++++++-------- .../src/typescript/generator.rs | 0 .../src/typescript/line_index.rs | 0 .../src/typescript/mod.rs | 2 +- .../src/typescript/source_mapped.rs | 0 9 files changed, 14 insertions(+), 14 deletions(-) rename {litho-export => litho-codegen}/Cargo.toml (93%) rename {litho-export => litho-codegen}/src/lib.rs (60%) rename {litho-export => litho-codegen}/src/typescript/generator.rs (100%) rename {litho-export => litho-codegen}/src/typescript/line_index.rs (100%) rename {litho-export => litho-codegen}/src/typescript/mod.rs (97%) rename {litho-export => litho-codegen}/src/typescript/source_mapped.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 03924bc..b6c5882 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,14 @@ [workspace] members = [ "litho-cli", + "litho-codegen", "litho-compiler", "litho-diagnostics", - "litho-export", "litho-import", "litho-language", "litho-lsp", "litho-lsp-wasm", "litho-tests", "litho-types", - "litho-validation", + "litho-validation", ] diff --git a/litho-cli/Cargo.toml b/litho-cli/Cargo.toml index cf89955..cfe0fdf 100644 --- a/litho-cli/Cargo.toml +++ b/litho-cli/Cargo.toml @@ -8,8 +8,8 @@ edition = "2021" name = "litho" [dependencies] +litho-codegen = { path = "../litho-codegen" } litho-compiler = { path = "../litho-compiler" } -litho-export = { path = "../litho-export" } litho-language = { path = "../litho-language" } ariadne = "0.1.5" diff --git a/litho-cli/src/commands/generate.rs b/litho-cli/src/commands/generate.rs index 30efa5e..303e7c9 100644 --- a/litho-cli/src/commands/generate.rs +++ b/litho-cli/src/commands/generate.rs @@ -105,7 +105,7 @@ pub fn generate() -> ExitCode { match success { true => { for output in outputs { - litho_export::export( + litho_codegen::codegen( workspace.compiler().database(), workspace .files() diff --git a/litho-export/Cargo.toml b/litho-codegen/Cargo.toml similarity index 93% rename from litho-export/Cargo.toml rename to litho-codegen/Cargo.toml index 3d21249..9dd6824 100644 --- a/litho-export/Cargo.toml +++ b/litho-codegen/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "litho-export" +name = "litho-codegen" version = "0.0.0" edition = "2021" diff --git a/litho-export/src/lib.rs b/litho-codegen/src/lib.rs similarity index 60% rename from litho-export/src/lib.rs rename to litho-codegen/src/lib.rs index d982401..2bb5708 100644 --- a/litho-export/src/lib.rs +++ b/litho-codegen/src/lib.rs @@ -8,25 +8,25 @@ use litho_types::Database; mod typescript; -use typescript::{export_typescript, TypescriptError}; +use typescript::{codegen_typescript, TypescriptError}; #[derive(Debug)] -pub enum ExportError { +pub enum CodegenError { UnrecognizedExtension, Typescript(TypescriptError), } -impl From for ExportError { +impl From for CodegenError { fn from(value: TypescriptError) -> Self { - ExportError::Typescript(value) + CodegenError::Typescript(value) } } -pub fn export( +pub fn codegen( database: &Database, source_map: HashMap, path: P, -) -> Result<(), ExportError> +) -> Result<(), CodegenError> where T: Eq + Hash + Borrow, P: AsRef, @@ -34,7 +34,7 @@ where let path = path.as_ref(); match path.extension().and_then(|ext| ext.to_str()) { - Some("js" | "ts") => export_typescript(database, source_map, path).map_err(Into::into), - _ => Err(ExportError::UnrecognizedExtension), + Some("js" | "ts") => codegen_typescript(database, source_map, path).map_err(Into::into), + _ => Err(CodegenError::UnrecognizedExtension), } } diff --git a/litho-export/src/typescript/generator.rs b/litho-codegen/src/typescript/generator.rs similarity index 100% rename from litho-export/src/typescript/generator.rs rename to litho-codegen/src/typescript/generator.rs diff --git a/litho-export/src/typescript/line_index.rs b/litho-codegen/src/typescript/line_index.rs similarity index 100% rename from litho-export/src/typescript/line_index.rs rename to litho-codegen/src/typescript/line_index.rs diff --git a/litho-export/src/typescript/mod.rs b/litho-codegen/src/typescript/mod.rs similarity index 97% rename from litho-export/src/typescript/mod.rs rename to litho-codegen/src/typescript/mod.rs index 01f2849..9dd568a 100644 --- a/litho-export/src/typescript/mod.rs +++ b/litho-codegen/src/typescript/mod.rs @@ -26,7 +26,7 @@ impl From for TypescriptError { } } -pub fn export_typescript( +pub fn codegen_typescript( database: &Database, source_map: HashMap, path: &Path, diff --git a/litho-export/src/typescript/source_mapped.rs b/litho-codegen/src/typescript/source_mapped.rs similarity index 100% rename from litho-export/src/typescript/source_mapped.rs rename to litho-codegen/src/typescript/source_mapped.rs