Skip to content

Commit a54d775

Browse files
committed
feat(core): invoke registered plugin hooks
BREAKING CHANGE: plugins now use async functions instead of events
1 parent d4b2598 commit a54d775

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

packages/core/src/lib/compose.js

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -187,30 +187,14 @@ module.exports = function(pattern, patternlab) {
187187
uikit.outputDir
188188
);
189189

190-
patternlab.events.emit(
191-
events.PATTERNLAB_PATTERN_WRITE_END,
192-
patternlab,
193-
pattern
194-
);
195-
196-
console.log(196);
197-
198-
(async function() {
190+
await (async function() {
199191
const hookHandlers = patternlab.hooks[
200192
events.PATTERNLAB_PATTERN_WRITE_END
201-
].forEach(h => h());
202-
console.log(203, hookHandlers.length);
193+
].map(h => h(patternlab, pattern));
203194

204195
const results = await Promise.all(hookHandlers);
205-
console.log(205, results);
206196
})();
207197

208-
console.log(208);
209-
210-
await patternlab.hooks[events.PATTERNLAB_PATTERN_WRITE_END];
211-
212-
console.log(212);
213-
214198
// Allows serializing the compile state
215199
patternlab.graph.node(
216200
pattern

0 commit comments

Comments
 (0)