@milkenjoyer/toolchain 0.7.2 → 0.8.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 +6 -0
- package/dist/compatible-D8n_sQHa.mjs +160 -0
- package/dist/compatible-n7uFGrI3.d.mts +91 -0
- package/dist/compatible.d.mts +2 -91
- package/dist/compatible.mjs +1 -160
- package/dist/effect-tsgo-D0QfeKGD.mjs +27 -0
- package/dist/effect-tsgo.mjs +1 -27
- package/dist/exceptions-Bq-9MxoR.mjs +3 -0
- package/dist/exceptions-LNZ022dl.d.mts +7 -0
- package/dist/exceptions.d.mts +2 -6
- package/dist/exceptions.mjs +1 -3
- package/dist/guard.d.mts +3 -3
- package/dist/guard.mjs +5 -5
- package/dist/lint-JSnPsGO1.mjs +140 -0
- package/dist/lint.mjs +1 -140
- package/dist/proof.d.mts +1 -0
- package/dist/proof.mjs +141 -0
- package/dist/rules-vHmNoAU0.mjs +117 -0
- package/dist/rules.mjs +1 -117
- package/dist/versions-C7LKZGr3.mjs +142 -0
- package/dist/versions-D02TrtKw.d.mts +46 -0
- package/dist/versions.d.mts +2 -46
- package/dist/versions.mjs +1 -142
- package/package.json +7 -2
- package/renovate.json +9 -1
- package/src/proof.ts +216 -0
package/README.md
CHANGED
|
@@ -27,3 +27,9 @@ The program runs the local `vp config --hooks`, retains an absolute shared hooks
|
|
|
27
27
|
Use this same prepare entrypoint for regeneration. A bare native `vp config` or `vp hooks enable` restores the upstream stub. The supported setup entrypoint regenerates and reinstalls the corrected stub together. A worktree whose shared active dispatcher belongs to another checkout cannot silently repair that checkout. Setup must reject a stale shared dispatcher until the parent updates the primary through the reviewed deployment.
|
|
28
28
|
|
|
29
29
|
Before deployment, save the active generated stub's bytes and executable mode. Compare the replacement with the released `worktreePrePush` export. Rollback restores those saved bytes and mode. The old stub reintroduces the diagnosed executable/config mismatch, so keep affected worktree pushes held after rollback.
|
|
30
|
+
|
|
31
|
+
## Verifier proof
|
|
32
|
+
|
|
33
|
+
Run `GH_TOKEN="$(gh auth token)" vp exec proof <owner/repo> <files>` to upload screenshots and video as Git objects under a hidden `refs/proof/<commit>` ref and print inline Markdown for the PR. The repository must be private; media stays private to repo members. The command accepts `GH_TOKEN` or `GITHUB_TOKEN`. Video uploads include a GIF preview capped at 30 seconds and 720 pixels and need ffmpeg on the runner.
|
|
34
|
+
|
|
35
|
+
In CI, give the job `permissions: contents: write`, set `GH_TOKEN: ${{ github.token }}`, and run `vp exec proof ${{ github.repository }} <files>` after generating the media.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { c as lead, f as versionOf, i as familyOf, o as fixedBy, r as familyNamed, s as fixedOf, t as catalog, u as ownerOf } from "./versions-C7LKZGr3.mjs";
|
|
2
|
+
import * as Arr from "effect/Array";
|
|
3
|
+
import * as Data from "effect/Data";
|
|
4
|
+
import { dual } from "effect/Function";
|
|
5
|
+
import * as HashSet from "effect/HashSet";
|
|
6
|
+
import * as Match from "effect/Match";
|
|
7
|
+
import * as Option from "effect/Option";
|
|
8
|
+
import * as R from "effect/Record";
|
|
9
|
+
import * as Schema from "effect/Schema";
|
|
10
|
+
import * as Str from "effect/String";
|
|
11
|
+
import semver from "semver";
|
|
12
|
+
// src/compatible.ts
|
|
13
|
+
const Ranges = Schema.optionalKey(Schema.Record(Schema.String, Schema.String));
|
|
14
|
+
const VersionManifest = Schema.Struct({
|
|
15
|
+
dependencies: Ranges,
|
|
16
|
+
peerDependencies: Ranges,
|
|
17
|
+
bundledVersions: Ranges
|
|
18
|
+
});
|
|
19
|
+
const Packument = Schema.Struct({
|
|
20
|
+
"dist-tags": Schema.Record(Schema.String, Schema.String),
|
|
21
|
+
versions: Schema.Record(Schema.String, VersionManifest)
|
|
22
|
+
});
|
|
23
|
+
const Packuments = Schema.Record(Schema.String, Packument);
|
|
24
|
+
const Conflict = Data.taggedEnum();
|
|
25
|
+
const ALIAS = /^npm:(?<target>(?:@[^/@]+\/)?[^@]+)@(?<version>.+)$/u;
|
|
26
|
+
const manifestOf = (registry, name, version) => Option.flatMap(R.get(registry, name), (packument) => R.get(packument.versions, version));
|
|
27
|
+
const latestOf = dual(2, (registry, family) => Option.flatMap(R.get(registry, lead(family)), (packument) => R.get(packument["dist-tags"], "latest")));
|
|
28
|
+
const otherTags = dual(2, (registry, family) => Arr.flatMap(family.packages, (name) => Option.match(R.get(registry, name), {
|
|
29
|
+
onNone: () => [],
|
|
30
|
+
onSome: (packument) => Arr.filter(R.toEntries(packument["dist-tags"]), ([tag]) => tag !== "latest")
|
|
31
|
+
})));
|
|
32
|
+
const aliasTarget = (alias) => Option.flatMap(Option.fromNullishOr(ALIAS.exec(alias)?.groups), (groups) => Option.all([Option.fromNullishOr(groups.target), Option.fromNullishOr(groups.version)]));
|
|
33
|
+
const fixedRange = dual(3, (registry, family, name) => Option.flatMap(manifestOf(registry, lead(family), family.version), ({ dependencies = {} }) => R.get(dependencies, name)));
|
|
34
|
+
const anchored = (start, name) => Option.exists(ownerOf(name, start), (owner) => Arr.isReadonlyArrayNonEmpty(fixedBy(owner.name, start)));
|
|
35
|
+
const requirements = (start, name, manifest) => {
|
|
36
|
+
const { dependencies = {}, peerDependencies = {} } = manifest;
|
|
37
|
+
return [...anchored(start, name) ? R.toEntries(dependencies) : [], ...R.toEntries(peerDependencies)];
|
|
38
|
+
};
|
|
39
|
+
const holds = (registry, needs, actual, range) => Option.match(aliasTarget(actual), {
|
|
40
|
+
onNone: () => semver.validRange(range) !== null && semver.satisfies(actual, Str.replace(/^=/u, "")(range)),
|
|
41
|
+
onSome: ([target, version]) => range === actual || Option.exists(Option.flatMap(manifestOf(registry, target, version), ({ bundledVersions = {} }) => R.get(bundledVersions, needs)), (bundled) => semver.satisfies(bundled, range))
|
|
42
|
+
});
|
|
43
|
+
const conflictsForManifest = (registry, start, lookup, family, name, manifest) => Arr.flatMap(requirements(start, name, manifest), ([needs, range]) => Option.match(lookup(needs), {
|
|
44
|
+
onNone: () => [],
|
|
45
|
+
onSome: (actual) => holds(registry, needs, actual, range) ? [] : [Conflict.Unmet({
|
|
46
|
+
name,
|
|
47
|
+
version: family.version,
|
|
48
|
+
needs,
|
|
49
|
+
range,
|
|
50
|
+
actual
|
|
51
|
+
})]
|
|
52
|
+
}));
|
|
53
|
+
const memberConflicts = (registry, start, lookup, family, name) => Option.match(manifestOf(registry, name, family.version), {
|
|
54
|
+
onNone: () => R.has(registry, name) ? [Conflict.Unpublished({
|
|
55
|
+
name,
|
|
56
|
+
version: family.version
|
|
57
|
+
})] : [],
|
|
58
|
+
onSome: (manifest) => conflictsForManifest(registry, start, lookup, family, name, manifest)
|
|
59
|
+
});
|
|
60
|
+
const conflictsAmong = (registry, start, picked, lookup) => Arr.flatMap(picked, (family) => Arr.flatMap(family.packages, (name) => memberConflicts(registry, start, lookup, family, name)));
|
|
61
|
+
const conflicts = dual(2, (current, registry) => conflictsAmong(registry, current, current.families, (name) => versionOf(name, current)));
|
|
62
|
+
const fixedVersion = (registry, family, entry) => Option.match(fixedRange(registry, family, entry.name), {
|
|
63
|
+
onNone: () => entry,
|
|
64
|
+
onSome: (range) => ({
|
|
65
|
+
...entry,
|
|
66
|
+
version: Str.replace(/^=/u, "")(range)
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
const onLatestLine = dual(2, (version, latest) => semver.lte(version, latest) && (semver.prerelease(latest) !== null || semver.prerelease(version) === null));
|
|
70
|
+
const published = (registry, family) => Option.match(R.get(registry, lead(family)), {
|
|
71
|
+
onNone: () => [],
|
|
72
|
+
onSome: (packument) => R.keys(packument.versions)
|
|
73
|
+
});
|
|
74
|
+
const rises = (family, latest, tagged, version) => semver.valid(version) !== null && semver.gt(version, family.version) && onLatestLine(version, latest) && (version === latest || !HashSet.has(tagged, version));
|
|
75
|
+
const ladder = (registry, family) => {
|
|
76
|
+
const tagged = HashSet.fromIterable(Arr.map(otherTags(registry, family), ([, version]) => version));
|
|
77
|
+
const above = Option.match(latestOf(registry, family), {
|
|
78
|
+
onNone: () => [],
|
|
79
|
+
onSome: (latest) => Arr.filter(published(registry, family), (version) => rises(family, latest, tagged, version) && Arr.every(family.packages, (name) => !R.has(registry, name) || Option.isSome(manifestOf(registry, name, version))))
|
|
80
|
+
});
|
|
81
|
+
return [...Arr.sort(above, semver.rcompare), family.version];
|
|
82
|
+
};
|
|
83
|
+
const assemble = (registry, start, picked) => ({
|
|
84
|
+
families: picked,
|
|
85
|
+
fixed: Arr.flatMap(start.fixed, (entry) => Arr.fromOption(Option.map(familyNamed(entry.by, {
|
|
86
|
+
...start,
|
|
87
|
+
families: picked
|
|
88
|
+
}), (family) => fixedVersion(registry, family, entry))))
|
|
89
|
+
});
|
|
90
|
+
const pickedVersion = (registry, start, picked, name) => {
|
|
91
|
+
const owner = ownerOf(name, start);
|
|
92
|
+
if (Option.isNone(owner)) return Option.none();
|
|
93
|
+
const chosen = familyNamed(owner.value.name, {
|
|
94
|
+
...start,
|
|
95
|
+
families: picked
|
|
96
|
+
});
|
|
97
|
+
if (Option.isNone(chosen)) return Option.none();
|
|
98
|
+
if (Option.isSome(familyOf(name, start))) return Option.some(chosen.value.version);
|
|
99
|
+
return Option.map(fixedOf(name, start), (entry) => fixedVersion(registry, chosen.value, entry).version);
|
|
100
|
+
};
|
|
101
|
+
const search = (registry, start, rungs, picked) => Arr.matchLeft(rungs, {
|
|
102
|
+
onEmpty: () => Option.some(picked),
|
|
103
|
+
onNonEmpty: ([family, versions], rest) => Arr.findFirst(versions, (version) => {
|
|
104
|
+
const next = [...picked, {
|
|
105
|
+
...family,
|
|
106
|
+
version
|
|
107
|
+
}];
|
|
108
|
+
return Arr.isReadonlyArrayEmpty(conflictsAmong(registry, start, next, (name) => pickedVersion(registry, start, next, name))) ? search(registry, start, rest, next) : Option.none();
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
const describeConflict = dual(2, (conflict, current) => Match.value(conflict).pipe(Match.tag("Unpublished", ({ name, version }) => `${name} ${version} is not published`), Match.tag("Unmet", ({ name, version, needs, range, actual }) => {
|
|
112
|
+
return `${name} ${version} needs ${needs} ${range}, and the set has ${needs} ${actual}${Option.match(fixedOf(needs, current), {
|
|
113
|
+
onNone: () => "",
|
|
114
|
+
onSome: (entry) => `, which ${entry.by} fixes`
|
|
115
|
+
})}`;
|
|
116
|
+
}), Match.exhaustive));
|
|
117
|
+
const involves = (conflict, family, current) => family.packages.includes(conflict.name) || Match.value(conflict).pipe(Match.tag("Unmet", ({ needs }) => Option.exists(ownerOf(needs, current), (owner) => owner.name === family.name)), Match.orElse(() => false));
|
|
118
|
+
const familyBlocker = (registry, solved, family, latest) => {
|
|
119
|
+
const families = Arr.map(solved.families, (entry) => entry.name === family.name ? {
|
|
120
|
+
...entry,
|
|
121
|
+
version: latest
|
|
122
|
+
} : entry);
|
|
123
|
+
const trial = assemble(registry, solved, families);
|
|
124
|
+
const relevant = Arr.filter(conflicts(trial, registry), (conflict) => involves(conflict, family, trial));
|
|
125
|
+
return Arr.match(relevant, {
|
|
126
|
+
onEmpty: () => {
|
|
127
|
+
if (ladder(registry, family).includes(latest)) return `no compatible set includes ${family.name} ${latest}`;
|
|
128
|
+
return `${family.name} ${latest} is below the catalog or not published for every package in its family`;
|
|
129
|
+
},
|
|
130
|
+
onNonEmpty: ([first]) => describeConflict(first, trial)
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
const blockersOf = (registry, solved, latest) => R.fromEntries(Arr.flatMap(solved.families, (family) => Option.match(R.get(latest, family.name), {
|
|
134
|
+
onNone: () => [],
|
|
135
|
+
onSome: (version) => version === family.version ? [] : [[family.name, familyBlocker(registry, solved, family, version)]]
|
|
136
|
+
})));
|
|
137
|
+
const solve = dual((args) => Schema.is(Packuments)(args[0]), (registry, start = catalog) => {
|
|
138
|
+
const latest = R.fromEntries(Arr.flatMap(start.families, (family) => Arr.fromOption(Option.map(latestOf(registry, family), (version) => [family.name, version]))));
|
|
139
|
+
const rungs = Arr.map(start.families, (family) => [family, ladder(registry, family)]);
|
|
140
|
+
return Option.match(search(registry, start, rungs, []), {
|
|
141
|
+
onNone: () => ({
|
|
142
|
+
resolved: false,
|
|
143
|
+
catalog: start,
|
|
144
|
+
latest,
|
|
145
|
+
blockers: {},
|
|
146
|
+
conflicts: conflicts(start, registry)
|
|
147
|
+
}),
|
|
148
|
+
onSome: (picked) => {
|
|
149
|
+
const solved = assemble(registry, start, picked);
|
|
150
|
+
return {
|
|
151
|
+
resolved: true,
|
|
152
|
+
catalog: solved,
|
|
153
|
+
latest,
|
|
154
|
+
blockers: blockersOf(registry, solved, latest),
|
|
155
|
+
conflicts: []
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
export { aliasTarget as a, fixedRange as c, otherTags as d, solve as f, VersionManifest as i, latestOf as l, Packument as n, conflicts as o, Packuments as r, describeConflict as s, Conflict as t, onLatestLine as u };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { n as Family, t as Catalog } from "./versions-D02TrtKw.mjs";
|
|
2
|
+
import * as Data from "effect/Data";
|
|
3
|
+
import * as Option from "effect/Option";
|
|
4
|
+
import * as Schema from "effect/Schema";
|
|
5
|
+
declare const VersionManifest: Schema.Struct<{
|
|
6
|
+
readonly dependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
7
|
+
readonly peerDependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
8
|
+
readonly bundledVersions: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
9
|
+
}>;
|
|
10
|
+
type VersionManifest = typeof VersionManifest.Type;
|
|
11
|
+
declare const Packument: Schema.Struct<{
|
|
12
|
+
readonly "dist-tags": Schema.$Record<Schema.String, Schema.String>;
|
|
13
|
+
readonly versions: Schema.$Record<Schema.String, Schema.Struct<{
|
|
14
|
+
readonly dependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
15
|
+
readonly peerDependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
16
|
+
readonly bundledVersions: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
17
|
+
}>>;
|
|
18
|
+
}>;
|
|
19
|
+
type Packument = typeof Packument.Type;
|
|
20
|
+
declare const Packuments: Schema.$Record<Schema.String, Schema.Struct<{
|
|
21
|
+
readonly "dist-tags": Schema.$Record<Schema.String, Schema.String>;
|
|
22
|
+
readonly versions: Schema.$Record<Schema.String, Schema.Struct<{
|
|
23
|
+
readonly dependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
24
|
+
readonly peerDependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
25
|
+
readonly bundledVersions: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
26
|
+
}>>;
|
|
27
|
+
}>>;
|
|
28
|
+
type Packuments = typeof Packuments.Type;
|
|
29
|
+
type UnmetFields = {
|
|
30
|
+
readonly name: string;
|
|
31
|
+
readonly version: string;
|
|
32
|
+
readonly needs: string;
|
|
33
|
+
readonly range: string;
|
|
34
|
+
readonly actual: string;
|
|
35
|
+
};
|
|
36
|
+
type Conflict = Data.TaggedEnum<{
|
|
37
|
+
Unpublished: {
|
|
38
|
+
readonly name: string;
|
|
39
|
+
readonly version: string;
|
|
40
|
+
};
|
|
41
|
+
Unmet: UnmetFields;
|
|
42
|
+
}>;
|
|
43
|
+
declare const Conflict: Data.TaggedEnum.Constructor<{
|
|
44
|
+
readonly _tag: "Unmet";
|
|
45
|
+
readonly name: string;
|
|
46
|
+
readonly version: string;
|
|
47
|
+
readonly needs: string;
|
|
48
|
+
readonly range: string;
|
|
49
|
+
readonly actual: string;
|
|
50
|
+
} | {
|
|
51
|
+
readonly _tag: "Unpublished";
|
|
52
|
+
readonly name: string;
|
|
53
|
+
readonly version: string;
|
|
54
|
+
}>;
|
|
55
|
+
type Solution = {
|
|
56
|
+
readonly resolved: boolean;
|
|
57
|
+
readonly catalog: Catalog;
|
|
58
|
+
readonly latest: Readonly<Record<string, string>>;
|
|
59
|
+
readonly blockers: Readonly<Record<string, string>>;
|
|
60
|
+
readonly conflicts: ReadonlyArray<Conflict>;
|
|
61
|
+
};
|
|
62
|
+
declare const latestOf: {
|
|
63
|
+
(family: Family): (registry: Packuments) => Option.Option<string>;
|
|
64
|
+
(registry: Packuments, family: Family): Option.Option<string>;
|
|
65
|
+
};
|
|
66
|
+
declare const otherTags: {
|
|
67
|
+
(family: Family): (registry: Packuments) => ReadonlyArray<readonly [string, string]>;
|
|
68
|
+
(registry: Packuments, family: Family): ReadonlyArray<readonly [string, string]>;
|
|
69
|
+
};
|
|
70
|
+
declare const aliasTarget: (alias: string) => Option.Option<readonly [string, string]>;
|
|
71
|
+
declare const fixedRange: {
|
|
72
|
+
(family: Family, name: string): (registry: Packuments) => Option.Option<string>;
|
|
73
|
+
(registry: Packuments, family: Family, name: string): Option.Option<string>;
|
|
74
|
+
};
|
|
75
|
+
declare const conflicts: {
|
|
76
|
+
(registry: Packuments): (current: Catalog) => ReadonlyArray<Conflict>;
|
|
77
|
+
(current: Catalog, registry: Packuments): ReadonlyArray<Conflict>;
|
|
78
|
+
};
|
|
79
|
+
declare const onLatestLine: {
|
|
80
|
+
(latest: string): (version: string) => boolean;
|
|
81
|
+
(version: string, latest: string): boolean;
|
|
82
|
+
};
|
|
83
|
+
declare const describeConflict: {
|
|
84
|
+
(current: Catalog): (conflict: Conflict) => string;
|
|
85
|
+
(conflict: Conflict, current: Catalog): string;
|
|
86
|
+
};
|
|
87
|
+
declare const solve: {
|
|
88
|
+
(start?: Catalog): (registry: Packuments) => Solution;
|
|
89
|
+
(registry: Packuments, start?: Catalog): Solution;
|
|
90
|
+
};
|
|
91
|
+
export { VersionManifest as a, describeConflict as c, onLatestLine as d, otherTags as f, Solution as i, fixedRange as l, Packument as n, aliasTarget as o, solve as p, Packuments as r, conflicts as s, Conflict as t, latestOf as u };
|
package/dist/compatible.d.mts
CHANGED
|
@@ -1,91 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import * as Option from "effect/Option";
|
|
4
|
-
import * as Schema from "effect/Schema";
|
|
5
|
-
export declare const VersionManifest: Schema.Struct<{
|
|
6
|
-
readonly dependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
7
|
-
readonly peerDependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
8
|
-
readonly bundledVersions: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
9
|
-
}>;
|
|
10
|
-
export type VersionManifest = typeof VersionManifest.Type;
|
|
11
|
-
export declare const Packument: Schema.Struct<{
|
|
12
|
-
readonly "dist-tags": Schema.$Record<Schema.String, Schema.String>;
|
|
13
|
-
readonly versions: Schema.$Record<Schema.String, Schema.Struct<{
|
|
14
|
-
readonly dependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
15
|
-
readonly peerDependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
16
|
-
readonly bundledVersions: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
17
|
-
}>>;
|
|
18
|
-
}>;
|
|
19
|
-
export type Packument = typeof Packument.Type;
|
|
20
|
-
export declare const Packuments: Schema.$Record<Schema.String, Schema.Struct<{
|
|
21
|
-
readonly "dist-tags": Schema.$Record<Schema.String, Schema.String>;
|
|
22
|
-
readonly versions: Schema.$Record<Schema.String, Schema.Struct<{
|
|
23
|
-
readonly dependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
24
|
-
readonly peerDependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
25
|
-
readonly bundledVersions: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
26
|
-
}>>;
|
|
27
|
-
}>>;
|
|
28
|
-
export type Packuments = typeof Packuments.Type;
|
|
29
|
-
type UnmetFields = {
|
|
30
|
-
readonly name: string;
|
|
31
|
-
readonly version: string;
|
|
32
|
-
readonly needs: string;
|
|
33
|
-
readonly range: string;
|
|
34
|
-
readonly actual: string;
|
|
35
|
-
};
|
|
36
|
-
export type Conflict = Data.TaggedEnum<{
|
|
37
|
-
Unpublished: {
|
|
38
|
-
readonly name: string;
|
|
39
|
-
readonly version: string;
|
|
40
|
-
};
|
|
41
|
-
Unmet: UnmetFields;
|
|
42
|
-
}>;
|
|
43
|
-
export declare const Conflict: Data.TaggedEnum.Constructor<{
|
|
44
|
-
readonly _tag: "Unmet";
|
|
45
|
-
readonly name: string;
|
|
46
|
-
readonly version: string;
|
|
47
|
-
readonly needs: string;
|
|
48
|
-
readonly range: string;
|
|
49
|
-
readonly actual: string;
|
|
50
|
-
} | {
|
|
51
|
-
readonly _tag: "Unpublished";
|
|
52
|
-
readonly name: string;
|
|
53
|
-
readonly version: string;
|
|
54
|
-
}>;
|
|
55
|
-
export type Solution = {
|
|
56
|
-
readonly resolved: boolean;
|
|
57
|
-
readonly catalog: Catalog;
|
|
58
|
-
readonly latest: Readonly<Record<string, string>>;
|
|
59
|
-
readonly blockers: Readonly<Record<string, string>>;
|
|
60
|
-
readonly conflicts: ReadonlyArray<Conflict>;
|
|
61
|
-
};
|
|
62
|
-
export declare const latestOf: {
|
|
63
|
-
(family: Family): (registry: Packuments) => Option.Option<string>;
|
|
64
|
-
(registry: Packuments, family: Family): Option.Option<string>;
|
|
65
|
-
};
|
|
66
|
-
export declare const otherTags: {
|
|
67
|
-
(family: Family): (registry: Packuments) => ReadonlyArray<readonly [string, string]>;
|
|
68
|
-
(registry: Packuments, family: Family): ReadonlyArray<readonly [string, string]>;
|
|
69
|
-
};
|
|
70
|
-
export declare const aliasTarget: (alias: string) => Option.Option<readonly [string, string]>;
|
|
71
|
-
export declare const fixedRange: {
|
|
72
|
-
(family: Family, name: string): (registry: Packuments) => Option.Option<string>;
|
|
73
|
-
(registry: Packuments, family: Family, name: string): Option.Option<string>;
|
|
74
|
-
};
|
|
75
|
-
export declare const conflicts: {
|
|
76
|
-
(registry: Packuments): (current: Catalog) => ReadonlyArray<Conflict>;
|
|
77
|
-
(current: Catalog, registry: Packuments): ReadonlyArray<Conflict>;
|
|
78
|
-
};
|
|
79
|
-
export declare const onLatestLine: {
|
|
80
|
-
(latest: string): (version: string) => boolean;
|
|
81
|
-
(version: string, latest: string): boolean;
|
|
82
|
-
};
|
|
83
|
-
export declare const describeConflict: {
|
|
84
|
-
(current: Catalog): (conflict: Conflict) => string;
|
|
85
|
-
(conflict: Conflict, current: Catalog): string;
|
|
86
|
-
};
|
|
87
|
-
export declare const solve: {
|
|
88
|
-
(start?: Catalog): (registry: Packuments) => Solution;
|
|
89
|
-
(registry: Packuments, start?: Catalog): Solution;
|
|
90
|
-
};
|
|
91
|
-
export {};
|
|
1
|
+
import { a as VersionManifest, c as describeConflict, d as onLatestLine, f as otherTags, i as Solution, l as fixedRange, n as Packument, o as aliasTarget, p as solve, r as Packuments, s as conflicts, t as Conflict, u as latestOf } from "./compatible-n7uFGrI3.mjs";
|
|
2
|
+
export { Conflict, Packument, Packuments, Solution, VersionManifest, aliasTarget, conflicts, describeConflict, fixedRange, latestOf, onLatestLine, otherTags, solve };
|
package/dist/compatible.mjs
CHANGED
|
@@ -1,160 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import * as Arr from "effect/Array";
|
|
3
|
-
import * as Data from "effect/Data";
|
|
4
|
-
import { dual } from "effect/Function";
|
|
5
|
-
import * as HashSet from "effect/HashSet";
|
|
6
|
-
import * as Match from "effect/Match";
|
|
7
|
-
import * as Option from "effect/Option";
|
|
8
|
-
import * as R from "effect/Record";
|
|
9
|
-
import * as Schema from "effect/Schema";
|
|
10
|
-
import * as Str from "effect/String";
|
|
11
|
-
import semver from "semver";
|
|
12
|
-
// src/compatible.ts
|
|
13
|
-
const Ranges = Schema.optionalKey(Schema.Record(Schema.String, Schema.String));
|
|
14
|
-
const VersionManifest = Schema.Struct({
|
|
15
|
-
dependencies: Ranges,
|
|
16
|
-
peerDependencies: Ranges,
|
|
17
|
-
bundledVersions: Ranges
|
|
18
|
-
});
|
|
19
|
-
const Packument = Schema.Struct({
|
|
20
|
-
"dist-tags": Schema.Record(Schema.String, Schema.String),
|
|
21
|
-
versions: Schema.Record(Schema.String, VersionManifest)
|
|
22
|
-
});
|
|
23
|
-
const Packuments = Schema.Record(Schema.String, Packument);
|
|
24
|
-
const Conflict = Data.taggedEnum();
|
|
25
|
-
const ALIAS = /^npm:(?<target>(?:@[^/@]+\/)?[^@]+)@(?<version>.+)$/u;
|
|
26
|
-
const manifestOf = (registry, name, version) => Option.flatMap(R.get(registry, name), (packument) => R.get(packument.versions, version));
|
|
27
|
-
const latestOf = dual(2, (registry, family) => Option.flatMap(R.get(registry, lead(family)), (packument) => R.get(packument["dist-tags"], "latest")));
|
|
28
|
-
const otherTags = dual(2, (registry, family) => Arr.flatMap(family.packages, (name) => Option.match(R.get(registry, name), {
|
|
29
|
-
onNone: () => [],
|
|
30
|
-
onSome: (packument) => Arr.filter(R.toEntries(packument["dist-tags"]), ([tag]) => tag !== "latest")
|
|
31
|
-
})));
|
|
32
|
-
const aliasTarget = (alias) => Option.flatMap(Option.fromNullishOr(ALIAS.exec(alias)?.groups), (groups) => Option.all([Option.fromNullishOr(groups.target), Option.fromNullishOr(groups.version)]));
|
|
33
|
-
const fixedRange = dual(3, (registry, family, name) => Option.flatMap(manifestOf(registry, lead(family), family.version), ({ dependencies = {} }) => R.get(dependencies, name)));
|
|
34
|
-
const anchored = (start, name) => Option.exists(ownerOf(name, start), (owner) => Arr.isReadonlyArrayNonEmpty(fixedBy(owner.name, start)));
|
|
35
|
-
const requirements = (start, name, manifest) => {
|
|
36
|
-
const { dependencies = {}, peerDependencies = {} } = manifest;
|
|
37
|
-
return [...anchored(start, name) ? R.toEntries(dependencies) : [], ...R.toEntries(peerDependencies)];
|
|
38
|
-
};
|
|
39
|
-
const holds = (registry, needs, actual, range) => Option.match(aliasTarget(actual), {
|
|
40
|
-
onNone: () => semver.validRange(range) !== null && semver.satisfies(actual, Str.replace(/^=/u, "")(range)),
|
|
41
|
-
onSome: ([target, version]) => range === actual || Option.exists(Option.flatMap(manifestOf(registry, target, version), ({ bundledVersions = {} }) => R.get(bundledVersions, needs)), (bundled) => semver.satisfies(bundled, range))
|
|
42
|
-
});
|
|
43
|
-
const conflictsForManifest = (registry, start, lookup, family, name, manifest) => Arr.flatMap(requirements(start, name, manifest), ([needs, range]) => Option.match(lookup(needs), {
|
|
44
|
-
onNone: () => [],
|
|
45
|
-
onSome: (actual) => holds(registry, needs, actual, range) ? [] : [Conflict.Unmet({
|
|
46
|
-
name,
|
|
47
|
-
version: family.version,
|
|
48
|
-
needs,
|
|
49
|
-
range,
|
|
50
|
-
actual
|
|
51
|
-
})]
|
|
52
|
-
}));
|
|
53
|
-
const memberConflicts = (registry, start, lookup, family, name) => Option.match(manifestOf(registry, name, family.version), {
|
|
54
|
-
onNone: () => R.has(registry, name) ? [Conflict.Unpublished({
|
|
55
|
-
name,
|
|
56
|
-
version: family.version
|
|
57
|
-
})] : [],
|
|
58
|
-
onSome: (manifest) => conflictsForManifest(registry, start, lookup, family, name, manifest)
|
|
59
|
-
});
|
|
60
|
-
const conflictsAmong = (registry, start, picked, lookup) => Arr.flatMap(picked, (family) => Arr.flatMap(family.packages, (name) => memberConflicts(registry, start, lookup, family, name)));
|
|
61
|
-
const conflicts = dual(2, (current, registry) => conflictsAmong(registry, current, current.families, (name) => versionOf(name, current)));
|
|
62
|
-
const fixedVersion = (registry, family, entry) => Option.match(fixedRange(registry, family, entry.name), {
|
|
63
|
-
onNone: () => entry,
|
|
64
|
-
onSome: (range) => ({
|
|
65
|
-
...entry,
|
|
66
|
-
version: Str.replace(/^=/u, "")(range)
|
|
67
|
-
})
|
|
68
|
-
});
|
|
69
|
-
const onLatestLine = dual(2, (version, latest) => semver.lte(version, latest) && (semver.prerelease(latest) !== null || semver.prerelease(version) === null));
|
|
70
|
-
const published = (registry, family) => Option.match(R.get(registry, lead(family)), {
|
|
71
|
-
onNone: () => [],
|
|
72
|
-
onSome: (packument) => R.keys(packument.versions)
|
|
73
|
-
});
|
|
74
|
-
const rises = (family, latest, tagged, version) => semver.valid(version) !== null && semver.gt(version, family.version) && onLatestLine(version, latest) && (version === latest || !HashSet.has(tagged, version));
|
|
75
|
-
const ladder = (registry, family) => {
|
|
76
|
-
const tagged = HashSet.fromIterable(Arr.map(otherTags(registry, family), ([, version]) => version));
|
|
77
|
-
const above = Option.match(latestOf(registry, family), {
|
|
78
|
-
onNone: () => [],
|
|
79
|
-
onSome: (latest) => Arr.filter(published(registry, family), (version) => rises(family, latest, tagged, version) && Arr.every(family.packages, (name) => !R.has(registry, name) || Option.isSome(manifestOf(registry, name, version))))
|
|
80
|
-
});
|
|
81
|
-
return [...Arr.sort(above, semver.rcompare), family.version];
|
|
82
|
-
};
|
|
83
|
-
const assemble = (registry, start, picked) => ({
|
|
84
|
-
families: picked,
|
|
85
|
-
fixed: Arr.flatMap(start.fixed, (entry) => Arr.fromOption(Option.map(familyNamed(entry.by, {
|
|
86
|
-
...start,
|
|
87
|
-
families: picked
|
|
88
|
-
}), (family) => fixedVersion(registry, family, entry))))
|
|
89
|
-
});
|
|
90
|
-
const pickedVersion = (registry, start, picked, name) => {
|
|
91
|
-
const owner = ownerOf(name, start);
|
|
92
|
-
if (Option.isNone(owner)) return Option.none();
|
|
93
|
-
const chosen = familyNamed(owner.value.name, {
|
|
94
|
-
...start,
|
|
95
|
-
families: picked
|
|
96
|
-
});
|
|
97
|
-
if (Option.isNone(chosen)) return Option.none();
|
|
98
|
-
if (Option.isSome(familyOf(name, start))) return Option.some(chosen.value.version);
|
|
99
|
-
return Option.map(fixedOf(name, start), (entry) => fixedVersion(registry, chosen.value, entry).version);
|
|
100
|
-
};
|
|
101
|
-
const search = (registry, start, rungs, picked) => Arr.matchLeft(rungs, {
|
|
102
|
-
onEmpty: () => Option.some(picked),
|
|
103
|
-
onNonEmpty: ([family, versions], rest) => Arr.findFirst(versions, (version) => {
|
|
104
|
-
const next = [...picked, {
|
|
105
|
-
...family,
|
|
106
|
-
version
|
|
107
|
-
}];
|
|
108
|
-
return Arr.isReadonlyArrayEmpty(conflictsAmong(registry, start, next, (name) => pickedVersion(registry, start, next, name))) ? search(registry, start, rest, next) : Option.none();
|
|
109
|
-
})
|
|
110
|
-
});
|
|
111
|
-
const describeConflict = dual(2, (conflict, current) => Match.value(conflict).pipe(Match.tag("Unpublished", ({ name, version }) => `${name} ${version} is not published`), Match.tag("Unmet", ({ name, version, needs, range, actual }) => {
|
|
112
|
-
return `${name} ${version} needs ${needs} ${range}, and the set has ${needs} ${actual}${Option.match(fixedOf(needs, current), {
|
|
113
|
-
onNone: () => "",
|
|
114
|
-
onSome: (entry) => `, which ${entry.by} fixes`
|
|
115
|
-
})}`;
|
|
116
|
-
}), Match.exhaustive));
|
|
117
|
-
const involves = (conflict, family, current) => family.packages.includes(conflict.name) || Match.value(conflict).pipe(Match.tag("Unmet", ({ needs }) => Option.exists(ownerOf(needs, current), (owner) => owner.name === family.name)), Match.orElse(() => false));
|
|
118
|
-
const familyBlocker = (registry, solved, family, latest) => {
|
|
119
|
-
const families = Arr.map(solved.families, (entry) => entry.name === family.name ? {
|
|
120
|
-
...entry,
|
|
121
|
-
version: latest
|
|
122
|
-
} : entry);
|
|
123
|
-
const trial = assemble(registry, solved, families);
|
|
124
|
-
const relevant = Arr.filter(conflicts(trial, registry), (conflict) => involves(conflict, family, trial));
|
|
125
|
-
return Arr.match(relevant, {
|
|
126
|
-
onEmpty: () => {
|
|
127
|
-
if (ladder(registry, family).includes(latest)) return `no compatible set includes ${family.name} ${latest}`;
|
|
128
|
-
return `${family.name} ${latest} is below the catalog or not published for every package in its family`;
|
|
129
|
-
},
|
|
130
|
-
onNonEmpty: ([first]) => describeConflict(first, trial)
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
const blockersOf = (registry, solved, latest) => R.fromEntries(Arr.flatMap(solved.families, (family) => Option.match(R.get(latest, family.name), {
|
|
134
|
-
onNone: () => [],
|
|
135
|
-
onSome: (version) => version === family.version ? [] : [[family.name, familyBlocker(registry, solved, family, version)]]
|
|
136
|
-
})));
|
|
137
|
-
const solve = dual((args) => Schema.is(Packuments)(args[0]), (registry, start = catalog) => {
|
|
138
|
-
const latest = R.fromEntries(Arr.flatMap(start.families, (family) => Arr.fromOption(Option.map(latestOf(registry, family), (version) => [family.name, version]))));
|
|
139
|
-
const rungs = Arr.map(start.families, (family) => [family, ladder(registry, family)]);
|
|
140
|
-
return Option.match(search(registry, start, rungs, []), {
|
|
141
|
-
onNone: () => ({
|
|
142
|
-
resolved: false,
|
|
143
|
-
catalog: start,
|
|
144
|
-
latest,
|
|
145
|
-
blockers: {},
|
|
146
|
-
conflicts: conflicts(start, registry)
|
|
147
|
-
}),
|
|
148
|
-
onSome: (picked) => {
|
|
149
|
-
const solved = assemble(registry, start, picked);
|
|
150
|
-
return {
|
|
151
|
-
resolved: true,
|
|
152
|
-
catalog: solved,
|
|
153
|
-
latest,
|
|
154
|
-
blockers: blockersOf(registry, solved, latest),
|
|
155
|
-
conflicts: []
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
export { Conflict, Packument, Packuments, VersionManifest, aliasTarget, conflicts, describeConflict, fixedRange, latestOf, onLatestLine, otherTags, solve };
|
|
1
|
+
export { t as Conflict, n as Packument, r as Packuments, i as VersionManifest, a as aliasTarget, o as conflicts, s as describeConflict, c as fixedRange, l as latestOf, u as onLatestLine, d as otherTags, f as solve } from "./compatible-D8n_sQHa.mjs";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as Arr from "effect/Array";
|
|
2
|
+
import * as R from "effect/Record";
|
|
3
|
+
import { presets } from "@effect/tsgo/oxlint-presets";
|
|
4
|
+
import * as Order from "effect/Order";
|
|
5
|
+
import * as Struct from "effect/Struct";
|
|
6
|
+
// src/effect-tsgo.ts
|
|
7
|
+
const patchCommand = "effect-tsgo patch --oxlint";
|
|
8
|
+
const effectTsgoPlugin = "effecttsgo";
|
|
9
|
+
const beyondRecommended = [
|
|
10
|
+
"effecttsgo/crypto-random-uuid-in-effect",
|
|
11
|
+
"effecttsgo/effect-try-without-catch",
|
|
12
|
+
"effecttsgo/global-date-in-effect",
|
|
13
|
+
"effecttsgo/global-fetch-in-effect",
|
|
14
|
+
"effecttsgo/global-json-in-effect",
|
|
15
|
+
"effecttsgo/global-random-in-effect",
|
|
16
|
+
"effecttsgo/global-timers-in-effect",
|
|
17
|
+
"effecttsgo/missing-effect-service-dependency",
|
|
18
|
+
"effecttsgo/unsafe-effect-type-assertion"
|
|
19
|
+
];
|
|
20
|
+
const disabledRecommendedTsgoRules = [
|
|
21
|
+
"effecttsgo/schema-number",
|
|
22
|
+
"effecttsgo/return-effect-in-gen",
|
|
23
|
+
"effecttsgo/layer-merge-all-with-dependencies"
|
|
24
|
+
];
|
|
25
|
+
const enforcedTsgoRules = Arr.sort(Arr.dedupe([...Arr.filter(Struct.keys(presets.recommended.rules ?? {}), (rule) => !disabledRecommendedTsgoRules.includes(rule)), ...beyondRecommended]), Order.String);
|
|
26
|
+
const effectTsgoRules = R.fromEntries([...Arr.map(enforcedTsgoRules, (rule) => [rule, "error"]), ...Arr.map(disabledRecommendedTsgoRules, (rule) => [rule, "off"])]);
|
|
27
|
+
export { patchCommand as a, enforcedTsgoRules as i, effectTsgoPlugin as n, effectTsgoRules as r, disabledRecommendedTsgoRules as t };
|
package/dist/effect-tsgo.mjs
CHANGED
|
@@ -1,27 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import * as R from "effect/Record";
|
|
3
|
-
import { presets } from "@effect/tsgo/oxlint-presets";
|
|
4
|
-
import * as Order from "effect/Order";
|
|
5
|
-
import * as Struct from "effect/Struct";
|
|
6
|
-
// src/effect-tsgo.ts
|
|
7
|
-
const patchCommand = "effect-tsgo patch --oxlint";
|
|
8
|
-
const effectTsgoPlugin = "effecttsgo";
|
|
9
|
-
const beyondRecommended = [
|
|
10
|
-
"effecttsgo/crypto-random-uuid-in-effect",
|
|
11
|
-
"effecttsgo/effect-try-without-catch",
|
|
12
|
-
"effecttsgo/global-date-in-effect",
|
|
13
|
-
"effecttsgo/global-fetch-in-effect",
|
|
14
|
-
"effecttsgo/global-json-in-effect",
|
|
15
|
-
"effecttsgo/global-random-in-effect",
|
|
16
|
-
"effecttsgo/global-timers-in-effect",
|
|
17
|
-
"effecttsgo/missing-effect-service-dependency",
|
|
18
|
-
"effecttsgo/unsafe-effect-type-assertion"
|
|
19
|
-
];
|
|
20
|
-
const disabledRecommendedTsgoRules = [
|
|
21
|
-
"effecttsgo/schema-number",
|
|
22
|
-
"effecttsgo/return-effect-in-gen",
|
|
23
|
-
"effecttsgo/layer-merge-all-with-dependencies"
|
|
24
|
-
];
|
|
25
|
-
const enforcedTsgoRules = Arr.sort(Arr.dedupe([...Arr.filter(Struct.keys(presets.recommended.rules ?? {}), (rule) => !disabledRecommendedTsgoRules.includes(rule)), ...beyondRecommended]), Order.String);
|
|
26
|
-
const effectTsgoRules = R.fromEntries([...Arr.map(enforcedTsgoRules, (rule) => [rule, "error"]), ...Arr.map(disabledRecommendedTsgoRules, (rule) => [rule, "off"])]);
|
|
27
|
-
export { disabledRecommendedTsgoRules, effectTsgoPlugin, effectTsgoRules, enforcedTsgoRules, patchCommand };
|
|
1
|
+
export { t as disabledRecommendedTsgoRules, n as effectTsgoPlugin, r as effectTsgoRules, i as enforcedTsgoRules, a as patchCommand } from "./effect-tsgo-D0QfeKGD.mjs";
|
package/dist/exceptions.d.mts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
readonly rules: ReadonlyArray<string>;
|
|
4
|
-
readonly issue: string;
|
|
5
|
-
};
|
|
6
|
-
export declare const exceptions: ReadonlyArray<Exception>;
|
|
1
|
+
import { n as exceptions, t as Exception } from "./exceptions-LNZ022dl.mjs";
|
|
2
|
+
export { Exception, exceptions };
|
package/dist/exceptions.mjs
CHANGED
package/dist/guard.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Packuments } from "./compatible.mjs";
|
|
2
|
-
import { Exception } from "./exceptions.mjs";
|
|
3
|
-
import { Catalog } from "./versions.mjs";
|
|
1
|
+
import { r as Packuments } from "./compatible-n7uFGrI3.mjs";
|
|
2
|
+
import { t as Exception } from "./exceptions-LNZ022dl.mjs";
|
|
3
|
+
import { t as Catalog } from "./versions-D02TrtKw.mjs";
|
|
4
4
|
import { OxlintConfig } from "vite-plus/lint";
|
|
5
5
|
type Ranges = Readonly<Record<string, string>>;
|
|
6
6
|
export declare const manifestRanges: (text: string) => ReadonlyArray<readonly [string, Ranges]>;
|
package/dist/guard.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { latestOf, onLatestLine
|
|
2
|
-
import { enforcedTsgoRules } from "./effect-tsgo.mjs";
|
|
3
|
-
import { exceptions } from "./exceptions.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { lead, versionOf } from "./versions.mjs";
|
|
1
|
+
import { d as otherTags, l as latestOf, u as onLatestLine } from "./compatible-D8n_sQHa.mjs";
|
|
2
|
+
import { i as enforcedTsgoRules } from "./effect-tsgo-D0QfeKGD.mjs";
|
|
3
|
+
import { t as exceptions } from "./exceptions-Bq-9MxoR.mjs";
|
|
4
|
+
import { a as toolchainScopes, n as effectRules, r as foldkitPreset, t as birbprophetRules } from "./lint-JSnPsGO1.mjs";
|
|
5
|
+
import { c as lead, f as versionOf } from "./versions-C7LKZGr3.mjs";
|
|
6
6
|
import * as Arr from "effect/Array";
|
|
7
7
|
import { dual } from "effect/Function";
|
|
8
8
|
import * as HashSet from "effect/HashSet";
|