Skip to content

feat(cli): align vite exports with upstream vite package#375

Merged
Brooooooklyn merged 9 commits intomainfrom
exports-types
Dec 26, 2025
Merged

feat(cli): align vite exports with upstream vite package#375
Brooooooklyn merged 9 commits intomainfrom
exports-types

Conversation

@Brooooooklyn
Copy link
Copy Markdown
Member

@Brooooooklyn Brooooooklyn commented Dec 25, 2025

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:

import type { ImportGlobFunction } from '@voidzero-dev/vite-plus/types/importGlob.d.ts';

🤖 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.

  • Add syncCorePackageExports() to build.ts to create shims for ./client (triple-slash types), ./module-runner, ./internal, ./dist/client/* (JS), and ./types/* (type-only export type *), with ./types/internal/* blocked
  • Require core build artifacts; mirror dist/vite/client and dist/vite/types into dist/client and dist/types
  • Update packages/cli/package.json exports to include the new Vite-compatible subpaths and precedence (./types/internal/* before ./types/*)
  • Enhance test export shims to include side-effect imports in .d.ts to preserve augmentations; keep auto-sync of ./test/*
  • Expand BUNDLING.md to document the new 4-step build, export mapping, output structure, and rationale

Written by Cursor Bugbot for commit 714de68. This will update automatically on new commits. Configure here.

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>
Copilot AI review requested due to automatic review settings December 25, 2025 15:24
Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 internal directory

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.

Comment thread packages/cli/build.ts Outdated
Comment thread packages/cli/build.ts Outdated
Comment thread packages/cli/build.ts Outdated
Comment thread packages/cli/build.ts Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread packages/cli/build.ts Outdated
Comment thread packages/cli/build.ts Outdated
- 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>
@Brooooooklyn Brooooooklyn requested a review from fengmk2 December 26, 2025 02:40
Comment thread packages/cli/build.ts
Comment thread packages/cli/build.ts Outdated
- 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>
Copilot AI review requested due to automatic review settings December 26, 2025 03:03
Comment thread packages/cli/build.ts
Comment thread packages/cli/package.json Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/cli/build.ts
Comment thread packages/cli/package.json Outdated
Comment thread packages/cli/build.ts
Brooooooklyn and others added 2 commits December 26, 2025 11:12
- 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>
Copilot AI review requested due to automatic review settings December 26, 2025 03:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/cli/build.ts Outdated
Comment thread packages/cli/build.ts
Comment thread packages/cli/build.ts
Comment thread packages/cli/build.ts
Brooooooklyn and others added 2 commits December 26, 2025 11:29
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>
Copilot AI review requested due to automatic review settings December 26, 2025 03:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/cli/build.ts
Comment thread packages/cli/BUNDLING.md
Comment thread packages/cli/BUNDLING.md
Comment thread packages/cli/build.ts
Comment thread packages/cli/build.ts
Brooooooklyn and others added 2 commits December 26, 2025 11:48
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>
Copilot AI review requested due to automatic review settings December 26, 2025 03:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Brooooooklyn Brooooooklyn merged commit 861cc36 into main Dec 26, 2025
18 of 19 checks passed
Copy link
Copy Markdown
Member Author

Merge activity

@Brooooooklyn Brooooooklyn deleted the exports-types branch December 26, 2025 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants