Skip to content

Commit

Permalink
perf: skip empty plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Feb 4, 2023
1 parent c5dcdc0 commit 1b44e3c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/breadc/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,21 @@ export function makePluginContainer(plugins: Partial<Plugin>[] = []) {

return {
async preRun(breadc: Breadc) {
if (plugins.length === 0) return;
for (const p of plugins) {
await p.onPreRun?.(breadc);
}
},
async preCommand(command: Command, result: ParseResult) {
if (plugins.length === 0) return;
await run(onPreCommand, command, result);
},
async postCommand(command: Command, result: ParseResult) {
if (plugins.length === 0) return;
await run(onPostCommand, command, result);
},
async postRun(breadc: Breadc) {
if (plugins.length === 0) return;
for (const p of plugins) {
await p.onPostRun?.(breadc);
}
Expand Down

0 comments on commit 1b44e3c

Please sign in to comment.