Tensegritics / Tensegritics/ClojureDart
local Dart libs paths are not properly relativized
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 1.6k
- Forks
- 119
- PR merge metrics
- No merged PRs in 30d
Description
This only affects dart projects; flutter projects seem to cope with the issue.
To reproduce, create a dart file in lib and require it from a clojure ns. Then in the the compiled dart for the ns, the path to the local dart file will have an extra ../. (Flutter seems ok with that but not Dart.)
This comes from an imbalance where libs from compiled nses are stored by the compiler with the "lib" prefix (to be able to relativize properly when test and other directories are involved.
Current workaround is to require the file as "package:projectname-as-set-in-pubspec-yaml/myfile.dart".
(This https://stackoverflow.com/a/61604885 points to the fact that relative paths is just a meter of style.)
Possible solutions:
- to automatically generate
package:projectname-as-set-in-pubspec-yaml/we need to parse the YAML. (In this case could we go as far as remove all relativization logic -- I'm still concerned about what happens when multiple source directories are in use) - we get the analyzer to give us the canonical lib
- we ask the user to prefix with
liband fix the existence check and deal with relative/absolute libs path depending on where in the compiler we are (I believe the relative path matters only fordump-ns)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce with a Dart file in lib required from a Clojure namespace, then inspect how the compiler stores libraries from compiled namespaces and relativizes paths, including dump-ns behavior. Done means generated Dart for Dart projects no longer adds an extra ../ to local lib paths while paths involving test or other directories still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure, dart
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100