From cdcc69f975cb3130573682135ec907be0af71a49 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 2 Jun 2026 23:24:05 +0200 Subject: [PATCH 1/7] Bootstrapped builder --- crates/mist-api/src/builder.rs | 187 --------------------------------- 1 file changed, 187 deletions(-) delete mode 100644 crates/mist-api/src/builder.rs diff --git a/crates/mist-api/src/builder.rs b/crates/mist-api/src/builder.rs deleted file mode 100644 index ec74fc6..0000000 --- a/crates/mist-api/src/builder.rs +++ /dev/null @@ -1,187 +0,0 @@ -use std::{ - collections::HashMap, - env, fs, - path::{MAIN_SEPARATOR, PathBuf}, - process::{Command, Stdio}, -}; - -use cargo_metadata::{CompilerMessage, Message}; -use mist_parser::rev_mapper::{RustMap, find_mapping, get_mapping}; - -#[derive(Debug, Clone)] -pub struct MistDiagnosticMessage { - pub message: String, - pub file_path: PathBuf, - pub file_name: String, - pub line: usize, - pub column: usize, -} - -#[derive(Debug, Clone)] -pub enum MistDiagnostic { - Error(MistDiagnosticMessage), - Warning(MistDiagnosticMessage), - Rust(CompilerMessage), -} - -pub fn build(mut args: Vec, root: PathBuf) -> bool { - args.remove(0); - args.insert(1, "--message-format=json".to_string()); - - let is_root = root == env::current_dir().expect("Failed getting env"); - - let mut command = Command::new("cargo") - .args(args) - .stdout(Stdio::piped()) - .stderr(Stdio::inherit()) - .stdin(Stdio::inherit()) - .spawn() - .expect("Failed to run cargo"); - - let mut reader = std::io::BufReader::new(command.stdout.take().expect("Failed to get reader")); - - let mut diagnostics = Vec::new(); - - let mut mapping = HashMap::new(); - - let mist_src = format!(".mist{MAIN_SEPARATOR}src"); - - for message in cargo_metadata::Message::parse_stream(&mut reader) { - match message { - Ok(Message::CompilerMessage(msg)) => { - for span in &msg.message.spans { - if span.is_primary { - let rust_path = root.join(&span.file_name); - - let mist_file = span - .file_name - .replacen(&mist_src, "src", 1) - .trim_end_matches(".rs") - .to_string() - + ".mist"; - - let mist_path = root.join(&mist_file); - - if !fs::exists(&mist_path).expect("Unable to check if mist file exists") { - diagnostics.push(MistDiagnostic::Rust(msg)); - break; - } - - let map = mapping.entry(rust_path.clone()).or_insert_with(|| { - get_mapping( - &fs::read_to_string(rust_path) - .expect("Failed to read file for mapping"), - ) - }); - - let mist_span = - find_mapping(&map, &RustMap(span.line_end, span.column_start)) - .expect("Unable to find mapping"); - - let mist_msg = MistDiagnosticMessage { - message: format!( - "{}: {}", - msg.message.message, - span.label.clone().unwrap_or_default() - ), - file_name: if is_root { - mist_file - } else { - mist_path.to_string_lossy().to_string() - }, - file_path: mist_path, - line: mist_span.1.0, - column: mist_span.1.1, - }; - - match msg.message.level { - cargo_metadata::diagnostic::DiagnosticLevel::Error => { - diagnostics.push(MistDiagnostic::Error(mist_msg)) - } - - cargo_metadata::diagnostic::DiagnosticLevel::Warning => { - diagnostics.push(MistDiagnostic::Warning(mist_msg)) - } - - _ => {} - } - } - } - } - - Ok(Message::BuildFinished(finish)) => { - print_diagnostics(&diagnostics); - - let mut raw_reader = reader.into_inner(); - let mut stdout = std::io::stdout(); - - std::io::copy(&mut raw_reader, &mut stdout) - .map_err(|v| v.to_string()) - .expect("(Mist) Failed to copy IO"); - - command.wait().unwrap(); - - return finish.success; - } - - Ok(Message::TextLine(text)) => println!("{text}"), - _ => {} - } - } - - false -} - -pub fn print_diagnostics(diagnostics: &Vec) { - let mut files = HashMap::new(); - - for diag in diagnostics { - match diag { - MistDiagnostic::Error(msg) => { - let line = get_line(&mut files, &msg); - - println!( - "\n{}:{}:{}\n \x1b[31mError\x1b[0m: {}\n\t{}", - msg.file_name, - msg.line, - msg.column, - msg.message, - line.unwrap_or_default(), - ) - } - - MistDiagnostic::Warning(msg) => { - let line = get_line(&mut files, &msg); - - println!( - "\n{}:{}:{}\n \x1b[33mWarning\x1b[0m: {}\n\t{}", - msg.file_name, - msg.line, - msg.column, - msg.message, - line.unwrap_or_default(), - ) - } - - MistDiagnostic::Rust(rs) => println!("{rs}"), - } - } -} - -pub fn get_line( - files: &mut HashMap>, - msg: &MistDiagnosticMessage, -) -> Option { - let src_path = msg.file_path.clone(); - - let lines = files.entry(src_path.clone()).or_insert_with(|| { - fs::read_to_string(src_path) - .expect("Unable to read mist file") - .lines() - .into_iter() - .map(String::from) - .collect() - }); - - lines.get(msg.line - 1).map(|v| v.trim().to_string()) -} From 280e11a95eaf5268da762247208160573f093518 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 2 Jun 2026 23:24:11 +0200 Subject: [PATCH 2/7] Bootstrapped builder --- crates/mist-api/src/builder.mist | 188 +++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 crates/mist-api/src/builder.mist diff --git a/crates/mist-api/src/builder.mist b/crates/mist-api/src/builder.mist new file mode 100644 index 0000000..90a9bd9 --- /dev/null +++ b/crates/mist-api/src/builder.mist @@ -0,0 +1,188 @@ +use ; +use ; +use ; +use ; +use ; +use ; +use ; +use ; +use ; +use ; + +#[derive(Debug, Clone)] +pub struct MistDiagnosticMessage { + pub String message, + pub PathBuf file_path, + pub String file_name, + pub usize line, + pub usize column, +} + +#[derive(Debug, Clone)] +pub enum MistDiagnostic { + Error[MistDiagnosticMessage], + Warning[MistDiagnosticMessage], + Rust[CompilerMessage], +} + +pub bool build(Vec mut args, PathBuf root) { + args.remove(0); + args.insert(1, "--message-format=json".to_string()); + + var is_root = root == env::current_dir().expect("Failed getting env"); + + var mut command = Command::new("cargo") + .args(args) + .stdout(Stdio::piped()) + .stderr(Stdio::inherit()) + .stdin(Stdio::inherit()) + .spawn() + .expect("Failed to run cargo"); + + var mut reader = std::io::BufReader::new(command.stdout.take().expect("Failed to get reader")); + + var mut diagnostics = Vec::new(); + + var mut mapping = HashMap::new(); + + var mist_src = format!(".mist{MAIN_SEPARATOR}src"); + + for (message : cargo_metadata::Message::parse_stream(&mut reader)) { + match (message) { + Ok[Message::CompilerMessage[msg]] => { + for (span : &msg.message.spans) { + if (span.is_primary) { + var rust_path = root.join(&span.file_name); + + var mist_file = span + .file_name + .replacen(&mist_src, "src", 1) + .trim_end_matches(".rs") + .to_string() + + ".mist"; + + var mist_path = root.join(&mist_file); + + if (!fs::exists(&mist_path).expect("Unable to check if mist file exists")) { + diagnostics.push(MistDiagnostic::Rust(msg)); + break; + } + + var map = mapping.entry(rust_path.clone()).or_insert_with(|| { + rev_mapper::get_mapping( + &fs::read_to_string(rust_path) + .expect("Failed to read file for mapping") + ) + }); + + var [_, rev_mapper::MistMap[line, column]] = + rev_mapper::find_mapping(&map, &rev_mapper::RustMap(span.line_end, span.column_start)) + .expect("Unable to find mapping"); + + var mist_msg = MistDiagnosticMessage { + message: format!( + "{}: {}", + msg.message.message, + span.label.clone().unwrap_or_default() + ), + file_name: if (is_root) { + mist_file + } else { + mist_path.to_string_lossy().to_string() + }, + file_path: mist_path, + line: line, + column: column + }; + + match (msg.message.level) { + cargo_metadata::diagnostic::DiagnosticLevel::Error => { + diagnostics.push(MistDiagnostic::Error(mist_msg)) + } + + cargo_metadata::diagnostic::DiagnosticLevel::Warning => { + diagnostics.push(MistDiagnostic::Warning(mist_msg)) + } + + _ => {} + } + } + } + } + + Ok[Message::BuildFinished[finish]] => { + print_diagnostics(&diagnostics); + + var mut raw_reader = reader.into_inner(); + var mut stdout = std::io::stdout(); + + std::io::copy(&mut raw_reader, &mut stdout) + .map_err(|var v| v.to_string()) + .expect("(Mist) Failed to copy IO"); + + command.wait().unwrap(); + + return finish.success; + } + + Ok[Message::TextLine[text]] => println!("{text}"); + _ => {} + } + } + + false +} + +pub void print_diagnostics(Vec* diagnostics) { + var mut files = HashMap::new(); + + for (diag : diagnostics) { + match (diag) { + MistDiagnostic::Error[msg] => { + var line = get_line(&mut files, &msg); + + println!( + "\n{}:{}:{}\n \x1b[31mError\x1b[0m: {}\n\t{}", + msg.file_name, + msg.line, + msg.column, + msg.message, + line.unwrap_or_default(), + ) + } + + MistDiagnostic::Warning[msg] => { + var line = get_line(&mut files, &msg); + + println!( + "\n{}:{}:{}\n \x1b[33mWarning\x1b[0m: {}\n\t{}", + msg.file_name, + msg.line, + msg.column, + msg.message, + line.unwrap_or_default(), + ) + } + + MistDiagnostic::Rust[rs] => println!("{rs}"); + } + } +} + +pub Option get_line( + HashMap> mut* files, + MistDiagnosticMessage* msg, +) { + var src_path = msg.file_path.clone(); + + var lines = files.entry(src_path.clone()).or_insert_with(|| { + fs::read_to_string(src_path) + .expect("Unable to read mist file") + .lines() + .into_iter() + .map(String::from) + .collect() + }); + + lines.get(msg.line - 1).map(|var v| v.trim().to_string()) +} From 8a0eee547df87ee4c8ff8a836d4a801adb808a4e Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Tue, 2 Jun 2026 23:28:59 +0200 Subject: [PATCH 3/7] Removed warnings from transpiler --- crates/mist-api/src/transpiler.mist | 3 +-- src/main.mist | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/mist-api/src/transpiler.mist b/crates/mist-api/src/transpiler.mist index da5a49b..330ee6e 100644 --- a/crates/mist-api/src/transpiler.mist +++ b/crates/mist-api/src/transpiler.mist @@ -1,5 +1,4 @@ use ; -use ; use ; use ; use ; @@ -8,7 +7,7 @@ use ; use ; use ; -pub PathBuf build(bool force) { +pub PathBuf transpile() { var start = time::Instant::now(); var root = env::current_dir().expect("Unable to find project root"); diff --git a/src/main.mist b/src/main.mist index 671bf6a..0c76e2d 100644 --- a/src/main.mist +++ b/src/main.mist @@ -14,7 +14,7 @@ void main() { match (args[1].as_str()) { "run" | "build" | "check" | "r" | "b" | "c" => { - var root = transpiler::build(false); + var root = transpiler::transpile(); println!(""); @@ -25,7 +25,7 @@ void main() { } } "transpile" | "t" => { - transpiler::build(args.get(2).is_some()); + transpiler::transpile(); } "init" => { init_project(args); From e0b52a02164130acc4ed9a2b5ddf689ec3104a47 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Wed, 3 Jun 2026 15:44:41 +0200 Subject: [PATCH 4/7] Fixed sidefiles in module system --- crates/mist-api/src/modules.mist | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/crates/mist-api/src/modules.mist b/crates/mist-api/src/modules.mist index edf47d2..536f0e8 100644 --- a/crates/mist-api/src/modules.mist +++ b/crates/mist-api/src/modules.mist @@ -22,12 +22,14 @@ pub class Module { if (pkg_gate.exists()) { self.path = pkg_gate; } - + self.scan_directory(&dir, &rust_path); } } void scan_directory(self mut*, Path* search_dir, Path* rust_path) { + fs::create_dir_all(rust_path).expect("Failed to create dir"); + var entries = match (fs::read_dir(search_dir)) { Ok[entries] => entries; Err[e] => { @@ -51,6 +53,16 @@ pub class Module { continue; } + if (!child_path.is_dir() && child_path.extension().and_then(|var v| v.to_str()) != Some("mist")) { + var file_name = child_path.file_name() + .and_then(|var s| s.to_str()) + .expect("Failed to get file name"); + + fs::copy(&child_path, rust_path.join(&file_name)).expect("Failed to copy SideFile"); + + continue; + } + String child_name = child_path.file_stem() .and_then(|var s| s.to_str()) .expect("Failed to get module name") @@ -58,7 +70,7 @@ pub class Module { PathBuf child_output = rust_path.join(&child_name).with_extension("rs"); - if (!child_path.is_dir() && should_skip(&child_path, &child_output)) { + if (should_skip(&child_path, &child_output)) { continue; } @@ -92,11 +104,13 @@ pub Module master_package(PathBuf mist_path, PathBuf rust_path) { var mut root_mod = new Module(name, mist_path.clone(), rust_path.clone()); if (!mist_path.is_dir()) { - PathBuf parent_dir = mist_path.parent() - .expect("Failed to get parent directory of root file") - .to_path_buf(); - - root_mod.scan_directory(&parent_dir, &rust_path); + Path* parent_dir = mist_path.parent() + .expect("Failed to get parent directory of root file"); + + Path* rust_path = rust_path.parent() + .expect("Failed to get parent directory of rust path"); + + root_mod.scan_directory(parent_dir, rust_path); } root_mod From 71e4f74c248113fce762b4ee1c8bae55b18d5bd5 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Wed, 3 Jun 2026 16:00:23 +0200 Subject: [PATCH 5/7] Fixed module system --- crates/mist-api/src/modules.mist | 57 +++---------- crates/mist-api/src/transpiler.mist | 2 +- mist-test/src/app.mist | 123 ---------------------------- mist-test/src/event.mist | 7 -- mist-test/src/logger.mist | 72 ---------------- mist-test/src/main.mist | 23 +----- mist-test/src/plugin.mist | 16 ---- mist-test/src/task.mist | 20 ----- mist-test/src/test_package.mist | 3 + 9 files changed, 19 insertions(+), 304 deletions(-) delete mode 100644 mist-test/src/app.mist delete mode 100644 mist-test/src/event.mist delete mode 100644 mist-test/src/logger.mist delete mode 100644 mist-test/src/plugin.mist delete mode 100644 mist-test/src/task.mist create mode 100644 mist-test/src/test_package.mist diff --git a/crates/mist-api/src/modules.mist b/crates/mist-api/src/modules.mist index 536f0e8..6a7b1b1 100644 --- a/crates/mist-api/src/modules.mist +++ b/crates/mist-api/src/modules.mist @@ -9,27 +9,27 @@ pub class Module { pub PathBuf path; pub Vec children; - pub constructor(String name, PathBuf mist_path, PathBuf rust_path) { + pub constructor(PathBuf mist_path) { self.children = new Vec(); - self.name = name; + self.name = mist_path.file_stem() + .and_then(|var s| s.to_str()) + .expect("Failed to get module name") + .to_string(); self.path = mist_path; if (self.path.is_dir()) { PathBuf dir = self.path.clone(); - // Behavior 2: It's a directory node. Check for gateway package.mist first. PathBuf pkg_gate = self.path.join("package.mist"); if (pkg_gate.exists()) { self.path = pkg_gate; } - self.scan_directory(&dir, &rust_path); + self.scan_directory(&dir); } } - void scan_directory(self mut*, Path* search_dir, Path* rust_path) { - fs::create_dir_all(rust_path).expect("Failed to create dir"); - + void scan_directory(self mut*, Path* search_dir) { var entries = match (fs::read_dir(search_dir)) { Ok[entries] => entries; Err[e] => { @@ -53,28 +53,7 @@ pub class Module { continue; } - if (!child_path.is_dir() && child_path.extension().and_then(|var v| v.to_str()) != Some("mist")) { - var file_name = child_path.file_name() - .and_then(|var s| s.to_str()) - .expect("Failed to get file name"); - - fs::copy(&child_path, rust_path.join(&file_name)).expect("Failed to copy SideFile"); - - continue; - } - - String child_name = child_path.file_stem() - .and_then(|var s| s.to_str()) - .expect("Failed to get module name") - .to_string(); - - PathBuf child_output = rust_path.join(&child_name).with_extension("rs"); - - if (should_skip(&child_path, &child_output)) { - continue; - } - - self.children.push(new Module(child_name, child_path, child_output)); + self.children.push(new Module(child_path)); } } @@ -95,23 +74,13 @@ pub class Module { } } -pub Module master_package(PathBuf mist_path, PathBuf rust_path) { - String name = mist_path.file_stem() - .and_then(|var s| s.to_str()) - .expect("Failed to get module name") - .to_string(); +pub Module master_package(PathBuf mist_path) { + var mut root_mod = new Module(mist_path.clone()); - var mut root_mod = new Module(name, mist_path.clone(), rust_path.clone()); + Path* parent_dir = mist_path.parent() + .expect("Failed to get parent directory of root file"); - if (!mist_path.is_dir()) { - Path* parent_dir = mist_path.parent() - .expect("Failed to get parent directory of root file"); - - Path* rust_path = rust_path.parent() - .expect("Failed to get parent directory of rust path"); - - root_mod.scan_directory(parent_dir, rust_path); - } + root_mod.scan_directory(parent_dir); root_mod } diff --git a/crates/mist-api/src/transpiler.mist b/crates/mist-api/src/transpiler.mist index 330ee6e..39b8240 100644 --- a/crates/mist-api/src/transpiler.mist +++ b/crates/mist-api/src/transpiler.mist @@ -15,7 +15,7 @@ pub PathBuf transpile() { PathBuf src = root.join("src"); PathBuf out = root.join(".mist/src"); - var master = modules::master_package(src.join("main.mist"), out.join("main.rs")); + var master = modules::master_package(src.join("main.mist")); master.transpile(&out); diff --git a/mist-test/src/app.mist b/mist-test/src/app.mist deleted file mode 100644 index 9e68eb4..0000000 --- a/mist-test/src/app.mist +++ /dev/null @@ -1,123 +0,0 @@ -use ; -use ; -use ; - -pub class Application { - String name; - - Vec tasks; - Vec plugins; - - logger::Logger logger; - - bool running; - i32 ticks; - - pub constructor(str* name) { - self.name = name.to_string(); - self.tasks = new Vec(); - self.plugins = new Vec(); - - self.logger = new logger::Logger("app"); - - self.running = false; - self.ticks = 0; - } - - pub void boot(self mut*) { - self.logger.info("booting application"); - - self.running = true; - - self.emit(event::Event::Startup); - } - - pub void run(self mut*) { - while(self.running) { - self.tick(); - - if(self.ticks >= 5) { - self.shutdown(); - } - } - } - - void tick(self mut*) { - self.logger.info("tick"); - - self.ticks++; - - var task = task::create_task("background-job"); - - self.tasks.push(task); - - println!("tasks: {}", self.tasks.len()); - } - - pub void shutdown(self mut*) { - self.emit(event::Event::Shutdown); - - self.logger.warning("shutdown"); - - self.running = false; - } - - pub void register_plugin(self mut*, String name) { - self.plugins.push(name.clone()); - - self.emit(event::Event::PluginLoaded(name)); - } - - void emit(self*, event::Event event) { - match(event) { - event::Event::Startup => { - self.logger.info("startup event"); - } - - event::Event::Shutdown => { - self.logger.info("shutdown event"); - } - - event::Event::PluginLoaded[name] => { - println!("plugin loaded: {}", name); - } - - event::Event::TaskExecuted[name] => { - println!("task executed: {}", name); - } - - event::Event::Error[message] => { - self.logger.error(&message); - } - } - } -} - -i32 test_stmt() { - if (0 == 0) { - 0 - } - else { - 1 - } -} - -void loops_test() { - for (x : 0..10) { - println!("{x}"); - } - - for (var mut i = 0; i < 10; i++) { - println!("{i}"); - } - - var i = 0; - - while (i == 1) { - println!("hi"); - } - - loop { - println!("loop!"); - } -} diff --git a/mist-test/src/event.mist b/mist-test/src/event.mist deleted file mode 100644 index 61a1292..0000000 --- a/mist-test/src/event.mist +++ /dev/null @@ -1,7 +0,0 @@ -pub enum Event { - Startup, - Shutdown, - TaskExecuted[String], - PluginLoaded[String], - Error[String], -} \ No newline at end of file diff --git a/mist-test/src/logger.mist b/mist-test/src/logger.mist deleted file mode 100644 index fab6cea..0000000 --- a/mist-test/src/logger.mist +++ /dev/null @@ -1,72 +0,0 @@ -use ; -use ; - -pub trait TestLogging: fmt::Display { - String get(self*); -} - -pub enum LogLevel { - Info, - Warning, - Error, -} - -impl fmt::Display for LogLevel { - fmt::Result fmt(self*, Formatter<'_> mut* f) { - match (self) { - LogLevel::Info => write!(f, "[INFO]"); - - LogLevel::Warning => write!(f, "[WARN]"); - - LogLevel::Error => write!(f, "[ERROR]"); - } - } -} - -impl TestLogging for LogLevel { - String get(self*) { - return format!("{self}"); - } -} - -pub class Logger { - String prefix; - - pub constructor(str* prefix) { - self.prefix = prefix.to_string(); - } - - pub void info(self*, str* message) { - self.log(LogLevel::Info, message); - } - - pub void warning(self*, str* message) { - self.log(LogLevel::Warning, message); - } - - pub void error(self*, str* message) { - self.log(LogLevel::Error, message); - } - - void log(self*, LogLevel level, str* message) { - match(level) { - LogLevel::Info => { - println!("{level} {} {}", self.prefix, message); - } - - LogLevel::Warning => { - println!("{} {} {}", level.get(), self.prefix, message); - } - - LogLevel::Error => { - println!("{level} {} {}", self.prefix, message); - } - } - } - - impl fmt::Display { - fmt::Result fmt(self*, Formatter<'_> mut* f) { - write!(f, "logger ({})", self.prefix) - } - } -} \ No newline at end of file diff --git a/mist-test/src/main.mist b/mist-test/src/main.mist index 317b44f..a6546d1 100644 --- a/mist-test/src/main.mist +++ b/mist-test/src/main.mist @@ -1,22 +1,3 @@ void main() { - var mut app_instance = new app::Application("mist-app"); - - app_instance.boot(); - app_instance.run(); -} - -void do_stuff() { - vec!(1, 2, 3).into_iter().map(Option |var v| {Some(v)}).collect::>(); - - if (43==69) testing1(); -} - -i32 testing1() { - - i32 v = if (0 == 0) { - 0 - } else { - 1 - }; - v -} + test_package::hello(); +} \ No newline at end of file diff --git a/mist-test/src/plugin.mist b/mist-test/src/plugin.mist deleted file mode 100644 index a3d16ba..0000000 --- a/mist-test/src/plugin.mist +++ /dev/null @@ -1,16 +0,0 @@ -pub struct PluginInfo { - pub String name, - pub String version, -} - -pub class PluginRegistry { - T plugins; - - pub constructor(T plugins) { - self.plugins = plugins; - } - - pub T plugins(self) { - return self.plugins; - } -} \ No newline at end of file diff --git a/mist-test/src/task.mist b/mist-test/src/task.mist deleted file mode 100644 index a90f9e3..0000000 --- a/mist-test/src/task.mist +++ /dev/null @@ -1,20 +0,0 @@ -pub enum TaskState { - Pending, - Running, - Finished, - Failed, -} - -pub struct Task { - pub String name, - pub TaskState state, - pub i32 executions, -} - -pub Task create_task(str* name) { - Task { - name: name.to_string(), - state: TaskState::Pending, - executions: 0, - } -} \ No newline at end of file diff --git a/mist-test/src/test_package.mist b/mist-test/src/test_package.mist new file mode 100644 index 0000000..c35a53e --- /dev/null +++ b/mist-test/src/test_package.mist @@ -0,0 +1,3 @@ +pub void hello() { + println!("Hello") +} \ No newline at end of file From 248462e467bbbcb725657abc012b98cd9b155217 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Wed, 3 Jun 2026 16:17:21 +0200 Subject: [PATCH 6/7] Sidefiles and empty dir ignore --- crates/mist-api/src/transpiler.mist | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/mist-api/src/transpiler.mist b/crates/mist-api/src/transpiler.mist index 39b8240..789c422 100644 --- a/crates/mist-api/src/transpiler.mist +++ b/crates/mist-api/src/transpiler.mist @@ -31,6 +31,16 @@ pub PathBuf transpile() { impl modules::Module { String transpile(self*, PathBuf* parent_dir) { + if (!self.path.is_dir() && self.path.extension().and_then(|var v| v.to_str()) != Some("mist")) { + var file_name = self.path.file_name() + .and_then(|var s| s.to_str()) + .expect("Failed to get file name"); + + fs::copy(&self.path, parent_dir.join(&file_name)).expect("Failed to copy SideFile"); + + return String::new(); + } + PathBuf dir = self.output_dir(&parent_dir); PathBuf output_file = self.output_path(&parent_dir); @@ -43,6 +53,10 @@ impl modules::Module { } if (self.path.is_dir()) { + if (output.len() == 0) { + return String::new(); + } + var res = fs::write(&output_file, output); if (res.is_err()) { From a3455e1b68c510842a702c2949ccf024c43327cd Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Wed, 3 Jun 2026 16:19:32 +0200 Subject: [PATCH 7/7] Removed should_skip --- crates/mist-api/src/modules.mist | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/crates/mist-api/src/modules.mist b/crates/mist-api/src/modules.mist index 6a7b1b1..d28df95 100644 --- a/crates/mist-api/src/modules.mist +++ b/crates/mist-api/src/modules.mist @@ -84,17 +84,3 @@ pub Module master_package(PathBuf mist_path) { root_mod } - -bool should_skip(Path* source, Path* output) { - var src_time = fs::metadata(source) - .ok() - .and_then(|var v| v.modified().ok()); - - var out_time = fs::metadata(output) - .ok() - .and_then(|var v| v.modified().ok()); - - out_time - .map(|var out_time| out_time >= src_time.unwrap()) - .unwrap_or_default() -}