@gasket/plugin-dynamic-plugins
Advanced tools
Comparing version 7.1.0-next.1 to 7.1.0-next.2
@@ -12,13 +12,13 @@ /// <reference types="@gasket/plugin-metadata" /> | ||
hooks: { | ||
async prepare(gasket) { | ||
if (!gasket.config.dynamicPlugins?.length) return; | ||
async prepare(gasket, config) { | ||
if (!config.dynamicPlugins?.length) return config; | ||
const load = await Promise.all(gasket.config.dynamicPlugins.map(plugin => import(plugin))); | ||
const load = await Promise.all(config.dynamicPlugins.map(plugin => import(plugin))); | ||
load.forEach(mod => { | ||
gasket.config.plugins.push(mod.default); | ||
config.plugins.push(mod.default); | ||
}); | ||
gasket.engine.registerPlugins(gasket.config.plugins); | ||
gasket.engine.registerPlugins(config.plugins); | ||
// eslint-disable-next-line no-sync | ||
gasket.execApplySync('init', function (plugin, handler) { | ||
if (gasket.config.dynamicPlugins.includes(plugin.name)) { | ||
if (config.dynamicPlugins.includes(plugin.name)) { | ||
handler(); | ||
@@ -29,6 +29,8 @@ } | ||
gasket.execApplySync('configure', async function (plugin, handler) { | ||
if (gasket.config.dynamicPlugins.includes(plugin.name)) { | ||
gasket.config = handler(gasket.config); | ||
if (config.dynamicPlugins.includes(plugin.name)) { | ||
config = handler(config); | ||
} | ||
}); | ||
return config; | ||
}, | ||
@@ -35,0 +37,0 @@ metadata(gasket, meta) { |
{ | ||
"name": "@gasket/plugin-dynamic-plugins", | ||
"version": "7.1.0-next.1", | ||
"version": "7.1.0-next.2", | ||
"description": "Gasket plugin for dynamically adding plugins to Gasket", | ||
@@ -41,3 +41,3 @@ "type": "module", | ||
"devDependencies": { | ||
"@gasket/core": "7.1.0-next.1", | ||
"@gasket/core": "7.1.0-next.2", | ||
"eslint": "^8.56.0", | ||
@@ -68,3 +68,3 @@ "eslint-config-godaddy": "^7.1.1", | ||
}, | ||
"gitHead": "88ffa495d5f76822e138ddbd696ab3e7ff8e7680" | ||
"gitHead": "9dd2af74728d5e62fdfc198c592349eb4ab3a25e" | ||
} |
56
7537