add before-all, after-all hooks corresponding to preProcess, postProcess

This commit is contained in:
Sid Vishnoi 2021-02-20 02:51:37 +05:30
parent 39c96e4239
commit c8fcef387a
1 changed files with 11 additions and 0 deletions

View File

@ -29,6 +29,12 @@ export function setupExtensions(corePlugins, conf) {
}
const allPlugins = [];
if (extMap.has("before-all")) {
allPlugins.push(...extMap.get("before-all"));
extMap.delete("before-all");
}
for (const corePlugin of corePlugins) {
const beforeHookName = corePlugin.hooks?.find(s => s.startsWith("before-"));
if (beforeHookName && extMap.has(beforeHookName)) {
@ -45,6 +51,11 @@ export function setupExtensions(corePlugins, conf) {
}
}
if (extMap.has("after-all")) {
allPlugins.push(...extMap.get("after-all"));
extMap.delete("after-all");
}
// remaining extensions have no corresponding hooks.
for (const [on, exts] of extMap) {
for (const ext of exts) {