@systemfsoftware/stryker-js-cli-contract 0.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.
- package/CHANGELOG.md +7 -0
- package/LICENSE +203 -0
- package/README.md +65 -0
- package/contract/span-taxonomy.json +1272 -0
- package/contract/stock-catalog.json +430 -0
- package/contract/stream.schema.json +1180 -0
- package/dist/index.d.mts +1470 -0
- package/dist/index.mjs +1709 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/package.json +75 -0
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "arithmetic-operator",
|
|
4
|
+
"name": "ArithmeticOperator",
|
|
5
|
+
"tier": "default",
|
|
6
|
+
"definition": "A binary arithmetic operator: `+` becomes `-`, `-` becomes `+`, `*` becomes `/`, `/` becomes `*` and `%` becomes `*`. A string or template literal on either side is refused, as is a private name on the left.",
|
|
7
|
+
"examples": [
|
|
8
|
+
{
|
|
9
|
+
"before": "const x = 1 + 2;",
|
|
10
|
+
"after": [
|
|
11
|
+
"1 - 2"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"before": "const x = 'a' + 'b';",
|
|
16
|
+
"after": []
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": "array-declaration",
|
|
22
|
+
"name": "ArrayDeclaration",
|
|
23
|
+
"tier": "default",
|
|
24
|
+
"definition": "An array literal becomes `[]` and an empty one becomes `['Stryker was here']`; `Array(1, 2)` becomes `Array()` and `Array()` becomes `Array([])`. A call that is not `Array` is refused.",
|
|
25
|
+
"examples": [
|
|
26
|
+
{
|
|
27
|
+
"before": "const x = [1];",
|
|
28
|
+
"after": [
|
|
29
|
+
"[]"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"before": "const x = [];",
|
|
34
|
+
"after": [
|
|
35
|
+
"[\"Stryker was here\"]"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"before": "const x = Array(1, 2);",
|
|
40
|
+
"after": [
|
|
41
|
+
"Array()"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"before": "const x = Array();",
|
|
46
|
+
"after": [
|
|
47
|
+
"Array([])"
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"before": "const x = someCall(1, 2);",
|
|
52
|
+
"after": []
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "arrow-function",
|
|
58
|
+
"name": "ArrowFunction",
|
|
59
|
+
"tier": "default",
|
|
60
|
+
"definition": "An arrow function shorthand body becomes `undefined`. A block body, and a body that already is `undefined`, are refused.",
|
|
61
|
+
"examples": [
|
|
62
|
+
{
|
|
63
|
+
"before": "const x = () => 1;",
|
|
64
|
+
"after": [
|
|
65
|
+
"() => undefined"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"before": "const x = () => { return 1; };",
|
|
70
|
+
"after": []
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "assignment-operator",
|
|
76
|
+
"name": "AssignmentOperator",
|
|
77
|
+
"tier": "default",
|
|
78
|
+
"definition": "A compound assignment operator: `+=` becomes `-=`, `*=` becomes `/=`, `%=` becomes `*=`, `<<=` becomes `>>=`, `&=` becomes `|=`, `&&=` becomes `||=` and `??=` becomes `&&=`. A compound assignment whose right side is string-like is refused, except for the logical assignments.",
|
|
79
|
+
"examples": [
|
|
80
|
+
{
|
|
81
|
+
"before": "let x = 1; x += 2;",
|
|
82
|
+
"after": [
|
|
83
|
+
"x -= 2"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"before": "let s = 'a'; s += 'b';",
|
|
88
|
+
"after": []
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"id": "block-statement",
|
|
94
|
+
"name": "BlockStatement",
|
|
95
|
+
"tier": "default",
|
|
96
|
+
"definition": "A non-empty block becomes `{}`. An empty block, and a derived constructor body that references `super` while the class initializes properties, are refused.",
|
|
97
|
+
"examples": [
|
|
98
|
+
{
|
|
99
|
+
"before": "function f() { const x = 1; }",
|
|
100
|
+
"after": [
|
|
101
|
+
"{}"
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"before": "function f() {}",
|
|
106
|
+
"after": []
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"id": "boolean-literal",
|
|
112
|
+
"name": "BooleanLiteral",
|
|
113
|
+
"tier": "default",
|
|
114
|
+
"definition": "`true` becomes `false`, `false` becomes `true`, and a prefix `!` collapses to its operand. A literal that is not a boolean is refused.",
|
|
115
|
+
"examples": [
|
|
116
|
+
{
|
|
117
|
+
"before": "const x = true;",
|
|
118
|
+
"after": [
|
|
119
|
+
"false"
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"before": "const x = !a;",
|
|
124
|
+
"after": [
|
|
125
|
+
"a"
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"before": "const x = 1;",
|
|
130
|
+
"after": []
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"id": "conditional-expression",
|
|
136
|
+
"name": "ConditionalExpression",
|
|
137
|
+
"tier": "default",
|
|
138
|
+
"definition": "A condition becomes `true` and `false`; a loop test becomes `false`; a condition under `&&` becomes `true` and one under `||` becomes `false`. A statement the rule does not match is refused.",
|
|
139
|
+
"examples": [
|
|
140
|
+
{
|
|
141
|
+
"before": "if (a) { f(); }",
|
|
142
|
+
"after": [
|
|
143
|
+
"true",
|
|
144
|
+
"false"
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"before": "while (a) { f(); }",
|
|
149
|
+
"after": [
|
|
150
|
+
"false"
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"id": "equality-operator",
|
|
157
|
+
"name": "EqualityOperator",
|
|
158
|
+
"tier": "default",
|
|
159
|
+
"definition": "An ordering comparison becomes its two alternatives (`<` becomes `<=` and `>=`) and an equality comparison flips (`===` becomes `!==`, `!=` becomes `==`).",
|
|
160
|
+
"examples": [
|
|
161
|
+
{
|
|
162
|
+
"before": "const x = a === b;",
|
|
163
|
+
"after": [
|
|
164
|
+
"a !== b"
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"before": "const x = a < b;",
|
|
169
|
+
"after": [
|
|
170
|
+
"a <= b",
|
|
171
|
+
"a >= b"
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"id": "logical-operator",
|
|
178
|
+
"name": "LogicalOperator",
|
|
179
|
+
"tier": "default",
|
|
180
|
+
"definition": "`&&` becomes `||`, `||` becomes `&&` and `??` becomes `&&`. An expression that is not logical is refused.",
|
|
181
|
+
"examples": [
|
|
182
|
+
{
|
|
183
|
+
"before": "const x = a && b;",
|
|
184
|
+
"after": [
|
|
185
|
+
"a || b"
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"before": "const x = a ?? b;",
|
|
190
|
+
"after": [
|
|
191
|
+
"a && b"
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"before": "const x = a + b;",
|
|
196
|
+
"after": []
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"id": "method-expression",
|
|
202
|
+
"name": "MethodExpression",
|
|
203
|
+
"tier": "default",
|
|
204
|
+
"definition": "A known method call becomes its opposite (`toLowerCase` becomes `toUpperCase`) or, for a removal method, a call of the object itself (`arr.filter(p)` becomes `arr()`). A `super` call, an unknown method and a string-literal key are refused.",
|
|
205
|
+
"examples": [
|
|
206
|
+
{
|
|
207
|
+
"before": "const x = \"HELLO\".toLowerCase();",
|
|
208
|
+
"after": [
|
|
209
|
+
"\"HELLO\".toUpperCase()"
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"before": "const x = arr.filter(p);",
|
|
214
|
+
"after": [
|
|
215
|
+
"arr()"
|
|
216
|
+
]
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"before": "const x = arr['filter'](p);",
|
|
220
|
+
"after": []
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"id": "object-literal",
|
|
226
|
+
"name": "ObjectLiteral",
|
|
227
|
+
"tier": "default",
|
|
228
|
+
"definition": "A non-empty object literal becomes `{}`; an empty one is refused.",
|
|
229
|
+
"examples": [
|
|
230
|
+
{
|
|
231
|
+
"before": "const x = { a: 1 };",
|
|
232
|
+
"after": [
|
|
233
|
+
"{}"
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"before": "const x = {};",
|
|
238
|
+
"after": []
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"id": "optional-chaining",
|
|
244
|
+
"name": "OptionalChaining",
|
|
245
|
+
"tier": "default",
|
|
246
|
+
"definition": "An optional access becomes the plain one: `a?.b` becomes `a.b`, `a?.[k]` becomes `a[k]` and `a?.()` becomes `a()`. A member that is not optional is refused.",
|
|
247
|
+
"examples": [
|
|
248
|
+
{
|
|
249
|
+
"before": "const x = a?.b;",
|
|
250
|
+
"after": [
|
|
251
|
+
"a.b"
|
|
252
|
+
]
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"before": "const x = a?.[k];",
|
|
256
|
+
"after": [
|
|
257
|
+
"a[k]"
|
|
258
|
+
]
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"before": "const x = a.b;",
|
|
262
|
+
"after": []
|
|
263
|
+
}
|
|
264
|
+
]
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"id": "regex",
|
|
268
|
+
"name": "Regex",
|
|
269
|
+
"tier": "default",
|
|
270
|
+
"definition": "A regular-expression literal, or the string of `new RegExp(...)`, loses anchors, quantifiers, lookarounds or class negations — one mutant per mutation, emitted anchors first. Alternations and groups are refused.",
|
|
271
|
+
"examples": [
|
|
272
|
+
{
|
|
273
|
+
"before": "const x = /a+/;",
|
|
274
|
+
"after": [
|
|
275
|
+
"/a/"
|
|
276
|
+
]
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"before": "const x = /a|b/;",
|
|
280
|
+
"after": []
|
|
281
|
+
}
|
|
282
|
+
]
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"id": "string-literal",
|
|
286
|
+
"name": "StringLiteral",
|
|
287
|
+
"tier": "default",
|
|
288
|
+
"definition": "A non-empty string becomes `\"\"` and an empty one becomes 'Stryker was here!'; a template literal's first quasi is mutated. A directive, an import or export specifier, a property key, a JSX attribute and a literal type are refused.",
|
|
289
|
+
"examples": [
|
|
290
|
+
{
|
|
291
|
+
"before": "const x = \"hello\";",
|
|
292
|
+
"after": [
|
|
293
|
+
"\"\""
|
|
294
|
+
]
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"before": "'use strict';",
|
|
298
|
+
"after": []
|
|
299
|
+
}
|
|
300
|
+
]
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"id": "unary-operator",
|
|
304
|
+
"name": "UnaryOperator",
|
|
305
|
+
"tier": "default",
|
|
306
|
+
"definition": "`+x` becomes `-x`, `-x` becomes `+x` and `~x` becomes `x`. `!`, `typeof`, `void` and `delete` are refused.",
|
|
307
|
+
"examples": [
|
|
308
|
+
{
|
|
309
|
+
"before": "const x = -a;",
|
|
310
|
+
"after": [
|
|
311
|
+
"+a"
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"before": "const x = ~a;",
|
|
316
|
+
"after": [
|
|
317
|
+
"a"
|
|
318
|
+
]
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"before": "const x = typeof y;",
|
|
322
|
+
"after": []
|
|
323
|
+
}
|
|
324
|
+
]
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"id": "update-operator",
|
|
328
|
+
"name": "UpdateOperator",
|
|
329
|
+
"tier": "default",
|
|
330
|
+
"definition": "`++` becomes `--` and `--` becomes `++`, prefix or postfix.",
|
|
331
|
+
"examples": [
|
|
332
|
+
{
|
|
333
|
+
"before": "let x = 1; x++;",
|
|
334
|
+
"after": [
|
|
335
|
+
"x--"
|
|
336
|
+
]
|
|
337
|
+
}
|
|
338
|
+
]
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"id": "atomic-update-split",
|
|
342
|
+
"name": "AtomicUpdateSplit",
|
|
343
|
+
"tier": "optIn",
|
|
344
|
+
"definition": "A `Ref` or `SynchronizedRef` atomic update — `modify`, `modifySome`, `update`, `updateSome`, `updateAndGet`, `getAndUpdate` — is split into a read, a snapshot update and a write, so a lost update survives. The `Effect` module has to be in scope, and the reference and the handler have to be movable.",
|
|
345
|
+
"examples": [
|
|
346
|
+
{
|
|
347
|
+
"before": "import { Effect, Ref } from 'effect'\n\nexport const bump = (ref: Ref.Ref<number>): Effect.Effect<void> => Ref.update(ref, (n) => n + 1)\n",
|
|
348
|
+
"after": [
|
|
349
|
+
"Effect.flatMap(Effect.succeed(ref), self => Effect.flatMap(Ref.get(self), s => Effect.flatMap(Ref.make(s), snap => Effect.flatMap(Ref.update(snap, n => n + 1), b => Effect.flatMap(Effect.yieldNow, () => Effect.flatMap(Ref.get(snap), a => Effect.as(Ref.set(self, a), b)))))))"
|
|
350
|
+
]
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"before": "import { Effect, pipe, Ref } from 'effect'\n\nexport const bumpPiped = (ref: Ref.Ref<number>) => pipe(ref, Ref.update((n: number) => n + 1))\n",
|
|
354
|
+
"after": [
|
|
355
|
+
"self => Effect.flatMap(Ref.get(self), s => Effect.flatMap(Ref.make(s), snap => Effect.flatMap(Ref.update(snap, (n: number) => n + 1), b => Effect.flatMap(Effect.yieldNow, () => Effect.flatMap(Ref.get(snap), a => Effect.as(Ref.set(self, a), b))))))"
|
|
356
|
+
]
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"before": "import { Ref } from 'effect'\n\nexport const withoutEffect = (ref: Ref.Ref<number>) => Ref.update(ref, (n) => n + 1)\n",
|
|
360
|
+
"after": []
|
|
361
|
+
}
|
|
362
|
+
]
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"id": "synchronization-removal",
|
|
366
|
+
"name": "SynchronizationRemoval",
|
|
367
|
+
"tier": "optIn",
|
|
368
|
+
"definition": "The lock a call takes is dropped: `Semaphore.withPermits(sem, n, effect)` and `Semaphore.withPermit(sem, effect)` become the guarded effect, their piped forms become `self => self`, `Effect.uninterruptible(effect)` becomes `effect`, and `Effect.uninterruptibleMask(f)` becomes `Effect.suspend(() => f(Effect.interruptible))`. A guard that is not droppable, and a method-form call whose guard is built on the spot, are refused.",
|
|
369
|
+
"examples": [
|
|
370
|
+
{
|
|
371
|
+
"before": "import { Effect, Semaphore } from 'effect'\n\nexport const guarded = (sem: Semaphore.Semaphore, effect: Effect.Effect<number>) =>\n Semaphore.withPermits(sem, 1, effect)\n",
|
|
372
|
+
"after": [
|
|
373
|
+
"effect"
|
|
374
|
+
]
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"before": "import { Effect, pipe } from 'effect'\n\nexport const frozen = (effect: Effect.Effect<number>) => pipe(effect, Effect.uninterruptible)\n",
|
|
378
|
+
"after": [
|
|
379
|
+
"self => self"
|
|
380
|
+
]
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"before": "import { Effect } from 'effect'\n\nexport const masked = (effect: Effect.Effect<number>) => Effect.uninterruptibleMask((restore) => restore(effect))\n",
|
|
384
|
+
"after": [
|
|
385
|
+
"Effect.suspend(() => (restore => restore(effect))(Effect.interruptible))"
|
|
386
|
+
]
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"before": "import { Effect, Semaphore } from 'effect'\n\nexport const methodForm = (sem: Semaphore.Semaphore, effect: Effect.Effect<number>) =>\n sem.withPermits(1)(effect)\n",
|
|
390
|
+
"after": []
|
|
391
|
+
}
|
|
392
|
+
]
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"id": "finalizer-escape",
|
|
396
|
+
"name": "FinalizerEscape",
|
|
397
|
+
"tier": "optIn",
|
|
398
|
+
"definition": "A finalizer is kept only for the path that did not interrupt: `Effect.ensuring(effect, fin)` re-runs `fin` when the exit was not an interruption, `Effect.onError(effect, h)` re-runs `h` when the cause carries none, a release bracket wraps its release the same way, and `Effect.onInterrupt(effect, h)` drops the handler. A handler built by a call, and a cleanup that yields while it is moved, are refused.",
|
|
399
|
+
"examples": [
|
|
400
|
+
{
|
|
401
|
+
"before": "import { Effect, Ref } from 'effect'\n\nexport const ensuringDataFirst = (effect: Effect.Effect<number>, closed: Ref.Ref<boolean>) =>\n Effect.ensuring(effect, Ref.set(closed, true))\n",
|
|
402
|
+
"after": [
|
|
403
|
+
"Effect.onExitIf(effect, exit => exit._tag === \"Success\" || !exit.cause.reasons.some(reason => reason._tag === \"Interrupt\"), () => Ref.set(closed, true))"
|
|
404
|
+
]
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"before": "import { Effect, Ref } from 'effect'\n\nexport const onErrorDataFirst = (effect: Effect.Effect<number>, closed: Ref.Ref<boolean>) =>\n Effect.onError(effect, () => Ref.set(closed, true))\n",
|
|
408
|
+
"after": [
|
|
409
|
+
"Effect.onErrorIf(effect, cause => !cause.reasons.some(reason => reason._tag === \"Interrupt\"), () => Ref.set(closed, true))"
|
|
410
|
+
]
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"before": "import { Effect, Ref } from 'effect'\n\nexport const acquireReleaseTwoArg = (acquire: Effect.Effect<number>, closed: Ref.Ref<boolean>) =>\n Effect.acquireRelease(acquire, () => Ref.getAndSet(closed, true))\n",
|
|
414
|
+
"after": [
|
|
415
|
+
"Effect.flatMap(Effect.interruptible(acquire), a => Effect.acquireRelease(Effect.succeed(a), () => Ref.getAndSet(closed, true)))"
|
|
416
|
+
]
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"before": "import { Effect, Ref } from 'effect'\n\nexport const acquireUseReleaseBrackets = (\n acquire: Effect.Effect<number>,\n use: (a: number) => Effect.Effect<number>,\n closed: Ref.Ref<boolean>,\n) => Effect.acquireUseRelease(acquire, use, () => Ref.set(closed, true))\n",
|
|
420
|
+
"after": [
|
|
421
|
+
"Effect.acquireUseRelease(acquire, use, (a, exit) => exit._tag === \"Success\" || !exit.cause.reasons.some(reason => reason._tag === \"Interrupt\") ? (() => Ref.set(closed, true))() : Effect.void)"
|
|
422
|
+
]
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"before": "import { Effect, Ref } from 'effect'\n\nconst ensuring = (effect: Effect.Effect<number>, cleanup: Effect.Effect<void>) => effect\n\nexport const localEnsuringRefusal = (effect: Effect.Effect<number>, closed: Ref.Ref<boolean>) =>\n ensuring(effect, Ref.set(closed, true))\n",
|
|
426
|
+
"after": []
|
|
427
|
+
}
|
|
428
|
+
]
|
|
429
|
+
}
|
|
430
|
+
]
|