@systemfsoftware/stryker-js-instrumenter 7.1.0 → 8.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@systemfsoftware/stryker-js-instrumenter",
3
- "version": "7.1.0",
3
+ "version": "8.0.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/systemfsoftware/stryker-js-effect.git",
@@ -18,38 +18,34 @@
18
18
  "types": "./dist/index.d.mts",
19
19
  "default": "./dist/index.mjs"
20
20
  },
21
- "./mutants": {
22
- "types": "./dist/mutants.d.mts",
23
- "default": "./dist/mutants.mjs"
24
- },
25
21
  "./package.json": "./package.json"
26
22
  },
27
23
  "license": "Apache-2.0",
28
24
  "dependencies": {
29
- "@eslint-community/regexpp": "4.12.2",
30
- "@oxc-project/types": "^0.140.0",
31
- "@systemfsoftware/effect-cell-types": "^8",
32
- "angular-html-parser": "~10.4.0",
33
- "effect": "4.0.0-rc.112",
34
- "oxc-parser": "^0.140.0",
25
+ "@eslint-community/regexpp": "^4.12.2",
26
+ "@oxc-project/types": "^0.150.0",
27
+ "@systemfsoftware/effect-cell-types": "^8.3.2",
28
+ "angular-html-parser": "~10.12.0",
29
+ "effect": "4.0.0-rc.116",
30
+ "oxc-parser": "^0.150.0",
35
31
  "oxc-walker": "^1"
36
32
  },
37
33
  "devDependencies": {
38
34
  "@effect/tsgo": "^0.45.0",
39
35
  "@microsoft/api-extractor": "^7",
40
- "@systemfsoftware/all": "^2",
41
- "@systemfsoftware/arethetypeswrong-cli": "^4",
42
- "@systemfsoftware/effect-gherkin-spec": "^4",
43
- "@systemfsoftware/tsconfig": "^1",
36
+ "@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
37
+ "@systemfsoftware/effect-gherkin-spec": "^4.2.1",
38
+ "@systemfsoftware/oxlint-config-recommended": "^1.0.0",
39
+ "@systemfsoftware/tsconfig": "^1.3.6",
44
40
  "@types/node": "^24",
45
41
  "oxlint": "^1",
46
42
  "rimraf": "^6.1.3",
47
- "svelte": "5.55.1",
43
+ "svelte": "^5",
48
44
  "tsdown": "^0.23.0",
49
45
  "typescript": "^7",
50
- "vitest": "^4",
46
+ "vitest": "^5",
47
+ "@systemfsoftware/stryker-ignorer-interface": "^0.1.1",
51
48
  "@systemfsoftware/tsdown-config": "^0.1.0",
52
- "@systemfsoftware/stryker-ignorer-interface": "^0.1.0",
53
49
  "@systemfsoftware/vitest-config": "^0.1.0"
54
50
  },
55
51
  "engines": {
@@ -1,163 +0,0 @@
1
- import * as S from "effect/Schema";
2
- //#region src/Location.schema.d.ts
3
- declare const PositionSchema: S.Struct<{
4
- readonly line: S.Finite;
5
- readonly column: S.Finite;
6
- }>;
7
- type Position = typeof PositionSchema.Type;
8
- declare const LocationSchema: S.Struct<{
9
- readonly start: S.Struct<{
10
- readonly line: S.Finite;
11
- readonly column: S.Finite;
12
- }>;
13
- readonly end: S.Struct<{
14
- readonly line: S.Finite;
15
- readonly column: S.Finite;
16
- }>;
17
- }>;
18
- type Location = typeof LocationSchema.Type;
19
- declare const OpenEndLocationSchema: S.Struct<{
20
- readonly start: S.Struct<{
21
- readonly line: S.Finite;
22
- readonly column: S.Finite;
23
- }>;
24
- readonly end: S.optional<S.Struct<{
25
- readonly line: S.Finite;
26
- readonly column: S.Finite;
27
- }>>;
28
- }>;
29
- type OpenEndLocation = typeof OpenEndLocationSchema.Type;
30
- //#endregion
31
- //#region src/Mutant.schema.d.ts
32
- declare const MutantStatusSchema: S.Literals<readonly ["Killed", "Survived", "NoCoverage", "CompileError", "RuntimeError", "Timeout", "Ignored", "Pending"]>;
33
- type MutantStatus = typeof MutantStatusSchema.Type;
34
- declare const Mutant_base: S.Class<Mutant, S.TaggedStruct<"Mutant", {
35
- readonly id: S.NonEmptyString;
36
- readonly fileName: S.NonEmptyString;
37
- readonly mutatorName: S.NonEmptyString;
38
- readonly replacement: S.String;
39
- readonly location: S.Struct<{
40
- readonly start: S.Struct<{
41
- readonly line: S.Finite;
42
- readonly column: S.Finite;
43
- }>;
44
- readonly end: S.Struct<{
45
- readonly line: S.Finite;
46
- readonly column: S.Finite;
47
- }>;
48
- }>;
49
- readonly status: S.optional<S.Literals<readonly ["Killed", "Survived", "NoCoverage", "CompileError", "RuntimeError", "Timeout", "Ignored", "Pending"]>>;
50
- readonly statusReason: S.optional<S.String>;
51
- readonly coveredBy: S.optional<S.$Array<S.String>>;
52
- readonly static: S.optional<S.Boolean>;
53
- readonly testsCompleted: S.optional<S.Finite>;
54
- readonly description: S.optional<S.String>;
55
- }>, {}>;
56
- declare class Mutant extends Mutant_base {}
57
- declare const RunOptionsFields: {
58
- timeout: S.Finite;
59
- disableBail: S.Boolean;
60
- };
61
- declare const MutantActivationSchema: S.Literals<readonly ["runtime", "static"]>;
62
- type MutantActivation = typeof MutantActivationSchema.Type;
63
- declare const MutantRunOptionsSchema: S.Struct<{
64
- readonly timeout: S.Finite;
65
- readonly disableBail: S.Boolean;
66
- readonly activeMutant: typeof Mutant;
67
- readonly sandboxFileName: S.String;
68
- readonly mutantActivation: S.Literals<readonly ["runtime", "static"]>;
69
- readonly reloadEnvironment: S.Boolean;
70
- readonly testFilter: S.optionalKey<S.$Array<S.String>>;
71
- readonly hitLimit: S.optionalKey<S.Finite>;
72
- }>;
73
- //#endregion
74
- //#region src/Mutant.d.ts
75
- interface MutantCoverage {
76
- readonly perTest: Record<string, Record<string, number>>;
77
- readonly static: Record<string, number>;
78
- }
79
- type CoverageData = Record<string, number>;
80
- type CoveragePerTestId = Record<string, CoverageData>;
81
- interface Coverage {
82
- readonly static: CoverageData;
83
- readonly perTest: CoveragePerTestId;
84
- }
85
- interface RunOptions {
86
- readonly timeout: number;
87
- readonly disableBail: boolean;
88
- }
89
- interface MutantRunOptions extends RunOptions {
90
- readonly testFilter?: readonly string[];
91
- readonly hitLimit?: number;
92
- readonly activeMutant: Mutant;
93
- readonly sandboxFileName: string;
94
- readonly mutantActivation: MutantActivation;
95
- readonly reloadEnvironment: boolean;
96
- }
97
- interface EarlyResultPlan {
98
- readonly plan: 'EarlyResult';
99
- readonly mutant: Mutant;
100
- }
101
- interface RunPlan {
102
- readonly plan: 'Run';
103
- readonly mutant: Mutant;
104
- readonly runOptions: MutantRunOptions;
105
- readonly netTime: number;
106
- }
107
- type TestPlan = EarlyResultPlan | RunPlan;
108
- declare const isMutant: (value: unknown) => value is Mutant;
109
- type MutantTestCoverage = Mutant & {
110
- readonly coveredBy: ReadonlyArray<string> | undefined;
111
- readonly static: boolean | undefined;
112
- };
113
- type RunMutantResult = Mutant & {
114
- readonly status: MutantStatus;
115
- readonly statusReason?: string | undefined;
116
- readonly testsCompleted?: number | undefined;
117
- readonly killedBy?: readonly string[] | undefined;
118
- readonly coveredBy?: readonly string[] | undefined;
119
- readonly static?: boolean | undefined;
120
- };
121
- declare const INSTRUMENTER_CONSTANTS: Readonly<{
122
- NAMESPACE: '__stryker__';
123
- MUTATION_COVERAGE_OBJECT: 'mutantCoverage';
124
- ACTIVE_MUTANT: 'activeMutant';
125
- CURRENT_TEST_ID: 'currentTestId';
126
- HIT_COUNT: 'hitCount';
127
- HIT_LIMIT: 'hitLimit';
128
- ACTIVE_MUTANT_ENV_VARIABLE: '__STRYKER_ACTIVE_MUTANT__';
129
- }>;
130
- interface InstrumenterContext {
131
- activeMutant?: string;
132
- currentTestId?: string;
133
- mutantCoverage?: MutantCoverage;
134
- hitCount?: number;
135
- hitLimit?: number;
136
- }
137
- declare function normalizeFileName(fileName: string): string;
138
- interface ErrnoException extends Error {
139
- code?: string;
140
- errno?: number;
141
- path?: string;
142
- syscall?: string;
143
- }
144
- declare function isErrnoException(error: unknown): error is ErrnoException;
145
- declare function errorToString(error: unknown): string;
146
- declare const ERROR_CODES: Readonly<{
147
- NoSuchFileOrDirectory: 'ENOENT';
148
- }>;
149
- interface MutationRange {
150
- readonly start: Position;
151
- readonly end: Position;
152
- }
153
- type MutateDescription = ReadonlyArray<MutationRange> | boolean;
154
- interface FileDescription {
155
- readonly mutate: MutateDescription;
156
- }
157
- type FileDescriptions = Record<string, FileDescription>;
158
- type MutantRunPlan = RunPlan;
159
- type MutantEarlyResultPlan = EarlyResultPlan;
160
- type MutantTestPlan = TestPlan;
161
- declare const causeText: (cause: unknown, depth: number) => string | undefined;
162
- //#endregion
163
- export { MutantActivationSchema as A, PositionSchema as B, causeText as C, normalizeFileName as D, isMutant as E, Location as F, LocationSchema as I, OpenEndLocation as L, MutantStatus as M, MutantStatusSchema as N, Mutant as O, RunOptionsFields as P, OpenEndLocationSchema as R, TestPlan as S, isErrnoException as T, MutateDescription as _, EarlyResultPlan as a, RunOptions as b, FileDescriptions as c, MutantCoverage as d, MutantEarlyResultPlan as f, MutantTestPlan as g, MutantTestCoverage as h, ERROR_CODES as i, MutantRunOptionsSchema as j, MutantActivation as k, INSTRUMENTER_CONSTANTS as l, MutantRunPlan as m, CoverageData as n, ErrnoException as o, MutantRunOptions as p, CoveragePerTestId as r, FileDescription as s, Coverage as t, InstrumenterContext as u, MutationRange as v, errorToString as w, RunPlan as x, RunMutantResult as y, Position as z };
@@ -1,128 +0,0 @@
1
- import * as Predicate from "effect/Predicate";
2
- import * as S from "effect/Schema";
3
- import * as Match from "effect/Match";
4
- import * as Option from "effect/Option";
5
- //#region src/Location.schema.ts
6
- const PositionSchema = S.Struct({
7
- line: S.Finite,
8
- column: S.Finite
9
- });
10
- const LocationSchema = S.Struct({
11
- start: PositionSchema,
12
- end: PositionSchema
13
- });
14
- const OpenEndLocationSchema = S.Struct({
15
- start: PositionSchema,
16
- end: S.optional(PositionSchema)
17
- });
18
- //#endregion
19
- //#region src/Mutant.schema.ts
20
- const MutantStatusSchema = S.Literals([
21
- "Killed",
22
- "Survived",
23
- "NoCoverage",
24
- "CompileError",
25
- "RuntimeError",
26
- "Timeout",
27
- "Ignored",
28
- "Pending"
29
- ]);
30
- var Mutant = class extends S.TaggedClass()("Mutant", {
31
- id: S.NonEmptyString,
32
- fileName: S.NonEmptyString,
33
- mutatorName: S.NonEmptyString,
34
- replacement: S.String,
35
- location: LocationSchema,
36
- status: S.optional(MutantStatusSchema),
37
- statusReason: S.optional(S.String),
38
- coveredBy: S.optional(S.Array(S.String)),
39
- static: S.optional(S.Boolean),
40
- testsCompleted: S.optional(S.Finite),
41
- description: S.optional(S.String)
42
- }) {};
43
- const RunOptionsFields = {
44
- timeout: S.Finite,
45
- disableBail: S.Boolean
46
- };
47
- const MutantActivationSchema = S.Literals(["runtime", "static"]);
48
- const MutantRunOptionsSchema = S.Struct({
49
- ...RunOptionsFields,
50
- activeMutant: Mutant,
51
- sandboxFileName: S.String,
52
- mutantActivation: MutantActivationSchema,
53
- reloadEnvironment: S.Boolean,
54
- testFilter: S.optionalKey(S.Array(S.String)),
55
- hitLimit: S.optionalKey(S.Finite)
56
- });
57
- //#endregion
58
- //#region src/Mutant.ts
59
- const isMutant = (value) => S.is(Mutant)(value);
60
- const INSTRUMENTER_CONSTANTS = Object.freeze({
61
- NAMESPACE: "__stryker__",
62
- MUTATION_COVERAGE_OBJECT: "mutantCoverage",
63
- ACTIVE_MUTANT: "activeMutant",
64
- CURRENT_TEST_ID: "currentTestId",
65
- HIT_COUNT: "hitCount",
66
- HIT_LIMIT: "hitLimit",
67
- ACTIVE_MUTANT_ENV_VARIABLE: "__STRYKER_ACTIVE_MUTANT__"
68
- });
69
- function normalizeFileName(fileName) {
70
- return fileName.replace(/\\/g, "/");
71
- }
72
- const hasText = (value) => Predicate.isString(value) && value.length > 0;
73
- const textIfNonEmpty = (value) => Option.getOrUndefined(Option.filter(Option.fromUndefinedOr(value), hasText));
74
- const fieldOf = (value, key) => Match.value(key in value).pipe(Match.when(true, () => {
75
- return Reflect.get(value, key);
76
- }), Match.orElse(() => void 0));
77
- const hasStringCode = (error) => Match.value(fieldOf(error, "code")).pipe(Match.when(Match.string, () => true), Match.orElse(() => false));
78
- function isErrnoException(error) {
79
- return Match.value(error).pipe(Match.when(Match.instanceOf(Error), hasStringCode), Match.orElse(() => false));
80
- }
81
- const isEmptyNumber = (value) => Match.value(value).pipe(Match.when(0, () => true), Match.orElse(Number.isNaN));
82
- const isEmptyError = (error) => Match.value(error).pipe(Match.when(Match.undefined, () => true), Match.when(Match.null, () => true), Match.when(Match.string, (text) => text.length === 0), Match.when(Match.number, isEmptyNumber), Match.when(Match.boolean, (value) => !value), Match.orElse(() => false));
83
- const formatErrnoException = (error) => Match.value(error.stack).pipe(Match.when(hasText, (stack) => `${error.name}: ${error.code} (${error.syscall}) ${stack}`), Match.orElse(() => `${error.name}: ${error.code} (${error.syscall})`));
84
- const formatError = (error) => Match.value(error.stack).pipe(Match.when(hasText, (stack) => `${error.name}: ${error.message}\n${stack}`), Match.orElse(() => `${error.name}: ${error.message}`));
85
- const isJsonPrimitive = (value) => Match.value(value).pipe(Match.when(Match.number, () => true), Match.when(Match.boolean, () => true), Match.when(Match.bigint, () => true), Match.orElse(() => false));
86
- const jsonText = (error) => {
87
- try {
88
- return textIfNonEmpty(JSON.stringify(error));
89
- } catch {
90
- return;
91
- }
92
- };
93
- const isNonPlaceholderText = (text) => Match.value({
94
- hasLength: text.length > 0,
95
- isPlaceholder: text === "[object Object]"
96
- }).pipe(Match.when({
97
- hasLength: true,
98
- isPlaceholder: false
99
- }, () => true), Match.orElse(() => false));
100
- const isUsableText = (value) => Match.value(value).pipe(Match.when(Match.string, isNonPlaceholderText), Match.orElse(() => false));
101
- const usableText = (value) => Match.value(value).pipe(Match.when(isUsableText, (text) => text), Match.orElse(() => ""));
102
- const objectToStringText = (value) => Match.value(fieldOf(value, "toString")).pipe(Match.when(Match.instanceOf(Function), (callable) => {
103
- try {
104
- return usableText(Reflect.apply(callable, value, []));
105
- } catch {
106
- return "";
107
- }
108
- }), Match.orElse(() => ""));
109
- const isObjectType = (cause) => typeof cause === "object";
110
- const toStringText = (error) => Match.value(error).pipe(Match.when(Match.null, () => ""), Match.when(isObjectType, (value) => objectToStringText(value)), Match.orElse(() => ""));
111
- const stringifyRest = (error) => Match.value(jsonText(error)).pipe(Match.when(hasText, (json) => json), Match.orElse(() => toStringText(error)));
112
- const stringifyNonError = (error) => Match.value(error).pipe(Match.when(Match.string, (text) => text), Match.when(isJsonPrimitive, (primitive) => JSON.stringify(primitive)), Match.orElse(() => stringifyRest(error)));
113
- const errorText = (error) => Match.value(error).pipe(Match.when(isErrnoException, formatErrnoException), Match.orElse(() => formatError(error)));
114
- function errorToString(error) {
115
- return Match.value(error).pipe(Match.when(isEmptyError, () => ""), Match.when(Match.instanceOf(Error), errorText), Match.orElse(() => stringifyNonError(error)));
116
- }
117
- const ERROR_CODES = Object.freeze({ NoSuchFileOrDirectory: "ENOENT" });
118
- const errorNameOf = (value) => Match.value(value).pipe(Match.when(Match.instanceOf(Error), (error) => textIfNonEmpty(error.name)), Match.orElse(() => void 0));
119
- const tagOf = (value) => Match.value(textIfNonEmpty(fieldOf(value, "_tag"))).pipe(Match.when(hasText, (tag) => tag), Match.orElse(() => errorNameOf(value)));
120
- const textWithNested = (own, nested) => Match.value(own).pipe(Match.when(hasText, (text) => appendNested(text, nested)), Match.orElse(() => nested));
121
- const appendNested = (own, nested) => Match.value(nested).pipe(Match.when(hasText, (text) => `${own}: ${text}`), Match.orElse(() => own));
122
- const errorMessage = (error) => Match.value(error.message.length > 0).pipe(Match.when(true, () => error.message), Match.orElse(() => tagOf(error)));
123
- const errorMessageOrTag = (value) => Match.value(value).pipe(Match.when(Match.instanceOf(Error), errorMessage), Match.orElse(() => tagOf(value)));
124
- const messageText = (value) => Match.value(textIfNonEmpty(fieldOf(value, "message"))).pipe(Match.when(hasText, (message) => message), Match.orElse(() => errorMessageOrTag(value)));
125
- const ownCauseText = (value) => Match.value(textIfNonEmpty(fieldOf(value, "reason"))).pipe(Match.when(hasText, (reason) => reason), Match.orElse(() => messageText(value)));
126
- const causeText = (cause, depth) => Match.value(cause).pipe(Match.when(() => depth > 4, () => void 0), Match.when(Match.undefined, () => void 0), Match.when(Match.null, () => void 0), Match.when(Match.string, textIfNonEmpty), Match.when(isObjectType, (value) => textWithNested(ownCauseText(value), causeText(fieldOf(value, "cause"), depth + 1))), Match.orElse(() => void 0));
127
- //#endregion
128
- export { isErrnoException as a, Mutant as c, MutantStatusSchema as d, RunOptionsFields as f, PositionSchema as h, errorToString as i, MutantActivationSchema as l, OpenEndLocationSchema as m, INSTRUMENTER_CONSTANTS as n, isMutant as o, LocationSchema as p, causeText as r, normalizeFileName as s, ERROR_CODES as t, MutantRunOptionsSchema as u };
@@ -1,2 +0,0 @@
1
- import { A as MutantActivationSchema, B as PositionSchema, C as causeText, D as normalizeFileName, E as isMutant, F as Location, I as LocationSchema, L as OpenEndLocation, M as MutantStatus, N as MutantStatusSchema, O as Mutant, P as RunOptionsFields, R as OpenEndLocationSchema, S as TestPlan, T as isErrnoException, _ as MutateDescription, a as EarlyResultPlan, b as RunOptions, c as FileDescriptions, d as MutantCoverage, f as MutantEarlyResultPlan, g as MutantTestPlan, h as MutantTestCoverage, i as ERROR_CODES, j as MutantRunOptionsSchema, k as MutantActivation, l as INSTRUMENTER_CONSTANTS, m as MutantRunPlan, n as CoverageData, o as ErrnoException, p as MutantRunOptions, r as CoveragePerTestId, s as FileDescription, t as Coverage, u as InstrumenterContext, v as MutationRange, w as errorToString, x as RunPlan, y as RunMutantResult, z as Position } from "./Mutant-BYxuyyRL.mjs";
2
- export { type Coverage, type CoverageData, type CoveragePerTestId, ERROR_CODES, type EarlyResultPlan, type ErrnoException, type FileDescription, type FileDescriptions, INSTRUMENTER_CONSTANTS, type InstrumenterContext, type Location, LocationSchema, Mutant, type MutantActivation, MutantActivationSchema, type MutantCoverage, type MutantEarlyResultPlan, type MutantRunOptions, MutantRunOptionsSchema, type MutantRunPlan, type MutantStatus, MutantStatusSchema, type MutantTestCoverage, type MutantTestPlan, type MutateDescription, type MutationRange, type OpenEndLocation, OpenEndLocationSchema, type Position, PositionSchema, type RunMutantResult, type RunOptions, RunOptionsFields, type RunPlan, type TestPlan, causeText, errorToString, isErrnoException, isMutant, normalizeFileName };
package/dist/mutants.mjs DELETED
@@ -1,2 +0,0 @@
1
- import { a as isErrnoException, c as Mutant, d as MutantStatusSchema, f as RunOptionsFields, h as PositionSchema, i as errorToString, l as MutantActivationSchema, m as OpenEndLocationSchema, n as INSTRUMENTER_CONSTANTS, o as isMutant, p as LocationSchema, r as causeText, s as normalizeFileName, t as ERROR_CODES, u as MutantRunOptionsSchema } from "./Mutant-DnhV_fpo.mjs";
2
- export { ERROR_CODES, INSTRUMENTER_CONSTANTS, LocationSchema, Mutant, MutantActivationSchema, MutantRunOptionsSchema, MutantStatusSchema, OpenEndLocationSchema, PositionSchema, RunOptionsFields, causeText, errorToString, isErrnoException, isMutant, normalizeFileName };