@systemfsoftware/stryker-js 11.0.0 → 12.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,82 +0,0 @@
1
- import { n as Options_exports } from "./dist-ClUhPgb6.mjs";
2
- import * as Match from "effect/Match";
3
- import * as Option from "effect/Option";
4
- import * as Predicate from "effect/Predicate";
5
- import * as S from "effect/Schema";
6
- import * as Effect from "effect/Effect";
7
- import { dual } from "effect/Function";
8
- import * as Record from "effect/Record";
9
- //#region src/config/stryker-config.schema.ts
10
- /**
11
- * Whether an entry takes part in a merge: a key literally named `__proto__` never does — the
12
- * merged record must not gain a document-decided prototype — and an explicitly `undefined`
13
- * value states that the author left the key unset, not that they want it set to nothing.
14
- */
15
- const usable = (value, key) => key !== "__proto__" && value !== void 0;
16
- const usableEntries = (source) => Record.filter(source, usable);
17
- const isConfigRecord = (value) => Predicate.isObject(value);
18
- const asConfigRecord = (value) => Option.filter(Option.fromUndefinedOr(value), isConfigRecord);
19
- const mergeNested = (base, override) => Option.match(asConfigRecord(override), {
20
- onNone: () => override,
21
- onSome: (overrideRecord) => mergeRecords(base, overrideRecord)
22
- });
23
- const hasUsableMember = (key) => (merged) => merged.hasOwnProperty(key) && merged[key] !== void 0;
24
- const ownValueOf = (merged, key) => Option.map(Option.liftPredicate(merged, hasUsableMember(key)), (present) => present[key]);
25
- const baseRecordOf = (ownValue) => Option.filter(Option.flatMap(ownValue, Option.fromUndefinedOr), isConfigRecord);
26
- const mergeKeyInto = (merged, override, key) => ({
27
- ...merged,
28
- [key]: Option.match(baseRecordOf(ownValueOf(merged, key)), {
29
- onNone: () => override,
30
- onSome: (baseRecord) => mergeNested(baseRecord, override)
31
- })
32
- });
33
- const mergeRecords = (base, overrides) => Record.reduce(usableEntries(overrides), usableEntries(base), mergeKeyInto);
34
- S.Struct({
35
- command: S.Literals(["run", "merge-reports"]),
36
- isDryRun: S.Boolean,
37
- mode: S.Literals(["human", "machine"]),
38
- isCi: S.Boolean
39
- });
40
- const isNonNullObject = (value) => typeof value === "object" && value !== null;
41
- const isRecordValue = (value) => isNonNullObject(value) && Array.isArray(value) === false;
42
- const isArrayValue = (value) => Array.isArray(value);
43
- const freezeArrayValue = (value) => Object.freeze(value.map((element) => deepFreeze(element)));
44
- const freezeMapEntry = ([entryKey, entryValue]) => [deepFreeze(entryKey), deepFreeze(entryValue)];
45
- const freezeMapValue = (value) => Object.freeze(new Map([...value.entries()].map(freezeMapEntry)));
46
- const freezeSetValue = (value) => Object.freeze(new Set([...value.values()].map((element) => deepFreeze(element))));
47
- const freezeRegExpValue = (value) => Object.freeze(value);
48
- const freezeRecordValue = (value) => Object.freeze(Record.map(value, (propertyValue) => deepFreeze(propertyValue)));
49
- function deepFreeze(target) {
50
- return Match.value(target).pipe(Match.when(isArrayValue, freezeArrayValue), Match.when((value) => value instanceof Map, freezeMapValue), Match.when((value) => value instanceof RegExp, freezeRegExpValue), Match.when((value) => value instanceof Set, freezeSetValue), Match.when(isRecordValue, freezeRecordValue), Match.orElse(() => target));
51
- }
52
- const configFileNames = (extensions) => extensions.map((extension) => `stryker.config${extension}`);
53
- const CONFIG_FILE_NAMES = Object.freeze(configFileNames([
54
- ".ts",
55
- ".mts",
56
- ".js",
57
- ".mjs"
58
- ]));
59
- const CONFIG_SYNTAX_HELP = `
60
- Example of how a config file should look:
61
- /**
62
- * @type {import('@systemfsoftware/stryker-js-plugin-interface').StrykerOptions}
63
- */
64
- export default {
65
- mutate: ['src/**/*.js'],
66
- testRunner: 'vitest',
67
- reporters: ['progress', 'clear-text', 'html'],
68
- concurrency: 4
69
- };
70
- See https://stryker-mutator.io/docs/stryker-js/config-file for more information.`.trim();
71
- var StrykerConfig = class StrykerConfig extends S.Class("StrykerConfig")({ entries: S.Record(S.String, S.Unknown) }) {
72
- static define(config) {
73
- return config;
74
- }
75
- static merge = dual(2, (defaults, overrides) => mergeRecords(defaults, overrides));
76
- static createDefaultOptions = S.decodeEffect(Options_exports.StrykerOptionsSchema)({}).pipe(Effect.orDie);
77
- static defaultOptions = Effect.map(StrykerConfig.createDefaultOptions, (options) => deepFreeze(options));
78
- static supportedFileNames = CONFIG_FILE_NAMES;
79
- static syntaxHelp = CONFIG_SYNTAX_HELP;
80
- };
81
- //#endregion
82
- export { StrykerConfig as t };
@@ -1,35 +0,0 @@
1
- import { n as mod_d_exports$2 } from "./index-CMCCQdTd.mjs";
2
- import * as S from "effect/Schema";
3
- import * as Effect from "effect/Effect";
4
- //#region src/config/stryker-config.schema.d.ts
5
- type Primitive = boolean | number | string | null | undefined;
6
- type ImmutablePrimitive = Primitive | ((...args: never[]) => void);
7
- type Immutable<T> = T extends ImmutablePrimitive ? T : T extends Array<infer U> ? ReadonlyArray<Immutable<U>> : T extends Map<infer K, infer V> ? ReadonlyMap<Immutable<K>, Immutable<V>> : T extends Set<infer M> ? ReadonlySet<Immutable<M>> : T extends RegExp ? Readonly<RegExp> : { readonly [K in keyof T]: Immutable<T[K]>; };
8
- declare const ConfigEnvSchema: S.Struct<{
9
- readonly command: S.Literals<readonly ["run", "merge-reports"]>;
10
- readonly isDryRun: S.Boolean;
11
- readonly mode: S.Literals<readonly ["human", "machine"]>;
12
- readonly isCi: S.Boolean;
13
- }>;
14
- type ConfigEnv = typeof ConfigEnvSchema.Type;
15
- type StrykerConfigFn = (env: ConfigEnv) => mod_d_exports$2.PartialStrykerOptions | Promise<mod_d_exports$2.PartialStrykerOptions>;
16
- type StrykerConfigExport = mod_d_exports$2.PartialStrykerOptions | Promise<mod_d_exports$2.PartialStrykerOptions> | StrykerConfigFn;
17
- declare const StrykerConfig_base: S.Class<StrykerConfig, S.Struct<{
18
- readonly entries: S.$Record<S.String, S.Unknown>;
19
- }>, {}>;
20
- declare class StrykerConfig extends StrykerConfig_base {
21
- static define(config: mod_d_exports$2.PartialStrykerOptions): mod_d_exports$2.PartialStrykerOptions;
22
- static define(config: Promise<mod_d_exports$2.PartialStrykerOptions>): Promise<mod_d_exports$2.PartialStrykerOptions>;
23
- static define(config: StrykerConfigFn): StrykerConfigFn;
24
- static define(config: StrykerConfigExport): StrykerConfigExport;
25
- static readonly merge: {
26
- (overrides: mod_d_exports$2.PartialStrykerOptions): (defaults: mod_d_exports$2.PartialStrykerOptions) => mod_d_exports$2.PartialStrykerOptions;
27
- (defaults: mod_d_exports$2.PartialStrykerOptions, overrides: mod_d_exports$2.PartialStrykerOptions): mod_d_exports$2.PartialStrykerOptions;
28
- };
29
- static readonly createDefaultOptions: Effect.Effect<mod_d_exports$2.StrykerOptions>;
30
- static readonly defaultOptions: Effect.Effect<Immutable<mod_d_exports$2.StrykerOptions>, never, never>;
31
- static readonly supportedFileNames: readonly string[];
32
- static readonly syntaxHelp: string;
33
- }
34
- //#endregion
35
- export { StrykerConfig as a, Primitive as i, Immutable as n, StrykerConfigExport as o, ImmutablePrimitive as r, StrykerConfigFn as s, ConfigEnv as t };