Skip to content

fix(core): rewrite rolldown types in vite types#392

Merged
Brooooooklyn merged 3 commits intomainfrom
01-06-fix_core_rewrite_rolldown_types_in_vite_types
Jan 6, 2026
Merged

fix(core): rewrite rolldown types in vite types#392
Brooooooklyn merged 3 commits intomainfrom
01-06-fix_core_rewrite_rolldown_types_in_vite_types

Conversation

@Brooooooklyn
Copy link
Copy Markdown
Member

@Brooooooklyn Brooooooklyn commented Jan 6, 2026

  • Close VP-136
  • Close VP-138

Note

Introduces an AST-driven rewriting flow for module specifiers to ensure correct import paths in emitted JS and type declaration files.

  • New build-support/rewrite-module-specifiers.ts using @ast-grep/napi with pluggable rules (vite and rolldown) and support for TS/TSX/DTS
  • build.ts now applies rewriteModuleSpecifiers when copying:
    • Vite .d.ts and types files; replaces vite and rolldown imports to package-local paths
    • Rolldown files (.mjs/.js/.d.ts/.d.mts), including optional RELEASE_BUILD binding path tweak
    • Vitepress dist files (JS/MJS/DTS) to target pkgJson.name/vite
  • Adds @ast-grep/napi to devDependencies and updates lockfile
  • Minor script formatting cleanup in .github/scripts/upgrade-deps.mjs

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

Copilot AI review requested due to automatic review settings January 6, 2026 03:09
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 enhances the type rewriting logic to handle single-quoted imports in addition to double-quoted imports for both vite and rolldown packages. The changes ensure that all import statement variations are correctly transformed during the build process.

  • Adds support for single-quoted import statements in the type file rewriting logic
  • Extends both vite and rolldown import replacements to handle single quotes
  • Applies the rewriting logic to type files that were previously just copied

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/build.ts Outdated
Comment thread packages/core/build.ts Outdated
Comment thread packages/core/build.ts Outdated
Comment thread packages/core/build.ts Outdated
Comment thread packages/core/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.

Reviewed commit: 03251b9705

ℹ️ 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/core/build.ts Outdated
@Brooooooklyn Brooooooklyn force-pushed the 01-06-fix_core_rewrite_rolldown_types_in_vite_types branch 2 times, most recently from dba1eeb to 2c6e10a Compare January 6, 2026 03:17
Copilot AI review requested due to automatic review settings January 6, 2026 03:19
@linear
Copy link
Copy Markdown

linear Bot commented Jan 6, 2026

VP-136 missing `Rollup.RollupError` type after vite+ migration

Namespace '"~/vite-plugin-vue/node_modules/.pnpm/voidzero-dev+vite-plus-core@0.0.0-aa1a9791837714a9920c5bbe9738fca41aa26de7_@types+node_95f7af2affdfda25136d27b2d82eb70a/node_modules/voidzero-dev/vite-plus-core/dist/vite/types/internal/rollupTypeCompat"' has no exported member 'RollupError'.ts(2694)

vite8 code: https://github.com/fengmk2/vite-plugin-vue/blob/vite-v8/playground/vitestSetup.ts#L302

vite+ code: https://github.com/fengmk2/vite-plugin-vue/blob/vite-plus-migration-e2e/playground/vitestSetup.ts#L302

VP-138 Cannot find module '@rolldown/pluginutils/filter'

https://github.com/fengmk2/laravel-vite-plugin/actions/runs/20736671158/job/59535190220?pr=2

The replacement code at https://github.com/voidzero-dev/vite-plus/blob/main/packages/core/build.ts#L227 should match the subdirectories.

Similarly, we also need to take a look at the replacement of @oxc-project/types and rolldown.

> tsc --emitDeclarationOnly

Error: node_modules/vite/dist/rolldown/filter-index.d.mts(3,15): error TS2307: Cannot find module '@rolldown/pluginutils/filter' or its corresponding type declarations.
Error: node_modules/vite/dist/rolldown/parse-ast-index.d.mts(2,25): error TS2307: Cannot find module '@oxc-project/types' or its corresponding type declarations.
Error: node_modules/vite/dist/rolldown/shared/binding-MAEzB4KA.d.mts(1,38): error TS2307: Cannot find module '@oxc-project/types' or its corresponding type declarations.
Error: node_modules/vite/dist/rolldown/shared/define-config-twT5HTur.d.mts(3,42): error TS2307: Cannot find module '@rolldown/pluginutils' or its corresponding type declarations.
Error: node_modules/vite/dist/rolldown/shared/define-config-twT5HTur.d.mts(4,25): error TS2307: Cannot find module '@oxc-project/types' or its corresponding type declarations.
Error: node_modules/vite/dist/vite/types/internal/rollupTypeCompat.d.ts(1,32): error TS2307: Cannot find module 'rolldown' or its corresponding type declarations.
Error: node_modules/vite/dist/vite/types/internal/rollupTypeCompat.d.ts(3,15): error TS2307: Cannot find module 'rolldown' or its corresponding type declarations.
Error: src/index.ts(14,19): error TS2694: Namespace '"/home/runner/work/laravel-vite-plugin/laravel-vite-plugin/node_modules/vite/dist/vite/types/internal/rollupTypeCompat"' has no exported member 'InputOption'.
Error: src/index.ts(40,18): error TS2694: Namespace '"/home/runner/work/laravel-vite-plugin/laravel-vite-plugin/node_modules/vite/dist/vite/types/internal/rollupTypeCompat"' has no exported member 'InputOption'.
Error: src/index.ts(396,77): error TS2694: Namespace '"/home/runner/work/laravel-vite-plugin/laravel-vite-plugin/node_modules/vite/dist/vite/types/internal/rollupTypeCompat"' has no exported member 'InputOption'.
Error: The operation was canceled.

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 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/build.ts Outdated
Comment thread packages/core/build.ts
@Brooooooklyn Brooooooklyn force-pushed the 01-06-fix_core_rewrite_rolldown_types_in_vite_types branch from a02e607 to 9c346ba Compare January 6, 2026 03:49
Comment thread packages/core/build-support/rewrite-module-specifiers.ts Outdated
Comment thread packages/core/build-support/rewrite-module-specifiers.ts
@Brooooooklyn Brooooooklyn force-pushed the 01-06-fix_core_rewrite_rolldown_types_in_vite_types branch from 9c346ba to 1e1bfe1 Compare January 6, 2026 04:00
Copilot AI review requested due to automatic review settings January 6, 2026 04:00
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 4 out of 5 changed files in this pull request and generated 9 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/build-support/rewrite-module-specifiers.ts Outdated
Comment thread packages/core/build-support/rewrite-module-specifiers.ts
Comment thread packages/core/build-support/rewrite-module-specifiers.ts
Comment thread packages/core/build-support/rewrite-module-specifiers.ts
Comment thread packages/core/build-support/rewrite-module-specifiers.ts
Comment thread packages/core/build-support/rewrite-module-specifiers.ts
Comment thread packages/core/build-support/rewrite-module-specifiers.ts
Comment thread packages/core/build-support/rewrite-module-specifiers.ts
Comment thread packages/core/build.ts
@Brooooooklyn Brooooooklyn force-pushed the 01-06-fix_core_rewrite_rolldown_types_in_vite_types branch from 1e1bfe1 to f1dd24a Compare January 6, 2026 04:07
@Brooooooklyn Brooooooklyn merged commit fb0e891 into main Jan 6, 2026
13 checks passed
Copy link
Copy Markdown
Member Author

Merge activity

@Brooooooklyn Brooooooklyn deleted the 01-06-fix_core_rewrite_rolldown_types_in_vite_types branch January 6, 2026 04:21
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