-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
63 lines (61 loc) · 2.23 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { Plugin, StoreAggregateTrigger, Step } from "@shanzhai/interfaces";
import { SerialStep } from "@shanzhai/serial-step";
import { ParallelStep } from "@shanzhai/parallel-step";
import { CollectSvgDefsStep } from "@shanzhai/collect-svg-defs-step";
import { svgDefStore } from "@shanzhai/svg-def-store";
import { typeScriptSourceStore } from "@shanzhai/type-script-source-store";
import { pugLocalStore } from "@shanzhai/pug-local-store";
import { typeScriptGlobalStore } from "@shanzhai/type-script-global-store";
import { WrapInObjectOutput } from "@shanzhai/wrap-in-object-output";
import { DeleteFromKeyedStoreStep } from "@shanzhai/delete-from-keyed-store-step";
import { KeyedStoreGetAllInput } from "@shanzhai/keyed-store-get-all-input";
import { KeyedStoreSetOutput } from "@shanzhai/keyed-store-set-output";
const collectSvgDefsPlugin: Plugin<{
readonly collectSvgDefs: StoreAggregateTrigger;
}> = {
triggers: {
collectSvgDefs: {
type: `storeAggregate`,
stores: [svgDefStore],
invalidated(): Step {
return new SerialStep(`Collect SVG defs`, [
new ParallelStep(`Delete previous outputs`, [
new DeleteFromKeyedStoreStep(
typeScriptSourceStore,
`temp/collect-svg-defs-plugin.ts`
),
new DeleteFromKeyedStoreStep(
typeScriptGlobalStore,
`collect-svg-defs-plugin`
),
new DeleteFromKeyedStoreStep(
pugLocalStore,
`collect-svg-defs-plugin`
),
]),
new CollectSvgDefsStep(
new KeyedStoreGetAllInput(svgDefStore),
new KeyedStoreSetOutput(
typeScriptSourceStore,
`temp/collect-svg-defs-plugin.ts`
),
new KeyedStoreSetOutput(
typeScriptGlobalStore,
`collect-svg-defs-plugin`
),
new WrapInObjectOutput(
`collectSvgDefsPluginSvg`,
new KeyedStoreSetOutput(pugLocalStore, `collect-svg-defs-plugin`)
)
),
]);
},
writesToStores: [
typeScriptSourceStore,
typeScriptGlobalStore,
pugLocalStore,
],
},
},
};
export = collectSvgDefsPlugin;