feat!: support pnpm global virtual store paths and upgrade pnpm to 10.32.1 - #20
Conversation
Add regex matchers for pnpm's global virtual store path pattern (e.g. Library/pnpm/store/v10/links/<pkg>/<ver>/<hash>/node_modules) so they are replaced with <PNPM_INNER> just like local .pnpm paths.
- Upgrade packageManager from pnpm@9.14.4 to pnpm@10.32.1 - Add .npmrc with enable-global-virtual-store=true - Fix global virtual store regex to handle multi-segment store versions (e.g. pnpm/store/v3/v10/links/...) - Update e2e snapshots to reflect new global virtual store paths
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求旨在增强路径序列化工具对 pnpm 全局虚拟存储路径的兼容性。通过引入新的匹配器和更新相关测试,确保在使用 pnpm 全局虚拟存储功能时,路径序列化能够保持一致性和准确性,从而提高项目的兼容性和稳定性。 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Pull request overview
该 PR 旨在让 path-serializer 兼容 pnpm 启用 globalVirtualStore 后出现的新路径结构(pnpm/store/.../links/.../node_modules),从而在快照中稳定地序列化并标记为 <PNPM_INNER>。
Changes:
- 在
createPnpmInnerMatchers中新增对 pnpm global virtual store(posix/win32)的匹配规则 - 升级
packageManager到 pnpm 10,并通过.npmrc启用enable-global-virtual-store - 新增/更新 e2e 用例与快照以覆盖 global virtual store 场景
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/matchers.ts | 新增 global virtual store 的路径正则匹配规则,以便替换为 <PNPM_INNER> |
| package.json | 更新 packageManager 到 pnpm 10(带 corepack integrity) |
| .npmrc | 启用 enable-global-virtual-store=true 以改变 pnpm 安装布局 |
| e2e/pnpmGlobalVirtualStore.test.ts | 新增 global virtual store 的序列化测试(含 posix/win32) |
| e2e/index.test.ts | 更新现有 e2e 快照期望以适配新的 pnpm 路径布局 |
| e2e/features.test.ts | 同步更新 features 相关快照期望 |
| e2e/snapshots/index.test.ts.snap | 更新对应的持久化快照内容 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Strip environment-dependent prefix before <PNPM_INNER> so that both local virtual store (<ROOT>/node_modules/<PNPM_INNER>/pkg/...) and global virtual store (<HOME>/Library/<PNPM_INNER>/pkg/...) normalize to just <PNPM_INNER>/pkg/..., making snapshots portable across environments with different enableGlobalVirtualStore settings.
- Remove redundant win32 global virtual store matcher since transformWin32Path normalizes paths before matching (Gemini) - Fix ReDoS vulnerability by replacing regex with string-based stripPnpmInnerPrefix using split/join (CodeQL) - OS-dependent snapshots are already fixed by prefix stripping, output is now <PNPM_INNER>/pkg/... regardless of platform (Copilot)
…ction Move pnpm inner path replacement from the matcher-based pipeline into a dedicated `replacePnpmInnerPath` function in utils.ts. This function handles regex matching (local + global virtual store) and prefix stripping in one place, making the logic clearer and self-contained.
Extract replacePnpmInnerPath into src/pnpm/replacePnpmInnerPath.ts with a barrel export from src/pnpm/index.ts.
Summary
Related issues
AI Summary
What changed
src/matchers.ts: new posix and win32 patterns to match pnpm's global virtual store path structure (pnpm/store/<versions>/links/<pkg>/<ver>/<hash>/node_modules), replacing them with<PNPM_INNER>just like local.pnpmvirtual store paths.9.14.4to10.32.1inpackageManagerfield.enableGlobalVirtualStorevia.npmrc(enable-global-virtual-store=true).e2e/pnpmGlobalVirtualStore.test.ts) covering posix, win32, and scoped package paths for the global virtual store.<HOME>/Library/<PNPM_INNER>/...instead of<ROOT>/node_modules/<PNPM_INNER>/...).Why
When pnpm's
enableGlobalVirtualStoreis enabled, resolved dependency paths point to a centralized store (e.g.~/Library/pnpm/store/v3/v10/links/react/19.2.4/<hash>/node_modules/react/...) instead of the localnode_modules/.pnpm/directory. The existingreplacePnpmInnerfeature only handled local virtual store paths, causing these global store paths to leak into snapshots unprocessed.Implementation details
.+?(not[^/]+) betweenstore/and/linksto handle multi-segment version directories likev3/v10..pnpmmatchers, ensuring consistent<PNPM_INNER>replacement regardless of store location.This PR was written using Vibe Kanban