rescript-lang / rescript-lang/rescript
Dependency analysis
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 7.5k
- Forks
- 485
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 55
Description
Currently it is very hard to analyze where a dependency will be imported, for example:
type t
@module("dep") external make: unit => t = "make"
let timeMake = () => {
Js.Console.timeStart("make")
let t = make()
Js.Console.timeEnd("make")
t
}
A consuming module may import dep directly, or it may not depending on which function is used and if there is an interface file.
If dependencies, devDependencies, and peerDependencies are not properly set this may become a problem for certain package manager setups. A small change could end up causing a runtime error. It could be particularly insidious if it is a rarely used or lazy loaded binding.
Due to the different dependency types often being misunderstood and the complexity of analysis, I believe ReScript should have the ability to check package.json dependencies for correctness.
I've had Claude create an example project here that failures when using pnpm style linking. The main branch uses ReScript 12 and ESM, but there is also a rescript-11-cjs branch for reference.
BTW it could be helpful if this feature was implemented in a way that we could integrate with Knip as a plugin
Contributor guide
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
Start with the linked res-dep-issue example, comparing its main and rescript-11-cjs branches and reproducing the pnpm-style linking failure. Then read the compiler's dependency-analysis entry points and determine how package.json dependencies should be checked. Done means the proposed analysis reliably identifies incorrect dependencies and has a clear path for Knip integration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system, compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100