rescript-lang / rescript-lang/rescript

Dependency analysis

Aperta
#8,499 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
OCaml
Stelle
7.5k
Fork
485
Merge medio
1g 2h
PR unite (30g)
55

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con l'esempio collegato res-dep-issue, confronta i suoi branch main e rescript-11-cjs e riproduci il problema di linking in stile pnpm. Poi leggi gli entry point dell'analisi delle dipendenze del compilatore e determina come dovrebbero essere verificate le dipendenze di package.json. Il lavoro è completato quando l'analisi proposta identifica in modo affidabile le dipendenze errate e offre un percorso chiaro per l'integrazione con Knip.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
build-system, compilers
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Tranquilla
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.