Closed nicoespeon closed 3 years ago
Hey @nicoespeon, thanks for the tests and the feedback. I'll have a look at resolving the case with the current path, should be a good addition and probably not too hard to fix (as I encountered/resolved such cases in the Python Parser also) 👍
@nicoespeon I've just pushed a naive implementation for the JS parser (0.16.1
) which should include your described and valid case
import { GenericId, Age, Country, Amount } from ".";
If you find the time, check if this solves the problem in the JS parser. I was thinking of splitting every dependency resolving case/code into separate methods inside the parser, this should facilitate readability and testability, e.g.
def resolve_dependency_current_dir_index_js(self, ...)
...
def resolve_dependency_global_at(self, ...)
...
def resolve_dependency_relative_current_dir(self, ...)
...
What do you think? If you find more cases or could even implement them, I'd appreciate any help 😉
@nicoespeon I've rewritten some parts of the dependency resolving code for all parsers, including TS and JS. Hopefully this should be less error-prone and not creating false duplicates anymore. If you haven't found any more bugs, I would close this issue?
@glato hey! Sorry I didn't get back to this.
I think it's fine to close this. I'll give it a try this week and get back to you if I find anything 👍 Worst-case scenario: I create a new issue 😁
I gave it a try and it works fine!
Hey @glato 👋
I did more tests to identify edge cases that would not be covered yet with emerge. I'll report them here as I find these. If you don't have time to fix them, I'll have a look some time myself.
1. Import local index
This is a valid import:
"."
refers to the current folder. In JS, it will pick theindex.{js,ts}
file.Today, this doesn't seem to be resolved. This structure should highlight the issue:
This would generate 2 orphan nodes.
math.js
should depend onindex.js
though.