Skip to content

Commit

Permalink
upstream dalbit
Browse files Browse the repository at this point in the history
  • Loading branch information
orpos committed Dec 11, 2024
1 parent db102ba commit d841333
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
18 changes: 14 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ futures = "0.3.31"
strum_macros = "0.26.4"
strum = { version = "0.26.3", features = ["strum_macros"] }
indexmap = "2.7.0"
kaledis_dalbit = { version = "0.1.0" }
kaledis_dalbit = { version = "0.1.1" }
18 changes: 8 additions & 10 deletions src/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use strum::IntoEnumIterator;
use tokio::io::{ AsyncReadExt, AsyncWriteExt };
use tokio::fs::{ self, create_dir, remove_dir_all, File };

use dal_core::{ manifest::Manifest, transpile };
use kaledis_dalbit::{ manifest::Manifest, transpile };

use crate::cli_utils::LoadingStatusBar;
use crate::{ toml_conf::{ Config, Modules }, utils::relative };
Expand Down Expand Up @@ -121,16 +121,16 @@ impl Builder {
}
pub async fn process_file(&self, input: PathBuf, output: PathBuf) -> anyhow::Result<()> {
let mut additional_rules = vec![
dal_core::modifiers::Modifier::DarkluaRule(
Box::new(dal_core::modifiers::ModifyRelativePath {
kaledis_dalbit::modifiers::Modifier::DarkluaRule(
Box::new(kaledis_dalbit::modifiers::ModifyRelativePath {
project_root: self.local.clone(),
})
)
];
if let Some(modules) = &self.used_modules {
additional_rules.push(
dal_core::modifiers::Modifier::DarkluaRule(
Box::new(dal_core::modifiers::GetLoveModules {
kaledis_dalbit::modifiers::Modifier::DarkluaRule(
Box::new(kaledis_dalbit::modifiers::GetLoveModules {
modules: Arc::clone(modules),
})
)
Expand All @@ -140,7 +140,7 @@ impl Builder {
new_manifest.input = input;
new_manifest.output = output;
new_manifest.minify = if self.strategy == Strategy::BuildDev { true } else { false };
transpile::process(new_manifest).await?;
transpile::process(new_manifest, Some(&mut additional_rules)).await?;
return Ok(());
}
pub async fn add_luau_file(&mut self, input: &PathBuf) -> anyhow::Result<()> {
Expand Down Expand Up @@ -257,7 +257,7 @@ pub async fn get_transpiler(one_file: bool) -> anyhow::Result<Manifest> {
let mut manifest = Manifest {
minify: true,
file_extension: Some("lua".to_string()),
target_version: dal_core::TargetVersion::Lua51,
target_version: kaledis_dalbit::TargetVersion::Lua51,
bundle: one_file,
..Default::default()
};
Expand All @@ -280,9 +280,7 @@ pub async fn get_transpiler(one_file: bool) -> anyhow::Result<Manifest> {
"remove_unused_if_branch"
);
// Thanks to new dalbit version this was made much easier
if let Some(polyfill) = manifest.polyfills.iter_mut().next() {
polyfill.cache().await?;
}
manifest.polyfill.cache().await?;
return Ok(manifest);
}

Expand Down

0 comments on commit d841333

Please sign in to comment.