Skip to content

[WIP] Add ability to install custom JS module loaders.#1

Draft
Sam Gammon (sgammon) wants to merge 1 commit intobase/24.1.2from
feat/js-module-import-hook
Draft

[WIP] Add ability to install custom JS module loaders.#1
Sam Gammon (sgammon) wants to merge 1 commit intobase/24.1.2from
feat/js-module-import-hook

Conversation

@sgammon
Copy link
Copy Markdown
Member

@sgammon Sam Gammon (sgammon) commented Feb 24, 2025

  • Adds JSModuleLoaderFactory interface for ESM loader hook.
  • Adds CommonJSResolverHook interface for CJS resolver hook.
  • Adds js.module-loader-factory=handler setting to enable.
  • Adjusts JSEngine to retain the installed factory and/or resolver.
  • Adjusts JSRealm to use JSEngine to create the module loader.
  • Adjusts NpmCompatibleESModuleLoader to be extensible.
  • Adjusts CommonJSResolution to use the resolver hook if present.

Relates to oracle/graal#9177
Relates to elide-dev/elide#1227

- Adds `JSModuleLoaderFactory` interface for ESM loader hook.
- Adds `CommonJSResolverHook` interface for CJS resolver hook.
- Adds `js.module-loader-factory=handler` setting to enable.
- Adjusts `JSEngine` to retain the installed factory and/or resolver.
- Adjusts `JSRealm` to use `JSEngine` to create the module loader.
- Adjusts `NpmCompatibleESModuleLoader` to be extensible.
- Adjusts `CommonJSResolution` to use the resolver hook if present.

Relates to oracle/graal#9177

Signed-off-by: Sam Gammon <sam@elide.dev>
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