@reventlessdev/reventless-gwt 1.0.0-alpha.100
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/CHANGELOG.md +916 -0
- package/LICENSE +202 -0
- package/bin/reventless-dev.mjs +21 -0
- package/package.json +54 -0
- package/rescript.json +36 -0
- package/src/.gwtignore +10 -0
- package/src/Automation_GWT.res +207 -0
- package/src/Automation_GWT.res.mjs +160 -0
- package/src/Behavior_GWT.res +569 -0
- package/src/Behavior_GWT.res.mjs +523 -0
- package/src/Bind.res +29 -0
- package/src/Bind.res.mjs +22 -0
- package/src/BuildClassifier.res +147 -0
- package/src/BuildClassifier.res.mjs +136 -0
- package/src/Cancellation.res +37 -0
- package/src/Cancellation.res.mjs +46 -0
- package/src/ChildProcess.res +102 -0
- package/src/ChildProcess.res.mjs +107 -0
- package/src/Cli.res +905 -0
- package/src/Cli.res.mjs +952 -0
- package/src/Collector.res +212 -0
- package/src/Collector.res.mjs +218 -0
- package/src/ComponentMeta.res +77 -0
- package/src/ComponentMeta.res.mjs +91 -0
- package/src/ComponentScan.res +103 -0
- package/src/ComponentScan.res.mjs +105 -0
- package/src/Delegate_GWT.res +303 -0
- package/src/Delegate_GWT.res.mjs +372 -0
- package/src/Diff.res +91 -0
- package/src/Diff.res.mjs +98 -0
- package/src/Discovery.res +105 -0
- package/src/Discovery.res.mjs +99 -0
- package/src/DomainDeadCode.res +98 -0
- package/src/DomainDeadCode.res.mjs +72 -0
- package/src/DomainGraph.res +0 -0
- package/src/DomainGraph.res.mjs +0 -0
- package/src/EventMapping_GWT.res +29 -0
- package/src/EventMapping_GWT.res.mjs +44 -0
- package/src/Filter.res +45 -0
- package/src/Filter.res.mjs +47 -0
- package/src/Flow_GWT.res +664 -0
- package/src/Flow_GWT.res.mjs +604 -0
- package/src/FormatterHuman.res +109 -0
- package/src/FormatterHuman.res.mjs +115 -0
- package/src/FormatterJson.res +264 -0
- package/src/FormatterJson.res.mjs +322 -0
- package/src/FormatterJunit.res +93 -0
- package/src/FormatterJunit.res.mjs +90 -0
- package/src/FormatterTap.res +100 -0
- package/src/FormatterTap.res.mjs +131 -0
- package/src/FormatterVsCode.res +352 -0
- package/src/FormatterVsCode.res.mjs +546 -0
- package/src/Hint.res +119 -0
- package/src/Hint.res.mjs +124 -0
- package/src/InboundTranslation_GWT.res +83 -0
- package/src/InboundTranslation_GWT.res.mjs +94 -0
- package/src/JestBind.res +70 -0
- package/src/JestBind.res.mjs +63 -0
- package/src/Loader.res +24 -0
- package/src/Loader.res.mjs +23 -0
- package/src/LocalHost.res +119 -0
- package/src/LocalHost.res.mjs +99 -0
- package/src/Mapping_GWT.res +474 -0
- package/src/Mapping_GWT.res.mjs +322 -0
- package/src/MismatchRender.res +72 -0
- package/src/MismatchRender.res.mjs +127 -0
- package/src/MultiSourceProjection_GWT.res +316 -0
- package/src/MultiSourceProjection_GWT.res.mjs +354 -0
- package/src/OutboundTranslation_GWT.res +238 -0
- package/src/OutboundTranslation_GWT.res.mjs +186 -0
- package/src/Outcome.res +97 -0
- package/src/Outcome.res.mjs +93 -0
- package/src/PackageScan.res +80 -0
- package/src/PackageScan.res.mjs +81 -0
- package/src/PlatformRunner.res +181 -0
- package/src/PlatformRunner.res.mjs +176 -0
- package/src/PlatformScan.res +142 -0
- package/src/PlatformScan.res.mjs +132 -0
- package/src/ProcessManager.res +135 -0
- package/src/ProcessManager.res.mjs +119 -0
- package/src/Projection_GWT.res +312 -0
- package/src/Projection_GWT.res.mjs +332 -0
- package/src/Query_GWT.res +379 -0
- package/src/Query_GWT.res.mjs +367 -0
- package/src/RenderRescript.res +125 -0
- package/src/RenderRescript.res.mjs +141 -0
- package/src/RunWorker.res +24 -0
- package/src/RunWorker.res.mjs +16 -0
- package/src/RunnerTypes.res +68 -0
- package/src/RunnerTypes.res.mjs +60 -0
- package/src/SideEffect_GWT.res +157 -0
- package/src/SideEffect_GWT.res.mjs +113 -0
- package/src/StateChange/ExternalAddCategorySlice.res +25 -0
- package/src/StateChange/ExternalAddCategorySlice.res.mjs +34 -0
- package/src/StateChange/ExternalAddCategorySlice_Behavior.res +19 -0
- package/src/StateChange/ExternalAddCategorySlice_Behavior.res.mjs +46 -0
- package/src/StateChange/WithFixtures.res +22 -0
- package/src/StateChange/WithFixtures.res.mjs +31 -0
- package/src/StateChange/WithFixtures_Behavior.res +17 -0
- package/src/StateChange/WithFixtures_Behavior.res.mjs +37 -0
- package/src/StateChange/WithManualOpen.res +23 -0
- package/src/StateChange/WithManualOpen.res.mjs +31 -0
- package/src/StateChange/WithManualOpen_Behavior.res +17 -0
- package/src/StateChange/WithManualOpen_Behavior.res.mjs +37 -0
- package/src/StubRuntime.res +54 -0
- package/src/StubRuntime.res.mjs +55 -0
- package/src/TestFixtures.res +16 -0
- package/src/TestFixtures.res.mjs +34 -0
- package/src/Watch.res +108 -0
- package/src/Watch.res.mjs +85 -0
- package/src/WatcherProbe.res +56 -0
- package/src/WatcherProbe.res.mjs +59 -0
- package/src/Worker.res +24 -0
- package/src/Worker.res.mjs +9 -0
- package/tests/AutomationGwtTest.res +71 -0
- package/tests/AutomationGwtTest.res.mjs +189 -0
- package/tests/BuildClassifierTest.res +133 -0
- package/tests/BuildClassifierTest.res.mjs +176 -0
- package/tests/CliRunEntryTest.res +57 -0
- package/tests/CliRunEntryTest.res.mjs +65 -0
- package/tests/CliWatchScopeTest.res +62 -0
- package/tests/CliWatchScopeTest.res.mjs +95 -0
- package/tests/ComponentMetaTest.res +67 -0
- package/tests/ComponentMetaTest.res.mjs +71 -0
- package/tests/DelegateGwtTest.res +487 -0
- package/tests/DelegateGwtTest.res.mjs +891 -0
- package/tests/DiscoveryTest.res +42 -0
- package/tests/DiscoveryTest.res.mjs +43 -0
- package/tests/DomainDeadCodeTest.res +119 -0
- package/tests/DomainDeadCodeTest.res.mjs +158 -0
- package/tests/DomainGraphTest.res +448 -0
- package/tests/DomainGraphTest.res.mjs +505 -0
- package/tests/FlowAggregateGwtTest.res +171 -0
- package/tests/FlowAggregateGwtTest.res.mjs +273 -0
- package/tests/FlowCrossPluginGwtTest.res +340 -0
- package/tests/FlowCrossPluginGwtTest.res.mjs +798 -0
- package/tests/FlowGwtTest.res +222 -0
- package/tests/FlowGwtTest.res.mjs +433 -0
- package/tests/FormatterGoldenTest.res +125 -0
- package/tests/FormatterGoldenTest.res.mjs +162 -0
- package/tests/FormatterVsCodeMessageTest.res +41 -0
- package/tests/FormatterVsCodeMessageTest.res.mjs +42 -0
- package/tests/InboundTranslationGwtTest.res +34 -0
- package/tests/InboundTranslationGwtTest.res.mjs +99 -0
- package/tests/LocalHostIntegration.res +70 -0
- package/tests/LocalHostIntegration.res.mjs +64 -0
- package/tests/LocalHostTest.res +71 -0
- package/tests/LocalHostTest.res.mjs +63 -0
- package/tests/MappingGwtTest.res +350 -0
- package/tests/MappingGwtTest.res.mjs +596 -0
- package/tests/OutboundTranslationGwtTest.res +59 -0
- package/tests/OutboundTranslationGwtTest.res.mjs +139 -0
- package/tests/PlatformRunnerTest.res +66 -0
- package/tests/PlatformRunnerTest.res.mjs +85 -0
- package/tests/PlatformScanTest.res +61 -0
- package/tests/PlatformScanTest.res.mjs +56 -0
- package/tests/QueryGwtTest.res +161 -0
- package/tests/QueryGwtTest.res.mjs +314 -0
- package/tests/QueryResolverGwtTest.res +71 -0
- package/tests/QueryResolverGwtTest.res.mjs +136 -0
- package/tests/RunnerUnitTest.res +219 -0
- package/tests/RunnerUnitTest.res.mjs +244 -0
- package/tests/SideEffect/FakeOrderNotification.res +23 -0
- package/tests/SideEffect/FakeOrderNotification.res.mjs +36 -0
- package/tests/SideEffect/FakeOrderNotificationGwtTest.res +35 -0
- package/tests/SideEffect/FakeOrderNotificationGwtTest.res.mjs +73 -0
- package/tests/SideEffect/MockEmail.res +18 -0
- package/tests/SideEffect/MockEmail.res.mjs +47 -0
- package/tests/StateChange/ExternalAddCategorySlice_GWT.res +27 -0
- package/tests/StateChange/ExternalAddCategorySlice_GWT.res.mjs +70 -0
- package/tests/StateChange/WithFixtures_Fixtures.res +9 -0
- package/tests/StateChange/WithFixtures_Fixtures.res.mjs +20 -0
- package/tests/StateChange/WithFixtures_GWT.res +23 -0
- package/tests/StateChange/WithFixtures_GWT.res.mjs +56 -0
- package/tests/StateChange/WithManualOpen_Fixtures.res +7 -0
- package/tests/StateChange/WithManualOpen_Fixtures.res.mjs +20 -0
- package/tests/StateChange/WithManualOpen_GWT.res +17 -0
- package/tests/StateChange/WithManualOpen_GWT.res.mjs +56 -0
- package/tests/StateChangeSliceGwtTest.res +160 -0
- package/tests/StateChangeSliceGwtTest.res.mjs +280 -0
- package/tests/StateViewSliceGwtTest.res +64 -0
- package/tests/StateViewSliceGwtTest.res.mjs +161 -0
- package/tests/WatchDebounceTest.res +106 -0
- package/tests/WatchDebounceTest.res.mjs +128 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Nodepath from "node:path";
|
|
4
|
+
import * as Promises from "node:fs/promises";
|
|
5
|
+
|
|
6
|
+
let ignoreNames = [
|
|
7
|
+
"node_modules",
|
|
8
|
+
".git",
|
|
9
|
+
"dist",
|
|
10
|
+
"lib",
|
|
11
|
+
".history"
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
function shouldIgnore(name) {
|
|
15
|
+
return ignoreNames.includes(name);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let gwtIgnoreFile = ".gwtignore";
|
|
19
|
+
|
|
20
|
+
function isPruned(entries) {
|
|
21
|
+
return entries.some(e => e.name === gwtIgnoreFile);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function isGwtTestFile(name) {
|
|
25
|
+
if (name.endsWith("_GWT.res.mjs") || name.endsWith("GwtTest.res.mjs")) {
|
|
26
|
+
return true;
|
|
27
|
+
} else {
|
|
28
|
+
return name.endsWith("Gwt.res.mjs");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function walk(dir, acc) {
|
|
33
|
+
let entries;
|
|
34
|
+
try {
|
|
35
|
+
entries = await Promises.readdir(dir, {
|
|
36
|
+
withFileTypes: true
|
|
37
|
+
});
|
|
38
|
+
} catch (exn) {
|
|
39
|
+
entries = [];
|
|
40
|
+
}
|
|
41
|
+
if (isPruned(entries)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
for (let i = 0, i_finish = entries.length; i < i_finish; ++i) {
|
|
45
|
+
let entry = entries[i];
|
|
46
|
+
if (!ignoreNames.includes(entry.name)) {
|
|
47
|
+
let full = Nodepath.join(dir, entry.name);
|
|
48
|
+
if (entry.isDirectory()) {
|
|
49
|
+
await walk(full, acc);
|
|
50
|
+
} else if (entry.isFile() && isGwtTestFile(entry.name)) {
|
|
51
|
+
acc.push(full);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function discover(roots) {
|
|
58
|
+
let found = [];
|
|
59
|
+
for (let i = 0, i_finish = roots.length; i < i_finish; ++i) {
|
|
60
|
+
let root = roots[i];
|
|
61
|
+
let absolute = Nodepath.isAbsolute(root) ? root : Nodepath.resolve(root);
|
|
62
|
+
let isDir;
|
|
63
|
+
try {
|
|
64
|
+
let s = await Promises.stat(absolute);
|
|
65
|
+
isDir = s.isDirectory();
|
|
66
|
+
} catch (exn) {
|
|
67
|
+
isDir = false;
|
|
68
|
+
}
|
|
69
|
+
if (isDir) {
|
|
70
|
+
await walk(absolute, found);
|
|
71
|
+
} else if (isGwtTestFile(absolute)) {
|
|
72
|
+
found.push(absolute);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
let seen = {};
|
|
76
|
+
let unique = [];
|
|
77
|
+
found.forEach(path => {
|
|
78
|
+
let match = seen[path];
|
|
79
|
+
if (match !== undefined) {
|
|
80
|
+
return;
|
|
81
|
+
} else {
|
|
82
|
+
seen[path] = true;
|
|
83
|
+
unique.push(path);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return unique;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export {
|
|
91
|
+
ignoreNames,
|
|
92
|
+
shouldIgnore,
|
|
93
|
+
gwtIgnoreFile,
|
|
94
|
+
isPruned,
|
|
95
|
+
isGwtTestFile,
|
|
96
|
+
walk,
|
|
97
|
+
discover,
|
|
98
|
+
}
|
|
99
|
+
/* node:path Not a pure module */
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Domain-level dead-code analysis (Phase 5). Pure reflection over the loaded
|
|
2
|
+
// pluginStructures (LocalHost.loadGraph): finds produced event
|
|
3
|
+
// types that no component consumes — the event-sourcing counterpart to reactive
|
|
4
|
+
// dead code, the domain layer the language LSP cannot see.
|
|
5
|
+
//
|
|
6
|
+
// An event is reachable when ANY of these hold:
|
|
7
|
+
// 1. Some component lists it in `consumedEventTypes` — the DCB-style link used by
|
|
8
|
+
// state-view slices, automation slices, outbound translations, and aggregate /
|
|
9
|
+
// state-change-slice consistency reads. Scanned across ALL plugins, so a
|
|
10
|
+
// cross-plugin consumer clears it.
|
|
11
|
+
// 2. The producing write-side has a non-empty `linkedViews`. Classic aggregate →
|
|
12
|
+
// read-model projections express the link on the PRODUCER side (the read model's
|
|
13
|
+
// `consumedEventTypes` is empty; it projects the aggregate's whole stream). This
|
|
14
|
+
// is event-opaque, so a write-side with at least one linked view is treated as
|
|
15
|
+
// fully consumed — see the precision caveat below.
|
|
16
|
+
// A produced event matched by neither of these is reported as an orphan, anchored on
|
|
17
|
+
// the producing write-side declaration.
|
|
18
|
+
//
|
|
19
|
+
// Precision caveat: because classic read models carry no per-event consumption, rule
|
|
20
|
+
// (2) is conservative — a write-side with a linked view is never flagged, even if a
|
|
21
|
+
// specific event it produces is projected by nothing. This avoids false positives at
|
|
22
|
+
// the cost of missing per-event orphans inside an otherwise-projected aggregate. DCB
|
|
23
|
+
// consumers (rule 1) keep full per-event precision.
|
|
24
|
+
//
|
|
25
|
+
// Scope (v1): orphan produced events only. "Extension points with zero extensions"
|
|
26
|
+
// and "read models nothing resolves against" need data `pluginStructure` does not
|
|
27
|
+
// carry (the EP declaration list / the id-resolver table) — deferred.
|
|
28
|
+
|
|
29
|
+
// Finding kinds are the typed protocol vocabulary — constructing the variant here
|
|
30
|
+
// (not a string literal) means a typo or rename is a compile error, and the emitter
|
|
31
|
+
// forwards findings without conversion.
|
|
32
|
+
module P = ReventlessVscodeProtocol.Protocol
|
|
33
|
+
|
|
34
|
+
type finding = {
|
|
35
|
+
kind: P.deadCodeKind,
|
|
36
|
+
pluginName: string, // plugin owning the producer
|
|
37
|
+
componentName: string, // the producing aggregate / state-change slice
|
|
38
|
+
detail: string, // the orphaned event type
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let analyze = (
|
|
42
|
+
~structures: array<(string, Reventless.Plugin.pluginStructure)>,
|
|
43
|
+
): array<finding> => {
|
|
44
|
+
// Every event type consumed anywhere becomes a key in `consumed`.
|
|
45
|
+
let consumed = Dict.make()
|
|
46
|
+
let mark = (evt: string) => consumed->Dict.set(evt, true)
|
|
47
|
+
structures->Array.forEach(((_, s)) => {
|
|
48
|
+
s.readModels->Array.forEach((q: Reventless.Plugin.queryableDef) =>
|
|
49
|
+
q.consumedEventTypes->Array.forEach(mark)
|
|
50
|
+
)
|
|
51
|
+
s.stateViewSlices->Array.forEach((q: Reventless.Plugin.queryableDef) =>
|
|
52
|
+
q.consumedEventTypes->Array.forEach(mark)
|
|
53
|
+
)
|
|
54
|
+
s.aggregates->Array.forEach((w: Reventless.Plugin.writableDef) =>
|
|
55
|
+
w.consumedEventTypes->Array.forEach(mark)
|
|
56
|
+
)
|
|
57
|
+
s.stateChangeSlices->Array.forEach((w: Reventless.Plugin.writableDef) =>
|
|
58
|
+
w.consumedEventTypes->Array.forEach(mark)
|
|
59
|
+
)
|
|
60
|
+
s.automationSlices->Array.forEach((a: Reventless.Plugin.automationSliceDef) =>
|
|
61
|
+
a.consumedEventTypes->Array.forEach(mark)
|
|
62
|
+
)
|
|
63
|
+
s.outboundTranslationSlices->Array.forEach((o: Reventless.Plugin.outboundTranslationSliceDef) =>
|
|
64
|
+
o.consumedEventTypes->Array.forEach(mark)
|
|
65
|
+
)
|
|
66
|
+
s.extensions->Array.forEach((e: Reventless.Plugin.extensionDef) =>
|
|
67
|
+
e.eventTypes->Array.forEach(mark)
|
|
68
|
+
)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
// Produced events with no consumer, reported per producing write-side. A write-side
|
|
72
|
+
// with a linked view is treated as fully consumed (rule 2 above).
|
|
73
|
+
let findings = []
|
|
74
|
+
let scanProducers = (pluginName, writables: array<Reventless.Plugin.writableDef>) =>
|
|
75
|
+
writables->Array.forEach(w =>
|
|
76
|
+
if w.linkedViews->Array.length > 0 {
|
|
77
|
+
()
|
|
78
|
+
} else {
|
|
79
|
+
w.producedEventTypes->Array.forEach(evt =>
|
|
80
|
+
switch consumed->Dict.get(evt) {
|
|
81
|
+
| Some(_) => ()
|
|
82
|
+
| None =>
|
|
83
|
+
findings->Array.push({
|
|
84
|
+
kind: OrphanEvent,
|
|
85
|
+
pluginName,
|
|
86
|
+
componentName: w.name,
|
|
87
|
+
detail: evt,
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
structures->Array.forEach(((pluginName, s)) => {
|
|
94
|
+
scanProducers(pluginName, s.aggregates)
|
|
95
|
+
scanProducers(pluginName, s.stateChangeSlices)
|
|
96
|
+
})
|
|
97
|
+
findings
|
|
98
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function analyze(structures) {
|
|
5
|
+
let consumed = {};
|
|
6
|
+
let mark = evt => {
|
|
7
|
+
consumed[evt] = true;
|
|
8
|
+
};
|
|
9
|
+
structures.forEach(param => {
|
|
10
|
+
let s = param[1];
|
|
11
|
+
s.readModels.forEach(q => {
|
|
12
|
+
q.consumedEventTypes.forEach(mark);
|
|
13
|
+
});
|
|
14
|
+
s.stateViewSlices.forEach(q => {
|
|
15
|
+
q.consumedEventTypes.forEach(mark);
|
|
16
|
+
});
|
|
17
|
+
s.aggregates.forEach(w => {
|
|
18
|
+
w.consumedEventTypes.forEach(mark);
|
|
19
|
+
});
|
|
20
|
+
s.stateChangeSlices.forEach(w => {
|
|
21
|
+
w.consumedEventTypes.forEach(mark);
|
|
22
|
+
});
|
|
23
|
+
s.automationSlices.forEach(a => {
|
|
24
|
+
a.consumedEventTypes.forEach(mark);
|
|
25
|
+
});
|
|
26
|
+
s.outboundTranslationSlices.forEach(o => {
|
|
27
|
+
o.consumedEventTypes.forEach(mark);
|
|
28
|
+
});
|
|
29
|
+
s.extensions.forEach(e => {
|
|
30
|
+
e.eventTypes.forEach(mark);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
let findings = [];
|
|
34
|
+
let scanProducers = (pluginName, writables) => {
|
|
35
|
+
writables.forEach(w => {
|
|
36
|
+
if (w.linkedViews.length !== 0) {
|
|
37
|
+
return;
|
|
38
|
+
} else {
|
|
39
|
+
w.producedEventTypes.forEach(evt => {
|
|
40
|
+
let match = consumed[evt];
|
|
41
|
+
if (match !== undefined) {
|
|
42
|
+
return;
|
|
43
|
+
} else {
|
|
44
|
+
findings.push({
|
|
45
|
+
kind: "OrphanEvent",
|
|
46
|
+
pluginName: pluginName,
|
|
47
|
+
componentName: w.name,
|
|
48
|
+
detail: evt
|
|
49
|
+
});
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
structures.forEach(param => {
|
|
58
|
+
let s = param[1];
|
|
59
|
+
let pluginName = param[0];
|
|
60
|
+
scanProducers(pluginName, s.aggregates);
|
|
61
|
+
scanProducers(pluginName, s.stateChangeSlices);
|
|
62
|
+
});
|
|
63
|
+
return findings;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let P;
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
P,
|
|
70
|
+
analyze,
|
|
71
|
+
}
|
|
72
|
+
/* No side effect */
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
open ReventlessCore
|
|
2
|
+
|
|
3
|
+
// Stage 5 — `EventMapping_GWT` is now a thin alias over `Mapping_GWT`
|
|
4
|
+
// specialised for the Aggregate → Aggregate case. New tests should use
|
|
5
|
+
// `Mapping_GWT.Make` directly with `Mapping_GWT.FromBehavior` adapters; this
|
|
6
|
+
// wrapper is retained for migration backward-compat with consumers that were
|
|
7
|
+
// already calling `EventMapping_GWT.Make(Source, SourceBehavior, Target,
|
|
8
|
+
// TargetBehavior, EventMapping)` before Stage 5 landed.
|
|
9
|
+
|
|
10
|
+
module Make = (
|
|
11
|
+
Source: Reventless.Aggregate.Spec,
|
|
12
|
+
SourceBehavior: Behavior.T with module Spec = Source,
|
|
13
|
+
Target: Reventless.Aggregate.Spec,
|
|
14
|
+
TargetBehavior: Behavior.T with module Spec = Target,
|
|
15
|
+
EventMapping: Reventless.EventMapping.T
|
|
16
|
+
with module Source = Source
|
|
17
|
+
and module Target = Target,
|
|
18
|
+
) => {
|
|
19
|
+
module AdaptedSource = Mapping_GWT.FromBehavior(Source, SourceBehavior)
|
|
20
|
+
module AdaptedTarget = Mapping_GWT.FromBehavior(Target, TargetBehavior)
|
|
21
|
+
|
|
22
|
+
module BoundMapping = {
|
|
23
|
+
module Source = AdaptedSource
|
|
24
|
+
module Target = AdaptedTarget
|
|
25
|
+
let map = EventMapping.map
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
include Mapping_GWT.Make(BoundMapping)
|
|
29
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Mapping_GWT$ReventlessGwt from "./Mapping_GWT.res.mjs";
|
|
4
|
+
|
|
5
|
+
function Make(Source) {
|
|
6
|
+
return SourceBehavior => (Target => (TargetBehavior => (EventMapping => {
|
|
7
|
+
let AdaptedSource = Mapping_GWT$ReventlessGwt.FromBehavior(Source)(SourceBehavior);
|
|
8
|
+
let AdaptedTarget = Mapping_GWT$ReventlessGwt.FromBehavior(Target)(TargetBehavior);
|
|
9
|
+
let map = EventMapping.map;
|
|
10
|
+
let BoundMapping = {
|
|
11
|
+
Source: undefined,
|
|
12
|
+
Target: undefined,
|
|
13
|
+
map: map
|
|
14
|
+
};
|
|
15
|
+
let include = Mapping_GWT$ReventlessGwt.Make({
|
|
16
|
+
Source: AdaptedSource,
|
|
17
|
+
Target: AdaptedTarget,
|
|
18
|
+
map: map
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
AdaptedSource: AdaptedSource,
|
|
22
|
+
AdaptedTarget: AdaptedTarget,
|
|
23
|
+
BoundMapping: BoundMapping,
|
|
24
|
+
Source: include.Source,
|
|
25
|
+
Target: include.Target,
|
|
26
|
+
describe: include.describe,
|
|
27
|
+
test: include.test,
|
|
28
|
+
givenSourceEvents: include.givenSourceEvents,
|
|
29
|
+
andTargetEvents: include.andTargetEvents,
|
|
30
|
+
whenSourceCmd: include.whenSourceCmd,
|
|
31
|
+
thenTargetEvents: include.thenTargetEvents,
|
|
32
|
+
thenTargetEvent: include.thenTargetEvent,
|
|
33
|
+
thenNoTargetEvent: include.thenNoTargetEvent,
|
|
34
|
+
thenSourceError: include.thenSourceError,
|
|
35
|
+
thenTargetError: include.thenTargetError,
|
|
36
|
+
thenTargetEventsWithError: include.thenTargetEventsWithError
|
|
37
|
+
};
|
|
38
|
+
})));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
Make,
|
|
43
|
+
}
|
|
44
|
+
/* Mapping_GWT-ReventlessGwt Not a pure module */
|
package/src/Filter.res
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Source-level test filters: `only`, `skip`, `xtest`, `xdescribe`.
|
|
2
|
+
//
|
|
3
|
+
// Jest ships `describe.only` / `test.only` / `xtest` as properties/aliases
|
|
4
|
+
// on the globals; reventless-gwt exposes them as explicit helpers. When the
|
|
5
|
+
// CLI runner is active, they mutate `Collector` state; when Jest is driving,
|
|
6
|
+
// they forward to the Jest globals.
|
|
7
|
+
|
|
8
|
+
@val external jestXTest: (string, unit => unit) => unit = "xtest"
|
|
9
|
+
@val external jestXDescribe: (string, unit => unit) => unit = "xdescribe"
|
|
10
|
+
|
|
11
|
+
// Mark the next registered `test` / `testPromise` as skipped.
|
|
12
|
+
let skip = () => Collector.markSkipNext()
|
|
13
|
+
|
|
14
|
+
// Mark the next registered `test` / `testPromise` as the focus of the run.
|
|
15
|
+
// If at least one entry is flagged `Only`, only those entries execute.
|
|
16
|
+
let only = () => Collector.markOnlyNext()
|
|
17
|
+
|
|
18
|
+
// xtest: register a test but mark it as skipped.
|
|
19
|
+
let xtest = (~slice as _: option<string>=?, name: string, _body: unit => Outcome.outcome) =>
|
|
20
|
+
if Collector.isActive() {
|
|
21
|
+
Collector.markSkipNext()
|
|
22
|
+
Collector.push(name, () => Promise.resolve(Outcome.pass))
|
|
23
|
+
} else {
|
|
24
|
+
jestXTest(name, () => ())
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// xdescribe: register a describe block with every nested test pre-marked
|
|
28
|
+
// skipped.
|
|
29
|
+
let xdescribe = (label: string, body: unit => unit) =>
|
|
30
|
+
if Collector.isActive() {
|
|
31
|
+
Collector.skipDepth := Collector.skipDepth.contents + 1
|
|
32
|
+
// Decrement on both the normal and the throwing path (ReScript has no
|
|
33
|
+
// `finally`): a body that raises must not leak the incremented depth and
|
|
34
|
+
// skip every following sibling/file.
|
|
35
|
+
try {
|
|
36
|
+
Collector.pushDescribe(label, body)
|
|
37
|
+
Collector.skipDepth := Collector.skipDepth.contents - 1
|
|
38
|
+
} catch {
|
|
39
|
+
| e =>
|
|
40
|
+
Collector.skipDepth := Collector.skipDepth.contents - 1
|
|
41
|
+
throw(e)
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
jestXDescribe(label, body)
|
|
45
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Outcome$ReventlessGwt from "./Outcome.res.mjs";
|
|
4
|
+
import * as Collector$ReventlessGwt from "./Collector.res.mjs";
|
|
5
|
+
|
|
6
|
+
function skip() {
|
|
7
|
+
Collector$ReventlessGwt.markSkipNext();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function only() {
|
|
11
|
+
Collector$ReventlessGwt.markOnlyNext();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function xtest(param, name, _body) {
|
|
15
|
+
if (Collector$ReventlessGwt.isActive()) {
|
|
16
|
+
Collector$ReventlessGwt.markSkipNext();
|
|
17
|
+
return Collector$ReventlessGwt.push(undefined, undefined, undefined, name, () => Promise.resolve(Outcome$ReventlessGwt.pass));
|
|
18
|
+
} else {
|
|
19
|
+
globalThis.xtest(name, () => {});
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function xdescribe(label, body) {
|
|
25
|
+
if (Collector$ReventlessGwt.isActive()) {
|
|
26
|
+
Collector$ReventlessGwt.skipDepth.contents = Collector$ReventlessGwt.skipDepth.contents + 1 | 0;
|
|
27
|
+
try {
|
|
28
|
+
Collector$ReventlessGwt.pushDescribe(label, body);
|
|
29
|
+
Collector$ReventlessGwt.skipDepth.contents = Collector$ReventlessGwt.skipDepth.contents - 1 | 0;
|
|
30
|
+
return;
|
|
31
|
+
} catch (e) {
|
|
32
|
+
Collector$ReventlessGwt.skipDepth.contents = Collector$ReventlessGwt.skipDepth.contents - 1 | 0;
|
|
33
|
+
throw e;
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
globalThis.xdescribe(label, body);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
skip,
|
|
43
|
+
only,
|
|
44
|
+
xtest,
|
|
45
|
+
xdescribe,
|
|
46
|
+
}
|
|
47
|
+
/* No side effect */
|