@systemfsoftware/stryker-js-plugin-interface 4.0.0 → 5.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # @systemfsoftware/stryker-js-plugin-interface
2
+
3
+ ## 5.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - The plugin system now runs each configured TestRunner/Checker/Reporter plugin in its own spawned process over an @effect/rpc wire: plugins load from the project's config-declared specifiers (no glob discovery), boundary failures are typed errors, and plugin spans link into the host trace. Breaking: the in-process plugin Layer contract is removed.
8
+
9
+ - `@systemfsoftware/stryker-js` is renamed to `@systemfsoftware/stryker-js-language`, and the plugin boundary now ships as the two packages `@systemfsoftware/stryker-js-plugin-interface` and `@systemfsoftware/stryker-js-plugin-runtime`.
10
+
11
+ `@systemfsoftware/stryker-js-plugin-interface` owns the contract both sides of the process split agree on: the per-kind `@effect/rpc` groups (`TestRunnerRpcs`, `CheckerRpcs`, `ReporterRpcs`), the boundary payload schemas, the typed boundary errors (`BoundaryPayloadRejected`, `BoundaryUnrecognizedSignal`), the spawn contract (`WorkerPluginKind`, `WorkerPluginSpawnSchema`, `WorkerEntryUrl`), and the trace-context contract (`TraceContextMiddleware`, `PropagatedTrace`, `TracedRpc`, `formatTraceparent`, `parseTraceparent`, `TraceContextReference`, `TRACEPARENT_HEADER`, `TRACESTATE_HEADER`).
12
+
13
+ `@systemfsoftware/stryker-js-plugin-runtime` owns what a plugin process actually runs: the worker server layer a plugin's `main.ts` launches (`workerServerLayer`, `nodeModuleLayer`), the worker and host OTel bootstraps (`startWorkerTelemetry`, `startHostTelemetry`), the worker-options wire codec (`encodeWorkerOptions`, `decodeWorkerOptions`, `readWorkerOptionsFromEnv`), and the trace-context middleware implementations (`layerTraceContextClient`, `layerTraceContextServer`, `withLinkedSpan`, `tracePartsOf`).
14
+
15
+ To migrate, update the package name on every import that is not a plugin symbol to `@systemfsoftware/stryker-js-language`; install `@systemfsoftware/stryker-js-plugin-interface` and import the contract symbols listed above from it, and install `@systemfsoftware/stryker-js-plugin-runtime` for the worker-side symbols. The former in-process surface (`declarePlugin`, `composePlugins`, `PluginContribution`, `PluginLayerContribution`, `PluginKind`, `PluginEnvironment`, `RunConfiguration`, `SandboxDirectory`) no longer exists: a plugin now declares `strykerPlugins: readonly { kind, name }[]` and a worker entry exported under `./worker` (or a `bin`) that serves the per-kind `RpcServer`.
16
+
17
+ ### Patch Changes
18
+
19
+ - Maintenance release. Every published entry point, export, option, and behaviour is exactly as it was.
package/dist/index.d.mts CHANGED
@@ -1,108 +1,170 @@
1
- import { CheckResultSchema, CheckerFailed, CheckerFailed as CheckerFailed$1, DryRunResultSchema, DryRunResultSchema as DryRunResultSchema$1, Mutant, MutantRunResultSchema, MutantRunResultSchema as MutantRunResultSchema$1, ReporterEventUnion, ReporterFailed, ReporterFailed as ReporterFailed$1, TestRunnerCapabilitiesSchema, TestRunnerCapabilitiesSchema as TestRunnerCapabilitiesSchema$1, TestRunnerFailed, TestRunnerFailed as TestRunnerFailed$1 } from "@systemfsoftware/stryker-js-language";
2
- import * as Rpc from "effect/unstable/rpc/Rpc";
3
- import * as RpcGroup from "effect/unstable/rpc/RpcGroup";
4
- import * as S from "effect/Schema";
5
- import * as Context from "effect/Context";
6
- import * as RpcMiddleware from "effect/unstable/rpc/RpcMiddleware";
7
- import * as Option from "effect/Option";
8
- import { Schema } from "effect";
9
- //#region src/Plugin.schema.d.ts
10
- export declare const WorkerPluginKind: S.Literals<readonly ["TestRunner", "Checker", "Reporter"]>;
11
- export type WorkerPluginKind = typeof WorkerPluginKind.Type;
12
- export declare const TestRunnerDryRunRequest: S.Struct<{
13
- readonly options: S.Struct<{
14
- readonly timeout: S.Finite;
15
- readonly disableBail: S.Boolean;
16
- readonly coverageAnalysis: S.Literals<readonly ["off", "all", "perTest"]>;
17
- readonly files: S.optionalKey<S.$Array<S.String>>;
18
- readonly testFiles: S.optionalKey<S.$Array<S.String>>;
19
- }>;
20
- }>;
21
- export type TestRunnerDryRunRequest = typeof TestRunnerDryRunRequest.Type;
22
- export declare const TestRunnerMutantRunRequest: S.Struct<{
23
- readonly options: S.Struct<{
24
- readonly timeout: S.Finite;
25
- readonly disableBail: S.Boolean;
26
- readonly activeMutant: typeof Mutant;
27
- readonly sandboxFileName: S.String;
28
- readonly mutantActivation: S.Literals<readonly ["runtime", "static"]>;
29
- readonly reloadEnvironment: S.Boolean;
30
- readonly testFilter: S.optionalKey<S.$Array<S.String>>;
31
- readonly hitLimit: S.optionalKey<S.Finite>;
32
- }>;
33
- }>;
34
- export type TestRunnerMutantRunRequest = typeof TestRunnerMutantRunRequest.Type;
35
- export declare const CheckerRequest: S.Struct<{
36
- readonly checkerName: S.String;
37
- readonly mutants: S.$Array<typeof Mutant>;
38
- }>;
39
- export type CheckerRequest = typeof CheckerRequest.Type;
40
- export declare const CheckerCheckResult: S.$Record<S.String, S.Union<readonly [S.Struct<{
41
- readonly status: S.Literal<"passed">;
42
- }>, S.Struct<{
43
- readonly status: S.Literal<"compileError">;
44
- readonly reason: S.String;
45
- }>]>>;
46
- export declare const CheckerGroupResult: S.$Array<S.$Array<S.String>>;
47
- export declare const ReporterInitOptions: S.Struct<{
48
- readonly traceparent: S.optionalKey<S.String>;
49
- readonly tracestate: S.optionalKey<S.String>;
50
- }>;
51
- export type ReporterInitOptions = typeof ReporterInitOptions.Type;
52
- export declare const ReporterEventBatch: S.$Array<S.Union<readonly [typeof import("@systemfsoftware/stryker-js-language").DryRunCompleted, typeof import("@systemfsoftware/stryker-js-language").MutationTestingPlanReady, typeof import("@systemfsoftware/stryker-js-language").MutantTested, typeof import("@systemfsoftware/stryker-js-language").MutationTestReportReady]>>;
53
- export type ReporterEventBatch = typeof ReporterEventBatch.Type;
54
- export declare const ReporterAck: S.Void;
55
- export declare const ReporterDrained: S.Void;
56
- declare const BoundaryPayloadRejected_base: S.Class<BoundaryPayloadRejected, S.TaggedStruct<"BoundaryPayloadRejected", {
57
- readonly pluginName: S.String;
58
- readonly method: S.String;
59
- readonly cause: S.String;
60
- }>, import("effect/Cause").YieldableError>;
61
- export declare class BoundaryPayloadRejected extends BoundaryPayloadRejected_base {}
62
- declare const BoundaryUnrecognizedSignal_base: S.Class<BoundaryUnrecognizedSignal, S.TaggedStruct<"BoundaryUnrecognizedSignal", {
63
- readonly pluginName: S.String;
64
- readonly method: S.String;
65
- readonly signal: S.String;
66
- }>, import("effect/Cause").YieldableError>;
67
- export declare class BoundaryUnrecognizedSignal extends BoundaryUnrecognizedSignal_base {}
68
- export declare const BoundaryErrorSchema: S.Union<readonly [typeof BoundaryPayloadRejected, typeof BoundaryUnrecognizedSignal, typeof TestRunnerFailed$1, typeof CheckerFailed$1, typeof ReporterFailed$1]>;
69
- type BoundaryError = typeof BoundaryErrorSchema.Type;
70
- export declare const WorkerEntryUrl: S.String;
71
- export type WorkerEntryUrl = typeof WorkerEntryUrl.Type;
72
- export declare const WorkerPluginSpawnSchema: S.Struct<{
73
- readonly kind: S.Literals<readonly ["TestRunner", "Checker", "Reporter"]>;
74
- readonly entrypoint: S.String;
75
- }>;
76
- type WorkerPluginSpawn = typeof WorkerPluginSpawnSchema.Type;
77
- //#endregion
78
- //#region src/TraceContext.schema.d.ts
79
- declare const Traceparent: S.String;
80
- type Traceparent = typeof Traceparent.Type;
81
- //#endregion
82
- //#region src/TraceContext.d.ts
83
- export declare const TRACEPARENT_HEADER = "traceparent";
84
- export declare const TRACESTATE_HEADER = "tracestate";
85
- interface TraceContextParts {
86
- readonly version: string;
87
- readonly traceId: string;
88
- readonly spanId: string;
89
- readonly traceFlags: number;
90
- readonly traceState?: string | undefined;
91
- }
92
- export declare const formatTraceparent: (parts: TraceContextParts) => Traceparent;
93
- export declare const parseTraceparent: (value: string) => Option.Option<TraceContextParts>;
94
- export declare const TraceContextReference: Context.Reference<Option.Option<TraceContextParts>>;
95
- //#endregion
96
- //#region src/TraceContextRpc.d.ts
97
- declare const PropagatedTrace_base: Context.ServiceClass<PropagatedTrace, "@systemfsoftware/stryker-js-plugin-interface/TraceContextRpc/PropagatedTrace", Option.Option<TraceContextParts>>;
98
- export declare class PropagatedTrace extends PropagatedTrace_base {}
99
- declare const TraceContextMiddleware_base: RpcMiddleware.ServiceClass<TraceContextMiddleware, "@systemfsoftware/stryker-js-plugin-interface/TraceContextMiddleware", typeof PropagatedTrace, Schema.Never, never, never, true>;
100
- export declare class TraceContextMiddleware extends TraceContextMiddleware_base {}
101
- type TracedRpc<Tag extends string, Payload extends Schema.Top = Schema.Void, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never> = Rpc.Rpc<Tag, Payload, Success, Error, typeof TraceContextMiddleware, RpcMiddleware.ApplyServices<typeof TraceContextMiddleware['Identifier'], never>>;
102
- //#endregion
103
- //#region src/Plugin.d.ts
104
- export declare const TestRunnerRpcs: RpcGroup.RpcGroup<TracedRpc<'capabilities', Schema.Void, typeof TestRunnerCapabilitiesSchema$1, typeof TestRunnerFailed$1> | TracedRpc<'dryRun', typeof TestRunnerDryRunRequest, typeof DryRunResultSchema$1, typeof TestRunnerFailed$1> | TracedRpc<'mutantRun', typeof TestRunnerMutantRunRequest, typeof MutantRunResultSchema$1, typeof TestRunnerFailed$1>>;
105
- export declare const CheckerRpcs: RpcGroup.RpcGroup<TracedRpc<'check', typeof CheckerRequest, typeof CheckerCheckResult, typeof CheckerFailed$1> | TracedRpc<'group', typeof CheckerRequest, typeof CheckerGroupResult, typeof CheckerFailed$1>>;
106
- export declare const ReporterRpcs: RpcGroup.RpcGroup<TracedRpc<'init', typeof ReporterInitOptions, typeof ReporterAck, typeof ReporterFailed$1> | TracedRpc<'onEventBatch', typeof ReporterEventBatch, typeof ReporterAck, typeof ReporterFailed$1> | TracedRpc<'flush', Schema.Void, typeof ReporterDrained, typeof ReporterFailed$1>>;
107
- //#endregion
108
- export { type BoundaryError, CheckResultSchema, CheckerFailed, DryRunResultSchema, MutantRunResultSchema, ReporterEventUnion, ReporterFailed, TestRunnerCapabilitiesSchema, TestRunnerFailed, type TraceContextParts, type TracedRpc, type Traceparent, type WorkerPluginSpawn };
1
+ import { CheckerFailed } from '@systemfsoftware/stryker-js-language';
2
+ import { CheckResultSchema } from '@systemfsoftware/stryker-js-language';
3
+ import * as Context from 'effect/Context';
4
+ import { DryRunCompleted } from '@systemfsoftware/stryker-js-language';
5
+ import { DryRunResultSchema } from '@systemfsoftware/stryker-js-language';
6
+ import { Mutant } from '@systemfsoftware/stryker-js-language';
7
+ import { MutantRunResultSchema } from '@systemfsoftware/stryker-js-language';
8
+ import { MutantTested } from '@systemfsoftware/stryker-js-language';
9
+ import { MutationTestingPlanReady } from '@systemfsoftware/stryker-js-language';
10
+ import { MutationTestReportReady } from '@systemfsoftware/stryker-js-language';
11
+ import * as Option from 'effect/Option';
12
+ import { ReporterEventUnion } from '@systemfsoftware/stryker-js-language';
13
+ import { ReporterFailed } from '@systemfsoftware/stryker-js-language';
14
+ import * as Rpc from 'effect/unstable/rpc/Rpc';
15
+ import * as RpcGroup from 'effect/unstable/rpc/RpcGroup';
16
+ import * as RpcMiddleware from 'effect/unstable/rpc/RpcMiddleware';
17
+ import * as S from 'effect/Schema';
18
+ import { Schema } from 'effect';
19
+ import { TestRunnerCapabilitiesSchema } from '@systemfsoftware/stryker-js-language';
20
+ import { TestRunnerFailed } from '@systemfsoftware/stryker-js-language';
21
+ import { YieldableError } from 'effect/Cause';
22
+
23
+ export declare type BoundaryError = typeof BoundaryErrorSchema.Type;
24
+
25
+ export declare const BoundaryErrorSchema: S.Union<readonly [typeof BoundaryPayloadRejected, typeof BoundaryUnrecognizedSignal, typeof TestRunnerFailed, typeof CheckerFailed, typeof ReporterFailed]>;
26
+
27
+ export declare class BoundaryPayloadRejected extends BoundaryPayloadRejected_base {}
28
+
29
+ declare const BoundaryPayloadRejected_base: S.Class<BoundaryPayloadRejected, S.TaggedStruct<"BoundaryPayloadRejected", {
30
+ readonly pluginName: S.String;
31
+ readonly method: S.String;
32
+ readonly cause: S.String;
33
+ }>, YieldableError>;
34
+
35
+ export declare class BoundaryUnrecognizedSignal extends BoundaryUnrecognizedSignal_base {}
36
+
37
+ declare const BoundaryUnrecognizedSignal_base: S.Class<BoundaryUnrecognizedSignal, S.TaggedStruct<"BoundaryUnrecognizedSignal", {
38
+ readonly pluginName: S.String;
39
+ readonly method: S.String;
40
+ readonly signal: S.String;
41
+ }>, YieldableError>;
42
+
43
+ export declare const CheckerCheckResult: S.$Record<S.String, S.Union<readonly [S.Struct<{
44
+ readonly status: S.Literal<"passed">;
45
+ }>, S.Struct<{
46
+ readonly status: S.Literal<"compileError">;
47
+ readonly reason: S.String;
48
+ }>]>>;
49
+
50
+ export { CheckerFailed }
51
+
52
+ export declare const CheckerGroupResult: S.$Array<S.$Array<S.String>>;
53
+
54
+ export declare const CheckerRequest: S.Struct<{
55
+ readonly checkerName: S.String;
56
+ readonly mutants: S.$Array<typeof Mutant>;
57
+ }>;
58
+
59
+ export declare type CheckerRequest = typeof CheckerRequest.Type;
60
+
61
+ export declare const CheckerRpcs: RpcGroup.RpcGroup<TracedRpc<'check', typeof CheckerRequest, typeof CheckerCheckResult, typeof CheckerFailed> | TracedRpc<'group', typeof CheckerRequest, typeof CheckerGroupResult, typeof CheckerFailed>>;
62
+
63
+ export { CheckResultSchema }
64
+
65
+ export { DryRunResultSchema }
66
+
67
+ export declare const formatTraceparent: (parts: TraceContextParts) => Traceparent;
68
+
69
+ export { MutantRunResultSchema }
70
+
71
+ export declare const parseTraceparent: (value: string) => Option.Option<TraceContextParts>;
72
+
73
+ export declare class PropagatedTrace extends PropagatedTrace_base {}
74
+
75
+ declare const PropagatedTrace_base: Context.ServiceClass<PropagatedTrace, "@systemfsoftware/stryker-js-plugin-interface/TraceContextRpc/PropagatedTrace", Option.Option<TraceContextParts>>;
76
+
77
+ export declare const ReporterAck: S.Void;
78
+
79
+ export declare const ReporterDrained: S.Void;
80
+
81
+ export declare const ReporterEventBatch: S.$Array<S.Union<readonly [DryRunCompleted, MutationTestingPlanReady, MutantTested, MutationTestReportReady]>>;
82
+
83
+ export declare type ReporterEventBatch = typeof ReporterEventBatch.Type;
84
+
85
+ export { ReporterEventUnion }
86
+
87
+ export { ReporterFailed }
88
+
89
+ export declare const ReporterInitOptions: S.Struct<{
90
+ readonly traceparent: S.optionalKey<S.String>;
91
+ readonly tracestate: S.optionalKey<S.String>;
92
+ }>;
93
+
94
+ export declare type ReporterInitOptions = typeof ReporterInitOptions.Type;
95
+
96
+ export declare const ReporterRpcs: RpcGroup.RpcGroup<TracedRpc<'init', typeof ReporterInitOptions, typeof ReporterAck, typeof ReporterFailed> | TracedRpc<'onEventBatch', typeof ReporterEventBatch, typeof ReporterAck, typeof ReporterFailed> | TracedRpc<'flush', Schema.Void, typeof ReporterDrained, typeof ReporterFailed>>;
97
+
98
+ export { TestRunnerCapabilitiesSchema }
99
+
100
+ export declare const TestRunnerDryRunRequest: S.Struct<{
101
+ readonly options: S.Struct<{
102
+ readonly timeout: S.Finite;
103
+ readonly disableBail: S.Boolean;
104
+ readonly coverageAnalysis: S.Literals<readonly ["off", "all", "perTest"]>;
105
+ readonly files: S.optionalKey<S.$Array<S.String>>;
106
+ readonly testFiles: S.optionalKey<S.$Array<S.String>>;
107
+ }>;
108
+ }>;
109
+
110
+ export declare type TestRunnerDryRunRequest = typeof TestRunnerDryRunRequest.Type;
111
+
112
+ export { TestRunnerFailed }
113
+
114
+ export declare const TestRunnerMutantRunRequest: S.Struct<{
115
+ readonly options: S.Struct<{
116
+ readonly timeout: S.Finite;
117
+ readonly disableBail: S.Boolean;
118
+ readonly activeMutant: typeof Mutant;
119
+ readonly sandboxFileName: S.String;
120
+ readonly mutantActivation: S.Literals<readonly ["runtime", "static"]>;
121
+ readonly reloadEnvironment: S.Boolean;
122
+ readonly testFilter: S.optionalKey<S.$Array<S.String>>;
123
+ readonly hitLimit: S.optionalKey<S.Finite>;
124
+ }>;
125
+ }>;
126
+
127
+ export declare type TestRunnerMutantRunRequest = typeof TestRunnerMutantRunRequest.Type;
128
+
129
+ export declare const TestRunnerRpcs: RpcGroup.RpcGroup<TracedRpc<'capabilities', Schema.Void, typeof TestRunnerCapabilitiesSchema, typeof TestRunnerFailed> | TracedRpc<'dryRun', typeof TestRunnerDryRunRequest, typeof DryRunResultSchema, typeof TestRunnerFailed> | TracedRpc<'mutantRun', typeof TestRunnerMutantRunRequest, typeof MutantRunResultSchema, typeof TestRunnerFailed>>;
130
+
131
+ export declare class TraceContextMiddleware extends TraceContextMiddleware_base {}
132
+
133
+ declare const TraceContextMiddleware_base: RpcMiddleware.ServiceClass<TraceContextMiddleware, "@systemfsoftware/stryker-js-plugin-interface/TraceContextMiddleware", typeof PropagatedTrace, Schema.Never, never, never, true>;
134
+
135
+ export declare interface TraceContextParts {
136
+ readonly version: string;
137
+ readonly traceId: string;
138
+ readonly spanId: string;
139
+ readonly traceFlags: number;
140
+ readonly traceState?: string | undefined;
141
+ }
142
+
143
+ export declare const TraceContextReference: Context.Reference<Option.Option<TraceContextParts>>;
144
+
145
+ export declare type TracedRpc<Tag extends string, Payload extends Schema.Top = Schema.Void, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never> = Rpc.Rpc<Tag, Payload, Success, Error, typeof TraceContextMiddleware, RpcMiddleware.ApplyServices<typeof TraceContextMiddleware['Identifier'], never>>;
146
+
147
+ export declare const Traceparent: S.String;
148
+
149
+ export declare type Traceparent = typeof Traceparent.Type;
150
+
151
+ export declare const TRACEPARENT_HEADER = "traceparent";
152
+
153
+ export declare const TRACESTATE_HEADER = "tracestate";
154
+
155
+ export declare const WorkerEntryUrl: S.String;
156
+
157
+ export declare type WorkerEntryUrl = typeof WorkerEntryUrl.Type;
158
+
159
+ export declare const WorkerPluginKind: S.Literals<readonly ["TestRunner", "Checker", "Reporter"]>;
160
+
161
+ export declare type WorkerPluginKind = typeof WorkerPluginKind.Type;
162
+
163
+ export declare type WorkerPluginSpawn = typeof WorkerPluginSpawnSchema.Type;
164
+
165
+ export declare const WorkerPluginSpawnSchema: S.Struct<{
166
+ readonly kind: S.Literals<readonly ["TestRunner", "Checker", "Reporter"]>;
167
+ readonly entrypoint: S.String;
168
+ }>;
169
+
170
+ export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@systemfsoftware/stryker-js-plugin-interface",
3
- "version": "4.0.0",
3
+ "version": "5.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/systemfsoftware/stryker-js-effect.git",
@@ -19,9 +19,10 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "effect": "4.0.0-rc.112",
22
- "@systemfsoftware/stryker-js-language": "^4.0.0"
22
+ "@systemfsoftware/stryker-js-language": "^5.0.0"
23
23
  },
24
24
  "devDependencies": {
25
+ "@effect/tsgo": "^0.45.0",
25
26
  "@microsoft/api-extractor": "^7",
26
27
  "@systemfsoftware/all": "^2",
27
28
  "@systemfsoftware/arethetypeswrong-cli": "^4",
@@ -35,9 +36,8 @@
35
36
  "tsdown": "^0.23.0",
36
37
  "typescript": "^7",
37
38
  "vitest": "^4",
38
- "@effect/tsgo": "^0.45.0",
39
- "@systemfsoftware/vitest-config": "^0.1.0",
40
- "@systemfsoftware/tsdown-config": "^0.1.0"
39
+ "@systemfsoftware/tsdown-config": "^0.1.0",
40
+ "@systemfsoftware/vitest-config": "^0.1.0"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public",