Summary
Support root exports shorthand in the Vercel Optimize workspace resolver.
buildPackageLookup currently only iterates object entries as subpath keys. A package with "exports": "./index.js", a root fallback array, or a root conditional object such as { "import": "./index.js" } therefore returns null for its bare package import. As a result, resolveWorkspaceImports omits that package's source entry from the investigation's file list.
Normalize these root forms to a . entry before using the existing target selection logic. Explicit subpath maps and wildcard resolution remain unchanged; root-only exports do not expose private subpaths. This does not attempt to replace the existing conditional-target heuristic with a full Node resolver.
Reference: Node.js exports sugar.
Tests
- Three root-form regression cases, including assertions that an unexported subpath stays unresolved.
- A filesystem-backed integration case showing that a bare import reaches
resolveWorkspaceImports. - All four new cases fail before the runtime change and pass afterward.
- Full Vercel Optimize suite: 773 passed, 0 failed.
- Generated documentation freshness, citation checks (99 URLs, 13 rule references), and
git diff --checkpass.
Found by reviewing the resolver directly, rather than implementing an existing issue. AI-assisted implementation and validation; the reproducer uses local synthetic packages, not a claimed production incident.
Activity
4Copilot review overview
🟢 Approval recommended
All reviewed changes are covered by passing regression and integration tests with no unresolved issues.
Review effort: Lite
Findings: None
What changed in this PR
Adds root exports shorthand support to the Vercel Optimize workspace resolver while preserving subpath restrictions.
Changes:
- Normalize string, array, and conditional root exports.
- Add regression and integration coverage.
| File | Description |
|---|---|
skills/vercel-optimize/lib/workspace-resolver.mjs | Resolves root export forms. |
packages/vercel-optimize-tests/test/workspace-resolver.test.mjs | Covers root exports and integration behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
A brief follow-up on resolving root workspace package exports. I am still available to address review feedback or narrow the patch if needed. Thank you.
Posted with Codex assistance.
@GreedyC is attempting to deploy a commit to the Vercel Team on Vercel.
A member of the Team first needs to authorize it.