microsoft / microsoft/TypeScript

Yarn PnP

Aperta
#63,769 4 commenti 142 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

Yarn PnP is an alternative resolution strategy originally created for Yarn, and it’s also available in pnpm. Its key difference is a static resolution map: Yarn generates a file that tells Node.js and bundlers exactly where packages live on disk based on name and version. This is faster (no filesystem calls), and more stable (no ghost dependencies).

Most JavaScript libraries work with Yarn PnP out of the box. Over the past seven years, we’ve collaborated with various resolution libraries to build native PnP support. As a result, tools like Webpack, Rollup, Esbuild, Rspack, and even TypeScript now support PnP—albeit with one caveat.

Adding Yarn PnP support to TypeScript has proven challenging. The Yarn team has maintained a [patch](https://github.com/microsoft/TypeScript/pull/35206) that we automatically apply to TypeScript installations. While this has worked so far, it’s not ideal: it introduces untested paths, requires regular updates, and doesn’t work for native code. The latter is especially worrisome, because it’s unclear how Yarn PnP and typescript-go will coexist. It would be unfortunate if developers had to abandon one technology to use the other. I've personally been hoping for a project like typescript-go for a long time now. I really want us to be able to use it!

Given my team's history of maintaining a PnP codepath over an extended period of time, we’d like to propose adding native PnP support to the experimental TypeScript codebase, and to help maintaining it in the future. **We would do so only if we can ensure solid implementation quality and address any security concerns (i.e., avoid dynamic code execution).** We have relevant experience, as both Esbuild (Go) and Rspack (Rust) use a static-data approach rather than relying on the Node.js loader API.

Ref: https://github.com/microsoft/TypeScript/issues/28289
Ref: https://github.com/microsoft/TypeScript/pull/35206

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 leggendo la codebase sperimentale di TypeScript e l’issue 28289 e la pull request 35206 indicate, per comprendere i percorsi esistenti di patch e risoluzione di PnP. Il lavoro è completato quando il supporto nativo per PnP è implementato con una copertura solida e senza esecuzione dinamica del codice, inclusa la compatibilità con typescript-go.

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

Valutazione

Stack tecnologico
go, javascript, typescript
Ambito
compilers, tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Attiva
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.