bivium 0.9.0 → 0.11.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/README.md +10 -6
- package/cli.js +51 -2192
- package/compute.js +4 -3
- package/config.js +3 -2
- package/docs/api.md +3 -0
- package/docs/ci.md +138 -4
- package/docs/cli.md +101 -3
- package/docs/config.md +115 -0
- package/docs/how-it-works.md +129 -0
- package/docs/tuning.md +24 -1
- package/errors.js +2 -1
- package/index.d.ts +62 -0
- package/package.json +1 -1
- package/shared-1erx1bv8.js +26 -0
- package/shared-6n8bazs5.js +103 -0
- package/shared-8kbmg99n.js +164 -0
- package/shared-9e8vfbjs.js +475 -0
- package/shared-9xwazb0f.js +1047 -0
- package/shared-apgq7xbk.js +13 -0
- package/shared-b9dpffxv.js +30 -0
- package/shared-dyz928f5.js +68 -0
- package/shared-graedbt1.js +12 -0
- package/shared-jee85qxj.js +149 -0
- package/shared-jp8yw63q.js +4 -0
- package/shared-k2ahcc61.js +68 -0
- package/shared-mpjk8met.js +320 -0
- package/shared-nyb7n090.js +655 -0
- package/shared-p3qfqmwd.js +40 -0
- package/{shared-550cvwt2.js → shared-qaqjsxsk.js} +42 -5
- package/shared-vaqyv5nn.js +19 -0
- package/{shared-07rt4zr7.js → shared-wxem8d5w.js} +2162 -1363
- package/shared-211m8fjt.js +0 -69
package/shared-211m8fjt.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// src/errors.ts
|
|
2
|
-
var KINDS = {
|
|
3
|
-
BV_MISSING_ARGUMENT: "usage",
|
|
4
|
-
BV_UNKNOWN_COMMAND: "usage",
|
|
5
|
-
BV_UNKNOWN_OPTION: "usage",
|
|
6
|
-
BV_BAD_OPTION_VALUE: "usage",
|
|
7
|
-
BV_UNEXPECTED_ARGUMENT: "usage",
|
|
8
|
-
BV_UNKNOWN_SUITE: "usage",
|
|
9
|
-
BV_UNKNOWN_TEST: "usage",
|
|
10
|
-
BV_UNKNOWN_FILE: "usage",
|
|
11
|
-
BV_NO_RUN_COMMAND: "usage",
|
|
12
|
-
BV_NO_GITHUB_OUTPUT: "usage",
|
|
13
|
-
BV_CONFIG_NOT_FOUND: "config",
|
|
14
|
-
BV_CONFIG_UNREADABLE: "config",
|
|
15
|
-
BV_CONFIG_INVALID: "config",
|
|
16
|
-
BV_GIT_NO_BASE: "git",
|
|
17
|
-
BV_GIT_NO_MERGE_BASE: "git",
|
|
18
|
-
BV_GIT_FAILED: "git",
|
|
19
|
-
BV_INTERNAL: "other"
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
class BiviumError2 extends Error {
|
|
23
|
-
code;
|
|
24
|
-
kind;
|
|
25
|
-
constructor(code, message, options) {
|
|
26
|
-
super(message, options);
|
|
27
|
-
this.code = code;
|
|
28
|
-
this.kind = KINDS[code];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function distance(a, b) {
|
|
32
|
-
const width = b.length + 1;
|
|
33
|
-
const cells = new Uint32Array((a.length + 1) * width);
|
|
34
|
-
const d = (i, j) => cells[i * width + j] ?? 0;
|
|
35
|
-
for (let i = 0;i <= a.length; i++)
|
|
36
|
-
cells[i * width] = i;
|
|
37
|
-
for (let j = 0;j <= b.length; j++)
|
|
38
|
-
cells[j] = j;
|
|
39
|
-
for (let i = 1;i <= a.length; i++) {
|
|
40
|
-
for (let j = 1;j <= b.length; j++) {
|
|
41
|
-
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
42
|
-
let best = Math.min(d(i - 1, j) + 1, d(i, j - 1) + 1, d(i - 1, j - 1) + cost);
|
|
43
|
-
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
|
|
44
|
-
best = Math.min(best, d(i - 2, j - 2) + 1);
|
|
45
|
-
}
|
|
46
|
-
cells[i * width + j] = best;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return d(a.length, b.length);
|
|
50
|
-
}
|
|
51
|
-
function closest(input, candidates) {
|
|
52
|
-
const most = Math.max(1, Math.floor(input.length / 3));
|
|
53
|
-
let best;
|
|
54
|
-
let bestDistance = most + 1;
|
|
55
|
-
for (const candidate of candidates) {
|
|
56
|
-
const d = distance(input, candidate);
|
|
57
|
-
if (d < bestDistance) {
|
|
58
|
-
best = candidate;
|
|
59
|
-
bestDistance = d;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return best;
|
|
63
|
-
}
|
|
64
|
-
function didYouMean2(input, candidates) {
|
|
65
|
-
const match = closest(input, candidates);
|
|
66
|
-
return match === undefined ? "" : ` (did you mean ${match}?)`;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export { BiviumError2, didYouMean2 };
|