fix compilation errors depending on feature selection and update dependency version

This commit is contained in:
Moritz Hölting 2025-01-17 12:27:25 +01:00
parent 6179bebbf0
commit 8223dccc24
5 changed files with 33 additions and 21 deletions

View File

@ -19,26 +19,26 @@ default = ["fs_access", "lua", "shulkerbox", "zip"]
fs_access = ["shulkerbox?/fs_access"]
lua = ["dep:mlua"]
serde = ["dep:serde", "shulkerbox?/serde"]
shulkerbox = ["dep:shulkerbox"]
shulkerbox = ["dep:shulkerbox", "dep:chksum-md5"]
zip = ["shulkerbox?/zip"]
[target.'cfg(target_arch = "wasm32")'.dependencies]
path-absolutize = { version = "3.1.1", features = ["use_unix_paths_on_wasm"] }
[dependencies]
chksum-md5 = "0.0.0"
colored = "2.1.0"
chksum-md5 = { version = "0.1.0", optional = true }
colored = "3.0.0"
derive_more = { version = "1.0.0", default-features = false, features = ["deref", "deref_mut", "from"] }
enum-as-inner = "0.6.0"
getset = "0.1.2"
itertools = "0.13.0"
mlua = { version = "0.10.0", features = ["lua54", "vendored"], optional = true }
itertools = "0.14.0"
mlua = { version = "0.10.2", features = ["lua54", "vendored"], optional = true }
path-absolutize = "3.1.1"
pathdiff = "0.2.2"
serde = { version = "1.0.214", features = ["derive", "rc"], optional = true }
pathdiff = "0.2.3"
serde = { version = "1.0.217", features = ["derive", "rc"], optional = true }
shulkerbox = { version = "0.1.0", default-features = false, optional = true }
strsim = "0.11.1"
strum = { version = "0.26.2", features = ["derive"] }
strum_macros = "0.26.4"
thiserror = "1.0.65"
tracing = "0.1.40"
thiserror = "2.0.11"
tracing = "0.1.41"

View File

@ -12,6 +12,7 @@
#![warn(missing_docs, clippy::all, clippy::pedantic)]
#![allow(clippy::missing_panics_doc, clippy::missing_const_for_fn)]
#[cfg(feature = "shulkerbox")]
pub use shulkerbox;
pub mod base;

View File

@ -13,7 +13,7 @@ use crate::{
syntax::syntax_tree::expression::Expression,
};
use super::transpiler::FunctionData;
use super::FunctionData;
/// Errors that can occur during transpilation.
#[allow(clippy::module_name_repetitions, missing_docs)]
@ -44,6 +44,7 @@ pub struct MissingFunctionDeclaration {
}
impl MissingFunctionDeclaration {
#[cfg_attr(not(feature = "shulkerbox"), expect(unused))]
pub(super) fn from_context(
identifier_span: Span,
functions: &BTreeMap<(String, String), FunctionData>,

View File

@ -1,9 +1,14 @@
//! The transpile module is responsible for transpiling the abstract syntax tree into a data pack.
use std::collections::HashMap;
use crate::{base::source_file::Span, syntax::syntax_tree::statement::Statement};
#[doc(hidden)]
#[cfg(feature = "shulkerbox")]
pub mod conversions;
mod error;
#[doc(inline)]
#[allow(clippy::module_name_repetitions)]
pub use error::{TranspileError, TranspileResult};
@ -11,7 +16,18 @@ pub use error::{TranspileError, TranspileResult};
pub mod lua;
#[cfg(feature = "shulkerbox")]
mod transpiler;
#[doc(inline)]
#[cfg(feature = "shulkerbox")]
#[cfg_attr(feature = "shulkerbox", doc(inline))]
pub use transpiler::Transpiler;
#[cfg(feature = "shulkerbox")]
mod util;
#[derive(Debug, Clone, PartialEq, Eq)]
pub(super) struct FunctionData {
pub(super) namespace: String,
pub(super) identifier_span: Span,
pub(super) statements: Vec<Statement>,
pub(super) public: bool,
pub(super) annotations: HashMap<String, Option<String>>,
}

View File

@ -26,7 +26,10 @@ use crate::{
transpile::error::{ConflictingFunctionNames, MissingFunctionDeclaration},
};
use super::error::{TranspileError, TranspileResult, UnexpectedExpression};
use super::{
error::{TranspileError, TranspileResult, UnexpectedExpression},
FunctionData,
};
/// A transpiler for `Shulkerscript`.
#[derive(Debug)]
@ -40,15 +43,6 @@ pub struct Transpiler {
aliases: HashMap<(String, String), (String, String)>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub(super) struct FunctionData {
pub(super) namespace: String,
pub(super) identifier_span: Span,
pub(super) statements: Vec<Statement>,
pub(super) public: bool,
pub(super) annotations: HashMap<String, Option<String>>,
}
impl Transpiler {
/// Creates a new transpiler.
#[must_use]