Skip to content

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

Open
leizongmin wants to merge 2 commits intomainfrom
add-import-module-callback
Open

Add support for registering import module callback functions in quickjs module#146
leizongmin wants to merge 2 commits intomainfrom
add-import-module-callback

Conversation

@leizongmin
Copy link
Copy Markdown
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