Skip to content

Conversation

@dwisiswant0
Copy link

@dwisiswant0 dwisiswant0 commented May 22, 2025

Adds support for using embedded filesystems with the require package by introducing a new WithFS option. This allows modules to be loaded from embedded filesystems before falling back to the host filesystem.

Changes

  • Added new WithFS option to configure one or more embedded filesystems.
  • Modified DefaultSourceLoader to check embedded filesystems before falling back to host filesystem.
  • Made DefaultSourceLoader a receiver method to access Registry's filesystems.

Use Cases

  • WithFS v. WithGlobalFolders
    • For bundling modules with the app v. runtime configuration of module search paths
    • Embedding required modules v. global module installations
    • Providing read-only module access v. user-specific module directories
    • Shipping standalone executables v. custom module repositories

Signed-off-by: Dwi Siswanto <git@dw1.io>
@dop251
Copy link
Owner

dop251 commented May 22, 2025

Thanks for submitting. The current idea is that Registry should not know anything about filesystem, all operations should be abstracted through SourceLoader and PathResolver. So ideally you should be able implement these without touching the Registry itself.

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