microsoft / microsoft/TypeScript

Yarn PnP

Ouverte
#63,769 4 commentaires 142 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Suggestion
Langage dominant
Go
Étoiles
111k
Forks
14.3k
Merge moyen
2 j 4 h
PR mergées (30 j)
132

Description

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 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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par lire la base de code expérimentale TypeScript ainsi que l’issue 28289 et la pull request 35206 référencées afin de comprendre les chemins existants de patch et de résolution de PnP. Le travail est terminé lorsque la prise en charge native de PnP est implémentée avec une couverture solide et sans exécution dynamique de code, y compris la compatibilité avec typescript-go.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
go, javascript, typescript
Domaine
compilers, tooling
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Active
Clarté
À clarifier
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.