You need to sign in or sign up before continuing.
@mutaflow/testkit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +75 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +164 -0
- package/dist/index.js.map +1 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# @mutaflow/testkit
|
|
2
|
+
|
|
3
|
+
Testing helpers for Mutaflow optimistic flows.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install mutaflow @mutaflow/testkit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What it provides
|
|
12
|
+
|
|
13
|
+
- `createTestStore(...)`
|
|
14
|
+
- `runFlowAndCollectEvents(...)`
|
|
15
|
+
- `recordFlow(...)`
|
|
16
|
+
- `expectEvents(...)`
|
|
17
|
+
- `expectResource(...)`
|
|
18
|
+
- `expectInvalidations(...)`
|
|
19
|
+
- `expectConsistency(...)`
|
|
20
|
+
- `expectSummary(...)`
|
|
21
|
+
- `expectOptimisticState(...)`
|
|
22
|
+
- `expectRollback(...)`
|
|
23
|
+
- `expectReconciled(...)`
|
|
24
|
+
|
|
25
|
+
## Example
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { optimistic } from "mutaflow";
|
|
29
|
+
import { createFlow } from "mutaflow";
|
|
30
|
+
import {
|
|
31
|
+
createTestStore,
|
|
32
|
+
expectConsistency,
|
|
33
|
+
expectEvents,
|
|
34
|
+
expectReconciled,
|
|
35
|
+
runFlowAndCollectEvents,
|
|
36
|
+
} from "@mutaflow/testkit";
|
|
37
|
+
|
|
38
|
+
const flow = createFlow({
|
|
39
|
+
action: async (input) => ({ id: `todo:${input.title}`, title: input.title }),
|
|
40
|
+
optimistic: optimistic.insert({
|
|
41
|
+
target: "todos:list",
|
|
42
|
+
item: (input) => ({ id: `temp:${input.title}`, title: input.title, pending: true }),
|
|
43
|
+
}),
|
|
44
|
+
consistency: () => ({
|
|
45
|
+
strategy: "immediate",
|
|
46
|
+
readYourOwnWrites: true,
|
|
47
|
+
invalidations: [{ kind: "tag", value: "todos.list" }],
|
|
48
|
+
}),
|
|
49
|
+
reconcile: {
|
|
50
|
+
target: "todos:list",
|
|
51
|
+
onSuccess: (current, result) =>
|
|
52
|
+
(Array.isArray(current) ? current : []).map((todo) =>
|
|
53
|
+
todo.id === `temp:${result.title}`
|
|
54
|
+
? { ...todo, id: result.id, pending: false }
|
|
55
|
+
: todo,
|
|
56
|
+
),
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const testStore = createTestStore({
|
|
61
|
+
"todos:list": [],
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const run = await runFlowAndCollectEvents(flow, { title: "Ship" }, testStore);
|
|
65
|
+
|
|
66
|
+
expectEvents(run, ["flow:start", "flow:optimistic-applied", "flow:reconciled", "flow:success"]);
|
|
67
|
+
expectConsistency(run, { strategy: "immediate", readYourOwnWrites: true });
|
|
68
|
+
expectReconciled(run, "todos:list", [
|
|
69
|
+
{ id: "todo:Ship", title: "Ship", pending: false },
|
|
70
|
+
]);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Status
|
|
74
|
+
|
|
75
|
+
This is an early test helper package for the current Mutaflow runtime.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ConsistencyPreset, type FlowDefinition, type FlowRunOptions, type FlowRunResult, type InvalidateEntry, type MutationEvent, type MutationEventStore, type MutationEventType, type ResourceStore } from "mutaflow";
|
|
2
|
+
export type MutaflowTestStore = {
|
|
3
|
+
store: ResourceStore;
|
|
4
|
+
events: MutationEventStore;
|
|
5
|
+
getResource: <TValue>(target: string) => TValue | undefined;
|
|
6
|
+
setResource: <TValue>(target: string, value: TValue) => TValue;
|
|
7
|
+
snapshot: () => Record<string, unknown>;
|
|
8
|
+
getEvents: () => MutationEvent[];
|
|
9
|
+
clearEvents: () => void;
|
|
10
|
+
};
|
|
11
|
+
export type RunFlowAndCollectEventsResult<TResult> = {
|
|
12
|
+
result: FlowRunResult<TResult>;
|
|
13
|
+
store: ResourceStore;
|
|
14
|
+
events: MutationEventStore;
|
|
15
|
+
resourceSnapshot: Record<string, unknown>;
|
|
16
|
+
eventList: MutationEvent[];
|
|
17
|
+
eventTypes: MutationEventType[];
|
|
18
|
+
};
|
|
19
|
+
export type MutationSummary = {
|
|
20
|
+
total: number;
|
|
21
|
+
success: number;
|
|
22
|
+
error: number;
|
|
23
|
+
cancelled: number;
|
|
24
|
+
retries: number;
|
|
25
|
+
};
|
|
26
|
+
export declare function createTestStore(initialState?: Record<string, unknown>): MutaflowTestStore;
|
|
27
|
+
export declare function runFlowAndCollectEvents<TInput, TResult>(flow: FlowDefinition<TInput, TResult>, input: TInput, options?: (FlowRunOptions & {
|
|
28
|
+
store?: ResourceStore;
|
|
29
|
+
events?: MutationEventStore;
|
|
30
|
+
}) | MutaflowTestStore): Promise<RunFlowAndCollectEventsResult<TResult>>;
|
|
31
|
+
export declare const recordFlow: typeof runFlowAndCollectEvents;
|
|
32
|
+
export declare function expectEvents(source: MutationEvent[] | MutationEventStore | RunFlowAndCollectEventsResult<unknown> | MutaflowTestStore, expectedTypes: MutationEventType[]): void;
|
|
33
|
+
export declare function expectResource(source: ResourceStore | RunFlowAndCollectEventsResult<unknown> | MutaflowTestStore | Record<string, unknown>, target: string, expected: unknown): void;
|
|
34
|
+
export declare function expectInvalidations(source: RunFlowAndCollectEventsResult<unknown> | FlowRunResult<unknown>, expected: InvalidateEntry[]): void;
|
|
35
|
+
export declare function expectConsistency(source: RunFlowAndCollectEventsResult<unknown> | FlowRunResult<unknown>, expected: Partial<ConsistencyPreset>): void;
|
|
36
|
+
export declare function expectSummary(source: MutationEvent[] | MutationEventStore | RunFlowAndCollectEventsResult<unknown> | MutaflowTestStore, expected: Partial<MutationSummary>): void;
|
|
37
|
+
export declare function expectOptimisticState(source: ResourceStore | RunFlowAndCollectEventsResult<unknown> | MutaflowTestStore | Record<string, unknown>, target: string, expected: unknown): void;
|
|
38
|
+
export declare function expectRollback(source: RunFlowAndCollectEventsResult<unknown>, target: string, expected: unknown): void;
|
|
39
|
+
export declare function expectReconciled(source: RunFlowAndCollectEventsResult<unknown>, target: string, expected: unknown): void;
|
|
40
|
+
export declare function summarizeEvents(events: MutationEvent[]): MutationSumm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AAG,iBAAiB,EACzG,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,QAWnC;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,aAAa,GAAG,6BAA6B,CAAC,OAAO,CAAC,GAAG,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5G,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,OAAO,QAGlB;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,6BAA6B,CAAC,OAAO,CAAC,EAC9C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,OAAO,QAIlB;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,6BAA6B,CAAC,OAAO,CAAC,EAC9C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,OAAO,QAMlB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,eAAe,CAQxE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { createMutationEventStore, createResourceStore, runFlow, } from "mutaflow";
|
|
2
|
+
export function createTestStore(initialState = {}) {
|
|
3
|
+
const store = createResourceStore(initialState);
|
|
4
|
+
const events = createMutationEventStore();
|
|
5
|
+
return {
|
|
6
|
+
store,
|
|
7
|
+
events,
|
|
8
|
+
getResource(target) {
|
|
9
|
+
return store.get(target);
|
|
10
|
+
},
|
|
11
|
+
setResource(target, value) {
|
|
12
|
+
return store.set(target, value);
|
|
13
|
+
},
|
|
14
|
+
snapshot() {
|
|
15
|
+
return store.snapshot();
|
|
16
|
+
},
|
|
17
|
+
getEvents() {
|
|
18
|
+
return events.getEvents();
|
|
19
|
+
},
|
|
20
|
+
clearEvents() {
|
|
21
|
+
events.clear();
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export async function runFlowAndCollectEvents(flow, input, options = {}) {
|
|
26
|
+
const testStore = isMutaflowTestStore(options) ? options : undefined;
|
|
27
|
+
const store = testStore?.store ?? options.store ?? createResourceStore();
|
|
28
|
+
const events = testStore?.events ?? options.events ?? createMutationEventStore();
|
|
29
|
+
const result = await runFlow(flow, input, {
|
|
30
|
+
...(!testStore ? options : {}),
|
|
31
|
+
store,
|
|
32
|
+
events,
|
|
33
|
+
});
|
|
34
|
+
const eventList = events.getEvents();
|
|
35
|
+
return {
|
|
36
|
+
result,
|
|
37
|
+
store,
|
|
38
|
+
events,
|
|
39
|
+
resourceSnapshot: store.snapshot(),
|
|
40
|
+
eventList,
|
|
41
|
+
eventTypes: eventList.map((event) => event.type),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export const recordFlow = runFlowAndCollectEvents;
|
|
45
|
+
export function expectEvents(source, expectedTypes) {
|
|
46
|
+
assertDeepEqual(readEvents(source).map((event) => event.type), expectedTypes, "Expected mutation event sequence to match.");
|
|
47
|
+
}
|
|
48
|
+
export function expectResource(source, target, expected) {
|
|
49
|
+
assertDeepEqual(readResource(source, target), expected, `Expected resource '${target}' to match.`);
|
|
50
|
+
}
|
|
51
|
+
export function expectInvalidations(source, expected) {
|
|
52
|
+
const invalidations = isRunCollectionResult(source)
|
|
53
|
+
? source.result.invalidations ?? []
|
|
54
|
+
: source.invalidations ?? [];
|
|
55
|
+
assertDeepEqual(invalidations, expected, "Expected invalidations to match.");
|
|
56
|
+
}
|
|
57
|
+
export function expectConsistency(source, expected) {
|
|
58
|
+
const consistency = isRunCollectionResult(source)
|
|
59
|
+
? source.result.consistency
|
|
60
|
+
: source.consistency;
|
|
61
|
+
assertTruthy(consistency, "Expected flow consistency metadata to be present.");
|
|
62
|
+
const resolvedConsistency = consistency;
|
|
63
|
+
const comparable = {
|
|
64
|
+
strategy: resolvedConsistency.strategy,
|
|
65
|
+
readYourOwnWrites: resolvedConsistency.readYourOwnWrites,
|
|
66
|
+
invalidations: resolvedConsistency.invalidations,
|
|
67
|
+
};
|
|
68
|
+
const expectedComparable = {
|
|
69
|
+
strategy: expected.strategy ?? comparable.strategy,
|
|
70
|
+
readYourOwnWrites: expected.readYourOwnWrites ?? comparable.readYourOwnWrites,
|
|
71
|
+
invalidations: expected.invalidations ?? comparable.invalidations,
|
|
72
|
+
};
|
|
73
|
+
assertDeepEqual(comparable, expectedComparable, "Expected consistency metadata to match.");
|
|
74
|
+
}
|
|
75
|
+
export function expectSummary(source, expected) {
|
|
76
|
+
const summary = summarizeEvents(readEvents(source));
|
|
77
|
+
const comparable = {
|
|
78
|
+
total: expected.total ?? summary.total,
|
|
79
|
+
success: expected.success ?? summary.success,
|
|
80
|
+
error: expected.error ?? summary.error,
|
|
81
|
+
cancelled: expected.cancelled ?? summary.cancelled,
|
|
82
|
+
retries: expected.retries ?? summary.retries,
|
|
83
|
+
};
|
|
84
|
+
assertDeepEqual(summary, comparable, "Expected mutation summary to match.");
|
|
85
|
+
}
|
|
86
|
+
export function expectOptimisticState(source, target, expected) {
|
|
87
|
+
expectResource(source, target, expected);
|
|
88
|
+
}
|
|
89
|
+
export function expectRollback(source, target, expected) {
|
|
90
|
+
assertTruthy(source.result.error, "Expected flow result to include an error for rollback assertion.");
|
|
91
|
+
expectResource(source, target, expected);
|
|
92
|
+
}
|
|
93
|
+
export function expectReconciled(source, target, expected) {
|
|
94
|
+
if (source.result.error) {
|
|
95
|
+
throw new Error("Expected flow result to be successful for reconcile assertion.");
|
|
96
|
+
}
|
|
97
|
+
expectResource(source, target, expected);
|
|
98
|
+
}
|
|
99
|
+
export function summarizeEvents(events) {
|
|
100
|
+
return {
|
|
101
|
+
total: events.length,
|
|
102
|
+
success: events.filter((event) => event.type === "flow:success").length,
|
|
103
|
+
error: events.filter((event) => event.type === "flow:error").length,
|
|
104
|
+
cancelled: events.filter((event) => event.type === "flow:cancelled").length,
|
|
105
|
+
retries: events.filter((event) => event.type === "flow:retrying").length,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function assertTruthy(value, message) {
|
|
109
|
+
if (!value) {
|
|
110
|
+
throw new Error(message);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function assertDeepEqual(actual, expected, message) {
|
|
114
|
+
const actualSerialized = JSON.stringify(actual);
|
|
115
|
+
const expectedSerialized = JSON.stringify(expected);
|
|
116
|
+
if (actualSerialized !== expectedSerialized) {
|
|
117
|
+
throw new Error(`${message}\nExpected: ${expectedSerialized}\nReceived: ${actualSerialized}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function isMutaflowTestStore(value) {
|
|
121
|
+
return Boolean(value
|
|
122
|
+
&& typeof value === "object"
|
|
123
|
+
&& "store" in value
|
|
124
|
+
&& "events" in value
|
|
125
|
+
&& "getResource" in value
|
|
126
|
+
&& "getEvents" in value);
|
|
127
|
+
}
|
|
128
|
+
function isRunCollectionResult(value) {
|
|
129
|
+
return Boolean(value
|
|
130
|
+
&& typeof value === "object"
|
|
131
|
+
&& "resourceSnapshot" in value
|
|
132
|
+
&& "eventList" in value);
|
|
133
|
+
}
|
|
134
|
+
function isResourceStore(value) {
|
|
135
|
+
return Boolean(value
|
|
136
|
+
&& typeof value === "object"
|
|
137
|
+
&& "get" in value
|
|
138
|
+
&& typeof value.get === "function");
|
|
139
|
+
}
|
|
140
|
+
function readEvents(source) {
|
|
141
|
+
if (Array.isArray(source)) {
|
|
142
|
+
return source;
|
|
143
|
+
}
|
|
144
|
+
if (isRunCollectionResult(source)) {
|
|
145
|
+
return source.eventList;
|
|
146
|
+
}
|
|
147
|
+
if (isMutaflowTestStore(source)) {
|
|
148
|
+
return source.getEvents();
|
|
149
|
+
}
|
|
150
|
+
return source.getEvents();
|
|
151
|
+
}
|
|
152
|
+
function readResource(source, target) {
|
|
153
|
+
if (isRunCollectionResult(source)) {
|
|
154
|
+
return source.resourceSnapshot[target];
|
|
155
|
+
}
|
|
156
|
+
if (isMutaflowTestStore(source)) {
|
|
157
|
+
return source.getResource(target);
|
|
158
|
+
}
|
|
159
|
+
if (isResourceStore(source)) {
|
|
160
|
+
return source.get(target);
|
|
161
|
+
}
|
|
162
|
+
return source[target];
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,OAAO,GAUR,MAAM,UAAU,CAAC;AA6BlB,MAAM,UAAU,eAAe,CAAC,eAAwC,EAAE;IACxE,MAAM,KAAK,GAAG,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,wBAAwB,EAAE,CAAC;IAE1C,OAAO;QACL,KAAK;QACL,MAAM;QACN,WAAW,CAAC,MAAM;YAChB,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3B,CAAC;QACD,WAAW,CAAC,MAAM,EAAE,KAAK;YACvB,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAClC,CAAC;QACD,QAAQ;YACN,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC1B,CAAC;QACD,SAAS;YACP,OAAO,MAAM,CAAC,SAAS,EAAE,CAAC;QAC5B,CAAC;QACD,WAAW;YACT,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,IAAqC,EACrC,KAAa,EACb,UAAyG,EAAE;IAE3G,MAAM,SAAS,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IACrE,MAAM,KAAK,GAAG,SAAS,EAAE,KAAK,IAAI,OAAO,CAAC,KAAK,IAAI,mBAAmB,EAAE,CAAC;IACzE,MAAM,MAAM,GAAG,SAAS,EAAE,MAAM,IAAI,OAAO,CAAC,MAAM,IAAI,wBAAwB,EAAE,CAAC;IAEjF,MAAM,MAAM,GAAG,MAAM,OAAO,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,OAAO,MAAM,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC,SAAS,EAAE,CAAC;IAC5B,CAAC;IAED,OAAO,MAAM,CAAC,SAAS,EAAE,CAAC;AAC5B,CAAC;AAED,SAAS,YAAY,CACnB,MAA4G,EAC5G,MAAc;IAEd,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAED,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mutaflow/testkit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Testing helpers for Mutaflow optimistic flows",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/javaquasar/mutaflow.git",
|
|
9
|
+
"directory": "packages/testkit"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/javaquasar/mutaflow#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/javaquasar/mutaflow/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"main": "./dist/index.js",
|
|
18
|
+
"module": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc -p tsconfig.json",
|
|
33
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
34
|
+
"prepublishOnly": "npm run build"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"mutaflow": "^0.1.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"mutaflow": "file:../mutaflow"
|
|
41
|
+
}
|
|
42
|
+
}
|