1 |
3a515b92
|
cagy
|
/*
|
2 |
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
3 |
|
|
Author Tobias Koppers @sokra
|
4 |
|
|
*/
|
5 |
|
|
"use strict";
|
6 |
|
|
|
7 |
|
|
const Hook = require("./Hook");
|
8 |
|
|
const HookCodeFactory = require("./HookCodeFactory");
|
9 |
|
|
|
10 |
|
|
class SyncHookCodeFactory extends HookCodeFactory {
|
11 |
|
|
content({ onError, onDone, rethrowIfPossible }) {
|
12 |
|
|
return this.callTapsSeries({
|
13 |
|
|
onError: (i, err) => onError(err),
|
14 |
|
|
onDone,
|
15 |
|
|
rethrowIfPossible
|
16 |
|
|
});
|
17 |
|
|
}
|
18 |
|
|
}
|
19 |
|
|
|
20 |
|
|
const factory = new SyncHookCodeFactory();
|
21 |
|
|
|
22 |
|
|
class SyncHook extends Hook {
|
23 |
|
|
tapAsync() {
|
24 |
|
|
throw new Error("tapAsync is not supported on a SyncHook");
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
tapPromise() {
|
28 |
|
|
throw new Error("tapPromise is not supported on a SyncHook");
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
compile(options) {
|
32 |
|
|
factory.setup(this, options);
|
33 |
|
|
return factory.create(options);
|
34 |
|
|
}
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
module.exports = SyncHook;
|