microsoft / microsoft/TypeScript
Yarn PnP
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先阅读实验性的 TypeScript 代码库以及所引用的 issue 28289 和 pull request 35206,以了解现有的 PnP 补丁和解析路径。实现原生 PnP 支持,并具备扎实的覆盖率且不执行动态代码,同时兼容 typescript-go,即表示工作完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- go, javascript, typescript
- 领域
- compilers, tooling
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 活跃
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100