-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read non-hoisted deps #84
Conversation
src/build/packages.rs
Outdated
let path_buf = | ||
match PathBuf::from(format!("{}/node_modules/{}", parent_path, package_name)).canonicalize() { | ||
Ok(p) => p, | ||
Err(_) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we print the error as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/build/packages.rs
Outdated
match PathBuf::from(format!("{}/node_modules/{}", parent_path, package_name)).canonicalize() { | ||
Ok(p) => p, | ||
Err(_) => { | ||
match PathBuf::from(format!("node_modules/{}", package_name)).canonicalize() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use the absolute path and prepend with project_root
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
); | ||
std::process::exit(2) | ||
let path_buf = | ||
match PathBuf::from(format!("{}/node_modules/{}", parent_path, package_name)).canonicalize() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the is_root
condition isn't handled here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not needed here, since the code never runs for the root package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is the root package handled then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok so it's only run for deps, so you are probably right :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a nutshell this PR moves does 3 things:
- Moves the code from
helpers
module to thePackage
impl - Updates the logic to resolve the package path to support both hoisted and non-hoisted set up
- Starts using the resolved package path instead of building the hoisted path everytime it's needed
What's left:
- Update the last place to use resolved package path (in the compile.rs)
- Maybe use non-canonicalize paths for compiler errors ???
- Continue fixing next errors. After this PR it started finding files correctly, but I got another compilation error.
// TODO: Add support for non-hoisted set up | ||
let hoisted_path = format!("{}/node_modules/{}/lib/ocaml", root_path, &x); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to fix it in a separate PR
pub fn get_ast_path(&self, source_file: &str) -> String { | ||
helpers::get_compiler_asset(self, source_file, &packages::Namespace::NoNamespace, "ast") | ||
} | ||
|
||
pub fn get_iast_path(&self, source_file: &str) -> String { | ||
helpers::get_compiler_asset(self, source_file, &packages::Namespace::NoNamespace, "iast") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it correct that you use packages::Namespace::NoNamespace
here? Shouldn't it be package.namespace
instead? Then, it would be able to move more code from helpers
to the package implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes because asts never have namespaces in the filename
I think I need to redo the PR from scratch. The conflicts are scarry 🙈 |
I'll try to find some time during the weekend to continue on the PR |
what's the status of this PR? Did you have time to work on it again @DZakh ? The current status makes it a blocker for my setup and at the same time, I'm really getting fed up with stale builds. Is there a way I could help? |
Sorry, had a lot of traveling recently. I'll have time to continue working on it this weekend. |
Closed in favor of #87 |
Need to fix the error: