diff --git a/crates/dash_node_impl/src/lib.rs b/crates/dash_node_impl/src/lib.rs index 67a8a41f..c07f1eab 100644 --- a/crates/dash_node_impl/src/lib.rs +++ b/crates/dash_node_impl/src/lib.rs @@ -34,15 +34,11 @@ pub fn run_with_nodejs_mnemnoics(path: &str, opt: OptLevel, initial_gc_threshold async fn run_inner_fallible(path: &str, opt: OptLevel, initial_gc_threshold: Option) -> anyhow::Result<()> { let path = Path::new(path); let package_state = if path.is_dir() { - // TODO: make it also work with paths to files. need to adjust the execute_node_module call too, - // since that needs a dir path process_package_json(path)? } else { PackageState { base_dir: path.parent().unwrap_or(&env::current_dir()?).into(), - metadata: Package::default_with_entry( - String::from_utf8_lossy(path.to_str().unwrap_or_default().as_bytes()).to_string(), - ), + metadata: Package::default_with_entry(path.into()), } }; diff --git a/crates/dash_node_impl/src/package.rs b/crates/dash_node_impl/src/package.rs index 59e042d4..2107f1f7 100644 --- a/crates/dash_node_impl/src/package.rs +++ b/crates/dash_node_impl/src/package.rs @@ -1,4 +1,5 @@ use std::collections::HashMap; +use std::path::PathBuf; use dash_proc_macro::Trace; use serde::Deserialize; @@ -8,12 +9,12 @@ pub struct Package { pub name: String, pub version: String, pub description: String, - pub main: String, + pub main: PathBuf, #[serde(default)] pub dependencies: HashMap, } impl Package { - pub fn default_with_entry(entry: String) -> Self { + pub fn default_with_entry(entry: PathBuf) -> Self { Package { name: String::default(), version: String::default(),