Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for registering import module callback functions in quickjs module #146

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

leizongmin
Copy link
Owner

@leizongmin leizongmin commented Jul 11, 2024

Add support for registering callback functions to handle import modules in the quickjs module.

  • quickjs/quickjs.go:

    • Add moduleLoader field to Runtime struct.
    • Add SetModuleLoader method to Runtime struct to register a callback function for handling import modules.
    • Update NewContext method to call the registered module loader callback during module resolution.
  • internal/jsexecutor/jsexecutor.go:

    • Add RegisterModuleLoader function to register a callback function for handling import modules.
    • Update NewJSRuntime function to call the registered module loader callback during module resolution.
  • internal/jsbuiltin/src/00_module.js:

    • Add importModuleCallbacks array to store callback functions.
    • Add registerImportModuleCallback function to register callback functions for handling import modules.
    • Add callImportModuleCallbacks function to call the registered import module callback functions during module resolution.

For more details, open the Copilot Workspace session.

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