Skip to content

feat: support virtualModules option#428

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

feat: support virtualModules option#428
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

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits

Reviewing files that changed from the base of the PR and between a3e705d and e0bfe54.

📒 Files selected for processing (4)
  • lib/types.d.ts
  • src/require.ts
  • test/virtual-modules.test.ts
  • vitest.config.ts
 _____________________________
< I speak fluent stack trace. >
 -----------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

✏️ Tip: You can disable in-progress messages and the fortune message in your review settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/vfs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@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