@systemfsoftware/stryker-js 13.1.0 → 15.0.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.
@@ -1,63 +0,0 @@
1
- import "./dist-CQ7r4AaH.mjs";
2
- import * as Match from "effect/Match";
3
- import * as Option from "effect/Option";
4
- import * as Predicate from "effect/Predicate";
5
- import { dual } from "effect/Function";
6
- import * as Record from "effect/Record";
7
- //#region src/config/merge-config.ts
8
- /**
9
- * Whether an entry takes part in a merge: a key literally named `__proto__` never does — the
10
- * merged record must not gain a document-decided prototype — and an explicitly `undefined`
11
- * value states that the author left the key unset, not that they want it set to nothing.
12
- */
13
- const usable = (value, key) => key !== "__proto__" && value !== void 0;
14
- const usableEntries = (source) => Record.filter(source, usable);
15
- const isConfigRecord = (value) => Predicate.isObject(value);
16
- const asConfigRecord = (value) => Option.filter(Option.fromUndefinedOr(value), isConfigRecord);
17
- const mergeNested = (base, override) => Option.match(asConfigRecord(override), {
18
- onNone: () => override,
19
- onSome: (overrideRecord) => mergeRecords(base, overrideRecord)
20
- });
21
- const hasUsableMember = (key) => (merged) => merged.hasOwnProperty(key) && merged[key] !== void 0;
22
- const ownValueOf = (merged, key) => Option.map(Option.liftPredicate(merged, hasUsableMember(key)), (present) => present[key]);
23
- const baseRecordOf = (ownValue) => Option.filter(Option.flatMap(ownValue, Option.fromUndefinedOr), isConfigRecord);
24
- const mergeKeyInto = (merged, override, key) => ({
25
- ...merged,
26
- [key]: Option.match(baseRecordOf(ownValueOf(merged, key)), {
27
- onNone: () => override,
28
- onSome: (baseRecord) => mergeNested(baseRecord, override)
29
- })
30
- });
31
- const mergeRecords = (base, overrides) => Record.reduce(usableEntries(overrides), usableEntries(base), mergeKeyInto);
32
- const mergeConfig = dual(2, (defaults, overrides) => mergeRecords(defaults, overrides));
33
- const isNonNullObject = (value) => typeof value === "object" && value !== null;
34
- const asUnknownArray = (value) => Array.isArray(value) ? value : [];
35
- const isFirstDescriptorOccurrence = (descriptors) => (descriptor, index) => typeof descriptor !== "string" || descriptors.slice(0, index).includes(descriptor) === false;
36
- const mergePluginDescriptors = (parentPlugins, childPlugins) => {
37
- const merged = [...parentPlugins, ...childPlugins];
38
- return merged.filter(isFirstDescriptorOccurrence(merged));
39
- };
40
- const isConfigOptionsRecord = (value) => isNonNullObject(value) && Array.isArray(value) === false;
41
- const mergeConfigRecords = (parentNested, childNested) => ({
42
- ...parentNested,
43
- ...childNested
44
- });
45
- const toConfigRecordOption = (value) => isConfigOptionsRecord(value) ? Option.some(value) : Option.none();
46
- const inheritNested = (parentValue, childValue) => Option.match(Option.all([toConfigRecordOption(parentValue), toConfigRecordOption(childValue)]), {
47
- onSome: ([parentNested, childNested]) => mergeConfigRecords(parentNested, childNested),
48
- onNone: () => childValue
49
- });
50
- const inheritEntry = (out, key, parentValue, childValue) => Match.value(childValue).pipe(Match.when(null, () => {
51
- const next = { ...out };
52
- delete next[key];
53
- return next;
54
- }), Match.orElse(() => Match.value(key).pipe(Match.when("plugins", () => ({
55
- ...out,
56
- [key]: mergePluginDescriptors(asUnknownArray(parentValue), asUnknownArray(childValue))
57
- })), Match.orElse(() => ({
58
- ...out,
59
- [key]: inheritNested(parentValue, childValue)
60
- })))));
61
- const mergeConfigs = dual(2, (parent, child) => Object.entries(child).reduce((out, entry) => inheritEntry(out, entry[0], parent[entry[0]], entry[1]), { ...parent }));
62
- //#endregion
63
- export { mergeConfigs as n, mergeConfig as t };