feat(cli): align vite exports with upstream vite package#375
feat(cli): align vite exports with upstream vite package#375Brooooooklyn merged 9 commits intomainfrom
Conversation
Add missing exports to vite-plus CLI package to match vite's export map:
- ./client (types only, ambient declarations)
- ./module-runner
- ./internal
- ./dist/client/*
- ./types/*
- ./types/internal/* (blocked)
This enables imports like:
```typescript
import type { ImportGlobFunction } from '@voidzero-dev/vite-plus/types/importGlob.d.ts';
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds missing exports to the vite-plus CLI package to align with the upstream Vite package's export map. The changes enable users to import Vite core types and modules through the CLI package, improving compatibility and developer experience.
Key changes:
- Added new package.json export entries for
./client,./module-runner,./internal,./dist/client/*, and./types/* - Implemented build-time synchronization logic to create shim files that re-export from the core package
- Added recursive directory traversal for types with proper handling of the blocked
internaldirectory
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/cli/package.json | Added 6 new export declarations to expose Vite core modules and types |
| packages/cli/build.ts | Implemented syncCorePackageExports() function and helper syncTypesDir() to generate shim files during build |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Use static imports instead of dynamic imports for consistency - Add error handling when core package isn't built (throw instead of silent skip) - Fix .mjs/.cjs file handling to create re-export shims instead of copying - Remove unused dynamic import statement 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add .d.mts/.d.cts handling in syncTypesDir for consistency with client - Only skip 'internal' directory at top level (matches ./types/internal/* export block) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Move ./types/internal/* before ./types/* for correct precedence - Add directory check in client loop to prevent EISDIR crash - Use async copyFile for consistency with other file operations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add file header explaining the build process overview - Expand syncCorePackageExports JSDoc with usage examples and export order note - Add comprehensive JSDoc for syncTypesDir function 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Document the new 4-step build process that includes core package export synchronization, enabling @voidzero-dev/vite-plus to serve as a drop-in replacement for upstream vite. Key additions: - Step 3: syncCorePackageExports() documentation - Export mapping tables for ./client, ./module-runner, ./internal, ./dist/client/*, and ./types/* - Technical details on type-only exports, internal types blocking, and triple-slash references for ambient client types - Updated output structure and build flow diagrams 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: LongYinan <lynweklm@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
For consistency with ./dist/client/* handling, strip .d.ts/.d.mts/.d.cts extensions from the import specifiers in type shims. TypeScript's module resolution automatically finds .d.ts files without explicit extensions. Before: export type * from 'pkg/types/importMeta.d.ts'; After: export type * from 'pkg/types/importMeta'; 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This reverts commit 20889e8.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|

Add missing exports to vite-plus CLI package to match vite's export map:
This enables imports like:
🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com
Note
Aligns the CLI package’s export map with upstream Vite by generating shims that re-export from the core package and refining test shims.
syncCorePackageExports()tobuild.tsto create shims for./client(triple-slash types),./module-runner,./internal,./dist/client/*(JS), and./types/*(type-onlyexport type *), with./types/internal/*blockeddist/vite/clientanddist/vite/typesintodist/clientanddist/typespackages/cli/package.jsonexports to include the new Vite-compatible subpaths and precedence (./types/internal/*before./types/*).d.tsto preserve augmentations; keep auto-sync of./test/*BUNDLING.mdto document the new 4-step build, export mapping, output structure, and rationaleWritten by Cursor Bugbot for commit 714de68. This will update automatically on new commits. Configure here.