-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.ts
34 lines (32 loc) · 1.2 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Step, Plugin, StoreAggregateTrigger } from "@shanzhai/interfaces";
import { htmlHeaderStore } from "@shanzhai/html-header-store";
import { pugLocalStore } from "@shanzhai/pug-local-store";
import { KeyedStoreSetOutput } from "@shanzhai/keyed-store-set-output";
import { ConcatenateObjectValuesInput } from "@shanzhai/concatenate-object-values-input";
import { CopyStep } from "@shanzhai/copy-step";
import { WrapInObjectOutput } from "@shanzhai/wrap-in-object-output";
import { KeyedStoreGetAllInput } from "@shanzhai/keyed-store-get-all-input";
const htmlHeaderPugLocalPlugin: Plugin<{
readonly htmlHeaderPugLocal: StoreAggregateTrigger;
}> = {
triggers: {
htmlHeaderPugLocal: {
type: `storeAggregate`,
stores: [htmlHeaderStore],
invalidated(): Step {
return new CopyStep(
`Copy HTML headers to Pug locals`,
new ConcatenateObjectValuesInput(
new KeyedStoreGetAllInput(htmlHeaderStore)
),
new WrapInObjectOutput(
`headers`,
new KeyedStoreSetOutput(pugLocalStore, `htmlHeaderPugLocalPlugin`)
)
);
},
writesToStores: [pugLocalStore],
},
},
};
export = htmlHeaderPugLocalPlugin;