fix(content): support validator detection with pnpm enableGlobalVirtualStore#3791
fix(content): support validator detection with pnpm enableGlobalVirtualStore#3791BellYun wants to merge 3 commits into
Conversation
|
@BellYun is attempting to deploy a commit to the Nuxt Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR establishes a global singleton pattern for the validators context to prevent reset on duplicate module evaluation. Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/unit/validatorRegistry.test.ts`:
- Around line 6-8: The test helper resetValidatorsContext currently uses a
dynamic delete on globalThis which trips `@typescript-eslint/no-dynamic-delete`;
replace the delete with an assignment to undefined on the same symbol key so the
singleton is cleared but no dynamic delete is used (modify
resetValidatorsContext to set (globalThis as Record<symbol,
unknown>)[SINGLETON_KEY] = undefined instead of deleting it), referencing the
SINGLETON_KEY and globalThis symbols to locate the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fbc76699-75bd-488d-b16c-c5c4d55f2265
📒 Files selected for processing (3)
src/utils/context.tssrc/utils/dependencies.tstest/unit/validatorRegistry.test.ts
commit: |
🔗 Linked issue
enableGlobalVirtualStore: zod detection fails #3790globalVirtualStorenuxt#34809❓ Type of change
📚 Description
This fixes validator detection when using pnpm 11 with
enableGlobalVirtualStore: true.With pnpm's default layout, project dependencies are linked through the local virtual store at
node_modules/.pnpm,when
enableGlobalVirtualStoreis enabled,node_modulesinstead points to a shared central virtual store outside the project.That make two issues in
@nuxt/content:@nuxt/content's own location, sozodcould appear to be missing even when it was available through the module installationcontent.config.tsevaluation,@nuxt/contentcould be evaluated more than once, which caused the validator registry to fall back to its stub state and throw the "Zod is not installed" errorThis PR updates validator package detection to resolve from
@nuxt/contentitself and preserves the validator registry across duplicate module evaluation.📝 Checklist