Skip to content

feat(migration): add declare module rewriting support#357

Merged
fengmk2 merged 1 commit intomainfrom
rewrite-declare-module-namespace
Dec 24, 2025
Merged

feat(migration): add declare module rewriting support#357
fengmk2 merged 1 commit intomainfrom
rewrite-declare-module-namespace

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Dec 22, 2025

Add support for rewriting TypeScript declare module statements from
vite/vitest to @voidzero-dev/vite-plus. This mirrors the existing
import rewriting functionality but targets module declarations.

Changes:

  • Add 6 new ast-grep rules for declare module statements
  • Update documentation to include declare module examples
  • Add 19 comprehensive tests covering all patterns
  • Support all variants: base modules, subpaths, and scoped packages

The implementation uses ast-grep with kind: module to match
declare module statements and rewrites module names using the same
transformation logic as import statements.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com


Note

Adds declare-module rewriting alongside existing import rewrites.

  • Rules: +6 ast-grep rules targeting declare module for vite, vite/*, vitest, vitest/config, vitest/*, and @vitest/* variants; matches with kind: module and rewrites to the corresponding @voidzero-dev/vite-plus targets
  • Code: Updates import_rewriter.rs rule set and docs to include declare-module cases; core rewrite pipeline unchanged
  • Tests: +new unit tests covering single, subpath, scoped, mixed import+declare scenarios, and edge cases (quotes, complex interfaces)
  • Snap tests: Adds scenarios migration-from-vitest-config, migration-from-vitest-files, and migration-rewrite-declare-module with updated expected outputs (rewritten module declarations and imports)

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

Copy link
Copy Markdown
Member Author

fengmk2 commented Dec 22, 2025

@fengmk2 fengmk2 self-assigned this Dec 22, 2025
@fengmk2 fengmk2 force-pushed the rewrite-declare-module-namespace branch from 0a2377e to 986f687 Compare December 22, 2025 07:40
@fengmk2 fengmk2 marked this pull request as ready for review December 22, 2025 07:43
@fengmk2 fengmk2 force-pushed the 12-16-feat_migration_rewrite_vitest_imports branch from fda9731 to b24cfe6 Compare December 22, 2025 15:02
@fengmk2 fengmk2 force-pushed the rewrite-declare-module-namespace branch from 986f687 to 1a4348e Compare December 22, 2025 15:02
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Dec 22, 2025

Deploying vite-plus with  Cloudflare Pages  Cloudflare Pages

Latest commit: e3a2603
Status:🚫  Build failed.

View logs

@fengmk2 fengmk2 force-pushed the 12-16-feat_migration_rewrite_vitest_imports branch from b24cfe6 to e9087f3 Compare December 23, 2025 02:28
@fengmk2 fengmk2 force-pushed the rewrite-declare-module-namespace branch from 1a4348e to cc93454 Compare December 23, 2025 02:28
@fengmk2 fengmk2 force-pushed the 12-16-feat_migration_rewrite_vitest_imports branch from e9087f3 to b68fc5e Compare December 23, 2025 08:24
@fengmk2 fengmk2 force-pushed the rewrite-declare-module-namespace branch from cc93454 to 4da046c Compare December 23, 2025 08:24
@fengmk2 fengmk2 force-pushed the 12-16-feat_migration_rewrite_vitest_imports branch from b68fc5e to 51df143 Compare December 23, 2025 08:31
@fengmk2 fengmk2 force-pushed the rewrite-declare-module-namespace branch 3 times, most recently from f96eab7 to f02d318 Compare December 23, 2025 11:53
@fengmk2 fengmk2 force-pushed the 12-16-feat_migration_rewrite_vitest_imports branch from 51df143 to be27764 Compare December 23, 2025 11:53
@fengmk2 fengmk2 force-pushed the rewrite-declare-module-namespace branch from f02d318 to c2be0e2 Compare December 24, 2025 03:30
@fengmk2 fengmk2 force-pushed the 12-16-feat_migration_rewrite_vitest_imports branch from be27764 to 6b51526 Compare December 24, 2025 03:30
@fengmk2 fengmk2 force-pushed the rewrite-declare-module-namespace branch from c2be0e2 to 9d34b0d Compare December 24, 2025 04:38
@fengmk2 fengmk2 force-pushed the 12-16-feat_migration_rewrite_vitest_imports branch from 6b51526 to 08ece1b Compare December 24, 2025 04:38
@fengmk2 fengmk2 force-pushed the 12-16-feat_migration_rewrite_vitest_imports branch from 08ece1b to eb5aeab Compare December 24, 2025 05:25
@fengmk2 fengmk2 force-pushed the rewrite-declare-module-namespace branch from 9d34b0d to ea8c676 Compare December 24, 2025 05:25
@fengmk2 fengmk2 force-pushed the 12-16-feat_migration_rewrite_vitest_imports branch from eb5aeab to 4653d5e Compare December 24, 2025 05:41
@fengmk2 fengmk2 force-pushed the rewrite-declare-module-namespace branch from ea8c676 to a4b708d Compare December 24, 2025 05:42
@fengmk2 fengmk2 force-pushed the 12-16-feat_migration_rewrite_vitest_imports branch from 4653d5e to a5ed6db Compare December 24, 2025 06:10
@fengmk2 fengmk2 force-pushed the rewrite-declare-module-namespace branch from a4b708d to aac6031 Compare December 24, 2025 06:10
@fengmk2 fengmk2 force-pushed the 12-16-feat_migration_rewrite_vitest_imports branch 2 times, most recently from e7cebaf to 7ea4cc7 Compare December 24, 2025 07:02
@fengmk2 fengmk2 force-pushed the rewrite-declare-module-namespace branch from aac6031 to e3a2603 Compare December 24, 2025 07:02
@Brooooooklyn
Copy link
Copy Markdown
Member

cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no bugs!

@fengmk2 fengmk2 changed the base branch from 12-16-feat_migration_rewrite_vitest_imports to graphite-base/357 December 24, 2025 07:22
Add support for rewriting TypeScript `declare module` statements from
vite/vitest to @voidzero-dev/vite-plus. This mirrors the existing
import rewriting functionality but targets module declarations.

Changes:
- Add 6 new ast-grep rules for declare module statements
- Update documentation to include declare module examples
- Add 19 comprehensive tests covering all patterns
- Support all variants: base modules, subpaths, and scoped packages

The implementation uses ast-grep with `kind: module` to match
declare module statements and rewrites module names using the same
transformation logic as import statements.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@fengmk2 fengmk2 force-pushed the rewrite-declare-module-namespace branch from e3a2603 to 93ec15b Compare December 24, 2025 07:23
@graphite-app graphite-app Bot changed the base branch from graphite-base/357 to main December 24, 2025 07:23
@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented Dec 24, 2025

Merge activity

  • Dec 24, 7:23 AM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.
  • Dec 24, 7:41 AM UTC: @fengmk2 merged this pull request with Graphite.

@fengmk2 fengmk2 merged commit 29897cd into main Dec 24, 2025
18 of 21 checks passed
@fengmk2 fengmk2 deleted the rewrite-declare-module-namespace branch December 24, 2025 07:41
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.

2 participants