@systemfsoftware/stryker-js 12.1.1 → 13.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.
@@ -1,4 +1,4 @@
1
- import { n as mod_d_exports$2 } from "./index-B8dqrKV1.mjs";
1
+ import { n as mod_d_exports$2 } from "./index-Ptvmn934.mjs";
2
2
  import * as S from "effect/Schema";
3
3
  //#region src/config/stryker-config.schema.d.ts
4
4
  type StrykerConfig = mod_d_exports$2.PartialStrykerOptions;
@@ -15,4 +15,11 @@ type ConfigEnv = typeof ConfigEnvSchema.Type;
15
15
  type StrykerConfigFn = (env: ConfigEnv) => StrykerConfig | Promise<StrykerConfig>;
16
16
  type StrykerConfigExport = StrykerConfig | Promise<StrykerConfig> | StrykerConfigFn;
17
17
  //#endregion
18
- export { StrykerConfig as a, Primitive as i, Immutable as n, StrykerConfigExport as o, ImmutablePrimitive as r, StrykerConfigFn as s, ConfigEnv as t };
18
+ //#region src/config/merge-config.d.ts
19
+ declare const mergeConfig: {
20
+ (overrides: StrykerConfig): (defaults: StrykerConfig) => StrykerConfig;
21
+ (defaults: StrykerConfig, overrides: StrykerConfig): StrykerConfig;
22
+ };
23
+ declare const mergeConfigs: ((child: mod_d_exports$2.PartialStrykerOptions) => (parent: mod_d_exports$2.PartialStrykerOptions) => mod_d_exports$2.PartialStrykerOptions) & ((parent: mod_d_exports$2.PartialStrykerOptions, child: mod_d_exports$2.PartialStrykerOptions) => mod_d_exports$2.PartialStrykerOptions);
24
+ //#endregion
25
+ export { ImmutablePrimitive as a, StrykerConfigExport as c, Immutable as i, StrykerConfigFn as l, mergeConfigs as n, Primitive as o, ConfigEnv as r, StrykerConfig as s, mergeConfig as t };
@@ -0,0 +1,63 @@
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 };
@@ -1,5 +1,5 @@
1
- import { n as mod_d_exports$2 } from "./index-B8dqrKV1.mjs";
2
- import { s as MutationTestDone } from "./RunEnvironment.service-6aDpmGcD.mjs";
3
- //#region src/promises/mod.d.ts
1
+ import { n as mod_d_exports$2 } from "./index-Ptvmn934.mjs";
2
+ import { l as MutationTestDone } from "./RunEnvironment.service-rkMZ8nm1.mjs";
3
+ //#region src/drivers/promise.d.ts
4
4
  export declare const run: ((targetMutatePatterns?: readonly string[]) => (options: mod_d_exports$2.PartialStrykerOptions) => Promise<MutationTestDone>) & ((options: mod_d_exports$2.PartialStrykerOptions, targetMutatePatterns?: readonly string[]) => Promise<MutationTestDone>);
5
5
  //#endregion
package/dist/promises.mjs CHANGED
@@ -1,10 +1,7 @@
1
- import { m as nodePlatformLayer, n as strykerCell } from "./run-stages.cell-CtFLJCm0.mjs";
1
+ import { h as nodePlatformLayer, n as strykerCell } from "./run-stages.cell-rdoY0cVH.mjs";
2
+ import * as Effect from "effect/Effect";
2
3
  import { dual } from "effect/Function";
3
- import * as ManagedRuntime from "effect/ManagedRuntime";
4
- //#region src/promises/mod.ts
5
- const run = dual((args) => args.length === 2 || Array.isArray(args[0]) === false, (options, targetMutatePatterns) => {
6
- const runtime = ManagedRuntime.make(nodePlatformLayer);
7
- return runtime.runPromise(strykerCell(options, targetMutatePatterns)).then((done) => runtime.dispose().then(() => done), (cause) => runtime.dispose().then(() => Promise.reject(cause)));
8
- });
4
+ //#region src/drivers/promise.ts
5
+ const run = dual((args) => args.length === 2 || Array.isArray(args[0]) === false, (options, targetMutatePatterns) => Effect.runPromise(strykerCell(options, targetMutatePatterns).pipe(Effect.provide(nodePlatformLayer))));
9
6
  //#endregion
10
7
  export { run };