feat: support `virtualModules` option by pi0 · Pull Request #428 · unjs/jiti · GitHub
Skip to content

feat: support virtualModules option - #428

Merged
pi0 merged 1 commit into
mainfrom
feat/vfs
Feb 27, 2026
Merged

pi0 merged 1 commit into
mainfrom
feat/vfs

Conversation

@pi0

@pi0 pi0 commented Feb 27, 2026 •

Copy link
Copy Markdown
Member

Add virtualModules option to bypass filesystem resolution for pre-loaded module objects. Useful for bundled modules in compiled binaries (e.g., Bun).

Changes

  • Add virtualModules?: Record<string, unknown> to JitiOptions
  • Check virtual modules in jitiRequire before filesystem resolution (supports both sync and async)
  • Add test coverage

Co-authored-by: Mario Zechner (badlogic@ad402d3)

Summary by CodeRabbit

  • New Features

    • Virtual modules support added to the loader configuration, enabling pre-loaded module objects that bypass filesystem resolution.
  • Tests

    • Comprehensive test suite added for virtual modules functionality, validating synchronous and asynchronous module loading, and ensuring proper fallback to standard resolution.

Bypass filesystem resolution for pre-loaded module objects (e.g., bundled modules in compiled Bun binaries).

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
@coderabbitai

coderabbitai Bot commented Feb 27, 2026

Copy link
Copy Markdown

@pi0 pi0 changed the title feat: support virtual modules option feat: support virtualModules option Feb 27, 2026
@pi0
pi0 merged commit ae790b0 into main Feb 27, 2026
7 of 8 checks passed
@pi0
pi0 deleted the feat/vfs branch February 27, 2026 13:39
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.

1 participant