dev: address TODO comment in Kernel.js

This commit is contained in:
KernelDeimos
2024-12-09 13:14:10 -05:00
parent c36dd1b3d3
commit 7839d52925
+7 -15
View File
@@ -294,6 +294,13 @@ class Kernel extends AdvancedBase {
const mod = new ExtensionModule();
mod.extension = new Extension();
const mod_context = this._create_mod_context(mod_install_root_context, {
name: mod_dirname,
['module']: mod,
external: true,
mod_path,
});
// This is where the module gets the 'use' and 'def' globals
await this.useapi.awithuse(async () => {
// This is where the module gets the 'extension' global
@@ -304,21 +311,6 @@ class Kernel extends AdvancedBase {
if ( maybe_promise && maybe_promise instanceof Promise ) {
await maybe_promise;
}
});
});
const mod_context = this._create_mod_context(mod_install_root_context, {
name: mod_dirname,
['module']: mod,
external: true,
mod_path,
});
// TODO: DRY `awithuse` and `aglobalwith` with above
await this.useapi.awithuse(async () => {
await useapi.aglobalwith({
extension: mod.extension,
}, async () => {
// This is where the 'install' event gets triggered
await mod.install(mod_context);
});